FFmpeg
Data Structures | Macros | Functions
Internal Implementation Details

Internal functions and structures not part of the public API. More...

Data Structures

struct  CheckasmPerf
 

Macros

#define checkasm_clear_cpu_state()
 Clear CPU state after running a function. More...
 
#define CHECKASM_PERF_CALL4(...)
 
#define CHECKASM_PERF_CALL16(...)
 
#define CHECKASM_PERF_BENCH_SIMPLE(count, time, ...)
 
#define CHECKASM_PERF_BENCH_ASM(total_count, time, ...)
 
#define CHECKASM_PERF_BENCH(count, time, ...)
 
#define DECL_CHECK_FUNC(NAME, TYPE)
 
#define DECL_CHECKASM_CHECK_FUNC(type)   CHECKASM_API DECL_CHECK_FUNC(checkasm_check_impl_##type, type)
 
#define checkasm_check_impl2(type)   checkasm_check_impl_##type
 
#define checkasm_check_impl(type)   checkasm_check_impl2(type)
 
#define checkasm_check1(type, ...)   checkasm_check_impl_##type(__VA_ARGS__)
 
#define checkasm_check2(type, ...)   checkasm_check1(type, __FILE__, __LINE__, __VA_ARGS__)
 

Functions

CHECKASM_API void checkasm_set_signal_handler_state (int enabled)
 Enable or disable signal handling. More...
 
CHECKASM_API void checkasm_push_stack_guard (uintptr_t guard[2])
 Push stack guard values for corruption detection. More...
 
CHECKASM_API void checkasm_pop_stack_guard (void)
 
const CHECKASM_API CheckasmPerfcheckasm_get_perf (void)
 
CHECKASM_API int checkasm_bench_func (void)
 Check if current function should be benchmarked. More...
 
CHECKASM_API int checkasm_bench_runs (void)
 Get number of iterations for current benchmark run. More...
 
CHECKASM_API void checkasm_bench_update (int iterations, uint64_t cycles)
 Update benchmark statistics with timing results. More...
 
CHECKASM_API void checkasm_bench_finish (void)
 Finalize and store benchmark results. More...
 
static void checkasm_unused (void)
 Suppress unused variable warnings. More...
 
 DECL_CHECKASM_CHECK_FUNC (int)
 
 DECL_CHECKASM_CHECK_FUNC (int8_t)
 
 DECL_CHECKASM_CHECK_FUNC (int16_t)
 
 DECL_CHECKASM_CHECK_FUNC (int32_t)
 
 DECL_CHECKASM_CHECK_FUNC (unsigned)
 
 DECL_CHECKASM_CHECK_FUNC (uint8_t)
 
 DECL_CHECKASM_CHECK_FUNC (uint16_t)
 
 DECL_CHECKASM_CHECK_FUNC (uint32_t)
 
CHECKASM_API int checkasm_check_impl_float_ulp (const char *file, int line, const float *buf1, ptrdiff_t stride1, const float *buf2, ptrdiff_t stride2, int w, int h, const char *name, unsigned max_ulp, int align_w, int align_h, int padding)
 Compare float buffers with ULP tolerance. More...
 

Detailed Description

Internal functions and structures not part of the public API.

These functions and types are used internally by checkasm macros and should not be called or referenced directly by test code.

Macro Definition Documentation

◆ checkasm_clear_cpu_state

#define checkasm_clear_cpu_state ( )
Value:
do { \
} while (0)

Clear CPU state after running a function.

Clears any processor state that might be left over after running a function. On x86, this typically includes running EMMS to clear MMX state.

Definition at line 522 of file test.h.

◆ CHECKASM_PERF_CALL4

#define CHECKASM_PERF_CALL4 (   ...)
Value:
do { \
int tidx = 0; \
bench_func(__VA_ARGS__); \
tidx = 1; \
bench_func(__VA_ARGS__); \
tidx = 2; \
bench_func(__VA_ARGS__); \
tidx = 3; \
bench_func(__VA_ARGS__); \
(void) tidx; \
} while (0)

