drivers/video: add support for YUYV format
Add YUYV format which is used by most USB Cameras Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
This commit is contained in:
parent
84fa994f51
commit
365b1f4bb8
@ -500,19 +500,23 @@ static void convert_to_imgdatafmt(FAR video_format_t *video,
|
||||
data->height = video->height;
|
||||
switch (video->pixelformat)
|
||||
{
|
||||
case V4L2_PIX_FMT_UYVY :
|
||||
case V4L2_PIX_FMT_YUYV:
|
||||
data->pixelformat = IMGDATA_PIX_FMT_YUYV;
|
||||
break;
|
||||
|
||||
case V4L2_PIX_FMT_UYVY:
|
||||
data->pixelformat = IMGDATA_PIX_FMT_UYVY;
|
||||
break;
|
||||
|
||||
case V4L2_PIX_FMT_RGB565 :
|
||||
case V4L2_PIX_FMT_RGB565:
|
||||
data->pixelformat = IMGDATA_PIX_FMT_RGB565;
|
||||
break;
|
||||
|
||||
case V4L2_PIX_FMT_JPEG :
|
||||
case V4L2_PIX_FMT_JPEG:
|
||||
data->pixelformat = IMGDATA_PIX_FMT_JPEG;
|
||||
break;
|
||||
|
||||
default : /* V4L2_PIX_FMT_JPEG_WITH_SUBIMG */
|
||||
default: /* V4L2_PIX_FMT_JPEG_WITH_SUBIMG */
|
||||
data->pixelformat = IMGDATA_PIX_FMT_JPEG_WITH_SUBIMG;
|
||||
break;
|
||||
}
|
||||
@ -527,19 +531,23 @@ static void convert_to_imgsensorfmt(FAR video_format_t *video,
|
||||
sensor->height = video->height;
|
||||
switch (video->pixelformat)
|
||||
{
|
||||
case V4L2_PIX_FMT_UYVY :
|
||||
case V4L2_PIX_FMT_YUYV:
|
||||
sensor->pixelformat = IMGSENSOR_PIX_FMT_YUYV;
|
||||
break;
|
||||
|
||||
case V4L2_PIX_FMT_UYVY:
|
||||
sensor->pixelformat = IMGSENSOR_PIX_FMT_UYVY;
|
||||
break;
|
||||
|
||||
case V4L2_PIX_FMT_RGB565 :
|
||||
case V4L2_PIX_FMT_RGB565:
|
||||
sensor->pixelformat = IMGSENSOR_PIX_FMT_RGB565;
|
||||
break;
|
||||
|
||||
case V4L2_PIX_FMT_JPEG :
|
||||
case V4L2_PIX_FMT_JPEG:
|
||||
sensor->pixelformat = IMGSENSOR_PIX_FMT_JPEG;
|
||||
break;
|
||||
|
||||
default : /* V4L2_PIX_FMT_JPEG_WITH_SUBIMG */
|
||||
default: /* V4L2_PIX_FMT_JPEG_WITH_SUBIMG */
|
||||
sensor->pixelformat = IMGSENSOR_PIX_FMT_JPEG_WITH_SUBIMG;
|
||||
break;
|
||||
}
|
||||
@ -1508,6 +1516,7 @@ static int video_try_fmt(FAR struct video_mng_s *priv,
|
||||
|
||||
break;
|
||||
|
||||
case V4L2_PIX_FMT_YUYV:
|
||||
case V4L2_PIX_FMT_UYVY:
|
||||
case V4L2_PIX_FMT_RGB565:
|
||||
case V4L2_PIX_FMT_JPEG:
|
||||
|
@ -42,6 +42,7 @@
|
||||
#define IMGDATA_PIX_FMT_JPEG_WITH_SUBIMG (3)
|
||||
#define IMGDATA_PIX_FMT_SUBIMG_UYVY (4)
|
||||
#define IMGDATA_PIX_FMT_SUBIMG_RGB565 (5)
|
||||
#define IMGDATA_PIX_FMT_YUYV (6)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
|
@ -101,7 +101,7 @@
|
||||
|
||||
/* Status bit definition for IMGSENSOR_ID_3A_STATUS */
|
||||
|
||||
#define IMGSENSOR_3A_STATUS_STABLE (0)
|
||||
#define IMGSENSOR_3A_STATUS_STABLE (0)
|
||||
#define IMGSENSOR_3A_STATUS_AE_OPERATING (1 << 0)
|
||||
#define IMGSENSOR_3A_STATUS_AWB_OPERATING (1 << 1)
|
||||
#define IMGSENSOR_3A_STATUS_AF_OPERATING (1 << 2)
|
||||
@ -117,6 +117,7 @@
|
||||
#define IMGSENSOR_PIX_FMT_JPEG_WITH_SUBIMG (3)
|
||||
#define IMGSENSOR_PIX_FMT_SUBIMG_UYVY (4)
|
||||
#define IMGSENSOR_PIX_FMT_SUBIMG_RGB565 (5)
|
||||
#define IMGSENSOR_PIX_FMT_YUYV (6)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
|
@ -217,6 +217,7 @@ extern "C"
|
||||
/* YUV 4:2:2 */
|
||||
|
||||
#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y')
|
||||
#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V')
|
||||
|
||||
/* RGB565 */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user