#include <stdlib.h>
#include <math.h>
#include "attributes.h"
#include "csp.h"
#include "pixfmt.h"
#include "rational.h"
Go to the source code of this file.
|
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 describing the colorspace. More...
|
|
const AVColorPrimariesDesc * | av_csp_primaries_desc_from_id (enum AVColorPrimaries prm) |
| Retrieves a complete gamut description from an enum constant describing the color primaries. More...
|
|
static av_always_inline AVRational | abs_sub_q (AVRational r1, AVRational r2) |
|
enum AVColorPrimaries | av_csp_primaries_id_from_desc (const AVColorPrimariesDesc *prm) |
| Detects which enum AVColorPrimaries constant corresponds to the given complete gamut description. More...
|
|
double | av_csp_approximate_trc_gamma (enum AVColorTransferCharacteristic trc) |
| Determine a suitable 'gamma' value to match the supplied AVColorTransferCharacteristic. More...
|
|
static double | trc_bt709 (double Lc) |
|
static double | trc_bt709_inv (double E) |
|
static double | trc_gamma22 (double Lc) |
|
static double | trc_gamma22_inv (double E) |
|
static double | trc_gamma28 (double Lc) |
|
static double | trc_gamma28_inv (double E) |
|
static double | trc_smpte240M (double Lc) |
|
static double | trc_smpte240M_inv (double E) |
|
static double | trc_linear (double Lc) |
|
static double | trc_log (double Lc) |
|
static double | trc_log_inv (double E) |
|
static double | trc_log_sqrt (double Lc) |
|
static double | trc_log_sqrt_inv (double E) |
|
static double | trc_iec61966_2_4 (double Lc) |
|
static double | trc_iec61966_2_4_inv (double E) |
|
static double | trc_bt1361 (double Lc) |
|
static double | trc_bt1361_inv (double E) |
|
static double | trc_iec61966_2_1 (double Lc) |
|
static double | trc_iec61966_2_1_inv (double E) |
|
static double | trc_smpte_st2084 (double Lc) |
|
static double | trc_smpte_st2084_inv (double E) |
|
static double | trc_smpte_st428_1 (double Lc) |
|
static double | trc_smpte_st428_1_inv (double E) |
|
static double | trc_arib_std_b67 (double Lc) |
|
static double | trc_arib_std_b67_inv (double E) |
|
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. More...
|
|
av_csp_trc_function | av_csp_trc_func_inv_from_id (enum AVColorTransferCharacteristic trc) |
| Returns the mathematical inverse of the corresponding TRC function. More...
|
|
static void | eotf_linear (const double Lw, const double Lb, double E[3]) |
|
static void | eotf_linear_inv (const double Lw, const double Lb, double L[3]) |
|
static void | eotf_bt1886 (const double Lw, const double Lb, double E[3]) |
|
static void | eotf_bt1886_inv (const double Lw, const double Lb, double L[3]) |
|
static void | eotf_smpte_st2084 (const double Lw, const double Lb, double E[3]) |
|
static void | eotf_smpte_st2084_inv (const double Lw, const double Lb, double L[3]) |
|
static void | eotf_smpte_st428_1 (const double Lw_Y, const double Lb_Y, double E[3]) |
|
static void | eotf_smpte_st428_1_inv (const double Lw_Y, const double Lb_Y, double L[3]) |
|
static void | eotf_arib_std_b67 (const double Lw, const double Lb, double E[3]) |
|
static void | eotf_arib_std_b67_inv (const double Lw, const double Lb, double L[3]) |
|
av_csp_eotf_function | av_csp_itu_eotf (enum AVColorTransferCharacteristic trc) |
| Returns the ITU EOTF corresponding to a given TRC. More...
|
|
av_csp_eotf_function | av_csp_itu_eotf_inv (enum AVColorTransferCharacteristic trc) |
| Returns the mathematical inverse of the corresponding EOTF. More...
|
|
◆ AVR
#define AVR |
( |
|
d | ) |
{ (int)(d * 100000 + 0.5), 100000 } |
Definition at line 38 of file csp.c.
◆ WP_D65
#define WP_D65 { AVR(0.3127), AVR(0.3290) } |
Definition at line 71 of file csp.c.
◆ WP_C
#define WP_C { AVR(0.3100), AVR(0.3160) } |
Definition at line 72 of file csp.c.
◆ WP_DCI
#define WP_DCI { AVR(0.3140), AVR(0.3510) } |
Definition at line 73 of file csp.c.
◆ WP_E
#define WP_E { {1, 3}, {1, 3} } |
Definition at line 74 of file csp.c.
◆ BT709_alpha
#define BT709_alpha 1.099296826809442 |
◆ BT709_beta
#define BT709_beta 0.018053968510807 |
◆ PQ_c1
#define PQ_c1 ( 3424.0 / 4096.0) /* c3-c2 + 1 */ |
◆ PQ_c2
#define PQ_c2 ( 32.0 * 2413.0 / 4096.0) |
◆ PQ_c3
#define PQ_c3 ( 32.0 * 2392.0 / 4096.0) |
◆ PQ_m
#define PQ_m (128.0 * 2523.0 / 4096.0) |
◆ PQ_n
#define PQ_n ( 0.25 * 2610.0 / 4096.0) |
◆ DCI_L [1/2]
◆ DCI_P [1/2]
◆ HLG_a
◆ HLG_b
◆ HLG_c
◆ WRAP_SDR_OETF
#define WRAP_SDR_OETF |
( |
|
name | ) |
|
Value:static void oetf_##
name(
double L[3]) \
{ \
for (
int i = 0;
i < 3;
i++) \
} \
\
static
void oetf_##
name##_inv(
double E[3]) \
{ \
for (
int i = 0;
i < 3;
i++) \
}
Definition at line 445 of file csp.c.
◆ WRAP_SDR_EOTF
#define WRAP_SDR_EOTF |
( |
|
name | ) |
|
Value:static void eotf_##
name(
double Lw,
double Lb,
double E[3]) \
{ \
eotf_linear(Lw, Lb,
E); \
} \
\
static
void eotf_##
name##_inv(
double Lw,
double Lb,
double L[3]) \
{ \
eotf_linear_inv(Lw, Lb,
L); \
}
Definition at line 462 of file csp.c.
◆ DCI_L [2/2]
◆ DCI_P [2/2]
◆ DCI_X
#define DCI_X (42.94 / DCI_L) |
◆ DCI_Z
#define DCI_Z (45.82 / DCI_L) |
◆ abs_sub_q()
◆ trc_bt709()
◆ trc_bt709_inv()
◆ trc_gamma22()
◆ trc_gamma22_inv()
◆ trc_gamma28()
◆ trc_gamma28_inv()
◆ trc_smpte240M()
◆ trc_smpte240M_inv()
◆ trc_linear()
◆ trc_log()
◆ trc_log_inv()
◆ trc_log_sqrt()
◆ trc_log_sqrt_inv()
◆ trc_iec61966_2_4()
◆ trc_iec61966_2_4_inv()
◆ trc_bt1361()
◆ trc_bt1361_inv()
◆ trc_iec61966_2_1()
◆ trc_iec61966_2_1_inv()
◆ trc_smpte_st2084()
◆ trc_smpte_st2084_inv()
◆ trc_smpte_st428_1()
◆ trc_smpte_st428_1_inv()
◆ trc_arib_std_b67()
◆ trc_arib_std_b67_inv()
◆ eotf_linear()
◆ eotf_linear_inv()
◆ eotf_bt1886()
◆ eotf_bt1886_inv()
◆ eotf_smpte_st2084()
◆ eotf_smpte_st2084_inv()
◆ eotf_smpte_st428_1()
◆ eotf_smpte_st428_1_inv()
◆ eotf_arib_std_b67()
Note: This equation is technically only accurate if the contrast ratio Lw:Lb is greater than 12:1; otherwise we would need to use a different, significantly more complicated solution. Ignore this as a highly degenerate case, since any real world reference display will have a static contrast ratio multiple orders of magnitude higher.
Definition at line 541 of file csp.c.
◆ eotf_arib_std_b67_inv()
◆ luma_coefficients
◆ color_primaries
Initial value:
Definition at line 76 of file csp.c.
Referenced by av_csp_primaries_desc_from_id(), av_csp_primaries_id_from_desc(), color_config(), convert_primaries(), mov_read_colr(), mov_read_vpcc(), print_film_grain_params(), print_primaries(), scale_vaapi_init(), scale_vt_init(), tonemap_vaapi_init(), and vpp_init().
◆ approximate_gamma
◆ trc_funcs
◆ trc_inv_funcs
◆ eotf_funcs
◆ eotf_inv_funcs
static double trc_bt1361_inv(double E)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
static double trc_smpte240M(double Lc)
@ AVCOL_TRC_LINEAR
"Linear transfer characteristics"
static void eotf_smpte_st428_1_inv(const double Lw_Y, const double Lb_Y, double L[3])
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB), YZX and ST 428-1
@ AVCOL_TRC_BT2020_12
ITU-R BT2020 for 12-bit system.
@ AVCOL_SPC_BT2020_CL
ITU-R BT2020 constant luminance system.
static double trc_log_inv(double E)
@ AVCOL_SPC_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
@ AVCOL_TRC_IEC61966_2_1
IEC 61966-2-1 (sRGB or sYCC)
@ AVCOL_TRC_GAMMA28
also ITU-R BT470BG
static double trc_gamma22(double Lc)
static void eotf_linear_inv(const double Lw, const double Lb, double L[3])
@ AVCOL_TRC_LOG_SQRT
"Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)"
@ AVCOL_TRC_GAMMA22
also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
static double trc_smpte240M_inv(double E)
static double trc_iec61966_2_1(double Lc)
@ AVCOL_TRC_BT1361_ECG
ITU-R BT1361 Extended Colour Gamut.
@ AVCOL_SPC_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
@ AVCOL_PRI_SMPTE428
SMPTE ST 428-1 (CIE 1931 XYZ)
static void eotf_smpte_st2084_inv(const double Lw, const double Lb, double L[3])
@ AVCOL_PRI_SMPTE240M
identical to above, also called "SMPTE C" even though it uses D65
static double trc_gamma28_inv(double E)
@ AVCOL_PRI_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
@ AVCOL_PRI_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
static void eotf_bt1886_inv(const double Lw, const double Lb, double L[3])
@ AVCOL_TRC_IEC61966_2_4
IEC 61966-2-4.
@ AVCOL_PRI_BT709
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP 177 Annex B
static double trc_bt1361(double Lc)
@ AVCOL_TRC_BT2020_10
ITU-R BT2020 for 10-bit system.
static void eotf_arib_std_b67(const double Lw, const double Lb, double E[3])
@ AVCOL_PRI_BT2020
ITU-R BT2020.
@ AVCOL_TRC_SMPTE2084
SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems.
@ AVCOL_PRI_SMPTE431
SMPTE ST 431-2 (2011) / DCI P3.
@ AVCOL_PRI_FILM
colour filters using Illuminant C
static double trc_log(double Lc)
@ AVCOL_TRC_LOG
"Logarithmic transfer characteristic (100:1 range)"
static double trc_smpte_st2084(double Lc)
static void eotf_linear(const double Lw, const double Lb, double E[3])
@ AVCOL_TRC_BT709
also ITU-R BT1361
@ AVCOL_SPC_SMPTE240M
derived from 170M primaries and D65 white point, 170M is derived from BT470 System M's primaries
#define i(width, name, range_min, range_max)
static double trc_iec61966_2_4_inv(double E)
@ AVCOL_SPC_BT2020_NCL
ITU-R BT2020 non-constant luminance system.
static double trc_bt709(double Lc)
static void eotf_smpte_st2084(const double Lw, const double Lb, double E[3])
@ AVCOL_PRI_BT470M
also FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
static double trc_linear(double Lc)
@ AVCOL_TRC_ARIB_STD_B67
ARIB STD-B67, known as "Hybrid log-gamma".
static double trc_gamma28(double Lc)
static double trc_arib_std_b67_inv(double E)
@ AVCOL_SPC_FCC
FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
static void eotf_smpte_st428_1(const double Lw_Y, const double Lb_Y, double E[3])
@ AVCOL_TRC_SMPTE170M
also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
static double trc_log_sqrt(double Lc)
@ AVCOL_PRI_SMPTE432
SMPTE ST 432-1 (2010) / P3 D65 / Display P3.
static double trc_gamma22_inv(double E)
static double trc_smpte_st2084_inv(double E)
static double trc_iec61966_2_1_inv(double E)
@ AVCOL_TRC_SMPTE428
SMPTE ST 428-1.
static double trc_bt709_inv(double E)
static double trc_log_sqrt_inv(double E)
static double trc_arib_std_b67(double Lc)
static double trc_smpte_st428_1_inv(double E)
static double trc_smpte_st428_1(double Lc)
static void eotf_arib_std_b67_inv(const double Lw, const double Lb, double L[3])
@ AVCOL_SPC_BT709
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / derived in SMPTE RP 177 Annex B
static void eotf_bt1886(const double Lw, const double Lb, double E[3])
static double trc_iec61966_2_4(double Lc)