libswscale/swscale.c File Reference

#include <inttypes.h>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include "config.h"
#include <assert.h>
#include "swscale.h"
#include "swscale_internal.h"
#include "rgb2rgb.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/x86_cpu.h"
#include "libavutil/avutil.h"
#include "libavutil/bswap.h"
#include "libavutil/pixdesc.h"

Go to the source code of this file.

Defines

#define DITHER1XBPP
#define FAST_BGR2YV12
#define PI   M_PI
#define isPacked(x)
#define RGB2YUV_SHIFT   15
#define BY   ( (int)(0.114*219/255*(1<<RGB2YUV_SHIFT)+0.5))
#define BV   (-(int)(0.081*224/255*(1<<RGB2YUV_SHIFT)+0.5))
#define BU   ( (int)(0.500*224/255*(1<<RGB2YUV_SHIFT)+0.5))
#define GY   ( (int)(0.587*219/255*(1<<RGB2YUV_SHIFT)+0.5))
#define GV   (-(int)(0.419*224/255*(1<<RGB2YUV_SHIFT)+0.5))
#define GU   (-(int)(0.331*224/255*(1<<RGB2YUV_SHIFT)+0.5))
#define RY   ( (int)(0.299*219/255*(1<<RGB2YUV_SHIFT)+0.5))
#define RV   ( (int)(0.500*224/255*(1<<RGB2YUV_SHIFT)+0.5))
#define RU   (-(int)(0.169*224/255*(1<<RGB2YUV_SHIFT)+0.5))
#define YSCALE_YUV_2_PACKEDX_NOCLIP_C(type, alpha)
#define YSCALE_YUV_2_PACKEDX_C(type, alpha)
#define YSCALE_YUV_2_PACKEDX_FULL_C(rnd, alpha)
#define YSCALE_YUV_2_RGBX_FULL_C(rnd, alpha)
#define YSCALE_YUV_2_GRAY16_C
#define YSCALE_YUV_2_RGBX_C(type, alpha)
#define YSCALE_YUV_2_PACKED2_C(type, alpha)
#define YSCALE_YUV_2_GRAY16_2_C
#define YSCALE_YUV_2_RGB2_C(type, alpha)
#define YSCALE_YUV_2_PACKED1_C(type, alpha)
#define YSCALE_YUV_2_GRAY16_1_C
#define YSCALE_YUV_2_RGB1_C(type, alpha)
#define YSCALE_YUV_2_PACKED1B_C(type, alpha)
#define YSCALE_YUV_2_RGB1B_C(type, alpha)
#define YSCALE_YUV_2_MONO2_C
#define YSCALE_YUV_2_MONOX_C
#define YSCALE_YUV_2_ANYRGB_C(func, func2, func_g16, func_monoblack)
#define BGR2Y(type, name, shr, shg, shb, maskr, maskg, maskb, RY, GY, BY, S)
#define BGR2UV(type, name, shr, shg, shb, maska, maskr, maskg, maskb, RU, GU, BU, RV, GV, BV, S)
#define COMPILE_TEMPLATE_MMX   0
#define COMPILE_TEMPLATE_MMX2   0
#define COMPILE_TEMPLATE_AMD3DNOW   0
#define COMPILE_TEMPLATE_ALTIVEC   0
#define isRGBA32(x)
#define CONV_IS(src, dst)   (srcFormat == PIX_FMT_##src && dstFormat == PIX_FMT_##dst)

Functions

static av_always_inline void yuv2yuvX16inC_template (const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize, const int16_t **alpSrc, uint16_t *dest, uint16_t *uDest, uint16_t *vDest, uint16_t *aDest, int dstW, int chrDstW, int big_endian)
static void yuv2yuvX16inC (const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize, const int16_t **alpSrc, uint16_t *dest, uint16_t *uDest, uint16_t *vDest, uint16_t *aDest, int dstW, int chrDstW, enum PixelFormat dstFormat)
static void yuv2yuvXinC (const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, int dstW, int chrDstW)
static void yuv2nv12XinC (const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize, uint8_t *dest, uint8_t *uDest, int dstW, int chrDstW, int dstFormat)
static void yuv2packedXinC (SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
static void yuv2rgbXinC_full (SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
else if (CONFIG_SWSCALE_ALPHA &&c->alpPixBuf)
static void fillPlane (uint8_t *plane, int stride, int width, int height, int y, uint8_t val)
static void rgb48ToY (uint8_t *dst, const uint8_t *src, int width, uint32_t *unused)
static void rgb48ToUV (uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused)
static void rgb48ToUV_half (uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused)
static void abgrToA (uint8_t *dst, const uint8_t *src, long width, uint32_t *unused)
static void palToY (uint8_t *dst, const uint8_t *src, long width, uint32_t *pal)
static void palToUV (uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *pal)
static void monowhite2Y (uint8_t *dst, const uint8_t *src, long width, uint32_t *unused)
static void monoblack2Y (uint8_t *dst, const uint8_t *src, long width, uint32_t *unused)
SwsFunc ff_getSwsFunc (SwsContext *c)
 Returns function pointer to fastest main scaler path function depending on architecture and available optimizations.
static int planarToNv12Wrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[])
static int planarToYuy2Wrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[])
static int planarToUyvyWrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[])
static int yuv422pToYuy2Wrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[])
static int yuv422pToUyvyWrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[])
static int yuyvToYuv420Wrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[])
static int yuyvToYuv422Wrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[])
static int uyvyToYuv420Wrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[])
static int uyvyToYuv422Wrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[])
static int palToRgbWrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
static int rgbToRgbWrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
static int bgr24ToYv12Wrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
static int yvu9ToYv12Wrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
static int packedCopyWrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
static int planarCopyWrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
int ff_hardcodedcpuflags (void)
 Returns the SWS_CPU_CAPS for the optimized code compiled into swscale.
