linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
To: Ezequiel Garcia <ezequiel@collabora.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Tomasz Figa <tfiga@chromium.org>,
	kernel@collabora.com, Jonas Karlman <jonas@kwiboo.se>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	Alexandre Courbot <acourbot@chromium.org>,
	Jeffrey Kardatzke <jkardatzke@chromium.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Maxime Ripard <mripard@kernel.org>,
	Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Subject: Re: [RFC 4/7] media: uapi: h264: increase size of fields
Date: Thu, 25 Jun 2020 11:01:17 -0400	[thread overview]
Message-ID: <079f79676335c32941e0021b84849164858c09df.camel@collabora.com> (raw)
In-Reply-To: <20200623182809.1375-5-ezequiel@collabora.com>

[-- Attachment #1: Type: text/plain, Size: 4747 bytes --]

Le mardi 23 juin 2020 à 15:28 -0300, Ezequiel Garcia a écrit :
> Slice header syntax element 'first_mb_in_slice' can point
> to the last macroblock, currently the field can only reference
> 65536 macroblocks which is insufficient for 8K videos.
> 
> DPB entry PicNum maximum value is 2*MaxFrameNum for interlaced
> content (field_pic_flag=1).
> 
> Therefore, increase 'first_mb_in_slice' and 'pic_num'.
> 
> The v4l2_h264_dpb_entry struct needs to be padded to avoid a hole,
> which will be useful to allow future uAPI extensions.
> 
> Note that v4l2_ctrl_h264_slice_params struct will be modified
> in a follow-up commit, and so we defer its 64-bit padding.

This patch includes two changes, with two distinct rationale. Please
split in two, I would also add reference to the spec in the commit
messages. The explanation is also insufficient. Need to mention that
macro-blocks are 16x16, and the bounds for synthetic value
MaxFrameNum (derived from bitstream value) has not be mention either.

> 
> Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
> ---
>  .../userspace-api/media/v4l/ext-ctrls-codec.rst          | 7 +++++--
>  drivers/media/v4l2-core/v4l2-ctrls.c                     | 9 +++++++++
>  include/media/h264-ctrls.h                               | 6 ++++--
>  include/media/v4l2-h264.h                                | 2 +-
>  4 files changed, 19 insertions(+), 5 deletions(-)
> 
> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> index 0808a36777b6..e3b5a28fb965 100644
> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> @@ -1772,7 +1772,7 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type -
>      * - __u32
>        - ``header_bit_size``
>        -
> -    * - __u16
> +    * - __u32
>        - ``first_mb_in_slice``
>        -
>      * - __u8
> @@ -2046,7 +2046,10 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type -
>      * - __u16
>        - ``frame_num``
>        -
> -    * - __u16
> +    * - __u8
> +      - ``reserved[6]``
> +      - Applications and drivers must set this to zero.
> +    * - __u32
>        - ``pic_num``
>        -
>      * - __s32
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
> index 6abd023f10c7..a751c14f9c22 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -1734,6 +1734,7 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,
>  	struct v4l2_ctrl_mpeg2_slice_params *p_mpeg2_slice_params;
>  	struct v4l2_ctrl_vp8_frame_header *p_vp8_frame_header;
>  	struct v4l2_ctrl_h264_slice_params *p_h264_slice_params;
> +	struct v4l2_ctrl_h264_decode_params *p_h264_dec_params;
>  	struct v4l2_ctrl_hevc_sps *p_hevc_sps;
>  	struct v4l2_ctrl_hevc_pps *p_hevc_pps;
>  	struct v4l2_ctrl_hevc_slice_params *p_hevc_slice_params;
> @@ -1808,6 +1809,14 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,
>  		}
>  		break;
>  	case V4L2_CTRL_TYPE_H264_DECODE_PARAMS:
> +		p_h264_dec_params = p;
> +
> +		for (i = 0; i < V4L2_H264_NUM_DPB_ENTRIES; i++) {
> +			struct v4l2_h264_dpb_entry *dpb_entry =
> +				&p_h264_dec_params->dpb[i];
> +
> +			zero_reserved(*dpb_entry);
> +		}
>  		break;
>  
>  	case V4L2_CTRL_TYPE_VP8_FRAME_HEADER:
> diff --git a/include/media/h264-ctrls.h b/include/media/h264-ctrls.h
> index c6cbf178c1c9..a938d16b901c 100644
> --- a/include/media/h264-ctrls.h
> +++ b/include/media/h264-ctrls.h
> @@ -161,7 +161,8 @@ struct v4l2_ctrl_h264_slice_params {
>  	/* Offset in bits to slice_data() from the beginning of this slice. */
>  	__u32 header_bit_size;
>  
> -	__u16 first_mb_in_slice;
> +	__u32 first_mb_in_slice;
> +
>  	__u8 slice_type;
>  	__u8 pic_parameter_set_id;
>  	__u8 colour_plane_id;
> @@ -208,7 +209,8 @@ struct v4l2_ctrl_h264_slice_params {
>  struct v4l2_h264_dpb_entry {
>  	__u64 reference_ts;
>  	__u16 frame_num;
> -	__u16 pic_num;
> +	__u8 reserved[6];
> +	__u32 pic_num;
>  	/* Note that field is indicated by v4l2_buffer.field */
>  	__s32 top_field_order_cnt;
>  	__s32 bottom_field_order_cnt;
> diff --git a/include/media/v4l2-h264.h b/include/media/v4l2-h264.h
> index bc9ebb560ccf..1a5f26fc2a9a 100644
> --- a/include/media/v4l2-h264.h
> +++ b/include/media/v4l2-h264.h
> @@ -33,7 +33,7 @@ struct v4l2_h264_reflist_builder {
>  	struct {
>  		s32 pic_order_count;
>  		int frame_num;
> -		u16 pic_num;
> +		u32 pic_num;
>  		u16 longterm : 1;
>  	} refs[V4L2_H264_NUM_DPB_ENTRIES];
>  	s32 cur_pic_order_count;

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  reply	other threads:[~2020-06-25 15:01 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-23 18:28 [RFC 0/7] media: Clean and make H264 stateless uAPI public Ezequiel Garcia
2020-06-23 18:28 ` [RFC 1/7] media: uapi: h264: update reference lists Ezequiel Garcia
2020-06-23 18:28 ` [RFC 2/7] fixup! " Ezequiel Garcia
2020-06-25 14:53   ` Nicolas Dufresne
2020-06-25 17:42     ` Ezequiel Garcia
2020-06-25 17:47       ` Nicolas Dufresne
2020-06-25 15:30   ` Tomasz Figa
2020-06-25 16:52     ` Ezequiel Garcia
2020-06-23 18:28 ` [RFC 3/7] media: uapi: h264: clarify pic_order_cnt_bit_size field Ezequiel Garcia
2020-06-25 15:06   ` Nicolas Dufresne
2020-06-23 18:28 ` [RFC 4/7] media: uapi: h264: increase size of fields Ezequiel Garcia
2020-06-25 15:01   ` Nicolas Dufresne [this message]
2020-06-25 15:29     ` Ezequiel Garcia
2020-06-23 18:28 ` [RFC 5/7] media: uapi: h264: pad v4l2_ctrl_h264_pps to 64-bit Ezequiel Garcia
2020-06-25 14:55   ` Nicolas Dufresne
2020-06-23 18:28 ` [RFC 6/7] media: uapi: h264: Clean slice invariants syntax elements Ezequiel Garcia
2020-06-25 15:05   ` Nicolas Dufresne
2020-06-26 19:34     ` Ezequiel Garcia
2020-06-23 18:28 ` [RFC 7/7] media: uapi: make H264 stateless codec interface public Ezequiel Garcia
2020-06-25  7:52   ` Hans Verkuil
2020-06-25 17:51     ` Ezequiel Garcia
2020-06-25 14:42 ` [RFC 0/7] media: Clean and make H264 stateless uAPI public Nicolas Dufresne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=079f79676335c32941e0021b84849164858c09df.camel@collabora.com \
    --to=nicolas.dufresne@collabora.com \
    --cc=acourbot@chromium.org \
    --cc=ezequiel@collabora.com \
    --cc=hverkuil@xs4all.nl \
    --cc=jkardatzke@chromium.org \
    --cc=jonas@kwiboo.se \
    --cc=kernel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mripard@kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=paul.kocialkowski@bootlin.com \
    --cc=tfiga@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).