+ +
2da5fe7 OpenAVX v0.2.0 - High-performance open-standard IP audio and video transport suite
saifmukhtar · 2026-11-24
c · 119 lines · 4.8 KB · SPDX: MIT
main
1 /* Simple Plugin API */
2 /* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
3 /* SPDX-License-Identifier: MIT */
4  
5 #ifndef SPA_VIDEO_COLOR_H
6 #define SPA_VIDEO_COLOR_H
7  
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11  
12 /**
13 * \addtogroup spa_param
14 * \{
15 */
16  
17 /**
18 * Possible color range values. These constants are defined for 8 bit color
19 * values and can be scaled for other bit depths.
20 */
21 enum spa_video_color_range {
22 SPA_VIDEO_COLOR_RANGE_UNKNOWN = 0, /**< unknown range */
23 SPA_VIDEO_COLOR_RANGE_0_255, /**< [0..255] for 8 bit components */
24 SPA_VIDEO_COLOR_RANGE_16_235 /**< [16..235] for 8 bit components. Chroma has
25 [16..240] range. */
26 };
27  
28 /**
29 * The color matrix is used to convert between Y'PbPr and
30 * non-linear RGB (R'G'B')
31 */
32 enum spa_video_color_matrix {
33 SPA_VIDEO_COLOR_MATRIX_UNKNOWN = 0, /**< unknown matrix */
34 SPA_VIDEO_COLOR_MATRIX_RGB, /**< identity matrix */
35 SPA_VIDEO_COLOR_MATRIX_FCC, /**< FCC color matrix */
36 SPA_VIDEO_COLOR_MATRIX_BT709, /**< ITU BT.709 color matrix */
37 SPA_VIDEO_COLOR_MATRIX_BT601, /**< ITU BT.601 color matrix */
38 SPA_VIDEO_COLOR_MATRIX_SMPTE240M, /**< SMTPE 240M color matrix */
39 SPA_VIDEO_COLOR_MATRIX_BT2020, /**< ITU-R BT.2020 color matrix */
40 };
41  
42 /**
43 * The video transfer function defines the formula for converting between
44 * non-linear RGB (R'G'B') and linear RGB
45 */
46 enum spa_video_transfer_function {
47 SPA_VIDEO_TRANSFER_UNKNOWN = 0, /**< unknown transfer function */
48 SPA_VIDEO_TRANSFER_GAMMA10, /**< linear RGB, gamma 1.0 curve */
49 SPA_VIDEO_TRANSFER_GAMMA18, /**< Gamma 1.8 curve */
50 SPA_VIDEO_TRANSFER_GAMMA20, /**< Gamma 2.0 curve */
51 SPA_VIDEO_TRANSFER_GAMMA22, /**< Gamma 2.2 curve */
52 SPA_VIDEO_TRANSFER_BT709, /**< Gamma 2.2 curve with a linear segment in the lower range */
53 SPA_VIDEO_TRANSFER_SMPTE240M, /**< Gamma 2.2 curve with a linear segment in the lower range */
54 SPA_VIDEO_TRANSFER_SRGB, /**< Gamma 2.4 curve with a linear segment in the lower range */
55 SPA_VIDEO_TRANSFER_GAMMA28, /**< Gamma 2.8 curve */
56 SPA_VIDEO_TRANSFER_LOG100, /**< Logarithmic transfer characteristic 100:1 range */
57 SPA_VIDEO_TRANSFER_LOG316, /**< Logarithmic transfer characteristic 316.22777:1 range */
58 SPA_VIDEO_TRANSFER_BT2020_12, /**< Gamma 2.2 curve with a linear segment in the lower
59 * range. Used for BT.2020 with 12 bits per
60 * component */
61 SPA_VIDEO_TRANSFER_ADOBERGB, /**< Gamma 2.19921875 */
62 SPA_VIDEO_TRANSFER_BT2020_10, /**< Rec. ITU-R BT.2020-2 with 10 bits per component.
63 * (functionally the same as the values
64 * SPA_VIDEO_TRANSFER_BT709 and SPA_VIDEO_TRANSFER_BT601) */
65 SPA_VIDEO_TRANSFER_SMPTE2084, /**< SMPTE ST 2084 for 10, 12, 14, and 16-bit systems.
66 * Known as perceptual quantization (PQ) */
67 SPA_VIDEO_TRANSFER_ARIB_STD_B67,/**< Association of Radio Industries and Businesses (ARIB)
68 * STD-B67 and Rec. ITU-R BT.2100-1 hybrid loggamma (HLG) system */
69 SPA_VIDEO_TRANSFER_BT601, /**< also known as SMPTE170M / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
70 * Functionally the same as the values
71 * SPA_VIDEO_TRANSFER_BT709, and SPA_VIDEO_TRANSFER_BT2020_10 */
72 };
73  
74 /**
75 * The color primaries define the how to transform linear RGB values to and from
76 * the CIE XYZ colorspace.
77 */
78 enum spa_video_color_primaries {
79 SPA_VIDEO_COLOR_PRIMARIES_UNKNOWN = 0, /**< unknown color primaries */
80 SPA_VIDEO_COLOR_PRIMARIES_BT709, /**< BT709 primaries */
81 SPA_VIDEO_COLOR_PRIMARIES_BT470M, /**< BT470M primaries */
82 SPA_VIDEO_COLOR_PRIMARIES_BT470BG, /**< BT470BG primaries */
83 SPA_VIDEO_COLOR_PRIMARIES_SMPTE170M, /**< SMPTE170M primaries */
84 SPA_VIDEO_COLOR_PRIMARIES_SMPTE240M, /**< SMPTE240M primaries */
85 SPA_VIDEO_COLOR_PRIMARIES_FILM, /**< Generic film */
86 SPA_VIDEO_COLOR_PRIMARIES_BT2020, /**< BT2020 primaries */
87 SPA_VIDEO_COLOR_PRIMARIES_ADOBERGB, /**< Adobe RGB primaries */
88 SPA_VIDEO_COLOR_PRIMARIES_SMPTEST428, /**< SMPTE ST 428 primaries (CIE 1931 XYZ) */
89 SPA_VIDEO_COLOR_PRIMARIES_SMPTERP431, /**< SMPTE RP 431 primaries (ST 431-2 (2011) / DCI P3) */
90 SPA_VIDEO_COLOR_PRIMARIES_SMPTEEG432, /**< SMPTE EG 432 primaries (ST 432-1 (2010) / P3 D65) */
91 SPA_VIDEO_COLOR_PRIMARIES_EBU3213, /**< EBU 3213 primaries (JEDEC P22 phosphors) */
92 };
93  
94 /**
95 * spa_video_colorimetry:
96 *
97 * Structure describing the color info.
98 */
99 struct spa_video_colorimetry {
100 enum spa_video_color_range range; /**< The color range. This is the valid range for the
101 * samples. It is used to convert the samples to Y'PbPr
102 * values. */
103 enum spa_video_color_matrix matrix; /**< the color matrix. Used to convert between Y'PbPr and
104 * non-linear RGB (R'G'B') */
105 enum spa_video_transfer_function transfer; /**< The transfer function. Used to convert between
106 * R'G'B' and RGB */
107 enum spa_video_color_primaries primaries; /**< Color primaries. Used to convert between R'G'B'
108 * and CIE XYZ */
109 };
110  
111 /**
112 * \}
113 */
114  
115 #ifdef __cplusplus
116 } /* extern "C" */
117 #endif
118  
119 #endif /* SPA_VIDEO_COLOR_H */