FFmpeg
Functions | Variables
colorspace.c File Reference
#include "libavutil/frame.h"
#include "libavutil/mastering_display_metadata.h"
#include "libavutil/pixdesc.h"
#include "colorspace.h"

Go to the source code of this file.

Functions

void ff_matrix_invert_3x3 (const double in[3][3], double out[3][3])
 
void ff_matrix_mul_3x3 (double dst[3][3], const double src1[3][3], const double src2[3][3])
 
void ff_fill_rgb2xyz_table (const struct PrimaryCoefficients *coeffs, const struct WhitepointCoefficients *wp, double rgb2xyz[3][3])
 
const struct LumaCoefficientsff_get_luma_coefficients (enum AVColorSpace csp)
 
void ff_fill_rgb2yuv_table (const struct LumaCoefficients *coeffs, double rgb2yuv[3][3])
 
double ff_determine_signal_peak (AVFrame *in)
 
void ff_update_hdr_metadata (AVFrame *in, double peak)
 

Variables

static const double ycgco_matrix [3][3]
 
static const double gbr_matrix [3][3]
 
static const struct LumaCoefficients luma_coefficients [AVCOL_SPC_NB]
 

Function Documentation

◆ ff_matrix_invert_3x3()

void ff_matrix_invert_3x3 ( const double  in[3][3],
double  out[3][3] 
)

◆ ff_matrix_mul_3x3()

void ff_matrix_mul_3x3 ( double  dst[3][3],
const double  src1[3][3],
const double  src2[3][3] 
)

Definition at line 54 of file colorspace.c.

Referenced by create_filtergraph(), fill_whitepoint_conv_table(), and get_rgb2rgb_matrix().

◆ ff_fill_rgb2xyz_table()

void ff_fill_rgb2xyz_table ( const struct PrimaryCoefficients coeffs,
const struct WhitepointCoefficients wp,
double  rgb2xyz[3][3] 
)

Definition at line 68 of file colorspace.c.

Referenced by create_filtergraph(), and get_rgb2rgb_matrix().

◆ ff_get_luma_coefficients()

const struct LumaCoefficients* ff_get_luma_coefficients ( enum AVColorSpace  csp)

Definition at line 128 of file colorspace.c.

Referenced by create_filtergraph(), and tonemap_opencl_init().

◆ ff_fill_rgb2yuv_table()

void ff_fill_rgb2yuv_table ( const struct LumaCoefficients coeffs,
double  rgb2yuv[3][3] 
)

Definition at line 141 of file colorspace.c.

Referenced by create_filtergraph(), and tonemap_opencl_init().

◆ ff_determine_signal_peak()

double ff_determine_signal_peak ( AVFrame in)

Definition at line 168 of file colorspace.c.

Referenced by filter_frame(), and tonemap_opencl_filter_frame().

◆ ff_update_hdr_metadata()

void ff_update_hdr_metadata ( AVFrame in,
double  peak 
)

Definition at line 193 of file colorspace.c.

Referenced by filter_frame(), and tonemap_opencl_filter_frame().

Variable Documentation

◆ ycgco_matrix

const double ycgco_matrix[3][3]
static
Initial value:
=
{
{ 0.25, 0.5, 0.25 },
{ -0.25, 0.5, -0.25 },
{ 0.5, 0, -0.5 },
}

Definition at line 96 of file colorspace.c.

Referenced by ff_fill_rgb2yuv_table().

◆ gbr_matrix

const double gbr_matrix[3][3]
static
Initial value:
=
{
{ 0, 1, 0 },
{ 0, -0.5, 0.5 },
{ 0.5, -0.5, 0 },
}

Definition at line 103 of file colorspace.c.

Referenced by ff_fill_rgb2yuv_table().

◆ luma_coefficients

const struct LumaCoefficients luma_coefficients[AVCOL_SPC_NB]
static
Initial value:
= {
[AVCOL_SPC_FCC] = { 0.30, 0.59, 0.11 },
[AVCOL_SPC_BT470BG] = { 0.299, 0.587, 0.114 },
[AVCOL_SPC_SMPTE170M] = { 0.299, 0.587, 0.114 },
[AVCOL_SPC_BT709] = { 0.2126, 0.7152, 0.0722 },
[AVCOL_SPC_SMPTE240M] = { 0.212, 0.701, 0.087 },
[AVCOL_SPC_YCOCG] = { 0.25, 0.5, 0.25 },
[AVCOL_SPC_RGB] = { 1, 1, 1 },
[AVCOL_SPC_BT2020_NCL] = { 0.2627, 0.6780, 0.0593 },
[AVCOL_SPC_BT2020_CL] = { 0.2627, 0.6780, 0.0593 },
}

Definition at line 116 of file colorspace.c.

Referenced by ff_get_luma_coefficients().

AVCOL_SPC_YCOCG
@ AVCOL_SPC_YCOCG
Definition: pixfmt.h:506
AVCOL_SPC_RGB
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
Definition: pixfmt.h:497
AVCOL_SPC_BT2020_CL
@ AVCOL_SPC_BT2020_CL
ITU-R BT2020 constant luminance system.
Definition: pixfmt.h:508
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:502
AVCOL_SPC_SMPTE170M
@ AVCOL_SPC_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
Definition: pixfmt.h:503
AVCOL_SPC_SMPTE240M
@ AVCOL_SPC_SMPTE240M
functionally identical to above
Definition: pixfmt.h:504
AVCOL_SPC_BT2020_NCL
@ AVCOL_SPC_BT2020_NCL
ITU-R BT2020 non-constant luminance system.
Definition: pixfmt.h:507
AVCOL_SPC_FCC
@ AVCOL_SPC_FCC
FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
Definition: pixfmt.h:501
AVCOL_SPC_BT709
@ AVCOL_SPC_BT709
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
Definition: pixfmt.h:498