Definition at line 554 of file test.h.

◆ CHECKASM_PERF_CALL16

#define CHECKASM_PERF_CALL16 (   ...)
Value:
do { \
CHECKASM_PERF_CALL4(__VA_ARGS__); \
CHECKASM_PERF_CALL4(__VA_ARGS__); \
CHECKASM_PERF_CALL4(__VA_ARGS__); \
CHECKASM_PERF_CALL4(__VA_ARGS__); \
} while (0)

Definition at line 567 of file test.h.

◆ CHECKASM_PERF_BENCH_SIMPLE

#define CHECKASM_PERF_BENCH_SIMPLE (   count,
  time,
  ... 
)
Value:
do { \
time = perf.start(); \
for (int tidx = 0; tidx < count; tidx++) \
bench_func(__VA_ARGS__); \
time = perf.stop(time); \
} while (0)

Definition at line 577 of file test.h.

◆ CHECKASM_PERF_BENCH_ASM

#define CHECKASM_PERF_BENCH_ASM (   total_count,
  time,
  ... 
)
Value:
do { \
int tcount_trim = 0; \
uint64_t tsum_trim = 0; \
for (int titer = 0; titer < total_count; titer += 32) { \
uint64_t t = CHECKASM_PERF_ASM(); \
CHECKASM_PERF_CALL16(__VA_ARGS__); \
CHECKASM_PERF_CALL16(__VA_ARGS__); \
t = CHECKASM_PERF_ASM() - t; \
if (t * tcount_trim <= tsum_trim * 4 && (titer > 0 || total_count < 1000)) { \
tsum_trim += t; \
tcount_trim++; \
} \
} \
time = tsum_trim; \
total_count = tcount_trim << 5; \
} while (0)

Definition at line 586 of file test.h.

◆ CHECKASM_PERF_BENCH

#define CHECKASM_PERF_BENCH (   count,
  time,
  ... 
)
Value:
do { \
const CheckasmPerf perf = *checkasm_get_perf(); \
CHECKASM_PERF_BENCH_SIMPLE(count, time, __VA_ARGS__); \
} while (0)

Definition at line 621 of file test.h.

◆ DECL_CHECK_FUNC

#define DECL_CHECK_FUNC (   NAME,
  TYPE 
)
Value:
int (NAME)(const char *const file, const int line, const TYPE *const buf1, \
const ptrdiff_t stride1, const TYPE *const buf2, const ptrdiff_t stride2, \
const int w, const int h, const char *const buf_name, const int align_w, \
const int align_h, const int padding)

Definition at line 416 of file utils.h.

◆ DECL_CHECKASM_CHECK_FUNC

#define DECL_CHECKASM_CHECK_FUNC (   type)    CHECKASM_API DECL_CHECK_FUNC(checkasm_check_impl_##type, type)

Definition at line 422 of file utils.h.

◆ checkasm_check_impl2

#define checkasm_check_impl2 (   type)    checkasm_check_impl_##type

Definition at line 445 of file utils.h.

◆ checkasm_check_impl

#define checkasm_check_impl (   type)    checkasm_check_impl2(type)

Definition at line 446 of file utils.h.

◆ checkasm_check1

#define checkasm_check1 (   type,
  ... 
)    checkasm_check_impl_##type(__VA_ARGS__)

Definition at line 447 of file utils.h.

◆ checkasm_check2

#define checkasm_check2 (   type,
  ... 
)    checkasm_check1(type, __FILE__, __LINE__, __VA_ARGS__)

Definition at line 448 of file utils.h.

Function Documentation

◆ checkasm_set_signal_handler_state()

CHECKASM_API void checkasm_set_signal_handler_state ( int  enabled)

Enable or disable signal handling.

Parameters
[in]enabledNon-zero to enable signal handling, 0 to disable

Definition at line 52 of file signal.c.

Referenced by checkasm_perf_init().

◆ checkasm_push_stack_guard()

CHECKASM_API void checkasm_push_stack_guard ( uintptr_t  guard[2])

Push stack guard values for corruption detection.

