FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
mathops.h File Reference
#include <stdint.h>
#include "libavutil/common.h"
#include "config.h"

Go to the source code of this file.

Macros

#define MAX_NEG_CROP   1024
 
#define MUL64(a, b)   ((int64_t)(a) * (int64_t)(b))
 
#define MULL(a, b, s)   (MUL64(a, b) >> (s))
 
#define MAC64(d, a, b)   ((d) += MUL64(a, b))
 
#define MLS64(d, a, b)   ((d) -= MUL64(a, b))
 
#define MAC16(rt, ra, rb)   rt += (ra) * (rb)
 
#define MUL16(ra, rb)   ((ra) * (rb))
 
#define MLS16(rt, ra, rb)   ((rt) -= (ra) * (rb))
 
#define mid_pred   mid_pred
 
#define median4   median4
 
#define COPY3_IF_LT(x, y, a, b, c, d)
 
#define MASK_ABS(mask, level)
 
#define NEG_SSR32(a, s)   ((( int32_t)(a))>>(32-(s)))
 
#define NEG_USR32(a, s)   (((uint32_t)(a))>>(32-(s)))
 
#define PACK_2U8(a, b)   (((b) << 8) | (a))
 
#define PACK_4U8(a, b, c, d)   (((d) << 24) | ((c) << 16) | ((b) << 8) | (a))
 
#define PACK_2U16(a, b)   (((b) << 16) | (a))
 
#define PACK_2S8(a, b)   PACK_2U8((a)&255, (b)&255)
 
#define PACK_4S8(a, b, c, d)   PACK_4U8((a)&255, (b)&255, (c)&255, (d)&255)
 
#define PACK_2S16(a, b)   PACK_2U16((a)&0xffff, (b)&0xffff)
 
#define FASTDIV(a, b)   ((uint32_t)((((uint64_t)a) * ff_inverse[b]) >> 32))
 
#define ff_sqrt   ff_sqrt
 

Functions

static av_always_inline int MULH (int a, int b)
 
static av_always_inline unsigned UMULH (unsigned a, unsigned b)
 
static av_const int mid_pred (int a, int b, int c)
 
static av_const int median4 (int a, int b, int c, int d)
 
static av_const int sign_extend (int val, unsigned bits)
 
static av_const unsigned zero_extend (unsigned val, unsigned bits)
 
static av_const unsigned int ff_sqrt (unsigned int a)
 
static int8_t ff_u8_to_s8 (uint8_t a)
 

Variables

const uint32_t ff_inverse [257]
 
const uint8_t ff_reverse [256]
 
const uint8_t ff_sqrt_tab [256]
 
const uint8_t ff_crop_tab [256+2 *MAX_NEG_CROP]
 
const uint8_t ff_zigzag_direct [64]
 

Macro Definition Documentation

#define MAX_NEG_CROP   1024
#define MUL64 (   a,
  b 
)    ((int64_t)(a) * (int64_t)(b))
#define MULL (   a,
  b,
  s 
)    (MUL64(a, b) >> (s))

Definition at line 57 of file mathops.h.

Referenced by long_term_filter(), lsp2poly(), and silk_is_lpc_stable().

#define MAC64 (   d,
  a,
  b 
)    ((d) += MUL64(a, b))

Definition at line 73 of file mathops.h.

Referenced by ac3_sum_square_butterfly_int32_c().

#define MLS64 (   d,
  a,
  b 
)    ((d) -= MUL64(a, b))

Definition at line 77 of file mathops.h.

#define MAC16 (   rt,
  ra,
  rb 
)    rt += (ra) * (rb)

Definition at line 82 of file mathops.h.

Referenced by g722_apply_qmf().

#define MUL16 (   ra,
  rb 
)    ((ra) * (rb))

Definition at line 87 of file mathops.h.

#define MLS16 (   rt,
  ra,
  rb 
)    ((rt) -= (ra) * (rb))

Definition at line 91 of file mathops.h.

#define mid_pred   mid_pred
#define median4   median4

Definition at line 125 of file mathops.h.

Referenced by get_chroma_mv(), and get_luma_mv().

#define COPY3_IF_LT (   x,
  y,
  a,
  b,
  c,
 
)
Value:
if ((y) < (x)) {\
(x) = (y);\
(a) = (b);\
(c) = (d);\
}

Definition at line 155 of file mathops.h.

#define MASK_ABS (   mask,
  level 
)
Value:
do { \
mask = level >> 31; \
level = (level ^ mask) - mask; \
} while (0)

Definition at line 164 of file mathops.h.

Referenced by dnxhd_init_vlc(), and mpeg1_encode_block().

#define NEG_SSR32 (   a,
  s 
)    ((( int32_t)(a))>>(32-(s)))

Definition at line 171 of file mathops.h.

#define NEG_USR32 (   a,
  s 
)    (((uint32_t)(a))>>(32-(s)))
#define PACK_2U8 (   a,
  b 
)    (((b) << 8) | (a))

Definition at line 190 of file mathops.h.

#define PACK_4U8 (   a,
  b,
  c,
 
)    (((d) << 24) | ((c) << 16) | ((b) << 8) | (a))

Definition at line 193 of file mathops.h.

Referenced by pred4x4_vertical_vp8_c().

#define PACK_2U16 (   a,
  b 
)    (((b) << 16) | (a))

Definition at line 196 of file mathops.h.

#define PACK_2S8 (   a,
  b 
)    PACK_2U8((a)&255, (b)&255)

Definition at line 201 of file mathops.h.

#define PACK_4S8 (   a,
  b,
  c,
 
)    PACK_4U8((a)&255, (b)&255, (c)&255, (d)&255)

Definition at line 204 of file mathops.h.

#define PACK_2S16 (   a,
  b 
)    PACK_2U16((a)&0xffff, (b)&0xffff)

Definition at line 207 of file mathops.h.

#define FASTDIV (   a,
  b 
)    ((uint32_t)((((uint64_t)a) * ff_inverse[b]) >> 32))
#define ff_sqrt   ff_sqrt

Function Documentation

static av_always_inline int MULH ( int  a,
int  b 
)
static

Definition at line 61 of file mathops.h.

static av_always_inline unsigned UMULH ( unsigned  a,
unsigned  b 
)
static

Definition at line 67 of file mathops.h.

Referenced by pRNG().

static av_const int mid_pred ( int  a,
int  b,
int  c 
)
inlinestatic

Definition at line 97 of file mathops.h.

static av_const int median4 ( int  a,
int  b,
int  c,
int  d 
)
inlinestatic

Definition at line 126 of file mathops.h.

static av_const int sign_extend ( int  val,
unsigned  bits 
)
inlinestatic
static av_const unsigned zero_extend ( unsigned  val,
unsigned  bits 
)
inlinestatic

Definition at line 148 of file mathops.h.

static av_const unsigned int ff_sqrt ( unsigned int  a)
inlinestatic

Definition at line 216 of file mathops.h.

static int8_t ff_u8_to_s8 ( uint8_t  a)
inlinestatic

Definition at line 237 of file mathops.h.

Referenced by color_transform_delta().

Variable Documentation

const uint32_t ff_inverse[257]

Definition at line 27 of file mathtables.c.

Referenced by dct_quantize_TMPL(), ff_msmpeg4_pred_dc(), and setup_classifs().

const uint8_t ff_reverse[256]
const uint8_t ff_sqrt_tab[256]

Definition at line 63 of file mathtables.c.

Referenced by ff_sqrt().

const uint8_t ff_crop_tab[256+2 *MAX_NEG_CROP]

Definition at line 96 of file mathtables.c.

const uint8_t ff_zigzag_direct[64]