Browse Source

drivers: video: formats: add grayscale formats

Add the grayscale formats in the same packing as defined by MIPI.
The Linux V4L2 naming is preserved.

Signed-off-by: Josuah Demangeon <me@josuah.net>
pull/88583/head
Josuah Demangeon 3 months ago committed by Benjamin Cabé
parent
commit
90b23bfd58
  1. 54
      include/zephyr/drivers/video.h

54
include/zephyr/drivers/video.h

@ -1009,6 +1009,59 @@ void video_closest_frmival(const struct device *dev, enum video_endpoint_id ep, @@ -1009,6 +1009,59 @@ void video_closest_frmival(const struct device *dev, enum video_endpoint_id ep,
*/
#define VIDEO_PIX_FMT_SRGGB14P VIDEO_FOURCC('p', 'R', 'E', 'E')
/**
* @}
*/
/**
* @name Grayscale formats
* Luminance (Y) channel only, in various bit depth and packing.
*
* When the format includes more than 8-bit per pixel, a strategy becomes needed to pack
* the bits over multiple bytes, as illustrated for each format.
*
* The number above the 'Y', 'y' are hints about which pixel number the following bits belong to.
*
* @{
*/
/**
* Same as Y8 (8-bit luma-only) following the standard FOURCC naming,
* or L8 in some graphics libraries.
*
* @code{.unparsed}
* 0 1 2 3
* | Yyyyyyyy | Yyyyyyyy | Yyyyyyyy | Yyyyyyyy | ...
* @endcode
*/
#define VIDEO_PIX_FMT_GREY VIDEO_FOURCC('G', 'R', 'E', 'Y')
/**
* @code{.unparsed}
* 0 1 2 3 3 2 1 0
* | Yyyyyyyy | Yyyyyyyy | Yyyyyyyy | Yyyyyyyy | yyyyyyyy | ...
* @endcode
*/
#define VIDEO_PIX_FMT_Y10P VIDEO_FOURCC('Y', '1', '0', 'P')
/**
* @code{.unparsed}
* 0 1 1 0 2 3 3 2
* | Yyyyyyyy | Yyyyyyyy | yyyyyyyy | Yyyyyyyy | Yyyyyyyy | yyyyyyyy | ...
* | Yyyyyyyy | Yyyyyyyy | yyyyyyyy | Yyyyyyyy | Yyyyyyyy | yyyyyyyy | ...
* @endcode
*/
#define VIDEO_PIX_FMT_Y12P VIDEO_FOURCC('Y', '1', '2', 'P')
/**
* @code{.unparsed}
* 0 1 2 3 1 0 2 1 3 2
* | Yyyyyyyy | Yyyyyyyy | Yyyyyyyy | Yyyyyyyy | yyyyyyyy yyyyyyyy yyyyyyyy | ...
* | Yyyyyyyy | Yyyyyyyy | Yyyyyyyy | Yyyyyyyy | yyyyyyyy yyyyyyyy yyyyyyyy | ...
* @endcode
*/
#define VIDEO_PIX_FMT_Y14P VIDEO_FOURCC('Y', '1', '4', 'P')
/**
* @}
*/
@ -1112,6 +1165,7 @@ static inline unsigned int video_bits_per_pixel(uint32_t pixfmt) @@ -1112,6 +1165,7 @@ static inline unsigned int video_bits_per_pixel(uint32_t pixfmt)
case VIDEO_PIX_FMT_GBRG8:
case VIDEO_PIX_FMT_GRBG8:
case VIDEO_PIX_FMT_RGGB8:
case VIDEO_PIX_FMT_GREY:
return 8;
case VIDEO_PIX_FMT_SBGGR10P:
case VIDEO_PIX_FMT_SGBRG10P:

Loading…
Cancel
Save