media: uapi: mpeg2: Move reference buffer fields

The forward and backwards references are specified per-picture
and not per-slice. Move it to V4L2_CID_MPEG_VIDEO_MPEG2_PICTURE.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
Tested-by: Daniel Almeida <daniel.almeida@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
Ezequiel Garcia 2021-04-29 16:48:13 +02:00 коммит произвёл Mauro Carvalho Chehab
Родитель f329e21e9d
Коммит b6d7e8031c
5 изменённых файлов: 28 добавлений и 32 удалений

Просмотреть файл

@ -1636,20 +1636,6 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type -
* - __u32 * - __u32
- ``data_bit_offset`` - ``data_bit_offset``
- Offset (in bits) to the video data in the current slice data. - Offset (in bits) to the video data in the current slice data.
* - __u64
- ``backward_ref_ts``
- Timestamp of the V4L2 capture buffer to use as backward reference, used
with B-coded and P-coded frames. The timestamp refers to the
``timestamp`` field in struct :c:type:`v4l2_buffer`. Use the
:c:func:`v4l2_timeval_to_ns()` function to convert the struct
:c:type:`timeval` in struct :c:type:`v4l2_buffer` to a __u64.
* - __u64
- ``forward_ref_ts``
- Timestamp for the V4L2 capture buffer to use as forward reference, used
with B-coded frames. The timestamp refers to the ``timestamp`` field in
struct :c:type:`v4l2_buffer`. Use the :c:func:`v4l2_timeval_to_ns()`
function to convert the struct :c:type:`timeval` in struct
:c:type:`v4l2_buffer` to a __u64.
* - __u32 * - __u32
- ``quantiser_scale_code`` - ``quantiser_scale_code``
- Code used to determine the quantization scale to use for the IDCT. - Code used to determine the quantization scale to use for the IDCT.
@ -1742,6 +1728,20 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type -
:stub-columns: 0 :stub-columns: 0
:widths: 1 1 2 :widths: 1 1 2
* - __u64
- ``backward_ref_ts``
- Timestamp of the V4L2 capture buffer to use as backward reference, used
with B-coded and P-coded frames. The timestamp refers to the
``timestamp`` field in struct :c:type:`v4l2_buffer`. Use the
:c:func:`v4l2_timeval_to_ns()` function to convert the struct
:c:type:`timeval` in struct :c:type:`v4l2_buffer` to a __u64.
* - __u64
- ``forward_ref_ts``
- Timestamp for the V4L2 capture buffer to use as forward reference, used
with B-coded frames. The timestamp refers to the ``timestamp`` field in
struct :c:type:`v4l2_buffer`. Use the :c:func:`v4l2_timeval_to_ns()`
function to convert the struct :c:type:`timeval` in struct
:c:type:`v4l2_buffer` to a __u64.
* - __u32 * - __u32
- ``flags`` - ``flags``
- See :ref:`MPEG-2 Picture Flags <mpeg2_picture_flags>`. - See :ref:`MPEG-2 Picture Flags <mpeg2_picture_flags>`.

Просмотреть файл

