Add r8brain-free-src to the resampler comparison - #45
Merged
Merged
Conversation
r8brain-free-src (7.5, pinned by commit in cmake/r8brain.cmake) joins libsamplerate and soxr in every leg of docs/COMPARISON.md: - Quality (notebooks/asrc_comparison.ipynb): CDSPResampler24 through a two-function ctypes shim (tools/compare_shim/, SRT_BUILD_COMPARE_SHIM) measures at the format ceilings like the other oracle-fed libraries (-143.9 dB THD+N at 24-bit IO, 149.1 dB DR). A new section sweeps its transition band and measures latency against the 20 kHz passband: 789 input frames at the default, 200 at the lowest-latency setting still flat to 20 kHz (8%), ~1 ms only at a 45% band that is -35 dB at 20 kHz. - Host throughput (bench/compare): 120 dB default and passband-matched rows plus the 16- and 24-bit presets. r8brain out-runs balanced on x86 (1.1-1.7x) at 8-33x the filter delay. - Embedded instruction counts (bench/icount, compare.yml): r8brain on M55/M33/Hexagon. It builds for Cortex-M only with a no-op std::mutex (forced include; its filter cache has no lock hook and thread-less newlib has none). Each engine now also builds at 4 s so steady state separates from one-time construction, and SampleRateTap's Q15 datapath joins as an engine. Steady state, balanced float beats r8brain 1.1-2.2x; Q15 on M33 is 879 insn/frame vs r8brain's ~26.6k. Re-measurement also corrects stale numbers: balanced now measures -133.9 dB (was -132.1; the compensated design landed after the last run), and the old per-frame embedded figures folded construction in. Construction is now reported on its own: ~1.3 G instructions on M33, the one column where SampleRateTap loses. The libsamplerate totals reproduce the old table exactly, confirming the harness. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G3HxzEGiZp7jStoMuYNuBK
- compare-smoke now also builds the r8brain ctypes shim on the host and the Q15 and r8brain comparison workloads for M55, so the bare-metal no-op-mutex path and the new engines can't silently rot between manual compare.yml runs. - README provenance: r8brain-free-src (MIT) is fetched at a commit pin by the opt-in comparison builds only, never linked into the library. - Book (two-crystals): replace the stale "about 9.8x" M33 claim with the steady-state figure (~56x the Q15 datapath's 879 insn/frame) and say why the number changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G3HxzEGiZp7jStoMuYNuBK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Adds r8brain-free-src (7.5, pinned at commit
9e73d2ddincmake/r8brain.cmake) to every part ofdocs/COMPARISON.md: the quality notebook, the host throughput bench and the embedded instruction counts. The embedded counts now report steady-state cost separately from one-time construction.Why
We had no measured comparison against r8brain, a widely used MIT resampler. Re-measuring also turned up stale numbers in the comparison. The old embedded per-frame figures included one-time construction, so the headline "~9.8× cheaper than libsamplerate on M33" no longer matched the library.
Verification
All of this was built and run in one container on 2026-09-25/26:
notebooks/asrc_comparison.ipynbis re-executed and committed executed, and its assertions pass.CDSPResampler24measures −143.9 dB THD+N at 24-bit I/O, −150.8 dB at float I/O, and 149.1 dB DR.srt_bench_compare, median of 5, all engines in one session. The numbers are inCOMPARISON.md.ok=1, on M55 (mps3-an547), M33 (mps2-an505) and Hexagon (qemu-hexagon built with plugins from the checksum-pinned 8.2.2 source, toolchain 19.1.5). The toolchain and plugin-header pins matchcompare.yml.compare.ymlon GitHub. The recorded counts come from this local reproduction, and one manual run would confirm them on CI.-DSRT_WERROR=ON; all 73 tests pass.compare-smokesteps: run locally in fresh directories, both pass.-Werror: my new code builds clean. The build still fails on existing lines inbench/bench_asrc.cpp:83and in the oldsrtBenchinbench_compare.cpp, bothint64_t/size_tsignedness. I didn't touch these, and CI doesn't build them with clang.Notes for the reviewer
a45043a, 2026-07-04), so this is a re-measurement, not a change this PR makes.balancedon x86 (1.1–1.7×), at 8–33× the filter delay. The doc states this too.bench/icount/r8b_single_thread_mutex.h. r8brain's filter cache usesstd::mutexwith no hook to replace it, and thread-less newlib doesn't declare one. The stand-in is exact for the single-threaded workload and off the per-sample path.GIT_REPOSITORYplus a full commit SHA rather than a tarballURL_HASH. Its newest tag (6.5) predates 7.x, and the archive download was blocked in my environment. It's comparison-only and never linked into the library; the README provenance section now says so.book/src/part0/two-crystals.mdis corrected here. Other stale figures (−132.1 dB, 5,043 insn/frame, June host throughput) remain in the book (two-crystals.md,budgets.md,cortex-m.md,notebooks.md,hardware.md, glossary) and in the Pico example READMEs.🤖 Generated with Claude Code
https://claude.ai/code/session_01G3HxzEGiZp7jStoMuYNuBK
Generated by Claude Code