FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
swscale.c File Reference
#include <inttypes.h>
#include "config.h"
#include "libswscale/swscale.h"
#include "libswscale/swscale_internal.h"
#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/x86/cpu.h"
#include "libavutil/cpu.h"
#include "libavutil/pixdesc.h"

Go to the source code of this file.

Macros

#define SCALE_FUNC(filter_n, from_bpc, to_bpc, opt)
 
#define SCALE_FUNCS(filter_n, opt)
 
#define SCALE_FUNCS_MMX(opt)
 
#define SCALE_FUNCS_SSE(opt)
 
#define VSCALEX_FUNC(size, opt)
 
#define VSCALEX_FUNCS(opt)
 
#define VSCALE_FUNC(size, opt)
 
#define VSCALE_FUNCS(opt1, opt2)
 
#define INPUT_Y_FUNC(fmt, opt)
 
#define INPUT_UV_FUNC(fmt, opt)
 
#define INPUT_FUNC(fmt, opt)
 
#define INPUT_FUNCS(opt)
 
#define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2)
 
#define ASSIGN_MMX_SCALE_FUNC(hscalefn, filtersize, opt1, opt2)
 
#define ASSIGN_VSCALEX_FUNC(vscalefn, opt, do_16_case, condition_8bit)
 
#define ASSIGN_VSCALE_FUNC(vscalefn, opt1, opt2, opt2chk)
 
#define case_rgb(x, X, opt)
 
#define ASSIGN_SSE_SCALE_FUNC(hscalefn, filtersize, opt1, opt2)
 

Functions

 SCALE_FUNCS_SSE (sse2)
 
 SCALE_FUNCS_SSE (ssse3)
 
 SCALE_FUNCS_SSE (sse4)
 
 VSCALEX_FUNCS (sse2)
 
 VSCALEX_FUNCS (sse4)
 
 VSCALEX_FUNC (16, sse4)
 
 VSCALEX_FUNCS (avx)
 
 VSCALE_FUNCS (sse2, sse2)
 
 VSCALE_FUNC (16, sse4)
 
 VSCALE_FUNCS (avx, avx)
 
 INPUT_FUNCS (sse2)
 
 INPUT_FUNCS (ssse3)
 
 INPUT_FUNCS (avx)
 
av_cold void ff_sws_init_swscale_x86 (SwsContext *c)
 

Macro Definition Documentation

#define SCALE_FUNC (   filter_n,
  from_bpc,
  to_bpc,
  opt 
)
Value:
void ff_hscale ## from_bpc ## to ## to_bpc ## _ ## filter_n ## _ ## opt( \
SwsContext *c, int16_t *data, \
int dstW, const uint8_t *src, \
const int16_t *filter, \
const int32_t *filterPos, int filterSize)
ptrdiff_t const GLvoid * data
Definition: opengl_enc.c:101
#define src
Definition: vp8dsp.c:254
static void filter(int16_t *output, ptrdiff_t out_stride, int16_t *low, ptrdiff_t low_stride, int16_t *high, ptrdiff_t high_stride, int len, int clip)
Definition: cfhd.c:153
uint8_t
#define _
const char * to
Definition: webvttdec.c:34
int32_t
static double c[64]

Definition at line 280 of file swscale.c.

#define SCALE_FUNCS (   filter_n,
  opt 
)
Value:
SCALE_FUNC(filter_n, 8, 15, opt); \
SCALE_FUNC(filter_n, 9, 15, opt); \
SCALE_FUNC(filter_n, 10, 15, opt); \
SCALE_FUNC(filter_n, 12, 15, opt); \
SCALE_FUNC(filter_n, 14, 15, opt); \
SCALE_FUNC(filter_n, 16, 15, opt); \
SCALE_FUNC(filter_n, 8, 19, opt); \
SCALE_FUNC(filter_n, 9, 19, opt); \
SCALE_FUNC(filter_n, 10, 19, opt); \
SCALE_FUNC(filter_n, 12, 19, opt); \
SCALE_FUNC(filter_n, 14, 19, opt); \
SCALE_FUNC(filter_n, 16, 19, opt)
#define SCALE_FUNC(filter_n, from_bpc, to_bpc, opt)
Definition: swscale.c:280

Definition at line 287 of file swscale.c.

#define SCALE_FUNCS_MMX (   opt)
Value:
SCALE_FUNCS(4, opt); \
SCALE_FUNCS(8, opt); \
SCALE_FUNCS(X, opt)
#define SCALE_FUNCS(filter_n, opt)
Definition: swscale.c:287

Definition at line 301 of file swscale.c.

#define SCALE_FUNCS_SSE (   opt)
Value:
SCALE_FUNCS(4, opt); \
SCALE_FUNCS(8, opt); \
SCALE_FUNCS(X4, opt); \
SCALE_FUNCS(X8, opt)
#define SCALE_FUNCS(filter_n, opt)
Definition: swscale.c:287

Definition at line 306 of file swscale.c.

