Show a patch.

GET /api/1.1/patches/11192/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 11192,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/11192/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/11192/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20210208150738.2293520-3-naush@raspberrypi.com>",
    "date": "2021-02-08T15:07:34",
    "name": "[libcamera-devel,v6,2/6] pipeline: raspberrypi: Set the ISP Output1 to 1/4 resolution if unused",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "20dac34b463653cd29bf9b35b6868aa622d1e86f",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/1.1/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/11192/mbox/",
    "series": [
        {
            "id": 1666,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1666/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1666",
            "date": "2021-02-08T15:07:32",
            "name": "Raspberry Pi: Colour denoise",
            "version": 6,
            "mbox": "https://patchwork.libcamera.org/series/1666/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/11192/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/11192/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 CEBC9BD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  8 Feb 2021 15:07:58 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9DCA860D2D;\n\tMon,  8 Feb 2021 16:07:58 +0100 (CET)",
            "from mail-wr1-x431.google.com (mail-wr1-x431.google.com\n\t[IPv6:2a00:1450:4864:20::431])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C7EA760D18\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  8 Feb 2021 16:07:56 +0100 (CET)",
            "by mail-wr1-x431.google.com with SMTP id n6so4707359wrv.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 08 Feb 2021 07:07:56 -0800 (PST)",
            "from naush-laptop.pitowers.org (cust51-dsl50.idnet.net.\n\t[212.69.50.51]) by smtp.gmail.com with ESMTPSA id\n\ta17sm31261389wrx.63.2021.02.08.07.07.53\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 08 Feb 2021 07:07:53 -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=\"BkQsrYjE\"; 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=ryNStR4waILijeEpS9cXHD4lYAxZzMUYzfSprSf3nS0=;\n\tb=BkQsrYjE5ZtzOYWQdJqvDSYgHhp8cxRaugY5P/+4+zCLuJMrzr1k9CQPiR7TLk1KeT\n\tF1YlMpWTBMn9s1zlyXl4oeR7E7t81oGpDe4hAAtiY1JbZzbtVd3Yo/tjyVJx4P33sMLb\n\tCFbSeac0p36JNMSQ5NVb8gKNwDjdH+Fs0mLpO3mhfa+DstU8itqcoaSngWaZIMrKEUJw\n\tldwcu99/J5fLXlT3yrzJ0aNMjQh+TADy8ezbq73rM5hhfxzJZMv+EIUtiKOHDABAly47\n\tPcJUeMOfqTiYKWWJnvsF/OEW73ZLUiLD410V4Vq2jEhsiZLFfhnPvU6/ICE3cg2yLs/w\n\t4mQw==",
        "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=ryNStR4waILijeEpS9cXHD4lYAxZzMUYzfSprSf3nS0=;\n\tb=i6kBR927EZtEhowE8sp0XF9S7BvESUsigMLVq7p5PqOSfiHC5wwDxHjSXQ394O/9RX\n\tGXuYqpzpPuLVQJOirwlzRU2jOM/a915rSYLuEEd1JzQxf4NqOmopyITX+VcMU6tBdeav\n\tXdX6cBg48m75xMPuTjViO7OYzbZHb48SK33aiE/m/4d9HJEg2Tf4NwGZNncWPbLtKWsF\n\tCEO2fasP5WHL11CCodKv7lOqv3A8KEfiiDpjbXITlX8/jsQSMHkdt7ahlqa4woMu09BF\n\tcSpU0JVnBRWp4L+rVXONp9QLgn+HV5du0t+UDVyp9z3Xaa+aEQ8jUDSmLJfqz8MwZD9S\n\tusMg==",
        "X-Gm-Message-State": "AOAM530GnJBp6UBxHPcpzD47F6IJQ8TSor+qanghyZ4GkWRoj2Am/ClS\n\tJGd7M4PfGIZiRf+W7/p5tRhCvDdIEwkdagU9",
        "X-Google-Smtp-Source": "ABdhPJwyEaWzfsa+PvS4FLqnrzPtZq9iJB/WYez6RQDZ1he6LsnZSI/EYoHEOUiCRf/cYJAcB6u/GQ==",
        "X-Received": "by 2002:adf:ed45:: with SMTP id\n\tu5mr20235183wro.358.1612796874100; \n\tMon, 08 Feb 2021 07:07:54 -0800 (PST)",
        "From": "Naushir Patuck <naush@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon,  8 Feb 2021 15:07:34 +0000",
        "Message-Id": "<20210208150738.2293520-3-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20210208150738.2293520-1-naush@raspberrypi.com>",
        "References": "<20210208150738.2293520-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v6 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>\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp      | 46 ++++++++++++++++++-\n 1 file changed, 45 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 183a690dbca1..7ecb080f62d3 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -494,8 +494,16 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,\n \t\t\tbreak;\n \n \t\tcase StreamRole::VideoRecording:\n+\t\t\t/*\n+\t\t\t * The colour denoise algorithm require the analysis\n+\t\t\t * image, produced by the second ISP output, to be in\n+\t\t\t * YUV420 format. Select this format as the default, to\n+\t\t\t * maximize chances that it will be picked by\n+\t\t\t * applications and enable usage of the colour denoise\n+\t\t\t * algorithm.\n+\t\t\t */\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@@ -607,6 +615,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@@ -631,6 +640,9 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n \t\tformat.size = cfg.size;\n \t\tformat.fourcc = fourcc;\n \n+\t\tLOG(RPI, Debug) << \"Setting \" << stream->name() << \" to \"\n+\t\t\t\t<< format.toString();\n+\n \t\tret = stream->dev()->setFormat(&format);\n \t\tif (ret)\n \t\t\treturn -EINVAL;\n@@ -644,6 +656,38 @@ 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+\t * \\todo If Output 1 format is not YUV420, Output 1 ought to be disabled as\n+\t * colour denoise will not run.\n+\t */\n+\tif (!output1Set) {\n+\t\tV4L2DeviceFormat output1Format = format;\n+\t\tconstexpr Size maxDimensions(1200, 1200);\n+\t\tconst Size limit = maxDimensions.boundedToAspectRatio(format.size);\n+\n+\t\toutput1Format.size = (format.size / 2).boundedTo(limit).alignedDownTo(2, 2);\n+\n+\t\tLOG(RPI, Debug) << \"Setting ISP Output1 (internal) to \"\n+\t\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",
        "v6",
        "2/6"
    ]
}