|
FFmpeg
|
#include <assert.h>#include <inttypes.h>#include <limits.h>#include <math.h>#include <stdarg.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <time.h>#include "checkasm_config.h"#include "checkasm/test.h"#include "checkasm/utils.h"#include "internal.h"Go to the source code of this file.
Data Structures | |
| struct | CheckasmRand |
| union | intfloat |
Macros | |
| #define | CHECKASM_PRNG_NUM 4 |
| #define | PRNG_CACHE_SIZE 64 |
| #define | DEF_CHECKASM_RAND(BITS, TYPE, NAME) |
| #define | RANDOMIZE_DIST(buf, ftype, width, mean, stddev) |
| #define | DEF_CHECKASM_INIT_MASK(BITS, PIXEL) |
| #define | PRINT_LINE(buf1, buf2, xstart, xend, xpad, fmt, fmtw) |
| #define | PRINT_RECT(type, buf1, buf2, ystart, yend, xstart, xend, fmt, fmtw) |
| #define | CHECK_RECT(buf1, buf2, ystart, yend, xstart, xend, msg, compare, type, fmt, fmtw) |
| #define | DEF_CHECKASM_CHECK_BODY(compare, type, fmt, fmtw) |
| #define | cmp_int(a, b, len) |
| #define | DEF_CHECKASM_CHECK_FUNC(type, fmt, fmtw) |
| #define | cmp_float(a, b, len) |
Enumerations | |
| enum | { PAT_ZERO , PAT_ONE , PAT_RAND , PAT_LOW , PAT_HIGH , PAT_ALTLO , PAT_ALTHI , PAT_MIX } |
Functions | |
| NOINLINE void | checkasm_noop (void *ptr) |
| static ALWAYS_INLINE uint64_t | gettime_nsec (int is_seed) |
| uint64_t | checkasm_gettime_nsec (void) |
| uint64_t | checkasm_gettime_nsec_diff (uint64_t t) |
| unsigned | checkasm_seed (void) |
| static ALWAYS_INLINE uint32_t | rotl (const uint32_t x, int k) |
| static ALWAYS_INLINE void | xoshiro128pp (CheckasmRand *restrict xs, uint32_t *restrict buf) |
| static void | prng (CheckasmRand *restrict xs, uint8_t *restrict buf, size_t size) |
| static uint64_t | splitmix64 (uint64_t *state) |
| void | checkasm_srand (unsigned seed) |
| int | checkasm_rand (void) |
| Generate a random non-negative integer. | |
| double | checkasm_randf (void) |
| Generate a random double-precision floating-point number. | |
| static double | marsaglia (double *z2) |
| double | checkasm_rand_norm (void) |
| Generate a random number from the standard normal distribution. | |
| double | checkasm_rand_dist (CheckasmDist dist) |
| Generate a normally distributed random number. | |
| void | checkasm_randomize (void *buf, size_t bytes) |
| Fill a buffer with uniformly chosen random bytes. | |
| void | checkasm_randomize_mask8 (uint8_t *buf, int width, uint8_t mask) |
| Fill a uint8_t buffer with random values chosen uniformly within a mask. | |
| void | checkasm_randomize_mask16 (uint16_t *buf, int width, uint16_t mask) |
| Fill a uint16_t buffer with random values chosen uniformly within a mask. | |
| void | checkasm_randomize_range (double *buf, int width, double range) |
| Fill a double buffer with random values chosen uniformly below a limit. | |
| void | checkasm_randomize_rangef (float *buf, int width, float range) |
| Fill a float buffer with random values chosen uniformly below a limit. | |
| void | checkasm_randomize_interval (double *buf, int width, double low, double high) |
| Fill a double buffer with random values chosen uniformly from an interval. | |
| void | checkasm_randomize_intervalf (float *buf, int width, float low, float high) |
| Fill a float buffer with random values chosen uniformly from an interval. | |
| void | checkasm_randomize_dist (double *buf, int width, CheckasmDist dist) |
| Fill a double buffer with normally distributed random values. | |
| void | checkasm_randomize_distf (float *buf, int width, CheckasmDist dist) |
| Fill a float buffer with normally distributed random values. | |
| void | checkasm_randomize_norm (double *buf, int width) |
| Fill a double buffer with values from a standard normal distribution. | |
| void | checkasm_randomize_normf (float *buf, int width) |
| Fill a float buffer with values from a standard normal distribution. | |
| void | checkasm_clear (void *buf, size_t bytes) |
| Clear a buffer to a pre-determined pattern (currently 0xAA) | |
| void | checkasm_clear8 (uint8_t *buf, int width, uint8_t val) |
| Fill a uint8_t buffer with a constant value. | |
| void | checkasm_clear16 (uint16_t *buf, int width, uint16_t val) |
| Fill a uint16_t buffer with a constant value. | |
| static int | clz (const unsigned int mask) |
| static int | shift_rand (int x) |
| void | checkasm_init (void *buf, size_t bytes) |
| Initialize a buffer with pathological test patterns. | |
| int | checkasm_vfprintf (FILE *const f, const int color, const char *const fmt, va_list arg) |
| void | checkasm_statusline (const char *status) |
| static COLD int | should_use_color (FILE *const f) |
| COLD void | checkasm_setup_fprintf (void) |
| static int | get_terminal_width (void) |
| void | checkasm_json (CheckasmJson *json, const char *key, const char *const fmt,...) |
| void | checkasm_json_str (CheckasmJson *json, const char *key, const char *str) |
| void | checkasm_json_push (CheckasmJson *json, const char *const key, const char type) |
| void | checkasm_json_pop (CheckasmJson *json, char type) |
| static int | is_negative (const intfloat u) |
| int | checkasm_float_near_ulp (const float a, const float b, const unsigned max_ulp) |
| Compare floats using ULP (Units in Last Place) tolerance. | |
| int | checkasm_float_near_ulp_array (const float *const a, const float *const b, const unsigned max_ulp, const int len) |
| Compare float arrays using ULP tolerance. | |
| int | checkasm_float_near_abs_eps (const float a, const float b, const float eps) |
| Compare floats using absolute epsilon tolerance. | |
| int | checkasm_float_near_abs_eps_array (const float *const a, const float *const b, const float eps, const int len) |
| Compare float arrays using absolute epsilon tolerance. | |
| int | checkasm_float_near_abs_eps_ulp (const float a, const float b, const float eps, const unsigned max_ulp) |
| Compare floats using both epsilon and ULP tolerances. | |
| int | checkasm_float_near_abs_eps_array_ulp (const float *const a, const float *const b, const float eps, const unsigned max_ulp, const int len) |
| Compare float arrays using both epsilon and ULP tolerances. | |
| int | checkasm_double_near_abs_eps (const double a, const double b, const double eps) |
| Compare doubles using absolute epsilon tolerance. | |
| int | checkasm_double_near_abs_eps_array (const double *const a, const double *const b, const double eps, const unsigned len) |
| Compare double arrays using absolute epsilon tolerance. | |
| static int | check_err (const char *const file, const int line, const char *const name, const int w, const int h, int *const err) |
| 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. | |
| char * | checkasm_vasprintf (const char *fmt, va_list arg) |
Variables | ||
| static CheckasmRand | checkasm_prng | |
| struct { | ||
| uint8_t buf8 [PRNG_CACHE_SIZE] | ||
| uint16_t buf16 [PRNG_CACHE_SIZE > > 1] | ||
| uint32_t buf32 [PRNG_CACHE_SIZE > > 2] | ||
| uint64_t buf64 [PRNG_CACHE_SIZE > > 3] | ||
| int num8 | ||
| int num16 | ||
| int num32 | ||
| int num64 | ||
| } | prng_cache | |
| static int | use_printf_color [2] | |
| static char | statusline [256] | |
| static int | statusline_visible | |
| #define CHECKASM_PRNG_NUM 4 |
Definition at line 124 of file utils.c.
Referenced by checkasm_srand(), prng(), and xoshiro128pp().
Definition at line 337 of file utils.c.
Referenced by checkasm_randomize_dist(), checkasm_randomize_distf(), checkasm_randomize_norm(), and checkasm_randomize_normf().
| #define PRINT_LINE | ( | buf1, | |
| buf2, | |||
| xstart, | |||
| xend, | |||
| xpad, | |||
| fmt, | |||
| fmtw ) |
| #define PRINT_RECT | ( | type, | |
| buf1, | |||
| buf2, | |||
| ystart, | |||
| yend, | |||
| xstart, | |||
| xend, | |||
| fmt, | |||
| fmtw ) |
Definition at line 799 of file utils.c.
Referenced by checkasm_check_impl_float_ulp().
| #define DEF_CHECKASM_CHECK_FUNC | ( | type, | |
| fmt, | |||
| fmtw ) |
Referenced by checkasm_check_impl_float_ulp().
| anonymous enum |
| NOINLINE void checkasm_noop | ( | void * | ptr | ) |
Definition at line 63 of file utils.c.
Referenced by checkasm_measure_nop_cycles(), checkasm_measure_perf_scale(), checkasm_perf_init_macos(), and checkasm_perf_validate_start_stop().
|
static |
Definition at line 68 of file utils.c.
Referenced by checkasm_gettime_nsec(), checkasm_gettime_nsec_diff(), and checkasm_seed().
| uint64_t checkasm_gettime_nsec | ( | void | ) |
Definition at line 107 of file utils.c.
Referenced by checkasm_measure_perf_scale(), checkasm_perf_init(), checkasm_perf_init_macos(), checkasm_perf_validate_start(), and checkasm_perf_validate_start_stop().
| uint64_t checkasm_gettime_nsec_diff | ( | uint64_t | t | ) |
Definition at line 112 of file utils.c.
Referenced by checkasm_measure_perf_scale(), checkasm_perf_init(), checkasm_perf_init_macos(), checkasm_perf_validate_start(), and checkasm_perf_validate_start_stop().
| unsigned checkasm_seed | ( | void | ) |
Definition at line 117 of file utils.c.
Referenced by checkasm_perf_init_macos(), and checkasm_run().
|
static |
Definition at line 133 of file utils.c.
Referenced by xoshiro128pp().
|
static |
|
static |
Definition at line 154 of file utils.c.
Referenced by checkasm_randomize(), checkasm_randomize_mask16(), checkasm_randomize_mask8(), dct_error(), idct248_error(), init_block(), main(), and main().
|
inlinestatic |
Definition at line 220 of file utils.c.
Referenced by checkasm_srand(), and splitmix64().
| void checkasm_srand | ( | unsigned | seed | ) |
Definition at line 229 of file utils.c.
Referenced by check_cpu_flag(), checkasm_check_key(), and run_all_tests().
Definition at line 260 of file utils.c.
Referenced by checkasm_rand_norm().
| double checkasm_rand_norm | ( | void | ) |
Generate a random number from the standard normal distribution.
Definition at line 274 of file utils.c.
Referenced by checkasm_rand_dist().
| double checkasm_rand_dist | ( | CheckasmDist | dist | ) |
|
inlinestatic |
Definition at line 407 of file utils.c.
Referenced by shift_rand().
| int checkasm_vfprintf | ( | FILE *const | f, |
| const int | color, | ||
| const char *const | fmt, | ||
| va_list | arg ) |
| void checkasm_statusline | ( | const char * | status | ) |
Definition at line 501 of file utils.c.
Referenced by print_summary(), and update_statusline().
|
static |
Definition at line 522 of file utils.c.
Referenced by checkasm_setup_fprintf().
| COLD void checkasm_setup_fprintf | ( | void | ) |
Definition at line 544 of file utils.c.
Referenced by checkasm_list_cpu_flags(), and checkasm_run().
| void checkasm_json | ( | CheckasmJson * | json, |
| const char * | key, | ||
| const char *const | fmt, | ||
| ... ) |
| void checkasm_json_str | ( | CheckasmJson * | json, |
| const char * | key, | ||
| const char * | str ) |
Definition at line 586 of file utils.c.
Referenced by checkasm_json(), cpu_info_json(), cpu_mask_json(), json_var(), print_bench_header(), and print_bench_iter().
| void checkasm_json_push | ( | CheckasmJson * | json, |
| const char *const | key, | ||
| const char | type ) |
Definition at line 611 of file utils.c.
Referenced by checkasm_json(), cpu_mask_json(), json_measurement(), json_var(), print_bench_header(), and print_bench_iter().
| void checkasm_json_pop | ( | CheckasmJson * | json, |
| char | type ) |
Definition at line 627 of file utils.c.
Referenced by checkasm_json(), cpu_mask_json(), json_measurement(), json_var(), print_bench_footer(), print_bench_header(), and print_bench_iter().
|
static |
Definition at line 646 of file utils.c.
Referenced by checkasm_float_near_ulp().
|
static |
| char * checkasm_vasprintf | ( | const char * | fmt, |
| va_list | arg ) |
Definition at line 853 of file utils.c.
Referenced by checkasm_set_func_variant().
|
static |
Definition at line 131 of file utils.c.
Referenced by checkasm_randomize(), checkasm_randomize_mask16(), checkasm_randomize_mask8(), and checkasm_srand().
| uint8_t buf8[PRNG_CACHE_SIZE] |
| uint16_t buf16[PRNG_CACHE_SIZE > > 1] |
Definition at line 180 of file utils.c.
Referenced by imc_decode_frame().
| uint32_t buf32[PRNG_CACHE_SIZE > > 2] |
Definition at line 181 of file utils.c.
Referenced by decode_frame().
| uint64_t buf64[PRNG_CACHE_SIZE > > 3] |
| int num64 |
Definition at line 186 of file utils.c.
Referenced by get_avg_xpsnr().
| struct { ... } prng_cache |
Referenced by checkasm_srand().
|
static |
Definition at line 468 of file utils.c.
Referenced by checkasm_setup_fprintf(), checkasm_statusline(), and checkasm_vfprintf().
|
static |
Definition at line 469 of file utils.c.
Referenced by checkasm_statusline(), and checkasm_vfprintf().
|
static |
Definition at line 470 of file utils.c.
Referenced by checkasm_statusline(), and checkasm_vfprintf().