Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp315985ybm; Tue, 26 May 2020 18:01:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqa9zSPYxkbUS5FSWM8oJWCnWpJPpVqWnRE/WRb1KtA+7VhX3k7ngKqkO2Gmq+LgW3BzmS X-Received: by 2002:a05:6402:1d06:: with SMTP id dg6mr22792688edb.314.1590541305705; Tue, 26 May 2020 18:01:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590541305; cv=none; d=google.com; s=arc-20160816; b=VF++r43EdQk9mOfdeMUFNF+fVTADik0/wOMS9AGSKg6QTqyhaL8Cv5KqzHLhkFAM3N XkkKeQS0ew4FlSC49Rm08bddRGacS0jw/E4Tc6yUX0n5gCj8RB/Thpe2WzZESG8QKSeu Scch/8oLbT4TwNdWcC7f8G/fZb4p2s/CFvopSAcCZ9WiESXjQ3FcOG+z3KDZa10EnuJT D+HSU42zyyT2u/wVwQqWqmdPZ+cJTpCPVF52WzFB+C4IKqUs6lDaWKAHHNhKSWtws4ob XE1Emrzc5nuYA/VEd++54h0AXlTICDSf5ZzzbfQvYvz8xhlRvZc0gGQskgn+GuV7N4Sx JmuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=DtoiVIeHWERaSBEx78ia06b9zdq9g6cht2Ue69Q2Jik=; b=F79T2tc0exlh7wV+Q4lust5Kmww3t2rL9MBV6A7u7JY3fMjFXrJhj0ZJZgW72nWqN7 S3PnyOZw0jvfYwvjzpYgNmKQKhrcTcvzxkwjJcN8LCAGDQgI2ztSpyZjxlaOQcRd9Ey5 H3QHC8UEjQa00ahvV2FupQADbhjIGu9p5UGy54mNQqef5jRU8O/7pa7hPFkAktxkrR9D u9l4eDccJLT8QPS8nZ0js44IklZ0WULbwaJfV/yXRgz7+YnGM2Ctj0R9MjRpEqPp7dEH 5N1Z6aqaWIzWJCLam0i8atrkby+bOn4scietTpn9cgwxT09ueeRAoufXG1qksyIXVZik fUPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vebJv3oP; 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 l22si844279eds.197.2020.05.26.18.01.22; Tue, 26 May 2020 18:01:45 -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=vebJv3oP; 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 S2389474AbgEZVxL (ORCPT + 99 others); Tue, 26 May 2020 17:53:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389096AbgEZVxK (ORCPT ); Tue, 26 May 2020 17:53:10 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E078C03E96D for ; Tue, 26 May 2020 14:53:09 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id h4so1139097wmb.4 for ; Tue, 26 May 2020 14:53:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=DtoiVIeHWERaSBEx78ia06b9zdq9g6cht2Ue69Q2Jik=; b=vebJv3oP2lnh/sFEpz8fOASD5UbPYep6VTqCHBS+JHprGL0YBJZxGAcPm4k7J62QE4 p/M/2/mPnBpg/wsAkf9VHafckjeksiFC+8Q48XtKW13lFDI2aPka+bIgITPJX770f7uO 1p1QqcK0D98ytVH6wHmEf2G5EYXB2+qu13e75MGXCuHQbiGdv7CNeHEZDeSRwFfPaVcZ VQg5yPNeqeadUR05lUYtYZ3kqOTDWsg2e+JQnnA7oXEbdF+fNWcXckAoPUmWfd2iNBSR b69Ic6rUqc6vd0Lc9ZA0hpWP8cQ8L0n/C1AOt99gjyMsoyUEUesEhDryb8kXBL6YQJ8Y 4CBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=DtoiVIeHWERaSBEx78ia06b9zdq9g6cht2Ue69Q2Jik=; b=XiuYVcWKCda5IM4Wjk3C2FlApQDoq1ALMp8DRbYS9ecf7ZF1fKG9ue1ENYIxWKZulK 7VpIBj0jDlWclQtd3ihYkULYLQoWKHCWATutJD6APPpdCFCWZz03nchb76UnXdcH61Zi oo+ql//ZkooTO/oidZ86jI2kHZO7i2TC2sYhxrxHgEZPwdA8DJAbvstuJD3dtn8uffQm YGK8fCGxGvFLHSvgoINY0M7/ZVjc6P+ZeXesJBYeNGVoSGC1e1StrOHFX0a/oYRH3gLx 3LlBfAUEOZyqcrlhPv66TwRAQ0bP69iKNIjNpGZLtbxS0FBGwXRTBqZEQNPzIxhIxVaH CIqw== X-Gm-Message-State: AOAM530mPDK9b5oqxIFoklwVN+ZYFAu7eI0hljA/Ek7F4pjFmm3ehHp+ 9liW39JGOeeXtfhG++qH3xpcmM8IEjk= X-Received: by 2002:a05:600c:4401:: with SMTP id u1mr1141071wmn.36.1590529987975; Tue, 26 May 2020 14:53:07 -0700 (PDT) Received: from [192.168.1.9] (hst-221-24.medicom.bg. [84.238.221.24]) by smtp.googlemail.com with ESMTPSA id l5sm719844wml.27.2020.05.26.14.53.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 26 May 2020 14:53:07 -0700 (PDT) Subject: Re: [PATCH] v4l2-ctrl: add control for thumnails To: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Philipp Zabel , Ezequiel Garcia , Paul Kocialkowski , Nicolas Dufresne , Tomasz Figa References: <20200526085446.30956-1-stanimir.varbanov@linaro.org> <65ac9697-a43f-7025-e6fe-69c4a44c6d9a@xs4all.nl> From: Stanimir Varbanov Message-ID: Date: Wed, 27 May 2020 00:53:06 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <65ac9697-a43f-7025-e6fe-69c4a44c6d9a@xs4all.nl> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Hans, On 5/26/20 3:04 PM, Hans Verkuil wrote: > On 26/05/2020 10:54, Stanimir Varbanov wrote: >> Add v4l2 control for decoder thumbnail. >> >> Signed-off-by: Stanimir Varbanov >> --- >> Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 7 +++++++ >> drivers/media/v4l2-core/v4l2-ctrls.c | 2 ++ >> include/uapi/linux/v4l2-controls.h | 2 ++ >> 3 files changed, 11 insertions(+) >> >> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst >> index d0d506a444b1..e838e410651b 100644 >> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst >> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst >> @@ -3726,6 +3726,13 @@ enum v4l2_mpeg_video_hevc_size_of_length_field - >> disables generating SPS and PPS at every IDR. Setting it to one enables >> generating SPS and PPS at every IDR. >> >> +``V4L2_CID_MPEG_VIDEO_DECODER_THUMBNAIL (button)`` >> + Instructs the decoder to produce immediate output. The decoder should >> + consume first input buffer for progressive stream (or first two buffers >> + for interlace). Decoder should not allocate more output buffers that it >> + is required to consume one input frame. Usually the decoder input >> + buffers will contain only I/IDR frames but it is not mandatory. > > This is very vague. It doesn't explain why the control is called 'THUMBNAIL', > but more importantly it doesn't explain how this relates to normal decoding. If in the normal decode the capture queue buffers are 5, in the thumbnail mode the number of buffers will be only 1 (if the bitstream is progressive) and this will guarantee low memory usage. The other difference is that the decoder will produce decoded frames (without errors) only for I/IDR (sync frames). > > I.e. if you are decoding and 'press' this control, what happens then? Might be the button type wasn't great idea. In fact the control should be set before streamon so that the driver returns min_capture_bufs 1. > > What exactly is the use-case? It could be used to generate thumbnails of all video clips in a folder or when you open a Gallery application on your phone. > > Regards, > > Hans > >> + >> .. _v4l2-mpeg-hevc: >> >> ``V4L2_CID_MPEG_VIDEO_HEVC_SPS (struct)`` >> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c >> index b188577db40f..cb2554404c63 100644 >> --- a/drivers/media/v4l2-core/v4l2-ctrls.c >> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c >> @@ -991,6 +991,7 @@ 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_DECODER_THUMBNAIL: return "Thumbnail generation"; >> >> /* CAMERA controls */ >> /* Keep the order of the 'case's the same as in v4l2-controls.h! */ >> @@ -1234,6 +1235,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, >> case V4L2_CID_AUTO_FOCUS_START: >> case V4L2_CID_AUTO_FOCUS_STOP: >> case V4L2_CID_DO_WHITE_BALANCE: >> + case V4L2_CID_MPEG_VIDEO_DECODER_THUMBNAIL: >> *type = V4L2_CTRL_TYPE_BUTTON; >> *flags |= V4L2_CTRL_FLAG_WRITE_ONLY | >> V4L2_CTRL_FLAG_EXECUTE_ON_WRITE; >> diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h >> index 62271418c1be..7e44a2779863 100644 >> --- a/include/uapi/linux/v4l2-controls.h >> +++ b/include/uapi/linux/v4l2-controls.h >> @@ -743,6 +743,8 @@ 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_DECODER_THUMBNAIL (V4L2_CID_MPEG_BASE + 645) >> + >> /* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */ >> #define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000) >> #define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0) >> > -- regards, Stan