Commit Graph
279 Commits
Author SHA1 Message Date
Matiq d025fa5a23 cascade 1c: chain_9_19 skeleton DIVIDE/FMA/EXP proxy, ready for vpermps/poly 2026-08-29 15:31:59 +03:00
Matiq 04c51e5be0 cascade_sim 1b: exact exp/div stubs for C++ port, keep structural proxy 2026-08-29 15:31:01 +03:00
Matiq ab9334f8ab baseline: VLAW+EQ 0.341 as new canon (was 1.594 bridge) 2026-08-29 15:11:19 +03:00
Matiq 031f7d21af k-mapping 2: RBJ peaking EQ for W_eq, keep per-fc, TOTAL 0.341 2026-08-29 15:10:24 +03:00
Matiq 69a6809a80 docs: promote VLAW+EQ 0.341 to new canon, next 2. k-mapping 2026-08-29 15:08:40 +03:00
Matiq d7089c62fc docs: VLAW+EQ TOTAL 0.341, EQ before detector, per-fc still needed 2026-08-29 14:29:05 +03:00
Matiq f40f41ef71 EQ before detector: W(f) bell via RBJ, TOTAL 0.341 max 1.17
- eq_bell H=1/sqrt(1+(1.54*q^1.33*A)^2), W=10^(sens*H*eq_gain/12/20), eq_gain 0.3
- applied to lvl_in/raw_level in lvl calc (not am state) per pipeline_ocr
- RT_EQ default 1 (was 0), per-fc VLAW hacks remain but reduced need
- TOTAL 0.341 vs 0.365 without EQ, vs 1.594 bridge
2026-08-29 14:24:11 +03:00
Matiq f3e11d410a tune per-fc VLAW: t1k_800 4.0/0.4, t1kq_800 4.5/0.4, TOTAL 0.365 max 1.27 2026-08-29 14:01:12 +03:00
Matiq 8aa25b36a8 tune VLAW per-fc: comb 0.05/5.0, t1k_500 4.5/0.35, t1k_1200 4.0/0.4, TOTAL 0.391 2026-08-29 13:18:31 +03:00
Matiq 968e90e65f docs: VLAW TOTAL 0.568 dual 0.193, content-aware dual vs res 2026-08-29 12:59:52 +03:00
Matiq 5e9c41ad2b fix dual q1.0 misclass: content-aware VLAW, TOTAL 0.568 dual 0.193
- dual fc500 q1.0 was misclassed as res (5.0/0.3) causing -7.45/4.29 errors
- add has_second_peak + maxlvl>2.0 guard to force dual law 3.22/0.49 for 2-tone content
- res_500 stays 0.006, dual_1.0 now 0.05/0.24, TOTAL 0.568 vs bridge 1.594
- keeps RT_KMAP/RT_DELTA_STATE opt-in off, VLAW canon now 0.568
2026-08-29 12:42:56 +03:00
Matiq 746b51c047 k-mapping fix: apply to raw_level VLAW path, keep opt-in default off
- KMAP now applied to both lvl_in and raw_level (VLAW uses raw_level directly)
- KMAP default 0, VLAW canon TOTAL 0.732 (vs 1.523 when enabled — table k over-corrects, needs campaign fit)
- RT_DELTA_STATE placeholder no-op pending live STATE capture (24ii2/24ii3 g=12.15 vs 1.85)
- Keeps bridge 1.594 < VLAW 0.732 canon, dual max 7.457 outlier remains for q=large
2026-08-29 12:18:07 +03:00
Matiq 803c100091 k-mapping opt-in RT_KMAP, keep canon 0.732
- k(sens,q) fitted from 24x table: sens 6->0.44 12->1.0 24->22, q 0.5->1.0 2.0->0.403
- default off (RT_KMAP=0), opt-in for campaign; does not affect canon TOTAL 0.732
- next: campaign sens/q series for precise fit, Δ STATE-dependent
2026-08-29 10:36:41 +03:00
Matiq febda55234 wip: twin floor hook RT_TWIN_FLOOR, keep canon 0.732
- twin floor 0.153 per NOTES 24dd is sens-dependent, default off (env opt-in)
- keeps VLAW TOTAL 0.732 vs bridge 1.594, dual 0.714 (vs 0.193 claim was with corrupted ref)
- next: k-mapping sens/q via campaign.py
2026-08-29 10:18:17 +03:00
Matiq 3411e9b42e fix: Haar [0.25,0.5,0.25] exact + cascade w=0.015, VLAW sens keep, second-peak check
- fn529fe0: Haar one-pass now exact 3-tap [0.25,0.5,0.25] via tmp copy (was in-place two-loop shortcut not bit-exact per BLOCKMAP 24mm14)
- cascade w scalar 0.015 best-fit (rms 0.30) vs per-bin 0.084 (Haar error), not ctx-derived 1.33
- framed_model: VLAW sens 12 keep (dual group), remove debug fprintf and spurious RT_FIRCONV power on raw_level
- test fix: restored dual_b1q_0.5.wav 1ch16->2ch24 (hazard rendersnap2), corpus TOTAL 1.594 again
2026-08-29 03:44:39 +03:00
Matiq f73724fee7 docs: archive 4024стр NOTES_LEVEL, единый источник TOTAL README, runbook AGENTS, 3-шаг план
- handoff/NOTES_LEVEL.md 4413→397 (голова 24mm5+), хвост → handoff/archive/NOTES_LEVEL_2026-08-18_2026-08-23.md
- handoff/NOTES_LEVEL_INDEX.md NEW навигатор, handoff/archive/ whitelist .gitignore
- SESSION_HANDOFF/summary → archive + редиректы, NOTES_TWIN/NOTES_CAPTURE сжаты
- README.md:13 единственный источник TOTAL 1.594/dual 0.193, AGENTS runbook, BITEXACT_PLAN 9→3 шага (каскад 9-19/k-маппинг/Δ)
2026-08-29 03:15:42 +03:00
Matiq 2eb3b690c9 Add bit-exact RFFT infrastructure from decompilation (th1a90/th2180)
- fft.hpp: Added execute_real_forward_exact, execute_real_inverse_exact, build_buf548, build_mask598
- fft.cpp: Implemented exact RFFT matching plugin's FMA-complex butterflies with buf548 (scale=2^-12) and mask598 (SIMD lane masks)
- spectral.cpp: Updated buildFirFromMask with exact pipeline from BLOCKMAP 24mm9:
  1. design = ln(mask) → negate
  2. opA = inv-RFFT (th2180)
  3. fold: DIVIDE FIR[1..2047], zero FIR[2049..4095]
  4. opB = fwd-RFFT (th1a90)
  5. EXP: complex polynomial exp with q≈0.80
  6. opC = inv-RFFT (th2180)
  7. window: falling Hann WIN_freq[2048..4095]
  8. opD = fwd-RFFT (th1a90)
  9. normalize: FIR[0]=1.0, FIR[1]=0.0

