MCPcopy Create free account
hub / github.com/AOMediaCodec/libavif / avmScaleQuantizer

Function avmScaleQuantizer

src/codec_avm.c:406–416  ·  view source on GitHub ↗

Scales from aom's [0:63] to avm's [M:255], where M=0/-48/-96 for 8/10/12 bit. See --min-qp help in https://gitlab.com/AOMediaCodec/avm/-/blob/main/apps/avmenc.c

Source from the content-addressed store, hash-verified

404// See --min-qp help in
405// https://gitlab.com/AOMediaCodec/avm/-/blob/main/apps/avmenc.c
406static int avmScaleQuantizer(int quantizer, uint32_t depth)
407{
408 if (depth == 10) {
409 return AVIF_CLAMP((quantizer * (255 + 48) + 31) / 63 - 48, -48, 255);
410 }
411 if (depth == 12) {
412 return AVIF_CLAMP((quantizer * (255 + 96) + 31) / 63 - 96, -96, 255);
413 }
414 assert(depth == 8);
415 return AVIF_CLAMP((quantizer * 255 + 31) / 63, 0, 255);
416}
417
418// Converts quality to avm's quantizer in the range of [M:255], where M=0/-48/-96 for 8/10/12 bit.
419// See --min-qp help in

Callers 1

avmCodecEncodeImageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected