@@ -812,6 +812,14 @@ void video_closest_frmival_stepwise(const struct video_frmival_stepwise *stepwis
812
812
void video_closest_frmival (const struct device * dev , enum video_endpoint_id ep ,
813
813
struct video_frmival_enum * match );
814
814
815
+ /**
816
+ * @defgroup video_pixel_formats Video pixel formats
817
+ * The @c | characters separate the pixels, and spaces separate the bytes.
818
+ * The uppercase letter represents the most significant bit.
819
+ * The lowercase letters represent the rest of the bits.
820
+ * @{
821
+ */
822
+
815
823
/**
816
824
* @brief Four-character-code uniquely identifying the pixel format
817
825
*/
@@ -829,14 +837,6 @@ void video_closest_frmival(const struct device *dev, enum video_endpoint_id ep,
829
837
*/
830
838
#define VIDEO_FOURCC_FROM_STR (str ) VIDEO_FOURCC((str)[0], (str)[1], (str)[2], (str)[3])
831
839
832
- /**
833
- * @defgroup video_pixel_formats Video pixel formats
834
- * The @c | characters separate the pixels, and spaces separate the bytes.
835
- * The uppercase letter represents the most significant bit.
836
- * The lowercase letters represent the rest of the bits.
837
- * @{
838
- */
839
-
840
840
/**
841
841
* @name Bayer formats (R, G, B channels).
842
842
*
@@ -966,33 +966,37 @@ void video_closest_frmival(const struct device *dev, enum video_endpoint_id ep,
966
966
*/
967
967
968
968
/**
969
- * @}
970
- */
971
-
972
- /**
973
- * @brief Get number of bytes per pixel of a pixel format
969
+ * @brief Get number of bits per pixel of a pixel format
970
+ *
971
+ * @param pixfmt FourCC pixel format value (@ref video_pixel_formats).
974
972
*
975
- * @param pixfmt FourCC pixel format value (\ref video_pixel_formats).
973
+ * @retval 0 if the format is unhandled or if it is variable number of bits
974
+ * @retval bit size of one pixel for this format
976
975
*/
977
- static inline unsigned int video_pix_fmt_bpp (uint32_t pixfmt )
976
+ static inline unsigned int video_bits_per_pixel (uint32_t pixfmt )
978
977
{
979
978
switch (pixfmt ) {
980
979
case VIDEO_PIX_FMT_BGGR8 :
981
980
case VIDEO_PIX_FMT_GBRG8 :
982
981
case VIDEO_PIX_FMT_GRBG8 :
983
982
case VIDEO_PIX_FMT_RGGB8 :
984
- return 1 ;
983
+ return 8 ;
985
984
case VIDEO_PIX_FMT_RGB565 :
986
985
case VIDEO_PIX_FMT_YUYV :
987
- return 2 ;
986
+ return 16 ;
988
987
case VIDEO_PIX_FMT_XRGB32 :
989
988
case VIDEO_PIX_FMT_XYUV32 :
990
- return 4 ;
989
+ return 32 ;
991
990
default :
991
+ /* Variable number of bits per pixel or unknown format */
992
992
return 0 ;
993
993
}
994
994
}
995
995
996
+ /**
997
+ * @}
998
+ */
999
+
996
1000
#ifdef __cplusplus
997
1001
}
998
1002
#endif
0 commit comments