mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
92 lines
4.8 KiB
Diff
92 lines
4.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jonas Karlman <jonas@kwiboo.se>
|
|
Date: Mon, 6 Jul 2020 21:54:36 +0000
|
|
Subject: [PATCH] media: v4l2: Add NV15 and NV20 pixel formats
|
|
|
|
Add NV15 and NV20 pixel formats used by the Rockchip Video Decoder for
|
|
10-bit buffers.
|
|
|
|
NV15 and NV20 is a packed 10-bit 4:2:0/4:2:2 semi-planar Y/UV format
|
|
similar to P010 and P210 but has no padding between components. Instead,
|
|
luminance and chrominance samples are grouped into 4s so that each group is
|
|
packed into an integer number of bytes:
|
|
|
|
YYYY = UVUV = 4 * 10 bits = 40 bits = 5 bytes
|
|
|
|
The '15' and '20' suffix refers to the optimum effective bits per pixel
|
|
which is achieved when the total number of luminance samples is a multiple
|
|
of 8 for NV15 and 4 for NV20.
|
|
|
|
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
|
---
|
|
drivers/media/v4l2-core/v4l2-common.c | 3 +++
|
|
drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++
|
|
include/uapi/linux/videodev2.h | 3 +++
|
|
3 files changed, 8 insertions(+)
|
|
|
|
diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
|
|
index cb2f1acab7cf..8446a1deffd8 100644
|
|
--- a/drivers/media/v4l2-core/v4l2-common.c
|
|
+++ b/drivers/media/v4l2-core/v4l2-common.c
|
|
@@ -268,6 +268,9 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
|
|
{ .format = V4L2_PIX_FMT_NV42, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .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 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 2, .vdiv = 1 },
|
|
|
|
+ { .format = V4L2_PIX_FMT_NV15, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 5, 5, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 2, .vdiv = 2, .block_w = { 4, 2, 0, 0 }, .block_h = { 1, 1, 0, 0 } },
|
|
+ { .format = V4L2_PIX_FMT_NV20, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 5, 5, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 2, .vdiv = 1, .block_w = { 4, 2, 0, 0 }, .block_h = { 1, 1, 0, 0 } },
|
|
+
|
|
{ .format = V4L2_PIX_FMT_YUV410, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .bpp_div = { 1, 1, 1, 1 }, .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 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 4, .vdiv = 4 },
|
|
{ .format = V4L2_PIX_FMT_YUV411P, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 4, .vdiv = 1 },
|
|
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
|
|
index 01e630f2ec78..cea44992aea3 100644
|
|
--- a/include/uapi/linux/videodev2.h
|
|
+++ b/include/uapi/linux/videodev2.h
|
|
@@ -628,6 +628,9 @@ struct v4l2_pix_format {
|
|
#define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/VU 4:4:4 */
|
|
#define V4L2_PIX_FMT_P010 v4l2_fourcc('P', '0', '1', '0') /* 24 Y/UV 4:2:0 10-bit per component */
|
|
|
|
+#define V4L2_PIX_FMT_NV15 v4l2_fourcc('N', 'V', '1', '5') /* 15 Y/UV 4:2:0 10-bit packed */
|
|
+#define V4L2_PIX_FMT_NV20 v4l2_fourcc('N', 'V', '2', '0') /* 20 Y/UV 4:2:2 10-bit packed */
|
|
+
|
|
/* two non contiguous planes - one Y, one Cr + Cb interleaved */
|
|
#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/UV 4:2:0 */
|
|
#define V4L2_PIX_FMT_NV21M v4l2_fourcc('N', 'M', '2', '1') /* 21 Y/VU 4:2:0 */
|
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jonas Karlman <jonas@kwiboo.se>
|
|
Date: Mon, 6 Jul 2020 21:54:37 +0000
|
|
Subject: [PATCH] media: rkvdec: Extract rkvdec_fill_decoded_pixfmt helper
|
|
method
|
|
|
|
This extract setting decoded pixfmt into a helper method, current code is
|
|
replaced with a call to the new helper method.
|
|
|
|
The helper method is also called from a new function in next patch.
|
|
|
|
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
|
---
|
|
drivers/staging/media/rkvdec/rkvdec.c | 29 ++++++++++++++-------------
|
|
1 file changed, 15 insertions(+), 14 deletions(-)
|
|
|
|
diff --git a/drivers/staging/media/rkvdec/rkvdec.h b/drivers/staging/media/rkvdec/rkvdec.h
|
|
index 633335ebb9c4..b9e219438bc9 100644
|
|
--- a/drivers/staging/media/rkvdec/rkvdec.h
|
|
+++ b/drivers/staging/media/rkvdec/rkvdec.h
|
|
@@ -66,6 +66,7 @@ vb2_to_rkvdec_decoded_buf(struct vb2_buffer *buf)
|
|
struct rkvdec_coded_fmt_ops {
|
|
int (*adjust_fmt)(struct rkvdec_ctx *ctx,
|
|
struct v4l2_format *f);
|
|
+ u32 (*valid_fmt)(struct rkvdec_ctx *ctx, struct v4l2_ctrl *ctrl);
|
|
int (*start)(struct rkvdec_ctx *ctx);
|
|
void (*stop)(struct rkvdec_ctx *ctx);
|
|
int (*run)(struct rkvdec_ctx *ctx);
|
|
@@ -101,6 +102,7 @@ struct rkvdec_ctx {
|
|
struct v4l2_fh fh;
|
|
struct v4l2_format coded_fmt;
|
|
struct v4l2_format decoded_fmt;
|
|
+ u32 valid_fmt;
|
|
const struct rkvdec_coded_fmt_desc *coded_fmt_desc;
|
|
struct v4l2_ctrl_handler ctrl_hdl;
|
|
struct rkvdec_dev *dev;
|