FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
colorspace.h File Reference

Various defines for YUV<->RGB conversion. More...

Go to the source code of this file.

Macros

#define SCALEBITS   10
 
#define ONE_HALF   (1 << (SCALEBITS - 1))
 
#define FIX(x)   ((int) ((x) * (1<<SCALEBITS) + 0.5))
 
#define YUV_TO_RGB1_CCIR(cb1, cr1)
 
#define YUV_TO_RGB1_CCIR_BT709(cb1, cr1)
 
#define YUV_TO_RGB2_CCIR(r, g, b, y1)
 
#define YUV_TO_RGB1(cb1, cr1)
 
#define YUV_TO_RGB2(r, g, b, y1)
 
#define Y_CCIR_TO_JPEG(y)   cm[((y) * FIX(255.0/219.0) + (ONE_HALF - 16 * FIX(255.0/219.0))) >> SCALEBITS]
 
#define Y_JPEG_TO_CCIR(y)   (((y) * FIX(219.0/255.0) + (ONE_HALF + (16 << SCALEBITS))) >> SCALEBITS)
 
#define C_CCIR_TO_JPEG(y)   cm[(((y) - 128) * FIX(127.0/112.0) + (ONE_HALF + (128 << SCALEBITS))) >> SCALEBITS]
 
#define RGB_TO_Y_CCIR(r, g, b)
 
#define RGB_TO_U_CCIR(r1, g1, b1, shift)
 
#define RGB_TO_V_CCIR(r1, g1, b1, shift)
 

Functions

static int C_JPEG_TO_CCIR (int y)
 

Detailed Description

Various defines for YUV<->RGB conversion.

Definition in file colorspace.h.

Macro Definition Documentation

#define SCALEBITS   10

Definition at line 30 of file colorspace.h.

Referenced by C_JPEG_TO_CCIR().

#define ONE_HALF   (1 << (SCALEBITS - 1))

Definition at line 31 of file colorspace.h.

Referenced by C_JPEG_TO_CCIR().

#define FIX (   x)    ((int) ((x) * (1<<SCALEBITS) + 0.5))

Definition at line 32 of file colorspace.h.

Referenced by C_JPEG_TO_CCIR().

#define YUV_TO_RGB1_CCIR (   cb1,
  cr1 
)
Value:
{\
cb = (cb1) - 128;\
cr = (cr1) - 128;\
r_add = FIX(1.40200*255.0/224.0) * cr + ONE_HALF;\
g_add = - FIX(0.34414*255.0/224.0) * cb - FIX(0.71414*255.0/224.0) * cr + \
b_add = FIX(1.77200*255.0/224.0) * cb + ONE_HALF;\
}
#define ONE_HALF
Definition: colorspace.h:31
#define FIX(x)
Definition: colorspace.h:32
static double cb(void *priv, double x, double y)
Definition: vf_geq.c:97
static double cr(void *priv, double x, double y)
Definition: vf_geq.c:98

Definition at line 34 of file colorspace.h.

Referenced by dvbsub_parse_clut_segment(), parse_ifo_palette(), parse_palette_segment(), and yuv_a_to_rgba().

#define YUV_TO_RGB1_CCIR_BT709 (   cb1,
  cr1 
)
Value:
{ \
cb = (cb1) - 128; \
cr = (cr1) - 128; \
r_add = ONE_HALF + FIX(1.5747 * 255.0 / 224.0) * cr; \
g_add = ONE_HALF - FIX(0.1873 * 255.0 / 224.0) * cb - \
FIX(0.4682 * 255.0 / 224.0) * cr; \
b_add = ONE_HALF + FIX(1.8556 * 255.0 / 224.0) * cb; \
}
#define ONE_HALF
Definition: colorspace.h:31
#define FIX(x)
Definition: colorspace.h:32
static double cb(void *priv, double x, double y)
Definition: vf_geq.c:97
static double cr(void *priv, double x, double y)
Definition: vf_geq.c:98

Definition at line 44 of file colorspace.h.

Referenced by parse_palette_segment().

#define YUV_TO_RGB2_CCIR (   r,
  g,
  b,
  y1 
)
Value:
{\
y = ((y1) - 16) * FIX(255.0/219.0);\
r = cm[(y + r_add) >> SCALEBITS];\
g = cm[(y + g_add) >> SCALEBITS];\
b = cm[(y + b_add) >> SCALEBITS];\
}
#define FIX(x)
Definition: colorspace.h:32
const char * g
Definition: vf_curves.c:112
const char * b
Definition: vf_curves.c:113
#define cm
Definition: dvbsubdec.c:36
const char * r
Definition: vf_curves.c:111
#define SCALEBITS
Definition: colorspace.h:30