void ff_get_unscaled_swscale (SwsContext *c)
 Sets c->swScale to an unscaled converter if one exists for the specific source and destination formats, bit depths, flags, etc.
static void reset_ptr (const uint8_t *src[], int format)
int sws_scale (SwsContext *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[])
 swscale wrapper, so we don't need to export the SwsContext.
int sws_scale_ordered (SwsContext *c, const uint8_t *const src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
void sws_convertPalette8ToPacked32 (const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
 Converts an 8bit paletted frame into a frame with a color depth of 32-bits.
void sws_convertPalette8ToPacked24 (const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
 Converts an 8bit paletted frame into a frame with a color depth of 24 bits.

Variables

static const double rgb2yuv_table [8][9]
static const uint8_t dither_2x2_4 [2][8]
static const uint8_t dither_2x2_8 [2][8]
const uint8_t dither_4x4_16 [4][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]
 break
case PIX_FMT_ABGR
 aidx = 0
case PIX_FMT_BGR24
case PIX_FMT_BGRA
 dest [aidx] = needAlpha ? A : 255
default __pad0__


Define Documentation

#define BGR2UV ( type,
name,
shr,
shg,
shb,
maska,
maskr,
maskg,
maskb,
RU,
GU,
BU,
RV,
GV,
BV,
S   ) 

Value:

static inline void name(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, const uint8_t *dummy, long width, uint32_t *unused)\
{\
    int i;\
    for (i=0; i<width; i++) {\
        int b= (((const type*)src)[i]&maskb)>>shb;\
        int g= (((const type*)src)[i]&maskg)>>shg;\
        int r= (((const type*)src)[i]&maskr)>>shr;\
\
        dstU[i]= ((RU)*r + (GU)*g + (BU)*b + (257<<((S)-1)))>>(S);\
        dstV[i]= ((RV)*r + (GV)*g + (BV)*b + (257<<((S)-1)))>>(S);\
    }\
}\
static inline void name ## _half(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, const uint8_t *dummy, long width, uint32_t *unused)\
{\
    int i;\
    for (i=0; i<width; i++) {\
        int pix0= ((const type*)src)[2*i+0];\
        int pix1= ((const type*)src)[2*i+1];\
        int g= (pix0&~(maskr|maskb))+(pix1&~(maskr|maskb));\
        int b= ((pix0+pix1-g)&(maskb|(2*maskb)))>>shb;\
        int r= ((pix0+pix1-g)&(maskr|(2*maskr)))>>shr;\
        g&= maskg|(2*maskg);\
\
        g>>=shg;\
\
        dstU[i]= ((RU)*r + (GU)*g + (BU)*b + (257<<(S)))>>((S)+1);\
        dstV[i]= ((RV)*r + (GV)*g + (BV)*b + (257<<(S)))>>((S)+1);\
    }\
}

Definition at line 1070 of file swscale.c.

#define BGR2Y ( type,
name,
shr,
shg,
shb,
maskr,
maskg,
maskb,
RY,
GY,
BY,
S   ) 

Value:

static inline void name(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused)\
{\
    int i;\
    for (i=0; i<width; i++) {\
        int b= (((const type*)src)[i]>>shb)&maskb;\
        int g= (((const type*)src)[i]>>shg)&maskg;\
        int r= (((const type*)src)[i]>>shr)&maskr;\
\
        dst[i]= (((RY)*r + (GY)*g + (BY)*b + (33<<((S)-1)))>>(S));\
    }\
}

Definition at line 1042 of file swscale.c.

#define BU   ( (int)(0.500*224/255*(1<<RGB2YUV_SHIFT)+0.5))

Definition at line 96 of file swscale.c.

#define BV   (-(int)(0.081*224/255*(1<<RGB2YUV_SHIFT)+0.5))

Definition at line 95 of file swscale.c.

#define BY   ( (int)(0.114*219/255*(1<<RGB2YUV_SHIFT)+0.5))

Definition at line 94 of file swscale.c.

#define COMPILE_TEMPLATE_ALTIVEC   0

Definition at line 1182 of file swscale.c.

#define COMPILE_TEMPLATE_AMD3DNOW   0

Definition at line 1181 of file swscale.c.

#define COMPILE_TEMPLATE_MMX   0

Definition at line 1179 of file swscale.c.

#define COMPILE_TEMPLATE_MMX2   0

Definition at line 1180 of file swscale.c.

#define CONV_IS ( src,
dst   )     (srcFormat == PIX_FMT_##src && dstFormat == PIX_FMT_##dst)

Referenced by rgbToRgbWrapper().

#define DITHER1XBPP

Definition at line 76 of file swscale.c.

Referenced by sws_getContext().

#define FAST_BGR2YV12

Definition at line 78 of file swscale.c.

#define GU   (-(int)(0.331*224/255*(1<<RGB2YUV_SHIFT)+0.5))

Definition at line 99 of file swscale.c.

#define GV   (-(int)(0.419*224/255*(1<<RGB2YUV_SHIFT)+0.5))

Definition at line 98 of file swscale.c.

#define GY   ( (int)(0.587*219/255*(1<<RGB2YUV_SHIFT)+0.5))

Definition at line 97 of file swscale.c.

#define isPacked (  ) 

Value:

(       \
           (x)==PIX_FMT_PAL8        \
        || (x)==PIX_FMT_YUYV422     \
        || (x)==PIX_FMT_UYVY422     \
        || isAnyRGB(x)              \
    )

Definition at line 86 of file swscale.c.

Referenced by ff_get_unscaled_swscale().

#define isRGBA32 (  ) 

Value:

(            \
           (x) == PIX_FMT_ARGB   \
        || (x) == PIX_FMT_RGBA   \
        || (x) == PIX_FMT_BGRA   \
        || (x) == PIX_FMT_ABGR   \
        )

Definition at line 1450 of file swscale.c.

Referenced by rgbToRgbWrapper().

#define PI   M_PI

Definition at line 81 of file swscale.c.

#define RGB2YUV_SHIFT   15

Definition at line 93 of file swscale.c.

#define RU   (-(int)(0.169*224/255*(1<<RGB2YUV_SHIFT)+0.5))

Definition at line 102 of file swscale.c.

#define RV   ( (int)(0.500*224/255*(1<<RGB2YUV_SHIFT)+0.5))

Definition at line 101 of file swscale.c.

#define RY   ( (int)(0.299*219/255*(1<<RGB2YUV_SHIFT)+0.5))

Definition at line 100 of file swscale.c.

#define YSCALE_YUV_2_ANYRGB_C ( func,
func2,
func_g16,
func_monoblack   ) 

