Show a patch.

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

{
    "id": 19026,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/19026/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19026/",
    "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": "<20230915130650.35691-8-jacopo.mondi@ideasonboard.com>",
    "date": "2023-09-15T13:06:45",
    "name": "[libcamera-devel,v3,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/1.1/people/143/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo.mondi@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/19026/mbox/",
    "series": [
        {
            "id": 4025,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4025/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4025",
            "date": "2023-09-15T13:06:38",
            "name": "libcamera: Introduce SensorConfiguration",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/4025/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19026/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19026/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 2F07FC32B1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 15 Sep 2023 13:07:18 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 501B462918;\n\tFri, 15 Sep 2023 15:07:17 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0692462927\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Sep 2023 15:07:11 +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 8A128208C;\n\tFri, 15 Sep 2023 15:05:37 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1694783237;\n\tbh=Bjqt1BC/qeXCOGnSbabt151Jc4j/SYVO0ZOFPLYMUaA=;\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=ckc1enNV+OZAjVK1Rati5N1jqwWC8kuBZhMbQ5Fvwwcwo3akSyif6Y9JcGDmOuBqo\n\t59/ckBAkQ+m5KOP0n1CtdnAX1M0mKdkHnyFOl5mqsoPbl7jiTnfl5xxY81RDl1JGdq\n\tIyiHD8GHx4TnRRh8jYiiODNYjSoPdi/He5SSFr0qYI3J8OwuQkVXhkkLt9VF9KUV6a\n\ttlmKgXHkuSpmViux5MpVR7pg+ike7gtoD1ib7VRWjju7dAW27RWeTKsuZ254qXKE8Z\n\tSs/7rAN3UBiDzyCCyJW5VX2xy+NP/y2SPKkZf81eruW7DbdjCU1NNFv7uDGhcsCyiS\n\t9BCRm1I7QTyVQ==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1694783137;\n\tbh=Bjqt1BC/qeXCOGnSbabt151Jc4j/SYVO0ZOFPLYMUaA=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=B5PtuB+V+yhQV6srnLGvMPkaJ4ely480w2B+xCZ9cKSpddeMRD+2T316FUgmdsPDJ\n\tcinbcRO4czHeR/EPuwI7hE9T95/4RZY+Fg6F0d/PmhcjEAGF4FXhKKKDpNhd1nKHAF\n\t+Ah9iKZfhhFUxXNTc4OJ8ptN6KTxX6wo1cXQSEFc="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"B5PtuB+V\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 15 Sep 2023 15:06:45 +0200",
        "Message-ID": "<20230915130650.35691-8-jacopo.mondi@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.42.0",
        "In-Reply-To": "<20230915130650.35691-1-jacopo.mondi@ideasonboard.com>",
        "References": "<20230915130650.35691-1-jacopo.mondi@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 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 2d787f4b99ed..d8e1ebc106af 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",
        "v3",
        "07/12"
    ]
}