#define VSCALEX_FUNC (   size,
  opt 
)
Value:
void ff_yuv2planeX_ ## size ## _ ## opt(const int16_t *filter, int filterSize, \
const int16_t **src, uint8_t *dest, int dstW, \
const uint8_t *dither, int offset)
#define src
Definition: vp8dsp.c:254
static void filter(int16_t *output, ptrdiff_t out_stride, int16_t *low, ptrdiff_t low_stride, int16_t *high, ptrdiff_t high_stride, int len, int clip)
Definition: cfhd.c:153
uint8_t
ptrdiff_t size
Definition: opengl_enc.c:101
#define _
static const uint8_t dither[8][8]
Definition: vf_fspp.c:57
static const uint8_t offset[127][2]
Definition: vf_spp.c:92

Definition at line 319 of file swscale.c.

#define VSCALEX_FUNCS (   opt)
Value:
VSCALEX_FUNC(8, opt); \
VSCALEX_FUNC(9, opt); \
VSCALEX_FUNC(10, opt)
#define VSCALEX_FUNC(size, opt)
Definition: swscale.c:319

Definition at line 323 of file swscale.c.

#define VSCALE_FUNC (   size,
  opt 
)
Value:
void ff_yuv2plane1_ ## size ## _ ## opt(const int16_t *src, uint8_t *dst, int dstW, \
const uint8_t *dither, int offset)
#define src
Definition: vp8dsp.c:254
uint8_t
ptrdiff_t size
Definition: opengl_enc.c:101
#define _
static const uint8_t dither[8][8]
Definition: vf_fspp.c:57
static const uint8_t offset[127][2]
Definition: vf_spp.c:92

Definition at line 336 of file swscale.c.

#define VSCALE_FUNCS (   opt1,
  opt2 
)
Value:
VSCALE_FUNC(8, opt1); \
VSCALE_FUNC(9, opt2); \
VSCALE_FUNC(10, opt2); \
VSCALE_FUNC(16, opt1)
#define VSCALE_FUNC(size, opt)
Definition: swscale.c:336

Definition at line 339 of file swscale.c.

#define INPUT_Y_FUNC (   fmt,
  opt 
)
Value:
void ff_ ## fmt ## ToY_ ## opt(uint8_t *dst, const uint8_t *src, \
const uint8_t *unused1, const uint8_t *unused2, \
int w, uint32_t *unused)
const char * fmt
Definition: avisynth_c.h:769
#define src
Definition: vp8dsp.c:254
uint8_t
uint8_t w
Definition: llviddspenc.c:38

Definition at line 352 of file swscale.c.

#define INPUT_UV_FUNC (   fmt,
  opt 
)
Value:
void ff_ ## fmt ## ToUV_ ## opt(uint8_t *dstU, uint8_t *dstV, \
const uint8_t *unused0, \
const uint8_t *src1, \
const uint8_t *src2, \
int w, uint32_t *unused)
const char * fmt
Definition: avisynth_c.h:769
uint8_t
uint8_t w
Definition: llviddspenc.c:38
#define src1
Definition: h264pred.c:139

Definition at line 356 of file swscale.c.

#define INPUT_FUNC (   fmt,
  opt 
)
Value:
const char * fmt
Definition: avisynth_c.h:769
#define INPUT_Y_FUNC(fmt, opt)
Definition: swscale.c:352
#define INPUT_UV_FUNC(fmt, opt)
Definition: swscale.c:356

Definition at line 362 of file swscale.c.

#define INPUT_FUNCS (   opt)
Value:
INPUT_FUNC(uyvy, opt); \
INPUT_FUNC(yuyv, opt); \
INPUT_UV_FUNC(nv12, opt); \
INPUT_UV_FUNC(nv21, opt); \
INPUT_FUNC(rgba, opt); \
INPUT_FUNC(bgra, opt); \
INPUT_FUNC(argb, opt); \
INPUT_FUNC(abgr, opt); \
INPUT_FUNC(rgb24, opt); \
INPUT_FUNC(bgr24, opt)
#define INPUT_FUNC(fmt, opt)
Definition: swscale.c:362
#define INPUT_UV_FUNC(fmt, opt)
Definition: swscale.c:356

Definition at line 365 of file swscale.c.

