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.
Showing the changes to include/uapi/linux (1 of 1 file). Show all
Unified · Split
| @@ -178,30 +178,103 @@ enum v4l2_memory { · 177 unmodified lines | ||
| 178 | 178 | |
| 179 | 179 | /* see also http://vektor.theorem.ca/graphics/ycbcr/ */ |
| 180 | 180 | enum v4l2_colorspace { |
| 181 | − /* ITU-R 601 -- broadcast NTSC/PAL */ | |
| 181 | + /* SMPTE 170M: used for broadcast NTSC/PAL SDTV */ | |
| 182 | 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 | 185 | V4L2_COLORSPACE_SMPTE240M = 2, |
| 186 | 186 | |
| 187 | − /* HD and modern captures. */ | |
| 187 | + /* Rec.709: used for HDTV */ | |
| 188 | 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 | 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 | 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 | 207 | V4L2_COLORSPACE_470_SYSTEM_BG = 6, |
| 196 | 208 | |
| 197 | − /* I know there will be cameras that send this. So, this is | |
| 198 | − * unspecified chromaticities and full 0-255 on each of the | |
| 199 | − * Y'CbCr components | |
| 209 | + /* | |
| 210 | + * Effectively shorthand for V4L2_COLORSPACE_SRGB, V4L2_YCBCR_ENC_601 | |
| 211 | + * and V4L2_QUANTIZATION_FULL_RANGE. To be used for (Motion-)JPEG. | |
| 200 | 212 | */ |
| 201 | 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 | 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 | + | |
| 225 | +enum 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 | + | |
| 269 | +enum 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 | |
| 207 | 280 | enum v4l2_priority { |
| @@ -294,6 +367,8 @@ struct v4l2_pix_format { · 86 unmodified lines | ||
| 294 | 367 | __u32 colorspace; /* enum v4l2_colorspace */ |
| 295 | 368 | __u32 priv; /* private data, depends on pixelformat */ |
| 296 | 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 | 374 | /* Pixel format FOURCC depth Description */ |
| @@ -1777,6 +1852,8 @@ struct v4l2_plane_pix_format { · 1477 unmodified lines | ||
| 1777 | 1852 | * @plane_fmt: per-plane information |
| 1778 | 1853 | * @num_planes: number of planes for this format |
| 1779 | 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 | */ |
| 1781 | 1858 | struct v4l2_pix_format_mplane { |
| 1782 | 1859 | __u32 width; |
| @@ -1788,7 +1865,9 @@ struct v4l2_pix_format_mplane { · 5 unmodified lines | ||
| 1788 | 1865 | struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES]; |
| 1789 | 1866 | __u8 num_planes; |
| 1790 | 1867 | __u8 flags; |
| 1791 | − __u8 reserved[10]; | |
| 1868 | + __u8 ycbcr_enc; | |
| 1869 | + __u8 quantization; | |
| 1870 | + __u8 reserved[8]; | |
| 1792 | 1871 | } __attribute__ ((packed)); |
| 1793 | 1872 | |
| 1794 | 1873 | /** |