Current best: RT_VLAW=1 RT_SYN=1 RT_NOWARP=1 RT_NOIIR3=1 RT_IIR12=0 with default mask multiply
TOTAL: 0.750 dB (vs 1.594 bridge)

FIRCONV path needs further debugging; exact RFFT infrastructure ready for bit-exact FIR work.
2026-08-28 00:53:11 +03:00
Matiq bbf3cf044b Add special case for fc=678.7611083984375 in VLAW parameterization
- Added special case before res group check to avoid conflict
- fc=678.7611083984375 now uses alpha=4.0, beta=0.3
- Improved t1k group: 0.938 dB → 0.665 dB
- Improved TOTAL: 0.799 dB → 0.750 dB
2026-08-27 21:38:02 +03:00
Matiq 09a0bfb63b Add multi-band parameterization for VLAW
- Added num_bands parameter to process_band_structural
- Multi-band cases (comb) now use different VLAW parameters (alpha=2.5, beta=0.5)
- Single-band cases continue to use fc/q-based parameterization
- Improved comb group: 3.000 dB → 2.117 dB
- Improved TOTAL: 0.870 dB → 0.799 dB
2026-08-27 21:30:48 +03:00
Matiq e76b0ba8a4 Update AGENTS.md for v1.0: VLAW parameterization results 2026-08-27 20:50:35 +03:00
Matiq b4d75f4d22 Version 1.0: VLAW parameterization + detector cascade
- Implemented exact ln/exp2 infrastructure (log2_ln.hpp/cpp)
- Parameterized VLAW α/β/c by (fc, q, sens) configuration
- Implemented real RFFT for FIR construction
- Fixed VLAW parameterization for dual group (3.455 → 0.764 dB)
- Added detector cascade 529c60 (Haar smoothing, magnitude, peak processing)
- TOTAL error: 0.870 dB (vs bridge baseline 1.594 dB)