Definition at line 685 of file swscale.c.

Referenced by yuv2packedXinC().

#define YSCALE_YUV_2_GRAY16_1_C

Value:

for (i=0; i<(dstW>>1); i++) {\
        const int i2= 2*i;\
        int Y1= buf0[i2  ]<<1;\
        int Y2= buf0[i2+1]<<1;

Definition at line 607 of file swscale.c.

#define YSCALE_YUV_2_GRAY16_2_C

Value:

for (i=0; i<(dstW>>1); i++) { \
        const int i2= 2*i;       \
        int Y1= (buf0[i2  ]*yalpha1+buf1[i2  ]*yalpha)>>11;           \
        int Y2= (buf0[i2+1]*yalpha1+buf1[i2+1]*yalpha)>>11;

Definition at line 581 of file swscale.c.

#define YSCALE_YUV_2_GRAY16_C

Value:

for (i=0; i<(dstW>>1); i++) {\
        int j;\
        int Y1 = 1<<18;\
        int Y2 = 1<<18;\
        int U  = 1<<18;\
        int V  = 1<<18;\
        \
        const int i2= 2*i;\
        \
        for (j=0; j<lumFilterSize; j++) {\
            Y1 += lumSrc[j][i2] * lumFilter[j];\
            Y2 += lumSrc[j][i2+1] * lumFilter[j];\
        }\
        Y1>>=11;\
        Y2>>=11;\
        if ((Y1|Y2|U|V)&65536) {\
            if (Y1>65535)   Y1=65535; \
            else if (Y1<0)Y1=0;   \
            if (Y2>65535)   Y2=65535; \
            else if (Y2<0)Y2=0;   \
        }

Definition at line 538 of file swscale.c.

Referenced by yuv2packedXinC().

#define YSCALE_YUV_2_MONO2_C

Value:

const uint8_t * const d128=dither_8x8_220[y&7];\
    uint8_t *g= c->table_gU[128] + c->table_gV[128];\
    for (i=0; i<dstW-7; i+=8) {\
        int acc;\
        acc =       g[((buf0[i  ]*yalpha1+buf1[i  ]*yalpha)>>19) + d128[0]];\
        acc+= acc + g[((buf0[i+1]*yalpha1+buf1[i+1]*yalpha)>>19) + d128[1]];\
        acc+= acc + g[((buf0[i+2]*yalpha1+buf1[i+2]*yalpha)>>19) + d128[2]];\
        acc+= acc + g[((buf0[i+3]*yalpha1+buf1[i+3]*yalpha)>>19) + d128[3]];\
        acc+= acc + g[((buf0[i+4]*yalpha1+buf1[i+4]*yalpha)>>19) + d128[4]];\
        acc+= acc + g[((buf0[i+5]*yalpha1+buf1[i+5]*yalpha)>>19) + d128[5]];\
        acc+= acc + g[((buf0[i+6]*yalpha1+buf1[i+6]*yalpha)>>19) + d128[6]];\
        acc+= acc + g[((buf0[i+7]*yalpha1+buf1[i+7]*yalpha)>>19) + d128[7]];\
        ((uint8_t*)dest)[0]= c->dstFormat == PIX_FMT_MONOBLACK ? acc : ~acc;\
        dest++;\
    }

Definition at line 639 of file swscale.c.

#define YSCALE_YUV_2_MONOX_C

Value:

const uint8_t * const d128=dither_8x8_220[y&7];\
    uint8_t *g= c->table_gU[128] + c->table_gV[128];\
    int acc=0;\
    for (i=0; i<dstW-1; i+=2) {\
        int j;\
        int Y1=1<<18;\
        int Y2=1<<18;\
\
        for (j=0; j<lumFilterSize; j++) {\
            Y1 += lumSrc[j][i] * lumFilter[j];\
            Y2 += lumSrc[j][i+1] * lumFilter[j];\
        }\
        Y1>>=19;\
        Y2>>=19;\
        if ((Y1|Y2)&256) {\
            if (Y1>255)   Y1=255;\
            else if (Y1<0)Y1=0;\
            if (Y2>255)   Y2=255;\
            else if (Y2<0)Y2=0;\
        }\
        acc+= acc + g[Y1+d128[(i+0)&7]];\
        acc+= acc + g[Y2+d128[(i+1)&7]];\
        if ((i&7)==6) {\
            ((uint8_t*)dest)[0]= c->dstFormat == PIX_FMT_MONOBLACK ? acc : ~acc;\
            dest++;\
        }\
    }

Definition at line 656 of file swscale.c.

Referenced by yuv2packedXinC().

#define YSCALE_YUV_2_PACKED1_C ( type,
alpha   ) 

Value:

for (i=0; i<(dstW>>1); i++) {\
        const int i2= 2*i;\
        int Y1= buf0[i2  ]>>7;\
        int Y2= buf0[i2+1]>>7;\
        int U= (uvbuf1[i     ])>>7;\
        int V= (uvbuf1[i+VOFW])>>7;\
        type av_unused *r, *b, *g;\
        int av_unused A1, A2;\
        if (alpha) {\
            A1= abuf0[i2  ]>>7;\
            A2= abuf0[i2+1]>>7;\
        }

Definition at line 593 of file swscale.c.

#define YSCALE_YUV_2_PACKED1B_C ( type,
alpha   ) 

Value:

for (i=0; i<(dstW>>1); i++) {\
        const int i2= 2*i;\
        int Y1= buf0[i2  ]>>7;\
        int Y2= buf0[i2+1]>>7;\
        int U= (uvbuf0[i     ] + uvbuf1[i     ])>>8;\
        int V= (uvbuf0[i+VOFW] + uvbuf1[i+VOFW])>>8;\
        type av_unused *r, *b, *g;\
        int av_unused A1, A2;\
        if (alpha) {\
            A1= abuf0[i2  ]>>7;\
            A2= abuf0[i2+1]>>7;\
        }

Definition at line 619 of file swscale.c.

#define YSCALE_YUV_2_PACKED2_C ( type,
alpha   ) 

Value:

for (i=0; i<(dstW>>1); i++) { \
        const int i2= 2*i;       \
        int Y1= (buf0[i2  ]*yalpha1+buf1[i2  ]*yalpha)>>19;           \
        int Y2= (buf0[i2+1]*yalpha1+buf1[i2+1]*yalpha)>>19;           \
        int U= (uvbuf0[i     ]*uvalpha1+uvbuf1[i     ]*uvalpha)>>19;  \
        int V= (uvbuf0[i+VOFW]*uvalpha1+uvbuf1[i+VOFW]*uvalpha)>>19;  \
        type av_unused *r, *b, *g;                                    \
        int av_unused A1, A2;                                         \
        if (alpha) {\
            A1= (abuf0[i2  ]*yalpha1+abuf1[i2  ]*yalpha)>>19;         \
            A2= (abuf0[i2+1]*yalpha1+abuf1[i2+1]*yalpha)>>19;         \
        }

Definition at line 567 of file swscale.c.

#define YSCALE_YUV_2_PACKEDX_C ( type,
alpha   ) 

Value:

YSCALE_YUV_2_PACKEDX_NOCLIP_C(type,alpha)\
        if ((Y1|Y2|U|V)&256) {\
            if (Y1>255)   Y1=255; \
            else if (Y1<0)Y1=0;   \
            if (Y2>255)   Y2=255; \
            else if (Y2<0)Y2=0;   \
            if (U>255)    U=255;  \
            else if (U<0) U=0;    \
            if (V>255)    V=255;  \
            else if (V<0) V=0;    \
        }\
        if (alpha && ((A1|A2)&256)) {\
            A1=av_clip_uint8(A1);\
            A2=av_clip_uint8(A2);\
        }

Definition at line 476 of file swscale.c.

Referenced by yuv2packedXinC().

#define YSCALE_YUV_2_PACKEDX_FULL_C ( rnd,
alpha   ) 

Value:

for (i=0; i<dstW; i++) {\
        int j;\
        int Y = 0;\
        int U = -128<<19;\
        int V = -128<<19;\
        int av_unused A;\
        int R,G,B;\
        \
        for (j=0; j<lumFilterSize; j++) {\
            Y += lumSrc[j][i     ] * lumFilter[j];\
        }\
        for (j=0; j<chrFilterSize; j++) {\
            U += chrSrc[j][i     ] * chrFilter[j];\
            V += chrSrc[j][i+VOFW] * chrFilter[j];\
        }\
        Y >>=10;\
        U >>=10;\
        V >>=10;\
        if (alpha) {\
            A = rnd;\
            for (j=0; j<lumFilterSize; j++)\
                A += alpSrc[j][i     ] * lumFilter[j];\
            A >>=19;\
            if (A&256)\
                A = av_clip_uint8(A);\
        }

Definition at line 493 of file swscale.c.

#define YSCALE_YUV_2_PACKEDX_NOCLIP_C ( type,
alpha   ) 

Definition at line 442 of file swscale.c.

#define YSCALE_YUV_2_RGB1_C ( type,
alpha   ) 

