libswscale/yuv2rgb.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <assert.h>
#include "config.h"
#include "rgb2rgb.h"
#include "swscale.h"
#include "swscale_internal.h"
#include "yuv2rgb_template.c"

Go to the source code of this file.

Defines

#define DITHER1XBPP
#define RENAME(a)   a ## _MMX
#define HAVE_MMX
#define HAVE_MMX2
#define RENAME(a)   a ## _MMX2
#define RGB(i)
#define DST1(i)
#define DST2(i)
#define DST1RGB(i)
#define DST2RGB(i)
#define DST1BGR(i)
#define DST2BGR(i)
#define PROLOG(func_name, dst_type)
#define EPILOG1(dst_delta)
#define EPILOG2()
#define EPILOG(dst_delta)
#define DST1bpp8(i, o)
#define DST2bpp8(i, o)
#define DST1_4(i)
#define DST2_4(i)
#define DST1bpp4(i, o)
#define DST2bpp4(i, o)
#define DST1bpp4b(i, o)
#define DST2bpp4b(i, o)
#define DST1bpp1(i, o)
#define DST2bpp1(i, o)

Functions

 DECLARE_ASM_CONST (DECLARE_ASM_CONST(8, DECLARE_ASM_CONST(uint64_t, mmx_00ffw)
 RGB (0)
 DST1 (0)
 DST2 (0)
 RGB (1)
 DST2 (1)
 DST1 (1)
 RGB (2)
 DST1 (2)
 DST2 (2)
 RGB (3)
 DST2 (3)
 DST1 (3)
 DST1RGB (0)
 DST2RGB (0)
 DST2RGB (1)
 DST1RGB (1)
 DST1RGB (2)
 DST2RGB (2)
 DST2RGB (3)
 DST1RGB (3)
 DST1BGR (0)
 DST2BGR (0)
 DST2BGR (1)
 DST1BGR (1)
 DST1BGR (2)
 DST2BGR (2)
 DST2BGR (3)
 DST1BGR (3)
 DST1bpp8 (0, 0)
 DST2bpp8 (0, 0)
 DST2bpp8 (1, 2)
 DST1bpp8 (1, 2)
 DST1bpp8 (2, 4)
 DST2bpp8 (2, 4)
 DST2bpp8 (3, 6)
 DST1bpp8 (3, 6)
 DST1_4 (0)
 DST2_4 (0)
 DST2_4 (1)
 DST1_4 (1)
 DST1_4 (2)
 DST2_4 (2)
 DST2_4 (3)
 DST1_4 (3)
 DST1bpp4 (0, 0)
 DST2bpp4 (0, 0)
 DST2bpp4 (1, 2)
 DST1bpp4 (1, 2)
 DST1bpp4 (2, 4)
 DST2bpp4 (2, 4)
 DST2bpp4 (3, 6)
 DST1bpp4 (3, 6)
 DST1bpp4b (0, 0)
 DST2bpp4b (0, 0)
 DST2bpp4b (1, 2)
 DST1bpp4b (1, 2)
 DST1bpp4b (2, 4)
 DST2bpp4b (2, 4)
 DST2bpp4b (3, 6)
 DST1bpp4b (3, 6)
 DST1bpp1 (0, 0)
 DST2bpp1 (0, 0)
 DST2bpp1 (1, 2)
 DST1bpp1 (1, 2)
 DST1bpp1 (2, 4)
 DST2bpp1 (2, 4)
 DST2bpp1 (3, 6)
 DST1bpp1 (3, 6)
SwsFunc yuv2rgb_get_func_ptr (SwsContext *c)
static int div_round (int dividend, int divisor)
int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation)

Variables

const uint8_t dither_2x2_4 [2][8]
const uint8_t dither_2x2_8 [2][8]
const uint8_t dither_8x8_32 [8][8]
const uint8_t dither_8x8_73 [8][8]
const uint8_t dither_8x8_220 [8][8]
static uint64_t dither8 [2]
const int32_t Inverse_Table_6_9 [8][4]
const uint8_td32 = dither_8x8_32[y&7]
const uint8_td64 = dither_8x8_73[y&7]
int acc
const uint8_td128 = dither_8x8_220[y&7]
char out_1 = 0
char out_2 = 0
 g = c->table_gU[128] + c->table_gV[128]
 dst_1 [0] = out_1
 dst_2 [0] = out_2


Define Documentation

#define DITHER1XBPP

Definition at line 50 of file yuv2rgb.c.

#define DST1 (  ) 

Value:

Y = py_1[2*i];                      \
    dst_1[2*i] = r[Y] + g[Y] + b[Y];    \
    Y = py_1[2*i+1];                    \
    dst_1[2*i+1] = r[Y] + g[Y] + b[Y];

Definition at line 219 of file yuv2rgb.c.

#define DST1_4 (  ) 

Value:

Y = py_1[2*i];                  \
    acc = r[Y] + g[Y] + b[Y];       \
    Y = py_1[2*i+1];                \
    acc |= (r[Y] + g[Y] + b[Y])<<4; \
    dst_1[i] = acc;

Definition at line 458 of file yuv2rgb.c.

#define DST1BGR (  ) 

Value:

Y = py_1[2*i];                                                \
    dst_1[6*i] = b[Y]; dst_1[6*i+1] = g[Y]; dst_1[6*i+2] = r[Y];  \
    Y = py_1[2*i+1];                                              \
    dst_1[6*i+3] = b[Y]; dst_1[6*i+4] = g[Y]; dst_1[6*i+5] = r[Y];

Definition at line 243 of file yuv2rgb.c.

#define DST1bpp1 ( i,
 ) 