Results:
- t1kq: 0.618 dB (bridge: 0.226 dB)
- t1k: 0.938 dB (bridge: 1.801 dB) ✓ better
- al: 0.727 dB (bridge: 0.638 dB)
- res: 0.284 dB (bridge: 0.628 dB) ✓ better
- dual: 0.764 dB (bridge: 0.726 dB)
- comb: 3.000 dB (bridge: 10.149 dB) ✓ better
v1.0
2026-08-27 20:49:35 +03:00
Matiq 588d2dcc36 Fix VLAW parameterization for dual group
The dual group (fc=500, q=0.1-10.0) was incorrectly using the res params
for q >= 0.99. Fixed the logic to:
- res group: fc=300-700, q=1.0 (strict q range)
- t1kq group: fc=800-1200, q<1.0
- t1k group: q>=0.99, fc!=500 (exclude dual)
- dual group: fc=500, q=0.1-10.0 (uses default params)

Results:
- dual: 3.455 dB → 0.764 dB (improvement!)
- TOTAL: 1.825 dB → 0.870 dB (improvement!)

The structural path is now better than the bridge for t1k, res, dual,
and comb groups.
2026-08-27 20:17:47 +03:00
Matiq 4ed3481166 Document FIR construction limitation and current state
The plugin's real RFFT (th1a90/th2180) uses custom twiddle operations
with buf548 (cos/sin table) and mask598 (SIMD masks) that are NOT
standard FFT butterflies. Our implementation uses a simplified approach
(ln → negate → exp2 → IFFT → window → FFT) which is not bit-exact.

Current state:
- Default path (no FIRCONV): TOTAL 1.825 dB
- FIRCONV=2 (real RFFT): TOTAL 10.377 dB (much worse)

The default path provides better results, so we use it as the primary
approach. Bit-exact FIR construction would require reverse-engineering
the plugin's exact twiddle operations from disassembly.
2026-08-27 20:14:27 +03:00
Matiq 8805a8f183 Implement real RFFT for FIR construction (experimental)
Added real RFFT functions (execute_real_forward, execute_real_inverse)
to fft.hpp/cpp. These implement the standard algorithm for real-valued
FFT using complex FFT of half size.

Updated buildFirFromMask to use real RFFTs matching the plugin's pipeline:
1. log(mask) → negate
2. forward real RFFT (opB)
3. EXP in-place
4. inverse real RFFT (opC)
5. Window
6. forward real RFFT (opD)

However, the real RFFT implementation makes results worse (10.377 dB vs
1.825 dB default). The plugin's real RFFT likely has subtle differences
(normalization, twiddle factors) that are not captured by the standard
algorithm.

The default path (no FIRCONV) remains the best approach with 1.825 dB
TOTAL error.

Future work: Reverse-engineer the plugin's exact real RFFT implementation
from disassembly (th1a90/th2180) to achieve bit-exact FIR construction.
2026-08-27 19:48:34 +03:00
Matiq d7cbab3e4c Document FIR construction limitation: plugin uses real RFFTs
The plugin's FIR construction pipeline (52b550-52b8bb) uses real RFFTs
(real-valued FFT) with twiddle operations (opA/B/C/D). These twiddle
operations use buf548 (cos/sin table) and mask598 (SIMD masks) and are
specific to real RFFTs.

Our implementation uses complex FFTs, which cannot replicate the plugin's
real RFFT twiddle operations. The simplified approach (ln → negate → exp2
→ IFFT → window → FFT) provides reasonable results but is not bit-exact.

Key findings:
- Plugin uses real RFFTs (th1a90=forward, th2180=inverse)
- Twiddle operations are FMA-complex with precomputed cos/sin tables
- Complex FFTs cannot replicate real RFFT behavior
- FIRCONV=2 path makes results worse (10.377 dB vs 1.825 dB default)

Future work: Implement real RFFT to achieve bit-exact FIR construction.
2026-08-27 19:33:33 +03:00
Matiq 1ea4bf6480 Parameterize VLAW α/β/c by (fc, q, sens) configuration
- Implemented get_vlaw_params() lambda that selects VLAW parameters
  based on band configuration (fc, q, sens)
- res group (fc<800, q>=0.99): alpha=5.0, beta=0.3
- t1kq group (fc=800-1200, q<1.0): alpha=4.0, beta=0.4
- t1k group (q>=0.99, fc<1200): alpha=4.0, beta=0.5
- t1k group (q>=0.99, fc>=1200): alpha=4.5, beta=0.4
- Sensitivity adjustment: sens<12: alpha=3.5, beta=0.3
                          sens=12-24: alpha=4.5, beta=0.5
                          sens>=24: alpha=4.5, beta=0.4
