diff mbox series

[FFmpeg-devel] lavc/vp9: set update_map to 0 when segmentation.enabled is 0

Message ID CZHCF9QL07FJ.3VOACXA14QCVF@yukari.in
State New
Headers show
Series [FFmpeg-devel] lavc/vp9: set update_map to 0 when segmentation.enabled is 0 | 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

llyyr Feb. 29, 2024, 5:58 a.m. UTC
segmentation.update_map is never reset to 0 on a new frame, and retains
the value from the previous frame. This bugs out a bunch of hwaccel
drivers when segmentation.enabled is 0 but update_map isn't because
they don't ignore values behind switches. We also do this for vp8* so
this commit is just mirroring the vp8 logic.

This fixes an issue with certain samples** that causes blocky
artifacts with vaapi and d3d11va (as far as known hwaccel drivers go).
Mesa worked around*** this by ignoring this field if
segmentation.enabled is 0, but d3d11va still doesn't work.

* https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/HEAD:/libavcodec/vp8.c#l811
** https://github.com/mpv-player/mpv/issues/13533
*** https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27816

Signed-off-by: llyyr <llyyr@yukari.in>
---
 libavcodec/vp9.c | 2 ++
 1 file changed, 2 insertions(+)


base-commit: d263fce2b209e86a5a1e8f1b6aa33430ecc2c187
diff mbox series

Patch

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 855936cdc1c7..4a628625131e 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -717,6 +717,8 @@  static int decode_frame_header(AVCodecContext *avctx,
                 s->s.h.segmentation.feat[i].skip_enabled = get_bits1(&s->gb);
             }
         }
+    } else {
+        s->s.h.segmentation.update_map = 0;
     }
 
     // set qmul[] based on Y/UV, AC/DC and segmentation Q idx deltas