Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1515266ybg; Thu, 4 Jun 2020 11:37:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwX8UL6bag27ugBGK8thJuMarjdh0dU2FQRdpj+ua3UirieTNEls+8QoKVYiV0BtvZxryN X-Received: by 2002:a17:906:1cd3:: with SMTP id i19mr4862359ejh.321.1591295849513; Thu, 04 Jun 2020 11:37:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591295849; cv=none; d=google.com; s=arc-20160816; b=urjDicMeinQScWqYQlFZtpkL9q3+O63bL0aWSL8PBFC5xyhf6lGWHAy0QjhWysD4bx hjmcs+NefTo6HQkkJocezRiurJNqEPVyUCCpQ6Vsx1dsUTBPF1Jz8RRVJr8v0AIQzKQD PSi+i+rh5QeHaoyor6CtE5+/LBvwfEp9H4s9IL04HOsyJ+JaHNXnXwrqWey/6DW0OV1J O3fCqcI8rPmujonSXSc4lsQ96wk/xFVIqDu4hOJch3ECAM5YhBiJopKKj9ZEkOule7Db oU8fuNGmzGrIX4W2bOqHDFBe/2CTqom/cFXgpC8usyw6ZBgSLjQabZgz3THtYVTNeU7d 5lgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=i1sD5nsjWErhoOPpiUlLQ4uHWzuhyGOs7H0JtQng1CY=; b=LuQ06uwdFCUU3zD/8ydifGCROk9w46no4Mo/YkB/b8gITv8RdD8s/f3pPtval0+Hh6 AT2gYqI7ZPz7a+swRm7cs+pfGnbB8lTaPXpCQsklax1w2/e2obyR/JNysLUqgqF86p28 QFctlmodryKNQvNmfxpkZZchA7f4MmvYPJ0ZpucfNAzvkCE6SI/aIRJ+0ttozzyXkvXg HVOXHe9OO13xZIPU31vJsMrUckB22UcqklZir5EODBSFuC4X8rKeWDpG/2r5w0DG4v0/ ++c863e8OezPa8Ft1Rjgq0JpyCKVoMddU+vuln83vSIGY9L17bEMF8eF54HKORDyUa4J i8UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=WWpNoL+S; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o9si1967064ejg.526.2020.06.04.11.37.06; Thu, 04 Jun 2020 11:37:29 -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=@chromium.org header.s=google header.b=WWpNoL+S; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728237AbgFDM6H (ORCPT + 99 others); Thu, 4 Jun 2020 08:58:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726221AbgFDM6G (ORCPT ); Thu, 4 Jun 2020 08:58:06 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7AC8C08C5C1 for ; Thu, 4 Jun 2020 05:58:06 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id l27so6002116ejc.1 for ; Thu, 04 Jun 2020 05:58:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=i1sD5nsjWErhoOPpiUlLQ4uHWzuhyGOs7H0JtQng1CY=; b=WWpNoL+SNH1Hw9+Gwm1Ak+QjVz0IerRxIEeJDL3Lo5aTpzOB1DL2eQ2MZLUGDzYkXt wB9UNSZ8QVmYpoqQIdEXahA+f0XxOM9aPJneNVy704qnLz8JLpN4nSuN4q6XrrW8JvRP +Q8qPzkuVW95yhPofoknBa491KN5X0pIUi240= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=i1sD5nsjWErhoOPpiUlLQ4uHWzuhyGOs7H0JtQng1CY=; b=m3yD8KtL7EtXsUKilxQC46CwR+nwTwRUe50pPqNMso7vzxWTxy0VOcJZoV9fefQ+Ws 3QbmUqTJhe06HLV8RLYTzgeR6vhBotwnVPtBxYv3dSArM70uTEZdO/0y+Y1k3b6OWfmr L90OkzW8ILDk2LnNWofNQAjAGM8hzwfWP3LqcS4CJ5waYVuYL7c6uAAVVEkF82TYSdrg v6/FjnKOe+A22ZNU64LdvOHJw9HwbMfYUDEd/xOc8T4DgNLrcIo+tzwi92vt9LKwIcsF zxJb7vgOweOWLQE257Y7mQw6YVZcSbayu0y3KXuJrkrK5BDWNjOK4YdiveWftVnSmTLd 42Vw== X-Gm-Message-State: AOAM530mn7mgUwFqnN3EwAWK1h4P6n+fR4hUySiyho1tdPDGrFP7oNnu 5xH6rVZcJASyGRDNayn0f3jbsH08hQg= X-Received: by 2002:a17:906:365a:: with SMTP id r26mr3714053ejb.466.1591275484913; Thu, 04 Jun 2020 05:58:04 -0700 (PDT) Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com. [209.85.128.46]) by smtp.gmail.com with ESMTPSA id h16sm2230189ejq.62.2020.06.04.05.58.03 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Jun 2020 05:58:04 -0700 (PDT) Received: by mail-wm1-f46.google.com with SMTP id g10so5133377wmh.4 for ; Thu, 04 Jun 2020 05:58:03 -0700 (PDT) X-Received: by 2002:a7b:c0c8:: with SMTP id s8mr4134715wmh.134.1591275483243; Thu, 04 Jun 2020 05:58:03 -0700 (PDT) MIME-Version: 1.0 References: <20200526085446.30956-1-stanimir.varbanov@linaro.org> <65ac9697-a43f-7025-e6fe-69c4a44c6d9a@xs4all.nl> <544b19dd-4883-bae0-b488-46c856eb207d@xs4all.nl> <6f71931a-9060-a399-835c-a1cf1f05dc79@linaro.org> <1bc10e88-8cbe-3da9-daeb-d015f42d7acc@xs4all.nl> In-Reply-To: <1bc10e88-8cbe-3da9-daeb-d015f42d7acc@xs4all.nl> From: Tomasz Figa Date: Thu, 4 Jun 2020 14:57:51 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] v4l2-ctrl: add control for thumnails To: Hans Verkuil Cc: Stanimir Varbanov , Linux Media Mailing List , Linux Kernel Mailing List , Philipp Zabel , Ezequiel Garcia , Paul Kocialkowski , Nicolas Dufresne Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 4, 2020 at 2:56 PM Hans Verkuil wrote: > > On 04/06/2020 14:34, Stanimir Varbanov wrote: > > Hi Hans, > > > > On 6/4/20 12:08 PM, Hans Verkuil wrote: > >> On 04/06/2020 11:02, Stanimir Varbanov wrote: > >>> Hi Hans, > >>> > >>> On 5/27/20 12:53 AM, Stanimir Varbanov wrote: > >>>> 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). > >> > >> Isn't this really a "DECODE_SYNC_FRAMES_ONLY" control? That's what it does, > >> right? Skip any B/P frames and only decode sync frames. > > > > Yes, it is. > > To me V4L2_CID_MPEG_VIDEO_DECODE_SYNC_FRAMES sounds better. If you are > > fine I can send a new patch. > > > > The definition of "sync frames" is a bit difficult for codec-agnostic > > controls. Is it sound better "INTRA", DECODE_INTRA_FRAMES (ONLY)? > > INTRA is better. DECODE_INTRA_FRAMES_ONLY is a good name, I think. > > Thumbnail creation can be given as an example in the description of the > control, but that's just a use-case. How about the other aspect of the behavior? "Decoder should not allocate more output buffers that it is required to consume one input frame." Best regards, Tomasz > > Regards, > > Hans > > > > >> > >> That this is useful for creating thumbnails is just a specific use-case. > >> > >> Regards, > >> > >> Hans > >> > >>>> > >>>>> > >>>>> 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. > >>>> > >>> > >>> What is your opinion on that control? I could consider to make it Venus > >>> custom control but from the use-case it looks other drivers also can > >>> benefit of it. > >>> > >>> I tried to make more generic one [1] but it looks it will be too difficult. > >>> > >> > > >