probe(sbr-chirp): repair the non-engaging instrument, refute the bw-per-level hypothesis
Browse files at this commit9a984c9aaa3d09104f40adf72be51571b97841b9Parent: 054aa951 changed file +46 -25
- scripts/aac-tables/sbrchirp.py +46 -25
scripts/aac-tables/sbrchirp.pymodified+46 -25
| @@ -14,27 +14,42 @@ decays geometrically as `g^n` per QMF slot -- `g` *is* the chirp factor | ||
| 14 | 14 | (pole radius), directly recoverable from the decay rate with no analysis of |
| 15 | 15 | our own decoder involved. |
| 16 | 16 | |
| 17 | -STATUS (dead end, not chased further): the isolated-single-MDCT-line core | |
| 18 | -(`tone_core`) does not round-trip -- most HCB3 codewords beyond the one | |
| 19 | -tuple earlier probes happened to exercise are unverified and desync the | |
| 20 | -bitstream ("Input buffer exhausted before END element found"); see the | |
| 21 | -`(2,0,0,0)`/`(2,0,2,2)`/`(0,0,0,0)` isolation test in the project ledger. | |
| 22 | -Falling back to the already-proven-clean broadband `sce_core` comb content | |
| 23 | -(`broadband_core_bits`) decodes without framing errors, but every real SBR | |
| 24 | -sweep built on top of it (`stream()`, any `n_low`/`n_high`/`n_q` combination | |
| 25 | -tried, any `env0`/`noise0` magnitude) makes the reference decoder print | |
| 26 | -"No quantized data read for sbr_dequant." and then produce PCM that is | |
| 27 | -*value-independent* of both `bs_invf_mode` (all four levels byte-identical) | |
| 28 | -and the envelope amplitude itself (`env0=0` vs `env0=100`: power differs by | |
| 29 | -<0.02%, when a real amp_res=0 dequant law would differ by orders of | |
| 30 | -magnitude) -- i.e. the reference's SBR envelope/gain stage is not engaging | |
| 31 | -with this harness's `sbr_data` payload at all, for a reason not yet | |
| 32 | -isolated (framing/byte-count is provably correct per `oracle_check`, so the | |
| 33 | -fault is in a field *value* or ordering `oracle_check`'s byte-count-only | |
| 34 | -check cannot see). No bw fingerprint could be extracted; Task 1 could not be | |
| 35 | -completed this round. Do not reuse `stream()`'s SCE/FIXFIX(num_env=1) recipe | |
| 36 | -believing it produces a working real decode -- it does not, despite passing | |
| 37 | -the byte-count oracle. | |
| 17 | +STATUS (round-19): the round-18 non-engagement was `stream()`'s own recipe | |
| 18 | +shape, not a framing bug -- bisected field-by-field against a known-working | |
| 19 | +CPE probe (see project ledger) and isolated to TWO independent culprits, | |
| 20 | +either one sufficient alone to make the reference decoder's SBR gain stage | |
| 21 | +not engage (envelope amplitude and `bs_invf_mode` both become powerless, | |
| 22 | +`"No quantized data read for sbr_dequant."` fires either way -- that | |
| 23 | +message is a red herring, printed on this SCE probe shape regardless of | |
| 24 | +engagement, not diagnostic of it): | |
| 25 | + | |
| 26 | + 1. `bs_amp_res=0` (coarse, 7-bit raw envelope resolution). Sweeping the | |
| 27 | + full raw range (0..127) still gives <0.03% output-power change; fine | |
| 28 | + resolution (`bs_amp_res=1`, 6-bit raw) with the same header gives | |
| 29 | + three-to-four-orders-of-magnitude power swings for a mid-range raw | |
| 30 | + sweep (3 -> 60). Pure probe-construction quirk, not implicating our | |
| 31 | + parser/writer: real encoders emit both resolutions routinely and nothing | |
| 32 | + here says our AAC parser mishandles coarse-resolution streams -- it is | |
| 33 | + specifically *this reference build's* dequant path refusing these raw | |
| 34 | + values under `amp_res=0`, for a reason not chased further (plausibly an | |
| 35 | + offset/table-range mismatch in how this probe's raw codewords map, | |
| 36 | + unrelated to any of our own code). | |
| 37 | + 2. `bs_num_env=1` (FIXFIX single envelope). Independent of amp_res: even | |
| 38 | + requesting `amp_res=1` explicitly, a single-envelope frame still fails | |
| 39 | + to engage here. | |
| 40 | + | |
| 41 | +`stream()` below now uses the repaired shape: SCE, FIXFIX with `num_env=2`, | |
| 42 | +`amp_res=1`, envelope held constant across `bs_invf_mode` sweeps. Task 2 (a | |
| 43 | +four-level `bs_invf_mode` sweep plus a HIGH->NONE transition, `n_q=1` | |
| 44 | +narrow HF target) on this repaired instrument found only a ~0.1% output | |
| 45 | +power drift across all four levels and no resolvable flatness difference, | |
| 46 | +against a `BW_TABLE` that nominally spans `bw=0.0..0.98` -- STOP RULE | |
| 47 | +applies: fingerprints are indistinguishable on the working instrument, so | |
| 48 | +the bw-per-level hypothesis is refuted for this measurement and `sbr_hf.rs` | |
| 49 | +was left unchanged. (The HIGH->NONE transition run showed a >200x power | |
| 50 | +spike two frames from the stream's end; that coincides with the trailing | |
| 51 | +silence frame and reads as a decoder-side reset artifact of this probe's | |
| 52 | +framing, not a chirp-smoothing signal -- not chased further.) | |
| 38 | 53 | """ |
| 39 | 54 | import os |
| 40 | 55 | import sys |
| @@ -105,13 +120,16 @@ def broadband_core_bits(w, gain=200): | ||
| 105 | 120 | |
| 106 | 121 | |
| 107 | 122 | def stream(cfg, tables, n_frames, invf_seq): |
| 108 | - """`n_frames` FIXFIX/1-env frames, header on the first, `bs_invf_mode` | |
| 109 | - taken from `invf_seq[i]` (repeats last if shorter).""" | |
| 110 | - grid = dict(frame_class=0, num_env=1, freq_res=0) | |
| 123 | + """`n_frames` FIXFIX/2-env, `amp_res=1` frames (the repaired, engaging | |
| 124 | + shape -- see module docstring), header on the first, `bs_invf_mode` | |
| 125 | + taken from `invf_seq[i]` (repeats last if shorter), envelope held fixed | |
| 126 | + across the sweep.""" | |
| 127 | + grid = dict(frame_class=0, num_env=2, freq_res=0) | |
| 111 | 128 | frames = [P.silent(SF_INDEX)] |
| 112 | 129 | for i in range(n_frames): |
| 113 | 130 | mode = invf_seq[min(i, len(invf_seq) - 1)] |
| 114 | - c = dict(cfg, invf=mode, header=1) | |
| 131 | + c = dict(cfg, invf=mode, header=1, amp_res=1, element="sce", coupling=0, | |
| 132 | + df_env=[0] * 8, df_noise=[0, 0], env0=[40] * 8, noise0=[2, 2]) | |
| 115 | 133 | w = P.BitW() |
| 116 | 134 | broadband_core_bits(w) |
| 117 | 135 | body = F.sbr_bits_full(c, tables, grid, []) |
| @@ -122,8 +140,11 @@ def stream(cfg, tables, n_frames, invf_seq): | ||
| 122 | 140 | w.w(cnt - 15 + 1, 8) |
| 123 | 141 | else: |
| 124 | 142 | w.w(cnt, 4) |
| 143 | + start = len(w) | |
| 125 | 144 | w.w(13, 4) |
| 126 | 145 | w.wbits(body.bits) |
| 146 | + while len(w) - start < cnt * 8: | |
| 147 | + w.w(0, 1) | |
| 127 | 148 | w.w(7, 3) |
| 128 | 149 | frames.append(P.adts(w.pack(pad=0), SF_INDEX)) |
| 129 | 150 | frames.append(P.silent(SF_INDEX)) |