Show a patch.

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

{
    "id": 10906,
    "url": "https://patchwork.libcamera.org/api/patches/10906/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/10906/",
    "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": "<20210120083449.642418-3-naush@raspberrypi.com>",
    "date": "2021-01-20T08:34:46",
    "name": "[libcamera-devel,2/5] pipeline: raspberrypi: Set the ISP Output1 to 1/4 resolution if unused",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "d3a11e824db1fead4139b5b3cd8861e77e285ba9",
    "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/10906/mbox/",
    "series": [
        {
            "id": 1587,
            "url": "https://patchwork.libcamera.org/api/series/1587/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1587",
            "date": "2021-01-20T08:34:44",
            "name": "Raspberry Pi: Colour denoise",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1587/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/10906/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/10906/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 66A27C0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 20 Jan 2021 08:34:59 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 27A0668182;\n\tWed, 20 Jan 2021 09:34:59 +0100 (CET)",
            "from mail-wm1-x334.google.com (mail-wm1-x334.google.com\n\t[IPv6:2a00:1450:4864:20::334])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D9AD460312\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Jan 2021 09:34:56 +0100 (CET)",
            "by mail-wm1-x334.google.com with SMTP id u14so2024355wmq.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Jan 2021 00:34:56 -0800 (PST)",
            "from naushir-VirtualBox.patuck.local ([88.97.76.4])\n\tby smtp.gmail.com with ESMTPSA id\n\t33sm2809284wrn.35.2021.01.20.00.34.55\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 20 Jan 2021 00:34: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=\"iNwfnctw\"; 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=H6uWx2Ho8qpRpkD8knmJwuY9KThGww4e7VlCQWcrh20=;\n\tb=iNwfnctwDDReQEnuPTm17r6z/qHMK0tkC6Tfw2d4ik1HNo++WdpBCSqxahd+xOq2fb\n\tmmWTw+GL3NxNLzv3tRIPxmxV7tZ5aPdKoyeX6EEdzqLeIVVexxh7GjsTP4c2LgxYQCtO\n\tMdbWc7o+5XvSPYbvPobAnJr9XGFWIaAh+jqSnFTfl9xuxwgXIa8fkc/QV8L6UThUbMbp\n\tiFv2YjHSUzu8HaX2EeHKbyk9kMe2i/pBPIsjKivjQAvrPHS4ezIWSeIKTd8tsJeICBZe\n\tKqcqF9VhjGL5DnonpP5FQhPbVN60NUZWcsf/r9kYsN2ub2rUHCCGiEs6imH39xvX6/1e\n\tsrdA==",
        "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=H6uWx2Ho8qpRpkD8knmJwuY9KThGww4e7VlCQWcrh20=;\n\tb=WRIMMFm5YAWwNp6zixbN4UVGNZFPy/HGMMbqWb4L+XyLx6jwC7Nwg6G0fr5xHoIQi2\n\tk22uZITHRgu/qhCcNaWEmCFNF91BbIl7dr6uArOUe0Ect7995SkkI31CHrcte+C2lvD8\n\tkAV9rBvki4iKzD1Fabod7qdMAfXeMwcdvJxTo1rvxEexXxyo/m9z5L7PkcBia0jLsTiq\n\tgHzJsxGNu0aZwhhMx35OHgPK6k2ACmmURMd4LTPmQtJ/B/N9ck3y0umVx5Rys7m9sEMH\n\tXAcfaoIqUYIb/xhkN1DIfcFU89R16sh24Vgtv1OOMt/wLsYTojg4QSSs4vTq8yNXGI8C\n\tQJ9Q==",
        "X-Gm-Message-State": "AOAM530kXYWP5LJbH5gu7X8KW6OcZndPU4/gjbKfx8SPxGUJ1M8bKM4K\n\tuLXxlhl8cKSRUlOrbqTHYqA/w9vII3Gf1Q==",
        "X-Google-Smtp-Source": "ABdhPJzAR5o6ow3rT/L5u0eothP9WnqFLniSylHtkgLGNe6AMLOkxW8w+UuGYSee/yB4D9+AQO2AQg==",
        "X-Received": "by 2002:a1c:a145:: with SMTP id k66mr3218927wme.18.1611131696321;\n\tWed, 20 Jan 2021 00:34:56 -0800 (PST)",
        "From": "Naushir Patuck <naush@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 20 Jan 2021 08:34:46 +0000",
        "Message-Id": "<20210120083449.642418-3-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20210120083449.642418-1-naush@raspberrypi.com>",
        "References": "<20210120083449.642418-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH 2/5] 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      | 42 ++++++++++++++++++-\n 1 file changed, 41 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex e03bcb036f9f..282c4ba75d89 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,42 @@ 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+\n+\t\toutput1Format.size = format.size / 2;\n+\t\tif (output1Format.size.width > maxDimensions) {\n+\t\t\toutput1Format.size.height = maxDimensions * output1Format.size.height /\n+\t\t\t\t\t\t    output1Format.size.width;\n+\t\t\toutput1Format.size.height &= ~1;\n+\t\t\toutput1Format.size.width = maxDimensions;\n+\t\t} else if (output1Format.size.height > maxDimensions) {\n+\t\t\toutput1Format.size.width = maxDimensions * output1Format.size.width /\n+\t\t\t\t\t\t   output1Format.size.height;\n+\t\t\toutput1Format.size.width &= ~1;\n+\t\t\toutput1Format.size.height = maxDimensions;\n+\t\t}\n+\n+\t\tLOG(RPI, Info) << \"Setting ISP Output 1 (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",
        "2/5"
    ]
}