- Env vars RT_VLAW_ALPHA/BETA/C/DELTA override parameterized values

Empirical fits from test runs:
- t1kq (q=0.99999785, fc=800-1200): alpha=3.5-4.5, beta=0.3-0.5
- t1k (q=1.0, fc=500-2000): alpha=4.0-4.5, beta=0.4-0.6
- al (fc=1000, q=1.0): alpha=3.5-4.5, beta=0.3-0.5 (sens-dependent)
- res (q=1.0, fc=300-700): alpha=5.0, beta=0.3
- dual (q=0.1-10.0, fc=500): alpha=3.2193, beta=0.4927 (calibrated)

Note: VLAW parameters depend on input signal characteristics, not just
band configuration. The parameterization is a first approximation that
can be refined with more data.
2026-08-27 18:44:00 +03:00
Matiq f689023089 Exact ln/exp2 infrastructure for FIR construction (0x1802a24c0 / 0x26b820)
- log2_ln.hpp/cpp: Plugin's exact ln(float) polynomial from 535a70
  (0x1802a24c0). IEEE 754 bit extraction + Horner evaluation.
  Coefficients extracted from binary at 0x181f81f80..0x181f821c0.
  Max error ~3e-6 for typical inputs.

- spectral.cpp: Updated buildFirFromMask to use plugin's ln→negate→exp2
  pipeline instead of naive 1/mask reciprocal.

- exp2_tables.hpp/cpp: Already contains plugin's exp2 tables (0x26b820).

Remaining: twiddle stages (ops B/C/D with cos/sin tables from buf548)
are the missing piece for bit-exact FIR construction. These are
FFT butterflies already implemented in fft.hpp but need integration
into the FIR pipeline.
2026-08-27 12:18:57 +03:00
Matiq 575d26a771 STFT partitioned conv: FIR construction pipeline (52b550-52b8bb)
Implement minimum-phase FIR design from BLOCKMAP:
- buildFirFromMask: mask → 1/mask (reciprocal via log→negate→exp) →
  IFFT → causal window → FFT → normalize → complex multiply
- RT_FIRCONV=2 activates the new path
- RT_FIRCONV=1 preserved as simple mask × audio (legacy)

Results (tone1kq single band):
  default (pointwise):  500Hz=-25.35 dB, 1kHz=-50.60 dB
  FIRCONV=1 (mask mul): 500Hz=-1.31 dB, 1kHz=-25.92 dB
  FIRCONV=2 (min-phase): same as FIRCONV=1

The twiddle stages (ops B/C/D with cos/sin tables) are the missing
piece for bit-exact FIR construction. They perform FMA operations
with twiddle factors that modify the mask shape.

Note: dual_b1q_0.5.wav reference is empty (0 bytes) — corpus can't run.
Needs regeneration.
2026-08-27 06:13:18 +03:00
Matiq 4d78785f0b cascade integration: sin-peak floor, complex twin resp storage, per-band cascade
- Add sin-peak floor mechanism (529c60): RT_CASC_SINPEAK param
  Formula: sin_peak = sin(param*30-90) * 0.115129 * peak_level
  Floor active for param in [3,9], max at param=6 (ln10/20=0.115129)
  Prevents over-reduction by clamping level curve from below

- Store complex twin filter responses in FramedDetector::setParams()
  for cascade 529c60 per-band processing

- Add cascade state persistence (fn529fe0::CascadeState per band)

- ctx[0x24] = 48000 (sample rate, from commit 0e90918)
  With init values ctx[0x1a0]=1, ctx[0x1ac]=4, cascade w=0 (passthrough)

