media: imx-jpeg: Add support for 12 bit extended jpeg
v3 cover media: imx-jpeg: Add support for 12 bit extended jpeg
the imx8 jpeg codec support ISO/IEC 10918-1 Standard Baseline and Extended Sequential DCT modes.
it can support 8-bit and 12-bit per color samples. Currently we only enable the 8-bit jpeg,
and we can enable the 12-bit extended jpeg
with the new defined 12 bit pixel format.
v3
- correct the new 12-bit format naming according to Nicolas's comments
v2
- correct the new 12-bit format naming according to Hans's comments
Ming Qian (10):
media: Add P012 and P012M video format
media: Add Y012 video format
media: Add YUYV64_12 video format
media: Add YUV48_12 video format
media: Add BGR48_12 video format
media: Add ABGR64_12 video format
media: imx-jpeg: Refine the function mxc_jpeg_find_format
media: imx-jpeg: Clear slot next desc ptr if config error
media: imx-jpeg: Decoder add support for 12bit jpeg
media: imx-jpeg: Encoder add support for 12bit jpeg
.../media/v4l/pixfmt-packed-yuv.rst | 70 ++++ .../userspace-api/media/v4l/pixfmt-rgb.rst | 44 +++ .../media/v4l/pixfmt-yuv-luma.rst | 15 + .../media/v4l/pixfmt-yuv-planar.rst | 94 +++++ .../media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c | 19 +- .../media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h | 5 +- .../media/platform/nxp/imx-jpeg/mxc-jpeg.c | 326 ++++++++++++++++-- drivers/media/v4l2-core/v4l2-common.c | 6 + drivers/media/v4l2-core/v4l2-ioctl.c | 7 + include/uapi/linux/videodev2.h | 9 + 10 files changed, 569 insertions(+), 26 deletions(-)
Signature · 1 line
2.38.1
PATCH v3 1/10 media: Add P012 and P012M video format
P012 is a YUV format with 12-bits per component with interleaved UV, like NV12, expanded to 16 bits.
Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order.
And P012M has two non contiguous planes.
--- .../media/v4l/pixfmt-yuv-planar.rst | 94 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-common.c | 2 + drivers/media/v4l2-core/v4l2-ioctl.c | 2 + include/uapi/linux/videodev2.h | 2 + 4 files changed, 100 insertions(+)
Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst +94 -0
@@ -123,6 +123,20 @@ All components are stored with the same number of bits per component. - Cb, Cr - Yes - 4x4 tiles + * - V4L2_PIX_FMT_P012 + - 'P012' + - 12 + - 4:2:0 + - Cb, Cr + - Yes + - Linear + * - V4L2_PIX_FMT_P012M + - 'PM12' + - 12 + - 4:2:0 + - Cb, Cr + - Yes + - Linear * - V4L2_PIX_FMT_NV16 - 'NV16' - 8
@@ -586,6 +600,86 @@ Data in the 10 high bits, zeros in the 6 low bits, arranged in little endian ord - Cb\ :sub:`11` - Cr\ :sub:`11` +.. _V4L2-PIX-FMT-P012: +.. _V4L2-PIX-FMT-P012M: + +P012 and P012M +-------------- + +P012 is like NV12 with 12 bits per component, expanded to 16 bits. +Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order. + +.. flat-table:: Sample 4x4 P012 Image + :header-rows: 0 + :stub-columns: 0 + + * - start + 0: + - Y'\ :sub:`00` + - Y'\ :sub:`01` + - Y'\ :sub:`02` + - Y'\ :sub:`03` + * - start + 8: + - Y'\ :sub:`10` + - Y'\ :sub:`11` + - Y'\ :sub:`12` + - Y'\ :sub:`13` + * - start + 16: + - Y'\ :sub:`20` + - Y'\ :sub:`21` + - Y'\ :sub:`22` + - Y'\ :sub:`23` + * - start + 24: + - Y'\ :sub:`30` + - Y'\ :sub:`31` + - Y'\ :sub:`32` + - Y'\ :sub:`33` + * - start + 32: + - Cb\ :sub:`00` + - Cr\ :sub:`00` + - Cb\ :sub:`01` + - Cr\ :sub:`01` + * - start + 40: + - Cb\ :sub:`10` + - Cr\ :sub:`10` + - Cb\ :sub:`11` + - Cr\ :sub:`11` + +.. flat-table:: Sample 4x4 P012M Image + :header-rows: 0 + :stub-columns: 0 + + * - start0 + 0: + - Y'\ :sub:`00` + - Y'\ :sub:`01` + - Y'\ :sub:`02` + - Y'\ :sub:`03` + * - start0 + 8: + - Y'\ :sub:`10` + - Y'\ :sub:`11` + - Y'\ :sub:`12` + - Y'\ :sub:`13` + * - start0 + 16: + - Y'\ :sub:`20` + - Y'\ :sub:`21` + - Y'\ :sub:`22` + - Y'\ :sub:`23` + * - start0 + 24: + - Y'\ :sub:`30` + - Y'\ :sub:`31` + - Y'\ :sub:`32` + - Y'\ :sub:`33` + * - + * - start1 + 0: + - Cb\ :sub:`00` + - Cr\ :sub:`00` + - Cb\ :sub:`01` + - Cr\ :sub:`01` + * - start1 + 8: + - Cb\ :sub:`10` + - Cr\ :sub:`10` + - Cb\ :sub:`11` + - Cr\ :sub:`11` + Fully Planar YUV Formats ========================
drivers/media/v4l2-core/v4l2-common.c +2 -0
@@ -267,6 +267,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) { .format = V4L2_PIX_FMT_NV24, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_NV42, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_P010, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 2, 2, 0, 0 }, .hdiv = 2, .vdiv = 1 }, + { .format = V4L2_PIX_FMT_P012, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 2, 4, 0, 0 }, .hdiv = 2, .vdiv = 2 }, { .format = V4L2_PIX_FMT_YUV410, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .hdiv = 4, .vdiv = 4 }, { .format = V4L2_PIX_FMT_YVU410, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .hdiv = 4, .vdiv = 4 },
@@ -292,6 +293,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) { .format = V4L2_PIX_FMT_NV21M, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 2, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2 }, { .format = V4L2_PIX_FMT_NV16M, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 2, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 1 }, { .format = V4L2_PIX_FMT_NV61M, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 2, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 1 }, + { .format = V4L2_PIX_FMT_P012M, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 2, .comp_planes = 2, .bpp = { 2, 4, 0, 0 }, .hdiv = 2, .vdiv = 2 }, /* Bayer RGB formats */ { .format = V4L2_PIX_FMT_SBGGR8, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 1, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
drivers/media/v4l2-core/v4l2-ioctl.c +2 -0
@@ -1349,6 +1349,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_PIX_FMT_NV24 : descr ="Y/UV 4:4:4" ;break ;case V4L2_PIX_FMT_NV42 : descr ="Y/VU 4:4:4" ;break ;case V4L2_PIX_FMT_P010 : descr ="10-bit Y/UV 4:2:0" ;break ; +case V4L2_PIX_FMT_P012 : descr ="12-bit Y/UV 4:2:0" ;break ;case V4L2_PIX_FMT_NV12_4L4 : descr ="Y/UV 4:2:0 (4x4 Linear)" ;break ;case V4L2_PIX_FMT_NV12_16L16 : descr ="Y/UV 4:2:0 (16x16 Linear)" ;break ;case V4L2_PIX_FMT_NV12_32L32 : descr ="Y/UV 4:2:0 (32x32 Linear)" ;break ;
@@ -1359,6 +1360,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_PIX_FMT_NV61M : descr ="Y/VU 4:2:2 (N-C)" ;break ;case V4L2_PIX_FMT_NV12MT : descr ="Y/UV 4:2:0 (64x32 MB, N-C)" ;break ;case V4L2_PIX_FMT_NV12MT_16X16 : descr ="Y/UV 4:2:0 (16x16 MB, N-C)" ;break ; +case V4L2_PIX_FMT_P012M : descr ="12-bit Y/UV 4:2:0 (N-C)" ;break ;case V4L2_PIX_FMT_YUV420M : descr ="Planar YUV 4:2:0 (N-C)" ;break ;case V4L2_PIX_FMT_YVU420M : descr ="Planar YVU 4:2:0 (N-C)" ;break ;case V4L2_PIX_FMT_YUV422M : descr ="Planar YUV 4:2:2 (N-C)" ;break ;
include/uapi/linux/videodev2.h +2 -0
@@ -626,12 +626,14 @@ struct v4l2_pix_format {#define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4')/* 24 Y/CbCr 4:4:4 */ #define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2')/* 24 Y/CrCb 4:4:4 */ #define V4L2_PIX_FMT_P010 v4l2_fourcc('P', '0', '1', '0')/* 24 Y/CbCr 4:2:0 10-bit per component */ +#define V4L2_PIX_FMT_P012 v4l2_fourcc('P', '0', '1', '2')/* 24 Y/CbCr 4:2:0 12-bit per component */ /* two non contiguous planes - one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2')/* 12 Y/CbCr 4:2:0 */ #define V4L2_PIX_FMT_NV21M v4l2_fourcc('N', 'M', '2', '1')/* 21 Y/CrCb 4:2:0 */ #define V4L2_PIX_FMT_NV16M v4l2_fourcc('N', 'M', '1', '6')/* 16 Y/CbCr 4:2:2 */ #define V4L2_PIX_FMT_NV61M v4l2_fourcc('N', 'M', '6', '1')/* 16 Y/CrCb 4:2:2 */ +#define V4L2_PIX_FMT_P012M v4l2_fourcc('P', 'M', '1', '2')/* 24 Y/CbCr 4:2:0 12-bit per component */ /* three planes - Y Cb, Cr */ #define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9')/* 9 YUV 4:1:0 */
Signature · 1 line
2.38.1
PATCH v3 2/10 media: Add Y012 video format
In reply to Ming QianY012 is a luma-only formats with 12-bits per pixel, expanded to 16bits.
Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order.
--- .../userspace-api/media/v4l/pixfmt-yuv-luma.rst | 15 +++++++++++++++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 3 files changed, 17 insertions(+)
Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst +15 -0
@@ -103,6 +103,17 @@ are often referred to as greyscale formats. - ... - ... + * .. _V4L2-PIX-FMT-Y012: + + - ``V4L2_PIX_FMT_Y012`` + - 'Y012' + + - Y'\ :sub:`0`\ [3:0] `0000` + - Y'\ :sub:`0`\ [11:4] + - ... + - ... + - ... + * .. _V4L2-PIX-FMT-Y14: - ``V4L2_PIX_FMT_Y14``
@@ -146,3 +157,7 @@ are often referred to as greyscale formats. than 16 bits. For example, 10 bits per pixel uses values in the range 0 to 1023. For the IPU3_Y10 format 25 pixels are packed into 32 bytes, which leaves the 6 most significant bits of the last byte padded with 0. + + For Y012 and Y12 formats, Y012 place its data in the 12 high bits, with + padding zeros in the 4 low bits, in contrast to Y12 format, which have + its padding located in the most significant bits of the 16 bit word.
drivers/media/v4l2-core/v4l2-ioctl.c +1 -0
@@ -1304,6 +1304,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_PIX_FMT_Y6 : descr ="6-bit Greyscale" ;break ;case V4L2_PIX_FMT_Y10 : descr ="10-bit Greyscale" ;break ;case V4L2_PIX_FMT_Y12 : descr ="12-bit Greyscale" ;break ; +case V4L2_PIX_FMT_Y012 : descr ="12-bit Greyscale" ;break ;case V4L2_PIX_FMT_Y14 : descr ="14-bit Greyscale" ;break ;case V4L2_PIX_FMT_Y16 : descr ="16-bit Greyscale" ;break ;case V4L2_PIX_FMT_Y16_BE : descr ="16-bit Greyscale BE" ;break ;
include/uapi/linux/videodev2.h +1 -0
@@ -583,6 +583,7 @@ struct v4l2_pix_format {#define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ')/* 6 Greyscale */ #define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ')/* 10 Greyscale */ #define V4L2_PIX_FMT_Y12 v4l2_fourcc('Y', '1', '2', ' ')/* 12 Greyscale */ +#define V4L2_PIX_FMT_Y012 v4l2_fourcc('Y', '0', '1', '2')/* 12 Greyscale */ #define V4L2_PIX_FMT_Y14 v4l2_fourcc('Y', '1', '4', ' ')/* 14 Greyscale */ #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ')/* 16 Greyscale */ #define V4L2_PIX_FMT_Y16_BE v4l2_fourcc_be('Y', '1', '6', ' ')/* 16 Greyscale BE */
Signature · 1 line
2.38.1
PATCH v3 3/10 media: Add YUYV64_12 video format
In reply to Ming QianYUYV64_12 is a YUV format with 12-bits per component like YUYV, expanded to 16bits.
Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order.
--- .../media/v4l/pixfmt-packed-yuv.rst | 42 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-common.c | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 4 files changed, 45 insertions(+)
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst +42 -0
@@ -341,6 +341,48 @@ components horizontally by 2, storing 2 pixels in 4 bytes. \normalsize +The next lists the packed YUV 4:2:2 formats with more than 8 bits per component. +expand the bits per component to 16 bits, data in the high bits, zeros in the low bits, +arranged in little endian order. storing 2 pixels in 8 bytes. + +.. raw:: latex + + \footnotesize + +.. tabularcolumns:: |p{3.4cm}|p{1.2cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}| + +.. flat-table:: Packed YUV 4:2:2 Formats (more than 8bpc) + :header-rows: 1 + :stub-columns: 0 + + * - Identifier + - Code + - Byte 1-0 + - Byte 3-2 + - Byte 5-4 + - Byte 7-6 + - Byte 9-8 + - Byte 11-10 + - Byte 13-12 + - Byte 15-14 + * .. _V4L2-PIX-FMT-YUYV64-12: + + - ``V4L2_PIX_FMT_YUYV64_12`` + - 'Y212' + + - Y'\ :sub:`0` + - Cb\ :sub:`0` + - Y'\ :sub:`1` + - Cr\ :sub:`0` + - Y'\ :sub:`2` + - Cb\ :sub:`2` + - Y'\ :sub:`3` + - Cr\ :sub:`2` + +.. raw:: latex + + \normalsize + **Color Sample Location:** Chroma samples are :ref:`interstitially sited<yuv-chroma-centered>` horizontally.
drivers/media/v4l2-core/v4l2-common.c +1 -0
@@ -258,6 +258,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) { .format = V4L2_PIX_FMT_YVYU, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, { .format = V4L2_PIX_FMT_UYVY, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, { .format = V4L2_PIX_FMT_VYUY, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, + { .format = V4L2_PIX_FMT_YUYV64_12, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, /* YUV planar formats */ { .format = V4L2_PIX_FMT_NV12, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2 },
drivers/media/v4l2-core/v4l2-ioctl.c +1 -0
@@ -1343,6 +1343,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_PIX_FMT_YUV420 : descr ="Planar YUV 4:2:0" ;break ;case V4L2_PIX_FMT_HI240 : descr ="8-bit Dithered RGB (BTTV)" ;break ;case V4L2_PIX_FMT_M420 : descr ="YUV 4:2:0 (M420)" ;break ; +case V4L2_PIX_FMT_YUYV64_12 : descr ="12-bit Depth YUYV 4:2:2" ;break ;case V4L2_PIX_FMT_NV12 : descr ="Y/UV 4:2:0" ;break ;case V4L2_PIX_FMT_NV21 : descr ="Y/VU 4:2:0" ;break ;case V4L2_PIX_FMT_NV16 : descr ="Y/UV 4:2:2" ;break ;
include/uapi/linux/videodev2.h +1 -0
@@ -618,6 +618,7 @@ struct v4l2_pix_format {#define V4L2_PIX_FMT_YUVA32 v4l2_fourcc('Y', 'U', 'V', 'A')/* 32 YUVA-8-8-8-8 */ #define V4L2_PIX_FMT_YUVX32 v4l2_fourcc('Y', 'U', 'V', 'X')/* 32 YUVX-8-8-8-8 */ #define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0')/* 12 YUV 4:2:0 2 lines y, 1 line uv interleaved */ +#define V4L2_PIX_FMT_YUYV64_12 v4l2_fourcc('Y', '2', '1', '2')/* 32 YUYV 12-bit per component */ /* two planes -- one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2')/* 12 Y/CbCr 4:2:0 */
Signature · 1 line
2.38.1
Re: [PATCH v3 03/10] media: Add YUYV64_12 video format
Hi,
Quoted 95 lines · Ming Qian
YUYV64_12is a YUV format with 12-bits per component like YUYV, expanded to 16bits.
Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order.Signed-off-by Ming Qian <[email protected]>--- .../media/v4l/pixfmt-packed-yuv.rst | 42 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-common.c | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 4 files changed, 45 insertions(+)Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst +42
-0@@ -341,6 +341,48 @@ components horizontally by 2, storing 2 pixels in 4 bytes. \normalsize +The next lists the packed YUV 4:2:2 formats with more than 8 bits per component. +expand the bits per component to 16 bits, data in the high bits, zeros in the low bits, +arranged in little endian order. storing 2 pixels in 8 bytes. + +.. raw:: latex + + \footnotesize + +.. tabularcolumns:: |p{3.4cm}|p{1.2cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}| + +.. flat-table:: Packed YUV 4:2:2 Formats (more than 8bpc) + :header-rows: 1 + :stub-columns: 0 + + * - Identifier + - Code + - Byte 1-0 + - Byte 3-2 + - Byte 5-4 + - Byte 7-6 + - Byte 9-8 + - Byte 11-10 + - Byte 13-12 + - Byte 15-14 + * .. _V4L2-PIX-FMT-YUYV64-12: + + - ``V4L2_PIX_FMT_YUYV64_12`` + - 'Y212' + + - Y'\ :sub:`0` + - Cb\ :sub:`0` + - Y'\ :sub:`1` + - Cr\ :sub:`0` + - Y'\ :sub:`2` + - Cb\ :sub:`2` + - Y'\ :sub:`3` + - Cr\ :sub:`2` + +.. raw:: latex + + \normalsize + **Color Sample Location:** Chroma samples are :ref:`interstitially sited<yuv-chroma-centered>` horizontally.drivers/media/v4l2-core/v4l2-common.c +1
-0@@ -258,6 +258,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) { .format = V4L2_PIX_FMT_YVYU, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, { .format = V4L2_PIX_FMT_UYVY, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, { .format = V4L2_PIX_FMT_VYUY, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, + { .format = V4L2_PIX_FMT_YUYV64_12, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, /* YUV planar formats */ { .format = V4L2_PIX_FMT_NV12, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2 },drivers/media/v4l2-core/v4l2-ioctl.c +1
-0@@ -1343,6 +1343,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_PIX_FMT_YUV420 : descr ="Planar YUV 4:2:0" ;break ;case V4L2_PIX_FMT_HI240 : descr ="8-bit Dithered RGB (BTTV)" ;break ;case V4L2_PIX_FMT_M420 : descr ="YUV 4:2:0 (M420)" ;break ; +case V4L2_PIX_FMT_YUYV64_12 : descr ="12-bit Depth YUYV 4:2:2" ;break ;case V4L2_PIX_FMT_NV12 : descr ="Y/UV 4:2:0" ;break ;case V4L2_PIX_FMT_NV21 : descr ="Y/VU 4:2:0" ;break ;case V4L2_PIX_FMT_NV16 : descr ="Y/UV 4:2:2" ;break ;include/uapi/linux/videodev2.h +0
-0
include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 621
Quoted 4 lines
include/uapi/linux/videodev2.h +1
-0@@ -618,6 +618,7 @@ struct v4l2_pix_format {#define V4L2_PIX_FMT_YUVA32 v4l2_fourcc('Y', 'U', 'V', 'A')/* 32 YUVA-8-8-8-8 */ #define V4L2_PIX_FMT_YUVX32 v4l2_fourcc('Y', 'U', 'V', 'X')/* 32 YUVX-8-8-8-8 */ #define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0')/* 12 YUV 4:2:0 2 lines y, 1 line uv interleaved */ +#define V4L2_PIX_FMT_YUYV64_12 v4l2_fourcc('Y', '2', '1', '2')/* 32 YUYV 12-bit per component */
It seems Y212 is already added with the same fourcc code, causing build errors:
drivers/media/v4l2-core/v4l2-ioctl.c: In function ‘v4l_fill_fmtdesc’:drivers/media/v4l2-core/v4l2-ioctl.c:1455:9: error: duplicate case value
1455 | case V4L2_PIX_FMT_Y212: descr = "12-bit YUYV
Packed"; break;
| ^~~~
drivers/media/v4l2-core/v4l2-ioctl.c:1349:9: note: previously used here
1349 | case V4L2_PIX_FMT_YUYV64_12: descr = "12-bit Depth
YUYV 4:2:2"; break;
| ^~~~Regards,
Mirela
Quoted 3 lines
include/uapi/linux/videodev2.h +0
-0/* two planes -- one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2')/* 12 Y/CbCr 4:2:0 */
RE: [PATCH v3 03/10] media: Add YUYV64_12 video format
Quoted 156 lines
From: Mirela Rabulea (OSS) <[email protected]>
Sent: 2023年2月19日 5:52
To: Ming Qian <[email protected]>; [email protected]; hverkuil- [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; X.H. Bao <[email protected]>; dl-linux-imx <linux- [email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 03/10] media: AddYUYV64_12video formatHi,
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst components horizontally by 2, storing 2 pixels in 4
Quoted 20 lines · Ming Qian
YUYV64_12is a YUV format with 12-bits per component like YUYV, expanded to 16bits.
Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order.Signed-off-by Ming Qian <[email protected]>--- .../media/v4l/pixfmt-packed-yuv.rst | 42 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-common.c | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 4 files changed, 45 insertions(+)diff --git
a/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rstb/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rstindexbf283a1b5581..76fc331f126e100644Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst +0
-0@@ -341,6 +341,48 @@ components horizontally by 2, storing 2 pixels in 4bytes.
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst components horizontally by 2, storing 2 pixels in 4 bytes.
Quoted 4 lines
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst +1
-0\normalsize +The next lists the packed YUV 4:2:2 formats with more than 8 bits percomponent.
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst components horizontally by 2, storing 2 pixels in 4 · line 345
Quoted 2 lines
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst +2
-0+expand the bits per component to 16 bits, data in the high bits, +zeros in the low bits, arranged in little endian order. storing 2 pixels in 8bytes.
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst components horizontally by 2, storing 2 pixels in 4 bytes.
Quoted 7 lines
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst +6
-0+ +.. raw:: latex + + \footnotesize + +.. tabularcolumns::+|p{3.4cm}|p{1.2cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8
drivers/media/v4l2-core/v4l2-common.c const struct v4l2_format_info
Quoted 43 lines
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst +34
-0+cm}|p{0.8cm}|p{0.8cm}| + +.. flat-table:: Packed YUV 4:2:2 Formats (more than 8bpc) + :header-rows: 1 + :stub-columns: 0 + + * - Identifier + - Code + - Byte 1-0 + - Byte 3-2 + - Byte 5-4 + - Byte 7-6 + - Byte 9-8 + - Byte 11-10 + - Byte 13-12 + - Byte 15-14 + * .. _V4L2-PIX-FMT-YUYV64-12: + + - ``V4L2_PIX_FMT_YUYV64_12`` + - 'Y212' + + - Y'\ :sub:`0` + - Cb\ :sub:`0` + - Y'\ :sub:`1` + - Cr\ :sub:`0` + - Y'\ :sub:`2` + - Cb\ :sub:`2` + - Y'\ :sub:`3` + - Cr\ :sub:`2` + +.. raw:: latex + + \normalsize + **Color Sample Location:** Chroma samples are :ref:`interstitially sited<yuv-chroma-centered>` horizontally.drivers/media/v4l2-core/v4l2-common.c +0
-0@@ -258,6 +258,7 @@ const struct v4l2_format_info*v4l2_format_info(u32 format)
drivers/media/v4l2-core/v4l2-common.c const struct v4l2_format_info · line 258
Quoted 1 line
drivers/media/v4l2-core/v4l2-common.c +0
-0{ .format = V4L2_PIX_FMT_YVYU, .pixel_enc =
V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 },drivers/media/v4l2-core/v4l2-common.c const struct v4l2_format_info · line 259
Quoted 1 line
drivers/media/v4l2-core/v4l2-common.c +0
-0{ .format = V4L2_PIX_FMT_UYVY, .pixel_enc =
V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 },drivers/media/v4l2-core/v4l2-common.c const struct v4l2_format_info · line 260
Quoted 1 line
drivers/media/v4l2-core/v4l2-common.c +0
-0{ .format = V4L2_PIX_FMT_VYUY, .pixel_enc =
V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 },drivers/media/v4l2-core/v4l2-common.c const struct v4l2_format_info
Quoted 6 lines
drivers/media/v4l2-core/v4l2-common.c +3
-0+ { .format = V4L2_PIX_FMT_YUYV64_12, .pixel_enc = +V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, +0, 0 }, .hdiv = 2, .vdiv = 1 }, /* YUV planar formats */ { .format = V4L2_PIX_FMT_NV12, .pixel_enc =
V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2 },drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc
Quoted 6 lines
drivers/media/v4l2-core/v4l2-ioctl.c +0
-0@@ -1343,6 +1343,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc*fmt)
drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc · line 1344
Quoted 2 lines
drivers/media/v4l2-core/v4l2-ioctl.c +0
-0case V4L2_PIX_FMT_YUV420 : descr ="Planar YUV 4:2:0" ;break ;case V4L2_PIX_FMT_HI240 : descr ="8-bit Dithered RGB (BTTV)" ;break;
drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc · line 1345
Quoted 1 line
drivers/media/v4l2-core/v4l2-ioctl.c +0
-0case V4L2_PIX_FMT_M420 : descr ="YUV 4:2:0 (M420)" ;break;
drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc · line 1346
Quoted 1 line
drivers/media/v4l2-core/v4l2-ioctl.c +1
-0+ case V4L2_PIX_FMT_YUYV64_12: descr = "12-bit Depth YUYV4:2:2"; break;
include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 618
Quoted 10 lines
drivers/media/v4l2-core/v4l2-ioctl.c +0
-0case V4L2_PIX_FMT_NV12 : descr ="Y/UV 4:2:0" ;break ;case V4L2_PIX_FMT_NV21 : descr ="Y/VU 4:2:0" ;break ;case V4L2_PIX_FMT_NV16 : descr ="Y/UV 4:2:2" ;break ;(quoted diff) +0
-0
b/include/uapi/linux/videodev2.hindex3d8f89bff33c..3712a36d6fdf100644include/uapi/linux/videodev2.h +0
-0@@ -618,6 +618,7 @@ struct v4l2_pix_format {#define V4L2_PIX_FMT_YUVA32 v4l2_fourcc('Y', 'U', 'V', 'A')/* 32 YUVA-8- 8-8-8 */
include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 619
Quoted 1 line
include/uapi/linux/videodev2.h +0
-0#define V4L2_PIX_FMT_YUVX32 v4l2_fourcc('Y', 'U', 'V', 'X')/* 32 YUVX-8- 8-8-8 */
include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 620
Quoted 1 line
include/uapi/linux/videodev2.h +0
-0#define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0')/* 12 YUV 4:2:0 2 lines y, 1 line uv interleaved */
include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 621
Quoted 1 line
include/uapi/linux/videodev2.h +1
-0+#define V4L2_PIX_FMT_YUYV64_12 v4l2_fourcc('Y', '2', '1', '2')/* 32 YUYV 12-bit per component */
It seems Y212 is already added with the same fourcc code, causing build errors:
drivers/media/v4l2-core/v4l2-ioctl.c: In function ‘v4l_fill_fmtdesc’:drivers/media/v4l2-core/v4l2-ioctl.c:1455:9: error: duplicate case value
1455 | caseV4L2_PIX_FMT_Y212: descr = "12-bit YUYVPacked"; break; | ^~~~ drivers/media/v4l2-core/v4l2-ioctl.c:1349:9: note: previously used here 1349 | case V4L2_PIX_FMT_YUYV64_12: descr = "12-bit Depth YUYV 4:2:2"; break; | ^~~~
Quoted 2 lines
Regards,
Mirela
Hi Mirela,
Would you please double check it?
The format V4L2_PIX_FMT_Y212 was added by the first version of this patchset, and it should be replaced byV4L2_PIX_FMT_YUYV64_12 in this v3 patchset.
And I checked my patch, and my local environment, I didn't found any V4L2_PIX_FMT_Y212, and I didn't meet this build error
Ming
Quoted 4 lines
include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 623
Quoted 3 lines
include/uapi/linux/videodev2.h +0
-0/* two planes -- one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2')/* 12 Y/CbCr 4:2:0 */
Re: [PATCH v3 03/10] media: Add YUYV64_12 video format
Hi Ming,
Quoted 159 lines · Ming Qian
Quoted 156 lines
From: Mirela Rabulea (OSS) <[email protected]>
Sent: 2023年2月19日 5:52
To: Ming Qian <[email protected]>; [email protected]; hverkuil- [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; X.H. Bao <[email protected]>; dl-linux-imx <linux- [email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 03/10] media: AddYUYV64_12video formatHi,
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst components horizontally by 2, storing 2 pixels in 4
Quoted 20 lines · Ming Qian
YUYV64_12is a YUV format with 12-bits per component like YUYV, expanded to 16bits.
Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order.Signed-off-by Ming Qian <[email protected]>--- .../media/v4l/pixfmt-packed-yuv.rst | 42 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-common.c | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 4 files changed, 45 insertions(+)diff --git
a/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rstb/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rstindexbf283a1b5581..76fc331f126e100644Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst +0
-0@@ -341,6 +341,48 @@ components horizontally by 2, storing 2 pixels in 4bytes.
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst components horizontally by 2, storing 2 pixels in 4 bytes.
Quoted 4 lines
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst +1
-0\normalsize +The next lists the packed YUV 4:2:2 formats with more than 8 bits percomponent.
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst components horizontally by 2, storing 2 pixels in 4 · line 345
Quoted 2 lines
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst +2
-0+expand the bits per component to 16 bits, data in the high bits, +zeros in the low bits, arranged in little endian order. storing 2 pixels in 8bytes.
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst components horizontally by 2, storing 2 pixels in 4 bytes.
Quoted 7 lines
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst +6
-0+ +.. raw:: latex + + \footnotesize + +.. tabularcolumns::+|p{3.4cm}|p{1.2cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8
drivers/media/v4l2-core/v4l2-common.c const struct v4l2_format_info
Quoted 43 lines
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst +34
-0+cm}|p{0.8cm}|p{0.8cm}| + +.. flat-table:: Packed YUV 4:2:2 Formats (more than 8bpc) + :header-rows: 1 + :stub-columns: 0 + + * - Identifier + - Code + - Byte 1-0 + - Byte 3-2 + - Byte 5-4 + - Byte 7-6 + - Byte 9-8 + - Byte 11-10 + - Byte 13-12 + - Byte 15-14 + * .. _V4L2-PIX-FMT-YUYV64-12: + + - ``V4L2_PIX_FMT_YUYV64_12`` + - 'Y212' + + - Y'\ :sub:`0` + - Cb\ :sub:`0` + - Y'\ :sub:`1` + - Cr\ :sub:`0` + - Y'\ :sub:`2` + - Cb\ :sub:`2` + - Y'\ :sub:`3` + - Cr\ :sub:`2` + +.. raw:: latex + + \normalsize + **Color Sample Location:** Chroma samples are :ref:`interstitially sited<yuv-chroma-centered>` horizontally.drivers/media/v4l2-core/v4l2-common.c +0
-0@@ -258,6 +258,7 @@ const struct v4l2_format_info*v4l2_format_info(u32 format)
drivers/media/v4l2-core/v4l2-common.c const struct v4l2_format_info · line 258
Quoted 1 line
drivers/media/v4l2-core/v4l2-common.c +0
-0{ .format = V4L2_PIX_FMT_YVYU, .pixel_enc =
V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 },drivers/media/v4l2-core/v4l2-common.c const struct v4l2_format_info · line 259
Quoted 1 line
drivers/media/v4l2-core/v4l2-common.c +0
-0{ .format = V4L2_PIX_FMT_UYVY, .pixel_enc =
V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 },drivers/media/v4l2-core/v4l2-common.c const struct v4l2_format_info · line 260
Quoted 1 line
drivers/media/v4l2-core/v4l2-common.c +0
-0{ .format = V4L2_PIX_FMT_VYUY, .pixel_enc =
V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 },drivers/media/v4l2-core/v4l2-common.c const struct v4l2_format_info
Quoted 6 lines
drivers/media/v4l2-core/v4l2-common.c +3
-0+ { .format = V4L2_PIX_FMT_YUYV64_12, .pixel_enc = +V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, +0, 0 }, .hdiv = 2, .vdiv = 1 }, /* YUV planar formats */ { .format = V4L2_PIX_FMT_NV12, .pixel_enc =
V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2 },drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc
Quoted 6 lines
drivers/media/v4l2-core/v4l2-ioctl.c +0
-0@@ -1343,6 +1343,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc*fmt)
drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc · line 1344
Quoted 2 lines
drivers/media/v4l2-core/v4l2-ioctl.c +0
-0case V4L2_PIX_FMT_YUV420 : descr ="Planar YUV 4:2:0" ;break ;case V4L2_PIX_FMT_HI240 : descr ="8-bit Dithered RGB (BTTV)" ;break;
drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc · line 1345
Quoted 1 line
drivers/media/v4l2-core/v4l2-ioctl.c +0
-0case V4L2_PIX_FMT_M420 : descr ="YUV 4:2:0 (M420)" ;break;
drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc · line 1346
Quoted 1 line
drivers/media/v4l2-core/v4l2-ioctl.c +1
-0+ case V4L2_PIX_FMT_YUYV64_12: descr = "12-bit Depth YUYV4:2:2"; break;
include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 618
Quoted 10 lines
drivers/media/v4l2-core/v4l2-ioctl.c +0
-0case V4L2_PIX_FMT_NV12 : descr ="Y/UV 4:2:0" ;break ;case V4L2_PIX_FMT_NV21 : descr ="Y/VU 4:2:0" ;break ;case V4L2_PIX_FMT_NV16 : descr ="Y/UV 4:2:2" ;break ;(quoted diff) +0
-0
b/include/uapi/linux/videodev2.hindex3d8f89bff33c..3712a36d6fdf100644include/uapi/linux/videodev2.h +0
-0@@ -618,6 +618,7 @@ struct v4l2_pix_format {#define V4L2_PIX_FMT_YUVA32 v4l2_fourcc('Y', 'U', 'V', 'A')/* 32 YUVA-8- 8-8-8 */
include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 619
Quoted 1 line
include/uapi/linux/videodev2.h +0
-0#define V4L2_PIX_FMT_YUVX32 v4l2_fourcc('Y', 'U', 'V', 'X')/* 32 YUVX-8- 8-8-8 */
include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 620
Quoted 1 line
include/uapi/linux/videodev2.h +0
-0#define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0')/* 12 YUV 4:2:0 2 lines y, 1 line uv interleaved */
include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 621
Quoted 1 line
include/uapi/linux/videodev2.h +1
-0+#define V4L2_PIX_FMT_YUYV64_12 v4l2_fourcc('Y', '2', '1', '2')/* 32 YUYV 12-bit per component */
It seems Y212 is already added with the same fourcc code, causing build errors:
drivers/media/v4l2-core/v4l2-ioctl.c: In function ‘v4l_fill_fmtdesc’:drivers/media/v4l2-core/v4l2-ioctl.c:1455:9: error: duplicate case value
1455 | caseV4L2_PIX_FMT_Y212: descr = "12-bit YUYVPacked"; break; | ^~~~ drivers/media/v4l2-core/v4l2-ioctl.c:1349:9: note: previously used here 1349 | case V4L2_PIX_FMT_YUYV64_12: descr = "12-bit Depth YUYV 4:2:2"; break; | ^~~~Quoted 2 lines
Regards,
Mirela
Quoted 7 lines
Hi Mirela,
Would you please double check it?
The formatV4L2_PIX_FMT_Y212was added by the first version of this patchset, and it should be replaced byV4L2_PIX_FMT_YUYV64_12in this v3 patchset.
And I checked my patch, and my local environment, I didn't found anyV4L2_PIX_FMT_Y212, and I didn't meet this build errorMing
I applied the _v3 version of the patches over linux-next, and the build error comes from conflicting definition of the fourcc
#define V4L2_PIX_FMT_YUYV64_12 v4l2_fourcc('Y', '2', '1', '2') /* 32 YUYV 12-bit per component */
with this patch, which adds:
+#define V4L2_PIX_FMT_Y212 v4l2_fourcc('Y', '2', '1', '2') /* 32 YUYV 4:2:2 */
commit 0dc1d7a79a8d13e316d3b168e9fc57e376099c7a
Author: Tomi Valkeinen <[email protected]> Date: Wed Dec 21 11:24:43 2022 +0200
media: Add Y210, Y212 and Y216 formats
Add Y210, Y212 and Y216 formats.
https://patchwork.kernel.org/project/linux-media/patch/[email protected]/
In this case, matching the formats defined in DRM was the stronger argument for the format naming scheme.
Regards,
Mirela
Quoted 5 lines
Quoted 5 lines
include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 623
Quoted 4 lines
include/uapi/linux/videodev2.h +0
-0/* two planes -- one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2')/* 12 Y/CbCr 4:2:0 */
RE: [PATCH v3 03/10] media: Add YUYV64_12 video format
Hi Mirela,
Quoted 227 lines
From: Mirela Rabulea (OSS) <[email protected]>
Sent: 2023年2月21日 5:59
To: Ming Qian <[email protected]>; [email protected]; hverkuil- [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; X.H. Bao <[email protected]>; dl-linux-imx <linux- [email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 03/10] media: AddYUYV64_12video formatHi Ming,
Quoted 147 lines · Ming Qian
Quoted 147 lines
From: Mirela Rabulea (OSS) <[email protected]>
Sent: 2023年2月19日 5:52
To: Ming Qian <[email protected]>; [email protected]; hverkuil- [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; X.H. Bao <[email protected]>; dl-linux-imx <linux- [email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 03/10] media: AddYUYV64_12video formatHi,
Quoted 20 lines · Ming Qian
YUYV64_12is a YUV format with 12-bits per component like YUYV, expanded to 16bits.
Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order.Signed-off-by Ming Qian <[email protected]>--- .../media/v4l/pixfmt-packed-yuv.rst | 42 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-common.c | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 4 files changed, 45 insertions(+)diff --git
a/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rstb/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rstindexbf283a1b5581..76fc331f126e100644Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst +0
-0@@ -341,6 +341,48 @@ components horizontally by 2, storing 2 pixelsQuoted 1 line
in 4
bytes.
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst
Quoted 5 lines
\normalsize
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst +2
-0+The next lists the packed YUV 4:2:2 formats with more than 8 bits +percomponent.
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst
Quoted 3 lines
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst +3
-0+expand the bits per component to 16 bits, data in the high bits, +zeros in the low bits, arranged in little endian order. storing 2 +pixels in 8bytes.
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst components horizontally by 2, storing 2 pixels in 4 bytes.
Quoted 7 lines
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst +6
-0+ +.. raw:: latex + + \footnotesize + +.. tabularcolumns::+|p{3.4cm}|p{1.2cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0. +|8
drivers/media/v4l2-core/v4l2-common.c const struct v4l2_format_info
Quoted 43 lines
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst +34
-0+cm}|p{0.8cm}|p{0.8cm}| + +.. flat-table:: Packed YUV 4:2:2 Formats (more than 8bpc) + :header-rows: 1 + :stub-columns: 0 + + * - Identifier + - Code + - Byte 1-0 + - Byte 3-2 + - Byte 5-4 + - Byte 7-6 + - Byte 9-8 + - Byte 11-10 + - Byte 13-12 + - Byte 15-14 + * .. _V4L2-PIX-FMT-YUYV64-12: + + - ``V4L2_PIX_FMT_YUYV64_12`` + - 'Y212' + + - Y'\ :sub:`0` + - Cb\ :sub:`0` + - Y'\ :sub:`1` + - Cr\ :sub:`0` + - Y'\ :sub:`2` + - Cb\ :sub:`2` + - Y'\ :sub:`3` + - Cr\ :sub:`2` + +.. raw:: latex + + \normalsize + **Color Sample Location:** Chroma samples are :ref:`interstitially sited<yuv-chroma-centered>` horizontally.drivers/media/v4l2-core/v4l2-common.c +0
-0@@ -258,6 +258,7 @@ const struct v4l2_format_info*v4l2_format_info(u32 format)
drivers/media/v4l2-core/v4l2-common.c const struct v4l2_format_info · line 258
Quoted 1 line
drivers/media/v4l2-core/v4l2-common.c +0
-0{ .format = V4L2_PIX_FMT_YVYU, .pixel_enc =
V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0,
0 }, .hdiv = 2, .vdiv = 1 },drivers/media/v4l2-core/v4l2-common.c const struct v4l2_format_info · line 259
Quoted 1 line
drivers/media/v4l2-core/v4l2-common.c +0
-0{ .format = V4L2_PIX_FMT_UYVY, .pixel_enc =
V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0,
0 }, .hdiv = 2, .vdiv = 1 },drivers/media/v4l2-core/v4l2-common.c const struct v4l2_format_info · line 260
Quoted 1 line
drivers/media/v4l2-core/v4l2-common.c +0
-0{ .format = V4L2_PIX_FMT_VYUY, .pixel_enc =
V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0,
0 }, .hdiv = 2, .vdiv = 1 },drivers/media/v4l2-core/v4l2-common.c const struct v4l2_format_info
Quoted 6 lines
drivers/media/v4l2-core/v4l2-common.c +3
-0+ { .format = V4L2_PIX_FMT_YUYV64_12, .pixel_enc = +V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, +0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, /* YUV planar formats */ { .format = V4L2_PIX_FMT_NV12, .pixel_enc =
V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0,
0 }, .hdiv = 2, .vdiv = 2 },Quoted 7 lines
drivers/media/v4l2-core/v4l2-ioctl.c +0
-0@@ -1343,6 +1343,7 @@ static void v4l_fill_fmtdesc(struct
v4l2_fmtdesc*fmt)
Quoted 2 lines
case V4L2_PIX_FMT_YUV420: descr = "Planar YUV 4:2:0"; break; case V4L2_PIX_FMT_HI240: descr = "8-bit Dithered RGB (BTTV)";break;
Quoted 1 line
case V4L2_PIX_FMT_M420: descr = "YUV 4:2:0 (M420)";break;
drivers/media/v4l2-core/v4l2-ioctl.c
Quoted 1 line
drivers/media/v4l2-core/v4l2-ioctl.c +1
-0+ case V4L2_PIX_FMT_YUYV64_12: descr = "12-bit Depth YUYV4:2:2"; break;
Quoted 11 lines
case V4L2_PIX_FMT_NV12: descr = "Y/UV 4:2:0"; break; case V4L2_PIX_FMT_NV21: descr = "Y/VU 4:2:0"; break; case V4L2_PIX_FMT_NV16: descr = "Y/UV 4:2:2"; break;(quoted diff) +0
-0
b/include/uapi/linux/videodev2.hindex3d8f89bff33c..3712a36d6fdf100644include/uapi/linux/videodev2.h +0
-0@@ -618,6 +618,7 @@ struct v4l2_pix_format {#define V4L2_PIX_FMT_YUVA32 v4l2_fourcc('Y', 'U', 'V', 'A')/* 32 YUVA-8-
8-8-8 */
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
#define V4L2_PIX_FMT_YUVX32 v4l2_fourcc('Y', 'U', 'V', 'X') /*32 YUVX-8-
8-8-8 */
Quoted 1 line
#define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0') /* 12 YUV4:2:0
Quoted 2 lines
Quoted 2 lines
2 lines y, 1 line uv interleaved */
Quoted 1 line
+#define
V4L2_PIX_FMT_YUYV64_12v4l2_fourcc('Y', '2', '1', '2')/* 32YUYV
Quoted 27 lines
Quoted 16 lines
12-bit per component */
It seems Y212 is already added with the same fourcc code, causing build
errors:
drivers/media/v4l2-core/v4l2-ioctl.c: In function ‘v4l_fill_fmtdesc’:drivers/media/v4l2-core/v4l2-ioctl.c:1455:9: error: duplicate case value
1455 | caseV4L2_PIX_FMT_Y212: descr = "12-bit YUYVPacked"; break; | ^~~~ drivers/media/v4l2-core/v4l2-ioctl.c:1349:9: note: previously used here 1349 | case V4L2_PIX_FMT_YUYV64_12: descr = "12-bit Depth YUYV 4:2:2"; break; | ^~~~Quoted 2 lines
Regards,
MirelaHi Mirela,
Would you please double check it?
The formatV4L2_PIX_FMT_Y212was added by the first version of
this patchset, and it should be replaced byV4L2_PIX_FMT_YUYV64_12in this v3 patchset.
And I checked my patch, and my local environment, I didn't found
anyV4L2_PIX_FMT_Y212, and I didn't meet this build errorQuoted 1 line
Ming
I applied the
_v3version of the patches over linux-next, and the build error comes from conflicting definition of the fourcc
#defineV4L2_PIX_FMT_YUYV64_12v4l2_fourcc('Y', '2', '1', '2')/* 32
YUYV 12-bit per component */with this patch, which adds:
+#defineV4L2_PIX_FMT_Y212v4l2_fourcc('Y', '2', '1', '2')/* 32
YUYV 4:2:2 */commit
0dc1d7a79a8d13e316d3b168e9fc57e376099c7aAuthor: Tomi Valkeinen <[email protected]> Date: Wed Dec 21 11:24:43 2022 +0200media: Add Y210, Y212 and Y216 formats Add Y210, Y212 and Y216 formats. Signed-off-by: Tomi Valkeinen<[email protected]>
Reviewed-by: Laurent Pinchart
<[email protected]>Acked-by Hans Verkuil <[email protected]>Signed-off-by Laurent Pincharthttps://patchwork.kernel.org/project/linux-
media/patch/20221219140139.294245-3-
[email protected]/
Quoted 6 lines
In this case, matching the formats defined in DRM was the stronger argument for the format naming scheme.
Regards,
Mirela
Thanks for your comment, I got it, I was working on media_tree, and this patch is not included yet. As the format V4L2_PIX_FMT_Y212 is added, we can use it directly and drop V4L2_PIX_FMT_YUYV64_12.
I will prepare the v4 patch set that drop this patch and apply V4L2_PIX_FMT_Y212 directly after the Y212 patch in merged to media_tree.
Ming
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
/* two planes -- one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr4:2:0 */
PATCH v3 4/10 media: Add YUV48_12 video format
In reply to Ming QianYUV48_12 is a YUV format with 12-bits per component like YUV24, expanded to 16bits.
Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order.
--- .../media/v4l/pixfmt-packed-yuv.rst | 28 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-common.c | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 4 files changed, 31 insertions(+)
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst +28 -0
@@ -257,6 +257,34 @@ the second byte and Y'\ :sub:`7-0` in the third byte. - The padding bits contain undefined values that must be ignored by all applications and drivers. +The next lists the packed YUV 4:4:4 formats with more than 8 bits per component. +expand the bits per component to 16 bits, data in the high bits, zeros in the low bits, +arranged in little endian order. storing 1 pixels in 6 bytes. + +.. flat-table:: Packed YUV 4:4:4 Image Formats (more than 8bpc) + :header-rows: 1 + :stub-columns: 0 + + * - Identifier + - Code + - Byte 1-0 + - Byte 3-2 + - Byte 5-4 + - Byte 7-6 + - Byte 9-8 + - Byte 11-10 + + * .. _V4L2-PIX-FMT-YUV48-12: + + - ``V4L2_PIX_FMT_YUV48_12`` + - 'Y312' + + - Y'\ :sub:`0` + - Cb\ :sub:`0` + - Cr\ :sub:`0` + - Y'\ :sub:`1` + - Cb\ :sub:`1` + - Cr\ :sub:`1` 4:2:2 Subsampling =================
drivers/media/v4l2-core/v4l2-common.c +1 -0
@@ -259,6 +259,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) { .format = V4L2_PIX_FMT_UYVY, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, { .format = V4L2_PIX_FMT_VYUY, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, { .format = V4L2_PIX_FMT_YUYV64_12, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, + { .format = V4L2_PIX_FMT_YUV48_12, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 6, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, /* YUV planar formats */ { .format = V4L2_PIX_FMT_NV12, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2 },
drivers/media/v4l2-core/v4l2-ioctl.c +1 -0
@@ -1344,6 +1344,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_PIX_FMT_HI240 : descr ="8-bit Dithered RGB (BTTV)" ;break ;case V4L2_PIX_FMT_M420 : descr ="YUV 4:2:0 (M420)" ;break ;case V4L2_PIX_FMT_YUYV64_12 : descr ="12-bit Depth YUYV 4:2:2" ;break ; +case V4L2_PIX_FMT_YUV48_12 : descr ="12-bit Depth YUV 4:4:4" ;break ;case V4L2_PIX_FMT_NV12 : descr ="Y/UV 4:2:0" ;break ;case V4L2_PIX_FMT_NV21 : descr ="Y/VU 4:2:0" ;break ;case V4L2_PIX_FMT_NV16 : descr ="Y/UV 4:2:2" ;break ;
include/uapi/linux/videodev2.h +1 -0
@@ -619,6 +619,7 @@ struct v4l2_pix_format {#define V4L2_PIX_FMT_YUVX32 v4l2_fourcc('Y', 'U', 'V', 'X')/* 32 YUVX-8-8-8-8 */ #define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0')/* 12 YUV 4:2:0 2 lines y, 1 line uv interleaved */ #define V4L2_PIX_FMT_YUYV64_12 v4l2_fourcc('Y', '2', '1', '2')/* 32 YUYV 12-bit per component */ +#define V4L2_PIX_FMT_YUV48_12 v4l2_fourcc('Y', '3', '1', '2')/* 48 YUV 4:4:4 12-bit per component */ /* two planes -- one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2')/* 12 Y/CbCr 4:2:0 */
Signature · 1 line
2.38.1
PATCH v3 5/10 media: Add BGR48_12 video format
In reply to Ming QianBGR48_12 is a reversed RGB format with 12 bits per component like BGR24, expanded to 16bits.
Data in the 12 high bits, zeros in the 4 low bits,
arranged in little endian order.
--- .../userspace-api/media/v4l/pixfmt-rgb.rst | 35 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-common.c | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 3 ++ 4 files changed, 40 insertions(+)
Documentation/userspace-api/media/v4l/pixfmt-rgb.rst +35 -0
@@ -763,6 +763,41 @@ nomenclature that instead use the order of components as seen in a 24- or \normalsize +More Than 8 Bits Per Component +============================== + +These formats store an RGB triplet in six or eighth bytes, with more than 8 bits per component. +expand the bits per component to 16 bits, data in the high bits, zeros in the low bits, +arranged in little endian order. + +.. raw:: latex + + \small + +.. flat-table:: RGB Formats With More Than 8 Bits Per Component + :header-rows: 1 + :stub-columns: 0 + + * - Identifier + - Code + - Byte 1-0 + - Byte 3-2 + - Byte 5-4 + - Byte 7-6 + * .. _V4L2-PIX-FMT-BGR48-12: + + - ``V4L2_PIX_FMT_BGR48_12`` + - 'B312' + + - B\ :sub:`15-4` + - G\ :sub:`15-4` + - R\ :sub:`15-4` + - + +.. raw:: latex + + \normalsize + Deprecated RGB Formats ======================
drivers/media/v4l2-core/v4l2-common.c +1 -0
@@ -252,6 +252,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) { .format = V4L2_PIX_FMT_RGB565, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_RGB555, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_BGR666, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, + { .format = V4L2_PIX_FMT_BGR48_12, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 6, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, /* YUV packed formats */ { .format = V4L2_PIX_FMT_YUYV, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 },
drivers/media/v4l2-core/v4l2-ioctl.c +1 -0
@@ -1299,6 +1299,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_PIX_FMT_BGRX32 : descr ="32-bit XBGR 8-8-8-8" ;break ;case V4L2_PIX_FMT_RGBA32 : descr ="32-bit RGBA 8-8-8-8" ;break ;case V4L2_PIX_FMT_RGBX32 : descr ="32-bit RGBX 8-8-8-8" ;break ; +case V4L2_PIX_FMT_BGR48_12 : descr ="12-bit Depth BGR" ;break ;case V4L2_PIX_FMT_GREY : descr ="8-bit Greyscale" ;break ;case V4L2_PIX_FMT_Y4 : descr ="4-bit Greyscale" ;break ;case V4L2_PIX_FMT_Y6 : descr ="6-bit Greyscale" ;break ;
include/uapi/linux/videodev2.h +3 -0
@@ -577,6 +577,9 @@ struct v4l2_pix_format {#define V4L2_PIX_FMT_ARGB32 v4l2_fourcc('B', 'A', '2', '4')/* 32 ARGB-8-8-8-8 */ #define V4L2_PIX_FMT_XRGB32 v4l2_fourcc('B', 'X', '2', '4')/* 32 XRGB-8-8-8-8 */ +/* RGB formats (6 or 8 bytes per pixel) */ +#define V4L2_PIX_FMT_BGR48_12 v4l2_fourcc('B', '3', '1', '2')/* 48 BGR 12-bit per component */ +/* Grey formats */ #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y')/* 8 Greyscale */ #define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ')/* 4 Greyscale */
Signature · 1 line
2.38.1
PATCH v3 6/10 media: Add ABGR64_12 video format
In reply to Ming QianABGR64_12 is a reversed RGB format with alpha channel last, 12 bits per component like ABGR32,
expanded to 16bits.
Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order.
--- Documentation/userspace-api/media/v4l/pixfmt-rgb.rst | 9 +++++++++ drivers/media/v4l2-core/v4l2-common.c | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 4 files changed, 12 insertions(+)
Documentation/userspace-api/media/v4l/pixfmt-rgb.rst +9 -0
@@ -793,6 +793,15 @@ arranged in little endian order. - G\ :sub:`15-4` - R\ :sub:`15-4` - + * .. _V4L2-PIX-FMT-ABGR64-12: + + - ``V4L2_PIX_FMT_ABGR64_12`` + - 'B412' + + - B\ :sub:`15-4` + - G\ :sub:`15-4` + - R\ :sub:`15-4` + - A\ :sub:`15-4` .. raw:: latex
drivers/media/v4l2-core/v4l2-common.c +1 -0
@@ -253,6 +253,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) { .format = V4L2_PIX_FMT_RGB555, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_BGR666, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_BGR48_12, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 6, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, + { .format = V4L2_PIX_FMT_ABGR64_12, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 8, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, /* YUV packed formats */ { .format = V4L2_PIX_FMT_YUYV, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 },
drivers/media/v4l2-core/v4l2-ioctl.c +1 -0
@@ -1300,6 +1300,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_PIX_FMT_RGBA32 : descr ="32-bit RGBA 8-8-8-8" ;break ;case V4L2_PIX_FMT_RGBX32 : descr ="32-bit RGBX 8-8-8-8" ;break ;case V4L2_PIX_FMT_BGR48_12 : descr ="12-bit Depth BGR" ;break ; +case V4L2_PIX_FMT_ABGR64_12 : descr ="12-bit Depth BGRA" ;break ;case V4L2_PIX_FMT_GREY : descr ="8-bit Greyscale" ;break ;case V4L2_PIX_FMT_Y4 : descr ="4-bit Greyscale" ;break ;case V4L2_PIX_FMT_Y6 : descr ="6-bit Greyscale" ;break ;
include/uapi/linux/videodev2.h +1 -0
@@ -579,6 +579,7 @@ struct v4l2_pix_format {/* RGB formats (6 or 8 bytes per pixel) */ #define V4L2_PIX_FMT_BGR48_12 v4l2_fourcc('B', '3', '1', '2')/* 48 BGR 12-bit per component */ +#define V4L2_PIX_FMT_ABGR64_12 v4l2_fourcc('B', '4', '1', '2')/* 64 BGRA 12-bit per component */ /* Grey formats */ #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y')/* 8 Greyscale */
Signature · 1 line
2.38.1
PATCH v3 7/10 media: imx-jpeg: Refine the function mxc_jpeg_find_format
In reply to Ming Qianremove the unused parameter ctx
--- drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +8 -9
@@ -420,8 +420,7 @@ static int enum_fmt(const struct mxc_jpeg_fmt *mxc_formats, int n,return 0 ; } -static const struct mxc_jpeg_fmt *mxc_jpeg_find_format (struct mxc_jpeg_ctx *ctx, -u32 pixelformat) +static const struct mxc_jpeg_fmt *mxc_jpeg_find_format (u32 pixelformat) {unsigned int k;
@@ -1562,7 +1561,7 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, struct vb2_buffer *vb)if (fourcc ==0 )return -EINVAL ; - jpeg_src_buf->fmt =mxc_jpeg_find_format (ctx, fourcc); + jpeg_src_buf->fmt =mxc_jpeg_find_format (fourcc); jpeg_src_buf->w = header.frame.width; jpeg_src_buf->h = header.frame.height; ctx->header_parsed = true;
@@ -1702,11 +1701,11 @@ static void mxc_jpeg_set_default_params(struct mxc_jpeg_ctx *ctx)int i;if (ctx->mxc_jpeg->mode ==MXC_JPEG_ENCODE ) { - out_q->fmt =mxc_jpeg_find_format (ctx,MXC_JPEG_DEFAULT_PFMT ); - cap_q->fmt =mxc_jpeg_find_format (ctx,V4L2_PIX_FMT_JPEG ); + out_q->fmt =mxc_jpeg_find_format (MXC_JPEG_DEFAULT_PFMT ); + cap_q->fmt =mxc_jpeg_find_format (V4L2_PIX_FMT_JPEG ); }else { - out_q->fmt =mxc_jpeg_find_format (ctx,V4L2_PIX_FMT_JPEG ); - cap_q->fmt =mxc_jpeg_find_format (ctx,MXC_JPEG_DEFAULT_PFMT ); + out_q->fmt =mxc_jpeg_find_format (V4L2_PIX_FMT_JPEG ); + cap_q->fmt =mxc_jpeg_find_format (MXC_JPEG_DEFAULT_PFMT ); }for (i =0 ; i <2 ; i++) {
@@ -1950,7 +1949,7 @@ static int mxc_jpeg_try_fmt(struct v4l2_format *f, pix_mp->height : MXC_JPEG_MAX_HEIGHT;int i; - fmt =mxc_jpeg_find_format (ctx, fourcc); + fmt =mxc_jpeg_find_format (fourcc);if (!fmt || fmt->flags !=mxc_jpeg_get_fmt_type (ctx, f->type)) { dev_warn(ctx->mxc_jpeg->dev, "Format not supported: %c%c%c%c, use the default.\n", (fourcc & 0xff),
@@ -1958,7 +1957,7 @@ static int mxc_jpeg_try_fmt(struct v4l2_format *f, (fourcc >>16 ) &0xff , (fourcc >> 24) & 0xff); fourcc =mxc_jpeg_get_default_fourcc (ctx, f->type); - fmt =mxc_jpeg_find_format (ctx, fourcc); + fmt =mxc_jpeg_find_format (fourcc);if (!fmt)return -EINVAL ; f->fmt.pix_mp.pixelformat = fourcc;
Signature · 1 line
2.38.1
PATCH v3 8/10 media: imx-jpeg: Clear slot next desc ptr if config error
In reply to Ming Qianclear slot next desc ptr if config error,
otherwise codec will report config error interrupt repeatedly, it may led to system hang.
--- drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c | 5 +++++ drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h | 1 + drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 1 + 3 files changed, 7 insertions(+)
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c +5 -0
@@ -178,3 +178,8 @@ void mxc_jpeg_set_desc(u32 desc, void __iomem *reg, int slot)writel (desc |MXC_NXT_DESCPT_EN , reg +MXC_SLOT_OFFSET (slot,SLOT_NXT_DESCPT_PTR )); } + +void mxc_jpeg_clr_desc (void __iomem *reg,int slot) +{ +writel (0 , reg +MXC_SLOT_OFFSET (slot,SLOT_NXT_DESCPT_PTR )); +}
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h +1 -0
@@ -137,6 +137,7 @@ void mxc_jpeg_set_bufsize(struct mxc_jpeg_desc *desc, u32 bufsize);void mxc_jpeg_set_res (struct mxc_jpeg_desc *desc,u16 w,u16 h);void mxc_jpeg_set_line_pitch (struct mxc_jpeg_desc *desc,u32 line_pitch);void mxc_jpeg_set_desc (u32 desc,void __iomem *reg,int slot); +void mxc_jpeg_clr_desc (void __iomem *reg,int slot);void mxc_jpeg_set_regs_from_desc (struct mxc_jpeg_desc *desc,void __iomem *reg);#endif
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +1 -0
@@ -692,6 +692,7 @@ static irqreturn_t mxc_jpeg_dec_irq(int irq, void *priv)u32 ret =readl (reg +CAST_STATUS12 );dev_err (dev,"Encoder/decoder error, status=0x%08x" , ret); +mxc_jpeg_clr_desc (reg, slot);mxc_jpeg_sw_reset (reg); buf_state =VB2_BUF_STATE_ERROR ; goto buffers_done;
Signature · 1 line
2.38.1
PATCH v3 9/10 media: imx-jpeg: Decoder add support for 12bit jpeg
In reply to Ming Qianenable decoding 12-bit extended jpeg
--- .../media/platform/nxp/imx-jpeg/mxc-jpeg.c | 136 +++++++++++++++++- 1 file changed, 134 insertions(+), 2 deletions(-)
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +134 -2
@@ -87,6 +87,20 @@ static const struct mxc_jpeg_fmt mxc_formats[] = { .precision = 8, .is_rgb = 1, }, + { + .name = "BGR 12bit", /*12-bit BGR packed format*/ + .fourcc = V4L2_PIX_FMT_BGR48_12, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_444, + .nc = 3, + .depth = 36, + .mem_planes = 1, + .comp_planes = 1, + .h_align = 3, + .v_align = 3, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + .is_rgb = 1, + }, { .name = "ABGR", /* ABGR packed format */ .fourcc = V4L2_PIX_FMT_ABGR32,
@@ -101,6 +115,20 @@ static const struct mxc_jpeg_fmt mxc_formats[] = { .precision = 8, .is_rgb = 1, }, + { + .name = "ABGR 12bit", /* 12-bit ABGR packed format */ + .fourcc = V4L2_PIX_FMT_ABGR64_12, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_444, + .nc = 4, + .depth = 48, + .mem_planes = 1, + .comp_planes = 1, + .h_align = 3, + .v_align = 3, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + .is_rgb = 1, + }, { .name = "YUV420", /* 1st plane = Y, 2nd plane = UV */ .fourcc = V4L2_PIX_FMT_NV12M,
@@ -127,6 +155,32 @@ static const struct mxc_jpeg_fmt mxc_formats[] = { .flags = MXC_JPEG_FMT_TYPE_RAW, .precision = 8, }, + { + .name = "YUV420 12bit", /* 1st plane = Y, 2nd plane = UV */ + .fourcc = V4L2_PIX_FMT_P012M, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_420, + .nc = 3, + .depth = 18, /* 6 x 12 bits (4Y + UV) for 4 pixels */ + .mem_planes = 2, + .comp_planes = 2, /* 1 plane Y, 1 plane UV interleaved */ + .h_align = 4, + .v_align = 4, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + }, + { + .name = "YUV420 12bit", /* 1st plane = Y, 2nd plane = UV */ + .fourcc = V4L2_PIX_FMT_P012, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_420, + .nc = 3, + .depth = 18, /* 6 x 12 bits (4Y + UV) for 4 pixels */ + .mem_planes = 1, + .comp_planes = 2, /* 1 plane Y, 1 plane UV interleaved */ + .h_align = 4, + .v_align = 4, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + }, { .name = "YUV422", /* YUYV */ .fourcc = V4L2_PIX_FMT_YUYV,
@@ -140,6 +194,19 @@ static const struct mxc_jpeg_fmt mxc_formats[] = { .flags = MXC_JPEG_FMT_TYPE_RAW, .precision = 8, }, + { + .name = "YUV422 12bit", /* YUYV */ + .fourcc = V4L2_PIX_FMT_YUYV64_12, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_422, + .nc = 3, + .depth = 24, + .mem_planes = 1, + .comp_planes = 1, + .h_align = 4, + .v_align = 3, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + }, { .name = "YUV444", /* YUVYUV */ .fourcc = V4L2_PIX_FMT_YUV24,
@@ -153,6 +220,19 @@ static const struct mxc_jpeg_fmt mxc_formats[] = { .flags = MXC_JPEG_FMT_TYPE_RAW, .precision = 8, }, + { + .name = "YUV444 12bit", /* YUVYUV */ + .fourcc = V4L2_PIX_FMT_YUV48_12, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_444, + .nc = 3, + .depth = 36, + .mem_planes = 1, + .comp_planes = 1, + .h_align = 3, + .v_align = 3, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + }, { .name = "Gray", /* Gray (Y8/Y12) or Single Comp */ .fourcc = V4L2_PIX_FMT_GREY,
@@ -166,6 +246,19 @@ static const struct mxc_jpeg_fmt mxc_formats[] = { .flags = MXC_JPEG_FMT_TYPE_RAW, .precision = 8, }, + { + .name = "Gray 12bit", /* Gray (Y8/Y12) or Single Comp */ + .fourcc = V4L2_PIX_FMT_Y012, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY, + .nc = 1, + .depth = 12, + .mem_planes = 1, + .comp_planes = 1, + .h_align = 3, + .v_align = 3, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + }, };#define MXC_JPEG_NUM_FORMATS ARRAY_SIZE(mxc_formats)
@@ -437,17 +530,24 @@ static enum mxc_jpeg_image_format mxc_jpeg_fourcc_to_imgfmt(u32 fourcc) {switch (fourcc) {case V4L2_PIX_FMT_GREY : +case V4L2_PIX_FMT_Y012 :return MXC_JPEG_GRAY ;case V4L2_PIX_FMT_YUYV : +case V4L2_PIX_FMT_YUYV64_12 :return MXC_JPEG_YUV422 ;case V4L2_PIX_FMT_NV12 :case V4L2_PIX_FMT_NV12M : +case V4L2_PIX_FMT_P012 : +case V4L2_PIX_FMT_P012M :return MXC_JPEG_YUV420 ;case V4L2_PIX_FMT_YUV24 : +case V4L2_PIX_FMT_YUV48_12 :return MXC_JPEG_YUV444 ;case V4L2_PIX_FMT_BGR24 : +case V4L2_PIX_FMT_BGR48_12 :return MXC_JPEG_BGR ;case V4L2_PIX_FMT_ABGR32 : +case V4L2_PIX_FMT_ABGR64_12 :return MXC_JPEG_ABGR ;default :return MXC_JPEG_INVALID ;
@@ -483,6 +583,17 @@ static void mxc_jpeg_addrs(struct mxc_jpeg_desc *desc, offset; } +static bool mxc_jpeg_is_extended_sequential (const struct mxc_jpeg_fmt *fmt) +{ +if (!fmt || !(fmt->flags &MXC_JPEG_FMT_TYPE_RAW )) +return false; + +if (fmt->precision >8 ) +return true; + +return false; +} +static void notify_eos (struct mxc_jpeg_ctx *ctx) {const struct v4l2_event ev = {
@@ -767,24 +878,31 @@ static int mxc_jpeg_fixup_sof(struct mxc_jpeg_sof *sof,switch (fourcc) {case V4L2_PIX_FMT_NV12 :case V4L2_PIX_FMT_NV12M : +case V4L2_PIX_FMT_P012 : +case V4L2_PIX_FMT_P012M : sof->components_no =3 ; sof->comp[0 ].v =0x2 ; sof->comp[0 ].h =0x2 ;break ;case V4L2_PIX_FMT_YUYV : +case V4L2_PIX_FMT_YUYV64_12 : sof->components_no =3 ; sof->comp[0 ].v =0x1 ; sof->comp[0 ].h =0x2 ;break ;case V4L2_PIX_FMT_YUV24 : +case V4L2_PIX_FMT_YUV48_12 :case V4L2_PIX_FMT_BGR24 : +case V4L2_PIX_FMT_BGR48_12 :default : sof->components_no =3 ;break ;case V4L2_PIX_FMT_ABGR32 : +case V4L2_PIX_FMT_ABGR64_12 : sof->components_no =4 ;break ;case V4L2_PIX_FMT_GREY : +case V4L2_PIX_FMT_Y012 : sof->components_no =1 ;break ; }
@@ -804,20 +922,27 @@ static int mxc_jpeg_fixup_sos(struct mxc_jpeg_sos *sos,switch (fourcc) {case V4L2_PIX_FMT_NV12 :case V4L2_PIX_FMT_NV12M : +case V4L2_PIX_FMT_P012 : +case V4L2_PIX_FMT_P012M : sos->components_no =3 ;break ;case V4L2_PIX_FMT_YUYV : +case V4L2_PIX_FMT_YUYV64_12 : sos->components_no =3 ;break ;case V4L2_PIX_FMT_YUV24 : +case V4L2_PIX_FMT_YUV48_12 :case V4L2_PIX_FMT_BGR24 : +case V4L2_PIX_FMT_BGR48_12 :default : sos->components_no =3 ;break ;case V4L2_PIX_FMT_ABGR32 : +case V4L2_PIX_FMT_ABGR64_12 : sos->components_no =4 ;break ;case V4L2_PIX_FMT_GREY : +case V4L2_PIX_FMT_Y012 : sos->components_no =1 ;break ; }
@@ -847,12 +972,15 @@ static unsigned int mxc_jpeg_setup_cfg_stream(void *cfg_stream_vaddr,u8 *cfg = (u8 *)cfg_stream_vaddr;struct mxc_jpeg_sof *sof;struct mxc_jpeg_sos *sos; +const struct mxc_jpeg_fmt *fmt =mxc_jpeg_find_format (fourcc); + +if (!fmt) +return 0 ;memcpy (cfg + offset, jpeg_soi,ARRAY_SIZE (jpeg_soi)); offset +=ARRAY_SIZE (jpeg_soi); -if (fourcc ==V4L2_PIX_FMT_BGR24 || - fourcc ==V4L2_PIX_FMT_ABGR32 ) { +if (fmt->is_rgb) {memcpy (cfg + offset, jpeg_app14,sizeof (jpeg_app14)); offset +=sizeof (jpeg_app14); }else {
@@ -918,6 +1046,10 @@ static void mxc_jpeg_config_dec_desc(struct vb2_buffer *out_buf, desc->stm_ctrl &= ~STM_CTRL_IMAGE_FORMAT (0xF );/* clear image format */ desc->stm_ctrl |=STM_CTRL_IMAGE_FORMAT (img_fmt); desc->stm_ctrl |=STM_CTRL_BITBUF_PTR_CLR (1 ); +if (mxc_jpeg_is_extended_sequential (jpeg_src_buf->fmt)) + desc->stm_ctrl |=STM_CTRL_PIXEL_PRECISION ; +else + desc->stm_ctrl &= ~STM_CTRL_PIXEL_PRECISION ; desc->line_pitch = q_data_cap->bytesperline[0 ];mxc_jpeg_addrs (desc, dst_buf, src_buf,0 );mxc_jpeg_set_bufsize (desc,ALIGN (vb2_plane_size (src_buf,0 ),1024 ));
Signature · 1 line
2.38.1
PATCH v3 10/10 media: imx-jpeg: Encoder add support for 12bit jpeg
In reply to Ming Qianenable encoding 12-bit extended jpeg
--- .../media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c | 14 +- .../media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h | 4 +- .../media/platform/nxp/imx-jpeg/mxc-jpeg.c | 172 +++++++++++++++++- 3 files changed, 175 insertions(+), 15 deletions(-)
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c +10 -4
@@ -97,25 +97,31 @@ void mxc_jpeg_sw_reset(void __iomem *reg)writel (GLB_CTRL_SFT_RST , reg +GLB_CTRL ); } -void mxc_jpeg_enc_mode_conf (struct device *dev,void __iomem *reg) +void mxc_jpeg_enc_mode_conf (struct device *dev,void __iomem *reg,u8 extseq) {dev_dbg (dev,"CAST Encoder CONFIG...\n" );/* * "Config_Mode" enabled, "Config_Mode auto clear enabled", */ -writel (0xa0 , reg +CAST_MODE ); +if (extseq) +writel (0xb0 , reg +CAST_MODE ); +else +writel (0xa0 , reg +CAST_MODE );/* all markers and segments */ writel (0x3ff , reg +CAST_CFG_MODE ); } -void mxc_jpeg_enc_mode_go (struct device *dev,void __iomem *reg) +void mxc_jpeg_enc_mode_go (struct device *dev,void __iomem *reg,u8 extseq) {dev_dbg (dev,"CAST Encoder GO...\n" );/* * "GO" enabled, "GO bit auto clear" enabled */ -writel (0x140 , reg +CAST_MODE ); +if (extseq) +writel (0x150 , reg +CAST_MODE ); +else +writel (0x140 , reg +CAST_MODE ); }void mxc_jpeg_enc_set_quality (struct device *dev,void __iomem *reg,u8 quality)
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h +2 -2
@@ -117,8 +117,8 @@ void print_wrapper_info(struct device *dev, void __iomem *reg);void mxc_jpeg_sw_reset (void __iomem *reg);int mxc_jpeg_enable (void __iomem *reg);void wait_frmdone (struct device *dev,void __iomem *reg); -void mxc_jpeg_enc_mode_conf (struct device *dev,void __iomem *reg); -void mxc_jpeg_enc_mode_go (struct device *dev,void __iomem *reg); +void mxc_jpeg_enc_mode_conf (struct device *dev,void __iomem *reg,u8 extseq); +void mxc_jpeg_enc_mode_go (struct device *dev,void __iomem *reg,u8 extseq);void mxc_jpeg_enc_set_quality (struct device *dev,void __iomem *reg,u8 quality);void mxc_jpeg_dec_mode_go (struct device *dev,void __iomem *reg);int mxc_jpeg_get_slot (void __iomem *reg);
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +163 -9
235 lines not on this page · raw message
Signature · 1 line
2.38.1