[{"id":36552,"web_url":"https://patchwork.libcamera.org/comment/36552/","msgid":"<tysu4ehyfmqhedinnvuanobtxjrmtj5zxohwnuflcs5t5wgytr@zjp6aimhzwvc>","date":"2025-10-30T11:41:57","subject":"Re: [PATCH 05/10] libcamera: formats: Add CRU-packed RAWnn libcamera\n\tformats","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Dan\n\nOn Thu, Jul 24, 2025 at 07:52:51AM +0100, Daniel Scally wrote:\n> Add libcamera formats for the CRU-packed, bayer order agnostic CRU\n> pixel formats that map to the V4L2 Pixel Formats in the kernel\n> header.\n\nAh, so you need the DRM fourcc to be able to capture CRU-packaged\nimages in RAW format I guess\n\n>\n> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>\n> ---\n>  src/libcamera/formats.cpp  | 30 ++++++++++++++++++++++++++++++\n>  src/libcamera/formats.yaml | 13 +++++++++++++\n>  2 files changed, 43 insertions(+)\n>\n> diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp\n> index bfcdfc08..8f10d1ec 100644\n> --- a/src/libcamera/formats.cpp\n> +++ b/src/libcamera/formats.cpp\n> @@ -969,6 +969,36 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{\n>  \t\t.pixelsPerGroup = 2,\n>  \t\t.planes = {{ { 2, 1 }, { 0, 0 }, { 0, 0 } }},\n>  \t} },\n> +\t{ formats::RAW10_CRU, {\n> +\t\t.name = \"RAW10_CRU\",\n> +\t\t.format = formats::RAW10_CRU,\n> +\t\t.v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_RAW_CRU10), },\n> +\t\t.bitsPerPixel = 10,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n> +\t\t.packed = true,\n> +\t\t.pixelsPerGroup = 6,\n> +\t\t.planes = {{ { 8, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::RAW12_CRU, {\n> +\t\t.name = \"RAW12_CRU\",\n> +\t\t.format = formats::RAW12_CRU,\n> +\t\t.v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_RAW_CRU12), },\n> +\t\t.bitsPerPixel = 12,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n> +\t\t.packed = true,\n> +\t\t.pixelsPerGroup = 5,\n> +\t\t.planes = {{ { 8, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::RAW14_CRU, {\n> +\t\t.name = \"RAW14_CRU\",\n> +\t\t.format = formats::RAW14_CRU,\n> +\t\t.v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_RAW_CRU14), },\n> +\t\t.bitsPerPixel = 14,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n> +\t\t.packed = true,\n> +\t\t.pixelsPerGroup = 4,\n> +\t\t.planes = {{ { 8, 1 }, { 0, 0 }, { 0, 0 } }},\n\nThe CRU packaging for RAW14 has a padding byte in the upper byte of\n64 bits word. I guess we should indeed report {8, 1} to describe the\npacking and let the user know how to unpack the data. (The alternative\nwould be to specify { 7, 1 } as that's the actual number of\nsignificant bytes, but that would mess up calculations..)\n\n\n> +\t} },\n>  \t/* Compressed formats. */\n>  \t{ formats::MJPEG, {\n>  \t\t.name = \"MJPEG\",\n> diff --git a/src/libcamera/formats.yaml b/src/libcamera/formats.yaml\n> index 2d54d391..47188fc8 100644\n> --- a/src/libcamera/formats.yaml\n> +++ b/src/libcamera/formats.yaml\n> @@ -209,4 +209,17 @@ formats:\n>    - MONO_PISP_COMP1:\n>        fourcc: DRM_FORMAT_R16\n>        mod: PISP_FORMAT_MOD_COMPRESS_MODE1\n> +\n> +  - RAW10_CRU:\n> +      fourcc: DRM_FORMAT_RAW10\n> +      mod: RENESAS_CRU_FORMAT_MOD_PACKED\n> +  - RAW12_CRU:\n> +      fourcc: DRM_FORMAT_RAW12\n> +      mod: RENESAS_CRU_FORMAT_MOD_PACKED\n> +  - RAW14_CRU:\n> +      fourcc: DRM_FORMAT_RAW14\n> +      mod: RENESAS_CRU_FORMAT_MOD_PACKED\n> +  - RAW20_CRU:\n> +      fourcc: DRM_FORMAT_RAW20\n> +      mod: RENESAS_CRU_FORMAT_MOD_PACKED\n\nI don't see a 20bits format in CRU specs nor in the above table ? What\nhave I missed ?\n\nThanks\n  j\n\n>  ...\n> --\n> 2.30.2\n>","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 20108BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 30 Oct 2025 11:42:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 600EC603ED;\n\tThu, 30 Oct 2025 12:42:02 +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 6C403603ED\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 30 Oct 2025 12:42:00 +0100 (CET)","from ideasonboard.com (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 60DB916C5;\n\tThu, 30 Oct 2025 12:40:10 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"WVBppd7J\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1761824410;\n\tbh=m+/K6briJdK2YqQWSG3lKF/QPz8aabE3lt5y6M2J170=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=WVBppd7Jnx/prXn6Gbg7rNzD97cKvWfg+fRs7gUej9hRTxLww213Y7REeoX21qAJN\n\toGv6TkD5aXFpLCt3gt1vbauQKtOalFYYuix8IRP7l6nITiacguGERoxQLBMaiR0Xyt\n\tVnn4kWZ/E77XYs8SR9oLzjcwPMeGwY3ZmmOUnFkA=","Date":"Thu, 30 Oct 2025 12:41:57 +0100","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Daniel Scally <dan.scally@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH 05/10] libcamera: formats: Add CRU-packed RAWnn libcamera\n\tformats","Message-ID":"<tysu4ehyfmqhedinnvuanobtxjrmtj5zxohwnuflcs5t5wgytr@zjp6aimhzwvc>","References":"<20250724065256.75175-1-dan.scally@ideasonboard.com>\n\t<20250724065256.75175-6-dan.scally@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20250724065256.75175-6-dan.scally@ideasonboard.com>","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>"}}]