Value:

YSCALE_YUV_2_PACKED1_C(type,alpha)\
    r = (type *)c->table_rV[V];\
    g = (type *)(c->table_gU[U] + c->table_gV[V]);\
    b = (type *)c->table_bU[U];

Definition at line 613 of file swscale.c.

#define YSCALE_YUV_2_RGB1B_C ( type,
alpha   ) 

Value:

YSCALE_YUV_2_PACKED1B_C(type,alpha)\
    r = (type *)c->table_rV[V];\
    g = (type *)(c->table_gU[U] + c->table_gV[V]);\
    b = (type *)c->table_bU[U];

Definition at line 633 of file swscale.c.

#define YSCALE_YUV_2_RGB2_C ( type,
alpha   ) 

Value:

YSCALE_YUV_2_PACKED2_C(type,alpha)\
    r = (type *)c->table_rV[V];\
    g = (type *)(c->table_gU[U] + c->table_gV[V]);\
    b = (type *)c->table_bU[U];

Definition at line 587 of file swscale.c.

#define YSCALE_YUV_2_RGBX_C ( type,
alpha   ) 

Value:

YSCALE_YUV_2_PACKEDX_C(type,alpha)  /* FIXME fix tables so that clipping is not needed and then use _NOCLIP*/\
    r = (type *)c->table_rV[V];   \
    g = (type *)(c->table_gU[U] + c->table_gV[V]); \
    b = (type *)c->table_bU[U];

