{"id":24240,"url":"https://patchwork.libcamera.org/api/patches/24240/?format=json","web_url":"https://patchwork.libcamera.org/patch/24240/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20250827090739.86955-4-david.plowman@raspberrypi.com>","date":"2025-08-27T09:07:30","name":"[RFC,03/12] pipeline: rpi: pisp: Use the new BayerFormat::toMbusCode() instead","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"50dc1f76cce69236e0ddccb03eb1263cf8d2d32a","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/?format=json","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/24240/mbox/","series":[{"id":5407,"url":"https://patchwork.libcamera.org/api/series/5407/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5407","date":"2025-08-27T09:07:27","name":"Bayer Re-Processing","version":1,"mbox":"https://patchwork.libcamera.org/series/5407/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/24240/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/24240/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 96391C32BB\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 Aug 2025 09:07:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E737A69301;\n\tWed, 27 Aug 2025 11:07:52 +0200 (CEST)","from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com\n\t[IPv6:2a00:1450:4864:20::32c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 62CE8692F5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Aug 2025 11:07:46 +0200 (CEST)","by mail-wm1-x32c.google.com with SMTP id\n\t5b1f17b1804b1-45b5c12dd87so30987125e9.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Aug 2025 02:07:46 -0700 (PDT)","from raspberrypi.pitowers.org\n\t([2a00:1098:3142:1f:ffc9:aff6:7f7f:893b])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-45b6f30fe02sm21498675e9.18.2025.08.27.02.07.44\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 27 Aug 2025 02:07:44 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"AJIRPgjW\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1756285665; x=1756890465;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=sgDB9QwlZ/6ZlpG67CFAzzVzDYU+hnHDTrA998eUhaQ=;\n\tb=AJIRPgjW6Zb14JD+rlG8pLFwhhQjgBIe5Akw/CD15owkraHOF/WxtmUTSwYfnwhktW\n\t/QIgJEHGyqKUAkJIt7AHb/C0fV7JJ6eyHV7pQf3nqWcoHqYJZHvi4z/ndG+fB/7ffUa+\n\tayRfovI3/vOu/kqzWN0K3IQ2h+dHtG31MXSWpzIz6kpT6THBkI2vPS1+87l4GtyNVhzl\n\t9sBLLipfmDoV6R7CL9h99NoFjs2CZX1ZKCipGwmeBCwdT+qEWKQzstk3SA15XrwuRZ9j\n\tsKGScPFBaQflbgdpEjeaXf42uTByQzF2+/OVb2pln15bztDqqnjW1FgZpD1LE1AKTl/s\n\tC3kQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1756285665; x=1756890465;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=sgDB9QwlZ/6ZlpG67CFAzzVzDYU+hnHDTrA998eUhaQ=;\n\tb=RPp7G4w/2TS1w9v3tuNUbtH0xxiYeQH8lYvi4jWAyy86a9TzGGJ/wpvUxczuJ+IBap\n\t5HnMJvuxIQ/MHGlqAZbp5GJ4VNkZ5Q5Vxx2hMduwmtJCXzPw54oK7e8kGMkuOP9dmZNf\n\t4GxrCMgD8Wx/TQ1AhpYHVFzjfcF6m1ZgElPNqxOURDvnrvn3QnnHPFqJzvCG/A6+aVHA\n\tyFf/xkIUDj4IdUswFBLGocM1rMJ7iMBo9giXq1iGpszMY/xqLWJ9dqmNIUxZMB1NXDQU\n\tyQU5/fyGWVagoGkt7t9om7poORB/n4KPIr1OE8rrv75phGExrTFwAZ/Hbyk2b3W1cHwR\n\tFgUw==","X-Gm-Message-State":"AOJu0Yz9FaBLBmhGHAv59QKMQdAbIw6VUrxSFoo4/EZ9lnewa60p6orE\n\ts1n1Qhsc4lQuvW1S4vlTXCOqfds02JV837r+ExXOFzhFUxtgPYmOE4VlgHo0+870EBjc8lJLHIm\n\tAepfS","X-Gm-Gg":"ASbGncsUn2VFw4qZYNQIcf/3HHE8IWR/tiJZoN3ebsnHWOBBu1FKf7chIqFGC6xTaGJ\n\tmbPyUn9dUjzfeeMOcAfO2YTF80fbjA86b5yv7Pwyzm15LyVFgfm6kfWFJ2EFTbRwo7RTWhbkmVF\n\t9g3crgA7a1giaFjthotpAz/DiY4ULSYwYaUGdmWQxT3WS82y93HSF4Na8XqdDEnm3zei1Q2ewg5\n\tGhQkfg81o/OOW+OzdkeVOplZv2WFseIpuJxmBToXEu1Az2uM0oDexWxeM2nneEQNvfA1dQ4TQFo\n\tYXvyKaYf5H2lwxGhszIARBK+SHcdoBQtUIzmZ89CyNewfggc9zD5asqBIN460NR6NOFmfjLVmJC\n\tY7rDCYelCH9k2bmluFF/8MBIR6uVdWqWXsIx6zk2XSgVWPPDrhdNipXNH/OKo9IfrmFOHEQYiXO\n\tSxxzreCYX82nPEyhKFVpX/+kKoUu4SXPqfmr9xuX+mLHzT6hT4FQ==","X-Google-Smtp-Source":"AGHT+IFXVs/tZ6HQFOlr+O1lToHW9ohRWkLirdiwLq4uMoHV3A1W9ChsPO+5IzKVSh0bI6EQLgbyxw==","X-Received":"by 2002:a05:600c:1c0c:b0:458:bda4:43df with SMTP id\n\t5b1f17b1804b1-45b727a2c43mr10026805e9.17.1756285665249; \n\tWed, 27 Aug 2025 02:07:45 -0700 (PDT)","From":"David Plowman <david.plowman@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"David Plowman <david.plowman@raspberrypi.com>","Subject":"[RFC PATCH 03/12] pipeline: rpi: pisp: Use the new\n\tBayerFormat::toMbusCode() instead","Date":"Wed, 27 Aug 2025 10:07:30 +0100","Message-Id":"<20250827090739.86955-4-david.plowman@raspberrypi.com>","X-Mailer":"git-send-email 2.39.5","In-Reply-To":"<20250827090739.86955-1-david.plowman@raspberrypi.com>","References":"<20250827090739.86955-1-david.plowman@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"We now have a centralised version of bayerToMbusCode - use it instead.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/libcamera/pipeline/rpi/pisp/pisp.cpp | 47 +-----------------------\n 1 file changed, 2 insertions(+), 45 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/rpi/pisp/pisp.cpp b/src/libcamera/pipeline/rpi/pisp/pisp.cpp\nindex ec52f6f2..745cb546 100644\n--- a/src/libcamera/pipeline/rpi/pisp/pisp.cpp\n+++ b/src/libcamera/pipeline/rpi/pisp/pisp.cpp\n@@ -55,55 +55,12 @@ enum class Isp : unsigned int { Input, Output0, Output1, TdnInput, TdnOutput,\n constexpr unsigned int DefaultCompressionOffset = 2048;\n constexpr unsigned int DefaultCompressionMode = 1;\n \n-const std::vector<std::pair<BayerFormat, unsigned int>> BayerToMbusCodeMap{\n-\t{ { BayerFormat::BGGR, 8, BayerFormat::Packing::None }, MEDIA_BUS_FMT_SBGGR8_1X8, },\n-\t{ { BayerFormat::GBRG, 8, BayerFormat::Packing::None }, MEDIA_BUS_FMT_SGBRG8_1X8, },\n-\t{ { BayerFormat::GRBG, 8, BayerFormat::Packing::None }, MEDIA_BUS_FMT_SGRBG8_1X8, },\n-\t{ { BayerFormat::RGGB, 8, BayerFormat::Packing::None }, MEDIA_BUS_FMT_SRGGB8_1X8, },\n-\t{ { BayerFormat::BGGR, 10, BayerFormat::Packing::None }, MEDIA_BUS_FMT_SBGGR10_1X10, },\n-\t{ { BayerFormat::GBRG, 10, BayerFormat::Packing::None }, MEDIA_BUS_FMT_SGBRG10_1X10, },\n-\t{ { BayerFormat::GRBG, 10, BayerFormat::Packing::None }, MEDIA_BUS_FMT_SGRBG10_1X10, },\n-\t{ { BayerFormat::RGGB, 10, BayerFormat::Packing::None }, MEDIA_BUS_FMT_SRGGB10_1X10, },\n-\t{ { BayerFormat::BGGR, 12, BayerFormat::Packing::None }, MEDIA_BUS_FMT_SBGGR12_1X12, },\n-\t{ { BayerFormat::GBRG, 12, BayerFormat::Packing::None }, MEDIA_BUS_FMT_SGBRG12_1X12, },\n-\t{ { BayerFormat::GRBG, 12, BayerFormat::Packing::None }, MEDIA_BUS_FMT_SGRBG12_1X12, },\n-\t{ { BayerFormat::RGGB, 12, BayerFormat::Packing::None }, MEDIA_BUS_FMT_SRGGB12_1X12, },\n-\t{ { BayerFormat::BGGR, 14, BayerFormat::Packing::None }, MEDIA_BUS_FMT_SBGGR14_1X14, },\n-\t{ { BayerFormat::GBRG, 14, BayerFormat::Packing::None }, MEDIA_BUS_FMT_SGBRG14_1X14, },\n-\t{ { BayerFormat::GRBG, 14, BayerFormat::Packing::None }, MEDIA_BUS_FMT_SGRBG14_1X14, },\n-\t{ { BayerFormat::RGGB, 14, BayerFormat::Packing::None }, MEDIA_BUS_FMT_SRGGB14_1X14, },\n-\t{ { BayerFormat::BGGR, 16, BayerFormat::Packing::None }, MEDIA_BUS_FMT_SBGGR16_1X16, },\n-\t{ { BayerFormat::GBRG, 16, BayerFormat::Packing::None }, MEDIA_BUS_FMT_SGBRG16_1X16, },\n-\t{ { BayerFormat::GRBG, 16, BayerFormat::Packing::None }, MEDIA_BUS_FMT_SGRBG16_1X16, },\n-\t{ { BayerFormat::RGGB, 16, BayerFormat::Packing::None }, MEDIA_BUS_FMT_SRGGB16_1X16, },\n-\t{ { BayerFormat::BGGR, 16, BayerFormat::Packing::PISP1 }, MEDIA_BUS_FMT_SBGGR16_1X16, },\n-\t{ { BayerFormat::GBRG, 16, BayerFormat::Packing::PISP1 }, MEDIA_BUS_FMT_SGBRG16_1X16, },\n-\t{ { BayerFormat::GRBG, 16, BayerFormat::Packing::PISP1 }, MEDIA_BUS_FMT_SGRBG16_1X16, },\n-\t{ { BayerFormat::RGGB, 16, BayerFormat::Packing::PISP1 }, MEDIA_BUS_FMT_SRGGB16_1X16, },\n-\t{ { BayerFormat::RGGB, 16, BayerFormat::Packing::PISP1 }, MEDIA_BUS_FMT_SRGGB16_1X16, },\n-\t{ { BayerFormat::MONO, 16, BayerFormat::Packing::None }, MEDIA_BUS_FMT_Y16_1X16, },\n-\t{ { BayerFormat::MONO, 16, BayerFormat::Packing::PISP1 }, MEDIA_BUS_FMT_Y16_1X16, },\n-};\n-\n-unsigned int bayerToMbusCode(const BayerFormat &bayer)\n-{\n-\tconst auto it = std::find_if(BayerToMbusCodeMap.begin(), BayerToMbusCodeMap.end(),\n-\t\t\t\t     [bayer](const std::pair<BayerFormat, unsigned int> &match) {\n-\t\t\t\t\t\treturn bayer == match.first;\n-\t\t\t\t     });\n-\n-\tif (it != BayerToMbusCodeMap.end())\n-\t\treturn it->second;\n-\n-\treturn 0;\n-}\n-\n uint32_t mbusCodeUnpacked16(unsigned int code)\n {\n \tBayerFormat bayer = BayerFormat::fromMbusCode(code);\n \tBayerFormat bayer16(bayer.order, 16, BayerFormat::Packing::None);\n \n-\treturn bayerToMbusCode(bayer16);\n+\treturn bayer16.toMbusCode();\n }\n \n uint8_t toPiSPBayerOrder(V4L2PixelFormat format)\n@@ -2217,7 +2174,7 @@ int PiSPCameraData::configureEntities(V4L2SubdeviceFormat sensorFormat,\n \tcfe_[Cfe::Output0].dev()->getFormat(&feOutputFormat);\n \tBayerFormat feOutputBayer = BayerFormat::fromV4L2PixelFormat(feOutputFormat.fourcc);\n \n-\tfeFormat.code = bayerToMbusCode(feOutputBayer);\n+\tfeFormat.code = feOutputBayer.toMbusCode();\n \tret = feSubdev_->setFormat(feVideo0SourcePad, &feFormat);\n \n \treturn ret;\n","prefixes":["RFC","03/12"]}