media: uapi: move VP8 stateless controls out of staging

Until now, the VP8 V4L2 API was not exported as a public API,
and only defined in a private media header (media/vp8-ctrls.h).

The reason for this was a concern about the API not complete
and ready to support VP8 decoding hardware accelerators.

After reviewing the VP8 specification in detail, and now
that the API is able to support Cedrus and Hantro G1,
we can consider this ready.

Signed-off-by: Ezequiel Garcia <ezequiel@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-03-04 15:07:55 +01:00 committed by Mauro Carvalho Chehab
parent 0c86b4bdac
commit 363240ce1c
17 changed files with 555 additions and 565 deletions

View File

@ -910,3 +910,337 @@ FWHT Flags
.. raw:: latex
\normalsize
.. _v4l2-codec-stateless-vp8:
``V4L2_CID_STATELESS_VP8_FRAME (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`.
.. c:type:: v4l2_ctrl_vp8_frame
.. raw:: latex
\small
.. tabularcolumns:: |p{7.0cm}|p{4.6cm}|p{5.7cm}|
.. cssclass:: longtable
.. flat-table:: struct v4l2_ctrl_vp8_frame
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - struct :c:type:`v4l2_vp8_segment`
- ``segment``
- Structure with segment-based adjustments metadata.
* - struct :c:type:`v4l2_vp8_loop_filter`
- ``lf``
- Structure with loop filter level adjustments metadata.
* - struct :c:type:`v4l2_vp8_quantization`
- ``quant``
- Structure with VP8 dequantization indices metadata.
* - struct :c:type:`v4l2_vp8_entropy`
- ``entropy``
- 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. Must be one of: 1, 2, 4, or 8.
* - __u32
- ``first_part_size``
- Size of the first partition, i.e. the control partition.
* - __u32
- ``first_part_header_bits``
- Size in bits of the first partition header portion.
* - __u32
- ``dct_part_sizes[8]``
- DCT coefficients sizes.
* - __u64
- ``last_frame_ts``
- Timestamp for the V4L2 capture buffer to use as last reference frame, used
with inter-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
- ``golden_frame_ts``
- Timestamp for the V4L2 capture buffer to use as last reference frame, used
with inter-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
- ``alt_frame_ts``
- Timestamp for the V4L2 capture buffer to use as alternate reference frame, used
with inter-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
- ``flags``
- See :ref:`Frame Flags <vp8_frame_flags>`
.. raw:: latex
\normalsize
.. _vp8_frame_flags:
``Frame Flags``
.. tabularcolumns:: |p{9.8cm}|p{0.8cm}|p{6.7cm}|
.. cssclass:: longtable
.. flat-table::
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - ``V4L2_VP8_FRAME_FLAG_KEY_FRAME``
- 0x01
- Indicates if the frame is a key frame.
* - ``V4L2_VP8_FRAME_FLAG_EXPERIMENTAL``
- 0x02
- Experimental bitstream.
* - ``V4L2_VP8_FRAME_FLAG_SHOW_FRAME``
- 0x04
- Show frame flag, indicates if the frame is for display.
* - ``V4L2_VP8_FRAME_FLAG_MB_NO_SKIP_COEFF``
- 0x08
- Enable/disable skipping of macroblocks with no non-zero coefficients.
* - ``V4L2_VP8_FRAME_FLAG_SIGN_BIAS_GOLDEN``
- 0x10
- Sign of motion vectors when the golden frame is referenced.
* - ``V4L2_VP8_FRAME_FLAG_SIGN_BIAS_ALT``
- 0x20
- Sign of motion vectors when the alt frame is referenced.
.. c:type:: v4l2_vp8_entropy_coder_state
.. cssclass:: longtable
.. tabularcolumns:: |p{1.0cm}|p{2.0cm}|p{14.3cm}|
.. flat-table:: struct v4l2_vp8_entropy_coder_state
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - __u8
- ``range``
- coder state value for "Range"
* - __u8
- ``value``
- coder state value for "Value"-
* - __u8
- ``bit_count``
- number of bits left.
* - __u8
- ``padding``
- Applications and drivers must set this to zero.
.. c:type:: v4l2_vp8_segment
.. cssclass:: longtable
.. tabularcolumns:: |p{1.2cm}|p{4.0cm}|p{12.1cm}|
.. flat-table:: struct v4l2_vp8_segment
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - __s8
- ``quant_update[4]``
- Signed quantizer value update.
* - __s8
- ``lf_update[4]``
- Signed loop filter level value update.
* - __u8
- ``segment_probs[3]``
- Segment probabilities.
* - __u8
- ``padding``
- Applications and drivers must set this to zero.
* - __u32
- ``flags``
- See :ref:`Segment Flags <vp8_segment_flags>`
.. _vp8_segment_flags:
``Segment Flags``
.. raw:: latex
\small
.. tabularcolumns:: |p{10cm}|p{1.0cm}|p{6.3cm}|
.. flat-table::
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - ``V4L2_VP8_SEGMENT_FLAG_ENABLED``
- 0x01
- Enable/disable segment-based adjustments.
* - ``V4L2_VP8_SEGMENT_FLAG_UPDATE_MAP``
- 0x02
- Indicates if the macroblock segmentation map is updated in this frame.
* - ``V4L2_VP8_SEGMENT_FLAG_UPDATE_FEATURE_DATA``
- 0x04
- Indicates if the segment feature data is updated in this frame.
* - ``V4L2_VP8_SEGMENT_FLAG_DELTA_VALUE_MODE``
- 0x08
- If is set, the segment feature data mode is delta-value.
If cleared, it's absolute-value.
.. raw:: latex
\normalsize
.. c:type:: v4l2_vp8_loop_filter
.. cssclass:: longtable
.. tabularcolumns:: |p{1.5cm}|p{3.9cm}|p{11.9cm}|
.. flat-table:: struct v4l2_vp8_loop_filter
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - __s8
- ``ref_frm_delta[4]``
- Reference adjustment (signed) delta value.
* - __s8
- ``mb_mode_delta[4]``
- Macroblock prediction mode adjustment (signed) delta value.
* - __u8
- ``sharpness_level``
- Sharpness level
* - __u8
- ``level``
- Filter level
* - __u16
- ``padding``
- Applications and drivers must set this to zero.
* - __u32
- ``flags``
- See :ref:`Loop Filter Flags <vp8_loop_filter_flags>`
.. _vp8_loop_filter_flags:
``Loop Filter Flags``
.. tabularcolumns:: |p{7.0cm}|p{1.2cm}|p{9.1cm}|
.. flat-table::
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - ``V4L2_VP8_LF_ADJ_ENABLE``
- 0x01
- Enable/disable macroblock-level loop filter adjustment.
* - ``V4L2_VP8_LF_DELTA_UPDATE``
- 0x02
- Indicates if the delta values used in an adjustment are updated.
* - ``V4L2_VP8_LF_FILTER_TYPE_SIMPLE``
- 0x04
- If set, indicates the filter type is simple.
If cleared, the filter type is normal.
.. c:type:: v4l2_vp8_quantization
.. tabularcolumns:: |p{1.5cm}|p{3.5cm}|p{12.3cm}|
.. flat-table:: struct v4l2_vp8_quantization
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - __u8
- ``y_ac_qi``
- Luma AC coefficient table index.
* - __s8
- ``y_dc_delta``
- Luma DC delta vaue.
* - __s8
- ``y2_dc_delta``
- Y2 block DC delta value.
* - __s8
- ``y2_ac_delta``
- Y2 block AC delta value.
* - __s8
- ``uv_dc_delta``
- Chroma DC delta value.
* - __s8
- ``uv_ac_delta``
- Chroma AC delta value.
* - __u16
- ``padding``
- Applications and drivers must set this to zero.
.. c:type:: v4l2_vp8_entropy
.. cssclass:: longtable
.. tabularcolumns:: |p{1.5cm}|p{5.8cm}|p{10.0cm}|
.. flat-table:: struct v4l2_vp8_entropy
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - __u8
- ``coeff_probs[4][8][3][11]``
- Coefficient update probabilities.
* - __u8
- ``y_mode_probs[4]``
- Luma mode update probabilities.
* - __u8
- ``uv_mode_probs[3]``
- Chroma mode update probabilities.
* - __u8
- ``mv_probs[2][19]``
- MV decoding update probabilities.
* - __u8
- ``padding[3]``
- Applications and drivers must set this to zero.

View File

@ -1798,345 +1798,6 @@ 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 (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
.. raw:: latex
\small
.. tabularcolumns:: |p{7.0cm}|p{4.6cm}|p{5.7cm}|
.. cssclass:: longtable
.. flat-table:: struct v4l2_ctrl_vp8_frame
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - struct :c:type:`v4l2_vp8_segment`
- ``segment``
- Structure with segment-based adjustments metadata.
* - struct :c:type:`v4l2_vp8_loop_filter`
- ``lf``
- Structure with loop filter level adjustments metadata.
* - struct :c:type:`v4l2_vp8_quantization`
- ``quant``
- Structure with VP8 dequantization indices metadata.
* - struct :c:type:`v4l2_vp8_entropy`
- ``entropy``
- 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. Must be one of: 1, 2, 4, or 8.
* - __u32
- ``first_part_size``
- Size of the first partition, i.e. the control partition.
* - __u32
- ``first_part_header_bits``
- Size in bits of the first partition header portion.
* - __u32
- ``dct_part_sizes[8]``
- DCT coefficients sizes.
* - __u64
- ``last_frame_ts``
- Timestamp for the V4L2 capture buffer to use as last reference frame, used
with inter-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
- ``golden_frame_ts``
- Timestamp for the V4L2 capture buffer to use as last reference frame, used
with inter-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
- ``alt_frame_ts``
- Timestamp for the V4L2 capture buffer to use as alternate reference frame, used
with inter-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
- ``flags``
- See :ref:`Frame Flags <vp8_frame_flags>`
.. raw:: latex
\normalsize
.. _vp8_frame_flags:
``Frame Flags``
.. tabularcolumns:: |p{9.8cm}|p{0.8cm}|p{6.7cm}|
.. cssclass:: longtable
.. flat-table::
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - ``V4L2_VP8_FRAME_FLAG_KEY_FRAME``
- 0x01
- Indicates if the frame is a key frame.
* - ``V4L2_VP8_FRAME_FLAG_EXPERIMENTAL``
- 0x02
- Experimental bitstream.
* - ``V4L2_VP8_FRAME_FLAG_SHOW_FRAME``
- 0x04
- Show frame flag, indicates if the frame is for display.
* - ``V4L2_VP8_FRAME_FLAG_MB_NO_SKIP_COEFF``
- 0x08
- Enable/disable skipping of macroblocks with no non-zero coefficients.
* - ``V4L2_VP8_FRAME_FLAG_SIGN_BIAS_GOLDEN``
- 0x10
- Sign of motion vectors when the golden frame is referenced.
* - ``V4L2_VP8_FRAME_FLAG_SIGN_BIAS_ALT``
- 0x20
- Sign of motion vectors when the alt frame is referenced.
.. c:type:: v4l2_vp8_entropy_coder_state
.. cssclass:: longtable
.. tabularcolumns:: |p{1.0cm}|p{2.0cm}|p{14.3cm}|
.. flat-table:: struct v4l2_vp8_entropy_coder_state
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - __u8
- ``range``
-
* - __u8
- ``value``
-
* - __u8
- ``bit_count``
-
* - __u8
- ``padding``
- Applications and drivers must set this to zero.
.. c:type:: v4l2_vp8_segment
.. cssclass:: longtable
.. tabularcolumns:: |p{1.2cm}|p{4.0cm}|p{12.1cm}|
.. flat-table:: struct v4l2_vp8_segment
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - __s8
- ``quant_update[4]``
- Signed quantizer value update.
* - __s8
- ``lf_update[4]``
- Signed loop filter level value update.
* - __u8
- ``segment_probs[3]``
- Segment probabilities.
* - __u8
- ``padding``
- Applications and drivers must set this to zero.
* - __u32
- ``flags``
- See :ref:`Segment Flags <vp8_segment_flags>`
.. _vp8_segment_flags:
``Segment Flags``
.. raw:: latex
\small
.. tabularcolumns:: |p{10cm}|p{1.0cm}|p{6.3cm}|
.. flat-table::
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - ``V4L2_VP8_SEGMENT_FLAG_ENABLED``
- 0x01
- Enable/disable segment-based adjustments.
* - ``V4L2_VP8_SEGMENT_FLAG_UPDATE_MAP``
- 0x02
- Indicates if the macroblock segmentation map is updated in this frame.
* - ``V4L2_VP8_SEGMENT_FLAG_UPDATE_FEATURE_DATA``
- 0x04
- Indicates if the segment feature data is updated in this frame.
* - ``V4L2_VP8_SEGMENT_FLAG_DELTA_VALUE_MODE``
- 0x08
- If is set, the segment feature data mode is delta-value.
If cleared, it's absolute-value.
.. raw:: latex
\normalsize
.. c:type:: v4l2_vp8_loop_filter
.. cssclass:: longtable
.. tabularcolumns:: |p{1.5cm}|p{3.9cm}|p{11.9cm}|
.. flat-table:: struct v4l2_vp8_loop_filter
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - __s8
- ``ref_frm_delta[4]``
- Reference adjustment (signed) delta value.
* - __s8
- ``mb_mode_delta[4]``
- Macroblock prediction mode adjustment (signed) delta value.
* - __u8
- ``sharpness_level``
- Sharpness level
* - __u8
- ``level``
- Filter level
* - __u16
- ``padding``
- Applications and drivers must set this to zero.
* - __u32
- ``flags``
- See :ref:`Loop Filter Flags <vp8_loop_filter_flags>`
.. _vp8_loop_filter_flags:
``Loop Filter Flags``
.. tabularcolumns:: |p{7.0cm}|p{1.2cm}|p{9.1cm}|
.. flat-table::
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - ``V4L2_VP8_LF_ADJ_ENABLE``
- 0x01
- Enable/disable macroblock-level loop filter adjustment.
* - ``V4L2_VP8_LF_DELTA_UPDATE``
- 0x02
- Indicates if the delta values used in an adjustment are updated.
* - ``V4L2_VP8_LF_FILTER_TYPE_SIMPLE``
- 0x04
- If set, indicates the filter type is simple.
If cleared, the filter type is normal.
.. c:type:: v4l2_vp8_quantization
.. tabularcolumns:: |p{1.5cm}|p{3.5cm}|p{12.3cm}|
.. flat-table:: struct v4l2_vp8_quantization
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - __u8
- ``y_ac_qi``
- Luma AC coefficient table index.
* - __s8
- ``y_dc_delta``
- Luma DC delta vaue.
* - __s8
- ``y2_dc_delta``
- Y2 block DC delta value.
* - __s8
- ``y2_ac_delta``
- Y2 block AC delta value.
* - __s8
- ``uv_dc_delta``
- Chroma DC delta value.
* - __s8
- ``uv_ac_delta``
- Chroma AC delta value.
* - __u16
- ``padding``
- Applications and drivers must set this to zero.
.. c:type:: v4l2_vp8_entropy
.. cssclass:: longtable
.. tabularcolumns:: |p{1.5cm}|p{5.8cm}|p{10.0cm}|
.. flat-table:: struct v4l2_vp8_entropy
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - __u8
- ``coeff_probs[4][8][3][11]``
- Coefficient update probabilities.
* - __u8
- ``y_mode_probs[4]``
- Luma mode update probabilities.
* - __u8
- ``uv_mode_probs[3]``
- Chroma mode update probabilities.
* - __u8
- ``mv_probs[2][19]``
- MV decoding update probabilities.
* - __u8
- ``padding[3]``
- Applications and drivers must set this to zero.
.. raw:: latex
\normalsize

View File

@ -153,12 +153,12 @@ Compressed Formats
- ``V4L2_PIX_FMT_VP8_FRAME``
- 'VP8F'
- VP8 parsed frame, as extracted from the container.
This format is adapted for stateless video decoders that implement a
VP8 pipeline (using the :ref:`mem2mem` and :ref:`media-request-api`).
- VP8 parsed frame, including the frame header, as extracted from the container.
This format is adapted for stateless video decoders that implement an
VP8 pipeline with the :ref:`stateless_decoder`.
Metadata associated with the frame to decode is required to be passed
through the ``V4L2_CID_MPEG_VIDEO_VP8_FRAME`` control.
See the :ref:`associated Codec Control IDs <v4l2-mpeg-vp8>`.
through the ``V4L2_CID_STATELESS_VP8_FRAME`` control.
See the :ref:`associated Codec Control IDs <v4l2-codec-stateless-vp8>`.
Exactly one output and one capture buffer must be provided for use with
this pixel format. The output buffer must contain the appropriate number
of macroblocks to decode a full corresponding frame to the matching

View File

@ -216,6 +216,10 @@ still cause this situation.
- ``p_fwht_params``
- A pointer to a struct :c:type:`v4l2_ctrl_fwht_params`. Valid if this control is
of type ``V4L2_CTRL_TYPE_FWHT_PARAMS``.
* - struct :c:type:`v4l2_ctrl_vp8_frame` *
- ``p_vp8_frame``
- A pointer to a struct :c:type:`v4l2_ctrl_vp8_frame`. Valid if this control is
of type ``V4L2_CTRL_TYPE_VP8_FRAME``.
* - void *
- ``ptr``
- A pointer to a compound type which can be an N-dimensional array

View File

@ -489,6 +489,12 @@ See also the examples in :ref:`control`.
- n/a
- A struct :c:type:`v4l2_ctrl_hevc_slice_params`, containing HEVC
slice parameters for stateless video decoders.
* - ``V4L2_CTRL_TYPE_VP8_FRAME``
- n/a
- n/a
- n/a
- A struct :c:type:`v4l2_ctrl_vp8_frame`, containing VP8
frame parameters for stateless video decoders.
.. raw:: latex

View File

@ -147,6 +147,7 @@ replace symbol V4L2_CTRL_TYPE_HEVC_PPS :c:type:`v4l2_ctrl_type`
replace symbol V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS :c:type:`v4l2_ctrl_type`
replace symbol V4L2_CTRL_TYPE_AREA :c:type:`v4l2_ctrl_type`
replace symbol V4L2_CTRL_TYPE_FWHT_PARAMS :c:type:`v4l2_ctrl_type`
replace symbol V4L2_CTRL_TYPE_VP8_FRAME :c:type:`v4l2_ctrl_type`
# V4L2 capability defines
replace define V4L2_CAP_VIDEO_CAPTURE device-capabilities

View File

@ -974,7 +974,6 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_MPEG_VIDEO_VP8_PROFILE: return "VP8 Profile";
case V4L2_CID_MPEG_VIDEO_VP9_PROFILE: return "VP9 Profile";
case V4L2_CID_MPEG_VIDEO_VP9_LEVEL: return "VP9 Level";
case V4L2_CID_MPEG_VIDEO_VP8_FRAME: return "VP8 Frame Parameters";
/* HEVC controls */
case V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_QP: return "HEVC I-Frame QP Value";
@ -1204,6 +1203,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_STATELESS_H264_SLICE_PARAMS: return "H264 Slice Parameters";
case V4L2_CID_STATELESS_H264_DECODE_PARAMS: return "H264 Decode Parameters";
case V4L2_CID_STATELESS_FWHT_PARAMS: return "FWHT Stateless Parameters";
case V4L2_CID_STATELESS_VP8_FRAME: return "VP8 Frame Parameters";
default:
return NULL;
}
@ -1476,7 +1476,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
case V4L2_CID_STATELESS_H264_PRED_WEIGHTS:
*type = V4L2_CTRL_TYPE_H264_PRED_WEIGHTS;
break;
case V4L2_CID_MPEG_VIDEO_VP8_FRAME:
case V4L2_CID_STATELESS_VP8_FRAME:
*type = V4L2_CTRL_TYPE_VP8_FRAME;
break;
case V4L2_CID_MPEG_VIDEO_HEVC_SPS:

View File

@ -299,7 +299,7 @@ static const struct hantro_ctrl controls[] = {
}, {
.codec = HANTRO_VP8_DECODER,
.cfg = {
.id = V4L2_CID_MPEG_VIDEO_VP8_FRAME,
.id = V4L2_CID_STATELESS_VP8_FRAME,
},
}, {
.codec = HANTRO_H264_DECODER,

View File

@ -10,7 +10,6 @@
*/
#include <media/v4l2-mem2mem.h>
#include <media/vp8-ctrls.h>
#include "hantro_hw.h"
#include "hantro.h"
@ -437,7 +436,7 @@ void hantro_g1_vp8_dec_run(struct hantro_ctx *ctx)
hantro_start_prepare_run(ctx);
hdr = hantro_get_ctrl(ctx, V4L2_CID_MPEG_VIDEO_VP8_FRAME);
hdr = hantro_get_ctrl(ctx, V4L2_CID_STATELESS_VP8_FRAME);
if (WARN_ON(!hdr))
return;

View File

@ -13,7 +13,6 @@
*/
#include <media/v4l2-mem2mem.h>
#include <media/vp8-ctrls.h>
#include "hantro_hw.h"
#include "hantro.h"
@ -515,7 +514,7 @@ void rk3399_vpu_vp8_dec_run(struct hantro_ctx *ctx)
hantro_start_prepare_run(ctx);
hdr = hantro_get_ctrl(ctx, V4L2_CID_MPEG_VIDEO_VP8_FRAME);
hdr = hantro_get_ctrl(ctx, V4L2_CID_STATELESS_VP8_FRAME);
if (WARN_ON(!hdr))
return;

View File

@ -147,7 +147,7 @@ static const struct cedrus_control cedrus_controls[] = {
},
{
.cfg = {
.id = V4L2_CID_MPEG_VIDEO_VP8_FRAME,
.id = V4L2_CID_STATELESS_VP8_FRAME,
},
.codec = CEDRUS_CODEC_VP8,
},

View File

@ -72,7 +72,7 @@ void cedrus_device_run(void *priv)
case V4L2_PIX_FMT_VP8_FRAME:
run.vp8.frame_params = cedrus_find_control_data(ctx,
V4L2_CID_MPEG_VIDEO_VP8_FRAME);
V4L2_CID_STATELESS_VP8_FRAME);
break;
default:

View File

@ -423,7 +423,8 @@ static const u8 prob_table_init[] = {
* This table is a copy of k_mv_entropy_update_probs from the VP8
* specification.
*
* FIXME: If any other driver uses it, move this table to media/vp8-ctrls.h
* FIXME: If any other driver uses it, we can consider moving
* this table so it can be shared.
*/
static const u8 k_mv_entropy_update_probs[2][V4L2_VP8_MV_PROB_CNT] = {
{ 237, 246, 253, 253, 254, 254, 254, 254, 254,

View File

@ -18,7 +18,6 @@
* This will move to the public headers once this API is fully stable.
*/
#include <media/mpeg2-ctrls.h>
#include <media/vp8-ctrls.h>
#include <media/hevc-ctrls.h>
/* forward references */

View File

@ -1,210 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* These are the VP8 state controls for use with stateless VP8
* codec drivers.
*
* It turns out that these structs are not stable yet and will undergo
* more changes. So keep them private until they are stable and ready to
* become part of the official public API.
*/
#ifndef _VP8_CTRLS_H_
#define _VP8_CTRLS_H_
#include <linux/types.h>
#define V4L2_CID_MPEG_VIDEO_VP8_FRAME (V4L2_CID_CODEC_BASE + 2000)
#define V4L2_VP8_SEGMENT_FLAG_ENABLED 0x01
#define V4L2_VP8_SEGMENT_FLAG_UPDATE_MAP 0x02
#define V4L2_VP8_SEGMENT_FLAG_UPDATE_FEATURE_DATA 0x04
#define V4L2_VP8_SEGMENT_FLAG_DELTA_VALUE_MODE 0x08
/**
* struct v4l2_vp8_segment - VP8 segment-based adjustments parameters
*
* @quant_update: update values for the segment quantizer.
* @lf_update: update values for the loop filter level.
* @segment_probs: branch probabilities of the segment_id decoding tree.
* @padding: padding field. Should be zeroed by applications.
* @flags: see V4L2_VP8_SEGMENT_FLAG_{}.
*
* This structure contains segment-based adjustments related parameters.
* See the 'update_segmentation()' part of the frame header syntax,
* and section '9.3. Segment-Based Adjustments' of the VP8 specification
* for more details.
*/
struct v4l2_vp8_segment {
__s8 quant_update[4];
__s8 lf_update[4];
__u8 segment_probs[3];
__u8 padding;
__u32 flags;
};
#define V4L2_VP8_LF_ADJ_ENABLE 0x01
#define V4L2_VP8_LF_DELTA_UPDATE 0x02
#define V4L2_VP8_LF_FILTER_TYPE_SIMPLE 0x04
/**
* struct v4l2_vp8_loop_filter - VP8 loop filter parameters
*
* @ref_frm_delta: Reference frame signed delta values.
* @mb_mode_delta: MB prediction mode signed delta values.
* @sharpness_level: matches sharpness_level syntax element.
* @level: matches loop_filter_level syntax element.
* @padding: padding field. Should be zeroed by applications.
* @flags: see V4L2_VP8_LF_FLAG_{}.
*
* This structure contains loop filter related parameters.
* See the 'mb_lf_adjustments()' part of the frame header syntax,
* and section '9.4. Loop Filter Type and Levels' of the VP8 specification
* for more details.
*/
struct v4l2_vp8_loop_filter {
__s8 ref_frm_delta[4];
__s8 mb_mode_delta[4];
__u8 sharpness_level;
__u8 level;
__u16 padding;
__u32 flags;
};
/**
* struct v4l2_vp8_quantization - VP8 quantizattion indices
*
* @y_ac_qi: luma AC coefficient table index.
* @y_dc_delta: luma DC delta vaue.
* @y2_dc_delta: y2 block DC delta value.
* @y2_ac_delta: y2 block AC delta value.
* @uv_dc_delta: chroma DC delta value.
* @uv_ac_delta: chroma AC delta value.
* @padding: padding field. Should be zeroed by applications.
* This structure contains the quantization indices present
* in 'quant_indices()' part of the frame header syntax.
* See section '9.6. Dequantization Indices' of the VP8 specification
* for more details.
*/
struct v4l2_vp8_quantization {
__u8 y_ac_qi;
__s8 y_dc_delta;
__s8 y2_dc_delta;
__s8 y2_ac_delta;
__s8 uv_dc_delta;
__s8 uv_ac_delta;
__u16 padding;
};
#define V4L2_VP8_COEFF_PROB_CNT 11
#define V4L2_VP8_MV_PROB_CNT 19
/**
* struct v4l2_vp8_entropy - VP8 update probabilities
*
* @coeff_probs: coefficient probability update values.
* @y_mode_probs: luma intra-prediction probabilities.
* @uv_mode_probs: chroma intra-prediction probabilities.
* @mv_probs: mv decoding probability.
* @padding: padding field. Should be zeroed by applications.
*
* This structure contains the update probabilities present in
* 'token_prob_update()' and 'mv_prob_update()' part of the frame header.
* See section '17.2. Probability Updates' of the VP8 specification
* for more details.
*/
struct v4l2_vp8_entropy {
__u8 coeff_probs[4][8][3][V4L2_VP8_COEFF_PROB_CNT];
__u8 y_mode_probs[4];
__u8 uv_mode_probs[3];
__u8 mv_probs[2][V4L2_VP8_MV_PROB_CNT];
__u8 padding[3];
};
/**
* struct v4l2_vp8_entropy_coder_state - VP8 boolean coder state
*
* @range: coder state value for "Range"
* @value: coder state value for "Value"
* @bit_count: number of bits left in range "Value".
* @padding: padding field. Should be zeroed by applications.
*
* This structure contains the state for the boolean coder, as
* explained in section '7. Boolean Entropy Decoder' of the VP8 specification.
*/
struct v4l2_vp8_entropy_coder_state {
__u8 range;
__u8 value;
__u8 bit_count;
__u8 padding;
};
#define V4L2_VP8_FRAME_FLAG_KEY_FRAME 0x01
#define V4L2_VP8_FRAME_FLAG_EXPERIMENTAL 0x02
#define V4L2_VP8_FRAME_FLAG_SHOW_FRAME 0x04
#define V4L2_VP8_FRAME_FLAG_MB_NO_SKIP_COEFF 0x08
#define V4L2_VP8_FRAME_FLAG_SIGN_BIAS_GOLDEN 0x10
#define V4L2_VP8_FRAME_FLAG_SIGN_BIAS_ALT 0x20
#define V4L2_VP8_FRAME_IS_KEY_FRAME(hdr) \
(!!((hdr)->flags & V4L2_VP8_FRAME_FLAG_KEY_FRAME))
/**
* struct v4l2_vp8_frame - VP8 frame parameters
*
* @seg: segmentation parameters. See &v4l2_vp8_segment for more details
* @lf: loop filter parameters. See &v4l2_vp8_loop_filter for more details
* @quant: quantization parameters. See &v4l2_vp8_quantization for more details
* @probs: probabilities. See &v4l2_vp9_probabilities for more details
* @width: frame width.
* @height: frame height.
* @horizontal_scale: horizontal scaling factor.
* @vertical_scale: vertical scaling factor.
* @version: bitstream version.
* @prob_skip_false: frame header syntax element.
* @prob_intra: frame header syntax element.
* @prob_last: frame header syntax element.
* @prob_gf: frame header syntax element.
* @num_dct_parts: number of DCT coefficients partitions.
* @first_part_size: size of the first partition, i.e. the control partition.
* @first_part_header_bits: size in bits of the first partition header portion.
* @dct_part_sizes: DCT coefficients sizes.
* @last_frame_ts: "last" reference buffer timestamp.
* The timestamp refers to the timestamp field in struct v4l2_buffer.
* Use v4l2_timeval_to_ns() to convert the struct timeval to a __u64.
* @golden_frame_ts: "golden" reference buffer timestamp.
* @alt_frame_ts: "alt" reference buffer timestamp.
* @flags: see V4L2_VP8_FRAME_FLAG_{}.
*/
struct v4l2_ctrl_vp8_frame {
struct v4l2_vp8_segment segment;
struct v4l2_vp8_loop_filter lf;
struct v4l2_vp8_quantization quant;
struct v4l2_vp8_entropy entropy;
struct v4l2_vp8_entropy_coder_state coder_state;
__u16 width;
__u16 height;
__u8 horizontal_scale;
__u8 vertical_scale;
__u8 version;
__u8 prob_skip_false;
__u8 prob_intra;
__u8 prob_last;
__u8 prob_gf;
__u8 num_dct_parts;
__u32 first_part_size;
__u32 first_part_header_bits;
__u32 dct_part_sizes[8];
__u64 last_frame_ts;
__u64 golden_frame_ts;
__u64 alt_frame_ts;
__u64 flags;
};
#endif

View File

@ -1661,6 +1661,201 @@ struct v4l2_ctrl_fwht_params {
__u32 quantization;
};
/* Stateless VP8 control */
#define V4L2_VP8_SEGMENT_FLAG_ENABLED 0x01
#define V4L2_VP8_SEGMENT_FLAG_UPDATE_MAP 0x02
#define V4L2_VP8_SEGMENT_FLAG_UPDATE_FEATURE_DATA 0x04
#define V4L2_VP8_SEGMENT_FLAG_DELTA_VALUE_MODE 0x08
/**
* struct v4l2_vp8_segment - VP8 segment-based adjustments parameters
*
* @quant_update: update values for the segment quantizer.
* @lf_update: update values for the loop filter level.
* @segment_probs: branch probabilities of the segment_id decoding tree.
* @padding: padding field. Should be zeroed by applications.
* @flags: see V4L2_VP8_SEGMENT_FLAG_{}.
*
* This structure contains segment-based adjustments related parameters.
* See the 'update_segmentation()' part of the frame header syntax,
* and section '9.3. Segment-Based Adjustments' of the VP8 specification
* for more details.
*/
struct v4l2_vp8_segment {
__s8 quant_update[4];
__s8 lf_update[4];
__u8 segment_probs[3];
__u8 padding;
__u32 flags;
};
#define V4L2_VP8_LF_ADJ_ENABLE 0x01
#define V4L2_VP8_LF_DELTA_UPDATE 0x02
#define V4L2_VP8_LF_FILTER_TYPE_SIMPLE 0x04
/**
* struct v4l2_vp8_loop_filter - VP8 loop filter parameters
*
* @ref_frm_delta: Reference frame signed delta values.
* @mb_mode_delta: MB prediction mode signed delta values.
* @sharpness_level: matches sharpness_level syntax element.
* @level: matches loop_filter_level syntax element.
* @padding: padding field. Should be zeroed by applications.
* @flags: see V4L2_VP8_LF_FLAG_{}.
*
* This structure contains loop filter related parameters.
* See the 'mb_lf_adjustments()' part of the frame header syntax,
* and section '9.4. Loop Filter Type and Levels' of the VP8 specification
* for more details.
*/
struct v4l2_vp8_loop_filter {
__s8 ref_frm_delta[4];
__s8 mb_mode_delta[4];
__u8 sharpness_level;
__u8 level;
__u16 padding;
__u32 flags;
};
/**
* struct v4l2_vp8_quantization - VP8 quantizattion indices
*
* @y_ac_qi: luma AC coefficient table index.
* @y_dc_delta: luma DC delta vaue.
* @y2_dc_delta: y2 block DC delta value.
* @y2_ac_delta: y2 block AC delta value.
* @uv_dc_delta: chroma DC delta value.
* @uv_ac_delta: chroma AC delta value.
* @padding: padding field. Should be zeroed by applications.
* This structure contains the quantization indices present
* in 'quant_indices()' part of the frame header syntax.
* See section '9.6. Dequantization Indices' of the VP8 specification
* for more details.
*/
struct v4l2_vp8_quantization {
__u8 y_ac_qi;
__s8 y_dc_delta;
__s8 y2_dc_delta;
__s8 y2_ac_delta;
__s8 uv_dc_delta;
__s8 uv_ac_delta;
__u16 padding;
};
#define V4L2_VP8_COEFF_PROB_CNT 11
#define V4L2_VP8_MV_PROB_CNT 19
/**
* struct v4l2_vp8_entropy - VP8 update probabilities
*
* @coeff_probs: coefficient probability update values.
* @y_mode_probs: luma intra-prediction probabilities.
* @uv_mode_probs: chroma intra-prediction probabilities.
* @mv_probs: mv decoding probability.
* @padding: padding field. Should be zeroed by applications.
*
* This structure contains the update probabilities present in
* 'token_prob_update()' and 'mv_prob_update()' part of the frame header.
* See section '17.2. Probability Updates' of the VP8 specification
* for more details.
*/
struct v4l2_vp8_entropy {
__u8 coeff_probs[4][8][3][V4L2_VP8_COEFF_PROB_CNT];
__u8 y_mode_probs[4];
__u8 uv_mode_probs[3];
__u8 mv_probs[2][V4L2_VP8_MV_PROB_CNT];
__u8 padding[3];
};
/**
* struct v4l2_vp8_entropy_coder_state - VP8 boolean coder state
*
* @range: coder state value for "Range"
* @value: coder state value for "Value"
* @bit_count: number of bits left in range "Value".
* @padding: padding field. Should be zeroed by applications.
*
* This structure contains the state for the boolean coder, as
* explained in section '7. Boolean Entropy Decoder' of the VP8 specification.
*/
struct v4l2_vp8_entropy_coder_state {
__u8 range;
__u8 value;
__u8 bit_count;
__u8 padding;
};
#define V4L2_VP8_FRAME_FLAG_KEY_FRAME 0x01
#define V4L2_VP8_FRAME_FLAG_EXPERIMENTAL 0x02
#define V4L2_VP8_FRAME_FLAG_SHOW_FRAME 0x04
#define V4L2_VP8_FRAME_FLAG_MB_NO_SKIP_COEFF 0x08
#define V4L2_VP8_FRAME_FLAG_SIGN_BIAS_GOLDEN 0x10
#define V4L2_VP8_FRAME_FLAG_SIGN_BIAS_ALT 0x20
#define V4L2_VP8_FRAME_IS_KEY_FRAME(hdr) \
(!!((hdr)->flags & V4L2_VP8_FRAME_FLAG_KEY_FRAME))
#define V4L2_CID_STATELESS_VP8_FRAME (V4L2_CID_CODEC_STATELESS_BASE + 200)
/**
* struct v4l2_vp8_frame - VP8 frame parameters
*
* @seg: segmentation parameters. See &v4l2_vp8_segment for more details
* @lf: loop filter parameters. See &v4l2_vp8_loop_filter for more details
* @quant: quantization parameters. See &v4l2_vp8_quantization for more details
* @probs: probabilities. See &v4l2_vp9_probabilities for more details
* @width: frame width.
* @height: frame height.
* @horizontal_scale: horizontal scaling factor.
* @vertical_scale: vertical scaling factor.
* @version: bitstream version.
* @prob_skip_false: frame header syntax element.
* @prob_intra: frame header syntax element.
* @prob_last: frame header syntax element.
* @prob_gf: frame header syntax element.
* @num_dct_parts: number of DCT coefficients partitions.
* @first_part_size: size of the first partition, i.e. the control partition.
* @first_part_header_bits: size in bits of the first partition header portion.
* @dct_part_sizes: DCT coefficients sizes.
* @last_frame_ts: "last" reference buffer timestamp.
* The timestamp refers to the timestamp field in struct v4l2_buffer.
* Use v4l2_timeval_to_ns() to convert the struct timeval to a __u64.
* @golden_frame_ts: "golden" reference buffer timestamp.
* @alt_frame_ts: "alt" reference buffer timestamp.
* @flags: see V4L2_VP8_FRAME_FLAG_{}.
*/
struct v4l2_ctrl_vp8_frame {
struct v4l2_vp8_segment segment;
struct v4l2_vp8_loop_filter lf;
struct v4l2_vp8_quantization quant;
struct v4l2_vp8_entropy entropy;
struct v4l2_vp8_entropy_coder_state coder_state;
__u16 width;
__u16 height;
__u8 horizontal_scale;
__u8 vertical_scale;
__u8 version;
__u8 prob_skip_false;
__u8 prob_intra;
__u8 prob_last;
__u8 prob_gf;
__u8 num_dct_parts;
__u32 first_part_size;
__u32 first_part_header_bits;
__u32 dct_part_sizes[8];
__u64 last_frame_ts;
__u64 golden_frame_ts;
__u64 alt_frame_ts;
__u64 flags;
};
/* MPEG-compression definitions kept for backwards compatibility */
#ifndef __KERNEL__
#define V4L2_CTRL_CLASS_MPEG V4L2_CTRL_CLASS_CODEC

View File

@ -1738,6 +1738,7 @@ struct v4l2_ext_control {
struct v4l2_ctrl_h264_slice_params __user *p_h264_slice_params;
struct v4l2_ctrl_h264_decode_params __user *p_h264_decode_params;
struct v4l2_ctrl_fwht_params __user *p_fwht_params;
struct v4l2_ctrl_vp8_frame __user *p_vp8_frame;
void __user *ptr;
};
} __attribute__ ((packed));