Definition at line 561 of file swscale.c.

Referenced by yuv2packedXinC().

#define YSCALE_YUV_2_RGBX_FULL_C ( rnd,
alpha   ) 

Value:

YSCALE_YUV_2_PACKEDX_FULL_C(rnd>>3,alpha)\
        Y-= c->yuv2rgb_y_offset;\
        Y*= c->yuv2rgb_y_coeff;\
        Y+= rnd;\
        R= Y + V*c->yuv2rgb_v2r_coeff;\
        G= Y + V*c->yuv2rgb_v2g_coeff + U*c->yuv2rgb_u2g_coeff;\
        B= Y +                          U*c->yuv2rgb_u2b_coeff;\
        if ((R|G|B)&(0xC0000000)) {\
            if (R>=(256<<22))   R=(256<<22)-1; \
            else if (R<0)R=0;   \
            if (G>=(256<<22))   G=(256<<22)-1; \
            else if (G<0)G=0;   \
            if (B>=(256<<22))   B=(256<<22)-1; \
            else if (B<0)B=0;   \
        }

Definition at line 521 of file swscale.c.

Referenced by if(), and yuv2rgbXinC_full().


Function Documentation

static void abgrToA ( uint8_t *  dst,
const uint8_t *  src,
long  width,
uint32_t *  unused 
) [inline, static]

Definition at line 1062 of file swscale.c.

static int bgr24ToYv12Wrapper ( SwsContext c,
const uint8_t *  src[],
int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t *  dst[],
int  dstStride[] 
) [static]

Definition at line 1551 of file swscale.c.

Referenced by ff_get_unscaled_swscale().

void ff_get_unscaled_swscale ( SwsContext c  ) 

Sets c->swScale to an unscaled converter if one exists for the specific source and destination formats, bit depths, flags, etc.

Definition at line 1704 of file swscale.c.

Referenced by sws_getContext().

SwsFunc ff_getSwsFunc ( SwsContext c  ) 

Returns function pointer to fastest main scaler path function depending on architecture and available optimizations.

CONFIG_RUNTIME_CPUDETECT

Definition at line 1240 of file swscale.c.

Referenced by sws_getContext().

int ff_hardcodedcpuflags ( void   ) 

Returns the SWS_CPU_CAPS for the optimized code compiled into swscale.

Definition at line 1687 of file swscale.c.

Referenced by sws_getContext().

static void fillPlane ( uint8_t *  plane,
int  stride,
int  width,
int  height,
int  y,
uint8_t  val 
) [static]

