aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2014-11-17 07:06:42 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-12-01 12:32:27 -0500
commitd5735d64e1cebb3748e64f926fa7c35ffabd7afa (patch)
treea90cef6a47151415473612bee90a4d21c97fec22
parentac61e3787315a50d6e30bee47ab315f098ab0d39 (diff)
[media] videodev2.h: improve colorspace support
Add support for the new AdobeRGB and BT.2020 colorspaces as needed for HDMI 2.0. Add support to specify the Y'CbCr encoding and quantization range explicitly. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--include/uapi/linux/videodev2.h99
1 files changed, 89 insertions, 10 deletions
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 1c2f84fd4d99..ced659e1b9f6 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -178,30 +178,103 @@ enum v4l2_memory {
178 178
179/* see also http://vektor.theorem.ca/graphics/ycbcr/ */ 179/* see also http://vektor.theorem.ca/graphics/ycbcr/ */
180enum v4l2_colorspace { 180enum v4l2_colorspace {
181 /* ITU-R 601 -- broadcast NTSC/PAL */ 181 /* SMPTE 170M: used for broadcast NTSC/PAL SDTV */
182 V4L2_COLORSPACE_SMPTE170M = 1, 182 V4L2_COLORSPACE_SMPTE170M = 1,
183 183
184 /* 1125-Line (US) HDTV */ 184 /* Obsolete pre-1998 SMPTE 240M HDTV standard, superseded by Rec 709 */
185 V4L2_COLORSPACE_SMPTE240M = 2, 185 V4L2_COLORSPACE_SMPTE240M = 2,
186 186
187 /* HD and modern captures. */ 187 /* Rec.709: used for HDTV */
188 V4L2_COLORSPACE_REC709 = 3, 188 V4L2_COLORSPACE_REC709 = 3,
189 189
190 /* broken BT878 extents (601, luma range 16-253 instead of 16-235) */ 190 /*
191 * Deprecated, do not use. No driver will ever return this. This was
192 * based on a misunderstanding of the bt878 datasheet.
193 */
191 V4L2_COLORSPACE_BT878 = 4, 194 V4L2_COLORSPACE_BT878 = 4,
192 195
193 /* These should be useful. Assume 601 extents. */ 196 /*
197 * NTSC 1953 colorspace. This only makes sense when dealing with
198 * really, really old NTSC recordings. Superseded by SMPTE 170M.
199 */
194 V4L2_COLORSPACE_470_SYSTEM_M = 5, 200 V4L2_COLORSPACE_470_SYSTEM_M = 5,
201
202 /*
203 * EBU Tech 3213 PAL/SECAM colorspace. This only makes sense when
204 * dealing with really old PAL/SECAM recordings. Superseded by
205 * SMPTE 170M.
206 */
195 V4L2_COLORSPACE_470_SYSTEM_BG = 6, 207 V4L2_COLORSPACE_470_SYSTEM_BG = 6,
196 208
197 /* I know there will be cameras that send this. So, this is 209 /*
198 * unspecified chromaticities and full 0-255 on each of the 210 * Effectively shorthand for V4L2_COLORSPACE_SRGB, V4L2_YCBCR_ENC_601
199 * Y'CbCr components 211 * and V4L2_QUANTIZATION_FULL_RANGE. To be used for (Motion-)JPEG.
200 */ 212 */
201 V4L2_COLORSPACE_JPEG = 7, 213 V4L2_COLORSPACE_JPEG = 7,
202 214
203 /* For RGB colourspaces, this is probably a good start. */ 215 /* For RGB colorspaces such as produces by most webcams. */
204 V4L2_COLORSPACE_SRGB = 8, 216 V4L2_COLORSPACE_SRGB = 8,
217
218 /* AdobeRGB colorspace */
219 V4L2_COLORSPACE_ADOBERGB = 9,
220
221 /* BT.2020 colorspace, used for UHDTV. */
222 V4L2_COLORSPACE_BT2020 = 10,
223};
224
225enum v4l2_ycbcr_encoding {
226 /*
227 * Mapping of V4L2_YCBCR_ENC_DEFAULT to actual encodings for the
228 * various colorspaces:
229 *
230 * V4L2_COLORSPACE_SMPTE170M, V4L2_COLORSPACE_470_SYSTEM_M,
231 * V4L2_COLORSPACE_470_SYSTEM_BG, V4L2_COLORSPACE_ADOBERGB and
232 * V4L2_COLORSPACE_JPEG: V4L2_YCBCR_ENC_601
233 *
234 * V4L2_COLORSPACE_REC709: V4L2_YCBCR_ENC_709
235 *
236 * V4L2_COLORSPACE_SRGB: V4L2_YCBCR_ENC_SYCC
237 *
238 * V4L2_COLORSPACE_BT2020: V4L2_YCBCR_ENC_BT2020
239 *
240 * V4L2_COLORSPACE_SMPTE240M: V4L2_YCBCR_ENC_SMPTE240M
241 */
242 V4L2_YCBCR_ENC_DEFAULT = 0,
243
244 /* ITU-R 601 -- SDTV */
245 V4L2_YCBCR_ENC_601 = 1,
246
247 /* Rec. 709 -- HDTV */
248 V4L2_YCBCR_ENC_709 = 2,
249
250 /* ITU-R 601/EN 61966-2-4 Extended Gamut -- SDTV */
251 V4L2_YCBCR_ENC_XV601 = 3,
252
253 /* Rec. 709/EN 61966-2-4 Extended Gamut -- HDTV */
254 V4L2_YCBCR_ENC_XV709 = 4,
255
256 /* sYCC (Y'CbCr encoding of sRGB) */
257 V4L2_YCBCR_ENC_SYCC = 5,
258
259 /* BT.2020 Non-constant Luminance Y'CbCr */
260 V4L2_YCBCR_ENC_BT2020 = 6,
261
262 /* BT.2020 Constant Luminance Y'CbcCrc */
263 V4L2_YCBCR_ENC_BT2020_CONST_LUM = 7,
264
265 /* SMPTE 240M -- Obsolete HDTV */
266 V4L2_YCBCR_ENC_SMPTE240M = 8,
267};
268
269enum v4l2_quantization {
270 /*
271 * The default for R'G'B' quantization is always full range. For
272 * Y'CbCr the quantization is always limited range, except for
273 * SYCC, XV601, XV709 or JPEG: those are full range.
274 */
275 V4L2_QUANTIZATION_DEFAULT = 0,
276 V4L2_QUANTIZATION_FULL_RANGE = 1,
277 V4L2_QUANTIZATION_LIM_RANGE = 2,
205}; 278};
206 279
207enum v4l2_priority { 280enum v4l2_priority {
@@ -294,6 +367,8 @@ struct v4l2_pix_format {
294 __u32 colorspace; /* enum v4l2_colorspace */ 367 __u32 colorspace; /* enum v4l2_colorspace */
295 __u32 priv; /* private data, depends on pixelformat */ 368 __u32 priv; /* private data, depends on pixelformat */
296 __u32 flags; /* format flags (V4L2_PIX_FMT_FLAG_*) */ 369 __u32 flags; /* format flags (V4L2_PIX_FMT_FLAG_*) */
370 __u32 ycbcr_enc; /* enum v4l2_ycbcr_encoding */
371 __u32 quantization; /* enum v4l2_quantization */
297}; 372};
298 373
299/* Pixel format FOURCC depth Description */ 374/* Pixel format FOURCC depth Description */
@@ -1777,6 +1852,8 @@ struct v4l2_plane_pix_format {
1777 * @plane_fmt: per-plane information 1852 * @plane_fmt: per-plane information
1778 * @num_planes: number of planes for this format 1853 * @num_planes: number of planes for this format
1779 * @flags: format flags (V4L2_PIX_FMT_FLAG_*) 1854 * @flags: format flags (V4L2_PIX_FMT_FLAG_*)
1855 * @ycbcr_enc: enum v4l2_ycbcr_encoding, Y'CbCr encoding
1856 * @quantization: enum v4l2_quantization, colorspace quantization
1780 */ 1857 */
1781struct v4l2_pix_format_mplane { 1858struct v4l2_pix_format_mplane {
1782 __u32 width; 1859 __u32 width;
@@ -1788,7 +1865,9 @@ struct v4l2_pix_format_mplane {
1788 struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES]; 1865 struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES];
1789 __u8 num_planes; 1866 __u8 num_planes;
1790 __u8 flags; 1867 __u8 flags;
1791 __u8 reserved[10]; 1868 __u8 ycbcr_enc;
1869 __u8 quantization;
1870 __u8 reserved[8];
1792} __attribute__ ((packed)); 1871} __attribute__ ((packed));
1793 1872
1794/** 1873/**