Value:

Y = py_1[2*i];                  \
    out_1+= out_1 + g[Y+d128[0+o]]; \
    Y = py_1[2*i+1];                \
    out_1+= out_1 + g[Y+d128[1+o]];

Definition at line 585 of file yuv2rgb.c.

#define DST1bpp4 ( i,
 ) 

Value:

Y = py_1[2*i];                                                \
    acc = r[Y+d128[0+o]] + g[Y+d64[0+o]] + b[Y+d128[0+o]];        \
    Y = py_1[2*i+1];                                              \
    acc |= (r[Y+d128[1+o]] + g[Y+d64[1+o]] + b[Y+d128[1+o]])<<4;  \
    dst_1[i]= acc;

Definition at line 494 of file yuv2rgb.c.

#define DST1bpp4b ( i,
 ) 

Value:

Y = py_1[2*i];                                                    \
    dst_1[2*i]   = r[Y+d128[0+o]] + g[Y+d64[0+o]] + b[Y+d128[0+o]];   \
    Y = py_1[2*i+1];                                                  \
    dst_1[2*i+1] = r[Y+d128[1+o]] + g[Y+d64[1+o]] + b[Y+d128[1+o]];

Definition at line 550 of file yuv2rgb.c.

#define DST1bpp8 ( i,
 ) 

Value:

Y = py_1[2*i];                                                  \
    dst_1[2*i]   = r[Y+d32[0+o]] + g[Y+d32[0+o]] + b[Y+d64[0+o]];   \
    Y = py_1[2*i+1];                                                \
    dst_1[2*i+1] = r[Y+d32[1+o]] + g[Y+d32[1+o]] + b[Y+d64[1+o]];

Definition at line 423 of file yuv2rgb.c.

#define DST1RGB (  ) 

Value:

Y = py_1[2*i];                                                \
    dst_1[6*i] = r[Y]; dst_1[6*i+1] = g[Y]; dst_1[6*i+2] = b[Y];  \
    Y = py_1[2*i+1];                                              \
    dst_1[6*i+3] = r[Y]; dst_1[6*i+4] = g[Y]; dst_1[6*i+5] = b[Y];

Definition at line 231 of file yuv2rgb.c.

#define DST2 (  ) 

Value:

Y = py_2[2*i];                      \
    dst_2[2*i] = r[Y] + g[Y] + b[Y];    \
    Y = py_2[2*i+1];                    \
    dst_2[2*i+1] = r[Y] + g[Y] + b[Y];

Definition at line 225 of file yuv2rgb.c.

#define DST2_4 (  ) 

Value:

Y = py_2[2*i];                  \
    acc = r[Y] + g[Y] + b[Y];       \
    Y = py_2[2*i+1];                \
    acc |= (r[Y] + g[Y] + b[Y])<<4; \
    dst_2[i] = acc;

Definition at line 465 of file yuv2rgb.c.

