FFmpeg
Functions | Variables
csputils.c File Reference
#include "libavutil/csp.h"
#include "csputils.h"
#include "utils.h"

Go to the source code of this file.

Functions

void ff_sws_matrix3x3_mul (SwsMatrix3x3 *a, const SwsMatrix3x3 *b)
 
void ff_sws_matrix3x3_rmul (const SwsMatrix3x3 *a, SwsMatrix3x3 *b)
 
void ff_sws_matrix3x3_invert (SwsMatrix3x3 *mat)
 
void ff_sws_matrix3x3_apply (const SwsMatrix3x3 *mat, float vec[3])
 
static AVRational cie_X (AVCIExy xy)
 
static AVRational cie_Z (AVCIExy xy)
 
SwsMatrix3x3 ff_sws_rgb2xyz (const AVColorPrimariesDesc *desc)
 
SwsMatrix3x3 ff_sws_xyz2rgb (const AVColorPrimariesDesc *prim)
 
static void apply_chromatic_adaptation (AVWhitepointCoefficients src, AVWhitepointCoefficients dst, SwsMatrix3x3 *mat)
 
SwsMatrix3x3 ff_sws_get_adaptation (const AVPrimaryCoefficients *prim, AVWhitepointCoefficients from, AVWhitepointCoefficients to)
 
SwsMatrix3x3 ff_sws_ipt_rgb2lms (const AVColorPrimariesDesc *prim)
 
SwsMatrix3x3 ff_sws_ipt_lms2rgb (const AVColorPrimariesDesc *prim)
 
static int test_point_line (AVCIExy p, AVCIExy a, AVCIExy b)
 
static float test_point_gamut (const AVCIExy point, const AVPrimaryCoefficients *prim)
 
bool ff_prim_superset (const AVPrimaryCoefficients *a, const AVPrimaryCoefficients *b)
 Returns true if 'b' is entirely contained in 'a'. More...
 

Variables

static const SwsMatrix3x3 m_cat16
 
static const SwsMatrix3x3 m_cat16_inv
 
static const AVWhitepointCoefficients d65
 
static const SwsMatrix3x3 hpe
 
const float ff_pq_eotf_lut [PQ_LUT_SIZE+1]
 

Function Documentation

◆ ff_sws_matrix3x3_mul()

void ff_sws_matrix3x3_mul ( SwsMatrix3x3 a,
const SwsMatrix3x3 b 
)

◆ ff_sws_matrix3x3_rmul()

void ff_sws_matrix3x3_rmul ( const SwsMatrix3x3 a,
SwsMatrix3x3 b 
)

Definition at line 39 of file csputils.c.

◆ ff_sws_matrix3x3_invert()

void ff_sws_matrix3x3_invert ( SwsMatrix3x3 mat)

Definition at line 52 of file csputils.c.

Referenced by ff_sws_ipt_lms2rgb(), ff_sws_rgb2xyz(), and ff_sws_xyz2rgb().

◆ ff_sws_matrix3x3_apply()

void ff_sws_matrix3x3_apply ( const SwsMatrix3x3 mat,
float  vec[3] 
)

Definition at line 85 of file csputils.c.

Referenced by absolute().

◆ cie_X()

static AVRational cie_X ( AVCIExy  xy)
inlinestatic

Definition at line 94 of file csputils.c.

Referenced by apply_chromatic_adaptation(), and ff_sws_rgb2xyz().

◆ cie_Z()

static AVRational cie_Z ( AVCIExy  xy)
inlinestatic

Definition at line 100 of file csputils.c.

Referenced by apply_chromatic_adaptation(), and ff_sws_rgb2xyz().

◆ ff_sws_rgb2xyz()

SwsMatrix3x3 ff_sws_rgb2xyz ( const AVColorPrimariesDesc desc)

Definition at line 105 of file csputils.c.

Referenced by ff_sws_get_adaptation(), ff_sws_ipt_rgb2lms(), and ff_sws_xyz2rgb().

