FFmpeg
Loading...
Searching...
No Matches
mathops.h File Reference
#include <stdint.h>
#include "libavutil/attributes_internal.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)
 
#define MULL(a, b, s)
 
#define MAC64(d, a, b)
 
#define MLS64(d, a, b)
 
#define MAC16(rt, ra, rb)
 
#define MUL16(ra, rb)
 
#define MLS16(rt, ra, rb)
 
#define mid_pred   median3_c
 
#define median4   median4
 
#define FF_SIGNBIT(x)
 
#define COPY3_IF_LT(x, y, a, b, c, d)
 
#define MASK_ABS(mask, level)
 
#define NEG_SSR32(a, s)
 
#define NEG_USR32(a, s)
 
#define PACK_2U8(a, b)
 
#define PACK_4U8(a, b, c, d)
 
#define PACK_2U16(a, b)
 
#define PACK_2S8(a, b)
 
#define PACK_4S8(a, b, c, d)
 
#define PACK_2S16(a, b)
 
#define FASTDIV(a, b)
 
#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 median3_c (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 int64_t sign_extend64 (int64_t val, unsigned bits)
 
static av_const unsigned zero_extend (unsigned val, unsigned bits)
 
static av_const unsigned int ff_sqrt (unsigned int a)
 
static av_const float ff_sqrf (float a)
 
static int8_t ff_u8_to_s8 (uint8_t a)
 

Variables

const uint32_t ff_inverse [257]
 
const uint8_t ff_log2_run [41]
 
EXTERN const uint32_t ff_square_tab [512]
 
const uint8_t ff_sqrt_tab [256]
 
EXTERN const uint8_t ff_crop_tab [256+2 *MAX_NEG_CROP]
 
const uint8_t ff_zigzag_direct [64]
 
const uint8_t ff_zigzag_scan [16+1]
 

Macro Definition Documentation

◆ MAX_NEG_CROP

◆ MUL64

◆ MULL

#define MULL ( a,
b,
s )
Value:
(MUL64(a, b) >> (s))
#define s(width, name)
Definition cbs_vp9.c:198
#define MUL64(a, b)
Definition mathops.h:56

Definition at line 60 of file mathops.h.

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

◆ MAC64

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

Definition at line 76 of file mathops.h.

Referenced by ac3_sum_square_butterfly_int32_c().

◆ MLS64

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

Definition at line 80 of file mathops.h.

◆ MAC16

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

Definition at line 85 of file mathops.h.

Referenced by g722_apply_qmf().

◆ MUL16

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

Definition at line 90 of file mathops.h.

Referenced by celt_cos(), ff_dot_product(), g722_apply_qmf(), pRNG(), and synth_frame().

◆ MLS16

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

Definition at line 94 of file mathops.h.

◆ mid_pred

◆ median4

#define median4   median4

Definition at line 119 of file mathops.h.

Referenced by get_chroma_mv(), and get_luma_mv().

◆ FF_SIGNBIT

#define FF_SIGNBIT ( x)
Value:
((x) >> CHAR_BIT * sizeof(x) - 1)

Definition at line 132 of file mathops.h.

Referenced by aptx_prediction_filtering(), dnxhd_10bit_dct_quantize(), inter_predict(), mv_pred_direct(), and scale_mv().

◆ COPY3_IF_LT

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

Definition at line 160 of file mathops.h.

◆ MASK_ABS

#define MASK_ABS ( mask,
level )
Value:
do { \
mask = level >> 31; \
level = (level ^ mask) - mask; \
} while (0)
static const uint16_t mask[17]
Definition lzw.c:38
uint8_t level
Definition svq3.c:208

Definition at line 169 of file mathops.h.

Referenced by dnxhd_init_vlc(), and encode_block().

◆ NEG_SSR32

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

Definition at line 176 of file mathops.h.

◆ NEG_USR32

#define NEG_USR32 ( a,
s )
Value:
(((uint32_t)(a))>>(32-(s)))

