FFmpeg
Loading...
Searching...
No Matches
yuv2rgb.c File Reference
#include <stddef.h>
#include <stdint.h>
#include "libavutil/bswap.h"
#include "libavutil/mem.h"
#include "config.h"
#include "swscale.h"
#include "swscale_internal.h"
#include "libavutil/pixdesc.h"

Go to the source code of this file.

Macros

#define LOADCHROMA(l, i)
 
#define PUTRGB(l, i, abase)
 
#define PUTRGB24(l, i, abase)
 
#define PUTBGR24(l, i, abase)
 
#define PUTRGBA(l, i, abase)
 
#define PUTRGB48(l, i, abase)
 
#define PUTBGR48(l, i, abase)
 
#define PUTGBRP(l, i, abase)
 
#define YUV2RGBFUNC(func_name, dst_type, alpha, yuv422, nb_dst_planes)
 
#define ENDYUV2RGBLINE(dst_delta, ss, alpha, yuv422, nb_dst_planes)
 
#define ENDYUV2RGBFUNC()
 
#define YUV420FUNC(func_name, dst_type, alpha, abase, PUTFUNC, dst_delta, nb_dst_planes)
 
#define YUV422FUNC(func_name, dst_type, alpha, abase, PUTFUNC, dst_delta, nb_dst_planes)
 
#define YUV420FUNC_DITHER(func_name, dst_type, LOADDITHER, PUTFUNC, dst_delta)
 
#define YUV422FUNC_DITHER(func_name, dst_type, LOADDITHER, PUTFUNC, dst_delta)
 
#define LOADDITHER16
 
#define PUTRGB16(l, i, o)
 
#define LOADDITHER15
 
#define PUTRGB15(l, i, o)
 
#define LOADDITHER12    const uint8_t *d16 = ff_dither_4x4_16[y & 3];
 
#define PUTRGB12(l, i, o)
 
#define LOADDITHER8
 
#define PUTRGB8(l, i, o)
 
#define LOADDITHER4D
 
#define PUTRGB4D(l, i, o)
 
#define LOADDITHER4DB
 
#define PUTRGB4DB(l, i, o)
 
#define PUTRGB1(out, src, i, o)
 
#define PUTRGB1_OR00(out, src, i, o)
 
#define ALLOC_YUV_TABLE(x)
 

Functions

const int * sws_getCoefficients (int colorspace)
 Return a pointer to yuv<->rgb coefficients for the given colorspace suitable for sws_setColorspaceDetails().
 
 PUTRGB1 (out_1, py_1, 0, 0)
 
 PUTRGB1 (out_2, py_2, 0, 0+8)
 
 PUTRGB1 (out_2, py_2, 1, 2+8)
 
 PUTRGB1 (out_1, py_1, 1, 2)
 
 PUTRGB1 (out_1, py_1, 2, 4)
 
 PUTRGB1 (out_2, py_2, 2, 4+8)
 
 PUTRGB1 (out_2, py_2, 3, 6+8)
 
 PUTRGB1 (out_1, py_1, 3, 6)
 
 if (c->opts.dst_w &7)
 

Variables

const int32_t ff_yuv2rgb_coeffs [11][4]
 
const uint8_t * d128 = ff_dither_8x8_220[yd & 7]
 
char out_1 = 0
 
char out_2 = 0
 
 g = c->table_gU[128 + YUVRGB_TABLE_HEADROOM] + c->table_gV[128 + YUVRGB_TABLE_HEADROOM]
 
 dst_1 [0] = out_1
 
 dst_2 [0] = out_2
 
 py_1 = 8
 
 py_2 = 8
 

Macro Definition Documentation

◆ LOADCHROMA

#define LOADCHROMA ( l,
i )
Value:
U = pu_##l[i]; \
V = pv_##l[i]; \
r = (void *)c->table_rV[V+YUVRGB_TABLE_HEADROOM]; \
g = (void *)(c->table_gU[U+YUVRGB_TABLE_HEADROOM] + c->table_gV[V+YUVRGB_TABLE_HEADROOM]); \
b = (void *)c->table_bU[U+YUVRGB_TABLE_HEADROOM];
#define U(x)
Definition vpx_arith.h:37
#define V
Definition avdct.c:32
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define r
Definition input.c:42
#define b
Definition input.c:43
#define YUVRGB_TABLE_HEADROOM
const char * g
Definition vf_curves.c:128
static double c[64]

Definition at line 68 of file yuv2rgb.c.

◆ PUTRGB

