swscale_internal.h File Reference
#include "config.h"
#include "libavutil/avutil.h"
#include "libavutil/log.h"
#include "libavutil/pixfmt.h"
#include "libavutil/pixdesc.h"

Go to the source code of this file.

Data Structures

struct  SwsContext

Macros

#define STR(s)   AV_TOSTRING(s)
#define FAST_BGR2YV12
#define MAX_FILTER_SIZE   256
#define ALT32_CORR   1
#define APCK_PTR2   4
#define APCK_COEF   8
#define APCK_SIZE   16
#define RED_DITHER   "0*8"
#define GREEN_DITHER   "1*8"
#define BLUE_DITHER   "2*8"
#define Y_COEFF   "3*8"
#define VR_COEFF   "4*8"
#define UB_COEFF   "5*8"
#define VG_COEFF   "6*8"
#define UG_COEFF   "7*8"
#define Y_OFFSET   "8*8"
#define U_OFFSET   "9*8"
#define V_OFFSET   "10*8"
#define LUM_MMX_FILTER_OFFSET   "11*8"
#define CHR_MMX_FILTER_OFFSET   "11*8+4*4*256"
#define DSTW_OFFSET   "11*8+4*4*256*2"
#define ESP_OFFSET   "11*8+4*4*256*2+8"
#define VROUNDER_OFFSET   "11*8+4*4*256*2+16"
#define U_TEMP   "11*8+4*4*256*2+24"
#define V_TEMP   "11*8+4*4*256*2+32"
#define Y_TEMP   "11*8+4*4*256*2+40"
#define ALP_MMX_FILTER_OFFSET   "11*8+4*4*256*2+48"
#define UV_OFF_PX   "11*8+4*4*256*3+48"
#define UV_OFF_BYTE   "11*8+4*4*256*3+56"
#define DITHER16   "11*8+4*4*256*3+64"
#define DITHER32   "11*8+4*4*256*3+80"
#define is16BPS(x)   (av_pix_fmt_descriptors[x].comp[0].depth_minus1 == 15)
#define is9_OR_10BPS(x)
#define isBE(x)   (av_pix_fmt_descriptors[x].flags & PIX_FMT_BE)
#define isYUV(x)
#define isPlanarYUV(x)
#define isRGB(x)   (av_pix_fmt_descriptors[x].flags & PIX_FMT_RGB)
#define isGray(x)
#define isRGBinInt(x)
#define isBGRinInt(x)
#define isAnyRGB(x)
#define isALPHA(x)
#define isPacked(x)
#define isPlanar(x)
#define usePal(x)   ((av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL) || (x) == PIX_FMT_Y400A)

Typedefs

