FFmpeg  4.3
Macros | Functions | Variables
mathops.h File Reference
#include <stdint.h>
#include "libavutil/common.h"
#include "libavutil/reverse.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 av_const float ff_sqrf (float a)
 
static int8_t ff_u8_to_s8 (uint8_t a)
 
static av_always_inline uint32_t bitswap_32 (uint32_t x)
 

Variables

const uint32_t ff_inverse [257]
 
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]
 
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 54 of file mathops.h.

◆ MULL

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

Definition at line 58 of file mathops.h.

◆ MAC64

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

Definition at line 74 of file mathops.h.

◆ MLS64

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

Definition at line 78 of file mathops.h.

◆ MAC16

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

Definition at line 83 of file mathops.h.

◆ MUL16

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

Definition at line 88 of file mathops.h.

◆ MLS16

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

Definition at line 92 of file mathops.h.

◆ mid_pred

#define mid_pred   mid_pred

Definition at line 97 of file mathops.h.

◆ median4

#define median4   median4

Definition at line 116 of file mathops.h.

◆ COPY3_IF_LT

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

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

◆ NEG_SSR32

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

Definition at line 162 of file mathops.h.

◆ NEG_USR32

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

Definition at line 166 of file mathops.h.

◆ PACK_2U8

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

Definition at line 181 of file mathops.h.

◆ PACK_4U8

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

Definition at line 184 of file mathops.h.

◆ PACK_2U16

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

Definition at line 187 of file mathops.h.

◆ PACK_2S8

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

Definition at line 192 of file mathops.h.

◆ PACK_4S8

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

Definition at line 195 of file mathops.h.

◆ PACK_2S16

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

Definition at line 198 of file mathops.h.

◆ FASTDIV

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

Definition at line 202 of file mathops.h.

◆ ff_sqrt

#define ff_sqrt   ff_sqrt

Definition at line 206 of file mathops.h.

Function Documentation

◆ MULH()

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

Definition at line 62 of file mathops.h.

◆ UMULH()

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

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

◆ median4()

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

Definition at line 117 of file mathops.h.

◆ sign_extend()

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

◆ zero_extend()

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

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

◆ ff_sqrf()

static av_const float ff_sqrf ( float  a)
inlinestatic

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

Referenced by color_transform_delta().

◆ bitswap_32()

static av_always_inline uint32_t bitswap_32 ( uint32_t  x)
static

Definition at line 243 of file mathops.h.

Referenced by build_table(), and reverse().

Variable Documentation

◆ ff_inverse

const uint32_t ff_inverse[257]

Definition at line 27 of file mathtables.c.

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

◆ 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 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]

◆ ff_zigzag_scan

const uint8_t ff_zigzag_scan[16+1]
level
uint8_t level
Definition: svq3.c:209
b
#define b
Definition: input.c:41
x
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo x
Definition: fate.txt:150
mask
static const uint16_t mask[17]
Definition: lzw.c:38
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