else if ( CONFIG_SWSCALE_ALPHA &&c->  alpPixBuf  ) 

Definition at line 963 of file swscale.c.

Referenced by aac_decode_frame(), ape_decode_value(), ape_read_header(), audio_read_header(), audio_read_packet(), av_ext2dbl(), av_transcode(), avcodec_default_reget_buffer(), average_quantized_coeffs(), avs_decode_frame(), blend_subrect(), cavs_decode_frame(), cmv_decode_inter(), commit_bitstream_and_slice_buffer(), compute_pkt_fields(), construct_perm_table(), cook_decode_frame(), decode_end(), decode_exp_vlc(), decode_frame(), decode_init(), dv_extract_audio(), dv_inject_audio(), dvbsub_display_end_segment(), dvbsub_parse_page_segment(), dvbsub_parse_region_segment(), dvvideo_init(), ebml_parse_elem(), encode_frame(), ff_mjpeg_decode_sos(), ff_vdpau_mpeg_picture_complete(), ff_vdpau_vc1_decode_picture(), ff_xvmc_decode_mb(), ff_xvmc_field_start(), FfmpegFindNextSchroParseUnit(), file_seek(), fill_picture_parameters(), flashsv_decode_frame(), g726_init(), get_block_sizes(), hyscale_TMPL(), imc_decode_frame(), ipvideo_decode_block_opcode_0x8(), ipvideo_decode_block_opcode_0xA(), ipvideo_decode_frame(), libdirac_encode_init(), main(), matroska_probe(), mlp_parse(), mm_decode_inter(), motion_search(), mov_parse_mpeg2_frame(), mpeg1_encode_sequence_header(), mpeg4_encode_mb(), mpeg_mux_init(), mpegps_probe(), mpegts_write_pes(), MPV_common_init(), msrle_decode_8_16_24_32(), mxf_interleave_get_packet(), mxf_parse_mpeg2_frame(), mxf_read_header(), nut_probe(), nut_read_seek(), ogg_read_page(), paint_mouse_pointer(), pam_encode_frame(), pnm_decode_frame(), pnm_encode_frame(), qdm2_decode(), qdm2_fft_tone_synthesizer(), qtrle_decode_1bpp(), read_var_block_data(), rpza_decode_stream(), sbr_hf_calc_npatches(), sbr_make_f_master(), shorten_decode_frame(), smc_decode_stream(), svq3_decode_frame(), svq3_mc_dir(), sws_getContext(), synth_block_fcb_acb(), synth_superframe(), tgv_decode_inter(), tm2_decode_blocks(), unpack_superblocks(), unpack_vlcs(), vaapi_mpeg4_start_frame(), vc1_decode_b_mb(), vorbis_parse_setup_hdr_codebooks(), vp56_init(), wiener_denoise(), wsvqa_read_header(), and X264_init().

static void monoblack2Y ( uint8_t *  dst,
const uint8_t *  src,
long  width,
uint32_t *  unused 
) [inline, static]

Definition at line 1142 of file swscale.c.

static void monowhite2Y ( uint8_t *  dst,
const uint8_t *  src,
long  width,
uint32_t *  unused 
) [inline, static]

Definition at line 1132 of file swscale.c.

static int packedCopyWrapper ( SwsContext c,
const uint8_t *  src[],
int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t *  dst[],
int  dstStride[] 
) [static]

Definition at line 1602 of file swscale.c.

Referenced by ff_get_unscaled_swscale().

static int palToRgbWrapper ( SwsContext c,
const uint8_t *  src[],
int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t *  dst[],
int  dstStride[] 
) [static]

Definition at line 1414 of file swscale.c.

Referenced by ff_get_unscaled_swscale().

static void palToUV ( uint8_t *  dstU,
uint8_t *  dstV,
const uint8_t *  src1,
const uint8_t *  src2,
long  width,
uint32_t *  pal 
) [inline, static]

Definition at line 1118 of file swscale.c.

static void palToY ( uint8_t *  dst,
const uint8_t *  src,
long  width,
uint32_t *  pal 
) [inline, static]

Definition at line 1108 of file swscale.c.

static int planarCopyWrapper ( SwsContext c,
const uint8_t *  src[],
int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t *  dst[],
int  dstStride[] 
) [static]

Definition at line 1627 of file swscale.c.

Referenced by ff_get_unscaled_swscale().

static int planarToNv12Wrapper ( SwsContext c,
const uint8_t *  src[],
int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t *  dstParam[],
int  dstStride[] 
) [static]

Definition at line 1294 of file swscale.c.

Referenced by ff_get_unscaled_swscale().

static int planarToUyvyWrapper ( SwsContext c,
const uint8_t *  src[],
int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t *  dstParam[],
int  dstStride[] 
) [static]

Definition at line 1330 of file swscale.c.

Referenced by ff_get_unscaled_swscale().

static int planarToYuy2Wrapper ( SwsContext c,
const uint8_t *  src[],
int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t *  dstParam[],
int  dstStride[] 
) [static]

Definition at line 1320 of file swscale.c.

