This series aims to make HEVC uapi stable and usable for hardware
decoder. HEVC uapi is used by 2 mainlined drivers (Cedrus and Hantro)
and 2 out of the tree drivers (rkvdec and RPI).
version 10:
- Rebased on media_stage/master
- Add Acked-by tag from Nicolas
- Add Tested-by tag from Jernej
- Fix typo in patch 14
This version has been tested with these branches:
- GStreamer: https://gitlab.freedesktop.org/benjamin.gaignard1/gstreamer/-/tree/HEVC_aligned_with_kernel_5.15
- Linux: https://gitlab.collabora.com/benjamin.gaignard/for-upstream/-/tree/HEVC_UAPI_V10
With patches to decode 10-bits bitstream and produce P010 frames the Fluster score
which was 77/147 before, is now 141/147.
The 10-bits series will comes after this because of it dependency to
uAPI change. If you are curious you can find the WIP branch here:
https://gitlab.collabora.com/benjamin.gaignard/for-upstream/-/commits/WIP_HEVC_UAPI_V10
The 6 failing tests are:
- PICSIZE_{A,B,C,D}_Bossen_1 where resolutions are to big for Hantro hardware.
- WPP_D_ericsson_MAIN_2 and WPP_D_ericsson_MAIN10_2 are visually ok but some
difference exist on 5 decoded frames. Some pixels values are no the same
the very end of few lines.
version 9:
- Reword some commit message
- Use fls()
- Remove useless padding at the end of hevc structures
- Reword all _minus* field description
- change CVS to codec video sequence
- Fix various typo
- Fix undefined label: v4l2-ctrl-flag-dynamic-array warning
- fix the waring reported by 'scripts/kernel-doc -none
include/uapi/linux/v4l2-controls.h'
version 8:
- Same than v7 but rebased on media_stage/master
version 7:
- Apply Jernej patches for Cedrus about bit offset definition and
V4L2_CID_STATELESS_HEVC_SLICE_PARAMS being a dynamic array control.
- Based on media_tree/master
version 6:
- Add short_term_ref_pic_set_size and long_term_ref_pic_set_size
in v4l2_ctrl_hevc_decode_params structure.
- Change slice_pic_order_cnt type to s32 to match with PoC type.
- Set V4L2_CTRL_FLAG_DYNAMIC_ARRAY flag automatically when using
V4L2_CID_STATELESS_HEVC_SLICE_PARAMS control.
- Add a define for max slices count
- Stop using Hantro dedicated control.
version 5:
- Change __u16 pic_order_cnt[2] into __s32 pic_order_cnt_val in
hevc_dpb_entry structure
- Add defines for SEI pic_struct values (patch 4)
- Fix numbers of bits computation in cedrus_h265_skip_bits() parameters
- Fix num_short_term_ref_pic_sets and num_long_term_ref_pics_sps
documentation (patch 8)
- Rebased on v5-18-rc1
Version 4:
- Add num_entry_point_offsets field in struct v4l2_ctrl_hevc_slice_params
- Fix V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS name
- Initialize control V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS
- Fix space/tab issue in kernel-doc
- Add patch to change data_bit_offset definition
- Fix hantro-media SPDX license
- put controls under stateless section in v4l2-ctrls-defs.c
Benjamin Gaignard (14):
media: uapi: HEVC: Add missing fields in HEVC controls
media: uapi: HEVC: Rename HEVC stateless controls with STATELESS
prefix
media: uapi: HEVC: Change pic_order_cnt definition in
v4l2_hevc_dpb_entry
media: uapi: HEVC: Add SEI pic struct flags
media: uapi: HEVC: Add documentation to uAPI structure
media: uapi: HEVC: Define V4L2_CID_STATELESS_HEVC_SLICE_PARAMS as a
dynamic array
media: uapi: Move parsed HEVC pixel format out of staging
media: uapi: Add V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS control
media: uapi: Move the HEVC stateless control type out of staging
media: controls: Log HEVC stateless control in .std_log
media: hantro: Stop using Hantro dedicated control
media: uapi: HEVC: fix padding in v4l2 control structures
media: uapi: Change data_bit_offset definition
media: uapi: move HEVC stateless controls out of staging
Hans Verkuil (3):
videodev2.h: add V4L2_CTRL_FLAG_DYNAMIC_ARRAY
v4l2-ctrls: add support for dynamically allocated arrays.
vivid: add dynamic array test control
.../media/v4l/ext-ctrls-codec-stateless.rst | 897 ++++++++++++++++++
.../media/v4l/ext-ctrls-codec.rst | 780 ---------------
.../media/v4l/pixfmt-compressed.rst | 7 +-
.../media/v4l/vidioc-g-ext-ctrls.rst | 20 +
.../media/v4l/vidioc-queryctrl.rst | 8 +
.../media/videodev2.h.rst.exceptions | 6 +
.../media/test-drivers/vivid/vivid-ctrls.c | 15 +
drivers/media/v4l2-core/v4l2-ctrls-api.c | 103 +-
drivers/media/v4l2-core/v4l2-ctrls-core.c | 212 ++++-
drivers/media/v4l2-core/v4l2-ctrls-defs.c | 38 +-
drivers/media/v4l2-core/v4l2-ctrls-priv.h | 3 +-
drivers/media/v4l2-core/v4l2-ctrls-request.c | 13 +-
drivers/staging/media/hantro/hantro_drv.c | 62 +-
.../staging/media/hantro/hantro_g2_hevc_dec.c | 44 +-
drivers/staging/media/hantro/hantro_hevc.c | 10 +-
drivers/staging/media/hantro/hantro_hw.h | 4 +-
drivers/staging/media/sunxi/cedrus/cedrus.c | 26 +-
.../staging/media/sunxi/cedrus/cedrus_dec.c | 10 +-
.../staging/media/sunxi/cedrus/cedrus_h265.c | 23 +-
.../staging/media/sunxi/cedrus/cedrus_video.c | 1 -
include/media/hevc-ctrls.h | 250 -----
include/media/v4l2-ctrls.h | 48 +-
include/uapi/linux/v4l2-controls.h | 459 +++++++++
include/uapi/linux/videodev2.h | 13 +
24 files changed, 1826 insertions(+), 1226 deletions(-)
delete mode 100644 include/media/hevc-ctrls.h
--
2.32.0
Add kernel-doc documentation for all the HEVC structures.
Signed-off-by: Benjamin Gaignard <[email protected]>
Acked-by: Nicolas Dufresne <[email protected]>
Tested-by: Jernej Skrabec <[email protected]>
---
version 9:
- Reword all _minus* field description
- change CVS to codec video sequence
- Fix various typo
.../media/v4l/ext-ctrls-codec.rst | 168 +++++++------
include/media/hevc-ctrls.h | 221 +++++++++++++++++-
2 files changed, 313 insertions(+), 76 deletions(-)
diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
index 8ba16e8742f3..eeb60c9a1af4 100644
--- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
+++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
@@ -2695,70 +2695,76 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
of H.265 specifications.
* - __u16
- ``pic_width_in_luma_samples``
- -
+ - Specifies the width of each decoded picture in units of luma samples.
* - __u16
- ``pic_height_in_luma_samples``
- -
+ - Specifies the height of each decoded picture in units of luma samples.
* - __u8
- ``bit_depth_luma_minus8``
- -
+ - This value plus 8 specifies the bit depth of the samples of the luma array.
* - __u8
- ``bit_depth_chroma_minus8``
- -
+ - This value plus 8 specifies the bit depth of the samples of the chroma arrays.
* - __u8
- ``log2_max_pic_order_cnt_lsb_minus4``
- -
+ - This value plus 4 specifies the value of the variable MaxPicOrderCntLsb.
* - __u8
- ``sps_max_dec_pic_buffering_minus1``
- -
+ - This value plus 1 specifies the maximum required size of the decoded picture buffer for
+ the codec video sequence.
* - __u8
- ``sps_max_num_reorder_pics``
- -
+ - Indicates the maximum allowed number of pictures.
* - __u8
- ``sps_max_latency_increase_plus1``
- -
+ - Not equal to 0 is used to compute the value of SpsMaxLatencyPictures array.
* - __u8
- ``log2_min_luma_coding_block_size_minus3``
- -
+ - This value plus 3 specifies the minimum luma coding block size.
* - __u8
- ``log2_diff_max_min_luma_coding_block_size``
- -
+ - Specifies the difference between the maximum and minimum luma coding block size.
* - __u8
- ``log2_min_luma_transform_block_size_minus2``
- -
+ - This value plus 2 specifies the minimum luma transform block size.
* - __u8
- ``log2_diff_max_min_luma_transform_block_size``
- -
+ - Specifies the difference between the maximum and minimum luma transform block size.
* - __u8
- ``max_transform_hierarchy_depth_inter``
- -
+ - Specifies the maximum hierarchy depth for transform units of coding units coded
+ in inter prediction mode.
* - __u8
- ``max_transform_hierarchy_depth_intra``
- -
+ - Specifies the maximum hierarchy depth for transform units of coding units coded in
+ intra prediction mode.
* - __u8
- ``pcm_sample_bit_depth_luma_minus1``
- -
+ - This value plus 1 specifies the number of bits used to represent each of PCM sample
+ values of the luma component.
* - __u8
- ``pcm_sample_bit_depth_chroma_minus1``
- -
+ - This value plus 1 specifies the number of bits used to represent each of PCM sample
+ values of the chroma components.
* - __u8
- ``log2_min_pcm_luma_coding_block_size_minus3``
- -
+ - This value plus 3 specifies the minimum size of coding blocks.
* - __u8
- ``log2_diff_max_min_pcm_luma_coding_block_size``
- -
+ - Specifies the difference between the maximum and minimum size of coding blocks.
* - __u8
- ``num_short_term_ref_pic_sets``
- -
+ - Specifies the number of st_ref_pic_set() syntax structures included in the SPS.
* - __u8
- ``num_long_term_ref_pics_sps``
- -
+ - Specifies the number of candidate long-term reference pictures that are
+ specified in the SPS.
* - __u8
- ``chroma_format_idc``
- -
+ - Specifies the chroma sampling.
* - __u8
- ``sps_max_sub_layers_minus1``
- -
+ - This value plus 1 specifies the maximum number of temporal sub-layers.
* - __u64
- ``flags``
- See :ref:`Sequence Parameter Set Flags <hevc_sps_flags>`
@@ -2837,46 +2843,52 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
- Identifies the PPS for reference by other syntax elements.
* - __u8
- ``num_extra_slice_header_bits``
- -
+ - Specifies the number of extra slice header bits that are present
+ in the slice header RBSP for coded pictures referring to the PPS.
* - __u8
- ``num_ref_idx_l0_default_active_minus1``
- - Specifies the inferred value of num_ref_idx_l0_active_minus1
+ - This value plus 1 specifies the inferred value of num_ref_idx_l0_active_minus1
* - __u8
- ``num_ref_idx_l1_default_active_minus1``
- - Specifies the inferred value of num_ref_idx_l1_active_minus1
+ - This value plus 1 specifies the inferred value of num_ref_idx_l1_active_minus1
* - __s8
- ``init_qp_minus26``
- -
+ - This value plus 26 specifies the initial value of SliceQp Y for each slice
+ referring to the PPS.
* - __u8
- ``diff_cu_qp_delta_depth``
- -
+ - Specifies the difference between the luma coding tree block size
+ and the minimum luma coding block size of coding units that
+ convey cu_qp_delta_abs and cu_qp_delta_sign_flag.
* - __s8
- ``pps_cb_qp_offset``
- -
+ - Specify the offsets to the luma quantization parameter Cb.
* - __s8
- ``pps_cr_qp_offset``
- -
+ - Specify the offsets to the luma quantization parameter Cr.
* - __u8
- ``num_tile_columns_minus1``
- -
+ - This value plus 1 specifies the number of tile columns partitioning the picture.
* - __u8
- ``num_tile_rows_minus1``
- -
+ - This value plus 1 specifies the number of tile rows partitioning the picture.
* - __u8
- ``column_width_minus1[20]``
- -
+ - Plus 1 specifies the width of each tile column in units of
+ coding tree blocks.
* - __u8
- ``row_height_minus1[22]``
- -
+ - This value plus 1 specifies the height of each tile row in units of coding
+ tree blocks.
* - __s8
- ``pps_beta_offset_div2``
- -
+ - Specify the default deblocking parameter offsets for beta divided by 2.
* - __s8
- ``pps_tc_offset_div2``
- -
+ - Specify the default deblocking parameter offsets for tC divided by 2.
* - __u8
- ``log2_parallel_merge_level_minus2``
- -
+ - Plus 2 specifies the value of the variable Log2ParMrgLevel.
* - __u8
- ``padding[4]``
- Applications and drivers must set this to zero.
@@ -2998,10 +3010,10 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
- Offset (in bits) to the video data in the current slice data.
* - __u8
- ``nal_unit_type``
- -
+ - Specifies the coding type of the slice (B, P or I).
* - __u8
- ``nuh_temporal_id_plus1``
- -
+ - This value minus 1 specifies a temporal identifier for the NAL unit.
* - __u8
- ``slice_type``
-
@@ -3009,52 +3021,56 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
V4L2_HEVC_SLICE_TYPE_B).
* - __u8
- ``colour_plane_id``
- -
+ - Specifies the colour plane associated with the current slice.
* - __s32
- ``slice_pic_order_cnt``
- -
+ - Specifies the picture order count.
* - __u8
- ``num_ref_idx_l0_active_minus1``
- -
+ - This value plus 1 specifies the maximum reference index for
+ reference picture list 0 that may be used to decode the slice.
* - __u8
- ``num_ref_idx_l1_active_minus1``
- -
+ - This value plus 1 specifies the maximum reference index for
+ reference picture list 1 that may be used to decode the slice.
* - __u8
- ``collocated_ref_idx``
- -
+ - Specifies the reference index of the collocated picture used for
+ temporal motion vector prediction.
* - __u8
- ``five_minus_max_num_merge_cand``
- -
+ - Specifies the maximum number of merging motion vector prediction
+ candidates supported in the slice subtracted from 5.
* - __s8
- ``slice_qp_delta``
- -
+ - Specifies the initial value of QpY to be used for the coding blocks in the slice.
* - __s8
- ``slice_cb_qp_offset``
- -
+ - Specifies a difference to be added to the value of pps_cb_qp_offset.
* - __s8
- ``slice_cr_qp_offset``
- -
+ - Specifies a difference to be added to the value of pps_cr_qp_offset.
* - __s8
- ``slice_act_y_qp_offset``
- -
+ - screen content extension parameters
* - __s8
- ``slice_act_cb_qp_offset``
- -
+ - screen content extension parameters
* - __s8
- ``slice_act_cr_qp_offset``
- -
+ - screen content extension parameters
* - __s8
- ``slice_beta_offset_div2``
- -
+ - Specify the deblocking parameter offsets for beta divided by 2.
* - __s8
- ``slice_tc_offset_div2``
- -
+ - Specify the deblocking parameter offsets for tC divided by 2.
* - __u8
- ``pic_struct``
- -
+ - Indicates whether a picture should be displayed as a frame or as one or more fields.
* - __u32
- ``slice_segment_addr``
- -
+ - Specifies the address of the first coding tree block in the slice segment.
* - __u8
- ``ref_idx_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]``
- The list of L0 reference elements as indices in the DPB.
@@ -3219,11 +3235,9 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
- ``field_pic``
- Whether the reference is a field picture or a frame.
See :ref:`HEVC dpb field pic Flags <hevc_dpb_field_pic_flags>`
- * - __u16
- - ``pic_order_cnt[2]``
- - The picture order count of the reference. Only the first element of the
- array is used for frame pictures, while the first element identifies the
- top field and the second the bottom field in field-coded pictures.
+ * - __s32
+ - ``pic_order_cnt_val``
+ - The picture order count of the current picture.
* - __u8
- ``padding[2]``
- Applications and drivers must set this to zero.
@@ -3298,36 +3312,44 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
:stub-columns: 0
:widths: 1 1 2
- * - __u8
- - ``luma_log2_weight_denom``
- -
- * - __s8
- - ``delta_chroma_log2_weight_denom``
- -
* - __s8
- ``delta_luma_weight_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]``
- -
+ - The difference of the weighting factor applied to the luma
+ prediction value for list 0.
* - __s8
- ``luma_offset_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]``
- -
+ - The additive offset applied to the luma prediction value for list 0.
* - __s8
- ``delta_chroma_weight_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]``
- -
+ - The difference of the weighting factor applied to the chroma
+ prediction value for list 0.
* - __s8
- ``chroma_offset_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]``
- -
+ - The difference of the additive offset applied to the chroma
+ prediction values for list 0.
* - __s8
- ``delta_luma_weight_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]``
- -
+ - The difference of the weighting factor applied to the luma
+ prediction value for list 1.
* - __s8
- ``luma_offset_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]``
- -
+ - The additive offset applied to the luma prediction value for list 1.
* - __s8
- ``delta_chroma_weight_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]``
- -
+ - The difference of the weighting factor applied to the chroma
+ prediction value for list 1.
* - __s8
- ``chroma_offset_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]``
- -
+ - The difference of the additive offset applied to the chroma
+ prediction values for list 1.
+ * - __u8
+ - ``luma_log2_weight_denom``
+ - The base 2 logarithm of the denominator for all luma weighting
+ factors.
+ * - __s8
+ - ``delta_chroma_log2_weight_denom``
+ - The difference of the base 2 logarithm of the denominator for
+ all chroma weighting factors.
* - __u8
- ``padding[6]``
- Applications and drivers must set this to zero.
diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h
index f3695ab44389..57053cfa099b 100644
--- a/include/media/hevc-ctrls.h
+++ b/include/media/hevc-ctrls.h
@@ -55,9 +55,68 @@ enum v4l2_stateless_hevc_start_code {
#define V4L2_HEVC_SPS_FLAG_SPS_TEMPORAL_MVP_ENABLED (1ULL << 7)
#define V4L2_HEVC_SPS_FLAG_STRONG_INTRA_SMOOTHING_ENABLED (1ULL << 8)
-/* The controls are not stable at the moment and will likely be reworked. */
+/**
+ * struct v4l2_ctrl_hevc_sps - ITU-T Rec. H.265: Sequence parameter set
+ *
+ * @video_parameter_set_id: specifies the value of the
+ * vps_video_parameter_set_id of the active VPS
+ * @seq_parameter_set_id: provides an identifier for the SPS for
+ * reference by other syntax elements
+ * @pic_width_in_luma_samples: specifies the width of each decoded picture
+ * in units of luma samples
+ * @pic_height_in_luma_samples: specifies the height of each decoded picture
+ * in units of luma samples
+ * @bit_depth_luma_minus8: this value plus 8 specifies the bit depth of the
+ * samples of the luma array
+ * @bit_depth_chroma_minus8: this value plus 8 specifies the bit depth of the
+ * samples of the chroma arrays
+ * @log2_max_pic_order_cnt_lsb_minus4: this value plus 4 specifies the value
+ * of the variable MaxPicOrderCntLsb
+ * @sps_max_dec_pic_buffering_minus1: this value plus 1 specifies the maximum
+ * required size of the decoded picture
+ * buffer for the codec video sequence
+ * @sps_max_num_reorder_pics: indicates the maximum allowed number of pictures
+ * @sps_max_latency_increase_plus1: not equal to 0 is used to compute the
+ * value of SpsMaxLatencyPictures array
+ * @log2_min_luma_coding_block_size_minus3: this value plus 3 specifies the
+ * minimum luma coding block size
+ * @log2_diff_max_min_luma_coding_block_size: specifies the difference between
+ * the maximum and minimum luma
+ * coding block size
+ * @log2_min_luma_transform_block_size_minus2: this value plus 2 specifies the
+ * minimum luma transform block size
+ * @log2_diff_max_min_luma_transform_block_size: specifies the difference between
+ * the maximum and minimum luma
+ * transform block size
+ * @max_transform_hierarchy_depth_inter: specifies the maximum hierarchy
+ * depth for transform units of
+ * coding units coded in inter
+ * prediction mode
+ * @max_transform_hierarchy_depth_intra: specifies the maximum hierarchy
+ * depth for transform units of
+ * coding units coded in intra
+ * prediction mode
+ * @pcm_sample_bit_depth_luma_minus1: this value plus 1 specifies the number of
+ * bits used to represent each of PCM sample
+ * values of the luma component
+ * @pcm_sample_bit_depth_chroma_minus1: this value plus 1 specifies the number
+ * of bits used to represent each of PCM
+ * sample values of the chroma components
+ * @log2_min_pcm_luma_coding_block_size_minus3: this value plus 3 specifies the
+ * minimum size of coding blocks
+ * @log2_diff_max_min_pcm_luma_coding_block_size: specifies the difference between
+ * the maximum and minimum size of
+ * coding blocks
+ * @num_short_term_ref_pic_sets: specifies the number of st_ref_pic_set()
+ * syntax structures included in the SPS
+ * @num_long_term_ref_pics_sps: specifies the number of candidate long-term
+ * reference pictures that are specified in the SPS
+ * @chroma_format_idc: specifies the chroma sampling
+ * @sps_max_sub_layers_minus1: this value plus 1 specifies the maximum number
+ * of temporal sub-layers
+ * @flags: see V4L2_HEVC_SPS_FLAG_{}
+ */
struct v4l2_ctrl_hevc_sps {
- /* ISO/IEC 23008-2, ITU-T Rec. H.265: Sequence parameter set */
__u8 video_parameter_set_id;
__u8 seq_parameter_set_id;
__u16 pic_width_in_luma_samples;
@@ -108,8 +167,43 @@ struct v4l2_ctrl_hevc_sps {
#define V4L2_HEVC_PPS_FLAG_DEBLOCKING_FILTER_CONTROL_PRESENT (1ULL << 19)
#define V4L2_HEVC_PPS_FLAG_UNIFORM_SPACING (1ULL << 20)
+/**
+ * struct v4l2_ctrl_hevc_pps - ITU-T Rec. H.265: Picture parameter set
+ *
+ * @pic_parameter_set_id: identifies the PPS for reference by other
+ * syntax elements
+ * @num_extra_slice_header_bits: specifies the number of extra slice header
+ * bits that are present in the slice header RBSP
+ * for coded pictures referring to the PPS.
+ * @num_ref_idx_l0_default_active_minus1: this value plus 1 specifies the inferred
+ * value of num_ref_idx_l0_active_minus1
+ * @num_ref_idx_l1_default_active_minus1: this value plus 1 specifies the inferred
+ * value of num_ref_idx_l1_active_minus1
+ * @init_qp_minus26: this value plus 26 specifies the initial value of SliceQp Y
+ * for each slice referring to the PPS
+ * @diff_cu_qp_delta_depth: specifies the difference between the luma coding
+ * tree block size and the minimum luma coding block
+ * size of coding units that convey cu_qp_delta_abs
+ * and cu_qp_delta_sign_flag
+ * @pps_cb_qp_offset: specify the offsets to the luma quantization parameter Cb
+ * @pps_cr_qp_offset: specify the offsets to the luma quantization parameter Cr
+ * @num_tile_columns_minus1: this value plus 1 specifies the number of tile columns
+ * partitioning the picture
+ * @num_tile_rows_minus1: this value plus 1 specifies the number of tile rows
+ * partitioning the picture
+ * @column_width_minus1: this value plus 1 specifies the width of each tile column
+ * in units of coding tree blocks
+ * @row_height_minus1: this value plus 1 specifies the height of each tile row in
+ * units of coding tree blocks
+ * @pps_beta_offset_div2: specify the default deblocking parameter offsets for
+ * beta divided by 2
+ * @pps_tc_offset_div2: specify the default deblocking parameter offsets for tC
+ * divided by 2
+ * @log2_parallel_merge_level_minus2: this value plus 2 specifies the value of
+ * the variable Log2ParMrgLevel
+ * @flags: see V4L2_HEVC_PPS_FLAG_{}
+ */
struct v4l2_ctrl_hevc_pps {
- /* ISO/IEC 23008-2, ITU-T Rec. H.265: Picture parameter set */
__u8 pic_parameter_set_id;
__u8 num_extra_slice_header_bits;
__u8 num_ref_idx_l0_default_active_minus1;
@@ -148,6 +242,14 @@ struct v4l2_ctrl_hevc_pps {
#define V4L2_HEVC_DPB_ENTRIES_NUM_MAX 16
+/**
+ * struct v4l2_hevc_dpb_entry - HEVC decoded picture buffer entry
+ *
+ * @timestamp: timestamp of the V4L2 capture buffer to use as reference.
+ * @flags: long term flag for the reference frame
+ * @field_pic: whether the reference is a field picture or a frame.
+ * @pic_order_cnt_val: the picture order count of the reference.
+ */
struct v4l2_hevc_dpb_entry {
__u64 timestamp;
__u8 flags;
@@ -156,6 +258,31 @@ struct v4l2_hevc_dpb_entry {
__u8 padding[2];
};
+/**
+ * struct v4l2_hevc_pred_weight_table - HEVC weighted prediction parameters
+ *
+ * @delta_luma_weight_l0: the difference of the weighting factor applied
+ * to the luma prediction value for list 0
+ * @luma_offset_l0: the additive offset applied to the luma prediction value
+ * for list 0
+ * @delta_chroma_weight_l0: the difference of the weighting factor applied
+ * to the chroma prediction values for list 0
+ * @chroma_offset_l0: the difference of the additive offset applied to
+ * the chroma prediction values for list 0
+ * @delta_luma_weight_l1: the difference of the weighting factor applied
+ * to the luma prediction value for list 1
+ * @luma_offset_l1: the additive offset applied to the luma prediction value
+ * for list 1
+ * @delta_chroma_weight_l1: the difference of the weighting factor applied
+ * to the chroma prediction values for list 1
+ * @chroma_offset_l1: the difference of the additive offset applied to
+ * the chroma prediction values for list 1
+ * @luma_log2_weight_denom: the base 2 logarithm of the denominator for
+ * all luma weighting factors
+ * @delta_chroma_log2_weight_denom: the difference of the base 2 logarithm
+ * of the denominator for all chroma
+ * weighting factors
+ */
struct v4l2_hevc_pred_weight_table {
__s8 delta_luma_weight_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
__s8 luma_offset_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
@@ -184,6 +311,50 @@ struct v4l2_hevc_pred_weight_table {
#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED (1ULL << 8)
#define V4L2_HEVC_SLICE_PARAMS_FLAG_DEPENDENT_SLICE_SEGMENT (1ULL << 9)
+/**
+ * struct v4l2_ctrl_hevc_slice_params - HEVC slice parameters
+ *
+ * @bit_size: size (in bits) of the current slice data
+ * @data_bit_offset: offset (in bits) to the video data in the current slice data
+ * @nal_unit_type: specifies the coding type of the slice (B, P or I)
+ * @nuh_temporal_id_plus1: minus 1 specifies a temporal identifier for the NAL unit
+ * @slice_type: see V4L2_HEVC_SLICE_TYPE_{}
+ * @colour_plane_id: specifies the colour plane associated with the current slice
+ * @slice_pic_order_cnt: specifies the picture order count
+ * @num_ref_idx_l0_active_minus1: this value plus 1 specifies the maximum reference
+ * index for reference picture list 0 that may be
+ * used to decode the slice
+ * @num_ref_idx_l1_active_minus1: this value plus 1 specifies the maximum reference
+ * index for reference picture list 1 that may be
+ * used to decode the slice
+ * @collocated_ref_idx: specifies the reference index of the collocated picture used
+ * for temporal motion vector prediction
+ * @five_minus_max_num_merge_cand: specifies the maximum number of merging
+ * motion vector prediction candidates supported in
+ * the slice subtracted from 5
+ * @slice_qp_delta: specifies the initial value of QpY to be used for the coding
+ * blocks in the slice
+ * @slice_cb_qp_offset: specifies a difference to be added to the value of pps_cb_qp_offset
+ * @slice_cr_qp_offset: specifies a difference to be added to the value of pps_cr_qp_offset
+ * @slice_act_y_qp_offset: screen content extension parameters
+ * @slice_act_cb_qp_offset: screen content extension parameters
+ * @slice_act_cr_qp_offset: screen content extension parameters
+ * @slice_beta_offset_div2: specify the deblocking parameter offsets for beta divided by 2
+ * @slice_tc_offset_div2: specify the deblocking parameter offsets for tC divided by 2
+ * @pic_struct: indicates whether a picture should be displayed as a frame or as one or
+ * more fields
+ * @slice_segment_addr: specifies the address of the first coding tree block in
+ * the slice segment
+ * @ref_idx_l0: the list of L0 reference elements as indices in the DPB
+ * @ref_idx_l1: the list of L1 reference elements as indices in the DPB
+ * @short_term_ref_pic_set_size: specifies the size of short-term reference
+ * pictures included in the SPS
+ * @long_term_ref_pic_set_size: specifies the size of long-term reference
+ * picture include in the SPS
+ * @pred_weight_table: the prediction weight coefficients for inter-picture
+ * prediction
+ * @flags: see V4L2_HEVC_SLICE_PARAMS_FLAG_{}
+ */
struct v4l2_ctrl_hevc_slice_params {
__u32 bit_size;
__u32 data_bit_offset;
@@ -230,6 +401,28 @@ struct v4l2_ctrl_hevc_slice_params {
#define V4L2_HEVC_DECODE_PARAM_FLAG_IDR_PIC 0x2
#define V4L2_HEVC_DECODE_PARAM_FLAG_NO_OUTPUT_OF_PRIOR 0x4
+/**
+ * struct v4l2_ctrl_hevc_decode_params - HEVC decode parameters
+ *
+ * @pic_order_cnt_val: picture order count
+ * @short_term_ref_pic_set_size: specifies the size of short-term reference
+ * pictures set included in the SPS of the first slice
+ * @long_term_ref_pic_set_size: specifies the size of long-term reference
+ * pictures set include in the SPS of the first slice
+ * @num_active_dpb_entries: the number of entries in dpb
+ * @dpb: the decoded picture buffer, for meta-data about reference frames
+ * @num_poc_st_curr_before: the number of reference pictures in the short-term
+ * set that come before the current frame
+ * @num_poc_st_curr_after: the number of reference pictures in the short-term
+ * set that come after the current frame
+ * @num_poc_lt_curr: the number of reference pictures in the long-term set
+ * @poc_st_curr_before: provides the index of the short term before references
+ * in DPB array
+ * @poc_st_curr_after: provides the index of the short term after references
+ * in DPB array
+ * @poc_lt_curr: provides the index of the long term references in DPB array
+ * @flags: see V4L2_HEVC_DECODE_PARAM_FLAG_{}
+ */
struct v4l2_ctrl_hevc_decode_params {
__s32 pic_order_cnt_val;
__u16 short_term_ref_pic_set_size;
@@ -245,6 +438,28 @@ struct v4l2_ctrl_hevc_decode_params {
__u64 flags;
};
+/**
+ * struct v4l2_ctrl_hevc_scaling_matrix - HEVC scaling lists parameters
+ *
+ * @scaling_list_4x4: scaling list is used for the scaling process for
+ * transform coefficients. The values on each scaling
+ * list are expected in raster scan order
+ * @scaling_list_8x8: scaling list is used for the scaling process for
+ * transform coefficients. The values on each scaling
+ * list are expected in raster scan order
+ * @scaling_list_16x16: scaling list is used for the scaling process for
+ * transform coefficients. The values on each scaling
+ * list are expected in raster scan order
+ * @scaling_list_32x32: scaling list is used for the scaling process for
+ * transform coefficients. The values on each scaling
+ * list are expected in raster scan order
+ * @scaling_list_dc_coef_16x16: scaling list is used for the scaling process
+ * for transform coefficients. The values on each
+ * scaling list are expected in raster scan order.
+ * @scaling_list_dc_coef_32x32: scaling list is used for the scaling process
+ * for transform coefficients. The values on each
+ * scaling list are expected in raster scan order.
+ */
struct v4l2_ctrl_hevc_scaling_matrix {
__u8 scaling_list_4x4[6][16];
__u8 scaling_list_8x8[6][64];
--
2.32.0
'F.7.3.6.1 General slice segment header syntax' section of HEVC
specification describes that a slice header always end aligned on
byte boundary, therefore we only need to provide the data offset in bytes.
Signed-off-by: Benjamin Gaignard <[email protected]>
Acked-by: Nicolas Dufresne <[email protected]>
Tested-by: Jernej Skrabec <[email protected]>
---
.../media/v4l/ext-ctrls-codec.rst | 4 ++--
.../staging/media/sunxi/cedrus/cedrus_h265.c | 19 ++++++++++++++++++-
.../staging/media/sunxi/cedrus/cedrus_video.c | 1 -
include/media/hevc-ctrls.h | 4 ++--
4 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
index 889e2bcffde6..af5cb4e4ef73 100644
--- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
+++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
@@ -3008,8 +3008,8 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
- ``bit_size``
- Size (in bits) of the current slice data.
* - __u32
- - ``data_bit_offset``
- - Offset (in bits) to the video data in the current slice data.
+ - ``data_byte_offset``
+ - Offset (in bytes) to the video data in the current slice data.
* - __u32
- ``num_entry_point_offsets``
- Specifies the number of entry point offset syntax elements in the slice header.
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
index 411601975124..7b67cb4621cf 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
@@ -317,6 +317,8 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
u32 chroma_log2_weight_denom;
u32 output_pic_list_index;
u32 pic_order_cnt[2];
+ u8 *padding;
+ int count;
u32 reg;
sps = run->h265.sps;
@@ -405,7 +407,22 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
/* Initialize bitstream access. */
cedrus_write(dev, VE_DEC_H265_TRIGGER, VE_DEC_H265_TRIGGER_INIT_SWDEC);
- cedrus_h265_skip_bits(dev, slice_params->data_bit_offset);
+ /*
+ * Cedrus expects that bitstream pointer is actually at the end of the slice header
+ * instead of start of slice data. Padding is 8 bits at most (one bit set to 1 and
+ * at most seven bits set to 0), so we have to inspect only one byte before slice data.
+ */
+ padding = (u8 *)vb2_plane_vaddr(&run->src->vb2_buf, 0) +
+ slice_params->data_byte_offset - 1;
+
+ for (count = 0; count < 8; count++)
+ if (*padding & (1 << count))
+ break;
+
+ /* Include the one bit. */
+ count++;
+
+ cedrus_h265_skip_bits(dev, slice_params->data_byte_offset * 8 - count);
/* Bitstream parameters. */
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
index 33726175d980..66714609b577 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
@@ -568,7 +568,6 @@ int cedrus_queue_init(void *priv, struct vb2_queue *src_vq,
src_vq->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
src_vq->io_modes = VB2_MMAP | VB2_DMABUF;
- src_vq->dma_attrs = DMA_ATTR_NO_KERNEL_MAPPING;
src_vq->drv_priv = ctx;
src_vq->buf_struct_size = sizeof(struct cedrus_buffer);
src_vq->ops = &cedrus_qops;
diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h
index 7358cbfc3e4d..c89029b3c5da 100644
--- a/include/media/hevc-ctrls.h
+++ b/include/media/hevc-ctrls.h
@@ -310,7 +310,7 @@ struct v4l2_hevc_pred_weight_table {
* V4L2_CTRL_FLAG_DYNAMIC_ARRAY flag must be set when using it.
*
* @bit_size: size (in bits) of the current slice data
- * @data_bit_offset: offset (in bits) to the video data in the current slice data
+ * @data_byte_offset: offset (in bytes) to the video data in the current slice data
* @num_entry_point_offsets: specifies the number of entry point offset syntax
* elements in the slice header.
* @nal_unit_type: specifies the coding type of the slice (B, P or I)
@@ -356,7 +356,7 @@ struct v4l2_hevc_pred_weight_table {
*/
struct v4l2_ctrl_hevc_slice_params {
__u32 bit_size;
- __u32 data_bit_offset;
+ __u32 data_byte_offset;
__u32 num_entry_point_offsets;
/* ISO/IEC 23008-2, ITU-T Rec. H.265: NAL unit header */
__u8 nal_unit_type;
--
2.32.0
Simply print the type of the control.
Signed-off-by: Benjamin Gaignard <[email protected]>
Acked-by: Nicolas Dufresne <[email protected]>
Tested-by: Jernej Skrabec <[email protected]>
---
drivers/media/v4l2-core/v4l2-ctrls-core.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c
index ff8a61f24d0a..c5c5407584ff 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls-core.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c
@@ -307,6 +307,21 @@ static void std_log(const struct v4l2_ctrl *ctrl)
case V4L2_CTRL_TYPE_VP9_FRAME:
pr_cont("VP9_FRAME");
break;
+ case V4L2_CTRL_TYPE_HEVC_SPS:
+ pr_cont("HEVC_SPS");
+ break;
+ case V4L2_CTRL_TYPE_HEVC_PPS:
+ pr_cont("HEVC_PPS");
+ break;
+ case V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS:
+ pr_cont("HEVC_SLICE_PARAMS");
+ break;
+ case V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX:
+ pr_cont("HEVC_SCALING_MATRIX");
+ break;
+ case V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS:
+ pr_cont("HEVC_DECODE_PARAMS");
+ break;
default:
pr_cont("unknown type %d", ctrl->type);
break;
--
2.32.0
The number of 'entry point offset' can be very variable.
Instead of using a large static array define a v4l2 dynamic array
of U32 (V4L2_CTRL_TYPE_U32).
The number of entry point offsets is reported by the elems field
and in struct v4l2_ctrl_hevc_slice_params.num_entry_point_offsets
field.
Signed-off-by: Benjamin Gaignard <[email protected]>
Acked-by: Nicolas Dufresne <[email protected]>
Tested-by: Jernej Skrabec <[email protected]>
---
.../userspace-api/media/v4l/ext-ctrls-codec.rst | 11 +++++++++++
drivers/media/v4l2-core/v4l2-ctrls-defs.c | 5 +++++
include/media/hevc-ctrls.h | 5 ++++-
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
index db0df7d9f27c..8df8d7fdfe70 100644
--- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
+++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
@@ -3010,6 +3010,9 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
* - __u32
- ``data_bit_offset``
- Offset (in bits) to the video data in the current slice data.
+ * - __u32
+ - ``num_entry_point_offsets``
+ - Specifies the number of entry point offset syntax elements in the slice header.
* - __u8
- ``nal_unit_type``
- Specifies the coding type of the slice (B, P or I).
@@ -3150,6 +3153,14 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
\normalsize
+``V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS (integer)``
+ Specifies entry point offsets in bytes.
+ This control is a dynamically sized array. The number of entry point
+ offsets is reported by the ``elems`` field.
+ This bitstream parameter is defined according to :ref:`hevc`.
+ They are described in section 7.4.7.1 "General slice segment header
+ semantics" of the specification.
+
``V4L2_CID_STATELESS_HEVC_SCALING_MATRIX (struct)``
Specifies the HEVC scaling matrix parameters used for the scaling process
for transform coefficients.
diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
index d594efbcbb93..e22921e7ea61 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
@@ -1188,6 +1188,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_STATELESS_HEVC_DECODE_PARAMS: return "HEVC Decode Parameters";
case V4L2_CID_STATELESS_HEVC_DECODE_MODE: return "HEVC Decode Mode";
case V4L2_CID_STATELESS_HEVC_START_CODE: return "HEVC Start Code";
+ case V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS: return "HEVC Entry Point Offsets";
/* Colorimetry controls */
/* Keep the order of the 'case's the same as in v4l2-controls.h! */
@@ -1518,6 +1519,10 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
case V4L2_CID_STATELESS_HEVC_DECODE_PARAMS:
*type = V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS;
break;
+ case V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS:
+ *type = V4L2_CTRL_TYPE_U32;
+ *flags |= V4L2_CTRL_FLAG_DYNAMIC_ARRAY;
+ break;
case V4L2_CID_STATELESS_VP9_COMPRESSED_HDR:
*type = V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR;
break;
diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h
index a372c184689e..3a6601a46ced 100644
--- a/include/media/hevc-ctrls.h
+++ b/include/media/hevc-ctrls.h
@@ -20,6 +20,7 @@
#define V4L2_CID_STATELESS_HEVC_DECODE_PARAMS (V4L2_CID_CODEC_BASE + 1012)
#define V4L2_CID_STATELESS_HEVC_DECODE_MODE (V4L2_CID_CODEC_BASE + 1015)
#define V4L2_CID_STATELESS_HEVC_START_CODE (V4L2_CID_CODEC_BASE + 1016)
+#define V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS (V4L2_CID_CODEC_BASE + 1017)
/* enum v4l2_ctrl_type type values */
#define V4L2_CTRL_TYPE_HEVC_SPS 0x0120
@@ -316,6 +317,8 @@ struct v4l2_hevc_pred_weight_table {
*
* @bit_size: size (in bits) of the current slice data
* @data_bit_offset: offset (in bits) to the video data in the current slice data
+ * @num_entry_point_offsets: specifies the number of entry point offset syntax
+ * elements in the slice header.
* @nal_unit_type: specifies the coding type of the slice (B, P or I)
* @nuh_temporal_id_plus1: minus 1 specifies a temporal identifier for the NAL unit
* @slice_type: see V4L2_HEVC_SLICE_TYPE_{}
@@ -358,7 +361,7 @@ struct v4l2_hevc_pred_weight_table {
struct v4l2_ctrl_hevc_slice_params {
__u32 bit_size;
__u32 data_bit_offset;
-
+ __u32 num_entry_point_offsets;
/* ISO/IEC 23008-2, ITU-T Rec. H.265: NAL unit header */
__u8 nal_unit_type;
__u8 nuh_temporal_id_plus1;
--
2.32.0
Move HEVC pixel format since we are ready to stabilize the uAPI
Signed-off-by: Benjamin Gaignard <[email protected]>
Acked-by: Nicolas Dufresne <[email protected]>
Tested-by: Jernej Skrabec <[email protected]>
---
Documentation/userspace-api/media/v4l/pixfmt-compressed.rst | 5 -----
include/media/hevc-ctrls.h | 3 ---
include/uapi/linux/videodev2.h | 1 +
3 files changed, 1 insertion(+), 8 deletions(-)
diff --git a/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst b/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst
index 967fc803ef94..c352d91a73d8 100644
--- a/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst
+++ b/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst
@@ -215,11 +215,6 @@ Compressed Formats
See the :ref:`associated Codec Control IDs <v4l2-mpeg-hevc>`.
Buffers associated with this pixel format must contain the appropriate
number of macroblocks to decode a full corresponding frame.
-
- .. note::
-
- This format is not yet part of the public kernel API and it
- is expected to change.
* .. _V4L2-PIX-FMT-FWHT:
- ``V4L2_PIX_FMT_FWHT``
diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h
index 341fc795d550..a372c184689e 100644
--- a/include/media/hevc-ctrls.h
+++ b/include/media/hevc-ctrls.h
@@ -13,9 +13,6 @@
#include <linux/videodev2.h>
-/* The pixel format isn't stable at the moment and will likely be renamed. */
-#define V4L2_PIX_FMT_HEVC_SLICE v4l2_fourcc('S', '2', '6', '5') /* HEVC parsed slices */
-
#define V4L2_CID_STATELESS_HEVC_SPS (V4L2_CID_CODEC_BASE + 1008)
#define V4L2_CID_STATELESS_HEVC_PPS (V4L2_CID_CODEC_BASE + 1009)
#define V4L2_CID_STATELESS_HEVC_SLICE_PARAMS (V4L2_CID_CODEC_BASE + 1010)
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 9018aa984db3..37f9f23a67fe 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -712,6 +712,7 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_FWHT v4l2_fourcc('F', 'W', 'H', 'T') /* Fast Walsh Hadamard Transform (vicodec) */
#define V4L2_PIX_FMT_FWHT_STATELESS v4l2_fourcc('S', 'F', 'W', 'H') /* Stateless FWHT (vicodec) */
#define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '4') /* H264 parsed slices */
+#define V4L2_PIX_FMT_HEVC_SLICE v4l2_fourcc('S', '2', '6', '5') /* HEVC parsed slices */
/* Vendor-specific formats */
#define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
--
2.32.0
Complete the HEVC controls with missing fields from H.265 specifications.
Even if these fields aren't used by the current mainlined drivers
they will be required for (at least) the rkvdec driver.
Signed-off-by: Benjamin Gaignard <[email protected]>
Acked-by: Nicolas Dufresne <[email protected]>
Tested-by: Jernej Skrabec <[email protected]>
---
version 9:
- fix typo
.../media/v4l/ext-ctrls-codec.rst | 32 +++++++++++++++++++
include/media/hevc-ctrls.h | 8 ++++-
2 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
index 6183f43f4d73..cff742142a55 100644
--- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
+++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
@@ -2683,6 +2683,16 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
:stub-columns: 0
:widths: 1 1 2
+ * - __u8
+ - ``video_parameter_set_id``
+ - Specifies the value of the vps_video_parameter_set_id of the active VPS
+ as described in section "7.4.3.2.1 General sequence parameter set RBSP semantics"
+ of H.265 specifications.
+ * - __u8
+ - ``seq_parameter_set_id``
+ - Provides an identifier for the SPS for reference by other syntax elements
+ as described in section "7.4.3.2.1 General sequence parameter set RBSP semantics"
+ of H.265 specifications.
* - __u16
- ``pic_width_in_luma_samples``
-
@@ -2822,6 +2832,9 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
:stub-columns: 0
:widths: 1 1 2
+ * - __u8
+ - ``pic_parameter_set_id``
+ - Identifies the PPS for reference by other syntax elements.
* - __u8
- ``num_extra_slice_header_bits``
-
@@ -3048,6 +3061,15 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
* - __u8
- ``ref_idx_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]``
- The list of L1 reference elements as indices in the DPB.
+ * - __u16
+ - ``short_term_ref_pic_set_size``
+ - Specifies the size, in bits, of the short-term reference picture set, described as st_ref_pic_set()
+ in the specification, included in the slice header or SPS (section 7.3.6.1).
+ * - __u16
+ - ``long_term_ref_pic_set_size``
+ - Specifies the size, in bits, of the long-term reference picture set include in the slice header
+ or SPS. It is the number of bits in the conditional block if(long_term_ref_pics_present_flag)
+ in section 7.3.6.1 of the specification.
* - __u8
- ``padding``
- Applications and drivers must set this to zero.
@@ -3385,6 +3407,16 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
- ``pic_order_cnt_val``
- PicOrderCntVal as described in section 8.3.1 "Decoding process
for picture order count" of the specification.
+ * - __u16
+ - ``short_term_ref_pic_set_size``
+ - Specifies the size, in bits, of the short-term reference picture set, of the first slice
+ described as st_ref_pic_set() in the specification, included in the slice header
+ or SPS (section 7.3.6.1).
+ * - __u16
+ - ``long_term_ref_pic_set_size``
+ - Specifies the size, in bits, of the long-term reference picture set, of the first slice
+ included in the slice header or SPS. It is the number of bits in the conditional block
+ if(long_term_ref_pics_present_flag) in section 7.3.6.1 of the specification.
* - __u8
- ``num_active_dpb_entries``
- The number of entries in ``dpb``.
diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h
index 01ccda48d8c5..752a8d10782c 100644
--- a/include/media/hevc-ctrls.h
+++ b/include/media/hevc-ctrls.h
@@ -58,6 +58,8 @@ enum v4l2_mpeg_video_hevc_start_code {
/* The controls are not stable at the moment and will likely be reworked. */
struct v4l2_ctrl_hevc_sps {
/* ISO/IEC 23008-2, ITU-T Rec. H.265: Sequence parameter set */
+ __u8 video_parameter_set_id;
+ __u8 seq_parameter_set_id;
__u16 pic_width_in_luma_samples;
__u16 pic_height_in_luma_samples;
__u8 bit_depth_luma_minus8;
@@ -108,6 +110,7 @@ struct v4l2_ctrl_hevc_sps {
struct v4l2_ctrl_hevc_pps {
/* ISO/IEC 23008-2, ITU-T Rec. H.265: Picture parameter set */
+ __u8 pic_parameter_set_id;
__u8 num_extra_slice_header_bits;
__u8 num_ref_idx_l0_default_active_minus1;
__u8 num_ref_idx_l1_default_active_minus1;
@@ -199,7 +202,8 @@ struct v4l2_ctrl_hevc_slice_params {
__u32 slice_segment_addr;
__u8 ref_idx_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
__u8 ref_idx_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
-
+ __u16 short_term_ref_pic_set_size;
+ __u16 long_term_ref_pic_set_size;
__u8 padding;
/* ISO/IEC 23008-2, ITU-T Rec. H.265: Weighted prediction parameter */
@@ -214,6 +218,8 @@ struct v4l2_ctrl_hevc_slice_params {
struct v4l2_ctrl_hevc_decode_params {
__s32 pic_order_cnt_val;
+ __u16 short_term_ref_pic_set_size;
+ __u16 long_term_ref_pic_set_size;
__u8 num_active_dpb_entries;
struct v4l2_hevc_dpb_entry dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
__u8 num_poc_st_curr_before;
--
2.32.0
Move the HEVC stateless controls types out of staging,
and re-number them.
Signed-off-by: Benjamin Gaignard <[email protected]>
Acked-by: Nicolas Dufresne <[email protected]>
Tested-by: Jernej Skrabec <[email protected]>
---
.../userspace-api/media/videodev2.h.rst.exceptions | 5 +++++
include/media/hevc-ctrls.h | 7 -------
include/uapi/linux/videodev2.h | 6 ++++++
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/Documentation/userspace-api/media/videodev2.h.rst.exceptions b/Documentation/userspace-api/media/videodev2.h.rst.exceptions
index 0b91200776f8..2feea4a5a008 100644
--- a/Documentation/userspace-api/media/videodev2.h.rst.exceptions
+++ b/Documentation/userspace-api/media/videodev2.h.rst.exceptions
@@ -153,6 +153,11 @@ replace symbol V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR :c:type:`v4l2_ctrl_type`
replace symbol V4L2_CTRL_TYPE_VP9_FRAME :c:type:`v4l2_ctrl_type`
replace symbol V4L2_CTRL_TYPE_HDR10_CLL_INFO :c:type:`v4l2_ctrl_type`
replace symbol V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY :c:type:`v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_HEVC_SPS :c:type:`v4l2_ctrl_type`
+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_HEVC_SCALING_MATRIX :c:type:`v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS :c:type:`v4l2_ctrl_type`
# V4L2 capability defines
replace define V4L2_CAP_VIDEO_CAPTURE device-capabilities
diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h
index 3a6601a46ced..42d16e8a1050 100644
--- a/include/media/hevc-ctrls.h
+++ b/include/media/hevc-ctrls.h
@@ -22,13 +22,6 @@
#define V4L2_CID_STATELESS_HEVC_START_CODE (V4L2_CID_CODEC_BASE + 1016)
#define V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS (V4L2_CID_CODEC_BASE + 1017)
-/* enum v4l2_ctrl_type type values */
-#define V4L2_CTRL_TYPE_HEVC_SPS 0x0120
-#define V4L2_CTRL_TYPE_HEVC_PPS 0x0121
-#define V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS 0x0122
-#define V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX 0x0123
-#define V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS 0x0124
-
enum v4l2_stateless_hevc_decode_mode {
V4L2_STATELESS_HEVC_DECODE_MODE_SLICE_BASED,
V4L2_STATELESS_HEVC_DECODE_MODE_FRAME_BASED,
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 37f9f23a67fe..e0d19a6b5bc7 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -1836,6 +1836,12 @@ enum v4l2_ctrl_type {
V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR = 0x0260,
V4L2_CTRL_TYPE_VP9_FRAME = 0x0261,
+
+ V4L2_CTRL_TYPE_HEVC_SPS = 0x0270,
+ V4L2_CTRL_TYPE_HEVC_PPS = 0x0271,
+ V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS = 0x0272,
+ V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX = 0x0273,
+ V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS = 0x0274,
};
/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
--
2.32.0
On Tue, Jul 05, 2022 at 10:54:07AM +0200, Benjamin Gaignard wrote:
> Complete the HEVC controls with missing fields from H.265 specifications.
> Even if these fields aren't used by the current mainlined drivers
> they will be required for (at least) the rkvdec driver.
>
> Signed-off-by: Benjamin Gaignard <[email protected]>
> Acked-by: Nicolas Dufresne <[email protected]>
> Tested-by: Jernej Skrabec <[email protected]>
Reviewed-by: Ezequiel Garcia <[email protected]>
> ---
> version 9:
> - fix typo
>
> .../media/v4l/ext-ctrls-codec.rst | 32 +++++++++++++++++++
> include/media/hevc-ctrls.h | 8 ++++-
> 2 files changed, 39 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> index 6183f43f4d73..cff742142a55 100644
> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> @@ -2683,6 +2683,16 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
> :stub-columns: 0
> :widths: 1 1 2
>
> + * - __u8
> + - ``video_parameter_set_id``
> + - Specifies the value of the vps_video_parameter_set_id of the active VPS
> + as described in section "7.4.3.2.1 General sequence parameter set RBSP semantics"
> + of H.265 specifications.
> + * - __u8
> + - ``seq_parameter_set_id``
> + - Provides an identifier for the SPS for reference by other syntax elements
> + as described in section "7.4.3.2.1 General sequence parameter set RBSP semantics"
> + of H.265 specifications.
> * - __u16
> - ``pic_width_in_luma_samples``
> -
> @@ -2822,6 +2832,9 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
> :stub-columns: 0
> :widths: 1 1 2
>
> + * - __u8
> + - ``pic_parameter_set_id``
> + - Identifies the PPS for reference by other syntax elements.
> * - __u8
> - ``num_extra_slice_header_bits``
> -
> @@ -3048,6 +3061,15 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
> * - __u8
> - ``ref_idx_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]``
> - The list of L1 reference elements as indices in the DPB.
> + * - __u16
> + - ``short_term_ref_pic_set_size``
> + - Specifies the size, in bits, of the short-term reference picture set, described as st_ref_pic_set()
> + in the specification, included in the slice header or SPS (section 7.3.6.1).
> + * - __u16
> + - ``long_term_ref_pic_set_size``
> + - Specifies the size, in bits, of the long-term reference picture set include in the slice header
> + or SPS. It is the number of bits in the conditional block if(long_term_ref_pics_present_flag)
> + in section 7.3.6.1 of the specification.
> * - __u8
> - ``padding``
> - Applications and drivers must set this to zero.
> @@ -3385,6 +3407,16 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
> - ``pic_order_cnt_val``
> - PicOrderCntVal as described in section 8.3.1 "Decoding process
> for picture order count" of the specification.
> + * - __u16
> + - ``short_term_ref_pic_set_size``
> + - Specifies the size, in bits, of the short-term reference picture set, of the first slice
> + described as st_ref_pic_set() in the specification, included in the slice header
> + or SPS (section 7.3.6.1).
> + * - __u16
> + - ``long_term_ref_pic_set_size``
> + - Specifies the size, in bits, of the long-term reference picture set, of the first slice
> + included in the slice header or SPS. It is the number of bits in the conditional block
> + if(long_term_ref_pics_present_flag) in section 7.3.6.1 of the specification.
> * - __u8
> - ``num_active_dpb_entries``
> - The number of entries in ``dpb``.
> diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h
> index 01ccda48d8c5..752a8d10782c 100644
> --- a/include/media/hevc-ctrls.h
> +++ b/include/media/hevc-ctrls.h
> @@ -58,6 +58,8 @@ enum v4l2_mpeg_video_hevc_start_code {
> /* The controls are not stable at the moment and will likely be reworked. */
> struct v4l2_ctrl_hevc_sps {
> /* ISO/IEC 23008-2, ITU-T Rec. H.265: Sequence parameter set */
> + __u8 video_parameter_set_id;
> + __u8 seq_parameter_set_id;
> __u16 pic_width_in_luma_samples;
> __u16 pic_height_in_luma_samples;
> __u8 bit_depth_luma_minus8;
> @@ -108,6 +110,7 @@ struct v4l2_ctrl_hevc_sps {
>
> struct v4l2_ctrl_hevc_pps {
> /* ISO/IEC 23008-2, ITU-T Rec. H.265: Picture parameter set */
> + __u8 pic_parameter_set_id;
> __u8 num_extra_slice_header_bits;
> __u8 num_ref_idx_l0_default_active_minus1;
> __u8 num_ref_idx_l1_default_active_minus1;
> @@ -199,7 +202,8 @@ struct v4l2_ctrl_hevc_slice_params {
> __u32 slice_segment_addr;
> __u8 ref_idx_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
> __u8 ref_idx_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
> -
> + __u16 short_term_ref_pic_set_size;
> + __u16 long_term_ref_pic_set_size;
> __u8 padding;
>
> /* ISO/IEC 23008-2, ITU-T Rec. H.265: Weighted prediction parameter */
> @@ -214,6 +218,8 @@ struct v4l2_ctrl_hevc_slice_params {
>
> struct v4l2_ctrl_hevc_decode_params {
> __s32 pic_order_cnt_val;
> + __u16 short_term_ref_pic_set_size;
> + __u16 long_term_ref_pic_set_size;
> __u8 num_active_dpb_entries;
> struct v4l2_hevc_dpb_entry dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
> __u8 num_poc_st_curr_before;
> --
> 2.32.0
>
On Tue, Jul 05, 2022 at 10:54:11AM +0200, Benjamin Gaignard wrote:
> Add kernel-doc documentation for all the HEVC structures.
>
> Signed-off-by: Benjamin Gaignard <[email protected]>
> Acked-by: Nicolas Dufresne <[email protected]>
> Tested-by: Jernej Skrabec <[email protected]>
> ---
> version 9:
> - Reword all _minus* field description
> - change CVS to codec video sequence
> - Fix various typo
>
> .../media/v4l/ext-ctrls-codec.rst | 168 +++++++------
> include/media/hevc-ctrls.h | 221 +++++++++++++++++-
> 2 files changed, 313 insertions(+), 76 deletions(-)
>
> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> index 8ba16e8742f3..eeb60c9a1af4 100644
> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> @@ -2695,70 +2695,76 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
> of H.265 specifications.
> * - __u16
> - ``pic_width_in_luma_samples``
> - -
> + - Specifies the width of each decoded picture in units of luma samples.
> * - __u16
> - ``pic_height_in_luma_samples``
> - -
> + - Specifies the height of each decoded picture in units of luma samples.
> * - __u8
> - ``bit_depth_luma_minus8``
> - -
> + - This value plus 8 specifies the bit depth of the samples of the luma array.
> * - __u8
> - ``bit_depth_chroma_minus8``
> - -
> + - This value plus 8 specifies the bit depth of the samples of the chroma arrays.
> * - __u8
> - ``log2_max_pic_order_cnt_lsb_minus4``
> - -
> + - This value plus 4 specifies the value of the variable MaxPicOrderCntLsb.
> * - __u8
> - ``sps_max_dec_pic_buffering_minus1``
> - -
> + - This value plus 1 specifies the maximum required size of the decoded picture buffer for
> + the codec video sequence.
> * - __u8
> - ``sps_max_num_reorder_pics``
> - -
> + - Indicates the maximum allowed number of pictures.
> * - __u8
> - ``sps_max_latency_increase_plus1``
> - -
> + - Not equal to 0 is used to compute the value of SpsMaxLatencyPictures array.
> * - __u8
> - ``log2_min_luma_coding_block_size_minus3``
> - -
> + - This value plus 3 specifies the minimum luma coding block size.
> * - __u8
> - ``log2_diff_max_min_luma_coding_block_size``
> - -
> + - Specifies the difference between the maximum and minimum luma coding block size.
> * - __u8
> - ``log2_min_luma_transform_block_size_minus2``
> - -
> + - This value plus 2 specifies the minimum luma transform block size.
> * - __u8
> - ``log2_diff_max_min_luma_transform_block_size``
> - -
> + - Specifies the difference between the maximum and minimum luma transform block size.
> * - __u8
> - ``max_transform_hierarchy_depth_inter``
> - -
> + - Specifies the maximum hierarchy depth for transform units of coding units coded
> + in inter prediction mode.
> * - __u8
> - ``max_transform_hierarchy_depth_intra``
> - -
> + - Specifies the maximum hierarchy depth for transform units of coding units coded in
> + intra prediction mode.
> * - __u8
> - ``pcm_sample_bit_depth_luma_minus1``
> - -
> + - This value plus 1 specifies the number of bits used to represent each of PCM sample
> + values of the luma component.
> * - __u8
> - ``pcm_sample_bit_depth_chroma_minus1``
> - -
> + - This value plus 1 specifies the number of bits used to represent each of PCM sample
> + values of the chroma components.
> * - __u8
> - ``log2_min_pcm_luma_coding_block_size_minus3``
> - -
> + - This value plus 3 specifies the minimum size of coding blocks.
> * - __u8
> - ``log2_diff_max_min_pcm_luma_coding_block_size``
> - -
> + - Specifies the difference between the maximum and minimum size of coding blocks.
> * - __u8
> - ``num_short_term_ref_pic_sets``
> - -
> + - Specifies the number of st_ref_pic_set() syntax structures included in the SPS.
> * - __u8
> - ``num_long_term_ref_pics_sps``
> - -
> + - Specifies the number of candidate long-term reference pictures that are
> + specified in the SPS.
> * - __u8
> - ``chroma_format_idc``
> - -
> + - Specifies the chroma sampling.
> * - __u8
> - ``sps_max_sub_layers_minus1``
> - -
> + - This value plus 1 specifies the maximum number of temporal sub-layers.
> * - __u64
> - ``flags``
> - See :ref:`Sequence Parameter Set Flags <hevc_sps_flags>`
> @@ -2837,46 +2843,52 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
> - Identifies the PPS for reference by other syntax elements.
> * - __u8
> - ``num_extra_slice_header_bits``
> - -
> + - Specifies the number of extra slice header bits that are present
> + in the slice header RBSP for coded pictures referring to the PPS.
> * - __u8
> - ``num_ref_idx_l0_default_active_minus1``
> - - Specifies the inferred value of num_ref_idx_l0_active_minus1
> + - This value plus 1 specifies the inferred value of num_ref_idx_l0_active_minus1
Missing ending period.
> * - __u8
> - ``num_ref_idx_l1_default_active_minus1``
> - - Specifies the inferred value of num_ref_idx_l1_active_minus1
> + - This value plus 1 specifies the inferred value of num_ref_idx_l1_active_minus1
Ditto.
> * - __s8
> - ``init_qp_minus26``
> - -
> + - This value plus 26 specifies the initial value of SliceQp Y for each slice
> + referring to the PPS.
> * - __u8
> - ``diff_cu_qp_delta_depth``
> - -
> + - Specifies the difference between the luma coding tree block size
> + and the minimum luma coding block size of coding units that
> + convey cu_qp_delta_abs and cu_qp_delta_sign_flag.
> * - __s8
> - ``pps_cb_qp_offset``
> - -
> + - Specify the offsets to the luma quantization parameter Cb.
Should be "Specifies" for consistency.
> * - __s8
> - ``pps_cr_qp_offset``
> - -
> + - Specify the offsets to the luma quantization parameter Cr.
Ditto.
> * - __u8
> - ``num_tile_columns_minus1``
> - -
> + - This value plus 1 specifies the number of tile columns partitioning the picture.
> * - __u8
> - ``num_tile_rows_minus1``
> - -
> + - This value plus 1 specifies the number of tile rows partitioning the picture.
> * - __u8
> - ``column_width_minus1[20]``
> - -
> + - Plus 1 specifies the width of each tile column in units of
> + coding tree blocks.
> * - __u8
> - ``row_height_minus1[22]``
> - -
> + - This value plus 1 specifies the height of each tile row in units of coding
> + tree blocks.
> * - __s8
> - ``pps_beta_offset_div2``
> - -
> + - Specify the default deblocking parameter offsets for beta divided by 2.
Ditto.
> * - __s8
> - ``pps_tc_offset_div2``
> - -
> + - Specify the default deblocking parameter offsets for tC divided by 2.
Ditto.
> * - __u8
> - ``log2_parallel_merge_level_minus2``
> - -
> + - Plus 2 specifies the value of the variable Log2ParMrgLevel.
> * - __u8
> - ``padding[4]``
> - Applications and drivers must set this to zero.
> @@ -2998,10 +3010,10 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
> - Offset (in bits) to the video data in the current slice data.
> * - __u8
> - ``nal_unit_type``
> - -
> + - Specifies the coding type of the slice (B, P or I).
> * - __u8
> - ``nuh_temporal_id_plus1``
> - -
> + - This value minus 1 specifies a temporal identifier for the NAL unit.
> * - __u8
> - ``slice_type``
> -
> @@ -3009,52 +3021,56 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
> V4L2_HEVC_SLICE_TYPE_B).
> * - __u8
> - ``colour_plane_id``
> - -
> + - Specifies the colour plane associated with the current slice.
> * - __s32
> - ``slice_pic_order_cnt``
> - -
> + - Specifies the picture order count.
> * - __u8
> - ``num_ref_idx_l0_active_minus1``
> - -
> + - This value plus 1 specifies the maximum reference index for
> + reference picture list 0 that may be used to decode the slice.
> * - __u8
> - ``num_ref_idx_l1_active_minus1``
> - -
> + - This value plus 1 specifies the maximum reference index for
> + reference picture list 1 that may be used to decode the slice.
> * - __u8
> - ``collocated_ref_idx``
> - -
> + - Specifies the reference index of the collocated picture used for
> + temporal motion vector prediction.
> * - __u8
> - ``five_minus_max_num_merge_cand``
> - -
> + - Specifies the maximum number of merging motion vector prediction
> + candidates supported in the slice subtracted from 5.
> * - __s8
> - ``slice_qp_delta``
> - -
> + - Specifies the initial value of QpY to be used for the coding blocks in the slice.
> * - __s8
> - ``slice_cb_qp_offset``
> - -
> + - Specifies a difference to be added to the value of pps_cb_qp_offset.
> * - __s8
> - ``slice_cr_qp_offset``
> - -
> + - Specifies a difference to be added to the value of pps_cr_qp_offset.
> * - __s8
> - ``slice_act_y_qp_offset``
> - -
> + - screen content extension parameters
Missing period, and not starting with a capital.
> * - __s8
> - ``slice_act_cb_qp_offset``
> - -
> + - screen content extension parameters
> * - __s8
> - ``slice_act_cr_qp_offset``
> - -
> + - screen content extension parameters
> * - __s8
> - ``slice_beta_offset_div2``
> - -
> + - Specify the deblocking parameter offsets for beta divided by 2.
Ditto.
To the best of my knowledge, this looks good.
Reviewed-by: Ezequiel Garcia <[email protected]>
Thanks,
Ezequiel
> * - __s8
> - ``slice_tc_offset_div2``
> - -
> + - Specify the deblocking parameter offsets for tC divided by 2.
> * - __u8
> - ``pic_struct``
> - -
> + - Indicates whether a picture should be displayed as a frame or as one or more fields.
> * - __u32
> - ``slice_segment_addr``
> - -
> + - Specifies the address of the first coding tree block in the slice segment.
> * - __u8
> - ``ref_idx_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]``
> - The list of L0 reference elements as indices in the DPB.
> @@ -3219,11 +3235,9 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
> - ``field_pic``
> - Whether the reference is a field picture or a frame.
> See :ref:`HEVC dpb field pic Flags <hevc_dpb_field_pic_flags>`
> - * - __u16
> - - ``pic_order_cnt[2]``
> - - The picture order count of the reference. Only the first element of the
> - array is used for frame pictures, while the first element identifies the
> - top field and the second the bottom field in field-coded pictures.
> + * - __s32
> + - ``pic_order_cnt_val``
> + - The picture order count of the current picture.
> * - __u8
> - ``padding[2]``
> - Applications and drivers must set this to zero.
> @@ -3298,36 +3312,44 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
> :stub-columns: 0
> :widths: 1 1 2
>
> - * - __u8
> - - ``luma_log2_weight_denom``
> - -
> - * - __s8
> - - ``delta_chroma_log2_weight_denom``
> - -
> * - __s8
> - ``delta_luma_weight_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]``
> - -
> + - The difference of the weighting factor applied to the luma
> + prediction value for list 0.
> * - __s8
> - ``luma_offset_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]``
> - -
> + - The additive offset applied to the luma prediction value for list 0.
> * - __s8
> - ``delta_chroma_weight_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]``
> - -
> + - The difference of the weighting factor applied to the chroma
> + prediction value for list 0.
> * - __s8
> - ``chroma_offset_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]``
> - -
> + - The difference of the additive offset applied to the chroma
> + prediction values for list 0.
> * - __s8
> - ``delta_luma_weight_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]``
> - -
> + - The difference of the weighting factor applied to the luma
> + prediction value for list 1.
> * - __s8
> - ``luma_offset_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]``
> - -
> + - The additive offset applied to the luma prediction value for list 1.
> * - __s8
> - ``delta_chroma_weight_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]``
> - -
> + - The difference of the weighting factor applied to the chroma
> + prediction value for list 1.
> * - __s8
> - ``chroma_offset_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]``
> - -
> + - The difference of the additive offset applied to the chroma
> + prediction values for list 1.
> + * - __u8
> + - ``luma_log2_weight_denom``
> + - The base 2 logarithm of the denominator for all luma weighting
> + factors.
> + * - __s8
> + - ``delta_chroma_log2_weight_denom``
> + - The difference of the base 2 logarithm of the denominator for
> + all chroma weighting factors.
> * - __u8
> - ``padding[6]``
> - Applications and drivers must set this to zero.
> diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h
> index f3695ab44389..57053cfa099b 100644
> --- a/include/media/hevc-ctrls.h
> +++ b/include/media/hevc-ctrls.h
> @@ -55,9 +55,68 @@ enum v4l2_stateless_hevc_start_code {
> #define V4L2_HEVC_SPS_FLAG_SPS_TEMPORAL_MVP_ENABLED (1ULL << 7)
> #define V4L2_HEVC_SPS_FLAG_STRONG_INTRA_SMOOTHING_ENABLED (1ULL << 8)
>
> -/* The controls are not stable at the moment and will likely be reworked. */
> +/**
> + * struct v4l2_ctrl_hevc_sps - ITU-T Rec. H.265: Sequence parameter set
> + *
> + * @video_parameter_set_id: specifies the value of the
> + * vps_video_parameter_set_id of the active VPS
> + * @seq_parameter_set_id: provides an identifier for the SPS for
> + * reference by other syntax elements
> + * @pic_width_in_luma_samples: specifies the width of each decoded picture
> + * in units of luma samples
> + * @pic_height_in_luma_samples: specifies the height of each decoded picture
> + * in units of luma samples
> + * @bit_depth_luma_minus8: this value plus 8 specifies the bit depth of the
> + * samples of the luma array
> + * @bit_depth_chroma_minus8: this value plus 8 specifies the bit depth of the
> + * samples of the chroma arrays
> + * @log2_max_pic_order_cnt_lsb_minus4: this value plus 4 specifies the value
> + * of the variable MaxPicOrderCntLsb
> + * @sps_max_dec_pic_buffering_minus1: this value plus 1 specifies the maximum
> + * required size of the decoded picture
> + * buffer for the codec video sequence
> + * @sps_max_num_reorder_pics: indicates the maximum allowed number of pictures
> + * @sps_max_latency_increase_plus1: not equal to 0 is used to compute the
> + * value of SpsMaxLatencyPictures array
> + * @log2_min_luma_coding_block_size_minus3: this value plus 3 specifies the
> + * minimum luma coding block size
> + * @log2_diff_max_min_luma_coding_block_size: specifies the difference between
> + * the maximum and minimum luma
> + * coding block size
> + * @log2_min_luma_transform_block_size_minus2: this value plus 2 specifies the
> + * minimum luma transform block size
> + * @log2_diff_max_min_luma_transform_block_size: specifies the difference between
> + * the maximum and minimum luma
> + * transform block size
> + * @max_transform_hierarchy_depth_inter: specifies the maximum hierarchy
> + * depth for transform units of
> + * coding units coded in inter
> + * prediction mode
> + * @max_transform_hierarchy_depth_intra: specifies the maximum hierarchy
> + * depth for transform units of
> + * coding units coded in intra
> + * prediction mode
> + * @pcm_sample_bit_depth_luma_minus1: this value plus 1 specifies the number of
> + * bits used to represent each of PCM sample
> + * values of the luma component
> + * @pcm_sample_bit_depth_chroma_minus1: this value plus 1 specifies the number
> + * of bits used to represent each of PCM
> + * sample values of the chroma components
> + * @log2_min_pcm_luma_coding_block_size_minus3: this value plus 3 specifies the
> + * minimum size of coding blocks
> + * @log2_diff_max_min_pcm_luma_coding_block_size: specifies the difference between
> + * the maximum and minimum size of
> + * coding blocks
> + * @num_short_term_ref_pic_sets: specifies the number of st_ref_pic_set()
> + * syntax structures included in the SPS
> + * @num_long_term_ref_pics_sps: specifies the number of candidate long-term
> + * reference pictures that are specified in the SPS
> + * @chroma_format_idc: specifies the chroma sampling
> + * @sps_max_sub_layers_minus1: this value plus 1 specifies the maximum number
> + * of temporal sub-layers
> + * @flags: see V4L2_HEVC_SPS_FLAG_{}
> + */
> struct v4l2_ctrl_hevc_sps {
> - /* ISO/IEC 23008-2, ITU-T Rec. H.265: Sequence parameter set */
> __u8 video_parameter_set_id;
> __u8 seq_parameter_set_id;
> __u16 pic_width_in_luma_samples;
> @@ -108,8 +167,43 @@ struct v4l2_ctrl_hevc_sps {
> #define V4L2_HEVC_PPS_FLAG_DEBLOCKING_FILTER_CONTROL_PRESENT (1ULL << 19)
> #define V4L2_HEVC_PPS_FLAG_UNIFORM_SPACING (1ULL << 20)
>
> +/**
> + * struct v4l2_ctrl_hevc_pps - ITU-T Rec. H.265: Picture parameter set
> + *
> + * @pic_parameter_set_id: identifies the PPS for reference by other
> + * syntax elements
> + * @num_extra_slice_header_bits: specifies the number of extra slice header
> + * bits that are present in the slice header RBSP
> + * for coded pictures referring to the PPS.
> + * @num_ref_idx_l0_default_active_minus1: this value plus 1 specifies the inferred
> + * value of num_ref_idx_l0_active_minus1
> + * @num_ref_idx_l1_default_active_minus1: this value plus 1 specifies the inferred
> + * value of num_ref_idx_l1_active_minus1
> + * @init_qp_minus26: this value plus 26 specifies the initial value of SliceQp Y
> + * for each slice referring to the PPS
> + * @diff_cu_qp_delta_depth: specifies the difference between the luma coding
> + * tree block size and the minimum luma coding block
> + * size of coding units that convey cu_qp_delta_abs
> + * and cu_qp_delta_sign_flag
> + * @pps_cb_qp_offset: specify the offsets to the luma quantization parameter Cb
> + * @pps_cr_qp_offset: specify the offsets to the luma quantization parameter Cr
> + * @num_tile_columns_minus1: this value plus 1 specifies the number of tile columns
> + * partitioning the picture
> + * @num_tile_rows_minus1: this value plus 1 specifies the number of tile rows
> + * partitioning the picture
> + * @column_width_minus1: this value plus 1 specifies the width of each tile column
> + * in units of coding tree blocks
> + * @row_height_minus1: this value plus 1 specifies the height of each tile row in
> + * units of coding tree blocks
> + * @pps_beta_offset_div2: specify the default deblocking parameter offsets for
> + * beta divided by 2
> + * @pps_tc_offset_div2: specify the default deblocking parameter offsets for tC
> + * divided by 2
> + * @log2_parallel_merge_level_minus2: this value plus 2 specifies the value of
> + * the variable Log2ParMrgLevel
> + * @flags: see V4L2_HEVC_PPS_FLAG_{}
> + */
> struct v4l2_ctrl_hevc_pps {
> - /* ISO/IEC 23008-2, ITU-T Rec. H.265: Picture parameter set */
> __u8 pic_parameter_set_id;
> __u8 num_extra_slice_header_bits;
> __u8 num_ref_idx_l0_default_active_minus1;
> @@ -148,6 +242,14 @@ struct v4l2_ctrl_hevc_pps {
>
> #define V4L2_HEVC_DPB_ENTRIES_NUM_MAX 16
>
> +/**
> + * struct v4l2_hevc_dpb_entry - HEVC decoded picture buffer entry
> + *
> + * @timestamp: timestamp of the V4L2 capture buffer to use as reference.
> + * @flags: long term flag for the reference frame
> + * @field_pic: whether the reference is a field picture or a frame.
> + * @pic_order_cnt_val: the picture order count of the reference.
> + */
> struct v4l2_hevc_dpb_entry {
> __u64 timestamp;
> __u8 flags;
> @@ -156,6 +258,31 @@ struct v4l2_hevc_dpb_entry {
> __u8 padding[2];
> };
>
> +/**
> + * struct v4l2_hevc_pred_weight_table - HEVC weighted prediction parameters
> + *
> + * @delta_luma_weight_l0: the difference of the weighting factor applied
> + * to the luma prediction value for list 0
> + * @luma_offset_l0: the additive offset applied to the luma prediction value
> + * for list 0
> + * @delta_chroma_weight_l0: the difference of the weighting factor applied
> + * to the chroma prediction values for list 0
> + * @chroma_offset_l0: the difference of the additive offset applied to
> + * the chroma prediction values for list 0
> + * @delta_luma_weight_l1: the difference of the weighting factor applied
> + * to the luma prediction value for list 1
> + * @luma_offset_l1: the additive offset applied to the luma prediction value
> + * for list 1
> + * @delta_chroma_weight_l1: the difference of the weighting factor applied
> + * to the chroma prediction values for list 1
> + * @chroma_offset_l1: the difference of the additive offset applied to
> + * the chroma prediction values for list 1
> + * @luma_log2_weight_denom: the base 2 logarithm of the denominator for
> + * all luma weighting factors
> + * @delta_chroma_log2_weight_denom: the difference of the base 2 logarithm
> + * of the denominator for all chroma
> + * weighting factors
> + */
> struct v4l2_hevc_pred_weight_table {
> __s8 delta_luma_weight_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
> __s8 luma_offset_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
> @@ -184,6 +311,50 @@ struct v4l2_hevc_pred_weight_table {
> #define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED (1ULL << 8)
> #define V4L2_HEVC_SLICE_PARAMS_FLAG_DEPENDENT_SLICE_SEGMENT (1ULL << 9)
>
> +/**
> + * struct v4l2_ctrl_hevc_slice_params - HEVC slice parameters
> + *
> + * @bit_size: size (in bits) of the current slice data
> + * @data_bit_offset: offset (in bits) to the video data in the current slice data
> + * @nal_unit_type: specifies the coding type of the slice (B, P or I)
> + * @nuh_temporal_id_plus1: minus 1 specifies a temporal identifier for the NAL unit
> + * @slice_type: see V4L2_HEVC_SLICE_TYPE_{}
> + * @colour_plane_id: specifies the colour plane associated with the current slice
> + * @slice_pic_order_cnt: specifies the picture order count
> + * @num_ref_idx_l0_active_minus1: this value plus 1 specifies the maximum reference
> + * index for reference picture list 0 that may be
> + * used to decode the slice
> + * @num_ref_idx_l1_active_minus1: this value plus 1 specifies the maximum reference
> + * index for reference picture list 1 that may be
> + * used to decode the slice
> + * @collocated_ref_idx: specifies the reference index of the collocated picture used
> + * for temporal motion vector prediction
> + * @five_minus_max_num_merge_cand: specifies the maximum number of merging
> + * motion vector prediction candidates supported in
> + * the slice subtracted from 5
> + * @slice_qp_delta: specifies the initial value of QpY to be used for the coding
> + * blocks in the slice
> + * @slice_cb_qp_offset: specifies a difference to be added to the value of pps_cb_qp_offset
> + * @slice_cr_qp_offset: specifies a difference to be added to the value of pps_cr_qp_offset
> + * @slice_act_y_qp_offset: screen content extension parameters
> + * @slice_act_cb_qp_offset: screen content extension parameters
> + * @slice_act_cr_qp_offset: screen content extension parameters
> + * @slice_beta_offset_div2: specify the deblocking parameter offsets for beta divided by 2
> + * @slice_tc_offset_div2: specify the deblocking parameter offsets for tC divided by 2
> + * @pic_struct: indicates whether a picture should be displayed as a frame or as one or
> + * more fields
> + * @slice_segment_addr: specifies the address of the first coding tree block in
> + * the slice segment
> + * @ref_idx_l0: the list of L0 reference elements as indices in the DPB
> + * @ref_idx_l1: the list of L1 reference elements as indices in the DPB
> + * @short_term_ref_pic_set_size: specifies the size of short-term reference
> + * pictures included in the SPS
> + * @long_term_ref_pic_set_size: specifies the size of long-term reference
> + * picture include in the SPS
> + * @pred_weight_table: the prediction weight coefficients for inter-picture
> + * prediction
> + * @flags: see V4L2_HEVC_SLICE_PARAMS_FLAG_{}
> + */
> struct v4l2_ctrl_hevc_slice_params {
> __u32 bit_size;
> __u32 data_bit_offset;
> @@ -230,6 +401,28 @@ struct v4l2_ctrl_hevc_slice_params {
> #define V4L2_HEVC_DECODE_PARAM_FLAG_IDR_PIC 0x2
> #define V4L2_HEVC_DECODE_PARAM_FLAG_NO_OUTPUT_OF_PRIOR 0x4
>
> +/**
> + * struct v4l2_ctrl_hevc_decode_params - HEVC decode parameters
> + *
> + * @pic_order_cnt_val: picture order count
> + * @short_term_ref_pic_set_size: specifies the size of short-term reference
> + * pictures set included in the SPS of the first slice
> + * @long_term_ref_pic_set_size: specifies the size of long-term reference
> + * pictures set include in the SPS of the first slice
> + * @num_active_dpb_entries: the number of entries in dpb
> + * @dpb: the decoded picture buffer, for meta-data about reference frames
> + * @num_poc_st_curr_before: the number of reference pictures in the short-term
> + * set that come before the current frame
> + * @num_poc_st_curr_after: the number of reference pictures in the short-term
> + * set that come after the current frame
> + * @num_poc_lt_curr: the number of reference pictures in the long-term set
> + * @poc_st_curr_before: provides the index of the short term before references
> + * in DPB array
> + * @poc_st_curr_after: provides the index of the short term after references
> + * in DPB array
> + * @poc_lt_curr: provides the index of the long term references in DPB array
> + * @flags: see V4L2_HEVC_DECODE_PARAM_FLAG_{}
> + */
> struct v4l2_ctrl_hevc_decode_params {
> __s32 pic_order_cnt_val;
> __u16 short_term_ref_pic_set_size;
> @@ -245,6 +438,28 @@ struct v4l2_ctrl_hevc_decode_params {
> __u64 flags;
> };
>
> +/**
> + * struct v4l2_ctrl_hevc_scaling_matrix - HEVC scaling lists parameters
> + *
> + * @scaling_list_4x4: scaling list is used for the scaling process for
> + * transform coefficients. The values on each scaling
> + * list are expected in raster scan order
> + * @scaling_list_8x8: scaling list is used for the scaling process for
> + * transform coefficients. The values on each scaling
> + * list are expected in raster scan order
> + * @scaling_list_16x16: scaling list is used for the scaling process for
> + * transform coefficients. The values on each scaling
> + * list are expected in raster scan order
> + * @scaling_list_32x32: scaling list is used for the scaling process for
> + * transform coefficients. The values on each scaling
> + * list are expected in raster scan order
> + * @scaling_list_dc_coef_16x16: scaling list is used for the scaling process
> + * for transform coefficients. The values on each
> + * scaling list are expected in raster scan order.
> + * @scaling_list_dc_coef_32x32: scaling list is used for the scaling process
> + * for transform coefficients. The values on each
> + * scaling list are expected in raster scan order.
> + */
> struct v4l2_ctrl_hevc_scaling_matrix {
> __u8 scaling_list_4x4[6][16];
> __u8 scaling_list_8x8[6][64];
> --
> 2.32.0
>
On Tue, Jul 05, 2022 at 10:54:15AM +0200, Benjamin Gaignard wrote:
> Move the HEVC stateless controls types out of staging,
> and re-number them.
>
> Signed-off-by: Benjamin Gaignard <[email protected]>
> Acked-by: Nicolas Dufresne <[email protected]>
> Tested-by: Jernej Skrabec <[email protected]>
Reviewed-by: Ezequiel Garcia <[email protected]>
> ---
> .../userspace-api/media/videodev2.h.rst.exceptions | 5 +++++
> include/media/hevc-ctrls.h | 7 -------
> include/uapi/linux/videodev2.h | 6 ++++++
> 3 files changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/Documentation/userspace-api/media/videodev2.h.rst.exceptions b/Documentation/userspace-api/media/videodev2.h.rst.exceptions
> index 0b91200776f8..2feea4a5a008 100644
> --- a/Documentation/userspace-api/media/videodev2.h.rst.exceptions
> +++ b/Documentation/userspace-api/media/videodev2.h.rst.exceptions
> @@ -153,6 +153,11 @@ replace symbol V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR :c:type:`v4l2_ctrl_type`
> replace symbol V4L2_CTRL_TYPE_VP9_FRAME :c:type:`v4l2_ctrl_type`
> replace symbol V4L2_CTRL_TYPE_HDR10_CLL_INFO :c:type:`v4l2_ctrl_type`
> replace symbol V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY :c:type:`v4l2_ctrl_type`
> +replace symbol V4L2_CTRL_TYPE_HEVC_SPS :c:type:`v4l2_ctrl_type`
> +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_HEVC_SCALING_MATRIX :c:type:`v4l2_ctrl_type`
> +replace symbol V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS :c:type:`v4l2_ctrl_type`
>
> # V4L2 capability defines
> replace define V4L2_CAP_VIDEO_CAPTURE device-capabilities
> diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h
> index 3a6601a46ced..42d16e8a1050 100644
> --- a/include/media/hevc-ctrls.h
> +++ b/include/media/hevc-ctrls.h
> @@ -22,13 +22,6 @@
> #define V4L2_CID_STATELESS_HEVC_START_CODE (V4L2_CID_CODEC_BASE + 1016)
> #define V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS (V4L2_CID_CODEC_BASE + 1017)
>
> -/* enum v4l2_ctrl_type type values */
> -#define V4L2_CTRL_TYPE_HEVC_SPS 0x0120
> -#define V4L2_CTRL_TYPE_HEVC_PPS 0x0121
> -#define V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS 0x0122
> -#define V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX 0x0123
> -#define V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS 0x0124
> -
> enum v4l2_stateless_hevc_decode_mode {
> V4L2_STATELESS_HEVC_DECODE_MODE_SLICE_BASED,
> V4L2_STATELESS_HEVC_DECODE_MODE_FRAME_BASED,
> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
> index 37f9f23a67fe..e0d19a6b5bc7 100644
> --- a/include/uapi/linux/videodev2.h
> +++ b/include/uapi/linux/videodev2.h
> @@ -1836,6 +1836,12 @@ enum v4l2_ctrl_type {
>
> V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR = 0x0260,
> V4L2_CTRL_TYPE_VP9_FRAME = 0x0261,
> +
> + V4L2_CTRL_TYPE_HEVC_SPS = 0x0270,
> + V4L2_CTRL_TYPE_HEVC_PPS = 0x0271,
> + V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS = 0x0272,
> + V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX = 0x0273,
> + V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS = 0x0274,
> };
>
> /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
> --
> 2.32.0
>
On Tue, Jul 05, 2022 at 10:54:19AM +0200, Benjamin Gaignard wrote:
> 'F.7.3.6.1 General slice segment header syntax' section of HEVC
> specification describes that a slice header always end aligned on
> byte boundary, therefore we only need to provide the data offset in bytes.
>
> Signed-off-by: Benjamin Gaignard <[email protected]>
> Acked-by: Nicolas Dufresne <[email protected]>
> Tested-by: Jernej Skrabec <[email protected]>
Makes sense and it matches what other CODEC ABIs.
Reviewed-by: Ezequiel Garcia <[email protected]>
Thanks,
Ezequiel
> ---
> .../media/v4l/ext-ctrls-codec.rst | 4 ++--
> .../staging/media/sunxi/cedrus/cedrus_h265.c | 19 ++++++++++++++++++-
> .../staging/media/sunxi/cedrus/cedrus_video.c | 1 -
> include/media/hevc-ctrls.h | 4 ++--
> 4 files changed, 22 insertions(+), 6 deletions(-)
>
> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> index 889e2bcffde6..af5cb4e4ef73 100644
> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> @@ -3008,8 +3008,8 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
> - ``bit_size``
> - Size (in bits) of the current slice data.
> * - __u32
> - - ``data_bit_offset``
> - - Offset (in bits) to the video data in the current slice data.
> + - ``data_byte_offset``
> + - Offset (in bytes) to the video data in the current slice data.
> * - __u32
> - ``num_entry_point_offsets``
> - Specifies the number of entry point offset syntax elements in the slice header.
> diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
> index 411601975124..7b67cb4621cf 100644
> --- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
> +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
> @@ -317,6 +317,8 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
> u32 chroma_log2_weight_denom;
> u32 output_pic_list_index;
> u32 pic_order_cnt[2];
> + u8 *padding;
> + int count;
> u32 reg;
>
> sps = run->h265.sps;
> @@ -405,7 +407,22 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
> /* Initialize bitstream access. */
> cedrus_write(dev, VE_DEC_H265_TRIGGER, VE_DEC_H265_TRIGGER_INIT_SWDEC);
>
> - cedrus_h265_skip_bits(dev, slice_params->data_bit_offset);
> + /*
> + * Cedrus expects that bitstream pointer is actually at the end of the slice header
> + * instead of start of slice data. Padding is 8 bits at most (one bit set to 1 and
> + * at most seven bits set to 0), so we have to inspect only one byte before slice data.
> + */
> + padding = (u8 *)vb2_plane_vaddr(&run->src->vb2_buf, 0) +
> + slice_params->data_byte_offset - 1;
> +
> + for (count = 0; count < 8; count++)
> + if (*padding & (1 << count))
> + break;
> +
> + /* Include the one bit. */
> + count++;
> +
> + cedrus_h265_skip_bits(dev, slice_params->data_byte_offset * 8 - count);
>
> /* Bitstream parameters. */
>
> diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
> index 33726175d980..66714609b577 100644
> --- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
> +++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
> @@ -568,7 +568,6 @@ int cedrus_queue_init(void *priv, struct vb2_queue *src_vq,
>
> src_vq->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
> src_vq->io_modes = VB2_MMAP | VB2_DMABUF;
> - src_vq->dma_attrs = DMA_ATTR_NO_KERNEL_MAPPING;
> src_vq->drv_priv = ctx;
> src_vq->buf_struct_size = sizeof(struct cedrus_buffer);
> src_vq->ops = &cedrus_qops;
> diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h
> index 7358cbfc3e4d..c89029b3c5da 100644
> --- a/include/media/hevc-ctrls.h
> +++ b/include/media/hevc-ctrls.h
> @@ -310,7 +310,7 @@ struct v4l2_hevc_pred_weight_table {
> * V4L2_CTRL_FLAG_DYNAMIC_ARRAY flag must be set when using it.
> *
> * @bit_size: size (in bits) of the current slice data
> - * @data_bit_offset: offset (in bits) to the video data in the current slice data
> + * @data_byte_offset: offset (in bytes) to the video data in the current slice data
> * @num_entry_point_offsets: specifies the number of entry point offset syntax
> * elements in the slice header.
> * @nal_unit_type: specifies the coding type of the slice (B, P or I)
> @@ -356,7 +356,7 @@ struct v4l2_hevc_pred_weight_table {
> */
> struct v4l2_ctrl_hevc_slice_params {
> __u32 bit_size;
> - __u32 data_bit_offset;
> + __u32 data_byte_offset;
> __u32 num_entry_point_offsets;
> /* ISO/IEC 23008-2, ITU-T Rec. H.265: NAL unit header */
> __u8 nal_unit_type;
> --
> 2.32.0
>
Hi guys,
On Tue, Jul 05, 2022 at 10:54:14AM +0200, Benjamin Gaignard wrote:
> The number of 'entry point offset' can be very variable.
> Instead of using a large static array define a v4l2 dynamic array
> of U32 (V4L2_CTRL_TYPE_U32).
> The number of entry point offsets is reported by the elems field
> and in struct v4l2_ctrl_hevc_slice_params.num_entry_point_offsets
> field.
>
> Signed-off-by: Benjamin Gaignard <[email protected]>
> Acked-by: Nicolas Dufresne <[email protected]>
> Tested-by: Jernej Skrabec <[email protected]>
> ---
> .../userspace-api/media/v4l/ext-ctrls-codec.rst | 11 +++++++++++
> drivers/media/v4l2-core/v4l2-ctrls-defs.c | 5 +++++
> include/media/hevc-ctrls.h | 5 ++++-
> 3 files changed, 20 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> index db0df7d9f27c..8df8d7fdfe70 100644
> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> @@ -3010,6 +3010,9 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
> * - __u32
> - ``data_bit_offset``
> - Offset (in bits) to the video data in the current slice data.
> + * - __u32
> + - ``num_entry_point_offsets``
> + - Specifies the number of entry point offset syntax elements in the slice header.
This looks underdocumented. Somewhere in the docs it should be mentioned
that the field 'num_entry_point_offsets' is linked to the control
V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS.
Thanks,
Ezequiel
> * - __u8
> - ``nal_unit_type``
> - Specifies the coding type of the slice (B, P or I).
> @@ -3150,6 +3153,14 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
>
> \normalsize
>
> +``V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS (integer)``
> + Specifies entry point offsets in bytes.
> + This control is a dynamically sized array. The number of entry point
> + offsets is reported by the ``elems`` field.
> + This bitstream parameter is defined according to :ref:`hevc`.
> + They are described in section 7.4.7.1 "General slice segment header
> + semantics" of the specification.
> +
> ``V4L2_CID_STATELESS_HEVC_SCALING_MATRIX (struct)``
> Specifies the HEVC scaling matrix parameters used for the scaling process
> for transform coefficients.
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> index d594efbcbb93..e22921e7ea61 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> @@ -1188,6 +1188,7 @@ const char *v4l2_ctrl_get_name(u32 id)
> case V4L2_CID_STATELESS_HEVC_DECODE_PARAMS: return "HEVC Decode Parameters";
> case V4L2_CID_STATELESS_HEVC_DECODE_MODE: return "HEVC Decode Mode";
> case V4L2_CID_STATELESS_HEVC_START_CODE: return "HEVC Start Code";
> + case V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS: return "HEVC Entry Point Offsets";
>
> /* Colorimetry controls */
> /* Keep the order of the 'case's the same as in v4l2-controls.h! */
> @@ -1518,6 +1519,10 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
> case V4L2_CID_STATELESS_HEVC_DECODE_PARAMS:
> *type = V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS;
> break;
> + case V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS:
> + *type = V4L2_CTRL_TYPE_U32;
> + *flags |= V4L2_CTRL_FLAG_DYNAMIC_ARRAY;
> + break;
> case V4L2_CID_STATELESS_VP9_COMPRESSED_HDR:
> *type = V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR;
> break;
> diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h
> index a372c184689e..3a6601a46ced 100644
> --- a/include/media/hevc-ctrls.h
> +++ b/include/media/hevc-ctrls.h
> @@ -20,6 +20,7 @@
> #define V4L2_CID_STATELESS_HEVC_DECODE_PARAMS (V4L2_CID_CODEC_BASE + 1012)
> #define V4L2_CID_STATELESS_HEVC_DECODE_MODE (V4L2_CID_CODEC_BASE + 1015)
> #define V4L2_CID_STATELESS_HEVC_START_CODE (V4L2_CID_CODEC_BASE + 1016)
> +#define V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS (V4L2_CID_CODEC_BASE + 1017)
>
> /* enum v4l2_ctrl_type type values */
> #define V4L2_CTRL_TYPE_HEVC_SPS 0x0120
> @@ -316,6 +317,8 @@ struct v4l2_hevc_pred_weight_table {
> *
> * @bit_size: size (in bits) of the current slice data
> * @data_bit_offset: offset (in bits) to the video data in the current slice data
> + * @num_entry_point_offsets: specifies the number of entry point offset syntax
> + * elements in the slice header.
> * @nal_unit_type: specifies the coding type of the slice (B, P or I)
> * @nuh_temporal_id_plus1: minus 1 specifies a temporal identifier for the NAL unit
> * @slice_type: see V4L2_HEVC_SLICE_TYPE_{}
> @@ -358,7 +361,7 @@ struct v4l2_hevc_pred_weight_table {
> struct v4l2_ctrl_hevc_slice_params {
> __u32 bit_size;
> __u32 data_bit_offset;
> -
> + __u32 num_entry_point_offsets;
> /* ISO/IEC 23008-2, ITU-T Rec. H.265: NAL unit header */
> __u8 nal_unit_type;
> __u8 nuh_temporal_id_plus1;
> --
> 2.32.0
>
Le 05/07/2022 à 17:45, Ezequiel Garcia a écrit :
> Hi guys,
>
> On Tue, Jul 05, 2022 at 10:54:14AM +0200, Benjamin Gaignard wrote:
>> The number of 'entry point offset' can be very variable.
>> Instead of using a large static array define a v4l2 dynamic array
>> of U32 (V4L2_CTRL_TYPE_U32).
>> The number of entry point offsets is reported by the elems field
>> and in struct v4l2_ctrl_hevc_slice_params.num_entry_point_offsets
>> field.
>>
>> Signed-off-by: Benjamin Gaignard <[email protected]>
>> Acked-by: Nicolas Dufresne <[email protected]>
>> Tested-by: Jernej Skrabec <[email protected]>
>> ---
>> .../userspace-api/media/v4l/ext-ctrls-codec.rst | 11 +++++++++++
>> drivers/media/v4l2-core/v4l2-ctrls-defs.c | 5 +++++
>> include/media/hevc-ctrls.h | 5 ++++-
>> 3 files changed, 20 insertions(+), 1 deletion(-)
>>
>> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
>> index db0df7d9f27c..8df8d7fdfe70 100644
>> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
>> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
>> @@ -3010,6 +3010,9 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
>> * - __u32
>> - ``data_bit_offset``
>> - Offset (in bits) to the video data in the current slice data.
>> + * - __u32
>> + - ``num_entry_point_offsets``
>> + - Specifies the number of entry point offset syntax elements in the slice header.
> This looks underdocumented. Somewhere in the docs it should be mentioned
> that the field 'num_entry_point_offsets' is linked to the control
> V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS.
This field is here because some drivers would like know the number of
entry point offsets without getting the entry point offsets data itself.
Benjamin
>
> Thanks,
> Ezequiel
>
>> * - __u8
>> - ``nal_unit_type``
>> - Specifies the coding type of the slice (B, P or I).
>> @@ -3150,6 +3153,14 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
>>
>> \normalsize
>>
>> +``V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS (integer)``
>> + Specifies entry point offsets in bytes.
>> + This control is a dynamically sized array. The number of entry point
>> + offsets is reported by the ``elems`` field.
>> + This bitstream parameter is defined according to :ref:`hevc`.
>> + They are described in section 7.4.7.1 "General slice segment header
>> + semantics" of the specification.
>> +
>> ``V4L2_CID_STATELESS_HEVC_SCALING_MATRIX (struct)``
>> Specifies the HEVC scaling matrix parameters used for the scaling process
>> for transform coefficients.
>> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
>> index d594efbcbb93..e22921e7ea61 100644
>> --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
>> +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
>> @@ -1188,6 +1188,7 @@ const char *v4l2_ctrl_get_name(u32 id)
>> case V4L2_CID_STATELESS_HEVC_DECODE_PARAMS: return "HEVC Decode Parameters";
>> case V4L2_CID_STATELESS_HEVC_DECODE_MODE: return "HEVC Decode Mode";
>> case V4L2_CID_STATELESS_HEVC_START_CODE: return "HEVC Start Code";
>> + case V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS: return "HEVC Entry Point Offsets";
>>
>> /* Colorimetry controls */
>> /* Keep the order of the 'case's the same as in v4l2-controls.h! */
>> @@ -1518,6 +1519,10 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
>> case V4L2_CID_STATELESS_HEVC_DECODE_PARAMS:
>> *type = V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS;
>> break;
>> + case V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS:
>> + *type = V4L2_CTRL_TYPE_U32;
>> + *flags |= V4L2_CTRL_FLAG_DYNAMIC_ARRAY;
>> + break;
>> case V4L2_CID_STATELESS_VP9_COMPRESSED_HDR:
>> *type = V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR;
>> break;
>> diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h
>> index a372c184689e..3a6601a46ced 100644
>> --- a/include/media/hevc-ctrls.h
>> +++ b/include/media/hevc-ctrls.h
>> @@ -20,6 +20,7 @@
>> #define V4L2_CID_STATELESS_HEVC_DECODE_PARAMS (V4L2_CID_CODEC_BASE + 1012)
>> #define V4L2_CID_STATELESS_HEVC_DECODE_MODE (V4L2_CID_CODEC_BASE + 1015)
>> #define V4L2_CID_STATELESS_HEVC_START_CODE (V4L2_CID_CODEC_BASE + 1016)
>> +#define V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS (V4L2_CID_CODEC_BASE + 1017)
>>
>> /* enum v4l2_ctrl_type type values */
>> #define V4L2_CTRL_TYPE_HEVC_SPS 0x0120
>> @@ -316,6 +317,8 @@ struct v4l2_hevc_pred_weight_table {
>> *
>> * @bit_size: size (in bits) of the current slice data
>> * @data_bit_offset: offset (in bits) to the video data in the current slice data
>> + * @num_entry_point_offsets: specifies the number of entry point offset syntax
>> + * elements in the slice header.
>> * @nal_unit_type: specifies the coding type of the slice (B, P or I)
>> * @nuh_temporal_id_plus1: minus 1 specifies a temporal identifier for the NAL unit
>> * @slice_type: see V4L2_HEVC_SLICE_TYPE_{}
>> @@ -358,7 +361,7 @@ struct v4l2_hevc_pred_weight_table {
>> struct v4l2_ctrl_hevc_slice_params {
>> __u32 bit_size;
>> __u32 data_bit_offset;
>> -
>> + __u32 num_entry_point_offsets;
>> /* ISO/IEC 23008-2, ITU-T Rec. H.265: NAL unit header */
>> __u8 nal_unit_type;
>> __u8 nuh_temporal_id_plus1;
>> --
>> 2.32.0
>>
On Tue, Jul 05, 2022 at 10:54:13AM +0200, Benjamin Gaignard wrote:
> Move HEVC pixel format since we are ready to stabilize the uAPI
>
> Signed-off-by: Benjamin Gaignard <[email protected]>
> Acked-by: Nicolas Dufresne <[email protected]>
> Tested-by: Jernej Skrabec <[email protected]>
Reviewed-by: Ezequiel Garcia <[email protected]>
> ---
> Documentation/userspace-api/media/v4l/pixfmt-compressed.rst | 5 -----
> include/media/hevc-ctrls.h | 3 ---
> include/uapi/linux/videodev2.h | 1 +
> 3 files changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst b/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst
> index 967fc803ef94..c352d91a73d8 100644
> --- a/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst
> +++ b/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst
> @@ -215,11 +215,6 @@ Compressed Formats
> See the :ref:`associated Codec Control IDs <v4l2-mpeg-hevc>`.
> Buffers associated with this pixel format must contain the appropriate
> number of macroblocks to decode a full corresponding frame.
> -
> - .. note::
> -
> - This format is not yet part of the public kernel API and it
> - is expected to change.
> * .. _V4L2-PIX-FMT-FWHT:
>
> - ``V4L2_PIX_FMT_FWHT``
> diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h
> index 341fc795d550..a372c184689e 100644
> --- a/include/media/hevc-ctrls.h
> +++ b/include/media/hevc-ctrls.h
> @@ -13,9 +13,6 @@
>
> #include <linux/videodev2.h>
>
> -/* The pixel format isn't stable at the moment and will likely be renamed. */
> -#define V4L2_PIX_FMT_HEVC_SLICE v4l2_fourcc('S', '2', '6', '5') /* HEVC parsed slices */
> -
> #define V4L2_CID_STATELESS_HEVC_SPS (V4L2_CID_CODEC_BASE + 1008)
> #define V4L2_CID_STATELESS_HEVC_PPS (V4L2_CID_CODEC_BASE + 1009)
> #define V4L2_CID_STATELESS_HEVC_SLICE_PARAMS (V4L2_CID_CODEC_BASE + 1010)
> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
> index 9018aa984db3..37f9f23a67fe 100644
> --- a/include/uapi/linux/videodev2.h
> +++ b/include/uapi/linux/videodev2.h
> @@ -712,6 +712,7 @@ struct v4l2_pix_format {
> #define V4L2_PIX_FMT_FWHT v4l2_fourcc('F', 'W', 'H', 'T') /* Fast Walsh Hadamard Transform (vicodec) */
> #define V4L2_PIX_FMT_FWHT_STATELESS v4l2_fourcc('S', 'F', 'W', 'H') /* Stateless FWHT (vicodec) */
> #define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '4') /* H264 parsed slices */
> +#define V4L2_PIX_FMT_HEVC_SLICE v4l2_fourcc('S', '2', '6', '5') /* HEVC parsed slices */
>
> /* Vendor-specific formats */
> #define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
> --
> 2.32.0
>
Dne torek, 05. julij 2022 ob 18:03:28 CEST je Benjamin Gaignard napisal(a):
> Le 05/07/2022 ? 17:45, Ezequiel Garcia a ?crit :
> > Hi guys,
> >
> > On Tue, Jul 05, 2022 at 10:54:14AM +0200, Benjamin Gaignard wrote:
> >> The number of 'entry point offset' can be very variable.
> >> Instead of using a large static array define a v4l2 dynamic array
> >> of U32 (V4L2_CTRL_TYPE_U32).
> >> The number of entry point offsets is reported by the elems field
> >> and in struct v4l2_ctrl_hevc_slice_params.num_entry_point_offsets
> >> field.
> >>
> >> Signed-off-by: Benjamin Gaignard <[email protected]>
> >> Acked-by: Nicolas Dufresne <[email protected]>
> >> Tested-by: Jernej Skrabec <[email protected]>
> >> ---
> >>
> >> .../userspace-api/media/v4l/ext-ctrls-codec.rst | 11 +++++++++++
> >> drivers/media/v4l2-core/v4l2-ctrls-defs.c | 5 +++++
> >> include/media/hevc-ctrls.h | 5 ++++-
> >> 3 files changed, 20 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> >> b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index
> >> db0df7d9f27c..8df8d7fdfe70 100644
> >> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> >> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> >> @@ -3010,6 +3010,9 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
> >>
> >> * - __u32
> >>
> >> - ``data_bit_offset``
> >> - Offset (in bits) to the video data in the current slice data.
> >>
> >> + * - __u32
> >> + - ``num_entry_point_offsets``
> >> + - Specifies the number of entry point offset syntax elements in
> >> the slice header.>
> > This looks underdocumented. Somewhere in the docs it should be mentioned
> > that the field 'num_entry_point_offsets' is linked to the control
> > V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS.
>
> This field is here because some drivers would like know the number of
> entry point offsets without getting the entry point offsets data itself.
Yeah, this field must be set even when entry points offset control isn't used.
Additionally, if entry point offsets control is needed and if submitting
multiple slices at once, length of entry point offsets array must be sum of
num_entry_point_offsets of all slices in that job. Not sure where to put this
explanation.
Best regards,
Jernej
>
> Benjamin
>
> > Thanks,
> > Ezequiel
> >
> >> * - __u8
> >>
> >> - ``nal_unit_type``
> >> - Specifies the coding type of the slice (B, P or I).
> >>
> >> @@ -3150,6 +3153,14 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
> >>
> >> \normalsize
> >>
> >> +``V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS (integer)``
> >> + Specifies entry point offsets in bytes.
> >> + This control is a dynamically sized array. The number of entry point
> >> + offsets is reported by the ``elems`` field.
> >> + This bitstream parameter is defined according to :ref:`hevc`.
> >> + They are described in section 7.4.7.1 "General slice segment header
> >> + semantics" of the specification.
> >> +
> >>
> >> ``V4L2_CID_STATELESS_HEVC_SCALING_MATRIX (struct)``
> >>
> >> Specifies the HEVC scaling matrix parameters used for the scaling
> >> process
> >> for transform coefficients.
> >>
> >> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> >> b/drivers/media/v4l2-core/v4l2-ctrls-defs.c index
> >> d594efbcbb93..e22921e7ea61 100644
> >> --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> >> +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> >> @@ -1188,6 +1188,7 @@ const char *v4l2_ctrl_get_name(u32 id)
> >>
> >> case V4L2_CID_STATELESS_HEVC_DECODE_PARAMS: return
"HEVC Decode
> >> Parameters"; case V4L2_CID_STATELESS_HEVC_DECODE_MODE:
return "HEVC
> >> Decode Mode"; case V4L2_CID_STATELESS_HEVC_START_CODE:
return "HEVC
> >> Start Code";>>
> >> + case V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS: return
"HEVC Entry
> >> Point Offsets";>>
> >> /* Colorimetry controls */
> >> /* Keep the order of the 'case's the same as in v4l2-controls.h!
*/
> >>
> >> @@ -1518,6 +1519,10 @@ void v4l2_ctrl_fill(u32 id, const char **name,
> >> enum v4l2_ctrl_type *type,>>
> >> case V4L2_CID_STATELESS_HEVC_DECODE_PARAMS:
> >> *type = V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS;
> >> break;
> >>
> >> + case V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS:
> >> + *type = V4L2_CTRL_TYPE_U32;
> >> + *flags |= V4L2_CTRL_FLAG_DYNAMIC_ARRAY;
> >> + break;
> >>
> >> case V4L2_CID_STATELESS_VP9_COMPRESSED_HDR:
> >> *type = V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR;
> >> break;
> >>
> >> diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h
> >> index a372c184689e..3a6601a46ced 100644
> >> --- a/include/media/hevc-ctrls.h
> >> +++ b/include/media/hevc-ctrls.h
> >> @@ -20,6 +20,7 @@
> >>
> >> #define V4L2_CID_STATELESS_HEVC_DECODE_PARAMS
(V4L2_CID_CODEC_BASE +
> >> 1012)
> >> #define V4L2_CID_STATELESS_HEVC_DECODE_MODE (V4L2_CID_CODEC_BASE
+
> >> 1015)
> >> #define V4L2_CID_STATELESS_HEVC_START_CODE (V4L2_CID_CODEC_BASE + 1016)
> >>
> >> +#define V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS (V4L2_CID_CODEC_BASE
> >> + 1017)>>
> >> /* enum v4l2_ctrl_type type values */
> >> #define V4L2_CTRL_TYPE_HEVC_SPS 0x0120
> >>
> >> @@ -316,6 +317,8 @@ struct v4l2_hevc_pred_weight_table {
> >>
> >> *
> >> * @bit_size: size (in bits) of the current slice data
> >> * @data_bit_offset: offset (in bits) to the video data in the current
> >> slice data>>
> >> + * @num_entry_point_offsets: specifies the number of entry point offset
> >> syntax + * elements in the slice
header.
> >>
> >> * @nal_unit_type: specifies the coding type of the slice (B, P or I)
> >> * @nuh_temporal_id_plus1: minus 1 specifies a temporal identifier for
> >> the NAL unit * @slice_type: see V4L2_HEVC_SLICE_TYPE_{}
> >>
> >> @@ -358,7 +361,7 @@ struct v4l2_hevc_pred_weight_table {
> >>
> >> struct v4l2_ctrl_hevc_slice_params {
> >>
> >> __u32 bit_size;
> >> __u32 data_bit_offset;
> >>
> >> -
> >> + __u32 num_entry_point_offsets;
> >>
> >> /* ISO/IEC 23008-2, ITU-T Rec. H.265: NAL unit header */
> >> __u8 nal_unit_type;
> >> __u8 nuh_temporal_id_plus1;
> >>
> >> --
> >> 2.32.0
Hi Benjamin,
On 7/5/22 18:03, Benjamin Gaignard wrote:
>
> Le 05/07/2022 à 17:45, Ezequiel Garcia a écrit :
>> Hi guys,
>>
>> On Tue, Jul 05, 2022 at 10:54:14AM +0200, Benjamin Gaignard wrote:
>>> The number of 'entry point offset' can be very variable.
>>> Instead of using a large static array define a v4l2 dynamic array
>>> of U32 (V4L2_CTRL_TYPE_U32).
>>> The number of entry point offsets is reported by the elems field
>>> and in struct v4l2_ctrl_hevc_slice_params.num_entry_point_offsets
>>> field.
>>>
>>> Signed-off-by: Benjamin Gaignard <[email protected]>
>>> Acked-by: Nicolas Dufresne <[email protected]>
>>> Tested-by: Jernej Skrabec <[email protected]>
>>> ---
>>> .../userspace-api/media/v4l/ext-ctrls-codec.rst | 11 +++++++++++
>>> drivers/media/v4l2-core/v4l2-ctrls-defs.c | 5 +++++
>>> include/media/hevc-ctrls.h | 5 ++++-
>>> 3 files changed, 20 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
>>> index db0df7d9f27c..8df8d7fdfe70 100644
>>> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
>>> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
>>> @@ -3010,6 +3010,9 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
>>> * - __u32
>>> - ``data_bit_offset``
>>> - Offset (in bits) to the video data in the current slice data.
>>> + * - __u32
>>> + - ``num_entry_point_offsets``
>>> + - Specifies the number of entry point offset syntax elements in the slice header.
>> This looks underdocumented. Somewhere in the docs it should be mentioned
>> that the field 'num_entry_point_offsets' is linked to the control
>> V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS.
>
> This field is here because some drivers would like know the number of
> entry point offsets without getting the entry point offsets data itself.
I agree with Ezequiel that this needs to be documented a bit better, esp. by
having a reference to the control (and vice versa, probably). That puts this
into better context.
I assume you'll post a v11?
Regards,
Hans
>
> Benjamin
>
>>
>> Thanks,
>> Ezequiel
>>
>>> * - __u8
>>> - ``nal_unit_type``
>>> - Specifies the coding type of the slice (B, P or I).
>>> @@ -3150,6 +3153,14 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
>>>
>>> \normalsize
>>>
>>> +``V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS (integer)``
>>> + Specifies entry point offsets in bytes.
>>> + This control is a dynamically sized array. The number of entry point
>>> + offsets is reported by the ``elems`` field.
>>> + This bitstream parameter is defined according to :ref:`hevc`.
>>> + They are described in section 7.4.7.1 "General slice segment header
>>> + semantics" of the specification.
>>> +
>>> ``V4L2_CID_STATELESS_HEVC_SCALING_MATRIX (struct)``
>>> Specifies the HEVC scaling matrix parameters used for the scaling process
>>> for transform coefficients.
>>> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
>>> index d594efbcbb93..e22921e7ea61 100644
>>> --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
>>> +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
>>> @@ -1188,6 +1188,7 @@ const char *v4l2_ctrl_get_name(u32 id)
>>> case V4L2_CID_STATELESS_HEVC_DECODE_PARAMS: return "HEVC Decode Parameters";
>>> case V4L2_CID_STATELESS_HEVC_DECODE_MODE: return "HEVC Decode Mode";
>>> case V4L2_CID_STATELESS_HEVC_START_CODE: return "HEVC Start Code";
>>> + case V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS: return "HEVC Entry Point Offsets";
>>>
>>> /* Colorimetry controls */
>>> /* Keep the order of the 'case's the same as in v4l2-controls.h! */
>>> @@ -1518,6 +1519,10 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
>>> case V4L2_CID_STATELESS_HEVC_DECODE_PARAMS:
>>> *type = V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS;
>>> break;
>>> + case V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS:
>>> + *type = V4L2_CTRL_TYPE_U32;
>>> + *flags |= V4L2_CTRL_FLAG_DYNAMIC_ARRAY;
>>> + break;
>>> case V4L2_CID_STATELESS_VP9_COMPRESSED_HDR:
>>> *type = V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR;
>>> break;
>>> diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h
>>> index a372c184689e..3a6601a46ced 100644
>>> --- a/include/media/hevc-ctrls.h
>>> +++ b/include/media/hevc-ctrls.h
>>> @@ -20,6 +20,7 @@
>>> #define V4L2_CID_STATELESS_HEVC_DECODE_PARAMS (V4L2_CID_CODEC_BASE + 1012)
>>> #define V4L2_CID_STATELESS_HEVC_DECODE_MODE (V4L2_CID_CODEC_BASE + 1015)
>>> #define V4L2_CID_STATELESS_HEVC_START_CODE (V4L2_CID_CODEC_BASE + 1016)
>>> +#define V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS (V4L2_CID_CODEC_BASE + 1017)
>>>
>>> /* enum v4l2_ctrl_type type values */
>>> #define V4L2_CTRL_TYPE_HEVC_SPS 0x0120
>>> @@ -316,6 +317,8 @@ struct v4l2_hevc_pred_weight_table {
>>> *
>>> * @bit_size: size (in bits) of the current slice data
>>> * @data_bit_offset: offset (in bits) to the video data in the current slice data
>>> + * @num_entry_point_offsets: specifies the number of entry point offset syntax
>>> + * elements in the slice header.
>>> * @nal_unit_type: specifies the coding type of the slice (B, P or I)
>>> * @nuh_temporal_id_plus1: minus 1 specifies a temporal identifier for the NAL unit
>>> * @slice_type: see V4L2_HEVC_SLICE_TYPE_{}
>>> @@ -358,7 +361,7 @@ struct v4l2_hevc_pred_weight_table {
>>> struct v4l2_ctrl_hevc_slice_params {
>>> __u32 bit_size;
>>> __u32 data_bit_offset;
>>> -
>>> + __u32 num_entry_point_offsets;
>>> /* ISO/IEC 23008-2, ITU-T Rec. H.265: NAL unit header */
>>> __u8 nal_unit_type;
>>> __u8 nuh_temporal_id_plus1;
>>> --
>>> 2.32.0
>>>
Dne sreda, 06. julij 2022 ob 20:39:41 CEST je Ezequiel Garcia napisal(a):
> Hi Jernej,
>
> On Tue, Jul 5, 2022 at 1:11 PM Jernej Škrabec <[email protected]>
wrote:
> > Dne torek, 05. julij 2022 ob 18:03:28 CEST je Benjamin Gaignard
napisal(a):
> > > Le 05/07/2022 à 17:45, Ezequiel Garcia a écrit :
> > > > Hi guys,
> > > >
> > > > On Tue, Jul 05, 2022 at 10:54:14AM +0200, Benjamin Gaignard wrote:
> > > >> The number of 'entry point offset' can be very variable.
> > > >> Instead of using a large static array define a v4l2 dynamic array
> > > >> of U32 (V4L2_CTRL_TYPE_U32).
> > > >> The number of entry point offsets is reported by the elems field
> > > >> and in struct v4l2_ctrl_hevc_slice_params.num_entry_point_offsets
> > > >> field.
> > > >>
> > > >> Signed-off-by: Benjamin Gaignard <[email protected]>
> > > >> Acked-by: Nicolas Dufresne <[email protected]>
> > > >> Tested-by: Jernej Skrabec <[email protected]>
> > > >> ---
> > > >>
> > > >> .../userspace-api/media/v4l/ext-ctrls-codec.rst | 11
> > > >> +++++++++++
> > > >> drivers/media/v4l2-core/v4l2-ctrls-defs.c | 5 +++++
> > > >> include/media/hevc-ctrls.h | 5 ++++-
> > > >> 3 files changed, 20 insertions(+), 1 deletion(-)
> > > >>
> > > >> diff --git
> > > >> a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> > > >> b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index
> > > >> db0df7d9f27c..8df8d7fdfe70 100644
> > > >> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> > > >> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> > > >> @@ -3010,6 +3010,9 @@ enum v4l2_mpeg_video_hevc_size_of_length_field
> > > >> -
> > > >>
> > > >> * - __u32
> > > >>
> > > >> - ``data_bit_offset``
> > > >> - Offset (in bits) to the video data in the current slice
> > > >> data.
> > > >>
> > > >> + * - __u32
> > > >> + - ``num_entry_point_offsets``
> > > >> + - Specifies the number of entry point offset syntax elements
> > > >> in
> > > >> the slice header.>
> > > >
> > > > This looks underdocumented. Somewhere in the docs it should be
> > > > mentioned
> > > > that the field 'num_entry_point_offsets' is linked to the control
> > > > V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS.
> > >
> > > This field is here because some drivers would like know the number of
> > > entry point offsets without getting the entry point offsets data itself.
> >
> > Yeah, this field must be set even when entry points offset control isn't
> > used. Additionally, if entry point offsets control is needed and if
> > submitting multiple slices at once, length of entry point offsets array
> > must be sum of num_entry_point_offsets of all slices in that job. Not
> > sure where to put this explanation.
>
> This confused me a bit: so you mean that this field (called
> num_entry_point_offsets)
> must be the sum of "num_entry_point_offsets" syntax elements for
> slices in the request?
No, it's the other way around. num_entry_point_offsets field has same meaning as
in syntax. It's per slice property. I said that if there is control with all
entry point offsets, it has to have number of elements, which is sum of all
num_entry_point_offsets fields in slice array.
Example (totaly made up):
Frame has 4 slices, each with 16 entry points.
App sends only 2 slices per job. Both num_entry_point_offsets fields in slice
control will have value 16, but entry point offsets array control will have 32
elements (16 entry points offsets from first and 16 entry point offsets from
second slice).
Best regards,
Jernej
>
> If this is the case, then perhaps it will be a mistake to name our V4L2
> field exactly like the syntax element, since it this sum meaning.
> Otherwise, developers would tend to get confused by it.
>
> What do you think?
>
> Thanks,
> Ezequiel
>
> > Best regards,
> > Jernej
> >
> > > Benjamin
> > >
> > > > Thanks,
> > > > Ezequiel
> > > >
> > > >> * - __u8
> > > >>
> > > >> - ``nal_unit_type``
> > > >> - Specifies the coding type of the slice (B, P or I).
> > > >>
> > > >> @@ -3150,6 +3153,14 @@ enum v4l2_mpeg_video_hevc_size_of_length_field
> > > >> -
> > > >>
> > > >> \normalsize
> > > >>
> > > >> +``V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS (integer)``
> > > >> + Specifies entry point offsets in bytes.
> > > >> + This control is a dynamically sized array. The number of entry
> > > >> point
> > > >> + offsets is reported by the ``elems`` field.
> > > >> + This bitstream parameter is defined according to :ref:`hevc`.
> > > >> + They are described in section 7.4.7.1 "General slice segment
> > > >> header
> > > >> + semantics" of the specification.
> > > >> +
> > > >>
> > > >> ``V4L2_CID_STATELESS_HEVC_SCALING_MATRIX (struct)``
> > > >>
> > > >> Specifies the HEVC scaling matrix parameters used for the
> > > >> scaling
> > > >> process
> > > >> for transform coefficients.
> > > >>
> > > >> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> > > >> b/drivers/media/v4l2-core/v4l2-ctrls-defs.c index
> > > >> d594efbcbb93..e22921e7ea61 100644
> > > >> --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> > > >> +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> > > >> @@ -1188,6 +1188,7 @@ const char *v4l2_ctrl_get_name(u32 id)
> > > >>
> > > >> case V4L2_CID_STATELESS_HEVC_DECODE_PARAMS: return
> >
> > "HEVC Decode
> >
> > > >> Parameters"; case V4L2_CID_STATELESS_HEVC_DECODE_MODE:
> > return "HEVC
> >
> > > >> Decode Mode"; case V4L2_CID_STATELESS_HEVC_START_CODE:
> > return "HEVC
> >
> > > >> Start Code";>>
> > > >>
> > > >> + case V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS: return
> >
> > "HEVC Entry
> >
> > > >> Point Offsets";>>
> > > >>
> > > >> /* Colorimetry controls */
> > > >> /* Keep the order of the 'case's the same as in v4l2-controls.h!
> >
> > */
> >
> > > >> @@ -1518,6 +1519,10 @@ void v4l2_ctrl_fill(u32 id, const char **name,
> > > >> enum v4l2_ctrl_type *type,>>
> > > >>
> > > >> case V4L2_CID_STATELESS_HEVC_DECODE_PARAMS:
> > > >> *type = V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS;
> > > >> break;
> > > >>
> > > >> + case V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS:
> > > >> + *type = V4L2_CTRL_TYPE_U32;
> > > >> + *flags |= V4L2_CTRL_FLAG_DYNAMIC_ARRAY;
> > > >> + break;
> > > >>
> > > >> case V4L2_CID_STATELESS_VP9_COMPRESSED_HDR:
> > > >> *type = V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR;
> > > >> break;
> > > >>
> > > >> diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h
> > > >> index a372c184689e..3a6601a46ced 100644
> > > >> --- a/include/media/hevc-ctrls.h
> > > >> +++ b/include/media/hevc-ctrls.h
> > > >> @@ -20,6 +20,7 @@
> > > >>
> > > >> #define V4L2_CID_STATELESS_HEVC_DECODE_PARAMS
> >
> > (V4L2_CID_CODEC_BASE +
> >
> > > >> 1012)
> > > >> #define V4L2_CID_STATELESS_HEVC_DECODE_MODE
> > > >> (V4L2_CID_CODEC_BASE
> >
> > +
> >
> > > >> 1015)
> > > >> #define V4L2_CID_STATELESS_HEVC_START_CODE
> > > >> (V4L2_CID_CODEC_BASE + 1016)> > >>
> > > >> +#define V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS
> > > >> (V4L2_CID_CODEC_BASE
> > > >> + 1017)>>
> > > >>
> > > >> /* enum v4l2_ctrl_type type values */
> > > >> #define V4L2_CTRL_TYPE_HEVC_SPS 0x0120
> > > >>
> > > >> @@ -316,6 +317,8 @@ struct v4l2_hevc_pred_weight_table {
> > > >>
> > > >> *
> > > >> * @bit_size: size (in bits) of the current slice data
> > > >> * @data_bit_offset: offset (in bits) to the video data in the
> > > >> current
> > > >> slice data>>
> > > >>
> > > >> + * @num_entry_point_offsets: specifies the number of entry point
> > > >> offset
> > > >> syntax + * elements in the slice
> >
> > header.
> >
> > > >> * @nal_unit_type: specifies the coding type of the slice (B, P or
> > > >> I)
> > > >> * @nuh_temporal_id_plus1: minus 1 specifies a temporal identifier
> > > >> for
> > > >> the NAL unit * @slice_type: see V4L2_HEVC_SLICE_TYPE_{}
> > > >>
> > > >> @@ -358,7 +361,7 @@ struct v4l2_hevc_pred_weight_table {
> > > >>
> > > >> struct v4l2_ctrl_hevc_slice_params {
> > > >>
> > > >> __u32 bit_size;
> > > >> __u32 data_bit_offset;
> > > >>
> > > >> -
> > > >> + __u32 num_entry_point_offsets;
> > > >>
> > > >> /* ISO/IEC 23008-2, ITU-T Rec. H.265: NAL unit header */
> > > >> __u8 nal_unit_type;
> > > >> __u8 nuh_temporal_id_plus1;
> > > >>
> > > >> --
> > > >> 2.32.0
Hi Jernej,
On Tue, Jul 5, 2022 at 1:11 PM Jernej Škrabec <[email protected]> wrote:
>
> Dne torek, 05. julij 2022 ob 18:03:28 CEST je Benjamin Gaignard napisal(a):
> > Le 05/07/2022 à 17:45, Ezequiel Garcia a écrit :
> > > Hi guys,
> > >
> > > On Tue, Jul 05, 2022 at 10:54:14AM +0200, Benjamin Gaignard wrote:
> > >> The number of 'entry point offset' can be very variable.
> > >> Instead of using a large static array define a v4l2 dynamic array
> > >> of U32 (V4L2_CTRL_TYPE_U32).
> > >> The number of entry point offsets is reported by the elems field
> > >> and in struct v4l2_ctrl_hevc_slice_params.num_entry_point_offsets
> > >> field.
> > >>
> > >> Signed-off-by: Benjamin Gaignard <[email protected]>
> > >> Acked-by: Nicolas Dufresne <[email protected]>
> > >> Tested-by: Jernej Skrabec <[email protected]>
> > >> ---
> > >>
> > >> .../userspace-api/media/v4l/ext-ctrls-codec.rst | 11 +++++++++++
> > >> drivers/media/v4l2-core/v4l2-ctrls-defs.c | 5 +++++
> > >> include/media/hevc-ctrls.h | 5 ++++-
> > >> 3 files changed, 20 insertions(+), 1 deletion(-)
> > >>
> > >> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> > >> b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index
> > >> db0df7d9f27c..8df8d7fdfe70 100644
> > >> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> > >> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> > >> @@ -3010,6 +3010,9 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
> > >>
> > >> * - __u32
> > >>
> > >> - ``data_bit_offset``
> > >> - Offset (in bits) to the video data in the current slice data.
> > >>
> > >> + * - __u32
> > >> + - ``num_entry_point_offsets``
> > >> + - Specifies the number of entry point offset syntax elements in
> > >> the slice header.>
> > > This looks underdocumented. Somewhere in the docs it should be mentioned
> > > that the field 'num_entry_point_offsets' is linked to the control
> > > V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS.
> >
> > This field is here because some drivers would like know the number of
> > entry point offsets without getting the entry point offsets data itself.
>
> Yeah, this field must be set even when entry points offset control isn't used.
> Additionally, if entry point offsets control is needed and if submitting
> multiple slices at once, length of entry point offsets array must be sum of
> num_entry_point_offsets of all slices in that job. Not sure where to put this
> explanation.
>
This confused me a bit: so you mean that this field (called
num_entry_point_offsets)
must be the sum of "num_entry_point_offsets" syntax elements for
slices in the request?
If this is the case, then perhaps it will be a mistake to name our V4L2 field
exactly like the syntax element, since it this sum meaning.
Otherwise, developers would tend to get confused by it.
What do you think?
Thanks,
Ezequiel
> Best regards,
> Jernej
>
> >
> > Benjamin
> >
> > > Thanks,
> > > Ezequiel
> > >
> > >> * - __u8
> > >>
> > >> - ``nal_unit_type``
> > >> - Specifies the coding type of the slice (B, P or I).
> > >>
> > >> @@ -3150,6 +3153,14 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
> > >>
> > >> \normalsize
> > >>
> > >> +``V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS (integer)``
> > >> + Specifies entry point offsets in bytes.
> > >> + This control is a dynamically sized array. The number of entry point
> > >> + offsets is reported by the ``elems`` field.
> > >> + This bitstream parameter is defined according to :ref:`hevc`.
> > >> + They are described in section 7.4.7.1 "General slice segment header
> > >> + semantics" of the specification.
> > >> +
> > >>
> > >> ``V4L2_CID_STATELESS_HEVC_SCALING_MATRIX (struct)``
> > >>
> > >> Specifies the HEVC scaling matrix parameters used for the scaling
> > >> process
> > >> for transform coefficients.
> > >>
> > >> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> > >> b/drivers/media/v4l2-core/v4l2-ctrls-defs.c index
> > >> d594efbcbb93..e22921e7ea61 100644
> > >> --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> > >> +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> > >> @@ -1188,6 +1188,7 @@ const char *v4l2_ctrl_get_name(u32 id)
> > >>
> > >> case V4L2_CID_STATELESS_HEVC_DECODE_PARAMS: return
> "HEVC Decode
> > >> Parameters"; case V4L2_CID_STATELESS_HEVC_DECODE_MODE:
> return "HEVC
> > >> Decode Mode"; case V4L2_CID_STATELESS_HEVC_START_CODE:
> return "HEVC
> > >> Start Code";>>
> > >> + case V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS: return
> "HEVC Entry
> > >> Point Offsets";>>
> > >> /* Colorimetry controls */
> > >> /* Keep the order of the 'case's the same as in v4l2-controls.h!
> */
> > >>
> > >> @@ -1518,6 +1519,10 @@ void v4l2_ctrl_fill(u32 id, const char **name,
> > >> enum v4l2_ctrl_type *type,>>
> > >> case V4L2_CID_STATELESS_HEVC_DECODE_PARAMS:
> > >> *type = V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS;
> > >> break;
> > >>
> > >> + case V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS:
> > >> + *type = V4L2_CTRL_TYPE_U32;
> > >> + *flags |= V4L2_CTRL_FLAG_DYNAMIC_ARRAY;
> > >> + break;
> > >>
> > >> case V4L2_CID_STATELESS_VP9_COMPRESSED_HDR:
> > >> *type = V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR;
> > >> break;
> > >>
> > >> diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h
> > >> index a372c184689e..3a6601a46ced 100644
> > >> --- a/include/media/hevc-ctrls.h
> > >> +++ b/include/media/hevc-ctrls.h
> > >> @@ -20,6 +20,7 @@
> > >>
> > >> #define V4L2_CID_STATELESS_HEVC_DECODE_PARAMS
> (V4L2_CID_CODEC_BASE +
> > >> 1012)
> > >> #define V4L2_CID_STATELESS_HEVC_DECODE_MODE (V4L2_CID_CODEC_BASE
> +
> > >> 1015)
> > >> #define V4L2_CID_STATELESS_HEVC_START_CODE (V4L2_CID_CODEC_BASE + 1016)
> > >>
> > >> +#define V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS (V4L2_CID_CODEC_BASE
> > >> + 1017)>>
> > >> /* enum v4l2_ctrl_type type values */
> > >> #define V4L2_CTRL_TYPE_HEVC_SPS 0x0120
> > >>
> > >> @@ -316,6 +317,8 @@ struct v4l2_hevc_pred_weight_table {
> > >>
> > >> *
> > >> * @bit_size: size (in bits) of the current slice data
> > >> * @data_bit_offset: offset (in bits) to the video data in the current
> > >> slice data>>
> > >> + * @num_entry_point_offsets: specifies the number of entry point offset
> > >> syntax + * elements in the slice
> header.
> > >>
> > >> * @nal_unit_type: specifies the coding type of the slice (B, P or I)
> > >> * @nuh_temporal_id_plus1: minus 1 specifies a temporal identifier for
> > >> the NAL unit * @slice_type: see V4L2_HEVC_SLICE_TYPE_{}
> > >>
> > >> @@ -358,7 +361,7 @@ struct v4l2_hevc_pred_weight_table {
> > >>
> > >> struct v4l2_ctrl_hevc_slice_params {
> > >>
> > >> __u32 bit_size;
> > >> __u32 data_bit_offset;
> > >>
> > >> -
> > >> + __u32 num_entry_point_offsets;
> > >>
> > >> /* ISO/IEC 23008-2, ITU-T Rec. H.265: NAL unit header */
> > >> __u8 nal_unit_type;
> > >> __u8 nuh_temporal_id_plus1;
> > >>
> > >> --
> > >> 2.32.0
>
>
Le 06/07/2022 à 20:49, Jernej Škrabec a écrit :
> Dne sreda, 06. julij 2022 ob 20:39:41 CEST je Ezequiel Garcia napisal(a):
>> Hi Jernej,
>>
>> On Tue, Jul 5, 2022 at 1:11 PM Jernej Škrabec <[email protected]>
> wrote:
>>> Dne torek, 05. julij 2022 ob 18:03:28 CEST je Benjamin Gaignard
> napisal(a):
>>>> Le 05/07/2022 à 17:45, Ezequiel Garcia a écrit :
>>>>> Hi guys,
>>>>>
>>>>> On Tue, Jul 05, 2022 at 10:54:14AM +0200, Benjamin Gaignard wrote:
>>>>>> The number of 'entry point offset' can be very variable.
>>>>>> Instead of using a large static array define a v4l2 dynamic array
>>>>>> of U32 (V4L2_CTRL_TYPE_U32).
>>>>>> The number of entry point offsets is reported by the elems field
>>>>>> and in struct v4l2_ctrl_hevc_slice_params.num_entry_point_offsets
>>>>>> field.
>>>>>>
>>>>>> Signed-off-by: Benjamin Gaignard <[email protected]>
>>>>>> Acked-by: Nicolas Dufresne <[email protected]>
>>>>>> Tested-by: Jernej Skrabec <[email protected]>
>>>>>> ---
>>>>>>
>>>>>> .../userspace-api/media/v4l/ext-ctrls-codec.rst | 11
>>>>>> +++++++++++
>>>>>> drivers/media/v4l2-core/v4l2-ctrls-defs.c | 5 +++++
>>>>>> include/media/hevc-ctrls.h | 5 ++++-
>>>>>> 3 files changed, 20 insertions(+), 1 deletion(-)
>>>>>>
>>>>>> diff --git
>>>>>> a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
>>>>>> b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index
>>>>>> db0df7d9f27c..8df8d7fdfe70 100644
>>>>>> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
>>>>>> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
>>>>>> @@ -3010,6 +3010,9 @@ enum v4l2_mpeg_video_hevc_size_of_length_field
>>>>>> -
>>>>>>
>>>>>> * - __u32
>>>>>>
>>>>>> - ``data_bit_offset``
>>>>>> - Offset (in bits) to the video data in the current slice
>>>>>> data.
>>>>>>
>>>>>> + * - __u32
>>>>>> + - ``num_entry_point_offsets``
>>>>>> + - Specifies the number of entry point offset syntax elements
>>>>>> in
>>>>>> the slice header.>
>>>>> This looks underdocumented. Somewhere in the docs it should be
>>>>> mentioned
>>>>> that the field 'num_entry_point_offsets' is linked to the control
>>>>> V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS.
>>>> This field is here because some drivers would like know the number of
>>>> entry point offsets without getting the entry point offsets data itself.
>>> Yeah, this field must be set even when entry points offset control isn't
>>> used. Additionally, if entry point offsets control is needed and if
>>> submitting multiple slices at once, length of entry point offsets array
>>> must be sum of num_entry_point_offsets of all slices in that job. Not
>>> sure where to put this explanation.
>> This confused me a bit: so you mean that this field (called
>> num_entry_point_offsets)
>> must be the sum of "num_entry_point_offsets" syntax elements for
>> slices in the request?
> No, it's the other way around. num_entry_point_offsets field has same meaning as
> in syntax. It's per slice property. I said that if there is control with all
> entry point offsets, it has to have number of elements, which is sum of all
> num_entry_point_offsets fields in slice array.
>
> Example (totaly made up):
>
> Frame has 4 slices, each with 16 entry points.
> App sends only 2 slices per job. Both num_entry_point_offsets fields in slice
> control will have value 16, but entry point offsets array control will have 32
> elements (16 entry points offsets from first and 16 entry point offsets from
> second slice).
Jernej I have used your previous answer to document this field in v11.
Regards,
Benjamin
>
> Best regards,
> Jernej
>
>> If this is the case, then perhaps it will be a mistake to name our V4L2
>> field exactly like the syntax element, since it this sum meaning.
>> Otherwise, developers would tend to get confused by it.
>>
>> What do you think?
>>
>> Thanks,
>> Ezequiel
>>
>>> Best regards,
>>> Jernej
>>>
>>>> Benjamin
>>>>
>>>>> Thanks,
>>>>> Ezequiel
>>>>>
>>>>>> * - __u8
>>>>>>
>>>>>> - ``nal_unit_type``
>>>>>> - Specifies the coding type of the slice (B, P or I).
>>>>>>
>>>>>> @@ -3150,6 +3153,14 @@ enum v4l2_mpeg_video_hevc_size_of_length_field
>>>>>> -
>>>>>>
>>>>>> \normalsize
>>>>>>
>>>>>> +``V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS (integer)``
>>>>>> + Specifies entry point offsets in bytes.
>>>>>> + This control is a dynamically sized array. The number of entry
>>>>>> point
>>>>>> + offsets is reported by the ``elems`` field.
>>>>>> + This bitstream parameter is defined according to :ref:`hevc`.
>>>>>> + They are described in section 7.4.7.1 "General slice segment
>>>>>> header
>>>>>> + semantics" of the specification.
>>>>>> +
>>>>>>
>>>>>> ``V4L2_CID_STATELESS_HEVC_SCALING_MATRIX (struct)``
>>>>>>
>>>>>> Specifies the HEVC scaling matrix parameters used for the
>>>>>> scaling
>>>>>> process
>>>>>> for transform coefficients.
>>>>>>
>>>>>> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
>>>>>> b/drivers/media/v4l2-core/v4l2-ctrls-defs.c index
>>>>>> d594efbcbb93..e22921e7ea61 100644
>>>>>> --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
>>>>>> +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
>>>>>> @@ -1188,6 +1188,7 @@ const char *v4l2_ctrl_get_name(u32 id)
>>>>>>
>>>>>> case V4L2_CID_STATELESS_HEVC_DECODE_PARAMS: return
>>> "HEVC Decode
>>>
>>>>>> Parameters"; case V4L2_CID_STATELESS_HEVC_DECODE_MODE:
>>> return "HEVC
>>>
>>>>>> Decode Mode"; case V4L2_CID_STATELESS_HEVC_START_CODE:
>>> return "HEVC
>>>
>>>>>> Start Code";>>
>>>>>>
>>>>>> + case V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS: return
>>> "HEVC Entry
>>>
>>>>>> Point Offsets";>>
>>>>>>
>>>>>> /* Colorimetry controls */
>>>>>> /* Keep the order of the 'case's the same as in v4l2-controls.h!
>>> */
>>>
>>>>>> @@ -1518,6 +1519,10 @@ void v4l2_ctrl_fill(u32 id, const char **name,
>>>>>> enum v4l2_ctrl_type *type,>>
>>>>>>
>>>>>> case V4L2_CID_STATELESS_HEVC_DECODE_PARAMS:
>>>>>> *type = V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS;
>>>>>> break;
>>>>>>
>>>>>> + case V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS:
>>>>>> + *type = V4L2_CTRL_TYPE_U32;
>>>>>> + *flags |= V4L2_CTRL_FLAG_DYNAMIC_ARRAY;
>>>>>> + break;
>>>>>>
>>>>>> case V4L2_CID_STATELESS_VP9_COMPRESSED_HDR:
>>>>>> *type = V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR;
>>>>>> break;
>>>>>>
>>>>>> diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h
>>>>>> index a372c184689e..3a6601a46ced 100644
>>>>>> --- a/include/media/hevc-ctrls.h
>>>>>> +++ b/include/media/hevc-ctrls.h
>>>>>> @@ -20,6 +20,7 @@
>>>>>>
>>>>>> #define V4L2_CID_STATELESS_HEVC_DECODE_PARAMS
>>> (V4L2_CID_CODEC_BASE +
>>>
>>>>>> 1012)
>>>>>> #define V4L2_CID_STATELESS_HEVC_DECODE_MODE
>>>>>> (V4L2_CID_CODEC_BASE
>>> +
>>>
>>>>>> 1015)
>>>>>> #define V4L2_CID_STATELESS_HEVC_START_CODE
>>>>>> (V4L2_CID_CODEC_BASE + 1016)> > >>
>>>>>> +#define V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS
>>>>>> (V4L2_CID_CODEC_BASE
>>>>>> + 1017)>>
>>>>>>
>>>>>> /* enum v4l2_ctrl_type type values */
>>>>>> #define V4L2_CTRL_TYPE_HEVC_SPS 0x0120
>>>>>>
>>>>>> @@ -316,6 +317,8 @@ struct v4l2_hevc_pred_weight_table {
>>>>>>
>>>>>> *
>>>>>> * @bit_size: size (in bits) of the current slice data
>>>>>> * @data_bit_offset: offset (in bits) to the video data in the
>>>>>> current
>>>>>> slice data>>
>>>>>>
>>>>>> + * @num_entry_point_offsets: specifies the number of entry point
>>>>>> offset
>>>>>> syntax + * elements in the slice
>>> header.
>>>
>>>>>> * @nal_unit_type: specifies the coding type of the slice (B, P or
>>>>>> I)
>>>>>> * @nuh_temporal_id_plus1: minus 1 specifies a temporal identifier
>>>>>> for
>>>>>> the NAL unit * @slice_type: see V4L2_HEVC_SLICE_TYPE_{}
>>>>>>
>>>>>> @@ -358,7 +361,7 @@ struct v4l2_hevc_pred_weight_table {
>>>>>>
>>>>>> struct v4l2_ctrl_hevc_slice_params {
>>>>>>
>>>>>> __u32 bit_size;
>>>>>> __u32 data_bit_offset;
>>>>>>
>>>>>> -
>>>>>> + __u32 num_entry_point_offsets;
>>>>>>
>>>>>> /* ISO/IEC 23008-2, ITU-T Rec. H.265: NAL unit header */
>>>>>> __u8 nal_unit_type;
>>>>>> __u8 nuh_temporal_id_plus1;
>>>>>>
>>>>>> --
>>>>>> 2.32.0
>