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/mathematics.h"
#include "libavutil/bswap.h"
#include "libavutil/pixdesc.h"
#include "swscale_template.c"

Go to the source code of this file.

Defines

#define DITHER1XBPP
#define FAST_BGR2YV12
#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, shp, maskr, maskg, maskb, RU, GU, BU, RV, GV, BV, S)
#define COMPILE_C   1
#define COMPILE_MMX   0
#define COMPILE_MMX2   0
#define COMPILE_3DNOW   0
#define COMPILE_ALTIVEC   0
#define COMPILE_TEMPLATE_MMX   0
#define COMPILE_TEMPLATE_MMX2   0
#define COMPILE_TEMPLATE_AMD3DNOW   0
#define COMPILE_TEMPLATE_ALTIVEC   0
#define RENAME(a)   a ## _C
#define isRGBA32(x)
#define CONV_IS(src, dst)   (srcFormat == PIX_FMT_##src && dstFormat == PIX_FMT_##dst)

Functions

 DECLARE_ALIGNED (8, static const uint8_t, dither_2x2_4)[2][8]
 DECLARE_ALIGNED (8, static const uint8_t, dither_2x2_8)[2][8]
 DECLARE_ALIGNED (8, const uint8_t, dither_4x4_16)[4][8]
 DECLARE_ALIGNED (8, const uint8_t, dither_8x8_32)[8][8]
 DECLARE_ALIGNED (8, const uint8_t, dither_8x8_73)[8][8]
 DECLARE_ALIGNED (8, const uint8_t, dither_8x8_220)[8][8]
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)
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, long width, uint32_t *unused)
static void rgb48ToUV (uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused)
static void rgb48ToUV_half (uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long 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)
static int check_image_pointers (uint8_t *data[4], enum PixelFormat pix_fmt, const int linesizes[4])
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]
 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,
shp,
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]>>shp)&maskb)>>shb;\
        int g= ((((const type*)src)[i]>>shp)&maskg)>>shg;\
        int r= ((((const type*)src)[i]>>shp)&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]>>shp;\
        int pix1= ((const type*)src)[2*i+1]>>shp;\
        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 1067 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 1037 of file swscale.c.

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

Definition at line 91 of file swscale.c.

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

Definition at line 90 of file swscale.c.

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

Definition at line 89 of file swscale.c.

#define COMPILE_3DNOW   0

Definition at line 1190 of file swscale.c.

#define COMPILE_ALTIVEC   0

Definition at line 1193 of file swscale.c.

#define COMPILE_C   1

Definition at line 1176 of file swscale.c.

#define COMPILE_MMX   0

Definition at line 1184 of file swscale.c.

#define COMPILE_MMX2   0

Definition at line 1187 of file swscale.c.

#define COMPILE_TEMPLATE_ALTIVEC   0

Definition at line 1199 of file swscale.c.

#define COMPILE_TEMPLATE_AMD3DNOW   0

Definition at line 1198 of file swscale.c.

#define COMPILE_TEMPLATE_MMX   0

Definition at line 1196 of file swscale.c.

#define COMPILE_TEMPLATE_MMX2   0

Definition at line 1197 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 77 of file swscale.c.

#define FAST_BGR2YV12

Definition at line 79 of file swscale.c.

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

Definition at line 94 of file swscale.c.

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

Definition at line 93 of file swscale.c.

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

Definition at line 92 of file swscale.c.

#define isPacked (  ) 

Value:

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

Definition at line 81 of file swscale.c.

#define isRGBA32 (  ) 

Value:

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

Definition at line 1467 of file swscale.c.

Referenced by rgbToRgbWrapper().

#define RENAME (  )     a ## _C

Definition at line 1202 of file swscale.c.

#define RGB2YUV_SHIFT   15

Definition at line 88 of file swscale.c.

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

Definition at line 97 of file swscale.c.

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

Definition at line 96 of file swscale.c.

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

Definition at line 95 of file swscale.c.

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

Definition at line 680 of file swscale.c.

#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 602 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 576 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 533 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 634 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 651 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 588 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 614 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 562 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 471 of file swscale.c.

#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 488 of file swscale.c.

#define YSCALE_YUV_2_PACKEDX_NOCLIP_C ( type,
alpha   ) 

Definition at line 437 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 608 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 628 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 582 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 556 of file swscale.c.

#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 516 of file swscale.c.

Referenced by yuv2rgbXinC_full().


Function Documentation

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

Definition at line 1059 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 1568 of file swscale.c.

Referenced by ff_get_unscaled_swscale().

static int check_image_pointers ( uint8_t *  data[4],
enum PixelFormat  pix_fmt,
const int  linesizes[4] 
) [static]

Definition at line 1852 of file swscale.c.

Referenced by sws_scale().

DECLARE_ALIGNED ( ,
const   uint8_t,
dither_8x8_220   
)

DECLARE_ALIGNED ( ,
const   uint8_t,
dither_8x8_73   
)

DECLARE_ALIGNED ( ,
const   uint8_t,
dither_8x8_32   
)

DECLARE_ALIGNED ( ,
const   uint8_t,
dither_4x4_16   
)

DECLARE_ALIGNED ( ,
static const   uint8_t,
dither_2x2_8   
)

DECLARE_ALIGNED ( ,
static const   uint8_t,
dither_2x2_4   
)

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 1723 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 1257 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 1706 of file swscale.c.

Referenced by update_flags_cpu().

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

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

Definition at line 1141 of file swscale.c.

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

Definition at line 1131 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 1619 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 1431 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 1117 of file swscale.c.

Referenced by hcscale_TMPL().

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

Definition at line 1107 of file swscale.c.

Referenced by hyscale_TMPL().

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

Definition at line 1644 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 1311 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 1347 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 1337 of file swscale.c.

Referenced by ff_get_unscaled_swscale().

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

Definition at line 1840 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,
long  width,
uint32_t *  unused 
) [inline, static]

Definition at line 1005 of file swscale.c.

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

Definition at line 1021 of file swscale.c.

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

Definition at line 992 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 1475 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 2019 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 2010 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 1871 of file swscale.c.

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 2002 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 1404 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 1419 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 391 of file swscale.c.

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 890 of file swscale.c.

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 898 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 330 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 270 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 350 of file swscale.c.

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

Definition at line 1367 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 1357 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 1377 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 1392 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 1583 of file swscale.c.

Referenced by ff_get_unscaled_swscale().


Variable Documentation

default __pad0__

Definition at line 976 of file swscale.c.

aidx = 0

Definition at line 944 of file swscale.c.

Referenced by aw_pulse_set2(), and yuv2rgbXinC_full().

Definition at line 941 of file swscale.c.

dest = needAlpha ? A : 255

Definition at line 951 of file swscale.c.

Definition at line 943 of file swscale.c.

Definition at line 946 of file swscale.c.

Definition at line 949 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 99 of file swscale.c.


Generated on Fri Sep 10 03:08:36 2010 for FFmpeg by  doxygen 1.5.6