#define DST2BGR (  ) 

Value:

Y = py_2[2*i];                                                \
    dst_2[6*i] = b[Y]; dst_2[6*i+1] = g[Y]; dst_2[6*i+2] = r[Y];  \
    Y = py_2[2*i+1];                                              \
    dst_2[6*i+3] = b[Y]; dst_2[6*i+4] = g[Y]; dst_2[6*i+5] = r[Y];

Definition at line 249 of file yuv2rgb.c.

#define DST2bpp1 ( i,
 ) 

Value:

Y = py_2[2*i];                  \
    out_2+= out_2 + g[Y+d128[8+o]]; \
    Y = py_2[2*i+1];                \
    out_2+= out_2 + g[Y+d128[9+o]];

Definition at line 591 of file yuv2rgb.c.

#define DST2bpp4 ( i,
 ) 

Value:

Y = py_2[2*i];                                                \
    acc =  r[Y+d128[8+o]] + g[Y+d64[8+o]] + b[Y+d128[8+o]];       \
    Y = py_2[2*i+1];                                              \
    acc |=  (r[Y+d128[9+o]] + g[Y+d64[9+o]] + b[Y+d128[9+o]])<<4; \
    dst_2[i]= acc;

Definition at line 501 of file yuv2rgb.c.

#define DST2bpp4b ( i,
 ) 

Value:

Y = py_2[2*i];                                                    \
    dst_2[2*i]   =  r[Y+d128[8+o]] + g[Y+d64[8+o]] + b[Y+d128[8+o]];  \
    Y = py_2[2*i+1];                                                  \
    dst_2[2*i+1] =  r[Y+d128[9+o]] + g[Y+d64[9+o]] + b[Y+d128[9+o]];

Definition at line 556 of file yuv2rgb.c.

#define DST2bpp8 ( i,
 ) 

Value:

Y = py_2[2*i];                                                  \
    dst_2[2*i]   =  r[Y+d32[8+o]] + g[Y+d32[8+o]] + b[Y+d64[8+o]];  \
    Y = py_2[2*i+1];                                                \
    dst_2[2*i+1] =  r[Y+d32[9+o]] + g[Y+d32[9+o]] + b[Y+d64[9+o]];

Definition at line 429 of file yuv2rgb.c.

#define DST2RGB (  ) 

Value:

Y = py_2[2*i];                                                \
    dst_2[6*i] = r[Y]; dst_2[6*i+1] = g[Y]; dst_2[6*i+2] = b[Y];  \
    Y = py_2[2*i+1];                                              \
    dst_2[6*i+3] = r[Y]; dst_2[6*i+4] = g[Y]; dst_2[6*i+5] = b[Y];

Definition at line 237 of file yuv2rgb.c.

#define EPILOG ( dst_delta   ) 

Value:

EPILOG1(dst_delta)\
    EPILOG2()

Definition at line 296 of file yuv2rgb.c.

#define EPILOG1 ( dst_delta   ) 

Value:

pu += 4;\
            pv += 4;\
            py_1 += 8;\
            py_2 += 8;\
            dst_1 += dst_delta;\
            dst_2 += dst_delta;\
        }\
        if (c->dstW & 4) {\
            int av_unused U, V;\
            int Y;\

Definition at line 278 of file yuv2rgb.c.

 
#define EPILOG2 (  ) 

Value:

}\
    }\
    return srcSliceH;\
}

Definition at line 290 of file yuv2rgb.c.

#define HAVE_MMX

Definition at line 193 of file yuv2rgb.c.

#define HAVE_MMX2

Definition at line 194 of file yuv2rgb.c.

#define PROLOG ( func_name,
dst_type   ) 

Value:

