diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2023-10-17 19:31:37 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2023-11-20 00:19:25 +0100 |
commit | 6364fa9e9a4b5712d817ae307d9ae07e149e2f79 (patch) | |
tree | 09190ada8f17cc882b4d2743f5a8b2fba5a49b81 /libavcodec/h264_refs.c | |
parent | 29f6c9b04d37305ec7b19cefdd4e4c71b1bdfe78 (diff) | |
download | ffmpeg-6364fa9e9a4b5712d817ae307d9ae07e149e2f79.tar.gz |
avcodec/h264: Avoid using gray gap frames as references
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/h264_refs.c')
-rw-r--r-- | libavcodec/h264_refs.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index 92778e737a..9bc7b20988 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -410,6 +410,17 @@ int ff_h264_build_ref_list(H264Context *h, H264SliceContext *sl) else return -1; } + if (h->noref_gray>0 && sl->ref_list[list][index].parent->gray && h->non_gray) { + for (int j=0; j<sl->list_count; j++) { + int list2 = (list+j)&1; + if (h->default_ref[list2].parent && !h->default_ref[list2].parent->gray + && !(!FIELD_PICTURE(h) && (h->default_ref[list2].reference&3) != 3)) { + sl->ref_list[list][index] = h->default_ref[list2]; + av_log(h, AV_LOG_DEBUG, "replacement of gray gap frame\n"); + break; + } + } + } av_assert0(av_buffer_get_ref_count(sl->ref_list[list][index].parent->f->buf[0]) > 0); } } |