FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
color_utils.c File Reference
#include <stddef.h>
#include <math.h>
#include "common.h"
#include "libavutil/color_utils.h"
#include "libavutil/pixfmt.h"

Go to the source code of this file.

Macros

#define BT709_alpha   1.099296826809442
 
#define BT709_beta   0.018053968510807
 

Functions

double avpriv_get_gamma_from_trc (enum AVColorTransferCharacteristic trc)
 Determine a suitable 'gamma' value to match the supplied AVColorTransferCharacteristic. More...
 
static double avpriv_trc_bt709 (double Lc)
 
static double avpriv_trc_gamma22 (double Lc)
 
static double avpriv_trc_gamma28 (double Lc)
 
static double avpriv_trc_smpte240M (double Lc)
 
static double avpriv_trc_linear (double Lc)
 
static double avpriv_trc_log (double Lc)
 
static double avpriv_trc_log_sqrt (double Lc)
 
static double avpriv_trc_iec61966_2_4 (double Lc)
 
static double avpriv_trc_bt1361 (double Lc)
 
static double avpriv_trc_iec61966_2_1 (double Lc)
 
static double avpriv_trc_smpte_st2084 (double Lc)
 
static double avpriv_trc_smpte_st428_1 (double Lc)
 
static double avpriv_trc_arib_std_b67 (double Lc)
 
avpriv_trc_function avpriv_get_trc_function_from_trc (enum AVColorTransferCharacteristic trc)
 Determine the function needed to apply the given AVColorTransferCharacteristic to linear input. More...
 

Macro Definition Documentation

#define BT709_alpha   1.099296826809442

Definition at line 58 of file color_utils.c.

Referenced by avpriv_trc_bt1361(), avpriv_trc_bt709(), and avpriv_trc_iec61966_2_4().

#define BT709_beta   0.018053968510807

Definition at line 59 of file color_utils.c.

Referenced by avpriv_trc_bt1361(), avpriv_trc_bt709(), and avpriv_trc_iec61966_2_4().

Function Documentation

double avpriv_get_gamma_from_trc ( enum AVColorTransferCharacteristic  trc)

Determine a suitable 'gamma' value to match the supplied AVColorTransferCharacteristic.

See Apple Technical Note TN2257 (https://developer.apple.com/library/mac/technotes/tn2257/_index.html)

Returns
Will return an approximation to the simple gamma function matching the supplied Transfer Characteristic, Will return 0.0 for any we cannot reasonably match against.

Definition at line 28 of file color_utils.c.

Referenced by mov_write_gama_tag(), and png_get_gama().

static double avpriv_trc_bt709 ( double  Lc)
static

Definition at line 61 of file color_utils.c.

Referenced by avpriv_get_trc_function_from_trc().

static double avpriv_trc_gamma22 ( double  Lc)
static

Definition at line 71 of file color_utils.c.

Referenced by avpriv_get_trc_function_from_trc().

static double avpriv_trc_gamma28 ( double  Lc)
static

Definition at line 76 of file color_utils.c.

Referenced by avpriv_get_trc_function_from_trc().

static double avpriv_trc_smpte240M ( double  Lc)
static

Definition at line 81 of file color_utils.c.

Referenced by avpriv_get_trc_function_from_trc().

static double avpriv_trc_linear ( double  Lc)
static

Definition at line 91 of file color_utils.c.

Referenced by avpriv_get_trc_function_from_trc().

static double avpriv_trc_log ( double  Lc)
static

Definition at line 96 of file color_utils.c.

Referenced by avpriv_get_trc_function_from_trc().

static double avpriv_trc_log_sqrt ( double  Lc)
static

Definition at line 101 of file color_utils.c.

Referenced by avpriv_get_trc_function_from_trc().

static double avpriv_trc_iec61966_2_4 ( double  Lc)
static

Definition at line 107 of file color_utils.c.

Referenced by avpriv_get_trc_function_from_trc().

static double avpriv_trc_bt1361 ( double  Lc)
static

Definition at line 117 of file color_utils.c.

Referenced by avpriv_get_trc_function_from_trc().

static double avpriv_trc_iec61966_2_1 ( double  Lc)
static

Definition at line 127 of file color_utils.c.

Referenced by avpriv_get_trc_function_from_trc().

static double avpriv_trc_smpte_st2084 ( double  Lc)
static

Definition at line 137 of file color_utils.c.

Referenced by avpriv_get_trc_function_from_trc().

static double avpriv_trc_smpte_st428_1 ( double  Lc)
static

Definition at line 152 of file color_utils.c.

Referenced by avpriv_get_trc_function_from_trc().

static double avpriv_trc_arib_std_b67 ( double  Lc)
static

Definition at line 159 of file color_utils.c.

Referenced by avpriv_get_trc_function_from_trc().

avpriv_trc_function avpriv_get_trc_function_from_trc ( enum AVColorTransferCharacteristic  trc)

Determine the function needed to apply the given AVColorTransferCharacteristic to linear input.

The function returned should expect a nominal domain and range of [0.0-1.0] values outside of this range maybe valid depending on the chosen characteristic function.

Returns
Will return pointer to the function matching the supplied Transfer Characteristic. If unspecified will return NULL:

Definition at line 170 of file color_utils.c.

Referenced by decode_block(), decode_init(), and main().