Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4627115pxj; Tue, 22 Jun 2021 04:42:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAq5F2M5uRfpDzh0D6ZhOBGiM0skYhT2fFSb5E2PLzT28Jz+aNfL3XNrXfzZOi7D79ARh9 X-Received: by 2002:a05:6402:3589:: with SMTP id y9mr2324168edc.218.1624362142596; Tue, 22 Jun 2021 04:42:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624362142; cv=none; d=google.com; s=arc-20160816; b=YG5USNz1ydOpobDg/TT4MFW5a391jq4RvE3oyc2Keai5G8V6cRjvZLxq230JrqE+i/ olFuKw+n9b2ZUV/Vr+2BVxxqxZhTdhYhueTibCq3jAkY8GKGUhSN8RKnn4WytKiUEvpj 5hOUA9Kdaqw16jThSx3mA9yW9jlQG3RheFdXLQh2Rh4HBlHusJMKZJqNabWZUtRGacs0 AqpSZgavzyXTwHdzOmZIb5X6h32POh9M1qsAdtnYYJb5ZiRbGP0QfZsdzOBvH7z8iRzW Et9/z+VeUHDPdW94+JBXKmsZF+1HJuLWH3frK9tB02sLWuDj3Ow6JRl8th6eRvlFeX5G otwg== 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=SuSvtD+Nv+CHB27crL9nwMh5wHimNIqoxaFLzzkG3PY=; b=q1D49GTsqSHoVP7k5+TrtDTOBJn9mvlGiAR6FABdpuqvykl7rO85pxgRd2TqO9BSI8 nzKiYb3SZy6ccfUFXD6ymrvLkDQS4pmHGxKPq1atH4kWkLjyqWunbERxGTBNYxSYPyBE cKk+ZoCzUzZtSurBMRGi1APU3fjGKKMLzFN1IBkyKFgddEwLEOHR/r3S3ooifJteU0nv NabWgcltXJKrgGsswZBnWvuK7yLrqu4Wy+dJ+hCKSvtZEeh8PDI4HChYFGxMPLo66m5b lqx7PgIar9WJo5tahBQIsBbWo3VynZYEAjDZV3EdTvH/HOIGKCV5Nd/YCs9R82aahjLh 7a7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ijzVsaIB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hu7si6656917ejc.142.2021.06.22.04.42.00; Tue, 22 Jun 2021 04:42:22 -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; dkim=pass header.i=@linaro.org header.s=google header.b=ijzVsaIB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230397AbhFVLmq (ORCPT + 99 others); Tue, 22 Jun 2021 07:42:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230274AbhFVLmi (ORCPT ); Tue, 22 Jun 2021 07:42:38 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53337C061768 for ; Tue, 22 Jun 2021 04:40:21 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id f15so7814250wro.8 for ; Tue, 22 Jun 2021 04:40:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SuSvtD+Nv+CHB27crL9nwMh5wHimNIqoxaFLzzkG3PY=; b=ijzVsaIB4FsCX9SbN3ecdP5Ei7CZr43XT9EKA5w58gn6k00DcpJvG9J0XT99hC87yX 3ujmqoDlzmyQFGcA9KMW/fdY7BzsO5tflw/7Lj/BD0hpZpIZ/NITB2LQbrpZRdT47evY sVstdEzVSCppVDlWQbGrCQIlKWBocXDEtD+5ILfGE1eSeVR9x/cpORMMRTxd9hf7JSor dwRYx+yMaJ5nSeCqHW8j1d53lu1Zd5UZl+zMlrOrftCeTRaPxf0YjXBaTNSi00x37DO2 k/y+L9j0xwHSP0hqhwMnSvDxMkMs+MhkR1Pc/RxBGDRy0GmKi+eQ+wtOMrs7OI3iYLs2 bWkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SuSvtD+Nv+CHB27crL9nwMh5wHimNIqoxaFLzzkG3PY=; b=tw4ySxxksCUI8RSzQnLCyA8MUR7lmRj8RrNhn2SvhnedO/8XDGXcUvP/FG3eQDHaox P+iyEUlW38clumIodCrJ/S/mYbkKTKuW9FbP/aN6x0+6c7yuBAkA7knQ9GNCnIhEi3kJ ddTFYv6SMj9ZssOdCkiLdrHIPbOX+rBUtFqp2K6K7qJF3OvCyoWJbtUhiFCM3kjYgAzq BGiehrh7nWnXo8NFY1wvbyoo3B4pdRBK3Z8u6+AiNyyBoIPWSdVAetg25rhzfhLua7M+ 7HYJgwE9JzUo3bI3Iyc9w4PfUSxtqG+TkwvxyR8i+NA2p4ywD6aZ+wBBMH+yPAzYvw/3 PCBA== X-Gm-Message-State: AOAM532gCoQYVT/9NpqlIk4j071tSDsGW7wREXaGIIfXa0cMoO0KcKBA cWlpTlj/bR3fxiEO82Hs0c6yJw== X-Received: by 2002:a5d:6992:: with SMTP id g18mr4184521wru.73.1624362019899; Tue, 22 Jun 2021 04:40:19 -0700 (PDT) Received: from localhost.localdomain (hst-221-32.medicom.bg. [84.238.221.32]) by smtp.gmail.com with ESMTPSA id k2sm20690929wrw.93.2021.06.22.04.40.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 04:40:19 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: Ezequiel Garcia , nicolas.dufresne@collabora.com, Hans Verkuil , Stanimir Varbanov Subject: [PATCH v5 2/3] media: v4l2-ctrls: Add intra-refresh period control Date: Tue, 22 Jun 2021 14:39:57 +0300 Message-Id: <20210622113958.809173-3-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210622113958.809173-1-stanimir.varbanov@linaro.org> References: <20210622113958.809173-1-stanimir.varbanov@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a control to set intra-refresh period. Signed-off-by: Stanimir Varbanov --- .../userspace-api/media/v4l/ext-ctrls-codec.rst | 17 ++++++++++++++++- drivers/media/v4l2-core/v4l2-ctrls-defs.c | 2 ++ include/uapi/linux/v4l2-controls.h | 1 + 3 files changed, 19 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 addf44b99dfa..64c76a3a1205 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -1175,9 +1175,24 @@ enum v4l2_mpeg_video_h264_entropy_mode - macroblocks refreshed every frame. Each frame a successive set of macroblocks is refreshed until the cycle completes and starts from the top of the frame. Setting this control to zero means that - macroblocks will not be refreshed. + macroblocks will not be refreshed. Note that this control will not + take effect when ``V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD`` control + is set to non zero value. Applicable to H264, H263 and MPEG4 encoder. +``V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD (integer)`` + Intra macroblock refresh period. This sets the period to refresh + the whole frame. In other words, this defines the number of frames + for which the whole frame will be intra-refreshed. An example: + setting period to 1 means that the whole frame will be refreshed, + setting period to 2 means that the half of macroblocks will be + intra-refreshed on frameX and the other half of macroblocks + will be refreshed in frameX + 1 and so on. Setting the period to + zero means no period is specified. + Note that if the client sets this control to non zero value the + ``V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB`` control shall be + ignored. Applicable to H264 and HEVC encoders. + ``V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE (boolean)`` Frame level rate control enable. If this control is disabled then the quantization parameter for each frame type is constant and set diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c index b6344bbf1e00..421300e13a41 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c @@ -833,6 +833,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE: return "Decoder Slice Interface"; case V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER: return "MPEG4 Loop Filter Enable"; case V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB: return "Number of Intra Refresh MBs"; + case V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD: return "Intra Refresh Period"; case V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE: return "Frame Level Rate Control Enable"; case V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE: return "H264 MB Level Rate Control"; case V4L2_CID_MPEG_VIDEO_HEADER_MODE: return "Sequence Header Mode"; @@ -1258,6 +1259,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE: case V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE: case V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY: + case V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD: *type = V4L2_CTRL_TYPE_INTEGER; break; case V4L2_CID_MPEG_VIDEO_LTR_COUNT: diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index fdf97a6d7d18..5532b5f68493 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -435,6 +435,7 @@ enum v4l2_mpeg_video_multi_slice_mode { #define V4L2_CID_MPEG_VIDEO_FRAME_LTR_INDEX (V4L2_CID_CODEC_BASE+233) #define V4L2_CID_MPEG_VIDEO_USE_LTR_FRAMES (V4L2_CID_CODEC_BASE+234) #define V4L2_CID_MPEG_VIDEO_DEC_CONCEAL_COLOR (V4L2_CID_CODEC_BASE+235) +#define V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD (V4L2_CID_CODEC_BASE+236) /* CIDs for the MPEG-2 Part 2 (H.262) codec */ #define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL (V4L2_CID_CODEC_BASE+270) -- 2.25.1