FFmpeg
csp.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Kevin Wheatley <kevin.j.wheatley@gmail.com>
3  * Copyright (c) 2016 Ronald S. Bultje <rsbultje@gmail.com>
4  * Copyright (c) 2023 Leo Izen <leo.izen@gmail.com>
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 /**
24  * @file Colorspace functions for libavutil
25  * @author Ronald S. Bultje <rsbultje@gmail.com>
26  * @author Leo Izen <leo.izen@gmail.com>
27  * @author Kevin Wheatley <kevin.j.wheatley@gmail.com>
28  */
29 
30 #include <stdlib.h>
31 #include <math.h>
32 
33 #include "attributes.h"
34 #include "csp.h"
35 #include "pixfmt.h"
36 #include "rational.h"
37 
38 #define AVR(d) { (int)(d * 100000 + 0.5), 100000 }
39 
40 /*
41  * All constants explained in e.g. https://linuxtv.org/downloads/v4l-dvb-apis/ch02s06.html
42  * The older ones (bt470bg/m) are also explained in their respective ITU docs
43  * (e.g. https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.470-5-199802-S!!PDF-E.pdf)
44  * whereas the newer ones can typically be copied directly from wikipedia :)
45  */
47  [AVCOL_SPC_FCC] = { AVR(0.30), AVR(0.59), AVR(0.11) },
48  [AVCOL_SPC_BT470BG] = { AVR(0.299), AVR(0.587), AVR(0.114) },
49  [AVCOL_SPC_SMPTE170M] = { AVR(0.299), AVR(0.587), AVR(0.114) },
50  [AVCOL_SPC_BT709] = { AVR(0.2126), AVR(0.7152), AVR(0.0722) },
51  [AVCOL_SPC_SMPTE240M] = { AVR(0.212), AVR(0.701), AVR(0.087) },
52  [AVCOL_SPC_YCOCG] = { AVR(0.25), AVR(0.5), AVR(0.25) },
53  [AVCOL_SPC_RGB] = { AVR(1), AVR(1), AVR(1) },
54  [AVCOL_SPC_BT2020_NCL] = { AVR(0.2627), AVR(0.6780), AVR(0.0593) },
55  [AVCOL_SPC_BT2020_CL] = { AVR(0.2627), AVR(0.6780), AVR(0.0593) },
56 };
57 
59 {
60  const AVLumaCoefficients *coeffs;
61 
62  if (csp >= AVCOL_SPC_NB)
63  return NULL;
64  coeffs = &luma_coefficients[csp];
65  if (!coeffs->cr.num)
66  return NULL;
67 
68  return coeffs;
69 }
70 
71 #define WP_D65 { AVR(0.3127), AVR(0.3290) }
72 #define WP_C { AVR(0.3100), AVR(0.3160) }
73 #define WP_DCI { AVR(0.3140), AVR(0.3510) }
74 #define WP_E { {1, 3}, {1, 3} }
75 
77  [AVCOL_PRI_BT709] = { WP_D65, { { AVR(0.640), AVR(0.330) }, { AVR(0.300), AVR(0.600) }, { AVR(0.150), AVR(0.060) } } },
78  [AVCOL_PRI_BT470M] = { WP_C, { { AVR(0.670), AVR(0.330) }, { AVR(0.210), AVR(0.710) }, { AVR(0.140), AVR(0.080) } } },
79  [AVCOL_PRI_BT470BG] = { WP_D65, { { AVR(0.640), AVR(0.330) }, { AVR(0.290), AVR(0.600) }, { AVR(0.150), AVR(0.060) } } },
80  [AVCOL_PRI_SMPTE170M] = { WP_D65, { { AVR(0.630), AVR(0.340) }, { AVR(0.310), AVR(0.595) }, { AVR(0.155), AVR(0.070) } } },
81  [AVCOL_PRI_SMPTE240M] = { WP_D65, { { AVR(0.630), AVR(0.340) }, { AVR(0.310), AVR(0.595) }, { AVR(0.155), AVR(0.070) } } },
82  [AVCOL_PRI_SMPTE428] = { WP_E, { { AVR(0.735), AVR(0.265) }, { AVR(0.274), AVR(0.718) }, { AVR(0.167), AVR(0.009) } } },
83  [AVCOL_PRI_SMPTE431] = { WP_DCI, { { AVR(0.680), AVR(0.320) }, { AVR(0.265), AVR(0.690) }, { AVR(0.150), AVR(0.060) } } },
84  [AVCOL_PRI_SMPTE432] = { WP_D65, { { AVR(0.680), AVR(0.320) }, { AVR(0.265), AVR(0.690) }, { AVR(0.150), AVR(0.060) } } },
85  [AVCOL_PRI_FILM] = { WP_C, { { AVR(0.681), AVR(0.319) }, { AVR(0.243), AVR(0.692) }, { AVR(0.145), AVR(0.049) } } },
86  [AVCOL_PRI_BT2020] = { WP_D65, { { AVR(0.708), AVR(0.292) }, { AVR(0.170), AVR(0.797) }, { AVR(0.131), AVR(0.046) } } },
87  [AVCOL_PRI_JEDEC_P22] = { WP_D65, { { AVR(0.630), AVR(0.340) }, { AVR(0.295), AVR(0.605) }, { AVR(0.155), AVR(0.077) } } },
88 };
89 
91 {
92  const AVColorPrimariesDesc *p;
93 
94  if (prm >= AVCOL_PRI_NB)
95  return NULL;
96  p = &color_primaries[prm];
97  if (!p->prim.r.x.num)
98  return NULL;
99 
100  return p;
101 }
102 
104 {
105  AVRational diff = av_sub_q(r1, r2);
106  /* denominator assumed to be positive */
107  return av_make_q(abs(diff.num), diff.den);
108 }
109 
111 {
113 
114  for (enum AVColorPrimaries p = 0; p < AVCOL_PRI_NB; p++) {
116  if (!ref->prim.r.x.num)
117  continue;
118 
119  delta = abs_sub_q(prm->prim.r.x, ref->prim.r.x);
120  delta = av_add_q(delta, abs_sub_q(prm->prim.r.y, ref->prim.r.y));
121  delta = av_add_q(delta, abs_sub_q(prm->prim.g.x, ref->prim.g.x));
122  delta = av_add_q(delta, abs_sub_q(prm->prim.g.y, ref->prim.g.y));
123  delta = av_add_q(delta, abs_sub_q(prm->prim.b.x, ref->prim.b.x));
124  delta = av_add_q(delta, abs_sub_q(prm->prim.b.y, ref->prim.b.y));
125  delta = av_add_q(delta, abs_sub_q(prm->wp.x, ref->wp.x));
126  delta = av_add_q(delta, abs_sub_q(prm->wp.y, ref->wp.y));
127 
128  if (av_cmp_q(delta, av_make_q(1, 1000)) < 0)
129  return p;
130  }
131 
132  return AVCOL_PRI_UNSPECIFIED;
133 }
134 
135 static const double approximate_gamma[AVCOL_TRC_NB] = {
136  [AVCOL_TRC_BT709] = 1.961,
137  [AVCOL_TRC_SMPTE170M] = 1.961,
138  [AVCOL_TRC_SMPTE240M] = 1.961,
139  [AVCOL_TRC_BT1361_ECG] = 1.961,
140  [AVCOL_TRC_BT2020_10] = 1.961,
141  [AVCOL_TRC_BT2020_12] = 1.961,
142  [AVCOL_TRC_GAMMA22] = 2.2,
143  [AVCOL_TRC_IEC61966_2_1] = 2.2,
144  [AVCOL_TRC_GAMMA28] = 2.8,
145  [AVCOL_TRC_LINEAR] = 1.0,
146  [AVCOL_TRC_SMPTE428] = 2.6,
147 };
148 
150 {
151  double gamma;
152  if (trc >= AVCOL_TRC_NB)
153  return 0.0;
154  gamma = approximate_gamma[trc];
155  if (gamma > 0)
156  return gamma;
157  return 0.0;
158 }
159 
160 #define BT709_alpha 1.099296826809442
161 #define BT709_beta 0.018053968510807
162 
163 static double trc_bt709(double Lc)
164 {
165  const double a = BT709_alpha;
166  const double b = BT709_beta;
167 
168  return (0.0 > Lc) ? 0.0
169  : ( b > Lc) ? 4.500 * Lc
170  : a * pow(Lc, 0.45) - (a - 1.0);
171 }
172 
173 static double trc_gamma22(double Lc)
174 {
175  return (0.0 > Lc) ? 0.0 : pow(Lc, 1.0/ 2.2);
176 }
177 
178 static double trc_gamma28(double Lc)
179 {
180  return (0.0 > Lc) ? 0.0 : pow(Lc, 1.0/ 2.8);
181 }
182 
183 static double trc_smpte240M(double Lc)
184 {
185  const double a = 1.1115;
186  const double b = 0.0228;
187 
188  return (0.0 > Lc) ? 0.0
189  : ( b > Lc) ? 4.000 * Lc
190  : a * pow(Lc, 0.45) - (a - 1.0);
191 }
192 
193 static double trc_linear(double Lc)
194 {
195  return Lc;
196 }
197 
198 static double trc_log(double Lc)
199 {
200  return (0.01 > Lc) ? 0.0 : 1.0 + log10(Lc) / 2.0;
201 }
202 
203 static double trc_log_sqrt(double Lc)
204 {
205  // sqrt(10) / 1000
206  return (0.00316227766 > Lc) ? 0.0 : 1.0 + log10(Lc) / 2.5;
207 }
208 
209 static double trc_iec61966_2_4(double Lc)
210 {
211  const double a = BT709_alpha;
212  const double b = BT709_beta;
213 
214  return (-b >= Lc) ? -a * pow(-Lc, 0.45) + (a - 1.0)
215  : ( b > Lc) ? 4.500 * Lc
216  : a * pow( Lc, 0.45) - (a - 1.0);
217 }
218 
219 static double trc_bt1361(double Lc)
220 {
221  const double a = BT709_alpha;
222  const double b = BT709_beta;
223 
224  return (-0.0045 >= Lc) ? -(a * pow(-4.0 * Lc, 0.45) + (a - 1.0)) / 4.0
225  : ( b > Lc) ? 4.500 * Lc
226  : a * pow( Lc, 0.45) - (a - 1.0);
227 }
228 
229 static double trc_iec61966_2_1(double Lc)
230 {
231  const double a = 1.055;
232  const double b = 0.0031308;
233 
234  return (0.0 > Lc) ? 0.0
235  : ( b > Lc) ? 12.92 * Lc
236  : a * pow(Lc, 1.0 / 2.4) - (a - 1.0);
237 }
238 
239 static double trc_smpte_st2084(double Lc)
240 {
241  const double c1 = 3424.0 / 4096.0; // c3-c2 + 1
242  const double c2 = 32.0 * 2413.0 / 4096.0;
243  const double c3 = 32.0 * 2392.0 / 4096.0;
244  const double m = 128.0 * 2523.0 / 4096.0;
245  const double n = 0.25 * 2610.0 / 4096.0;
246  const double L = Lc / 10000.0;
247  const double Ln = pow(L, n);
248 
249  return (0.0 > Lc) ? 0.0
250  : pow((c1 + c2 * Ln) / (1.0 + c3 * Ln), m);
251 
252 }
253 
254 static double trc_smpte_st428_1(double Lc)
255 {
256  return (0.0 > Lc) ? 0.0
257  : pow(48.0 * Lc / 52.37, 1.0 / 2.6);
258 }
259 
260 
261 static double trc_arib_std_b67(double Lc) {
262  // The function uses the definition from HEVC, which assumes that the peak
263  // white is input level = 1. (this is equivalent to scaling E = Lc * 12 and
264  // using the definition from the ARIB STD-B67 spec)
265  const double a = 0.17883277;
266  const double b = 0.28466892;
267  const double c = 0.55991073;
268  return (0.0 > Lc) ? 0.0 :
269  (Lc <= 1.0 / 12.0 ? sqrt(3.0 * Lc) : a * log(12.0 * Lc - b) + c);
270 }
271 
289 };
290 
292 {
294  if (trc >= AVCOL_TRC_NB)
295  return NULL;
296  func = trc_funcs[trc];
297  if (!func)
298  return NULL;
299  return func;
300 }
AVLumaCoefficients::cr
AVRational cr
Definition: csp.h:49
func
int(* func)(AVBPrint *dst, const char *in, const char *arg)
Definition: jacosubdec.c:68
abs_sub_q
static av_always_inline AVRational abs_sub_q(AVRational r1, AVRational r2)
Definition: csp.c:103
AVColorTransferCharacteristic
AVColorTransferCharacteristic
Color Transfer Characteristic.
Definition: pixfmt.h:580
AVColorPrimariesDesc::wp
AVWhitepointCoefficients wp
Definition: csp.h:79
trc_smpte240M
static double trc_smpte240M(double Lc)
Definition: csp.c:183
AVColorPrimariesDesc
Struct that contains both white point location and primaries location, providing the complete descrip...
Definition: csp.h:78
WP_D65
#define WP_D65
Definition: csp.c:71
AVCOL_TRC_LINEAR
@ AVCOL_TRC_LINEAR
"Linear transfer characteristics"
Definition: pixfmt.h:589
rational.h
normalize.log
log
Definition: normalize.py:21
AVCOL_TRC_NB
@ AVCOL_TRC_NB
Not part of ABI.
Definition: pixfmt.h:602
AVCOL_SPC_YCOCG
@ AVCOL_SPC_YCOCG
Definition: pixfmt.h:619
av_csp_luma_coeffs_from_avcsp
const struct AVLumaCoefficients * av_csp_luma_coeffs_from_avcsp(enum AVColorSpace csp)
Retrieves the Luma coefficients necessary to construct a conversion matrix from an enum constant desc...
Definition: csp.c:58
AVCOL_SPC_NB
@ AVCOL_SPC_NB
Not part of ABI.
Definition: pixfmt.h:626
b
#define b
Definition: input.c:41
AVCOL_PRI_JEDEC_P22
@ AVCOL_PRI_JEDEC_P22
Definition: pixfmt.h:572
AVCOL_SPC_RGB
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB), YZX and ST 428-1
Definition: pixfmt.h:610
AVCOL_TRC_BT2020_12
@ AVCOL_TRC_BT2020_12
ITU-R BT2020 for 12-bit system.
Definition: pixfmt.h:596
AVLumaCoefficients
Struct containing luma coefficients to be used for RGB to YUV/YCoCg, or similar calculations.
Definition: csp.h:48
AVColorPrimaries
AVColorPrimaries
Chromaticity coordinates of the source primaries.
Definition: pixfmt.h:555
c1
static const uint64_t c1
Definition: murmur3.c:52
av_sub_q
AVRational av_sub_q(AVRational b, AVRational c)
Subtract one rational from another.
Definition: rational.c:101
AVCOL_SPC_BT2020_CL
@ AVCOL_SPC_BT2020_CL
ITU-R BT2020 constant luminance system.
Definition: pixfmt.h:621
av_csp_trc_func_from_id
av_csp_trc_function av_csp_trc_func_from_id(enum AVColorTransferCharacteristic trc)
Determine the function needed to apply the given AVColorTransferCharacteristic to linear input.
Definition: csp.c:291
AVCOL_SPC_BT470BG
@ AVCOL_SPC_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
Definition: pixfmt.h:615
AVCOL_TRC_IEC61966_2_1
@ AVCOL_TRC_IEC61966_2_1
IEC 61966-2-1 (sRGB or sYCC)
Definition: pixfmt.h:594
WP_C
#define WP_C
Definition: csp.c:72
BT709_alpha
#define BT709_alpha
Definition: csp.c:160
AVCOL_TRC_GAMMA28
@ AVCOL_TRC_GAMMA28
also ITU-R BT470BG
Definition: pixfmt.h:586
trc_gamma22
static double trc_gamma22(double Lc)
Definition: csp.c:173
AVCOL_TRC_LOG_SQRT
@ AVCOL_TRC_LOG_SQRT
"Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)"
Definition: pixfmt.h:591
AVRational::num
int num
Numerator.
Definition: rational.h:59
AVCOL_TRC_GAMMA22
@ AVCOL_TRC_GAMMA22
also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
Definition: pixfmt.h:585
trc_iec61966_2_1
static double trc_iec61966_2_1(double Lc)
Definition: csp.c:229
AVCOL_PRI_NB
@ AVCOL_PRI_NB
Not part of ABI.
Definition: pixfmt.h:573
av_csp_primaries_desc_from_id
const AVColorPrimariesDesc * av_csp_primaries_desc_from_id(enum AVColorPrimaries prm)
Retrieves a complete gamut description from an enum constant describing the color primaries.
Definition: csp.c:90
AVCOL_TRC_BT1361_ECG
@ AVCOL_TRC_BT1361_ECG
ITU-R BT1361 Extended Colour Gamut.
Definition: pixfmt.h:593
AVCOL_SPC_SMPTE170M
@ AVCOL_SPC_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
Definition: pixfmt.h:616
approximate_gamma
static const double approximate_gamma[AVCOL_TRC_NB]
Definition: csp.c:135
AVCOL_PRI_SMPTE428
@ AVCOL_PRI_SMPTE428
SMPTE ST 428-1 (CIE 1931 XYZ)
Definition: pixfmt.h:567
av_csp_primaries_id_from_desc
enum AVColorPrimaries av_csp_primaries_id_from_desc(const AVColorPrimariesDesc *prm)
Detects which enum AVColorPrimaries constant corresponds to the given complete gamut description.
Definition: csp.c:110
AVCOL_PRI_SMPTE240M
@ AVCOL_PRI_SMPTE240M
identical to above, also called "SMPTE C" even though it uses D65
Definition: pixfmt.h:564
AVCOL_PRI_UNSPECIFIED
@ AVCOL_PRI_UNSPECIFIED
Definition: pixfmt.h:558
AVCOL_PRI_BT470BG
@ AVCOL_PRI_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
Definition: pixfmt.h:562
AVCOL_PRI_SMPTE170M
@ AVCOL_PRI_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
Definition: pixfmt.h:563
NULL
#define NULL
Definition: coverity.c:32
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
AVCOL_TRC_IEC61966_2_4
@ AVCOL_TRC_IEC61966_2_4
IEC 61966-2-4.
Definition: pixfmt.h:592
trc_funcs
static const av_csp_trc_function trc_funcs[AVCOL_TRC_NB]
Definition: csp.c:272
AVCOL_PRI_BT709
@ AVCOL_PRI_BT709
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP 177 Annex B
Definition: pixfmt.h:557
BT709_beta
#define BT709_beta
Definition: csp.c:161
trc_bt1361
static double trc_bt1361(double Lc)
Definition: csp.c:219
AVCOL_TRC_BT2020_10
@ AVCOL_TRC_BT2020_10
ITU-R BT2020 for 10-bit system.
Definition: pixfmt.h:595
abs
#define abs(x)
Definition: cuda_runtime.h:35
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
AVCOL_PRI_BT2020
@ AVCOL_PRI_BT2020
ITU-R BT2020.
Definition: pixfmt.h:566
AVCIExy::x
AVRational x
Definition: csp.h:57
color_primaries
static const AVColorPrimariesDesc color_primaries[AVCOL_PRI_NB]
Definition: csp.c:76
AVCOL_TRC_SMPTE2084
@ AVCOL_TRC_SMPTE2084
SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems.
Definition: pixfmt.h:597
AVPrimaryCoefficients::b
AVCIExy b
Definition: csp.h:65
AVCOL_PRI_SMPTE431
@ AVCOL_PRI_SMPTE431
SMPTE ST 431-2 (2011) / DCI P3.
Definition: pixfmt.h:569
AVPrimaryCoefficients::r
AVCIExy r
Definition: csp.h:65
AVCOL_TRC_SMPTE240M
@ AVCOL_TRC_SMPTE240M
Definition: pixfmt.h:588
AVCOL_PRI_FILM
@ AVCOL_PRI_FILM
colour filters using Illuminant C
Definition: pixfmt.h:565
trc_log
static double trc_log(double Lc)
Definition: csp.c:198
AVCOL_TRC_LOG
@ AVCOL_TRC_LOG
"Logarithmic transfer characteristic (100:1 range)"
Definition: pixfmt.h:590
trc_smpte_st2084
static double trc_smpte_st2084(double Lc)
Definition: csp.c:239
av_make_q
static AVRational av_make_q(int num, int den)
Create an AVRational.
Definition: rational.h:71
av_csp_approximate_trc_gamma
double av_csp_approximate_trc_gamma(enum AVColorTransferCharacteristic trc)
Determine a suitable 'gamma' value to match the supplied AVColorTransferCharacteristic.
Definition: csp.c:149
AVPrimaryCoefficients::g
AVCIExy g
Definition: csp.h:65
diff
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)
Definition: vf_paletteuse.c:164
a
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
Definition: undefined.txt:41
csp.h
attributes.h
AVCOL_TRC_BT709
@ AVCOL_TRC_BT709
also ITU-R BT1361
Definition: pixfmt.h:582
AVCOL_SPC_SMPTE240M
@ AVCOL_SPC_SMPTE240M
derived from 170M primaries and D65 white point, 170M is derived from BT470 System M's primaries
Definition: pixfmt.h:617
av_csp_trc_function
double(* av_csp_trc_function)(double)
Function pointer representing a double -> double transfer function that performs an EOTF transfer inv...
Definition: csp.h:87
AVCOL_SPC_BT2020_NCL
@ AVCOL_SPC_BT2020_NCL
ITU-R BT2020 non-constant luminance system.
Definition: pixfmt.h:620
AVColorSpace
AVColorSpace
YUV colorspace type.
Definition: pixfmt.h:609
trc_bt709
static double trc_bt709(double Lc)
Definition: csp.c:163
delta
float delta
Definition: vorbis_enc_data.h:430
av_always_inline
#define av_always_inline
Definition: attributes.h:49
av_cmp_q
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
Definition: rational.h:89
AVCOL_PRI_BT470M
@ AVCOL_PRI_BT470M
also FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
Definition: pixfmt.h:560
pixfmt.h
WP_E
#define WP_E
Definition: csp.c:74
AVR
#define AVR(d)
Definition: csp.c:38
AVCIExy::y
AVRational y
Definition: csp.h:57
trc_linear
static double trc_linear(double Lc)
Definition: csp.c:193
WP_DCI
#define WP_DCI
Definition: csp.c:73
c2
static const uint64_t c2
Definition: murmur3.c:53
AVCOL_TRC_ARIB_STD_B67
@ AVCOL_TRC_ARIB_STD_B67
ARIB STD-B67, known as "Hybrid log-gamma".
Definition: pixfmt.h:601
trc_gamma28
static double trc_gamma28(double Lc)
Definition: csp.c:178
AVCOL_SPC_FCC
@ AVCOL_SPC_FCC
FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
Definition: pixfmt.h:614
ref
static int ref[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:112
L
#define L(x)
Definition: vpx_arith.h:36
AVCOL_TRC_SMPTE170M
@ AVCOL_TRC_SMPTE170M
also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
Definition: pixfmt.h:587
trc_log_sqrt
static double trc_log_sqrt(double Lc)
Definition: csp.c:203
AVCOL_PRI_SMPTE432
@ AVCOL_PRI_SMPTE432
SMPTE ST 432-1 (2010) / P3 D65 / Display P3.
Definition: pixfmt.h:570
av_add_q
AVRational av_add_q(AVRational b, AVRational c)
Add two rationals.
Definition: rational.c:93
AVColorPrimariesDesc::prim
AVPrimaryCoefficients prim
Definition: csp.h:80
luma_coefficients
static const struct AVLumaCoefficients luma_coefficients[AVCOL_SPC_NB]
Definition: csp.c:46
AVCOL_TRC_SMPTE428
@ AVCOL_TRC_SMPTE428
SMPTE ST 428-1.
Definition: pixfmt.h:599
trc_arib_std_b67
static double trc_arib_std_b67(double Lc)
Definition: csp.c:261
trc_smpte_st428_1
static double trc_smpte_st428_1(double Lc)
Definition: csp.c:254
AVCOL_SPC_BT709
@ AVCOL_SPC_BT709
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / derived in SMPTE RP 177 Annex B
Definition: pixfmt.h:611
trc_iec61966_2_4
static double trc_iec61966_2_4(double Lc)
Definition: csp.c:209