Show a patch.

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

{
    "id": 10959,
    "url": "https://patchwork.libcamera.org/api/patches/10959/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/10959/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20210122131451.726584-2-naush@raspberrypi.com>",
    "date": "2021-01-22T13:14:47",
    "name": "[libcamera-devel,v3,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/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/10959/mbox/",
    "series": [
        {
            "id": 1599,
            "url": "https://patchwork.libcamera.org/api/series/1599/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1599",
            "date": "2021-01-22T13:14:46",
            "name": "[libcamera-devel,v3,1/6] pipeline: raspberrypi: Refactor stream configuration routine",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/1599/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/10959/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/10959/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 D976ABD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 22 Jan 2021 13:14:57 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 930C46827A;\n\tFri, 22 Jan 2021 14:14:57 +0100 (CET)",
            "from mail-wm1-x332.google.com (mail-wm1-x332.google.com\n\t[IPv6:2a00:1450:4864:20::332])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E99A268279\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Jan 2021 14:14:56 +0100 (CET)",
            "by mail-wm1-x332.google.com with SMTP id s24so6691153wmj.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Jan 2021 05:14:56 -0800 (PST)",
            "from naushir-VirtualBox.patuck.local ([88.97.76.4])\n\tby smtp.gmail.com with ESMTPSA id\n\ti8sm7228870wry.90.2021.01.22.05.14.55\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 22 Jan 2021 05:14:55 -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=\"bdG5S6nb\"; 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=bdG5S6nbDtcZL8UdnsL5Bls7SgJ69EvTLamMeL4KCXZuaMevrgEO9m8SESMIK2vEeS\n\t1iXd5fMC9OTa4PP7Y84S+zMHI86p3PjTXuAzV7Yl1rzK31oezPZ7ZL+gSlWm7RLUBUIz\n\tqYKtPq/b51TdGnQpv45Xvk8WUWHwG35Q4vCfVIMO3RzHtcwz297ftPeVi/UMLdYA1cCl\n\tWkWItfoTOSXWUMbf3GpHLn7ZGP65I6e6HaIa1p3zPc+C3FE6B9wNkgqNVsbqXEHhQPDQ\n\trJ+EYU20/zwdRjO1e3EO8SAcf9Atv0kyHyKuVIcr179q+lSUDo8j6yVBSl+tPl+3v3Ef\n\txJoQ==",
        "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=YFFaV3IlPTtI+Fn5NAllHD66/zRF7nY5LS9N4oU3Pnc+7dUjo0wk6g41Cz8OIrkwZK\n\thrBjwgDscKZvZE6bT0K1mCPwiB3R8Rjf6YeLVFspp2q7QeabM3z9bAjKX5swTpi7UM8A\n\tpD3QaMrCU9EXliwsSxQvdA+IA8dCinWclmRTfU7gY4zXJN4Yf6uR98i0sWFPo3IXJ2WU\n\tP+pgf9B3n/ljNkualGdmjuG024TSzrBWmGrpOLsNI99WFamUQwSL89LvmGraoebJCf2O\n\t8/L0BvLcAvPV6DP7wO/sJhzQP/f24Y1LYbhIGiTRJZmFm8gYi6tfsqgGUO1dTvWODrvf\n\thmow==",
        "X-Gm-Message-State": "AOAM531yEVrI9flMHoT3Muo1KQiYfvTmXeSDzmytk3OleXAknWgM+HsO\n\t2gBnf/Qs9QUz6/UnkMBjqGTotNVeY8TUQg==",
        "X-Google-Smtp-Source": "ABdhPJzmjwG4kiC48f+R7ZFjUkb4YAIJ44Mk/OQDFJQWKBLma4K+t9Rk2BwHT/pjRwf0dAL8cpk8SQ==",
        "X-Received": "by 2002:a1c:dc41:: with SMTP id\n\tt62mr3979431wmg.106.1611321296475; \n\tFri, 22 Jan 2021 05:14:56 -0800 (PST)",
        "From": "Naushir Patuck <naush@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 22 Jan 2021 13:14:47 +0000",
        "Message-Id": "<20210122131451.726584-2-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20210122131451.726584-1-naush@raspberrypi.com>",
        "References": "<20210122131451.726584-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v3 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",
        "v3",
        "2/6"
    ]
}