Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp130880pxa; Thu, 13 Aug 2020 22:32:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypGHZ64Jo3BP5iCZt3GDH3x4A1XGSO+rsxzXGXp9jnDDgK3auaY0Eupj/5y5fFZbJLt8Zu X-Received: by 2002:a17:906:ca5a:: with SMTP id jx26mr852488ejb.62.1597383163652; Thu, 13 Aug 2020 22:32:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597383163; cv=none; d=google.com; s=arc-20160816; b=svJiCPnBdrHy1ldyILQI2T7aVrnCii4iSJY8msdjf20w8QW7C3Fks5ZpGT6l2zXN0k 9AutYWK3aDOXZo2ytURKQ7mOrrgJzcEv24M/iRBYly2R3YbCn3Rpw4H+Hxx75E7HHmV+ lFk1YxPq/xwXN9tsDxFrCmtU6LjSZvJdesV4vyLfDsWnF8emOQMs81xEzhRvbeDraQV/ LqXZ5WE9QIpfhYAfvqF/42BW8Ye5zz3G8Dq9N8wIcDKN6Fc+q+C+Y2dZ4/XnXB51q+Tu ThVAv9ae99MPVEuzpcw+CCKTnlagD4qNNDIH4Pv5OAr+j3YoeXzmuu/NABPpW5Agdews YfFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=2wB5Blaqt/6/KRb7TuuABXVV7D0extrltEsMPWR1M+Y=; b=c4weesJz3o3jaKjRHAxUCqjM0ZxDtduiLCV1Uq3QOutNwKIbAgZAPQ00NFhLtDiH4G d69PGMMqkvKCrIa0zVps56odu4kw5hjMjlTzq7n2R9bFMl5O5FY+rWfVeyrmA2OZcnjZ mWeSE+rCN+HbmzzJlYFKM2OMYA7h7BPs2/N+3v12oCprqM9kYqFs4+M2NBLCAwetet8M uI6k9IzZOScsqP6/78Zt30k7wR0Xp6DNNZL4glrZhk6iM+eFLQgMFoo6e2aGTmK7O4R9 YqL0RunmYrIIRhs9ihGM40jmVVFBj2CTLrzSIxANkDPMvKCeH+Ekwj326CRnCYubJLIa 3TJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k22si4653677edx.491.2020.08.13.22.32.20; Thu, 13 Aug 2020 22:32:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726590AbgHNF3y (ORCPT + 99 others); Fri, 14 Aug 2020 01:29:54 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:10118 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726320AbgHNF3y (ORCPT ); Fri, 14 Aug 2020 01:29:54 -0400 Received: from ironmsg08-lv.qualcomm.com ([10.47.202.152]) by alexa-out.qualcomm.com with ESMTP; 13 Aug 2020 22:29:52 -0700 Received: from ironmsg02-blr.qualcomm.com ([10.86.208.131]) by ironmsg08-lv.qualcomm.com with ESMTP/TLS/AES256-SHA; 13 Aug 2020 22:29:50 -0700 Received: from dikshita-linux.qualcomm.com ([10.204.65.237]) by ironmsg02-blr.qualcomm.com with ESMTP; 14 Aug 2020 10:59:32 +0530 Received: by dikshita-linux.qualcomm.com (Postfix, from userid 347544) id 2AC0D4702; Fri, 14 Aug 2020 10:59:31 +0530 (IST) From: Dikshita Agarwal To: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: mchehab@kernel.org, hverkuil-cisco@xs4all.nl, nicolas@ndufresne.ca, majja@codeaurora.org, stanimir.varbanov@linaro.org, vgarodia@codeaurora.org, Dikshita Agarwal Subject: [PATCH v2] media: v4l2-ctrl: add control for long term reference. Date: Fri, 14 Aug 2020 10:59:27 +0530 Message-Id: <1597382967-32729-1-git-send-email-dikshita@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org LTR (Long Term Reference) frames are the frames that are encoded sometime in the past and stored in the DPB buffer list to be used as reference to encode future frames. This change adds controls to enable this feature. Signed-off-by: Dikshita Agarwal --- .../userspace-api/media/v4l/ext-ctrls-codec.rst | 23 ++++++++++++++++++++++ drivers/media/v4l2-core/v4l2-ctrls.c | 6 ++++++ include/uapi/linux/v4l2-controls.h | 4 ++++ 3 files changed, 33 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index d0d506a..6d1b005 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -4272,3 +4272,26 @@ enum v4l2_mpeg_video_hevc_size_of_length_field - - Selecting this value specifies that HEVC slices are expected to be prefixed by Annex B start codes. According to :ref:`hevc` valid start codes can be 3-bytes 0x000001 or 4-bytes 0x00000001. + +``V4L2_CID_MPEG_VIDEO_LTRCOUNT (enum)`` + Specifies the number of Long Term Reference frames encoder needs to + generate or keep. + This control is used to query or configure the number of Long Term + Reference frames. + +``V4L2_CID_MPEG_VIDEO_MARKLTRFRAME (enum)`` + This control is used to mark current frame as Long Term Reference + frame. + this provides a Long Term Reference index that ranges from 0 + to LTR count-1 and then the particular frame will be marked with that + Long Term Reference index. + +``V4L2_CID_MPEG_VIDEO_USELTRFRAME (enum)`` + Specifies the Long Term Reference frame(s) to be used for encoding + the current frame. + This provides a bitmask which consists of bits [0, 15]. A total of N + LSB bits of this field are valid, where N is the maximum number of + Long Term Reference frames supported. + All the other bits are invalid and should be rejected. + The LSB corresponds to the Long Term Reference index 0. Bit N-1 from + the LSB corresponds to the Long Term Reference index max LTR count-1. diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 3f3fbcd..3138c72 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -991,6 +991,9 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS: return "HEVC Slice Parameters"; case V4L2_CID_MPEG_VIDEO_HEVC_DECODE_MODE: return "HEVC Decode Mode"; case V4L2_CID_MPEG_VIDEO_HEVC_START_CODE: return "HEVC Start Code"; + case V4L2_CID_MPEG_VIDEO_LTRCOUNT: return "LTR Count"; + case V4L2_CID_MPEG_VIDEO_MARKLTRFRAME: return "Mark LTR"; + case V4L2_CID_MPEG_VIDEO_USELTRFRAME: return "Use LTR"; /* CAMERA controls */ /* Keep the order of the 'case's the same as in v4l2-controls.h! */ @@ -1224,6 +1227,9 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, break; case V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE: case V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE: + case V4L2_CID_MPEG_VIDEO_LTRCOUNT: + case V4L2_CID_MPEG_VIDEO_MARKLTRFRAME: + case V4L2_CID_MPEG_VIDEO_USELTRFRAME: *type = V4L2_CTRL_TYPE_INTEGER; break; case V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME: diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 6227141..f2daa86 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -742,6 +742,10 @@ enum v4l2_cid_mpeg_video_hevc_size_of_length_field { #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L6_BR (V4L2_CID_MPEG_BASE + 642) #define V4L2_CID_MPEG_VIDEO_REF_NUMBER_FOR_PFRAMES (V4L2_CID_MPEG_BASE + 643) #define V4L2_CID_MPEG_VIDEO_PREPEND_SPSPPS_TO_IDR (V4L2_CID_MPEG_BASE + 644) +#define V4L2_CID_MPEG_VIDEO_LTRCOUNT (V4L2_CID_MPEG_BASE + 645) +#define V4L2_CID_MPEG_VIDEO_MARKLTRFRAME (V4L2_CID_MPEG_BASE + 646) +#define V4L2_CID_MPEG_VIDEO_USELTRFRAME (V4L2_CID_MPEG_BASE + 647) + /* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */ #define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000) -- 1.9.1