Definition at line 55 of file colorspace.h.

Referenced by dvbsub_parse_clut_segment(), parse_ifo_palette(), parse_palette_segment(), and yuv_a_to_rgba().

#define YUV_TO_RGB1 (   cb1,
  cr1 
)
Value:
{\
cb = (cb1) - 128;\
cr = (cr1) - 128;\
r_add = FIX(1.40200) * cr + ONE_HALF;\
g_add = - FIX(0.34414) * cb - FIX(0.71414) * cr + ONE_HALF;\
b_add = FIX(1.77200) * cb + ONE_HALF;\
}
#define ONE_HALF
Definition: colorspace.h:31
#define FIX(x)
Definition: colorspace.h:32
static double cb(void *priv, double x, double y)
Definition: vf_geq.c:97
static double cr(void *priv, double x, double y)
Definition: vf_geq.c:98

Definition at line 63 of file colorspace.h.

#define YUV_TO_RGB2 (   r,
  g,
  b,
  y1 
)
Value:
{\
y = (y1) << SCALEBITS;\
r = cm[(y + r_add) >> SCALEBITS];\
g = cm[(y + g_add) >> SCALEBITS];\
b = cm[(y + b_add) >> SCALEBITS];\
}
const char * g
Definition: vf_curves.c:112
const char * b
Definition: vf_curves.c:113
#define cm
Definition: dvbsubdec.c:36
const char * r
Definition: vf_curves.c:111
#define SCALEBITS
Definition: colorspace.h:30

Definition at line 72 of file colorspace.h.

#define Y_CCIR_TO_JPEG (   y)    cm[((y) * FIX(255.0/219.0) + (ONE_HALF - 16 * FIX(255.0/219.0))) >> SCALEBITS]

Definition at line 80 of file colorspace.h.

#define Y_JPEG_TO_CCIR (   y)    (((y) * FIX(219.0/255.0) + (ONE_HALF + (16 << SCALEBITS))) >> SCALEBITS)

Definition at line 83 of file colorspace.h.

#define C_CCIR_TO_JPEG (   y)    cm[(((y) - 128) * FIX(127.0/112.0) + (ONE_HALF + (128 << SCALEBITS))) >> SCALEBITS]

Definition at line 86 of file colorspace.h.

#define RGB_TO_Y_CCIR (   r,
  g,
  b 
)
Value:
((FIX(0.29900*219.0/255.0) * (r) + FIX(0.58700*219.0/255.0) * (g) + \
FIX(0.11400*219.0/255.0) * (b) + (ONE_HALF + (16 << SCALEBITS))) >> SCALEBITS)
#define ONE_HALF
Definition: colorspace.h:31
#define FIX(x)
Definition: colorspace.h:32
const char * g
Definition: vf_curves.c:112
const char * b
Definition: vf_curves.c:113
const char * r
Definition: vf_curves.c:111
#define SCALEBITS
Definition: colorspace.h:30

Definition at line 98 of file colorspace.h.

Referenced by encode_dvb_subtitles(), ff_draw_color(), ff_fill_line_with_color(), and init().

#define RGB_TO_U_CCIR (   r1,
  g1,
  b1,
  shift 
)
Value:
(((- FIX(0.16874*224.0/255.0) * r1 - FIX(0.33126*224.0/255.0) * g1 + \
FIX(0.50000*224.0/255.0) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128)
#define ONE_HALF
Definition: colorspace.h:31
static int shift(int a, int b)
Definition: sonic.c:82
#define FIX(x)
Definition: colorspace.h:32
#define SCALEBITS
Definition: colorspace.h:30

Definition at line 102 of file colorspace.h.

Referenced by encode_dvb_subtitles(), ff_draw_color(), ff_fill_line_with_color(), and init().

#define RGB_TO_V_CCIR (   r1,
  g1,
  b1,
  shift 
)
Value:
(((FIX(0.50000*224.0/255.0) * r1 - FIX(0.41869*224.0/255.0) * g1 - \
FIX(0.08131*224.0/255.0) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128)
#define ONE_HALF
Definition: colorspace.h:31
static int shift(int a, int b)
Definition: sonic.c:82
#define FIX(x)
Definition: colorspace.h:32
#define SCALEBITS
Definition: colorspace.h:30

Definition at line 106 of file colorspace.h.

Referenced by encode_dvb_subtitles(), ff_draw_color(), ff_fill_line_with_color(), and init().

Function Documentation

static int C_JPEG_TO_CCIR ( int  y)
inlinestatic

Definition at line 90 of file colorspace.h.