#define ASSIGN_SCALE_FUNC2 (   hscalefn,
  filtersize,
  opt1,
  opt2 
)
Value:
do { \
if (c->srcBpc == 8) { \
hscalefn = c->dstBpc <= 14 ? ff_hscale8to15_ ## filtersize ## _ ## opt2 : \
ff_hscale8to19_ ## filtersize ## _ ## opt1; \
} else if (c->srcBpc == 9) { \
hscalefn = c->dstBpc <= 14 ? ff_hscale9to15_ ## filtersize ## _ ## opt2 : \
ff_hscale9to19_ ## filtersize ## _ ## opt1; \
} else if (c->srcBpc == 10) { \
hscalefn = c->dstBpc <= 14 ? ff_hscale10to15_ ## filtersize ## _ ## opt2 : \
ff_hscale10to19_ ## filtersize ## _ ## opt1; \
} else if (c->srcBpc == 12) { \
hscalefn = c->dstBpc <= 14 ? ff_hscale12to15_ ## filtersize ## _ ## opt2 : \
ff_hscale12to19_ ## filtersize ## _ ## opt1; \
} else if (c->srcBpc == 14 || ((c->srcFormat==AV_PIX_FMT_PAL8||isAnyRGB(c->srcFormat)) && av_pix_fmt_desc_get(c->srcFormat)->comp[0].depth<16)) { \
hscalefn = c->dstBpc <= 14 ? ff_hscale14to15_ ## filtersize ## _ ## opt2 : \
ff_hscale14to19_ ## filtersize ## _ ## opt1; \
} else { /* c->srcBpc == 16 */ \
av_assert0(c->srcBpc == 16);\
hscalefn = c->dstBpc <= 14 ? ff_hscale16to15_ ## filtersize ## _ ## opt2 : \
ff_hscale16to19_ ## filtersize ## _ ## opt1; \
} \
} while (0)
static av_always_inline int isAnyRGB(enum AVPixelFormat pix_fmt)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2446
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
Definition: pixdesc.h:117
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:77
#define _
if(ret< 0)
Definition: vf_mcdeint.c:279
static double c[64]
int depth
Number of bits in the component.
Definition: pixdesc.h:58
#define ASSIGN_MMX_SCALE_FUNC (   hscalefn,
  filtersize,
  opt1,
  opt2 
)
Value:
switch (filtersize) { \
case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \
case 8: ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \
default: ASSIGN_SCALE_FUNC2(hscalefn, X, opt1, opt2); break; \
}
#define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2)

Referenced by ff_sws_init_swscale_x86().

#define ASSIGN_VSCALEX_FUNC (   vscalefn,
  opt,
  do_16_case,
  condition_8bit 
)
Value:
switch(c->dstBpc){ \
case 16: do_16_case; break; \
case 10: if (!isBE(c->dstFormat) && c->dstFormat != AV_PIX_FMT_P010LE) vscalefn = ff_yuv2planeX_10_ ## opt; break; \
case 9: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_9_ ## opt; break; \
case 8: if ((condition_8bit) && !c->use_mmx_vfilter) vscalefn = ff_yuv2planeX_8_ ## opt; break; \
}
like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, little-endian
Definition: pixfmt.h:284
static av_always_inline int isBE(enum AVPixelFormat pix_fmt)
static double c[64]

Referenced by ff_sws_init_swscale_x86().

#define ASSIGN_VSCALE_FUNC (   vscalefn,
  opt1,
  opt2,
  opt2chk 
)
Value:
switch(c->dstBpc){ \
case 16: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2plane1_16_ ## opt1; break; \
case 10: if (!isBE(c->dstFormat) && c->dstFormat != AV_PIX_FMT_P010LE && opt2chk) vscalefn = ff_yuv2plane1_10_ ## opt2; break; \
case 9: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_9_ ## opt2; break; \
case 8: vscalefn = ff_yuv2plane1_8_ ## opt1; break; \
default: av_assert0(c->dstBpc>8); \
}
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, little-endian
Definition: pixfmt.h:284
static av_always_inline int isBE(enum AVPixelFormat pix_fmt)
static double c[64]

Referenced by ff_sws_init_swscale_x86().

#define case_rgb (   x,
  X,
  opt 
)
Value:
case AV_PIX_FMT_ ## X: \
c->lumToYV12 = ff_ ## x ## ToY_ ## opt; \
if (!c->chrSrcHSubSample) \
c->chrToYV12 = ff_ ## x ## ToUV_ ## opt; \
break
if(ret< 0)
Definition: vf_mcdeint.c:279
static double c[64]

Referenced by ff_sws_init_swscale_x86().

#define ASSIGN_SSE_SCALE_FUNC (   hscalefn,
  filtersize,
  opt1,
  opt2 
)
Value:
switch (filtersize) { \
case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \
case 8: ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \
default: if (filtersize & 4) ASSIGN_SCALE_FUNC2(hscalefn, X4, opt1, opt2); \
else ASSIGN_SCALE_FUNC2(hscalefn, X8, opt1, opt2); \
break; \
}
#define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2)

Referenced by ff_sws_init_swscale_x86().

Function Documentation

SCALE_FUNCS_SSE ( sse2  )
SCALE_FUNCS_SSE ( ssse3  )
SCALE_FUNCS_SSE ( sse4  )
VSCALEX_FUNCS ( sse2  )
VSCALEX_FUNCS ( sse4  )
VSCALEX_FUNC ( 16  ,
sse4   
)
VSCALEX_FUNCS ( avx  )
VSCALE_FUNCS ( sse2  ,
sse2   
)
VSCALE_FUNC ( 16  ,
sse4   
)
VSCALE_FUNCS ( avx  ,
avx   
)
INPUT_FUNCS ( sse2  )
INPUT_FUNCS ( ssse3  )
INPUT_FUNCS ( avx  )
av_cold void ff_sws_init_swscale_x86 ( SwsContext c)

Definition at line 384 of file swscale.c.

Referenced by ff_getSwsFunc().