Row-sum-preserving quantization (RBJ round 2) + Appendix D, on Tap House Rules#33
Open
tap wants to merge 2 commits into
Open
Row-sum-preserving quantization (RBJ round 2) + Appendix D, on Tap House Rules#33tap wants to merge 2 commits into
tap wants to merge 2 commits into
Conversation
PR #33's content re-applied on top of the snake_case migration: the largest-remainder row-sum correction in polyphase_filter_bank (with the quantized-row-0 copy for the extra row), k_coeff_scale on all three sample_traits, the tightened DcGain gates (12 -> 1; measured 0 LSB over a 256-point mu sweep), RowSumsAreExact and CompensatedBranchSumsAreUniform tests, the epilogue postscript, and Appendix D (The two budgets). Also completes the migration in examples/alsa_bridge.cpp, which the style pass left half-renamed and uncompilable when examples are enabled (converter_state members, Config/servo/status field spellings, and six struct members declared camelCase but used snake_case). https://claude.ai/code/session_01HuAFfoeD5a5Xe5aGNA16M9
(1) examples/alsa_bridge.cpp fully migrated: the remaining consistently- camelCase internals (g_stop, on_sigint, state_name, parse_args, open_device, dump_failed, buf_frames), the cli_args and alsa_device types, and the target_latency_frames mention in the help text -- the file now reads one dialect throughout instead of the half-and-half the style pass left it in. (2) k_k_ -> k_ repo-wide (14 files: tests, three headers, drifting_clocks): the migrator double-prefixed constants that already carried the k (kFs -> k_k_fs). Thirteen distinct names, no collisions with existing k_ identifiers. Bonus alignment: the book's prose was already migrated to the intended single-prefix spellings (k_channel_parallel in the decision log and resampler chapter), so code and book agree again; the live excerpts pick the fix up automatically. 73/73 under -Werror with examples enabled; book builds clean. https://claude.ai/code/session_01HuAFfoeD5a5Xe5aGNA16M9
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.
Context
RBJ's MATLAB script arrived (validated at R=512/N=32 — exactly
economy()'s shape) with one more claim: "for DC, this should get you infinite S/N ratio... for every phase or fractional delay, the FIR coefficients must add to 1" — plus a warning that 16-bit coefficient quantization needs "tricky things."Rebased-by-port onto the Tap House Rules migration: the branch is now a single commit re-applying everything in the new dialect (snake_case,
.h, mandatory braces, new clang-format).Verified, then fixed
image_zerosdesigns' branch-DC sums are uniform to a spread of 1.8×10⁻¹⁵ (machine epsilon) — zeros at k·fs and branch-DC uniformity are the same fact stated in two domains. The plainfast()design spreads 4.7×10⁻⁶ (its stopband leakage at fs). NewKaiser.CompensatedBranchSumsAreUniformpins this.DcGaintolerance.The fix
Largest-remainder row-sum-preserving quantization in
polyphase_filter_bank's constructor (integer coefficient types only): each row's total rounding residual is distributed to the taps rounded furthest from it, so every row sums to exactlyllround(exact × k_coeff_scale). The extra row L is copied from quantized row 0, keeping the μ-wrap continuity invariant bit-exact through the correction.Measured
DcGaintolerances tightened 12 → 1; newRowSumsAreExactQ15/Q31pin every row to exactlyk_coeff_scale-Werror(examples enabled); constructor cost is ~L·T doubles of bookkeeping — noise even on the M33 icount ledgerRiders
examples/alsa_bridge.cpp, which the pass left half-renamed and uncompilable when examples are enabled:converter_statemembers,Config/servo/status field spellings, and six struct members declared camelCase but used snake_case. (Separately: the migration mintedk_k_fs/k_k_epsin the tests by double-prefixing the oldkFs/kEps— left untouched here, flagging for the style owner.)pw_row_sumlive excerpt), and Appendix D: The two budgets — a first-person essay on real-time instinct meeting the million-point FFT, with a measured timing table and runnable one-liners.🤖 Generated with Claude Code
https://claude.ai/code/session_01HuAFfoeD5a5Xe5aGNA16M9