◆ ff_sws_xyz2rgb()

SwsMatrix3x3 ff_sws_xyz2rgb ( const AVColorPrimariesDesc prim)

Definition at line 143 of file csputils.c.

Referenced by ff_sws_get_adaptation().

◆ apply_chromatic_adaptation()

static void apply_chromatic_adaptation ( AVWhitepointCoefficients  src,
AVWhitepointCoefficients  dst,
SwsMatrix3x3 mat 
)
static

Definition at line 164 of file csputils.c.

Referenced by ff_sws_get_adaptation(), and ff_sws_ipt_rgb2lms().

◆ ff_sws_get_adaptation()

SwsMatrix3x3 ff_sws_get_adaptation ( const AVPrimaryCoefficients prim,
AVWhitepointCoefficients  from,
AVWhitepointCoefficients  to 
)

Definition at line 204 of file csputils.c.

Referenced by ff_sws_color_map_generate_dynamic().

◆ ff_sws_ipt_rgb2lms()

SwsMatrix3x3 ff_sws_ipt_rgb2lms ( const AVColorPrimariesDesc prim)

Definition at line 232 of file csputils.c.

Referenced by ff_sws_ipt_lms2rgb(), and gamut_from_colorspace().

◆ ff_sws_ipt_lms2rgb()

SwsMatrix3x3 ff_sws_ipt_lms2rgb ( const AVColorPrimariesDesc prim)

Definition at line 252 of file csputils.c.

Referenced by gamut_from_colorspace().

◆ test_point_line()

static int test_point_line ( AVCIExy  p,
AVCIExy  a,
AVCIExy  b 
)
static

Definition at line 260 of file csputils.c.

Referenced by test_point_gamut().

◆ test_point_gamut()

static float test_point_gamut ( const AVCIExy  point,
const AVPrimaryCoefficients prim 
)
static

Definition at line 268 of file csputils.c.

Referenced by ff_prim_superset().

◆ ff_prim_superset()

bool ff_prim_superset ( const AVPrimaryCoefficients a,
const AVPrimaryCoefficients b 
)

Returns true if 'b' is entirely contained in 'a'.

Useful for figuring out if colorimetric clipping will occur or not.

Definition at line 281 of file csputils.c.

Referenced by ff_sws_color_map_noop().

Variable Documentation

◆ m_cat16

const SwsMatrix3x3 m_cat16
static
Initial value:
= {{
{ 0.401288f, 0.650173f, -0.051461f },
{ -0.250268f, 1.204414f, 0.045854f },
{ -0.002079f, 0.048952f, 0.953127f },
}}

Definition at line 151 of file csputils.c.

Referenced by apply_chromatic_adaptation().

◆ m_cat16_inv

const SwsMatrix3x3 m_cat16_inv
static
Initial value:
= {{
{ 1.862068f, -1.011255f, 0.149187f },
{ 0.387527f, 0.621447f, -0.008974f },
{ -0.015841f, -0.034123f, 1.049964f },
}}

Definition at line 157 of file csputils.c.

Referenced by apply_chromatic_adaptation().

◆ d65

const AVWhitepointCoefficients d65
static
Initial value:
= {
.x = {3127, 10000},
.y = {3290, 10000}
}

Definition at line 221 of file csputils.c.

Referenced by ff_sws_ipt_rgb2lms().

◆ hpe

const SwsMatrix3x3 hpe
static
Initial value:
= {{
{ 0.40024f, 0.70760f, -0.08081f },
{ -0.22630f, 1.16532f, 0.04570f },
{ 0.00000f, 0.00000f, 0.91822f },
}}

Definition at line 226 of file csputils.c.

Referenced by ff_sws_ipt_rgb2lms().

◆ ff_pq_eotf_lut

const float ff_pq_eotf_lut[PQ_LUT_SIZE+1]

Definition at line 288 of file csputils.c.

Referenced by pq_eotf().