FFmpeg
Data Structures | Macros | Functions | Variables
checkasm.c File Reference
#include "config.h"
#include "config_components.h"
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "checkasm.h"
#include "libavutil/common.h"
#include "libavutil/cpu.h"
#include "libavutil/intfloat.h"
#include "libavutil/random_seed.h"

Go to the source code of this file.

Data Structures

struct  CheckasmFuncVersion
 
struct  CheckasmFunc
 

Macros

#define _GNU_SOURCE
 
#define COLOR_RED   1
 
#define COLOR_GREEN   2
 
#define COLOR_YELLOW   3
 
#define isatty(fd)   1
 
#define is_red(f)   ((f) && !(f)->color)
 
#define DEF_CHECKASM_CHECK_FUNC(type, fmt)
 

Functions

static int is_negative (union av_intfloat32 u)
 
int float_near_ulp (float a, float b, unsigned max_ulp)
 
int float_near_ulp_array (const float *a, const float *b, unsigned max_ulp, unsigned len)
 
int float_near_abs_eps (float a, float b, float eps)
 
int float_near_abs_eps_array (const float *a, const float *b, float eps, unsigned len)
 
int float_near_abs_eps_ulp (float a, float b, float eps, unsigned max_ulp)
 
int float_near_abs_eps_array_ulp (const float *a, const float *b, float eps, unsigned max_ulp, unsigned len)
 
int double_near_abs_eps (double a, double b, double eps)
 
int double_near_abs_eps_array (const double *a, const double *b, double eps, unsigned len)
 
static void color_printf (int color, const char *fmt,...)
 
static void destroy_func_tree (CheckasmFunc *f)
 
static void * checkasm_malloc (size_t size)
 
static const char * cpu_suffix (int cpu)
 
static int cmp_nop (const void *a, const void *b)
 
static int measure_nop_time (void)
 
static double avg_cycles_per_call (const CheckasmPerf *const p)
 
static void print_benchs (CheckasmFunc *f)
 
static int cmp_func_names (const char *a, const char *b)
 
static CheckasmFuncrotate_tree (CheckasmFunc *f, int dir)
 
static void balance_tree (CheckasmFunc **root)
 
static CheckasmFuncget_func (CheckasmFunc **root, const char *name)
 
static void signal_handler (int s)
 
static int wildstrcmp (const char *str, const char *pattern)
 
static void check_cpu_flag (const char *name, int flag)
 
static void print_cpu_name (void)
 
static int bench_init_ffmpeg (void)
 
static int bench_init (void)
 
static void bench_uninit (void)
 
static int usage (const char *path)
 
int main (int argc, char *argv[])
 
void * checkasm_check_func (void *func, const char *name,...)
 
int checkasm_bench_func (void)
 
void checkasm_fail_func (const char *msg,...)
 
void checkasm_set_signal_handler_state (int enabled)
 
int checkasm_handle_signal (int s)
 
CheckasmPerfcheckasm_get_perf_context (void)
 
void checkasm_report (const char *name,...)
 

Variables

uint64_t bench_runs = 1U << 10
 
struct {
   const char *   name
 
   void(*   func )(void)
 
tests []
 
struct {
   const char *   name
 
   const char *   suffix
 
   int   flag
 
cpus []
 
struct {
   CheckasmFunc *   funcs
 
   CheckasmFunc *   current_func
 
   CheckasmFuncVersion *   current_func_ver
 
   const char *   current_test_name
 
   const char *   bench_pattern
 
   int   bench_pattern_len
 
   int   num_checked
 
   int   num_failed
 
   int   nop_time
 
   int   sysfd
 
   int   cpu_flag
 
   const char *   cpu_flag_name
 
   const char *   test_pattern
 
   int   verbose
 
   int   csv
 
   int   tsv
 
