Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2411351ybt; Tue, 16 Jun 2020 05:34:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwl/QheIUuK97jY1FeviV5PfSmkUhi1hW6CAVpRssPgOlH8+fKgFVf30fsryeBruB3sQuqQ X-Received: by 2002:a05:6402:1559:: with SMTP id p25mr2329824edx.244.1592310874958; Tue, 16 Jun 2020 05:34:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592310874; cv=none; d=google.com; s=arc-20160816; b=Al87ASqo6v6R3I5MQGv3q1ggl9iNn+MlNNUVZ8uoVBVkGXlkUAz23DNYrJKTo+Fzua sy+S8yUwkf0m3iJu9IcVcuV+SmdtQjccsl0H8cop5ffyMuXW6lJRSAXFfAUO0x0RTVst a+Ube9x5sNdOY1DjLe8vATZ5wItUf0vxJ0F9ELrFvsDZBGxpsc6d1KVrL2Nk+kmIa5Tt X5cyRxqhhuMwTeVJdWTPULSALNMpXbhT/r7ehveBNbKigCi/THCBuwnCGZKt8Qzxe0wv ut1gSnP71K3koIWYwvw2B3rTM1gtoqAscgviE1REY16pCw6D/+R7Og21BHWRsP7q7joo I+/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=gW9cbjjRPD6R6Z7AF3iL+tqbW8lQcn4mBsQDieJZv9Y=; b=S4tG1LjMguf3hbHy0bBDZKlxTDGxoLAaBKDDNLF2YIwG/POgxQynoc0/4lOJfzB/1o du0DenWsM+KKhJwfRxUVacKfxE46FJhXlr/C/mggnNqs/+0oNkg8HDc3zAJwDmTCFEeJ mXDy5EPKcGFSwXa9lFIfR/Kx7oJ7t7bq0RJbR1lZ2HvojqN738qj77Df74gLYSUr9R/z MADjuqYqV6zYd6+MqtTfdWO7AyFt1pY1iJRX1jcgsRG8QAM1tTL5W0umEPPsfw61+0eX AT+Sn0+INV9mLNLRB/lAVknwAmEjqj9cRor46G4W4inB6cFoX0Sz2Le2kNlrNEuq2FEu UgIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BZHtCB60; 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 ds15si13835704ejc.14.2020.06.16.05.34.12; Tue, 16 Jun 2020 05:34:34 -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=BZHtCB60; 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 S1728928AbgFPMbm (ORCPT + 99 others); Tue, 16 Jun 2020 08:31:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728882AbgFPMbj (ORCPT ); Tue, 16 Jun 2020 08:31:39 -0400 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E98BDC08C5C3 for ; Tue, 16 Jun 2020 05:31:38 -0700 (PDT) Received: by mail-ed1-x541.google.com with SMTP id k8so14127734edq.4 for ; Tue, 16 Jun 2020 05:31:38 -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; bh=gW9cbjjRPD6R6Z7AF3iL+tqbW8lQcn4mBsQDieJZv9Y=; b=BZHtCB60tWJPdqElhEU3iZEXInx6mH3ofR+IpXPVtDhfBby5ky8JIGXj4QtcCqkj7h Zz2+4sSRk8avHt4Zlj9NZ3teh6An3qOt85dgFhKaOuHAbH58rL5X1jG8hxZDFYzpLa2e Bz89PwSbZS79/kgQ0ifr9aCkseQ7BZXfqY85+EFY21XxVZepl4V3owbqKEh91o0oKgSs /IsGCx082Db1nRRc9Znmwks+4CwvnbDFr2TSpcU91ciPywQ2dBWOwwM50tVxJ4C0EDAq oGDGrPO88ruGiy0A21SdE6fEId2egf6i/cVexHbzU9mRCCCR8Ae3E+vt9KK6xHojewzZ lyJA== 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; bh=gW9cbjjRPD6R6Z7AF3iL+tqbW8lQcn4mBsQDieJZv9Y=; b=oV4RC7zYkojh+PJ/+SFSc4Qzkk5BZPXzAMLn9xl7Ki+dq2ThCoSlaf1CtmxEEA9AeL 8qh8bThtFBsYQgz5Lt9WoIcwI47dJ08ZFZE7SvCTrCKnHHA8xNmIWc03IQX4umQN7L4L yfQhbzF/HKSrSirRzannwFMpwJRWkXffhIN5q0QRLdobrL6+0uRkgq+cbwZdgcj3yuu4 NnIR+RmvEy3OIMCKwZzcLfo4/vJ9sgenyPykNhPYUejM0SYHyvv5vaIlFhEibWgBtvED +b6zO+m7SMBj4LVk6f98dbXwTYbaY7t6SOuxEqxh5VbhbzxhWGJGgEh58N78J9//1yMM fURA== X-Gm-Message-State: AOAM533pTkOxG9gGNCIAnwz5ymV/Ntiy8vQGk1NlqhB8baUoE+Cf69f+ 6fvg1A3xYoPuHvnHaZhju91zcw== X-Received: by 2002:a50:fe07:: with SMTP id f7mr2338476edt.315.1592310697650; Tue, 16 Jun 2020 05:31:37 -0700 (PDT) Received: from localhost.localdomain (212-5-158-38.ip.btc-net.bg. [212.5.158.38]) by smtp.gmail.com with ESMTPSA id p6sm11071983ejb.71.2020.06.16.05.31.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jun 2020 05:31:37 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: Hans Verkuil , Ezequiel Garcia , Maheshwar Ajja , Mauro Carvalho Chehab , Stanimir Varbanov Subject: [PATCH 3/4] v4l2-ctrl: Add control for intra only decode Date: Tue, 16 Jun 2020 15:30:00 +0300 Message-Id: <20200616123001.11321-4-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200616123001.11321-1-stanimir.varbanov@linaro.org> References: <20200616123001.11321-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds a new decoder control to instruct the decoders to produce on its output intra frames only. Usually in this mode decoders might lower the count of output decoder buffers and hence reduce memory usage. Signed-off-by: Stanimir Varbanov --- .../userspace-api/media/v4l/ext-ctrls-codec.rst | 9 +++++++++ drivers/media/v4l2-core/v4l2-ctrls.c | 2 ++ include/uapi/linux/v4l2-controls.h | 1 + 3 files changed, 12 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index b9d3f7ae6486..d7f34596f95b 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -652,6 +652,15 @@ enum v4l2_mpeg_video_bitrate_mode - otherwise the decoder expects a single frame in per buffer. Applicable to the decoder, all codecs. +``V4L2_CID_MPEG_VIDEO_DECODE_INTRA_FRAMES_ONLY (boolean)`` + If enabled the decoder should start decoding only intra frames. The + decoder consume first input buffer for progressive stream (or first + two buffers for interlace). Decoder might not allocate more output + buffers than it is required to consume one input frame. Usually the + decoder input buffers will contain only intra frames but it is not + mandatory. This control could be used for thumbnails generation. + Applicable to the decoder, all codecs. + ``V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE (boolean)`` Enable writing sample aspect ratio in the Video Usability Information. Applicable to the H264 encoder. diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index bc00d02e411f..2b1fb8dcd360 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -846,6 +846,7 @@ const char *v4l2_ctrl_get_name(u32 id) 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"; case V4L2_CID_MPEG_VIDEO_MAX_REF_PIC: return "Max Number of Reference Pics"; + case V4L2_CID_MPEG_VIDEO_DECODE_INTRA_FRAMES_ONLY: return "Decode intra frames only"; case V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP: return "H263 I-Frame QP Value"; case V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP: return "H263 P-Frame QP Value"; case V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP: return "H263 B-Frame QP Value"; @@ -1197,6 +1198,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE: case V4L2_CID_MPEG_VIDEO_MPEG4_QPEL: case V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER: + case V4L2_CID_MPEG_VIDEO_DECODE_INTRA_FRAMES_ONLY: case V4L2_CID_WIDE_DYNAMIC_RANGE: case V4L2_CID_IMAGE_STABILIZATION: case V4L2_CID_RDS_RECEPTION: diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 0f7e4388dcce..c64471e64aa7 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -744,6 +744,7 @@ enum v4l2_cid_mpeg_video_hevc_size_of_length_field { #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_CONSTANT_QUALITY (V4L2_CID_MPEG_BASE + 645) +#define V4L2_CID_MPEG_VIDEO_DECODE_INTRA_FRAMES_ONLY (V4L2_CID_MPEG_BASE + 646) /* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */ #define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000) -- 2.17.1