AOMediaCodec / libavif

libavif - Library for encoding and decoding .avif files
Other
1.44k stars 187 forks source link

Set default encoder options for the libaom encoder #955

Open wantehchang opened 2 years ago

wantehchang commented 2 years ago

The current recommended avifenc command line to encode an image, say at quantize level 18, is very long (see https://web.dev/compress-images-avif/):

./avifenc --min 0 --max 63 -a end-usage=q -a cq-level=18 -a tune=ssim happy_dog.jpg happy_dog.avif

This bug tracks the changes to set the recommended libaom-specific encoder options by default, so that the avifenc command line is as simple as possible

Specifically, we are planning to make two changes.

  1. Set the libaom-specific options -a end-usage=q and -a tune=ssim by default, so that users can omit them in the avifenc command line.

Note that we may set other recommended libaom-specific options by default in the future. But we will start with these two options initially.

  1. Replace the --min and --max quantize levels with a single quantize level (e.g., --qp). Note that there will still be separate quantize levels for the color and alpha sub-images.

This change is more complicated for two reasons. First, if we want to provide backward compatibility, both --min + --max and --qp will need to be supported during the transitional period. Second. we are very interested in replacing the quantize level with a JPEG-style quality factor (e.g., -q)

joedrago commented 2 years ago

Has anyone on your team (or elsewhere) done any kind of mapping from a semi-linear "feeling" 1-100 quality number to a min/max QP pair? I like the idea of a single tunable number that feels like it consistently trades off size and quality as you tune the number, but I think the only way you're going to arrive at that mapping is with experiments/testing.

joedrago commented 2 years ago

Also it might have to that each codec layer does this mapping themselves, maybe? If we're going to do this, I'd like to have confidence that the whole range feels right/good before we release it.

wantehchang commented 2 years ago

The pull request https://github.com/AOMediaCodec/libavif/pull/950 sets -a end-usage=q by default (except when we are using libaom's real-time mode, in which case the pull request sets -a end-usage=cbr by default).