Parameters
[in]guardArray of guard values to push

Definition at line 41 of file stackguard.c.

Referenced by checkasm_pop_stack_guard().

◆ checkasm_pop_stack_guard()

CHECKASM_API void checkasm_pop_stack_guard ( void  )

Definition at line 66 of file stackguard.c.

◆ checkasm_get_perf()

const CHECKASM_API CheckasmPerf* checkasm_get_perf ( void  )

Definition at line 54 of file perf.c.

◆ checkasm_bench_func()

CHECKASM_API int checkasm_bench_func ( void  )

Check if current function should be benchmarked.

Returns
Non-zero if benchmarking is enabled for the current function

Definition at line 449 of file checkasm.c.

◆ checkasm_bench_runs()

CHECKASM_API int checkasm_bench_runs ( void  )

Get number of iterations for current benchmark run.

Returns
Number of iterations to run, or 0 if benchmarking is complete

Definition at line 454 of file checkasm.c.

◆ checkasm_bench_update()

CHECKASM_API void checkasm_bench_update ( int  iterations,
uint64_t  cycles 
)

Update benchmark statistics with timing results.

Parameters
[in]iterationsNumber of iterations that were run
[in]cyclesSum of elapsed time/cycles for those iterations

Definition at line 472 of file checkasm.c.

◆ checkasm_bench_finish()

CHECKASM_API void checkasm_bench_finish ( void  )

Finalize and store benchmark results.

Definition at line 486 of file checkasm.c.

◆ checkasm_unused()

static void checkasm_unused ( void  )
inlinestatic

Suppress unused variable warnings.

Definition at line 655 of file test.h.

◆ DECL_CHECKASM_CHECK_FUNC() [1/8]

DECL_CHECKASM_CHECK_FUNC ( int  )

◆ DECL_CHECKASM_CHECK_FUNC() [2/8]

DECL_CHECKASM_CHECK_FUNC ( int8_t  )

◆ DECL_CHECKASM_CHECK_FUNC() [3/8]

DECL_CHECKASM_CHECK_FUNC ( int16_t  )

◆ DECL_CHECKASM_CHECK_FUNC() [4/8]

DECL_CHECKASM_CHECK_FUNC ( int32_t  )

◆ DECL_CHECKASM_CHECK_FUNC() [5/8]

DECL_CHECKASM_CHECK_FUNC ( unsigned  )

◆ DECL_CHECKASM_CHECK_FUNC() [6/8]

DECL_CHECKASM_CHECK_FUNC ( uint8_t  )

◆ DECL_CHECKASM_CHECK_FUNC() [7/8]

DECL_CHECKASM_CHECK_FUNC ( uint16_t  )

◆ DECL_CHECKASM_CHECK_FUNC() [8/8]

DECL_CHECKASM_CHECK_FUNC ( uint32_t  )

◆ checkasm_check_impl_float_ulp()

CHECKASM_API int checkasm_check_impl_float_ulp ( const char *  file,
int  line,
const float buf1,
ptrdiff_t  stride1,
const float buf2,
ptrdiff_t  stride2,
int  w,
int  h,
const char *  name,
unsigned  max_ulp,
int  align_w,
int  align_h,
int  padding 
)

Compare float buffers with ULP tolerance.

Definition at line 701 of file utils.c.

CheckasmPerf
Definition: test.h:527
TYPE
#define TYPE
Definition: ffv1dec.c:96
checkasm_get_perf
const CHECKASM_API CheckasmPerf * checkasm_get_perf(void)
Definition: perf.c:54
w
uint8_t w
Definition: llvidencdsp.c:39
CHECKASM_PERF_ASM
#define CHECKASM_PERF_ASM()
Definition: aarch64.h:61
h
h
Definition: vp9dsp_template.c:2070
line
The official guide to swscale for confused that consecutive non overlapping rectangles of slice_bottom special converter These generally are unscaled converters of common like for each output line the vertical scaler pulls lines from a ring buffer When the ring buffer does not contain the wanted line
Definition: swscale.txt:40