Referenced by ff_get_unscaled_swscale().

static void reset_ptr ( const uint8_t *  src[],
int  format 
) [static]

Definition at line 1821 of file swscale.c.

Referenced by sws_scale().

static void rgb48ToUV ( uint8_t *  dstU,
uint8_t *  dstV,
const uint8_t *  src1,
const uint8_t *  src2,
int  width,
uint32_t *  unused 
) [inline, static]

Definition at line 1010 of file swscale.c.

static void rgb48ToUV_half ( uint8_t *  dstU,
uint8_t *  dstV,
const uint8_t *  src1,
const uint8_t *  src2,
int  width,
uint32_t *  unused 
) [inline, static]

Definition at line 1026 of file swscale.c.

static void rgb48ToY ( uint8_t *  dst,
const uint8_t *  src,
int  width,
uint32_t *  unused 
) [inline, static]

Definition at line 997 of file swscale.c.

static int rgbToRgbWrapper ( SwsContext c,
const uint8_t *  src[],
int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t *  dst[],
int  dstStride[] 
) [static]

Definition at line 1458 of file swscale.c.

Referenced by ff_get_unscaled_swscale().

void sws_convertPalette8ToPacked24 ( const uint8_t *  src,
uint8_t *  dst,
long  num_pixels,
const uint8_t *  palette 
)

Converts an 8bit paletted frame into a frame with a color depth of 24 bits.

With the palette format "ABCD", the destination frame ends up with the format "ABC".

Parameters:
src source frame buffer
dst destination frame buffer
num_pixels number of pixels to convert
palette array with [256] entries, which must match color arrangement (RGB or BGR) of src

Definition at line 1976 of file swscale.c.

Referenced by palette8topacked24(), and palToRgbWrapper().

void sws_convertPalette8ToPacked32 ( const uint8_t *  src,
uint8_t *  dst,
long  num_pixels,
const uint8_t *  palette 
)

Converts an 8bit paletted frame into a frame with a color depth of 32-bits.

The output frame will have the same packed format as the palette.

Parameters:
src source frame buffer
dst destination frame buffer
num_pixels number of pixels to convert
palette array with [256] entries, which must match color arrangement (RGB or BGR) of src

Definition at line 1967 of file swscale.c.

Referenced by palette8topacked32(), and palToRgbWrapper().

int sws_scale ( SwsContext c,
const uint8_t *const   src[],
const int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t *const   dst[],
const int  dstStride[] 
)

swscale wrapper, so we don't need to export the SwsContext.

Scales the image slice in srcSlice and puts the resulting scaled slice in the image in dst.

Assumes planar YUV to be in YUV order instead of YVU.

Definition at line 1837 of file swscale.c.

Referenced by do_video_out(), doTest(), draw_slice(), main(), queue_picture(), sws_scale_ordered(), and write_video_frame().

int sws_scale_ordered ( struct SwsContext context,
const uint8_t *const   src[],
int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t *  dst[],
int  dstStride[] 
)

Deprecated:
Use sws_scale() instead.

Definition at line 1959 of file swscale.c.

static int uyvyToYuv420Wrapper ( SwsContext c,
const uint8_t *  src[],
int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t *  dstParam[],
int  dstStride[] 
) [static]

Definition at line 1387 of file swscale.c.

Referenced by ff_get_unscaled_swscale().

static int uyvyToYuv422Wrapper ( SwsContext c,
const uint8_t *  src[],
int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t *  dstParam[],
int  dstStride[] 
) [static]

Definition at line 1402 of file swscale.c.

Referenced by ff_get_unscaled_swscale().

static void yuv2nv12XinC ( const int16_t *  lumFilter,
const int16_t **  lumSrc,
int  lumFilterSize,
const int16_t *  chrFilter,
const int16_t **  chrSrc,
int  chrFilterSize,
uint8_t *  dest,
uint8_t *  uDest,
int  dstW,
int  chrDstW,
int  dstFormat 
) [inline, static]

Definition at line 396 of file swscale.c.

Referenced by yuv2nv12X_TMPL().

static void yuv2packedXinC ( SwsContext c,
const int16_t *  lumFilter,
const int16_t **  lumSrc,
int  lumFilterSize,
const int16_t *  chrFilter,
const int16_t **  chrSrc,
int  chrFilterSize,
const int16_t **  alpSrc,
uint8_t *  dest,
int  dstW,
int  y 
) [inline, static]

Definition at line 895 of file swscale.c.

Referenced by yuv2packedX_TMPL().

static void yuv2rgbXinC_full ( SwsContext c,
const int16_t *  lumFilter,
const int16_t **  lumSrc,
int  lumFilterSize,
const int16_t *  chrFilter,
const int16_t **  chrSrc,
int  chrFilterSize,
const int16_t **  alpSrc,
uint8_t *  dest,
int  dstW,
int  y 
) [inline, static]

Definition at line 903 of file swscale.c.

