History

lavc/vp9: reset segmentation fields when segmentation isn't enabled

Fields under the segmentation switch are never reset on a new frame, and retain the value from the previous frame. This bugs out a bunch of hwaccel drivers when segmentation is disabled but update_map isn't reset because they don't ignore values behind switches. This commit also resets the temporal field, though it may not be required. We also do this for vp8 [1] so this commit is just mirroring the vp8 logic. This fixes an issue with certain samples [2] that causes blocky artifacts with vaapi, d3d11va and cuda (and possibly others). Mesa worked around [3] this by ignoring these fields if segmentation.enabled is 0, but d3d11va still displays blocky artifacts. [1] https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/2e877090f958131accb8c7e5ac10e5b9865d1735:/libavcodec/vp8.c#l797 [2] https://github.com/mpv-player/mpv/issues/13533 [3] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27816

llyyr committed 2 years ago

Commit 2b11a8b1 parent 01c7f681 file · +6 −0Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/vp9.c+6−0
@@ -709,6 +709,12 @@ static int decode_frame_header(AVCodecContext *avctx, · 708 unmodified lines
709709 s->s.h.segmentation.feat[i].skip_enabled = get_bits1(&s->gb);
710710 }
711711 }
712+ } else {
713+ // Reset fields under segmentation switch if segmentation is disabled.
714+ // This is necessary because some hwaccels don't ignore these fields
715+ // if segmentation is disabled.
716+ s->s.h.segmentation.temporal = 0;
717+ s->s.h.segmentation.update_map = 0;
712718 }
713719
714720 // set qmul[] based on Y/UV, AC/DC and segmentation Q idx deltas

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t