[v2,4/4] libcamera: v4l2_subdevice: Explain sort order of formatInfoMap
diff mbox series

Message ID 20240123152034.119295-1-kieran.bingham@ideasonboard.com
State Accepted
Headers show
Series
  • Untitled series #4160
Related show

Commit Message

Kieran Bingham Jan. 23, 2024, 3:20 p.m. UTC
The sort order used in the table isn't obvious. Reference the source of
linux/media-bus-format.h at the top of the table for reference for
future updates.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---

This patch replaces:
 [PATCH v2 4/4] libcamera: v4l2subdev: Organise the formatInfoMap

 src/libcamera/v4l2_subdevice.cpp | 1 +
 1 file changed, 1 insertion(+)

Comments

Laurent Pinchart Jan. 23, 2024, 3:30 p.m. UTC | #1
On Tue, Jan 23, 2024 at 03:20:34PM +0000, Kieran Bingham wrote:
> The sort order used in the table isn't obvious. Reference the source of
> linux/media-bus-format.h at the top of the table for reference for
> future updates.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
> 
> This patch replaces:
>  [PATCH v2 4/4] libcamera: v4l2subdev: Organise the formatInfoMap
> 
>  src/libcamera/v4l2_subdevice.cpp | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp
> index 265240dbd405..6d0785b7b484 100644
> --- a/src/libcamera/v4l2_subdevice.cpp
> +++ b/src/libcamera/v4l2_subdevice.cpp
> @@ -57,6 +57,7 @@ struct V4L2SubdeviceFormatInfo {
>   * bus codes
>   */
>  const std::map<uint32_t, V4L2SubdeviceFormatInfo> formatInfoMap = {
> +	/* This table is sorted to match the order in linux/media-bus-format.h */
>  	{ MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE, { 16, "RGB444_2X8_PADHI_BE", PixelFormatInfo::ColourEncodingRGB } },
>  	{ MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE, { 16, "RGB444_2X8_PADHI_LE", PixelFormatInfo::ColourEncodingRGB } },
>  	{ MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE, { 16, "RGB555_2X8_PADHI_BE", PixelFormatInfo::ColourEncodingRGB } },

Patch
diff mbox series

diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp
index 265240dbd405..6d0785b7b484 100644
--- a/src/libcamera/v4l2_subdevice.cpp
+++ b/src/libcamera/v4l2_subdevice.cpp
@@ -57,6 +57,7 @@  struct V4L2SubdeviceFormatInfo {
  * bus codes
  */
 const std::map<uint32_t, V4L2SubdeviceFormatInfo> formatInfoMap = {
+	/* This table is sorted to match the order in linux/media-bus-format.h */
 	{ MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE, { 16, "RGB444_2X8_PADHI_BE", PixelFormatInfo::ColourEncodingRGB } },
 	{ MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE, { 16, "RGB444_2X8_PADHI_LE", PixelFormatInfo::ColourEncodingRGB } },
 	{ MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE, { 16, "RGB555_2X8_PADHI_BE", PixelFormatInfo::ColourEncodingRGB } },