Skip to content

Commit adc8a8d

Browse files
ndufresnemchehab
authored andcommitted
media: h264: Store current picture fields
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>
1 parent 26e4520 commit adc8a8d

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

drivers/media/v4l2-core/v4l2-h264.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,17 @@ v4l2_h264_init_reflist_builder(struct v4l2_h264_reflist_builder *b,
3434
cur_frame_num = dec_params->frame_num;
3535

3636
memset(b, 0, sizeof(*b));
37-
if (!(dec_params->flags & V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC))
37+
if (!(dec_params->flags & V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC)) {
3838
b->cur_pic_order_count = min(dec_params->bottom_field_order_cnt,
3939
dec_params->top_field_order_cnt);
40-
else if (dec_params->flags & V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD)
40+
b->cur_pic_fields = V4L2_H264_FRAME_REF;
41+
} else if (dec_params->flags & V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD) {
4142
b->cur_pic_order_count = dec_params->bottom_field_order_cnt;
42-
else
43+
b->cur_pic_fields = V4L2_H264_BOTTOM_FIELD_REF;
44+
} else {
4345
b->cur_pic_order_count = dec_params->top_field_order_cnt;
46+
b->cur_pic_fields = V4L2_H264_TOP_FIELD_REF;
47+
}
4448

4549
for (i = 0; i < V4L2_H264_NUM_DPB_ENTRIES; i++) {
4650
u32 pic_order_count;

include/media/v4l2-h264.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* @refs.longterm: set to true for a long term reference
2222
* @refs: array of references
2323
* @cur_pic_order_count: picture order count of the frame being decoded
24+
* @cur_pic_fields: fields present in the frame being decoded
2425
* @unordered_reflist: unordered list of references. Will be used to generate
2526
* ordered P/B0/B1 lists
2627
* @num_valid: number of valid references in the refs array
@@ -36,7 +37,10 @@ struct v4l2_h264_reflist_builder {
3637
u32 pic_num;
3738
u16 longterm : 1;
3839
} refs[V4L2_H264_NUM_DPB_ENTRIES];
40+
3941
s32 cur_pic_order_count;
42+
u8 cur_pic_fields;
43+
4044
struct v4l2_h264_reference unordered_reflist[V4L2_H264_REF_LIST_LEN];
4145
u8 num_valid;
4246
};

0 commit comments

Comments
 (0)