diff --git a/drivers/video/video.c b/drivers/video/video.c index 9c6dd815f1..39bfad3f02 100644 --- a/drivers/video/video.c +++ b/drivers/video/video.c @@ -500,6 +500,10 @@ static void convert_to_imgdatafmt(FAR video_format_t *video, data->height = video->height; switch (video->pixelformat) { + case V4L2_PIX_FMT_YUV420: + data->pixelformat = IMGDATA_PIX_FMT_YUV420P; + break; + case V4L2_PIX_FMT_YUYV: data->pixelformat = IMGDATA_PIX_FMT_YUYV; break; @@ -531,6 +535,10 @@ static void convert_to_imgsensorfmt(FAR video_format_t *video, sensor->height = video->height; switch (video->pixelformat) { + case V4L2_PIX_FMT_YUV420: + sensor->pixelformat = IMGSENSOR_PIX_FMT_YUV420P; + break; + case V4L2_PIX_FMT_YUYV: sensor->pixelformat = IMGSENSOR_PIX_FMT_YUYV; break; @@ -1516,6 +1524,7 @@ static int video_try_fmt(FAR struct video_mng_s *priv, break; + case V4L2_PIX_FMT_YUV420: case V4L2_PIX_FMT_YUYV: case V4L2_PIX_FMT_UYVY: case V4L2_PIX_FMT_RGB565: diff --git a/include/nuttx/video/imgdata.h b/include/nuttx/video/imgdata.h index 944b4981b1..e1ecab7034 100644 --- a/include/nuttx/video/imgdata.h +++ b/include/nuttx/video/imgdata.h @@ -43,6 +43,7 @@ #define IMGDATA_PIX_FMT_SUBIMG_UYVY (4) #define IMGDATA_PIX_FMT_SUBIMG_RGB565 (5) #define IMGDATA_PIX_FMT_YUYV (6) +#define IMGDATA_PIX_FMT_YUV420P (7) /**************************************************************************** * Public Types diff --git a/include/nuttx/video/imgsensor.h b/include/nuttx/video/imgsensor.h index 464f549bfc..7cf2c8ab0f 100644 --- a/include/nuttx/video/imgsensor.h +++ b/include/nuttx/video/imgsensor.h @@ -118,6 +118,7 @@ #define IMGSENSOR_PIX_FMT_SUBIMG_UYVY (4) #define IMGSENSOR_PIX_FMT_SUBIMG_RGB565 (5) #define IMGSENSOR_PIX_FMT_YUYV (6) +#define IMGSENSOR_PIX_FMT_YUV420P (7) /**************************************************************************** * Public Types diff --git a/include/nuttx/video/video.h b/include/nuttx/video/video.h index 1b8be65d2a..34f926d5ac 100644 --- a/include/nuttx/video/video.h +++ b/include/nuttx/video/video.h @@ -219,6 +219,10 @@ extern "C" #define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') #define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') +/* YUV 4:2:0 */ + +#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') + /* RGB565 */ #define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P')