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

Function avifAOMOptionsContainExplicitTuning

src/codec_aom.c:401–424  ·  view source on GitHub ↗

Returns true if codec-specific options for AOM contain a tune metric setting. Returns false otherwise. Sets *useTuneIq to true if codec-specific options for AOM contain AOM_TUNE_IQ. Otherwise sets *useTuneIq to false.

Source from the content-addressed store, hash-verified

399// Returns true if codec-specific options for AOM contain a tune metric setting. Returns false otherwise.
400// Sets *useTuneIq to true if codec-specific options for AOM contain AOM_TUNE_IQ. Otherwise sets *useTuneIq to false.
401static avifBool avifAOMOptionsContainExplicitTuning(const avifCodec * codec, avifBool alpha, avifBool * useTuneIq)
402{
403 *useTuneIq = AVIF_FALSE;
404 avifBool isAnyTuneDefined = AVIF_FALSE;
405
406 // If there are multiple "tune" options specified, honor the last one.
407 // For consistent behavior, handle both cases where tune was either specified as a string (e.g. tune=iq),
408 // or as an enum value (e.g. tune=10).
409 for (uint32_t i = 0; i < codec->csOptions->count; ++i) {
410 const avifCodecSpecificOption * entry = &codec->csOptions->entries[i];
411 if (avifKeyEqualsName(entry->key, "tune", alpha)) {
412 isAnyTuneDefined = AVIF_TRUE;
413
414 int val;
415 if (aomOptionParseEnum(entry->value, tuneIqEnum, &val)) {
416 assert(val == AOM_TUNE_IQ);
417 *useTuneIq = AVIF_TRUE;
418 } else {
419 *useTuneIq = AVIF_FALSE;
420 }
421 }
422 }
423 return isAnyTuneDefined;
424}
425
426static avifBool avifProcessAOMOptionsPreInit(avifCodec * codec, avifBool alpha, struct aom_codec_enc_cfg * cfg)
427{

Callers 1

aomCodecEncodeImageFunction · 0.85

Calls 2

aomOptionParseEnumFunction · 0.85
avifKeyEqualsNameFunction · 0.70

Tested by

no test coverage detected