diff mbox series

[3/9] media: v4l2: Introduce compressed pixel encoding definition and helper

Message ID 20230324151228.2778112-4-paul.kocialkowski@bootlin.com
State New
Headers show
Series media: sun6i-csi/isp: Implement MC I/O support | expand

Commit Message

Paul Kocialkowski March 24, 2023, 3:12 p.m. UTC
Some pixel formats (such as JPEG) have their data compressed and
encoded in a specific way, which is not directly YUV, RGB or Bayer.

Add a new definition and helper for compressed pixel encoding to
represent this situation.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
---
 include/media/v4l2-common.h | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 1bdaea248089..37554bc10e2a 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -465,12 +465,14 @@  int v4l2_s_parm_cap(struct video_device *vdev,
  * @V4L2_PIXEL_ENC_YUV:		Pixel encoding is YUV
  * @V4L2_PIXEL_ENC_RGB:		Pixel encoding is RGB
  * @V4L2_PIXEL_ENC_BAYER:	Pixel encoding is Bayer
+ * @V4L2_PIXEL_ENC_COMPRESSED:	Pixel encoding is compressed
  */
 enum v4l2_pixel_encoding {
 	V4L2_PIXEL_ENC_UNKNOWN = 0,
 	V4L2_PIXEL_ENC_YUV = 1,
 	V4L2_PIXEL_ENC_RGB = 2,
 	V4L2_PIXEL_ENC_BAYER = 3,
+	V4L2_PIXEL_ENC_COMPRESSED = 4,
 };
 
 /**
@@ -512,6 +514,11 @@  static inline bool v4l2_is_format_bayer(const struct v4l2_format_info *f)
 	return f && f->pixel_enc == V4L2_PIXEL_ENC_BAYER;
 }
 
+static inline bool v4l2_is_format_compressed(const struct v4l2_format_info *f)
+{
+	return f && f->pixel_enc == V4L2_PIXEL_ENC_COMPRESSED;
+}
+
 const struct v4l2_format_info *v4l2_format_info(u32 format);
 void v4l2_apply_frmsize_constraints(u32 *width, u32 *height,
 				    const struct v4l2_frmsize_stepwise *frmsize);