xiph / rav1e

The fastest and safest AV1 encoder.
BSD 2-Clause "Simplified" License
3.69k stars 252 forks source link

Still image encoding is expensive #2750

Open kornelski opened 3 years ago

kornelski commented 3 years ago

Describe the bug Encoding of AV1 appears to be much more CPU-intensive than of other image formats at comparable compression ratios.

Using kodim08 as an example:

At speed 4 and below, rav1e beats WebP in file size and quality, but is an order of magnitude slower to encode. At speed 6, for this image, it's still much slower than cwebp, but generates a larger file with lower quality. At speed 10, the quality/filesize is comparable with MozJPEG, but twice as slow. The results vary depending on image and quality measurement algorithm, but the trend holds in general.

I've also compared to AOM using libavif example, and its encoding speed/quality is in the same ballpark as rav1e.

To Reproduce

cargo install cavif # 1.1.1
cargo install dssim --features=avif,webp # 3.1.0
time cavif --speed 1 --quality 57 -f kodim08.png -o kodim08.s1.avif
time cavif --speed 4 --quality 57 -f kodim08.png -o kodim08.s4.avif
time cavif --speed 6 --quality 57.4 -f kodim08.png -o kodim08.s6.avif
time cavif --speed 10 --quality 58.4 -f kodim08.png -o kodim08.s10.avif
time cwebp kodim08.png -o kodim08.webp
dssim kodim08.png kodim08.s*.avif kodim08.webp
ls -lS kodim08.*

Expected behavior I hoped the encoding would be faster. Have I used the encoder incorrectly? Am I missing some build setting? Is there a room for improvement in rav1e, or is this encoding cost typical for AV1?

Required Information Version: 0.5.0-alpha

kornelski commented 3 years ago

I've looked at existing detailed settings. I've been testing still images at quality comparable to JPEG q=80 (qualities normalized with DSSIM), so my conclusions may not apply to videos and low quality images.

My observations: