libswscale/swscale.c File Reference

#include <inttypes.h>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <unistd.h>
#include "config.h"
#include <assert.h>
#include "swscale.h"
#include "swscale_internal.h"
#include "rgb2rgb.h"
#include "libavutil/x86_cpu.h"
#include "libavutil/bswap.h"
#include "swscale_template.c"

Go to the source code of this file.

Defines

#define _SVID_SOURCE
#define DITHER1XBPP
#define FAST_BGR2YV12
#define RET   0xC3
#define PI   M_PI
#define isSupportedIn(x)
#define isSupportedOut(x)
#define isPacked(x)
#define usePal(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)
#define YSCALE_YUV_2_PACKEDX_C(type)
#define YSCALE_YUV_2_PACKEDX_FULL_C
#define YSCALE_YUV_2_RGBX_FULL_C(rnd)
#define YSCALE_YUV_2_GRAY16_C
#define YSCALE_YUV_2_RGBX_C(type)
#define YSCALE_YUV_2_PACKED2_C
#define YSCALE_YUV_2_GRAY16_2_C
#define YSCALE_YUV_2_RGB2_C(type)
#define YSCALE_YUV_2_PACKED1_C
#define YSCALE_YUV_2_GRAY16_1_C
#define YSCALE_YUV_2_RGB1_C(type)
#define YSCALE_YUV_2_PACKED1B_C
#define YSCALE_YUV_2_RGB1B_C(type)
#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 COMPILE_C
#define HAVE_MMX   0
#define HAVE_MMX2   0
#define HAVE_AMD3DNOW   0
#define HAVE_ALTIVEC   0
#define RENAME(a)   a ## _C
#define MAX_FUNNY_CODE_SIZE   10000

Functions

unsigned swscale_version (void)
 Returns the LIBSWSCALE_VERSION_INT constant.
static SwsVectorsws_getConvVec (SwsVector *a, SwsVector *b)
const char * sws_format_name (enum PixelFormat format)
static void yuv2yuvXinC (int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, int dstW, int chrDstW)
static void yuv2nv12XinC (int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, uint8_t *dest, uint8_t *uDest, int dstW, int chrDstW, int dstFormat)
static void yuv2packedXinC (SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, uint8_t *dest, int dstW, int y)
static void yuv2rgbXinC_full (SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, uint8_t *dest, int dstW, int y)
static double getSplineCoeff (double a, double b, double c, double d, double dist)
static int initFilter (int16_t **outFilter, int16_t **filterPos, int *outFilterSize, int xInc, int srcW, int dstW, int filterAlign, int one, int flags, SwsVector *srcFilter, SwsVector *dstFilter, double param[2])
static void globalInit (void)
static SwsFunc getSwsFunc (int flags)
static int PlanarToNV12Wrapper (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[])
static int PlanarToYuy2Wrapper (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[])
static int PlanarToUyvyWrapper (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[])
static int YUV422PToYuy2Wrapper (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[])
static int YUV422PToUyvyWrapper (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[])
static int pal2rgbWrapper (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
static int rgb2rgbWrapper (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
static int bgr24toyv12Wrapper (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
static int yvu9toyv12Wrapper (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
static int packedCopy (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
static int planarCopy (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
static int gray16togray (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
static int graytogray16 (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
static int gray16swap (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
static void getSubSampleFactors (int *h, int *v, int format)
static uint16_t roundToInt16 (int64_t f)
int sws_setColorspaceDetails (SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation)
int sws_getColorspaceDetails (SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation)
static int handle_jpeg (enum PixelFormat *format)
SwsContextsws_getContext (int srcW, int srcH, enum PixelFormat srcFormat, int dstW, int dstH, enum PixelFormat dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, double *param)
 Allocates and returns a SwsContext.
int sws_scale (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
 swscale wrapper, so we don't need to export the SwsContext.
int sws_scale_ordered (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
SwsFiltersws_getDefaultFilter (float lumaGBlur, float chromaGBlur, float lumaSharpen, float chromaSharpen, float chromaHShift, float chromaVShift, int verbose)
SwsVectorsws_getGaussianVec (double variance, double quality)
 Returns a normalized Gaussian curve used to filter stuff quality=3 is high quality, lower is lower quality.
SwsVectorsws_getConstVec (double c, int length)
 Allocates and returns a vector with length coefficients, all with the same value c.
SwsVectorsws_getIdentityVec (void)
 Allocates and returns a vector with just one coefficient, with value 1.0.
double sws_dcVec (SwsVector *a)
void sws_scaleVec (SwsVector *a, double scalar)
 Scales all the coefficients of a by the scalar value.
void sws_normalizeVec (SwsVector *a, double height)
 Scales all the coefficients of a so that their sum equals height.
static SwsVectorsws_sumVec (SwsVector *a, SwsVector *b)
static SwsVectorsws_diffVec (SwsVector *a, SwsVector *b)
static SwsVectorsws_getShiftedVec (SwsVector *a, int shift)
void sws_shiftVec (SwsVector *a, int shift)
void sws_addVec (SwsVector *a, SwsVector *b)
void sws_subVec (SwsVector *a, SwsVector *b)
void sws_convVec (SwsVector *a, SwsVector *b)
SwsVectorsws_cloneVec (SwsVector *a)
 Allocates and returns a clone of the vector a, that is a vector with the same coefficients as a.
void sws_printVec2 (SwsVector *a, AVClass *log_ctx, int log_level)
 Prints with av_log() a textual representation of the vector a if log_level <= av_log_level.
void sws_printVec (SwsVector *a)
void sws_freeVec (SwsVector *a)
void sws_freeFilter (SwsFilter *filter)
void sws_freeContext (SwsContext *c)
struct SwsContextsws_getCachedContext (struct SwsContext *context, int srcW, int srcH, enum PixelFormat srcFormat, int dstW, int dstH, enum PixelFormat dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, double *param)
 Checks if context can be reused, otherwise reallocates a new one.

Variables

const int32_t ff_yuv2rgb_coeffs [8][4]
static const double rgb2yuv_table [8][9]
static unsigned char clip_table [768]
static const uint8_t dither_2x2_4 [2][8]
static 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]
 break
default __pad0__


Define Documentation

#define _SVID_SOURCE

Definition at line 57 of file swscale.c.

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

Definition at line 169 of file swscale.c.

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

Definition at line 168 of file swscale.c.

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

Definition at line 167 of file swscale.c.

#define COMPILE_C

Definition at line 959 of file swscale.c.

#define DITHER1XBPP

Definition at line 90 of file swscale.c.

#define FAST_BGR2YV12

Definition at line 92 of file swscale.c.

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

Definition at line 172 of file swscale.c.

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

Definition at line 171 of file swscale.c.

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

Definition at line 170 of file swscale.c.

#define HAVE_ALTIVEC   0

Definition at line 990 of file swscale.c.

#define HAVE_AMD3DNOW   0

Definition at line 989 of file swscale.c.

#define HAVE_MMX   0

Definition at line 987 of file swscale.c.

#define HAVE_MMX2   0

Definition at line 988 of file swscale.c.

#define isPacked (  ) 

Value:

(       \
           (x)==PIX_FMT_PAL8        \
        || (x)==PIX_FMT_YUYV422     \
        || (x)==PIX_FMT_UYVY422     \
        || isRGB(x)                 \
        || isBGR(x)                 \
    )

Definition at line 151 of file swscale.c.

Referenced by sws_getContext().

#define isSupportedIn (  ) 

Definition at line 102 of file swscale.c.

Referenced by sws_getContext().

#define isSupportedOut (  ) 

Value:

(       \
           (x)==PIX_FMT_YUV420P     \
        || (x)==PIX_FMT_YUYV422     \
        || (x)==PIX_FMT_UYVY422     \
        || (x)==PIX_FMT_YUV444P     \
        || (x)==PIX_FMT_YUV422P     \
        || (x)==PIX_FMT_YUV411P     \
        || isRGB(x)                 \
        || isBGR(x)                 \
        || (x)==PIX_FMT_NV12        \
        || (x)==PIX_FMT_NV21        \
        || (x)==PIX_FMT_GRAY16BE    \
        || (x)==PIX_FMT_GRAY16LE    \
        || (x)==PIX_FMT_GRAY8       \
        || (x)==PIX_FMT_YUV410P     \
        || (x)==PIX_FMT_YUV440P     \
    )

Definition at line 134 of file swscale.c.

Referenced by sws_getContext().

#define MAX_FUNNY_CODE_SIZE   10000

Referenced by sws_freeContext(), and sws_getContext().

#define PI   M_PI

Definition at line 97 of file swscale.c.

Referenced by initFilter(), and sws_getGaussianVec().

#define RENAME (  )     a ## _C

Definition at line 993 of file swscale.c.

#define RET   0xC3

Definition at line 94 of file swscale.c.

#define RGB2YUV_SHIFT   15

Definition at line 166 of file swscale.c.

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

Definition at line 175 of file swscale.c.

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

Definition at line 174 of file swscale.c.

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

Definition at line 173 of file swscale.c.

#define usePal (  ) 

Value:

(       \
           (x)==PIX_FMT_PAL8        \
        || (x)==PIX_FMT_BGR4_BYTE   \
        || (x)==PIX_FMT_RGB4_BYTE   \
        || (x)==PIX_FMT_BGR8        \
        || (x)==PIX_FMT_RGB8        \
    )

Definition at line 158 of file swscale.c.

Referenced by pal2rgbWrapper(), sws_getContext(), and sws_scale().

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

Definition at line 768 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 690 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 669 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 630 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 718 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 736 of file swscale.c.

Referenced by yuv2packedXinC().

#define YSCALE_YUV_2_PACKED1_C

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;\

Definition at line 682 of file swscale.c.

#define YSCALE_YUV_2_PACKED1B_C

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;\

Definition at line 703 of file swscale.c.

#define YSCALE_YUV_2_PACKED2_C

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;  \

Definition at line 661 of file swscale.c.

#define YSCALE_YUV_2_PACKEDX_C ( type   ) 

Value:

YSCALE_YUV_2_PACKEDX_NOCLIP_C(type)\
        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;    \
        }

Definition at line 579 of file swscale.c.

Referenced by yuv2packedXinC().

#define YSCALE_YUV_2_PACKEDX_FULL_C

Value:

for (i=0; i<dstW; i++){\
        int j;\
        int Y = 0;\
        int U = -128<<19;\
        int V = -128<<19;\
        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;\

Definition at line 593 of file swscale.c.

#define YSCALE_YUV_2_PACKEDX_NOCLIP_C ( type   ) 

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;\
        type av_unused *r, *b, *g;\
        const int i2= 2*i;\
        \
        for (j=0; j<lumFilterSize; j++)\
        {\
            Y1 += lumSrc[j][i2] * lumFilter[j];\
            Y2 += lumSrc[j][i2+1] * lumFilter[j];\
        }\
        for (j=0; j<chrFilterSize; j++)\
        {\
            U += chrSrc[j][i] * chrFilter[j];\
            V += chrSrc[j][i+VOFW] * chrFilter[j];\
        }\
        Y1>>=19;\
        Y2>>=19;\
        U >>=19;\
        V >>=19;\

Definition at line 554 of file swscale.c.

#define YSCALE_YUV_2_RGB1_C ( type   ) 

Value:

YSCALE_YUV_2_PACKED1_C\
    type *r, *b, *g;\
    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 696 of file swscale.c.

#define YSCALE_YUV_2_RGB1B_C ( type   ) 

Value:

YSCALE_YUV_2_PACKED1B_C\
    type *r, *b, *g;\
    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 711 of file swscale.c.

#define YSCALE_YUV_2_RGB2_C ( type   ) 

Value:

YSCALE_YUV_2_PACKED2_C\
    type *r, *b, *g;\
    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 675 of file swscale.c.

#define YSCALE_YUV_2_RGBX_C ( type   ) 

Value:

YSCALE_YUV_2_PACKEDX_C(type)  /* 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 655 of file swscale.c.

Referenced by yuv2packedXinC().

#define YSCALE_YUV_2_RGBX_FULL_C ( rnd   ) 

Value:

YSCALE_YUV_2_PACKEDX_FULL_C\
        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 612 of file swscale.c.

Referenced by yuv2rgbXinC_full().


Function Documentation

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

Definition at line 1854 of file swscale.c.

Referenced by sws_getContext().

static double getSplineCoeff ( double  a,
double  b,
double  c,
double  d,
double  dist 
) [static]

Definition at line 1060 of file swscale.c.

Referenced by initFilter().

static void getSubSampleFactors ( int *  h,
int *  v,
int  format 
) [static]

Definition at line 2026 of file swscale.c.

Referenced by sws_getContext().

static SwsFunc getSwsFunc ( int  flags  )  [static]

CONFIG_RUNTIME_CPUDETECT

Definition at line 1637 of file swscale.c.

Referenced by sws_getContext().

static void globalInit ( void   )  [static]

Definition at line 1628 of file swscale.c.

Referenced by sws_getContext().

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

Definition at line 2007 of file swscale.c.

Referenced by sws_getContext().

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

Definition at line 1960 of file swscale.c.

Referenced by sws_getContext().

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

Definition at line 1985 of file swscale.c.

Referenced by sws_getContext().

static int handle_jpeg ( enum PixelFormat format  )  [static]

Definition at line 2162 of file swscale.c.

Referenced by sws_getContext().

static int initFilter ( int16_t **  outFilter,
int16_t **  filterPos,
int *  outFilterSize,
int  xInc,
int  srcW,
int  dstW,
int  filterAlign,
int  one,
int  flags,
SwsVector srcFilter,
SwsVector dstFilter,
double  param[2] 
) [inline, static]

Definition at line 1071 of file swscale.c.

Referenced by sws_getContext().

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

Definition at line 1897 of file swscale.c.

Referenced by sws_getContext().

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

Definition at line 1738 of file swscale.c.

Referenced by sws_getContext().

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

Definition at line 1924 of file swscale.c.

Referenced by sws_getContext().

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

Definition at line 1675 of file swscale.c.

Referenced by sws_getContext().

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

Definition at line 1711 of file swscale.c.

Referenced by sws_getContext().

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

Definition at line 1702 of file swscale.c.

Referenced by sws_getContext().

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

Definition at line 1774 of file swscale.c.

Referenced by sws_getContext().

static uint16_t roundToInt16 ( int64_t  f  )  [static]

Definition at line 2070 of file swscale.c.

Referenced by sws_setColorspaceDetails().

void sws_addVec ( SwsVector a,
SwsVector b 
)

Definition at line 3032 of file swscale.c.

Referenced by sws_getDefaultFilter().

SwsVector* sws_cloneVec ( SwsVector a  ) 

Allocates and returns a clone of the vector a, that is a vector with the same coefficients as a.

Definition at line 3056 of file swscale.c.

void sws_convVec ( SwsVector a,
SwsVector b 
)

Definition at line 3048 of file swscale.c.

double sws_dcVec ( SwsVector a  ) 

Definition at line 2927 of file swscale.c.

Referenced by sws_normalizeVec().

static SwsVector* sws_diffVec ( SwsVector a,
SwsVector b 
) [static]

Definition at line 2987 of file swscale.c.

Referenced by sws_subVec().

const char* sws_format_name ( enum PixelFormat  format  ) 

void sws_freeContext ( SwsContext c  ) 

Definition at line 3116 of file swscale.c.

void sws_freeFilter ( SwsFilter filter  ) 

Definition at line 3105 of file swscale.c.

void sws_freeVec ( SwsVector a  ) 

Definition at line 3098 of file swscale.c.

Referenced by sws_freeFilter(), and sws_getDefaultFilter().

struct SwsContext* sws_getCachedContext ( struct SwsContext context,
int  srcW,
int  srcH,
enum PixelFormat  srcFormat,
int  dstW,
int  dstH,
enum PixelFormat  dstFormat,
int  flags,
SwsFilter srcFilter,
SwsFilter dstFilter,
double *  param 
) [read]

Checks if context can be reused, otherwise reallocates a new one.

If context is NULL, just calls sws_getContext() to get a new context. Otherwise, checks if the parameters are the ones already saved in context. If that is the case, returns the current context. Otherwise, frees context and gets a new context with the new parameters.

Be warned that srcFilter and dstFilter are not checked, they are assumed to remain the same.

Definition at line 3169 of file swscale.c.

int sws_getColorspaceDetails ( SwsContext c,
int **  inv_table,
int *  srcRange,
int **  table,
int *  dstRange,
int *  brightness,
int *  contrast,
int *  saturation 
)

Returns:
-1 if not supported

Definition at line 2148 of file swscale.c.

SwsVector* sws_getConstVec ( double  c,
int  length 
)

Allocates and returns a vector with length coefficients, all with the same value c.

Definition at line 2908 of file swscale.c.

Referenced by sws_getIdentityVec().

SwsContext* sws_getContext ( int  srcW,
int  srcH,
enum PixelFormat  srcFormat,
int  dstW,
int  dstH,
enum PixelFormat  dstFormat,
int  flags,
SwsFilter srcFilter,
SwsFilter dstFilter,
double *  param 
) [read]

Allocates and returns a SwsContext.

You need it to perform scaling/conversion operations using sws_scale().

Parameters:
srcW the width of the source image
srcH the height of the source image
srcFormat the source image format
dstW the width of the destination image
dstH the height of the destination image
dstFormat the destination image format
flags specify which algorithm and options to use for rescaling
Returns:
a pointer to an allocated context, or NULL in case of error

Definition at line 2182 of file swscale.c.

static SwsVector * sws_getConvVec ( SwsVector a,
SwsVector b 
) [static]

Definition at line 2948 of file swscale.c.

Referenced by sws_convVec().

SwsFilter* sws_getDefaultFilter ( float  lumaGBlur,
float  chromaGBlur,
float  lumaSharpen,
float  chromaSharpen,
float  chromaHShift,
float  chromaVShift,
int  verbose 
)

Definition at line 2829 of file swscale.c.

SwsVector* sws_getGaussianVec ( double  variance,
double  quality 
)

Returns a normalized Gaussian curve used to filter stuff quality=3 is high quality, lower is lower quality.

Definition at line 2887 of file swscale.c.

Referenced by sws_getDefaultFilter().

SwsVector* sws_getIdentityVec ( void   ) 

Allocates and returns a vector with just one coefficient, with value 1.0.

Definition at line 2923 of file swscale.c.

Referenced by sws_getDefaultFilter().

static SwsVector* sws_getShiftedVec ( SwsVector a,
int  shift 
) [static]

Definition at line 3005 of file swscale.c.

Referenced by sws_shiftVec().

void sws_normalizeVec ( SwsVector a,
double  height 
)

Scales all the coefficients of a so that their sum equals height.

"

Definition at line 2944 of file swscale.c.

Referenced by sws_getDefaultFilter(), and sws_getGaussianVec().

void sws_printVec ( SwsVector a  ) 

Deprecated:
Use sws_printVec2() instead.

Definition at line 3093 of file swscale.c.

void sws_printVec2 ( SwsVector a,
AVClass log_ctx,
int  log_level 
)

Prints with av_log() a textual representation of the vector a if log_level <= av_log_level.

Definition at line 3069 of file swscale.c.

Referenced by sws_getDefaultFilter(), and sws_printVec().

int sws_scale ( SwsContext c,
uint8_t *  src[],
int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t *  dst[],
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 2725 of file swscale.c.

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

Deprecated:
Use sws_scale() instead.

Definition at line 2823 of file swscale.c.

void sws_scaleVec ( SwsVector a,
double  scalar 
)

Scales all the coefficients of a by the scalar value.

Definition at line 2937 of file swscale.c.

Referenced by sws_getDefaultFilter(), and sws_normalizeVec().

int sws_setColorspaceDetails ( SwsContext c,
const int  inv_table[4],
int  srcRange,
const int  table[4],
int  dstRange,
int  brightness,
int  contrast,
int  saturation 
)

Parameters:
inv_table the yuv2rgb coefficients, normally ff_yuv2rgb_coeffs[x]
fullRange if 1 then the luma range is 0..255 if 0 it is 16..235
Returns:
-1 if not supported

Definition at line 2082 of file swscale.c.

Referenced by sws_getContext().

void sws_shiftVec ( SwsVector a,
int  shift 
)

Definition at line 3024 of file swscale.c.

Referenced by sws_getDefaultFilter().

void sws_subVec ( SwsVector a,
SwsVector b 
)

Definition at line 3040 of file swscale.c.

static SwsVector* sws_sumVec ( SwsVector a,
SwsVector b 
) [static]

Definition at line 2970 of file swscale.c.

Referenced by sws_addVec().

unsigned swscale_version ( void   ) 

Returns the LIBSWSCALE_VERSION_INT constant.

Definition at line 77 of file swscale.c.

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

Definition at line 503 of file swscale.c.

Referenced by yuv2nv12X_TMPL().

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

Definition at line 906 of file swscale.c.

Referenced by yuv2packedX_TMPL().

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

Definition at line 914 of file swscale.c.

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

Definition at line 470 of file swscale.c.

Referenced by yuv2yuvX_TMPL().

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

Definition at line 1729 of file swscale.c.

Referenced by sws_getContext().

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

Definition at line 1720 of file swscale.c.

Referenced by sws_getContext().

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

Definition at line 1867 of file swscale.c.

Referenced by sws_getContext().


Variable Documentation

default __pad0__

Definition at line 952 of file swscale.c.

Definition at line 950 of file swscale.c.

unsigned char clip_table[768] [static]

Definition at line 263 of file swscale.c.

Referenced by globalInit(), and sws_getContext().

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 267 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 272 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 326 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 277 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 301 of file swscale.c.

const int32_t ff_yuv2rgb_coeffs[8][4]

Definition at line 68 of file yuv2rgb.c.

Referenced by sws_getContext().

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


Generated on Fri Oct 26 02:35:46 2012 for FFmpeg by  doxygen 1.5.8