#define PUTRGB ( l,
i,
abase )
Value:
Y = py_##l[2 * i]; \
dst_##l[2 * i] = r[Y] + g[Y] + b[Y]; \
Y = py_##l[2 * i + 1]; \
dst_##l[2 * i + 1] = r[Y] + g[Y] + b[Y];
#define Y
Definition boxblur.h:37

Definition at line 75 of file yuv2rgb.c.

◆ PUTRGB24

#define PUTRGB24 ( l,
i,
abase )
Value:
Y = py_##l[2 * i]; \
dst_##l[6 * i + 0] = r[Y]; \
dst_##l[6 * i + 1] = g[Y]; \
dst_##l[6 * i + 2] = b[Y]; \
Y = py_##l[2 * i + 1]; \
dst_##l[6 * i + 3] = r[Y]; \
dst_##l[6 * i + 4] = g[Y]; \
dst_##l[6 * i + 5] = b[Y];

Definition at line 81 of file yuv2rgb.c.

◆ PUTBGR24

#define PUTBGR24 ( l,
i,
abase )
Value:
Y = py_##l[2 * i]; \
dst_##l[6 * i + 0] = b[Y]; \
dst_##l[6 * i + 1] = g[Y]; \
dst_##l[6 * i + 2] = r[Y]; \
Y = py_##l[2 * i + 1]; \
dst_##l[6 * i + 3] = b[Y]; \
dst_##l[6 * i + 4] = g[Y]; \
dst_##l[6 * i + 5] = r[Y];

Definition at line 91 of file yuv2rgb.c.

◆ PUTRGBA

#define PUTRGBA ( l,
i,
abase )
Value:
Y = py_##l[2 * i]; \
dst_##l[2 * i] = r[Y] + g[Y] + b[Y] + ((uint32_t)(pa_##l[2 * i]) << abase); \
Y = py_##l[2 * i + 1]; \
dst_##l[2 * i + 1] = r[Y] + g[Y] + b[Y] + ((uint32_t)(pa_##l[2 * i + 1]) << abase);

Definition at line 101 of file yuv2rgb.c.

Referenced by if().

◆ PUTRGB48

#define PUTRGB48 ( l,
i,
abase )
Value:
Y = py_##l[ 2 * i]; \
dst_##l[12 * i + 0] = dst_##l[12 * i + 1] = r[Y]; \
dst_##l[12 * i + 2] = dst_##l[12 * i + 3] = g[Y]; \
dst_##l[12 * i + 4] = dst_##l[12 * i + 5] = b[Y]; \
Y = py_##l[ 2 * i + 1]; \
dst_##l[12 * i + 6] = dst_##l[12 * i + 7] = r[Y]; \
dst_##l[12 * i + 8] = dst_##l[12 * i + 9] = g[Y]; \
dst_##l[12 * i + 10] = dst_##l[12 * i + 11] = b[Y];

Definition at line 107 of file yuv2rgb.c.

Referenced by if().

◆ PUTBGR48

#define PUTBGR48 ( l,
i,
abase )
Value:
Y = py_##l[2 * i]; \
dst_##l[12 * i + 0] = dst_##l[12 * i + 1] = b[Y]; \
dst_##l[12 * i + 2] = dst_##l[12 * i + 3] = g[Y]; \
dst_##l[12 * i + 4] = dst_##l[12 * i + 5] = r[Y]; \
Y = py_##l[2 * i + 1]; \
dst_##l[12 * i + 6] = dst_##l[12 * i + 7] = b[Y]; \
dst_##l[12 * i + 8] = dst_##l[12 * i + 9] = g[Y]; \
dst_##l[12 * i + 10] = dst_##l[12 * i + 11] = r[Y];

Definition at line 117 of file yuv2rgb.c.

Referenced by if().

◆ PUTGBRP

#define PUTGBRP ( l,
i,
abase )
Value:
Y = py_##l[2 * i]; \
dst_##l [2 * i + 0] = g[Y]; \
dst1_##l[2 * i + 0] = b[Y]; \
dst2_##l[2 * i + 0] = r[Y]; \
Y = py_##l[2 * i + 1]; \
dst_##l [2 * i + 1] = g[Y]; \
dst1_##l[2 * i + 1] = b[Y]; \
dst2_##l[2 * i + 1] = r[Y];

Definition at line 127 of file yuv2rgb.c.

Referenced by if().

◆ YUV2RGBFUNC

#define YUV2RGBFUNC ( func_name,
dst_type,
alpha,
yuv422,
nb_dst_planes )

Definition at line 137 of file yuv2rgb.c.

◆ ENDYUV2RGBLINE

