Commit cfc8c3ed authored by Jernej Skrabec's avatar Jernej Skrabec Committed by Mauro Carvalho Chehab

media: cedrus: h264: Properly configure reference field

When interlaced H264 content is being decoded, references must indicate
which field is being referenced. Currently this was done by checking
capture buffer flags. However, that is not correct because capture
buffer may hold both fields.

Fix this by checking newly introduced flags in reference lists.
Signed-off-by: default avatarJernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: default avatarNicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent a52b29e8
...@@ -182,7 +182,6 @@ static void _cedrus_write_ref_list(struct cedrus_ctx *ctx, ...@@ -182,7 +182,6 @@ static void _cedrus_write_ref_list(struct cedrus_ctx *ctx,
for (i = 0; i < num_ref; i++) { for (i = 0; i < num_ref; i++) {
const struct v4l2_h264_dpb_entry *dpb; const struct v4l2_h264_dpb_entry *dpb;
const struct cedrus_buffer *cedrus_buf; const struct cedrus_buffer *cedrus_buf;
const struct vb2_v4l2_buffer *ref_buf;
unsigned int position; unsigned int position;
int buf_idx; int buf_idx;
u8 dpb_idx; u8 dpb_idx;
...@@ -197,12 +196,11 @@ static void _cedrus_write_ref_list(struct cedrus_ctx *ctx, ...@@ -197,12 +196,11 @@ static void _cedrus_write_ref_list(struct cedrus_ctx *ctx,
if (buf_idx < 0) if (buf_idx < 0)
continue; continue;
ref_buf = to_vb2_v4l2_buffer(cap_q->bufs[buf_idx]); cedrus_buf = vb2_to_cedrus_buffer(cap_q->bufs[buf_idx]);
cedrus_buf = vb2_v4l2_to_cedrus_buffer(ref_buf);
position = cedrus_buf->codec.h264.position; position = cedrus_buf->codec.h264.position;
sram_array[i] |= position << 1; sram_array[i] |= position << 1;
if (ref_buf->field == V4L2_FIELD_BOTTOM) if (ref_list[i].fields & V4L2_H264_BOTTOM_FIELD_REF)
sram_array[i] |= BIT(0); sram_array[i] |= BIT(0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment