Re: [PATCH v2 1/2] media: uapi: Add VP8 stateless decoder API

From: Philipp Zabel
Date: Wed Jul 03 2019 - 10:29:19 EST


On Tue, 2019-07-02 at 14:00 -0300, Ezequiel Garcia wrote:
> From: Pawel Osciak <posciak@xxxxxxxxxxxx>
>
> Add the parsed VP8 frame pixel format and controls, to be used
> with the new stateless decoder API for VP8 to provide parameters
> for accelerator (aka stateless) codecs.
>
> Signed-off-by: Pawel Osciak <posciak@xxxxxxxxxxxx>
> Signed-off-by: Ezequiel Garcia <ezequiel@xxxxxxxxxxxxx>
> --
> Changes from v1:
> * Move 1-bit fields to flags in the respective structures.
> * Add padding fields to make all structures 8-byte aligned.
> * Reorder fields where needed to avoid padding as much as possible.
> * Fix documentation as needed.
>
> Changes from RFC:
> * Make sure the uAPI has the same size on x86, x86_64, arm and arm64.
> * Move entropy coder state fields to a struct.
> * Move key_frame field to the flags.
> * Remove unneeded first_part_offset field.
> * Add documentation.
> ---
> Documentation/media/uapi/v4l/biblio.rst | 10 +
> .../media/uapi/v4l/ext-ctrls-codec.rst | 323 ++++++++++++++++++
> .../media/uapi/v4l/pixfmt-compressed.rst | 20 ++
> drivers/media/v4l2-core/v4l2-ctrls.c | 8 +
> drivers/media/v4l2-core/v4l2-ioctl.c | 1 +
> include/media/v4l2-ctrls.h | 3 +
> include/media/vp8-ctrls.h | 110 ++++++
> 7 files changed, 475 insertions(+)
> create mode 100644 include/media/vp8-ctrls.h
>
> diff --git a/Documentation/media/uapi/v4l/biblio.rst b/Documentation/media/uapi/v4l/biblio.rst
> index 8f4eb8823d82..ad2ff258afa8 100644
> --- a/Documentation/media/uapi/v4l/biblio.rst
> +++ b/Documentation/media/uapi/v4l/biblio.rst
> @@ -395,3 +395,13 @@ colimg
> :title: Color Imaging: Fundamentals and Applications
>
> :author: Erik Reinhard et al.
> +
> +.. _vp8:
> +
> +VP8
> +===
> +
> +
> +:title: RFC 6386: "VP8 Data Format and Decoding Guide"
> +
> +:author: J. Bankoski et al.
> diff --git a/Documentation/media/uapi/v4l/ext-ctrls-codec.rst b/Documentation/media/uapi/v4l/ext-ctrls-codec.rst
> index d6ea2ffd65c5..aef335f175cd 100644
> --- a/Documentation/media/uapi/v4l/ext-ctrls-codec.rst
> +++ b/Documentation/media/uapi/v4l/ext-ctrls-codec.rst
> @@ -2234,6 +2234,329 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type -
> Quantization parameter for a P frame for FWHT. Valid range: from 1
> to 31.
>
> +.. _v4l2-mpeg-vp8:
> +
> +``V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER (struct)``
> + Specifies the frame parameters for the associated VP8 parsed frame data.
> + This includes the necessary parameters for
> + configuring a stateless hardware decoding pipeline for VP8.
> + The bitstream parameters are defined according to :ref:`vp8`.
> +
> + .. note::
> +
> + This compound control is not yet part of the public kernel API and
> + it is expected to change.
> +
> +.. c:type:: v4l2_ctrl_vp8_frame_header
> +
> +.. cssclass:: longtable
> +
> +.. tabularcolumns:: |p{5.8cm}|p{4.8cm}|p{6.6cm}|
> +
> +.. flat-table:: struct v4l2_ctrl_vp8_frame_header
> + :header-rows: 0
> + :stub-columns: 0
> + :widths: 1 1 2
> +
> + * - struct :c:type:`v4l2_vp8_segment_header`
> + - ``segment_header``
> + - Structure with segment-based adjustments metadata.
> + * - struct :c:type:`v4l2_vp8_loopfilter_header`
> + - ``loopfilter_header``
> + - Structure with loop filter level adjustments metadata.
> + * - struct :c:type:`v4l2_vp8_quantization_header`
> + - ``quant_header``
> + - Structure with VP8 dequantization indices metadata.
> + * - struct :c:type:`v4l2_vp8_entropy_header`
> + - ``entropy_header``
> + - Structure with VP8 entropy coder probabilities metadata.
> + * - struct :c:type:`v4l2_vp8_entropy_coder_state`
> + - ``coder_state``
> + - Structure with VP8 entropy coder state.
> + * - __u16
> + - ``width``
> + - The width of the frame. Must be set for all frames.
> + * - __u16
> + - ``height``
> + - The height of the frame. Must be set for all frames.
> + * - __u8
> + - ``horizontal_scale``
> + - Horizontal scaling factor.
> + * - __u8
> + - ``vertical_scaling factor``
> + - Vertical scale.
> + * - __u8
> + - ``version``
> + - Bitstream version.
> + * - __u8
> + - ``prob_skip_false``
> + - Indicates the probability that the macroblock is not skipped.
> + * - __u8
> + - ``prob_intra``
> + - Indicates the probability that a macroblock is intra-predicted.
> + * - __u8
> + - ``prob_last``
> + - Indicates the probability that the last reference frame is used
> + for inter-prediction
> + * - __u8
> + - ``prob_gf``
> + - Indicates the probability that the golden reference frame is used
> + for inter-prediction
> + * - __u8
> + - ``num_dct_parts``
> + - Number of DCT coefficients partitions.

I assume this must be no larger than 8. Is this mandated by the spec? If
so, should it be documented here and checked by v4l2-core?

regards
Philipp