diff mbox series

[FFmpeg-devel] avcodec/amfenc: Fix inverted loop filter option

Message ID 20240914053407.142-1-aicommander@gmail.com
State New
Headers show
Series [FFmpeg-devel] avcodec/amfenc: Fix inverted loop filter option | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Cameron Gutman Sept. 14, 2024, 5:32 a.m. UTC
The AMF HEVC encoder takes a bool option for whether deblocking filter
should be _disabled_ instead of whether it should _enabled_ like the
AMF H.264 encoder does. The logic was accidentally copied from H.264 to
HEVC without negating the bool value, so the deblocking filter was
actually disabled when AV_CODEC_FLAG_LOOP_FILTER was set.

Before this patch:
------------------
no flags set => deblocking filter on
flags +loop  => deblocking filter off
flags -loop  => deblocking filter on

After this patch:
-----------------
no flags set => deblocking filter on
flags +loop  => deblocking filter on
flags -loop  => deblocking filter off

Signed-off-by: Cameron Gutman <aicommander@gmail.com>
---
 libavcodec/amfenc_hevc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Dmitrii Ovchinnikov Sept. 28, 2024, 2:04 p.m. UTC | #1
Thanks for the fix. Merged.
Cameron Gutman Sept. 28, 2024, 9:16 p.m. UTC | #2
On Sat, Sep 28, 2024 at 9:04 AM Dmitrii Ovchinnikov
<ovchinnikov.dmitrii@gmail.com> wrote:
>
> Thanks for the fix. Merged.

Thanks Dmitrii, can you cherry-pick this bugfix and the fix for
supported HEVC color ranges to release/7.1 (if you agree they are
suitable for backporting)?
diff mbox series

Patch

diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
index 71e7d8aa61..7b4b2f722d 100644
--- a/libavcodec/amfenc_hevc.c
+++ b/libavcodec/amfenc_hevc.c
@@ -269,7 +269,7 @@  FF_ENABLE_DEPRECATION_WARNINGS
     if (avctx->slices > 1) {
         AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_SLICES_PER_FRAME, avctx->slices);
     }
-    AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_DE_BLOCKING_FILTER_DISABLE, deblocking_filter);
+    AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_DE_BLOCKING_FILTER_DISABLE, !deblocking_filter);
 
     if (ctx->header_insertion_mode != -1) {
         AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_HEADER_INSERTION_MODE, ctx->header_insertion_mode);
@@ -511,6 +511,7 @@  static const FFCodecDefault defaults[] = {
     { "slices",     "1"   },
     { "qmin",       "-1"  },
     { "qmax",       "-1"  },
+    { "flags",      "+loop"},
     { NULL                },
 };
 static const AVClass hevc_amf_class = {