mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-25 16:31:13 +00:00
102 lines
3.9 KiB
Diff
102 lines
3.9 KiB
Diff
|
From 814c088cb7183f79ba68c8f9459505e2ac4dde3a Mon Sep 17 00:00:00 2001
|
||
|
From: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
|
||
|
Date: Fri, 26 Jan 2024 15:03:18 +0100
|
||
|
Subject: [PATCH 1148/1215] media: uapi: Add a pixel format for BGR48 and RGB48
|
||
|
|
||
|
Add BGR48 and RGB48 16-bit per component image formats.
|
||
|
|
||
|
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
|
||
|
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
||
|
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
|
||
|
---
|
||
|
.../userspace-api/media/v4l/pixfmt-rgb.rst | 54 +++++++++++++++++++
|
||
|
drivers/media/v4l2-core/v4l2-common.c | 2 +
|
||
|
include/uapi/linux/videodev2.h | 2 +
|
||
|
3 files changed, 58 insertions(+)
|
||
|
|
||
|
--- a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst
|
||
|
+++ b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst
|
||
|
@@ -996,6 +996,60 @@ arranged in little endian order.
|
||
|
|
||
|
\normalsize
|
||
|
|
||
|
+16 Bits Per Component
|
||
|
+=====================
|
||
|
+
|
||
|
+These formats store an RGB triplet in six bytes, with 16 bits per component
|
||
|
+stored in memory in little endian byte order. They are named based on the order
|
||
|
+of the RGB components as stored in memory. For instance, RGB48 stores R\
|
||
|
+:sub:`7:0` and R\ :sub:`15:8` in bytes 0 and 1 respectively. This differs from
|
||
|
+the DRM format nomenclature that instead uses the order of components as seen in
|
||
|
+the 48-bits little endian word.
|
||
|
+
|
||
|
+.. raw:: latex
|
||
|
+
|
||
|
+ \small
|
||
|
+
|
||
|
+.. flat-table:: RGB Formats With 16 Bits Per Component
|
||
|
+ :header-rows: 1
|
||
|
+
|
||
|
+ * - Identifier
|
||
|
+ - Code
|
||
|
+ - Byte 0
|
||
|
+ - Byte 1
|
||
|
+ - Byte 2
|
||
|
+ - Byte 3
|
||
|
+ - Byte 4
|
||
|
+ - Byte 5
|
||
|
+
|
||
|
+ * .. _V4L2-PIX-FMT-BGR48:
|
||
|
+
|
||
|
+ - ``V4L2_PIX_FMT_BGR48``
|
||
|
+ - 'BGR6'
|
||
|
+
|
||
|
+ - B\ :sub:`7-0`
|
||
|
+ - B\ :sub:`15-8`
|
||
|
+ - G\ :sub:`7-0`
|
||
|
+ - G\ :sub:`15-8`
|
||
|
+ - R\ :sub:`7-0`
|
||
|
+ - R\ :sub:`15-8`
|
||
|
+
|
||
|
+ * .. _V4L2-PIX-FMT-RGB48:
|
||
|
+
|
||
|
+ - ``V4L2_PIX_FMT_RGB48``
|
||
|
+ - 'RGB6'
|
||
|
+
|
||
|
+ - R\ :sub:`7-0`
|
||
|
+ - R\ :sub:`15-8`
|
||
|
+ - G\ :sub:`7-0`
|
||
|
+ - G\ :sub:`15-8`
|
||
|
+ - B\ :sub:`7-0`
|
||
|
+ - B\ :sub:`15-8`
|
||
|
+
|
||
|
+.. raw:: latex
|
||
|
+
|
||
|
+ \normalsize
|
||
|
+
|
||
|
Deprecated RGB Formats
|
||
|
======================
|
||
|
|
||
|
--- a/drivers/media/v4l2-core/v4l2-common.c
|
||
|
+++ b/drivers/media/v4l2-core/v4l2-common.c
|
||
|
@@ -253,6 +253,8 @@ const struct v4l2_format_info *v4l2_form
|
||
|
{ .format = V4L2_PIX_FMT_RGB555, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
|
||
|
{ .format = V4L2_PIX_FMT_BGR666, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
|
||
|
{ .format = V4L2_PIX_FMT_BGR48_12, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 6, 0, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
|
||
|
+ { .format = V4L2_PIX_FMT_BGR48, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 6, 0, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
|
||
|
+ { .format = V4L2_PIX_FMT_RGB48, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 6, 0, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
|
||
|
{ .format = V4L2_PIX_FMT_ABGR64_12, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 8, 0, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
|
||
|
|
||
|
/* YUV packed formats */
|
||
|
--- a/include/uapi/linux/videodev2.h
|
||
|
+++ b/include/uapi/linux/videodev2.h
|
||
|
@@ -587,6 +587,8 @@ struct v4l2_pix_format {
|
||
|
|
||
|
/* RGB formats (6 or 8 bytes per pixel) */
|
||
|
#define V4L2_PIX_FMT_BGR48_12 v4l2_fourcc('B', '3', '1', '2') /* 48 BGR 12-bit per component */
|
||
|
+#define V4L2_PIX_FMT_BGR48 v4l2_fourcc('B', 'G', 'R', '6') /* 48 BGR 16-bit per component */
|
||
|
+#define V4L2_PIX_FMT_RGB48 v4l2_fourcc('R', 'G', 'B', '6') /* 48 RGB 16-bit per component */
|
||
|
#define V4L2_PIX_FMT_ABGR64_12 v4l2_fourcc('B', '4', '1', '2') /* 64 BGRA 12-bit per component */
|
||
|
|
||
|
/* RGB formats (6 bytes per pixel) */
|