Skip to content

Commit 2c5ec1c

Browse files
josuahkartben
authored andcommitted
drivers: video: improve the format description docs
@verbatim shows the leading comment '*' fence in the output. @code{.unparsed} allows extracting the text only. In some formats, the pixels are also not immediately packed into fixed number of bytes, like YUYV due to chroma subsampling. Disambiguate. Add numbers marks on top to help identify the individual pixels. Signed-off-by: Josuah Demangeon <me@josuah.net>
1 parent cbfa49f commit 2c5ec1c

File tree

1 file changed

+37
-27
lines changed

1 file changed

+37
-27
lines changed

include/zephyr/drivers/video.h

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ void video_closest_frmival(const struct device *dev, enum video_endpoint_id ep,
810810

811811
/**
812812
* @defgroup video_pixel_formats Video pixel formats
813-
* The @c | characters separate the pixels, and spaces separate the bytes.
813+
* The '|' characters separate the pixels or logical blocks, and spaces separate the bytes.
814814
* The uppercase letter represents the most significant bit.
815815
* The lowercase letters represent the rest of the bits.
816816
* @{
@@ -856,38 +856,48 @@ void video_closest_frmival(const struct device *dev, enum video_endpoint_id ep,
856856
*
857857
* The full color information is spread over multiple pixels.
858858
*
859+
* When the format includes more than 8-bit per pixel, a strategy becomes needed to pack
860+
* the bits over multiple bytes, as illustrated for each format.
861+
*
862+
* The number above the 'R', 'r', 'G', 'g', 'B', 'b' are hints about which pixel number the
863+
* following bits belong to.
864+
*
859865
* @{
860866
*/
861867

862868
/**
863-
* @verbatim
864-
* | Bbbbbbbb | Gggggggg | Bbbbbbbb | Gggggggg | Bbbbbbbb | Gggggggg | ...
865-
* | Gggggggg | Rrrrrrrr | Gggggggg | Rrrrrrrr | Gggggggg | Rrrrrrrr | ...
866-
* @endverbatim
869+
* @code{.unparsed}
870+
* 0 1 2 3
871+
* | Bbbbbbbb | Gggggggg | Bbbbbbbb | Gggggggg | ...
872+
* | Gggggggg | Rrrrrrrr | Gggggggg | Rrrrrrrr | ...
873+
* @endcode
867874
*/
868875
#define VIDEO_PIX_FMT_BGGR8 VIDEO_FOURCC('B', 'A', '8', '1')
869876

870877
/**
871-
* @verbatim
872-
* | Gggggggg | Bbbbbbbb | Gggggggg | Bbbbbbbb | Gggggggg | Bbbbbbbb | ...
873-
* | Rrrrrrrr | Gggggggg | Rrrrrrrr | Gggggggg | Rrrrrrrr | Gggggggg | ...
874-
* @endverbatim
878+
* @code{.unparsed}
879+
* 0 1 2 3
880+
* | Gggggggg | Bbbbbbbb | Gggggggg | Bbbbbbbb | ...
881+
* | Rrrrrrrr | Gggggggg | Rrrrrrrr | Gggggggg | ...
882+
* @endcode
875883
*/
876884
#define VIDEO_PIX_FMT_GBRG8 VIDEO_FOURCC('G', 'B', 'R', 'G')
877885

878886
/**
879-
* @verbatim
880-
* | Gggggggg | Rrrrrrrr | Gggggggg | Rrrrrrrr | Gggggggg | Rrrrrrrr | ...
881-
* | Bbbbbbbb | Gggggggg | Bbbbbbbb | Gggggggg | Bbbbbbbb | Gggggggg | ...
882-
* @endverbatim
887+
* @code{.unparsed}
888+
* 0 1 2 3
889+
* | Gggggggg | Rrrrrrrr | Gggggggg | Rrrrrrrr | ...
890+
* | Bbbbbbbb | Gggggggg | Bbbbbbbb | Gggggggg | ...
891+
* @endcode
883892
*/
884893
#define VIDEO_PIX_FMT_GRBG8 VIDEO_FOURCC('G', 'R', 'B', 'G')
885894

886895
/**
887-
* @verbatim
888-
* | Rrrrrrrr | Gggggggg | Rrrrrrrr | Gggggggg | Rrrrrrrr | Gggggggg | ...
889-
* | Gggggggg | Bbbbbbbb | Gggggggg | Bbbbbbbb | Gggggggg | Bbbbbbbb | ...
890-
* @endverbatim
896+
* @code{.unparsed}
897+
* 0 1 2 3
898+
* | Rrrrrrrr | Gggggggg | Rrrrrrrr | Gggggggg | ...
899+
* | Gggggggg | Bbbbbbbb | Gggggggg | Bbbbbbbb | ...
900+
* @endcode
891901
*/
892902
#define VIDEO_PIX_FMT_RGGB8 VIDEO_FOURCC('R', 'G', 'G', 'B')
893903

@@ -905,30 +915,30 @@ void video_closest_frmival(const struct device *dev, enum video_endpoint_id ep,
905915
* 5 red bits [15:11], 6 green bits [10:5], 5 blue bits [4:0].
906916
* This 16-bit integer is then packed in big endian format over two bytes:
907917
*
908-
* @verbatim
918+
* @code{.unparsed}
909919
* 15.....8 7......0
910920
* | RrrrrGgg gggBbbbb | ...
911-
* @endverbatim
921+
* @endcode
912922
*/
913923
#define VIDEO_PIX_FMT_RGB565X VIDEO_FOURCC('R', 'G', 'B', 'R')
914924

915925
/**
916926
* 5 red bits [15:11], 6 green bits [10:5], 5 blue bits [4:0].
917927
* This 16-bit integer is then packed in little endian format over two bytes:
918928
*
919-
* @verbatim
929+
* @code{.unparsed}
920930
* 7......0 15.....8
921931
* | gggBbbbb RrrrrGgg | ...
922-
* @endverbatim
932+
* @endcode
923933
*/
924934
#define VIDEO_PIX_FMT_RGB565 VIDEO_FOURCC('R', 'G', 'B', 'P')
925935

926936
/**
927937
* The first byte is empty (X) for each pixel.
928938
*
929-
* @verbatim
939+
* @code{.unparsed}
930940
* | Xxxxxxxx Rrrrrrrr Gggggggg Bbbbbbbb | ...
931-
* @endverbatim
941+
* @endcode
932942
*/
933943
#define VIDEO_PIX_FMT_XRGB32 VIDEO_FOURCC('B', 'X', '2', '4')
934944

@@ -946,18 +956,18 @@ void video_closest_frmival(const struct device *dev, enum video_endpoint_id ep,
946956
* There is either a missing channel per pixel, U or V.
947957
* The value is to be averaged over 2 pixels to get the value of individual pixel.
948958
*
949-
* @verbatim
959+
* @code{.unparsed}
950960
* | Yyyyyyyy Uuuuuuuu | Yyyyyyyy Vvvvvvvv | ...
951-
* @endverbatim
961+
* @endcode
952962
*/
953963
#define VIDEO_PIX_FMT_YUYV VIDEO_FOURCC('Y', 'U', 'Y', 'V')
954964

955965
/**
956966
* The first byte is empty (X) for each pixel.
957967
*
958-
* @verbatim
968+
* @code{.unparsed}
959969
* | Xxxxxxxx Yyyyyyyy Uuuuuuuu Vvvvvvvv | ...
960-
* @endverbatim
970+
* @endcode
961971
*/
962972
#define VIDEO_PIX_FMT_XYUV32 VIDEO_FOURCC('X', 'Y', 'U', 'V')
963973

0 commit comments

Comments
 (0)