linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Ezequiel Garcia <ezequiel@collabora.com>,
	linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org,
	linux-kernel@vger.kernel.org
Cc: Tomasz Figa <tfiga@chromium.org>,
	kernel@collabora.com, Jonas Karlman <jonas@kwiboo.se>,
	Heiko Stuebner <heiko@sntech.de>,
	Alexandre Courbot <acourbot@chromium.org>,
	Jeffrey Kardatzke <jkardatzke@chromium.org>,
	gustavo.padovan@collabora.com,
	Nicolas Dufresne <nicolas.dufresne@collabora.com>,
	Boris Brezillon <boris.brezillon@collabora.com>
Subject: Re: [PATCH v4 2/3] media: uapi: Add VP9 stateless decoder controls
Date: Wed, 20 May 2020 15:26:30 +0200	[thread overview]
Message-ID: <c9e71d67-746c-b71e-c8df-d41d7074c20a@xs4all.nl> (raw)
In-Reply-To: <20200518174011.15543-3-ezequiel@collabora.com>

On 18/05/2020 19:40, Ezequiel Garcia wrote:
> From: Boris Brezillon <boris.brezillon@collabora.com>
> 
> Add the VP9 stateless decoder controls plus the documentation that goes
> with it.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
> Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
> ---
>  .../userspace-api/media/v4l/biblio.rst        |  10 +
>  .../media/v4l/ext-ctrls-codec.rst             | 550 ++++++++++++++++++
>  drivers/media/v4l2-core/v4l2-ctrls.c          | 239 ++++++++
>  drivers/media/v4l2-core/v4l2-ioctl.c          |   1 +
>  include/media/v4l2-ctrls.h                    |   1 +
>  include/media/vp9-ctrls.h                     | 485 +++++++++++++++
>  6 files changed, 1286 insertions(+)
>  create mode 100644 include/media/vp9-ctrls.h
> 

<snip>

> +/**
> + * struct v4l2_vp9_quantization - VP9 quantization parameters
> + *
> + * @base_q_idx: indicates the base frame qindex
> + * @delta_q_y_dc: indicates the Y DC quantizer relative to base_q_idx
> + * @delta_q_uv_dc: indicates the UV DC quantizer relative to base_q_idx
> + * @delta_q_uv_ac indicates the UV AC quantizer relative to base_q_idx
> + * @padding: padding bytes to align things on 64 bits. Must be set to 0
> + *
> + * Encodes the quantization parameters. See section '7.2.9 Quantization params
> + * syntax' of the VP9 specification for more details.
> + */
> +struct v4l2_vp9_quantization {
> +	__u8 base_q_idx;
> +	__s8 delta_q_y_dc;
> +	__s8 delta_q_uv_dc;
> +	__s8 delta_q_uv_ac;
> +	__u8 padding[4];

Are you sure this padding field is needed? What goes wrong if this is dropped?

> +};

<snip>

> +struct v4l2_ctrl_vp9_frame_decode_params {
> +	__u32 flags;
> +	__u16 compressed_header_size;
> +	__u16 uncompressed_header_size;
> +	__u8 profile;
> +	__u8 reset_frame_context;
> +	__u8 frame_context_idx;
> +	__u8 bit_depth;
> +	__u8 interpolation_filter;
> +	__u8 tile_cols_log2;
> +	__u8 tile_rows_log2;
> +	__u8 tx_mode;
> +	__u8 reference_mode;
> +	__u8 padding[6];

This doesn't look right: this should be 7 if you want to align at 64 bits. Don't
forget to update the documentation when you change this. In fact, the documentation
doesn't mention the size of the array, it just says 'u8 padding'.

I thought pahole flags something like this?

> +	__u16 frame_width_minus_1;
> +	__u16 frame_height_minus_1;
> +	__u16 render_width_minus_1;
> +	__u16 render_height_minus_1;
> +	__u64 refs[V4L2_REF_ID_CNT];
> +	struct v4l2_vp9_loop_filter lf;

sizeof(lf) is an odd-number of bytes, so...

> +	struct v4l2_vp9_quantization quant;

... even though sizeof(quant) == 8 with the padding bytes, that would still not
align at 64 bits.

> +	struct v4l2_vp9_segmentation seg;
> +	struct v4l2_vp9_probabilities probs;
> +};
> +
> +#define V4L2_VP9_NUM_FRAME_CTX	4
> +
> +/**
> + * struct v4l2_ctrl_vp9_frame_ctx - VP9 frame context control
> + *
> + * @probs: VP9 probabilities
> + *
> + * This control is accessed in both direction. The user should initialize the
> + * 4 contexts with default values just after starting the stream. Then before
> + * decoding a frame it should query the current frame context (the one passed
> + * through &v4l2_ctrl_vp9_frame_decode_params.frame_context_idx) to initialize
> + * &v4l2_ctrl_vp9_frame_decode_params.probs. The probs are then adjusted based
> + * on the bitstream info and passed to the kernel. The codec should update
> + * the frame context after the frame has been decoded, so that next time
> + * userspace query this context it contains the updated probabilities.
> + */
> +struct v4l2_ctrl_vp9_frame_ctx {
> +	struct v4l2_vp9_probabilities probs;
> +};
> +
> +#endif /* _VP9_CTRLS_H_ */
> 

Regards,

	Hans

  reply	other threads:[~2020-05-20 13:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-18 17:40 [PATCH v4 0/3] media: rkvdec: Add a VP9 backend Ezequiel Garcia
2020-05-18 17:40 ` [PATCH v4 1/3] media: rkvdec: Fix .buf_prepare Ezequiel Garcia
2020-05-20 13:07   ` Hans Verkuil
2020-05-20 13:12     ` Ezequiel Garcia
2020-05-18 17:40 ` [PATCH v4 2/3] media: uapi: Add VP9 stateless decoder controls Ezequiel Garcia
2020-05-20 13:26   ` Hans Verkuil [this message]
2020-09-10  6:04   ` Alexandre Courbot
2020-09-10  8:43     ` Alexandre Courbot
2021-02-24 21:07     ` Nicolas Dufresne
2021-02-28  6:13       ` Alexandre Courbot
2021-03-01 18:43         ` Nicolas Dufresne
2021-03-02  3:48           ` Alexandre Courbot
2020-05-18 17:40 ` [PATCH 3/3] media: rkvdec: Add the VP9 backend Ezequiel Garcia
2020-05-18 17:53   ` Ezequiel Garcia

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=c9e71d67-746c-b71e-c8df-d41d7074c20a@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=acourbot@chromium.org \
    --cc=boris.brezillon@collabora.com \
    --cc=ezequiel@collabora.com \
    --cc=gustavo.padovan@collabora.com \
    --cc=heiko@sntech.de \
    --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=linux-rockchip@lists.infradead.org \
    --cc=nicolas.dufresne@collabora.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).