{"id":19466,"url":"https://patchwork.libcamera.org/api/patches/19466/?format=json","web_url":"https://patchwork.libcamera.org/patch/19466/","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":"<20240123143535.52255-5-kieran.bingham@ideasonboard.com>","date":"2024-01-23T14:35:35","name":"[v2,4/4] libcamera: v4l2subdev: Organise the formatInfoMap","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"1f6f2edc08ed4bc00aa87b311f79039ce3ca27df","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/19466/mbox/","series":[{"id":4159,"url":"https://patchwork.libcamera.org/api/series/4159/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4159","date":"2024-01-23T14:35:31","name":"Mono format fixes","version":2,"mbox":"https://patchwork.libcamera.org/series/4159/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/19466/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/19466/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 D99A3C32BE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 23 Jan 2024 14:35:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ADDC262944;\n\tTue, 23 Jan 2024 15:35:45 +0100 (CET)","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 088EA62947\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Jan 2024 15:35:41 +0100 (CET)","from Monstersaurus.local\n\t(aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net\n\t[82.37.23.78])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 63B934AB0;\n\tTue, 23 Jan 2024 15:34:27 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"cEjOjndB\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1706020467;\n\tbh=9y2q4ayZMD+yYqujioOlIC+8WMWTwOcbLIrpCQwW9YY=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=cEjOjndB2jfFMGorGLJw0U0kSsHUSbaFjF3+C4jkkQ8RqtbUUK7Bc7XTO6XMyajvw\n\tMDLs7SM75YjK/oaSesNo8qX3IRbx/z0GOinPKHp+UmSr1Wa5EmyityFzyPHB64tFKG\n\tIN8yR6ySZWnb43TJ7i1VNU7wlkW/AndW7NngSckE=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Subject":"[PATCH v2 4/4] libcamera: v4l2subdev: Organise the formatInfoMap","Date":"Tue, 23 Jan 2024 14:35:35 +0000","Message-Id":"<20240123143535.52255-5-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20240123143535.52255-1-kieran.bingham@ideasonboard.com>","References":"<20240123143535.52255-1-kieran.bingham@ideasonboard.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":"The formatInfoMap is large, cluttered and not sorted.\n\nOrganise the table into groups, and move the mono formats to their own\ngrouping, as they are currently added in arbitrary points in the table.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\nv2: new patch\n\n src/libcamera/v4l2_subdevice.cpp | 14 +++++++++++---\n 1 file changed, 11 insertions(+), 3 deletions(-)","diff":"diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\nindex 265240dbd405..d5605c7c8ac5 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -57,6 +57,7 @@ struct V4L2SubdeviceFormatInfo {\n  * bus codes\n  */\n const std::map<uint32_t, V4L2SubdeviceFormatInfo> formatInfoMap = {\n+\t/* RGB */\n \t{ MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE, { 16, \"RGB444_2X8_PADHI_BE\", PixelFormatInfo::ColourEncodingRGB } },\n \t{ MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE, { 16, \"RGB444_2X8_PADHI_LE\", PixelFormatInfo::ColourEncodingRGB } },\n \t{ MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE, { 16, \"RGB555_2X8_PADHI_BE\", PixelFormatInfo::ColourEncodingRGB } },\n@@ -72,7 +73,14 @@ const std::map<uint32_t, V4L2SubdeviceFormatInfo> formatInfoMap = {\n \t{ MEDIA_BUS_FMT_RGB888_2X12_BE, { 24, \"RGB888_2X12_BE\", PixelFormatInfo::ColourEncodingRGB } },\n \t{ MEDIA_BUS_FMT_RGB888_2X12_LE, { 24, \"RGB888_2X12_LE\", PixelFormatInfo::ColourEncodingRGB } },\n \t{ MEDIA_BUS_FMT_ARGB8888_1X32, { 32, \"ARGB8888_1X32\", PixelFormatInfo::ColourEncodingRGB } },\n+\n+\t/* Mono */\n \t{ MEDIA_BUS_FMT_Y8_1X8, { 8, \"Y8_1X8\", PixelFormatInfo::ColourEncodingYUV } },\n+\t{ MEDIA_BUS_FMT_Y10_1X10, { 10, \"Y10_1X10\", PixelFormatInfo::ColourEncodingYUV } },\n+\t{ MEDIA_BUS_FMT_Y12_1X12, { 12, \"Y12_1X12\", PixelFormatInfo::ColourEncodingYUV } },\n+\t{ MEDIA_BUS_FMT_Y16_1X16, { 16, \"Y16_1X16\", PixelFormatInfo::ColourEncodingYUV } },\n+\n+\t/* YUV */\n \t{ MEDIA_BUS_FMT_UV8_1X8, { 8, \"UV8_1X8\", PixelFormatInfo::ColourEncodingYUV } },\n \t{ MEDIA_BUS_FMT_UYVY8_1_5X8, { 12, \"UYVY8_1_5X8\", PixelFormatInfo::ColourEncodingYUV } },\n \t{ MEDIA_BUS_FMT_VYUY8_1_5X8, { 12, \"VYUY8_1_5X8\", PixelFormatInfo::ColourEncodingYUV } },\n@@ -82,13 +90,10 @@ const std::map<uint32_t, V4L2SubdeviceFormatInfo> formatInfoMap = {\n \t{ MEDIA_BUS_FMT_VYUY8_2X8, { 16, \"VYUY8_2X8\", PixelFormatInfo::ColourEncodingYUV } },\n \t{ MEDIA_BUS_FMT_YUYV8_2X8, { 16, \"YUYV8_2X8\", PixelFormatInfo::ColourEncodingYUV } },\n \t{ MEDIA_BUS_FMT_YVYU8_2X8, { 16, \"YVYU8_2X8\", PixelFormatInfo::ColourEncodingYUV } },\n-\t{ MEDIA_BUS_FMT_Y10_1X10, { 10, \"Y10_1X10\", PixelFormatInfo::ColourEncodingYUV } },\n \t{ MEDIA_BUS_FMT_UYVY10_2X10, { 20, \"UYVY10_2X10\", PixelFormatInfo::ColourEncodingYUV } },\n \t{ MEDIA_BUS_FMT_VYUY10_2X10, { 20, \"VYUY10_2X10\", PixelFormatInfo::ColourEncodingYUV } },\n \t{ MEDIA_BUS_FMT_YUYV10_2X10, { 20, \"YUYV10_2X10\", PixelFormatInfo::ColourEncodingYUV } },\n \t{ MEDIA_BUS_FMT_YVYU10_2X10, { 20, \"YVYU10_2X10\", PixelFormatInfo::ColourEncodingYUV } },\n-\t{ MEDIA_BUS_FMT_Y12_1X12, { 12, \"Y12_1X12\", PixelFormatInfo::ColourEncodingYUV } },\n-\t{ MEDIA_BUS_FMT_Y16_1X16, { 16, \"Y16_1X16\", PixelFormatInfo::ColourEncodingYUV } },\n \t{ MEDIA_BUS_FMT_UYVY8_1X16, { 16, \"UYVY8_1X16\", PixelFormatInfo::ColourEncodingYUV } },\n \t{ MEDIA_BUS_FMT_VYUY8_1X16, { 16, \"VYUY8_1X16\", PixelFormatInfo::ColourEncodingYUV } },\n \t{ MEDIA_BUS_FMT_YUYV8_1X16, { 16, \"YUYV8_1X16\", PixelFormatInfo::ColourEncodingYUV } },\n@@ -109,6 +114,8 @@ const std::map<uint32_t, V4L2SubdeviceFormatInfo> formatInfoMap = {\n \t{ MEDIA_BUS_FMT_VYUY12_1X24, { 24, \"VYUY12_1X24\", PixelFormatInfo::ColourEncodingYUV } },\n \t{ MEDIA_BUS_FMT_YUYV12_1X24, { 24, \"YUYV12_1X24\", PixelFormatInfo::ColourEncodingYUV } },\n \t{ MEDIA_BUS_FMT_YVYU12_1X24, { 24, \"YVYU12_1X24\", PixelFormatInfo::ColourEncodingYUV } },\n+\n+\t/* Raw Bayer */\n \t{ MEDIA_BUS_FMT_SBGGR8_1X8, { 8, \"SBGGR8_1X8\", PixelFormatInfo::ColourEncodingRAW } },\n \t{ MEDIA_BUS_FMT_SGBRG8_1X8, { 8, \"SGBRG8_1X8\", PixelFormatInfo::ColourEncodingRAW } },\n \t{ MEDIA_BUS_FMT_SGRBG8_1X8, { 8, \"SGRBG8_1X8\", PixelFormatInfo::ColourEncodingRAW } },\n@@ -133,6 +140,7 @@ const std::map<uint32_t, V4L2SubdeviceFormatInfo> formatInfoMap = {\n \t{ MEDIA_BUS_FMT_SGBRG12_1X12, { 12, \"SGBRG12_1X12\", PixelFormatInfo::ColourEncodingRAW } },\n \t{ MEDIA_BUS_FMT_SGRBG12_1X12, { 12, \"SGRBG12_1X12\", PixelFormatInfo::ColourEncodingRAW } },\n \t{ MEDIA_BUS_FMT_SRGGB12_1X12, { 12, \"SRGGB12_1X12\", PixelFormatInfo::ColourEncodingRAW } },\n+\n \t/* \\todo Clarify colour encoding for HSV formats */\n \t{ MEDIA_BUS_FMT_AHSV8888_1X32, { 32, \"AHSV8888_1X32\", PixelFormatInfo::ColourEncodingRGB } },\n \t{ MEDIA_BUS_FMT_JPEG_1X8, { 8, \"JPEG_1X8\", PixelFormatInfo::ColourEncodingYUV } },\n","prefixes":["v2","4/4"]}