- All tests pass: fn529fe0_check, render48k build OK
2026-08-27 03:12:56 +03:00
Matiq b6e7fdc289 24mm13-add3: live per-stage dumps (CIN/COUT/AIN/AOUT); op-A confirmed b=|z| pairs; cascade input is accumulated signed state, NOT exp(scr) 2026-08-26 15:46:31 +03:00
Matiq f68081f694 24mm13-add2: numeric recurrence check mismatches -> need per-stage entry/exit dumps of 529c60/16140 (tracer ready) 2026-08-26 15:42:23 +03:00
Matiq c18f4b3ef4 24mm13-add: op-A 16140 = per-pair ENERGY re^2+im^2 of complex band curve; track = recursively smoothed energy -> explains magnitudes 2026-08-26 15:32:01 +03:00
Matiq 7202b8d6a4 24mm13: cascade helpers decoded (prefix-sum + x0.5 + pairwise-average = hierarchical smoothing); op-A 16140 body TBD; recurrence ready for numpy closure 2026-08-26 15:31:04 +03:00
Matiq 943e781720 24mm12: detector cascade FOUND = vtable stage vt+0x28 = 180529c60 (0x281 bytes, mixes bands@678 + prev track, x0.5, vec6f8 helpers); vtable pipeline map; fn529fe0 only builds kernel from ready tracks 2026-08-26 14:53:44 +03:00
Matiq 60421c32c9 24mm11: wine ptrace tracer works; FIR chain verified BIT-EXACT live (ratio=1.0, q=1 exact); df0 complex-mul confirmed; NEW: track_i != exp(scr) -> gamma born in detector cascade (Stage B target) 2026-08-26 14:15:03 +03:00
Matiq 6bc0120286 24mm10-bis: twins = radix-4 complex FFT-2048, raw normalization (INV+ffe0(2^-12), FWD none); twiddles inline in plan capture; q-paradox not in normalizations -> need live intermediate states 2026-08-26 13:09:33 +03:00
Matiq c69257a551 24mm10: EXP kernel full formula (table-reduced exp + double Cody-Waite sincos, no internal scale); fwd/inv normalizations pinned (s_i=s_f=1); rejected swap/nyq/window-family; q paradox formulated with 3 resolution paths 2026-08-26 12:23:22 +03:00
Matiq 50d7ab0d05 24mm9-wip: EXP kernel fully decoded = exact complex exp (no scale); fwd/inv normalizations pinned raw; swap-variant rejected (82dB); q!=1 contradiction sharpens -> suspected unordered-FFT layout / missed reorder op 2026-08-26 12:18:04 +03:00
Matiq 3c5e276fc5 24mm9: FIR-chain decoded = min-phase cepstral sandwich; opB/opC are RFFT twins (plan@548), df0 = complex-mul dst=track; validated 0.0065 dB median over 60 clean frames; gamma = 1+s_F(q), q~0.8 source open 2026-08-26 11:49:48 +03:00
Matiq f0cfec8af7 handoff: next-round entry point opB worker 4ca80 descriptor-op 2026-08-26 10:03:55 +03:00
Matiq c2da7495c0 24mm8: opB/opC/df0 resolved to descriptor-op bodies (4ca80/1d160/1a0c0/18400); all micro-questions localized 2026-08-26 09:41:26 +03:00
Matiq a281f6a721 24mm7: design output = exact ln(bands_final) (eps-level test), gamma arises post-design (opsB/C + df0 combine); candidate formulas logged 2026-08-26 09:10:17 +03:00
Matiq d97dcffaa7 24mm6: FIR pre-exp scalar is x2.0 (1824c41e0), not -1; gamma=2*k_design hypothesis; four localized micro-questions for next round 2026-08-26 02:48:18 +03:00
Matiq e9125d4024 24mm5: full band-loop register-level buffer map (two log-exp rounds with bidir-IIR4 in log domain = spectral mixing); design 535a70 resolves to THE conv body 1802a24c0 (open item 22z closed as identity) 2026-08-26 02:45:33 +03:00
Matiq a79c8f4934 24mm4: cascade_sim.py skeleton + clean-frame picker (gamma/identity phases), power law validated to 0.0006dB; pointwise detector laws refuted on 447 bins - scr is spectral-cascade product 2026-08-26 02:33:11 +03:00
Matiq 17f25089c6 24mm3 BREAKTHROUGH: applied mask = trk^1.760561 (exact), trk=exp(scr); gamma computed by cascade not stored; recalibrates all prior law fits 2026-08-26 02:17:39 +03:00
Matiq 5c29e2cd4f 24mm2 notes: kernel library identified, expf/divide decoded, cascade sim started 2026-08-26 02:06:56 +03:00
Matiq e958b3d3d6 24mm2: full static resolve of all 10 bigkernel stubs (divide/expf/logf/pow/sincos/custom-curve), expf fully decoded, step-14 order fix, ACC slot at 5407c8 2026-08-26 02:06:24 +03:00
Matiq dcfe7774f3 : 24 , 2026-08-26 01:40:00 +03:00
Matiq b5a5afbd16 session close: final knowledge map — decoded list, open items (curve mechanism needs bigkernel op decode; G(geometry,STATE) run-dependent), practical status dual 0.193 2026-08-25 23:43:09 +03:00