static int func_name(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, \
                     int srcSliceH, uint8_t* dst[], int dstStride[]){\
    int y;\
\
    if (c->srcFormat == PIX_FMT_YUV422P){\
        srcStride[1] *= 2;\
        srcStride[2] *= 2;\
    }\
    for (y=0; y<srcSliceH; y+=2){\
        dst_type *dst_1= (dst_type*)(dst[0] + (y+srcSliceY  )*dstStride[0]);\
        dst_type *dst_2= (dst_type*)(dst[0] + (y+srcSliceY+1)*dstStride[0]);\
        dst_type av_unused *r, *b;\
        dst_type *g;\
        uint8_t *py_1= src[0] + y*srcStride[0];\
        uint8_t *py_2= py_1 + srcStride[0];\
        uint8_t *pu= src[1] + (y>>1)*srcStride[1];\
        uint8_t *pv= src[2] + (y>>1)*srcStride[2];\
        unsigned int h_size= c->dstW>>3;\
        while (h_size--) {\
            int av_unused U, V;\
            int Y;\

Definition at line 255 of file yuv2rgb.c.

#define RENAME (  )     a ## _MMX2

Definition at line 196 of file yuv2rgb.c.

#define RENAME (  )     a ## _MMX

Definition at line 196 of file yuv2rgb.c.

#define RGB (  ) 

Value:

U = pu[i];                                      \
    V = pv[i];                                      \
    r = (void *)c->table_rV[V];                     \
    g = (void *)(c->table_gU[U] + c->table_gV[V]);  \
    b = (void *)c->table_bU[U];

Definition at line 212 of file yuv2rgb.c.


Function Documentation

DECLARE_ASM_CONST ( DECLARE_ASM_CONST(  8,
DECLARE_ASM_CONST(  uint64_t,
mmx_00ffw   
) [pure virtual]

Definition at line 162 of file yuv2rgb.c.

static int div_round ( int  dividend,
int  divisor 
) [static]

Definition at line 685 of file yuv2rgb.c.

Referenced by yuv2rgb_c_init_tables().

DST1 (  ) 

DST1 (  ) 

DST1 (  ) 

DST1 (  ) 

DST1_4 (  ) 

DST1_4 (  ) 

DST1_4 (  ) 

DST1_4 (  ) 

DST1BGR (  ) 

DST1BGR (  ) 

DST1BGR (  ) 

DST1BGR (  ) 

DST1bpp1 ( ,
 
)

DST1bpp1 ( ,
 
)

DST1bpp1 ( ,
 
)

DST1bpp1 ( ,
 
)

DST1bpp4 ( ,
 
)

DST1bpp4 ( ,
 
)

DST1bpp4 ( ,
 
)

DST1bpp4 ( ,
 
)

DST1bpp4b ( ,
 
)

DST1bpp4b ( ,
 
)

DST1bpp4b ( ,
 
)

DST1bpp4b ( ,
 
)

DST1bpp8 ( ,
 
)

DST1bpp8 ( ,
 
)

DST1bpp8 ( ,
 
)

DST1bpp8 ( ,
 
)

DST1RGB (  ) 

DST1RGB (  ) 

DST1RGB (  ) 

DST1RGB (  ) 

DST2 (  ) 

DST2 (  ) 

DST2 (  ) 

DST2 (  ) 

DST2_4 (  ) 

DST2_4 (  ) 

DST2_4 (  ) 

DST2_4 (  ) 

DST2BGR (  ) 

DST2BGR (  ) 

DST2BGR (  ) 

DST2BGR (  ) 

DST2bpp1 ( ,
 
)

DST2bpp1 ( ,
 
)

DST2bpp1 ( ,
 
)

DST2bpp1 ( ,
 
)

DST2bpp4 ( ,
 
)

DST2bpp4 ( ,
 
)

DST2bpp4 ( ,
 
)

DST2bpp4 ( ,
 
)

DST2bpp4b ( ,
 
)

DST2bpp4b ( ,
 
)

DST2bpp4b ( ,
 
)

DST2bpp4b ( ,
 
)

DST2bpp8 ( ,
 
)

DST2bpp8 ( ,
 
)

DST2bpp8 ( ,
 
)

DST2bpp8 ( ,
 
)

DST2RGB (  ) 

DST2RGB (  ) 

DST2RGB (  ) 

DST2RGB (  ) 

RGB (  ) 

RGB (  ) 

RGB (  ) 

RGB (  ) 

int yuv2rgb_c_init_tables ( SwsContext c,
const int  inv_table[4],
int  fullRange,
int  brightness,
int  contrast,
int  saturation 
)

Definition at line 693 of file yuv2rgb.c.

SwsFunc yuv2rgb_get_func_ptr ( SwsContext c  ) 

Definition at line 613 of file yuv2rgb.c.


Variable Documentation

int acc

Definition at line 457 of file yuv2rgb.c.

const uint8_t* d128 = dither_8x8_220[y&7]

Definition at line 491 of file yuv2rgb.c.

const uint8_t* d32 = dither_8x8_32[y&7]

Definition at line 421 of file yuv2rgb.c.

const uint8_t * d64 = dither_8x8_73[y&7]

Definition at line 422 of file yuv2rgb.c.

uint64_t dither8[2] [static]

Initial value:

{
    0x0602060206020602LL,
    0x0004000400040004LL,}

Definition at line 177 of file yuv2rgb.c.

Referenced by swScale_TMPL(), and yuv420_rgb16_TMPL().

const uint8_t dither_2x2_4[2][8]

Initial value:

{
{  1,   3,   1,   3,   1,   3,   1,   3, },
{  2,   0,   2,   0,   2,   0,   2,   0, },
}

Definition at line 52 of file yuv2rgb.c.

const uint8_t dither_2x2_8[2][8]

Initial value:

{
{  6,   2,   6,   2,   6,   2,   6,   2, },
{  0,   4,   0,   4,   0,   4,   0,   4, },
}

Definition at line 57 of file yuv2rgb.c.

const uint8_t dither_8x8_220[8][8]

Initial value:

{
{117,  62, 158, 103, 113,  58, 155, 100, },
{ 34, 199,  21, 186,  31, 196,  17, 182, },
{144,  89, 131,  76, 141,  86, 127,  72, },
{  0, 165,  41, 206,  10, 175,  52, 217, },
{110,  55, 151,  96, 120,  65, 162, 107, },
{ 28, 193,  14, 179,  38, 203,  24, 189, },
{138,  83, 124,  69, 148,  93, 134,  79, },
{  7, 172,  48, 213,   3, 168,  45, 210, },
}

Definition at line 111 of file yuv2rgb.c.

const uint8_t dither_8x8_32[8][8]

Initial value:

{
{ 17,   9,  23,  15,  16,   8,  22,  14, },
{  5,  29,   3,  27,   4,  28,   2,  26, },
{ 21,  13,  19,  11,  20,  12,  18,  10, },
{  0,  24,   6,  30,   1,  25,   7,  31, },
{ 16,   8,  22,  14,  17,   9,  23,  15, },
{  4,  28,   2,  26,   5,  29,   3,  27, },
{ 20,  12,  18,  10,  21,  13,  19,  11, },
{  1,  25,   7,  31,   0,  24,   6,  30, },
}

Definition at line 62 of file yuv2rgb.c.

const uint8_t dither_8x8_73[8][8]

Initial value:

{
{  0,  55,  14,  68,   3,  58,  17,  72, },
{ 37,  18,  50,  32,  40,  22,  54,  35, },
{  9,  64,   5,  59,  13,  67,   8,  63, },
{ 46,  27,  41,  23,  49,  31,  44,  26, },
{  2,  57,  16,  71,   1,  56,  15,  70, },
{ 39,  21,  52,  34,  38,  19,  51,  33, },
{ 11,  66,   7,  62,  10,  65,   6,  60, },
{ 48,  30,  43,  25,  47,  29,  42,  24, },
}

Definition at line 86 of file yuv2rgb.c.

dst_1[0] = out_1

Definition at line 609 of file yuv2rgb.c.

dst_2[0] = out_2

Definition at line 610 of file yuv2rgb.c.

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

Definition at line 583 of file yuv2rgb.c.

const int32_t Inverse_Table_6_9[8][4]

Initial value:

 {
    {117504, 138453, 13954, 34903}, 
    {117504, 138453, 13954, 34903}, 
    {104597, 132201, 25675, 53279}, 
    {104597, 132201, 25675, 53279}, 
    {104448, 132798, 24759, 53109}, 
    {104597, 132201, 25675, 53279}, 
    {104597, 132201, 25675, 53279}, 
    {117579, 136230, 16907, 35559}  
}

Definition at line 201 of file yuv2rgb.c.

char out_1 = 0

Definition at line 582 of file yuv2rgb.c.

char out_2 = 0

Definition at line 582 of file yuv2rgb.c.


Generated on Wed Feb 9 19:10:13 2011 for ffmpeg by  doxygen 1.5.6