{"id":10946,"url":"https://patchwork.libcamera.org/api/patches/10946/?format=json","web_url":"https://patchwork.libcamera.org/patch/10946/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20210122092537.708375-3-naush@raspberrypi.com>","date":"2021-01-22T09:25:33","name":"[libcamera-devel,v2,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":"663be167588a3dd545a2af6eb75253e7bcfd5b13","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/10946/mbox/","series":[{"id":1596,"url":"https://patchwork.libcamera.org/api/series/1596/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1596","date":"2021-01-22T09:25:31","name":"Raspberry Pi: Colour denoise","version":2,"mbox":"https://patchwork.libcamera.org/series/1596/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10946/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10946/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 16620BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 22 Jan 2021 09:25:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D5C9568235;\n\tFri, 22 Jan 2021 10:25:47 +0100 (CET)","from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com\n\t[IPv6:2a00:1450:4864:20::42f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4A46468238\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Jan 2021 10:25:45 +0100 (CET)","by mail-wr1-x42f.google.com with SMTP id a12so4384268wrv.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Jan 2021 01:25:45 -0800 (PST)","from naushir-VirtualBox.patuck.local ([88.97.76.4])\n\tby smtp.gmail.com with ESMTPSA id\n\th15sm10664801wru.4.2021.01.22.01.25.43\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 22 Jan 2021 01:25:43 -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=\"gLyf/Urm\"; 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=4t5pQWPhDpMTniEtHAIBP1ASHlzXWrJc0UXCliO3GZg=;\n\tb=gLyf/Urm33Hrl1kN4Ykx7cLMXMWUGLs9O+3aLnft/6DOFQirGeysKUzpuN2jnSz8Lz\n\tH6e60ICK5eqirrw3qIiVX4leQWitRKQe0Yhp3JDfqoXIt/iq3t8gJypv6wMmoHyF9xVK\n\tJ4Iu9A6Cr2tWDDXuLy6sjR/P1pwR3LaIFTFhYvdx39ig85ZGQZpjr/uShe+RRa4bCQq1\n\tXOCDCJguG+r5IrZEQ1wVcX3Ewx+sNDSe4BUp7uLYxro+hIdZnAGD8dGSXnChPOikhWfL\n\t3DnxyfMqMsoOWaU9xZ8NpFWPMfdvxz8HA6JX+DEmnNeWKyG57ekSkdxdE6rMwSYFT79h\n\tWzcQ==","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=4t5pQWPhDpMTniEtHAIBP1ASHlzXWrJc0UXCliO3GZg=;\n\tb=nXF3uplsECMP6vRyk4PCyymFMHYhLuvrOfb4QmYY2VjpTfj68TriZGIzCk7pFVQxca\n\tMWANhWXWzE1Fz6hCtndeu1tn810flJ35YHxcsiMMUqsriHWG1M+6GrVJbRKzn9ZExHrE\n\t3GdRTiPFvKp5bUENrZKLO5N9Ud5RYiQyRs5C+qsPg3eFEw1u4kkwAYYP9/+zHpmlLgbM\n\tzUGG0p4uz+hrQpJkf6k9VsfmaKvq/k+7iTy5DUB7yInpkJlqL4UnyWfMdvwhG9QXqajX\n\tsIJ8Q1tzENxT0efgwIs6MKizduiG1LH2ij+j+bhEnE8RLQ6ZmBVztAFzff+QxwViex6/\n\tlCYQ==","X-Gm-Message-State":"AOAM530MzzAv9jpxxDKfJWrh4gnCPUNStr5rNiqrzz5IHw7e3B1gFxD+\n\t0WSOeJjWuj/wZLgGq8z16vGBMX13CAR3ww==","X-Google-Smtp-Source":"ABdhPJztsPDb+kZ6GeGFzsOK2Fze+gyJnYKazJ8LRLTyDpn8DxrG8y0/PdSpK+C+MtUx24yu0n48tQ==","X-Received":"by 2002:adf:ef8b:: with SMTP id\n\td11mr3614909wro.156.1611307544686; \n\tFri, 22 Jan 2021 01:25:44 -0800 (PST)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 22 Jan 2021 09:25:33 +0000","Message-Id":"<20210122092537.708375-3-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20210122092537.708375-1-naush@raspberrypi.com>","References":"<20210122092537.708375-1-naush@raspberrypi.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v2 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>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp      | 32 ++++++++++++++++++-\n 1 file changed, 31 insertions(+), 1 deletion(-)","diff":"diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 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+\t\t\treturn -EINVAL;\n \t}\n \n \t/* ISP statistics output format. */\n","prefixes":["libcamera-devel","v2","2/6"]}