@ -101,12 +101,10 @@ hantro_g1_mpeg2_dec_set_buffers(struct hantro_dev *vpu, struct hantro_ctx *ctx,
switch (pic->picture_coding_type) { switch (pic->picture_coding_type) {
case V4L2_MPEG2_PIC_CODING_TYPE_B: case V4L2_MPEG2_PIC_CODING_TYPE_B:
backward_addr = hantro_get_ref(ctx, backward_addr = hantro_get_ref(ctx, pic->backward_ref_ts);
slice_params->backward_ref_ts);
fallthrough; fallthrough;
case V4L2_MPEG2_PIC_CODING_TYPE_P: case V4L2_MPEG2_PIC_CODING_TYPE_P:
forward_addr = hantro_get_ref(ctx, forward_addr = hantro_get_ref(ctx, pic->forward_ref_ts);
slice_params->forward_ref_ts);
} }
/* Source bitstream buffer */ /* Source bitstream buffer */

Просмотреть файл

@ -104,12 +104,10 @@ rk3399_vpu_mpeg2_dec_set_buffers(struct hantro_dev *vpu,
switch (pic->picture_coding_type) { switch (pic->picture_coding_type) {
case V4L2_MPEG2_PIC_CODING_TYPE_B: case V4L2_MPEG2_PIC_CODING_TYPE_B:
backward_addr = hantro_get_ref(ctx, backward_addr = hantro_get_ref(ctx, pic->backward_ref_ts);
slice_params->backward_ref_ts);
fallthrough; fallthrough;
case V4L2_MPEG2_PIC_CODING_TYPE_P: case V4L2_MPEG2_PIC_CODING_TYPE_P:
forward_addr = hantro_get_ref(ctx, forward_addr = hantro_get_ref(ctx, pic->forward_ref_ts);
slice_params->forward_ref_ts);
} }
/* Source bitstream buffer */ /* Source bitstream buffer */

Просмотреть файл

@ -128,14 +128,14 @@ static void cedrus_mpeg2_setup(struct cedrus_ctx *ctx, struct cedrus_run *run)
vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
forward_idx = vb2_find_timestamp(vq, slice_params->forward_ref_ts, 0); forward_idx = vb2_find_timestamp(vq, pic->forward_ref_ts, 0);
fwd_luma_addr = cedrus_dst_buf_addr(ctx, forward_idx, 0); fwd_luma_addr = cedrus_dst_buf_addr(ctx, forward_idx, 0);
fwd_chroma_addr = cedrus_dst_buf_addr(ctx, forward_idx, 1); fwd_chroma_addr = cedrus_dst_buf_addr(ctx, forward_idx, 1);
cedrus_write(dev, VE_DEC_MPEG_FWD_REF_LUMA_ADDR, fwd_luma_addr); cedrus_write(dev, VE_DEC_MPEG_FWD_REF_LUMA_ADDR, fwd_luma_addr);
cedrus_write(dev, VE_DEC_MPEG_FWD_REF_CHROMA_ADDR, fwd_chroma_addr); cedrus_write(dev, VE_DEC_MPEG_FWD_REF_CHROMA_ADDR, fwd_chroma_addr);
backward_idx = vb2_find_timestamp(vq, slice_params->backward_ref_ts, 0); backward_idx = vb2_find_timestamp(vq, pic->backward_ref_ts, 0);
bwd_luma_addr = cedrus_dst_buf_addr(ctx, backward_idx, 0); bwd_luma_addr = cedrus_dst_buf_addr(ctx, backward_idx, 0);
bwd_chroma_addr = cedrus_dst_buf_addr(ctx, backward_idx, 1); bwd_chroma_addr = cedrus_dst_buf_addr(ctx, backward_idx, 1);

Просмотреть файл

@ -77,6 +77,12 @@ struct v4l2_ctrl_mpeg2_sequence {
* All the members on this structure match the picture header and picture * All the members on this structure match the picture header and picture
* coding extension syntaxes as specified by the MPEG-2 specification. * coding extension syntaxes as specified by the MPEG-2 specification.
* *
* @backward_ref_ts: timestamp of the V4L2 capture buffer to use as
* reference for backward prediction.
* @forward_ref_ts: timestamp of the V4L2 capture buffer to use as
* reference for forward prediction. These timestamp refers to the
* timestamp field in struct v4l2_buffer. Use v4l2_timeval_to_ns()
* to convert the struct timeval to a __u64.
* @flags: see V4L2_MPEG2_PIC_FLAG_{}. * @flags: see V4L2_MPEG2_PIC_FLAG_{}.
* @f_code[2][2]: see MPEG-2 specification. * @f_code[2][2]: see MPEG-2 specification.
* @picture_coding_type: see MPEG-2 specification. * @picture_coding_type: see MPEG-2 specification.
@ -85,6 +91,8 @@ struct v4l2_ctrl_mpeg2_sequence {
* @reserved: padding field. Should be zeroed by applications. * @reserved: padding field. Should be zeroed by applications.
*/ */
struct v4l2_ctrl_mpeg2_picture { struct v4l2_ctrl_mpeg2_picture {
__u64 backward_ref_ts;
__u64 forward_ref_ts;
__u32 flags; __u32 flags;
__u8 f_code[2][2]; __u8 f_code[2][2];
__u8 picture_coding_type; __u8 picture_coding_type;
@ -96,12 +104,6 @@ struct v4l2_ctrl_mpeg2_picture {
/** /**
* struct v4l2_ctrl_mpeg2_slice_params - MPEG-2 slice header * struct v4l2_ctrl_mpeg2_slice_params - MPEG-2 slice header
* *
* @backward_ref_ts: timestamp of the V4L2 capture buffer to use as
* reference for backward prediction.
* @forward_ref_ts: timestamp of the V4L2 capture buffer to use as
* reference for forward prediction. These timestamp refers to the
* timestamp field in struct v4l2_buffer. Use v4l2_timeval_to_ns()
* to convert the struct timeval to a __u64.
* @quantiser_scale_code: quantiser scale integer matching an * @quantiser_scale_code: quantiser scale integer matching an
* homonymous syntax element. * homonymous syntax element.
* @reserved: padding field. Should be zeroed by applications. * @reserved: padding field. Should be zeroed by applications.
@ -109,8 +111,6 @@ struct v4l2_ctrl_mpeg2_picture {
struct v4l2_ctrl_mpeg2_slice_params { struct v4l2_ctrl_mpeg2_slice_params {
__u32 bit_size; __u32 bit_size;
__u32 data_bit_offset; __u32 data_bit_offset;
__u64 backward_ref_ts;
__u64 forward_ref_ts;
__u32 quantiser_scale_code; __u32 quantiser_scale_code;
__u32 reserved; __u32 reserved;
}; };