   volatile sig_atomic_t   catch_signals
 
state
 
AVLFG checkasm_lfg
 
checkasm_context checkasm_context_buf
 
static const struct sigaction signal_handler_act
 

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE

Definition at line 52 of file checkasm.c.

◆ COLOR_RED

#define COLOR_RED   1

Definition at line 84 of file checkasm.c.

◆ COLOR_GREEN

#define COLOR_GREEN   2

Definition at line 85 of file checkasm.c.

◆ COLOR_YELLOW

#define COLOR_YELLOW   3

Definition at line 86 of file checkasm.c.

◆ isatty

#define isatty (   fd)    1

Definition at line 94 of file checkasm.c.

◆ is_red

#define is_red (   f)    ((f) && !(f)->color)

Definition at line 693 of file checkasm.c.

◆ DEF_CHECKASM_CHECK_FUNC

#define DEF_CHECKASM_CHECK_FUNC (   type,
  fmt 
)

Definition at line 1177 of file checkasm.c.

Function Documentation

◆ is_negative()

static int is_negative ( union av_intfloat32  u)
static

Definition at line 416 of file checkasm.c.

Referenced by float_near_ulp().

◆ float_near_ulp()

int float_near_ulp ( float  a,
float  b,
unsigned  max_ulp 
)

Definition at line 421 of file checkasm.c.

Referenced by float_near_abs_eps_ulp(), and float_near_ulp_array().

◆ float_near_ulp_array()

int float_near_ulp_array ( const float a,
const float b,
unsigned  max_ulp,
unsigned  len 
)

◆ float_near_abs_eps()

int float_near_abs_eps ( float  a,
float  b,
float  eps 
)

◆ float_near_abs_eps_array()

int float_near_abs_eps_array ( const float a,
const float b,
float  eps,
unsigned  len 
)

◆ float_near_abs_eps_ulp()

int float_near_abs_eps_ulp ( float  a,
float  b,
float  eps,
unsigned  max_ulp 
)

Definition at line 474 of file checkasm.c.

Referenced by checkasm_check_synth_filter(), and float_near_abs_eps_array_ulp().

◆ float_near_abs_eps_array_ulp()

int float_near_abs_eps_array_ulp ( const float a,
const float b,
float  eps,
unsigned  max_ulp,
unsigned  len 
)

Definition at line 479 of file checkasm.c.

◆ double_near_abs_eps()

int double_near_abs_eps ( double  a,
double  b,
double  eps 
)

◆ double_near_abs_eps_array()

int double_near_abs_eps_array ( const double a,
const double b,
double  eps,
unsigned  len 
)

Definition at line 498 of file checkasm.c.

Referenced by checkasm_check_av_tx().

◆ color_printf()

static void color_printf ( int  color,
const char *  fmt,
  ... 
)
static

Definition at line 511 of file checkasm.c.

Referenced by checkasm_report(), and print_cpu_name().

◆ destroy_func_tree()

static void destroy_func_tree ( CheckasmFunc f)
static

Definition at line 554 of file checkasm.c.

Referenced by checkasm_malloc(), and main().

◆ checkasm_malloc()

static void* checkasm_malloc ( size_t  size)
static

Definition at line 571 of file checkasm.c.

Referenced by checkasm_check_func(), and get_func().

◆ cpu_suffix()

static const char* cpu_suffix ( int  cpu)
static

Definition at line 583 of file checkasm.c.

Referenced by checkasm_fail_func(), and print_benchs().

◆ cmp_nop()

static int cmp_nop ( const void *  a,
const void *  b 
)
static

Definition at line 594 of file checkasm.c.

Referenced by measure_nop_time().

◆ measure_nop_time()

static int measure_nop_time ( void  )
static

Definition at line 600 of file checkasm.c.

Referenced by bench_init().

◆ avg_cycles_per_call()

static double avg_cycles_per_call ( const CheckasmPerf *const  p)
inlinestatic

Definition at line 620 of file checkasm.c.

Referenced by print_benchs().

◆ print_benchs()

static void print_benchs ( CheckasmFunc f)
static

Definition at line 631 of file checkasm.c.

Referenced by main().

◆ cmp_func_names()

static int cmp_func_names ( const char *  a,
const char *  b 
)
static

Definition at line 668 of file checkasm.c.

Referenced by get_func().

◆ rotate_tree()

static CheckasmFunc* rotate_tree ( CheckasmFunc f,
int  dir 
)
static

Definition at line 683 of file checkasm.c.

Referenced by balance_tree().

◆ balance_tree()

static void balance_tree ( CheckasmFunc **  root)
static

Definition at line 696 of file checkasm.c.

Referenced by get_func().

◆ get_func()

static CheckasmFunc* get_func ( CheckasmFunc **  root,
const char *  name 
)
static

Definition at line 712 of file checkasm.c.

Referenced by checkasm_check_func().

◆ signal_handler()

static void signal_handler ( int  s)
static

Definition at line 784 of file checkasm.c.

Referenced by main().

◆ wildstrcmp()

static int wildstrcmp ( const char *  str,
const char *  pattern 
)
static

Definition at line 796 of file checkasm.c.

Referenced by check_cpu_flag(), and checkasm_bench_func().

◆ check_cpu_flag()

static void check_cpu_flag ( const char *  name,
int  flag 
)
static

Definition at line 812 of file checkasm.c.

Referenced by main().

◆ print_cpu_name()

static void print_cpu_name ( void  )
static

Definition at line 835 of file checkasm.c.

Referenced by checkasm_fail_func(), and checkasm_report().

◆ bench_init_ffmpeg()

static int bench_init_ffmpeg ( void  )
static

Definition at line 874 of file checkasm.c.

Referenced by bench_init().

◆ bench_init()

static int bench_init ( void  )
static

Definition at line 894 of file checkasm.c.

Referenced by main().

◆ bench_uninit()

static void bench_uninit ( void  )
static

Definition at line 911 of file checkasm.c.

Referenced by main().

◆ usage()

static int usage ( const char *  path)
static

Definition at line 918 of file checkasm.c.

Referenced by main().

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 931 of file checkasm.c.

◆ checkasm_check_func()

void* checkasm_check_func ( void *  func,
const char *  name,
  ... 
)

Definition at line 1039 of file checkasm.c.

◆ checkasm_bench_func()

int checkasm_bench_func ( void  )

Definition at line 1086 of file checkasm.c.

◆ checkasm_fail_func()

void checkasm_fail_func ( const char *  msg,
  ... 
)

Definition at line 1093 of file checkasm.c.

Referenced by checkasm_handle_signal().

◆ checkasm_set_signal_handler_state()

void checkasm_set_signal_handler_state ( int  enabled)

Definition at line 1112 of file checkasm.c.

Referenced by bench_init_ffmpeg().

◆ checkasm_handle_signal()

int checkasm_handle_signal ( int  s)

Definition at line 1116 of file checkasm.c.

◆ checkasm_get_perf_context()

CheckasmPerf* checkasm_get_perf_context ( void  )

Definition at line 1131 of file checkasm.c.

◆ checkasm_report()

void checkasm_report ( const char *  name,
  ... 
)

Definition at line 1140 of file checkasm.c.

Variable Documentation

◆ bench_runs

uint64_t bench_runs = 1U << 10

Definition at line 110 of file checkasm.c.

Referenced by main().

◆ name

const char* name

Definition at line 114 of file checkasm.c.

Referenced by check_cpu_flag(), checkasm_check_func(), checkasm_report(), get_func(), and main().

◆ func

void(* func) (void)

Definition at line 115 of file checkasm.c.

Referenced by checkasm_check_func(), and main().

◆ tests

const { ... } tests[]

Referenced by check_cpu_flag(), and main().

◆ suffix

const char* suffix

◆ flag

int flag

Definition at line 310 of file checkasm.c.

Referenced by check_cpu_flag(), cpu_suffix(), and main().

◆ cpus

const { ... } cpus[]

Referenced by cpu_suffix(), and main().

◆ funcs

CheckasmFunc* funcs

Definition at line 390 of file checkasm.c.

Referenced by filter_frame(), init_axis_color(), and init_volume().

◆ current_func

CheckasmFunc* current_func

Definition at line 391 of file checkasm.c.

◆ current_func_ver

CheckasmFuncVersion* current_func_ver

Definition at line 392 of file checkasm.c.

◆ current_test_name

const char* current_test_name

Definition at line 393 of file checkasm.c.

◆ bench_pattern

const char* bench_pattern

Definition at line 394 of file checkasm.c.

◆ bench_pattern_len

int bench_pattern_len

Definition at line 395 of file checkasm.c.

◆ num_checked

int num_checked

Definition at line 396 of file checkasm.c.

◆ num_failed

int num_failed

Definition at line 397 of file checkasm.c.

◆ nop_time

int nop_time

Definition at line 400 of file checkasm.c.

◆ sysfd

int sysfd

Definition at line 401 of file checkasm.c.

Referenced by measure_nop_time().

◆ cpu_flag

int cpu_flag

Definition at line 403 of file checkasm.c.

Referenced by main().

◆ cpu_flag_name

const char* cpu_flag_name

Definition at line 404 of file checkasm.c.

◆ test_pattern

const char* test_pattern

Definition at line 405 of file checkasm.c.

◆ verbose

int verbose

Definition at line 406 of file checkasm.c.

Referenced by main(), and sws_getDefaultFilter().

◆ csv

int csv

Definition at line 407 of file checkasm.c.

◆ tsv

int tsv

Definition at line 408 of file checkasm.c.

◆ catch_signals

volatile sig_atomic_t catch_signals

Definition at line 409 of file checkasm.c.

◆ state

struct { ... } state

Referenced by aac_sync(), aacdec_common_init(), adts_aac_resync(), adx_parse(), apng_probe(), atrac9_init_static(), atrac9_init_vlc(), au_compress(), au_decompress(), av1_filter_obus(), av_assert0_fpu(), av_log_once(), av_lzo1x_decode(), av_rc4_crypt(), av_rc4_init(), avg_cycles_per_call(), avi_read_packet(), avpriv_find_start_code(), avpriv_fits_header_init(), avs2_find_frame_end(), avs2_probe(), avs3_find_frame_end(), avs3video_probe(), bench_init(), bench_uninit(), bfi_read_packet(), bmp_parse(), bonk_decode(), build_coeff_vlc(), build_vlc(), cabac_init_state(), cavs_find_frame_end(), ccitt_unpack_init(), check_cpu_flag(), checkasm_bench_func(), checkasm_check_func(), checkasm_fail_func(), checkasm_get_perf_context(), checkasm_malloc(), checkasm_report(), checkasm_set_signal_handler_state(), clv_init_static(), cng_rand(), compute_gru(), cri_parse(), dca_find_frame_end(), decode_cabac_intra_mb_type(), decode_init_static(), decode_line(), decode_significance_8x8_loongarch(), decode_significance_loongarch(), decode_slice_header(), decode_spectrum_ac(), delta_decode(), dfpwm_dec_frame(), dfpwm_dec_init(), dfpwm_enc_frame(), dfpwm_enc_init(), dnxhd_find_frame_end(), dnxuc_parse(), dpx_parse(), draw_scope(), dts_probe(), dvdvideo_chapters_setup_preindex(), dvdvideo_menu_close(), dvdvideo_menu_next_ps_block(), dvdvideo_menu_open(), dvdvideo_play_close(), dvdvideo_play_next_ps_block(), dvdvideo_play_open(), dxv_compress_dxt1(), dxv_decompress_cgo(), dxv_decompress_dxt1(), dxv_decompress_dxt5(), dxv_decompress_yo(), encode_high(), encode_line(), encode_low(), encode_picture_ls(), encode_slice_header(), extract_extradata_mpeg12(), extract_extradata_mpeg4(), extract_extradata_vc1(), ff_aac_ac_finish(), ff_aac_ac_get_context(), ff_aac_ac_map_process(), ff_aac_ac_update_context(), ff_dshow_filter_GetState(), ff_dshow_filter_Pause(), ff_dshow_filter_Run(), ff_dshow_filter_Stop(), ff_ffv1_write_extradata(), ff_h264_decode_init_vlc(), ff_http_auth_create_response(), ff_http_auth_handle_header(), ff_iir_filter_free_statep(), ff_jpegls_decode_picture(), ff_jpegls_downscale_state(), ff_jpegls_init_state(), ff_jpegls_update_state_regular(), ff_rtp_send_h263_rfc2190(), ff_spdif_probe(), ff_spdif_read_packet(), ff_vlc_init_tables(), ff_vlc_init_tables_from_lengths(), ff_vlc_init_tables_sparse(), filter_frame(), find_any_startcode(), find_frame_end(), find_group3_syncmarker(), find_next_start_code(), find_start_code(), format_child_class_iterate(), frame_merge_filter(), ftr_parse(), gem_decode_frame(), gen_vlc(), get_cabac(), get_cabac_inline(), get_cabac_inline_loongarch(), get_cabac_inline_mips(), get_cabac_noinline(), get_ffv1_unsigned_symbol(), get_rac(), get_random_number(), get_symbol(), get_symbol2(), get_symbol_inline(), get_vlc_symbol(), h261_find_frame_end(), h263_find_frame_end(), h264_find_frame_end(), h264_split(), handle_basic_params(), handle_digest_params(), handle_digest_update(), hdcd_analyze_prepare(), hdcd_control(), hdcd_detect_onech(), hdcd_process(), hdcd_reset(), hdr_parse(), hevc_split(), iir_filter(), imc_init_static(), init_tables_once(), intlist_read(), intlist_write(), ipu_parse(), iterative_me(), jpeg_probe(), latm_find_frame_end(), libgsm_encode_frame(), ls_decode_line(), ls_encode_line(), ls_encode_regular(), ls_encode_run(), ls_encode_runterm(), ls_get_code_regular(), ls_get_code_runterm(), ls_store_lse(), main(), make_digest_auth(), measure_nop_time(), message(), misc4_parse(), mix(), mlp_filter_channel(), mobiclip_init_static(), mpc7_init_static(), mpeg1_find_frame_end(), mpeg4_find_frame_end(), mpeg4video_split(), mpegaudio_parse(), mpegaudiodec_common_init_static(), mpegts_write_packet_internal(), mpegvideo_split(), msmp4_vc1_vlcs_init(), msmpeg4_decode_init_static(), mxf_parse_ffv1_frame(), mxf_parse_h264_frame(), nc_read_packet(), next_gain(), opus_find_frame_end(), parse_adaptation_sets(), parse_nal_units(), parse_presentation_segment(), predictor_calc_error(), predictor_init_state(), print_benchs(), print_cpu_name(), prng_shift(), process_new(), process_old(), pulse_context_wait(), pulse_read_header(), pulse_stream_wait(), put_cabac(), put_lines_bits(), put_lines_bytes(), put_rac(), put_symbol(), put_symbol2(), put_symbol_inline(), put_vlc_symbol(), qoi_parse(), read_extra_header(), read_header(), read_high_coeffs(), read_low_coeffs(), read_quant_table(), ripemd128_transform(), ripemd160_transform(), ripemd256_transform(), ripemd320_transform(), rm_sync(), rv40_init_table(), rv40_init_tables(), rv60_init_static_data(), s337m_get_offset_and_codec(), s337m_probe(), s337m_read_packet(), sbc_synthesize_audio(), sbc_synthesize_eight(), sbc_synthesize_four(), SEI_FUNC(), send_mode_b(), sha1_transform(), sha256_transform(), sha512_transform(), signal_handler(), speex_inband_handler(), svc_decode_frame(), svq1_static_init(), uninit(), update_vlc_state(), vc1_init_static(), vc1_split(), wait_for_state(), webp_parse(), write_header(), write_quant_table(), x8_init_vlc(), x8_vlc_init(), and xbm_parse().

◆ checkasm_lfg

AVLFG checkasm_lfg

Definition at line 413 of file checkasm.c.

Referenced by main().

◆ checkasm_context_buf

checkasm_context checkasm_context_buf

Definition at line 736 of file checkasm.c.

◆ signal_handler_act

const struct sigaction signal_handler_act
static
Initial value:
= {
.sa_handler = signal_handler,
.sa_flags = SA_RESETHAND,
}

Definition at line 779 of file checkasm.c.

Referenced by main(), and signal_handler().

signal_handler
static void signal_handler(int s)
Definition: checkasm.c:784