https://github.com/FFmpeg/FFmpeg/blob/master/libavutil/x86/x...
On startup, it runs cpuid and assigns each operation the most optimal function pointer for that architecture.
In addition to things like ‘supports avx’ or ‘supports sse4’ some operations even have more explicit checks like ‘is a fifth generation celeron’. The level of optimization in that case was optimizing around the cache architecture on the cpu iirc.
Source: I did some dirty things with chromes native client and ffmpeg 10 years ago.
Would it ever make sense to write handwritten compiler intermediate representation like LLVM IR instead of architecture-specific assembly?
My best guess is you were doing codegen for several different instruction sets and the optimization or side channel prevention is something that would be too difficult or specialized to automate so you have to do it by hand.
It's glorious.
cr125rider•2h ago
prisenco•1h ago
Imagine all projects were similarly committed.
byteknight•1h ago
ackfoobar•45m ago
hluska•15m ago
Almondsetat•11m ago
therealmarv•7m ago
zahlman•1h ago
codys•1h ago
They publish doxygen generated documentation for the APIs, available here: https://ffmpeg.org/doxygen/trunk/
zahlman•1h ago
javier2•37m ago
Wowfunhappy•36m ago
ansk•2m ago
* To be more precise, these are bindings for the libav* libraries that underlie ffmpeg
xxpor•23m ago