Definition at line 180 of file mathops.h.

Referenced by decode_block(), decode_block_progressive(), dnxhd_decode_dct_block(), dv_decode_ac(), and get_xbits().

◆ PACK_2U8

#define PACK_2U8 ( a,
b )
Value:
(((b) << 8) | (a))

Definition at line 195 of file mathops.h.

◆ PACK_4U8

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

Definition at line 198 of file mathops.h.

Referenced by pred4x4_vertical_vp8_c().

◆ PACK_2U16

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

Definition at line 201 of file mathops.h.

◆ PACK_2S8

#define PACK_2S8 ( a,
b )
Value:
PACK_2U8((a)&255, (b)&255)
#define PACK_2U8(a, b)
Definition mathops.h:195

Definition at line 206 of file mathops.h.

◆ PACK_4S8

#define PACK_4S8 ( a,
b,
c,
d )
Value:
PACK_4U8((a)&255, (b)&255, (c)&255, (d)&255)
#define PACK_4U8(a, b, c, d)
Definition mathops.h:198

Definition at line 209 of file mathops.h.

◆ PACK_2S16

#define PACK_2S16 ( a,
b )
Value:
PACK_2U16((a)&0xffff, (b)&0xffff)
#define PACK_2U16(a, b)
Definition mathops.h:201

Definition at line 212 of file mathops.h.

◆ FASTDIV

#define FASTDIV ( a,
b )
Value:
((uint32_t)((((uint64_t)a) * ff_inverse[b]) >> 32))
const uint32_t ff_inverse[257]
Definition mathtables.c:66

Definition at line 216 of file mathops.h.

Referenced by adapt_prob(), decode_blockcodes(), ff_msmpeg4_pred_dc(), ff_sqrt(), get_dc(), mpeg4_decode_block(), mpeg4_encode_mb(), mpeg4_get_level_dc(), unpack_bitstream(), and vorbis_residue_decode_internal().

◆ ff_sqrt

Function Documentation

◆ MULH()

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

Definition at line 64 of file mathops.h.

◆ UMULH()

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

Definition at line 70 of file mathops.h.

Referenced by pRNG().

◆ median3_c()

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

Definition at line 98 of file mathops.h.

◆ median4()

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

Definition at line 120 of file mathops.h.

◆ sign_extend()

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

◆ sign_extend64()

static av_const int64_t sign_extend64 ( int64_t val,
unsigned bits )
inlinestatic

Definition at line 144 of file mathops.h.

Referenced by check_lpc33(), and get_sbits64().

◆ zero_extend()

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

Definition at line 153 of file mathops.h.

Referenced by get_xbits_le().

◆ ff_sqrt()

static av_const unsigned int ff_sqrt ( unsigned int a)
inlinestatic

Definition at line 221 of file mathops.h.

◆ ff_sqrf()

static av_const float ff_sqrf ( float a)
inlinestatic

Definition at line 242 of file mathops.h.

Referenced by search_for_quantizers_twoloop().

◆ ff_u8_to_s8()

static int8_t ff_u8_to_s8 ( uint8_t a)
inlinestatic

Definition at line 247 of file mathops.h.

Referenced by color_transform_delta().

Variable Documentation

◆ ff_inverse

const uint32_t ff_inverse[257]
extern

Definition at line 66 of file mathtables.c.

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

◆ ff_log2_run

const uint8_t ff_log2_run[41]
extern

◆ ff_square_tab

EXTERN const uint32_t ff_square_tab[512]

Definition at line 35 of file mathops.h.

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

◆ ff_sqrt_tab

const uint8_t ff_sqrt_tab[256]
extern

Definition at line 102 of file mathtables.c.

Referenced by ff_sqrt().

◆ ff_crop_tab

EXTERN const uint8_t ff_crop_tab[256+2 *MAX_NEG_CROP]

Definition at line 37 of file mathops.h.

◆ ff_zigzag_direct

◆ ff_zigzag_scan