$ show lieff/minimp3
minimp3 is a minimal, high-performance, ISO-conformant MP3 decoder implemented as a single-header C library (minimp3.h). It provides a low-level frame decoding API and a higher-level streaming/seek API (minimp3_ex.h) with callback-based I/O abstraction. The decoder supports SSE and NEON SIMD acceleration, and compiles to a ~30kB binary with zero external dependencies. The repository includes a comprehensive test suite with over 50 test vectors covering standard and edge-case MPEG audio streams, a fuzzing harness, and a full-featured GUI player (using SDL2 and Nuklear) that demonstrates real-world usage. An additional tool (huffopt) generates optimized Huffman tables for Layer III. The library is designed for embedded systems, game engines, and any environment requiring a lightweight MP3 decoder.
The LLM identified 3 files worth highlighting for reuse:
A self-contained C tool that uses dynamic programming to generate optimized Huffman code tables for MPEG Layer III. It reads the standard HUFFCODE specification and computes cost-optimal prefix codes. This component can be extracted and reused for any codec development requiring Huffman table optimization, and demonstrates non-trivial algorithm design (DP cost analysis) independent of the minimp3 library.
A high-level wrapper around the core minimp3 decoder that provides file/buffer streaming, precise seeking via binary search, and a callback interface (MP3D_READ_CB, MP3D_SEEK_CB) for flexible input sources. This module is self-contained (depends only on minimp3.h and stdio) and implements a reusable pattern for adding seekable streaming to any frame-based decoder. The binary-search index algorithm for accurate frame positioning is notable and could be adapted to other codec contexts.
The core MP3 decoder implemented as a single C header file with a define-based implementation guard. It contains a full ISO-conformant MPEG-1/2 Layer III decoder with SSE and NEON SIMD paths (runtime-detected), no external dependencies beyond standard C library, and compile-time configuration via macros. While not extractable as a separate component (it is the library itself), it exemplifies high craftsmanship in minimal, portable, performance-optimized library design and is the primary reusable asset of the repository.