#define ENDYUV2RGBLINE ( dst_delta,
ss,
alpha,
yuv422,
nb_dst_planes )
Value:
pu_1 += 4 >> ss; \
pv_1 += 4 >> ss; \
if (yuv422) { \
pu_2 += 4 >> ss; \
pv_2 += 4 >> ss; \
} \
py_1 += 8 >> ss; \
py_2 += 8 >> ss; \
if (alpha) { \
pa_1 += 8 >> ss; \
pa_2 += 8 >> ss; \
} \
dst_1 += dst_delta >> ss; \
dst_2 += dst_delta >> ss; \
if (nb_dst_planes > 1) { \
dst1_1 += dst_delta >> ss; \
dst1_2 += dst_delta >> ss; \
dst2_1 += dst_delta >> ss; \
dst2_2 += dst_delta >> ss; \
} \
} \
if (c->opts.dst_w & (4 >> ss)) { \
av_unused int Y, U, V; \
#define ss(width, name, subs,...)
Definition cbs_vp9.c:202
static const int16_t alpha[]
Definition ilbcdata.h:55
#define av_unused
Definition attributes.h:164
py_2
Definition yuv2rgb.c:484
py_1
Definition yuv2rgb.c:483
dst_1[0]
Definition yuv2rgb.c:480
dst_2[0]
Definition yuv2rgb.c:481

Definition at line 176 of file yuv2rgb.c.

◆ ENDYUV2RGBFUNC

#define ENDYUV2RGBFUNC ( )
Value:
} \
} \
return srcSliceH; \
}

Definition at line 201 of file yuv2rgb.c.

Referenced by if().

◆ YUV420FUNC

#define YUV420FUNC ( func_name,
dst_type,
alpha,
abase,
PUTFUNC,
dst_delta,
nb_dst_planes )
Value:
YUV2RGBFUNC(func_name, dst_type, alpha, 0, nb_dst_planes) \
LOADCHROMA(1, 0); \
PUTFUNC(1, 0, abase); \
PUTFUNC(2, 0, abase); \
\
LOADCHROMA(1, 1); \
PUTFUNC(2, 1, abase); \
PUTFUNC(1, 1, abase); \
\
LOADCHROMA(1, 2); \
PUTFUNC(1, 2, abase); \
PUTFUNC(2, 2, abase); \
\
LOADCHROMA(1, 3); \
PUTFUNC(2, 3, abase); \
PUTFUNC(1, 3, abase); \
ENDYUV2RGBLINE(dst_delta, 0, alpha, 0, nb_dst_planes) \
LOADCHROMA(1, 0); \
PUTFUNC(1, 0, abase); \
PUTFUNC(2, 0, abase); \
\
LOADCHROMA(1, 1); \
PUTFUNC(2, 1, abase); \
PUTFUNC(1, 1, abase); \
ENDYUV2RGBLINE(dst_delta, 1, alpha, 0, nb_dst_planes) \
LOADCHROMA(1, 0); \
PUTFUNC(1, 0, abase); \
PUTFUNC(2, 0, abase); \
ENDYUV2RGBFUNC()
#define YUV2RGBFUNC(func_name, dst_type, alpha)

Definition at line 207 of file yuv2rgb.c.

Referenced by if().

◆ YUV422FUNC

#define YUV422FUNC ( func_name,
dst_type,
alpha,
abase,
PUTFUNC,
dst_delta,
nb_dst_planes )

Definition at line 238 of file yuv2rgb.c.

Referenced by if().

◆ YUV420FUNC_DITHER

#define YUV420FUNC_DITHER ( func_name,
dst_type,
LOADDITHER,
PUTFUNC,
dst_delta )

Definition at line 283 of file yuv2rgb.c.

Referenced by if().

◆ YUV422FUNC_DITHER

#define YUV422FUNC_DITHER ( func_name,
dst_type,
LOADDITHER,
PUTFUNC,
dst_delta )

Definition at line 320 of file yuv2rgb.c.

Referenced by if().

◆ LOADDITHER16

#define LOADDITHER16
Value:
const uint8_t *d16 = ff_dither_2x2_8[y & 1]; \
const uint8_t *e16 = ff_dither_2x2_4[y & 1]; \
const uint8_t *f16 = ff_dither_2x2_8[(y & 1)^1];
const uint8_t ff_dither_2x2_4[][8]
Definition output.c:40
const uint8_t ff_dither_2x2_8[][8]
Definition output.c:46

Definition at line 371 of file yuv2rgb.c.

Referenced by if().

◆ PUTRGB16

