Show a patch.

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

{
    "id": 19045,
    "url": "https://patchwork.libcamera.org/api/patches/19045/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19045/",
    "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": "<20230916121930.29490-8-jacopo.mondi@ideasonboard.com>",
    "date": "2023-09-16T12:19:25",
    "name": "[libcamera-devel,v4,07/12] libcamera: rpi: Make isRaw/isYuv/isRgb static functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "5b351d7bdb22de6e8b3ffbb0fa8aef7c53b05a3a",
    "submitter": {
        "id": 143,
        "url": "https://patchwork.libcamera.org/api/people/143/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo.mondi@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/19045/mbox/",
    "series": [
        {
            "id": 4027,
            "url": "https://patchwork.libcamera.org/api/series/4027/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4027",
            "date": "2023-09-16T12:19:18",
            "name": "libcamera: Introduce SensorConfiguration",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/4027/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19045/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19045/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 16DC5BD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 16 Sep 2023 12:19:48 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9FAE662905;\n\tSat, 16 Sep 2023 14:19:47 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7227262925\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 16 Sep 2023 14:19:40 +0200 (CEST)",
            "from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 53FC08BE;\n\tSat, 16 Sep 2023 14:18:06 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1694866787;\n\tbh=Cz7IxIHRU7epEvaalMTcAR4pQRDJV+Kx1uhamDjjM/o=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=VI0hzNWZ97MkzlYlh2cTPyogiz/ZE72ZBCU6gtMKKVY1EHtEhLtVBjPREm1nemxNF\n\tuCpV5hsttvpaChBi9YAvS0vo+QG6JhPySS2xw1twFmJKdpWzp3PuNi5KToFAyhvN4s\n\tm7Tqwf8WBqyk3wB+kJ00MeXZ4ChMHDBIn9sTAGV5q74/pVbRLxGYw4rWFMyQkUpgeL\n\t8JnL5O/U5OBZUPr4i5R7sY/C5m1W71TLBGLCzvHpF4H5ld1QR8HPORKHFScBNBm6LW\n\tU1TGqIoH0oJ48FchKBsNNR0lqW4siY8iplvYTzvbDyNc1eIj66PPIyI/r9uCkgimUd\n\t8RUFi9py/w5vQ==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1694866686;\n\tbh=Cz7IxIHRU7epEvaalMTcAR4pQRDJV+Kx1uhamDjjM/o=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Plj2UhxQCcE10Ng7NRPuoATe9+eN3rRpMw7Fmn5UZXwzMCK/W0FvnFu9PcuLo5k5P\n\tc5RfCd2ufqf2AJjKEfAgW4aR0Z5Dzdwa0K78416MYffIQbgC6giPbMXPnlc92y+eY+\n\tz3NNct0qleQMFHhyFKZay43LoLKZ50dyX2Jp19mM="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Plj2UhxQ\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sat, 16 Sep 2023 14:19:25 +0200",
        "Message-ID": "<20230916121930.29490-8-jacopo.mondi@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.42.0",
        "In-Reply-To": "<20230916121930.29490-1-jacopo.mondi@ideasonboard.com>",
        "References": "<20230916121930.29490-1-jacopo.mondi@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 07/12] libcamera: rpi: Make\n\tisRaw/isYuv/isRgb static functions",
        "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>",
        "From": "Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>",
        "Cc": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "From: Naushir Patuck <naush@raspberrypi.com>\n\nMove the existing isRaw()/isYuv()/isRgb()into a static function of\nPipelineHandlerBase. This will allow then to be shared with the\npipeline handler derived class.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n .../pipeline/rpi/common/pipeline_base.cpp     | 52 +++++++++----------\n .../pipeline/rpi/common/pipeline_base.h       |  4 ++\n 2 files changed, 30 insertions(+), 26 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\nindex 566aa8f3211e..ebb79337d092 100644\n--- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n@@ -37,12 +37,6 @@ namespace {\n \n constexpr unsigned int defaultRawBitDepth = 12;\n \n-bool isRaw(const PixelFormat &pixFmt)\n-{\n-\t/* This test works for both Bayer and raw mono formats. */\n-\treturn BayerFormat::fromPixelFormat(pixFmt).isValid();\n-}\n-\n PixelFormat mbusCodeToPixelFormat(unsigned int mbus_code,\n \t\t\t\t  BayerFormat::Packing packingReq)\n {\n@@ -91,22 +85,6 @@ std::optional<ColorSpace> findValidColorSpace(const ColorSpace &colourSpace)\n \treturn std::nullopt;\n }\n \n-bool isRgb(const PixelFormat &pixFmt)\n-{\n-\tconst PixelFormatInfo &info = PixelFormatInfo::info(pixFmt);\n-\treturn info.colourEncoding == PixelFormatInfo::ColourEncodingRGB;\n-}\n-\n-bool isYuv(const PixelFormat &pixFmt)\n-{\n-\t/* The code below would return true for raw mono streams, so weed those out first. */\n-\tif (isRaw(pixFmt))\n-\t\treturn false;\n-\n-\tconst PixelFormatInfo &info = PixelFormatInfo::info(pixFmt);\n-\treturn info.colourEncoding == PixelFormatInfo::ColourEncodingYUV;\n-}\n-\n } /* namespace */\n \n /*\n@@ -129,7 +107,7 @@ CameraConfiguration::Status RPiCameraConfiguration::validateColorSpaces([[maybe_\n \n \tfor (auto cfg : config_) {\n \t\t/* First fix up raw streams to have the \"raw\" colour space. */\n-\t\tif (isRaw(cfg.pixelFormat)) {\n+\t\tif (PipelineHandlerBase::isRaw(cfg.pixelFormat)) {\n \t\t\t/* If there was no value here, that doesn't count as \"adjusted\". */\n \t\t\tif (cfg.colorSpace && cfg.colorSpace != ColorSpace::Raw)\n \t\t\t\tstatus = Adjusted;\n@@ -156,13 +134,13 @@ CameraConfiguration::Status RPiCameraConfiguration::validateColorSpaces([[maybe_\n \t\tif (cfg.colorSpace == ColorSpace::Raw)\n \t\t\tcontinue;\n \n-\t\tif (isYuv(cfg.pixelFormat) && cfg.colorSpace != yuvColorSpace_) {\n+\t\tif (PipelineHandlerBase::isYuv(cfg.pixelFormat) && cfg.colorSpace != yuvColorSpace_) {\n \t\t\t/* Again, no value means \"not adjusted\". */\n \t\t\tif (cfg.colorSpace)\n \t\t\t\tstatus = Adjusted;\n \t\t\tcfg.colorSpace = yuvColorSpace_;\n \t\t}\n-\t\tif (isRgb(cfg.pixelFormat) && cfg.colorSpace != rgbColorSpace_) {\n+\t\tif (PipelineHandlerBase::isRgb(cfg.pixelFormat) && cfg.colorSpace != rgbColorSpace_) {\n \t\t\t/* Be nice, and let the YUV version count as non-adjusted too. */\n \t\t\tif (cfg.colorSpace && cfg.colorSpace != yuvColorSpace_)\n \t\t\t\tstatus = Adjusted;\n@@ -199,7 +177,7 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()\n \n \tstd::vector<CameraData::StreamParams> rawStreams, outStreams;\n \tfor (const auto &[index, cfg] : utils::enumerate(config_)) {\n-\t\tif (isRaw(cfg.pixelFormat))\n+\t\tif (PipelineHandlerBase::isRaw(cfg.pixelFormat))\n \t\t\trawStreams.emplace_back(index, &cfg);\n \t\telse\n \t\t\toutStreams.emplace_back(index, &cfg);\n@@ -347,6 +325,28 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()\n \treturn status;\n }\n \n+bool PipelineHandlerBase::isRgb(const PixelFormat &pixFmt)\n+{\n+\tconst PixelFormatInfo &info = PixelFormatInfo::info(pixFmt);\n+\treturn info.colourEncoding == PixelFormatInfo::ColourEncodingRGB;\n+}\n+\n+bool PipelineHandlerBase::isYuv(const PixelFormat &pixFmt)\n+{\n+\t/* The code below would return true for raw mono streams, so weed those out first. */\n+\tif (PipelineHandlerBase::isRaw(pixFmt))\n+\t\treturn false;\n+\n+\tconst PixelFormatInfo &info = PixelFormatInfo::info(pixFmt);\n+\treturn info.colourEncoding == PixelFormatInfo::ColourEncodingYUV;\n+}\n+\n+bool PipelineHandlerBase::isRaw(const PixelFormat &pixFmt)\n+{\n+\t/* This test works for both Bayer and raw mono formats. */\n+\treturn BayerFormat::fromPixelFormat(pixFmt).isValid();\n+}\n+\n V4L2DeviceFormat PipelineHandlerBase::toV4L2DeviceFormat(const V4L2VideoDevice *dev,\n \t\t\t\t\t\t\t const V4L2SubdeviceFormat &format,\n \t\t\t\t\t\t\t BayerFormat::Packing packingReq)\ndiff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.h b/src/libcamera/pipeline/rpi/common/pipeline_base.h\nindex 3e7c487fb0bf..135b74392140 100644\n--- a/src/libcamera/pipeline/rpi/common/pipeline_base.h\n+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.h\n@@ -213,6 +213,10 @@ public:\n \t{\n \t}\n \n+\tstatic bool isRgb(const PixelFormat &pixFmt);\n+\tstatic bool isYuv(const PixelFormat &pixFmt);\n+\tstatic bool isRaw(const PixelFormat &pixFmt);\n+\n \tstatic V4L2DeviceFormat toV4L2DeviceFormat(const V4L2VideoDevice *dev,\n \t\t\t\t\t\t   const V4L2SubdeviceFormat &format,\n \t\t\t\t\t\t   BayerFormat::Packing packingReq);\n",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "07/12"
    ]
}