Skip to content

Commit 72a74c8

Browse files
mingqian-0Hans Verkuil
authored andcommitted
media: add nv12m_8l128 and nv12m_10be_8l128 video format.
nv12m_8l128 is 8-bit tiled nv12 format used by amphion decoder. nv12m_10be_8l128 is 10-bit tiled format used by amphion decoder. The tile size is 8x128 Signed-off-by: Ming Qian <[email protected]> Signed-off-by: Shijie Qin <[email protected]> Signed-off-by: Zhou Peng <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
1 parent 38ad8b3 commit 72a74c8

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ of the luma plane.
257257
.. _V4L2-PIX-FMT-NV12-4L4:
258258
.. _V4L2-PIX-FMT-NV12-16L16:
259259
.. _V4L2-PIX-FMT-NV12-32L32:
260+
.. _V4L2_PIX_FMT_NV12M_8L128:
261+
.. _V4L2_PIX_FMT_NV12M_10BE_8L128:
260262

261263
Tiled NV12
262264
----------
@@ -281,21 +283,41 @@ If the vertical resolution is an odd number of tiles, the last row of
281283
tiles is stored in linear order. The layouts of the luma and chroma
282284
planes are identical.
283285

284-
``V4L2_PIX_FMT_NV12_4L4`` stores pixel in 4x4 tiles, and stores
286+
``V4L2_PIX_FMT_NV12_4L4`` stores pixels in 4x4 tiles, and stores
285287
tiles linearly in memory. The line stride and image height must be
286288
aligned to a multiple of 4. The layouts of the luma and chroma planes are
287289
identical.
288290

289-
``V4L2_PIX_FMT_NV12_16L16`` stores pixel in 16x16 tiles, and stores
291+
``V4L2_PIX_FMT_NV12_16L16`` stores pixels in 16x16 tiles, and stores
290292
tiles linearly in memory. The line stride and image height must be
291293
aligned to a multiple of 16. The layouts of the luma and chroma planes are
292294
identical.
293295

294-
``V4L2_PIX_FMT_NV12_32L32`` stores pixel in 32x32 tiles, and stores
296+
``V4L2_PIX_FMT_NV12_32L32`` stores pixels in 32x32 tiles, and stores
295297
tiles linearly in memory. The line stride and image height must be
296298
aligned to a multiple of 32. The layouts of the luma and chroma planes are
297299
identical.
298300

301+
``V4L2_PIX_FMT_NV12M_8L128`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores
302+
pixels in 2D 8x128 tiles, and stores tiles linearly in memory.
303+
The image height must be aligned to a multiple of 128.
304+
The layouts of the luma and chroma planes are identical.
305+
306+
``V4L2_PIX_FMT_NV12M_10BE_8L128`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores
307+
10 bits pixels in 2D 8x128 tiles, and stores tiles linearly in memory.
308+
the data is arranged in big endian order.
309+
The image height must be aligned to a multiple of 128.
310+
The layouts of the luma and chroma planes are identical.
311+
Note the tile size is 8bytes multiplied by 128 bytes,
312+
it means that the low bits and high bits of one pixel may be in different tiles.
313+
The 10 bit pixels are packed, so 5 bytes contain 4 10-bit pixels layout like
314+
this (for luma):
315+
byte 0: Y0(bits 9-2)
316+
byte 1: Y0(bits 1-0) Y1(bits 9-4)
317+
byte 2: Y1(bits 3-0) Y2(bits 9-6)
318+
byte 3: Y2(bits 5-0) Y3(bits 9-8)
319+
byte 4: Y3(bits 7-0)
320+
299321
``V4L2_PIX_FMT_MM21`` store luma pixel in 16x32 tiles, and chroma pixels
300322
in 16x16 tiles. The line stride must be aligned to a multiple of 16 and the
301323
image height must be aligned to a multiple of 32. The number of luma and chroma

drivers/media/v4l2-core/v4l2-ioctl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,6 +1390,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
13901390
case V4L2_META_FMT_VIVID: descr = "Vivid Metadata"; break;
13911391
case V4L2_META_FMT_RK_ISP1_PARAMS: descr = "Rockchip ISP1 3A Parameters"; break;
13921392
case V4L2_META_FMT_RK_ISP1_STAT_3A: descr = "Rockchip ISP1 3A Statistics"; break;
1393+
case V4L2_PIX_FMT_NV12M_8L128: descr = "NV12M (8x128 Linear)"; break;
1394+
case V4L2_PIX_FMT_NV12M_10BE_8L128: descr = "10-bit NV12M (8x128 Linear, BE)"; break;
13931395

13941396
default:
13951397
/* Compressed formats */

include/uapi/linux/videodev2.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,8 @@ struct v4l2_pix_format {
632632
/* Tiled YUV formats, non contiguous planes */
633633
#define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 tiles */
634634
#define V4L2_PIX_FMT_NV12MT_16X16 v4l2_fourcc('V', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 16x16 tiles */
635+
#define V4L2_PIX_FMT_NV12M_8L128 v4l2_fourcc('N', 'A', '1', '2') /* Y/CbCr 4:2:0 8x128 tiles */
636+
#define V4L2_PIX_FMT_NV12M_10BE_8L128 v4l2_fourcc_be('N', 'T', '1', '2') /* Y/CbCr 4:2:0 10-bit 8x128 tiles */
635637

636638
/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */
637639
#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */

0 commit comments

Comments
 (0)