{"id":11011,"url":"https://patchwork.libcamera.org/api/1.1/patches/11011/?format=json","web_url":"https://patchwork.libcamera.org/patch/11011/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210126162412.824033-3-naush@raspberrypi.com>","date":"2021-01-26T16:24:08","name":"[libcamera-devel,v4,2/6] pipeline: raspberrypi: Set the ISP Output1 to 1/4 resolution if unused","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"43e21a829e8fbd01dc3ce56e29f2a893336f9d8c","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11011/mbox/","series":[{"id":1611,"url":"https://patchwork.libcamera.org/api/1.1/series/1611/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1611","date":"2021-01-26T16:24:06","name":"Raspberry Pi: Colour denoise","version":4,"mbox":"https://patchwork.libcamera.org/series/1611/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11011/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11011/checks/","tags":{},"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 A8A49C0F2B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 26 Jan 2021 16:24:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 773DB68319;\n\tTue, 26 Jan 2021 17:24:25 +0100 (CET)","from mail-wm1-x335.google.com (mail-wm1-x335.google.com\n\t[IPv6:2a00:1450:4864:20::335])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 81BC868316\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Jan 2021 17:24:19 +0100 (CET)","by mail-wm1-x335.google.com with SMTP id i9so3323031wmq.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Jan 2021 08:24:19 -0800 (PST)","from naushir-VirtualBox.patuck.local ([88.97.76.4])\n\tby smtp.gmail.com with ESMTPSA id\n\tm18sm8725809wrx.17.2021.01.26.08.24.17\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 26 Jan 2021 08:24: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=\"KHxT1wWQ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=dsPixlnJZhJd5BDuTN2uW6MwnaS4GEG/CSXQPrFQY2E=;\n\tb=KHxT1wWQELcTVqd//At5OWOes07++HOKONUI6Q8qWj5hW7JO8+T4aunMRDf9iIvpfg\n\t74+eyyoZhvnxMyq0tbwZRkmQQrgxnmL2DkJYTSX9f/NlVJNeyR2QeRYKtwG9PsoPoPd7\n\t6DMtqY9g2Zd93m3U2fQXcGp6zndZNLrxagB/uZDVWniXSPd6YmATJnF4KTys2djAFzSK\n\tBl2hWCvwwVQxSjO1+kKd+BY1vJuCqAQLSd104wfD/X2sV61T3tRrMEFj0atjGLB0newr\n\t4X17rewZ3B+/RdkIeeNVSFsp3nzZvrCaWNxOIIULLZpAS7V8hdJ4BN5vxBB2UA+OMPha\n\tL7Ag==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=dsPixlnJZhJd5BDuTN2uW6MwnaS4GEG/CSXQPrFQY2E=;\n\tb=UoOk7TyDLK8h9TsIUA83vBnkdI9EEtoihHF47nbMaZtLuVd3LNpJV9E7AsiBliN07l\n\tqAloD4SEeadWxQEOgF5ZLOYWrqfGTmXeWvnq1gma+yOHUqLOUKLSzor0q1U7CU3GK0Ot\n\tYQ1ZA5LHFrv2MBj1QtburKlaJseASn3XV5XB0v+jjd3zH0wnAYhaN2LPSHpJbxA0uP+7\n\ti5hTXqefy+mXcMCPGmimbVWN9TYvMrhRm24C5LPTGe95n66ctoNV6Kqq4a0GamdIRFVj\n\tmk8RbLbHcfWwsuYa0FOeYf9IrdabfYxdgsy78OWlD0Th5ZuN3UUawH12JD3XszS6P2dZ\n\t2RVA==","X-Gm-Message-State":"AOAM5321kmlFWgELQm8N6Lz3A5QqVvgq3Ht5DXnyLTukTFvYNZrGKtZ5\n\tWcQFFOIKXJyfyKOj5lCdTNT0M53boPDge+Na","X-Google-Smtp-Source":"ABdhPJw/5r2GaUxZ7W7oFzya9qGmLK/esIulDq1Us9vX/QTQBbWnvzBsP8yy7J7ohjdAIN+Cz7ql9A==","X-Received":"by 2002:a05:600c:4417:: with SMTP id\n\tu23mr497044wmn.100.1611678258897; \n\tTue, 26 Jan 2021 08:24:18 -0800 (PST)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 26 Jan 2021 16:24:08 +0000","Message-Id":"<20210126162412.824033-3-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20210126162412.824033-1-naush@raspberrypi.com>","References":"<20210126162412.824033-1-naush@raspberrypi.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v4 2/6] pipeline: raspberrypi: Set the ISP\n\tOutput1 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>","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>"},"content":"In preparation for fast colour denoise, set the low resolution ISP\noutput stream (Output1) to a 1/4 resolution of the application requested\nstream (Output0). This only happens if the application has not requested\nan additional YUV or RGB stream.\n\nWe also constrain this 1/4 resolution to at most 1200 pixels in the\nlargest dimension to avoid being too taxing on memory usage and system\nbandwidth.\n\nAlso switch the default StreamRole::VideoRecording to YUV420 to allow\nfast colour denoise to run.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp      | 35 ++++++++++++++++++-\n 1 file changed, 34 insertions(+), 1 deletion(-)","diff":"diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex d9895c779725..fe4c75f09925 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,35 @@ 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+\t\t\tLOG(RPI, Error) << \"Failed to set format on ISP Output1: \"\n+\t\t\t\t\t<< ret;\n+\t\t\treturn -EINVAL;\n+\t\t}\n \t}\n \n \t/* ISP statistics output format. */\n","prefixes":["libcamera-devel","v4","2/6"]}