src/codec_aom.c has some code that sets the aom-specific cq-level option for the user if the user does not set -a cq-level=QP and -a end-usage=q. This depends on the endUsageSet and cqLevelSet booleans being set correctly.
I found that we neglect to set cqLevelSet if the aom library has the aom_codec_set_option() function. Since all recent versions of the aom library (v3.0.0 or later) have the aom_codec_set_option() function, this bug affects all recent versions of the aom library.
To reproduce this bug, run this command:
avifenc --min 0 --max 63 -a cq-level=18 -a tune=ssim happy_dog.jpg happy_dog.avif
src/codec_aom.c will set the cq-level option to (min + max) / 2 = (0 + 63) / 2 = 31, overriding the -a cq-level=18 option from the user.
Note that if -q end-usage=q is passed, then things work correctly:
avifenc --min 0 --max 63 -a end-usage=q -a cq-level=18 -a tune=ssim happy_dog.jpg happy_dog.avif
Note: Since src/codec_aom.c uses the aom library's all-intra mode for still image encoding, and -a end-usage=q is the default for the all-intra mode, it is tempting to omit the -a end-usage=q option. Until this bug is fixed, the -a end-usage=q option cannot be omitted.
src/codec_aom.c has some code that sets the aom-specific
cq-leveloption for the user if the user does not set-a cq-level=QPand-a end-usage=q. This depends on theendUsageSetandcqLevelSetbooleans being set correctly.I found that we neglect to set
cqLevelSetif the aom library has theaom_codec_set_option()function. Since all recent versions of the aom library (v3.0.0 or later) have theaom_codec_set_option()function, this bug affects all recent versions of the aom library.To reproduce this bug, run this command:
avifenc --min 0 --max 63 -a cq-level=18 -a tune=ssim happy_dog.jpg happy_dog.avifsrc/codec_aom.c will set the
cq-leveloption to (min + max) / 2 = (0 + 63) / 2 = 31, overriding the-a cq-level=18option from the user.Note that if -q end-usage=q is passed, then things work correctly:
avifenc --min 0 --max 63 -a end-usage=q -a cq-level=18 -a tune=ssim happy_dog.jpg happy_dog.avifNote: Since src/codec_aom.c uses the aom library's all-intra mode for still image encoding, and
-a end-usage=qis the default for the all-intra mode, it is tempting to omit the-a end-usage=qoption. Until this bug is fixed, the-a end-usage=qoption cannot be omitted.