Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1224173iog; Tue, 14 Jun 2022 01:37:25 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tEWXCweJ8zeE3I8mZaoYmozcFoS7QaABIzei/aNLMmHkEKvsEot7Hbfz9uRa5qRMfksbg5 X-Received: by 2002:a17:90b:1bd0:b0:1e8:9ac9:c3ec with SMTP id oa16-20020a17090b1bd000b001e89ac9c3ecmr3298668pjb.117.1655195845632; Tue, 14 Jun 2022 01:37:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655195845; cv=none; d=google.com; s=arc-20160816; b=bTSUgQCXgTc1+/P+Q6cNUIurFkvtmou98nH00j+Y16uGUxbXpjeOvQjMjhDYlZAP6H Xq2QriHw7velypxR5bhI8lPXOI4EqbU+ge0b7ugoqy8fOPnmuqDFsSoQBcPWptm5ErbG 7puj8BhTFn7u4oYKF0CwVEXvmcrlI2Z51oM5aXaK8tPydD8xw/MVojZ1QW7JImV5L74l gMfgqLn38Y//JbDY9gIf0jdQjxrbfSn1sqIo9I6IbEUMmaORWu6cJiCO+gS7Cesa1EKk 7JnQ8DAW4YUS0nOtwoQPrUyK10gAGzJNcMBXrzd+MARFtOPFjB/OoGjwgLPoEVC6bCf8 qEJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=htd5ltcZRGJmHFFbul6GsbrR2PI7QmchDT638WGXOEg=; b=cs4Nx7lS/wSzF/XAyk6U2cW0xEt/A8ARp87dM7JSY7/VKh3CiIMoBYX/UHsAwT1afR gzmEPhpQqqGkRts0Rfxyk/Knsho2eHuteSooZV64yQujgS07xfc1vHZitfNbYx7wSXA/ /4Ek/ozEHZIJNnYPAp0aSlUKnpYOfRj0rkFlU+M8+kncKnQmSjQAngIXyuczBYR1H3q2 XbTo5DGxd7aKaiI+30MwTIS73qLril2ShhQ9LSmQEe0hC/ricLlFXRLIgp7Voh/NvJp2 8x5nL/rAzSearAoYzOAEcfGzaA5zPGvdo1RJoSlL+ZEF2xzCoaKmv3qxaWXflPb3c9Ln 7gkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=jc8ZVdrm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fs3-20020a17090af28300b001d99fab8c25si11115440pjb.10.2022.06.14.01.37.11; Tue, 14 Jun 2022 01:37:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=jc8ZVdrm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355359AbiFNHu5 (ORCPT + 99 others); Tue, 14 Jun 2022 03:50:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354995AbiFNHuL (ORCPT ); Tue, 14 Jun 2022 03:50:11 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A49A3ED06; Tue, 14 Jun 2022 00:50:04 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:4a7b:8d3a:acaa:ec46]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: benjamin.gaignard) by madras.collabora.co.uk (Postfix) with ESMTPSA id BF2A066016DF; Tue, 14 Jun 2022 08:50:02 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1655193003; bh=ftNAvCRvK+AQGEske0ptTAtK3LtSx8QeJyl1icndO24=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jc8ZVdrmR1GWgBRmZHbgE3DYdRdyKq7cJJuYQa51B4PsZwEqRmWjtvFr9/HKFimF3 jxK3/CtIpnuYIAjwoh5y3J6gtLWuB7CTSv8aVRXUNXVNTuq28pWFuR9cn2MOtBvAhY /poZHUuY7hbp+kw4PAN0qXKoEq2XEJJKWJ+HJIiiFdXCB8I7R3fDzP8HBeQw2hyw0F awim8H1ZScfp5Gfg5ilJ5Ox+MUUV5Ok4pOmqvnaqYKfZtQHVWwdFqMN2z1JQapUQhP YqYdCSYPj40sp1E81uLwoAAJVQ59oe6gyQH0oqbENlV0q8bLLpShZUcjJkWjnTt5IB jxXYfzEipuShA== From: Benjamin Gaignard To: mchehab@kernel.org, hverkuil@xs4all.nl, ezequiel@vanguardiasur.com.ar, p.zabel@pengutronix.de, gregkh@linuxfoundation.org, mripard@kernel.org, paul.kocialkowski@bootlin.com, wens@csie.org, jernej.skrabec@gmail.com, samuel@sholland.org, nicolas.dufresne@collabora.com, andrzej.p@collabora.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, kernel@collabora.com, Benjamin Gaignard Subject: [PATCH v7 11/17] media: uapi: Add V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS control Date: Tue, 14 Jun 2022 09:49:41 +0200 Message-Id: <20220614074947.160316-12-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220614074947.160316-1-benjamin.gaignard@collabora.com> References: <20220614074947.160316-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- .../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 0796b1563daa..05228e280f66 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 a3c829ef531a..1319cb99ae3f 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 @@ -318,6 +319,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_{} @@ -360,7 +363,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