History

media: v4l2: add support for colorspace conversion API (CSC) for video capture

For video capture it is the driver that reports the colorspace, transfer function, Y'CbCr/HSV encoding and quantization range used by the video, and there is no way to request something different, even though many HDTV receivers have some sort of colorspace conversion capabilities. For output video this feature already exists since the application specifies this information for the video format it will send out, and the transmitter will enable any available CSC if a format conversion has to be performed in order to match the capabilities of the sink. For video capture we propose adding new v4l2_pix_format flag: V4L2_PIX_FMT_FLAG_SET_CSC. The flag is set by the application, the driver will interpret the colorspace, xfer_func, ycbcr_enc/hsv_enc and quantization fields as the requested colorspace information and will attempt to do the conversion it supports. Drivers set the flags V4L2_FMT_FLAG_CSC_COLORSPACE, V4L2_FMT_FLAG_CSC_XFER_FUNC, V4L2_FMT_FLAG_CSC_YCBCR_ENC/V4L2_FMT_FLAG_CSC_HSV_ENC, V4L2_FMT_FLAG_CSC_QUANTIZATION, in the flags field of the struct v4l2_fmtdesc during enumeration to indicate that they support colorspace conversion for the respective field. Drivers do not have to actually look at the flags. If the flags are not set, then the fields 'colorspace', 'xfer_func', 'ycbcr_enc/hsv_enc', and 'quantization' are set to the default values by the core, i.e. just pass on the received format without conversion.

Dafna Hirschfeld committed 6 years ago

Commit b38c73c1 parent 1698a7f5 files · +109 −17Browse files

Showing the changes to include/uapi (1 of 5 files). Show all

Unified · Split

include/uapi/linux/videodev2.h+6−0
@@ -777,6 +777,7 @@ struct v4l2_pix_format { · 776 unmodified lines
777 777
778/* Flags */778/* Flags */
779#define V4L2_PIX_FMT_FLAG_PREMUL_ALPHA 0x00000001779#define V4L2_PIX_FMT_FLAG_PREMUL_ALPHA 0x00000001
780#define V4L2_PIX_FMT_FLAG_SET_CSC 0x00000002
780 781
781/*782/*
782 * F O R M A T E N U M E R A T I O N783 * F O R M A T E N U M E R A T I O N
@@ -796,6 +797,11 @@ struct v4l2_fmtdesc { · 13 unmodified lines
796#define V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM 0x0004797#define V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM 0x0004
797#define V4L2_FMT_FLAG_DYN_RESOLUTION 0x0008798#define V4L2_FMT_FLAG_DYN_RESOLUTION 0x0008
798#define V4L2_FMT_FLAG_ENC_CAP_FRAME_INTERVAL 0x0010799#define V4L2_FMT_FLAG_ENC_CAP_FRAME_INTERVAL 0x0010
800#define V4L2_FMT_FLAG_CSC_COLORSPACE 0x0020
801#define V4L2_FMT_FLAG_CSC_XFER_FUNC 0x0040
802#define V4L2_FMT_FLAG_CSC_YCBCR_ENC 0x0080
803#define V4L2_FMT_FLAG_CSC_HSV_ENC V4L2_FMT_FLAG_CSC_YCBCR_ENC
804#define V4L2_FMT_FLAG_CSC_QUANTIZATION 0x0100
799 805
800 /* Frame Size and frame rate enumeration */806 /* Frame Size and frame rate enumeration */
801/*807/*

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t