#define PUTRGB16 ( l,
i,
o )
Value:
Y = py_##l[2 * i]; \
dst_##l[2 * i] = r[Y + d16[0 + o]] + \
g[Y + e16[0 + o]] + \
b[Y + f16[0 + o]]; \
Y = py_##l[2 * i + 1]; \
dst_##l[2 * i + 1] = r[Y + d16[1 + o]] + \
g[Y + e16[1 + o]] + \
b[Y + f16[1 + o]];

Definition at line 376 of file yuv2rgb.c.

Referenced by if().

◆ LOADDITHER15

#define LOADDITHER15
Value:
const uint8_t *d16 = ff_dither_2x2_8[y & 1]; \
const uint8_t *e16 = ff_dither_2x2_8[(y & 1)^1];

Definition at line 386 of file yuv2rgb.c.

Referenced by if().

◆ PUTRGB15

#define PUTRGB15 ( l,
i,
o )
Value:
Y = py_##l[2 * i]; \
dst_##l[2 * i] = r[Y + d16[0 + o]] + \
g[Y + d16[1 + o]] + \
b[Y + e16[0 + o]]; \
Y = py_##l[2 * i + 1]; \
dst_##l[2 * i + 1] = r[Y + d16[1 + o]] + \
g[Y + d16[0 + o]] + \
b[Y + e16[1 + o]];

Definition at line 390 of file yuv2rgb.c.

Referenced by if().

◆ LOADDITHER12

#define LOADDITHER12    const uint8_t *d16 = ff_dither_4x4_16[y & 3];

Definition at line 400 of file yuv2rgb.c.

Referenced by if().

◆ PUTRGB12

#define PUTRGB12 ( l,
i,
o )
Value:
Y = py_##l[2 * i]; \
dst_##l[2 * i] = r[Y + d16[0 + o]] + \
g[Y + d16[0 + o]] + \
b[Y + d16[0 + o]]; \
Y = py_##l[2 * i + 1]; \
dst_##l[2 * i + 1] = r[Y + d16[1 + o]] + \
g[Y + d16[1 + o]] + \
b[Y + d16[1 + o]];

Definition at line 403 of file yuv2rgb.c.

Referenced by if().

◆ LOADDITHER8

#define LOADDITHER8
Value:
const uint8_t *d32 = ff_dither_8x8_32[yd & 7]; \
const uint8_t *d64 = ff_dither_8x8_73[yd & 7];
const uint8_t ff_dither_8x8_73[][8]
Definition output.c:72
const uint8_t ff_dither_8x8_32[][8]
Definition output.c:60

Definition at line 413 of file yuv2rgb.c.

Referenced by if().

◆ PUTRGB8

#define PUTRGB8 ( l,
i,
o )
Value:
Y = py_##l[2 * i]; \
dst_##l[2 * i] = r[Y + d32[0 + o]] + \
g[Y + d32[0 + o]] + \
b[Y + d64[0 + o]]; \
Y = py_##l[2 * i + 1]; \
dst_##l[2 * i + 1] = r[Y + d32[1 + o]] + \
g[Y + d32[1 + o]] + \
b[Y + d64[1 + o]];

Definition at line 417 of file yuv2rgb.c.

Referenced by if().

◆ LOADDITHER4D

#define LOADDITHER4D
Value:
const uint8_t * d64 = ff_dither_8x8_73[yd & 7]; \
const uint8_t *d128 = ff_dither_8x8_220[yd & 7]; \
int acc;
const uint8_t ff_dither_8x8_220[][8]
Definition output.c:85
const uint8_t * d128
Definition yuv2rgb.c:458

Definition at line 427 of file yuv2rgb.c.

Referenced by if().

◆ PUTRGB4D

#define PUTRGB4D ( l,
i,
o )
Value:
Y = py_##l[2 * i]; \
acc = r[Y + d128[0 + o]] + \
g[Y + d64[0 + o]] + \
b[Y + d128[0 + o]]; \
Y = py_##l[2 * i + 1]; \
acc |= (r[Y + d128[1 + o]] + \
g[Y + d64[1 + o]] + \
b[Y + d128[1 + o]]) << 4; \
dst_##l[i] = acc;

Definition at line 432 of file yuv2rgb.c.

Referenced by if().

◆ LOADDITHER4DB

#define LOADDITHER4DB
Value:
const uint8_t *d64 = ff_dither_8x8_73[yd & 7]; \
const uint8_t *d128 = ff_dither_8x8_220[yd & 7];

Definition at line 443 of file yuv2rgb.c.

Referenced by if().

◆ PUTRGB4DB

