kvog.sh Notes Code About

FFmpeg usage and development

Building

Quick debug build:

./configure --disable-optimizations --disable-asm
make -j$(nproc)                   # Linux
make -j$(sysctl -n hw.logicalcpu) # macOS

Useful toolchains (./configure --toolchain=NAME):

clang-asan          # address sanitizer
clang-ubsan         # undefined behavior
clang-tsan          # threads
clang-msan          # uninitialized reads
clang-asan-ubsan    # sanitizers combine with -
gcc-asan            # same set with gcc-
valgrind-memcheck   # fate under valgrind
valgrind-massif     # heap profiling
gcov                # coverage (gcc), llvm-cov for clang
hardened            # fortify, stack protector, pie

Testing

FATE documentation: https://ffmpeg.org/fate.html

Short version:

./configure --samples=$HOME/Proj/FFmpeg-FATE
make fate-rsync
make fate

Useful targets:

make fate-list          # list all tests
make fate-h264          # run one test or group
make fate-h264 GEN=1    # regenerate reference output
make fate -k            # keep going after failures

Debugging

Use ./ffmpeg_g (unstripped) instead of ./ffmpeg.

Assembly Stuff

Build checkasm:

make checkasm

List tests / functions:

./tests/checkasm/checkasm --list-tests
./tests/checkasm/checkasm --list-functions

Test correctness vs C:

./tests/checkasm/checkasm --test=hevc_pel

Test performance vs C:

./tests/checkasm/checkasm --test=hevc_pel --bench