[{"id":14687,"web_url":"https://patchwork.libcamera.org/comment/14687/","msgid":"<CAHW6GYKJCrZtqduesCQYh1iNSod31F8OTr-mc_reEmNWzDxkiA@mail.gmail.com>","date":"2021-01-22T10:53:06","subject":"Re: [libcamera-devel] [PATCH v2 2/6] pipeline: raspberrypi: Set the\n\tISP Output1 to 1/4 resolution if unused","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"content":"Hi Naush\n\nThanks for the revised version of this patch.\n\nOn Fri, 22 Jan 2021 at 09:25, Naushir Patuck <naush@raspberrypi.com> wrote:\n>\n> In preparation for fast colour denoise, set the low resolution ISP\n> output stream (Output1) to a 1/4 resolution of the application requested\n> stream (Output0). This only happens if the application has not requested\n> an additional YUV or RGB stream.\n>\n> We also constrain this 1/4 resolution to at most 1200 pixels in the\n> largest dimension to avoid being too taxing on memory usage and system\n> bandwidth.\n>\n> Also switch the default StreamRole::VideoRecording to YUV420 to allow\n> fast colour denoise to run.\n>\n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> ---\n>  .../pipeline/raspberrypi/raspberrypi.cpp      | 32 ++++++++++++++++++-\n>  1 file changed, 31 insertions(+), 1 deletion(-)\n>\n> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> index 7e92f7669126..a0d3ac7ce49f 100644\n> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> @@ -496,7 +496,7 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,\n>\n>                 case StreamRole::VideoRecording:\n>                         fmts = data->isp_[Isp::Output0].dev()->formats();\n> -                       pixelFormat = formats::NV12;\n> +                       pixelFormat = formats::YUV420;\n>                         size = { 1920, 1080 };\n>                         bufferCount = 4;\n>                         outCount++;\n> @@ -608,6 +608,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n>          * StreamConfiguration appropriately.\n>          */\n>         V4L2DeviceFormat format;\n> +       bool output1Set = false;\n>         for (unsigned i = 0; i < config->size(); i++) {\n>                 StreamConfiguration &cfg = config->at(i);\n>\n> @@ -632,6 +633,9 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n>                 format.size = cfg.size;\n>                 format.fourcc = fourcc;\n>\n> +               LOG(RPI, Info) << \"Setting \" << stream->name() << \" to a resolution of \"\n> +                              << format.toString();\n> +\n>                 ret = stream->dev()->setFormat(&format);\n>                 if (ret)\n>                         return -EINVAL;\n> @@ -645,6 +649,32 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n>\n>                 cfg.setStream(stream);\n>                 stream->setExternal(true);\n> +\n> +               if (i != maxIndex)\n> +                       output1Set = true;\n> +       }\n> +\n> +       /*\n> +        * If ISP::Output1 stream has not been requested by the application, we\n> +        * set it up for internal use now. This second stream will be used for\n> +        * fast colour denoise, and must be a quarter resolution of the ISP::Output0\n> +        * stream. However, also limit the maximum size to 1200 pixels in the\n> +        * larger dimension, just to avoid being wasteful with buffer allocations\n> +        * and memory bandwidth.\n> +        */\n> +       if (!output1Set) {\n> +               V4L2DeviceFormat output1Format = format;\n> +               constexpr unsigned int maxDimensions = 1200;\n> +               const Size limit = Size(maxDimensions, maxDimensions).boundedToAspectRatio(format.size);\n> +\n> +               output1Format.size = (format.size / 2).boundedTo(limit).alignedDownTo(2, 2);\n\nYes, doesn't it look lovely now!\n\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n\nThanks\nDavid\n\n> +\n> +               LOG(RPI, Info) << \"Setting ISP Output1 (internal) to a resolution of \"\n> +                              << output1Format.toString();\n> +\n> +               ret = data->isp_[Isp::Output1].dev()->setFormat(&output1Format);\n> +               if (ret)\n> +                       return -EINVAL;\n>         }\n>\n>         /* ISP statistics output format. */\n> --\n> 2.25.1\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 75192C0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 22 Jan 2021 10:53:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F1E356823B;\n\tFri, 22 Jan 2021 11:53:18 +0100 (CET)","from mail-ot1-x333.google.com (mail-ot1-x333.google.com\n\t[IPv6:2607:f8b0:4864:20::333])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 227E368232\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Jan 2021 11:53:18 +0100 (CET)","by mail-ot1-x333.google.com with SMTP id s2so2459141otp.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Jan 2021 02:53:18 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"gbNHdK0O\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=ZTiopsV/uocc8eDHkc/MTRUQv4MTyNYXpe5i41HGY7w=;\n\tb=gbNHdK0OpVXTA55CiUZUHUJkUQho4F7tNjbMcUfsWEeUoYIF1jqyRKNNZ6p9ENNbtO\n\tsB6jlbDnPvZAGHsb7tVJAazDMZEMQUVxeCZ9NU2HvlIvN9QBp81fEhnRBk37Ah0pJFvg\n\tgywY9DoC5e9pP8W/4YLIEDaAXsIdnA5tQdbebcsAdPcKeW24x5a3e4QqlkCXEAxWVshz\n\tc9Vi1FOZGrJXplQQQT26YlJODcly3my45+nYcx45kafDcgFTdj6/5OJaOzd7JsHM8ngk\n\tYHwEWWEu1LNxK1PuhVDgvoJ/t0UGoobML7s52ZWwLBnOrhJM3VsncEkZ3pROBVZIKzJU\n\tc+LA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=ZTiopsV/uocc8eDHkc/MTRUQv4MTyNYXpe5i41HGY7w=;\n\tb=Vbdo8izK+my/F5H9Z077oPe0eRBV3DSf41KQfEh3oV5rS67IrLigKOqgZK+jrHcgZ9\n\tbMNHhefpEQGppnyB8Z+CT9+BDPDO/v85Jl5Y2ihzSPXcnBAlhxHQPUGELcTpBuMiyjrB\n\t5l9hrxoNwNKmPOmTKGrbmG0jwPPiKFqToVK24vVjf5djIjcqrMoWK49P4ibLDJH/LTx1\n\tc7+60ZkBijUu+Y4owQPm1hfUdUXuHYvQwnUE2DMLkRXn2+6vQBBCEztlnGnfYgfYJ+9r\n\tHdsZ6L1Jvqfsi0YqcNc/x7PNsOnlbrlGiYafCRHghUcpA84EhaY9ceedw8cs2VbUJnRF\n\tfmVQ==","X-Gm-Message-State":"AOAM533ARQtGp/BsGtZnJhUemwFuKHXgU+Os5973yaQFHnK4hP9FxKcQ\n\tlLLxXgMWxW5/XSZo7q1wVJagwN4fDsL2RiCoyAFLNw==","X-Google-Smtp-Source":"ABdhPJyra/hcTG4z77TpRbu5m3NFTFiTFBd3rgb7XWKXQ7xaJAqZ/hFsx9RoTEnOws+GBMeTBJacLSjQ7bPRtTtK7So=","X-Received":"by 2002:a05:6830:1e7b:: with SMTP id\n\tm27mr2637257otr.317.1611312796966; \n\tFri, 22 Jan 2021 02:53:16 -0800 (PST)","MIME-Version":"1.0","References":"<20210122092537.708375-1-naush@raspberrypi.com>\n\t<20210122092537.708375-3-naush@raspberrypi.com>","In-Reply-To":"<20210122092537.708375-3-naush@raspberrypi.com>","From":"David Plowman <david.plowman@raspberrypi.com>","Date":"Fri, 22 Jan 2021 10:53:06 +0000","Message-ID":"<CAHW6GYKJCrZtqduesCQYh1iNSod31F8OTr-mc_reEmNWzDxkiA@mail.gmail.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH v2 2/6] pipeline: raspberrypi: Set the\n\tISP Output1 to 1/4 resolution if unused","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":14692,"web_url":"https://patchwork.libcamera.org/comment/14692/","msgid":"<c281ed6c-cdd6-7857-c951-d8fc10d360ea@ideasonboard.com>","date":"2021-01-22T11:42:56","subject":"Re: [libcamera-devel] [PATCH v2 2/6] pipeline: raspberrypi: Set the\n\tISP Output1 to 1/4 resolution if unused","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Naush,\n\nOn 22/01/2021 09:25, Naushir Patuck wrote:\n> In preparation for fast colour denoise, set the low resolution ISP\n> output stream (Output1) to a 1/4 resolution of the application requested\n> stream (Output0). This only happens if the application has not requested\n> an additional YUV or RGB stream.\n> \n> We also constrain this 1/4 resolution to at most 1200 pixels in the\n> largest dimension to avoid being too taxing on memory usage and system\n> bandwidth.\n> \n> Also switch the default StreamRole::VideoRecording to YUV420 to allow\n> fast colour denoise to run.\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> ---\n>  .../pipeline/raspberrypi/raspberrypi.cpp      | 32 ++++++++++++++++++-\n>  1 file changed, 31 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> index 7e92f7669126..a0d3ac7ce49f 100644\n> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> @@ -496,7 +496,7 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,\n>  \n>  \t\tcase StreamRole::VideoRecording:\n>  \t\t\tfmts = data->isp_[Isp::Output0].dev()->formats();\n> -\t\t\tpixelFormat = formats::NV12;\n> +\t\t\tpixelFormat = formats::YUV420;\n>  \t\t\tsize = { 1920, 1080 };\n>  \t\t\tbufferCount = 4;\n>  \t\t\toutCount++;\n> @@ -608,6 +608,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n>  \t * StreamConfiguration appropriately.\n>  \t */\n>  \tV4L2DeviceFormat format;\n> +\tbool output1Set = false;\n>  \tfor (unsigned i = 0; i < config->size(); i++) {\n>  \t\tStreamConfiguration &cfg = config->at(i);\n>  \n> @@ -632,6 +633,9 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n>  \t\tformat.size = cfg.size;\n>  \t\tformat.fourcc = fourcc;\n>  \n> +\t\tLOG(RPI, Info) << \"Setting \" << stream->name() << \" to a resolution of \"\n> +\t\t\t       << format.toString();\n> +\n>  \t\tret = stream->dev()->setFormat(&format);\n>  \t\tif (ret)\n>  \t\t\treturn -EINVAL;\n> @@ -645,6 +649,32 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n>  \n>  \t\tcfg.setStream(stream);\n>  \t\tstream->setExternal(true);\n> +\n> +\t\tif (i != maxIndex)\n> +\t\t\toutput1Set = true;\n> +\t}\n> +\n> +\t/*\n> +\t * If ISP::Output1 stream has not been requested by the application, we\n> +\t * set it up for internal use now. This second stream will be used for\n> +\t * fast colour denoise, and must be a quarter resolution of the ISP::Output0\n> +\t * stream. However, also limit the maximum size to 1200 pixels in the\n> +\t * larger dimension, just to avoid being wasteful with buffer allocations\n> +\t * and memory bandwidth.\n> +\t */\n> +\tif (!output1Set) {\n> +\t\tV4L2DeviceFormat output1Format = format;\n> +\t\tconstexpr unsigned int maxDimensions = 1200;\n> +\t\tconst Size limit = Size(maxDimensions, maxDimensions).boundedToAspectRatio(format.size);\n> +\n> +\t\toutput1Format.size = (format.size / 2).boundedTo(limit).alignedDownTo(2, 2);\n> +\n> +\t\tLOG(RPI, Info) << \"Setting ISP Output1 (internal) to a resolution of \"\n> +\t\t\t       << output1Format.toString();\n> +\n> +\t\tret = data->isp_[Isp::Output1].dev()->setFormat(&output1Format);\n> +\t\tif (ret)\n\nShould there be a print here if this happens? Or is it never really\ngoing to happen?\n\nOtherwise:\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> +\t\t\treturn -EINVAL;\n>  \t}\n>  \n>  \t/* ISP statistics output format. */\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 484A3BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 22 Jan 2021 11:43:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A3F9E68245;\n\tFri, 22 Jan 2021 12:43:00 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A19B2681D8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Jan 2021 12:42:59 +0100 (CET)","from [192.168.0.20]\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0D9CD4FB;\n\tFri, 22 Jan 2021 12:42:59 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"AyOKlRY7\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1611315779;\n\tbh=geiBRfnQqVlNY5opWzB+1HtUxQsZ6Xssy1d+8X/k7Ok=;\n\th=Reply-To:Subject:To:References:From:Date:In-Reply-To:From;\n\tb=AyOKlRY7/vgtwLWGpBAdnSG/Q7In1WrerPxhvhRHXcL63zeIBeSZ/tHCySgahd9eh\n\tnuuNNyrT46yDDxjlaYpAidsuHH/HQqCjnEmwP9PPJlWVMKjuv4ZZ8wkbDrxLKwVQjZ\n\trsOi2IJ8S/Ri3vo2G0LJa6JkJaVPxH0/OJ//HS0s=","To":"Naushir Patuck <naush@raspberrypi.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20210122092537.708375-1-naush@raspberrypi.com>\n\t<20210122092537.708375-3-naush@raspberrypi.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Autocr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HU/GUV/zHJSFk","Organization":"Ideas on Board","Message-ID":"<c281ed6c-cdd6-7857-c951-d8fc10d360ea@ideasonboard.com>","Date":"Fri, 22 Jan 2021 11:42:56 +0000","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101\n\tThunderbird/68.10.0","MIME-Version":"1.0","In-Reply-To":"<20210122092537.708375-3-naush@raspberrypi.com>","Content-Language":"en-GB","Subject":"Re: [libcamera-devel] [PATCH v2 2/6] pipeline: raspberrypi: Set the\n\tISP Output1 to 1/4 resolution if unused","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Reply-To":"kieran.bingham@ideasonboard.com","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":14698,"web_url":"https://patchwork.libcamera.org/comment/14698/","msgid":"<CAEmqJPq7FBpYfBQNZZm-=J1i10HnRsOBS+6xAvSr0iHRO+s5CQ@mail.gmail.com>","date":"2021-01-22T11:59:03","subject":"Re: [libcamera-devel] [PATCH v2 2/6] pipeline: raspberrypi: Set the\n\tISP Output1 to 1/4 resolution if unused","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi Kieran,\n\nThank you for your review feedback.\n\nOn Fri, 22 Jan 2021 at 11:42, Kieran Bingham <\nkieran.bingham@ideasonboard.com> wrote:\n\n> Hi Naush,\n>\n> On 22/01/2021 09:25, Naushir Patuck wrote:\n> > In preparation for fast colour denoise, set the low resolution ISP\n> > output stream (Output1) to a 1/4 resolution of the application requested\n> > stream (Output0). This only happens if the application has not requested\n> > an additional YUV or RGB stream.\n> >\n> > We also constrain this 1/4 resolution to at most 1200 pixels in the\n> > largest dimension to avoid being too taxing on memory usage and system\n> > bandwidth.\n> >\n> > Also switch the default StreamRole::VideoRecording to YUV420 to allow\n> > fast colour denoise to run.\n> >\n> > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > ---\n> >  .../pipeline/raspberrypi/raspberrypi.cpp      | 32 ++++++++++++++++++-\n> >  1 file changed, 31 insertions(+), 1 deletion(-)\n> >\n> > diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > index 7e92f7669126..a0d3ac7ce49f 100644\n> > --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > @@ -496,7 +496,7 @@ CameraConfiguration\n> *PipelineHandlerRPi::generateConfiguration(Camera *camera,\n> >\n> >               case StreamRole::VideoRecording:\n> >                       fmts = data->isp_[Isp::Output0].dev()->formats();\n> > -                     pixelFormat = formats::NV12;\n> > +                     pixelFormat = formats::YUV420;\n> >                       size = { 1920, 1080 };\n> >                       bufferCount = 4;\n> >                       outCount++;\n> > @@ -608,6 +608,7 @@ int PipelineHandlerRPi::configure(Camera *camera,\n> CameraConfiguration *config)\n> >        * StreamConfiguration appropriately.\n> >        */\n> >       V4L2DeviceFormat format;\n> > +     bool output1Set = false;\n> >       for (unsigned i = 0; i < config->size(); i++) {\n> >               StreamConfiguration &cfg = config->at(i);\n> >\n> > @@ -632,6 +633,9 @@ int PipelineHandlerRPi::configure(Camera *camera,\n> CameraConfiguration *config)\n> >               format.size = cfg.size;\n> >               format.fourcc = fourcc;\n> >\n> > +             LOG(RPI, Info) << \"Setting \" << stream->name() << \" to a\n> resolution of \"\n> > +                            << format.toString();\n> > +\n> >               ret = stream->dev()->setFormat(&format);\n> >               if (ret)\n> >                       return -EINVAL;\n> > @@ -645,6 +649,32 @@ int PipelineHandlerRPi::configure(Camera *camera,\n> CameraConfiguration *config)\n> >\n> >               cfg.setStream(stream);\n> >               stream->setExternal(true);\n> > +\n> > +             if (i != maxIndex)\n> > +                     output1Set = true;\n> > +     }\n> > +\n> > +     /*\n> > +      * If ISP::Output1 stream has not been requested by the\n> application, we\n> > +      * set it up for internal use now. This second stream will be used\n> for\n> > +      * fast colour denoise, and must be a quarter resolution of the\n> ISP::Output0\n> > +      * stream. However, also limit the maximum size to 1200 pixels in\n> the\n> > +      * larger dimension, just to avoid being wasteful with buffer\n> allocations\n> > +      * and memory bandwidth.\n> > +      */\n> > +     if (!output1Set) {\n> > +             V4L2DeviceFormat output1Format = format;\n> > +             constexpr unsigned int maxDimensions = 1200;\n> > +             const Size limit = Size(maxDimensions,\n> maxDimensions).boundedToAspectRatio(format.size);\n> > +\n> > +             output1Format.size = (format.size /\n> 2).boundedTo(limit).alignedDownTo(2, 2);\n> > +\n> > +             LOG(RPI, Info) << \"Setting ISP Output1 (internal) to a\n> resolution of \"\n> > +                            << output1Format.toString();\n> > +\n> > +             ret =\n> data->isp_[Isp::Output1].dev()->setFormat(&output1Format);\n> > +             if (ret)\n>\n> Should there be a print here if this happens? Or is it never really\n> going to happen?\n>\n\nIt is possible to have this so I can add a log message (like for the\nprevious case).\n\nRegards,\nNaush\n\n\n> Otherwise:\n>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>\n> > +                     return -EINVAL;\n> >       }\n> >\n> >       /* ISP statistics output format. */\n> >\n>\n> --\n> Regards\n> --\n> Kieran\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 0A800BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 22 Jan 2021 11:59:23 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C9FB868251;\n\tFri, 22 Jan 2021 12:59:22 +0100 (CET)","from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com\n\t[IPv6:2a00:1450:4864:20::22b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AC6FE68248\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Jan 2021 12:59:20 +0100 (CET)","by mail-lj1-x22b.google.com with SMTP id u11so6159823ljo.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Jan 2021 03:59:20 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"GyW34OwV\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=ia1nuViP8A5YuGCFigTh2RbCGUKyh3QQ8Kwg5ObbDlE=;\n\tb=GyW34OwVfUly307hKxesmXn1jbic9c7DB5qKCXUd9/OEwTmZ4huPR86ryl1JDB5WVS\n\tV54CdhvATjcnjo2h6r7vMO91FEh990nOJSKPmKtlALwysSaT0seK18E87RYLRpbCcxyM\n\tjHd9m94eNIOH4uKjW/jzUWVcCtJRzDEbtXK7JRuvoUXG8ci7jVRPbq4rdPS/sA73J7ks\n\tiaxA+x/gMlhcyv6z/v7BbBVRk9IC/O0A5yfTpz4TkzveT+Drz7+UpR0TvqZ++61ikbfa\n\tUOHJB1tK/PHjGvm2NfrZDPptUFN+WgAZ7bXeqa1B/nWIo/DtE0/gcW7yb5YwbX87ddAm\n\ttgYQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=ia1nuViP8A5YuGCFigTh2RbCGUKyh3QQ8Kwg5ObbDlE=;\n\tb=iT92gmH23nJWLYIyGCsgkFOJx20NTM7ZbuPteZW6rvrggzpMV+iLudpIzJCglTt3eD\n\thgs6CLbDxtRk2tIGHFkd7Ih314bcvvFrYrpARV8tQ+xGR3XGWamHijJyX3d/tr2u68Lr\n\t1tF+c/R8SBUifc69ikP8b1IAbWIVENE7GtStNJk7NsSipFpDZluODoglPoVGZmGwypAP\n\tHVXR4qnzNR6MVQ9GA9XbZRvbKRe6vrg15pxuzOUhW8inw5JOpCG8Hc8b61u/0mFwjRbR\n\tqmBifSHmQeC2SSzSyL9WQgSJ+8pgPlFYvmG9zpQSnCKc57lf3atuN7TcyEUJDLqcYJt6\n\tXcwA==","X-Gm-Message-State":"AOAM532SStznsWqKeWYXs1kaRFiYIBULRiGwOIi2C/5xhvUYRgTWS08O\n\trkOwQrSiUZ8u26Y0KgDM6cxKSPR1mZCY3Xt3OR3lNdPrTSU=","X-Google-Smtp-Source":"ABdhPJyGWqfdSJ7PYK1+HdDzy9+fy3mQy1ghc99JYK7w3euA1HhBFYLx/xToSGQfTrDH8zkOLf99rIqnmxU+KeTxkis=","X-Received":"by 2002:a2e:3215:: with SMTP id y21mr2120814ljy.48.1611316760114;\n\tFri, 22 Jan 2021 03:59:20 -0800 (PST)","MIME-Version":"1.0","References":"<20210122092537.708375-1-naush@raspberrypi.com>\n\t<20210122092537.708375-3-naush@raspberrypi.com>\n\t<c281ed6c-cdd6-7857-c951-d8fc10d360ea@ideasonboard.com>","In-Reply-To":"<c281ed6c-cdd6-7857-c951-d8fc10d360ea@ideasonboard.com>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Fri, 22 Jan 2021 11:59:03 +0000","Message-ID":"<CAEmqJPq7FBpYfBQNZZm-=J1i10HnRsOBS+6xAvSr0iHRO+s5CQ@mail.gmail.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v2 2/6] pipeline: raspberrypi: Set the\n\tISP Output1 to 1/4 resolution if unused","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Content-Type":"multipart/mixed;\n\tboundary=\"===============5742677890473873936==\"","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]