From 04e534159c2c9ced382d13a252cc9a2d27834160 Mon Sep 17 00:00:00 2001 From: Wan-Teh Chang Date: Mon, 1 Mar 2021 17:33:57 -0800 Subject: [PATCH] Disable key frame filtering when encoding images Disable key frame filtering when encoding still images. --- src/codec_aom.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/codec_aom.c b/src/codec_aom.c index 8990184ed1..1d23790746 100644 --- a/src/codec_aom.c +++ b/src/codec_aom.c @@ -591,6 +591,11 @@ static avifResult aomCodecEncodeImage(avifCodec * codec, if (aomCpuUsed != -1) { aom_codec_control(&codec->internal->encoder, AOME_SET_CPUUSED, aomCpuUsed); } + if (addImageFlags & AVIF_ADD_IMAGE_FLAG_SINGLE) { + // Disable temporal filtering on key frames, otherwise we will lose a good amount of compression + // performance. + aom_codec_control(&codec->internal->encoder, AV1E_SET_ENABLE_KEYFRAME_FILTERING, 0); + } if (!avifProcessAOMOptionsPostInit(codec)) { return AVIF_RESULT_INVALID_CODEC_SPECIFIC_OPTION; }