]> git.baikalelectronics.ru Git - kernel.git/commitdiff
media: h264: Store current picture fields
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Fri, 13 May 2022 20:29:05 +0000 (22:29 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Tue, 17 May 2022 07:59:40 +0000 (09:59 +0200)
This information, also called picture structure, is required in field
decoding mode to construct reference lists.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/v4l2-core/v4l2-h264.c
include/media/v4l2-h264.h

index 4b46b36526c0d691588ca9d616e12ca62b905587..58f18bb0afb6c5e61f19c12a1cd7748da60b4e95 100644 (file)
@@ -34,13 +34,17 @@ v4l2_h264_init_reflist_builder(struct v4l2_h264_reflist_builder *b,
        cur_frame_num = dec_params->frame_num;
 
        memset(b, 0, sizeof(*b));
-       if (!(dec_params->flags & V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC))
+       if (!(dec_params->flags & V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC)) {
                b->cur_pic_order_count = min(dec_params->bottom_field_order_cnt,
                                             dec_params->top_field_order_cnt);
-       else if (dec_params->flags & V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD)
+               b->cur_pic_fields = V4L2_H264_FRAME_REF;
+       } else if (dec_params->flags & V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD) {
                b->cur_pic_order_count = dec_params->bottom_field_order_cnt;
-       else
+               b->cur_pic_fields = V4L2_H264_BOTTOM_FIELD_REF;
+       } else {
                b->cur_pic_order_count = dec_params->top_field_order_cnt;
+               b->cur_pic_fields = V4L2_H264_TOP_FIELD_REF;
+       }
 
        for (i = 0; i < V4L2_H264_NUM_DPB_ENTRIES; i++) {
                u32 pic_order_count;
index e282fb16ac58df07291663971857f65d8a1561bb..e165a54c68fa2cd7168c75ac2b5fcfa88f1e894f 100644 (file)
@@ -21,6 +21,7 @@
  * @refs.longterm: set to true for a long term reference
  * @refs: array of references
  * @cur_pic_order_count: picture order count of the frame being decoded
+ * @cur_pic_fields: fields present in the frame being decoded
  * @unordered_reflist: unordered list of references. Will be used to generate
  *                    ordered P/B0/B1 lists
  * @num_valid: number of valid references in the refs array
@@ -36,7 +37,10 @@ struct v4l2_h264_reflist_builder {
                u32 pic_num;
                u16 longterm : 1;
        } refs[V4L2_H264_NUM_DPB_ENTRIES];
+
        s32 cur_pic_order_count;
+       u8 cur_pic_fields;
+
        struct v4l2_h264_reference unordered_reflist[V4L2_H264_REF_LIST_LEN];
        u8 num_valid;
 };