From d24dc74170e4bbabbf51b0e98ee8b130aaf04778 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Tue, 21 Dec 2021 10:55:58 -0500 Subject: [PATCH] v4l2codecs: h264: Fix dpb entry flag FLAG_FIELD The logic to guess back this value was broken. Use the value now saved into the picture instead. This was tested using LibreELEC patched 5.15 kernel, and fixed the interlaced decode issues. Part-of: --- subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codech264dec.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codech264dec.c b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codech264dec.c index f84981b..4ae13e0 100644 --- a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codech264dec.c +++ b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codech264dec.c @@ -609,8 +609,10 @@ gst_v4l2_codec_h264_dec_fill_decoder_params (GstV4l2CodecH264Dec * self, .pic_num = pic_num, .flags = V4L2_H264_DPB_ENTRY_FLAG_VALID | (GST_H264_PICTURE_IS_REF (ref_pic) ? V4L2_H264_DPB_ENTRY_FLAG_ACTIVE : 0) - | (GST_H264_PICTURE_IS_LONG_TERM_REF (ref_pic) ? V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM : 0), + | (GST_H264_PICTURE_IS_LONG_TERM_REF (ref_pic) ? V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM : 0) + | (ref_pic->field_pic_flag ? V4L2_H264_DPB_ENTRY_FLAG_FIELD : 0), }; + /* *INDENT-ON* */ switch (ref_pic->field) { case GST_H264_PICTURE_FIELD_FRAME: @@ -626,8 +628,6 @@ gst_v4l2_codec_h264_dec_fill_decoder_params (GstV4l2CodecH264Dec * self, entry->bottom_field_order_cnt = ref_pic->other_field->bottom_field_order_cnt; entry->fields |= V4L2_H264_BOTTOM_FIELD_REF; - } else { - entry->flags |= V4L2_H264_DPB_ENTRY_FLAG_FIELD; } break; case GST_H264_PICTURE_FIELD_BOTTOM_FIELD: @@ -638,13 +638,10 @@ gst_v4l2_codec_h264_dec_fill_decoder_params (GstV4l2CodecH264Dec * self, entry->top_field_order_cnt = ref_pic->other_field->top_field_order_cnt; entry->fields |= V4L2_H264_TOP_FIELD_REF; - } else { - entry->flags |= V4L2_H264_DPB_ENTRY_FLAG_FIELD; } break; } } - /* *INDENT-ON* */ g_array_unref (refs); } -- 2.7.4