typedef int(* SwsFunc )(struct SwsContext *context, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
typedef void(* yuv2planar1_fn )(const int16_t *src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
 Write one line of horizontally scaled data to planar output without any additional vertical scaling (or point-scaling).
typedef void(* yuv2planarX_fn )(const int16_t *filter, int filterSize, const int16_t **src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
 Write one line of horizontally scaled data to planar output with multi-point vertical scaling between input pixels.
typedef void(* yuv2interleavedX_fn )(struct SwsContext *c, const int16_t *chrFilter, int chrFilterSize, const int16_t **chrUSrc, const int16_t **chrVSrc, uint8_t *dest, int dstW)
 Write one line of horizontally scaled chroma to interleaved output with multi-point vertical scaling between input pixels.
typedef void(* yuv2packed1_fn )(struct SwsContext *c, const int16_t *lumSrc, const int16_t *chrUSrc[2], const int16_t *chrVSrc[2], const int16_t *alpSrc, uint8_t *dest, int dstW, int uvalpha, int y)
 Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB output without any additional vertical scaling (or point-scaling).
typedef void(* yuv2packed2_fn )(struct SwsContext *c, const int16_t *lumSrc[2], const int16_t *chrUSrc[2], const int16_t *chrVSrc[2], const int16_t *alpSrc[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y)
 Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB output by doing bilinear scaling between two input lines.
typedef void(* yuv2packedX_fn )(struct SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
 Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB output by doing multi-point vertical scaling between input pixels.
typedef struct SwsContext SwsContext

Functions

SwsFunc ff_yuv2rgb_get_func_ptr (SwsContext *c)
int ff_yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation)
void ff_yuv2rgb_init_tables_altivec (SwsContext *c, const int inv_table[4], int brightness, int contrast, int saturation)
void updateMMXDitherTables (SwsContext *c, int dstY, int lumBufIndex, int chrBufIndex, int lastInLumBuf, int lastInChrBuf)
SwsFunc ff_yuv2rgb_init_mmx (SwsContext *c)
SwsFunc ff_yuv2rgb_init_vis (SwsContext *c)
SwsFunc ff_yuv2rgb_init_mlib (SwsContext *c)
SwsFunc ff_yuv2rgb_init_altivec (SwsContext *c)
SwsFunc ff_yuv2rgb_get_func_ptr_bfin (SwsContext *c)
void ff_bfin_get_unscaled_swscale (SwsContext *c)
const char * sws_format_name (enum PixelFormat format)
void ff_get_unscaled_swscale (SwsContext *c)
 Set c->swScale to an unscaled converter if one exists for the specific source and destination formats, bit depths, flags, etc.
void ff_swscale_get_unscaled_altivec (SwsContext *c)
SwsFunc ff_getSwsFunc (SwsContext *c)
 Return function pointer to fastest main scaler path function depending on architecture and available optimizations.
void ff_sws_init_swScale_altivec (SwsContext *c)
void ff_sws_init_swScale_mmx (SwsContext *c)

Variables

const uint64_t ff_dither4 [2]
const uint64_t ff_dither8 [2]
const AVClass sws_context_class

Macro Definition Documentation

#define ALP_MMX_FILTER_OFFSET   "11*8+4*4*256*2+48"

Definition at line 355 of file swscale_internal.h.

Referenced by yuv2rgb32_X_ar_TMPL(), and yuv2rgb32_X_TMPL().

#define ALT32_CORR   1

Definition at line 44 of file swscale_internal.h.

Referenced by rgbToRgbWrapper().

#define APCK_COEF   8

Definition at line 53 of file swscale_internal.h.

Referenced by DECLARE_ASM_CONST().

#define APCK_PTR2   4

Definition at line 52 of file swscale_internal.h.

Referenced by DECLARE_ASM_CONST().

#define APCK_SIZE   16

Definition at line 54 of file swscale_internal.h.

Referenced by DECLARE_ASM_CONST(), and initFilter().

#define CHR_MMX_FILTER_OFFSET   "11*8+4*4*256"

Definition at line 348 of file swscale_internal.h.

#define DITHER16   "11*8+4*4*256*3+64"

Definition at line 358 of file swscale_internal.h.

#define DITHER32   "11*8+4*4*256*3+80"

Definition at line 359 of file swscale_internal.h.

#define DSTW_OFFSET   "11*8+4*4*256*2"

Definition at line 349 of file swscale_internal.h.

#define FAST_BGR2YV12

Definition at line 37 of file swscale_internal.h.

#define is16BPS (   x)    (av_pix_fmt_descriptors[x].comp[0].depth_minus1 == 15)
#define is9_OR_10BPS (   x)
Value:
av_pix_fmt_descriptors[x].comp[0].depth_minus1 == 9)

Definition at line 548 of file swscale_internal.h.

Referenced by ff_sws_init_swScale_altivec(), find_c_packed_planar_out_funcs(), planarCopyWrapper(), sws_init_swScale_TMPL(), and swScale().

#define isALPHA (   x)
Value:
av_pix_fmt_descriptors[x].nb_components == 4)

Definition at line 618 of file swscale_internal.h.

#define isAnyRGB (   x)
Value:
(isRGBinInt(x) || \
isBGRinInt(x))

Definition at line 614 of file swscale_internal.h.

Referenced by ff_get_unscaled_swscale(), sws_init_context(), and sws_init_swScale_c().

#define isBE (   x)    (av_pix_fmt_descriptors[x].flags & PIX_FMT_BE)
#define isBGRinInt (   x)
Value:
((x) == PIX_FMT_BGR48BE || \
(x) == PIX_FMT_BGR48LE || \
(x) == PIX_FMT_BGR32 || \
(x) == PIX_FMT_BGR32_1 || \
(x) == PIX_FMT_BGR24 || \
(x) == PIX_FMT_BGR565BE || \
(x) == PIX_FMT_BGR565LE || \
(x) == PIX_FMT_BGR555BE || \
(x) == PIX_FMT_BGR555LE || \
(x) == PIX_FMT_BGR444BE || \
(x) == PIX_FMT_BGR444LE || \
(x) == PIX_FMT_BGR8 || \
(x) == PIX_FMT_BGR4 || \
(x) == PIX_FMT_BGR4_BYTE || \
(x) == PIX_FMT_MONOBLACK || \

Definition at line 596 of file swscale_internal.h.

Referenced by findRgbConvFn().

#define isGray (   x)
Value:
((x) == PIX_FMT_GRAY8 || \
(x) == PIX_FMT_Y400A || \
(x) == PIX_FMT_GRAY16BE || \

Definition at line 571 of file swscale_internal.h.

#define isPacked (   x)
Value:

Definition at line 622 of file swscale_internal.h.

Referenced by ff_get_unscaled_swscale(), and swScale().

#define isPlanar (   x)
Value:

Definition at line 627 of file swscale_internal.h.

Referenced by reset_ptr().

#define isPlanarYUV (   x)
Value:

Definition at line 559 of file swscale_internal.h.

Referenced by ff_get_unscaled_swscale(), and swScale().

#define isRGB (   x)    (av_pix_fmt_descriptors[x].flags & PIX_FMT_RGB)

Definition at line 563 of file swscale_internal.h.

#define isRGBinInt (   x)
Value:
((x) == PIX_FMT_RGB48BE || \
(x) == PIX_FMT_RGB48LE || \
(x) == PIX_FMT_RGB32 || \
(x) == PIX_FMT_RGB32_1 || \
(x) == PIX_FMT_RGB24 || \
(x) == PIX_FMT_RGB565BE || \
(x) == PIX_FMT_RGB565LE || \
(x) == PIX_FMT_RGB555BE || \
(x) == PIX_FMT_RGB555LE || \
(x) == PIX_FMT_RGB444BE || \
(x) == PIX_FMT_RGB444LE || \
(x) == PIX_FMT_RGB8 || \
(x) == PIX_FMT_RGB4 || \
(x) == PIX_FMT_RGB4_BYTE || \
(x) == PIX_FMT_MONOBLACK || \

Definition at line 578 of file swscale_internal.h.

Referenced by findRgbConvFn().

#define isYUV (   x)
Value:
av_pix_fmt_descriptors[x].nb_components >= 2)

Definition at line 555 of file swscale_internal.h.

Referenced by sws_getColorspaceDetails(), and sws_setColorspaceDetails().

#define LUM_MMX_FILTER_OFFSET   "11*8"

Definition at line 347 of file swscale_internal.h.

#define MAX_FILTER_SIZE   256

Definition at line 39 of file swscale_internal.h.

Referenced by initFilter().

#define STR (   s)    AV_TOSTRING(s)

Definition at line 35 of file swscale_internal.h.

Referenced by av_register_all().

#define U_OFFSET   "9*8"

Definition at line 345 of file swscale_internal.h.

#define U_TEMP   "11*8+4*4*256*2+24"

Definition at line 352 of file swscale_internal.h.

Referenced by yuv2rgb32_2_TMPL(), and yuv2rgb32_X_ar_TMPL().

#define UB_COEFF   "5*8"

Definition at line 341 of file swscale_internal.h.

#define UG_COEFF   "7*8"

Definition at line 343 of file swscale_internal.h.

#define usePal (   x)    ((av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL) || (x) == PIX_FMT_Y400A)

Definition at line 631 of file swscale_internal.h.

Referenced by ff_get_unscaled_swscale(), palToRgbWrapper(), reset_ptr(), and sws_scale().

#define UV_OFF_BYTE   "11*8+4*4*256*3+56"

Definition at line 357 of file swscale_internal.h.

#define UV_OFF_PX   "11*8+4*4*256*3+48"

Definition at line 356 of file swscale_internal.h.

#define V_OFFSET   "10*8"

Definition at line 346 of file swscale_internal.h.

#define V_TEMP   "11*8+4*4*256*2+32"

Definition at line 353 of file swscale_internal.h.

Referenced by yuv2rgb32_2_TMPL(), and yuv2rgb32_X_ar_TMPL().

#define VG_COEFF   "6*8"

Definition at line 342 of file swscale_internal.h.

#define VR_COEFF   "4*8"

Definition at line 340 of file swscale_internal.h.

#define VROUNDER_OFFSET   "11*8+4*4*256*2+16"

Definition at line 351 of file swscale_internal.h.

#define Y_COEFF   "3*8"

Definition at line 339 of file swscale_internal.h.

#define Y_OFFSET   "8*8"

Definition at line 344 of file swscale_internal.h.

#define Y_TEMP   "11*8+4*4*256*2+40"

Definition at line 354 of file swscale_internal.h.

Referenced by yuv2rgb32_X_ar_TMPL().

Typedef Documentation

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

Definition at line 59 of file swscale_internal.h.

typedef void(* yuv2interleavedX_fn)(struct SwsContext *c, const int16_t *chrFilter, int chrFilterSize, const int16_t **chrUSrc, const int16_t **chrVSrc, uint8_t *dest, int dstW)

Write one line of horizontally scaled chroma to interleaved output with multi-point vertical scaling between input pixels.

Parameters
cSWS scaling context
chrFiltervertical chroma scaling coefficients, 12bit [0,4096]
chrUSrcscaled chroma (U) source data, 15bit for 8-10bit output, 19-bit for 16bit output (in int32_t)
chrVSrcscaled chroma (V) source data, 15bit for 8-10bit output, 19-bit for 16bit output (in int32_t)
chrFilterSizenumber of vertical chroma input lines to scale
destpointer to the output plane. For >8bit output, this is in uint16_t
dstWwidth of chroma planes

Definition at line 110 of file swscale_internal.h.

typedef void(* yuv2packed1_fn)(struct SwsContext *c, const int16_t *lumSrc, const int16_t *chrUSrc[2], const int16_t *chrVSrc[2], const int16_t *alpSrc, uint8_t *dest, int dstW, int uvalpha, int y)

Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB output without any additional vertical scaling (or point-scaling).

Note that this function may do chroma scaling, see the "uvalpha" argument.

Parameters
cSWS scaling context
lumSrcscaled luma (Y) source data, 15bit for 8-10bit output, 19-bit for 16bit output (in int32_t)
chrUSrcscaled chroma (U) source data, 15bit for 8-10bit output, 19-bit for 16bit output (in int32_t)
chrVSrcscaled chroma (V) source data, 15bit for 8-10bit output, 19-bit for 16bit output (in int32_t)
alpSrcscaled alpha (A) source data, 15bit for 8-10bit output, 19-bit for 16bit output (in int32_t)
destpointer to the output plane. For 16bit output, this is uint16_t
dstWwidth of lumSrc and alpSrc in pixels, number of pixels to write into dest[]
uvalphachroma scaling coefficient for the second line of chroma pixels, either 2048 or 0. If 0, one chroma input is used for 2 output pixels (or if the SWS_FLAG_FULL_CHR_INT flag is set, it generates 1 output pixel). If 2048, two chroma input pixels should be averaged for 2 output pixels (this only happens if SWS_FLAG_FULL_CHR_INT is not set)
yvertical line number for this output. This does not need to be used to calculate the offset in the destination, but can be used to generate comfort noise using dithering for some output formats.

Definition at line 146 of file swscale_internal.h.

typedef void(* yuv2packed2_fn)(struct SwsContext *c, const int16_t *lumSrc[2], const int16_t *chrUSrc[2], const int16_t *chrVSrc[2], const int16_t *alpSrc[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y)

Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB output by doing bilinear scaling between two input lines.

Parameters
cSWS scaling context
lumSrcscaled luma (Y) source data, 15bit for 8-10bit output, 19-bit for 16bit output (in int32_t)
chrUSrcscaled chroma (U) source data, 15bit for 8-10bit output, 19-bit for 16bit output (in int32_t)
chrVSrcscaled chroma (V) source data, 15bit for 8-10bit output, 19-bit for 16bit output (in int32_t)
alpSrcscaled alpha (A) source data, 15bit for 8-10bit output, 19-bit for 16bit output (in int32_t)
destpointer to the output plane. For 16bit output, this is uint16_t
dstWwidth of lumSrc and alpSrc in pixels, number of pixels to write into dest[]
yalphaluma/alpha scaling coefficients for the second input line. The first line's coefficients can be calculated by using 4096 - yalpha
uvalphachroma scaling coefficient for the second input line. The first line's coefficients can be calculated by using 4096 - uvalpha
yvertical line number for this output. This does not need to be used to calculate the offset in the destination, but can be used to generate comfort noise using dithering for some output formats.

Definition at line 179 of file swscale_internal.h.

typedef void(* yuv2packedX_fn)(struct SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int y)

Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB output by doing multi-point vertical scaling between input pixels.

Parameters
cSWS scaling context
lumFiltervertical luma/alpha scaling coefficients, 12bit [0,4096]
lumSrcscaled luma (Y) source data, 15bit for 8-10bit output, 19-bit for 16bit output (in int32_t)
lumFilterSizenumber of vertical luma/alpha input lines to scale
chrFiltervertical chroma scaling coefficients, 12bit [0,4096]
chrUSrcscaled chroma (U) source data, 15bit for 8-10bit output, 19-bit for 16bit output (in int32_t)
chrVSrcscaled chroma (V) source data, 15bit for 8-10bit output, 19-bit for 16bit output (in int32_t)
chrFilterSizenumber of vertical chroma input lines to scale
alpSrcscaled alpha (A) source data, 15bit for 8-10bit output, 19-bit for 16bit output (in int32_t)
destpointer to the output plane. For 16bit output, this is uint16_t
dstWwidth of lumSrc and alpSrc in pixels, number of pixels to write into dest[]
yvertical line number for this output. This does not need to be used to calculate the offset in the destination, but can be used to generate comfort noise using dithering or some output formats.

Definition at line 211 of file swscale_internal.h.

typedef void(* yuv2planar1_fn)(const int16_t *src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)

Write one line of horizontally scaled data to planar output without any additional vertical scaling (or point-scaling).

Parameters
srcscaled source data, 15bit for 8-10bit output, 19-bit for 16bit output (in int32_t)
destpointer to the output plane. For >8bit output, this is in uint16_t
dstWwidth of destination in pixels
ditherordered dither array of type int16_t and size 8
offsetDither offset

Definition at line 75 of file swscale_internal.h.

typedef void(* yuv2planarX_fn)(const int16_t *filter, int filterSize, const int16_t **src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)

Write one line of horizontally scaled data to planar output with multi-point vertical scaling between input pixels.

Parameters
filtervertical luma/alpha scaling coefficients, 12bit [0,4096]
srcscaled luma (Y) or alpha (A) source data, 15bit for 8-10bit output, 19-bit for 16bit output (in int32_t)
filterSizenumber of vertical input lines to scale
destpointer to output plane. For >8bit output, this is in uint16_t
dstWwidth of destination pixels
offsetDither offset

Definition at line 91 of file swscale_internal.h.

Function Documentation

void ff_bfin_get_unscaled_swscale ( SwsContext c)

Definition at line 79 of file swscale_bfin.c.

Referenced by ff_get_unscaled_swscale().

void ff_get_unscaled_swscale ( SwsContext c)

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

Definition at line 759 of file swscale_unscaled.c.

Referenced by sws_init_context().

SwsFunc ff_getSwsFunc ( SwsContext c)

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

Definition at line 2907 of file swscale.c.

Referenced by sws_init_context().

void ff_sws_init_swScale_altivec ( SwsContext c)

Definition at line 327 of file swscale_altivec.c.

Referenced by ff_getSwsFunc().

void ff_sws_init_swScale_mmx ( SwsContext c)

Definition at line 305 of file swscale_mmx.c.

Referenced by ff_getSwsFunc().

void ff_swscale_get_unscaled_altivec ( SwsContext c)

Definition at line 179 of file yuv2yuv_altivec.c.

Referenced by ff_get_unscaled_swscale().

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

Definition at line 590 of file yuv2rgb.c.

Referenced by sws_setColorspaceDetails().

SwsFunc ff_yuv2rgb_get_func_ptr ( SwsContext c)

Definition at line 505 of file yuv2rgb.c.

Referenced by ff_get_unscaled_swscale().

SwsFunc ff_yuv2rgb_get_func_ptr_bfin ( SwsContext c)

Definition at line 184 of file yuv2rgb_bfin.c.

Referenced by ff_yuv2rgb_get_func_ptr().

SwsFunc ff_yuv2rgb_init_altivec ( SwsContext c)

Definition at line 543 of file yuv2rgb_altivec.c.

Referenced by ff_yuv2rgb_get_func_ptr().

SwsFunc ff_yuv2rgb_init_mlib ( SwsContext c)

Definition at line 80 of file yuv2rgb_mlib.c.

Referenced by ff_yuv2rgb_get_func_ptr().

SwsFunc ff_yuv2rgb_init_mmx ( SwsContext c)

Referenced by ff_yuv2rgb_get_func_ptr().

void ff_yuv2rgb_init_tables_altivec ( SwsContext c,
const int  inv_table[4],
int  brightness,
int  contrast,
int  saturation 
)

Definition at line 603 of file yuv2rgb_altivec.c.

Referenced by sws_setColorspaceDetails().

SwsFunc ff_yuv2rgb_init_vis ( SwsContext c)

Definition at line 189 of file yuv2rgb_vis.c.

Referenced by ff_yuv2rgb_get_func_ptr().

const char* sws_format_name ( enum PixelFormat  format)
void updateMMXDitherTables ( SwsContext c,
int  dstY,
int  lumBufIndex,
int  chrBufIndex,
int  lastInLumBuf,
int  lastInChrBuf 
)

Referenced by swScale().

Variable Documentation

const uint64_t ff_dither4[2]
const uint64_t ff_dither8[2]

Definition at line 43 of file swscale_mmx.c.

Referenced by DECLARE_ASM_CONST(), yuv420_rgb15_TMPL(), and yuv420_rgb16_TMPL().

const AVClass sws_context_class

Definition at line 69 of file options.c.

Referenced by sws_alloc_context(), and sws_get_class().