FFmpeg
Loading...
Searching...
No Matches
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.
 
#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)
 
#define checkasm_check_impl2(type)
 
#define checkasm_check_impl(type)
 
#define checkasm_check1(type, ...)
 
#define checkasm_check2(type, ...)
 

Functions

CHECKASM_API void checkasm_set_signal_handler_state (int enabled)
 Enable or disable signal handling.
 
CHECKASM_API void checkasm_push_stack_guard (uintptr_t guard[2])
 Push stack guard values for corruption detection.
 
CHECKASM_API void checkasm_pop_stack_guard (void)
 
CHECKASM_API const CheckasmPerfcheckasm_get_perf (void)
 
CHECKASM_API int checkasm_bench_func (void)
 Check if current function should be benchmarked.
 
CHECKASM_API int checkasm_bench_runs (void)
 Get number of iterations for current benchmark run.
 
CHECKASM_API void checkasm_bench_update (int iterations, uint64_t cycles)
 Update benchmark statistics with timing results.
 
CHECKASM_API void checkasm_bench_finish (void)
 Finalize and store benchmark results.
 
static void checkasm_unused (void)
 Suppress unused variable warnings.
 
 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.
 

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 523 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 555 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 568 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 578 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)
#define CHECKASM_PERF_ASM()
Definition aarch64.h:61

Definition at line 587 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)
CHECKASM_API const CheckasmPerf * checkasm_get_perf(void)
Definition perf.c:54

Definition at line 622 of file test.h.

Referenced by checkasm_measure_nop_cycles().

◆ 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)
#define TYPE
Definition ffv1dec.c:90
uint8_t w
Definition llvidencdsp.c:39

Definition at line 494 of file utils.h.

◆ DECL_CHECKASM_CHECK_FUNC

#define DECL_CHECKASM_CHECK_FUNC ( type)
Value:
CHECKASM_API DECL_CHECK_FUNC(checkasm_check_impl_##type, type)
#define DECL_CHECK_FUNC(NAME, TYPE)
Definition utils.h:494
cl_device_type type
#define CHECKASM_API
Symbol visibility attribute for public API functions.
Definition attributes.h:90

Definition at line 500 of file utils.h.

◆ checkasm_check_impl2

#define checkasm_check_impl2 ( type)
Value:
checkasm_check_impl_##type

Definition at line 523 of file utils.h.

◆ checkasm_check_impl

#define checkasm_check_impl ( type)
Value:
#define checkasm_check_impl2(type)
Definition utils.h:523

Definition at line 524 of file utils.h.

◆ checkasm_check1

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

Definition at line 525 of file utils.h.

◆ checkasm_check2

#define checkasm_check2 ( type,
... )
Value:
checkasm_check1(type, __FILE__, __LINE__, __VA_ARGS__)
#define checkasm_check1(type,...)
Definition utils.h:525

Definition at line 526 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(), and checkasm_push_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()

CHECKASM_API const 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 466 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 471 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 489 of file checkasm.c.

◆ checkasm_bench_finish()

CHECKASM_API void checkasm_bench_finish ( void )

Finalize and store benchmark results.

Definition at line 503 of file checkasm.c.

◆ checkasm_unused()

static void checkasm_unused ( void )
inlinestatic

Suppress unused variable warnings.

Definition at line 656 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 843 of file utils.c.

Referenced by checkasm_check_impl_float_ulp().