#define PUTRGB4DB ( l,
i,
o )
Value:
Y = py_##l[2 * i]; \
dst_##l[2 * i] = r[Y + d128[0 + o]] + \
g[Y + d64[0 + o]] + \
b[Y + d128[0 + o]]; \
Y = py_##l[2 * i + 1]; \
dst_##l[2 * i + 1] = r[Y + d128[1 + o]] + \
g[Y + d64[1 + o]] + \
b[Y + d128[1 + o]];

Definition at line 447 of file yuv2rgb.c.

Referenced by if().

◆ PUTRGB1

#define PUTRGB1 ( out,
src,
i,
o )
Value:
Y = src[2 * i]; \
out += out + g[Y + d128[0 + o]]; \
Y = src[2 * i + 1]; \
out += out + g[Y + d128[1 + o]];
#define src
Definition vp8dsp.c:248
static FILE * out
Definition movenc.c:55

Definition at line 462 of file yuv2rgb.c.

◆ PUTRGB1_OR00

#define PUTRGB1_OR00 ( out,
src,
i,
o )
Value:
if (pixels_left) { \
PUTRGB1(out, src, i, o) \
pixels_left--; \
} else { \
out <<= 2; \
}

Referenced by if().

◆ ALLOC_YUV_TABLE

#define ALLOC_YUV_TABLE ( x)
Value:
c->yuvTable = av_malloc(x); \
if (!c->yuvTable) \
return AVERROR(ENOMEM);
#define AVERROR(e)
Definition error.h:45
#define av_malloc(s)
Definition ops_static.c:52

Referenced by if().

Function Documentation

◆ PUTRGB1() [1/8]

PUTRGB1 ( out_1 ,
py_1 ,
0 ,
0  )

◆ PUTRGB1() [2/8]

PUTRGB1 ( out_2 ,
py_2 ,
0 ,
0+ 8 )

◆ PUTRGB1() [3/8]

PUTRGB1 ( out_2 ,
py_2 ,
1 ,
2+ 8 )

◆ PUTRGB1() [4/8]

PUTRGB1 ( out_1 ,
py_1 ,
1 ,
2  )

◆ PUTRGB1() [5/8]

PUTRGB1 ( out_1 ,
py_1 ,
2 ,
4  )

◆ PUTRGB1() [6/8]

PUTRGB1 ( out_2 ,
py_2 ,
2 ,
4+ 8 )

◆ PUTRGB1() [7/8]

PUTRGB1 ( out_2 ,
py_2 ,
3 ,
6+ 8 )

◆ PUTRGB1() [8/8]

PUTRGB1 ( out_1 ,
py_1 ,
3 ,
6  )

◆ if()

if ( c->opts.dst_w & 7)

Definition at line 488 of file yuv2rgb.c.

Variable Documentation

◆ ff_yuv2rgb_coeffs

const int32_t ff_yuv2rgb_coeffs[11][4]
Initial value:
= {
{ 104597, 132201, 25675, 53279 },
{ 117489, 138438, 13975, 34925 },
{ 104597, 132201, 25675, 53279 },
{ 104597, 132201, 25675, 53279 },
{ 104448, 132798, 24759, 53109 },
{ 104597, 132201, 25675, 53279 },
{ 104597, 132201, 25675, 53279 },
{ 117579, 136230, 16907, 35559 },
{ 0 },
{ 110013, 140363, 12277, 42626 },
{ 110013, 140363, 12277, 42626 },
}

Definition at line 47 of file yuv2rgb.c.

Referenced by ff_sws_init_single_context(), fill_rgb2yuv_table(), and sws_getCoefficients().

◆ d128

◆ out_1

char out_1 = 0

Definition at line 459 of file yuv2rgb.c.

Referenced by if(), PUTRGB1(), PUTRGB1(), PUTRGB1(), and PUTRGB1().

◆ out_2

char out_2 = 0

Definition at line 459 of file yuv2rgb.c.

Referenced by if(), PUTRGB1(), PUTRGB1(), PUTRGB1(), and PUTRGB1().

◆ g

g = c->table_gU[128 + YUVRGB_TABLE_HEADROOM] + c->table_gV[128 + YUVRGB_TABLE_HEADROOM]

Definition at line 460 of file yuv2rgb.c.

◆ dst_1

dst_1 = out_1

Definition at line 480 of file yuv2rgb.c.

Referenced by if().

◆ dst_2

dst_2 = out_2

Definition at line 481 of file yuv2rgb.c.

Referenced by if().

◆ py_1

py_1 = 8

◆ py_2

py_2 = 8