v4l2codecs: h264: Fix dpb entry flag FLAG_FIELD
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Tue, 21 Dec 2021 15:55:58 +0000 (10:55 -0500)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 25 Mar 2022 21:40:28 +0000 (21:40 +0000)
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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2009>

subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codech264dec.c

index f84981b..4ae13e0 100644 (file)
@@ -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);
 }