HEVC/H.265 stateless support for V4L2 and Cedrus
Subsystems (5)
v7 cover HEVC/H.265 stateless support for V4L2 and Cedrus
HEVC/H.265 stateless support for V4L2 and Cedrus
This is early support for HEVC/H.265 stateless decoding in V4L2, including both definitions and driver support for the Cedrus VPU driver, which concerns Allwinner devices.
A specific pixel format is introduced for the HEVC slice format and controls are provided to pass the bitstream metadata to the decoder. Some bitstream extensions are intentionally not supported at this point.
Since this is the first proposal for stateless HEVC/H.265 support in V4L2, reviews and comments about the controls definitions are particularly welcome.
On the Cedrus side, the H.265 implementation covers frame pictures with both uni-directional and bi-direction prediction modes (P/B slices). Field pictures (interleaved), scaling lists and 10-bit output are not supported at this point.
Changes since v6:
* Rebased on latest media tree from Hans;
* Reordered some fields to avoid holes and multi-padding;
* Updated the documentation.
Changes since v5:
* Rebased atop latest next media tree;
* Moved to flags instead of u8 fields;
* Added padding to ensure 64-bit alignment
(tested with GDB on 32 and 64-bit architectures);
* Reworked cedrus H.265 driver support a bit for flags;
* Split off codec-specific control validation and init;
* Added HEVC controls fields cleanup at std_validate to allow reliable control comparison with memcmp;
* Fixed various misc reported mistakes.
Changes since v4:
* Rebased atop latest H.254 series.
Changes since v3:
* Updated commit messages;
* Updated CID base to avoid conflicts;
* Used cpu_to_le32 for packed le32 data;
* Fixed misc minor issues in the drive code;
* Made it clear in the docs that the API will evolve;
* Made the pixfmt private and split commits about it.
Changes since v2:
* Moved headers to non-public API;
* Added H265 capability for A64 and H5;
* Moved docs to ext-ctrls-codec.rst;
* Mentionned sections of the spec in the docs;
* Added padding to control structures for 32-bit alignment;
* Made write function use void/size in bytes;
* Reduced the number of arguments to helpers when possible;
* Removed PHYS_OFFSET since we already set PFN_OFFSET;
* Added comments where suggested;
* Moved to timestamp for references instead of index;
* Fixed some style issues reported by checkpatch.
Changes since v1:
* Added a H.265 capability to whitelist relevant platforms;
* Switched over to tags instead of buffer indices in the DPB
* Declared variable in their reduced scope as suggested;
* Added the H.265/HEVC spec to the biblio;
* Used in-doc references to the spec and the required APIs;
* Removed debugging leftovers.
Cheers!
Paul Kocialkowski (4):
media: v4l2-ctrl: Add a comment on why we zero out compound controls
fields
media: v4l: Add definitions for the HEVC slice controls
media: pixfmt: Document the HEVC slice pixel format
media: cedrus: Add HEVC/H.265 decoding support
Documentation/media/uapi/v4l/biblio.rst | 9 + .../media/uapi/v4l/ext-ctrls-codec.rst | 486 +++++++++++++- .../media/uapi/v4l/pixfmt-compressed.rst | 21 + .../media/uapi/v4l/vidioc-queryctrl.rst | 18 + .../media/videodev2.h.rst.exceptions | 3 + drivers/media/v4l2-core/v4l2-ctrls.c | 93 +++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + drivers/staging/media/sunxi/cedrus/Makefile | 2 +- drivers/staging/media/sunxi/cedrus/cedrus.c | 31 +- drivers/staging/media/sunxi/cedrus/cedrus.h | 18 + .../staging/media/sunxi/cedrus/cedrus_dec.c | 9 + .../staging/media/sunxi/cedrus/cedrus_h265.c | 616 ++++++++++++++++++ .../staging/media/sunxi/cedrus/cedrus_hw.c | 4 + .../staging/media/sunxi/cedrus/cedrus_regs.h | 271 ++++++++ .../staging/media/sunxi/cedrus/cedrus_video.c | 10 + include/media/hevc-ctrls.h | 198 ++++++ include/media/v4l2-ctrls.h | 7 + 17 files changed, 1789 insertions(+), 8 deletions(-) create mode 100644 drivers/staging/media/sunxi/cedrus/cedrus_h265.c create mode 100644 include/media/hevc-ctrls.h
Signature · 1 line
2.22.0
PATCH v7 1/4 media: v4l2-ctrl: Add a comment on why we zero out compound controls fields
Since it's not necessarily very explicit why we need to zero some fields in std_validate_compound, add a comment before the function to explain why, which should help as a reminder.
--- drivers/media/v4l2-core/v4l2-ctrls.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/media/v4l2-core/v4l2-ctrls.c +4 -0
@@ -1645,6 +1645,10 @@ static void std_log(const struct v4l2_ctrl *ctrl)#define zero_padding (s) \ memset(&(s).padding, 0, sizeof((s).padding)) +/* +* Compound controls validation requires setting unused fields/flags to zero +* in order to properly detect unchanged controls with std_equal's memcmp. +*/ static int std_validate_compound (const struct v4l2_ctrl *ctrl,u32 idx,union v4l2_ctrl_ptr ptr) {
Signature · 1 line
2.22.0
PATCH v7 2/4 media: v4l: Add definitions for the HEVC slice controls
In reply to Paul KocialkowskiThis introduces the required definitions for HEVC decoding support with stateless VPUs. The controls associated to the HEVC slice format provide the required meta-data for decoding slices extracted from the bitstream.
They are not exported to the public V4L2 API since reworking this API will be needed for covering various use-cases and new hardware.
The interface comes with the following limitations:
* No custom quantization matrices (scaling lists);
* Support for a single temporal layer only;
* No slice entry point offsets support;
* No conformance window support;
* No VUI parameters support;
* No support for SPS extensions: range, multilayer, 3d, scc, 4 bits;
* No support for PPS extensions: range, multilayer, 3d, scc, 4 bits.
--- Documentation/media/uapi/v4l/biblio.rst | 9 + .../media/uapi/v4l/ext-ctrls-codec.rst | 486 +++++++++++++++++- .../media/uapi/v4l/vidioc-queryctrl.rst | 18 + .../media/videodev2.h.rst.exceptions | 3 + drivers/media/v4l2-core/v4l2-ctrls.c | 89 ++++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/media/hevc-ctrls.h | 198 +++++++ include/media/v4l2-ctrls.h | 7 + 8 files changed, 808 insertions(+), 3 deletions(-) create mode 100644 include/media/hevc-ctrls.h
Documentation/media/uapi/v4l/biblio.rst +9 -0
@@ -131,6 +131,15 @@ ITU-T Rec. H.264 Specification (04/2017 Edition) :author: International Telecommunication Union (http://www.itu.ch) +.. _hevc: + +ITU H.265/HEVC +============== + +:title: ITU-T Rec. H.265 | ISO/IEC 23008-2 "High Efficiency Video Coding" + +:author: International Telecommunication Union (http://www.itu.ch), International Organisation for Standardisation (http://www.iso.ch) + .. _jfif: JFIF
Documentation/media/uapi/v4l/ext-ctrls-codec.rst +483 -3
495 lines not on this page · raw message
Documentation/media/uapi/v4l/vidioc-queryctrl.rst +18 -0
@@ -473,6 +473,24 @@ See also the examples in :ref:`control`. - n/a - A struct :c:type:`v4l2_ctrl_h264_decode_params`, containing H264 decode parameters for stateless video decoders. + * - ``V4L2_CTRL_TYPE_HEVC_SPS`` + - n/a + - n/a + - n/a + - A struct :c:type:`v4l2_ctrl_hevc_sps`, containing HEVC Sequence + Parameter Set for stateless video decoders. + * - ``V4L2_CTRL_TYPE_HEVC_PPS`` + - n/a + - n/a + - n/a + - A struct :c:type:`v4l2_ctrl_hevc_pps`, containing HEVC Picture + Parameter Set for stateless video decoders. + * - ``V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS`` + - n/a + - n/a + - n/a + - A struct :c:type:`v4l2_ctrl_hevc_slice_params`, containing HEVC + slice parameters for stateless video decoders. .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
Documentation/media/videodev2.h.rst.exceptions +3 -0
@@ -141,6 +141,9 @@ replace symbol V4L2_CTRL_TYPE_H264_PPS :c:type:`v4l2_ctrl_type` replace symbol V4L2_CTRL_TYPE_H264_SCALING_MATRIX :c:type:`v4l2_ctrl_type` replace symbol V4L2_CTRL_TYPE_H264_SLICE_PARAMS :c:type:`v4l2_ctrl_type` replace symbol V4L2_CTRL_TYPE_H264_DECODE_PARAMS :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` # V4L2 capability defines replace define V4L2_CAP_VIDEO_CAPTURE device-capabilities
drivers/media/v4l2-core/v4l2-ctrls.c +89 -0
120 lines not on this page · raw message
drivers/media/v4l2-core/v4l2-ioctl.c +1 -0
@@ -1356,6 +1356,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_PIX_FMT_VP8_FRAME : descr ="VP8 Frame" ;break ;case V4L2_PIX_FMT_VP9 : descr ="VP9" ;break ;case V4L2_PIX_FMT_HEVC : descr ="HEVC" ;break ;/* aka H.265 */ +case V4L2_PIX_FMT_HEVC_SLICE : descr ="HEVC Parsed Slice Data" ;break ;case V4L2_PIX_FMT_FWHT : descr ="FWHT" ;break ;/* used in vicodec */ case V4L2_PIX_FMT_FWHT_STATELESS : descr ="FWHT Stateless" ;break ;/* used in vicodec */ case V4L2_PIX_FMT_CPIA1 : descr ="GSPCA CPiA YUV" ;break ;
include/media/hevc-ctrls.h new file +198 -0
198 lines not on this page · raw message
include/media/v4l2-ctrls.h +7 -0
@@ -21,6 +21,7 @@#include <media/fwht-ctrls.h> #include <media/h264-ctrls.h> #include <media/vp8-ctrls.h> +#include <media/hevc-ctrls.h> /* forward references */ struct file ;
@@ -50,6 +51,9 @@ struct poll_table_struct;* @p_h264_slice_params: Pointer to a struct v4l2_ctrl_h264_slice_params. * @p_h264_decode_params: Pointer to a struct v4l2_ctrl_h264_decode_params. * @p_vp8_frame_header: Pointer to a VP8 frame header structure. +* @p_hevc_sps: Pointer to an HEVC sequence parameter set structure. +* @p_hevc_pps: Pointer to an HEVC picture parameter set structure. +* @p_hevc_slice_params: Pointer to an HEVC slice parameters structure. * @p: Pointer to a compound value. */ union v4l2_ctrl_ptr {
@@ -68,6 +72,9 @@ union v4l2_ctrl_ptr {struct v4l2_ctrl_h264_slice_params *p_h264_slice_params;struct v4l2_ctrl_h264_decode_params *p_h264_decode_params;struct v4l2_ctrl_vp8_frame_header *p_vp8_frame_header; +struct v4l2_ctrl_hevc_sps *p_hevc_sps; +struct v4l2_ctrl_hevc_pps *p_hevc_pps; +struct v4l2_ctrl_hevc_slice_params *p_hevc_slice_params;void *p; };
Signature · 1 line
2.22.0
PATCH v7 3/4 media: pixfmt: Document the HEVC slice pixel format
In reply to Paul KocialkowskiDocument the current state of the HEVC slice pixel format. The format will need to evolve in the future, which is why it is not part of the public API.
--- .../media/uapi/v4l/pixfmt-compressed.rst | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+)
Documentation/media/uapi/v4l/pixfmt-compressed.rst +21 -0
@@ -163,6 +163,27 @@ Compressed Formats - ``V4L2_PIX_FMT_HEVC`` - 'HEVC' - HEVC/H.265 video elementary stream. + * .. _V4L2-PIX-FMT-HEVC-SLICE: + + - ``V4L2_PIX_FMT_HEVC_SLICE`` + - 'S265' + - HEVC parsed slice data, as extracted from the HEVC bitstream. + This format is adapted for stateless video decoders that implement a + HEVC pipeline (using the :ref:`mem2mem` and :ref:`media-request-api`). + Metadata associated with the frame to decode is required to be passed + through the following controls : + * ``V4L2_CID_MPEG_VIDEO_HEVC_SPS`` + * ``V4L2_CID_MPEG_VIDEO_HEVC_PPS`` + * ``V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS`` + 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``
Signature · 1 line
2.22.0
PATCH v7 4/4 media: cedrus: Add HEVC/H.265 decoding support
In reply to Paul KocialkowskiThis introduces support for HEVC/H.265 to the Cedrus VPU driver, with both uni-directional and bi-directional prediction modes supported.
Field-coded (interlaced) pictures, custom quantization matrices and 10-bit output are not supported at this point.
--- drivers/staging/media/sunxi/cedrus/Makefile | 2 +- drivers/staging/media/sunxi/cedrus/cedrus.c | 31 +- drivers/staging/media/sunxi/cedrus/cedrus.h | 18 + .../staging/media/sunxi/cedrus/cedrus_dec.c | 9 + .../staging/media/sunxi/cedrus/cedrus_h265.c | 616 ++++++++++++++++++ .../staging/media/sunxi/cedrus/cedrus_hw.c | 4 + .../staging/media/sunxi/cedrus/cedrus_regs.h | 271 ++++++++ .../staging/media/sunxi/cedrus/cedrus_video.c | 10 + 8 files changed, 956 insertions(+), 5 deletions(-) create mode 100644 drivers/staging/media/sunxi/cedrus/cedrus_h265.c
drivers/staging/media/sunxi/cedrus/Makefile +1 -1
@@ -2,4 +2,4 @@ obj-$(CONFIG_VIDEO_SUNXI_CEDRUS) += sunxi-cedrus.o sunxi-cedrus-y = cedrus.o cedrus_video.o cedrus_hw.o cedrus_dec.o \ - cedrus_mpeg2.o cedrus_h264.o + cedrus_mpeg2.o cedrus_h264.o cedrus_h265.o
drivers/staging/media/sunxi/cedrus/cedrus.c +27 -4
@@ -70,6 +70,24 @@ static const struct cedrus_control cedrus_controls[] = { .codec = CEDRUS_CODEC_H264, .required = true, }, + { + .id = V4L2_CID_MPEG_VIDEO_HEVC_SPS, + .elem_size = sizeof(struct v4l2_ctrl_hevc_sps), + .codec = CEDRUS_CODEC_H265, + .required = true, + }, + { + .id = V4L2_CID_MPEG_VIDEO_HEVC_PPS, + .elem_size = sizeof(struct v4l2_ctrl_hevc_pps), + .codec = CEDRUS_CODEC_H265, + .required = true, + }, + { + .id = V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS, + .elem_size = sizeof(struct v4l2_ctrl_hevc_slice_params), + .codec = CEDRUS_CODEC_H265, + .required = true, + }, }; #define CEDRUS_CONTROLS_COUNT ARRAY_SIZE(cedrus_controls)
@@ -309,6 +327,7 @@ static int cedrus_probe(struct platform_device *pdev) dev->dec_ops[CEDRUS_CODEC_MPEG2 ] = &cedrus_dec_ops_mpeg2; dev->dec_ops[CEDRUS_CODEC_H264 ] = &cedrus_dec_ops_h264; + dev->dec_ops[CEDRUS_CODEC_H265 ] = &cedrus_dec_ops_h265;mutex_init (&dev->dev_mutex);
@@ -417,22 +436,26 @@ static const struct cedrus_variant sun8i_a33_cedrus_variant = { };static const struct cedrus_variant sun8i_h3_cedrus_variant = { - .capabilities =CEDRUS_CAPABILITY_UNTILED , + .capabilities =CEDRUS_CAPABILITY_UNTILED | +CEDRUS_CAPABILITY_H265_DEC , .mod_rate =402000000 , };static const struct cedrus_variant sun50i_a64_cedrus_variant = { - .capabilities =CEDRUS_CAPABILITY_UNTILED , + .capabilities =CEDRUS_CAPABILITY_UNTILED | +CEDRUS_CAPABILITY_H265_DEC , .mod_rate =402000000 , };static const struct cedrus_variant sun50i_h5_cedrus_variant = { - .capabilities =CEDRUS_CAPABILITY_UNTILED , + .capabilities =CEDRUS_CAPABILITY_UNTILED | +CEDRUS_CAPABILITY_H265_DEC , .mod_rate =402000000 , };static const struct cedrus_variant sun50i_h6_cedrus_variant = { - .capabilities =CEDRUS_CAPABILITY_UNTILED , + .capabilities =CEDRUS_CAPABILITY_UNTILED | +CEDRUS_CAPABILITY_H265_DEC , .quirks =CEDRUS_QUIRK_NO_DMA_OFFSET , .mod_rate =600000000 , };
drivers/staging/media/sunxi/cedrus/cedrus.h +18 -0
@@ -27,12 +27,14 @@#define CEDRUS_NAME "cedrus"#define CEDRUS_CAPABILITY_UNTILED BIT(0) +#define CEDRUS_CAPABILITY_H265_DEC BIT(1)#define CEDRUS_QUIRK_NO_DMA_OFFSET BIT(0)enum cedrus_codec {CEDRUS_CODEC_MPEG2 ,CEDRUS_CODEC_H264 , +CEDRUS_CODEC_H265 ,CEDRUS_CODEC_LAST , };
@@ -68,6 +70,12 @@ struct cedrus_mpeg2_run {const struct v4l2_ctrl_mpeg2_quantization *quantization; }; +struct cedrus_h265_run { +const struct v4l2_ctrl_hevc_sps *sps; +const struct v4l2_ctrl_hevc_pps *pps; +const struct v4l2_ctrl_hevc_slice_params *slice_params; +}; +struct cedrus_run {struct vb2_v4l2_buffer *src;struct vb2_v4l2_buffer *dst;
@@ -75,6 +83,7 @@ struct cedrus_run {union {struct cedrus_h264_run h264;struct cedrus_mpeg2_run mpeg2; +struct cedrus_h265_run h265; }; };
@@ -113,6 +122,14 @@ struct cedrus_ctx {void *neighbor_info_buf;dma_addr_t neighbor_info_buf_dma; } h264; +struct { +void *mv_col_buf; +dma_addr_t mv_col_buf_addr; +ssize_t mv_col_buf_size; +ssize_t mv_col_buf_unit_size; +void *neighbor_info_buf; +dma_addr_t neighbor_info_buf_addr; + } h265; } codec; };
@@ -158,6 +175,7 @@ struct cedrus_dev {extern struct cedrus_dec_ops cedrus_dec_ops_mpeg2;extern struct cedrus_dec_ops cedrus_dec_ops_h264; +extern struct cedrus_dec_ops cedrus_dec_ops_h265;static inline void cedrus_write (struct cedrus_dev *dev,u32 reg,u32 val) {
drivers/staging/media/sunxi/cedrus/cedrus_dec.c +9 -0
@@ -59,6 +59,15 @@ void cedrus_device_run(void *priv) V4L2_CID_MPEG_VIDEO_H264_SPS);break ; +case V4L2_PIX_FMT_HEVC_SLICE : + run.h265.sps =cedrus_find_control_data (ctx, +V4L2_CID_MPEG_VIDEO_HEVC_SPS ); + run.h265.pps =cedrus_find_control_data (ctx, +V4L2_CID_MPEG_VIDEO_HEVC_PPS ); + run.h265.slice_params =cedrus_find_control_data (ctx, +V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS ); +break ; +default :break ; }
drivers/staging/media/sunxi/cedrus/cedrus_h265.c new file +616 -0
616 lines not on this page · raw message
drivers/staging/media/sunxi/cedrus/cedrus_hw.c +4 -0
@@ -50,6 +50,10 @@ int cedrus_engine_enable(struct cedrus_dev *dev, enum cedrus_codec codec) reg |=VE_MODE_DEC_H264 ;break ; +case CEDRUS_CODEC_H265 : + reg |=VE_MODE_DEC_H265 ; +break ; +default :return -EINVAL ; }
drivers/staging/media/sunxi/cedrus/cedrus_regs.h +271 -0
287 lines not on this page · raw message
drivers/staging/media/sunxi/cedrus/cedrus_video.c +10 -0
@@ -41,6 +41,11 @@ static struct cedrus_format cedrus_formats[] = { .pixelformat = V4L2_PIX_FMT_H264_SLICE_RAW, .directions = CEDRUS_DECODE_SRC, }, + { + .pixelformat = V4L2_PIX_FMT_HEVC_SLICE, + .directions = CEDRUS_DECODE_SRC, + .capabilities = CEDRUS_CAPABILITY_H265_DEC, + }, { .pixelformat = V4L2_PIX_FMT_SUNXI_TILED_NV12, .directions = CEDRUS_DECODE_DST,
@@ -105,6 +110,7 @@ static void cedrus_prepare_format(struct v4l2_pix_format *pix_fmt)switch (pix_fmt->pixelformat) {case V4L2_PIX_FMT_MPEG2_SLICE :case V4L2_PIX_FMT_H264_SLICE_RAW : +case V4L2_PIX_FMT_HEVC_SLICE :/* Zero bytes per line for encoded source. */ bytesperline =0 ;
@@ -473,6 +479,10 @@ static int cedrus_start_streaming(struct vb2_queue *vq, unsigned int count) ctx->current_codec =CEDRUS_CODEC_H264 ;break ; +case V4L2_PIX_FMT_HEVC_SLICE : + ctx->current_codec =CEDRUS_CODEC_H265 ; +break ; +default :return -EINVAL ; }
Signature · 1 line
2.22.0
Quoted 14 lines · Paul Kocialkowski
HEVC/H.265 stateless support for V4L2 and Cedrus
This is early support for HEVC/H.265 stateless decoding in V4L2, including both definitions and driver support for the Cedrus VPU driver, which concerns Allwinner devices.
A specific pixel format is introduced for the HEVC slice format and controls are provided to pass the bitstream metadata to the decoder. Some bitstream extensions are intentionally not supported at this point.
Since this is the first proposal for stateless HEVC/H.265 support in V4L2, reviews and comments about the controls definitions are particularly welcome.
Quoted 7 lines
On the Cedrus side, the H.265 implementation covers frame pictures with both uni-directional and bi-direction prediction modes (P/B slices). Field pictures (interleaved), scaling lists and 10-bit output are not supported at this point.
Changes since v6:
* Rebased on latest media tree from Hans;
Which tree is that? Or are you just referring our media_tree master branch? (which isn't 'my' tree :-) )
Regards,
Hans
Quoted 76 lines
* Reordered some fields to avoid holes and multi-padding;
* Updated the documentation.Changes since v5:
* Rebased atop latest next media tree;
* Moved to flags instead of u8 fields;
* Added padding to ensure 64-bit alignment
(tested with GDB on 32 and 64-bit architectures);
* Reworked cedrus H.265 driver support a bit for flags;
* Split off codec-specific control validation and init;
* Added HEVC controls fields cleanup atstd_validateto allow reliable control comparison with memcmp;
* Fixed various misc reported mistakes.Changes since v4:
* Rebased atop latest H.254 series.Changes since v3:
* Updated commit messages;
* Updated CID base to avoid conflicts;
* Usedcpu_to_le32for packed le32 data;
* Fixed misc minor issues in the drive code;
* Made it clear in the docs that the API will evolve;
* Made the pixfmt private and split commits about it.Changes since v2:
* Moved headers to non-public API;
* Added H265 capability for A64 and H5;
* Moved docs toext-ctrls-codec.rst;
* Mentionned sections of the spec in the docs;
* Added padding to control structures for 32-bit alignment;
* Made write function use void/size in bytes;
* Reduced the number of arguments to helpers when possible;
* RemovedPHYS_OFFSETsince we already setPFN_OFFSET;
* Added comments where suggested;
* Moved to timestamp for references instead of index;
* Fixed some style issues reported by checkpatch.Changes since v1:
* Added a H.265 capability to whitelist relevant platforms;
* Switched over to tags instead of buffer indices in the DPB
* Declared variable in their reduced scope as suggested;
* Added the H.265/HEVC spec to the biblio;
* Used in-doc references to the spec and the required APIs;
* Removed debugging leftovers.Cheers!
Paul Kocialkowski (4):
media: v4l2-ctrl: Add a comment on why we zero out compound controls
fields
media: v4l: Add definitions for the HEVC slice controls
media: pixfmt: Document the HEVC slice pixel format
media: cedrus: Add HEVC/H.265 decoding supportDocumentation/media/uapi/v4l/biblio.rst | 9 + .../media/uapi/v4l/ext-ctrls-codec.rst | 486 +++++++++++++- .../media/uapi/v4l/pixfmt-compressed.rst | 21 + .../media/uapi/v4l/vidioc-queryctrl.rst | 18 + .../media/videodev2.h.rst.exceptions | 3 + drivers/media/v4l2-core/v4l2-ctrls.c | 93 +++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + drivers/staging/media/sunxi/cedrus/Makefile | 2 +- drivers/staging/media/sunxi/cedrus/cedrus.c | 31 +- drivers/staging/media/sunxi/cedrus/cedrus.h | 18 + .../staging/media/sunxi/cedrus/cedrus_dec.c | 9 + .../staging/media/sunxi/cedrus/cedrus_h265.c | 616 ++++++++++++++++++ .../staging/media/sunxi/cedrus/cedrus_hw.c | 4 + .../staging/media/sunxi/cedrus/cedrus_regs.h | 271 ++++++++ .../staging/media/sunxi/cedrus/cedrus_video.c | 10 + include/media/hevc-ctrls.h | 198 ++++++ include/media/v4l2-ctrls.h | 7 + 17 files changed, 1789 insertions(+), 8 deletions(-) create mode 100644 drivers/staging/media/sunxi/cedrus/cedrus_h265.c create mode 100644 include/media/hevc-ctrls.h
Hi Hans,
Quoted 20 lines · Hans Verkuil
Quoted 19 lines · Paul Kocialkowski
HEVC/H.265 stateless support for V4L2 and Cedrus
This is early support for HEVC/H.265 stateless decoding in V4L2, including both definitions and driver support for the Cedrus VPU driver, which concerns Allwinner devices.
A specific pixel format is introduced for the HEVC slice format and controls are provided to pass the bitstream metadata to the decoder. Some bitstream extensions are intentionally not supported at this point.
Since this is the first proposal for stateless HEVC/H.265 support in V4L2, reviews and comments about the controls definitions are particularly welcome.
On the Cedrus side, the H.265 implementation covers frame pictures with both uni-directional and bi-direction prediction modes (P/B slices). Field pictures (interleaved), scaling lists and 10-bit output are not supported at this point.
Quoted 5 lines
Quoted 2 lines
Changes since v6:
* Rebased on latest media tree from Hans;Which tree is that? Or are you just referring our
media_treemaster branch? (which isn't 'my' tree :-) )
I'm usually rebasing on the tree you use to send PRs to Mauro, at:
https://git.linuxtv.org/hverkuil/media_tree.git/
which is usually the best up-to-date stateless codec support tree :)
Cheers,
Paul
Quoted 81 lines
Regards,
Hans
Quoted 76 lines
* Reordered some fields to avoid holes and multi-padding;
* Updated the documentation.Changes since v5:
* Rebased atop latest next media tree;
* Moved to flags instead of u8 fields;
* Added padding to ensure 64-bit alignment
(tested with GDB on 32 and 64-bit architectures);
* Reworked cedrus H.265 driver support a bit for flags;
* Split off codec-specific control validation and init;
* Added HEVC controls fields cleanup atstd_validateto allow reliable control comparison with memcmp;
* Fixed various misc reported mistakes.Changes since v4:
* Rebased atop latest H.254 series.Changes since v3:
* Updated commit messages;
* Updated CID base to avoid conflicts;
* Usedcpu_to_le32for packed le32 data;
* Fixed misc minor issues in the drive code;
* Made it clear in the docs that the API will evolve;
* Made the pixfmt private and split commits about it.Changes since v2:
* Moved headers to non-public API;
* Added H265 capability for A64 and H5;
* Moved docs toext-ctrls-codec.rst;
* Mentionned sections of the spec in the docs;
* Added padding to control structures for 32-bit alignment;
* Made write function use void/size in bytes;
* Reduced the number of arguments to helpers when possible;
* RemovedPHYS_OFFSETsince we already setPFN_OFFSET;
* Added comments where suggested;
* Moved to timestamp for references instead of index;
* Fixed some style issues reported by checkpatch.Changes since v1:
* Added a H.265 capability to whitelist relevant platforms;
* Switched over to tags instead of buffer indices in the DPB
* Declared variable in their reduced scope as suggested;
* Added the H.265/HEVC spec to the biblio;
* Used in-doc references to the spec and the required APIs;
* Removed debugging leftovers.Cheers!
Paul Kocialkowski (4):
media: v4l2-ctrl: Add a comment on why we zero out compound controls
fields
media: v4l: Add definitions for the HEVC slice controls
media: pixfmt: Document the HEVC slice pixel format
media: cedrus: Add HEVC/H.265 decoding supportDocumentation/media/uapi/v4l/biblio.rst | 9 + .../media/uapi/v4l/ext-ctrls-codec.rst | 486 +++++++++++++- .../media/uapi/v4l/pixfmt-compressed.rst | 21 + .../media/uapi/v4l/vidioc-queryctrl.rst | 18 + .../media/videodev2.h.rst.exceptions | 3 + drivers/media/v4l2-core/v4l2-ctrls.c | 93 +++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + drivers/staging/media/sunxi/cedrus/Makefile | 2 +- drivers/staging/media/sunxi/cedrus/cedrus.c | 31 +- drivers/staging/media/sunxi/cedrus/cedrus.h | 18 + .../staging/media/sunxi/cedrus/cedrus_dec.c | 9 + .../staging/media/sunxi/cedrus/cedrus_h265.c | 616 ++++++++++++++++++ .../staging/media/sunxi/cedrus/cedrus_hw.c | 4 + .../staging/media/sunxi/cedrus/cedrus_regs.h | 271 ++++++++ .../staging/media/sunxi/cedrus/cedrus_video.c | 10 + include/media/hevc-ctrls.h | 198 ++++++ include/media/v4l2-ctrls.h | 7 + 17 files changed, 1789 insertions(+), 8 deletions(-) create mode 100644 drivers/staging/media/sunxi/cedrus/cedrus_h265.c create mode 100644 include/media/hevc-ctrls.h
Signature · 3 lines
Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com
Quoted 23 lines · Paul Kocialkowski
Hi Hans,
Quoted 20 lines · Hans Verkuil
Quoted 19 lines · Paul Kocialkowski
HEVC/H.265 stateless support for V4L2 and Cedrus
This is early support for HEVC/H.265 stateless decoding in V4L2, including both definitions and driver support for the Cedrus VPU driver, which concerns Allwinner devices.
A specific pixel format is introduced for the HEVC slice format and controls are provided to pass the bitstream metadata to the decoder. Some bitstream extensions are intentionally not supported at this point.
Since this is the first proposal for stateless HEVC/H.265 support in V4L2, reviews and comments about the controls definitions are particularly welcome.
On the Cedrus side, the H.265 implementation covers frame pictures with both uni-directional and bi-direction prediction modes (P/B slices). Field pictures (interleaved), scaling lists and 10-bit output are not supported at this point.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Changes since v6:
* Rebased on latest media tree from Hans;Which tree is that? Or are you just referring our
media_treemaster branch? (which isn't 'my' tree :-) )I'm usually rebasing on the tree you use to send PRs to Mauro, at:
https://git.linuxtv.org/hverkuil/media_tree.git/
There are lots of branches there, and none are stable branches.
Just base it on the master branch of git://linuxtv.org/media_tree.git.
Regards,
Hans
Quoted 89 lines
which is usually the best up-to-date stateless codec support tree :)
Cheers,
Paul
Quoted 81 lines
Regards,
Hans
Quoted 76 lines
* Reordered some fields to avoid holes and multi-padding;
* Updated the documentation.Changes since v5:
* Rebased atop latest next media tree;
* Moved to flags instead of u8 fields;
* Added padding to ensure 64-bit alignment
(tested with GDB on 32 and 64-bit architectures);
* Reworked cedrus H.265 driver support a bit for flags;
* Split off codec-specific control validation and init;
* Added HEVC controls fields cleanup atstd_validateto allow reliable control comparison with memcmp;
* Fixed various misc reported mistakes.Changes since v4:
* Rebased atop latest H.254 series.Changes since v3:
* Updated commit messages;
* Updated CID base to avoid conflicts;
* Usedcpu_to_le32for packed le32 data;
* Fixed misc minor issues in the drive code;
* Made it clear in the docs that the API will evolve;
* Made the pixfmt private and split commits about it.Changes since v2:
* Moved headers to non-public API;
* Added H265 capability for A64 and H5;
* Moved docs toext-ctrls-codec.rst;
* Mentionned sections of the spec in the docs;
* Added padding to control structures for 32-bit alignment;
* Made write function use void/size in bytes;
* Reduced the number of arguments to helpers when possible;
* RemovedPHYS_OFFSETsince we already setPFN_OFFSET;
* Added comments where suggested;
* Moved to timestamp for references instead of index;
* Fixed some style issues reported by checkpatch.Changes since v1:
* Added a H.265 capability to whitelist relevant platforms;
* Switched over to tags instead of buffer indices in the DPB
* Declared variable in their reduced scope as suggested;
* Added the H.265/HEVC spec to the biblio;
* Used in-doc references to the spec and the required APIs;
* Removed debugging leftovers.Cheers!
Paul Kocialkowski (4):
media: v4l2-ctrl: Add a comment on why we zero out compound controls
fields
media: v4l: Add definitions for the HEVC slice controls
media: pixfmt: Document the HEVC slice pixel format
media: cedrus: Add HEVC/H.265 decoding supportDocumentation/media/uapi/v4l/biblio.rst | 9 + .../media/uapi/v4l/ext-ctrls-codec.rst | 486 +++++++++++++- .../media/uapi/v4l/pixfmt-compressed.rst | 21 + .../media/uapi/v4l/vidioc-queryctrl.rst | 18 + .../media/videodev2.h.rst.exceptions | 3 + drivers/media/v4l2-core/v4l2-ctrls.c | 93 +++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + drivers/staging/media/sunxi/cedrus/Makefile | 2 +- drivers/staging/media/sunxi/cedrus/cedrus.c | 31 +- drivers/staging/media/sunxi/cedrus/cedrus.h | 18 + .../staging/media/sunxi/cedrus/cedrus_dec.c | 9 + .../staging/media/sunxi/cedrus/cedrus_h265.c | 616 ++++++++++++++++++ .../staging/media/sunxi/cedrus/cedrus_hw.c | 4 + .../staging/media/sunxi/cedrus/cedrus_regs.h | 271 ++++++++ .../staging/media/sunxi/cedrus/cedrus_video.c | 10 + include/media/hevc-ctrls.h | 198 ++++++ include/media/v4l2-ctrls.h | 7 + 17 files changed, 1789 insertions(+), 8 deletions(-) create mode 100644 drivers/staging/media/sunxi/cedrus/cedrus_h265.c create mode 100644 include/media/hevc-ctrls.h
Hi,
Quoted 30 lines · Hans Verkuil
Quoted 29 lines · Paul Kocialkowski
Hi Hans,
Quoted 25 lines · Hans Verkuil
Quoted 14 lines · Paul Kocialkowski
HEVC/H.265 stateless support for V4L2 and Cedrus
This is early support for HEVC/H.265 stateless decoding in V4L2, including both definitions and driver support for the Cedrus VPU driver, which concerns Allwinner devices.
A specific pixel format is introduced for the HEVC slice format and controls are provided to pass the bitstream metadata to the decoder. Some bitstream extensions are intentionally not supported at this point.
Since this is the first proposal for stateless HEVC/H.265 support in V4L2, reviews and comments about the controls definitions are particularly welcome.
Quoted 7 lines
On the Cedrus side, the H.265 implementation covers frame pictures with both uni-directional and bi-direction prediction modes (P/B slices). Field pictures (interleaved), scaling lists and 10-bit output are not supported at this point.
Changes since v6:
* Rebased on latest media tree from Hans;Which tree is that? Or are you just referring our
media_treemaster branch? (which isn't 'my' tree :-) )
Quoted 6 lines
Quoted 2 lines
I'm usually rebasing on the tree you use to send PRs to Mauro, at:
https://git.linuxtv.org/hverkuil/media_tree.git/There are lots of branches there, and none are stable branches.
Just base it on the master branch of
git://linuxtv.org/media_tree.git.
Understood, I will do that from now on.
Either way, the series applies and builds as-is (with the initial patch out of the way, as it was merged already) on top of the common media tree.
I just retested everything and it's good to go as far as I'm concerned!
Cheers,
Paul
Quoted 94 lines
Regards,
Hans
Quoted 89 lines
which is usually the best up-to-date stateless codec support tree :)
Cheers,
Paul
Quoted 81 lines
Regards,
Hans
Quoted 76 lines
* Reordered some fields to avoid holes and multi-padding;
* Updated the documentation.Changes since v5:
* Rebased atop latest next media tree;
* Moved to flags instead of u8 fields;
* Added padding to ensure 64-bit alignment
(tested with GDB on 32 and 64-bit architectures);
* Reworked cedrus H.265 driver support a bit for flags;
* Split off codec-specific control validation and init;
* Added HEVC controls fields cleanup atstd_validateto allow reliable control comparison with memcmp;
* Fixed various misc reported mistakes.Changes since v4:
* Rebased atop latest H.254 series.Changes since v3:
* Updated commit messages;
* Updated CID base to avoid conflicts;
* Usedcpu_to_le32for packed le32 data;
* Fixed misc minor issues in the drive code;
* Made it clear in the docs that the API will evolve;
* Made the pixfmt private and split commits about it.Changes since v2:
* Moved headers to non-public API;
* Added H265 capability for A64 and H5;
* Moved docs toext-ctrls-codec.rst;
* Mentionned sections of the spec in the docs;
* Added padding to control structures for 32-bit alignment;
* Made write function use void/size in bytes;
* Reduced the number of arguments to helpers when possible;
* RemovedPHYS_OFFSETsince we already setPFN_OFFSET;
* Added comments where suggested;
* Moved to timestamp for references instead of index;
* Fixed some style issues reported by checkpatch.Changes since v1:
* Added a H.265 capability to whitelist relevant platforms;
* Switched over to tags instead of buffer indices in the DPB
* Declared variable in their reduced scope as suggested;
* Added the H.265/HEVC spec to the biblio;
* Used in-doc references to the spec and the required APIs;
* Removed debugging leftovers.Cheers!
Paul Kocialkowski (4):
media: v4l2-ctrl: Add a comment on why we zero out compound controls
fields
media: v4l: Add definitions for the HEVC slice controls
media: pixfmt: Document the HEVC slice pixel format
media: cedrus: Add HEVC/H.265 decoding supportDocumentation/media/uapi/v4l/biblio.rst | 9 + .../media/uapi/v4l/ext-ctrls-codec.rst | 486 +++++++++++++- .../media/uapi/v4l/pixfmt-compressed.rst | 21 + .../media/uapi/v4l/vidioc-queryctrl.rst | 18 + .../media/videodev2.h.rst.exceptions | 3 + drivers/media/v4l2-core/v4l2-ctrls.c | 93 +++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + drivers/staging/media/sunxi/cedrus/Makefile | 2 +- drivers/staging/media/sunxi/cedrus/cedrus.c | 31 +- drivers/staging/media/sunxi/cedrus/cedrus.h | 18 + .../staging/media/sunxi/cedrus/cedrus_dec.c | 9 + .../staging/media/sunxi/cedrus/cedrus_h265.c | 616 ++++++++++++++++++ .../staging/media/sunxi/cedrus/cedrus_hw.c | 4 + .../staging/media/sunxi/cedrus/cedrus_regs.h | 271 ++++++++ .../staging/media/sunxi/cedrus/cedrus_video.c | 10 + include/media/hevc-ctrls.h | 198 ++++++ include/media/v4l2-ctrls.h | 7 + 17 files changed, 1789 insertions(+), 8 deletions(-) create mode 100644 drivers/staging/media/sunxi/cedrus/cedrus_h265.c create mode 100644 include/media/hevc-ctrls.h
Signature · 3 lines
Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com