static void yuv2yuvX16inC ( const int16_t *  lumFilter,
const int16_t **  lumSrc,
int  lumFilterSize,
const int16_t *  chrFilter,
const int16_t **  chrSrc,
int  chrFilterSize,
const int16_t **  alpSrc,
uint16_t *  dest,
uint16_t *  uDest,
uint16_t *  vDest,
uint16_t *  aDest,
int  dstW,
int  chrDstW,
enum PixelFormat  dstFormat 
) [inline, static]

Definition at line 335 of file swscale.c.

static av_always_inline void yuv2yuvX16inC_template ( const int16_t *  lumFilter,
const int16_t **  lumSrc,
int  lumFilterSize,
const int16_t *  chrFilter,
const int16_t **  chrSrc,
int  chrFilterSize,
const int16_t **  alpSrc,
uint16_t *  dest,
uint16_t *  uDest,
uint16_t *  vDest,
uint16_t *  aDest,
int  dstW,
int  chrDstW,
int  big_endian 
) [static]

Definition at line 275 of file swscale.c.

Referenced by yuv2yuvX16inC().

static void yuv2yuvXinC ( const int16_t *  lumFilter,
const int16_t **  lumSrc,
int  lumFilterSize,
const int16_t *  chrFilter,
const int16_t **  chrSrc,
int  chrFilterSize,
const int16_t **  alpSrc,
uint8_t *  dest,
uint8_t *  uDest,
uint8_t *  vDest,
uint8_t *  aDest,
int  dstW,
int  chrDstW 
) [inline, static]

Definition at line 355 of file swscale.c.

Referenced by yuv2yuvX_TMPL().

static int yuv422pToUyvyWrapper ( SwsContext c,
const uint8_t *  src[],
int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t *  dstParam[],
int  dstStride[] 
) [static]

Definition at line 1350 of file swscale.c.

Referenced by ff_get_unscaled_swscale().

static int yuv422pToYuy2Wrapper ( SwsContext c,
const uint8_t *  src[],
int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t *  dstParam[],
int  dstStride[] 
) [static]

Definition at line 1340 of file swscale.c.

Referenced by ff_get_unscaled_swscale().

static int yuyvToYuv420Wrapper ( SwsContext c,
const uint8_t *  src[],
int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t *  dstParam[],
int  dstStride[] 
) [static]

Definition at line 1360 of file swscale.c.

Referenced by ff_get_unscaled_swscale().

static int yuyvToYuv422Wrapper ( SwsContext c,
const uint8_t *  src[],
int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t *  dstParam[],
int  dstStride[] 
) [static]

Definition at line 1375 of file swscale.c.

Referenced by ff_get_unscaled_swscale().

static int yvu9ToYv12Wrapper ( SwsContext c,
const uint8_t *  src[],
int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t *  dst[],
int  dstStride[] 
) [static]

Definition at line 1566 of file swscale.c.

Referenced by ff_get_unscaled_swscale().


Variable Documentation

default __pad0__

Definition at line 981 of file swscale.c.

aidx = 0

Definition at line 949 of file swscale.c.

Referenced by aw_pulse_set2(), if(), and yuv2rgbXinC_full().

Definition at line 946 of file swscale.c.

dest = needAlpha ? A : 255

const uint8_t dither_2x2_4[2][8] [static]

Initial value:

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

Definition at line 187 of file swscale.c.

const uint8_t dither_2x2_8[2][8] [static]

Initial value:

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

Definition at line 192 of file swscale.c.

const uint8_t dither_4x4_16[4][8]

Initial value:

{
{  8,   4,  11,   7,   8,   4,  11,   7, },
{  2,  14,   1,  13,   2,  14,   1,  13, },
{ 10,   6,   9,   5,  10,   6,   9,   5, },
{  0,  12,   3,  15,   0,  12,   3,  15, },
}

Definition at line 197 of file swscale.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 227 of file swscale.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 204 of file swscale.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 215 of file swscale.c.

Definition at line 948 of file swscale.c.

Definition at line 951 of file swscale.c.

Definition at line 954 of file swscale.c.

const double rgb2yuv_table[8][9] [static]

Initial value:

{
    {0.7152, 0.0722, 0.2126, -0.386, 0.5, -0.115, -0.454, -0.046, 0.5},
    {0.7152, 0.0722, 0.2126, -0.386, 0.5, -0.115, -0.454, -0.046, 0.5},
    {0.587 , 0.114 , 0.299 , -0.331, 0.5, -0.169, -0.419, -0.081, 0.5},
    {0.587 , 0.114 , 0.299 , -0.331, 0.5, -0.169, -0.419, -0.081, 0.5},
    {0.59  , 0.11  , 0.30  , -0.331, 0.5, -0.169, -0.421, -0.079, 0.5}, 
    {0.587 , 0.114 , 0.299 , -0.331, 0.5, -0.169, -0.419, -0.081, 0.5},
    {0.587 , 0.114 , 0.299 , -0.331, 0.5, -0.169, -0.419, -0.081, 0.5}, 
    {0.701 , 0.087 , 0.212 , -0.384, 0.5  -0.116, -0.445, -0.055, 0.5}, 
}

Definition at line 104 of file swscale.c.


Generated on Fri Oct 26 02:36:55 2012 for FFmpeg by  doxygen 1.5.8