1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avcodec/h264: fix reference reordering

Fixes hardware decoders depending on long_term_pic_idx.
Relevant ITU conformance test vectors: MR6_BT_B, MR8_BT_B

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
This commit is contained in:
averne
2025-03-23 21:15:18 +01:00
committed by Zhao Zhili
parent 1e5c65f539
commit 02eda84bf2

View File

@ -337,7 +337,7 @@ int ff_h264_build_ref_list(H264Context *h, H264SliceContext *sl)
break;
}
if (i >= 0)
ref->pic_id = pred;
pic_id = pred;
break;
}
case 2: {
@ -354,7 +354,6 @@ int ff_h264_build_ref_list(H264Context *h, H264SliceContext *sl)
ref = h->long_ref[long_idx];
assert(!(ref && !ref->reference));
if (ref && (ref->reference & pic_structure)) {
ref->pic_id = pic_id;
assert(ref->long_ref);
i = 0;
} else {
@ -376,7 +375,7 @@ int ff_h264_build_ref_list(H264Context *h, H264SliceContext *sl)
for (i = index; i + 1 < sl->ref_count[list]; i++) {
if (sl->ref_list[list][i].parent &&
ref->long_ref == sl->ref_list[list][i].parent->long_ref &&
ref->pic_id == sl->ref_list[list][i].pic_id)
pic_id == sl->ref_list[list][i].pic_id)
break;
}
for (; i > index; i--) {