FFmpeg
Macros | Functions | Variables
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)   ((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  FF_SIGNBIT(x)   ((x) >> CHAR_BIT * sizeof(x) - 1)
 
#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_log2_run [41]
 
const uint8_t  ff_sqrt_tab [256]
 
 
const uint8_t  ff_zigzag_direct [64]
 
const uint8_t  ff_zigzag_scan [16+1]
 

Macro Definition Documentation

MAX_NEG_CROP

#define MAX_NEG_CROP   1024

Definition at line 31 of file mathops.h.

MUL64

#define MUL64 (   a,
  b 
)    ((int64_t)(a) * (int64_t)(b))

Definition at line 53 of file mathops.h.

MULL

#define MULL (   a,
  b,
  s 
)    (MUL64(a, b) >> (s))

Definition at line 57 of file mathops.h.

MAC64

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

Definition at line 73 of file mathops.h.

MLS64

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

Definition at line 77 of file mathops.h.

MAC16

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

Definition at line 82 of file mathops.h.

MUL16

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

Definition at line 87 of file mathops.h.

MLS16

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

Definition at line 91 of file mathops.h.

mid_pred

#define mid_pred   mid_pred

Definition at line 96 of file mathops.h.

median4

#define median4   median4

Definition at line 115 of file mathops.h.

FF_SIGNBIT

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

Definition at line 128 of file mathops.h.

COPY3_IF_LT

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

Definition at line 156 of file mathops.h.

MASK_ABS

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

Definition at line 165 of file mathops.h.

NEG_SSR32

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

Definition at line 172 of file mathops.h.

NEG_USR32

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

Definition at line 176 of file mathops.h.

PACK_2U8

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

Definition at line 191 of file mathops.h.

PACK_4U8

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

Definition at line 194 of file mathops.h.

PACK_2U16

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

Definition at line 197 of file mathops.h.

PACK_2S8

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

Definition at line 202 of file mathops.h.

PACK_4S8

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

Definition at line 205 of file mathops.h.

PACK_2S16

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

Definition at line 208 of file mathops.h.

FASTDIV

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

Definition at line 212 of file mathops.h.

ff_sqrt

#define ff_sqrt   ff_sqrt

Definition at line 216 of file mathops.h.

Function Documentation

MULH()

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

Definition at line 61 of file mathops.h.

UMULH()

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

Definition at line 67 of file mathops.h.

Referenced by pRNG().

mid_pred()

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

Definition at line 97 of file mathops.h.

median4()

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

Definition at line 116 of file mathops.h.

sign_extend()

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

Definition at line 131 of file mathops.h.

Referenced by adpcm_decode_frame(), adpcm_ima_cunning_expand_nibble(), alac_linear_predictor(), ambisonics_config(), aptx_unpack_codeword(), aptxhd_unpack_codeword(), check_lpc(), check_lpc33(), cinaudio_decode_frame(), decode_0cpy(), decode_band_numwavs(), decode_block(), decode_channel_sf_idx(), decode_huff(), decode_inter(), decode_inter_block(), decode_intra_block(), decode_plane(), decode_qu_spectra(), decode_tones_amplitude(), decode_tones_frequency(), dpcm_decode_frame(), ff_adpcm_argo_expand_nibble(), ff_h263_decode_motion(), ff_h263_encode_motion(), flic_decode_frame_15_16BPP(), flic_decode_frame_1BPP(), flic_decode_frame_24BPP(), flic_decode_frame_8BPP(), fold(), generate_joint_tables(), get_sbits_long(), get_xbits_le(), libopus_decode_init(), lpc_prediction(), mix_presentation_obu(), mpc8_decode_frame(), mpeg_decode_motion(), on2avc_decode_pairs(), on2avc_decode_quads(), paf_audio_decode(), parameter_block_obu(), peek_signed_nz(), qoa_decode_frame(), read_coeffs_coarse(), read_coeffs_fine(), read_signed_nz(), scalable_channel_layout_config(), scale_coefs(), svq1_decode_motion_vector(), test_decorrelate_sf(), tscc2_decode_mb(), tta_decode_frame(), xa_decode(), and xan_wc3_decode_frame().

sign_extend64()

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

Definition at line 140 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 149 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 217 of file mathops.h.

ff_sqrf()

static av_const float ff_sqrf ( float  a )
inlinestatic

Definition at line 238 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 243 of file mathops.h.

Referenced by color_transform_delta().

Variable Documentation

ff_inverse

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().

ff_log2_run

const uint8_t ff_log2_run[41]

Definition at line 116 of file mathtables.c.

Referenced by decode_frame(), decode_line(), encode_line(), ls_decode_line(), ls_encode_line(), and ls_encode_run().

ff_sqrt_tab

const uint8_t ff_sqrt_tab[256]

Definition at line 63 of file mathtables.c.

Referenced by ff_sqrt().

ff_crop_tab

const uint8_t attribute_visibility_hidden ff_crop_tab[256+2 *MAX_NEG_CROP]

Definition at line 77 of file mathtables.c.

ff_zigzag_direct

const uint8_t ff_zigzag_direct[64]

Definition at line 98 of file mathtables.c.

Referenced by ac_uncompress(), add_coefficients(), calc_dequant(), compute_quant_matrix(), decode_block(), decode_block_intra(), decode_dct(), decode_gop_header(), decode_i_block(), decode_init(), decode_scaling_list(), decode_studio_vop_header(), decode_vol_header(), decode_vop_header(), dnxhd_decode_header(), dnxhd_init_qmat(), dv_init_enc_block(), dvvideo_decode_init(), encode_picture(), ff_cavs_init(), ff_dxva2_h264_fill_scaling_lists(), ff_dxva2_mpeg2_fill_quantization_matrices(), ff_mpv_idct_init(), ff_rtjpeg_init(), ff_vp56_init_context(), ff_write_quant_matrix(), fic_decode_block(), hq_decode_block(), init_idct(), init_scan_tables(), ipu_decode_frame(), jpg_init(), lead_decode_init(), load_matrix(), mpeg_decode_picture_coding_extension(), mss4_decode_dct(), read_quant_matrix_ext(), set_pps(), set_sps(), speedhq_decode_init(), tgq_decode_block(), tqi_decode_mb(), vaapi_mpeg2_start_frame(), vaapi_mpeg4_start_frame(), and vp3_decode_init().

ff_zigzag_scan

const uint8_t ff_zigzag_scan[16+1]

Definition at line 109 of file mathtables.c.

Referenced by decode_mb_coeffs(), decode_scaling_list(), ff_dxva2_h264_fill_scaling_lists(), init_scan_tables(), set_pps(), set_sps(), svq3_decode_block(), tscc2_decode_mb(), vp78_decode_init(), vp7_decode_frame_header(), and vp8_decode_block_coeffs_internal().

level
uint8_t level
Definition: svq3.c:205
mask
int mask
Definition: mediacodecdec_common.c:154
b
#define b
Definition: input.c:41
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
a
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
Definition: undefined.txt:41

Generated on Fri Aug 22 2025 13:59:49 for FFmpeg by   doxygen 1.8.17

AltStyle によって変換されたページ (->オリジナル) /