FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
dsputil.c File Reference

DSP utils. More...

#include "libavutil/attributes.h"
#include "libavutil/internal.h"
#include "avcodec.h"
#include "copy_block.h"
#include "dsputil.h"
#include "simple_idct.h"
#include "mpegvideo.h"
#include "config.h"

Go to the source code of this file.

Macros

#define avg2(a, b)   ((a + b + 1) >> 1)
 
#define avg4(a, b, c, d)   ((a + b + c + d + 2) >> 2)
 
#define BUTTERFLY2(o1, o2, i1, i2)
 
#define BUTTERFLY1(x, y)
 
#define BUTTERFLYA(x, y)   (FFABS((x) + (y)) + FFABS((x) - (y)))
 
#define VSAD_INTRA(size)
 
#define VSAD(size)
 
#define SQ(a)   ((a) * (a))
 
#define VSSE_INTRA(size)
 
#define VSSE(size)
 
#define WRAPPER8_16_SQ(name8, name16)
 
#define SET_CMP_FUNC(name)
 

Functions

static int sse4_c (MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
 
static int sse8_c (MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
 
static int sse16_c (MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
 
static int sum_abs_dctelem_c (int16_t *block)
 
static int pix_abs16_c (MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
 
static int pix_abs16_x2_c (MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
 
static int pix_abs16_y2_c (MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
 
static int pix_abs16_xy2_c (MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
 
static int pix_abs8_c (MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
 
static int pix_abs8_x2_c (MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
 
static int pix_abs8_y2_c (MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
 
static int pix_abs8_xy2_c (MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
 
static int nsse16_c (MpegEncContext *c, uint8_t *s1, uint8_t *s2, int stride, int h)
 
static int nsse8_c (MpegEncContext *c, uint8_t *s1, uint8_t *s2, int stride, int h)
 
static int zero_cmp (MpegEncContext *s, uint8_t *a, uint8_t *b, int stride, int h)
 
void ff_set_cmp (DSPContext *c, me_cmp_func *cmp, int type)
 
static int hadamard8_diff8x8_c (MpegEncContext *s, uint8_t *dst, uint8_t *src, int stride, int h)
 
static int hadamard8_intra8x8_c (MpegEncContext *s, uint8_t *src, uint8_t *dummy, int stride, int h)
 
static int dct_sad8x8_c (MpegEncContext *s, uint8_t *src1, uint8_t *src2, int stride, int h)
 
static int dct_max8x8_c (MpegEncContext *s, uint8_t *src1, uint8_t *src2, int stride, int h)
 
static int quant_psnr8x8_c (MpegEncContext *s, uint8_t *src1, uint8_t *src2, int stride, int h)
 
static int rd8x8_c (MpegEncContext *s, uint8_t *src1, uint8_t *src2, int stride, int h)
 
static int bit8x8_c (MpegEncContext *s, uint8_t *src1, uint8_t *src2, int stride, int h)
 
av_cold void ff_dsputil_static_init (void)
 
int ff_check_alignment (void)
 
av_cold void ff_dsputil_init (DSPContext *c, AVCodecContext *avctx)
 
av_cold void dsputil_init (DSPContext *c, AVCodecContext *avctx)
 
av_cold void avpriv_dsputil_init (DSPContext *c, AVCodecContext *avctx)
 

Variables

uint32_t ff_square_tab [512] = { 0, }
 

Detailed Description

DSP utils.

Definition in file dsputil.c.

Macro Definition Documentation

#define avg2 (   a,
  b 
)    ((a + b + 1) >> 1)

Definition at line 116 of file dsputil.c.

Referenced by pix_abs16_x2_c(), pix_abs16_y2_c(), pix_abs8_x2_c(), and pix_abs8_y2_c().

#define avg4 (   a,
  b,
  c,
 
)    ((a + b + c + d + 2) >> 2)

Definition at line 117 of file dsputil.c.

Referenced by pix_abs16_xy2_c(), and pix_abs8_xy2_c().

#define BUTTERFLY2 (   o1,
  o2,
  i1,
  i2 
)
Value:
o1 = (i1) + (i2); \
o2 = (i1) - (i2);

Definition at line 435 of file dsputil.c.

Referenced by hadamard8_diff8x8_c(), and hadamard8_intra8x8_c().

#define BUTTERFLY1 (   x,
  y 
)
Value:
{ \
int a, b; \
a = x; \
b = y; \
x = a + b; \
y = a - b; \
}

Definition at line 439 of file dsputil.c.

Referenced by hadamard8_diff8x8_c(), and hadamard8_intra8x8_c().

#define BUTTERFLYA (   x,
  y 
)    (FFABS((x) + (y)) + FFABS((x) - (y)))

Definition at line 448 of file dsputil.c.

Referenced by hadamard8_diff8x8_c(), and hadamard8_intra8x8_c().

#define VSAD_INTRA (   size)
Value:
static int vsad_intra ## size ## _c(MpegEncContext *c, \
int stride, int h) \
{ \
int score = 0, x, y; \
for (y = 1; y < h; y++) { \
for (x = 0; x < size; x += 4) { \
score += FFABS(s[x] - s[x + stride]) + \
FFABS(s[x + 1] - s[x + stride + 1]) + \
FFABS(s[x + 2] - s[x + 2 + stride]) + \
FFABS(s[x + 3] - s[x + 3 + stride]); \
} \
s += stride; \
} \
\
return score; \
}

Definition at line 800 of file dsputil.c.

#define VSAD (   size)
Value:
static int vsad ## size ## _c(MpegEncContext *c, \
int stride, int h) \
{ \
int score = 0, x, y; \
for (y = 1; y < h; y++) { \
for (x = 0; x < size; x++) \
score += FFABS(s1[x] - s2[x] - s1[x + stride] + s2[x + stride]); \
s1 += stride; \
s2 += stride; \
} \
\
return score; \
}

Definition at line 822 of file dsputil.c.

#define SQ (   a)    ((a) * (a))

Definition at line 841 of file dsputil.c.

#define VSSE_INTRA (   size)
Value:
static int vsse_intra ## size ## _c(MpegEncContext *c, \
int stride, int h) \
{ \
int score = 0, x, y; \
for (y = 1; y < h; y++) { \
for (x = 0; x < size; x += 4) { \
score += SQ(s[x] - s[x + stride]) + \
SQ(s[x + 1] - s[x + stride + 1]) + \
SQ(s[x + 2] - s[x + stride + 2]) + \
SQ(s[x + 3] - s[x + stride + 3]); \
} \
s += stride; \
} \
\
return score; \
}

Definition at line 842 of file dsputil.c.

#define VSSE (   size)
Value:
static int vsse ## size ## _c(MpegEncContext *c, uint8_t *s1, uint8_t *s2, \
int stride, int h) \
{ \
int score = 0, x, y; \
for (y = 1; y < h; y++) { \
for (x = 0; x < size; x++) \
score += SQ(s1[x] - s2[x] - s1[x + stride] + s2[x + stride]); \
s1 += stride; \
s2 += stride; \
} \
\
return score; \
}

Definition at line 864 of file dsputil.c.

#define WRAPPER8_16_SQ (   name8,
  name16 
)
Value:
static int name16(MpegEncContext *s, uint8_t *dst, uint8_t *src, \
int stride, int h) \
{ \
int score = 0; \
\
score += name8(s, dst, src, stride, 8); \
score += name8(s, dst + 8, src + 8, stride, 8); \
if (h == 16) { \
dst += 8 * stride; \
src += 8 * stride; \
score += name8(s, dst, src, stride, 8); \
score += name8(s, dst + 8, src + 8, stride, 8); \
} \
return score; \
}

Definition at line 882 of file dsputil.c.

#define SET_CMP_FUNC (   name)
Value:
c->name[0] = name ## 16_c; \
c->name[1] = name ## 8x8_c;

Referenced by ff_dsputil_init().

Function Documentation

static int sse4_c ( MpegEncContext v,
uint8_t pix1,
uint8_t pix2,
int  line_size,
int  h 
)
static

Definition at line 39 of file dsputil.c.

Referenced by ff_dsputil_init().

static int sse8_c ( MpegEncContext v,
uint8_t pix1,
uint8_t pix2,
int  line_size,
int  h 
)
static

Definition at line 56 of file dsputil.c.

Referenced by ff_dsputil_init().

static int sse16_c ( MpegEncContext v,
uint8_t pix1,
uint8_t pix2,
int  line_size,
int  h 
)
static

Definition at line 77 of file dsputil.c.

Referenced by ff_dsputil_init().

static int sum_abs_dctelem_c ( int16_t *  block)
static

Definition at line 107 of file dsputil.c.

Referenced by ff_dsputil_init().

static int pix_abs16_c ( MpegEncContext v,
uint8_t pix1,
uint8_t pix2,
int  line_size,
int  h 
)
inlinestatic

Definition at line 119 of file dsputil.c.

Referenced by ff_dsputil_init().

static int pix_abs16_x2_c ( MpegEncContext v,
uint8_t pix1,
uint8_t pix2,
int  line_size,
int  h 
)
static

Definition at line 147 of file dsputil.c.

Referenced by ff_dsputil_init().

static int pix_abs16_y2_c ( MpegEncContext v,
uint8_t pix1,
uint8_t pix2,
int  line_size,
int  h 
)
static

Definition at line 175 of file dsputil.c.

Referenced by ff_dsputil_init().

static int pix_abs16_xy2_c ( MpegEncContext v,
uint8_t pix1,
uint8_t pix2,
int  line_size,
int  h 
)
static

Definition at line 205 of file dsputil.c.

Referenced by ff_dsputil_init().

static int pix_abs8_c ( MpegEncContext v,
uint8_t pix1,
uint8_t pix2,
int  line_size,
int  h 
)
inlinestatic

Definition at line 235 of file dsputil.c.

Referenced by ff_dsputil_init().

static int pix_abs8_x2_c ( MpegEncContext v,
uint8_t pix1,
uint8_t pix2,
int  line_size,
int  h 
)
static

Definition at line 255 of file dsputil.c.

Referenced by ff_dsputil_init().

static int pix_abs8_y2_c ( MpegEncContext v,
uint8_t pix1,
uint8_t pix2,
int  line_size,
int  h 
)
static

Definition at line 275 of file dsputil.c.

Referenced by ff_dsputil_init().

static int pix_abs8_xy2_c ( MpegEncContext v,
uint8_t pix1,
uint8_t pix2,
int  line_size,
int  h 
)
static

Definition at line 297 of file dsputil.c.

Referenced by ff_dsputil_init().

static int nsse16_c ( MpegEncContext c,
uint8_t s1,
uint8_t s2,
int  stride,
int  h 
)
static

Definition at line 319 of file dsputil.c.

Referenced by ff_dsputil_init().

static int nsse8_c ( MpegEncContext c,
uint8_t s1,
uint8_t s2,
int  stride,
int  h 
)
static

Definition at line 343 of file dsputil.c.

Referenced by ff_dsputil_init().

static int zero_cmp ( MpegEncContext s,
uint8_t a,
uint8_t b,
int  stride,
int  h 
)
static

Definition at line 367 of file dsputil.c.

Referenced by ff_set_cmp().

void ff_set_cmp ( DSPContext c,
me_cmp_func cmp,
int  type 
)

Definition at line 373 of file dsputil.c.

Referenced by dvvideo_encode_init(), encode_init(), ff_init_me(), and ff_MPV_encode_init().

static int hadamard8_diff8x8_c ( MpegEncContext s,
uint8_t dst,
uint8_t src,
int  stride,
int  h 
)
static

Definition at line 450 of file dsputil.c.

static int hadamard8_intra8x8_c ( MpegEncContext s,
uint8_t src,
uint8_t dummy,
int  stride,
int  h 
)
static

Definition at line 502 of file dsputil.c.

Referenced by ff_dsputil_init().

static int dct_sad8x8_c ( MpegEncContext s,
uint8_t src1,
uint8_t src2,
int  stride,
int  h 
)
static

Definition at line 554 of file dsputil.c.

static int dct_max8x8_c ( MpegEncContext s,
uint8_t src1,
uint8_t src2,
int  stride,
int  h 
)
static

Definition at line 620 of file dsputil.c.

static int quant_psnr8x8_c ( MpegEncContext s,
uint8_t src1,
uint8_t src2,
int  stride,
int  h 
)
static

Definition at line 637 of file dsputil.c.

static int rd8x8_c ( MpegEncContext s,
uint8_t src1,
uint8_t src2,
int  stride,
int  h 
)
static

Definition at line 662 of file dsputil.c.

static int bit8x8_c ( MpegEncContext s,
uint8_t src1,
uint8_t src2,
int  stride,
int  h 
)
static

Definition at line 739 of file dsputil.c.

av_cold void ff_dsputil_static_init ( void  )

Definition at line 911 of file dsputil.c.

Referenced by avcodec_init().

int ff_check_alignment ( void  )

Definition at line 919 of file dsputil.c.

Referenced by encode_thread(), estimate_motion_thread(), ff_dsputil_init(), and mb_var_thread().

av_cold void ff_dsputil_init ( DSPContext c,
AVCodecContext avctx 
)
av_cold void dsputil_init ( DSPContext c,
AVCodecContext avctx 
)

Definition at line 1000 of file dsputil.c.

av_cold void avpriv_dsputil_init ( DSPContext c,
AVCodecContext avctx 
)

Definition at line 1005 of file dsputil.c.

Referenced by config_input(), config_props(), and init().

Variable Documentation

uint32_t ff_square_tab[512] = { 0, }

Definition at line 37 of file dsputil.c.

Referenced by ff_dsputil_static_init(), pix_norm1(), pix_norm1_c(), sse(), sse16_c(), sse4_c(), and sse8_c().