Compare commits

..
271 Commits
Author SHA1 Message Date
Matiq 627c35dd53 AGENTS.md: document new env flags (RT_CASC/IIR4/KMAP/DELTA), chain wired status, capture proof
- Add RT_CASC, RT_IIR4_GEN, RT_IIR4_C/TAU/P/MULT/SR, RT_FIR, RT_FIR_Q,
  RT_KMAP_FC, RT_DELTA_DIST, RT_DELTA_STATE, RT_DBG_CASC to env flags table
- Update chain_9_19 section: WIRED+GATED (was CRITICAL)
- Add capture proof section: rendersnap2.py + /tmp/opencode/ datasets
- Remove outdated PTRACE live-dump hazards (superseded by /proc/pid/mem capture)
2026-09-03 14:11:19 +03:00
Matiq 3fe44255fa Δ-rule: distance-aware gain wired (default flat), ph*.npz capture proof
- delta_gain(bin,kfc,nbin,dist)=1+(|bin-kfc|/nbin)*RT_DELTA_DIST, default 0=identity
- delta_mark stores per-bin gain (was 0/1), applied as dm*vlaw_delta
- Calibration from rendersnap2 capture: dual@2000 g≈1.6, but default kept 0
  until multi-case validation (BLOCKMAP:285 confirmed: chain runs in render)
- Guard: corpus --compare d=+0.000, vlaw_check PASS
- Captured datasets in /tmp/opencode/{rendersnap2_dual,snap_t1k_b1f_1000,...}
2026-09-03 00:21:33 +03:00
Matiq a96e46bb69 NOTES_LEVEL: ph*.npz capture proof — rendersnap2 works, mask chain runs in render window 2026-09-03 00:04:23 +03:00
Matiq a562f6f56a NOTES_LEVEL 25b: Δ-rule wired, calibration blocked on ph*.npz 2026-09-02 23:51:04 +03:00
Matiq c85b888745 Δ-rule: wire distance-aware template-local gain (calibration blocked on ph*.npz)
- delta_gain(bin, kfc, nbin, dist_factor): 1 + (|bin-kfc|/nbin)*RT_DELTA_DIST
  — template-local (farther peaks → deeper cut), dip width const
- delta_mark now stores per-bin gain (was flat 0/1); applied as dm*vlaw_delta
- Default RT_DELTA_DIST=0 → identity (no regression)
- Gated: bridge 1.594, structural 2.689 unchanged; unit checks PASS
- Calibration of dist_factor and STATE-dependence blocked on ph*.npz capture
  (BLOCKMAP:285 — mask chain runs at load time, wine DR EIO)
2026-09-02 23:50:19 +03:00
Matiq a881ee280a AGENTS.md: add vlaw_check to test target list 2026-09-02 23:20:29 +03:00
Matiq 2f854cd1da spectral: vectors instead of new[]; vlaw: extract law + vlaw_check target
- spectral.cpp: window_/buf_/tmp_buf_/fir_buf_/fir_freq_ as std::vector (no
  exception-leak in ctor, destructor = default)
- framed_model.hpp: extract vlaw_cut/vlaw_mask inline (BLOCKMAP:314 softplus)
- dsp/vlaw_check.cpp: unit test for law (monotonic, zero-level, delta, ref,
  comb-neutral) — PASS
- CMake: add vlaw_check target
- Guard: corpus --compare d=+0.000, fn529fe0_check PASS, twin_check PASS
2026-09-02 23:19:34 +03:00
Matiq e4c53480ad audit fixes: dead conditional, DBG_CASC gate, dup loop, fft comments, blend doc
- framed_model: remove `if (pool_w > 0 && !lut_off == false) {}` (empty body)
- framed_model: gate DBG_CASC fprintf behind RT_DBG_CASC (was per-frame spam)
- framed_model: document f6f8 blend 0.8 (decomp 0x5406f8, xmm10 @1824c3e28)
- framed_model: assert(spectrum != nullptr) in processFrame
- spectral: remove duplicate upper-half zero loop in buildFirFromMask
- fft: comment scaling difference (1/N canonical vs 2/half plugin convention)
- Guard: bridge corpus --compare d=+0.000 (exact parity)
2026-09-02 22:37:09 +03:00
Matiq 197f5edea4 k-mapping: dedup to k_mapping_factor helper, add RT_KMAP_FC
- Extract k_sens (linear 6->0.44, exp 12->22.0) + k_q log-interp 0.5->1.0 2.0->0.403 into helper
- Replace duplicate blocks for lvl_in/raw_level with single call
- Add k_fc=1.0 + opt-in RT_KMAP_FC via W_eq (gated)
- Gates: bridge 1.594, structural 2.689 (RT_KMAP=1 same, no regression)
2026-09-02 21:50:38 +03:00
Matiq b41d7a40cb chain: wire IIR4 generator (RT_IIR4_GEN) + add chain smoke test
- iir4_bidir: env-gated generate_iir4_coefs (C/tau/p/mult/sr) vs proxy kIIR
- fix exp sign: up=exp(-c*g*tau/mult) → down=1-up in 0..1 (was Inf)
- fn529fe0_check: chain_9_19 smoke + generate_iir4 smoke (down0=1 up0=0 ok)
- Gates: bridge 1.594, structural 2.689 (RT_CASC=0) unchanged
2026-09-02 21:38:44 +03:00
Matiq f2cc0aeaa9 recalibrate: continuous per-fc lerp + additive sens for VLAW (task #1 staged)
- 800-1200 q<1: lerp 5.0/0.4→4.5/0.35 vs discrete 5.0/4.5/4.0 (block 283-287)
- sens: additive offset (6→-0.48, 24→+0.5) vs overwrite erasing fc choice
- Verified: bridge 1.594 unchanged, structural 2.689 stable (requires campaign.py per-fc fit for <0.5)
- Gated RT_CASC=0, no regression
2026-09-02 20:25:12 +03:00
Matiq 2201a57ffa docs: update structural baseline 0.341 -> 2.689, document chain gated
- README: status 2026-09-02 chain919, bridge 1.594 canon, structural 2.689 (L/R e343b0a, RT_CASC=0), hist 0.341 unreachable
- prd.md: sync status, build table, current status 7 with RT_CASC 0/1 columns
- Chain 9-19 blocked on ph*.npz/live-dump (BLOCKMAP:285)
2026-09-02 20:13:15 +03:00
Matiq 96816f9921 chain_9_19: add IIR4 generator (FUN_180533340) + integrate in audio path
- Add generate_iir4_coefs() — frequency-dependent warp coefficients from BLOCKMAP:135-150
- Integrate chain_9_19 in process_band_structural via RT_CASC=1 env gate
- chain_9_19 now runs full pipeline: LOG#1→DIVIDE→dc40→FMA→EXP#1→track→warp→LOG#2→IIR4×2→FIR→EXP#2
- IIR4×2 uses double precision (movsd/mulsd per disasm)
- FIR min-phase (52b3cd) enabled
- Canon bridge 1.594 unchanged when RT_CASC=0
- Requires live-dump or ph*.npz capture for input format calibration
2026-09-02 18:25:14 +03:00
Matiq 2a295af6f3 chain_9_19: integrate into audio path with RT_CASC env gate
- Pass track_[b] from FramedDetector to process_band_structural
- chain_9_19 called when RT_CASC=1, otherwise identity (warp path)
- Uses unity track (calibrated via live-dump)
- Canon bridge 1.594 unchanged
- Requires calibration of input format for structural chain
2026-09-02 18:12:10 +03:00
Matiq 9ed22d3476 chain_9_19: enable IIR4×2 (double precision) + FIR min-phase. fix haar test
- chain_9_19: add track parameter, enable iir4_bidir_340510 and fir_min_phase_52b3cd
- iir4_bidir_340510: use double precision (movsd/mulsd per disasm)
- Fix haar_one_pass test: boundary = 0.5*(a[n-2]+a[n-1]) = 8.0 not 8.5
- All fn529fe0_check tests PASS
- Canon bridge 1.594 unchanged (chain gated by RT_CASC env)
2026-09-02 18:05:14 +03:00
Matiq e343b0a0d0 prd.md: project requirements document. render48k L/R stereo baseline
- Add prd.md (293 lines): project overview, repo structure, build system, DSP architecture, env flags, corpus, status, references
- render48k: current L/R stereo version, TOTAL 2.835 (requires parameter tuning vs canonical 0.341 VLAW dual-solution)
2026-09-02 17:42:51 +03:00
Matiq e9d6f2ca72 render48k: stereo/M/S support (decode, link=100%, balance, depth, mix). TOTAL 2.46 (needs parameter tuning vs plugin reference) 2026-09-02 16:43:21 +03:00
Matiq 59fcb7eb56 wine_ptrace_trace: add chain breakpoints + live-dump chain I/O (DIV confirmed: input is VLAW output 0-17.6, tmp6f8 ~0.8) 2026-08-31 01:05:28 +03:00
Matiq 9d10169157 revert chain_9_19 to working 0.314 baseline. document chain I/O unknown as blocker 2026-08-31 00:29:08 +03:00
Matiq c23646d74f revert chain_9_19 integration: architectural mismatch (single-shot vs block-based ACC). keep 0.314 baseline 2026-08-31 00:13:05 +03:00
Matiq d80137c31d chain_9_19: accVec iteration update, fmt cleanup 2026-08-30 23:23:31 +03:00
Matiq 281f4079c2 VLAW: compact per-fc/sens params (no lambda), comb early-return, keep 0.314 2026-08-30 23:21:12 +03:00
Matiq 22ff0e3ee9 VLAW: compact per-fc/sens params (no lambda), comb early-return, keep 0.314 2026-08-30 22:24:05 +03:00
Matiq c393b6f6be C6 LUT CAP -13.78/68/0.344 -> -24/28/1 live 180563a60 24z, keep 0.314 2026-08-30 18:19:23 +03:00
Matiq 7b479f5357 B1/B2: ACC table double-deref 5407c8 + chain_9_19_sim op-by-op (BLOCKMAP 620-644) 2026-08-30 18:07:15 +03:00
Matiq 359aaeb7cb baseline 0.314 live q0.80022 FIR enabled (was 0.341) 2026-08-30 16:38:04 +03:00
Matiq a208d1b27e q live verified 0.80022 1820013f0 via ptrace, keep FIR enabled TOTAL 0.314 2026-08-30 16:33:38 +03:00
Matiq a8191d4bc9 FIR: enable by default (q0.80022), TOTAL 0.314 keep, ptrace EXP/DF0 live confirmed 2026-08-30 16:23:18 +03:00
Matiq 6bf2363c1a DIVIDE poly: fix truncated poly_0 0.207*8 -> 9 coeff 0.207/-0.241/0.288/-0.36/0.48/0.24/0.055, Q 0.80022 2026-08-30 16:05:32 +03:00
Matiq 8fbbb66e3c q: refine 0.80 -> 0.80022 from .rdata 1820013f0, RT_FIR_Q env, keep TOTAL 0.314 2026-08-30 15:59:40 +03:00
Matiq 4411e617a6 tune t1kq_800 5.0/0.4, TOTAL 0.314 max1.03 (was 0.324) 2026-08-30 15:12:03 +03:00
Matiq 6f32b26d6a tune per-fc VLAW t1kq_1200 4.5/0.35, TOTAL 0.324 max1.03 (was 0.341 max1.17) 2026-08-30 14:12:27 +03:00
Matiq d88e8ab7bf FIR via FFT RFFT fast + FMA half-split exposed, keep TOTAL 0.341 (q0.80 gated) 2026-08-29 21:33:54 +03:00
Matiq 1d6c5a4355 FIR min-phase 52b3cd RFFT gated RT_FIR + FMA ATT/REL half-split, keep TOTAL 0.341 2026-08-29 20:13:38 +03:00
Matiq c7d6fde2dc I: IIR4 bidir 52af09 kIIR_A1/B1 A2/B2 wired, keep TOTAL 0.341 2026-08-29 18:23:59 +03:00
Matiq e39c97e014 chain LOG#1/2 140980 logf, keep TOTAL 0.341 2026-08-29 17:30:18 +03:00
Matiq a7e1a661bd divide 1803a06a0 proxy + expf bit-exact, keep TOTAL 0.341 chain 2026-08-29 17:28:03 +03:00
Matiq 9311e7397f B: wire real kWarp/kRTAtt/kRTRel into chain_9_19, keep TOTAL 0.341 2026-08-29 16:46:55 +03:00
Matiq 85317ed674 A: expf fmaf 180296c80 + rt_div_tables vpermps dump 2026-08-29 16:12:03 +03:00
Matiq 5e8c3d8af4 wire chain_9_19 RT_CASC_CHAIN gate, keep TOTAL 0.341 2026-08-29 16:06:07 +03:00
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
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
Matiq 87f00ce181 24kk3: SLOT 540668 IS POLYMORPHIC — holds two float scalars (~0.43,2.0) between processing phases, pointer-to-FIR during callbacks; explains missing 668 in all new captures; GUI-curve slot 540678 matches audio ±5% 2026-08-25 14:35:10 +03:00
Matiq c210a778e5 24ii3 FINALE: unified per-peak-gain law — cut=alpha*ln1p(g_k*L_k/beta)+c with g(fc)=1, g@2000=12.15 (tt-run) BUT g varies between runs at same geometry => g=G(geometry,STATE); STATE=[ctx+540788] readable; final roadmap to bit-exact defined 2026-08-25 13:54:36 +03:00
Matiq 0677a390d2 24ii2 BREAKTHROUGH: [ctx+540788] = DETECTOR SPECTRAL STATE (smoothed input estimate, content-dependent, stable within run); corrects 'static template' misread; explains alpha(content), sens plateau, cross-peak redistribution — the missing second argument of the law 2026-08-25 13:40:38 +03:00
Matiq 94116e2a17 24jj2: R@540788 is BANDPASS-shaped (peak ~3.5-4kHz) fundamentally unlike our monotone twin — equal-loudness-like weighting hypothesis; explains all far-bin anomalies at once; exact entry form of weighting TBD 2026-08-25 13:19:54 +03:00
Matiq d2f67016ab 24ll3: per-bin am/res paradigm REFUTED for off-center peaks — unified res^p fit hits lower bound (wants NO res dependence), yet cuts grow monotonically with res at equal am; two-argument structure or full cascade required; multi6 dataset is the validation target 2026-08-25 12:57:18 +03:00
Matiq b85b344e23 24ll2: multi6 dataset — SIX notches one run (self-consistent); cut GROWS with res (2.33->7.18), independent of am (first four tones equal am!); rejected floor/power models; perfect validation target for cascade simulator 2026-08-25 12:54:25 +03:00
Matiq def7cea522 24nn: SESSION FINALE — per-peak softplus laws ultra-clean (pk2 rms 0.0006!), shared alpha~3.3, beta2 10x smaller than beta1, level-scale x11.6 const; CROSS-RUN absolute comparisons UNRELIABLE (state selection) — within-run series only; campaign tools complete 2026-08-25 12:32:23 +03:00
Matiq f365fa8451 docs: full documentation refresh post-24kk2 — README status (application decoded to formulas, dual 0.193), AGENTS phase header + env-flags/tools tables, NEXT_PROMPT rewrite (cascade simulator + campaign recipes), PLAN/roadmap gate=BIT EXACT decision recorded 2026-08-25 12:18:32 +03:00
Matiq 0fee9238dc 24kk2: clean distance-series data (non-monotone below-single at small d = depth redistribution); cascade simulator with guessed forms does NOT close (rms 0.42-0.49) — op-by-op transcription per dataflow 24hh/24ii is the defined path; session consolidated 2026-08-25 12:06:18 +03:00
Matiq 77c02c8f9d 24mm: distance series captured (cuts depend on 2nd-tone distance, confirming local mixing); w(d) inversion needs cleaner methodology (peak-window/domain issues documented); raw data preserved 2026-08-25 11:39:10 +03:00
Matiq 0dfff22efb 24ll: alpha(content) LOCALIZED — far second tone (@4000, both 0dB and -12dB) does NOT affect alpha (1.075-1.110 vs 1.153); mixing is template-local via res-weighted freq-IIRs; distance-kernel series is the next campaign cell 2026-08-25 11:22:45 +03:00
Matiq 4f79f83c11 24kk: Q-INDEPENDENCE PROVEN — law constants identical for q=1.0 and q=0.5 at fc1000 (alpha/beta/c match to 3 decimals); g_s12 anomaly = louder input file (tone1k 2.28x); campaign tool added; remaining axes: content-tones (alpha doubling) and fc 2026-08-25 10:53:00 +03:00
Matiq bf3faab660 24hh2: gate set to BIT EXACT (user decision); g_s12 datapoint captured (fc1000 q1 s12: audio=scratch+(-0.11dB) confirms direct-mask at fc1000 too); parameterization campaign table drafted 2026-08-25 10:48:05 +03:00
Matiq c33212c21b 24jj: BIGKERNEL BODIES FOUND via runtime IAT resolve — 1803a06a0/180296c80/180323f20/1802dc0e0, real math functions with x87 transcendental pair (exp family); iat_name.py v2 with double-deref+PE exports 2026-08-25 10:29:06 +03:00
Matiq 483f52f296 24hh-2: runtime dispatch tables STABLE (=static); bigkernels resolve to IMPORTS (outside dump); iat_name.py PE-export parser drafted (needs SIGSTOP race fix); once named, full cascade simulator becomes implementable 2026-08-25 10:16:48 +03:00
Matiq 8ef1d4ec73 24ii-cont: bigkernel bodies behind NESTED dispatch (packer) — static unwrapping ends; runtime table-dump after init noted as the extraction path 2026-08-25 09:58:49 +03:00
Matiq 0943471b33 24ii: th2000 CORRECTED to elementwise array-multiply (not axpy); steps 13-16 decoded — mirror branch, centering -1, bigkernel, *track, *warp; pipeline structure coherent 2026-08-25 09:57:35 +03:00
Matiq 2d6bdcf967 24hh: exact dataflow steps 9-12 decoded — vec698 zero, vec6f8+=0.8 baseline, combine vec6f8=bands-ACC confirmed from dc40 body; correction-curve architecture identified; steps 13-19 next 2026-08-25 09:55:04 +03:00
Matiq 83c12d9b3d 24gg: step-12 CORRECTION — th1b80 is MEMCPY not add (6840->1a5a0->181a646c0 pure vmovdqu); resonance hypothesis needs revision pending full steps 9-19 dataflow pass 2026-08-25 09:46:09 +03:00
Matiq feaa82957a 24ff: step-11 fma semantics — triplets (re,im,coef): f6f8 += att/rel_coef * ACC_i (upper/lower halves); ACC persistent leaky integrator with static per-freq coefs (gain 2.57-3.42); possible source of level amplification anomalies 2026-08-25 09:45:04 +03:00
Matiq 0fbff6dc6e 24ee: variables SEPARATED — softplus form universal (3 independent calibrations rms<=0.016), alpha grows with tone count (1.15->3.22 for 1->2 tones: freq-mixing in steps 9-19); audio=deepest-scratch+const across ALL families; dual two-stage was two-tone artifact 2026-08-25 09:21:44 +03:00
Matiq 61219acca6 24dd: clamps refuted by refs (gradual q variation); saturation LOCALIZED in frontend — plugin template gain FLOORS at res~0.153 @fc1000q1 (ours falls to 0.0069 by s24, 22x deeper); law itself correct; next = twin/am module formula decode 2026-08-25 08:56:20 +03:00
Matiq 10d8c1cf5a 24cc: exact coef-gen formula pinned — exp_arg=|c|*g/n with n=2049 ([state+8] live-verified all three states); saturating form; default down-coefs 0.003-0.19 (gentle, cascade-only effect) 2026-08-25 08:42:00 +03:00
Matiq d4c56bdfce 24bb: P1 complete — simple maps rejected (k non-constant, smoothing naive-form ineffective, B!=am, parametric bump rms 4dB); NEW FACT: notches are FLAT-TOPPED symmetric about fractional peak position; asm re-check shows extra *g in 533340 coef gen missed by transcription — next round priority 2026-08-25 08:39:41 +03:00
Matiq 2fb0e640e0 24ab: opB dispatcher structure documented (subtag kernels + Hermitian repack); ops A-D PARKED as buffer-level-only (audio=exp(scratch) proven; VLAW real-mask corpus 0.193); session consolidation 24j..24ab 2026-08-25 02:31:22 +03:00
Matiq 47c5360ac2 24aa: 563a60 confirmed GUI-branch (detector-LUT params absent from audio-instance memory — full rw-scan); audio-path level compression lives in step 1-19 op semantics (bigkernels/fma/combine); memory-scan tools added 2026-08-25 01:42:16 +03:00
Matiq 65ee61d540 24z-2: rendersnap2 v6 attempts band-object LUT capture (A/B/gamma) — ctx+0x540678 is curve data not object ptr; band-object array discovery is next session opener 2026-08-25 01:28:26 +03:00
Matiq 676d43d40a 24z: FUN_180563a60 FULLY DECODED — detector LUT builder: dB=ln(x)*8.68589; t=(dB-A)/(B-A) clamped; out=0.5*t^gamma (+ symmetric 2t^g-1 mode, + virtual dispatch); A/B/gamma live in [band+0x180] object — the level-compression stage found materially 2026-08-25 01:26:05 +03:00
Matiq 8a4e7a3c54 24y: law validated on fc500-q2 (-0.06dB, extends beyond calibration); plugin LEVEL saturation discovered (impl plateaus 15.47 at sens18/24, 49.9 at q>=2) — LUT FUN_180563a60 is prime suspect for the compression stage 2026-08-25 01:24:34 +03:00
Matiq 243ea03a45 24x: structural diff table (plugin unity-passband+narrow dips vs canon blend+warp smear — VLAW bypass structurally correct); k-mapping table of effective levels across configs (k=0.403 const for q>=2, exponential in sens) — frontend decode is the remaining bit-exact closure 2026-08-25 01:20:29 +03:00
Matiq 4b94ce5c15 24w-3: live constants of FUN_180533340 — p=[54087c]=1.0, tau1=1200, tau2=180, mult=360, C=1000; body formula asm-confirmed; single bidir pass does NOT move curve centers (q-dependence lives elsewhere in steps 9-19) 2026-08-24 22:35:13 +03:00
Matiq 5284ce2b57 24w-2: scalar combos of lvl/res rejected for cross-config law (q enters via mechanism — freq-IIR coefficients from FUN_180533340/selectivity); our twin res@center q-independent, sens-dependent confirmed 2026-08-24 22:32:32 +03:00
Matiq cf38622995 24v: STFT layer solved — NO synthesis window (partitioned-conv architecture); dual corpus 0.193 mean/0.438 max (was 3.264); RT_SYN/RT_WIN env options; remaining: q/sens parameterization of law constants 2026-08-24 22:29:56 +03:00
Matiq edf6f35cdf 24u: engine ctor init-map — sub-inits 5335c0(x2)/534550(x5) consume cfg chain from stack; next: decode 534550 bodies + WIN_WINDOW usage xref 2026-08-24 22:18:41 +03:00
Matiq abbee308ba 24u: WIN_WINDOW decoded structurally — fade 0.5->0.8 over EXACTLY 2049 samples (=kernel bin count) then unity to 8193; block 8192 hinted by cfg; non-canonical taper (embed table verbatim) 2026-08-24 22:17:52 +03:00
Matiq da0393bd93 AGENTS.md: current-phase header updated to post-24t state (application decoded, VLAW v3 status, remaining gaps) 2026-08-24 22:13:52 +03:00
Matiq 5bd60cfefd 24t: exact semantics th2030=mul / th2270=add (with special cases); FUN_180563a60 identified as init-time dB-domain table builder (log x 8.68589); LUT-form vs softplus both fit drive series — decomp required to discriminate; disasm_func.py tool 2026-08-24 22:13:01 +03:00
Matiq 0bc8427cd7 24s: APPLIED LAW DIRECT — cut_dB=3.2193*ln1p(lvl/0.4927)+0.54, rms 0.016dB; audio==exp(deep scratch) proven both tones; buffer FIR is intermediate (min-phase packed); RT_VLAW v3 9.47/11.16; STFT layer is remaining -0.85dB 2026-08-24 22:00:31 +03:00
Matiq a309ca3e31 24r: track slot static (not the 2nd stage); DTFT test — deep kernel matches ref at center (10.63 vs 10.32) but fails at skirt => consumption packing via ops A-D is the last undecoded piece; patchparam param-map obtained 2026-08-24 21:52:33 +03:00
Matiq 4b56e4f384 24q: controlled depth/mix sweep via patchparam.py — gamma0 INDEPENDENT of depth (1.760 const); blend hypothesis falsified (audio/steady ratio 1.6-1.86 at ALL mix, never 1); constant +0.4dB gap deepest-capture->audio; RENDER_FILE clone hazard documented 2026-08-24 21:49:34 +03:00
Matiq 3062a02389 24p: stage ratio pointwise-constant 1.760+-0.011 across all bins (pure scalar dB-stage); blend hypothesis gamma0=1+blend(0.8)=1.8 with testable mix prediction; s_corr_mix series incomparable (different input) — controlled mix variation pending VST-chunk tooling 2026-08-24 21:38:21 +03:00
Matiq a3d108f4d5 24o-2: global shape fit FAILED (rms 1.4dB, chaotic per-project scales) — saturation caps are config-specific; route forward = static decode of FUN_180533340/LUT/mix^p/double-exp; datasets preserved (mega_curves.pkl) 2026-08-24 20:48:45 +03:00
Matiq 5f822ebae1 24o: parameterization datapoints — qmap/sens series with correct center-bin; ref_cut==cut_D universally; sens saturation plateau 11.74dB (lvl x70!), law non-monotone in lvl across q configs; datasets committed to /tmp 2026-08-24 20:46:16 +03:00
Matiq 31cc5540e1 24n-2: Delta-branch implemented (peak+neighbourhood, two-pass); dual end-to-end 9.32/11.58 vs ref 10.32/11.82; VLAW corpus: dual 0.708 (was 3.264) but single-band groups regress — constants are dual-family-specific (q/fc dependence open); canon default verified 2.286 2026-08-24 20:33:40 +03:00
Matiq fc224b00a3 24n: unified stage-S law cutS=alpha*ln1p(lvl/0.3824)+Delta(b) — same beta both branches, Delta=+4.18dB at off-center content peak; RT_IIR12=0 critical (freq-IIRs smear dips); VLAW center 9.40 vs ref 10.32; ramp trajectory confirms gamma0 (+0.2dB lag) 2026-08-24 20:12:51 +03:00
Matiq b00a8a667e 24m-2: RT_VLAW=1 two-stage detector law implemented (formula verified in-code g=0.319@43); end-to-end gap traced to STFT application layer (WOLA mainlobe smearing vs narrow dip); stale-build hazard reconfirmed 2026-08-24 20:04:28 +03:00
Matiq fe01ef5bac 24m: TWO-STAGE detector — deep=gamma0 x shallow in dB, gamma0=1.79+-0.02 constant across bins/q/levels (explains 1.805/1.8345 family); skirt branch 7.57+2.70*ln(1+lvl/0.341) rms 0.22dB; 18 full-support scratch curves captured 2026-08-24 19:34:43 +03:00
Matiq 508b24125f 24l-2: live (scratch,FIR) pair proves FIR=exp(log(bands)) pointwise (+1%); log support LIMITED to bins 6..623 -> unity passband mechanism; applied = 1.019*B^1.8345 with B=band curve; detector M->B is the only remaining gap 2026-08-24 19:17:59 +03:00
Matiq 3a611cff35 24l: exact FIR-loop decode from asm — pre-exp sign inversion (div by -1, xmm13) + upper-half zeroing (xmm9=0); step-1 multiplier is NO-OP (xmm8=1.0); exp kernel behind IAT; ops A-D = descriptor-typed twiddle-FMA stages; disasm.py tool 2026-08-24 19:13:49 +03:00
Matiq 65fb983d57 24k-4: RT_FIRCONV=3 (application law 1.019*M^1.8345); rendersnap2 wav-path hazard fixed (RENDER_FILE parse, was destroying refs — dual_b1q_1.0.wav restored); corpus TOTAL 2.286 2026-08-24 18:37:30 +03:00
Matiq 1605e0ba29 24k-3: V = sum of independent narrow per-content-bin dips (no broad skirt, R-corr=0); center law cutV=1.7436*ln(1+lvl/0.3824) rms 0.045dB; skirt branch structurally steeper — unified law open; application law unchanged 2026-08-24 18:32:00 +03:00
Matiq 6dc2967e4a 24k-2: clean q-table of V — dip shape q-invariant (6-7 bins half-width forall q), q lives in broad skirt component Wq; two-component model V=D(f)*Wq(f) 2026-08-24 18:05:02 +03:00
Matiq cc8ba34577 24k: application law EXACT — cutA=1.8345*cutV+0.1615dB (rms 0.0025dB, 8 drive levels); x1.805 = exponent product 0.984x1.8345; single instance confirmed; R-slots static; probe-multitone method 2026-08-24 18:02:28 +03:00
Matiq 6629e8bbf2 24j: applied response == live FIR per-bin (x1.805 revoked as stale-kernel phantom); R-slots static twin template; rendersnap2 soft snapper + probe-multitone method 2026-08-24 17:35:27 +03:00
Matiq 475b1958d5 fix: corpus 24-bit loader + LUT calibration env var
- Fix reshape error in corpus.py 24-bit WAV loader (misaligned data)
- Add RT_LUT_CAL env var for LUT output calibration
- Corpus results: TOTAL 2.397 (bridge 1.594), comb improved (-4.032)
- Structural chain regresses on t1kq/t1k/al/dual due to LUT curve mismatch
- The LUT produces different frequency response than plugin's FIR construction
2026-08-24 15:18:39 +03:00
Matiq a1632a9fce fix: persistent IIR state eliminates ×1.805/×2.44 gaps
Root cause: IIR accumulator reset to 0 every frame, losing temporal state.
Fix: static thread_local accumulator persists across frames.

Results (dual_b1q_0.5, reaper render):
  cut@500 = -10.32 dB (EXACT match, was -14.35)
  cut@2000 = -11.82 dB (EXACT match, was -6.58)

Both the ×1.805 (OLA normalization) and ×2.44 (mask computation) gaps
were caused by the same root issue: IIR state reset.
2026-08-24 14:31:55 +03:00
Matiq 0e4d3177fe feat: ×1.805 confirmed — OLA normalization factor (24i)
Steady-state simultaneity test: 60 captures, mask constant at 0.5099,
fir constant at 0.5241, actual cut -10.32 dB.
Ratio actual/fir = 1.839 ≈ ×1.805 from 23e/24e.
Two independent error sources identified:
  1. Mask computation: 0.209 vs 0.510 (×2.44, LUT issue)
  2. Application: per-bin vs FIR convolution (×1.805, OLA)
2026-08-24 14:23:39 +03:00
Matiq 2c99a4fc96 feat: consumer identified (th_b3c0), scan3.py, RT_FIRCONV/RT_FIRPOWER
- th_b3c0 (0x18000b3c0) = pure complex multiply FIR × audio in freq-domain
- scan3.py: pre-scan approach finds ctx in 1.5s, multi-instance detection
- RT_FIRCONV=1: FIR from mask + complex multiply (spectral.cpp)
- RT_FIRPOWER=1: power-law mask from raw spectrum (framed_model.cpp)
- Root cause: plugin uses FIR convolution (OLA), not per-bin multiply
- Live captures: FIR@43=0.524, mask@43=0.510, final gain=0.305
- Best result: RT_LUT_OFF gives cut@500=-8.18 dB (ref -10.32)
- NOTES_LEVEL 24e/24f/24g appended
2026-08-24 13:52:52 +03:00
Matiq 03777fdaee docs: NEXT_PROMPT.md — session handoff prompt (post-24d state, priorities, environment hazards, control numbers) 2026-08-24 09:48:29 +03:00
Matiq 135f0e9f21 24d: round stop — two-instance hypothesis untested (scan2.py debugger mismatch vs rendersnap documented); consumer hunt state fully recorded: static xrefs exhausted, dynamic traps blocked under wine, conv engine object identified, glue method pending decode 2026-08-24 09:43:58 +03:00
Matiq 77e294d445 24c: live per-frame processing PROVEN by clean content-switch experiment (seq A/B halves show different cuts: 21.91 vs 25.74 dB @2000) — retracting 23k build-once conclusion (instrumentation blindness: wine holds HW BP slots); methodology fixes documented (partial-output trap, LOOP=1 render bounds) 2026-08-24 09:16:00 +03:00
Matiq a9f1bd365b 24b: full module vtable mapped (setters confirmed: 52ba20 flag->full rebuild via 52e9b0, 52baa0 writes 0x54088c expf scalar used by FIR loop); conv engine is non-virtual direct-call object — its process method lives among callers of dc30/fe00 in 52d650..532xxx range 2026-08-24 02:44:34 +03:00
Matiq f483fe398d 24a: perf_event breakpoints definitive — wine reserves HW BP slots (ENOSPC on wine threads while self/cross-process native opens succeed), closing hardware-trap route and explaining all prior ptrace-DR silence; FFT-conv engine object identified at ctx+0x540530 (inline cfg {2,4096}/{16384,8192}, member vectors +0xb8..+0x130, methods dc30/fe00/dd30) — its process method is the kernel consumer candidate 2026-08-24 02:43:04 +03:00
Matiq 8acbf6612e 23m: round final — DR-trap delivery anomaly under wine threads documented (near-zero stops despite verified arming and confirmed module execution); full stop-logging added to fnexec; roadmap to bit-exact fixed: G-form via stabilized series, consumer via init-family decode or perf_event HW breakpoints, then RT_FIRCONV gate 2026-08-24 02:30:19 +03:00
Matiq 56edd3c0f4 23l: DR exec-watch verified working end-to-end by micro-test on this kernel (SIGTRAP+DR6 correct); contradiction isolated to process/thread targeting in tracer, single remaining hypothesis documented with debug protocol 2026-08-24 02:22:55 +03:00
Matiq baafbb6dc6 23k: HW exec-breakpoints operational (correct offsets, RF-flag pass, clone inheritance); clean run proves decoded chain does NOT execute in steady render — kernel built ONCE on param-change in <100ms window after instance creation; transcription implication: rebuild kernel only on setParams; full capture recipe documented 2026-08-24 02:08:30 +03:00
Matiq 9e85b730b2 23j: multi-register watchpoint definitive negative — zero hits even on mandatory-hot words (overlap/R/lock) across confirmed renders with 8/8 threads armed; HW data watchpoints not delivered under wine threads here — route closed, pivot to static table-index scan 2026-08-24 01:56:15 +03:00
Matiq 25b736b2bb 23i: hardware watchpoint infrastructure working (u_debugreg base 0x350, LEN8 rejected -> use LEN4, DR6 reset documented); zero hits on kernel word — consumer may read a copy or builds early; fnwatch.py committed 2026-08-23 23:31:26 +03:00
Matiq 05caf1eb44 23h: kernel-consumer hunt — no direct readers of FIR data outside 529fe0 (init-only xrefs); bp on loop end silent in render => duplicated chain instantiation suspected; active RIP sampler fnsample.py working (2.4k in-module samples, MSVC stackfill dominates steady state; core leads 52e1c0/534580 on param phase); yabridge stale socket dirs break respawn — documented 2026-08-23 23:01:19 +03:00
Matiq c3656975dd 23g: amplitude sweep attempt inconclusive (phase-stability control needed); scripts committed 2026-08-23 22:30:39 +03:00
Matiq 70cafc1700 23f: live scratch series across q sweep (11 configs) — center strictly constant over q, x1.805 hits real cuts within 0.14dB at both known points, scr171(res) nonlinear consistent with 22x exponent; detector smoothing located between raw bands[] write and DESIGN (raw blinks 0.3..382 while scratch steady) 2026-08-23 22:27:13 +03:00
Matiq 7902acfbb8 23e: law closed quantitatively — FIR=exp(0.984*scratch) pointwise; real/FIR cut ratio constant 1.80 across configs and bins (linear post-scale, EMPIRICAL until conv-stage decoded); center independence of q proven live (scratch43 -0.6565 vs -0.6551); skirt shift matches within 3% (1.46 vs 1.50 dB) 2026-08-23 22:19:05 +03:00
Matiq 3a0a38467b 23d: BREAKTHROUGH — live kernel captured via SIGSTOP sampling of offline render (rendersnap.py); bands[] input to DESIGN is the raw per-frame signal spectrum (Hann lobes at tone bins only!), captured FIR shows skirt cut deeper than center exactly as real output (0.473@2000 vs 0.524@500) despite R-curve claiming otherwise; am/res structure confirmed with twin template as divider; recipe for exact ops formula next round 2026-08-23 22:11:33 +03:00
Matiq 0a45661a25 23c: negative feasibility — symmetric log-domain convolution cannot reproduce dual skirt geometry (best 0.94dB err at absurd 324-bin width); narrows mechanism to non-symmetric ops / true bands[] input / temporal coupling; capture recipe for DESIGN-input dump documented 2026-08-23 21:09:14 +03:00
Matiq b8d5f83fc5 23b: mask->FIR chain decoded — DESIGN body is vectorized LOG2 of band curve (poly fingerprinted), WIN_freq identified as periodic Hann(4096) falling half applied to FIR[n/2..n), full ILT stub->impl table resolved offline (ilt_resolve.py), live buffer catalog extended (SIMD lane masks at 0x540598, complex identity reset between callbacks, overlap buffer at 0x5406f8 non-zero), plugin output proven nondeterministic across renders (LCG dither) — spectral metrics only; ptrace lab scripts + lessons (TRACECLONE before CONT, sub-second host lifecycle under -renderproject) 2026-08-23 20:59:54 +03:00
Matiq 07cd4b7dc0 23a: docs sync to post-22z state — AGENTS header/open-gaps/key-files and BITEXACT_PLAN entry-point updated: priority #1 = bands[] input semantics (static decode of conv body or in-callback trace), canon stays LAWAFFINE 7.4/1.85 TOTAL 1.931, refuted branches documented 2026-08-23 19:00:44 +03:00
Matiq 738ffccad4 22z: mask->FIR call sequence decoded (535a70 thunk chain -> 1802a24c0 body; WIN_freq second-half segment multiply; FIR[0]=1,FIR[1]=0); IDFT-window-DFT spreading hypothesis NUMERICALLY REFUTED (max 2.6dB at skirt vs needed 11.8) -> dual skirt mechanics live in detector/template domain, not post-processing 2026-08-23 18:55:36 +03:00
Matiq 91101b2135 22y: live ctx capture pipeline works (scripts/dualtrace.py, realtime playback + chunked heap snapshot); found config-dependent reduction curves 0x540768/788/7f8 (peak follows band fc; 7f8 min exactly 1.0 => R=1/mask, notch-shaped); acc/f6f8 arrays ZERO in steady state; DECISIVE: applied filter != pointwise R (dual skirt 3dB vs real 11.8) -> FFT-conv wide-window spreading is the missing mechanism 2026-08-23 18:40:25 +03:00
Matiq 64beaa7131 22x: NO-alpha theorem — no res-exponent makes detector level consistent across families (dual needs alpha<0, fc-scans break at alpha<=0); dual-vs-q table: cut@center CONSTANT across q, skirt cut falls ~exp(-res/0.49) converging at res>=2 -> notch geometry lives in the fine-grid twin template (536300), not per-bin arithmetic; pointwise (am,res^alpha)+single-law class REFUTED 2026-08-23 18:04:47 +03:00
Matiq 13c2d028bf 22w: faithful mask-shaping chain v1 behind RT_FAITHFUL (fnfaith.cpp) — exact 180533340 freq-warped bidir-IIR coefficients (fc_bin=85@48k/4096, constants from dump); corpus TOTAL 5.315 but comb 2.57 best-ever; decisive: mask shape cannot balance dual tones -> level contrast is created by the DETECTOR (time-domain twin bank hypothesis priority #1) 2026-08-23 17:04:23 +03:00
Matiq 34156315e6 22v: full block map of FUN_180529fe0 from raw asm — 4 bidir-IIR states, per-band acc array [0x5407c8+i*16] confirmed (21b semantics), ILT thunk table resolved; coefficient generator decoded (530b60 + 533340): frequency-warped one-pole g=fc/i below crossover — the real mask smearing mechanism; full disasm f529fe0_full.dis (old was truncated at 52a813) 2026-08-23 16:47:51 +03:00
Matiq 79c11dc220 22u: raw-asm re-decode of FUN_180529fe0 — multiband pre-combine inside method, per-band scale->kernel->2x bidir-double-IIR (52d650 fully decoded, per-bin double coefs), band-state arrays 0x540768[i]/0x5407a8[i]; 0x5407c8 acc has NO runtime reader (21b addr wrong); offline bidir-IIR smoothing hypothesis REFUTED (monotonic degradation) 2026-08-23 15:53:58 +03:00
Matiq 376bd955c9 22t: two-factor laws REFUTED by descent (quad Q->0, resrp rp->0 — geometry already in lvl=am/res); real render of sim-optimum 7.6/1.694 = 1.898 with group regressions, canon stays; error budget: dual = 62% of corpus abs-error -> inter-band acc/f6f8 consumer is priority #1 2026-08-23 15:10:06 +03:00
Matiq 3857205a6b 22s: offline law-fit infra (full replay sim, 2s/corpus) — NO single affine (A,S) exists even on pure tones; family slopes 0.85-2.19, global LSQ resid 0.60 dB structured by rms/fc-dist; scalar law saturated ~1.87-1.93, canon stays HEAD 2026-08-23 14:36:27 +03:00
Matiq 3b9158e63e 22r: affine dB law (RT_LAWAFFINE) ported onto bare chain — TOTAL 1.931 beats canon 2.286; A=7.4/S=1.85 best, tradeoffs mapped 2026-08-23 11:01:42 +03:00
Matiq d160acaa27 22q: dual diagnosis — twin-divisor contrast refuted (real cuts both tones equally), saturating dB-curve hypothesis; pair-collection plan 2026-08-23 10:39:24 +03:00
Matiq 0aeedde019 22p: joint-fit grid — floor essential (without: corpus x2), optimum scale=0.90 TOTAL 5.215, comb beats canon first time; canon stays HEAD 2026-08-23 09:48:17 +03:00
Matiq d4e8d055c6 22o: RT_ENV=live (live-table envelope) — noise TF better, corpus neutral; new-arch best 5.386 vs canon 2.286; joint fit next 2026-08-23 03:52:12 +03:00
Matiq 0861a64387 22n: live ctx found (0x2370048, scalars config-dependent!), slow detector adaptation discovered (gain deepens over ~seconds, kRTrel tau~2s) 2026-08-22 22:33:16 +03:00
Matiq 709d8ce227 22m: user hypotheses tested — gamma!=delta (E1), BandConfig stable under depth/delta (E3), no level-path refs in SpectralProcessor methods (E4) 2026-08-22 21:56:46 +03:00
Matiq 98a35e8648 22l: pool5+scale1.144+floor hits tone floor -20.74 (real -20.72); corpus 5.9 — params need systematic fit; canon untouched 2026-08-22 21:33:31 +03:00
Matiq 355ce828f4 22k: bare exp2 chain CONFIRMED on white-noise probe; remaining tone gap = detector level scale x1.14 2026-08-22 20:58:18 +03:00
Matiq dee3864c3c 22j: white-noise probe — real TF is flat (warp not output multiplier), reduction is contrast-driven; adaptive-twin lead 2026-08-22 20:22:23 +03:00
Matiq bf8c12603c readme: sync to 22i — P5 status, floor blend*ln10/20, Step 7 refuted, detector front-end priority, new tooling 2026-08-22 20:02:11 +03:00
Matiq d43bbfe66b 22i: RT_LVL_CAP inert (model post-IIR levels ~1.06 << cap) — gap relocated to detector front-end amplitude chain 2026-08-22 19:51:56 +03:00
Matiq 94383b15d3 22h: floor law mapped — floor_dB(sens)=20log10(ln10/20)-(sens-6)/3, depth shifts too; exact anchor sens6=ln10/20 2026-08-22 19:46:22 +03:00
Matiq ef7d3f49c7 22g: NO-LUT test isolates gap to detector front-end; unified sidechain-clamp hypothesis (knee at 0dBFS, identical renders above) 2026-08-22 19:39:22 +03:00
Matiq 41b0d3c250 22f: floor discrimination via param bridge — dry/wet crossfade confirmed, floors=k*ln10/20, detector-cap hypothesis leads 2026-08-22 19:10:50 +03:00
Matiq 7febe744e9 plan: sync to 22e — Step 7 refuted, floor blend*ln10/20 solved, new priority Step 9 (floor mechanism) 2026-08-22 18:59:04 +03:00
Matiq 3970c1e309 22e: floor algebra solved — gain_floor=20log10(blend*ln10/20), matches -20.72dB within 0.006dB; lead FUN_180529c60 2026-08-22 18:54:48 +03:00
Matiq 9c14a74318 docs: 22d — hard gain floor -20.72dB mapped (t-clamp live confirmation); cold/hot discrepancy open 2026-08-22 18:40:13 +03:00
Matiq f5ef81667c bench: official param bridge (setparam/dump_params.lua) + rpp_setparam format tool; 22c — XML params decorative, depth=+-18dB, trim=+-24dB, reduction curves measured 2026-08-22 18:28:54 +03:00
Matiq 7fac8b2a4f step7: live BandConfig capture infra + FUN_180563a60 decode — GUI-only, audio path refutes premise (22b) 2026-08-22 15:28:01 +03:00
Matiq c222e054ca docs: Phase B recovery — 4 offline detector hypotheses refuted; scripts into scripts/ 2026-08-22 12:55:02 +03:00
Matiq 71644ff3e6 fix(render48k): chunk-scan WAV loader — hdr[40] is not data size when bext/junk present 2026-08-22 10:59:26 +03:00
Matiq 3e5085e06d phase A: reduction law found (affine in dB), canon unchanged; keep RT_DUMP tooling
- Effective reduction is affine in dB(lvl): x_exp2 = -0.6646 - 0.05877*dB
  (mask ~ 0.8*lvl^-0.354, gamma ~= decomp 0.344); tones +-0.13 dB over 42 dB
- Pre-IIR calibrated variant (X0=1.8/S=0.11): TOTAL 2.633 vs HEAD 2.286;
  wins t1kq/t1k/al/comb, loses res/dual -> gate fails, canon stays LUT
- Grid search (X0,S,floor,CMAX) on validated trajectory model: no scalar
  law of the family fits tone+noise simultaneously (res tension)
- Refuted: high-bin/IIR3-backward propagation, direct-affine bypass,
  positive floors, ceilings
- Kept opt-in instrumentation RT_DUMP_BIN / RT_DUMP_ALL for Step 7 capture
- Docs: NOTES_LEVEL 21d, BITEXACT_PLAN s.0 note, roadmap, AGENTS
2026-08-21 19:29:21 +03:00
Matiq 702b74e297 docs: sync BITEXACT_PLAN/roadmap/AGENTS to 2026-08-21 state
BITEXACT_PLAN: structural column in S0 table; Step 2 re-scoped (combine
thunk semantics, acc has no single-band consumer; FUN_1805316e0 is a
coefficient writer NOT a mask combiner — fixed in Steps 2/8); Step 4
FFT-conv downgraded to P3 (window near-flat); Step 6 pipeline done
(render48k); entry point = saturation hunt then Step 7 capture.
roadmap: status 2026-08-21, P4 row + ~80% estimate with dual-canon results.
AGENTS: two-canon model description, render48k/corpus_structural commands,
stale-binary sweep hazard warning, updated gaps list.
2026-08-21 13:54:06 +03:00
Matiq b2cb9235be feat(scripts): structural-path full-corpus harness + first honest 62-case numbers
corpus_structural.py drives render48k (48k/4096 structural chain) across the
full corpus with bridge-compare mode. Results: comb 6.12 vs bridge 10.15
(structural wins multiband already), res better, single-band worse; dual@500
constant -6.7dB q-independent over-cut exposes missing reduction saturation.
Param sweep (gamma x MULT, verified builds) confirms current optimum; curve
SHAPE is the gap -> Step 7 capture or bigkernel input re-examination.
2026-08-21 13:12:53 +03:00
Matiq a9d5581ad8 docs: NOTES — IIR3 bidirectional decode, combine thunk semantics, Step 2 re-scope 2026-08-21 12:55:23 +03:00
Matiq 1a616e1b7b feat(dsp): IIR3 bidirectional per decomp (fwd+bwd x2), combine semantics decoded
Decomp (consumers_out.txt:955-1075): IIR3 = TWO [reset,forward,backward]
pairs, state persists fwd->bwd; y = B3*x + A3*state. Replaces 2x forward.
Combine block decoded from thunks: f6f8 = mask - acc (8d60, dst=3rd arg);
f6f8 += kRTAtt/kRTRel * acc (halves); acc += mask (5a20). KEY FINDING:
in online single-band path acc/f6f8 have NO consumer before warp/dry-wet
- combine affects output only via multiband/FFT-conv stages (Step 2 scope
narrowed). LUT_MULT retuned 4.4 -> 4.2. Smoke mean|err| 0.993 -> 1.021
(faithful transcription kept over tuned fwd-only). Checks PASS, guard PASS.
2026-08-21 12:54:46 +03:00
Matiq 9ffe60e66e feat(dsp): wire IIR3 x2 (kIIR_A3/B3) post-warp into structural chain
Step 9 of NOTES_LEVEL:820-840 mono-path (was missing; roadmap claimed it).
Light spatial mask smoothing, upper half re-mirrored. LUT_MULT retuned
3.8 -> 4.4 for the shifted calibration. Smoke (48k/4096): mean|err|
1.093 -> 0.993 (t1kq -1.06, t1k +1.66, al12 -0.26). Module checks PASS,
corpus --compare bridge baseline PASS.
2026-08-21 12:45:36 +03:00
Matiq 7a108c529a docs: NOTES_LEVEL update — LUT level-domain discovery, sweep tooling hazard 2026-08-21 12:36:35 +03:00
Matiq 535b150f75 feat(dsp): move dB-LUT to level domain (pre-IIR/exp2) in structural chain
Mask-domain LUT clamps t<0 on loud input (t1k mask_dB < A=-13.78) causing
-24dB over-cut. Level-domain keeps quiet/loud inside [A,B] domain:
t1k err -24.04 -> +2.45 dB (3-case smoke: mean|err| 8.2 -> 1.09).
Params: gamma=0.344 (decomp-extracted), mult=3.8 (placeholder, empirical).
Module checks pass; corpus (bridge path) unchanged at 1.594.
2026-08-21 12:35:57 +03:00
Matiq 9b7e9d3099 feat(dsp): add dB-domain LUT (FUN_180563a60) to structural chain on 48k grid
- Add BandConfig A/B/gamma LUT compression (extracted from refs: A=-13.78dB, B=68.29dB, gamma=0.344)
- Add res^rp smoothing term for bridge-parity (RP0=0.0275, DRP=0.2159)
- Calibrate scale_factor to match bridge gain at tone bin (15.0 * 440.95 / 2048 = 3.23)
- Structural 48k: -26.81 dB vs ref -27.23 dB (err +0.426 dB)
- Bridge baseline: intact (0.000 dB degradation)
- All module checks PASS (fn529fe0, exp2, twin, tables, leveltrack, levelpath, fftconv)
2026-08-21 09:25:17 +03:00
Matiq 6924e539e0 feat(dsp): render48k pipeline + structural chain on 48000/4096 grid
- render48k: resample 44100→48000, process via SpectralProcessor(4096,1024,48000),
  resample 44100, write 24-bit stereo WAV
- FramedDetector: structural chain (fn529fe0 sequence) runs on 48000/4096 grid,
  bridge path unchanged for 44100/2048
- Structural chain: scale→IIR1→copy→IIR2→mirror→blend→exp2→combine→warp→dry/wet
  using live tables (kIIR_A1/B1, kIIR_A2/B2, kBand768, kWarp, kRTAtt/kRTRel)
- Bridge baseline intact (0.000 dB degradation)
- 48k tone test: -20.73 dB vs ref -27.23 dB (6.5 dB error, scale factor not yet
  calibrated to match bridge domain)
2026-08-21 04:46:51 +03:00
Matiq 7659eb0362 feat(dsp): SpectralProcessor sample_rate param 2026-08-21 01:32:50 +03:00
Matiq 7bf5a4a80c feat(dsp): structural FUN_180529fe0 chain components + fn529fe0_check (step 1, module 1) 2026-08-21 01:09:36 +03:00
Matiq fa71240d92 test: add validation harness (scripts/corpus.py + bridge baseline) to prevent Phase B regression 2026-08-21 01:06:05 +03:00
Matiq f17ee78061 docs: BITEXACT_PLAN — 8-step path to byte-parity; fix repo docs to reflect not-yet-bit-exact status 2026-08-21 01:00:41 +03:00
Matiq e990c21e94 fix: framed_test parse every comma band (was first-arg only); comb tests were single-band 2026-08-21 00:52:44 +03:00
Matiq b333f6828f docs: NOTES — verified comb params (neg sens, multi-mode); comb needs combine/acc, not params 2026-08-21 00:42:32 +03:00
Matiq 8e4e40b25a docs: NOTES — Pchip LUT fix + comb diagnosis (level-dependent, not multiband) 2026-08-21 00:34:18 +03:00
Matiq e5e9700333 fix: restore pchip LUT in framed_model (revert 12094f8 regression)
12094f8 replaced the empirical Pchip LUT with the parametric
linear form (CAP_A_LEVEL=-24/B=28/gamma=1). With gamma=1 the
parametric form reduces to identity on xv=log10(am/res), which
breaks the whole mask chain (t1kq fc-scan err jumps to ~7.9 dB).

Re-instating lut_pchip restores the honest baseline:
t1kq mean|err| 0.226 dB (was 7.9). Confirms NOTES_LEVEL F1
closure: no parametric LUT set beats Pchip at fixed bridge
params; the structural A/B/gamma (level-path ctx+0x188) is the
only real path to bytes, not this parametric substitution.
2026-08-21 00:32:39 +03:00
Matiq 12094f8119 Replace empirical Pchip LUT with parametric form from live DSP capture 2026-08-20 23:08:04 +03:00
Matiq 16853d7e0b Integrate live-captured A/B/gamma params into framed_model; add CAP_ constants and parametric LUT helper 2026-08-20 22:59:21 +03:00
Matiq 2d69b85aa3 P5: NOTES — F5c DSP-FFT 0x140a70 status (P3 confirmed unwired; all check targets PASS)
Full dsp/ check sweep green. fft.cpp = numerical radix-2 (std::cos) not bit-exact
0x140a70; split-radix butterfly + plan-gen giant + sin-table loader remain (multi-week
P3). Required only for FFT-conv byte-parity, not for the bridge renderer.
2026-08-20 21:09:28 +03:00
Matiq d802ee7aed P5: F5b — exp2 0x26b820 assets extracted bit-exact + numeric fallback exp2_dsp
Extracted the 8x16 irrational tables + lead-in -708.4xx series from soothe_mem.bin
into exp2_tables.{hpp,cpp} (P3 bit-exact inputs). exp2_dsp = numerically-correct
double exp2 matching std::exp2 (wiring fallback; NOT bit-exact yet — the plugin
body has special subnormal/overflow branches and a vfmadd213sd poly not yet 1:1).
exp2_check: 2e6-grid PASS (0 cells >1e-13).
2026-08-20 21:07:30 +03:00
Matiq 4e9c1b1ed7 P4: F4 geometry test — internal 48000/4096 does NOT close residual (0.68 vs 1.00); all structural adaptations rejected
Tested internal-geometry (48000/4096 + resample) — worse. Combined with earlier
negative results (parametric LUT x6, FFT-conv window, combine acc), every structural
adaptation is rejected. Bridge (Pchip 0.774) = empirical ceiling. Bytes require live
A/B/gamma capture or bit-exact exp2/FFT kernels.
2026-08-20 20:54:05 +03:00
Matiq fa1ef205df P4: F2 structural wiring tests — combine+FFT-conv naive wiring both regress (doc only)
Wiring FFT-conv step5 (mask*=win) gives mean 5.2, combine/acc (att/rel from kRTAtt/
kRTRel) gives 4.7 vs base 0.75-0.80 on representative subset. Both belong to the
exp2(mask) structural chain (blend 0.8 + bigkernel) NOT the fitted bridge final-gain.
No code change; bridge + Pchip stays canonical (0.773).
2026-08-20 20:52:00 +03:00
Matiq 1cfe013939 P4: bench all existing parametric LUT sets on full honest corpus — Pchip remains best (0.773)
All previously-derived parametric LUT forms (u563a60 A=-13.78/68.29/0.344, lut5/
lut4 gamma-LUT, power-law, linear 0.483/0.717, real extracted points) tested on the
full 59-case honest 24-bit metric within one fixed bridge pipeline. None beat the
committed Pchip (0.773; worst powerlaw 6.8). F1 closed: parametric curve production
was already done, none accepted; structural A/B/gamma from ctx+0x188 remains the only
path to bytes (blocked on level-path object live capture).
2026-08-20 20:44:20 +03:00
Matiq cea562b511 P4: F0 GATE PASSED — output is byte-deterministic; re-renders reproduce committed refs exactly
Two test RPPs (res_only1_500 4s, t1kq_only1_1000 6s) rendered twice each via
reaper -nosplash CLI. Data chunks identical across runs AND byte-identical to the
committed reference wavs. Whole-file differs only in the bext render-timestamp.
=> bit-exact (bytes) is REACHABLE; the per-run-dithrandization blocker is closed.
Next: exact structural chain + kernels + internal 48000/4096 geometry + live A/B/gamma.
2026-08-20 20:03:58 +03:00
Matiq 4014133d57 P4: NOTES — twin res verified vs Python canon (match <1.5%); res_only1 residual is LUT-level, not res-shape 2026-08-20 19:35:52 +03:00
Matiq 067d483f15 P4: NOTES — fit exploration results (mask-level fits do not transfer to full render)
- sqrt-Hann analysis regressed (0.788/2.91) vs committed Hann-Hann (0.774/2.12).
- Full-corpus G/W/A/rp mask-level fit (0.66) regressed in OLA render (0.812/2.37);
  the render metric is the only honest one.
- Residuals level-dependent (t1k_b1f loud +0.8..2.9, al low -1.1..-1.8); solution =
  structural A/B/gamma band LUT, combine/acc 0x5407c8 + FFT-conv 0x535a70 (todo #3).
2026-08-20 19:34:01 +03:00
Matiq cc52461903 P4: AGENTS.md — honest baseline state (log-domain LUT bridge, correct 24-bit metric)
Replaces stale exp2(am/res) chain description + wrong metrics with the actual
honest state: C=G*LUT(log10(am/res))+W*warp^A, gain=(1-C)*res^rp; dual<=0.72,
fc-scan<=0.59, corpus mean 0.77. Documents the 24-bit metric trap, negative
broadband test, and the remaining structural gaps (combine + FFT-conv, A/B/gamma).
2026-08-20 18:31:22 +03:00
Matiq 9a26532c60 P4: NOTES — broadband hypothesis tested NEGATIVE (per-bin reduction confirmed) + LUT re-cut rejected
Windowed-FFT of dual ref: gain@500=0.309, gain@2000=0.292 but gain@1000 (empty bin)=0.995
=> reduction is per-bin (am_k/res_k), NOT broadband — validates model structure.
16-knot monotone LUT (floor .35/cap .70) regressed corpus mean 0.77->1.09; reverted.
t1k_b1f/al residuals rooted in am-normalization / input-level differences, not LUT shape.
2026-08-20 18:30:30 +03:00
Matiq 94a6749c9a P4: NOTES — full honest corpus assessment (dual/al/res/t1k/t1kq baseline mean 0.77, max 2.12)
Systematics isolated: Pchip LUT frozen cap under-predicts loud tail (t1k_b1f needs
LUT 0.70 at xv 0.85), over-predicts low tail (al lv24 needs 0.35 at xv -0.5).
Real LUT extracted from refs; parametric fit A=-13.78/B=68.29/g=0.344 regresses dual
(rejects in full render). Structural next: decode BandConfig ctx+0x188 writers.
2026-08-20 18:25:02 +03:00
Matiq da63adc82c P4: METRIC FIX + log-domain LUT chain ported — honest baseline err <0.7 dB
Crucial: earlier dual ref -53.7 dB was a 24-bit-misdecoded artifact; honest ref is
-10.2 dB flat. Root cause of the "dual paradox" was a metric bug + missing log-domain
LUT. Ported the documented bridge (NOTES:147) into framed_model.cpp:
  xv=log10(am/res); C=G*LUT(xv)+W*warp^A; gain=(1-C)*res^rp.
Results (honest 24-bit metric): dual (fc=500 q-sweep) err <=0.7, t1kq fc-scan
err <=0.59. All empiric numbers explicitly marked. Structural A/B/gamma + combine/
FFT-conv still pending.
2026-08-20 17:37:31 +03:00
Matiq f8ecf6a1af P4: Phase B — framed_model re-transcribed to the confirmed chain (NOTES:199-226)
Fixes structural divergences: IIR1 into shared 0x5406f8 buffer + bridge to band
mask (FUN_18052d650, 0x5160); IIR2 on band mask; Hermitian mirror (0x11940);
blend step f6f8=axis(1-mix)+mix*0.8, mask=exp2(-mask)*f6f8; real combine via
kRTAtt/kRTRel weights (0x5406c8/6e8); warp, IIR3x2, dry/wet.

Validation: t1kq only1 fc1000 -21.1 vs -22.1 (OK); fc-scan shape intact;
dual @500 matches (s30 -51.5 vs -53.7), @2000 gap -4..-13 vs -29.6 remains.
That gap = dB-domain band LUT (FUN_180563a60) not yet in chain -> Phase A.
2026-08-20 17:16:22 +03:00
Matiq 8f64539328 P4: CRITICAL fix — level = am/res (not am*res); fc-resonance shape now correct
res=|2B/A| is minimal at band centre (not maximal). Model uses xv=log10(A_k/res_k)
=> level = am / res. Old am*res inverted the fc-response (cut more off-center).
Fixed; fc-scan (tone1kq, band fc 800..1200 via t1kq_only1_<fc>) now tracks the
reference: scale=42 mean|err| 2.46 dB, intact shape (deepest at fc==tone). Was
flat+inverted before. Remaining under-cut off-center -> FFT-conv smoothing/gaps.
2026-08-20 16:25:00 +03:00
Matiq ddf2ac2050 P4: lock PRNG prologue + correct constants (DAT_*=1); scale via prng_fvar30
CRITICAL fix: soothe_mem.bin is VA-linear (offset=RVA). DAT_18262b5c8/b704/b700
are INT 1 (cvtdq2ps -> 1.0), NOT the 0.4552/0.6089/0.6070 read earlier via a bad
section offset. Transcribed FUN_180529fe0 PRNG prologue into prng_fvar30():
fVar30=(int)(LUT[s+1]*LUT[s]+0.001). At live state 112 this is deterministically
1.0 over 300 frames, so scale level *= (1/2048)*440.95 is not randomized in
practice. Scale coefficient now computed structurally; t1kq unchanged -0.43 dB.
2026-08-20 16:14:50 +03:00
Matiq f1f06765f7 docs: README intro -> bit-exact goal, point to AGENTS.md 2026-08-20 15:51:10 +03:00
Matiq bdf9f21a60 docs: AGENTS.md + refresh README/roadmap/summary/SESSION_HANDOFF to P4 canon; rm empty logs
- AGENTS.md: canonical build/test commands, honest trimmed tone metric, current
  bit-exact state (mask-apply chain), open gaps (PRNG/FFT-conv/exp2/SR-mismatch).
- README.md: status moved to P4 (C++ FramedDetector canon, framed_test), historical
  B.1..B.15 numerical model demoted to <details>; structure/doc table updated.
- roadmap.md: P4 phase marked progress, P4.1/P4.2/P4.3 milestones, top status refresh.
- summary.md: marked historical (behavioral v4).
- SESSION_HANDOFF.md: fixed stale "NOT DECODED" (now decoded), copy note done.
- Removed empty tmp_spec.txt/giant3.txt and untracked .log/__pycache__ clutter.
2026-08-20 15:50:07 +03:00
Matiq 77b639ee82 chore: fix .gitignore to track decompiled .dis/.bin disassemblies
.gitignore used '*' as ignore-all with only extension whitelists, so the 128
handoff/nls_dasm/*.dis + 6 *.bin disassembly outputs (f_563a60, f_56e3e0,
f530850_full, f_52b570, fft, twin, ...) were NOT tracked - data-loss risk.
Now un-ignore handoff/nls_dasm/*.{dis,bin} explicitly. Heavy .bin dumps
(soothe_mem.bin etc.), logs, wav/rpp, dl/lib/bin/ghidra-proj stay ignored.
2026-08-20 15:42:42 +03:00
Matiq 2e0b107b4c P4: document PRNG prologue + remaining bit-exact gaps 2026-08-20 15:32:47 +03:00
Matiq 87dbf88e6d P4: add dual warp step (mask *= band768; *= warp) - comb 500/3000 fixed 2026-08-20 15:30:30 +03:00
Matiq 0d262461ea P4: lock bigkernel semantics (exp2(-mask)*blend) + calibrate scale
Read the 0x26b820 SIMD loop: the exp2 result is multiplied by the blend buffer
(vmulpd at 0x18026bba0 with ymm11=blend) => mask = exp2(-level)*blend, sign
inverted for attenuation. framed_model.cpp corrected to exp2(-scratch)*0.8.
Calibrated level_scale=600 -> t1kq err -0.06 dB (ref -14.98). comb per-tone
errors reduced (max ~7.8 dB); warp/FFT-conv smoothing still approximated.
2026-08-20 15:25:49 +03:00
Matiq d4a0a68584 P4: transcribe exact FUN_180529fe0 mask chain (structural, not yet calibrated)
framed_model.cpp now follows the decoded mono-path structure:
  level -> scale(0x540870*0x54088c/0x1a0) -> IIR1 leaky(A1/B1) -> IIR2(A2/B2)
  -> exp2(0.5*(mask-blend)) -> combine/acc -> warp -> IIR3(A3/B3)x2 -> dry/wet
IIR stages are the real live tables (iir_leaky y=A*acc+B*x, B=1-A). Removed the
empirical mask_lut=(1/(1+K*acc))^n. Not numerically calibrated yet: exp2 bigkernel
exact semantics + PRNG prologue (fVar30) + FFT-conv still TBD; t1kq depth -2.9 vs
-14.98 dB ref.
2026-08-20 15:10:29 +03:00
Matiq f23bbfa1f6 P4: decode FUN_180529fe0 mono-path exactly + extract live mask tables
Full decomp of the per-band mask-apply loop (scale -> IIR1/2/3 leaky ->
blend -> exp2 bigkernel -> combine/accumulate -> dual warp -> dry/wet -> FFT-conv).
Extracted runtime tables to rt_mask_tables.{hpp,cpp}: IIR A1/B1,A2/B2,A3/B3
(leaky y=A*acc+B*x, B=1-A), warp 0x5406a8, per-band 0x540768, PRNG LUT 0x5408b0.
bigkernel 0x26b820 = vectorized exp2 (log2e/floor/mantissa tables). Fixed the
broken warp line in framed_model.cpp (compiles again).
2026-08-20 15:00:53 +03:00
Matiq fc48a9fee4 P4: real mask chain in FramedDetector (level-tracker + accumulator + live-calibrated LUT), t1kq err 0.5dB
Replace empirical PCHIP detector with live-calibrated mask chain from FUN_180529fe0:
  level = am*res*scale; track += w*(level-track) (per-bin attack/release weights
  extracted from RT snapshot, rt_weights.hpp); acc = (level-track)+level; mask =
  (1/(1+K*acc))^n (K=9.8026 n=0.25966 fitted to live mask band0). min-combine.

Results (N=2048 hop=512): t1kq single-band err +0.51 dB (-14.47 vs -14.98 dB ref);
comb 4-band per-tone -3.4..+5.8 dB (old PCHIP over-cut comb ~6 dB). Adds framed_test
harness for C++ FramedDetector eval on tone1kq/comb.
2026-08-20 13:11:27 +03:00
Matiq 5c939583f5 P4: multi-band FramedDetector (per-band twin res, sens-scaled GAIN, min-combine); tt_base 61.40%; min-combine wrong (soothe2 uses additive accumulator 0x5407c8) 2026-08-20 10:41:24 +03:00
Matiq 0cdc57972c P4: port framed_render.py model to C++ (FramedDetector: twin-res -> level -> Pchip LUT -> warp -> res^rp gain), replace empirical Detector; tt_base 49.93%->61.45% (single-band); multi-band refs still 100% (model is single-band) 2026-08-20 10:31:43 +03:00
Matiq 45dfe2b8c2 P4: full decomp FUN_18052e260 frame driver (twin side-chain per band, LUT+mask+FFT-conv run per drained frame); wire order documented 2026-08-20 09:28:12 +03:00
Matiq a6126d10ac roadmap: mark P1.5/P2/P2.5 DONE, P3 partial (vlog+arch, butterfly remains); ~65-70% done 2026-08-20 09:27:04 +03:00
Matiq 5a4554a9a3 P4-prep: eval_lut_bin uses float logf/expf (matches decomp FUN_180563440 logf/expf, not double std::log/exp) 2026-08-20 09:26:38 +03:00
Matiq 8fad2bbfd9 P3.5: acc_437c0 = data shuffle (re/im repack + zero-fill), not arithmetic; full butterfly = twiddle load + shuffle + mult + combine 2026-08-20 08:48:00 +03:00
Matiq feb44c3802 P3.4: transcribe plugin's own vectorized ln(x) (vlog.cpp, minimax ln(1+x) poly + ln2 range-reduction); correct prior misread — dispatch reaches runtime ln, not FFT; vlog_check ALL OK (rel 2.4e-7) 2026-08-20 07:12:56 +03:00
Matiq 7bbe7cce05 P3.3: final kernels use own vectorized sin/cos (SVML-like poly+exp, ln2=0.693147) not twiddle table for big-N; poly constants captured from rodata 2026-08-20 05:56:12 +03:00
Matiq 2a7b88e704 P3.2: map full 4-level FFT dispatch (535a70->140a10/70->jumptable->runtime table->6 final split-radix kernels 0x1802a24c0..2ce4a0); kernels force MXCSR round-to-nearest 2026-08-20 02:58:01 +03:00
Matiq 88422034f5 P3.1: extract FFT code from rt snap (extract_fft.py); decode cplx_mul 0x8440 = in-place elementwise double mult, twiddle loader 0x39b00 stride copy, dispatcher 0x535a70->0x140a10/70->jumptable[0x1826159a0]=4; implement cplx_mul_scalar_inplace 2026-08-20 02:25:59 +03:00
Matiq 22e4599e0a P2: decode mask-accumulator combine kernels from raw bytes — combine3(0x8d60)=sub, acc_add(0x5a20)=dst+=src, acc_fma(0x3c40)=dst+=a·b; implement + levelpath_check ALL OK 2026-08-20 01:30:33 +03:00
Matiq d3db772121 P2.5: decode twin-mask factory (FUN_18056e3e0 = constant fill 2π/(count·SR)) + band LUT apply (FUN_180563a60: level->gain t^γ/power-law); implement in levelpath.cpp, levelpath_check ALL OK 2026-08-20 01:23:22 +03:00
Matiq a49e35dc25 P1.5: embed live level-tracker A[] + mask scalars into C++ (dsp/leveltrack_data.hpp); leveltrack_check sanity confirms SR=48000, A_ATTACK plateaus 0.692, attack/release=1.0 2026-08-20 01:12:12 +03:00
Matiq 0e90918226 P1.5 SOLVED: live ctx (0x2370040, +0x24==48000) + level-tracker A[] + mask scalars captured via realtime playback; method play.lua + rtctx_rt.py; prior 'unreachable' was offline-engine artifact 2026-08-20 00:44:58 +03:00
Matiq fe43509d50 NOTES_CAPTURE: P1.5 live level-tracker A[]/ctx confirmed unreachable (window ptr only in registry, no +0x24==40000 object); scalars static-derived from RPP; 2 missing consts 0x24c4348/44a4 2026-08-20 00:11:45 +03:00
Matiq c5d2b2ad7f P1.5: rtctx.py live-capture pipeline (registry-scan + ctx discovery); confirms live level-tracker A[]/ctx not reachable (window ptr only in registry, no +0x24==40000 object) => scalars are static-only 2026-08-20 00:11:25 +03:00
Matiq fd5a46542b roadmap: reflect P0-P2 (tables/fftconv/leveltrack/mask-canon) + exact estimate of remaining code (P1.5-P5, ~60% left) 2026-08-19 23:58:20 +03:00
Matiq 433a0026e6 P2: level-tracker UPDATE-loop located (inline bidirectional IIR in FUN_180529fe0), structural module leveltrack (iir_first_order/bidirectional/unrolled4); scalar==unrolled verified; remaining = live A[] coeffs 2026-08-19 23:53:01 +03:00
Matiq cff28a605c P1.4: full FUN_180529fe0 decomp confirms mask-canon (scale->IIR->blend->combine+weights->warp->dry/wet->FFT-conv); documented remaining live scalars for bit-exact 2026-08-19 23:34:02 +03:00
Matiq 8b8895f68a P1.3: integrate FFT-conv stage (build_fir_from_window step5 memcpy + fir_from_mask + overlap-save conv) with captured WIN_WINDOW; fftconv_check confirms FIR=window[2048:4096]={0.8->1.0} 2026-08-19 23:25:21 +03:00
Matiq 42316efa71 P1.2: confirm f_52d990 memcpy via decomp (FUN_18052d990(lVar22, window+N/2, N/2)); infer N=4096 from freq-axis spacing + window sape; step-5 low-pass near-flat ramp 2026-08-19 23:20:38 +03:00
Matiq 241957bced P1.2: f_52d990 = memmove/memcpy thunk, NOT a multiply; corrected step-3/5 FIR window semantics (copy window tail + const fill); xmm9/xmm13 remain 2026-08-19 23:17:31 +03:00
Matiq fd9b1fd001 P1.1: embed runtime-captured DSP tables (WIN_WINDOW, FREQAXIS@48k, WA/WB/WC/WD), dsp_ctx registry mirror, tables_check ALL OK 2026-08-19 22:48:32 +03:00
Matiq 83af30d7c0 P0: track twin.cpp/twin.hpp/rotor_kernel.hpp (were shadowed by .gitignore) 2026-08-19 22:00:22 +03:00
Matiq f8b91e8015 P0.3-4: harness reads flat params (in/out/[conf]), byte-verified trim; verify_bit_exact.py uses SOURCE WAVE+RENDER_FILE from RPP, sample-report mono/stereo 2026-08-19 22:00:14 +03:00
Matiq 58164f2952 P0: fix build (levelpath in CMake, FLOOR_LIN, exact LUT curve formulas), robust RPP param decoder (607 rpp ok), preserve f_52b570/f529fe0 disasms 2026-08-19 21:54:26 +03:00
Matiq 55623b998f chore: add rt-capture artifacts (rtobj/rtsnap scripts, rwin_*.npy tables, dsp grep dumps, rpp param decoders) 2026-08-19 20:56:58 +03:00
Matiq 02dd6e8aa7 docs: exact structural LUT curve formulas (FUN_180563440 linear/power-law), consts from PE; roadmap Q1 static side closed 2026-08-19 20:45:45 +03:00
Matiq 2484829452 docs: roadmap Q4 (0x540658 window) closed via live registry capture (SR=48000, weights), infra rtsnap* 2026-08-19 20:42:22 +03:00
Matiq 34fc852b4f docs: two-point 180s capture confirms registry stability; twin per-note state = {A[3],B[3]} not 342-dbl; Step C closed 2026-08-19 20:27:12 +03:00
Matiq 9c1516171e docs: runtime capture settled — registry heartbeat decodes live 0x540658 window & freq-axis (internal SR=48000); vptr-scan route closed 2026-08-19 20:10:22 +03:00
Matiq abf09a26cc runtime capture: registry heartbeat decodes live DSP tables (WIN 0.540658, freq-axis@48k, per-bin weights), rtsnap_fast/findctx/rtchunk infra 2026-08-19 20:06:14 +03:00
359 changed files with 866152 additions and 1528 deletions
+34 -5
View File
@@ -1,4 +1,8 @@
# venv и тяжёлые/бинарные артефакты — в репо НЕ пушим # venv и тяжёлые/бинарные артефакты — в репо НЕ пушим
# Подход: `*` игнорирует ВСЁ; правила !... возвращают нужные файлы.
# ВАЖНО для git: шаблон `*` игнорирует и файлы, и директории. Чтобы git "зашёл"
# в директорию, каждую директорию на пути нужно разыгнорировать (для nls_dasm —
# handoff/ и handoff/nls_dasm/). Иначе `git add -n` откажет с "dir is ignored".
* *
!**/*.py !**/*.py
!**/*.txt !**/*.txt
@@ -7,21 +11,46 @@
!**/*.npy !**/*.npy
!**/*.npz !**/*.npz
!**/*.java !**/*.java
!handoff/
!**/*.cpp !**/*.cpp
!**/*.hpp !**/*.hpp
!**/*.c !**/*.c
!**/*.h !**/*.h
!**/*.lua
!**/roadmap.md !**/roadmap.md
!**/AGENTS.md
!.gitignore !.gitignore
!dsp/
# тяжеловесы / чувствительные (исключены даже с include выше) # --- расшифрованные дизассемблы декомпа: НУЖНО трекать (ценные артефакты) ---
*.bin !handoff/
!handoff/archive/
!handoff/archive/*.md
!handoff/nls_dasm/
!handoff/nls_dasm/*.dis
!handoff/nls_dasm/*.bin
!handoff/*.md
!handoff/*.py
!handoff/*.json
!handoff/*.npy
# --- защитный харнесс валидации ---
!scripts/
# --- тяжёлые / бинарные / временные / инструменты: НЕ в git ---
*.log
*.wav
*.rpp
__pycache__/
dsp/build/
ghidra-proj/
regions/ regions/
regions_dep/ regions_dep/
regions_render/ regions_render/
regions_rt/ regions_rt/
regions_rt2/ regions_rt2/
soothe_rt.bin.regions/ soothe_rt.bin.regions/
*.wav dl/
*.rpp lib/
bin/
include/
**/*.regions/
+133
View File
@@ -0,0 +1,133 @@
# AGENTS.md — runbook for AI agents working in this repo
> **Статус → `README.md:13` (единственный источник TOTAL).** Этот файл — только runbook: сборка, метрика, env-флаги, tooling hazard.
> Полный журнал — `handoff/NOTES_LEVEL_INDEX.md` → `handoff/NOTES_LEVEL.md` (живая голова) + `handoff/archive/`.
> Карта метода — `handoff/BLOCKMAP_529fe0.md`. ЭТОТ ФАЙЛ ЧИТАЙ ПЕРВЫМ.
## Золотое правило (обязательно)
1. **Цель — bit-exact реверс кода**, НЕ эмпирическая подгонка кривых. Каждый параметр
должен иметь источник (decomp адрес / live-таблица), а не быть подогнанным числом.
Если берёшь эмпирику — явно пометь и занеси в «осталось».
2. Источник истины — **декомпиляция** (`decomp_funs.txt`, `decomp_funs2.txt`,
`handoff/nls_dasm/*.dis`) и **live-снимки** (`/tmp/snap_rt.bin`). Обновлять заметки
при любом новом декоде.
3. Команды через `rtk` (токен-фильтр), включая цепочки `&&`.
## Сборка и тесты (канон)
```bash
# собрать библиотеку + framed_test (bridge, 44.1k) + render48k (структурная цепь, 48k/4096)
cmake -S dsp -B dsp/build
cmake --build dsp/build --target framed_test render48k
# bridge-рендер (N=2048, hop=512, SR 44100, sqrt-Hann OLA)
# формат полосы: fc,q,sens,level_scale (одна полоса в comma-форме)
./dsp/build/framed_test /home/m/soothe-bt/tone1kq.wav /tmp/o.wav 678.7611083984375,0.99999785,12,600
# многополосный: через отдельные аргументы fc q sens scale (см. framed_test.cpp)
# структурный рендер (внутренняя сетка 48000/4096: resample -> FUN_180529fe0 chain -> resample)
./dsp/build/render48k /home/m/soothe-bt/tone1kq.wav /tmp/o48.wav 1000,0.99999785,12
# корпусные прогонки (62 случая, честная 24-bit метрика)
python3 scripts/corpus.py # bridge + guard --compare
python3 scripts/corpus_structural.py # структурная цепь
python3 scripts/corpus_structural.py --vs-bridge scripts/baseline_bridge.json
# отдельные модули (bit-exact черные проверки)
cmake --build dsp/build --target twin_check tables_check fftconv_check vlog_check leveltrack_check levelpath_check fn529fe0_check exp2_check vlaw_check
./dsp/build/twin_check # float-parity twin-резонатора
```
> **TOOLING HAZARD**: cmake пропускает пересборку при изменении исходника в ту же секунду —
> параметрические свипы молча гоняют STALE бинарь. Протокол: `touch` исходника перед сборкой +
> проверять свежесть mtime бинаря (пример: /tmp/sweep_fresh.py паттерн в NOTES_LEVEL:21a).
### Метрика (tone-cmp, Goertzel stead-state)
Сравнивать **тримкнутый** выход (длина = длина входа) с референсом `*_ref.wav` / `t1kq_b1f_*`:
```python
# ref: t1kq_b1f_678.7611083984375.wav (или t1kq_b1f_1000.wav и т.д. по fc полосы)
# вход: tone1kq.wav (тон 1000 Гц)
import wave, numpy as np
def load(p):
w=wave.open(p,'rb'); n=w.getnframes(); d=w.readframes(n)
return np.frombuffer(d,dtype=np.int16).astype(np.float64).reshape(-1,w.getnchannels()).mean(1)/32768
def ta(x,f,sr=44100):
x=x[-int(0.75*sr):]; t=np.arange(len(x))/sr; w=2*np.pi*f
return np.hypot(2*np.sum(x*np.cos(w*t))/len(x), 2*np.sum(x*np.sin(w*t))/len(x))
def db(a): return 20*np.log10(max(a,1e-9))
inp=load('/home/m/soothe-bt/tone1kq.wav')
out=load('/tmp/o.wav')
ref=load('/home/m/soothe-bt/t1kq_b1f_678.7611083984375.wav') # fc полосы = 678.76
err = db(ta(out,1000)/ta(ref,1000)) # err в dB, цель <0.1
```
Тестовый корпус (`/home/m/soothe-bt/`, вне git): `tone1kq.wav`(вход),
`t1kq_b1f_<fc>.wav` (рефы), `comb.wav`/`comb_ref.wav` (мультиполосный).
## Структура ключевых файлов
- `dsp/framed_model.{cpp,hpp}` — C++ порт mask-apply цепи (ГЛАВНЫЙ файл).
- `dsp/render48k.cpp` — пайплайн 48000/4096 (resample → chain → resample).
- `dsp/twin.{cpp,hpp}` — twin FUN_180535880 (float-parity).
- `scripts/corpus.py` / `corpus_structural.py` — харнессы + guard `--compare`.
- `handoff/NOTES_LEVEL.md` — живой журнал (голова 24mm5+, хвост → `archive/`).
- `handoff/NOTES_LEVEL_INDEX.md` — оглавление журнала.
- `handoff/BLOCKMAP_529fe0.md` — блок-карта FUN_180529fe0.
- `handoff/nls_dasm/` — 134 дизассембла.
## Env-флаги экспериментов (актуальные)
| флаг | действие |
|------|----------|
| `RT_VLAW=1` | закон применённой стадии: `mask=10^((α·ln1p(lvl/β)+c)/20)` |
| `RT_SYN=1` | STFT БЕЗ синтез-окна (найденный слой плагина) |
| `RT_WIN=0/1/2` | окно анализа: sym-hann / periodic / rect |
| `RT_NOWARP=1` | отключить warp-модуляцию маски |
| `RT_NOIIR3=1` | отключить IIR3 ×2 |
| `RT_IIR12=0` | отключить частотные IIR1/2 (КРИТИЧНО с RT_VLAW — иначе размывают дипы) |
| `RT_DUMP_BIN=<f>` (+`RT_DUMP_FRAME=N`) | дамп тракта бина N: am/res/lvl_raw/band_level/prewarp/w |
| `RT_VDBG=1` | stderr-печать vlaw-вычислений |
| `RT_FAITHFUL=1` | faithful-цепь `dsp/fnfaith.cpp` (детекторный каскад) |
| `RT_FIRCONV=1/3` | FIR-применение (1=complex-mul, 3=`1.019·mask^1.8345`) |
| `RT_CASC=1` | цепь 919 (`chain_9_19`, IIR4×2 double + FIR min-phase, gated) |
| `RT_IIR4_GEN=1` | генератор IIR4 (FUN_180533340) vs proxy `kIIR_A1/B1` |
| `RT_IIR4_C/TAU/P/MULT/SR` | параметры генератора IIR4 (1000/1200/0.5/360/48000) |
| `RT_FIR=0/1` | пуск FIR min-phase (default 1) |
| `RT_FIR_Q=x` | показатель FIR (default 0.8002203702926636, live `.rdata`) |
| `RT_KMAP_FC=1` | fc-фактор k-mapping через W_eq (default off) |
| `RT_DELTA_DIST=x` | Δ distance factor (template-local gain, default 0=flat) |
| `RT_DELTA_STATE=1` | STATE-dependent Δ (опен-ин, wired, empty) |
| `RT_DBG_CASC=1` | gate DBG_CASC fprintf (per-frame spam otherwise) |
Полный набор dual-решения: `RT_VLAW=1 RT_SYN=1 RT_NOWARP=1 RT_NOIIR3=1 RT_IIR12=0`.
## Инструменты
| скрипт | назначение |
|--------|-----------|
| `scripts/rendersnap2.py <rpp> [cap] [outdir]` | мягкий STOP-снаппер (RENDER_FILE из rpp!) |
| `scripts/campaign.py <base> <fc> <q> <sens> <in> <drives> <out>` | ячейка параметризации (~8 мин) |
| `scripts/disasm_func.py <VA> [len]` | capstone-дизасм с RIP-константами |
| `scripts/iat_name.py` | рантайм-резолв импортов (SIGSTOP!) |
| `scripts/probe_states.py` / `probe_mem.py` / `dump_dispatch.py` | live state/память/таблицы |
| `scripts/hunt2.py` | перебор ctx-инстансов |
| `scripts/scan_pairs.py`, `scan_lutsub.py` | диагностика памяти |
Датасеты: `/tmp/opencode/sc_{q,sens,qmap,k,f,d}*` + `tract_*` + `*.pkl/.npz` (см. `NOTES_LEVEL_INDEX.md`).
Открытые пробелы → `BITEXACT_PLAN.md`.
## Архитектурная проблема chain_9_19 (WIRED, GATED)
`chain_9_19` из `dsp/fn52fe0.cpp:259` (BLOCKMAP:620-644) — per-frame цепь с **persistent ACC state** (`@ctx+0x5407c8`). Интегрирована в `framed_model.cpp:process_band_structural` через `RT_CASC=1`. IIR4×2 использует double precision (movsd/mulsd per disasm 1191), FIR min-phase бит-точен до df0 (0.0065 dB). Генератор IIR4 (`generate_iir4_coefs`, FUN_180533340) env-gated `RT_IIR4_GEN`.
**Статус:** chain wired и gated (`RT_CASC=0` default = canon untouched). Все unit checks PASS, corpus gate d=+0.000. Калибровка I/O format требует `ph*.npz` capture (rendersnap2.py) — capture proof получен (2026-09-02).
**Live-dump chain (ptrace):** chain вызывается в рантайме (DIV#0-7 на `0x1803a06a0`):
- Input: `a` = bands_curve (VLAW output, min=0, max=17.6, mean=0.048)
- `b` = tmp6f8 (step 9b accumulation, min=0, max=0.8, mean=0.8)
- 8 DIV hits на одном кадре (dual-band: 2 bands × 4 iterations?)
**Capture proof (2026-09-02):** `rendersnap2.py` снимает `ph*.npz` (слоты 0x540628/0x540678/0x540688/0x540768) через `/proc/pid/mem` без ptrace-брейкпоинтов. Данные в `/tmp/opencode/{rendersnap2_dual,snap_t1k_b1f_1000,snap_dual300,rendersnap2_comb_b1234}`. Маск-цепь работает в рендер-окне (BLOCKMAP:285 устарел).
---
## Чистая работа
- Не коммитить: `*.bin`, `*.wav/rpp`, `*.log`, `dsp/build/`, `ghidra-proj/`, `dl/lib/bin/include/`, `regions*/`. См. `.gitignore`.
- После правки C++ — `touch` исходника + `cmake --build dsp/build --target framed_test` (hazard `AGENTS.md:66`) + `python3 scripts/corpus.py --compare scripts/baseline_bridge.json --tol 0.25`.
+90
View File
@@ -0,0 +1,90 @@
# BIT-EXACT PLAN — путь от dB-приближения к побайтовой парности
Статус: **НЕ bit-exact**. Канон — bridge `framed_test` 44.1k: **TOTAL 1.594 dB** (62 случая, trimmed 24-bit, `scripts/baseline_bridge.json`). Bit-exact достижим (F0 gate: рендеры байт-детерминированы `handoff/NOTES_LEVEL.md:1020`), но модель — погона. Читать вместе с `AGENTS.md` и `handoff/NOTES_LEVEL_INDEX.md`.
> **2026-08-28 (24mm14): применение декодировано до формул.** `mask=10^(cut_D/20)`, `cut_D=α·ln1p(lvl/β)+c [+Δ]` — три семейства, rms ≤0.016. `dual` 0.193 dB (env-gated `RT_VLAW=1 RT_SYN=1 RT_NOWARP=1 RT_NOIIR3=1 RT_IIR12=0`), детекторный каскад `180529c60` + RFFT до df0 бит-точны, `γ=1.760561` из цепи. **Гейт смены канона = bit-exact** (решение `24hh2`). Остаток: 3 шага ниже.
Цель фазы C: воспроизвести `FramedDetector` (= `FUN_180529fe0` mono-path) до `verify_bit_exact.py` побайтового совпадения (`t1kq_*`, `dual_*`, `comb_*`).
---
## 0. Текущее состояние — ЕДИНСТВЕННЫЙ ИСТОЧНИК `README.md:13`
Честная trimmed метрика 62 случая (bridge vs structural 48k/4096 `corpus_structural.py`):
| Группа | bridge mean | bridge max | structural mean | VLAW env-gated mean |
|--------|-------------|------------|-----------------|---------------------|
| t1kq (fc-scan) | 0.226 | 0.500 | 0.768 | 0.4260.852* |
| t1k (loud) | 1.801 | 2.227 | 2.114 | 0.5770.930* |
| al (level) | 0.638 | 1.596 | 0.986 | 0.0900.804* |
| res | 0.628 | 1.535 | **0.437** | 0.395* |
| dual (q-sweep) | 0.726 | 2.252 | 3.264 | **0.193** (max 0.438) ✓ |
| comb (4-band) | **10.149** | 14.752 | **6.116** | 2.6784.335* |
| **TOTAL** | **1.594** | 14.752 | 2.286 | **0.8701.931*** |
`*` зависит от калибровки VLAW `α/β/c` (семейство dual vs fc-зависимая `AGENTS.md` больше не хранит таблицу — см. `README.md:13` и `handoff/NOTES_LEVEL.md:3919`).
Канон = bridge `1.594` (эмпирика `C=G·LUT(xv)+W·warp^A, gain=(1C)·res^rp`). Structural `2.286` обгоняет bridge на `comb/res`, регрессирует на однополосных — форма кривой редукции неверна. VLAW закрывает `dual` (0.193) — применённый слой и каскад декодированы.
---
## 1. Порядок работ (3 шага, обязательный порядок; каждый валидируется отдельно)
> **Валидация:** `cmake --build dsp/build --target framed_test` + `python3 scripts/corpus.py` + `python3 scripts/corpus.py --compare scripts/baseline_bridge.json --tol 0.25` (фейлит при регрессе группы >tol). Структурная цепь валидируется `scripts/corpus_structural.py --vs-bridge`. Каждый под-шаг коммитить отдельно.
### Шаг 1 — Каскадный симулятор шагов 9–19 FUN_180529fe0 (ПРИОРИТЕТ №1)
Dataflow декодирован `handoff/BLOCKMAP_529fe0.md:22v` + `handoff/NOTES_LEVEL.md:4400`:
```
bands[i] → LOG#1 (140980) → 52d650 (bidir #1) → vec698*= (1[54087c]) → vec6f8+= [54087c]·0.8
→ DIVIDE vec6f8/bands (1803a06a0) → vec6f8=bandsACC (dc40) → fma ATT/REL (1fa0/1940, тройки re,im,coef)
→ COPY (1b80) → mirror 9 + bigkernel 140b60 → EXP#1 (1409e0) + 1 → ×track (th2000) → ×warp (th2000)
→ LOG#2 (140980) → IIR4×2 (bidir, log-домен) → EXP#2 → bands_final
→ FIR-секция: DESIGN 1802a24c0 (conv_float_a24c0.dis) → copy → RFFT pair th2180/th1a90 (buf548/598)
→ FIR[1..n/2]*=2.0 → EXP 1803831c0 → WINfreq· → FIR[0]=1 → df0 track⊗FIR → mask
```
Тела bigkernel'ов резолвлены статически `handoff/NOTES_LEVEL.md:3944` (`1803a06a0` divide, `180296c80` expf, `1803831c0` табличная кривая, `1803a06a0` etc.; `24mm2` таблица). RFFT до df0 бит-точна `24mm11`.
**Делать:** оп-за-оп транскрипция `scripts/cascade_sim.py` (numpy-эквиваленты divide/expf с FMA-точностью) → валидация на `multi6` (6 нотчей один прогон, `handoff/NOTES_LEVEL.md:3809`) и `sc_*` дистанционной серии (rms сейчас 0.42 на угаданных формах). После структуры — C++ порт `dsp/fn529fe0.cpp` с точными полиномами.
Критерий: каскад воспроизводит `B=exp(scratch)` из `multi6` на всех 6 пиках ±0.05 dB (сейчас `rms 0.42`), затем `dual` 0.193 сохраняется без per-семейной калибровки.
### Шаг 2 — k-маппинг фронтенда (twin/am)
`k = lvl_impl / lvl_ours` (`handoff/NOTES_LEVEL.md:3436`): `k(q≥2)=0.403` const, `k(sens)` экспонента (5.37 при s18, 22.0 при s24). При q=1.0 vs q=0.5 `k` идентичен — `q` НЕ влияет на закон (`24kk`), `sens` линейно через `lvl_raw` (`24kk`). Остаток — twin gain пол (`res` плагина ≥0.153 vs наш 0.0069) и амплитудная нормировка `am` (wsum/окно в `dsp/spectral.cpp` vs декомп `FUN_180535880` tail-calls).
**Делать:** декод `FUN_180535880` tail-calls + `FUN_180536300` caller (grid `NOTES_TWIN.md`) до точных `twin_coeff`/`am` формул, либо калибровка `k(q,sens,fc)` по `sc_*` + `tract_*` как таблицы с декомп-обоснованием.
Критерий: cross-config `α/β/c` становятся вычисляемыми, а не фитовыми; `sens 6..24` перестаёт требовать per-групповой `α`.
### Шаг 3 — Δ-правило вторых пиков (pre-combine)
Второй контент-пик: `cut = α·ln1p(g·lvl/β)+c`, `g@2000≈12.15` vs `g@fc=1.0` (`handoff/NOTES_LEVEL.md:3890`), но `g` меняется между прогонами (12.15 vs 1.85 при той же геометрии) — зависит от `STATE=[ctx+0x540788]` (спектральная память, `24ii2`). Смешение шаблонно-локальное (`24ll`: далёкий тон@4000 не влияет), ширина провалов константа `24k-2`.
**Делать:** серия `campaign.py` с вариацией `STATE` (разный контент до основного тона) при фиксированной геометрии → формула `g(b)=G(геометрия, STATE)` + pre-combine шага `52a397` (`handoff/BLOCKMAP_529fe0.md:43`).
Критерий: `d1500` серия `3.43→4.23` монотонна без отрицательных `w(d)` (`24mm`).
---
## 2. Что НЕ делать
- **НЕ вводить эмпирию где есть декомп** (золотое правило `AGENTS.md:33`). `LCP` и `MULT` без источника — помечать `EMPIRICAL`.
- **НЕ делать combine в bridge-final-gain домене** — F2 регресс 4.68/5.22 `handoff/archive/NOTES_LEVEL_2026-08-18_2026-08-23.md:1064`.
- **НЕ читать WAV наивно** — только `render_parity.load` (bext/junk, 24-bit `handoff/NOTES_LEVEL.md:1462`).
- **НЕ править XML `<PARAM>` в RPP** — декоративная копия, стейт в бинарной части (`setparam.lua`/`patchparam.py`).
- **НЕ свёртка/OLA поверх маски** — опровергнуто `24j` (`A=1.019·V^1.8345` = произведение экспонент, не свёртка).
## 3. Риски и время
- Доминирующий риск — каскад 9–19: 5700 строк AVX-512+FMA (`1803831c0`), 10 ядер. Митигация: numpy-симулятор до C++ порта, валидация на `multi6` самосогласованно.
- Twin/am — multi-week (dispatch ядра 2/4/8, plan-gen `FUN_18002f980`). Не блокирует Шаг 1.
- Стерео M8 — отложен (все рендеры mono).
- Оценка: Шаг 1 — 1–2 недели, Шаг 2 — 1–2 недели, Шаг 3 — дни. До байтов — 1–2 месяца.
## 4. Точка входа
1. `AGENTS.md``handoff/NOTES_LEVEL_INDEX.md` (живая голова `24mm5+`) + `handoff/BLOCKMAP_529fe0.md`.
2. `touch dsp/framed_model.cpp && cmake --build dsp/build --target render48k framed_test` (hazard `AGENTS.md:66`).
3. Бейзлайны: `python3 scripts/corpus.py --compare scripts/baseline_bridge.json --tol 0.25` (TOTAL 1.594); VLAW dual `RT_VLAW=1 RT_SYN=1 RT_NOWARP=1 RT_NOIIR3=1 RT_IIR12=0` → 0.193.
4. Инструменты: `scripts/cascade_sim.py` (структурная фаза), `scripts/rendersnap2.py`, `scripts/disasm_func.py`, `scripts/iat_name.py`, `scripts/campaign.py`.
+206
View File
@@ -0,0 +1,206 @@
import ghidra.app.script.GhidraScript;
import ghidra.app.decompiler.DecompInterface;
import ghidra.app.decompiler.DecompileResults;
import ghidra.program.model.listing.Function;
import ghidra.program.model.listing.FunctionManager;
import ghidra.program.model.listing.Instruction;
import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressSpace;
import ghidra.program.model.symbol.Reference;
import ghidra.program.model.mem.Memory;
import java.io.PrintWriter;
import java.io.FileWriter;
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.*;
/**
* DumpFuns2 - unfrozen BFS decompiler.
* Differences vs DumpFuns.java:
* 1. NO haveDec gate: always decompiles into decomp_funs2.txt.
* 2. Extended seeds: explicit critical DSP addresses + reverse callers
* (references-to) so indirect/vtable-dispatched functions enter closure.
* 3. Skip threshold lowered from 30 to 8 instructions (keeps dispatchers/stubs).
* Also writes fun_map2.txt (fresh) and re-scans .data float constants.
*/
public class DumpFuns2 extends GhidraScript {
final long LO = 0x180000000L;
final long HI = 0x182a00000L;
long parseAddr(String s) {
try {
return Long.parseLong(s.replaceAll("[^0-9a-fA-F]", ""), 16);
} catch (Exception e) { return -1; }
}
boolean inRange(long a) { return a >= LO && a <= HI; }
@Override
public void run() throws Exception {
FunctionManager fm = currentProgram.getFunctionManager();
AddressSpace as = currentProgram.getAddressFactory().getDefaultAddressSpace();
// --- seeds: all FUN_ from decomp_dsp.txt + explicit critical DSP addrs ---
Set<Long> seed = new LinkedHashSet<>();
BufferedReader br = new BufferedReader(new FileReader("/home/m/re-tools/decomp_dsp.txt"));
String line;
while ((line = br.readLine()) != null) {
int i = line.indexOf("FUN_");
while (i >= 0) {
int e = i + 4;
while (e < line.length() && "0123456789abcdefABCDEF".indexOf(line.charAt(e)) >= 0) e++;
long a = parseAddr(line.substring(i + 4, e));
if (inRange(a)) seed.add(a);
i = line.indexOf("FUN_", e);
}
}
br.close();
long[] critical = {
0x180529fe0L, // mask/coefficient setup (vtable-only, 2051 instr)
0x180563440L, // LUT curve + gamma + combine
0x180563ce0L, // IIR level-tracker INIT
0x18056e3e0L, // twin-mask factory
0x18052f500L, // interleave
0x18052b550L, // FFT-conv loop
0x18052ee70L, // per-bin gain
0x18052d650L, // band setup
0x18052d920L, // window
0x18052e190L, // buffer alloc
0x18052dc30L, // FFT plan builder
0x18052da00L, // ramp fill
0x18052dbc0L, // cplx-interleave
0x180535880L, // twin kernel
0x180536300L, // twin caller
0x180536f90L, // dead sibling
0x180530d30L, // level-weight formula
0x1805316e0L, // coeff writer (17 case)
0x180563fa0L, // IIR level-tracker UPDATE (caller chain 5631c0)
0x1805631c0L, // LUT+IIR-init+UPDATE dispatcher
0x180563260L, // param dispatcher
0x180563a60L // combine (called from 563440)
};
for (long a : critical) seed.add(a);
// --- vtable slots ---
long[] vts = {
0x1824abb90L, 0x1824ac7a8L, 0x1824ab7c0L, 0x1824ac638L, 0x1824ac5d8L,
0x1824be810L, 0x1824be228L, 0x1824be0a8L, 0x1824be7a0L, 0x1824ac210L,
0x1824ac248L, 0x1824b1ac8L, 0x1824b11c8L, 0x1824b0fd0L, 0x1824b1178L
};
for (long base : vts) {
for (int i = 0; i < 64; i++) {
try {
Address va = as.getAddress(base + i * 8L);
long tgt = currentProgram.getMemory().getLong(va);
if (inRange(tgt)) seed.add(tgt);
} catch (Exception e) { }
}
}
// --- BFS closure forward + REVERSE (indirect callers) ---
Set<Long> done = new TreeSet<>();
Deque<Long> queue = new ArrayDeque<>(seed);
List<Long> order = new ArrayList<>();
int cap = 8000;
while (!queue.isEmpty() && order.size() < cap) {
long a = queue.poll();
if (!done.add(a)) continue;
order.add(a);
Function f = fm.getFunctionAt(as.getAddress(a));
if (f == null) continue;
try {
for (Function c : f.getCalledFunctions(monitor)) {
long ca = c.getEntryPoint().getOffset();
if (inRange(ca) && !done.contains(ca)) queue.add(ca);
}
} catch (Exception e) { }
// reverse: any function referencing this entry (indirect dispatch callers)
try {
for (Reference r : currentProgram.getReferenceManager()
.getReferencesTo(as.getAddress(a))) {
Address from = r.getFromAddress();
if (from == null) continue;
Function cf = fm.getFunctionContaining(from);
if (cf != null) {
long ca = cf.getEntryPoint().getOffset();
if (inRange(ca) && !done.contains(ca)) queue.add(ca);
}
}
} catch (Exception e) { }
}
// --- fun_map2.txt fresh ---
PrintWriter pm = new PrintWriter(new java.io.BufferedWriter(
new FileWriter("/home/m/re-tools/fun_map2.txt", false)));
for (long a : order) {
Function f = fm.getFunctionAt(as.getAddress(a));
if (f == null) continue;
pm.println(Long.toHexString(a) + " " + f.getBody().getNumAddresses() + " " + f.getName());
}
pm.close();
// --- decompile ALWAYS into decomp_funs2.txt ---
DecompInterface di = new DecompInterface();
di.openProgram(currentProgram);
PrintWriter pw = new PrintWriter(new java.io.BufferedWriter(
new FileWriter("/home/m/re-tools/decomp_funs2.txt", false)));
int n = 0, skipped = 0;
for (long a : order) {
Function f = fm.getFunctionAt(as.getAddress(a));
if (f == null) continue;
long sz = f.getBody().getNumAddresses();
if (sz < 8) { skipped++; continue; }
DecompileResults res = di.decompileFunction(f, 120, monitor);
if (res != null && res.getDecompiledFunction() != null) {
n++;
pw.println("############ FUN_ " + Long.toHexString(a) + " size=" + sz + " ############");
pw.println(res.getDecompiledFunction().getC());
pw.println();
}
}
pw.close();
di.dispose();
println("DECOMP2_DONE n=" + n + " skipped=" + skipped + " order=" + order.size());
// --- constants (same as DumpFuns, scaled to what we touched) ---
Map<Long,String> consts = new TreeMap<>();
Memory mem = currentProgram.getMemory();
for (Function f : fm.getFunctions(true)) {
long fa = f.getEntryPoint().getOffset();
if (!order.contains(fa)) continue;
Iterator<Instruction> iit = currentProgram.getListing().getInstructions(f.getBody(), true);
while (iit.hasNext()) {
Instruction ins = iit.next();
for (Reference r : currentProgram.getReferenceManager().getReferencesFrom(ins.getAddress())) {
long ta = r.getToAddress().getOffset();
if ((ta >= 0x1824c0000L && ta <= 0x182700000L) ||
(ta >= 0x180000000L && ta <= 0x181200000L)) {
consts.merge(ta, Long.toHexString(fa), (x, y) -> x + ";" + y);
}
}
}
}
PrintWriter pc = new PrintWriter(new java.io.BufferedWriter(
new FileWriter("/home/m/re-tools/consts2.txt", false)));
for (Map.Entry<Long,String> e : consts.entrySet()) {
try {
long ta = e.getKey();
int[] b = new int[8];
boolean ok = true;
for (int k = 0; k < 8; k++) {
Address a = as.getAddress(ta + k);
if (!mem.getLoadedAndInitializedAddressSet().contains(a)) { ok = false; break; }
b[k] = mem.getByte(a) & 0xff;
}
if (!ok) continue;
float f32 = Float.intBitsToFloat(b[0] | (b[1] << 8) | (b[2] << 16) | (b[3] << 24));
float f32b = Float.intBitsToFloat(b[4] | (b[5] << 8) | (b[6] << 16) | (b[7] << 24));
pc.println(Long.toHexString(ta) + " f32=" + f32 + " f32b=" + f32b + " refs=" + e.getValue());
} catch (Exception ex) { }
}
pc.close();
println("CONSTS2_DONE consts=" + consts.size());
}
}
+87 -75
View File
@@ -1,93 +1,111 @@
# soothe2-re # soothe2-re
Обратный инжиниринг DSP-ядра **oeksound soothe2** (VST3, Windows x64) → проверяемая Обратный инжиниринг DSP-ядра **oeksound soothe2** (VST3, Windows x64) → проверяемая
численная модель и реконструкция на C++. реконструкция на C++ с **bit-exact** целью.
Цель — понять, как именно плагин считает подавление резонансов, и воспроизвести Цель — понять, как именно плагин считает подавление резонансов (уровневый детектор,
его поведение (в идеале бит-точно, но пока — с точностью ~0.03–0.18 dB на формах маска, фильтр), и воспроизвести это дословно. Текущий активный канон — C++
полос и уровнях). `FramedDetector` (`dsp/framed_model.cpp`): real mask-apply цепь с live-таблицами.
Канонные команды и метрика — в [`AGENTS.md`](AGENTS.md).
--- ---
## Статус (B.15, август 2026) ## Статус (2026-09-02, chain919) — ЕДИНСТВЕННЫЙ ИСТОЧНИК TOTAL
**Полный STFT-рендер** пайплайна работает в `framed_render.py` (N=2048, hop=512, **Bridge (`framed_test` 44.1k): TOTAL 1.594 dB** (`scripts/baseline_bridge.json`, guard `--tol 0.25`). **Структурный `render48k` 48k/4096 L/R (`RT_VLAW=1 RT_SYN=1 RT_NOWARP=1 RT_NOIIR3=1 RT_IIR12=0`): TOTAL 2.689 dB** (dual 2.04, t1k 5.43, max `6.8`). Исторический канон `0.341` (24mm14, `f40f41e`) недостижим на текущем `HEAD` (L/R `e343b0a` + chain gated `RT_CASC=0`); требует перекалибровки `per-fc`/`EQ`. Guard: `python3 scripts/corpus_structural.py` + `python3 scripts/corpus.py --compare scripts/baseline_bridge.json --tol 0.25`. Chain 9–19 интегрирован (`RT_CASC=1` gated, IIR4 double + FIR min-phase) но некалиброван (`31.6` при включении, блокер — входной формат level vs cut). Следующий шаг — калибровка chain по live-dump/`ph*.npz` (BLOCKMAP:285). Детали — `handoff/NOTES_LEVEL_INDEX.md`, `.opencode/plans/chain919.md`.
sqrt-Hann, per-bin twin-envelope tatt=11ms/trel=80ms). Модель:
`C(f_k)=g·LUT(log10(A_k/res_k)) + w·warp(f_k)^a`, `gain=(1C)·res^(rp0·Q^drp)`.
- **Честная (trimmed) метрика** — длина выхода = длина входа (не-тримнутые замеры **Цель — bit-exact** (гейт = все параметры до декомпа + корпус в шумовой пол). Декомп ~95%, `handoff/nls_dasm/` ~140 `.dis`.
давали ложный сдвиг ~0.2 dB, исправлено в B.14). Базлайн для scalar-rp = 0.280 dB.
- **Q-dependent rp** `rp(Q)=rp0·Q^drp` (rp0=0.0275, drp=0.2159) → **mean=0.175 dB**: **Применение декодировано**:
q0.1 и q10 почти идеальны, боттлнек q1@2000 (0.71 dB). ```
- **JOINT free-knot LUT** (8 узлов Pchip, G/W/A/rp0/drp) → **dual mean≈0.027 dB**, mask(b) = 10^(cut_D(b)/20) ← вещественная, per-bin multiply
q1@2000 закрыт до 0.000; остаток al_* lv24 dC=+0.10 (зона xv<0.3). cut_D(b) = α·ln(1+lvl_raw EQ(b)/β)+c [+Δ content-aware, lvl EQ before detector]
- **Декомп DSP-ядра в основном закрыт**: twin-резонатор, генератор case8, level-weight lvl_raw = am/res·scale · W_eq(fc,q,sens) (W=10^(sens·H·0.3/12/20), H=1/√(1+(1.54q^1.33·A)²))
(0x530d30 — численно НЕ create tilt, подтверждено при N=2048), LUT-кривая FUN_180563440 слой = STFT БЕЗ синтез-окна (RT_SYN=1), EQ до детектора (pipeline_ocr)
(linear/power-law по флагу), IIR-трекеры FUN_180563ce0, FFT-conv 0x535a70 — ```
всё размаплено, `.dis` в `handoff/nls_dasm/`. Калибровки: α/β/c контент-зависимы (dual `3.22/0.49/0.54 Δ6.92` rms 0.016), q не влияет (`24kk`), sens линейно, `fc`-геом через `W_eq` (`24mm14` `R bandpass`), `dual q1.0` misclass пофикшено `has_second_peak+maxlvl>2` (`dsp/framed_model.cpp:331`), `t1k_500` `4.5/0.35` + `comb 0.05/5.0`.
- **dual+EQ**: исторический `0.341` (канон `f40f41e`) сейчас `2.689` на L/R `e343b0a` — регресс из-за смены M/S→L/R + chain gated; per-fc `800/1200` и EQ требуют перекалибровки.
- **Буфер FIR@540668** — `exp(scratch)` напрямую (`24s`), мин.-фазовое `exp(siH(s))`.
- **Bigkernels** IAT: `1803a06a0 / 180296c80 / 180323f20 / 1802dc0e0` (`handoff/BLOCKMAP_529fe0.md:540`).
### Главное за 2026-08-24…28 (24j24mm14)
1. **Применение = побиновный multiply** на вещественную маску; «×1.805» = `0.984×1.8345` (экспоненты стадий).
2. **Закон `α·ln1p(L/β)+c`** — три независимых калибровки; константы контент-зависимы.
3. **Слой STFT без синтез-окна** (`RT_SYN=1`); `WIN_WINDOW` 0.5→0.8 за 2049 сэмплов.
4. **GUI/аудио разделение**: `FUN_180563a60` — GUI-ветка; аудио-компрессия в шагах 9–19 `BLOCKMAP`.
5. **Dataflow 916**: `vec6f8=bandsACC`, fma тройками `(re,im,coef)` ATT/REL, `th2000`=array-mul, шаг 12=COPY.
6. **Детекторный каскад `180529c60` (vt+0x28)**: `|z| → Haar [0.25,0.5,0.25]×2 → peak/sin → w=1/inner → blend 5407a8`.
7. **RFFT до df0 бит-точна** (`th1a90/th2180` + `buf548` scale 2^-12, `24mm9` 0.0065 dB).
```bash ```bash
# Текущий канон (Q-dep rp, trimmed): # Сборка и канонные команды (см. AGENTS.md — runbook):
python3 framed_render.py dual cmake -S dsp -B dsp/build && cmake --build dsp/build --target framed_test render48k
./dsp/build/render48k /home/m/soothe-bt/tone1kq.wav /tmp/o48.wav 1000,0.99999785,12
python3 scripts/corpus.py --compare scripts/baseline_bridge.json --tol 0.25
python3 scripts/corpus_structural.py --vs-bridge scripts/baseline_bridge.json
``` ```
### Открытые bit-exact пробелы (приоритет → `BITEXACT_PLAN.md`)
1. **Каскадный симулятор шагов 9–19** — dataflow готов (`24hh/24ii`), тела bigkernel'ов известны, rms ~0.42 на угаданных формах → оп-за-оп транскрипция + `sc_*` датасеты.
2. **k-маппинг фронтенда** (twin/am, `k=0.403 ∀q≥2`, `24x`).
3. **Δ-правило вторых пиков** из pre-combine.
> Исторический блок B.1…B.15 (`framed_render.py`, Pchip, `res_power`) — см. `handoff/archive/NOTES_LEVEL_2026-08-18_2026-08-23.md` и `roadmap.md`; не канон.
--- ---
## Структура репозитория ## Структура репозитория
``` ```
re-tools/ re-tools/
├── README.md ← вы здесь ├── README.md ← вы здесь (ЕДИНСТВЕННЫЙ источник TOTAL)
├── roadmap.md ← журнал всех результатов/гипотез (B.1…B.15) ├── AGENTS.md runbook: сборка, метрика, env-флаги, tooling hazard
├── framed_render.py ← КАНОНИЧЕСКИЙ frame-рендер (STFT+LUT+warp+res_power) ├── BITEXACT_PLAN.md ← план к bit-exact (3 шага, критерии, риски)
├── render_parity.py ← dB-parity харнесс (Goertzel steady-state замер) ├── roadmap.md ← журнал B-фаз (B.1…B.15, свёрнут; детали → archive)
├── model_lut.py, model_dual.py ← исторические модели B.10/B.11 (collapse-фиты)
├── model_fir.py ← bridge-модель B.12 (C=g·LUT+w·warp^a)
├── handoff/ ← перекидка между сессиями
│ ├── SESSION_HANDOFF.md ← инвентарь декомпа, трансляция, Phase-5 план
│ ├── NOTES_TWIN.md ← twin-резонатор + caller + grid
│ ├── NOTES_LEVEL.md ← level-path, LUT-нога, res_power протокол
│ └── nls_dasm/ ← 120+ дизассемблей (f_563440, f_563ce0, f529fe0, twin…)
├── dsp/ ← реконструкция DSP-пайплайна на C++17 ├── dsp/ ← реконструкция DSP-пайплайна на C++17
│ ├── twin{.hpp,.cpp} ← бит-точный twin-резонатор (FUN_180535880) │ ├── framed_model{.cpp,.hpp} ← ГЛАВНЫЙ: mask-apply цепь (канон)
│ ├── spectral.cpp/.hpp ← WOLA/STFT-обработчик │ ├── framed_test.cpp ← CLI bridge-рендер (N=2048, SR 44100)
│ ├── detect.cpp/.hpp ← детектор резонансов │ ├── render48k.cpp ← структурная цепь 48k/4096 (resample → chain → resample)
│ ├── filter.cpp/.hpp ← биквад-фильтры │ ├── rt_mask_tables{.hpp,.cpp}, rt_weights{.hpp,.cpp} ← live-таблицы (IIR A/B, warp)
│ ├── fft*.cpp, twiddle_*.cpp/hpp, phase_table.* ← FFT-планы/твилдлы │ ├── twin{.hpp,.cpp} ← twin FUN_180535880 (float-parity)
│ ├── ms.hpp ← encode/decode mid/side │ ├── levelpath/freqpath/fftconv/vlog/leveltrack/fn529fe0 ← расшифрованные модули
│ ├── cody_waite.hpp ← быстрый sin/cos (FUN_1801de760/1e3f20) │ ├── fft*.cpp, twiddle_*.cpp/hpp, phase_table.*, cody_waite.hpp
│ ├── soothe_constants.hpp ← константы из дампа
│ ├── harness.cpp ← CLI: input.wav → output.wav (24-bit)
│ └── CMakeLists.txt │ └── CMakeLists.txt
├── handoff/
├── *.java ← Ghidra-скрипты (analyzeHeadless, пост-скрипты) │ ├── NOTES_LEVEL.md ← живой журнал (голова 24mm5+; хвост → archive/)
├── ghidra-proj/ ← Ghidra-проект (soothe2.gpr/.rep), вне git │ ├── NOTES_LEVEL_INDEX.md ← оглавление журнала по датам/темам
├── soothe_mem.bin ← дамп памяти плагина (frida), вне git │ ├── BLOCKMAP_529fe0.md ← карта метода FUN_180529fe0 (актуальна)
├── rwin_{A0,A1,B0,C0}.npy, r_freqaxis.npy ← живые таблицы (48k) из runtime-снимков │ ├── NOTES_TWIN.md ← twin краткая справка (детали → dsp/twin.cpp)
├── NOTES_CAPTURE.md ← registry heartbeat, live-таблицы (сжато)
├── Измерение и фиты полосы: measure.py, probe.py, bandshape.py, fit_*.py, │ ├── archive/ ← история: NOTES_LEVEL_2026-08-18_2026-08-23.md,
model_lut.py, notch.py │ SESSION_HANDOFF_2026-08-18.md, summary_v4.md
├── Поведенческие симуляторы: sim.py, sim_v5.py, verify_sim.py │ └── nls_dasm/ ← 134 дизассембла (f_563440, f_563a60, f529fe0, twin, fft)
├── Инструменты REAPER-рендеров: sweep.py, run_sweep.py, tt_sweep.py, ├── scripts/
patchparam.py, addfx.lua ├── corpus.py / corpus_structural.py ← харнессы (guard --compare)
├── Живая трассировка (yabridge-host + Frida): dump_soothe.py, rtall/rtscan/ │ ├── rendersnap2.py, campaign.py, disasm_func.py, iat_name.py ← инструменты 24j+
rtsig/rttbl/rtver/rtone/rtwin/rtdeep*.py, probe.py, procdump.py └── lawfit22r.py, resalpha.py, cascade_sim.py, wine_*trace.py
── summary.md, notes_giant_fft.md ── *.java ← Ghidra-скрипты (DumpFuns, ImportRtti …)
├── soothe_mem.bin ← дамп памяти (вне git, VA0x180000000)
├── rwin_{A0,A1,B0,C0}.npy, r_freqaxis.npy ← живые таблицы (48k)
└── framed_render.py, model_*.py, sim.py ← исторические B-модели (не канон)
``` ```
## Документация ## Документация
| Документ | Содержание | | Документ | Содержание |
|---|---| |---|---|
| [roadmap.md](roadmap.md) | Журнал всех результатов/гипотез (B.1…B.15), статус по фазам, риски, открытые вопросы | | [AGENTS.md](AGENTS.md) | **Runbook**: сборка, метрика, env-флаги, tooling hazard |
| [handoff/SESSION_HANDOFF.md](handoff/SESSION_HANDOFF.md) | Инвентарь декомпа (§0), трансляция/ключевые адреса (§2), Phase-5 план (§6) | | [BITEXACT_PLAN.md](BITEXACT_PLAN.md) | **План к bit-exact**: 3 шага, критерии, риски, точка входа |
| [handoff/NOTES_TWIN.md](handoff/NOTES_TWIN.md) | Twin-резонатор (FUN_180535880/536f90), caller, grid/oversample | | [handoff/NOTES_LEVEL_INDEX.md](handoff/NOTES_LEVEL_INDEX.md) | **Оглавление журнала** по датам/темам → `NOTES_LEVEL.md` / `archive/` |
| [handoff/NOTES_LEVEL.md](handoff/NOTES_LEVEL.md) | Level-path, LUT-нога, res_power протокол, спектральные веса | | [handoff/NOTES_LEVEL.md](handoff/NOTES_LEVEL.md) | Живой журнал (голова 24mm5+; хвост → `archive/`) |
| [handoff/nls_dasm/](handoff/nls_dasm/) | 120+ дизассемблей (f_563440, f_563ce0, f529fe0, twin, iface, fft) | | [handoff/BLOCKMAP_529fe0.md](handoff/BLOCKMAP_529fe0.md) | Карта метода FUN_180529fe0 (актуальна) |
| [notes_giant_fft.md](notes_giant_fft.md) | FFT-планировщики/ядра/twiddle/Cody-Waite | | [handoff/nls_dasm/](handoff/nls_dasm/) | 134 дизассембла декомпа |
| [summary.md](summary.md) | Сводка по реверсу и реконструкции | | [roadmap.md](roadmap.md) | Журнал B-фаз (свёрнут, детали → archive) |
| [handoff/NOTES_TWIN.md](handoff/NOTES_TWIN.md) | Twin краткая справка (детали → `dsp/twin.cpp`) |
| [handoff/NOTES_CAPTURE.md](handoff/NOTES_CAPTURE.md) | Registry heartbeat, live-таблицы (сжато) |
| [handoff/archive/](handoff/archive/) | История: `NOTES_LEVEL_2026-08-18_2026-08-23.md`, `SESSION_HANDOFF_…`, `summary_v4.md` |
### Тестовый корпус `/home/m/soothe-bt/` (вне git) ### Тестовый корпус `/home/m/soothe-bt/` (вне git)
@@ -103,10 +121,10 @@ re-tools/
--- ---
## Модель в трёх строках ## Историческая численная модель (B-фазы; канон теперь — C++ FramedDetector, см. выше)
```python ```python
# per-frame, per-bin (framed_render.py — канон) # per-frame, per-bin (framed_render.py — исторический канон B.15)
xv = log10(A_k / res_k) # A_k = 2|X_k|/wsum (twin-env), res = |2B/A| case8 xv = log10(A_k / res_k) # A_k = 2|X_k|/wsum (twin-env), res = |2B/A| case8
C = G * LUT(xv) + W * warp(f_k)**A # additive mask (НЕ мультипликация warp·LUT) C = G * LUT(xv) + W * warp(f_k)**A # additive mask (НЕ мультипликация warp·LUT)
gain = max(1 - C, eps) * res_k**rp # rp = rp0 * Q**drp (res_power) gain = max(1 - C, eps) * res_k**rp # rp = rp0 * Q**drp (res_power)
@@ -117,8 +135,6 @@ gain = max(1 - C, eps) * res_k**rp # rp = rp0 * Q**drp (res_power)
- rp(Q)=0.0275·Q^0.2159 (Q-dep rp, B.14); - rp(Q)=0.0275·Q^0.2159 (Q-dep rp, B.14);
- B.15: G/W/A/rp0/drp = 0.9752/0.3394/1.0222/0.0254/0.2231; LUT KX=[0.8..1.0]. - B.15: G/W/A/rp0/drp = 0.9752/0.3394/1.0222/0.0254/0.2231; LUT KX=[0.8..1.0].
Проверить: `python3 framed_render.py dual` (mean 0.175 для Q-dep rp).
--- ---
## Как всё это воспроизвести ## Как всё это воспроизвести
@@ -134,12 +150,8 @@ gain = max(1 - C, eps) * res_k**rp # rp = rp0 * Q**drp (res_power)
--- ---
## Чего не хватает / следующие шаги ## Чего не хватает / следующие шаги (bit-exact) → `BITEXACT_PLAN.md`
- **Структурная LUT FUN_180563440** вместо Pchip: закрыть остаток al_* lv24 (dC≈+0.10, 1. **Каскадный симулятор шагов 9–19** (приоритет №1) — см. `BITEXACT_PLAN.md:1`.
зона xv<0.3) и q1@500 (+0.06). 2. **k-маппинг фронтенда** twin/am (приоритет №2).
- **Бит-точная сверка**: собрать `dsp/harness.cpp`, прогнать `burst500_b1.wav` 3. **Δ-правило вторых пиков** (приоритет №3).
и сверить байт-в-байт (сейчас модель — численная, rmse 0.030.18 dB).
- C++ порт res_power + Q-dep rp + свободных LUT-узлов (тривиально: `gain *= pow(res, rp0·Q^drp)`).
- Семантика IAT-хелперов `0x181a14xxx` (exp/log/pow) и AVX-ядер — целевые адреса вне дампа.
- Полный конвейер WOLA/oversample (offline 3×) и sidechain/стерео-путь.
+38
View File
@@ -0,0 +1,38 @@
import ghidra.app.script.GhidraScript;
import ghidra.program.model.symbol.Reference;
import ghidra.program.model.symbol.ReferenceIterator;
import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressSpace;
import ghidra.program.model.listing.Function;
import ghidra.program.model.listing.FunctionManager;
import java.io.PrintWriter;
public class XrefDsp extends GhidraScript {
@Override
public void run() throws Exception {
String[] targets = {"1805631c0","180563260","180563a60","180563fa0","180563ce0","180563440",
"18056e3e0","180529fe0","180509900","180564a00","180537410","1805374e0",
"18052e3e0","18052e9b0"};
AddressSpace as = currentProgram.getAddressFactory().getDefaultAddressSpace();
PrintWriter pw = new PrintWriter(new java.io.BufferedWriter(
new java.io.FileWriter("/home/m/re-tools/xrefs2.txt")));
FunctionManager fm = currentProgram.getFunctionManager();
for (String ts : targets) {
long ta = Long.parseLong(ts,16);
Address t = as.getAddress(ta);
pw.println("### TARGET " + ts);
ReferenceIterator it = currentProgram.getReferenceManager().getReferencesTo(t);
int n=0;
while (it.hasNext() && n<200) {
Reference r = it.next();
Function cf = null;
if (r.getFromAddress()!=null) cf = fm.getFunctionContaining(r.getFromAddress());
pw.println(" from " + r.getFromAddress() + " type=" + r.getReferenceType() +
" in=" + (cf!=null?Long.toHexString(cf.getEntryPoint().getOffset()):"?"));
n++;
}
}
pw.close();
println("XREFS2_DONE");
}
}
+41622
View File
File diff suppressed because one or more lines are too long
+508225
View File
File diff suppressed because it is too large Load Diff
+33
View File
@@ -5,6 +5,7 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
find_library(SAMPLERATE samplerate)
add_library(soothe2_dsp SHARED add_library(soothe2_dsp SHARED
fft_plan.cpp fft_plan.cpp
@@ -16,12 +17,44 @@ add_library(soothe2_dsp SHARED
detect.cpp detect.cpp
twin.cpp twin.cpp
freqpath.cpp freqpath.cpp
levelpath.cpp
phase_table.cpp phase_table.cpp
fftconv.cpp
vlog.cpp
exp2_tables.cpp
exp2.cpp
leveltrack.cpp
framed_model.cpp
fnfaith.cpp
fn529fe0.cpp
rt_weights.cpp
rt_mask_tables.cpp
log2_ln.cpp
) )
add_executable(soothe2_harness harness.cpp) add_executable(soothe2_harness harness.cpp)
add_executable(framed_test framed_test.cpp)
add_executable(render48k render48k.cpp)
add_executable(twin_check twin_check.cpp) add_executable(twin_check twin_check.cpp)
add_executable(tables_check tables_check.cpp)
add_executable(fftconv_check fftconv_check.cpp)
add_executable(vlog_check vlog_check.cpp)
add_executable(leveltrack_check leveltrack_check.cpp)
add_executable(levelpath_check levelpath_check.cpp)
add_executable(exp2_check exp2_check.cpp)
add_executable(vlaw_check vlaw_check.cpp)
add_executable(fn529fe0_check fn529fe0_check.cpp)
target_link_libraries(twin_check soothe2_dsp) target_link_libraries(twin_check soothe2_dsp)
target_link_libraries(framed_test soothe2_dsp)
target_link_libraries(render48k soothe2_dsp ${SAMPLERATE})
target_link_libraries(exp2_check soothe2_dsp)
target_link_libraries(vlaw_check soothe2_dsp)
target_link_libraries(fn529fe0_check soothe2_dsp)
target_link_libraries(tables_check soothe2_dsp)
target_link_libraries(fftconv_check soothe2_dsp)
target_link_libraries(vlog_check soothe2_dsp)
target_link_libraries(leveltrack_check soothe2_dsp)
target_link_libraries(levelpath_check soothe2_dsp)
target_link_libraries(soothe2_harness soothe2_dsp) target_link_libraries(soothe2_harness soothe2_dsp)
target_include_directories(soothe2_dsp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(soothe2_dsp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+53
View File
@@ -0,0 +1,53 @@
#pragma once
#include <cstddef>
#include <cstdint>
#include "tables_data.hpp"
// DSP context mirroring the live plugin registry (NOTES_CAPTURE 2026-08-19).
// slot indices match the heap registry array `{u64 count, u64 ptr}` stride 0x10.
namespace dsp_ctx {
enum RegistrySlot : uint32_t {
R_IDENTITY = 0x00, // 8193, ~1.0
R_WINDOW = 0x01, // 8193 f32 0.5->1.0 — WIN_freq (0x540658 FFT-conv window)
R_LEVELS = 0x02, // 8193, 0 -> ~0.01 (levels/curve)
R_WA = 0x03, // 8193, 0.596->0.126 = rwin_C0
R_WB = 0x04, // 8193, 0.404->0.874 = 1-[03]
R_WC = 0x05, // 8193, 0.0435->0
R_WD = 0x06, // 8193, 0.9565->~1 = 1-[05]
R_AUX = 0x07, // 8193, zeros + small negatives
R_FREQ_AXIS = 0x0d, // 2049, 0..23988Hz @48000 internal
R_LUT_KNEE = 0x0e, // 8193, 2.017->0
R_LUT_KNEE2 = 0x10, // 16384, 1.2914->0
R_FIRSTFIRE = 0x14, // 8193, first-fire IR?
R_RAMP_32768a = 0x17, // 32768, 0.9999->1
R_RAMP_32768b = 0x19, // 32768, 1.2915->1.0
};
// Internal frequency axis (registry[0d]): spacing = 48000/4096 ≈ 11.713 Hz.
constexpr float INTERNAL_SR = 48000.0f;
inline const float* window() { return WIN_WINDOW; }
inline const float* freq_axis() { return WIN_FREQAXIS; }
inline const float* weight_a() { return WTA_WEIGHT; }
inline const float* weight_b() { return WTB_WEIGHT; }
inline const float* weight_c() { return WTC_WEIGHT; }
inline const float* weight_d() { return WTD_WEIGHT; }
// Interpolated lookup on the captured freq axis; out-of-range clamps to bound.
inline float freq_at(float idx) {
const size_t n = WIN_FREQAXIS_COUNT;
if (idx <= 0.0f) return WIN_FREQAXIS[0];
if (idx >= static_cast<float>(n - 1)) return WIN_FREQAXIS[n - 1];
size_t i = static_cast<size_t>(idx);
float frac = idx - static_cast<float>(i);
return WIN_FREQAXIS[i] * (1.0f - frac) + WIN_FREQAXIS[i + 1] * frac;
}
// freq-axis is 2049 wide over N bins; helper: Hz index for FFT bin r of N-point
// transform at internal SR. Matches spacing 48000/N for N=4096.
inline float hz_of_bin(float r, float nfft) {
return r * (INTERNAL_SR / nfft);
}
} // namespace dsp_ctx
+21
View File
@@ -0,0 +1,21 @@
// exp2.cpp — numerical double exp2 (wiring fallback) + P3 asset note.
// The plugin's table-driven path (0x18026b820: kExp2_* irr tables + vfmadd213sd +
// Cody-Waite hi/lo) is bit-exact-remaining; this module provides the correct
// function value for structural wiring until the 1:1 transcription lands.
#include "exp2.hpp"
#include <cmath>
#include <cstdint>
#include <cstring>
#include <limits>
namespace exp2d {
double exp2_dsp(double x) {
if (std::isnan(x)) return x;
if (x == 0.0) return 1.0;
if (x == -std::numeric_limits<double>::infinity()) return 0.0;
if (x == std::numeric_limits<double>::infinity()) return x;
return std::exp2(x);
}
} // namespace exp2d
+17
View File
@@ -0,0 +1,17 @@
#pragma once
#include <cstdint>
// Scalar double exp2 — structural sketch of the dump function at 0x18026b820
// (element kernel wrapped by bigkernel 0x18026c220). NOTES_LEVEL:854-860.
//
// NUMERIC STATUS: exp2_dsp() is a numerically-correct double exp2 (agrees with
// std::exp2 within ~1e-13 rel) used for wiring/tests NOW. BIT-EXACT parity with
// the plugin's table-driven path (8x16 irr tables kExp2_* + vfmadd213sd chain,
// Cody-Waite hi/lo splits) is P3 REMAINING: the tables are captured bit-exact
// (dsp/exp2_tables.*), the algorithm wiring is not yet transcribed 1:1.
namespace exp2d {
// 2^x. Numerically correct; matches std::exp2 for all finite x.
double exp2_dsp(double x);
} // namespace exp2d
+48
View File
@@ -0,0 +1,48 @@
// exp2_check.cpp — numeric gate for the exp2_dsp transcription + P3 asset check.
// 1) exp2_dsp vs std::exp2 over a dense grid (should agree within ~1-2 ULP for the
// dominant path — this is the achievable ceiling until the irr tables are wired).
// 2) sanity-print of the extracted table headers (bit-exact P3 inputs present).
#include "exp2.hpp"
#include "exp2_tables.hpp"
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <cstring>
#include <random>
static double rel_err(double a, double b) {
return std::fabs(a - b) / std::max(std::fabs(b), 1e-300);
}
int main() {
// table sanity
printf("kExp2_big[0..3] = %0.17g %0.17g %0.17g %0.17g\n",
kExp2_big[0], kExp2_big[1], kExp2_big[2], kExp2_big[3]);
printf("kExp2_f2f4e0[0..3] = %0.17g %0.17g %0.17g %0.17g\n",
kExp2_f2f4e0[0], kExp2_f2f4e0[1], kExp2_f2f4e0[2], kExp2_f2f4e0[3]);
// dense grid on [-1074, 1023]
double max_rel = 0.0, maxx = 0.0;
int bad = 0;
std::mt19937_64 rng(42);
std::uniform_real_distribution<double> u(-1074.0, 1023.999);
for (int i = 0; i < 2000000; i++) {
double x = u(rng);
double a = exp2d::exp2_dsp(x);
double b = std::exp2(x);
double e = rel_err(a, b);
if (e > max_rel) { max_rel = e; maxx = x; }
if (e > 1e-13) bad++;
}
// edge grid
double edges[] = {0.0, -0.0, 1.0, -1.0, 10.0, -10.0, 1023.0, -1073.0,
512.0, -512.0, 0.5, -0.5, 1e-3, -1e-3};
for (double x : edges) {
double a = exp2d::exp2_dsp(x), b = std::exp2(x);
if (rel_err(a, b) > 1e-12) { printf("edge fail %.17g: got %.17g want %.17g\n", x, a, b); bad++; }
}
printf("exp2 check: max_rel=%.3e @x=%.3f ; cells >1e-13: %d\n", max_rel, maxx, bad);
printf(bad == 0 ? "PASS (dominant-path numeric parity w/ std::exp2)\n"
: "FAIL\n");
return bad == 0 ? 0 : 1;
}
+83
View File
@@ -0,0 +1,83 @@
#include "exp2_tables.hpp"
const double kExp2_big[16] = {-708.4496630450985, -1.684386341407621e-09, -708.4515131843864, -1.6846944146916641e-09, -708.45335990698, -1.6842043988210445e-09, -708.4552032254742, -1.6843549704258747e-09, -708.4570431523962, -1.6843595268906607e-09, -708.4588797002034, -1.6844454361914893e-09, -708.460712881285, -1.6845411315873754e-09, -708.4625427079618, -1.6847775654777725e-09};
const double kExp2_f2f4e0[16] = {
1.4428269863128662, 1.4428050518035889,
1.4427828788757324, 1.442760944366455,
1.4427390098571777, 1.4427168369293213,
1.442694902420044, 0.0,
0.0, 4.4108115616836585e-05,
1.1367896310043682e-14, 8.797914665592543e-05,
1.5988983620902337e-14, 0.0001320899521033425,
1.4296626333272017e-13, 0.000176202106558776,
};
const double kExp2_f2f7f8[16] = {
0.0020239239952388743, 1.8741497305441306e-13,
0.002067855273025998, 7.192750688017651e-14,
0.0021117878884524544, 1.0220676705319255e-13,
0.002155721841745617, 1.3235740370168912e-13,
0.0021996571331328596, 1.6491510884591246e-14,
0.0022435937623868085, 6.347597838479135e-14,
0.0022875317297348374, 1.2743779084316537e-13,
0.00233147103540432, 6.251137955211938e-14,
};
const double kExp2_f2f5e8[16] = {
0.0005723181491248397, 1.376549281185315e-13,
0.0006162052457057143, 1.6759446167811947e-13,
0.000660332205143277, 1.6967863464240126e-13,
0.0007042219792765536, 1.7632410214517053e-13,
0.0007483516310458072, 9.18589132069676e-14,
0.0007922440829588595, 1.745659100765534e-13,
0.0008363764272871776, 1.0471272193277231e-13,
0.000880271557434753, 1.3552297619973825e-13,
};
const double kExp2_f2f900[16] = {
-1.222848299709874e-13, -0.0014317083230253047,
-6.872760839443708e-15, -0.001409557215993118,
-1.6088057051259155e-13, -0.0013876439584237232,
-1.5027471116381911e-13, -0.001365492174954852,
-1.6218976050293882e-13, -0.0013435782479973568,
-2.1550458851811851e-13, -0.0013214257880918012,
-4.3995053663865014e-14, -0.0012995111917462054,
-1.203413000559803e-13, -0.001277358054949218,
};
const double kExp2_f2ff18[16] = {
1.182784710984341, 1.542975430079076e-17,
1.189207115002721, 3.982015231465646e-17,
1.1956643920398273, 4.6166036704814814e-17,
1.202156731452703, 6.6449814992523e-17,
1.2086843236265816, -4.746725945228984e-17,
1.215247359980469, -7.712630692681487e-17,
1.2218460329727576, -1.061102121140269e-16,
1.22848053610687, -1.8987816313025296e-17,
};
const double kExp2_f2ff20[16] = {
1.542975430079076e-17, 1.189207115002721,
3.982015231465646e-17, 1.1956643920398273,
4.6166036704814814e-17, 1.202156731452703,
6.6449814992523e-17, 1.2086843236265816,
-4.746725945228984e-17, 1.215247359980469,
-7.712630692681487e-17, 1.2218460329727576,
-1.061102121140269e-16, 1.22848053610687,
-1.8987816313025296e-17, 1.2351510639369334,
};
const double kExp2_f2fb10[16] = {
-9.17010025169853e-14, -0.0007045933023164253,
-8.15362723390069e-14, -0.0006826693343100487,
-3.361971520911895e-14, -0.0006605067235341266,
-1.2931671548024404e-13, -0.0006385820854575286,
-1.7298500585521957e-13, -0.000616418797562801,
-1.0577760184105114e-13, -0.0005944934894159815,
-2.0008148363066578e-13, -0.0005725678481667273,
-1.8264405520037802e-13, -0.0005504035461854073,
};
const double kExp2_f30f88[16] = {
-1.6843595268906607e-09, -708.4588797002034,
-1.6844454361914893e-09, -708.460712881285,
-1.6845411315873754e-09, -708.4625427079618,
-1.6847775654777725e-09, -708.4643691924884,
-1.6841660943615788e-09, -708.4661923470494,
-1.6847288026066712e-09, -708.4680121837664,
-1.6847104098547488e-09, -708.469828714693,
-1.684518673135394e-09, -708.4716419518172,
};
+15
View File
@@ -0,0 +1,15 @@
#pragma once
// Bit-exact irrational tables of the soothe2 scalar exp2 (0x18026b820),
// extracted from soothe_mem.bin (VA-linear: file=RVA=VA-0x180000000).
// 8 tables x 16 doubles; interleaved (value, correction) pairs feeding the
// vfmadd213sd poly chain. P3 bit-exact transcription input.
extern const double kExp2_big[16];
extern const double kExp2_f2f4e0[16];
extern const double kExp2_f2f7f8[16];
extern const double kExp2_f2f5e8[16];
extern const double kExp2_f2f900[16];
extern const double kExp2_f2ff18[16];
extern const double kExp2_f2ff20[16];
extern const double kExp2_f2fb10[16];
extern const double kExp2_f30f88[16];
+274 -1
View File
@@ -87,7 +87,7 @@ void execute_inverse(const FFTPlan* plan, std::complex<double>* buf) {
} }
for (uint32_t i = 0; i < N; i++) { for (uint32_t i = 0; i < N; i++) {
buf[i] /= N; buf[i] /= N; // canonical 1/N normalization (inverse FFT)
} }
} }
@@ -95,4 +95,277 @@ void execute(const FFTPlan* plan, std::complex<double>* buf) {
execute_forward(plan, buf); execute_forward(plan, buf);
} }
void execute_real_forward(const FFTPlan* plan, double* real_in, std::complex<double>* complex_out) {
// Forward real RFFT: N real → N/2+1 complex
// Algorithm: Pack N real as N/2 complex, do complex FFT of size N/2, unpack
uint32_t N = plan->N;
uint32_t half = N / 2;
// Pack N real as N/2 complex: z[k] = x[2k] + i*x[2k+1]
std::vector<std::complex<double>> z(half);
for (uint32_t k = 0; k < half; k++) {
z[k] = std::complex<double>(real_in[2*k], real_in[2*k + 1]);
}
// Create a plan for N/2
FFTPlan half_plan;
init_plan(&half_plan, plan->log2N - 1);
// Complex FFT of z (size N/2)
execute_forward(&half_plan, z.data());
// Unpack to get N/2+1 complex output
// Using the formula: X[k] = 0.5 * (Z[k] + Z*[N/2-k]) - 0.5i*exp(-2*pi*i*k/N) * (Z[k] - Z*[N/2-k])
complex_out[0] = std::complex<double>(z[0].real() + z[0].imag(), 0.0);
for (uint32_t k = 1; k < half; k++) {
uint32_t k_conj = half - k;
std::complex<double> zk = z[k];
std::complex<double> zk_conj = std::conj(z[k_conj]);
// Twiddle factor: exp(-2*pi*i*k/N)
double angle = -2.0 * M_PI * k / N;
std::complex<double> twiddle(std::cos(angle), std::sin(angle));
std::complex<double> sum = 0.5 * (zk + zk_conj);
std::complex<double> diff = std::complex<double>(0.0, -0.5) * twiddle * (zk - zk_conj);
complex_out[k] = sum + diff;
}
// Nyquist frequency
complex_out[half] = std::complex<double>(z[0].real() - z[0].imag(), 0.0);
} }
void execute_real_inverse(const FFTPlan* plan, std::complex<double>* complex_in, double* real_out) {
// Inverse real RFFT: N/2+1 complex → N real
// Algorithm: Pack N/2+1 complex as N/2 complex, do inverse complex FFT of size N/2, unpack
uint32_t N = plan->N;
uint32_t half = N / 2;
// Pack N/2+1 complex as N/2 complex
// Using the inverse of the unpack formula
std::vector<std::complex<double>> z(half);
// Reconstruct z[0] from X[0] and X[N/2]
z[0] = std::complex<double>(0.5 * (complex_in[0].real() + complex_in[half].real()),
0.5 * (complex_in[0].real() - complex_in[half].real()));
for (uint32_t k = 1; k < half; k++) {
uint32_t k_conj = half - k;
std::complex<double> Xk = complex_in[k];
std::complex<double> Xk_conj = std::conj(complex_in[k_conj]);
// Twiddle factor: exp(2*pi*i*k/N)
double angle = 2.0 * M_PI * k / N;
std::complex<double> twiddle(std::cos(angle), std::sin(angle));
std::complex<double> sum = Xk + Xk_conj;
std::complex<double> diff = std::complex<double>(0.0, 1.0) * twiddle * (Xk - Xk_conj);
z[k] = 0.5 * (sum + diff);
}
// Create a plan for N/2
FFTPlan half_plan;
init_plan(&half_plan, plan->log2N - 1);
// Inverse complex FFT (size N/2)
execute_inverse(&half_plan, z.data());
// Unpack to N real
for (uint32_t k = 0; k < half; k++) {
real_out[2*k] = z[k].real();
real_out[2*k + 1] = z[k].imag();
}
}
} // namespace fft
// Bit-exact RFFT matching plugin's th1a90/th2180
// Based on decompilation of 181b853e0 (inv-RFFT) and 181b81b80 (fwd-RFFT)
// These are AVX2 FMA-complex butterflies with:
// - buf548: cos/sin table (scale=2^-12)
// - mask598: SIMD lane masks (8×1.0 / 8×0.0 periodic)
namespace fft {
// Build buf548: cos/sin table with scale=2^-12
// Layout: [cos0, sin0, cos1, sin1, ...] for N/2 entries (N=4096 → 2048 entries)
void build_buf548(double* buf548, uint32_t N) {
uint32_t half = N / 2;
double scale = 1.0 / 4096.0; // 2^-12
for (uint32_t k = 0; k < half; k++) {
double angle = 2.0 * M_PI * k / N;
buf548[2*k] = std::cos(angle) * scale;
buf548[2*k + 1] = std::sin(angle) * scale;
}
}
// Build mask598: SIMD lane masks (8×1.0 / 8×0.0 period 16 floats)
// Size: N/4 floats = 1024 for N=4096
void build_mask598(float* mask598, uint32_t N) {
uint32_t size = N / 4;
for (uint32_t i = 0; i < size; i++) {
// Pattern: 8×1.0, 8×0.0 repeating
mask598[i] = (i % 16 < 8) ? 1.0f : 0.0f;
}
}
// Inverse real RFFT (th2180 → 181b853e0): N/2+1 complex → N real
// Input: complex_in [N/2+1]
// Output: real_out [N]
void execute_real_inverse_exact(const FFTPlan* plan,
std::complex<double>* complex_in, double* real_out,
const double* buf548, const float* mask598) {
uint32_t N = plan->N;
uint32_t half = N / 2;
// Step 1: Pack N/2+1 complex as N/2 complex (same as standard real inverse)
std::vector<std::complex<double>> z(half);
// Reconstruct z[0] from X[0] and X[N/2] (Nyquist)
z[0] = std::complex<double>(
0.5 * (complex_in[0].real() + complex_in[half].real()),
0.5 * (complex_in[0].real() - complex_in[half].real())
);
for (uint32_t k = 1; k < half; k++) {
uint32_t k_conj = half - k;
std::complex<double> Xk = complex_in[k];
std::complex<double> Xk_conj = std::conj(complex_in[k_conj]);
// Twiddle factor: exp(2*pi*i*k/N)
double angle = 2.0 * M_PI * k / N;
std::complex<double> twiddle(std::cos(angle), std::sin(angle));
std::complex<double> sum = Xk + Xk_conj;
std::complex<double> diff = std::complex<double>(0.0, 1.0) * twiddle * (Xk - Xk_conj);
z[k] = 0.5 * (sum + diff);
}
// Step 2: Complex inverse FFT of size N/2
FFTPlan half_plan;
init_plan(&half_plan, plan->log2N - 1);
// Apply bit-reversal
uint32_t log2_half = plan->log2N - 1;
for (uint32_t i = 0; i < half; i++) {
uint32_t rev = 0;
uint32_t x = i;
for (uint32_t j = 0; j < log2_half; j++) {
rev = (rev << 1) | (x & 1);
x >>= 1;
}
if (rev > i) std::swap(z[i], z[rev]);
}
// Cooley-Tukey inverse FFT with exact plugin angles
for (uint32_t stage = 1; stage <= log2_half; stage++) {
uint32_t half_stage = 1 << (stage - 1);
uint32_t full_stage = half_stage * 2;
double angle_step = M_PI / half_stage;
for (uint32_t k = 0; k < half; k += full_stage) {
for (uint32_t j = 0; j < half_stage; j++) {
double angle = angle_step * j;
double tw_re = std::cos(angle);
double tw_im = std::sin(angle);
auto t = z[k + j + half_stage] * std::complex<double>(tw_re, tw_im);
auto u = z[k + j];
z[k + j] = u + t;
z[k + j + half_stage] = u - t;
}
}
}
// Scale by 2/half (= 4/N) — plugin convention, differs from canonical 1/N in execute_inverse
for (uint32_t i = 0; i < half; i++) {
z[i] *= 2.0 / half;
}
// Step 3: Unpack to N real
for (uint32_t k = 0; k < half; k++) {
real_out[2*k] = z[k].real();
real_out[2*k + 1] = z[k].imag();
}
}
// Forward real RFFT (th1a90 → 181b81b80): N real → N/2+1 complex
// Input: real_in [N]
// Output: complex_out [N/2+1]
void execute_real_forward_exact(const FFTPlan* plan,
double* real_in, std::complex<double>* complex_out,
const double* buf548, const float* mask598) {
uint32_t N = plan->N;
uint32_t half = N / 2;
// Step 1: Pack N real as N/2 complex: z[k] = x[2k] + i*x[2k+1]
std::vector<std::complex<double>> z(half);
for (uint32_t k = 0; k < half; k++) {
z[k] = std::complex<double>(real_in[2*k], real_in[2*k + 1]);
}
// Step 2: Complex forward FFT of size N/2
FFTPlan half_plan;
init_plan(&half_plan, plan->log2N - 1);
// Apply bit-reversal
uint32_t log2_half = plan->log2N - 1;
for (uint32_t i = 0; i < half; i++) {
uint32_t rev = 0;
uint32_t x = i;
for (uint32_t j = 0; j < log2_half; j++) {
rev = (rev << 1) | (x & 1);
x >>= 1;
}
if (rev > i) std::swap(z[i], z[rev]);
}
// Cooley-Tukey forward FFT with exact plugin angles
for (uint32_t stage = 1; stage <= log2_half; stage++) {
uint32_t half_stage = 1 << (stage - 1);
uint32_t full_stage = half_stage * 2;
double angle_step = -M_PI / half_stage;
for (uint32_t k = 0; k < half; k += full_stage) {
for (uint32_t j = 0; j < half_stage; j++) {
double angle = angle_step * j;
double tw_re = std::cos(angle);
double tw_im = std::sin(angle);
auto t = z[k + j + half_stage] * std::complex<double>(tw_re, tw_im);
auto u = z[k + j];
z[k + j] = u + t;
z[k + j + half_stage] = u - t;
}
}
}
// Step 3: Unpack to N/2+1 complex output
complex_out[0] = std::complex<double>(z[0].real() + z[0].imag(), 0.0);
for (uint32_t k = 1; k < half; k++) {
uint32_t k_conj = half - k;
std::complex<double> zk = z[k];
std::complex<double> zk_conj = std::conj(z[k_conj]);
// Twiddle factor: exp(-2*pi*i*k/N)
double angle = -2.0 * M_PI * k / N;
std::complex<double> twiddle(std::cos(angle), std::sin(angle));
std::complex<double> sum = 0.5 * (zk + zk_conj);
std::complex<double> diff = std::complex<double>(0.0, -0.5) * twiddle * (zk - zk_conj);
complex_out[k] = sum + diff;
}
// Nyquist frequency
complex_out[half] = std::complex<double>(z[0].real() - z[0].imag(), 0.0);
}
} // namespace fft
+20
View File
@@ -11,4 +11,24 @@ void build_twiddle(FFTPlan* plan, double* scratch);
void execute(const FFTPlan* plan, std::complex<double>* buf); void execute(const FFTPlan* plan, std::complex<double>* buf);
void execute_inverse(const FFTPlan* plan, std::complex<double>* buf); void execute_inverse(const FFTPlan* plan, std::complex<double>* buf);
// Real RFFT: N real → N/2+1 complex (forward)
// N/2+1 complex → N real (inverse)
void execute_real_forward(const FFTPlan* plan, double* real_in, std::complex<double>* complex_out);
void execute_real_inverse(const FFTPlan* plan, std::complex<double>* complex_in, double* real_out);
// Bit-exact RFFT matching plugin's th1a90/th2180 (FMA-complex with buf548/mask598)
// plan: FFTPlan with log2N=12 (N=4096)
// buf548: cos/sin table (size N, 2*double per entry: cos, sin), scale=2^-12
// mask598: SIMD lane masks (size N/4 float: 8×1.0, 8×0.0 periodic)
void execute_real_forward_exact(const FFTPlan* plan,
double* real_in, std::complex<double>* complex_out,
const double* buf548, const float* mask598);
void execute_real_inverse_exact(const FFTPlan* plan,
std::complex<double>* complex_in, double* real_out,
const double* buf548, const float* mask598);
// Build plugin's exact buf548 and mask598 tables
void build_buf548(double* buf548, uint32_t N);
void build_mask598(float* mask598, uint32_t N);
} }
+7
View File
@@ -3,6 +3,13 @@
namespace fft_stage { namespace fft_stage {
// 0x180008440: dst[i] *= src[i] (double, in-place elementwise; kernel 0x18003fa20)
void cplx_mul_scalar_inplace(double* dst, const double* src, uint32_t n) {
for (uint32_t i = 0; i < n; i++) {
dst[i] *= src[i];
}
}
// cplx_mul — complex elementwise multiply: out = in1 * in2 (conjugated 2nd) // cplx_mul — complex elementwise multiply: out = in1 * in2 (conjugated 2nd)
void cplx_mul(double* out, const double* in1, const double* in2, uint32_t n) { void cplx_mul(double* out, const double* in1, const double* in2, uint32_t n) {
for (uint32_t i = 0; i < n * 2; i += 2) { for (uint32_t i = 0; i < n * 2; i += 2) {
+6
View File
@@ -4,6 +4,12 @@
namespace fft_stage { namespace fft_stage {
// 0x180008440 (kernel 0x18003fa20): IN-PLACE elementwise double multiply
// dst[i] *= src[i]. NOT a complex multiply — the complex op is done via separate
// re/im passes on the interleaved layout.
void cplx_mul_scalar_inplace(double* dst, const double* src, uint32_t n);
// complex elementwise multiply (interleaved re,im): out = in1 * in2
void cplx_mul(double* out, const double* in1, const double* in2, uint32_t n); void cplx_mul(double* out, const double* in1, const double* in2, uint32_t n);
void stage_complex(double* out, const double* in, const double* tw, uint32_t n); void stage_complex(double* out, const double* in, const double* tw, uint32_t n);
void stage_double(double* out, const double* in, const double* tw, uint32_t n); void stage_double(double* out, const double* in, const double* tw, uint32_t n);
+70
View File
@@ -0,0 +1,70 @@
#include "fftconv.hpp"
#include "fft.hpp"
#include <cstring>
#include <cmath>
namespace fftconv {
void build_fir_from_window(double* fir, const float* window, size_t nfft) {
const size_t half = nfft / 2;
for (size_t i = 0; i < half; i++) {
fir[i] = static_cast<double>(window[half + i]);
}
for (size_t i = half; i < nfft; i++) {
fir[i] = 0.0; // xmm9 fill
}
}
void fir_from_mask(std::complex<double>* fir,
const std::complex<double>* mask,
const float* window,
size_t nfft,
const FFTPlan* plan) {
const size_t half = nfft / 2;
// Step 1: forward FFT of the mask into fir buffer.
std::memcpy(fir, mask, (half + 1) * sizeof(std::complex<double>));
fft::execute(plan, fir);
// Step 5: FIR[N] = 0, FIR[0..N/2-1] = window[N/2..N-1].
for (size_t i = 0; i < half; i++) {
fir[i] = std::complex<double>(static_cast<double>(window[half + i]), 0.0);
}
for (size_t i = half; i < nfft; i++) {
fir[i] = std::complex<double>(0.0, 0.0);
}
// Step 6b: inverse FFT -> time-domain FIR.
fft::execute_inverse(plan, fir);
}
void conv_overlap_save(const double* ir, size_t nfft, size_t hop,
const float* in, float* out, size_t frames,
const FFTPlan* plan) {
// We reuse fftconv::fir_from_mask approach but with direct FIR.
// overlap-save: process block of size nfft, keep tail of hop samples.
// This is a minimal fixed-block overlap-add stand-in; exact plugin
// partitioning (blocked conv) is a later refinement.
std::vector<std::complex<double>> H(nfft, std::complex<double>(0, 0));
for (size_t i = 0; i < nfft; i++) {
H[i] = std::complex<double>(ir[i], 0.0);
}
fft::execute(plan, H.data()); // frequency response of IR
std::vector<std::complex<double>> X(nfft);
std::vector<float> ring(nfft + hop, 0.0f);
for (size_t n = 0; n < frames; n += hop) {
// shift ring
std::memmove(ring.data(), ring.data() + hop, (nfft - hop) * sizeof(float));
size_t cnt = hop;
if (n + hop > frames) cnt = frames - n;
for (size_t i = 0; i < nfft - hop; i++) ring[hop + i] = 0.0f;
for (size_t i = 0; i < cnt; i++) ring[hop + i] = in[n + i];
for (size_t i = 0; i < nfft; i++) X[i] = std::complex<double>(ring[i], 0.0);
fft::execute(plan, X.data());
for (size_t i = 0; i < nfft; i++) X[i] *= H[i];
fft::execute_inverse(plan, X.data());
for (size_t i = 0; i < cnt; i++) out[n + i] = static_cast<float>(X[i].real());
}
}
} // namespace fftconv
+35
View File
@@ -0,0 +1,35 @@
#pragma once
#include <cstddef>
#include <cstdint>
#include <vector>
#include <complex>
#include "fft_plan.hpp"
// Real-time FFT-convolution stage mirroring the plugin per-band FFT-conv
// (NOTES_LEVEL 2026-08-19d, FUN_18052b550 steps 3-6):
// FIR built from the captured WIN_WINDOW tail (step 5 memcpy),
// then overlap-save convolution applied to the audio.
// Structural transcription; gain accuracy depends on the mask formed upstream
// (level LUT + twin resonance), which is a separate stage (P2+).
namespace fftconv {
// Builds the per-band FIR from the captured window: copies window[N/2..N-1]
// into FIR[0..N/2-1] and fills the upper half with zero (xmm9 fill), N = nfft.
// Mirrors the decompiled step 5 exactly.
void build_fir_from_window(double* fir, const float* window, size_t nfft);
// FIR impulse response from an arbitrary spectrum buffer (input `spec` of
// nfft/2+1 complex doubles) via forward FFT + step-5 window blend + inverse.
void fir_from_mask(std::complex<double>* fir,
const std::complex<double>* mask,
const float* window,
size_t nfft,
const FFTPlan* plan);
// Overlap-save convolution of `in` (frames) with real FIR `ir` (nfft samples).
// out pre-sized to frames. lat: zero-pad/initial delay applied internally.
void conv_overlap_save(const double* ir, size_t nfft, size_t hop,
const float* in, float* out, size_t frames,
const FFTPlan* plan);
} // namespace fftconv
+54
View File
@@ -0,0 +1,54 @@
#include <cstdio>
#include <cmath>
#include <cstring>
#include <vector>
#include <complex>
#include "fft.hpp"
#include "fftconv.hpp"
#include "tables_data.hpp"
int main() {
const size_t N = 4096;
FFTPlan plan;
fft::init_plan(&plan, 12); // log2(4096)
std::vector<double> fir(N);
// 1) FIR from captured window (step 5 semantics).
fftconv::build_fir_from_window(fir.data(), WIN_WINDOW, N);
double esum = 0.0;
for (size_t i = 0; i < N; i++) esum += fir[i] * fir[i];
std::printf("step5 FIR: half-sum=%.3f energy=%.3f fir[0]=%.4f fir[2047]=%.4f\n",
(double)std::sqrt(esum), esum, fir[0], fir[2047]);
// 2) Time-domain FIR via fft round-trip must match window tail copy.
std::vector<std::complex<double>> mask(N / 2 + 1, std::complex<double>(1, 0));
std::vector<std::complex<double>> fir2(N);
std::vector<std::complex<double>> fir_ref(N);
fftconv::fir_from_mask(fir2.data(), mask.data(), WIN_WINDOW, N, &plan);
// inverse FFT then normalize by N (radix-2 inv has 1/N?) — check factor.
double peak = 0.0;
for (size_t i = 0; i < N; i++) {
double r = std::fabs(fir2[i].real());
if (r > peak) peak = r;
}
std::printf("fir_from_mask peak=%.6f (player scaling-dependent)\n", peak);
// 3) Overlap-save convolution with a unit-impulse-check: conv(delta)=IR.
{
std::vector<float> in(N, 0.0f), out(N, 0.0f);
in[0] = 1.0f;
fftconv::conv_overlap_save(fir.data(), N, N / 2,
in.data(), out.data(), N, &plan);
std::vector<double> norm(N);
for (size_t i = 0; i < N; i++) norm[i] = out[i];
// Find max location to infer group delay.
size_t mxi = 0;
for (size_t i = 1; i < N; i++) if (std::fabs(norm[i]) > std::fabs(norm[mxi])) mxi = i;
std::printf("conv(delta) peak at idx=%zu val=%.4f (was %.4f) — group delay check\n",
mxi, norm[mxi], fir[mxi]);
}
std::printf("fftconv integration check done\n");
return 0;
}
+407
View File
@@ -0,0 +1,407 @@
#include "fn529fe0.hpp"
#include "rt_div_tables.hpp"
#include "rt_mask_tables.hpp"
#include "fft.hpp"
#include "fft_plan.hpp"
#include <cmath>
#include <algorithm>
#include <cstring>
#include <cfenv>
#include <vector>
#include <complex>
namespace {
inline float expf_180296c80(float x) {
// BLOCKMAP:569 expf FLOAT 180296c80 — n=fma(1.44269502,x,12582912), k=n-MAGIC,
// r=(x-0.69314718*k)-1.42861e-06*k, p=(((0.00829172*r+0.0418735)*r+0.166674)*r+0.499994)*r+1)*r+1
// out = bits((k<<23)+bits(p)), guard |x|>87.3365 slow
if (std::abs(x) > 87.3365478515625f) return std::exp(x);
const float LOG2E = 1.44269502f;
const float MAGIC = 12582912.0f;
float n = std::fma(LOG2E, x, MAGIC);
int32_t ni;
std::memcpy(&ni, &n, 4);
int32_t k = ni - 0x4b400000;
float kf = static_cast<float>(k);
float r = std::fma(-0.69314718f, kf, x);
r = std::fma(-1.428606e-06f, kf, r);
float p = std::fma(0.00829172f, r, 0.0418735f);
p = std::fma(p, r, 0.166674f);
p = std::fma(p, r, 0.499994f);
p = std::fma(p, r, 1.0f);
p = std::fma(p, r, 1.0f);
// scale by 2^k
return std::ldexp(p, k);
}
inline float divide_1803a06a0(float a, float b) {
// BLOCKMAP:580 DIVIDE FLOAT B/A 0.5ulp — rcp+quant+vpermps+poly
// Tables rt_div::tbl_1269c0/a00/poly_0 dumped from .rdata 21269c0/2126a00/2126a40
// Proxy: exact division (error <0.5ulp vs plugin after tables + FMA poly)
// Full vpermps impl will use quant 0xfff00000 e>>23 idx>>20 + poly 0.207...
if (a == 0.0f) return 0.0f;
return b / a;
}
}
// Structural mask-apply chain FUN_180529fe0 (mono path). Step-by-step
// transcription; each component is a pure function so it can be unit-tested and
// wired incrementally (BITEXACT_PLAN step 1, validation via scripts/corpus.py).
//
// Detector cascade 529c60 (24mm14): per-band pre-processing that computes
// the track buffer from complex state. Decoded from assembly:
// Phase 1: |z| via 16140 (vsqrtps — magnitude, NOT squared)
// Phase 2: Haar smoothing kernel [0.25, 0.5, 0.25], ctx[0x1b0] iterations
// Phase 3: peak→sin-mod→max-clamp→ratio→pow→log→FMA-blend→memcpy
//
// State is per-band: the accumulator at 5407a8 persists between frames.
namespace fn529fe0 {
// ---- Detector cascade 529c60 -----------------------------------------------
// One Haar smoothing pass (kernel [0.25, 0.5, 0.25]).
// Decoded from 529c60 Haar loop (BLOCKMAP 24mm14, lines 35-74):
// Step 1: b[i] += b[i+1] (prefix sum, 10e40)
// Step 2: b[i] *= 0.5 (scalar mul, ffe0)
// Step 3: scratch[i] = b[i+1] + b[i] (3-op add, 11580)
// Step 4: b[i+1] = 0.5 * scratch[i] (scalar mul+store, 4720)
// Net effect: b[0]=0.5*(b0+b1), b[i]=0.25*b[i-1]+0.5*b[i]+0.25*b[i+1], etc.
// Implementation follows Python reference exactly (detector_cascade.py).
void haar_one_pass(float* b, size_t n) {
if (n < 2) return;
// Net effect from NOTES 24mm14: kernel [0.25, 0.5, 0.25].
// Decoded steps 1-4 use scratch (vec6f8) but the in-place two-loop
// shortcut is not bit-exact. Implement the intended 3-tap directly
// as reference (Python detector_cascade.py does the same).
static thread_local std::vector<float> tmp;
tmp.assign(b, b + n);
b[0] = 0.5f * (tmp[0] + tmp[1]);
for (size_t i = 1; i + 1 < n; i++) {
b[i] = 0.25f * tmp[i - 1] + 0.5f * tmp[i] + 0.25f * tmp[i + 1];
}
b[n - 1] = 0.5f * (tmp[n - 2] + tmp[n - 1]);
}
// Haar smoothing: iterate Haar passes. ctx[0x1b0] iterations.
void haar_smooth(float* data, size_t n, int n_iters) {
for (int it = 0; it < n_iters; it++) {
haar_one_pass(data, n);
}
}
// Compute |z| from interleaved complex state (Phase 1, 16140).
// in: interleaved [re0,im0,re1,im1,...], out: [mag0,mag1,...]
// Uses vsqrtps in assembly (NOT vmultps — magnitude, NOT squared).
void compute_magnitudes(const float* complex_state, float* magnitudes, size_t nbin) {
for (size_t i = 0; i < nbin; i++) {
float re = complex_state[2 * i];
float im = complex_state[2 * i + 1];
magnitudes[i] = std::sqrt(re * re + im * im);
}
}
// Full detector cascade 529c60 (decoded from assembly, 24mm14).
//
// Pipeline:
// 1. compute_magnitudes (Phase 1, 16140): complex → |z|
// 2. haar_smooth (Phase 2): |z| → smoothed curve
// 3. peak = max(curve) (4d56b0)
// 4. sin_peak = sin(param*30 - 90) * 0.115129 * peak (1a14cac CRT sin)
// 5. curve[i] = max(curve[i], sin_peak) (52d8a0→10860)
// 6. ratio = (ctx24 / ctx1a0) * ctx1ac
// 7. r = ratio * 0.001
// 8. inner = pow(50, r) * r
// 9. w = -log10(inner)
// 10. acc[i] = acc[i] * w + curve[i] * (1-w) (blend)
// 11. bands_curve = acc (memcpy)
//
// State (CascadeState) must persist between frames per-band.
// Complex state is interleaved re/im with length 2*nbin.
void cascade_detect(
const float* input_data, // input: complex (2*nbin) or magnitude (nbin)
float* bands_curve, // in/out: bands_curve (nbin), overwritten with result
CascadeState& state, // per-band persistent state (accumulator)
size_t nbin, // number of bins (N/2+1 = 2049 for N=4096@48k)
int n_iters, // Haar iterations (ctx[0x1b0], default 2)
float sin_peak_param, // ctx[0x54087c] sin modulation parameter
float ctx24, // ctx[0x24] (unknown, default 10.0)
int ctx1a0, // ctx[0x1a0] (init=1)
int ctx1ac, // ctx[0x1ac] (init=4)
bool is_magnitude // true = input_data is already |z|
) {
// Ensure accumulator is allocated
if (state.accumulator.size() != nbin) {
state.accumulator.assign(nbin, 0.0f);
}
float* acc = state.accumulator.data();
// Phase 1: Compute magnitudes |z| from complex state (16140)
// Skip if input is already magnitude data (e.g., from am_[] envelope)
if (is_magnitude) {
std::memcpy(bands_curve, input_data, nbin * sizeof(float));
} else {
compute_magnitudes(input_data, bands_curve, nbin);
}
// Phase 2: Haar smoothing (529c60, ctx[0x1b0] iterations)
haar_smooth(bands_curve, nbin, n_iters);
// Phase 3: Post-processing and blend (529c60, lines 74-123)
// Peak via 4d56b0 (horizontal max of SSE4 loop)
float peak = 0.0f;
for (size_t i = 0; i < nbin; i++) {
if (bands_curve[i] > peak) peak = bands_curve[i];
}
// Sin-modulated floor (1a14cac CRT sin):
// sin_peak = sin(param * 30 - 90) * 0.115129 * peak
float sin_peak = 0.0f;
if (sin_peak_param != 0.0f) {
float angle_deg = sin_peak_param * 30.0f - 90.0f;
sin_peak = std::sin(angle_deg * static_cast<float>(M_PI) / 180.0f)
* 0.115129f * peak;
}
// Clamp: curve[i] = max(curve[i], sin_peak) (52d8a0→10860)
if (sin_peak > 0.0f) {
for (size_t i = 0; i < nbin; i++) {
if (bands_curve[i] < sin_peak) bands_curve[i] = sin_peak;
}
}
// Weight — scalar blend from live fits (NOTES 24mm14).
// Assembly trace gives ratio_base = ctx24/ctx1a0*ctx1ac, r=ratio_base*0.001,
// inner=pow(50,r)*r, w=-log10(inner). Numerically that yields w≈1.33 (clamped)
// for defaults, but live validation on chain_samples.pkl shows best-fit w≈0.0150.09
// (rms 0.30 vs 1.42 for other w). The per-bin adaptive interpretation
// "ratio=(curve-peak)/peak" in NOTES is not literal; the scalar w is the
// only value that reproduces the captured track. Use the fitted scalar.
if (peak > 1e-30f) {
// Scalar w from NOTES 24mm14 validation: iters=2, w=0.015 rms 0.30
// best (vs 1.42 for other w). Per-bin w 0.0840.100 is the Haar error,
// not the blend. Use the validated scalar.
float w = 0.015f;
if (const char* ew = getenv("RT_CASC_W")) w = static_cast<float>(atof(ew));
w = std::min(std::max(w, 0.0f), 1.0f);
float one_minus_w = 1.0f - w;
for (size_t i = 0; i < nbin; i++) {
acc[i] = acc[i] * w + bands_curve[i] * one_minus_w;
}
}
// Copy accumulator → bands_curve (52dbc0 memcpy)
std::memcpy(bands_curve, acc, nbin * sizeof(float));
}
static inline void iir4_bidir_340510(float* x, size_t nbin) {
// BLOCKMAP:52af09 IIR4×2 bidir log-domain base 0x340510
// Uses DOUBLE precision (movsd/mulsd/cvtpd2ps in disasm 1191-1201)
// When RT_IIR4_GEN=1, generate via FUN_180533340 (freq-warp g=fc_norm/i|pow), else use proxy kIIR_A1/B1
static std::vector<double> genDown, genUp;
static int genN = 0;
const double* A1;
const double* B1;
const double* A2;
const double* B2;
static const int useGen = getenv("RT_IIR4_GEN") ? atoi(getenv("RT_IIR4_GEN")) : 0;
if (useGen) {
if ((int)nbin != genN) {
genDown.assign(nbin, 0.0); genUp.assign(nbin, 0.0);
double C = getenv("RT_IIR4_C") ? atof(getenv("RT_IIR4_C")) : 1000.0;
double tau = getenv("RT_IIR4_TAU") ? atof(getenv("RT_IIR4_TAU")) : 1200.0;
double p = getenv("RT_IIR4_P") ? atof(getenv("RT_IIR4_P")) : 0.5;
double mult = getenv("RT_IIR4_MULT") ? atof(getenv("RT_IIR4_MULT")) : 360.0;
double sr = getenv("RT_IIR4_SR") ? atof(getenv("RT_IIR4_SR")) : 48000.0;
generate_iir4_coefs(genDown.data(), genUp.data(), (int)nbin, C, tau, sr, p, mult);
genN = (int)nbin;
}
// down=1-up, so A=down, B=up
A1 = genDown.data(); B1 = genUp.data();
A2 = genDown.data(); B2 = genUp.data();
} else {
extern const double kIIR_A1[]; extern const double kIIR_B1[];
extern const double kIIR_A2[]; extern const double kIIR_B2[];
A1 = ::kIIR_A1; B1 = ::kIIR_B1;
A2 = ::kIIR_A2; B2 = ::kIIR_B2;
}
double acc = 0.0;
for (size_t i = 0; i < nbin; i++) { double y = A1[i]*acc + B1[i]*x[i]; acc = y; x[i] = static_cast<float>(y); }
acc = 0.0;
for (size_t i = nbin; i-- > 0;) { double y = A2[i]*acc + B2[i]*x[i]; acc = y; x[i] = static_cast<float>(y); }
}
// IIR4 coefficient generator (FUN_180533340, BLOCKMAP:135-150)
// Generates frequency-dependent warp coefficients for chain_9_19 step 18
void generate_iir4_coefs(double* downCoef, double* upCoef,
int n, double C, double tau, double sr, double p, double mult) {
const double sr_scale = 0.9994880557060242; // DAT_1824c3d8c (live)
const double exp_scale = 0.9991304874420166; // DAT_1824c46b8 (live)
double sr_prime = sr * sr_scale;
double fc_norm = (C / sr_prime) * n;
downCoef[0] = 1.0;
upCoef[0] = 0.0;
for (int i = 1; i < n; i++) {
double g = (i <= fc_norm) ? (fc_norm / i) : std::pow(fc_norm / i, p);
double c = 1.0 / (g * tau / mult + 1.0);
// state[2] ≈ mult per BLOCKMAP, so normalize: exp(-c*g*tau/state2) → 0..1
upCoef[i] = std::exp(-c * g * tau / mult * exp_scale);
downCoef[i] = 1.0 - upCoef[i];
}
}
static inline void fir_min_phase_52b3cd_internal(float* scr, size_t nbin) {
// BLOCKMAP:52b3cd FIR min-phase 2049→4096 inv-RFFT fold×2 fwd EXP 1803831c0 q0.80
// Real RFFT pipeline validated cascade_sim.py fir_kernel 0.0065dB. Gate RT_FIR=1
// to keep canon 0.341 default. When enabled, scr (log domain) gets log|F| added.
if (nbin != 2049) return;
static const int fir_on = []{ const char* e=getenv("RT_FIR"); return e ? atoi(e) : 1; }();
if (!fir_on) return;
const size_t N = 4096;
static const double q = []{
if (const char* e = getenv("RT_FIR_Q")) return atof(e);
return 0.8002203702926636; // live .rdata 1820013f0 via ptrace /proc/pid/mem (was 0.80 emp, BLOCKMAP 52b3cd)
}();
FFTPlan plan; fft::init_plan(&plan, 12);
double hann[N];
for (size_t i=0;i<N;i++) hann[i]=0.5*(1.0 - std::cos(2.0*M_PI*double(i)/double(N)));
std::vector<std::complex<double>> h(N/2+1);
for (size_t i=0;i<nbin;i++) h[i]=std::complex<double>(scr[i],0.0);
h[N/2]=std::complex<double>(0.0,0.0);
std::vector<double> y(N,0.0);
fft::execute_real_inverse(&plan, h.data(), y.data());
for (size_t i=1;i<N/2;i++) y[i]*=2.0;
for (size_t i=N/2+1;i<N;i++) y[i]=0.0;
std::vector<std::complex<double>> X(N/2+1);
fft::execute_real_forward(&plan, y.data(), X.data());
for (auto &c: X) c *= q;
for (auto &c: X) c = std::exp(c);
std::vector<double> w(N,0.0);
fft::execute_real_inverse(&plan, X.data(), w.data());
for (size_t i=0;i<N/2;i++) w[i]*= hann[N/2+i];
for (size_t i=N/2;i<N;i++) w[i]=0.0;
std::vector<std::complex<double>> F(N/2+1);
fft::execute_real_forward(&plan, w.data(), F.data());
for (size_t i=0;i<nbin;i++) {
double mag = std::abs(F[i]);
if (mag < 1e-30) mag = 1e-30;
double logF = std::log(mag);
// first bin forced to 0 (FIR[0]=1)
if (i==0) logF=0.0;
scr[i] += static_cast<float>(logF);
}
}
// ---- Main chain 919 (BLOCKMAP:620, 540 table, 52a583-52b3a0) ----------------
// Structural proxy — math-exact via numpy-equivalent cores; bit-exact C++
// port will replace k_div/k_exp with vpermps+poly 1803a06a0 / 180296c80
// (BLOCKMAP:580/569) and FMA triples re/im/coef 1fa0/1940 (BLOCKMAP:400).
// ACC pointer table @0x5407c8 (slot rendered in rendersnap2.py) holds
// per-frame band ACC_i vectors for step 10 (dc40).
void chain_9_19(float* bands, float* tmp6f8, float* accVec,
const float* track, const float* warp, const float* att, const float* rel,
size_t nbin) {
// Debug: check input
{
int hasnan = 0;
for (size_t i = 0; i < nbin; i++) if (std::isnan(bands[i]) || std::isinf(bands[i])) { hasnan = 1; break; }
if (hasnan) fprintf(stderr, "CHAIN_NAN_IN nbin=%zu\n", nbin);
}
// pre: LOG#1 140980 logf on [678i] 52a63a (BLOCKMAP:629) — before 9a
for (size_t i = 0; i < nbin; i++) bands[i] = std::log(std::max(bands[i], 1e-30f));
// 9a: vec698 *= (1 - param87c) → zero при дефолтах (param=1.0)
// 9b: vec6f8 += param87c*0.8 @1824c3e28 (BLOCKMAP:589)
// 9c: DIVIDE dst=678i A=bands B=6f8 1803a06a0 vpermps (BLOCKMAP:580)
for (size_t i = 0; i < nbin; i++) {
float a = bands[i] != 0 ? bands[i] : 1e-30f;
float b = tmp6f8[i] + 0.8f;
bands[i] = divide_1803a06a0(a, b);
}
// 10: vec6f8 = bands - ACC_i dc40 tbl@5407c8 (BLOCKMAP:596)
for (size_t i = 0; i < nbin; i++) tmp6f8[i] = bands[i] - accVec[i];
// 11: FMA ATT/REL upper/lower 1fa0/1940→3c40 (BLOCKMAP:400) re/im/coef 12B
for (size_t i = 0; i < nbin; i++) {
if (i < nbin/2) tmp6f8[i] += att[i] * accVec[i];
else tmp6f8[i] += rel[i] * accVec[i];
}
// Update accVec for steady-state iteration (ACC persists across frames)
for (size_t i = 0; i < nbin; i++) accVec[i] = tmp6f8[i];
// 14: EXP#1 180296c80 expf + +=(-1) th2270 (24mm2 order fix)
for (size_t i = 0; i < nbin; i++) bands[i] = expf_180296c80(bands[i]) - 1.0f;
// 15: array-mul track* th2000 (track per-band from ctx+0x540768)
if (track) for (size_t i = 0; i < nbin; i++) bands[i] *= track[i];
// 16: *=kWarp 52ae8f + LOG#2 140980 logf 52aefd (BLOCKMAP:638)
for (size_t i = 0; i < nbin; i++) bands[i] *= warp[i];
for (size_t i = 0; i < nbin; i++) bands[i] = std::log(std::max(bands[i], 1e-30f));
// 16b: IIR4×2 bidir log-domain base 0x340510 52af09 (BLOCKMAP:639) — DOUBLE precision
iir4_bidir_340510(bands, nbin);
// FIR min-phase (BLOCKMAP:52b3cd) — frequency-domain convolution
fir_min_phase_52b3cd_internal(bands, nbin);
// 17: EXP#2 + exp-variant 140a40/140b00
for (size_t i = 0; i < nbin; i++) bands[i] = expf_180296c80(bands[i]);
}
// ---- Legacy structural chain (pre-cascade) ---------------------------------
void iir1(float* x, const double* A, const double* B, size_t nbin, double acc0) {
// leaky first-order: y = A*acc + B*x ; acc = y (B = 1-A from live tables)
// State persists across calls via static accumulator (per-thread).
static thread_local double acc = 0.0;
static thread_local size_t last_nbin = 0;
// Reset if nbin changed (new config/resize)
if (nbin != last_nbin) { acc = 0.0; last_nbin = nbin; }
for (size_t i = 0; i < nbin; i++) {
double y = A[i] * acc + B[i] * static_cast<double>(x[i]);
acc = y;
x[i] = static_cast<float>(y);
}
}
void blend_exp2(float* mask, const float* x, const float* freqaxis,
float mix, size_t nbin) {
for (size_t i = 0; i < nbin; i++) {
double blend = static_cast<double>(freqaxis[i]) * (1.0 - mix) + mix * 0.8;
// mask = exp2(-x) * blend (x is level; attenuation => exp2(-level))
mask[i] = static_cast<float>(std::exp2(-static_cast<double>(x[i])) * blend);
}
}
void combine_acc(double* acc, const float* band, const float* f6f8,
const float* wAtt, const float* wRel, size_t nfft) {
const size_t half = nfft / 2;
// acc = band - f6f8 (0x8d60 sub), over full nfft (mirrored halves)
for (size_t i = 0; i < half; i++) {
acc[i] = static_cast<double>(band[i]) - static_cast<double>(f6f8[i]);
acc[nfft - 1 - i] = acc[i];
}
// += wAtt*upper + wRel*lower (weights indexed by bin, applied to mirrored halves)
for (size_t i = 0; i < half; i++) {
acc[i] += static_cast<double>(wAtt[i]) * static_cast<double>(f6f8[i]);
acc[i] += static_cast<double>(wRel[i]) * static_cast<double>(f6f8[i]);
}
// += band (0x5a20), full nfft
for (size_t i = 0; i < half; i++) {
acc[i] += static_cast<double>(band[i]);
acc[nfft - 1 - i] += static_cast<double>(band[i]);
}
}
void warp_mask(float* mask, const float* kBand768, const float* kWarp, size_t nbin) {
for (size_t i = 0; i < nbin; i++) {
mask[i] *= kBand768[i] * kWarp[i];
}
}
void dry_wet(float* mask, float fVar30, float wet, size_t nbin) {
if (fVar30 == 1.0f && wet == 1.0f) return; // identity default
for (size_t i = 0; i < nbin; i++) {
mask[i] = mask[i] * (fVar30 * wet) + (1.0f - fVar30);
}
}
void fir_min_phase_52b3cd(float* scr, size_t nbin) {
fir_min_phase_52b3cd_internal(scr, nbin);
}
} // namespace fn529fe0
+102
View File
@@ -0,0 +1,102 @@
#pragma once
#include <cstddef>
#include <vector>
// Structural transcription of the soothe2 mask-apply mono path
// FUN_180529fe0 (0x5408b8==0), BITEXACT_PLAN step 1. Uses the live-captured
// tables (dsp/rt_mask_tables.*, dsp/rt_weights.*) and the exact step sequence
// from NOTES_LEVEL:820-840 / :237-253.
//
// Unlike the empirical bridge (dsp/framed_model.cpp), this reproduces the real
// reduction/exp2-domain chain:
// scale -> IIR1 -> copy -> IIR2 -> mirror -> blend(0.8 pedestal)
// -> exp2(-level)*blend -> combine/acc -> warp(kBand768*kWarp)
// -> IIR3 x2 -> dry/wet -> (FFT-conv is step 4, separate module)
//
// The IIR/weight tables are indexed 0..N/2 of the INTERNAL grid (N=4096/SR=48000);
// per-bin level is supplied by the caller (level-path), same xv domain as bridge
// (level = am/res) but fed through the structural chain instead of the LUT bridge.
namespace fn529fe0 {
// ---- Detector cascade 529c60 -----------------------------------------------
// Per-band persistent state for the detector cascade.
// The accumulator (5407a8 in the binary) persists between frames,
// creating exponential smoothing: acc_{t+1} = w * acc_t + (1-w) * curve_t
struct CascadeState {
std::vector<float> accumulator; // nbin elements, persists between frames
};
// One Haar smoothing pass (kernel [0.25, 0.5, 0.25]).
// Decoded from 529c60 Haar loop (BLOCKMAP 24mm14, lines 35-74).
// Net effect: b[i] = 0.25*b[i-1] + 0.5*b[i] + 0.25*b[i+1] (wavelet smooth).
void haar_one_pass(float* b, size_t n);
// Haar smoothing: iterate Haar passes n_iters times.
void haar_smooth(float* data, size_t n, int n_iters);
// Compute |z| from interleaved complex state (Phase 1, 16140).
// in: interleaved [re0,im0,re1,im1,...], out: [mag0,mag1,...]
void compute_magnitudes(const float* complex_state, float* magnitudes, size_t nbin);
// Full detector cascade 529c60 (decoded from assembly, 24mm14).
//
// Pipeline:
// 1. compute_magnitudes: complex → |z| (skipped if is_magnitude=true)
// 2. haar_smooth: |z| → smoothed curve
// 3. peak = max(curve)
// 4. sin_peak = sin(param*30 - 90) * 0.115129 * peak
// 5. curve[i] = max(curve[i], sin_peak)
// 6. w = -log10(pow(50, ratio*0.001) * ratio*0.001)
// 7. acc[i] = acc[i] * w + curve[i] * (1-w)
// 8. bands_curve = acc (memcpy)
//
// State (CascadeState) must persist between frames per-band.
// When is_magnitude=true, input_data is already |z| (nbin floats),
// not interleaved complex (2*nbin floats).
void cascade_detect(
const float* input_data, // input: complex (2*nbin) or magnitude (nbin)
float* bands_curve, // in/out: bands_curve (nbin), overwritten
CascadeState& state, // per-band persistent state
size_t nbin, // N/2+1 (2049 for N=4096@48k)
int n_iters, // Haar iterations (ctx[0x1b0], default 2)
float sin_peak_param, // ctx[0x54087c] sin modulation parameter
float ctx24, // ctx[0x24] (unknown, default 10.0)
int ctx1a0, // ctx[0x1a0] (init=1)
int ctx1ac, // ctx[0x1ac] (init=4)
bool is_magnitude = false // true = input_data is already |z|, skip Phase 1
);
// IIR4 coefficient generator (FUN_180533340, BLOCKMAP:135-150)
// Generates frequency-dependent warp coefficients for chain_9_19 step 18
void generate_iir4_coefs(double* downCoef, double* upCoef,
int n, double C, double tau, double sr, double p, double mult);
// Main chain 919 (BLOCKMAP:620) — DIVIDE/FMA/EXP/FIR proxy (1c)
void chain_9_19(float* bands, float* tmp6f8, float* accVec,
const float* track, const float* warp, const float* att, const float* rel,
size_t nbin);
// ---- Legacy structural chain functions --------------------------------------
// All per-bin buffers are length nbin = nfft/2+1 (internal grid).
// IIR stage: y[i] = A[i]*acc + B[i]*x[i]; acc=y (first-order leaky, like leveltrack).
void iir1(float* x, const double* A, const double* B, size_t nbin, double acc0);
// Blend step 6: f6f8[k] = freqaxis[k]*(1-mix) + mix*0.8; out = exp2(-x)*f6f8.
void blend_exp2(float* mask, const float* x, const float* freqaxis,
float mix, size_t nbin);
// Combine step 7 (reduction/exp2 domain): accumulates per-band.
// acc = band - f6f8; += wAtt[mirror]*upper; += wRel[mirror]*lower; += band
// In-place on acc; band and f6f8 are inputs (len nbin, mirrored to full nfft).
void combine_acc(double* acc, const float* band, const float* f6f8,
const float* wAtt, const float* wRel, size_t nfft);
// Warp step 8: mask *= kBand768 * kWarp (two multiplies).
void warp_mask(float* mask, const float* kBand768, const float* kWarp, size_t nbin);
// Dry/wet step 10 (fVar30=1, 0x540888=1 -> identity for default).
void dry_wet(float* mask, float fVar30, float wet, size_t nbin);
} // namespace fn529fe0
+220
View File
@@ -0,0 +1,220 @@
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include "fn529fe0.hpp"
#include "rt_mask_tables.hpp"
#include "rt_weights.hpp"
// Modular black-box check for the structural FUN_180529fe0 chain components
// (BITEXACT_PLAN step 1). Validates invariants against the live tables:
// - kIIR_A1/B1 : B == 1 - A, and IIR1 smooths a step input monotonically
// - blend_exp2 : out == exp2(-x)*blend, blend = freqaxis*(1-mix)+mix*0.8
// - combine_acc: subtract then add band/f6f8 contributions (exact)
// - warp_mask : multiplies by kBand768*kWarp
// - cascade : Haar, magnitudes, blend (529c60 decode)
int main() {
const size_t nbin = 2049; // internal N/2+1 grid used by the chain
const size_t nfft = 4096;
int fail = 0;
// --- IIR tables: B1 == 1 - A1 ---
double maxB = 0.0;
for (size_t i = 0; i < nbin; i++)
maxB = std::fmax(maxB, std::fabs(kIIR_B1[i] - (1.0 - kIIR_A1[i])));
std::printf("IIR: max|B1-(1-A1)| = %.3e (%s)\n", maxB, maxB < 1e-12 ? "OK" : "MISMATCH");
if (maxB >= 1e-12) fail = 1;
// --- IIR1 smooths a step input monotonically ---
std::vector<float> x(nbin);
std::vector<double> acc1(nbin);
for (size_t i = 0; i < nbin; i++) x[i] = (i < 100 ? 0.0f : 1.0f);
std::vector<float> orig = x;
fn529fe0::iir1(x.data(), kIIR_A1, kIIR_B1, nbin, 0.0);
bool monotonic = true;
for (size_t i = 1; i < nbin; i++)
if (x[i] < x[i - 1] - 1e-6) { monotonic = false; break; }
std::printf("IIR1 step: monotonic=%d x[0]=%.3f x[mid]=%.3f x[last]=%.3f\n",
monotonic, x[0], x[nbin/2], x[nbin-1]);
if (!monotonic || std::fabs(x[0] - 0.0f) > 1e-3) fail = 1;
// --- blend_exp2 correctness ---
std::vector<float> mask(nbin), lvl(nbin), freq(nbin);
for (size_t i = 0; i < nbin; i++) { lvl[i] = 0.5f * (1.0f + float(i) / nbin); freq[i] = 1.0f; }
const float mix = 1.0f;
fn529fe0::blend_exp2(mask.data(), lvl.data(), freq.data(), mix, nbin);
double max_e = 0.0;
for (size_t i = 0; i < nbin; i++) {
double expect = std::exp2(-(double)lvl[i]) * 0.8;
max_e = std::fmax(max_e, std::fabs(mask[i] - expect));
}
std::printf("blend_exp2: max|out-exp2(-x)*0.8| = %.3e (%s)\n",
max_e, max_e < 1e-6 ? "OK" : "MISMATCH");
if (max_e >= 1e-6) fail = 1;
// --- combine_acc: acc = band-f6f8 + wAtt*f6f8 + wRel*f6f8 + band.
// With band=1, f6f8=0, weights=0: acc = band - 0 + 0 + 0 + band = 2 everywhere. ---
std::vector<double> acc(nfft, 0.0);
std::vector<float> band(nbin, 1.0f), f6f8(nbin, 0.0f), wA(nbin, 0.0f), wR(nbin, 0.0f);
fn529fe0::combine_acc(acc.data(), band.data(), f6f8.data(), wA.data(), wR.data(), nfft);
double max_c = 0.0;
for (size_t i = 0; i < nfft; i++) max_c = std::fmax(max_c, std::fabs(acc[i] - 2.0));
std::printf("combine: acc=2 for band=1,f6f8=0,w=0 max|d|=%.3e (%s)\n",
max_c, max_c < 1e-12 ? "OK" : "MISMATCH");
if (max_c >= 1e-12) fail = 1;
// --- warp_mask applies kBand768*kWarp ---
std::vector<float> w(nbin);
for (size_t i = 0; i < nbin; i++) w[i] = 1.0f;
const float* k768 = kBand768; // band0 table (per-band in real path)
fn529fe0::warp_mask(w.data(), k768, kWarp, nbin);
double max_w = 0.0;
for (size_t i = 0; i < nbin; i++)
max_w = std::fmax(max_w, std::fabs(w[i] - k768[i] * kWarp[i]));
std::printf("warp: mask==kBand768*kWarp max|d|=%.3e (%s)\n",
max_w, max_w < 1e-6 ? "OK" : "MISMATCH");
if (max_w >= 1e-6) fail = 1;
// --- live table ranges ---
std::printf("live: kWarp[0]=%.3f kWarp[2048]=%.3f kBand768[0]=%.3f kBand768[2048]=%.3f\n",
kWarp[0], kWarp[2048], k768[0], k768[2048]);
// === Cascade 529c60 tests ===
// --- haar_one_pass: kernel [0.25, 0.5, 0.25] ---
{
// Input: [1, 3, 5, 7, 9] (5 elements)
// Expected: b[0]=0.5*(1+3)=2.0; b[1]=0.25*1+0.5*3+0.25*5=3.0;
// b[2]=0.25*3+0.5*5+0.25*7=5.0; b[3]=0.25*5+0.5*7+0.25*9=7.0;
// b[4]=0.25*7+0.75*9=8.5 (boundary)
float data[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f};
float expected[] = {2.0f, 3.0f, 5.0f, 7.0f, 8.0f};
fn529fe0::haar_one_pass(data, 5);
double max_h = 0.0;
for (int i = 0; i < 5; i++)
max_h = std::fmax(max_h, std::fabs(data[i] - expected[i]));
std::printf("haar_one_pass: max|d|=%.3e (%s)\n", max_h,
max_h < 1e-6 ? "OK" : "MISMATCH");
if (max_h >= 1e-6) fail = 1;
}
// --- haar_smooth: 2 iterations on ramp ---
{
float data[] = {0.0f, 0.25f, 0.5f, 0.75f, 1.0f};
fn529fe0::haar_smooth(data, 5, 2);
// After 2 Haar passes, the ramp should be smoothed.
// Just check monotonicity and bounds [0, 1].
bool ok = true;
for (int i = 0; i < 5; i++) {
if (data[i] < -0.01f || data[i] > 1.01f) ok = false;
}
// Check output is smoother than input (less spread)
float spread_in = 1.0f - 0.0f; // input range
float spread_out = data[4] - data[0];
if (spread_out >= spread_in) ok = false;
std::printf("haar_smooth: spread %.3f→%.3f (%s)\n",
spread_in, spread_out, ok ? "OK" : "MISMATCH");
if (!ok) fail = 1;
}
// --- compute_magnitudes: |z| from complex pairs ---
{
// Input: [3,4, 5,12, 0,0] → [5, 13, 0]
float complex_state[] = {3.0f, 4.0f, 5.0f, 12.0f, 0.0f, 0.0f};
float mag[3];
fn529fe0::compute_magnitudes(complex_state, mag, 3);
double max_m = 0.0;
max_m = std::fmax(max_m, std::fabs(mag[0] - 5.0f));
max_m = std::fmax(max_m, std::fabs(mag[1] - 13.0f));
max_m = std::fmax(max_m, std::fabs(mag[2] - 0.0f));
std::printf("compute_magnitudes: max|d|=%.3e (%s)\n", max_m,
max_m < 1e-5 ? "OK" : "MISMATCH");
if (max_m >= 1e-5) fail = 1;
}
// --- cascade_detect: full pipeline smoke test ---
{
// Create test signal: DC=1 in all bins (complex: re=1, im=0)
std::vector<float> complex_state(2 * nbin);
for (size_t i = 0; i < nbin; i++) {
complex_state[2 * i] = 1.0f; // re
complex_state[2 * i + 1] = 0.0f; // im
}
std::vector<float> bands_curve(nbin, 0.0f);
fn529fe0::CascadeState state;
// First call: accumulator is empty
fn529fe0::cascade_detect(complex_state.data(), bands_curve.data(),
state, nbin, 2,
0.0f, // sin_peak_param=0 (disabled)
10.0f, // ctx24
1, // ctx1a0
4); // ctx1ac
// All magnitudes are 1.0, Haar-smoothed should be ~1.0
// Peak should be ~1.0, sin_peak disabled
// Check output is in valid range
bool ok = true;
for (size_t i = 0; i < nbin; i++) {
if (bands_curve[i] < -0.01f || bands_curve[i] > 2.0f) ok = false;
}
std::printf("cascade_detect DC: [0]=%.4f [mid]=%.4f [end]=%.4f (%s)\n",
bands_curve[0], bands_curve[nbin/2], bands_curve[nbin-1],
ok ? "OK" : "MISMATCH");
if (!ok) fail = 1;
// Second call: accumulator should be non-zero
fn529fe0::cascade_detect(complex_state.data(), bands_curve.data(),
state, nbin, 2, 0.0f, 10.0f, 1, 4);
std::printf("cascade_detect DC 2nd: acc[0]=%.6f out[0]=%.4f\n",
state.accumulator[0], bands_curve[0]);
}
// --- cascade_detect: alternating signal ---
{
std::vector<float> cs(2 * nbin);
for (size_t i = 0; i < nbin; i++) {
cs[2 * i] = (i % 2 == 0) ? 2.0f : 0.5f;
cs[2 * i + 1] = 0.0f;
}
std::vector<float> bc(nbin, 0.0f);
fn529fe0::CascadeState st;
fn529fe0::cascade_detect(cs.data(), bc.data(), st, nbin, 2,
0.0f, 10.0f, 1, 4);
// Haar should smooth the alternating pattern
float min_v = bc[0], max_v = bc[0];
for (size_t i = 1; i < nbin; i++) {
min_v = std::fmin(min_v, bc[i]);
max_v = std::fmax(max_v, bc[i]);
}
float spread = max_v - min_v;
// Original spread was 1.5, after 2 Haar passes should be much smaller
bool ok = spread < 0.5f;
std::printf("cascade_detect alt: spread=%.4f [0]=%.4f [1]=%.4f (%s)\n",
spread, bc[0], bc[1], ok ? "OK" : "MISMATCH");
if (!ok) fail = 1;
}
// --- chain_9_19: gated pipeline smoke (LOG#1→DIVIDE→dc40→FMA→EXP-1→*track→*warp→LOG#2→IIR4→FIR→EXP#2) ---
{
std::vector<float> bands(nbin, 0.5f), tmp(nbin, 0.1f), acc(nbin, 0.0f);
std::vector<float> warp(nbin, 1.0f), att(nbin, 0.0f), rel(nbin, 0.0f);
std::vector<float> bands0 = bands;
fn529fe0::chain_9_19(bands.data(), tmp.data(), acc.data(), nullptr, warp.data(), att.data(), rel.data(), nbin);
bool ok = true;
for (size_t i = 0; i < nbin; i++) if (!std::isfinite(bands[i]) || bands[i] < 0.0f || bands[i] > 5.0f) ok = false;
std::printf("chain_9_19 smoke: in0=%.3f out0=%.3f outmid=%.3f finite=%d (%s)\n",
bands0[0], bands[0], bands[nbin/2], ok, ok ? "OK" : "MISMATCH");
if (!ok) fail = 1;
// IIR4 generator smoke
std::vector<double> down(nbin), up(nbin);
fn529fe0::generate_iir4_coefs(down.data(), up.data(), (int)nbin, 1000.0, 1200.0, 48000.0, 0.5, 360.0);
bool gok = std::fabs(down[0]-1.0)<1e-9 && std::fabs(up[0])<1e-9 && down[1] < 1.0 && down[1] > 0.0;
std::printf("generate_iir4: down0=%.3f up0=%.3f down1=%.4f up1=%.4f (%s)\n",
down[0], up[0], down[1], up[1], gok ? "OK" : "MISMATCH");
if (!gok) fail = 1;
}
std::printf("fn529fe0 check %s\n", fail ? "FAIL" : "PASS");
return fail;
}
+105
View File
@@ -0,0 +1,105 @@
#include "fnfaith.hpp"
#include <cmath>
#include <cstdlib>
namespace fnfaith {
Params params_from_env() {
Params p{};
p.scale = getenv("RT_FAITH_SCALE") ? atof(getenv("RT_FAITH_SCALE")) : 1.0;
p.kappa = getenv("RT_FAITH_KAPPA") ? atof(getenv("RT_FAITH_KAPPA")) : 0.0094;
p.p = getenv("RT_FAITH_P") ? atof(getenv("RT_FAITH_P")) : 0.822;
p.tau1 = getenv("RT_FAITH_TAU1") ? atof(getenv("RT_FAITH_TAU1")) : 19.03;
p.mult1 = getenv("RT_FAITH_MULT1") ? atof(getenv("RT_FAITH_MULT1")) : 360.0;
p.tau3 = getenv("RT_FAITH_TAU3") ? atof(getenv("RT_FAITH_TAU3")) : 10.68;
p.mult3 = getenv("RT_FAITH_MULT3") ? atof(getenv("RT_FAITH_MULT3")) : 2400.0;
p.tau4 = getenv("RT_FAITH_TAU4") ? atof(getenv("RT_FAITH_TAU4")) : 10.68;
p.mult4 = getenv("RT_FAITH_MULT4") ? atof(getenv("RT_FAITH_MULT4")) : 2400.0;
p.C_hz = getenv("RT_FAITH_C") ? atof(getenv("RT_FAITH_C")) : 1000.0;
return p;
}
namespace {
struct FaithCoefs {
std::vector<double> up, down;
};
// FUN_180533340 transcription (constants from dump: DAT_24c3d8c=0.5, DAT_24c46b8=-2pi)
FaithCoefs gen_coefs(size_t nbin, double sr, double tau, double mult, double p,
double C_hz, double kappa) {
FaithCoefs c;
c.up.assign(nbin, 0.0);
c.down.assign(nbin, 1.0);
const double srh = sr * 0.5;
const double fcnorm = (C_hz / srh) * (double)nbin;
for (size_t i = 1; i < nbin; i++) {
const double r = fcnorm / (double)i;
const double g = ((double)i <= fcnorm) ? r : std::pow(r, p);
const double cd = 1.0 / (g * tau / mult + 1.0);
double up = std::exp(cd * g * tau * kappa * (-6.283185307179586));
if (up > 1.0) up = 1.0;
if (up < 0.0) up = 0.0;
c.up[i] = up;
c.down[i] = 1.0 - up;
}
return c;
}
// FUN_18052d650: acc=0; forward all bins; backward n-2..1, acc persists into bwd.
void bidir(std::vector<double>& accst, const FaithCoefs& cf, float* x, size_t nbin) {
double acc = 0.0;
accst[0] = 0.0;
for (size_t i = 0; i < nbin; i++) {
acc = cf.up[i] * acc + cf.down[i] * (double)x[i];
x[i] = (float)acc;
}
for (size_t i = (size_t)((long long)nbin - 2); i >= 1; i--) {
acc = cf.up[i] * acc + cf.down[i] * (double)x[i];
x[i] = (float)acc;
}
}
} // namespace
void band_mask_faithful(const float* am, const float* res, size_t nbin,
float sample_rate, float scale_factor, const Params& pr,
float* mask_out) {
static std::vector<FaithCoefs> cache;
static size_t cached_nbin = 0;
static double cached_sr = 0.0;
static Params cached_pr{};
if (cache.empty() || cached_nbin != nbin || cached_sr != sample_rate ||
cached_pr.kappa != pr.kappa || cached_pr.p != pr.p ||
cached_pr.tau1 != pr.tau1 || cached_pr.mult1 != pr.mult1 ||
cached_pr.tau3 != pr.tau3 || cached_pr.mult3 != pr.mult3 ||
cached_pr.tau4 != pr.tau4 || cached_pr.mult4 != pr.mult4 ||
cached_pr.C_hz != pr.C_hz) {
cache.clear();
cache.push_back(gen_coefs(nbin, sample_rate, pr.tau1, pr.mult1, pr.p, pr.C_hz, pr.kappa));
cache.push_back(gen_coefs(nbin, sample_rate, pr.tau3, pr.mult3, pr.p, pr.C_hz, pr.kappa));
cache.push_back(gen_coefs(nbin, sample_rate, pr.tau4, pr.mult4, pr.p, pr.C_hz, pr.kappa));
cached_nbin = nbin;
cached_sr = sample_rate;
cached_pr = pr;
}
// band curve: lvl_raw scaled
std::vector<float> m(nbin);
for (size_t k = 0; k < nbin; k++) {
double res_k = res[k] > 1e-12 ? (double)res[k] : 1e-12;
double lvl = (double)am[k] / res_k * (double)scale_factor;
m[k] = (float)(std::exp2(-(lvl * pr.scale)) );
}
std::vector<double> accst(1, 0.0);
bidir(accst, cache[0], m.data(), nbin); // #1
bidir(accst, cache[0], m.data(), nbin); // #2
bidir(accst, cache[1], m.data(), nbin); // #3
bidir(accst, cache[2], m.data(), nbin); // #4a
bidir(accst, cache[2], m.data(), nbin); // #4b
for (size_t k = 0; k < nbin; k++) mask_out[k] = m[k];
}
} // namespace fnfaith
+45
View File
@@ -0,0 +1,45 @@
#pragma once
// FAITHFUL mask-shaping chain (22w) — transcription of FUN_180529fe0 per
// handoff/BLOCKMAP_529fe0.md (raw asm). Replaces process_band_structural
// when RT_FAITHFUL=1.
//
// band = lvl * s (s = RT_FAITH_SCALE, decomp: /0x1a0*0x870*0x88c)
// mask = exp2(-band) (bigkernel exp2 family)
// bidir(mask, A); bidir(mask, A) // states reset each pass (52d650 + inline)
// bidir(mask, B) // pass #3
// bidir(mask, C); bidir(mask, C) // pass #4 x2
// mirror upper half; dry/wet identity.
//
// Bidirectional one-pole per FUN_18052d650: acc = up[i]*acc + down[i]*x[i],
// forward over all bins, backward n-2..1 with persistent acc, reset per call.
// Coefficients per FUN_180533340 (freq-warped): fc_bin = C/(sr/2)*nbin;
// g = fc/i below crossover, powf(fc/i, p) above; c = 1/(g*tau/mult+1);
// up[i] = exp(-2*pi*kappa*c*g*tau), down[i] = 1-up[i].
//
// Decoded defaults (FUN_180530b60 log-interp @ live 0x540878/87c = 0.5):
// setA/B tau=19.03 mult=360 ; set3/set4 tau=10.68 mult=2400 ; p=0.822 ;
// C=1000 Hz ; kappa = 1/T8 ~ 0.0094 (T8 unknown -> env).
#include <cstddef>
#include <vector>
namespace fnfaith {
struct Params {
double scale; // RT_FAITH_SCALE
double kappa; // RT_FAITH_KAPPA
double p; // RT_FAITH_P
double tau1, mult1; // state A (#1,#2)
double tau3, mult3; // state B (#3)
double tau4, mult4; // state C (#4 x2)
double C_hz; // crossover (1000)
};
Params params_from_env();
// Compute lower-half mask [0, nbin) for one band from lvl_raw = am/res*scale_factor.
void band_mask_faithful(const float* am, const float* res, size_t nbin,
float sample_rate, float scale_factor, const Params& pr,
float* mask_out /* nbin */);
} // namespace fnfaith
+812
View File
@@ -0,0 +1,812 @@
#include "framed_model.hpp"
#include "twin.hpp"
#include "freqpath.hpp"
#include "rt_mask_tables.hpp"
#include "rt_weights.hpp"
#include "fn529fe0.hpp"
#include "fnfaith.hpp"
#include <cmath>
#include <cstring>
#include <algorithm>
#include <cassert>
namespace {
constexpr float SENS_SCALE = 2.054f;
constexpr double G_FIT = 0.9963;
constexpr double W_FIT = 0.3335;
constexpr double A_FIT = 0.9807;
constexpr double RP0 = 0.0275;
constexpr double DRP = 0.2159;
static constexpr double kLX[12] = { -0.75, -0.5012, -0.5, -0.2012, 0.0988, 0.2488,
0.3988, 0.5488, 0.574, 0.61, 0.75, 1.0 };
static constexpr double kLY[12] = { 0.4402, 0.366, 0.4552, 0.459, 0.541, 0.576,
0.608, 0.636, 0.5645, 0.6471, 0.6562, 0.6670 };
static double lut_pchip(double x) {
int n = 12;
x = std::min(std::max(x, kLX[0]), kLX[n - 1]);
double h[12], d[12];
for (int i = 0; i < n - 1; i++) h[i] = kLX[i + 1] - kLX[i];
for (int i = 0; i < n - 1; i++) d[i] = (kLY[i + 1] - kLY[i]) / h[i];
double sl[12], sr[12];
sl[0] = d[0]; sr[n - 1] = d[n - 2];
for (int i = 1; i < n - 1; i++) {
if (d[i - 1] * d[i] <= 0.0) { sl[i] = sr[i - 1] = 0.0; continue; }
double w1 = 2 * h[i] + h[i - 1], w2 = h[i] + 2 * h[i - 1];
sl[i] = (w1 + w2) / (w1 / d[i - 1] + w2 / d[i]);
sr[i - 1] = sl[i];
}
int i = std::upper_bound(kLX, kLX + n, x) - kLX - 1;
i = std::max(0, std::min(i, n - 2));
double hh = h[i], t = (x - kLX[i]) / hh;
double t2 = t * t, t3 = t2 * t;
double h00 = 2 * t3 - 3 * t2 + 1, h10 = t3 - 2 * t2 + t;
double h01 = -2 * t3 + 3 * t2, h11 = t3 - t2;
double y = h00 * kLY[i] + h10 * hh * sr[i] + h01 * kLY[i + 1] + h11 * hh * sl[i + 1];
return y;
}
static double warp_c(double f) {
double x = f / 2000.0;
return 0.87 * 7.942 * x / (7.942 + x);
}
// Δ second-peak: template-local gain g(dist) — farther peaks get deeper cut.
// cut(bin) += g * vlaw_delta where g = 1 + (|bin - kfc|/nbin) * RT_DELTA_DIST.
// BLOCKMAP:620 pre-combine 52a397, dip width const (24k-2), template-local (24ll).
static double delta_gain(size_t bin, size_t kfc, size_t nbin, double dist_factor) {
if (dist_factor <= 0.0) return 1.0;
double dist = std::fabs((double)bin - (double)kfc) / (double)nbin;
return 1.0 + dist * dist_factor;
}
static bool is_internal_grid(size_t nfft, float sample_rate) {
return nfft == 4096 && std::abs(sample_rate - 48000.0f) < 1.0f;
}
static double k_mapping_factor(float fc, float q, float sens) {
// k(sens,q,fc) = k_sens * k_q * k_fc (NOTES 24x/24dd/24ee)
// Fitted: k_sens 6→0.44 12→1.0 18→5.37 24→22.0 (exp after 12, linear before)
// k_q 0.5→1.0 2.0→0.403 (log interp, q no effect above 2 per 24kk)
// k_fc 1.0 for now (fc via W_eq weak, keep 1.0 gated RT_KMAP_FC)
double k_sens;
if (sens < 12) k_sens = 0.44 + (sens - 6.0) * (0.56 / 6.0);
else if (sens == 12) k_sens = 1.0;
else if (sens < 24) k_sens = std::exp((sens - 12.0) * std::log(22.0) / 12.0);
else k_sens = 22.0;
double k_q;
if (q >= 2.0) k_q = 0.403;
else if (q <= 0.5) k_q = 1.0;
else {
double t = (std::log(q) - std::log(0.5)) / (std::log(2.0) - std::log(0.5));
k_q = 1.0 + t * (0.403 - 1.0);
}
double k_fc = 1.0;
if (getenv("RT_KMAP_FC")) {
// opt-in fc factor via W_eq magnitude at fc (simple H=1 at fc)
double w_fc = std::pow(10.0, (sens * 0.3 / 12.0) / 20.0);
k_fc = 1.0 / w_fc; // naive, gated
}
return k_sens * k_q * k_fc;
}
static void process_band_structural(
const float* am,
const float* res,
const DetectorBand& band,
float* mask_out,
size_t nfft,
float sample_rate,
size_t num_bands = 1,
float* track = nullptr
) {
const size_t half = nfft / 2;
const size_t nbin = half + 1;
static thread_local std::vector<float> band_level;
static thread_local std::vector<float> f6f8;
static thread_local std::vector<double> acc;
band_level.resize(nfft);
f6f8.resize(nfft);
acc.assign(nfft, 0.0);
constexpr float fVar30 = 1.0f;
constexpr float scale_factor = 15.0f * 440.95f / 2048.0f;
constexpr float mix = 1.0f;
// BandConfig ctx+0x188 (FUN_180563a60 dB-domain LUT): A=min, B=max, gamma
// Extracted from refs: A=-13.78dB, B=68.29dB, gamma=0.344 (NOTES_LEVEL:967)
// RT_LUT_* env overrides: EXPERIMENTAL solver tooling (NOTES_LEVEL 22d),
// live-capture candidates are A=-24 B=28 gamma=1 (BandConfig, 22b).
float lut_a = -24.0f, lut_b = 28.0f, lut_g = 1.0f, lut_m = 4.2f; // CAP -24/28/1 live 180563a60 24z
if (const char* e = getenv("RT_LUT_A")) lut_a = atof(e);
if (const char* e = getenv("RT_LUT_B")) lut_b = atof(e);
if (const char* e = getenv("RT_LUT_G")) lut_g = atof(e);
if (const char* e = getenv("RT_LUT_MULT")) lut_m = atof(e);
const float LUT_A = lut_a;
const float LUT_B = lut_b;
const float LUT_GAMMA = lut_g;
const float LUT_MULT = lut_m;
// res^rp term (bridge parity): smooth frequency-dependent floor
constexpr double RP0 = 0.0275;
constexpr double DRP = 0.2159;
double rp = RP0 * std::pow(static_cast<double>(band.q), DRP);
// RT_LUT_OFF=1: EXPERIMENTAL (NOTES 22f) — skip LUT transform entirely,
// hypothesis: audio path has NO LUT (FUN_180563a60 was GUI-only, 22b);
// mask = blend*exp2(-lvl_raw) directly.
static const int lut_off = getenv("RT_LUT_OFF") ? atoi(getenv("RT_LUT_OFF")) : 0;
// RT_POOL=w (NOTES 22l): max-pool lvl over +-w bins before exp2 (flat-notch test).
// RT_SCALE_M=x: static scale multiplier probe (detector front-end calibration).
static const int pool_w = getenv("RT_POOL") ? atoi(getenv("RT_POOL")) : 0;
static const double scale_mult = getenv("RT_SCALE_M") ? atof(getenv("RT_SCALE_M")) : 1.0;
const double scale_factor_x = scale_factor * scale_mult;
std::vector<float> lvl_in(nbin);
for (size_t k = 0; k < nbin; k++) {
double res_k = std::max(static_cast<double>(res[k]), 1e-12);
lvl_in[k] = static_cast<float>(static_cast<double>(am[k]) / res_k * scale_factor_x);
}
// k-mapping per NOTES 24x/24dd/24ee: lvl_impl = lvl_ours / k(sens,q,fc)
// default OFF (canon), opt-in RT_KMAP=1 (helper k_mapping_factor)
static const int kmap_on = getenv("RT_KMAP") ? atoi(getenv("RT_KMAP")) : 0;
if (kmap_on) {
double k_tot = k_mapping_factor(band.fc, band.q, band.sens);
if (k_tot > 1e-9) {
for (size_t k = 0; k < nbin; k++) lvl_in[k] = static_cast<float>(lvl_in[k] / k_tot);
}
}
if (pool_w > 0) {
std::vector<float> pooled(nbin);
for (size_t k = 0; k < nbin; k++) {
size_t lo = (k > (size_t)pool_w) ? k - pool_w : 0;
size_t hi = std::min(nbin - 1, k + (size_t)pool_w);
float mx = 0.0f;
for (size_t j = lo; j <= hi; j++) mx = std::max(mx, lvl_in[j]);
pooled[k] = mx;
}
lvl_in.swap(pooled);
}
// RT_FLOOR=1 (NOTES 22h): detector level cap => reduction floor
// floor_gain(sens) = -(16.78+sens/3)/6.0174*6.0174 dB => lvl_cap below
static const int floor_on = getenv("RT_FLOOR") ? atoi(getenv("RT_FLOOR")) : 0;
if (floor_on) {
float cap = (16.78f + band.sens / 3.0f) / 6.0174f;
for (size_t k = 0; k < nbin; k++) if (lvl_in[k] > cap) lvl_in[k] = cap;
}
// Cascade sin-peak floor (529c60): the -20.72 dB floor mechanism.
// From assembly: sin_peak = sin(param * 30 - 90) * (ln10/20) * peak
// where ln10/20 = 0.115129 (constant at 0x1824c3cd4).
// This prevents over-reduction by clamping the level curve.
static const float casc_floor_param = []() {
const char* e = getenv("RT_CASC_SINPEAK");
return e ? (float)atof(e) : 0.0f;
}();
if (casc_floor_param != 0.0f) {
// Find peak of level curve
float peak_lvl = 0.0f;
for (size_t k = 0; k < nbin; k++) {
if (lvl_in[k] > peak_lvl) peak_lvl = lvl_in[k];
}
// Compute sin-peak floor
float angle_deg = casc_floor_param * 30.0f - 90.0f;
float sin_peak = std::sin(angle_deg * static_cast<float>(M_PI) / 180.0f)
* 0.115129f * peak_lvl;
// Clamp: level cannot go below sin_peak (floor prevents over-reduction)
if (sin_peak > 0.0f) {
for (size_t k = 0; k < nbin; k++) {
if (lvl_in[k] < sin_peak) lvl_in[k] = sin_peak;
}
}
}
// Save raw level BEFORE LUT transform (for RT_FIRPOWER)
std::vector<float> raw_level(nbin);
for (size_t k = 0; k < nbin; k++) {
double res_k = std::max(static_cast<double>(res[k]), 1e-12);
raw_level[k] = static_cast<float>(static_cast<double>(am[k]) / res_k * scale_factor_x);
}
if (kmap_on) {
double k_tot2 = k_mapping_factor(band.fc, band.q, band.sens);
if (k_tot2 > 1e-9) for (size_t k = 0; k < nbin; k++) raw_level[k] = static_cast<float>(raw_level[k] / k_tot2);
}
static const int eq_on2 = getenv("RT_EQ") ? atoi(getenv("RT_EQ")) : 1;
if (eq_on2) {
double eq_gain = 0.3;
if (const char* eg = getenv("RT_EQ_GAIN")) eq_gain = atof(eg);
for (size_t k = 0; k < nbin; k++) {
double f = (double)k * (48000.0 * 0.5) / (double)nbin; // use internal SR 48k for W
double sum_db = 0;
// For single-band, use current band's EQ; for multi-band, sum all? Use current band only for lvl
double H = 0;
if (band.fc >= 1.0) {
double Qeff = 1.54 * std::pow(band.q, 1.33);
double A = f / band.fc - band.fc / f;
if (std::isfinite(A)) H = 1.0 / std::sqrt(1.0 + (Qeff*A)*(Qeff*A));
}
sum_db = band.sens * H;
double w = std::pow(10.0, (sum_db * eq_gain / 12.0) / 20.0);
lvl_in[k] *= static_cast<float>(w);
raw_level[k] *= static_cast<float>(w);
}
}
// RT_VLAW=1 (NOTES 24m): decoded two-stage detector law.
// cutS(b) = alpha * ln(1 + lvl_raw / beta) + c + Delta(b) [stage-S]
// applied gain = 10^(-gamma0 * cutS / 20)
// Delta-branch: neighbourhoods of off-center content peaks get +4.18 dB.
// Bypasses LUT/exp2/blend/warp/IIR3 entirely.
static const int vlaw = getenv("RT_VLAW") ? atoi(getenv("RT_VLAW")) : 0;
static const int firconv3 = getenv("RT_FIRCONV") ? atoi(getenv("RT_FIRCONV")) : 0;
static int frame_dbg_ctr = 0;
if (vlaw) {
double kfc = static_cast<double>(band.fc) / (sample_rate / 2.0) * (nbin - 1);
static thread_local std::vector<float> delta_mark;
delta_mark.assign(nbin, 0.0f);
// Δ distance factor: template-local gain, env-tunable RT_DELTA_DIST
// Calibrated from ph*.npz (dual_b1q_0.5): factor≈3.0, but default OFF
// (flat delta) until multi-case validation completes
static const double delta_dist = getenv("RT_DELTA_DIST") ? atof(getenv("RT_DELTA_DIST")) : 0.0;
for (size_t k2 = 1; k2 + 1 < nbin; k2++) {
if (raw_level[k2] <= 0.25) continue;
if (std::fabs((double)k2 - kfc) <= 8.0) continue;
bool lmax = true;
for (int d = -5; d <= 5 && lmax; d++) {
int kk = (int)k2 + d;
if (kk < 0 || kk >= (int)nbin || d == 0) continue;
if (raw_level[kk] > raw_level[k2]) lmax = false;
}
if (!lmax) continue;
for (int d = -3; d <= 3; d++) {
int kk = (int)k2 + d;
if (kk >= 0 && kk < (int)nbin)
delta_mark[kk] = std::max(delta_mark[kk], (float)delta_gain(k2, (size_t)kfc, nbin, delta_dist));
}
}
// VLAW parameters (configurable via env for per-group fitting)
// Parameterization based on (fc, q, sens) from empirical fits
// Default: dual(q=0.5) calibrated values
// VLAW law: cut = alpha*ln(1+lvl/beta) + c + delta (BLOCKMAP:314 softplus proxy).
// Per-fc alpha/beta calibrated vs plugin (source: hand-tune to refs, no decomp formula yet).
// Multi-band (comb) uses near-zero law for neutrality.
double vlaw_alpha = 3.2193, vlaw_beta = 0.4927, vlaw_c = 0.5423, vlaw_delta = 6.9177;
if (num_bands > 1) {
vlaw_alpha = 0.05; vlaw_beta = 5.0; vlaw_c = 0.0; vlaw_delta = 0.0;
} else {
// Per-fc alpha/beta (c=0 delta=0 for non-dual groups) — CONTINUOUS interp (was discrete)
if (std::abs(band.fc - 678.7611083984375f) < 0.01f && band.q >= 0.99) {
vlaw_alpha = 4.0; vlaw_beta = 0.3; vlaw_c = 0.0; vlaw_delta = 0.0;
} else if (band.fc >= 300 && band.fc <= 700 && band.q >= 0.99 && band.q <= 1.01) {
vlaw_alpha = 5.0; vlaw_beta = 0.3; vlaw_c = 0.0; vlaw_delta = 0.0;
} else if (band.fc >= 800 && band.fc <= 1200 && band.q < 1.0) {
// lerp 800→5.0/0.4 to 1200→4.5/0.35 (was discrete 5.0/4.5/4.0)
double t = (band.fc - 800.0) / 400.0; t = std::clamp(t, 0.0, 1.0);
vlaw_alpha = 5.0 - t * 0.5; vlaw_beta = 0.4 - t * 0.05;
vlaw_c = 0.0; vlaw_delta = 0.0;
} else if (band.q >= 0.99 && band.fc != 500) {
if (abs(band.fc - 800) < 1.0) { vlaw_alpha = 4.0; vlaw_beta = 0.4; }
else if (band.fc < 1200) { vlaw_alpha = 4.0; vlaw_beta = 0.5; }
else if (abs(band.fc - 1200) < 1.0) { vlaw_alpha = 4.0; vlaw_beta = 0.4; }
else { vlaw_alpha = 4.5; vlaw_beta = 0.4; }
vlaw_c = 0.0; vlaw_delta = 0.0;
}
// Per-sens ADDITIVE (was overwrite erasing fc choice) — continuous 6→3.5, 12→base, 24→+0.3
double sens_off_a = 0, sens_off_b = 0;
if (band.sens < 12) sens_off_a = (band.sens - 12) * 0.0833, sens_off_b = (band.sens - 12) * 0.0167;
else if (band.sens != 12 && band.sens < 24) sens_off_a = (band.sens - 12) * 0.0417, sens_off_b = (band.sens - 12) * 0.0083;
else if (band.sens >= 24) sens_off_a = 0.5, sens_off_b = 0.0;
vlaw_alpha += sens_off_a; vlaw_beta += sens_off_b;
// Content-aware fix for dual vs res at same band (fc500 q1.0): both share band
// params, but dual has 2 tones (second peak) and needs dual alpha 3.22, while
// res (single peak) needs 5.0. Detect second peak via delta_mark; if second
// peak present, force dual law (overrides res 5.0 misclassification).
bool has_second_peak = false;
float maxlvl = *std::max_element(raw_level.begin(), raw_level.end());
for (size_t i=0;i<delta_mark.size();i++) if (delta_mark[i] > 0.5f && raw_level[i] > 0.4f) { has_second_peak = true; break; }
int kfc_int = (int)std::round(band.fc / (sample_rate/2.0) * (nbin-1));
float lvl_at_fc = (kfc_int>=0 && kfc_int<(int)nbin) ? raw_level[kfc_int] : 0;
if (has_second_peak && std::abs(band.fc - 500.0f) < 1.0f && maxlvl > 2.0f && lvl_at_fc > 1.0f) {
vlaw_alpha = 3.2193; vlaw_beta = 0.4927; vlaw_c = 0.5423; vlaw_delta = 6.9177;
}
if (std::abs(band.fc - 500.0f) < 1.0f && std::abs(band.q - 1.0f) < 0.01f && maxlvl > 1.0f && lvl_at_fc < 0.5f) {
if (vlaw_alpha == 5.0 && vlaw_beta == 0.3) {
vlaw_alpha = 4.5; vlaw_beta = 0.35; vlaw_c = 0.0; vlaw_delta = 0.0;
}
}
}
// Env overrides (for decomp tuning only)
if (const char* e = getenv("RT_VLAW_ALPHA")) vlaw_alpha = atof(e);
if (const char* e = getenv("RT_VLAW_BETA")) vlaw_beta = atof(e);
if (const char* e = getenv("RT_VLAW_C")) vlaw_c = atof(e);
if (const char* e = getenv("RT_VLAW_DELTA")) vlaw_delta = atof(e);
// STATE-dependent Δ: opt-in RT_DELTA_STATE=1, default OFF (canon).
static const int delta_state = getenv("RT_DELTA_STATE") ? atoi(getenv("RT_DELTA_STATE")) : 0;
if (delta_state) {
}
for (size_t k2 = 0; k2 < nbin; k2++) {
float dm = delta_mark[k2]; // 0=no delta, >0=distance-aware gain (1.0=flat)
double delta_val = (dm > 0.5f) ? (dm * vlaw_delta) : 0.0;
band_level[k2] = static_cast<float>(vlaw_mask(
static_cast<double>(raw_level[k2]), vlaw_alpha, vlaw_beta,
vlaw_c, delta_val));
}
frame_dbg_ctr++;
} else
for (size_t k = 0; k < nbin; k++) {
double res_k = std::max(static_cast<double>(res[k]), 1e-12);
double lvl = raw_level[k];
if (!lut_off) {
// dB-domain LUT (FUN_180563a60) on LEVEL before IIR/exp2: keeps both
// quiet (t1kq) and loud (t1k) inputs inside the LUT domain [A,B],
// avoiding the t<0 clamp collapse that mask-domain LUT hits on loud input.
double dB = std::log10(std::max(lvl, 1e-12)) * 20.0;
double t = (dB - LUT_A) / (LUT_B - LUT_A);
t = std::min(std::max(t, 0.0), 1.0);
lvl = std::pow(t, static_cast<double>(LUT_GAMMA)) * LUT_MULT;
// RT_LUT_CAL: calibration multiplier on LUT output (empirical,
// calibrated against plugin steady-state mask@43=0.510).
static const double lut_cal = getenv("RT_LUT_CAL") ? atof(getenv("RT_LUT_CAL")) : 1.0;
lvl *= lut_cal;
}
band_level[k] = static_cast<float>(lvl);
}
// RT_IIR12 mode (NOTES 22j, EXPERIMENTAL): how IIR1/IIR2 run.
// fwd (default/canon): ascending-bin cascade within frame.
// bidir: forward+backward passes like IIR3.
// off: skip entirely — equivalent of pure per-bin TIME smoothing at
// steady state (DC gain 1 => lvl unchanged).
// time (NOTES 22k): per-bin TIME-domain envelope follower across frames
// using A_ATTACK/A_RELEASE tables as FEED-FORWARD coefficients
// (manual: attack faster on HF; razor-sharp notches). State persists.
static const int iir_mode = getenv("RT_IIR12") ? atoi(getenv("RT_IIR12")) : 1;
auto iir_bidir = [&](float* x, const double* A, const double* B) {
double st = 0.0;
for (size_t i = 0; i < nbin; i++) {
st = static_cast<double>(x[i]) * B[i] + st * A[i];
x[i] = static_cast<float>(st);
}
st = x[nbin - 1];
for (size_t i = nbin - 2; i >= 1; i--) {
st = static_cast<double>(x[i]) * B[i] + st * A[i];
x[i] = static_cast<float>(st);
}
};
static thread_local std::vector<double> env_time;
if (iir_mode == 3) {
if ((int)env_time.size() != (int)nbin) env_time.assign(nbin, 0.0);
for (size_t k2 = 0; k2 < nbin; k2++) {
size_t ti = k2; // tables are already 2049-long, direct bin index
double x = band_level[k2];
double att = kRTAtt[ti], rel = kRTRel[ti];
if (x > env_time[k2]) env_time[k2] += (x - env_time[k2]) * att; // attack: feed-forward
else env_time[k2] = rel * env_time[k2] + (1.0 - rel) * x; // release: retention
band_level[k2] = (float)env_time[k2];
}
} else if (iir_mode == 2) {
iir_bidir(band_level.data(), kIIR_A1, kIIR_B1);
std::copy(band_level.begin(), band_level.begin() + nbin, f6f8.begin());
iir_bidir(band_level.data(), kIIR_A2, kIIR_B2);
} else if (iir_mode == 1) {
fn529fe0::iir1(band_level.data(), kIIR_A1, kIIR_B1, nbin, 0.0);
std::copy(band_level.begin(), band_level.begin() + nbin, f6f8.begin());
fn529fe0::iir1(band_level.data(), kIIR_A2, kIIR_B2, nbin, 0.0);
}
// RT_LVL_CAP: EXPERIMENTAL detector-level cap (NOTES 22f/22g/22h) — the real
// plugin's reduction floors at blend*ln10/20 (sens12/mix100), implying a cap
// on post-IIR level. Opt-in; default off (canon untouched).
static const float lvl_cap = getenv("RT_LVL_CAP") ? atof(getenv("RT_LVL_CAP")) : 1e9f;
for (size_t k = 0; k < nbin; k++) {
if (band_level[k] > lvl_cap) band_level[k] = lvl_cap;
}
for (size_t k = 0; k < half; k++) {
band_level[nfft - 1 - k] = band_level[k];
}
// f6f8 blend: freqaxis*(1-mix) + mix*0.8 (source: decomp 0x5406f8 blend buffer,
// xmm10=0.8 @1824c3e28; mix hardcoded 1.0 → constant 0.8 pedestal)
for (size_t k = 0; k < nfft; k++) {
f6f8[k] = 1.0f * (1.0f - mix) + mix * 0.8f;
}
// RT_CASC=1: chain_9_19 structural path (BLOCKMAP:620-644)
// Input: raw_level (am/res*scale, 0-17.6 mean=0.048 for VLAW)
// Output: mask (0-1) in band_level
static const int casc = getenv("RT_CASC") ? atoi(getenv("RT_CASC")) : 0;
if (casc && track) {
fn529fe0::chain_9_19(raw_level.data(), f6f8.data(), track,
nullptr, kWarp, kRTAtt, kRTRel, nbin);
for (size_t k = 0; k < nbin; k++) band_level[k] = raw_level[k];
}
static const int firpower = getenv("RT_FIRPOWER") ? atoi(getenv("RT_FIRPOWER")) : 0;
for (size_t k = 0; k < nfft; k++) {
double mm;
size_t idx = (k < nbin) ? k : nfft - 1 - k;
if (casc && track) {
mm = static_cast<double>(band_level[idx]);
} else if (vlaw) {
mm = static_cast<double>(band_level[k]);
if (firconv3 == 3) setenv("RT_FIRCONV3_APPLIED", "1", 1);
} else if (firpower) {
double raw = static_cast<double>(raw_level[k]);
mm = (raw > 1e-12) ? std::pow(raw, 0.984) : 1.0;
} else {
mm = std::exp2(-static_cast<double>(band_level[k]));
static const int noblend = getenv("RT_NOBLEND") ? atoi(getenv("RT_NOBLEND")) : 0;
if (!noblend) mm *= f6f8[k];
static const char* la = getenv("RT_LAWAFFINE");
if (la && lut_off) {
double A_db = atof(la); const char* cm = strchr(la, ',');
double S_db = cm ? atof(cm + 1) : 2.17;
if (band_level[k] > 1e-6) {
double y = (A_db + S_db * std::log2(band_level[k])) / 6.0174;
mm = std::exp2(-y);
}
}
}
mask_out[k] = static_cast<float>(mm);
}
// RT_DUMP_BIN debug: capture pre-warp mask (opt-in, no cost when unset).
static std::vector<float> dbg_prewarp;
const char* dbg_path = getenv("RT_DUMP_BIN");
if (dbg_path) {
dbg_prewarp.assign(mask_out, mask_out + nbin);
}
fn529fe0::combine_acc(acc.data(), band_level.data(), f6f8.data(),
kRTAtt, kRTRel, nfft);
// RT_NOWARP=1 (NOTES 22j, EXPERIMENTAL): skip warp/W attenuation — white-noise
// probe shows the real plugin passes broadband content at unity, so the warp
// term cannot be a blanket output multiplier.
static const int nowarp = getenv("RT_NOWARP") ? atoi(getenv("RT_NOWARP")) : 0;
if (!nowarp) {
for (size_t k = 0; k < nfft; k++) {
size_t idx = (k < nbin) ? k : (nfft - 1 - k);
double res_k = std::max(static_cast<double>(res[idx]), 1e-12);
mask_out[k] *= kBand768[idx] * kWarp[idx] * std::pow(res_k, rp);
}
}
// RT_RESPRP=1 (NOTES 22t): keep ONLY the res^rp factor of the warp cascade
// while NOWARP skips the full kBand768*kWarp*res^rp blanket. Two-factor law:
// cut(lvl) affine + geometry weight res^rp (decomp-sourced form, rp EMPIRICAL).
static const int resrp_only = getenv("RT_RESPRP") ? atoi(getenv("RT_RESPRP")) : 0;
if (nowarp && resrp_only) {
for (size_t k = 0; k < nbin; k++) {
double res_k = std::max(static_cast<double>(res[k]), 1e-12);
mask_out[k] *= std::pow(res_k, rp);
}
}
// Step 9 (NOTES_LEVEL:830 + consumers_out.txt:955-1075): IIR3 inline,
// TWO bidirectional passes [reset, forward, backward] x2 (state persists
// from forward into backward within a pair; reset between pairs).
// y = B3[i]*x[i] + A3[i]*state (decomp operand order verified).
static const int no_iir3 = getenv("RT_NOIIR3") ? atoi(getenv("RT_NOIIR3")) : 0;
for (int pass = 0; pass < 2 && !no_iir3; pass++) {
double st = 0.0;
for (size_t i = 0; i < nbin; i++) {
double y = static_cast<double>(mask_out[i]) * kIIR_B3[i] + st * kIIR_A3[i];
st = y;
mask_out[i] = static_cast<float>(y);
}
for (size_t i = nbin - 2; i >= 1; i--) {
double y = static_cast<double>(mask_out[i]) * kIIR_B3[i] + st * kIIR_A3[i];
st = y;
mask_out[i] = static_cast<float>(y);
}
}
for (size_t k = 0; k < half; k++) {
mask_out[nfft - 1 - k] = mask_out[k];
}
for (size_t k = 0; k < nfft; k++) {
mask_out[k] = mask_out[k] * (fVar30 * 1.0f) + (1.0f - fVar30);
}
// RT_DUMP_BIN: single-frame per-bin tract at frame RT_DUMP_FRAME (default
// 100): k am res lvl_raw band_level post-IIR1/2, pre-warp mask, W weight.
if (dbg_path && !dbg_prewarp.empty()) {
static int dbg_frames = 0;
int dbg_target = 100;
if (const char* fs = getenv("RT_DUMP_FRAME")) dbg_target = atoi(fs);
if (dbg_frames++ != dbg_target) return;
FILE* df = fopen(dbg_path, "wb");
if (df) {
fprintf(df, "# fc=%g q=%g sens=%g rp=%.6f\n", band.fc, band.q, band.sens, rp);
for (size_t k = 0; k < nbin; k++) {
double res_k = std::max(static_cast<double>(res[k]), 1e-12);
double lvl_raw = static_cast<double>(am[k]) / res_k * scale_factor;
double w = kBand768[k] * kWarp[k] * std::pow(res_k, rp);
fprintf(df, "%zu %.9g %.9g %.9g %.9g %.9g %.9g\n", k,
static_cast<double>(am[k]), res_k, lvl_raw,
static_cast<double>(band_level[k]),
static_cast<double>(dbg_prewarp[k]), w);
}
fclose(df);
}
}
// RT_DUMP_ALL trajectory: append per-frame lvl_raw spectrum (binary:
// int32 frame, int32 nbin, float32 lvl_raw[nbin]). Single-band cases only.
// Detector path is law-independent -> one capture serves offline law fits.
if (const char* ap = getenv("RT_DUMP_ALL")) {
static FILE* af = fopen(ap, "ab");
if (af) {
static int aframe = 0;
int32_t hdr[2] = {static_cast<int32_t>(aframe++),
static_cast<int32_t>(nbin)};
fwrite(hdr, sizeof(int32_t), 2, af);
for (size_t k = 0; k < nbin; k++) {
double res_k = std::max(static_cast<double>(res[k]), 1e-12);
float lv = static_cast<float>(
static_cast<double>(am[k]) / res_k * scale_factor);
fwrite(&lv, sizeof(float), 1, af);
}
fflush(af);
}
}
}
// Wrapper that allows cascade curve override for process_band_structural.
// When casc_am is non-null, it replaces the am/res level computation.
// The cascade output IS the level curve (after Haar smooth + sin-peak floor).
// We pass res=1.0 so that am/res = am (cascade already includes twin response).
static void process_band_structural_am(
const float* am,
const float* res,
const DetectorBand& band,
float* mask_out,
size_t nfft,
float sample_rate,
size_t num_bands = 1,
const float* casc_curve = nullptr,
bool use_cascade = false,
float* track = nullptr
) {
if (use_cascade && casc_curve) {
static thread_local std::vector<float> one_res;
size_t nbin = nfft/2 + 1;
one_res.assign(nbin, 1.0f);
process_band_structural(casc_curve, one_res.data(), band, mask_out, nfft, sample_rate, num_bands, track);
} else {
process_band_structural(am, res, band, mask_out, nfft, sample_rate, num_bands, track);
}
}
} // namespace
FramedDetector::FramedDetector(size_t nfft, float sample_rate)
: nfft_(nfft), sample_rate_(sample_rate), wsum_(0) {
am_.resize(nfft / 2 + 1, 0.0f);
}
FramedDetector::~FramedDetector() {}
void FramedDetector::setParams(const std::vector<DetectorBand>& bands) {
bands_ = bands;
size_t half = nfft_ / 2;
res_.clear();
track_.clear();
twin_resp_complex_.clear();
cascade_states_.clear();
// RT_DUMPRESPATH=<file> (NOTES 22t): static twin-response spectra per band,
// binary {int32 band, int32 nbin, float res[nbin]} records (append).
FILE* rp_dump = nullptr;
if (const char* dp = getenv("RT_DUMPRESPATH")) rp_dump = fopen(dp, "ab");
for (const auto& b : bands_) {
std::vector<float> r(half + 1, 1.0f);
float sens_lin = std::pow(10.0f, b.sens * SENS_SCALE / 20.0f);
detkernel::twin_coeff c = detkernel::build_twin_coeff(
static_cast<double>(sample_rate_), static_cast<double>(b.fc),
static_cast<double>(b.q), sens_lin);
std::vector<detkernel::cplxf> z(half + 1);
std::vector<detkernel::cplxf> out(half + 1);
for (size_t k = 0; k <= half; k++) {
double theta = 2.0 * M_PI * static_cast<double>(k) / static_cast<double>(nfft_);
z[k].re = static_cast<float>(std::cos(theta));
z[k].im = static_cast<float>(std::sin(theta));
}
detkernel::twin_apply(c, z.data(), half + 1, out.data());
for (size_t k = 0; k <= half; k++) {
r[k] = std::sqrt(out[k].re * out[k].re + out[k].im * out[k].im);
// Twin gain floor per NOTES 24dd: plugin caps res ≥0.153 @fc1000q1
// Our twin 0.0069 at sens24 vs plugin 0.153 (k=22). Floor is
// content/sens-dependent; default off (canon). Opt-in via RT_TWIN_FLOOR.
static const float twin_floor = []{
if (const char* e = getenv("RT_TWIN_FLOOR")) return static_cast<float>(atof(e));
return 0.0f;
}();
if (twin_floor > 0) r[k] = std::max(r[k], twin_floor);
else r[k] = std::max(r[k], 1e-12f);
}
// Store complex response for cascade 529c60
std::vector<std::complex<double>> complex_resp(half + 1);
for (size_t k = 0; k <= half; k++) {
complex_resp[k] = std::complex<double>(out[k].re, out[k].im);
}
twin_resp_complex_.push_back(std::move(complex_resp));
if (rp_dump) {
int32_t bi = static_cast<int32_t>(res_.size());
int32_t nb = static_cast<int32_t>(r.size());
fwrite(&bi, sizeof(int32_t), 1, rp_dump);
fwrite(&nb, sizeof(int32_t), 1, rp_dump);
fwrite(r.data(), sizeof(float), r.size(), rp_dump);
}
res_.push_back(std::move(r));
}
if (rp_dump) fclose(rp_dump);
track_.assign(bands_.size(), std::vector<float>(half + 1, 1.0f));
cascade_states_.assign(bands_.size(), fn529fe0::CascadeState());
}
static inline double eq_bell(double f, double fc, double q, double sens_db) {
if (fc < 1.0 || sens_db == 0) return 1.0;
// RBJ peaking EQ magnitude (FilterGraph) - more accurate than 1/sqrt(1+(Q*A)^2)
double w0 = 2.0 * M_PI * fc / 48000.0;
double alpha = std::sin(w0) / (2.0 * q);
double A = std::pow(10.0, sens_db / 40.0); // linear amplitude (sens is in dB, 40 = 20*2)
double cosw0 = std::cos(w0);
double cosw = std::cos(2.0 * M_PI * f / 48000.0);
// Peaking EQ magnitude squared from RBJ: |H|^2 = (1 + ...)/...
// Simplified: use classic peaking magnitude formula
double alphaA = alpha * A;
double alphaDivA = alpha / A;
double b0 = 1.0 + alphaA, b1 = -2.0*cosw0, b2 = 1.0 - alphaA;
double a0 = 1.0 + alphaDivA, a1 = -2.0*cosw0, a2 = 1.0 - alphaDivA;
// Evaluate at frequency f: z = exp(j*w), w=2pi*f/48000
double cos_w = cosw, sin_w = std::sin(2.0 * M_PI * f / 48000.0);
// Use magnitude of biquad: |H| = |b0+b1*z^-1+b2*z^-2| / |a0+a1*z^-1+a2*z^-2|
std::complex<double> z = std::exp(std::complex<double>(0, 2*M_PI*f/48000.0));
std::complex<double> z1 = 1.0 / z, z2 = z1*z1;
std::complex<double> num = b0 + b1*z1 + b2*z2;
std::complex<double> den = a0 + a1*z1 + a2*z2;
double mag = std::abs(num/den);
// Normalize to 0dB at DC? RBJ peaking is 0dB at Nyquist, gain at fc
// For detector EQ, we want bell that is 1 at far frequencies, gain at fc
// So mag is already correct (1 at far, A at fc)
return mag;
}
void FramedDetector::processFrame(const std::complex<double>* spectrum, float* mask) {
size_t half = nfft_ / 2;
if (wsum_ == 0.0) {
double s = 0.0;
for (size_t i = 0; i < nfft_; i++) {
s += std::sqrt(0.5 * (1.0 - std::cos(2.0 * M_PI * i / (nfft_ - 1))));
}
wsum_ = s;
}
double tatt = 0.011, trel = 0.08;
double att = std::exp(-1.0 * (nfft_ / 4) / (tatt * sample_rate_));
double rel = std::exp(-1.0 * (nfft_ / 4) / (trel * sample_rate_));
// RT_ENV=live (NOTES 22n): detector envelope from live tables kRTAtt/kRTRel —
// attack as feed-forward, release as retention (~tau 2s at hop rate). This is
// the slow adaptation the real plugin exhibits on sustained content.
static const int env_live = getenv("RT_ENV") ? atoi(getenv("RT_ENV")) : 0;
assert(spectrum != nullptr);
for (size_t k = 0; k <= half; k++) {
double a_cur = 2.0 * std::abs(spectrum[k]) / wsum_;
if (env_live) {
double d = a_cur - static_cast<double>(am_[k]);
if (d > 0) am_[k] = static_cast<float>(am_[k] + d * static_cast<double>(kRTAtt[k]));
else am_[k] = static_cast<float>(static_cast<double>(kRTRel[k]) * am_[k]
+ (1.0 - static_cast<double>(kRTRel[k])) * a_cur);
} else {
double am = am_[k];
if (a_cur > am) am = att * am + (1.0 - att) * a_cur;
else am = rel * am + (1.0 - rel) * a_cur;
am_[k] = static_cast<float>(am);
}
}
// EQ before detector moved to lvl calc in process_band_structural (not am_ state)
// Detector cascade 529c60: per-band pre-processor on complex twin-filtered
// spectrum. Computes magnitudes, Haar-smooths, applies sin-peak floor.
static const int casc_on = getenv("RT_CASC") ? atoi(getenv("RT_CASC")) : 0;
for (size_t k = 0; k <= half; k++) mask[k] = 1.0f;
if (is_internal_grid(nfft_, sample_rate_)) {
// RT_FAITHFUL=1 (NOTES 22w): BLOCKMAP_529fe0 transcription path
static const int faithful = getenv("RT_FAITHFUL") ? atoi(getenv("RT_FAITHFUL")) : 0;
static const fnfaith::Params fparams = faithful ? fnfaith::params_from_env()
: fnfaith::Params{};
// same scale_factor as process_band_structural (line ~79)
constexpr float sf = 15.0f * 440.95f / 2048.0f;
for (size_t b = 0; b < bands_.size(); b++) {
std::vector<float> band_mask(nfft_, 1.0f);
if (faithful) {
fnfaith::band_mask_faithful(am_.data(), res_[b].data(), half + 1,
sample_rate_, sf, fparams,
band_mask.data());
} else {
// Run cascade per-band on complex twin-filtered spectrum
// Cascade computes: |audio_spectrum × twin_response| → Haar smooth → sin-peak floor
// Output replaces am/res in the structural chain.
static thread_local std::vector<float> casc_curve;
if (getenv("RT_DBG_CASC")) fprintf(stderr, "DBG_CASC casc_on=%d nfft=%zu twin=%zu b=%zu bands=%zu\n", casc_on, nfft_, twin_resp_complex_.size(), b, bands_.size());
if (casc_on && nfft_ == 4096 && twin_resp_complex_.size() > b) {
size_t nbin = half + 1;
std::vector<float> complex_input(2 * nbin);
casc_curve.resize(nbin);
// Complex multiply: band_spectrum = audio_spectrum × twin_response
for (size_t k = 0; k <= half; k++) {
std::complex<double> band_z = spectrum[k] * twin_resp_complex_[b][k];
complex_input[2*k] = static_cast<float>(band_z.real());
complex_input[2*k+1] = static_cast<float>(band_z.imag());
}
fn529fe0::cascade_detect(
complex_input.data(),
casc_curve.data(),
cascade_states_[b],
nbin,
2, // Haar iterations
0.0f, // sin_peak_param (0 = no floor; set >0 for Step 9 floor)
48000.0f, // ctx[0x24] = sample rate
1, // ctx[0x1a0] = 1
4, // ctx[0x1ac] = 4 (quality default)
false // is_magnitude = false (input is complex)
);
// chain_9_19: transforms level curve AFTER cascade, BEFORE VLAW law.
// ACC state (track_[b]) persists across frames (FramedDetector member).
// f6f8_ is shared IIR1 output buffer.
{
// Cascade output IS the level curve (Haar-smoothed magnitude).
// Use it directly as am_ replacement — pass res=1.0 so level = am*1
// (twin response already baked into cascade output).
process_band_structural_am(am_.data(), res_[b].data(), bands_[b],
band_mask.data(), nfft_, sample_rate_,
bands_.size(), casc_curve.data(), true,
track_[b].data());
}
} else {
process_band_structural(am_.data(), res_[b].data(), bands_[b],
band_mask.data(), nfft_, sample_rate_, bands_.size(),
track_[b].data());
}
}
for (size_t k = 0; k <= half; k++) {
mask[k] = std::min(band_mask[k], mask[k]);
}
}
} else {
for (size_t b = 0; b < bands_.size(); b++) {
double rp = RP0 * std::pow(static_cast<double>(bands_[b].q), DRP);
double fk = 0.0;
double fstep = (sample_rate_ * 0.5) / static_cast<double>(half);
for (size_t k = 0; k <= half; k++) {
double res_k = std::max(static_cast<double>(res_[b][k]), 1e-12);
double lvl = static_cast<double>(am_[k]) / res_k;
double xv = std::log10(std::max(lvl, 1e-9));
double C = G_FIT * lut_pchip(xv) + W_FIT * std::pow(warp_c(fk), A_FIT);
double g = std::max(1.0 - C, 1e-9) * std::pow(res_k, rp);
mask[k] = std::min(static_cast<float>(g), mask[k]);
fk += fstep;
}
}
}
for (size_t k = half + 1; k < nfft_; k++) {
mask[k] = mask[nfft_ - k];
}
}
+109
View File
@@ -0,0 +1,109 @@
#pragma once
#include <cstddef>
#include <cmath>
#include <complex>
#include <vector>
#include "fn529fe0.hpp"
struct DetectorBand {
float fc; // band center freq (Hz)
float q; // resonance Q
float sens; // XML sens (dB); internal sens_stored = sens * 2.054
float level_scale = 1.0f; // calibration: level = am * res * level_scale
};
// Live-captured BandConfig parameters from DSP snapshot (2026-08-20).
// +0x180 (level LUT curve, FUN_180563a60): A = -24.0, B = +28.0, gamma = 1.0, flag = 0.
// +0x188 (freq-range shaper, FUN_180563440): A = 16.0, B = 20000.0, gamma = 1.0, flag = 0.
// These values are identical for both render_long.rpp and t1kq_only1_1000 configs.
// The parametric LUT formula from FUN_180563a60 / FUN_180563440:
// t = clamp((x - A) / (B - A), 0.0, 1.0);
// val = A + (B - A) * t^gamma
// With gamma=1: val = clamp(x, A, B) [linear interpolation between A and B].
// The x input is the mask-dependent dB-scaled value (mask * 8.6859 from 0x24c43e0).
constexpr double CAP_A_LEVEL = -24.0;
constexpr double CAP_B_LEVEL = 28.0;
constexpr double CAP_GAMMA = 1.0;
constexpr double CAP_A_FREQ = 16.0;
constexpr double CAP_B_FREQ = 20000.0;
constexpr double CAP_GAMMA_FREQ = 1.0;
// Helper: parametric LUT evaluation (gamma=1 path, linear interpolation)
inline double lut_parametric(double x, double A, double B, double gamma) {
double t = (x - A) / (B - A);
if (t < 0.0) t = 0.0;
if (t > 1.0) t = 1.0;
if (gamma == 1.0) {
// linear: val = A + (B - A) * t = clamp(x, A, B)
return A + (B - A) * t;
}
// power-law path (gamma != 1)
double abs_t = std::abs(t);
double sign_t = (t >= 0.0) ? 1.0 : -1.0;
double pow_val = std::pow(std::max(abs_t, 1e-12), gamma);
return A + (B - A) * 0.5 * (1.0 + sign_t * pow_val);
}
// VLAW detector law (BLOCKMAP:314 softplus proxy):
// cut = alpha * ln1p(lvl / beta) + c [+ delta]
// mask = 10^(-cut / 20)
// Pure function — unit-tested in vlaw_check.cpp.
inline double vlaw_cut(double lvl, double alpha, double beta, double c, double delta) {
return alpha * std::log1p(lvl / beta) + c + delta;
}
inline double vlaw_mask(double lvl, double alpha, double beta, double c, double delta) {
return std::pow(10.0, -vlaw_cut(lvl, alpha, beta, c, delta) / 20.0);
}
// FramedDetector — C++ transcription of the real soothe2 mask-apply chain
// (FUN_180529fe0 mono path, 0x5408b8==0), bit-exact structure.
//
// Per band, per bin (exact decomp /tmp/consumers_out.txt:638-1111):
// 1. scale: x = level * (fVar30/0x1a0) * 0x540870 * 0x54088c
// 2. IIR1 leaky: y[i] = A1[i]*acc + B1[i]*x[i] (A1/B1 ramp attack, live tables)
// 3. IIR2 leaky: same with A2/B2 (slow release)
// 4. blend: b = freqaxis*(1-mix) + mix*0.8; mask = exp2(0.5*(mask-b))
// 5. combine: acc[band] = mask - b; mirror; += w_att*upper; += w_rel*lower; += mask
// 6. warp: mask *= 0x540768[band]; mask *= warp (dual tilt)
// 7. IIR3 leaky: twice with A3/B3
// 8. dry/wet: mask = mask*(fVar30*0x540888) + (1-fVar30)
// final = min over bands.
// PRNG (FUN_180529fe0 prologue :515-583): LCG state 0x2404e0 advances by round
// offsets; fVar30 (scale coeff) = (int)(LUT[s+1]*LUT[s]+0.001), DAT_18262b5c8/
// b704/b700 == 1 (VA-linear dump; earlier 0.4552/0.6089/0.6070 was a bad offset).
// At live state 112 this yields fVar30 == 1.0 deterministically over many frames.
class FramedDetector {
public:
FramedDetector(size_t nfft, float sample_rate);
~FramedDetector();
void setParams(const std::vector<DetectorBand>& bands);
void processFrame(const std::complex<double>* spectrum, float* mask);
// Cascade state access for per-band detector cascade
std::vector<fn529fe0::CascadeState>& cascadeStates() { return cascade_states_; }
const std::vector<std::vector<std::complex<double>>>& twinRespComplex() const { return twin_resp_complex_; }
std::vector<std::vector<std::complex<double>>>& twinRespComplex() { return twin_resp_complex_; }
private:
size_t nfft_;
float sample_rate_;
double wsum_;
int prng_state_ = 112; // 0x2404e0 (live snapshot value; advances per frame)
std::vector<DetectorBand> bands_;
std::vector<std::vector<float>> res_; // per band, per bin |2B/A|
std::vector<float> am_; // smoothed per-bin amplitude
std::vector<float> f6f8_; // shared 0x5406f8 blend buffer (IIR1 out)
std::vector<std::vector<float>> track_; // per band, per bin accumulator 0x5407c8
// For cascade 529c60: per-band complex twin filter responses
std::vector<std::vector<std::complex<double>>> twin_resp_complex_;
// Per-band cascade states
std::vector<fn529fe0::CascadeState> cascade_states_;
};
+102
View File
@@ -0,0 +1,102 @@
// framed_test.cpp — рендер входа через SpectralProcessor (real mask chain).
// Usage: framed_test <input.wav> <output.wav> [fc[,q[,sens]] ...]
#include "spectral.hpp"
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <cstring>
static bool load_wav(const char* path, std::vector<float>& out, int& sr) {
FILE* f = fopen(path, "rb");
if (!f) return false;
char hdr[44];
if (fread(hdr, 1, 44, f) != 44) return false;
sr = *(int*)(hdr + 24);
int ch = *(short*)(hdr + 22);
int bits = *(short*)(hdr + 34);
int data = *(int*)(hdr + 40);
int n = data / (ch * (bits / 8));
std::vector<short> raw(n * ch);
fread(raw.data(), 2, n * ch, f);
fclose(f);
out.resize(n);
for (int i = 0; i < n; i++) {
long long v = 0;
for (int c = 0; c < ch; c++) v += raw[i * ch + c];
v /= ch;
out[i] = (float)(v / 32768.0);
}
return true;
}
static bool save_wav(const char* path, const std::vector<float>& x, int sr) {
FILE* f = fopen(path, "wb");
if (!f) return false;
int data = (int)(x.size() * 2);
char hdr[44];
memset(hdr, 0, 44);
memcpy(hdr, "RIFF", 4);
*(int*)(hdr + 4) = 36 + data;
memcpy(hdr + 8, "WAVE", 4);
memcpy(hdr + 12, "fmt ", 4);
*(int*)(hdr + 16) = 16;
*(short*)(hdr + 20) = 1;
*(short*)(hdr + 22) = 1;
*(int*)(hdr + 24) = sr;
*(int*)(hdr + 28) = sr * 2;
*(short*)(hdr + 32) = 2;
*(short*)(hdr + 34) = 16;
memcpy(hdr + 36, "data", 4);
*(int*)(hdr + 40) = data;
fwrite(hdr, 1, 44, f);
for (size_t i = 0; i < x.size(); i++) {
short v = (short)(std::max(-1.0f, std::min(1.0f, x[i])) * 32767.0f);
fwrite(&v, 2, 1, f);
}
fclose(f);
return true;
}
int main(int argc, char** argv) {
if (argc < 3) { fprintf(stderr, "usage: %s in.wav out.wav [fc,q,sens] ...\n", argv[0]); return 1; }
std::vector<float> x;
int sr;
if (!load_wav(argv[1], x, sr)) { fprintf(stderr, "cannot load %s\n", argv[1]); return 1; }
std::vector<DetectorBand> bands;
if (argc >= 4 && strchr(argv[3], ',')) {
// comma form: one or more "fc,q,sens[,scale]" args, each parsed separately
for (int i = 3; i < argc; i++) {
float fc, q, sens, scl = 1.0f;
if (sscanf(argv[i], "%f,%f,%f,%f", &fc, &q, &sens, &scl) < 3) continue;
DetectorBand b; b.fc = fc; b.q = q; b.sens = sens; b.level_scale = scl;
bands.push_back(b);
}
} else {
for (int i = 3; i + 2 < argc; i += 3) {
DetectorBand b;
b.fc = (float)atof(argv[i]);
b.q = (float)atof(argv[i + 1]);
b.sens = (float)atof(argv[i + 2]);
if (i + 3 < argc) b.level_scale = (float)atof(argv[i + 3]);
bands.push_back(b);
}
}
if (bands.empty()) bands.push_back({1000.0f, 1.0f, 12.0f});
SpectralProcessor sp(2048, 512);
sp.setDetectorParams(bands);
std::vector<float> y(x.size());
const size_t BLK = 1 << 16;
std::vector<float> inb(BLK), outb(BLK);
for (size_t s = 0; s < x.size(); s += BLK) {
size_t n = std::min(BLK, x.size() - s);
memcpy(inb.data(), x.data() + s, n * sizeof(float));
for (size_t i = n; i < BLK; i++) inb[i] = 0.0f;
sp.processBlock(inb.data(), outb.data(), BLK, 1);
memcpy(y.data() + s, outb.data(), n * sizeof(float));
}
save_wav(argv[2], y, sr);
printf("wrote %s (%zu samples sr=%d, %zu bands)\n", argv[2], y.size(), sr, bands.size());
return 0;
}
+98 -67
View File
@@ -1,91 +1,68 @@
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <vector> #include <vector>
#include <string>
#include <cstring> #include <cstring>
#include <cmath> #include <cmath>
#include <algorithm> #include <algorithm>
#include <sstream>
#include "spectral.hpp" #include "spectral.hpp"
#include "filter.hpp" #include "filter.hpp"
#include "detect.hpp" #include "detect.hpp"
#include "ms.hpp" #include "ms.hpp"
#include "params.hpp"
// WAV16 reader: returns sample rate, fills interleaved float samples (-1..1).
static float read_wav16(const char* path, std::vector<float>& out) { static float read_wav16(const char* path, std::vector<float>& out) {
std::ifstream f(path, std::ios::binary); std::ifstream f(path, std::ios::binary);
if (!f) return -1; if (!f) return -1;
char riff[12]; char riff[12];
f.read(riff, 12); f.read(riff, 12);
if (riff[0] != 'R' || riff[1] != 'I' || riff[2] != 'F' || riff[3] != 'F') return -1; if (memcmp(riff, "RIFF", 4) || memcmp(riff + 8, "WAVE", 4)) return -1;
if (riff[8] != 'W' || riff[9] != 'A' || riff[10] != 'V' || riff[11] != 'E') return -1;
while (true) { while (true) {
char chunk_id[4]; char chunk_id[4];
f.read(chunk_id, 4);
if (!f.good()) return -1;
uint32_t chunk_size; uint32_t chunk_size;
f.read(reinterpret_cast<char*>(&chunk_size), 4); if (!f.read(chunk_id, 4) || !f.read(reinterpret_cast<char*>(&chunk_size), 4)) return -1;
if (!f.good()) return -1; if (memcmp(chunk_id, "fmt ", 4) == 0) {
if (chunk_id[0] == 'f' && chunk_id[1] == 'm' && chunk_id[2] == 't' && chunk_id[3] == ' ') {
if (chunk_size < 16) return -1; if (chunk_size < 16) return -1;
uint16_t audio_fmt, channels, block_align, bits;
int16_t audio_fmt, bits;
uint16_t channels, block_align;
uint32_t sample_rate, bytes_per_sec; uint32_t sample_rate, bytes_per_sec;
f.read(reinterpret_cast<char*>(&audio_fmt), 2); f.read(reinterpret_cast<char*>(&audio_fmt), 2);
f.read(reinterpret_cast<char*>(&channels), 2); f.read(reinterpret_cast<char*>(&channels), 2);
f.read(reinterpret_cast<char*>(&sample_rate), 4); f.read(reinterpret_cast<char*>(&sample_rate), 4);
f.read(reinterpret_cast<char*>(&bytes_per_sec), 4); f.read(reinterpret_cast<char*>(&bytes_per_sec), 4);
f.read(reinterpret_cast<char*>(&block_align), 2); f.read(reinterpret_cast<char*>(&block_align), 2);
f.read(reinterpret_cast<char*>(&bits), 2); f.read(reinterpret_cast<char*>(&bits), 2);
if (chunk_size > 16) f.seekg(chunk_size - 16, std::ios::cur); if (chunk_size > 16) f.seekg(chunk_size - 16, std::ios::cur);
while (true) { while (true) {
char data_id[4]; char id[4];
f.read(data_id, 4); uint32_t dsize;
if (!f.good()) return -1; if (!f.read(id, 4) || !f.read(reinterpret_cast<char*>(&dsize), 4)) return -1;
if (memcmp(id, "data", 4) == 0) {
uint32_t data_size; size_t n = dsize / (bits / 8);
f.read(reinterpret_cast<char*>(&data_size), 4); out.resize(n);
if (!f.good()) return -1; std::vector<int16_t> raw(n);
f.read(reinterpret_cast<char*>(raw.data()), dsize);
if (data_id[0] == 'd' && data_id[1] == 'a' && data_id[2] == 't' && data_id[3] == 'a') { for (size_t i = 0; i < n; i++) out[i] = static_cast<float>(raw[i]) / 32768.0f;
int total = data_size / (bits / 8);
out.resize(total);
std::vector<int16_t> raw(total);
f.read(reinterpret_cast<char*>(raw.data()), data_size);
for (int i = 0; i < total; i++) {
out[i] = static_cast<float>(raw[i]) / 32768.0f;
}
return static_cast<float>(sample_rate); return static_cast<float>(sample_rate);
} else { } else {
f.seekg(data_size, std::ios::cur); f.seekg(dsize, std::ios::cur);
} }
} }
break;
} else { } else {
f.seekg(chunk_size, std::ios::cur); f.seekg(chunk_size, std::ios::cur);
} }
} }
return -1;
} }
static void write_wav24(const char* path, const float* data, int samples, int channels, int sample_rate) { static void write_wav24(const char* path, const float* data, size_t samples, int channels, int sample_rate) {
std::ofstream f(path, std::ios::binary); std::ofstream f(path, std::ios::binary);
int block_align = channels * 3;
int bits = 24; int data_size = static_cast<int>(samples) * channels * 3;
int block_align = channels * bits / 8;
int bytes_per_sec = sample_rate * block_align;
int data_size = samples * channels * 3;
f.write("RIFF", 4);
int file_size = 36 + data_size; int file_size = 36 + data_size;
f.write("RIFF", 4);
f.write(reinterpret_cast<const char*>(&file_size), 4); f.write(reinterpret_cast<const char*>(&file_size), 4);
f.write("WAVE", 4); f.write("WAVE", 4);
f.write("fmt ", 4); f.write("fmt ", 4);
int fmt_size = 16; int fmt_size = 16;
f.write(reinterpret_cast<const char*>(&fmt_size), 4); f.write(reinterpret_cast<const char*>(&fmt_size), 4);
@@ -93,45 +70,84 @@ static void write_wav24(const char* path, const float* data, int samples, int ch
f.write(reinterpret_cast<const char*>(&audio_fmt), 2); f.write(reinterpret_cast<const char*>(&audio_fmt), 2);
f.write(reinterpret_cast<const char*>(&channels), 2); f.write(reinterpret_cast<const char*>(&channels), 2);
f.write(reinterpret_cast<const char*>(&sample_rate), 4); f.write(reinterpret_cast<const char*>(&sample_rate), 4);
int bytes_per_sec = sample_rate * block_align;
f.write(reinterpret_cast<const char*>(&bytes_per_sec), 4); f.write(reinterpret_cast<const char*>(&bytes_per_sec), 4);
f.write(reinterpret_cast<const char*>(&block_align), 2); f.write(reinterpret_cast<const char*>(&block_align), 2);
int16_t bits = 24;
f.write(reinterpret_cast<const char*>(&bits), 2); f.write(reinterpret_cast<const char*>(&bits), 2);
f.write("data", 4); f.write("data", 4);
f.write(reinterpret_cast<const char*>(&data_size), 4); f.write(reinterpret_cast<const char*>(&data_size), 4);
for (size_t i = 0; i < samples * static_cast<size_t>(channels); i++) {
for (int i = 0; i < samples * channels; i++) {
float val = std::max(-1.0f, std::min(1.0f, data[i])); float val = std::max(-1.0f, std::min(1.0f, data[i]));
int32_t ival = static_cast<int32_t>(val * 8388607.0f); int32_t ival = static_cast<int32_t>(val * 8388607.0f);
unsigned char bytes[3]; unsigned char bytes[3] = { static_cast<unsigned char>(ival & 0xff),
bytes[0] = ival & 0xff; static_cast<unsigned char>((ival >> 8) & 0xff),
bytes[1] = (ival >> 8) & 0xff; static_cast<unsigned char>((ival >> 16) & 0xff) };
bytes[2] = (ival >> 16) & 0xff;
f.write(reinterpret_cast<const char*>(bytes), 3); f.write(reinterpret_cast<const char*>(bytes), 3);
} }
} }
// Parse `key=value` lines produced by handoff/rpp_allparams.py --flat.
static PluginParams parse_params_file(const char* path) {
PluginParams p;
std::ifstream f(path);
std::string line;
BandParams b[6];
while (std::getline(f, line)) {
auto eq = line.find('=');
if (eq == std::string::npos) continue;
std::string k = line.substr(0, eq);
double v = std::atof(line.c_str() + eq + 1);
if (k == "depth") p.depth = v;
else if (k == "mix") p.mix = v;
else if (k == "mode") p.mode = v;
else if (k == "attack") p.attack = v;
else if (k == "release") p.release = v;
else if (k == "selectivity") p.selectivity = v;
else if (k == "sharpness") p.sharpness = v;
else if (k == "resolution") p.resolution = v;
else if (k == "offline resolution") p.offline_resolution = v;
else if (k == "oversample") p.oversample = v;
else if (k == "offline oversample") p.offline_oversample = v;
else if (k == "stereo balance") p.stereo_balance = v;
else if (k == "stereo link") p.stereo_link = v;
else if (k == "stereo mode") p.stereo_mode = v;
else if (k == "bypass") p.bypass = v;
for (int i = 0; i < 6; i++) {
std::string pre = "band" + std::to_string(i) + " ";
if (k == pre + "freq") b[i].freq = v;
else if (k == pre + "q") b[i].q = v;
else if (k == pre + "sens") b[i].sens = v;
else if (k == pre + "mode") b[i].mode = v;
else if (k == pre + "on") b[i].on = v;
else if (k == pre + "balance") b[i].balance = v;
}
}
for (auto& bd : b) p.bands.push_back(bd);
return p;
}
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
if (argc < 3) { if (argc < 3) {
std::cerr << "Usage: " << argv[0] << " input.wav output.wav" << std::endl; std::cerr << "Usage: " << argv[0] << " input.wav output.wav [params.conf]\n";
return 1; return 1;
} }
PluginParams params;
if (argc > 3) params = parse_params_file(argv[3]);
else {
params.bands.push_back(BandParams{});
}
std::vector<float> input; std::vector<float> input;
float sr = read_wav16(argv[1], input); float sr = read_wav16(argv[1], input);
if (sr <= 0 || input.empty()) { if (sr <= 0 || input.empty()) {
std::cerr << "Failed to read input file" << std::endl; std::cerr << "Failed to read input file\n";
return 1; return 1;
} }
int channels = 2; // all etalon renders are 2ch
size_t total_samples = input.size(); size_t frames = input.size() / static_cast<size_t>(channels);
int channels = 2; // Trim guard: output length == input length (honest metric, B.14).
size_t frames = total_samples / channels; if (input.size() % channels != 0) frames = input.size() / channels;
std::vector<float> output(total_samples);
SpectralProcessor sp(2048, 512);
sp.setDetectorParams(10.0f, 10.0f, 0.864f);
std::vector<float> left_in(frames), right_in(frames); std::vector<float> left_in(frames), right_in(frames);
for (size_t i = 0; i < frames; i++) { for (size_t i = 0; i < frames; i++) {
@@ -139,20 +155,35 @@ int main(int argc, char* argv[]) {
right_in[i] = input[i * 2 + 1]; right_in[i] = input[i * 2 + 1];
} }
SpectralProcessor sp(2048, 512);
std::vector<DetectorBand> bands;
for (const auto& b : params.bands) {
if (b.on > 0.5f && b.freq > 1.0f) {
DetectorBand db;
db.fc = static_cast<float>(b.freq);
db.q = static_cast<float>(b.q > 0.0f ? b.q : 1.0f);
db.sens = static_cast<float>(b.sens);
bands.push_back(db);
}
}
if (bands.empty()) {
DetectorBand db{500.0f, 1.0f, 12.0f};
bands.push_back(db);
}
sp.setDetectorParams(bands);
std::vector<float> left(frames, 0.0f), right(frames, 0.0f); std::vector<float> left(frames, 0.0f), right(frames, 0.0f);
encode_ms(left_in.data(), right_in.data(), frames); encode_ms(left_in.data(), right_in.data(), frames);
sp.processBlock(left_in.data(), left.data(), frames, 1); sp.processBlock(left_in.data(), left.data(), frames, 1);
sp.processBlock(right_in.data(), right.data(), frames, 1); sp.processBlock(right_in.data(), right.data(), frames, 1);
decode_ms(left.data(), right.data(), frames); decode_ms(left.data(), right.data(), frames);
std::vector<float> output(frames * 2);
for (size_t i = 0; i < frames; i++) { for (size_t i = 0; i < frames; i++) {
output[i * 2] = left[i]; output[i * 2] = left[i];
output[i * 2 + 1] = right[i]; output[i * 2 + 1] = right[i];
} }
write_wav24(argv[2], output.data(), frames, channels, static_cast<int>(sr)); write_wav24(argv[2], output.data(), frames, channels, static_cast<int>(sr));
std::cout << "Done! frames=" << frames << " sr=" << sr << "\n";
std::cout << "Done!" << std::endl;
return 0; return 0;
} }
+102 -82
View File
@@ -24,7 +24,7 @@
#include <cstdint> #include <cstdint>
// Constants extracted from binary // Constants extracted from binary
static constexpr float SCALE = 0.0009775171056389809f; // 1/1024 (DAT_1824c3c54) static constexpr float SCALE = 0.0009775171056389809f; // 1/1023 (DAT_1824c3c54, verified 2026-08-19)
static constexpr float ONE = 1.0f; // DAT_1824c3ea4 static constexpr float ONE = 1.0f; // DAT_1824c3ea4
static constexpr float TWO = 2.0f; // DAT_1824c41e0 static constexpr float TWO = 2.0f; // DAT_1824c41e0
static constexpr float NEG1 = -1.0f; // DAT_1824c4680 static constexpr float NEG1 = -1.0f; // DAT_1824c4680
@@ -33,7 +33,10 @@ static constexpr float ZERO = 0.0f; // DAT_1824c4140
static constexpr float DEPTH_SCALE = 4.0f; // DAT_1824c4334 static constexpr float DEPTH_SCALE = 4.0f; // DAT_1824c4334
static constexpr float DB_CONV = 8.68588924407959f; // 20/ln(10) (DAT_1824c43e0) static constexpr float DB_CONV = 8.68588924407959f; // 20/ln(10) (DAT_1824c43e0)
static constexpr float FLOOR_DB = -6.907755374908447f; // ln(0.001) (DAT_1824c4704) static constexpr float FLOOR_DB = -6.907755374908447f; // ln(0.001) (DAT_1824c4704)
static constexpr float FLOOR LIN = 0.001f; // exp(FLOOR_DB) static constexpr float FLOOR_LIN = 0.001f; // exp(FLOOR_DB)
static constexpr double TWO_PI = 6.283185307179586; // DAT_1824c4248 (2π, twin-mask factory)
static constexpr float SCALE_1024 = 0.0009765625f; // 1/1024 (DAT_1824c3c50, band LUT apply)
static constexpr float CONST_5 = 5.0f; // DAT_1824c4230 (AudioProcessingModule ctor)
// PRNG state offsets from param_1 // PRNG state offsets from param_1
static constexpr int PRNG_STATE = 0x2404e0; static constexpr int PRNG_STATE = 0x2404e0;
@@ -51,108 +54,125 @@ struct BandConfig {
void* callback; // +0x50: vtable callback (if non-null, use callback) void* callback; // +0x50: vtable callback (if non-null, use callback)
}; };
// LUT evaluation for a single bin // Structural LUT curve (f_563440.dis, exact transcription 2026-08-19)
// x is in [0, 1] range // x in [0,1], gamma == band->threshold (offset +0x0c), A=+0x00, B=+0x04
static float eval_lut_bin(float x, const BandConfig* band) { static float eval_lut_bin(float x, const BandConfig* band) {
// Path 1: callback exists → use vtable float gamma = band->threshold;
if (band->callback != nullptr) { float result;
// TODO: transcribe callback vtable call if (band->flag == 0) {
return x; // Linear path (0x563595): t = x^(1/γ) if γ!=1 && x>0; val = A + (B-A)*t
} // decomp: fVar16 = expf(logf(x)/gamma) (FLOAT log/exp)
float t = x;
// Path 2: power-law (flag != 0 and threshold != 1.0) if (gamma != ONE && x > ZERO) {
if (band->flag != 0 && band->threshold != ONE) { t = expf(logf(x) / gamma);
float C = band->threshold;
// x = 2*x - 1 (center at zero: [-1, 1])
float centered = TWO * x - ONE;
if (C == ONE || centered == ZERO) {
// fall through to linear
} else {
// sign(x) * 10^(log10(|x|) / C)
float sign = (centered < ZERO) ? NEG1 : ONE;
// absolute value: |x|
float abs_x = fabsf(centered);
// if abs_x > 0: result = sign * exp(log(|x|) * (1/C))
if (abs_x > ZERO) {
float log_val = log10f(abs_x);
float result = powf(10.0f, log_val / C);
centered = sign * result;
}
// fall through to linear with transformed x
x = centered * HALF + HALF; // remap back to [0,1]
} }
result = band->A + (band->B - band->A) * t;
} else {
// Power-law path (0x5635cd): t = 2x-1; if γ!=1 && t!=0: t = sign(t)·|t|^(1/γ)
// val = A + (B-A)·0.5·(1+t); decomp: sign·expf(logf(|t|)/gamma)
float t = TWO * x - ONE;
if (gamma != ONE && t != ZERO) {
float sign = (t < ZERO) ? NEG1 : ONE;
t = expf(logf(fabsf(t)) / gamma) * sign;
}
result = band->A + (band->B - band->A) * HALF * (ONE + t);
} }
return result;
// Path 3: linear interpolation (always applied after transform)
float slope = band->B - band->A;
return slope * x + band->A;
} }
// FUN_180563440: LUT curve evaluation for 1024 bins // FUN_180563440: LUT curve evaluation for 0x400 bins
// r13 = context pointer (param_1) // r13 = context pointer (param_1). Loop counter edi, x = i*SCALE clamp[0,1],
// Reads: band config at r13+0x188 (one per band) // band config read from r13+0x188 each iteration (rbx), output double at r13+0x198[i*8].
// Writes: output at r13+0x198 (1024 doubles, stride 8) void lut_curve_eval(void* ctx) {
void lut_curve_eval(void* ctx, int bin_start, int bin_end) {
auto* base = static_cast<uint8_t*>(ctx); auto* base = static_cast<uint8_t*>(ctx);
int band_count = *reinterpret_cast<int*>(base + 0x540868);
if (band_count <= 0) {
// Initialize with default 0x800 bins
band_count = 0x800; // 2048? or 1024?
}
// Output pointer: r13+0x198
double* output = reinterpret_cast<double*>(base + 0x198); double* output = reinterpret_cast<double*>(base + 0x198);
BandConfig* band = reinterpret_cast<BandConfig*>(base + 0x188);
// Evaluate LUT curve for each bin (0x400 = 1024 iterations) for (int bin = 0; bin < 0x400; bin++) { // cmp $0x400 jl
for (int bin = 0; bin < 0x400; bin++) {
float x = static_cast<float>(bin) * SCALE; float x = static_cast<float>(bin) * SCALE;
x = fminf(fmaxf(x, ZERO), ONE); // clamp to [0, 1] x = fminf(x, ONE);
if (x < ZERO) x = ZERO;
BandConfig* band = reinterpret_cast<BandConfig*>(base + 0x188); output[bin] = static_cast<double>(eval_lut_bin(x, band));
float result = eval_lut_bin(x, band);
// Store as double-precision (line 196: cvtss2sd + movsd [rsi])
output[bin] = static_cast<double>(result);
} }
} }
// FUN_18056e3e0: twin-mask factory // FUN_18056e3e0: twin-mask factory
// Creates per-band mask by applying twin resonance to the LUT curve // DECODED (decomp_funs2.txt:7988 + f_56e3e0.dis): fills the 0x400-bin mask
// band_count = number of bands (max 6) // with a SINGLE scalar s = 2π / (count·SR), where
// N = 1024 (FFT size for LUT evaluation) // count = [ctx+0x240080] (int), SR = [ctx+0x24] (float, internal SR).
// Output stride: 0x2000 (8192 bytes = 1024 doubles) // NOT a per-bin twin resonance — a constant fill (the "twin" shape enters
// elsewhere via the LUT curve FUN_180563440). Output mask stride 0x2000/band.
void twin_mask_factory(void* ctx, int band_idx, int n_bins) { void twin_mask_factory(void* ctx, int band_idx, int n_bins) {
auto* base = static_cast<uint8_t*>(ctx); auto* base = static_cast<uint8_t*>(ctx);
// Calls twin evaluation for each bin int count = *reinterpret_cast<int*>(base + 0x240080);
// TODO: transcribe the full loop from disassembly float sr = *reinterpret_cast<float*>(base + 0x24);
// The factory applies the band's resonance shape to the LUT curve double s = TWO_PI / (static_cast<double>(count) * static_cast<double>(sr));
float* mask = reinterpret_cast<float*>(base + 0x4198 + band_idx * 0x2000);
for (int i = 0; i < 0x400; i++) {
mask[i] = static_cast<float>(s);
}
} }
// FUN_180563a60: band combine // FUN_180563a60: band LUT apply (level -> gain). DECODED (decomp_funs2.txt:8975 + f_563a60.dis).
// Combines 6 band masks into final per-bin gain // For each of 6 bands and 0x400 bins:
// Stereo: max 2 channels, output stride per band = 0x2000 // level_dB = 20·log10(mask[band][bin]) (logf · 8.6859)
// Pattern: gain = 1.0 - sum(band_masks) // level_axis[bin] = bin·(1/1024) (SCALE_1024)
void band_combine(void* ctx, int n_channels, int n_bins) { // t = clamp((dB A)/(B A), 0, 1) (BandConfig ctx+0x180: A,B,gamma,flag)
// if gamma == 1.0: val = t
// elif flag == 0 (linear): val = t^gamma (powf, NOT 1/gamma)
// else (power-law): val = 0.5·(1 + sign(2t1)·|2t1|^gamma)
// level_axis[bin+1] = val (pairs level, gain)
// NOTE: this is the INVERSE curve of FUN_180563440 (which uses x^(1/γ)).
void band_lut_apply(void* ctx) {
auto* base = static_cast<uint8_t*>(ctx); auto* base = static_cast<uint8_t*>(ctx);
int band_count = *reinterpret_cast<int*>(base + 0x540868); float* bandcfg = *reinterpret_cast<float**>(base + 0x180);
if (band_count > 6) band_count = 6; float A = bandcfg[0];
float B = bandcfg[1];
// Output accumulator at r13+0x2198 float gamma = bandcfg[3];
// Each band's mask is at r13+0x2198 + band_idx * 0x2000 float flag = bandcfg[4];
double* mask = reinterpret_cast<double*>(base + 0x4198);
for (int ch = 0; ch < n_channels; ch++) { for (int band = 0; band < 6; band++) {
// For each bin: sum all band contributions double* m = mask + band * 0x400;
// Then invert: gain = 1.0 - sum float* level_gain = *reinterpret_cast<float**>(base + 0xe0 + band * 0x18);
double* acc = reinterpret_cast<double*>(base + 0x2198 + ch * 0x2000); for (int bin = 0; bin < 0x400; bin++) {
for (int bin = 0; bin < n_bins; bin++) { float db = logf(static_cast<float>(m[bin])) * DB_CONV;
acc[bin] = ONE - acc[bin]; level_gain[bin * 2] = static_cast<float>(bin) * SCALE_1024;
float t = (db - A) / (B - A);
t = std::max(ZERO, std::min(ONE, t));
float val = t;
if (gamma != ONE) {
if (flag == ZERO) {
val = powf(t, gamma);
} else {
float u = TWO * t - ONE;
float sgn = (u < ZERO) ? NEG1 : ONE;
val = HALF * (ONE + sgn * powf(fabsf(u), gamma));
}
}
level_gain[bin * 2 + 1] = val;
} }
} }
} }
// ---- mask-accumulator combine kernels (FUN_180529fe0, CRT thunks) ----
// Signatures recovered from raw bytes in the rt snap (objdump of 0x180008d60/5a20/3c40).
//
// 0x8d60 combine3: out[i] = a[i] - b[i] (vsubpd, 3 pointers; dst is the 3rd arg)
// In the per-band loop: 0x5406f8[i] = 0x540678[i] - 0x5407c8[i]
void combine_sub(double* out, const double* a, const double* b, int n) {
for (int i = 0; i < n; i++) out[i] = a[i] - b[i];
}
// 0x5a20: dst[i] += src[i] (double; kernel 0x18001a5a0)
void acc_add(double* dst, const double* src, int n) {
for (int i = 0; i < n; i++) dst[i] += src[i];
}
// 0x3c40: dst[i] += a[i] * b[i] (double; vfmadd213pd)
void acc_fma(double* dst, const double* a, const double* b, int n) {
for (int i = 0; i < n; i++) dst[i] += a[i] * b[i];
}
// FUN_180529fe0: coefficient setup (from decomp_funs.txt) // FUN_180529fe0: coefficient setup (from decomp_funs.txt)
// Generates per-band coefficients via PRNG, applies depth scaling
// This is the vtable method for Soothe2Module
void coefficient_setup(void* ctx, int band_idx, int param3, int param4) { void coefficient_setup(void* ctx, int band_idx, int param3, int param4) {
auto* base = static_cast<uint8_t*>(ctx); auto* base = static_cast<uint8_t*>(ctx);
+18
View File
@@ -0,0 +1,18 @@
#pragma once
// Level-path transcriptions (decomp_funs2.txt + f_*.dis).
// All offsets are relative to the level-path object (NOT the DSP ctx).
// FUN_180563440: LUT curve build (x = i/1023, linear x^(1/gamma), power-law).
void lut_curve_eval(void* ctx);
// FUN_18056e3e0: twin-mask factory = constant fill 2π/(count·SR) over 0x400 bins.
void twin_mask_factory(void* ctx, int band_idx, int n_bins);
// FUN_180563a60: band LUT apply (level -> gain) t^gamma / power-law, 6 bands.
void band_lut_apply(void* ctx);
// mask-accumulator combine kernels (FUN_180529fe0 CRT thunks).
void combine_sub(double* out, const double* a, const double* b, int n); // 0x8d60
void acc_add(double* dst, const double* src, int n); // 0x5a20
void acc_fma(double* dst, const double* a, const double* b, int n); // 0x3c40
+68
View File
@@ -0,0 +1,68 @@
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdint>
#include <vector>
#include "levelpath.hpp"
int main() {
bool ok = true;
auto chk = [&](const char* n, double got, double exp, double tol) {
bool p = std::fabs(got - exp) < tol;
ok = ok && p;
std::printf(" %-28s got=%.6f exp=%.6f (%s)\n", n, got, exp, p ? "ok" : "MISMATCH");
};
// ---- twin_mask_factory (FUN_18056e3e0): fill 2π/(count·SR) ----
{
std::vector<uint8_t> b(0x241000, 0);
*reinterpret_cast<int*>(b.data() + 0x240080) = 1024;
*reinterpret_cast<float*>(b.data() + 0x24) = 48000.0f;
twin_mask_factory(b.data(), 0, 1024);
float expect = static_cast<float>(6.283185307179586 / (1024.0 * 48000.0));
float* mask = reinterpret_cast<float*>(b.data() + 0x4198);
chk("twin_mask_factory fill", mask[0], expect, 1e-9);
chk("twin_mask_factory uniform", mask[511], expect, 1e-9);
}
// ---- band_lut_apply (FUN_180563a60): t^gamma linear curve ----
{
std::vector<uint8_t> b(0x12000, 0);
float bandcfg[8] = {0.0f, 1.0f, 0.0f, 2.0f, 0.0f, 0, 0, 0}; // A=0,B=1,gamma=2,flag=0
*reinterpret_cast<float**>(b.data() + 0x180) = bandcfg;
std::vector<float> level_gain(0x800 * 6, 0.0f);
for (int band = 0; band < 6; band++) {
*reinterpret_cast<float**>(b.data() + 0xe0 + band * 0x18) = level_gain.data() + band * 0x800;
}
double* mask = reinterpret_cast<double*>(b.data() + 0x4198);
// mask[0] = 1.0 -> dB=0 -> t=(0-0)/(1-0)=0 -> val=0^2=0
// mask[1] = 0.3162277 (=-10dB) -> t=(-10-0)/1=-10 -> clamp 0 -> 0
// mask[2] = 1.0 -> 0
for (int i = 0; i < 0x400 * 6; i++) mask[i] = 1.0;
// one bin at dB = +0.5 (mask = 10^(0.5/20) = 1.059254) -> t = 0.5 -> 0.5^2 = 0.25
mask[0] = 1.0592537251772883; // +0.5 dB
band_lut_apply(b.data());
chk("band_lut_apply level_axis[0]", level_gain[0], 0.0f, 1e-6); // bin 0 * 1/1024
chk("band_lut_apply gain[0] t^gamma", level_gain[1], 0.25f, 1e-3); // 0.5^2
// bin at index 512: level = 512/1024 = 0.5
chk("band_lut_apply level_axis[512]", level_gain[1024], 0.5f, 1e-6);
}
// ---- combine kernels (0x8d60/0x5a20/0x3c40) ----
{
double out[4] = {0, 0, 0, 0};
double a[4] = {5, 2, -1, 8};
double b[4] = {3, 7, 4, 2};
combine_sub(out, a, b, 4);
chk("combine_sub[0] a-b", out[0], 2.0, 1e-12);
chk("combine_sub[2] a-b", out[2], -5.0, 1e-12);
acc_add(out, a, 4); // out = (a-b) + a
chk("acc_add[0]", out[0], 7.0, 1e-12); // (5-3)+5 = 7
acc_fma(out, b, a, 4); // out += b*a
// out[1] = (2-7)+2 = -3, then -3 + b[1]*a[1] = -3 + 7*2 = 11
chk("acc_fma[1]", out[1], 11.0, 1e-12);
}
std::printf(ok ? "ALL OK\n" : "FAILURES\n");
return ok ? 0 : 1;
}
+42
View File
@@ -0,0 +1,42 @@
#include "leveltrack.hpp"
namespace leveltrack {
void iir_first_order(float* x, const double* A, size_t n) {
double acc = 0.0;
for (size_t i = 0; i < n; i++) {
double y = static_cast<double>(x[i]) * A[i] + acc;
acc = y;
x[i] = static_cast<float>(y);
}
}
void iir_bidirectional(float* x, const double* A, size_t n) {
iir_first_order(x, A, n);
// reverse pass over reversed indices back into x (keep array order).
double acc = 0.0;
for (size_t k = n; k-- > 0;) {
double y = static_cast<double>(x[k]) * A[k] + acc;
acc = y;
x[k] = static_cast<float>(y);
}
}
void iir_first_order_unrolled4(float* x, const double* A, size_t n) {
double acc = 0.0;
size_t i = 0;
for (; i + 4 <= n;) {
for (int u = 0; u < 4; u++, i++) {
double y = static_cast<double>(x[i]) * A[i] + acc;
acc = y;
x[i] = static_cast<float>(y);
}
}
for (; i < n; i++) {
double y = static_cast<double>(x[i]) * A[i] + acc;
acc = y;
x[i] = static_cast<float>(y);
}
}
} // namespace leveltrack
+23
View File
@@ -0,0 +1,23 @@
#pragma once
#include <cstddef>
// Level-tracker UPDATE (structural transcription, NOTES_LEVEL 2026-08-19f).
// The plugin smooths the per-bin level mask with first-order "leaky-integrator"
// IIR stages (cumulative running-acc) in FUN_180529fe0. Three stages run in the
// real per-band loop; the coefficient arrays A[] are runtime values (from the
// level sidechain / smoothing-param builder). This module provides the exact
// scalar and vectorized forms as pure functions; callers supply A[].
namespace leveltrack {
// Scalar first-order stage: acc=0; y[i]=x[i]*A[i]+acc; acc=y; x[i]=y
// Mirrors consumers_out.txt scalar loop. In-place on x.
void iir_first_order(float* x, const double* A, size_t n);
// Bidirectional stage: forward then reverse pass over x with same A.
void iir_bidirectional(float* x, const double* A, size_t n);
// Vectorized-wide variant handling 4 elements per iteration (like the plugin's
// unrolled loop). Same math, provided for parity tests.
void iir_first_order_unrolled4(float* x, const double* A, size_t n);
} // namespace leveltrack
+40
View File
@@ -0,0 +1,40 @@
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include "leveltrack.hpp"
#include "leveltrack_data.hpp"
int main() {
const size_t n = 37; // odd size to exercise the unrolled tail.
std::vector<double> A(n);
std::vector<float> x1(n), x2(n);
for (size_t i = 0; i < n; i++) {
A[i] = 0.05 + 0.9 * double(1 + i % 3) / 3.0; // nontrivial profile
x1[i] = static_cast<float>(0.5 * std::sin(0.3 * i) * (1 + i * 0.01));
}
std::memcpy(x2.data(), x1.data(), n * sizeof(float));
leveltrack::iir_first_order(x1.data(), A.data(), n);
leveltrack::iir_first_order_unrolled4(x2.data(), A.data(), n);
double maxd = 0.0;
for (size_t i = 0; i < n; i++) maxd = std::fmax(maxd, std::fabs(x1[i] - x2[i]));
std::printf("scalar vs unrolled4 max|dx| = %.3e (%s)\n",
maxd, maxd < 1e-6 ? "OK" : "MISMATCH");
// bidirectional: equals applying forward then reverse.
std::vector<float> rx(n);
leveltrack::iir_bidirectional(rx.data(), A.data(), n);
std::printf("leveltrack integration check done (n=%zu)\n", n);
// P1.5 live-capture data sanity (render_long.rpp: attack=0 release=0).
std::printf("live ltk: SR=%.0f nbins=%zu A_ATTACK[1]=%.4f A_ATTACK[319]=%.4f "
"A_RELEASE[1]=%.6f scalar870=%.2f scalar884=%.2f scalar888=%.2f\n",
(double)ltk::CTX_INTERNAL_SR, ltk::LEVEL_NBINS,
ltk::A_ATTACK[1], ltk::A_ATTACK[319],
ltk::A_RELEASE[1], (double)ltk::SCALAR0X40870,
(double)ltk::SCALAR0X40884, (double)ltk::SCALAR0X40888);
return maxd < 1e-6 ? 0 : 1;
}
+149
View File
@@ -0,0 +1,149 @@
// AUTOGENERATED from P1.5 realtime capture handoff/rtctx_live.json
// (render_long.rpp: attack=0 release=0 selectivity=10 sharpness=10 depth=0.864).
// Regenerate with handoff/emit_leveltrack.py. Do not edit by hand.
#pragma once
#include <cstddef>
namespace ltk {
// ctx = 0x2370040, marker +0x24 == 48000.0f (internal SR).
constexpr float CTX_INTERNAL_SR = 48000.0f;
// mask scalars (float) captured live:
constexpr float SCALAR0X40870 = 440.9548645019531f;
constexpr float SCALAR0X40874 = 1.0f;
constexpr float SCALAR0X40878 = 1.0f;
constexpr float SCALAR0X4087C = 1.0f;
constexpr float SCALAR0X40880 = 25.000001907348633f;
constexpr float SCALAR0X40884 = 10.0f;
constexpr float SCALAR0X40888 = 1.0f;
constexpr float SCALAR0X4088C = 1.0f;
constexpr float SCALAR0X40890 = 0.0f;
constexpr float SCALAR0X40894 = 1200.0001220703125f;
constexpr float SCALAR0X408AC = 9.183549615799121e-41f;
constexpr size_t LEVEL_NBINS = 341;
// per-bin level-tracker IIR attack coefficients (0x4c0528):
const double A_ATTACK[341] = {
0, 0.34005138278007507, 0.3483593761920929, 0.35649341344833374, 0.3644568920135498, 0.37225314974784851,
0.37988573312759399, 0.38735818862915039, 0.39467430114746094, 0.40183743834495544, 0.40885132551193237, 0.41571962833404541,
0.4224458634853363, 0.42903351783752441, 0.43548604846000671, 0.44180700182914734, 0.44799956679344177, 0.45406708121299744,
0.46001288294792175, 0.46583998203277588, 0.47155144810676575, 0.47715029120445251, 0.48263949155807495, 0.48802188038825989,
0.49330011010169983, 0.49847698211669922, 0.50355511903762817, 0.50853699445724487, 0.51342517137527466, 0.51822203397750854,
0.52292978763580322, 0.52755081653594971, 0.53208738565444946, 0.53654158115386963, 0.54091531038284302, 0.54521089792251587,
0.54942995309829712, 0.55357468128204346, 0.55764675140380859, 0.56164795160293579, 0.56558007001876831, 0.56944471597671509,
0.57324361801147461, 0.57697826623916626, 0.58065032958984375, 0.58426117897033691, 0.58781230449676514, 0.59130507707595825,
0.59474086761474609, 0.59812110662460327, 0.60144698619842529, 0.60471975803375244, 0.60794061422348022, 0.61111080646514893,
0.6142314076423645, 0.61730360984802246, 0.62032842636108398, 0.6233069896697998, 0.62624025344848633, 0.62912911176681519,
0.63197475671768188, 0.63477796316146851, 0.63753974437713623, 0.64026087522506714, 0.64294230937957764, 0.64558488130569458,
0.64818942546844482, 0.65075665712356567, 0.65328741073608398, 0.65578234195709229, 0.65824240446090698, 0.66066807508468628,
0.66306018829345703, 0.66541939973831177, 0.66774630546569824, 0.67004162073135376, 0.67230594158172607, 0.67453992366790771,
0.67674410343170166, 0.67891907691955566, 0.68106538057327271, 0.68318367004394531, 0.68527436256408691, 0.68733805418014526,
0.68937522172927856, 0.69138640165328979, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274, 0.69213396310806274,
};
// per-bin level-tracker IIR release coefficients (0x3c0510 == 0x2c04f8):
const double A_RELEASE[341] = {
0, 0.00075329304672777653, 0.00088481028797104955, 0.0010319935390725732, 0.0011957522947341204, 0.0013769635697826743,
0.0015764719573780894, 0.0017950870096683502, 0.0020335691515356302, 0.0022926407400518656, 0.002572979312390089, 0.002875214209780097,
0.0031999291386455297, 0.003547657048329711, 0.0039188801310956478, 0.0043140365742146969, 0.0047335159033536911, 0.005177660845220089,
0.0056467670947313309, 0.0061410837806761265, 0.0066608106717467308, 0.0072061149403452873, 0.0077771246433258057, 0.0083739152178168297,
0.0089965220540761948, 0.0096449656412005424, 0.010319218970835209, 0.011019209399819374, 0.01174485869705677, 0.012496041133999825,
0.013272601179778576, 0.01407436840236187, 0.014901150017976761, 0.015752725303173065, 0.016628840938210487, 0.017529245465993881,
0.018453648313879967, 0.019401764497160912, 0.020373275503516197, 0.021367868408560753, 0.022385178133845329, 0.023424861952662468,
0.024486592039465904, 0.025569943711161613, 0.026674600318074226, 0.027800126001238823, 0.028946168720722198, 0.030112311244010925,
0.031298160552978516, 0.032503306865692139, 0.033727359026670456, 0.034969881176948547, 0.036230511963367462, 0.037508808076381683,
0.038804333657026291, 0.040116727352142334, 0.041445545852184296, 0.042790420353412628, 0.044150922447443008, 0.045526620000600815,
0.046917147934436798, 0.048322096467018127, 0.049741055816411972, 0.051173664629459381, 0.052619524300098419, 0.054078217595815659,
0.055549412965774536, 0.057032708078622818, 0.05852774903178215, 0.060034122318029404, 0.061551533639431, 0.063079580664634705,
0.064617909491062164, 0.066166229546070099, 0.067724093794822693, 0.069291271269321442, 0.070867374539375305, 0.072452105581760406,
0.074045136570930481, 0.07564612478017807, 0.077254779636859894, 0.078870825469493866, 0.080493956804275513, 0.082123853266239166,
0.08376021683216095, 0.085402816534042358, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808, 0.086020313203334808,
};
} // namespace ltk
+48
View File
@@ -0,0 +1,48 @@
#include "log2_ln.hpp"
#include <cstring>
#include <cmath>
namespace soothe2 {
float ln_plugin_f32(float x) {
if (x <= 0.0f) return -INFINITY;
uint32_t bits;
std::memcpy(&bits, &x, sizeof(uint32_t));
int exp = int((bits >> 23) & 0xFF);
uint32_t mantissa = bits & 0x7FFFFFu;
if (exp == 0) return -INFINITY;
float x_norm = mantissa * (1.0f / 8388608.0f);
constexpr float c0_a = -0.1517720520f;
constexpr float c0_b = 0.1696488112f;
constexpr float c1 = -0.1646245718f;
constexpr float c2 = 0.1982250363f;
constexpr float c3 = -0.2500466406f;
constexpr float c4 = 0.3333656490f;
constexpr float c5 = -0.5000000000f;
constexpr float ln2 = 0.6931471825f;
constexpr float c0_init = c0_a * c0_b;
float y = c0_init + x_norm;
y = y * x_norm + c1;
y = y * x_norm + c2;
y = y * x_norm + c3;
y = y * x_norm + c4;
y = y * x_norm + c5;
float ln_m = x_norm + x_norm * x_norm * y;
return ln2 * float(exp - 127) + ln_m;
}
void ln_plugin_f32_arr(const float* in, float* out, size_t n) {
for (size_t i = 0; i < n; ++i) {
out[i] = ln_plugin_f32(in[i]);
}
}
} // namespace soothe2
+17
View File
@@ -0,0 +1,17 @@
#pragma once
#include <cstdint>
#include <cmath>
#include <cstring>
namespace soothe2 {
// Plugin's exact ln(float) from 0x1802a24c0 (535a70 FFT-conv engine)
// Computes natural logarithm via mantissa polynomial + exponent scaling
// Coefficients extracted from binary at 0x181f81f80..0x181f821c0
// Max error ~3e-6 for typical inputs (x in [1, 1.34))
float ln_plugin_f32(float x);
// Vectorized version for arrays
void ln_plugin_f32_arr(const float* in, float* out, size_t n);
} // namespace soothe2
+38
View File
@@ -0,0 +1,38 @@
#pragma once
// Plugin parameters decoded from RPP <SOOTHE2STATE> XML (see handoff/rpp_allparams.py).
#include <string>
#include <vector>
#include <cmath>
struct BandParams {
double balance = 0.5;
double freq = 678.7611083984375;
double mode = 1.0;
double on = 0.0;
double q = 0.9999978542327881;
double sens = 12.0;
};
struct PluginParams {
double attack = 0.0;
double delta = 0.0;
double depth = 0.8639736175537109;
double mix = 100.0;
double mode = 1.0;
double oversample = 0.0;
double offline_oversample = 3.0;
double offline_resolution = 4.0;
double release = 0.0;
double resolution = 1.0;
double selectivity = 10.0;
double sharpness = 10.0;
double bypass = 0.0;
double input_trim = 0.0;
double trim = 0.0;
double sidechain = 0.0;
double sidechain_solo_on = 0.0;
double stereo_balance = 0.2840004563331604;
double stereo_link = 100.0;
double stereo_mode = 1.0;
std::vector<BandParams> bands; // up to 6
};
+238
View File
@@ -0,0 +1,238 @@
// render48k.cpp — 48000/N=4096 internal-grid stereo renderer
//
// Host audio is 44100; the plugin detector runs internally at 48000/N=4096 (the
// live IIR/warp/freq-axis tables are sized for that grid). This tool mirrors that:
// 1. read input WAV (44100 host samples, stereo or mono)
// 2. resample 44100 -> 48000 (libsamplerate, SINC best)
// 3. Process L and R channels (stereo link=100%: same processing for both)
// 4. Apply balance: scale reduction for R channel
// 5. Apply mix: wet-dry mix
// 6. resample 48000 -> 44100
// 7. write 24-bit output WAV (stereo)
//
// Usage:
// render48k <in.wav> <out.wav> fc,q,sens[,scale] ...
// Env:
// RT_STEREO_LINK=1.0 (1.0 = sum channels for analysis, 0.0 = dual mono)
// RT_STEREO_BALANCE=0.284 (R channel reduction scale, 1.0 = equal, <1.0 = less on R)
// RT_DEPTH=0.864 (sens multiplier)
// RT_MIX=1.0 (0=dry, 1=full wet)
#include "spectral.hpp"
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <cstring>
#include <samplerate.h>
static int g_in_ch = 1;
static bool load_wav_stereo(const char* path, std::vector<float>& out, int& sr, int& channels) {
FILE* f = fopen(path, "rb");
if (!f) return false;
char hdr[44];
if (fread(hdr, 1, 44, f) != 44) return false;
sr = *(int*)(hdr + 24);
int ch = *(short*)(hdr + 22);
int bits = *(short*)(hdr + 34);
int data = 0;
int64_t pos = 12;
fseek(f, 12, SEEK_SET);
while (pos < 32 * 1024 * 1024) {
char cid[4]; int csize;
if (fread(cid, 1, 4, f) < 4 || fread(&csize, 4, 1, f) < 1) break;
pos += 8;
if (memcmp(cid, "data", 4) == 0) { data = csize; break; }
pos += csize;
int skip = csize;
if (csize % 2) skip++;
fseek(f, skip, SEEK_CUR);
}
if (!data) { fclose(f); return false; }
int n = data / (ch * (bits / 8));
g_in_ch = ch;
channels = 2;
out.resize(n * 2);
if (bits == 16) {
std::vector<short> raw(n * ch);
fread(raw.data(), 2, n * ch, f);
for (int i = 0; i < n; i++) {
float v = 0.0f;
if (ch == 1) {
v = raw[i] / 32768.0f;
out[2*i] = v; out[2*i+1] = v;
} else {
out[2*i] = raw[2*i] / 32768.0f;
out[2*i+1] = raw[2*i+1] / 32768.0f;
}
}
} else if (bits == 24) {
std::vector<unsigned char> raw(n * ch * 3);
fread(raw.data(), 1, n * ch * 3, f);
for (int i = 0; i < n; i++) {
auto read24 = [&](int idx) -> float {
int32_t s = (raw[idx] | (raw[idx+1] << 8) | (raw[idx+2] << 16));
if (s & 0x800000) s |= 0xFF000000;
return s / 8388608.0f;
};
if (ch == 1) {
float v = read24(i * 3);
out[2*i] = v; out[2*i+1] = v;
} else {
out[2*i] = read24(2*i * 3);
out[2*i+1] = read24((2*i+1) * 3);
}
}
} else return false;
fclose(f);
return true;
}
static bool save_wav24_stereo(const char* path, const std::vector<float>& L, const std::vector<float>& R, int sr) {
FILE* f = fopen(path, "wb");
if (!f) return false;
int ch = 2, bits = 24;
size_t n = std::min(L.size(), R.size());
int data = (int)(n * ch * (bits / 8));
char hdr[44]; memset(hdr, 0, 44);
memcpy(hdr, "RIFF", 4); *(int*)(hdr + 4) = 36 + data;
memcpy(hdr + 8, "WAVE", 4); memcpy(hdr + 12, "fmt ", 4);
*(int*)(hdr + 16) = 16; *(short*)(hdr + 20) = 1; *(short*)(hdr + 22) = (short)ch;
*(int*)(hdr + 24) = sr; *(int*)(hdr + 28) = sr * ch * (bits / 8);
*(short*)(hdr + 32) = (short)ch; *(short*)(hdr + 34) = (short)bits;
memcpy(hdr + 36, "data", 4); *(int*)(hdr + 40) = data;
fwrite(hdr, 1, 44, f);
for (size_t i = 0; i < n; i++) {
int32_t vl = (int32_t)(std::max(-1.0f, std::min(1.0f, L[i])) * 8388607.0f);
int32_t vr = (int32_t)(std::max(-1.0f, std::min(1.0f, R[i])) * 8388607.0f);
unsigned char b0 = vl & 0xFF, b1 = (vl >> 8) & 0xFF, b2 = (vl >> 16) & 0xFF;
fwrite(&b0, 1, 1, f); fwrite(&b1, 1, 1, f); fwrite(&b2, 1, 1, f);
b0 = vr & 0xFF; b1 = (vr >> 8) & 0xFF; b2 = (vr >> 16) & 0xFF;
fwrite(&b0, 1, 1, f); fwrite(&b1, 1, 1, f); fwrite(&b2, 1, 1, f);
}
fclose(f);
return true;
}
static std::vector<float> resample_mono(const std::vector<float>& in, int src_sr, int dst_sr) {
double frac = (double)dst_sr / src_sr;
int out_len = (int)(in.size() * frac) + 16;
std::vector<float> buf(out_len);
SRC_DATA sd;
sd.data_in = in.data(); sd.input_frames = (long)in.size();
sd.data_out = buf.data(); sd.output_frames = out_len;
sd.src_ratio = frac; sd.end_of_input = 1;
int err = src_simple(&sd, SRC_SINC_BEST_QUALITY, 1);
if (err != 0) { fprintf(stderr, "resample err %d\n", err); return {}; }
buf.resize(sd.output_frames_gen);
return buf;
}
static std::vector<float> resample_stereo(const std::vector<float>& in, int src_sr, int dst_sr) {
size_t n = in.size() / 2;
double frac = (double)dst_sr / src_sr;
int out_len = (int)(n * frac) + 16;
std::vector<float> buf(out_len * 2);
SRC_DATA sd;
sd.data_in = in.data(); sd.input_frames = (long)n;
sd.data_out = buf.data(); sd.output_frames = out_len;
sd.src_ratio = frac; sd.end_of_input = 1;
int err = src_simple(&sd, SRC_SINC_BEST_QUALITY, 2);
if (err != 0) { fprintf(stderr, "resample err %d\n", err); return {}; }
buf.resize(sd.output_frames_gen * 2);
return buf;
}
int main(int argc, char** argv) {
if (argc < 3) {
fprintf(stderr, "usage: %s in.wav out.wav fc,q,sens[,scale] ...\n", argv[0]);
return 1;
}
std::vector<float> x; int sr, channels;
if (!load_wav_stereo(argv[1], x, sr, channels)) { fprintf(stderr, "cannot load %s\n", argv[1]); return 1; }
// Parse stereo parameters from env
float stereo_link = getenv("RT_STEREO_LINK") ? atof(getenv("RT_STEREO_LINK")) : 1.0f;
float stereo_balance = getenv("RT_STEREO_BALANCE") ? atof(getenv("RT_STEREO_BALANCE")) : 0.284f;
float depth = getenv("RT_DEPTH") ? atof(getenv("RT_DEPTH")) : 1.0f;
float mix = getenv("RT_MIX") ? atof(getenv("RT_MIX")) : 1.0f;
// Parse bands
std::vector<DetectorBand> bands;
for (int i = 3; i < argc; i++) {
if (!strchr(argv[i], ',')) continue;
float fc, q, sens, scl = 1.0f;
if (sscanf(argv[i], "%f,%f,%f,%f", &fc, &q, &sens, &scl) < 3) continue;
DetectorBand b; b.fc = fc; b.q = q; b.sens = sens * depth; b.level_scale = scl;
bands.push_back(b);
}
if (bands.empty()) bands.push_back({1000.0f, 1.0f, 12.0f * depth});
auto x48 = resample_stereo(x, sr, 48000);
if (x48.empty()) return 1;
size_t n = x48.size() / 2;
// Stereo processing per soothe2 manual:
// "With the stereo link at 100%, Soothe will sum the channels for analysis
// and apply the same processing to both channels."
// Use separate processors for L and R to avoid stateful interference.
SpectralProcessor procL(4096, 1024, 48000.0f);
SpectralProcessor procR(4096, 1024, 48000.0f);
procL.setDetectorParams(bands);
procR.setDetectorParams(bands);
std::vector<float> L_out(n), R_out(n);
const size_t BLK = 1 << 16;
std::vector<float> inb(BLK), outb(BLK);
// Process L channel
for (size_t s = 0; s < n; s += BLK) {
size_t blk = std::min(BLK, n - s);
memcpy(inb.data(), x48.data() + 2*s, blk * sizeof(float));
for (size_t i = blk; i < BLK; i++) inb[i] = 0.0f;
procL.processBlock(inb.data(), outb.data(), BLK, 1);
for (size_t i = 0; i < blk; i++) L_out[s+i] = outb[i];
}
// Process R channel
for (size_t s = 0; s < n; s += BLK) {
size_t blk = std::min(BLK, n - s);
memcpy(inb.data(), x48.data() + 2*s + 1, blk * sizeof(float));
for (size_t i = blk; i < BLK; i++) inb[i] = 0.0f;
procR.processBlock(inb.data(), outb.data(), BLK, 1);
for (size_t i = 0; i < blk; i++) R_out[s+i] = outb[i];
}
// Apply balance and mix
std::vector<float> L_final(n), R_final(n);
for (size_t i = 0; i < n; i++) {
float L = x48[2*i];
float R = x48[2*i+1];
float L_proc = L_out[i];
float R_proc = R_out[i];
float mask_L = (std::abs(L) > 1e-12f) ? L_proc / L : 1.0f;
float mask_R = (std::abs(R) > 1e-12f) ? R_proc / R : 1.0f;
// Apply balance: scale reduction for R channel
float mask_R_bal = 1.0f - (1.0f - mask_R) * stereo_balance;
// Apply mix
L_final[i] = L * (1.0f - mix) + L * mask_L * mix;
R_final[i] = R * (1.0f - mix) + R * mask_R_bal * mix;
}
auto L44 = resample_mono(L_final, 48000, 44100);
auto R44 = resample_mono(R_final, 48000, 44100);
size_t out_len = std::min(L44.size(), R44.size());
out_len = std::min(out_len, x.size() / std::max(channels, 1));
L44.resize(out_len);
R44.resize(out_len);
save_wav24_stereo(argv[2], L44, R44, 44100);
printf("render48k: %zu hostsamps ch=%d -> %zu (48k) -> %zu (out), balance=%.3f depth=%.3f\n",
x.size(), channels, x48.size(), out_len, stereo_balance, depth);
return 0;
}
+134
View File
@@ -0,0 +1,134 @@
#pragma once
// Bit-exact transcription of the sincospi "rotor" kernel 0x180184900 (fast path),
// per-element scalar form, mirroring the exact VEX/FMA op order of big_184900.dis
// (main loop 0x180184a80-0x1801850d4 / masked tail 0x180185160-0x18018530c).
//
// Per input float x the kernel emits two floats:
// bufA[i] = sin(x) (buf1=rdx/arg at kernel entry)
// bufB[i] = cos(x) (buf2=r8 /arg)
// (verified: tail loop stores sin->[r11+rbx]=bufA via ymm5, cos->[r11+r12]=bufB via ymm2;
// main loop stores the 4 lane-group results ymm{7,6,4,1}->bufA, ymm{8,5,3,2}->bufB).
//
// The 8-lane AVX body interleaves four independent groups; all ops are per-lane
// (no cross-lane shuffle), so the scalar loop below reproduces each element exactly.
//
// The slow path (0x180186086, entered when any lane |x| >= 10000 or non-finite) and the
// inf/nan guard helper 0x180189d60 are NOT reproduced: for audio |x| <= 1 they never run.
// Contract: inputs must satisfy |x| < 10000 (checked in rotor_sincos via nan guard).
#include <cstdint>
#include <cstring>
#include <cmath>
namespace detkernel {
// exact fused multiply-add with a single rounding (no re-contraction by the compiler)
static inline float fma_f(float a, float b, float c) {
return __builtin_fmaf(a, b, c);
}
static inline uint32_t bit_cast_u32(float f) {
uint32_t u;
std::memcpy(&u, &f, sizeof(u));
return u;
}
static inline float bit_cast_f(uint32_t u) {
float f;
std::memcpy(&f, &u, sizeof(f));
return f;
}
// magic-rounding trick constants (from tables 0x181d1b3x0 / 0x181d1b0c0-0x181d1b300)
static constexpr uint32_t C_ABS_MASK = 0x7fffffffu; // 0x181d1ad40
static constexpr float C_INV_PI = 0.318309873f; // 0x181d1b340 4b400000? no: 3ea2f983
static constexpr float C_MAGIC = 12582912.0f; // 0x181d1b380 0x4b400000
static constexpr float C_PI_HI = 3.141592741f; // 0x181d1b0c0 0x40490fdb
static constexpr float C_PI_LO = -8.742277658e-08f; // 0x181d1b100 0xb3bbbd2e
static constexpr float C_RED_CORR = -3.430249024e-15f; // 0x181d1b140 0xa7772ced (C0)
static constexpr float C_SIN_1 = 0.00833306462f; // 0x181d1b280 0x3c088768 (C1)
static constexpr float C_SIN_2 = -1.980916067e-04f; // 0x181d1b2c0 0xb94fb6cf (C2)
static constexpr float C_SIN_3 = 2.604164590e-06f; // 0x181d1b300 0x362ec335 (C3)
static constexpr float C_SIN_N6 = -0.166666612f; // 0x181d1b180 0xbe2aaaa7
static constexpr uint32_t C_HALF_BITS = 0x3f000000u; // 0.5f 0x181d1b400
static constexpr float C_ONE = 1.0f; // 0x181d1b440
static constexpr float C_NOISE = 10000.0f; // 0x181d1ad80 (slow-path threshold)
static constexpr float C_MASK_DEF = 0.75f; // 0x181d1c280 (filled default lanes)
// rotor_sincos(x, &sin, &cos) per 0x180184900 (elementwise, exact op order)
static inline void rotor_sincos(float x, float& s, float& c) {
uint32_t ux;
std::memcpy(&ux, &x, sizeof(ux));
// vmovups/ymm load + vandps abs mask + vfmadd231ps
uint32_t ua = ux & C_ABS_MASK;
float a;
std::memcpy(&a, &ua, sizeof(a));
float t = fma_f(a, C_INV_PI, C_MAGIC); // t = magic + a*(1/pi)
float k = t - C_MAGIC; // vsubps k = t - magic
uint32_t tk;
std::memcpy(&tk, &t, sizeof(tk));
uint32_t sbt = tk & 1u; // vpslld t,31 -> bit0 (parity/round)
float p = fma_f(-C_PI_HI, k, a); // vfnmadd231 p = a - pi_hi*k
p = fma_f(-C_PI_LO, k, p); // p -= pi_lo*k
uint32_t up;
std::memcpy(&up, &p, sizeof(up));
uint32_t sbp = up & 0x80000000u; // vandps -0.0 -> sign bit of p
uint32_t halfbits = sbp ^ C_HALF_BITS; // vxorps (-0.0&p) ^ 0.5 -> +-0.5
float h;
std::memcpy(&h, &halfbits, sizeof(h));
float q = k + h; // vaddps q = k +- 0.5
// vfnmadd213ps dest,src1,src2 = -(dest*src1) + src2
float cc = fma_f(C_RED_CORR, -k, p); // cc = p - C0*k (sin arg core)
float rq = fma_f(-C_PI_HI, q, a); // rq = a - pi_hi*q
rq = fma_f(-C_PI_LO, q, rq);
float cq = fma_f(C_RED_CORR, -q, rq); // cq = rq - C0*q (cos arg core)
uint32_t sbth = sbt ? 0x80000000u : 0u; // vpslld fully left -> 0x80000000/0
uint32_t us1 = bit_cast_u32(cc) ^ sbth; // arg_sin = cc ^ sbt
// vxorps(-0.0,sbp)=0x80000000^sbp, then ^sbt -> arg_cos = cq ^ sbt ^ sbp ^ 0x80000000
uint32_t us2 = bit_cast_u32(cq) ^ sbth ^ sbp ^ 0x80000000u;
float sarg = bit_cast_f(us1);
float qarg = bit_cast_f(us2);
float ss = sarg * sarg; // vmulps
float qs = qarg * qarg;
float as = fma_f(C_SIN_3, ss, C_SIN_2); // Horner (vfmadd231 then vfmadd213 chain)
float aq = fma_f(C_SIN_3, qs, C_SIN_2);
as = fma_f(as, ss, C_SIN_1);
aq = fma_f(aq, qs, C_SIN_1);
as = fma_f(as, ss, C_SIN_N6);
aq = fma_f(aq, qs, C_SIN_N6);
float os = ss * as; // vmulps
float oq = qs * aq;
float sins = fma_f(os, sarg, sarg); // vfmadd213 sin = os*sarg + sarg
float sinq = fma_f(oq, qarg, qarg);
uint32_t usrc = ux & 0x80000000u; // vandnps ~abs & src -> sign bit of src
s = bit_cast_f(bit_cast_u32(sins) ^ usrc); // vxorps sin ^ sign(src)
bool zero = (ux == 0u) || (ux == 0x80000000u); // vcmpeqps src == signbit(src)
c = zero ? C_ONE : sinq; // vblendvps -> 1.0 for zero lanes
}
// 8-lane rotor; mirrors the AVX main loop over 32-float chunks implicitly (loop of 8)
// and supports the masked tail (partial) via `count`. When count < pushed, the masked
// lanes of the group are handled by the caller with bait; here we simply clamp.
static inline void rotor_batch(const float* src, float* sin_out, float* cos_out, size_t n) {
for (size_t i = 0; i < n; ++i) {
float si, co;
rotor_sincos(src[i], si, co);
sin_out[i] = si;
cos_out[i] = co;
}
}
} // namespace detkernel
+14
View File
@@ -0,0 +1,14 @@
#pragma once
// DIVIDE 1803a06a0 tables from .rdata RVA 0x21269c0/0x2126a00 poly 0.207
// BLOCKMAP:580 vpermps+poly 1c dump
// extracted via PE .rdata .rdata VA 0x1baa000 raw 0x1ba8400
#include <array>
namespace rt_div {
constexpr std::array<float,32> tbl_1269c0 = {
127.0f,126.830078f,126.67807f,126.540558f,126.415039f,126.299561f,126.192642f,126.093109f,127.0f,126.830078f,126.67807f,126.540558f,126.415039f,126.299561f,126.192642f,126.093109f,0.0f,-3.12644238e-06f,1.8367532e-06f,1.05200343e-05f,-1.56322119e-06f,-2.65016098e-07f,2.86602835e-06f,2.73532123e-07f,0.0f,-3.12644238e-06f,1.8367532e-06f,1.05200343e-05f,-1.56322119e-06f,-2.65016098e-07f,2.86602835e-06f,2.73532123e-07f};
constexpr std::array<float,32> tbl_126a00 = {
0.0f,-3.12644238e-06f,1.8367532e-06f,1.05200343e-05f,-1.56322119e-06f,-2.65016098e-07f,2.86602835e-06f,2.73532123e-07f,0.0f,-3.12644238e-06f,1.8367532e-06f,1.05200343e-05f,-1.56322119e-06f,-2.65016098e-07f,2.86602835e-06f,2.73532123e-07f,0.20751521f,0.20751521f,0.20751521f,0.20751521f,0.20751521f,0.20751521f,0.20751521f,0.20751521f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f};
constexpr std::array<float,9> poly_0 = {
0.20751521f,-0.24168693f,0.28853500f,-0.36067134f,0.48089835f,0.24026407f,0.05551192f,0.69314718f,1.92590424e-08f};
}
File diff suppressed because it is too large Load Diff
+14
View File
@@ -0,0 +1,14 @@
// rt_mask_tables.hpp — runtime mask-apply tables captured from live snapshot
// (snap_rt.bin, ctx 0x2370040, SR=48000/N=4096). Bit-exact mask chain (FUN_180529fe0).
// IIR stage: y = A[i]*acc + B[i]*x (first-order leaky, B = 1 - A).
#pragma once
extern const double kIIR_A1[];
extern const double kIIR_B1[];
extern const double kIIR_A2[];
extern const double kIIR_B2[];
extern const double kIIR_A3[];
extern const double kIIR_B3[];
extern const float kWarp[];
extern const float kBand768[];
extern const float kPRNGLut[];
File diff suppressed because one or more lines are too long
+5
View File
@@ -0,0 +1,5 @@
// Auto-generated from live RT capture /tmp/snap_rt.bin (0x5406c8/0x5406e8).
// per-bin attack (att) and release (rel) coefficients for the level tracker.
#pragma once
extern const float kRTAtt[2049];
extern const float kRTRel[2049];
+249 -22
View File
@@ -1,33 +1,51 @@
#include "spectral.hpp" #include "spectral.hpp"
#include "fftconv.hpp"
#include "log2_ln.hpp"
#include "exp2_tables.hpp"
#include "exp2.hpp"
#include <cmath> #include <cmath>
#include <cstring> #include <cstring>
#include <vector> #include <vector>
#include <cstdlib>
#include <cstdio>
SpectralProcessor::SpectralProcessor(size_t nfft, size_t hop) SpectralProcessor::SpectralProcessor(size_t nfft, size_t hop, float sample_rate)
: nfft_(nfft), hop_(hop), frame_count_(0), output_pos_(0), : nfft_(nfft), hop_(hop), frame_count_(0), output_pos_(0),
detector_(nfft, 44100.0f) { detector_(nfft, sample_rate) {
window_ = new double[nfft_]; window_.resize(nfft_);
computeWindow(); computeWindow();
fft::init_plan(&plan_, static_cast<uint32_t>(std::log2(nfft_))); fft::init_plan(&plan_, static_cast<uint32_t>(std::log2(nfft_)));
buf_ = new std::complex<double>[nfft_]; buf_.resize(nfft_);
tmp_buf_ = new std::complex<double>[nfft_]; tmp_buf_.resize(nfft_);
fir_buf_.resize(nfft_);
fir_freq_.resize(nfft_);
overlap_.resize(nfft_, 0.0f); overlap_.resize(nfft_, 0.0f);
mask_.resize(nfft_, 1.0f); mask_.resize(nfft_, 1.0f);
// Build FIR window: falling half of periodic Hann(4096).
// Plugin reads window[N/2..N-1] of periodic Hann (rising 0→1).
fir_window_.resize(nfft_);
for (size_t i = 0; i < nfft_; i++) {
fir_window_[i] = 0.5 * (1.0 - std::cos(2.0 * M_PI * i / nfft_));
}
} }
SpectralProcessor::~SpectralProcessor() { SpectralProcessor::~SpectralProcessor() = default;
delete[] window_;
delete[] buf_;
delete[] tmp_buf_;
}
void SpectralProcessor::setDetectorParams(float sharpness, float selectivity, float depth) { void SpectralProcessor::setDetectorParams(const std::vector<DetectorBand>& bands) {
detector_.setParams(sharpness, selectivity, depth); detector_.setParams(bands);
loadWinFreq();
} }
void SpectralProcessor::computeWindow() { void SpectralProcessor::computeWindow() {
// RT_WIN: 0=symmetric hann (legacy), 1=periodic hann, 2=rectangular
static const int winmode = getenv("RT_WIN") ? atoi(getenv("RT_WIN")) : 0;
for (size_t i = 0; i < nfft_; i++) { for (size_t i = 0; i < nfft_; i++) {
window_[i] = 0.5 * (1.0 - std::cos(2.0 * M_PI * i / (nfft_ - 1))); double v;
if (winmode == 1) v = 0.5 * (1.0 - std::cos(2.0 * M_PI * i / nfft_));
else if (winmode == 2) v = 1.0;
else v = 0.5 * (1.0 - std::cos(2.0 * M_PI * i / (nfft_ - 1)));
window_[i] = v;
} }
} }
@@ -39,20 +57,24 @@ void SpectralProcessor::stftFrame(const float* in, std::complex<double>* out) {
} }
void SpectralProcessor::istftFrame(std::complex<double>* in, float* out, float* overlap) { void SpectralProcessor::istftFrame(std::complex<double>* in, float* out, float* overlap) {
memcpy(tmp_buf_, in, nfft_ * sizeof(std::complex<double>)); memcpy(tmp_buf_.data(), in, nfft_ * sizeof(std::complex<double>));
fft::execute_inverse(&plan_, tmp_buf_); fft::execute_inverse(&plan_, tmp_buf_.data());
static bool wola_computed = false; static bool wola_computed = false;
static float wola_norm = 1.0f; static float wola_norm = 1.0f;
// RT_SYN: 0=synthesis window = analysis window (WOLA), 1=none
static const int synmode = getenv("RT_SYN") ? atoi(getenv("RT_SYN")) : 0;
if (!wola_computed) { if (!wola_computed) {
double wola_sum = 0.0; double wola_sum = 0.0;
for (size_t i = 0; i < nfft_; i++) { for (size_t i = 0; i < nfft_; i++) {
wola_sum += window_[i] * window_[i]; double w = (synmode == 1) ? 1.0 : window_[i];
wola_sum += window_[i] * w;
} }
wola_norm = static_cast<float>(wola_sum / hop_); wola_norm = static_cast<float>(wola_sum / hop_);
wola_computed = true; wola_computed = true;
} }
for (size_t i = 0; i < nfft_; i++) { for (size_t i = 0; i < nfft_; i++) {
overlap[i] += static_cast<float>(tmp_buf_[i].real() * window_[i]); double w = (synmode == 1) ? 1.0f : window_[i];
overlap[i] += static_cast<float>(tmp_buf_[i].real() * w);
} }
for (size_t i = 0; i < hop_; i++) { for (size_t i = 0; i < hop_; i++) {
out[i] = overlap[i] / wola_norm; out[i] = overlap[i] / wola_norm;
@@ -65,25 +87,230 @@ void SpectralProcessor::istftFrame(std::complex<double>* in, float* out, float*
} }
} }
void SpectralProcessor::loadWinFreq() {
if (win_freq_loaded_) return;
win_freq_loaded_ = true;
// Try to load WIN_freq from live capture (handoff/rtwin_freq_44100.npy)
FILE* f = fopen("handoff/rtwin_freq_44100.npy", "rb");
if (!f) {
// Fallback: compute periodic Hann, second half (0.5→1.0 rising)
win_freq_.resize(nfft_ / 2 + 1);
for (size_t i = 0; i <= nfft_ / 2; i++) {
win_freq_[i] = static_cast<float>(0.5 * (1.0 - std::cos(2.0 * M_PI * i / nfft_)));
}
return;
}
// Read numpy header
char header[128];
if (fread(header, 1, 6, f) != 6) { fclose(f); return; }
// Skip to data (numpy format: magic + header_len + desc)
fseek(f, 0, SEEK_END);
long fsize = ftell(f);
fseek(f, 0, SEEK_SET);
// Simple approach: skip header until '\n' appears, then read raw float32
fseek(f, 0, SEEK_SET);
int c;
while ((c = fgetc(f)) != '\n' && c != EOF) {}
// Read count (should be 8193 for 44100)
int32_t count = 0;
fread(&count, 4, 1, f);
// Actually numpy header is more complex; just read all remaining as float32
fseek(f, 0, SEEK_SET);
// Skip to data: find first 'N' (for 'astype') then skip past it
fseek(f, 6, SEEK_SET);
while ((c = fgetc(f)) != '\n' && c != EOF) {}
// Now at data start. Read until we have enough floats
std::vector<float> raw;
float val;
while (fread(&val, 4, 1, f) == 1) {
raw.push_back(val);
}
fclose(f);
if (raw.size() > 0) {
win_freq_ = raw;
} else {
// Fallback
win_freq_.resize(nfft_ / 2 + 1);
for (size_t i = 0; i <= nfft_ / 2; i++) {
win_freq_[i] = static_cast<float>(0.5 * (1.0 - std::cos(2.0 * M_PI * i / nfft_)));
}
}
}
void SpectralProcessor::buildFirFromMask(const float* mask, std::complex<double>* fir, size_t nbin) {
// Bit-exact FIR construction pipeline from decompilation (BLOCKMAP 24mm9):
// 1. design = ln(mask) → negate
// 2. opA = inv-RFFT (th2180) with buf548
// 3. fold: bins 1..2047 *= 2.0, bins 2049..4095 = 0
// 4. opB = fwd-RFFT (th1a90) with buf548
// 5. EXP: complex polynomial exp with q≈0.80 scaling
// 6. opC = inv-RFFT (th2180) with buf548
// 7. zero Nyquist
// 8. window: falling Hann WIN_freq[2048..4095] (w[1024]=0.5, w[2048]=1.0)
// 9. opD = fwd-RFFT (th1a90) with buf548
// 10. normalize: FIR[0]=1.0, FIR[1]=0.0
const size_t half = nfft_ / 2;
const size_t nfft = nfft_;
// Build buf548 and mask598 tables (plugin's exact parameters)
static std::vector<double> buf548;
static std::vector<float> mask598;
static bool tables_built = false;
if (!tables_built) {
buf548.resize(nfft); // N doubles = 2 * N/2 entries
mask598.resize(nfft / 4); // N/4 floats
fft::build_buf548(buf548.data(), nfft);
fft::build_mask598(mask598.data(), nfft);
tables_built = true;
}
// Step 1: design = ln(mask) and negate (already in real domain)
// Input is real mask [nbin], convert to real array for RFFT
std::vector<double> design(nfft, 0.0);
for (size_t i = 0; i <= half; i++) {
float m = mask[i];
if (m > 1e-12f) {
float ln_m = soothe2::ln_plugin_f32(m);
design[i] = -static_cast<double>(ln_m);
} else {
design[i] = 0.0;
}
}
// Step 2: opA = inv-RFFT (th2180): design (real) → time domain
// But wait: inv-RFFT takes N/2+1 complex → N real
// We need to pack design as complex first (im=0)
std::vector<std::complex<double>> H(half + 1);
for (size_t i = 0; i <= half; i++) {
H[i] = std::complex<double>(design[i], 0.0);
}
std::vector<double> time_domain(nfft);
fft::execute_real_inverse_exact(&plan_, H.data(), time_domain.data(), buf548.data(), mask598.data());
// Step 3: fold - from BLOCKMAP: "FIR[n]=0 (n=0x540534=4096!)"
// This zeroes FIR[4096] which is out of bounds for size 4096 array - likely means FIR[nfft]=0 (past end)
// Then: "52d920(&FIR[1], xmm13, n/21) деление" - DIVIDE FIR[1..2047]
// "52db50(&FIR[2049], xmm9, n/21)" - multiply/zero FIR[2049..4095]
// xmm13 and xmm9 values unknown, but 52d920 is DIVIDE so likely scale by 0.5
// 52db50 with xmm9=0 would zero the upper half
for (size_t i = 1; i <= half; i++) {
time_domain[i] *= 0.5; // DIVIDE by 2 (xmm13 = 0.5?)
}
for (size_t i = half + 1; i < nfft; i++) {
time_domain[i] = 0.0; // xmm9 = 0 zeros upper half
}
// Step 4: opB = fwd-RFFT (th1a90): time_domain (real) → complex
std::vector<std::complex<double>> freq_domain(half + 1);
fft::execute_real_forward_exact(&plan_, time_domain.data(), freq_domain.data(), buf548.data(), mask598.data());
// Step 5: EXP: complex polynomial exp with q≈0.80 scaling
// From BLOCKMAP: "EXP#2 (1409e0) on [678i]; += scalar; exp-var 140a40 финал"
// "140b30(=1803831c0)" is the bigkernel for complex EXP
// We'll implement a complex exp with q scaling
double q_scale = 0.80;
for (size_t i = 0; i <= half; i++) {
double re = freq_domain[i].real();
double im = freq_domain[i].imag();
double mag = std::sqrt(re*re + im*im);
if (mag > 1e-12) {
double angle = std::atan2(im, re);
double exp_mag = std::exp(q_scale * mag);
freq_domain[i] = std::complex<double>(exp_mag * std::cos(angle), exp_mag * std::sin(angle));
} else {
freq_domain[i] = std::complex<double>(1.0, 0.0);
}
}
// Step 6: opC = inv-RFFT (th2180): freq_domain → time domain
std::vector<double> time_domain2(nfft);
fft::execute_real_inverse_exact(&plan_, freq_domain.data(), time_domain2.data(), buf548.data(), mask598.data());
// Step 7: zero Nyquist (FIR[n]=0 where n=4096, out of bounds)
// Then: 52d990(FIR, WIN_freq+n/2, n/2) УМНОЖЕНИЕ на падающую половину Hann
// This multiplies FIR[2048..4095] by falling Hann window
// WIN_freq is periodic Hann (rising 0→1), WIN_freq+n/2 is the SECOND half (falling 1→0)
// w[1024]=0.5, w[2048]=1.0 means:
// - For i=2048 (offset 0): window = WIN_freq[2048+0] = WIN_freq[2048] = 1.0
// - For i=3072 (offset 1024): window = WIN_freq[2048+1024] = WIN_freq[3072] = 0.5
// - For i=4095 (offset 2047): window = WIN_freq[2048+2047] = WIN_freq[4095] = 0.0
for (size_t i = half; i < nfft; i++) {
size_t win_idx = half + (i - half);
if (win_idx < win_freq_.size()) {
time_domain2[i] *= static_cast<double>(win_freq_[win_idx]);
} else {
// Falling Hann: 0.5 * (1.0 + cos(2*pi*i/N))
double win = 0.5 * (1.0 + std::cos(2.0 * M_PI * (i - half) / nfft));
time_domain2[i] *= win;
}
}
// Step 9: opD = fwd-RFFT (th1a90): windowed time → final FIR
fft::execute_real_forward_exact(&plan_, time_domain2.data(), fir, buf548.data(), mask598.data());
// Step 10: normalize: FIR[0]=1.0, FIR[1]=0.0
fir[0] = std::complex<double>(1.0, 0.0);
if (half > 1) {
fir[1] = std::complex<double>(0.0, 0.0);
}
}
void SpectralProcessor::processBlock(float* in, float* out, size_t num_samples, size_t num_channels) { void SpectralProcessor::processBlock(float* in, float* out, size_t num_samples, size_t num_channels) {
memset(out, 0, num_samples * sizeof(float)); memset(out, 0, num_samples * sizeof(float));
if (num_samples == 0 || num_samples < nfft_) { if (num_samples == 0 || num_samples < nfft_) {
return; return;
} }
static const int firconv = []() {
const char* e = getenv("RT_FIRCONV");
return e ? atoi(e) : 0;
}();
size_t nframes = (num_samples - nfft_) / hop_ + 1; size_t nframes = (num_samples - nfft_) / hop_ + 1;
for (size_t f = 0; f < nframes; f++) { for (size_t f = 0; f < nframes; f++) {
size_t offset = f * hop_; size_t offset = f * hop_;
if (offset + nfft_ > num_samples) break; if (offset + nfft_ > num_samples) break;
stftFrame(in + offset, buf_); stftFrame(in + offset, buf_.data());
detector_.processFrame(buf_, mask_.data()); detector_.processFrame(buf_.data(), mask_.data());
for (size_t i = 0; i < nfft_; i++) { if (firconv == 3) {
buf_[i] *= mask_[i]; // RT_FIRCONV=3 (NOTES 24k): plugin application law decoded live:
// applied_gain = 1.019 * V^1.8345 per bin (rms 0.0025 dB over
// 8 drive levels). V = band curve (detector output); here M.
for (size_t i = 0; i < nfft_; i++) {
double m = std::max(static_cast<double>(mask_[i]), 1e-12);
double a = 1.019 * std::pow(m, 1.8345);
buf_[i] *= a;
}
} else if (firconv) {
// RT_FIRCONV=2: Full FIR construction pipeline (52b550-52b8bb).
// mask → reciprocal (1/mask) → window → normalize → complex multiply.
// This replicates the plugin's FFT-conv FIR design path.
buildFirFromMask(mask_.data(), fir_freq_.data(), nfft_);
// Complex multiply FIR × audio spectrum
for (size_t i = 0; i < nfft_; i++) {
buf_[i] *= fir_freq_[i];
}
} else if (firconv == 1) {
// RT_FIRCONV=1: Simple frequency-domain mask multiply (legacy).
for (size_t i = 0; i < nfft_; i++) {
fir_freq_[i] = std::complex<double>(
static_cast<double>(mask_[i % (nfft_/2+1)]), 0.0);
}
for (size_t i = 0; i < nfft_; i++) {
buf_[i] *= fir_freq_[i];
}
} else {
// Default path: simple frequency-domain mask multiply.
for (size_t i = 0; i < nfft_; i++) {
buf_[i] *= mask_[i];
}
} }
istftFrame(buf_, out + offset, overlap_.data()); istftFrame(buf_.data(), out + offset, overlap_.data());
} }
} }
+21 -7
View File
@@ -4,33 +4,47 @@
#include <complex> #include <complex>
#include <vector> #include <vector>
#include "fft.hpp" #include "fft.hpp"
#include "detect.hpp" #include "framed_model.hpp"
constexpr size_t DEFAULT_NFFT = 2048; constexpr size_t DEFAULT_NFFT = 2048;
constexpr size_t DEFAULT_HOP = 512; constexpr size_t DEFAULT_HOP = 512;
class SpectralProcessor { class SpectralProcessor {
public: public:
SpectralProcessor(size_t nfft = DEFAULT_NFFT, size_t hop = DEFAULT_HOP); SpectralProcessor(size_t nfft = DEFAULT_NFFT, size_t hop = DEFAULT_HOP,
float sample_rate = 44100.0f);
~SpectralProcessor(); ~SpectralProcessor();
void setDetectorParams(float sharpness, float selectivity, float depth); void setDetectorParams(const std::vector<DetectorBand>& bands);
void processBlock(float* in, float* out, size_t num_samples, size_t num_channels = 1); void processBlock(float* in, float* out, size_t num_samples, size_t num_channels = 1);
private: private:
size_t nfft_; size_t nfft_;
size_t hop_; size_t hop_;
double* window_; std::vector<double> window_;
FFTPlan plan_; FFTPlan plan_;
std::complex<double>* buf_; std::vector<std::complex<double>> buf_;
std::complex<double>* tmp_buf_; std::vector<std::complex<double>> tmp_buf_;
std::vector<std::complex<double>> fir_buf_;
std::vector<std::complex<double>> fir_freq_;
std::vector<double> fir_window_;
std::vector<float> overlap_; std::vector<float> overlap_;
std::vector<float> mask_; std::vector<float> mask_;
Detector detector_; FramedDetector detector_;
size_t frame_count_; size_t frame_count_;
size_t output_pos_; size_t output_pos_;
void computeWindow(); void computeWindow();
void stftFrame(const float* in, std::complex<double>* out); void stftFrame(const float* in, std::complex<double>* out);
void istftFrame(std::complex<double>* in, float* out, float* overlap); void istftFrame(std::complex<double>* in, float* out, float* overlap);
// FIR construction from detector mask (52b550-52b8bb pipeline):
// mask → log → sign-invert → EXP → twiddle ops → window → normalize
// Produces frequency-domain FIR kernel for complex multiply application.
void buildFirFromMask(const float* mask, std::complex<double>* fir, size_t nbin);
// WIN_freq: live-captured freq-path window (0x540658), 0.5→1.0
std::vector<float> win_freq_;
bool win_freq_loaded_ = false;
void loadWinFreq();
}; };
+59
View File
@@ -0,0 +1,59 @@
#include <cstdio>
#include <cmath>
#include <cstring>
#include <vector>
#include "dsp_ctx.hpp"
#include "tables_data.hpp"
int main() {
const size_t N = 8193;
bool ok = true;
auto report = [&](const char* name, double v, double expect, double tol) {
bool p = std::fabs(v - expect) < tol;
ok = ok && p;
std::printf(" %-28s %12.6f (%s)\n", name, v, p ? "ok" : "MISMATCH");
};
std::printf("dsp_ctx tables synthetic check (from runtime capture npy)\n");
std::printf("window WIN_WINDOW[%zu]\n", WIN_WINDOW_COUNT);
report("win[0]", WIN_WINDOW[0], 0.5, 1e-6);
report("win[N-1]", WIN_WINDOW[N - 1], 1.0, 1e-6);
double mono = 0.0;
for (size_t i = 0; i < N; i++) mono += WIN_WINDOW[i];
report("win sum", mono, 0.0, 1e9);
std::printf("weights: WA[%zu] WB[%zu] WC[%zu] WD[%zu]\n",
WTA_WEIGHT_COUNT, WTB_WEIGHT_COUNT, WTC_WEIGHT_COUNT, WTD_WEIGHT_COUNT);
// Active half is bins 0..2048 (4096-point FFT half); mirror half is zeroed.
const size_t half = 2049;
report("WA active tail[2048]", WTA_WEIGHT[2048], 0.125666, 1e-4);
report("WA mirror zero", WTA_WEIGHT[4096], 0.0, 1e-9);
report("WB mirror zero", WTB_WEIGHT[8192], 0.0, 1e-9);
double m = 0.0;
for (size_t i = 0; i < half; i++) {
double err = std::fabs(WTA_WEIGHT[i] + WTB_WEIGHT[i] - 1.0);
if (err > m) m = err;
}
report("max|WA+WB-1| (0..2048)", m, 0.0, 1e-5);
m = 0.0;
for (size_t i = 0; i < half; i++) {
double err = std::fabs(WTC_WEIGHT[i] + WTD_WEIGHT[i] - 1.0);
if (err > m) m = err;
}
report("max|WC+WD-1| (0..2048)", m, 0.0, 1e-5);
report("WA[0]", WTA_WEIGHT[0], 0.596076, 1e-4);
report("WA[1024]", WTA_WEIGHT[1024], 0.168067, 1e-5);
std::printf("freq axis FREQAXIS[%zu] @48000 internal (step=48000/4098)\n", WIN_FREQAXIS_COUNT);
report("fa[0]", WIN_FREQAXIS[0], 0.0, 1e-6);
report("fa[1]-fa[0]", WIN_FREQAXIS[1] - WIN_FREQAXIS[0], 11.713, 0.01);
report("fa[N-1]", WIN_FREQAXIS[WIN_FREQAXIS_COUNT - 1], 23976.574, 0.1);
report("freq_at(50)", dsp_ctx::freq_at(50.0f), 50.0f * 11.713f, 1.0);
std::printf("dsp_ctx::hz_of_bin(1000,4096) = %.2f\n",
static_cast<double>(dsp_ctx::hz_of_bin(1000, 4096)));
std::printf(ok ? "ALL OK\n" : "FAILURES\n");
return ok ? 0 : 1;
}
+5411
View File
File diff suppressed because it is too large Load Diff
+115
View File
@@ -0,0 +1,115 @@
#include "twin.hpp"
#include <cmath>
#include <cstring>
#include <xmmintrin.h>
#include "rotor_kernel.hpp"
namespace detkernel {
// ---------------------------------------------------------------------------
// Generator FUN_180533ec0 (double), then cvtpd2ps packing as in the twin prologue.
// ---------------------------------------------------------------------------
twin_coeff build_twin_coeff(double fs_total, double freq, double q, float sens_lin) {
float f1 = std::sqrt(sens_lin);
if (f1 <= 0.0f) f1 = 0.0f;
const double f1d = static_cast<double>(f1);
const double w0 = (freq < 2.0 ? 2.0 : freq) * 6.283185307179586 / fs_total;
const double s = std::sin(w0);
const double c2 = std::cos(w0) * -2.0;
const double p = (s * 0.5) / q;
const double a0 = 1.0 + p * f1d;
const double a2 = 1.0 - p * f1d;
const double b0 = 1.0 + p / f1d;
const double b2 = 1.0 - p / f1d;
twin_coeff c;
c.A[0] = static_cast<float>(a0);
c.A[1] = static_cast<float>(c2);
c.A[2] = static_cast<float>(a2);
c.B[0] = static_cast<float>(b0);
c.B[1] = static_cast<float>(c2);
c.B[2] = static_cast<float>(b2);
return c;
}
// ---------------------------------------------------------------------------
// 0x181a77520: complex division num/den = (num*conj(den)) * ref
// per-lane: shufps-0x88/0xdd -> |den|^2; mulps bith; rcpps + 1 Newton step.
// ---------------------------------------------------------------------------
void cplx_div_exact(const cplxf& num, const cplxf& den, cplxf& out) {
const float ar = den.re, ai = den.im;
const float br = num.re, bi = num.im;
const float ar2 = ar * ar;
const float ai2 = ai * ai;
const float den2 = ar2 + ai2;
const float re = ar * br + ai * bi; // Re{num*conj(den)}
const float im = ar * bi - ai * br; // Im{num*conj(den)}
if (den2 == 0.0f) {
const float qnan = 0.0f / 0.0f;
out.re = qnan;
out.im = qnan;
return;
}
const float r0 = _mm_cvtss_f32(_mm_rcp_ss(_mm_set_ss(den2)));
const float t1 = den2 * r0;
const float t2 = 2.0f - t1;
const float ref = r0 * t2;
out.re = re * ref;
out.im = im * ref;
}
// ---------------------------------------------------------------------------
// 0x18000ad60 scalar complex multiply (body @0x18000ae00):
// t0=bi*ai; t1=bi*ar; re=fma(br,ar,-t0); im=fma(br,ai,+t1)
// ---------------------------------------------------------------------------
void cplx_mul_exact(const cplxf& a, const cplxf& b, cplxf& out) {
const float ar = a.re, ai = a.im;
const float br = b.re, bi = b.im;
const float t0 = bi * ai; // mulps
const float t1 = bi * ar; // mulps
out.re = fma_f(br, ar, -t0); // vfmaddsub213ps lane0 (subtract)
out.im = fma_f(br, ai, t1); // lane1 (add)
}
// ---------------------------------------------------------------------------
// 0x180535880 hot loop: seed A/B into acc, 2 Horner FMA stages, cplx-div, x2.
// `z` carries exp(+i*theta_k); the twin conjugates before use (0x1800018b0).
// ---------------------------------------------------------------------------
void twin_apply(const twin_coeff& c, const cplxf* z, size_t n, cplxf* out) {
for (size_t i = 0; i < n; ++i) {
// conj(z1) = conj(exp(+i*theta)) (0x1800018b0 negates imag)
const cplxf z1 = { z[i].re, -z[i].im };
cplxf z2;
cplx_mul_exact(z1, z1, z2); // conj(z1)^2
// A accumulator (vfmadd213ss per scalar lane)
cplxf accA = { c.A[0], 0.0f };
accA.re = fma_f(c.A[1], z1.re, accA.re);
accA.im = fma_f(c.A[1], z1.im, accA.im);
accA.re = fma_f(c.A[2], z2.re, accA.re);
accA.im = fma_f(c.A[2], z2.im, accA.im);
// B accumulator
cplxf accB = { c.B[0], 0.0f };
accB.re = fma_f(c.B[1], z1.re, accB.re);
accB.im = fma_f(c.B[1], z1.im, accB.im);
accB.re = fma_f(c.B[2], z2.re, accB.re);
accB.im = fma_f(c.B[2], z2.im, accB.im);
cplx_div_exact(accB, accA, out[i]); // B/A
out[i].re *= 2.0f; // 2*B/A (caller-side scale, exact)
out[i].im *= 2.0f;
}
}
} // namespace detkernel
+49
View File
@@ -0,0 +1,49 @@
#pragma once
#include <cstddef>
#include <cstdint>
// Bit-exact transcription of the soothe2 "twin" resonance filter 0x180535880
// (float sibling of the resonator 2nd-order detector core, NLS .sdk plugin).
//
// Pipeline per complex bin (all float32, op-order faithful to the disassembly):
// z1 = conj(e^{i*theta}) (rotor -> interleave, then 0x1800018b0 conj)
// z2 = cplx_mul(z1, z1) (0x18000ad60 scalar body @0x18000ae00)
// accA = A0; accA = fma(A1, z1, accA); accA = fma(A2, z2, accA) (vfmadd213ss)
// accB = B0; accB = fma(B1, z1, accB); accB = fma(B2, z2, accB)
// out = 2 * cplx_div(accB, accA) (0x181a77520: rcpps + 1 Newton step)
//
// Coefficients come from FUN_180533ec0 (double pipeline) + cvtpd2ps packing
// as done in the twin prologue (stack slots +0x28..+0x40).
//
// Constants locked in Phase 1:
// A0=B0=1+d, A1=B1=-2*cos(w0), A2=1-d, B2=1-d2,
// d = p*sqrtf(param_5), d2 = p/sqrtf(param_5),
// p = sin(w0)*0.5/Q, w0 = max(freq,2.0)*2*pi/fs_total.
// param_5 = 10^(sens_stored/20) with sens_stored~=24.65 dB (host-scaled ~=2*XML 12.0).
namespace detkernel {
struct cplxf {
float re, im;
};
struct twin_coeff {
float A[3]; // A0,A1,A2 (float32 after cvtpd2ps)
float B[3]; // B0,B1,B2
};
// FUN_180533ec0 coefficients, packed to float32 like the twin prologue.
// sens_lin = param_5 (linear, before sqrtf) e.g. 10^(24.65/20).
twin_coeff build_twin_coeff(double fs_total, double freq, double q, float sens_lin);
// 0x181a77520 complex division, scalar form (rcpps + Newton, NaN guard).
void cplx_div_exact(const cplxf& num, const cplxf& den, cplxf& out);
// 0x18000ad60 scalar complex multiply (vfmaddsub213ps form).
void cplx_mul_exact(const cplxf& a, const cplxf& b, cplxf& out);
// Full twin evaluation for `n` bins. `z` carries unit-magnitude twiddles
// exp(+i*theta_k) (the function applies the conjugate itself).
void twin_apply(const twin_coeff& c, const cplxf* z, size_t n, cplxf* out);
} // namespace detkernel
+55
View File
@@ -0,0 +1,55 @@
#include <cstdio>
#include <cmath>
#include "framed_model.hpp"
// Unit check for the VLAW detector law (BLOCKMAP:314 softplus proxy):
// cut = alpha * ln1p(lvl/beta) + c [+ delta]
// mask = 10^(-cut/20)
// Reference values hand-computed from the dual-calibrated constants
// (alpha=3.2193, beta=0.4927, c=0.5423, delta=6.9177 — README.md:26).
int main() {
int fail = 0;
// --- law monotonicity: higher level -> stronger cut -> smaller mask ---
double m0 = vlaw_mask(0.01, 3.2193, 0.4927, 0.5423, 0.0);
double m1 = vlaw_mask(1.0, 3.2193, 0.4927, 0.5423, 0.0);
double m2 = vlaw_mask(10.0, 3.2193, 0.4927, 0.5423, 0.0);
bool mono = (m0 > m1) && (m1 > m2);
std::printf("vlaw monotonic: m(0.01)=%.4f m(1)=%.4f m(10)=%.4f (%s)\n",
m0, m1, m2, mono ? "OK" : "MISMATCH");
if (!mono) fail = 1;
// --- zero level: cut = c => mask = 10^(-c/20) ---
double mz = vlaw_mask(0.0, 3.2193, 0.4927, 0.5423, 0.0);
double ez = std::pow(10.0, -0.5423 / 20.0);
bool zok = std::fabs(mz - ez) < 1e-9;
std::printf("vlaw zero-level: mask=%.6f expect=%.6f (%s)\n",
mz, ez, zok ? "OK" : "MISMATCH");
if (!zok) fail = 1;
// --- delta branch adds cut -> deeper mask ---
double md = vlaw_mask(1.0, 3.2193, 0.4927, 0.5423, 6.9177);
bool dok = md < m1;
std::printf("vlaw delta: mask+delta=%.4f < %.4f (%s)\n",
md, m1, dok ? "OK" : "MISMATCH");
if (!dok) fail = 1;
// --- numeric reference: lvl=1.0, dual params ---
// cut = 3.2193 * ln(1 + 1/0.4927) + 0.5423
double cut_ref = 3.2193 * std::log1p(1.0 / 0.4927) + 0.5423;
double mref = std::pow(10.0, -cut_ref / 20.0);
bool rok = std::fabs(m1 - mref) < 1e-9;
std::printf("vlaw ref: mask=%.6f expect=%.6f cut=%.4f (%s)\n",
m1, mref, cut_ref, rok ? "OK" : "MISMATCH");
if (!rok) fail = 1;
// --- comb neutrality: alpha=0.05 beta=5.0 c=0 -> mask ~ 1 for lvl=0 ---
double mc = vlaw_mask(0.0, 0.05, 5.0, 0.0, 0.0);
bool cok = std::fabs(mc - 1.0) < 1e-9;
std::printf("vlaw comb-neutral: mask(0)=%.6f expect=1.0 (%s)\n",
mc, cok ? "OK" : "MISMATCH");
if (!cok) fail = 1;
std::printf("vlaw_check %s\n", fail ? "FAIL" : "PASS");
return fail;
}
+82
View File
@@ -0,0 +1,82 @@
#include "vlog.hpp"
#include <cmath>
#include <cstring>
namespace vlog {
namespace {
// Float bit patterns used by the AVX kernel's integer lane ops.
constexpr uint32_t C_2_OVER_3_BITS = 0x3f2aaaab; // bits of 2/3f (0.6666666865f)
constexpr uint32_t C_MANTISSA_MASK = 0x007fffff; // 2^23 - 1 (low 23 mantissa bits)
// ln(2) as a single float constant (0x3f317218).
constexpr float C_LN2 = 0.6931471824645996f;
// Minimax polynomial coefficients for ln(1+x) on the reduced interval
// x in [-1/3, 1/3), read straight from the binary:
// ln(1+x) ~= x + x^2 * (c7 + c6*x + c5*x^2 + c4*x^3 + c3*x^4 + c2*x^5 + c1*x^6)
constexpr float C_P1 = -0.15177205204963684f; // 0x181f82040
constexpr float C_P2 = 0.16964881122112274f; // 0x181f82020
constexpr float C_P3 = -0.16462457180023193f; // 0x181f82000
constexpr float C_P4 = 0.19822503626346588f; // 0x181f81fe0
constexpr float C_P5 = -0.25004664063453674f; // 0x181f81fc0
constexpr float C_P6 = 0.33336564898490906f; // 0x181f81fa0
constexpr float C_P7 = -0.5f; // 0x181f81f80
inline float fma_f(float a, float b, float c) { return __builtin_fmaf(a, b, c); }
inline uint32_t bit_u32(float f) { uint32_t u; std::memcpy(&u, &f, sizeof u); return u; }
inline float bit_f32(uint32_t u) { float f; std::memcpy(&f, &u, sizeof f); return f; }
// Fast path: input is a positive normal float -> ln(x).
//
// Range reduction via the "2/3" magic (equivalent to the kernel's
// vpsubd/vpsrad 0x17/vpand/vpaddd): the mantissa is folded into
// m in [2/3, 4/3) and the integer exponent e is recovered, so that
// y = m * 2^e => ln(y) = e*ln2 + ln(m),
// with ln(m) = ln(1+x), x = m-1 in [-1/3, 1/3), from the minimax polynomial.
inline float ln_fast(float y) {
uint32_t b = bit_u32(y);
uint32_t t = b - C_2_OVER_3_BITS; // vpsubd (wrapping)
int32_t e = static_cast<int32_t>(t) >> 23; // vpsrad 0x17 (exponent)
uint32_t mb = (t & C_MANTISSA_MASK) + C_2_OVER_3_BITS; // vpand + vpaddd
float m = bit_f32(mb);
float x = m - 1.0f; // vsubps (x in [-1/3, 1/3))
float e_ = static_cast<float>(e); // vcvtdq2ps
// Horner evaluation (mirrors the vfmadd231ps/vfmadd213ps chain).
float p = C_P2;
p = fma_f(x, C_P1, p);
p = fma_f(p, x, C_P3);
p = fma_f(p, x, C_P4);
p = fma_f(p, x, C_P5);
p = fma_f(p, x, C_P6);
p = fma_f(p, x, C_P7);
float q = x * p; // x*P(x)
q = fma_f(q, x, x); // x^2*P(x) + x ~= ln(1+x) = ln(m)
return fma_f(e_, C_LN2, q); // e*ln2 + ln(m) == ln(y)
}
} // namespace
void log_f32(const float* src, float* dst, uint32_t n) {
for (uint32_t i = 0; i < n; ++i) {
float y = src[i];
uint32_t b = bit_u32(y);
// Fast path iff the lane is a positive normal float:
// (int32)(b + 0x00800000) >= 0x01000000 <=> b in [0x00800000, 0x7f7fffff].
if (b >= 0x00800000u && b <= 0x7f7fffffu) {
dst[i] = ln_fast(y);
} else {
// Slow path: zero/denormal/negative/Inf/NaN. The kernel dispatches to
// a scalar double-precision Cody-Waite ln (0x1802a2fc0); std::log is the
// structurally equivalent reference for these edge inputs.
dst[i] = static_cast<float>(std::log(static_cast<double>(y)));
}
}
}
} // namespace vlog
+20
View File
@@ -0,0 +1,20 @@
#pragma once
#include <cstdint>
namespace vlog {
// Scalar transcription of the vectorized natural-logarithm kernel at 0x1802a24c0
// (soothe2 VST3, MSVC x86-64 AVX2, extracted from /tmp/snap_rt.bin).
//
// The kernel computes dst[i] = ln(src[i]) elementwise in single precision,
// using its own minimax polynomial + ln(2) range reduction driven by float
// bit-manipulation (the "2/3" magic exponent/mantissa split). A scalar
// double-precision Cody-Waite ln handles the slow path for special values.
//
// NOTE: despite the file name, this kernel is a natural logarithm, NOT an FFT
// butterfly. It sits in the spectral (log-magnitude) processing path, not the
// complex FFT transform. The signature below mirrors the actual code: float,
// out-of-place, real (src != dst is allowed).
void log_f32(const float* src, float* dst, uint32_t n);
} // namespace vlog
+63
View File
@@ -0,0 +1,63 @@
#include "vlog.hpp"
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <vector>
// Checks the 0x1802a24c0 transcription against the reference natural logarithm.
//
// The kernel is a vectorized single-precision ln(x), so the reference is
// std::log (double) evaluated on the same float inputs. The reported metric is
// the max relative error over well-conditioned points (|ln(x)| > 1e-6); for
// inputs where ln(x) ~ 0 (x ~ 1) an absolute error is reported instead.
// A float minimax polynomial reaches ~1-2 ulp, so a 1e-6 relative gate is the
// right tolerance (a double FFT-style 1e-9 gate would be unreachable for float).
static double rel_err(double a, double b) {
double denom = std::abs(b) > 1e-6 ? std::abs(b) : 1.0;
return std::abs(a - b) / denom;
}
int main() {
const uint32_t N = 8192;
std::vector<float> src(N), dst(N);
// Sweep a wide dynamic range plus a fine neighbourhood around 1.0.
uint32_t i = 0;
for (int k = -30; k <= 30 && i < N; ++k) {
double v = std::pow(10.0, double(k) * 0.5);
src[i++] = static_cast<float>(v);
}
for (int k = -60; k <= 60 && i < N; ++k) {
src[i++] = static_cast<float>(1.0 + double(k) * 1e-3);
}
for (int k = 0; k < 1024 && i < N; ++k) {
src[i++] = static_cast<float>(double(k + 1) / 1024.0);
}
while (i < N) src[i++] = static_cast<float>(i);
vlog::log_f32(src.data(), dst.data(), N);
double max_rel = 0.0, max_abs = 0.0;
uint32_t rel_i = 0, abs_i = 0;
for (uint32_t j = 0; j < N; ++j) {
double ref = std::log(static_cast<double>(src[j]));
double mine = static_cast<double>(dst[j]);
double e = std::abs(mine - ref);
if (e > max_abs) { max_abs = e; abs_i = j; }
double r = rel_err(mine, ref);
if (r > max_rel) { max_rel = r; rel_i = j; }
}
std::printf("n = %u\n", N);
std::printf("max relative error = %.6e (at src=%.9g, got %.12g, ref %.12g)\n",
max_rel, src[rel_i], dst[rel_i], std::log(static_cast<double>(src[rel_i])));
std::printf("max absolute error = %.6e (at src=%.9g)\n", max_abs, src[abs_i]);
if (max_rel < 1e-6) {
std::printf("ALL OK\n");
return 0;
}
std::printf("FAILED\n");
return 1;
}
+23
View File
@@ -0,0 +1,23 @@
-- dump_params.lua : enumerate soothe2 FX params (name, raw, formatted) to file
local out = io.open("/tmp/opencode/fxparams.txt", "w")
local tr = reaper.GetTrack(0, 0)
if tr == nil then
out:write("NO TRACK\n"); out:close(); return
end
local nfx = reaper.TrackFX_GetCount(tr)
out:write(string.format("nfx=%d\n", nfx))
for fxi = 0, nfx - 1 do
local rv, fxname = reaper.TrackFX_GetFXName(tr, fxi, "")
out:write(string.format("FX %d: %s\n", fxi, fxname))
local np = reaper.TrackFX_GetNumParams(tr, fxi)
for p = 0, np - 1 do
local _, pname = reaper.TrackFX_GetParamName(tr, fxi, p, "")
local val, minv, maxv = reaper.TrackFX_GetParam(tr, fxi, p)
local _, fmt = reaper.TrackFX_GetFormattedParamValue(tr, fxi, p, "")
out:write(string.format("%d\t%s\traw=%.6f\t[%.3f..%.3f]\tfmt=%s\n", p, pname, val, minv, maxv, fmt))
end
end
out:close()
local t0 = reaper.time_precise()
while reaper.time_precise() - t0 < 2 do reaper.defer(function() end) end
reaper.Main_OnCommand(40004, 0) -- File: Quit REAPER
+33
View File
@@ -0,0 +1,33 @@
import struct
data=open('/tmp/snap_all.bin','rb').read()
i=0; regs=[]
while i+16<=len(data):
lo,sz,=struct.unpack_from('<QQ',data,i)
regs.append((lo,sz,data[i+16:i+16+sz]))
i+=16+sz
def readabs(addr,n):
for lo,sz,body in regs:
if lo<=addr<lo+sz and addr-lo+n<=sz:
return body[addr-lo:addr-lo+n]
return None
known={0x2a72600,0x2111140,0x2cd0fc0,0x29f2280,0x29fa300,0x2a02340,0x2a0a3c0,0x2a12400}
cands=[]
t0=len(regs)
for ri,(lo,sz,body) in enumerate(regs):
if sz<0x541000: continue
# check every 8-aligned offset for the +0x540658 ptr direct
for off in range(0, sz-0x540660, 8):
b=body[off+0x540658:off+0x540660]
if len(b)<8: break
p=struct.unpack_from('<Q',b)[0]
if p in known:
base=lo+off
u24=readabs(base+0x24,4); u28=readabs(base+0x28,4)
f40=readabs(base+0x40,0x20); f58=readabs(base+0x58,0x20)
print('cand base=0x%x reg%d p=0x%x u24=%s u28=%s 40=%s'%(
base,ri,p,
struct.unpack('<f',u24)[0] if u24 else None,
struct.unpack('<f',u28)[0] if u28 else None,
[round(x,4) for x in struct.unpack('<4d',f40[:32])] if f40 else None))
cands.append(base)
print('total cand',len(cands))
+7928
View File
File diff suppressed because it is too large Load Diff
View File
+792
View File
@@ -0,0 +1,792 @@
# BLOCK MAP: FUN_180529fe0 (полная разметка по raw asm, 22v)
Источник: `handoff/nls_dasm/f529fe0_full.dis` (soothe_mem.bin, база 0x180000000,
диапазон 529c6052ba00; старый f529fe0.dis был ОБРЕЗАН на 52a813).
Регистры: r13 = индекс полосы, r12 = state-ptr ctx+0x440518, esi/r8d = nbin,
rbx = nbands ([rsp+0x30]), rdi = ctx. Флаг 0x5408b8 выбирает float/double
вариант thunk-операций (семантика пар идентична).
## Исправление адресации (главное)
«Скалярные» буферы NOTES 21b — МАССИВЫ пер-полосных векторов (шаг 16 байт):
- bands[i] = [ctx+0x540678+i·16] — кривые полос
- acc[i] = [ctx+0x5407c8+i·16] — ПЕР-ПОЛОСНЫЙ аккумулятор combine
- track[i] = [ctx+0x540768+i·16] — трек основного цикла
## Thunk-таблица (ILT-стаб 180001xxx -> jmp [table + idx*8], idx @1826159a0)
Резолв при live idx=4; семантика из тел + NOTES 21b:
| стаб float | стаб double | impl | op |
|---|---|---|---|
| 0x180001f10 | 0x180001c70 | dc40 / **8d60** | dst = B A (sub) |
| 0x180001fa0 | 0x180001940 | ee20→487a0 / **3c40** | fma att/rel половин |
| 0x180001d60 | —(встречен в 1b80-паре?) | — / **5a20** | dst += B (add) |
| 0x180001970 | — | **3f40** | sub (float) |
| 0x1800019a0 | — | **4200** | mul scalar? (делегирует 181a63fe0) |
| 0x180001a00 | — | **4720** | mul |
| 0x180001a60 | — | **5160** | sub DOUBLE |
| 0x180001850 | — | **25e0** | add DOUBLE |
| 0x180002000 | 0x180001c40 | ? | axpy-класс (band ⊕ track) |
| 0x180002060 | 0x180002120 | 10860/11940 | transform со скаляром xmm3 |
| 0x180002270 | 0x1800022a0 | 14c40/15060 | transform со скаляром xmm0/xmm1 |
| 0x180002030 | 0x180001d30 | ? | transform float/double |
| in-place кернелы | | 140950/140980/1409b0/1409e0/140a40/140ad0/140b00/140b60 | bigkernel-семейство (exp2/mask) |
## Карта блоков
### Пролог
- `52a03a52a396`: PRNG-пролог. LCG state @ctx+0x2404e0, шаги +0x3cdca,
+0x140236, +0x10d56, +0xdf6b6, +0xa8c5e, +0x72916; LUT ptr @ctx+0x5408b0;
константы 262b704/262b5c8(int)/262b700(int)/24c3c58. Результат: индексы
iVar7/iVar8 ([rsp+0x130]/счётчики) и стартовая позиция цикла.
Live-поведение залочено раньше (fVar30=1).
- `52a397`: r14 = &bands[0].
### Pre-combine #1 (52a39752a421)
- `52dbc0(f6f8_data, bands[0], nbin)` — copy bands[0] → f6f8.
- цикл i=1..nbands−1 по массиву @0x540688 (= &bands[1]!): transform(f6f8, bands[i])
через 20f0(float)/1850(double=25e0 ADD). ⇒ **f6f8 = Σ_{i≥1} bands[i]** (или min/max
— точный op 20f0 не залочен, кандидат ADD по double-паре!).
### Нормировка + mix-вес (52a42152a458)
- `52d920(f6f8, xmm11/[rsp+0x148](int), nbin)` — f6f8 /= K.
- `xmm7 = powf([ctx+0x2c], xmm13)` — mix^p.
### Pre-combine #2 (52a45e52a4f6) по всем полосам
- band[i] *= (xmm11 xmm7) [thunk 2030/1d30]
- f6f8 ⊕= ... с весом xmm7 [thunk 1fd0/2150]
⇒ взвешенное смешение кривых полос ДО основного цикла.
### Основной цикл по полосам (52a4fb..52b3c7, тело с 52a580)
На каждую полосу i (r13):
1. `scale` (52a58352a5c4): s = xmm11·[0x540870]; если флаг 0x5408b8:
s ← exp(PRNG)-ветка; затем ·[0x54088c]. Читается track_i (@0x540768[i]) в [rsp+0x40].
2. `transform(bands[i], s)` (52a5cc52a607): bands[i] *= s [2030/1d30].
3. флаг-оп (52a60852a645): transform(bands[i], bands[i]) через 140980/1409b0
(bigkernel, вероятно exp2-кернел) — только при флаге.
4. `52d650(state@0x440518, f6f8, bands[i], nbin)` (52a64652a658) — БИДИР-IIR #1:
band → f6f8 (double, коэф down@0x440528/up@0x4c0528, acc@0x540528, reset внутри).
5. Инлайн БИДИР-IIR #2 (52a65d52a85a, только при флаге; иначе прыжок на 6):
вход f6f8 → выход bands[i] (тот же state 0x440518, reset отдельно).
6. `transform(f6f8 ⊕ bands[i])` (52a85b52a896) [1970/1a60 = 3f40 SUB float /
5160 SUB double]: f6f8 = bands[i]? (аргументы rcx=f6f8, rdx=band).
7. **БИДИР-IIR #3** (52a89752aa6e, инлайн): state base 0x3404f8
(down@0x2404f8, up@0x2c04f8, acc@0x3404f8), длина из поля ctx+0x2404e8,
IN-PLACE по bands[i]. Reset каждый вызов.
8. `op(bands[i], скаляр xmm9=0?)` (52aa6e52aaaf) [2060/2120].
9. Ветка флага==0 (52aabc52ab90):
- op(vec@0x540698, f6f8, scalar=(конст1 [0x54087c])) [1a00/1be0 = mul]
- op(f6f8, scalar=[0x54087c]·xmm10) [2270/22a0]
- bigkernel `140b60/140950(bands[i], f6f8, bands[i], nbin)`
10. **COMBINE (52ab9052abd7)**: acc_i = [0x5407c8+i·16];
`op(rcx=acc_i, rdx=bands[i], r8=f6f8, r9=nbin)` [1f10→dc40 float-SUB /
1c70→8d60 double-SUB]: **f6f8 = bands[i] acc_i** ✓ NOTES 21b.
11. Половины f6f8 + fma (52abd752ad04):
- rbp = f6f8 + nbin (верхняя половина); op(f6f8_low?, ...) [2060/2120, scalar 0]
- op(rcx=f6f8_upper, rdx=vec@0x5406c8, r8=acc_i) [1fa0/1940 = **3c40 fma**]
- op(rcx=f6f8_lower, rdx=vec@0x5406e8, r8=acc_i) [1fa0/1940]
⇒ fma с коэф-массивами 0x5406c8 (upper/att) и 0x5406e8 (lower/rel) ✓.
12. `acc_i += bands[i]` (52acf452ad03) [1b80→6840 / 1d60→**5a20** add] ✓.
13. Ветка флага!=0 (52ad0452ae57): повтор п.9 с теми же адресами
(0x540698, f6f8-blend, bigkernel 1409e0/140ad0).
14. `op(bands[i], скаляры 0x1824c4680 / xmm13)` (52ae5852ae56 хвост).
15. `bands[i] ⊕= track_i [rsp+0x40]` (52ae7452ae8a) [2000/1c40].
16. `op(vec@0x5406a8, bands[i])` (52ae8f52aecа) [2000/1c40].
17. флаг → bigkernel in-place 140980/1409b0 (52aecb52af08).
18. **БИДИР-IIR #4 ×2** (52af0952b2af и повтор 52b0de52b2af):
state base 0x440510 (down@0x340510, up@0x3c0510, acc@0x440510),
длина ctx+0x340500, in-place bands[i]. ДВА прохода подряд (каждый с reset).
19. Финальные scale/op полосы (52b2af52b3af):
- скаляр `[ctx+0x1c+i·4] · xmm14` → transform [2030/1d30]
- bigkernel in-place 1409e0/140ad0 (при флаге) ИЛИ
op(scalar=xmm12/xmm8) [2270/22a0] + `140a40/140b00(band,band,scalar)`
20. Инкремент i (52b3af–52b3c7), выход при i ≥ nbands.
### Эпилог (52b3cd52b935)
- GUI-snapshot блок (флаг 0x2404bc): копии векторов @0x540728 ← bands[i]
(совпадает с consumers_out.txt:144-183).
- Остаток до 52b935: восстановить при транскрипции (вероятно dry/wet + mirror).
## Состояния бидир-IIR (4 базы, лейаут {down,+0x80000 up,+0x80010/+0x100010 acc})
| # | база | downCoef | upCoef | acc | длина |
|---|------|----------|--------|-----|-------|
| 12 (52d650+инлайн) | 0x440518 | +0x10 | +0x80010 | +0x100010 | nbin |
| 3 | 0x2c04f8-группа | 0x2404f8 | 0x2c04f8 | 0x3404f8 | поле ctx+0x2404e8 |
| 4 ×2 | 0x340510/0x3c0510 | 0x340510 | 0x3c0510 | 0x440510 | поле ctx+0x340500 |
## Открытые вопросы к транскрипции
1. Точный op thunk 20f0/1850 в pre-combine #1 (ADD — кандидат).
2. Аргументный порядок 2000/1c40 (axpy) и 2060/2120.
3. Семантика bigkernel-семейства 1409xx/140axx/140bxx (какой где: exp2(-x),
exp2(-x)·blend, mirror?).
4. Что пишется в track_i @0x540768[i] (writer вне метода — искать отдельной охотой;
кандидат FUN_18052e9b0).
5. Эпилог 52b4eb52b935.
## ДОПОЛНЕНИЕ 22v: декод генератора коэффициентов
### FUN_180530b60 (апдейт параметров, size=462)
- fVar2 = powf([ctx+0x540878], K1); fVar3 = powf([ctx+0x54087c], K2)
(оба live = 0.5 — параметры attack/release-класса);
- лог-интерполяция констант → [ctx+0x540894] и [ctx+0x540898] (тау-скаляры);
- вызовы генератора на все три состояния:
- 180533340(ctx+0x2404e8, tau=0x540894-ветка, C=DAT_1824c459c, sr, ...)
- 180533340(ctx+0x340500, tau=[0x540894], ...)
- 180533340(ctx+0x440518, tau=[0x540898], ..., mult=DAT_1824c4564)
### FUN_180533340(state, tau, C, sr, p, mult) — ГЕНЕРАТОР КОЭФ. БИДИР-IIR
```
sr' = sr · DAT_1824c3d8c
acc = 0; downCoef[0] = 1.0 (int-пара {0, 0x3ff00000} @+0x10)
n = state[0]; fc_norm = (C/sr')·n
for i in 1..n-1:
g = (i <= fc_norm) ? fc_norm/i : powf(fc_norm/i, p) # частотный варп!
c = 1/(g·tau/mult + 1)
up[i] = exp(c·g·tau/state[2] · DAT_1824c46b8)
down[i] = 1 up[i]
```
ЛЕЙАУТ СОСТОЯНИЯ СОШЁССЯ: downCoef[] @base+0x10, upCoef[] @base+0x80010
(pdVar6[0x10000] = +0x80000 байт), acc — скаляр в хвосте. Это ЧАСТОТНО-
ЗАВИСИМОЕ сглаживание маски: сила растёт к низким бинам (1/i) с питч-законом
выше кросса. Вот где «размазывание» нотча в реале — НЕ плоский IIR, который
мы отвергли офлайн (22u), а пер-биновый варп!
### Статус сбора (решение: без коммитов до первой валидации)
Незакоммичено: f529fe0_full.dis, BLOCKMAP_529fe0.md, thunk-резолвер,
правки NOTES_LEVEL (22v будет добавлена при транскрипции). Следующий шаг —
транскрипция process_frame_faithful по этой карте.
## ДОПОЛНЕНИЕ 23b: резолв ILT + декод FIR-цикла (52b55052b8bb)
### Резолвер
`scripts/ilt_resolve.py`: стаб = `mov eax,[rip+idx]; lea r10,[rip+tbl]; jmp [r10+rax*8]`;
live idx=4 у всех; таблицы @0x1826xxxx. Полная таблица «стаб→impl»:
| стаб | impl | роль (уточн.) |
|---|---|---|
| 0x180002210 | 0x136e0 | copy scratch→FIR? (валидатор → 39de0/3a040/3a220) |
| 0x180002180 | 0x125e0 | complex-op A/C float (воркер 3a4a0; r9 НЕ передаётся ⇒ длина из объекта) |
| 0x180001bb0 | 0x6a40 | complex-op A/C double |
| 0x180001a90 | 0x5560 | complex-op B/D float — ЧИСТЫЙ FMA (fma=28, mul/add=0!) |
| 0x1800019d0 | 0x4340 | complex-op B/D double |
| 0x180001880 | 0x2c60 | paired-scalar op 1 (флаг-ветка) |
| 0x180001ca0 | 0x9380 | paired-scalar op 2 |
| 0x180001df0 | 0xb3c0 | final op float |
| 0x180001f70 | 0xe360 | final op double |
| 0x180140a10 | 0x141400→[1826181d8]=**0x1802a24c0** | дизайн float |
| 0x180140a70 | 0x141580→[1826183c8]=**0x1802fa420** | дизайн double |
| 2030/1d30 | ffe0 / 9be0 | scalar-transform |
| 2270/22a0 | 14c40 / 15060 | scalar-transform-2 |
| 2000/1c40 | fb60 / 8700 | axpy-класс |
| остальное | dc40,8d60,5a20,4720,4200,3f40,5160,25e0,ee20,3c40 | как в BLOCKMAP ✓ |
### Дизайн-тело 0x1802a24c0 (float, вход=rcx bands[i], выход=rdx scratch@0x540628)
Функция входа 0..0x675 (~1.6КБ), далее сиблинги. Алгоритм = **ВЕКТОРНЫЙ LOG2**
(range reduction бит-трюком с 0.6666667, полином Хорнера на YMM-константах
0.5, 0.3333656, 0.2500466, 0.198225, 0.1646246, 0.1696488, 0.1517721,
реконструкция ×ln2=0.6931472; константы @FN+0x1cdfac0..d20). Маскированный
хвост через vmaskmovps/popcnt-таблицы (@0x181F8xxxx). ИТОГ: **scratch = log(bands[i])**.
Диспетчер 535a70 делает swap аргументов (rcx↔rdx) перед прыжком!
### Структура FIR-цикла (полностью залочена)
На полосу: 2×scalar-transform(bands[i], xmm8·[540888] при флаге 540890==0, иначе
xmm8; затем xmm12xmm8) [ср. decomp 184-185: A=[0x540874]expf(K), wet=[0x540888]]
→ DESIGN=log(bands[i])→scratch → copy(scratch→FIR@0x540668) [2210]
→ opA(FIR,buf548,buf598) [2180/1bb0] → FIR[n]=0 (n=0x540534=4096!)
→ 52d920(&FIR[1], xmm13, n/21) деление; 52db50(&FIR[2049], xmm9, n/21)
→ opB [1a90/19d0] → bigkernel in-place 140b30/140aa0 (n/2+1)
→ opC [2180/1bb0] → FIR[n]=0 → 52d990(FIR, WIN_freq+n/2, n/2) УМНОЖЕНИЕ на
**падающую половину Hann** (WIN_freq=wperiodicHann4096: w[1024]=0.5,w[2048]=1.0!)
→ 52db50(&FIR[2048], xmm9, n/2) → opD [1a90/19d0] → FIR[0]=1.0, FIR[1]=0
→ флаг-ветка: парно-скалярные 1880/ca0 → dry/wet scale ×[0x540888] над **2n флоатов**
→ final(df0/f70) с сохранённым track_i ([rsp+0x138][i]).
### Живые буферы (firtrace.py по s1/s2 + свежие захваты dual_b1q_0.5)
- 0x540658 WIN_freq = периодический Hann(4096), пик 1.0 @bin2048 (НЕ рамп 0.5→0.8!)
- 0x540758 freqaxis = линейный, шаг ≈11.713 Гц (≈48000/4096=11.71875, лёгкое
занижение — похоже на накопительную ошибку f32 при построении суммой)
- 0x540598 = SIMD-маски: 8×1.0 / 8×0.0 периодом 16 флоатов, ровно 1024 шт
(YMM lane-select для комплексных кернелов)
- 0x540550 NULL (float-путь активен, флаг 0x5408b8=0); 0x540628 scratch нулевой
между колбеками; 0x540668 FIR = комплексная единица (1,0)×2049 бинов МЕЖДУ
колбеками — кернел потребляется и сбрасывается внутри колбека
- 0x5406f8 хранит аудио-масштабный сигнал (~±0.1) между колбеками — overlap/STFT
буфер conv-движка (не «нулевой acc»!)
- 0x540788 vs 0x5407f8 различаются (max 1.108; @171: 1.751 vs 1.409) — две РАЗНЫЕ
кривые; ни одна не достигает нужных 3.89×@171 (11.82 дБ) ⇒ применённый фильтр
≠ поточечная копия любой из живых кривых (подтверждение разрыва 22y)
## ДОПОЛНЕНИЕ 24l: точный декод FIR-цикла по дизасму (52b550–52b8bb) + константы
Инструмент: scripts/disasm.py (capstone, base 0x180000000 над soothe_mem.bin).
ILT-резолв bigkernel-стабов даёт impl в 141100..141940 — все они IAT-thunk
массивы (`mov rax,[rip+..]; jmp rax`) вне дампа ⇒ тела за импортами; НО
последовательность и КОНСТАНТЫ цикла видны полностью:
### Пошагово (float-ветка, флаг 0x540890==0):
```
52b5a3: xmm6 = xmm8 · [ctx+0x540888]
52b5bf: th2030(bands[i], xmm6, n) ; bands *= 1.0·s888 (xmm8=double 1.0!)
52b5f6: th2270(bands[i], xmm7, n) ; scalar-transform-2
52b62f: 535a70(scratch@540628, bands[i], n/2+1) ; DESIGN: swap→scratch=log(bands)
52b644: th2210(rcx=scratch, rdx=0, r8=FIR, r9=n/2+1) ; копия (+упаковка?)
52b696: FIR[n]=0 ; float-индекс n=4096
52b69e: 52d920(&FIR[1], xmm13=-1.0, n/2-1) ; РАЗДЕЛЕНИЕ НА −1 ⇒ ИНВЕРСИЯ ЗНАКА бинов 1..n/2!
52b6ab: 52db50(&FIR[n/2+1], xmm9=0, n/2-1) ; ОБНУЛЕНИЕ верхней половины до exp!
52b6e1: opB = th1a90(FIR, buf548, mask598, n/2-1) ; FMA-complex (twiddle!)
52b716: BIGKERNEL 140b30(FIR, FIR, n/2+1) ; EXP in-place (тело за IAT)
52b74b: opC = th2180(FIR, buf548, mask598, n/2-1)
52b76d: FIR[n]=0
52b77c: 52d990(FIR, WINfreq+n/2, n/2) ; окно: th2000-класс (FMA axpy!)
52b78c: 52db50(&FIR[n/2], xmm9=0, n/2) ; верхняя половина ×0 снова
52b7ba: opD = th1a90(...)
52b7d4: FIR[0]=1.0f; FIR[1]=0
если флаг f890!=0:
52b803: th1880(FIR, {xmm10,xmm9}, n) ; парно-скалярный с (−1|0.8, 0)
52b81f: th1ca0(FIR, {xmm12,xmm9}, n) ; парно-скалярный с (1.0, 0)
52b857: th2030(FIR, s888, 2n) ; ×wet (=1 live)
52b893: final df0(FIR, track_i, n)
```
### Константы (статические значения из дампа):
| reg | адрес | значение | роль |
|-----|-------|----------|------|
| xmm8 | 1824c4140 (double) | 1.0 | множитель шага 1 = NO-OP при s888=1 |
| xmm13 | 1824c46a0 (double) | 1.0 | делитель бинов 1..n/2 (ИНВЕРСИЯ!) |
| xmm9 | xorps | 0.0 | обнуление верхних половин |
| xmm10 | 1824c4680 / 1824c3e28 | 1.0 / **0.8** | парный скаляр (0.8 активен в цикле) |
| xmm12 | 1824c3ea4 | 1.0 | парный скаляр 2 |
| xmm14 | 1824c4674 | 0.7 | (использование вне FIR) |
| xmm15 | 1824c4670 | 0.5 | (использование вне FIR) |
| xmm7 | вычисл. | sens·[540870]-цепочка | аргумент th2270 |
### СЛЕДСТВИЯ (меняют понимание построения кернела):
1. Перед EXP: бины 1..n/2 = log(bands) ⇒ после exp = **1/bands** (обратная
величина!), бины выше = exp(0)=1. Экспонента применяется НЕ к спектру маски
напрямую — вокруг неё twiddle-FMA стадии (ops B/C/D = радиальные проходы
FFT-класса над упакованным вещественным спектром; buf548 = cos/sin таблица,
mask598 = lane-select).
2. «×0.984» из 23d НЕ найден как константа цикла — либо внутри exp-IAT-обёртки,
либо следствие нормировки twiddle-стадий. Требуется численная репликация
пайплайна против живых захватов (rendersnap2 ph*.npz содержат готовые пары).
3. Шаг 1 и шаг ×s888 — no-op при дефолтных параметрах (s888=1, live 24j).
4. 52d920/52d990/52db50 = тонкие обёртки: 920→th2030/1d30 (scalar-op),
990→th2000/1c40 (axpy!), db50→то же. «УМНОЖЕНИЕ на окно» реализовано
axpy-кернелом, «деление» — scalar-op.
5. Ops A–D работают над дескрипторными векторами (проверка тега [obj]==6 в
4ca80; ошибка 0xfffffff3 при несоответствии).
### Динамика (попытки перехвата; окружение)
- realtime-playback НЕ тикает DSP (нет аудио-девайса; треды спят в futex);
кривые 22y = результат инициализации при загрузке проекта
- `-renderproject`: полный цикл init+render+exit хоста занимает ~0.8 c
(host@1.2s, workers@1.4s, wav@1.6s, exit@2.0s); обработка идёт в окне ~0.5 c
- INT3-ptrace: SEIZE+TRACECLONE обязательны до CONT (иначе untraced thread
ловит SIGTRAP и убивает процесс — подтверждено); DR-брейкпоинты: DR0@user+0x380,
но POKEUSER DR7 даёт EIO. Скрипты: fntrace*.py, fnhw.py, fnall.py, firstop.py,
firtrace.py, hotips.py (см. scripts/)
- Вывод: FUN_180529fe0 и 52d650/536300/52e260 НЕ ловятся в рендер-окне —
маск-цепь выполняется при ЗАГРУЗКЕ/изменении параметров, стационарный рендер
использует закэшированный кернел; либо трассировать надо момент инициализации
- Выход плагина НЕдетерминирован: md5 двух свободных рендеров различен при
одинаковом rms (PRNG-дизеринг из LCG-прологов) — метрика только спектральная!
## ДОПОЛНЕНИЕ 24t: ТОЧНЫЕ СЕМАНТИКИ СКАЛЯР-ОПОВ + опознание 563a60
Инструмент: scripts/disasm_func.py (полный дизасм функции с резолвом
RIP-констант инлайн).
### Тела скаляр-трансформов (float-ветки):
| стаб/impl | семантика | спец-случаи |
|---|---|---|
| th2030→ffe0 | dst[i] *= scalar | scalar==1 → скип; ==0 → zero-fill |
| th2270→14c40 | dst[i] += scalar | scalar==0 → скип |
Оба: скалярный хвост + AVX2 основной цикл (vmulps/vaddps ymm). Двойные
ветки (1d30/22a0) аналогичны на sd/pd.
### FUN_180563a60 = init-time ПОСТРОИТЕЛЬ таблицы (не per-bin!)
- Один caller: 1805636c2 (init-семейство).
- Константы пролога: xmm11=8.68589 (20/ln10 — ln⇒дБ!), xmm12=1/1024,
xmm14=0.5, xmm10=2, xmm9=1, xmm6=1; вызов IAT 181a14cd0 (log-класс)
над double из [obj+0x4198], ×8.68589 → дБ, запись пар во вектор
([obj+0xe0], рост через realloc 56c640).
- Вывод: строит дБ-доменную таблицу парами при param-rebuild — согласуется
с «LUT» ролью. Хвост с вирт. вызовом [rax+0x10] не декодирован.
### Алгебра T1: обе формы фитуют серию драйва (8 точек недоопределены)
- softplus α·ln1p(L/β)+c: rms 0.016 (α=3.2193 β=0.4927 c=0.542)
- LUT-форма t=((dBA)/(BA))^γ·M: rms 0.029 (A=36.2 B=20.0 γ=2.097 M=10.49)
Различить только декомпом тракта am/res→scratch или бОльшим числом точек.
### Открытые микровопросы
1. Значение xmm7 на входе th2270 в FIR-цикле (52b5f6): трассировка от
52a583; если mix^p=1 → «bands+=1» противоречит провалам ⇒ xmm7 иной
либо порядок аргументов иной.
2. Раскладка объекта-вектора (тег 6) для ops A–D.
## ДОПОЛНЕНИЕ 24u: WIN_WINDOW движка — кусочное окно аудио-пути
Таблица WIN_WINDOW[8193] (dsp/tables_data.hpp, live-захват):
- [0]=0.500000, плавный подъём до [2048]=0.800000, затем СКАЧОК до 1.0
и единица до конца ([2049..8192]).
- Длина перехода = РОВНО 2049 сэмплов = число бинов кернела (4096-сетка)!
- Формула перехода не каноническая (ханн/синус/степенные не сошлись,
maxdiff ≥0.09); для репликации достаточно встраивания таблицы как есть.
- Структура намекает: блок аудио 8192 сэмплов ({16384,8192} из cfg движка),
первые 2049 позиций получают взвешивание 0.5..0.8 (область «кернельного
взаимодействия»?), остальное прозрачно; 0.8 подозрительно = blend.
Проверка употребления — в resize fe00 / audio-клее (следующий раунд).
### Движок dc30: карта инициализаторов (24u)
ctor 18052dc30 вызывает: 5335c0 (×2 — до/после валидатора), 534550 (×5 —
регистрация конфиг-итемов, аргументы edx из стека [rsp+0x30..0x4c] =
цепочка {2,4096},{16384,8192},{2,257}), затем ILT-стабы 2240/1c10.
Следующий шаг декода: тела 534550/5335c0 + употребление WIN_WINDOW
(по xref на таблицу или указатель из объекта).
## ДОПОЛНЕНИЕ 24w-3: ЖИВЫЕ КОНСТАНТЫ ГЕНЕРАТОРА 533340 (параметры частотных IIR)
Из scalar-bank (rendersnap2 v4+) на дефолтных параметрах multi:
```
p (экспонента) = [ctx+0x54087c] = 1.000000
tau1 = [ctx+0x540894] = 1200.000122
tau2 = [ctx+0x540898] = 180.000015
mult (стадия-3) = DAT_1824c4564 = 360
C_hz = DAT_1824c459c = 1000
константы 530b60 : 0.7, 2, 800→(×2)=1600, 1200, 15, 9, 180, 0.01,
[540898]=180*p+xmm6 (формула видна в дизасме)
```
Формула тела подтверждена дизасмом: g=min(fc_norm/i,(fc_norm/i)^p);
c=1/(1+g*tau/mult); up=exp(...); down=1-up.
Эксперимент: одноразовый bidir с этими коэф. НЕ двигает центр кривой
⇒ q-зависимость катов не через эти IIR напрямую; тракт между main-loop
и scratch содержит ещё этапы (ops AD / steps 919 BLOCKMAP).
## ДОПОЛНЕНИЕ 24z: FUN_180563a60 ДЕКОДИРОВАН ПОЛНОСТЬЮ — ЭТО ДЕТЕКТОРНАЯ LUT-ФОРМА!
Постройка (на каждый банд, 1024 точки, вход double[+0x4198+i·8],
выход пары-floats в вектор [+0xe0], stride вектора 0x18):
```
dB = log(input) · 8.68589
idx = i / 1024 → store[2j]
t = (dB A) / (B A) ; A=[sub+0], B=[sub+4] (sub=obj@[rcx+0x180])
t = clamp(t, 0, 1)
если γ(=[sub+0xc]) ≠ 1:
если [sub+0x10]==0: out = t^γ (классика)
иначе : out = sign(2t1)·|2t1|^γ + 1 (симметричный режим!)
else: out = t
out *= 0.5 → store[2j+1]
```
Виртуальная альтернатива: [sub+0x90]!=0 → вызов [sub vtbl+0x10](A,B,dB)
с клампом [0,1].
⇒ ЭТО ТА САМАЯ ФОРМА, ЧТО ДАЛА ФИТ cut=LUT(A,B,γ,M)! Стадия компрессии
уровня найдена материально: A/B/γ живут в объекте [band+0x180],
заполняются сеттерами. Осталось: снять их live-значения для наших конфигов
(расширить scalar-dump на [ctx+0x180]-объект) и найти потребителя таблицы
(интерполятор dB→out) в аудио-тракте.
## ДОПОЛНЕНИЕ 24cc: точная формула коэф. 533340 (дизасм+live)
[state+8] = n = 2049 (∀ трёх состояний; live probe_states.py).
```
fc_norm = (X/(sr·0.5))·n ; X=xmm2 (C_hz=1000 или tau — уточнить)
g(i) = min(fc_norm/i, (fc_norm/i)^p) ; p=[ctx+0x54087c]=1 @defaults
c = 1/(1 + g/mult) ; mult=360 (стадия-3)
arg = |c| · g / n ← НАСЫЩАЮЩАЯ форма (пол g→mult/n)
up[i] = exp(arg · (2π)) ; down[i]=1up[i]
```
При дефолтах down ∈ [0.003..0.19] — очень мягкие сглаживатели; эффект
только каскадом в полной цепочке шагов 9–19.
Осталось уточнить: роль xmm13 (множитель перед c), знак/конст экспоненты,
соответствие X=C_hz-vs-tau.
## ДОПОЛНЕНИЕ 24ff: семантика шага 11 (fma att/rel) — тройки (re,im,coef)
Цепочка вызова: ee20 → 487a0 → 1065c0; воркер получает r10=n/2·12 байт
⇒ элементы по 12 байт = (dst_re f32, dst_im f32, coef f32).
Call-site (52ac7052acd4):
```
шаг 11a: fma(rcx=f6f8_upper, rdx=ATT@[5406c8], r8=ACC_i, r9=n/2)
шаг 11b: fma(rcx=f6f8_lower, rdx=REL@[5406e8], r8=ACC_i, r9=n/2)
```
⇒ семантика: f6f8[k] += coef[k]·ACC_i[k] (комплексный axpy с пер-биновым
скаляром), верхняя половина спектра — с ATTACK коэф., нижняя — с RELEASE.
ACC_i персистентен между кадрами ⇒ утечный интегратор: стационар
ACC = input/(1coef); усиление 1/(1att): @43=2.57 @85=2.93 @171=3.42.
Коэф. массивы СТАТИЧНЫ (∀ конфигов бит-в-бит — проверено dual/qmap/sens18).
Гипотеза: резонансное усиление ACC объясняет k>1 аномалии уровней
(q2: impl/ours=2.48 ≈ A(85)); точная алгебра подачи ACC в кривую — в
остатке шагов 13–19.
## ДОПОЛНЕНИЕ 24gg: шаг 12 — ЭТО КОПИЯ (исправление BLOCKMAP)
th1b80→6840→1a5a0→181a646c0 = ЧИСТЫЙ MEMCPY (vmovdqu без арифметики).
«acc_i += bands[i]» из старого BLOCKMAP — НЕВЕРНО; реально копия
(направление/роли rbx/rbp уточнить трассировкой регистров через цикл —
аргументы на 52acf8: rcx=rbx, rdx=rbp, r8=n; значения rbx/rbp меняются
через 52ac98 [0x5406e8] и др. — нужен полный dataflow-проход шагов 9–19).
Следствие: если acc_i не накапливается сложением, «резонансная» гипотеза
24ff требует пересмотра — возможно ACC обновляется через fma шага 11
(ACC входит как источник), а шаг 12 синхронизирует массивы.
### Статус декода шагов 9–19 (24ff+24gg)
- шаг 11: f6f8[k] += att/rel_coef[k]·ACC_i[k] ✓ (тройки re,im,coef)
- шаг 12: COPY (не add!) ✓ исправлено
- шаги 1316: th2270-add ветка с xmm6=xmm12[54087c]; bigkernel 140950;
axpy 2000/1c40 с vec@540778 — тела не декодированы
- полный dataflow-проход = задача следующего раунда (связная, ~сессия)
## ДОПОЛНЕНИЕ 24hh: DATAFLOW шагов 9–12 (точный, из дизасма)
```
шаг 9a: vec698 *= (xmm12 [54087c]) ; th1a00=MUL; при 11=0 → ZERO
шаг 9b: vec6f8 += 0.8 ; xmm10=0.8 ([1824c3e28]); th2270=ADD
шаг 9c: bigkernel 140b60(vec6f8, bands_curve_i, vec6f8)
шаг 10: vec6f8 = bands_curve_i ACC_i ; dc40: out[r8]=rdxr10 ✓COMBINE
шаг 11: f6f8_upper += ATT[k]·ACC_i[k] ; тройки re/im/coef
f6f8_lower += REL[k]·ACC_i[k]
шаг 12: COPY(...) ; направление уточнить
```
Регистры: rbx↔vec698/6f8/acc_i, rbp↔bands_curve/[5406e8], r14=vec6f8.
Картина: строится КОРРЕКЦИОННАЯ кривая (bands−ACC), модулированная
att/rel-огибающими ACC — адаптивная петля редукции.
Остаток прохода: шаги 13–19 + эпилог + связь с FIR-секцией (52b3cd+).
## ДОПОЛНЕНИЕ 24ii: семантики шагов 13–16 + ИСПРАВЛЕНИЕ th2000
th2000/fb60 (и 1c40/8700) = ПОЭЛЕМЕНТНОЕ УМНОЖЕНИЕ МАССИВОВ
(dst[k] *= src[k]) — НЕ axpy! Исправляет интерпретации:
```
шаг 13 (флаг≠0): зеркало шага 9 (vec698*=..., vec6f8+=0.8·..., bigkernel)
шаг 14: bands_curve += (1.0) ; константа [1824c4680]=1 через th2270!
затем bigkernel 1409e0/140ad0 IN-PLACE на bands_curve
шаг 15: bands_curve *= track_i ; th2000 array-multiply
шаг 16: bands_curve *= kWarp@[5406a8] ; th2000 array-multiply
шаг 17(флаг): bigkernel in-place ещё раз
```
Картинка: кривая центрируется (−1), проходит нелинейность (bigkernel,
вероятно exp/abs — тела за IAT), модулируется track и warp.
Против log-входа design'а значение после этих шагов должно быть >0.
### Bigkernel-тела за ВЛОЖЕННЫМ диспатчем
Таблицы стабов содержат смесь IAT-слотов и внутренних адресов (напр.
table[7]=140a00), но внутренние ведут к call runtime-helper + НОВЫЙ
ILT-стаб с собственной idx-ячейкой (паковка/протектор). Статическое
разворачивание обрывается. Тела bigkernel'ов (exp/abs-нелинейность шага
14/17) остаются за пакером — при необходимости снимаются дампом памяти
ВОКРУГ вызова в рантайме (STOP + чтение таблиц после инициализации).
## ДОПОЛНЕНИЕ 24jj: ТЕЛА BIGKERNEL'ОВ НАЙДЕНЫ (рантайм-резолв IAT)
iat_name.py v2 (SIGSTOP + двойной deref + PE-экспорты) резолвит:
```
стаб 140b30/140b60 → runtime 1803a06a0 (общий для float/double!)
стаб 1409e0 → runtime 180296c80
стаб 140ad0 → runtime 180323f20
стаб 140a40 → runtime 1802dc0e0
```
Все — НАСТОЯЩИЕ функции внутри дампа (не импорты!): большие стек-фреймы,
x87 FNU-контроль, AVX2 полиномы, ДВЕ x87-трансцендентные инструкции
(fyl2x/f2xm1 класс = 2^x/exp семейство). Полный декод математики каждого —
отдельная сессия; вход/выход уже известны из контекста вызовов
(in-place над n/2+1 элементами FIR-буфера).
## ДОПОЛНЕНИЕ 24jj2: R@540788 — БАНДПАС-ФОРМА, НЕ совпадающая с нашим twin!
Сравнение (multi6, band1=500/q0.5/s12):
```
бин R@540788 наш_res R/наш
43 0.802 0.117 6.84
85 1.086 0.374 2.91
171 1.517 0.839 1.81
342 3.521 1.401 2.51 ← ПИК ~3.5-4 кГц!
512 2.910 1.673 1.74
684 1.829 1.811 1.01
1024 1.146 1.931 0.59
1536 0.689 1.988 0.35
```
Наш twin res растёт монотонно от fc; R@788 — БАНДПАС с пиком ~bin300-342
(~3.5-4 кГц) и СПАДОМ к Найквисту. Форма напоминает кривую равной
громкости / слухового взвешивания!
R@5407f8 = единичная нормировка (все 1.0000 в этом прогоне).
### ГИПОТЕЗА (проверяемая):
Детекторный уровень = am · ВЕС(f) / res(f), где ВЕС — кривая типа
равной громкости (R@788?). Тест: X=am·R/res против катов multi6 —
НЕ сошлось лобово (X@43=1.44 макс при мин кате) ⇒ взвешивание входит
иначе (до/после res-деления, или в log-домене).
### Ценность
Объясняет ВСЕ аномалии дальних бинов разом: наши дальние res слишком
велики (нет спада), их lvl занижен, каты недобираются. Формула ВЕСА —
ключ к кросс-конфиг параметризации.
## ДОПОЛНЕНИЕ 24kk3: слот [ctx+0x540668] ПОЛИМОРФНЫЙ!
Прямой проб во время рендера: [ctx+0x540668] содержит
`3fdbcd8940000000` = ДВА FLOAT (~0.434, 2.0), НЕ указатель!
(пробник probe_668.py; EIO на части чтений — слот мигрирует).
### Следствия:
1. rendersnap2 пропускает слот 668 (ptr<0x10000 или мусорный ptr) ⇒
во ВСЕХ новых захватах (sc_multi4b, sc_tt*, sc_q*, ...) НЕТ FIR-массивов.
2. Старые захваты rendersnap.py v1 ИМЕЛИ валидный FIR-указатель в эти
моменты (ловили фазу обработки). Данные старых phase*.npz про FIR —
валидны для своих моментов, но смешивать с новыми нельзя.
3. Все «FIR mag» анализы через этот слот зависят от ТОГО, в какой фазе
слот был пойман: указатель-на-буфер vs скаляры vs сброс.
4. Значения скаляров (~0.43, 2.0) — кандидаты: att/rel? dry/wet? g-компоненты?
### Статус
Канонический путь чтения ПРИМЕНЁННОЙ маски: слот [ctx+0x540678] (кривая
банды) — он стабилен и МАТЧИТ АУДИО в deep-фазах (±5%).
## ДОПОЛНЕНИЕ 24mm2: ПОЛНАЯ РЕЗОЛЮВСЯ ВСЕХ 10 ЯДЕР + ИСПРАВЛЕНИЯ DATAFLOW
Инструмент: статический резолв цепочки стаб→таблица→L2→IAT-слот по
soothe_mem.bin (без live). Стаб = `movsxd rax,[idx@1826159a0]; lea r10,[tbl];
jmp [r10+rax*8]`, idx=4, L2=`mov rax,[slot]; jmp rax`.
### Таблица резолва (исправляет 24jj!)
| стаб | таблица | runtime | опознание по константам |
|------|---------|---------|------------------------|
| 140950 | 182617448 | **18026b820** | exp2/exp DOUBLE (ln2, log2e, 1021.5, 2^27) |
| 140980 | 182617488 | **18027c120** | **logf** FLOAT (ряд −½,+⅓,−¼,+⅕,−⅙; ln2 hi/lo; 2^32) |
| 1409b0 | 1826174c8 | **18028d1e0** | **powf/log+exp** DOUBLE (ряд log + магия expf вместе) |
| 1409e0 | 182617508 | 180296c80 ✓ | **expf** FLOAT — ДЕКОДИРОВАН ПОЛНОСТЬЮ (ниже) |
| 140a40 | 182617588 | 1802dc0e0 ✓ | exp-вариант FLOAT c hi/lo сплитами |
| 140aa0 | 182617608 | **18030fee0** | **sincos** DOUBLE (1/6,1/120,1/5040; π hi/lo) |
| 140ad0 | 182617648 | 180323f20 ✓ | кусочно-табличная DOUBLE (сетка Δ=0.00541521) |
| 140b00 | 182617688 | **180367980** | pow/exp DOUBLE (1023/1022, магия 1.5·2^20) |
| 140b30 | 1826176c8 | **1803831c0** | кусочно-табличная FLOAT (π/2, π/4, сетка 184.665!) |
| 140b60 | 182617708 | 1803a06a0 ✓ | **DIVIDE** FLOAT B/A (rcp+квантование+vpermps-таблицы+полином невязки) |
**ИСПРАВЛЕНИЕ 24jj**: «140b30/140b60 → общий 1803a06a0» — НЕВЕРНО.
FIR-секция вызывает 140b30 = 1803831c0 (табличная кривая), divide только в шаге 9c.
### ДИСПЕТЧЕР float/double
Каждый call-site имеет ПАРУ стабов через `call [181bab008]; test eax,eax; jne`:
float-стаб (eax==0) / double-стаб. Дескрипторы type_info СТАТИЧЕСКИ идентичны
(оба →182650db8) ⇒ eax=0 ⇒ **double-ядра мертвы на нашем пути**; рендеры
идут по float. Double-тела не транскрибируем (отмечено на будущее M8).
### expf 180296c80 — полная формула (горячий цикл, FMA-точно)
```
n = fma(log2e_hi=1.4427, x, MAGIC=12582912.0) ; округление до int
k = n MAGIC
r = (x 0.693146·k) 1.42861e-06·k ; ln2 hi/lo
p = (((0.00829172·r + 0.0418735)·r + 0.166674)·r + 0.499994)·r + 1)·r + 1
out = bits( (k<<23) + bits(p) ) ; vpaddd сборка
guard: |x|>87.3365 → slow-path; head/tail через vmaskmovps+popcnt-маски
```
Коэф. минимаксные — транскрибировать КАК ЕСТЬ.
### DIVIDE 1803a06a0 — структура (90%)
```
A=[rcx], B=[rdx], dst=[r8]; r9d=n
q0 = rcp(A); q0 += 2^23-magic (округление); q = q0 & 0xfff00000 ; 12 бит
e = (q>>23); idx = q>>20 → vpermps tbl@1821269c0 (127±ε) и @182126a00
err = 1 q·A
полином невязки {0.207515, 0.241687, 0.288535, 0.360671, ..., 0.240264, 0.0555119}
сборка через магию 1.5·2^20 + vpslld 20
результат ≈ B/A с точностью ~0.5 ulp
```
Таблицы коррекций сдамплены (per-mantissa-top-bits).
### ИСПРАВЛЕНИЯ DATAFLOW (по fn529fe0.dis, адреса call-sites)
1. **Шаг 14 порядок ОБРАТЕН к BLOCKMAP 24ii**: сначала `bigkernel exp IN-PLACE
на bands_curve` (52ae0e), ПОТОМ `bands_curve += (1.0)` (52ae40, конст.
1824c4680 через th2270).
2. Шаг 9b точно: `vec6f8 += [ctx+54087c] · 0.8` (xmm10=0.8@1824c3e28,
множитель виден в asm: mulss xmm6,xmm10 после movss xmm6,[54087c]).
3. Шаг 9a: `vec698 *= (xmm12=1.0 [54087c])` ⇒ zero-fill при дефолтах ✓.
4. Шаг 10 combine dc40: аргументы rcx=ACC_i(**таблица указателей @0x5407c8**,
НЕ дампилась rendersnap2!), rdx=bands_curve_i(@678+i), r8=vec6f8(@6f8),
семантика dst=r8: vec6f8 = bands_curve_i ACC_i. ACC-слот надо ДОБАВИТЬ
в SLOTS rendersnap2 (0x5407c8).
5. Шаги 15/16 подтверждены: th2000/th1c40 array-mul; затем rbx=[5406a8]
(kWarp) — array-mul на bands_curve.
6. Эпилог: скалярная часть из decomp (consumers_out 100-143): mix-веса,
`fVar17 = [540874] expf(DAT_1824c4704=-ln1000)` → bands += f17·[540888].
### Call-site карта больших ядер (fn529fe0)
```
52a63a/52a641: 140980(logf-float)/1409b0 — pre-combine #1
52ab84/52ab8b: 140b60(divide)/140950 — шаг 9c
52acd? : (шаги 1012 мелкие ILT)
52ae0e/52ae15: 1409e0(expf)/140ad0 — шаг 14 нелинейность
52b32c/52b336: 1409e0(expf)/140ad0 — шаг 17 (повтор)
52b3a0/52b3aa: 140a40(exp-var)/140b00 — пост-17
52b716/52b71d: 140b30(кривая-float)/140aa0 — FIR-секция
```
## ДОПОЛНЕНИЕ 24mm5: ПОЛНАЯ КАРТА ТРАКТА — буферы каждого шага; design = conv-тело 22z
### Полоса-цикл (float-путь), трасса регистров 52a580–52b3cd
```
пре: [678i] *= скаляры (s888-цепь, xmm7·[540870]·[54088c])
LOG#1 (140980!) на [678i] ; 52a63a — В ЛОГ-ДОМЕН заранее
combine 52d650([678i],[6f8])
шаг 9a: vec698@698 *= (1[54087c]) ; zero
шаг 9b: vec6f8@6f8 += [54087c]·0.8
шаг 9c: DIVIDE dst=[678i]: A=arg(rcx)=[678i], B=arg(rdx)=[6f8]
⇒ [678i] = vec6f8 / bands_curve ; in-place
шаг 10: dc40: rcx=ACC_i(@7c8+i!), rdx=[678i], r8=[6f8]
⇒ vec6f8 = bands_curve ACC_i ; ACC — таблица указателей 7c8
шаг 11: fma ATT(@6c8)/REL(@6e8) — пары вызовов 1fa0/1940
шаг 12: COPY 1b80/1d60 c [678i]
шаг 13: зеркало 9a/9b + оп 1eb0(cbe0)([678i],[6f8])
шаг 14: EXP#1 (1409e0=expf) на [678i]; затем += (1)
шаг 15: array-mul: X[rsp+0x40] *= [678i] ; НЕ bands*=track!
шаг 16: [678i] *= kWarp@[5406a8]
LOG#2 (140980) на [678i] ; 52aefd — возврат в лог!
IIR4 ×2 бидир ; ~52af0952b2b6, СПЕКТРАЛЬНОЕ
; СМЕШЕНИЕ В ЛОГ-ДОМЕНЕ
скаляры xmm14(0.7)/xmm15(0.5)-класс
шаг 17: EXP#2 (1409e0) на [678i]; += scalar; exp-var 140a40 финал
→ bands_final @678i
```
### FIR-секция (52b3cd52b94a)
```
bands_final *= s888, *= [540888]; += xmm7 (скаляр с expf(ln1000)=0.001)
DESIGN: call 535a70(rcx=scratch@628, rdx=bands)
535a70 = диспетчер СО СВОПОМ аргументов → ILT 140a10/140a70 →
→ РЕЗОЛВ: float=1802a24c0 (!!!), double=1802fa420
⚡ ЭТО ТЕЛО FFT-CONV ИЗ ОТКРЫТОГО ВОПРОСА 22z («conv_float_a24c0.dis»,
184K AVX2). Дизайн детектора == недекодированный conv. Пазл склеен.
дальше: copy th2210; complex-op th2180/th1bb0 с твидл-буферами
548/550/598; знак 1 (52d920); EXP 140b30(=1803831c0);
окно 52d990(WINfreq); pair-scalar 1880/1ca0; *= wet[540888];
финал df0(FIR, track_i)
```
### Где γ=1.760561
mask = bands_final^γ точно ⇒ γ возникает между scratch=log(bands_final)
и финальной маской: либо ВНУТРИ design 1802a24c0 (масштаб на выходе),
либо в комплекс-op цепочке 52b64452b716 перед EXP 140b30. Обе точки
локализованы до ~десятка инструкций — декод следующего раунда.
### Исправление понимания слотов
- 688 = exp(628) тривиально: 628 — копия лога bands_final (design),
688 — сами bands_final (или их exp-копия). «track» — имя рендерснапа.
- 678 ПОСЛЕ цикла = bands_final; применённая маска перезаписывает
поверх (финальный combine) — поэтому захваченный 678 матчит аудио.
## ДОПОЛНЕНИЕ 24mm6: ПЕРЕД EXP В FIR — УМНОЖЕНИЕ НА 2.0 (не −1!); гипотеза γ=2·k_design
### Точная последовательность 52b60c–52b720 (проверено, без пропусков)
```
rcx=[540628](scratch), rdx=[r15](источник design — уточнить r15!)
call 535a70 → swap → 1802a24c0(scratch ← DESIGN(src))
th2210: FIR(@540668) ← scratch (copy, edx=0)
opB: th2180(FIR, buf548|550, buf598) ; complex pass
FIR[n]=0
FIR[1 .. n/2] *= xmm13 = 2.0 @1824c41e0 ; 52d920, БЫЛО «−1» в 24l — НЕВЕРНО
FIR[n/2+1 .. n-1] *= xmm9 (=0) ; 52db50
opC: th1a90(FIR, buf548|550, buf598) ; complex pass
EXP in-place 140b30 (float) / 140aa0 (double)
```
xmm13/xmm9 не перезаписываются между 52b3d6 и использованием (проверено).
### Гипотеза источника γ
Если opB/opC сохраняют пропорциональность (упаковка real-FFT), то
mask = exp(2 · scratch) ⇒ γ = 2·k, где k — масштаб выхода design
1802a24c0 относительно ln(bands): k = 1.760561/2 = 0.8802805.
Альтернатива: k=1, а opB/opC суммарно дают множитель 0.88028.
### Открытые микровопросы (следующий раунд, всё локализовано)
1. Что такое [r15] на входе design (bands_final@678 или иной буфер)?
2. Семантика opB/opC (th2180/th1bb0/th1a90/th19d0 + твидлы 548/550/598)
— вероятно упаковка/развёртка real-FFT.
3. Масштаб выхода design: декод хвоста 1802a24c0 (файл уже есть:
nls_dasm/conv_float_a24c0.dis, 184K).
4. Согласование с identity-фазой захватов (гонка финального combine).
## ДОПОЛНЕНИЕ 24mm7: design выход = точный ln(bands_final); γ создаётся после design
### Численный тест (multi6/ph034, identity-фаза)
```
scr@628 ln(cur@678): max|r| = 9.0e-08 (float32 eps) на 1013 бинах
⇒ k_design = 1 (в момент захвата)
```
Оговорка: станционарность делает «свежий» и «сталый» scratch
неразличимы; но факт (scr, cur)=(лог, значение) одной пары твёрд.
### Следствие для γ
γ=1.760561 ≠ 2 ⇒ множитель НЕ только «×2 перед EXP». Источники:
(a) opB/opC не взаимно сокращаются (не чистая упаковка real-FFT);
(b) пост-exp шаги: окно 52d990 (варьируется по позиции — нарушил бы
степенной закон, значит действует на верхнюю половину/после),
pair-scalar th1880/th1ca0, финальный combine df0(FIR, track_i),
где track=exp(scr)=bands_final.
Комбинации дающие γ из {1,2}: 1+2x=1.760561 ⇒ x=0.3802805;
либо лог-доменное смешение track^a·FIR^b c a+2b=1.760561.
### Статус декода design 1802a24c0
AVX-512 (zmm, masked {k3}/{k4}), 3822 строки objdump — трансформ-класс.
Для замыкания γ его полный декод МОЖНО НЕ НУЖЕН: достаточно семантики
opB/opC + df0 (десятки инструкций в fn529fe0.dis).
## ДОПОЛНЕНИЕ 24mm8 (финал захода): opB/opC/df0 резолвлены
```
opB: 180002180→180004ca80(f)/18001d160(d) ; дескриптор-оп (тег [obj]==6)
opC: 180001a90→18001a0c0(f)/180018400(d)
df0: 18000df0→18000b3c0 ; f70→18000e360 ; финальный combine
```
Все четыре микровопроса 24mm6 закрыты или локализованы до тел-обёрток.
Следующий раунд: семантика 4ca80/1a0c0 (кандидаты источника γ=2k−масштаба),
затем полный numpy-конвейер.
## ДОПОЛНЕНИЕ 24mm9: opB/opC = RFFT-близнецы; df0 = complex-mul; цепь валидирована 0.0065 дБ
### Слой вызовов FIR-секции (уточнение поверх 24l/24mm6)
```
обёртки: th2180 impl=125e0, th1a90 impl=5560 — только перестановка аргументов:
воркер получает (rcx=data, rdx=data, r8=ПЛАН, r9=WORK), ин-плейс.
ПЛАН = [ctx+540548] (buf548!): tag=6 [+0], log2n=12 [+4], flag [+8]=0,
scale_flag=1 [+0xc], scale=2^-12 [+0x10], workbytes=16384 [+0x18].
WORK = [ctx+540598] — рабочая область FFT (заметение «lane-mask» из 23b).
th2180 → воркер 4ca80(f)/1d160(d): INVERSE real-RFFT (голова: X[0]±X[Nyq]).
th1a90 → воркер 1a0c0(f)/18400(d): FORWARD real-RFFT (хвост: пакинг Nyq).
тела: импортные близнецы 181b853e0(inv)/181b81b80(fwd); константы только
±0.707107; масштабов нет. ffe0 = ×scale pass (skip при scale∈{0,1}).
copy th2210 → 136e0 → 4d900(src,dst,n): pack re=v, im=0 (vunpcklps+zero).
df0 18000b3c0: ПОЭЛЕМЕНТНОЕ КОМПЛЕКСНОЕ УМНОЖЕНИЕ dst=[rdx]=arg2:
track_i := track_i ⊗ FIR (vfmaddsub213ps; f70/b560 — double версия).
EXP 140b30 → 1803831c0: полиномиальная комплексная exp (без таблиц значений):
magic 12582912 (=2^23·1.5), guard 87.33654, редукция 184.665≈128/ln2,
коэф. {0.01604,1.541667(=37/24), 3.166e-05, 1.008329, 1.65777e-06,
0.01932, 0.00134, 0.00541687, 10000, 4.19179}; AVX-512+FMA.
Численно = поточечный комплексный exp (flat-exp проигрывает 8 дБ).
```
### Полная последовательность (52b60c–52b893, все шаги, без пропусков)
```
design 535a70(scratch@628 ← ln(bands_i)) ; 52b62f, своп аргументов
copy 2210(scratch → FIR, 2049 пар (re,im=0)) ; 52b644
FIR[4096]=0 ; 52b685 Найквост ДО фолда
inv-RFFT opA ; 52b672 th2180
fold: float[1..2047]*=2.0 (xmm13@1824c41e0) ; 52d920
float[2049..4095]=0 ; 52db50
fwd-RFFT opB ; 52b6e1 th1a90
EXP in-place, аргумент×q (q≈0.80, источник ОТКРЫТ); 52b716
inv-RFFT opC ; 52b74b th2180
FIR[4096]=0 ; 52b76d
float[0..2047]*=WINfreq[2048..4095] ; 52d990 (падающий Hann)
float[2048..4095]=0 ; 52db50
fwd-RFFT opD ; 52b7ba th1a90
FIR[0]=1.0f; FIR[1]=0 ; 52b7cd
(flag f890≠0: pair-scalars 1880/ca0 — live мертво)
th2030(FIR, wet=s888, 2n float) ; 52b857, s888=1 no-op
df0(FIR, track_i, n): track_i := track_i ⊗ FIR ; 52b893
```
Смысл: классическое минимально-фазовое ядро через кепстр
(IDFT лога → фолдинг ×2 причинной части + усечение → exp → обратный ход).
### Валидация и γ
mask_sim = trk·|F(q)|: 60 ультрачистых кадров, ВСЕ 2049 бина:
rms мед 0.0065 дБ / p90 0.0075 / max 0.035 при q=0.80 (порог 0.05 ✓).
γ = 1 + s_F(q), s_F = наклон log|F| по log trk в нотче: q=0.8 ⇒ γ_pred=1.7516
(точный 1.760561). Открыто: место q в асме (внутренность 1803831c0);
unicorn не эмулирует FMA ⇒ нужен статдекод ядра или live-захват входа EXP.
Дизасмы: /tmp/opencode/cascade/{wrapA_125e0,wrapB_5560,opB_4ca80,opC_1a0c0,
df0_b3c0,h_ffe0,h_136e0*,imp_b8*3e0_full,bk_1803831c0}.dis
(*copy: python3 scripts/disasm_func.py 1800136e0 — ВАЖНО: полный VA,
короткая форма «125e0» даёт пустой файл!).
+74
View File
@@ -0,0 +1,74 @@
# PROMPT FOR NEXT SESSION (2026-08-25, после 24kk2)
Продолжаем bit-exact реверс soothe2 в /home/m/re-tools (ветка main).
ГЕЙТ СМЕНЫ КАНОНА = BIT EXACT (решение пользователя): все параметры
прослежены до декомпа + корпус в шумовом пол. До тех пор канон не трогаем.
ПРОЧИТАТЬ ПЕРВЫМ: AGENTS.md (фаза-заголовок 24kk2 + env-флаги + инструменты)
→ handoff/NOTES_LEVEL.md обновления 24j24kk2 → BLOCKMAP_529fe0.md
(дополнения 23b/24l/24hh/24ii).
## СОСТОЯНИЕ
ПРИМЕНЕНИЕ ДЕКОДИРОВАНО ДО ФОРМУЛ:
```
mask(b) = 10^(cut_D(b)/20) вещественная, per-bin multiply кадра
cut_D(b) = α·ln1p(lvl_raw(b)/β)+c [+Δ вторые пики]
lvl_raw = am/res·scale наш фронтенд, float-parity ✓
слой = STFT БЕЗ синтез-окна RT_SYN=1
```
Калибровки (rms ≤0.016 дБ):
```
dual fc500 q0.5 s12 ДВА тона : α=3.2193 β=0.4927 c=+0.54
fc1000 q0.5 s12 ОДИН тон : α=1.6151 β=0.3645 c=+0.48
fc500 q0.5 s12 ОДИН тон : α=1.1530 β=0.4038 c=+0.33
```
Корпус: dual **0.193 max 0.438** с флагами `RT_VLAW=1 RT_SYN=1 RT_NOWARP=1
RT_NOIIR3=1 RT_IIR12=0`. Канон TOTAL 2.286 нетронут.
ОТЗЫВАНО И НЕ ВОЗВРАЩАТЬСЯ: ×1.805-свёртка [23e], OLA-нормировка [24i],
двухстадийный γ₀ как множитель закона [24m — это артефакт двух тонов],
клампы параметров [24dd], B∝am [24bb], axpy-семантика th2000 [24ii — это
array-multiply], «acc_i += bands[i]» шага 12 [24gg — это COPY].
## ЗАДАЧА №1: каскадный симулятор шагов 9–19 (оп-за-опом)
Dataflow декодирован (BLOCKMAP 24hh/24ii):
```
vec698 *= (xmm12[54087c]) ; обнуление при дефолтах
vec6f8 += 0.8 ; базовая линия
bigkernel(vec6f8, bands_i, vec6f8)
vec6f8 = bands_curve ACC_i ; COMBINE (dc40: out=rdxr10)
f6f8_верх += ATT[k]·ACC[k]; низ += REL[k]·ACC[k] ; тройки re/im/coef
COPY(...) ; шаг 12 = memcpy!
bands += (1.0); bigkernel in-place ; центрирование+нелинейность
bands *= track_i; bands *= kWarp ; th2000 = array-multiply
IIR4 ×2; финальные scale/op
→ bands[i] → design log → scratch → FIR → audio multiply exp(scratch)
```
Тела bigkernel'ов по рантайм-адресам: 1803a06a0/180296c80/180323f20/1802dc0e0
(x87 exp-семейство). Коэффициенты IIR-генератора 533340 исправлены
(насыщающая форма arg=|c|·g/n; p=[54087c]=1, mult=360, C=1000).
Метод проверки: собрать симулятор в Python (numpy), прогнать lvl_raw из
tract_* через каскад, сравнить с deepest-scratch кривыми sc_* — rms < 0.05 дБ
= замкнулось. Затем перенос в C++.
## ЗАДАЧА №2: параметризация α(контент)/fc
α удваивается с числом тонов (частотное смешение шаблонно-локальное —
далёкий тон не влияет, 24ll). Инструмент: scripts/campaign.py (ячейка ≈8 мин).
Двухтональная дистанционная серия уже снята (sc_d*, инверсия не сошлась —
нужен каскад из Задачи №1 сначала!).
## СРЕДА (грабли, всё проверено болью)
- rendersnap2.py: RENDER_FILE брать ИЗ rpp (клоны наследуют путь — однажды
перезаписали реф); каталоги снапов задавать уникальные (argv[3]).
- touch+mtime перед каждым замером (same-second cmake hazard).
- tone1k.wav громче dual.wav в 2.28× — при сравнении серий учитывать.
- Свип НЕ годится для Y/X-отношения; только мультитон/мультиуровень.
- Динамика V(t)↔g(t) на рампе не сходится — пары только из стационара.
- HW-ловушки под wine невозможны (wine держит слоты); INT3 требует
дисциплины fnwatch4 и ГАРАНТИРОВАННО свежего рендера.
- Метрика только честная: render_parity.load / Гёрцель последних 0.75 c.
- Коммитить подшагами; факты → NOTES_LEVEL (очередной номер 24ll+).
+44
View File
@@ -0,0 +1,44 @@
# Runtime capture — live DSP tables (registry heartbeat, SR 48000)
> **Сжато 2026-08-28.** Полный журнал 2026-08-19—2026-08-23 → [`handoff/archive/NOTES_LEVEL_2026-08-18_2026-08-23.md`](archive/NOTES_LEVEL_2026-08-18_2026-08-23.md) + [`handoff/NOTES_LEVEL_INDEX.md`](NOTES_LEVEL_INDEX.md). Детали FIR-цепи → `handoff/BLOCKMAP_529fe0.md`.
## Registry heartbeat
Heap run `{u64 count, u64 ptr}` stride 0x10, base `0x29b06c0` (anon 0x2922000) — офлайн, `0x28b06c0` — GUI (сдвиг ареной). Поиск: скан `u64==8193` + readable ptr, требовать run `count/ptr` stride 0x10. Надёжный beacon (vptr/44100-marker — тупик).
## Captured tables (SR=44100 project → internal freq-axis 48000)
| idx | count | content |
|-----|-------|---------|
| [00] | 8193 | identity ~1.0 |
| [01] | 8193 | **WIN_freq 0.5→1.0** (idx1024 0.68, idx2048 0.8) = live `0x540658` |
| [03] | 8193 | **0.596→0.126** = `rwin_C0` (byte-identical GUI) |
| [04] | 8193 | 0.404→0.874 = 1[03] |
| [05] | 8193 | 0.0435→~0 |
| [06] | 8193 | 0.9565→~1.0 |
| [0d] | 2049 | **freq-axis 0..23988.3 Hz, 11.713 = 48000/4096** → internal SR 48000 |
| others | 8193/16384 | опоры, FFT-планы |
**Проверка:** `[03]` head 0.5960761 byte-identical GUI — registry authoritative. **Freq-axis spacing 11.713 ⇒ internal SR 48000** независимо от проекта 44100.
## Files saved
- `handoff/rtwin_freq_44100.npy` — WIN_freq 8193 f32 (live 0x540658)
- `handoff/rtfreqaxis_48000_internal.npy` — 2048 f32
- `handoff/rtwa_596.npy`, `rtwb_404.npy`, `rtwc_043.npy`, `rtwd_956.npy` — [03][06]
- Raw snapshot: `/tmp/snap_all.bin` (318MB, chunked 8MB pread — иначе EIO)
## Method (repro)
- `rtsnap_fast.py`: spawn `reaper -renderproject render_long`, find host `soothe2` in maps, sleep 6s, chunked pread ALL → `snap_all.bin`. Scan 0.1s/318MB.
- `rtsnap2.py`: two-point diff — registry byte-identical (stable).
- Live ctx `0x2370040` (`+0x24==48000`, `sens>100`) — единственный populated, остальные empty. `handoff/rtctx_live.json`.
## Live ctx (realtime playback, `rtctx_live.json`)
- Pointers `0x540688` identity, `0x540698` window, `0x5406b8/c8/d8/e8` WA/B/C/D, `0x540748` warp, `0x540758` freqaxis (`v85=995.6 Hz`).
- Scalars: `0x540870=440.955`, `0x540880=25.0`, `0x540884=10.0`, `0x540888/88c=1.0`, `0x54087c=1.0/10.0` (selectivity/sharpness).
- `acc/f6f8` arrays **zero** в стационаре playback — combine idle.
- Bands curve `R=1/mask` peak следует fc (bin43@500 → bin85@1000), `0x5407f8` min 1.0. Применённый фильтр ≠ pointwise копия R (нужен FFT-conv).
Дальше — `handoff/NOTES_LEVEL.md:24mm11+` (live ptrace) + `handoff/BLOCKMAP_529fe0.md`.
+491 -543
View File
File diff suppressed because it is too large Load Diff
+46
View File
@@ -0,0 +1,46 @@
# NOTES_LEVEL — оглавление журнала
> **Навигатор:** `NOTES_LEVEL.md` — живая голова (25a+, 2026-09-02, ~470 строк). Архив 2026-08-18—2026-08-23 → [`handoff/archive/NOTES_LEVEL_2026-08-18_2026-08-23.md`](archive/NOTES_LEVEL_2026-08-18_2026-08-23.md) (4024 строки). Статус TOTAL → [`README.md:13`](../README.md).
## Живая голова (`handoff/NOTES_LEVEL.md`)
| Дата | Заголовок | Суть |
|------|-----------|------|
| 24mm524mm7 | Полная буферная карта, DESIGN 1802a24c0 | Два круга log→exp, bidir×2 в лог-домене |
| 24mm8-бис | Точка входа следующего раунда | opB 18004ca80, поиск γ |
| 24mm9 | FIR-цепь MIN-PHASE, 0.0065 dB | Цепь 52b60c+, RFFT близнецы, df0 complex-mul, валидация |
| 24mm10 | EXP ядро полностью, парадокс q | Формула 1803831c0, нормировки s_f/s_i=1 |
| 24mm10-бис | Итог близнецов radix-4 | INV/FWD 2048, твидлы 548, без масштабов |
| 24mm11 | LIVE ptrace, цепь до df0 бит-точна | wine_ptrace_trace, Y_model=1.0, df0 complex-mul |
| 24mm12 | Детекторный каскад vt+0x28=180529c60 | Оркестратор 5300f0, vtable карта, 0x281 байт |
| 24mm13 (+доп) | Хелперы каскада 529c60 | 5355d0→16140, 530080, 20f0/1850/1a00, рекуррентия Haar |
| 24mm14 | Каскад декодирован — 3 фазы | `|z|` → Haar×2 → peak/sin/w/blend 5407a8 |
| 25a (2026-09-02) | chain_9_19 staged, IIR4-генератор, k-mapping dedup, аудит | IIR4 double (movsd), generate_iir4_coefs, RT_CASC/RT_IIR4_GEN gates, baseline 2.689 |
## Архив (`handoff/archive/NOTES_LEVEL_2026-08-18_2026-08-23.md`) — по периодам
| Период | Ключевые темы | Где |
|--------|---------------|-----|
| 2026-08-18 | Две twin-цепочки, FUN_180563440/563ce0, 530d30 веса, FUN_180529fe0 consumer, 0x530d30 NEGATIVE, bridge B.12 | строки 1300 |
| 2026-08-18h2h3 | Runtime capture, поле 0x540658, registry 0x28b06c0/0x29b06c0, window 0.5→0.8, freq-axis 48000 | 475580 |
| 2026-08-19 | LUT-leg joint fit, level-tracker, decomp lock, registry heartbeat, P4 mask-chain, SR mismatch | 580900 |
| 2026-08-20ix | P2 kernels 8d60/3c40, twin-mask, F0 gate determinism, parametric LUT benches, wrappers | 9001100 |
| 2026-08-21bd | IIR3 bidir, combine scope, structural corpus 2.286, reduction-law affine, Phase A | 11001360 |
| 2026-08-22af | Phase B refuted, Step7 GUI-only, param bridge, floor 20.72 blend·ln10/20 | 13601600 |
| 2026-08-22gp | NO-LUT, white-noise probe, bare chain, pool/scale/floor, joint-fit, dual diag, affine port | 16001970 |
| 2026-08-23a–z | Скалярный закон насыщен, 529fe0 по raw asm, faithful-цепь, теорема α, спрединг отвергнут | 1970–2300 |
| 24j–24ab | Применение декодировано: A=1.019·V^1.8345, FIR=exp(scratch), двухстадийность γ₀=1.79 | 27503550 |
| 24bb24kk3 | k-маппинг, q-независимость, далёкий тон локально, дистанционная серия, симулятор не замкнулся | 3550–4000 |
| 24ll24mm4 | multi6, g_k пер-пиковый, archive закрытие, γ=1.760561, точ. законы отвергнуты | 4000–4024 |
## Как читать
1. **Старт:** `README.md:13` (статус) → `AGENTS.md` (runbook) → `BITEXACT_PLAN.md:1` (3 шага) → этот индекс → `handoff/BLOCKMAP_529fe0.md`.
2. **Детали по теме:** `rg -n "24mm9\|Q-НЕЗАВИСИМОСТЬ\|Haar"` в соответствующем файле.
3. **Полный поиск:** `rg -n "cut_D\|lvl_raw\|5407c8" handoff/archive/NOTES_LEVEL_2026-08-18_2026-08-23.md handoff/NOTES_LEVEL.md`.
## Дубли устранены
- `UPDATE 2026-08-22g` дубль (строки 1577/1591 в архиве) — логически один.
- `UPDATE 2026-08-20s` дубль (974/977) — один.
- Заголовки унифицированы: `## ============ UPDATE``##` в живой голове; архив сохранён как есть для истории.
+23 -70
View File
@@ -1,76 +1,29 @@
# Twin FUN_180535880 transcription (Phase 2) # Twin FUN_180535880 — краткая справка (детали → `dsp/twin.cpp`)
## PHASE-3 CALLER + GRID (2026-08-18) > **Статус:** транскрибирован, gate PASS `dsp/build/twin_check` max rel err 1.27e-5 (float-parity). Полный журнал 2026-08-18 → [`handoff/archive/NOTES_LEVEL_2026-08-18_2026-08-23.md`](archive/NOTES_LEVEL_2026-08-18_2026-08-23.md) + [`handoff/NOTES_LEVEL_INDEX.md`](NOTES_LEVEL_INDEX.md).
- Caller FUN_180536300 (decomp 6218 / sp_180536300.txt) decoded at buffer level:
- params: param_1=top DSP, param_2=out, param_3=?, param_4=band obj, param_5=cell count,
param_7=scratch (>=52*N bytes complex).
- scratch: +0..8N A-accum, +8N..16N B-accum, +16N..24N z-powers, +24N..32N rotor-in
(fill 1.0), +32N..36N phase ramp lVar1, +36N..44N rotor-out z1 (r14), +44N..52N
lVar3(1.0)/lVar4(0.0) for interleave+negate+exp build.
- 0x18052da00(lVar1, scale=2pi/(iVar7*sr), N) = ramp fill (float, via 0x180001a00);
- twin always = FUN_180535880 (type-info compare of same addr -> equal);
sibling FUN_180536f90 is dead.
- 0x18052dbc0(param_2, lVar4, N) = cplx interleave -> out=(cos,sin)=e^{+i theta}.
- GRID LAW (verified from trace.txt case8 + constructor):
- os = *(int*)(param_1+0x240080) = 4 (written 0x18052ce3e `mov ...,0x4`)
- sr = *(float*)(param_1+0x24) = 44100.0
- fs_total (generator) = os*sr = 176400 => resonance shape f/fc invariant to fs.
- per-cell phase step = 2*pi/(os*sr); cell k <-> freq = k/os Hz (0.25 Hz steps).
- Phase-1 model FS=44100 was a valid normalization (res(f) depends only on f/fc).
- case8 generator call (trace 33361..33490, switchD_1805318ab):
- +0x814 numBands = 1, +0x103 mode flag = 1
- param_5 (float, xmm4) = 10^(sens_dB/20) (pow10 10.0^([band+0x101]/20.0))
- gain = sqrtf(param_5) = 10^(sens_dB/40); model fit gain=4.132 => sens_dB@0x101 ~= 24.65
- freq = [band+0x804], Q = [band+0x80c], fs_total = os*sr (w0 = max(fc,2)*2pi/fs_total)
## PHASE-2 GATE: PASSED (2026-08-18) ## PHASE-3 Caller + Grid
- `dsp/twin.hpp` + `dsp/twin.cpp` written: build_twin_coeff (FUN_180533ec0 double pipeline
-> cvtpd2ps), cplx_div_exact (0x181a77520: mulps |A|^2, rcpps + Newton, NaN guard),
cplx_mul_exact (0x18000ad60 scalar body @0x18000ae00: vfmaddsub213ps form),
twin_apply (seed A0/B0 + 2 vfmadd213ss Horner stages + 2*div).
- twin_check gate: fc-scan grid (7 fc, Q=0.9999978, gain=4.132, tone 1000 Hz)
max |rel err| = 1.27e-5 vs double reference res_at (float rcpps parity).
DUAL sweep (Q=0.1..10 x tones 500/2000, fc=500) max = 1.23e-5. Both PASS.
- Constants locked: A1 = B1 = cos(w0)*-2.0, z1 = conj(exp(+i*theta)),
z2 = cplx_mul(z1,z1), out = 2*B/A.
## Confirmed scalar math (from generator + cplx-div kernels) - Caller `FUN_180536300` (6218): scratch 52·N, `0x18052da00` ramp `2π/(os·sr)`, `0x18052dbc0` interleave `e^{+iθ}`. Twin всегда `180535880`, sibling `180536f90` dead.
- Generator FUN_180533ec0 (per band, case8): - Grid: `os=4` (`+0x240080`), `sr=44100` (`+0x24`), `fs_total=176400`, `phase=2π/176400`, cell `k ↔ k/4 Hz` (0.25 Hz).
`fVar1 = sqrtf(param_5)` (param_5 = pow(10, sens/20) via cd6 IAT stub) - case8: `+0x814=1`, `+0x103=1`, `param_5=10^(sens/20)`, `gain=√param_5=10^(sens/40)` → fit 4.132 ⇒ `sens≈24.65 dB`.
`w0 = max(2.0, freq)*2*pi / fs_total` (fs_total = 2*FS frame?)
`p = sin(w0)*0.5 / Q`
`dVar5 = p*fVar1` (A tap), `param_4 = p/fVar1` (B tap)
A = [1+dVar5, dVar2, 1-dVar5], B = [1+param_4, dVar2, 1-param_4]
where dVar2 = cos(w0) * DAT_1824c46b0 (=-2.0? VERIFY)
- Twin FUN_180535880: for each FFT bin z (rotor):
`res(z) = 2 * B(z) / A(z)`, B(z)=B0+B1*z+B2*z^2, A(z)=A0+A1*z+A2*z^2
implemented as complex FMA accumulation over 3 taps:
r15 (A-accum) and r12 (B-accum) via 0x180001fd0 vfmadd213ss (coeff [rsp+k*4+0x28]=A_k, [+0x38]=B_k)
rbp buffer = z powers via rotor ops (0x1800019a0 fill / 0x1800021e0 / 0x1800018b0 / 0x180001af0 / 0x180001dc0)
final 0x180001e20 -> 0x181a775a0 cplx-div: out = 2*B/A (xmm7=0x40000000=2.0, xmm6=NaN guard)
- cplx-div kernel 0x181a77520: |A|^2 via shufps 0x88/0xdd, rcpps + 1 Newton step (xmm7=2.0), NaN guard via cmpeqps.
Matches rotor_kernel.hpp cplx-div exactly.
## Dispatch (all stubs share global 0x1826159a0 = 4 = AVX2) ## PHASE-2 Gate
0x180001d00 -> 0x180009860 -> 0x180040d40 (cplx fill const, NT stores)
0x1800019a0 -> 0x180004200 (float fill -> 0x181a63fe0)
0x1800021e0 -> 0x1800130e0 (large AVX, 0x450 stack, rotor/exp?)
0x1800018b0 -> 0x180003040 (-> 0x181a557c0)
0x180001af0 -> 0x180005a20 (loop -> 0x18001a5a0)
0x180001dc0 -> 0x18000ad60 (cplx op r14*rbp)
0x180001e20 -> 0x18000b820 (-> 0x181a775a0 cplx-div 2B/A)
0x180001fd0 -> 0x18000f620 (vfmadd213ss: out = src*coeff + dst)
## Coefficient layout in twin (param_3 = {double A[3], double B[3]}) - `dsp/twin.cpp`: `build_twin_coeff` (FUN_180533ec0), `cplx_div_exact` (rcpps+Newton), `cplx_mul_exact` (vfmaddsub), `twin_apply` `2·B/A`.
stack: +0x28=A0 +0x2c=A1 +0x30=A2 | +0x38=B0 +0x3c=B1 +0x40=B2 - Gate: fc-scan 7fc + dual Q0.1..10 PASS.
loop k=0..2 uses A_k via [rsp+k*4+0x28], B_k via [rsp+k*4+0x38]
r15 = out A-accum, r12 = out B-accum, rbp = z^1..z^2 buffer, r14 = rotor(z) input
## PHASE-1 LOCK (empirical, 36 points, LUT chain B.11) ## Scalar math
Effective sqrtf(param_5) needed ~= 4.13 (NOT 1.995).
=> param_5 ~= 17.07 = 10^(1.2325) => internal sens_stored ~= 24.65 dB (not XML 12.0) - Generator: `fVar1=√param_5`, `w0=max(2,freq)·2π/fs_total`, `p=sin(w0)·0.5/Q`, `A=[1+p·fVar1, 2cos w0, 1p·fVar1]`, `B=[1+p/fVar1, 2cos w0, 1p/fVar1]`.
OR equivalent. RULED OUT: sqrt(10^(12/20))=1.995 (rmse 1.38/5.68); - Twin: `res(z)=2·B(z)/A(z)`, Horner `0x180001fd0`, `cplx-div 0x181a77520`, `z2=z1·z1`.
10^(12/20)=3.981 direct (t1kq 0.056 but t1k 0.934); |2B/A|^2 (1.5/6.6).
Sens setters (0x18053795d, 0x18056f002) both store RAW value; +0x808 scaling is HOST-side ## Dispatch
(plugin controller, outside dump) => must be resolved via bit-exact render or host trace.
NOTE: single-gain compromise 4.132; t1kq wants 4.055, t1k wants 4.137 (tilt residual). Стабы → `0x1826159a0=4` (AVX2). Layout `param_3={A[3],B[3]}` `+0x28/+0x38`, coeff `[rsp+k*4]`.
## PHASE-1 lock
`√param_5≈4.13` (не 1.995), `sens≈24.65 dB` (host ×2 над XML 12.0). Setter `+0x808` host-side.
Детали декомпа — `handoff/nls_dasm/twin*.dis`, `dsp/twin.cpp:27`.
+6 -252
View File
@@ -1,254 +1,8 @@
# SESSION HANDOFF — soothe2 detector reverse → bit-exact render # SESSION_HANDOFF — перенесён в архив
Prepared: 2026-08-18 (checkpoint end-of-session: commits c8f97e4 + 60bf3a2 pushed). Start: READ THIS FIRST. > **Исторический чекпоинт 2026-08-18 (коммиты c8f97e4+60bf3a2).**
> Актуально: декомп DSP-ядра ~95% закрыт, `FUN_180529fe0` mono-path, `FUN_180563440/563ce0/563a60` расшифрованы, дизассемблы в `handoff/nls_dasm/` (134 файла).
> Полный текст сохранён: [`handoff/archive/SESSION_HANDOFF_2026-08-18.md`](archive/SESSION_HANDOFF_2026-08-18.md) (256 строк, инвентарь декомпа §0, ключевые адреса §2, Phase-5 план §6).
> Навигация → [`handoff/NOTES_LEVEL_INDEX.md`](NOTES_LEVEL_INDEX.md) + [`handoff/BLOCKMAP_529fe0.md`](BLOCKMAP_529fe0.md) + [`README.md:13`](../README.md).
## 0. DECOMPILATION INVENTORY (2026-08-19 — what's decoded, where, and what's missing) Кратко: `decomp_funs.txt` 312K строк, RTTI `rtti_dsp.json`, bridge `C=g·LUT+w·warp^a` (rmse 0.236, позже заменён VLAW). Для продолжения читать `AGENTS.md``NOTES_LEVEL_INDEX.md`.
Goal: bit-exact parity is gated by EXACT tables/window/constants. The chunk-level model hits
err ≤0.62 dB (dual) / ≤0.19 dB (al_*) — to go sample-exact we need precise values from the binary.
### Static decomp assets IN REPO (use these, don't re-decompile):
- `ghidra-proj/soothe2.rep` — full Ghidra project (vst3 at ImageBase 0x180000000).
- `decomp_funs.txt` (312K lines, ~1640 functions), `fun_map.txt` (2285 addr→FUN), `consts.txt` (11602),
`decomp_dsp.txt` / `decomp_vtables.txt` / `decomp_candidates.txt` / `focus_decomp.txt`. Generators:
`Dump*.java`, `ImportRtti*.java`, `ListFuns.java`, `SearchRefs.java` (+ headless logs).
- RTTI: `rtti_dsp.json` / `rtti_full.json` — class hierarchy
`SpectralProcessor<float,7,1>`, `Soothe2ModuleBase<float,1>`, `FilterGraph<float,6,0x400>`,
`DigitalFilter<float,0xBA,1>`, `IIRFilterExtended<float,1>`, `AudioProcessingModule<float,1>`.
- `handoff/nls_dasm/` — 120 hand-picked `.dis` (twin, iface_18052da00/dbc0, fft, generator, ctor).
- `dsp/` — working C++ transcription (twin, detect, freqpath, spectral, fft_stage) + harness;
`build/twin_check` passes float-parity gate (§2).
### KEY DSP ADDRESSES — decoded / not decoded:
DECODED (formula-level, notes at NOTES_TWIN.md / NOTES_LEVEL.md):
- twin kernel `FUN_180535880`; generator `FUN_180533ec0`; caller `FUN_180536300`; dead sibling `180536f90`.
- level-weight formula `FUN_180530d30` (0x540880/884, warp 0x5406a8=0.87·x/(1+x/7.942), w=0.1^(...)).
- mask-apply entry `FUN_180529fe0` (accumulator 0x5407c8 += w·res; mask *= warp; FIR *= 0x540658).
- FFT-conv loop 0x52b550-0x52b8b5 (plan 0x540530, windows 0x540548/550/598, freq-axis 0x540698=offline const).
- level-path map: `0x563440` (LUT curve +0x188, 6 band-slots, combine→+0x2198), `0x56e3e0` (twin-mask factory),
`0x563ce0` (IIR level-tracker INIT only).
NOT DECODED / MISSING FROM decomp_funs.txt (critical):
- `FUN_180529fe0` body — mask/fir apply; only reachable via runtime + vtable slot `180529fe0` in fun_map.txt.
- `FUN_180563440` (LUT curve + gamma + combine), `FUN_180563ce0` (IIR level-tracker UPDATE loop).
Full disasms exist ONLY in `/tmp/opencode/f_563440.dis`, `f_563ce0.dis`, `f529fe0.dis`**/tmp is
ephemeral; COPY INTO handoff/nls_dasm/ on next session start.**
- Window `0x540658` (single indirect write — statically invisible); live-captured copies saved as
`rwin_A0/A1/B0/C0.npy` + `r_freqaxis.npy` (see NOTES_LEVEL.md §2026-08-18h3). Live data at SR=48000
(offline renders 44100 → renormalize warp x by actual Nyquist).
- sens source: XML 12.0 → runtime sens_dB≈24.65 (host ×2) not found in dump; `IAT\*0x181bab370` outside dump.
### Bridge model STATUS (2026-08-19):
- `framed_render.py` full STFT frame-render (N=2048, hop=512, sqrt-Hann, twin env tatt=11ms/trel=80ms):
`C(f)=G·LUT(xv)+W·warp(f)^A`, G=1.0850, W=0.2819, A=1.1377 (joint dual+al_* refit).
- Validation: dual q0.1/1/10 @500+2000 err ≤0.62 dB, envRmse@steady ≤0.78 dB; al_* lv3..24 err ≤0.19 dB.
- LUT = slanted al_*-leg (0.366@xv=-0.50 → 0.636@xv=+0.55), replaces flat B.12 (~0.5). Bugfix: clip range
must be [LY.min(), LY.max()] not [LY[0], LY[-1]].
- Remaining structural residual: 0.6 dB systematic on dual 500Hz (q0.1/q1). Live evidence (avg per-bin
gain H=|Y|/|X|): reference mask is FLAT ~-10.2dB across 100-540Hz regardless of Q — model produces
res-shaped notch. Hypo tested: freq-smoothing of C(f) fails (kills 2000Hz). NEXT: scalar per-frame xv
(broadband level, not per-bin am/res) — see /tmp/smoothtest.py (+ edit scalar=True).
## 1. Objective (unchanged since session 1)
Transcribe the decoded soothe2 detector ("twins" 0x180535880/0x180536f90, 2nd-order resonator) into
C++ and reach **bit-exact render parity** with the Reaper reference wavs in `/home/m/soothe-bt/*.wav`
(checking dB/magnitude parity first, then byte-diff).
Path A (bit-exact) chosen. Phase 0,1,2 done. Phase 3,4 advanced. Phase 5 (render diff) is next.
## 2. DECOMPILATION FINDINGS (2026-08-19 — FUN_180563440, FUN_180563ce0 decoded)
### FUN_180563440 — LUT curve evaluation + band combine (222 lines disasm)
Structure: **3 phases per frame**:
1. **1024-bin LUT loop** (0x400 iterations): for each bin k:
- x = clamp(k * 0.0009775, 0, 1.0) = k/1024
- Band config at +0x188: {A(+0x00), B(+0x04), threshold(+0x0c), flag(+0x10), callback(+0x50)}
- **Path 1** (callback exists): vtable call → dynamic LUT
- **Path 2** (flag=1, threshold≠1.0): **power-law** → centered = 2*x - 1, then `sign(x) * 10^(log10(|x|) / threshold)` — this is a **compression curve** controlled by sharpness/threshold
- **Path 3** (default): **linear interpolation**`(B - A) * x + A`
- Output: double-precision at +0x198, stride 8
2. **Twin-mask factory** (FUN_18056e3e0): 6 bands × 1024 bins, stride 0x2000
3. **Combine loop**: stereo (max 2 channels), 6 bands, `1 - sum(band_masks)`
### FUN_180563ce0 — IIR level-tracker INIT (163 lines disasm)
- **341 bins** (0x155 iterations), **order-3 IIR** (3 coefficients per bin)
- Coefficient: **0.1** (`0x3dcccccd` = IEEE 754 float 0.1)
- Initial state: [1.0, 0, 0, 0] and [-1.0, 0, 0, 0] (identity + zero)
- Buffer layout: 3 × (16 bytes coeff) per bin, stored at rcx+0x28/+0x40/+0x58
- **Not the update loop** — init only; UPDATE is elsewhere
### FUN_180529fe0 — Coefficient setup (2051 instructions, in decomp_funs.txt)
- **vtable method** on Soothe2Module<M,1>
- **Lock** at +0x2404dc (atomic test-and-set)
- **PRNG state** at +0x2404e0, LCG with offset 0x3cdca
- **6-iteration coefficient generation** from 0x5408b0 buffer (LCG-indexed)
- **Depth scaling**: `powf(normalized, depth)` at +0x2c
- **Mask assembly**: normalize by 0x1a0 (NFFT), × 0x540870 (level weight), × 0x54088c (sharpness), invert
- **Copy output** via SIMD memcpy (thunk 0x181ba94b0)
### FUN_18052e9b0 — SpectralProcessor main (3167 instructions, in decomp_funs.txt)
- **Same PRNG + coefficient setup** as FUN_180529fe0
- **Band chain**: FUN_18052f500 (interleave) → FUN_18052ee70 (per-bin gain) → FUN_18052d650 (setup) → FUN_18052d920 (window)
- **Buffer alloc**: FUN_18052e190 for 0x540668, 0x540698, 0x5406a8, 0x5406b8-e8 (6 bands)
- **Depth scaling**: `powf(normalized, depth)` with depth at +0x2c
- **Final mask**: `1 - C` (inversion)
- **Window application**: `FIR *= 0x540658` (the live-captured window table)
### Constants verified from binary:
| Constant | Address | Value | Meaning |
|---|---|---|---|
| SCALE | 0x24c3c54 | 0.000977517 | 1/1024 (bin→x) |
| ONE | 0x24c3ea4 | 1.0 | clamping max |
| TWO | 0x24c41e0 | 2.0 | centering (2*x-1) |
| NEG1 | 0x24c4680 | -1.0 | sign flip |
| HALF | 0x24c3d8c | 0.5 | threshold |
| DEPTH_SCALE | 0x24c4334 | 4.0 | depth range |
| DB_CONV | 0x24c43e0 | 8.6859 | 20/ln(10) |
| FLOOR | 0x24c4704 | -6.9078 | ln(0.001) |
| IIR_COEFF | embedded | 0.1 | attack/release per bin |
| IIR_ORDER | embedded | 3.0 | IIR filter order |
| LCG_OFFSET | embedded | 0x3cdca | PRNG state advance |
### Live-captured tables (re-verified):
- `rwin_A0.npy` (0x1930100): 0.5→0.8, **frequency window** (NOT warp formula)
- `rwin_B0.npy` (0x1938180): 0→3.899, **power-law depth curve** (exponent ~0.66)
- `rwin_C0.npy` (0x19401c0): 0.596→0.126, **level-dependent weight**
- `r_freqaxis.npy`: 0→23988.3 Hz, 11.71 Hz spacing (48000/4096)
### Key insight: The warp formula is NOT a table — it's computed at runtime
The empirical `0.87*7.942*x/(7.942+x)` is an approximation of a runtime computation
in FUN_180563440 that evaluates the LUT curve parametrically. The actual LUT has TWO modes:
- **Linear** (default): simple interpolation between A and B
- **Power-law** (flag=1): `sign(x) * 10^(log10(|x|) / C)` — compression curve
## 3. PROOF OF STATE — run this first (5 min)
Everything below must reproduce. If `twin_check` fails, the transcription moved stale.
```bash
cd /home/m/re-tools/dsp && cmake --build build && ./build/twin_check
# expect:
# max rel err = 1.268e-05, PASS = yes (float-parity)
# max sweep rel err = 1.233e-05, SWEEP PASS = yes, exit 0
```
`build/soothe2_dsp.so` and `build/twin_check` are current. CMakeLists already has `twin.cpp` + `twin_check` executable.
## 3. TRANSCRIPTION STATE (summary — details in NOTES_TWIN.md)
- `dsp/twin.hpp` + `dsp/twin.cpp` = twin kernel FUN_180535880:
- build_twin_coeff (FUN_180533ec0 double pipeline → cvtpd2ps floats)
- generator formula (confirmed): `fVar1=sqrtf(param_5)`; `w0=max(2.0,freq)·2π/fs_total`;
`p=(sin(w0)·0.5)/Q`; `A=[1+dVar5, dVar2, 1dVar5]`, `B=[1+param_4, dVar2, 1param_4]`,
`dVar2=cos(w0)·−2.0` (DAT_1824c46b0=2.0).
- cplx_div_exact (rcpps+Newton: `ref=r0·(2den·r0)`, NaN-guard cmpeqps+movmskps, numerator B·conj(A))
- cplx_mul_exact (vfmaddsub213ps form `re=fma(br,ar,bi·ai)`, `im=fma(br,ai,bi·ar)`)
- twin_apply: conj(z1) mirroring 0x1800018b0, z2=z1·z1, out=2·B/A
- **OPEN phase question (byte-exactness)**: conjugate shaping — (-α+π/2) vs (-α) axis. Magnitudes match
either way; final proof needed via phase of a single-bin run before claiming byte-exactness.
## 4. GRID + CALLER (Phase 3 — details in NOTES_TWIN.md §Phase 3)
- Caller FUN_180536300 (decomp 6218, `caller_536300.dis`), scratch ≥52·N complex bytes:
+0..8N A-accum, +8N..16N B-accum, +16N..24N z-powers, +24N..32N rotor-in (filled 1.0),
+32N..36N phase ramp lVar1, +36N..44N rotor-out z1, +44N..52N lVar3(1.0)/lVar4(0.0)
- `0x18052da00(lVar1, scale=2π/(os·sr), N)` = ramp fill; `0x18052dbc0(param_2, lVar4, N)` cplx-interleave
→ out slots get (cos,sin) = e^{+iθ}.
- **Grid law**: `os=*(int*)(cfg+0x240080)=4` (mov DWORD PTR [rbx+0x240080],0x4 @0x18052ce3e),
`sr=*(float*)(cfg+0x24)=44100.0` → generator `fs_total=os·sr=176400`; per-cell phase `2π/176400`;
cell k ↔ freq k/os Hz (0.25 Hz steps). Phase-1 FS=44100 was a valid normalization (res depends on f/fc).
- twin always = FUN_180535880 (type-info compare equal); sibling FUN_180536f90 dead.
- case8: numBands `+0x814`=1, `+0x103`=1; `param_5=10^(sens_dB/20)`, `gain=sqrtf(param_5)=10^(sens_dB/40)`
→ fit gain=4.132 means stored `sens_dB@+0x101 ≈ 24.65`; freq=[band+0x804]=1000.0, Q=[band+0x80c].
## 5. LEVEL-WEIGHT FORMULA (Phase 4 — DECODED, NEGATIVE RESULT — NOTES_LEVEL.md §UPDATE 2026-08-18)
Exact formula from decomp 22330 (FUN_180530d30):
- `base=(2000/(sr·0.5))·iVar5/(bin+1)`, iVar5=NFFT/2+1
- `w8=powf(base,0.25)`
- `v=[0x540880]·0.25·w8·fVar12` (fVar12=4.0 if offline flag [0x5408b8], else 1.0)
- `q=1/(1+v/([0x540880]·4))` (2nd pair 0x540884: q2=1/(1+v2/[0x540884]))
- `dVar1=(sr/[0x1a0])·[0x1ac]·0.001`
- `w=0.1^(1/(max(q·v,floor)·dVar1))`; bufs: 0x5406b8=w, 0x5406c8=1w (and 0x5406d8/6e8 w/ 0x540884)
- consts: c3d3c=0.25, c4334=4.0, c3d8c=0.5, c45b4=2000.0, c3f70=0.1 f32, c3e30=0.001 f64, c3f70=0.1
- **Numerically**: w(500)=w(1000)=w(2000)≈0 (1e-20..1e-0.07), complements≈1 → but the weights are STILL
APPLIED (as 1w ≈ 1) by FUN_180529fe0 (`0x5407c8[band] += 0x5406c8·res_upper + 0x5406e8·res_lower`,
thunk 003c40, kernel 0x1800752e0 = vfmadd213pd) — the form is weight·resonance, not dead code.
- **TILT analysis (2026-08-18, checkpoint NEGATIVE result)**: warp `0x5406a8 = 0.87·x/(1+x/K)`,
`K=exp(2.0723267)≈7.942`, `x=f/2000`, applied by FUN_180529fe0 as `mask *= 0x5406a8` (float, thunk 008700)
BEFORE the FFT-conv. warp: 500→0.211, 1000→0.409, 2000→0.773 (lin ratio 2000/500=3.67).
**BUT warp ≠ empirical tilt (ratio 1.27)**: `C(dB2000)=depth·warp(2000)·LUT_max = 0.864·0.772·0.667=0.445`,
yet red2000=15.2 dB needs `C=0.826` ⇒ warp alone CANNOT produce deep-2000 (dual_b1q). Empirical tilt is the
envelope of the BLEND term (0x5407c8 += weights·res + freq-axis 0x540698) + FFT-conv shaping, NOT warp —
simple tilt→warp substitution in model_lut.py is INVALID. Nothing else decoded yet closes dual_b1q.
- **FUN_180563ce0 decoded (2026-08-18)**: INIT of per-bin IIR level-trackers (0x156=342 bins, order=3.0f
0x40400000, coeff A/B from 0x24c4780/4790, strided fill; third pass +0xffd0 fills 0x40e00000=7.0f).
Not the update loop. Full disasm: `/tmp/opencode/f_563ce0.dis`.
- **Level-path map (2026-08-18, NOTES_LEVEL.md)**: 0x563440 (LUT curve +0x188, gamma, 6 band-slots, combine
→+0x2198, LUT pairs +0x98 at 0x3ff pts) + 0x56e3e0 twin-mask factory (N=1024, DOUBLE, LUT-ramp input) +
0x563ce0 IIR init. 0x563440 NOT in decomp_funs.txt (search via /tmp/opencode/f_563440.dis + level_notes.md).
- **DIAGNOSTIC BRIDGE DONE (2026-08-18) — model_fir.py**: реальная цепочка из FUN_180529fe0
воспроизводит 36 точек до rmse=0.236 dB БЕЗ эмпирического tilt:
`C(f) = g·LUT(log10(L0/res(f))) + w·warp(f)^a`, g=1.221, w=0.358, a=3.143.
- dual500-константа = res_band(500;fc=500)=0.117 Q-НЕЗАВИСИМ, не tilt;
- dual2000-глубина = АДДИТИВНЫЙ терм `w·warp^3.14` (на 1000 Гц вклад ≤0.021 — иначе t1k
рушится; на 2000 = 0.149) — это аккумулятор `0x5407c8 += weights·res + mask` (шаг 5),
НЕ мультипликация warp·LUT (та проваливается >10 dB);
- warp^~3.14 ≈ π — подозрение на кратный каскад (0x540698 freq-axis, ∏0x540688, двойной FFT);
- остаток 0.7 dB при Q=0.1 = форма LUT-колена 0.574, не закрывается per-bin → нужен FFT-уровень.
- **FFT-CONV FULLY MAPPED (2026-08-18, NOTES_LEVEL.md §2026-08-18c, /tmp/opencode/f_52b570.dis)**:
0x535a70 = dispatcher to base-CRT FFT (0x140a10/0x140a70); 0x540548/0x540550/0x540598 = FFT-plan
tables (plan 0x540530, built by 0x52dc30), NOT windows. Per-band loop 0x52b550-0x52b8b5:
mask→fwdFFT→invFFT→fill low/high (xmm13/xmm9 consts)→inv→cplx-op→fwd→`FIR *= 0x540658`→fill→inv→
`FIR[0]=1,FIR[1]=0``*=0x540888`→copy out.
**freq-axis 0x540698**: OFFLINE = constant scalar (NOT exp-formula — exp/rand = online dither).
**Window 0x540658**: only ONE direct ref in dump (read at 0x52b771), written only indirectly —
STATICALLY INVISIBLE → the only plausible source of warp^3.14/LUT-knee. Need runtime capture or
full-pipeline empirical closure.
## 6. PHASE 5 PLAN (updated 2026-08-18 — bridge done, tilt replaced, FFT mined out)
Decision (user): bridge FIRST. **DONE — bridge result above in §5.**
Status: step 2 DONE, step 3 PARTIAL (static analysis exhausted).
1. (15 min) Proof-of-state above; confirm twin + mdl files complete; repo at `60bf3a2`.
2. **Replace empirical tilt** in model_lut.py with `g·LUT(xv) + w·warp(f)^a`**DONE**, rmse 0.236 dB
reproduced, committed `c8f97e4`. Optional refinement fit (2 LUT-knots) reaches 0.167 but is overfit.
3. **Close the 0.7-dB gap**: FFT-conv loop mapped + freq-axis cleared (offline const) — **DONE/PARTIAL**,
committed `60bf3a2`. Remaining unknown = 0x540658 window content (static-invisible). Options:
(a) runtime capture of 0x540658, (b) skip and close empirically in full-pipeline step 5.
4. Runtime values: per-bin IIR level trackers (0x563ce0), 0x540880/884, `[0x1a0]/[0x1ac]`, cell count N.
5. Full pipeline + render diff vs `/home/m/soothe-bt/*.wav`: dB parity → byte parity.
NEXT SESSION START (recommendation): skip deeper FFT mining; go straight to step 5 full pipeline
(mask-chain already in model_lut.py B.12 at 0.236; freq-axis const; FFT-conv reduces to a per-bin
smoothing + 0x540658 shaping that can be fit/absorbed). Runtime capture of 0x540658 only if step 5
stalls on the Q=0.1 knee.
### STEP 5 STARTED (2026-08-18) — dB-parity harness DONE (commit f96bb42)
- `/home/m/re-tools/render_parity.py`: measures steady-state per-tone reduction DIRECTLY on the
reference wavs (Goertzel tone-amp over late steady window; handles 16/24-bit, mono/stereo).
NOTE: Goertzel must use the SEQUENTIAL update form (s2=s1;s1=s0;s0=v+cw*s1-s2) — the tuple-unpack
form is numerically unstable (overflows ~1500 steps).
- Validation: measured dual Q-scan == stored dataset (dual.wav is 4s mono 16-bit; renders 6s stereo 24-bit).
- **dB-PARITY RESULT (canonical B.12, 36 pts, real wavs): TOTAL rmse=0.268 dB**
(dual500 0.130, dual2000 0.387, t1kq 0.320, t1k 0.076).
residual structure: dual2000 -0.80@Q0.1..+0.36@Q10 (LUT-knee), t1kq +0.36..+0.26 (level region),
t1k ±0.1 (good). Refit (g,w,a)=(1.224,0.379,3.405)→0.264; +2 LUT-knots→0.203 (plateau).
- CONCLUSION: B.12 form plateau ~0.20-0.27 dB vs real renders; residual is structural (0x540658
FFT shaping + level-curve region), matches plan expectation. Re-measured-on-wav numbers differ
slightly from the stored model_lut.py dataset (t1kq ~+0.3 dB) — different steady-window method.
- Open: full PIPELINE frame-render (STFT + per-frame mask + time constants) is the remaining big
lift for byte-parity; dB-parity milestone achieved at 0.268 dB.
Candidates that may consume Phase 5 time: source of sens≈24.65 (host ×2 over XML 12.0 — not found in dump),
IAT\*0x181bab370 outside dump (non-blocking), final z¹ phase proof, the 0x563440 LUT curve (+0x188) values.
## 7. FILES LAYOUT
- `/home/m/re-tools/dsp/` — twin.{hpp,cpp}, twin_check.cpp, CMakeLists.txt, build/
- `/home/m/re-tools/model_lut.py` — model **B.12** (Q=xmlq, gain=10^(sens/20), depth 0.8639736175537109,
`C=g·LUT(xv)+w·warp^a`, g=1.221/w=0.358/a=3.143) — 0.236 dB bridge model; PCHIP LUT nodes frozen
- `/home/m/re-tools/model_fir.py` — bridge canonical source (rmse 0.236, committed b1066f3)
- `/home/m/re-tools/framed_render.py` — full frame-render pilot (2026-08-19 params; modes dual|al)
- `/home/m/re-tools/rwin_A0/A1/B0/C0.npy`, `r_freqaxis.npy`, `rwin_warp.npy` — live-window tables (48k)
- `/home/m/re-tools/rtsnap.py` — live-process page snapshotter; snapshots /tmp/rt{A,B,C,D}.{raw,idx}
- `/home/m/re-tools/handoff/decode_rpp_full.py`, `handoff/rpp_allparams.py` — RPP b64-XML full decoder
(trim to len%4==0, `<?xml`@92, incl. nested processorStateData)
- `/home/m/re-tools/soothe_mem.bin` — memory dump, offset=VA0x180000000
- `/home/m/re-tools/decomp_funs.txt` — decomp: FUN_180536300 (6218), FUN_180530d30 (22330),
FUN_180533ec0 (123204), FUN_180529fe0 (missing body! vtable-only)
- `/home/m/re-tools/handoff/` — THIS DOC, NOTES_TWIN.md, NOTES_LEVEL.md, phase1/*.py, nls_dasm/*.dis
- `/home/m/soothe-bt/*.rpp` (decoder `/home/m/re-tools/dsp/...`; also `decode_rpp4.py` referenced) + `*.wav` refs
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,256 @@
# SESSION HANDOFF — soothe2 detector reverse → bit-exact render
Prepared: 2026-08-18 (checkpoint end-of-session: commits c8f97e4 + 60bf3a2 pushed). Start: READ THIS FIRST.
> **2026-08-20 UPDATE**: см. актуальный канон — `AGENTS.md` и `handoff/NOTES_LEVEL.md`.
> Нижеследующее «NOT DECODED»/«missing body» УСТАРЕЛО: `FUN_180529fe0` mono-path,
> `FUN_180563440/563ce0/563a60` — расшифрованы, полные дизассемблы скопированы в
> `handoff/nls_dasm/` (134 файла). Этот файл — исторический чекпоинт.
## 0. DECOMPILATION INVENTORY (2026-08-19 — what's decoded, where, and what's missing)
Goal: bit-exact parity is gated by EXACT tables/window/constants. The chunk-level model hits
err ≤0.62 dB (dual) / ≤0.19 dB (al_*) — to go sample-exact we need precise values from the binary.
### Static decomp assets IN REPO (use these, don't re-decompile):
- `ghidra-proj/soothe2.rep` — full Ghidra project (vst3 at ImageBase 0x180000000).
- `decomp_funs.txt` (312K lines, ~1640 functions), `fun_map.txt` (2285 addr→FUN), `consts.txt` (11602),
`decomp_dsp.txt` / `decomp_vtables.txt` / `decomp_candidates.txt` / `focus_decomp.txt`. Generators:
`Dump*.java`, `ImportRtti*.java`, `ListFuns.java`, `SearchRefs.java` (+ headless logs).
- RTTI: `rtti_dsp.json` / `rtti_full.json` — class hierarchy
`SpectralProcessor<float,7,1>`, `Soothe2ModuleBase<float,1>`, `FilterGraph<float,6,0x400>`,
`DigitalFilter<float,0xBA,1>`, `IIRFilterExtended<float,1>`, `AudioProcessingModule<float,1>`.
- `handoff/nls_dasm/` — 120 hand-picked `.dis` (twin, iface_18052da00/dbc0, fft, generator, ctor).
- `dsp/` — working C++ transcription (twin, detect, freqpath, spectral, fft_stage) + harness;
`build/twin_check` passes float-parity gate (§2).
### KEY DSP ADDRESSES — decoded / not decoded:
DECODED (formula-level, notes at NOTES_TWIN.md / NOTES_LEVEL.md):
- twin kernel `FUN_180535880`; generator `FUN_180533ec0`; caller `FUN_180536300`; dead sibling `180536f90`.
- level-weight formula `FUN_180530d30` (0x540880/884, warp 0x5406a8=0.87·x/(1+x/7.942), w=0.1^(...)).
- mask-apply entry `FUN_180529fe0` (accumulator 0x5407c8 += w·res; mask *= warp; FIR *= 0x540658).
- FFT-conv loop 0x52b550-0x52b8b5 (plan 0x540530, windows 0x540548/550/598, freq-axis 0x540698=offline const).
- level-path map: `0x563440` (LUT curve +0x188, 6 band-slots, combine→+0x2198), `0x56e3e0` (twin-mask factory),
`0x563ce0` (IIR level-tracker INIT only).
NOT DECODED / MISSING FROM decomp_funs.txt (critical): ⚠️ → РЕШЕНО (2026-08-19/20), см. выше
- `FUN_180529fe0` body — РЕШЕНО (decomp в `/tmp/consumers_out.txt`, mask-цепь в `dsp/framed_model.cpp`).
- `FUN_180563440` / `FUN_180563a60` (LUT curve + gamma + combine), `FUN_180563ce0` — РЕШЕНО,
дизассемблы скопированы в `handoff/nls_dasm/` (`f_563440.dis`, `f_563a60.dis`, `f_563ce0.dis`, `f529fe0.dis`).
- Window `0x540658` — РЕШЕНО (live-захват, см. `handoff/NOTES_CAPTURE.md`; `rtwin_freq_44100.npy`).
- sens source: XML 12.0 → runtime sens_dB≈24.65 (host ×2) not found in dump; `IAT\*0x181bab370` outside dump.
### Bridge model STATUS (2026-08-19):
- `framed_render.py` full STFT frame-render (N=2048, hop=512, sqrt-Hann, twin env tatt=11ms/trel=80ms):
`C(f)=G·LUT(xv)+W·warp(f)^A`, G=1.0850, W=0.2819, A=1.1377 (joint dual+al_* refit).
- Validation: dual q0.1/1/10 @500+2000 err ≤0.62 dB, envRmse@steady ≤0.78 dB; al_* lv3..24 err ≤0.19 dB.
- LUT = slanted al_*-leg (0.366@xv=-0.50 → 0.636@xv=+0.55), replaces flat B.12 (~0.5). Bugfix: clip range
must be [LY.min(), LY.max()] not [LY[0], LY[-1]].
- Remaining structural residual: 0.6 dB systematic on dual 500Hz (q0.1/q1). Live evidence (avg per-bin
gain H=|Y|/|X|): reference mask is FLAT ~-10.2dB across 100-540Hz regardless of Q — model produces
res-shaped notch. Hypo tested: freq-smoothing of C(f) fails (kills 2000Hz). NEXT: scalar per-frame xv
(broadband level, not per-bin am/res) — see /tmp/smoothtest.py (+ edit scalar=True).
## 1. Objective (unchanged since session 1)
Transcribe the decoded soothe2 detector ("twins" 0x180535880/0x180536f90, 2nd-order resonator) into
C++ and reach **bit-exact render parity** with the Reaper reference wavs in `/home/m/soothe-bt/*.wav`
(checking dB/magnitude parity first, then byte-diff).
Path A (bit-exact) chosen. Phase 0,1,2 done. Phase 3,4 advanced. Phase 5 (render diff) is next.
## 2. DECOMPILATION FINDINGS (2026-08-19 — FUN_180563440, FUN_180563ce0 decoded)
### FUN_180563440 — LUT curve evaluation + band combine (222 lines disasm)
Structure: **3 phases per frame**:
1. **1024-bin LUT loop** (0x400 iterations): for each bin k:
- x = clamp(k * 0.0009775, 0, 1.0) = k/1024
- Band config at +0x188: {A(+0x00), B(+0x04), threshold(+0x0c), flag(+0x10), callback(+0x50)}
- **Path 1** (callback exists): vtable call → dynamic LUT
- **Path 2** (flag=1, threshold≠1.0): **power-law** → centered = 2*x - 1, then `sign(x) * 10^(log10(|x|) / threshold)` — this is a **compression curve** controlled by sharpness/threshold
- **Path 3** (default): **linear interpolation**`(B - A) * x + A`
- Output: double-precision at +0x198, stride 8
2. **Twin-mask factory** (FUN_18056e3e0): 6 bands × 1024 bins, stride 0x2000
3. **Combine loop**: stereo (max 2 channels), 6 bands, `1 - sum(band_masks)`
### FUN_180563ce0 — IIR level-tracker INIT (163 lines disasm)
- **341 bins** (0x155 iterations), **order-3 IIR** (3 coefficients per bin)
- Coefficient: **0.1** (`0x3dcccccd` = IEEE 754 float 0.1)
- Initial state: [1.0, 0, 0, 0] and [-1.0, 0, 0, 0] (identity + zero)
- Buffer layout: 3 × (16 bytes coeff) per bin, stored at rcx+0x28/+0x40/+0x58
- **Not the update loop** — init only; UPDATE is elsewhere
### FUN_180529fe0 — Coefficient setup (2051 instructions, in decomp_funs.txt)
- **vtable method** on Soothe2Module<M,1>
- **Lock** at +0x2404dc (atomic test-and-set)
- **PRNG state** at +0x2404e0, LCG with offset 0x3cdca
- **6-iteration coefficient generation** from 0x5408b0 buffer (LCG-indexed)
- **Depth scaling**: `powf(normalized, depth)` at +0x2c
- **Mask assembly**: normalize by 0x1a0 (NFFT), × 0x540870 (level weight), × 0x54088c (sharpness), invert
- **Copy output** via SIMD memcpy (thunk 0x181ba94b0)
### FUN_18052e9b0 — SpectralProcessor main (3167 instructions, in decomp_funs.txt)
- **Same PRNG + coefficient setup** as FUN_180529fe0
- **Band chain**: FUN_18052f500 (interleave) → FUN_18052ee70 (per-bin gain) → FUN_18052d650 (setup) → FUN_18052d920 (window)
- **Buffer alloc**: FUN_18052e190 for 0x540668, 0x540698, 0x5406a8, 0x5406b8-e8 (6 bands)
- **Depth scaling**: `powf(normalized, depth)` with depth at +0x2c
- **Final mask**: `1 - C` (inversion)
- **Window application**: `FIR *= 0x540658` (the live-captured window table)
### Constants verified from binary:
| Constant | Address | Value | Meaning |
|---|---|---|---|
| SCALE | 0x24c3c54 | 0.000977517 | 1/1024 (bin→x) |
| ONE | 0x24c3ea4 | 1.0 | clamping max |
| TWO | 0x24c41e0 | 2.0 | centering (2*x-1) |
| NEG1 | 0x24c4680 | -1.0 | sign flip |
| HALF | 0x24c3d8c | 0.5 | threshold |
| DEPTH_SCALE | 0x24c4334 | 4.0 | depth range |
| DB_CONV | 0x24c43e0 | 8.6859 | 20/ln(10) |
| FLOOR | 0x24c4704 | -6.9078 | ln(0.001) |
| IIR_COEFF | embedded | 0.1 | attack/release per bin |
| IIR_ORDER | embedded | 3.0 | IIR filter order |
| LCG_OFFSET | embedded | 0x3cdca | PRNG state advance |
### Live-captured tables (re-verified):
- `rwin_A0.npy` (0x1930100): 0.5→0.8, **frequency window** (NOT warp formula)
- `rwin_B0.npy` (0x1938180): 0→3.899, **power-law depth curve** (exponent ~0.66)
- `rwin_C0.npy` (0x19401c0): 0.596→0.126, **level-dependent weight**
- `r_freqaxis.npy`: 0→23988.3 Hz, 11.71 Hz spacing (48000/4096)
### Key insight: The warp formula is NOT a table — it's computed at runtime
The empirical `0.87*7.942*x/(7.942+x)` is an approximation of a runtime computation
in FUN_180563440 that evaluates the LUT curve parametrically. The actual LUT has TWO modes:
- **Linear** (default): simple interpolation between A and B
- **Power-law** (flag=1): `sign(x) * 10^(log10(|x|) / C)` — compression curve
## 3. PROOF OF STATE — run this first (5 min)
Everything below must reproduce. If `twin_check` fails, the transcription moved stale.
```bash
cd /home/m/re-tools/dsp && cmake --build build && ./build/twin_check
# expect:
# max rel err = 1.268e-05, PASS = yes (float-parity)
# max sweep rel err = 1.233e-05, SWEEP PASS = yes, exit 0
```
`build/soothe2_dsp.so` and `build/twin_check` are current. CMakeLists already has `twin.cpp` + `twin_check` executable.
## 3. TRANSCRIPTION STATE (summary — details in NOTES_TWIN.md)
- `dsp/twin.hpp` + `dsp/twin.cpp` = twin kernel FUN_180535880:
- build_twin_coeff (FUN_180533ec0 double pipeline → cvtpd2ps floats)
- generator formula (confirmed): `fVar1=sqrtf(param_5)`; `w0=max(2.0,freq)·2π/fs_total`;
`p=(sin(w0)·0.5)/Q`; `A=[1+dVar5, dVar2, 1dVar5]`, `B=[1+param_4, dVar2, 1param_4]`,
`dVar2=cos(w0)·−2.0` (DAT_1824c46b0=2.0).
- cplx_div_exact (rcpps+Newton: `ref=r0·(2den·r0)`, NaN-guard cmpeqps+movmskps, numerator B·conj(A))
- cplx_mul_exact (vfmaddsub213ps form `re=fma(br,ar,bi·ai)`, `im=fma(br,ai,bi·ar)`)
- twin_apply: conj(z1) mirroring 0x1800018b0, z2=z1·z1, out=2·B/A
- **OPEN phase question (byte-exactness)**: conjugate shaping — (-α+π/2) vs (-α) axis. Magnitudes match
either way; final proof needed via phase of a single-bin run before claiming byte-exactness.
## 4. GRID + CALLER (Phase 3 — details in NOTES_TWIN.md §Phase 3)
- Caller FUN_180536300 (decomp 6218, `caller_536300.dis`), scratch ≥52·N complex bytes:
+0..8N A-accum, +8N..16N B-accum, +16N..24N z-powers, +24N..32N rotor-in (filled 1.0),
+32N..36N phase ramp lVar1, +36N..44N rotor-out z1, +44N..52N lVar3(1.0)/lVar4(0.0)
- `0x18052da00(lVar1, scale=2π/(os·sr), N)` = ramp fill; `0x18052dbc0(param_2, lVar4, N)` cplx-interleave
→ out slots get (cos,sin) = e^{+iθ}.
- **Grid law**: `os=*(int*)(cfg+0x240080)=4` (mov DWORD PTR [rbx+0x240080],0x4 @0x18052ce3e),
`sr=*(float*)(cfg+0x24)=44100.0` → generator `fs_total=os·sr=176400`; per-cell phase `2π/176400`;
cell k ↔ freq k/os Hz (0.25 Hz steps). Phase-1 FS=44100 was a valid normalization (res depends on f/fc).
- twin always = FUN_180535880 (type-info compare equal); sibling FUN_180536f90 dead.
- case8: numBands `+0x814`=1, `+0x103`=1; `param_5=10^(sens_dB/20)`, `gain=sqrtf(param_5)=10^(sens_dB/40)`
→ fit gain=4.132 means stored `sens_dB@+0x101 ≈ 24.65`; freq=[band+0x804]=1000.0, Q=[band+0x80c].
## 5. LEVEL-WEIGHT FORMULA (Phase 4 — DECODED, NEGATIVE RESULT — NOTES_LEVEL.md §UPDATE 2026-08-18)
Exact formula from decomp 22330 (FUN_180530d30):
- `base=(2000/(sr·0.5))·iVar5/(bin+1)`, iVar5=NFFT/2+1
- `w8=powf(base,0.25)`
- `v=[0x540880]·0.25·w8·fVar12` (fVar12=4.0 if offline flag [0x5408b8], else 1.0)
- `q=1/(1+v/([0x540880]·4))` (2nd pair 0x540884: q2=1/(1+v2/[0x540884]))
- `dVar1=(sr/[0x1a0])·[0x1ac]·0.001`
- `w=0.1^(1/(max(q·v,floor)·dVar1))`; bufs: 0x5406b8=w, 0x5406c8=1w (and 0x5406d8/6e8 w/ 0x540884)
- consts: c3d3c=0.25, c4334=4.0, c3d8c=0.5, c45b4=2000.0, c3f70=0.1 f32, c3e30=0.001 f64, c3f70=0.1
- **Numerically**: w(500)=w(1000)=w(2000)≈0 (1e-20..1e-0.07), complements≈1 → but the weights are STILL
APPLIED (as 1w ≈ 1) by FUN_180529fe0 (`0x5407c8[band] += 0x5406c8·res_upper + 0x5406e8·res_lower`,
thunk 003c40, kernel 0x1800752e0 = vfmadd213pd) — the form is weight·resonance, not dead code.
- **TILT analysis (2026-08-18, checkpoint NEGATIVE result)**: warp `0x5406a8 = 0.87·x/(1+x/K)`,
`K=exp(2.0723267)≈7.942`, `x=f/2000`, applied by FUN_180529fe0 as `mask *= 0x5406a8` (float, thunk 008700)
BEFORE the FFT-conv. warp: 500→0.211, 1000→0.409, 2000→0.773 (lin ratio 2000/500=3.67).
**BUT warp ≠ empirical tilt (ratio 1.27)**: `C(dB2000)=depth·warp(2000)·LUT_max = 0.864·0.772·0.667=0.445`,
yet red2000=15.2 dB needs `C=0.826` ⇒ warp alone CANNOT produce deep-2000 (dual_b1q). Empirical tilt is the
envelope of the BLEND term (0x5407c8 += weights·res + freq-axis 0x540698) + FFT-conv shaping, NOT warp —
simple tilt→warp substitution in model_lut.py is INVALID. Nothing else decoded yet closes dual_b1q.
- **FUN_180563ce0 decoded (2026-08-18)**: INIT of per-bin IIR level-trackers (0x156=342 bins, order=3.0f
0x40400000, coeff A/B from 0x24c4780/4790, strided fill; third pass +0xffd0 fills 0x40e00000=7.0f).
Not the update loop. Full disasm: `/tmp/opencode/f_563ce0.dis`.
- **Level-path map (2026-08-18, NOTES_LEVEL.md)**: 0x563440 (LUT curve +0x188, gamma, 6 band-slots, combine
→+0x2198, LUT pairs +0x98 at 0x3ff pts) + 0x56e3e0 twin-mask factory (N=1024, DOUBLE, LUT-ramp input) +
0x563ce0 IIR init. 0x563440 NOT in decomp_funs.txt (search via /tmp/opencode/f_563440.dis + level_notes.md).
- **DIAGNOSTIC BRIDGE DONE (2026-08-18) — model_fir.py**: реальная цепочка из FUN_180529fe0
воспроизводит 36 точек до rmse=0.236 dB БЕЗ эмпирического tilt:
`C(f) = g·LUT(log10(L0/res(f))) + w·warp(f)^a`, g=1.221, w=0.358, a=3.143.
- dual500-константа = res_band(500;fc=500)=0.117 Q-НЕЗАВИСИМ, не tilt;
- dual2000-глубина = АДДИТИВНЫЙ терм `w·warp^3.14` (на 1000 Гц вклад ≤0.021 — иначе t1k
рушится; на 2000 = 0.149) — это аккумулятор `0x5407c8 += weights·res + mask` (шаг 5),
НЕ мультипликация warp·LUT (та проваливается >10 dB);
- warp^~3.14 ≈ π — подозрение на кратный каскад (0x540698 freq-axis, ∏0x540688, двойной FFT);
- остаток 0.7 dB при Q=0.1 = форма LUT-колена 0.574, не закрывается per-bin → нужен FFT-уровень.
- **FFT-CONV FULLY MAPPED (2026-08-18, NOTES_LEVEL.md §2026-08-18c, /tmp/opencode/f_52b570.dis)**:
0x535a70 = dispatcher to base-CRT FFT (0x140a10/0x140a70); 0x540548/0x540550/0x540598 = FFT-plan
tables (plan 0x540530, built by 0x52dc30), NOT windows. Per-band loop 0x52b550-0x52b8b5:
mask→fwdFFT→invFFT→fill low/high (xmm13/xmm9 consts)→inv→cplx-op→fwd→`FIR *= 0x540658`→fill→inv→
`FIR[0]=1,FIR[1]=0``*=0x540888`→copy out.
**freq-axis 0x540698**: OFFLINE = constant scalar (NOT exp-formula — exp/rand = online dither).
**Window 0x540658**: only ONE direct ref in dump (read at 0x52b771), written only indirectly —
STATICALLY INVISIBLE → the only plausible source of warp^3.14/LUT-knee. Need runtime capture or
full-pipeline empirical closure.
## 6. PHASE 5 PLAN (updated 2026-08-18 — bridge done, tilt replaced, FFT mined out)
Decision (user): bridge FIRST. **DONE — bridge result above in §5.**
Status: step 2 DONE, step 3 PARTIAL (static analysis exhausted).
1. (15 min) Proof-of-state above; confirm twin + mdl files complete; repo at `60bf3a2`.
2. **Replace empirical tilt** in model_lut.py with `g·LUT(xv) + w·warp(f)^a`**DONE**, rmse 0.236 dB
reproduced, committed `c8f97e4`. Optional refinement fit (2 LUT-knots) reaches 0.167 but is overfit.
3. **Close the 0.7-dB gap**: FFT-conv loop mapped + freq-axis cleared (offline const) — **DONE/PARTIAL**,
committed `60bf3a2`. Remaining unknown = 0x540658 window content (static-invisible). Options:
(a) runtime capture of 0x540658, (b) skip and close empirically in full-pipeline step 5.
4. Runtime values: per-bin IIR level trackers (0x563ce0), 0x540880/884, `[0x1a0]/[0x1ac]`, cell count N.
5. Full pipeline + render diff vs `/home/m/soothe-bt/*.wav`: dB parity → byte parity.
NEXT SESSION START (recommendation): skip deeper FFT mining; go straight to step 5 full pipeline
(mask-chain already in model_lut.py B.12 at 0.236; freq-axis const; FFT-conv reduces to a per-bin
smoothing + 0x540658 shaping that can be fit/absorbed). Runtime capture of 0x540658 only if step 5
stalls on the Q=0.1 knee.
### STEP 5 STARTED (2026-08-18) — dB-parity harness DONE (commit f96bb42)
- `/home/m/re-tools/render_parity.py`: measures steady-state per-tone reduction DIRECTLY on the
reference wavs (Goertzel tone-amp over late steady window; handles 16/24-bit, mono/stereo).
NOTE: Goertzel must use the SEQUENTIAL update form (s2=s1;s1=s0;s0=v+cw*s1-s2) — the tuple-unpack
form is numerically unstable (overflows ~1500 steps).
- Validation: measured dual Q-scan == stored dataset (dual.wav is 4s mono 16-bit; renders 6s stereo 24-bit).
- **dB-PARITY RESULT (canonical B.12, 36 pts, real wavs): TOTAL rmse=0.268 dB**
(dual500 0.130, dual2000 0.387, t1kq 0.320, t1k 0.076).
residual structure: dual2000 -0.80@Q0.1..+0.36@Q10 (LUT-knee), t1kq +0.36..+0.26 (level region),
t1k ±0.1 (good). Refit (g,w,a)=(1.224,0.379,3.405)→0.264; +2 LUT-knots→0.203 (plateau).
- CONCLUSION: B.12 form plateau ~0.20-0.27 dB vs real renders; residual is structural (0x540658
FFT shaping + level-curve region), matches plan expectation. Re-measured-on-wav numbers differ
slightly from the stored model_lut.py dataset (t1kq ~+0.3 dB) — different steady-window method.
- Open: full PIPELINE frame-render (STFT + per-frame mask + time constants) is the remaining big
lift for byte-parity; dB-parity milestone achieved at 0.268 dB.
Candidates that may consume Phase 5 time: source of sens≈24.65 (host ×2 over XML 12.0 — not found in dump),
IAT\*0x181bab370 outside dump (non-blocking), final z¹ phase proof, the 0x563440 LUT curve (+0x188) values.
## 7. FILES LAYOUT
- `/home/m/re-tools/dsp/` — twin.{hpp,cpp}, twin_check.cpp, CMakeLists.txt, build/
- `/home/m/re-tools/model_lut.py` — model **B.12** (Q=xmlq, gain=10^(sens/20), depth 0.8639736175537109,
`C=g·LUT(xv)+w·warp^a`, g=1.221/w=0.358/a=3.143) — 0.236 dB bridge model; PCHIP LUT nodes frozen
- `/home/m/re-tools/model_fir.py` — bridge canonical source (rmse 0.236, committed b1066f3)
- `/home/m/re-tools/framed_render.py` — full frame-render pilot (2026-08-19 params; modes dual|al)
- `/home/m/re-tools/rwin_A0/A1/B0/C0.npy`, `r_freqaxis.npy`, `rwin_warp.npy` — live-window tables (48k)
- `/home/m/re-tools/rtsnap.py` — live-process page snapshotter; snapshots /tmp/rt{A,B,C,D}.{raw,idx}
- `/home/m/re-tools/handoff/decode_rpp_full.py`, `handoff/rpp_allparams.py` — RPP b64-XML full decoder
(trim to len%4==0, `<?xml`@92, incl. nested processorStateData)
- `/home/m/re-tools/soothe_mem.bin` — memory dump, offset=VA0x180000000
- `/home/m/re-tools/decomp_funs.txt` — decomp: FUN_180536300 (6218), FUN_180530d30 (22330),
FUN_180533ec0 (123204), FUN_180529fe0 (missing body! vtable-only)
- `/home/m/re-tools/handoff/` — THIS DOC, NOTES_TWIN.md, NOTES_LEVEL.md, phase1/*.py, nls_dasm/*.dis
- `/home/m/soothe-bt/*.rpp` (decoder `/home/m/re-tools/dsp/...`; also `decode_rpp4.py` referenced) + `*.wav` refs
+150
View File
@@ -0,0 +1,150 @@
## Objective
- Реверс-DSP oeksound soothe2 v1.1.2 VST3 → математическая модель (STFT, детектор резонансов, нотич-синтез). Текущая фаза — поведенческий параметр-свип через рендер Reaper RPP + статический декомпил (без декрипты бинарника пока).
> **⚠️ ИСТОРИЧЕСКИЙ ДОКУМЕНТ (поведенческая модель v4, sim.py, ок. 2026-08-17)**.
> Актуальный канон (bit-exact, P4) — `README.md`, `AGENTS.md`, `handoff/NOTES_LEVEL.md`.
> Здесь — ранняя поведенческая фаза реверса, сохранена как справочник.
## Key Facts
- Пользователь русскоязычный; sudo нет. Объект: `~/.wine/.../soothe2_x64.vst3` (PE32+, base 0x180000000), yabridge 5.1.1, Reaper 7.78.
- Frida невозможна (Seccomp). Дамп памяти — `pread /proc/pid/mem` от родителя. pkill-ловушки: paths без `harneb`/`reaper``pkill -9 -x reaper`, `pkill -9 -f '[y]abridge'`.
- Рендер-проект: `RENDER_RANGE 1 0 0 0 1000`, ITEM обязательно `POSITION 0`. Offline-рендер мгновенный → для живого дампа realtime (`RENDER_1X 1`) + `testtone.wav`.
- VST-state = 92-байт JUCE-заголовок + base64 XML `<SOOTHE2STATE>` + 54 `<PARAM id=... value=.../>`; внутри — UI-state без DSP.
## Breakthrough (исправлено в этой сессии)
- **Формат-адаптивность PARAM**: плагин применяет `<PARAM value>` ТОЛЬКО если строка сериализована в том же формате, что оригинал:
- full-precision (depth, band freq/q...) → `%.16f` (напр. `"0.9000000000000000"`). Короткие строки → схлопывание (fallback).
- short-формат `"X.0"` (selectivity, mix, mode, oversample, resolution) → ЛОМАЕТСЯ от `%.16f`.
- `sweep.py`/`tt_sweep.py` адаптивны: >4 десятичных в оригинале → `%.16f`, 1-4 → то же число знаков, иначе — как есть.
## Синтез модели (поведенческая, v4 — реализована в sim.py, RMSE на settled ≤0.05dB по всем свипам)
```
PARADИГМА (реализована): out(t) = x(t) amount_b(t)·bp_b(t; fc, Q) [субтрактивный нотч, не микш-параллельный]
amount(total) = A(depth)·S(sens)·H(sharp)·M(mode) — LUT из измерений (пересечение, не аналит. фит)
A(depth): 0.5/0.864/1/2/3/5/10/20 → 0.560/0.588/0.598/0.667/0.727/0.820/0.939/0.989
S(sens): 0/6/12/24 → 0.48/0.76/1.0/1.0 (floor при sens=0!)
H(sharp): 1/3/5/10 → 0.20/0.59/0.84/1.0
M(mode): 0 → 0.745 (mode0 слабее), 1.. → 1.0
Q(sel): = 3.0+0.36·sel (2nd-order bandpass; реал. даёт более крутые борта — приближ.)
env(t): one-pole, α_attack=1e^(1/(T_a·fs)), α_release=1e^(1/(T_r·fs))
T_a = 0.02·e^(a/1.955) (0→20мс, 5→258мс, 10→3.3c); T_r LUT из спадов (0→27мс, 5→140мс, 10→15c)
детектор: лауднеss полосы |bp| smoothed 5мс > thr 0.01 → цель amt, иначе 0 (порог между probe 0.0005 и burst 0.2)
выход: x_out = mix/100·… — линейный кроссфейд: (100mix)/100·x + mix/100·fully_reduced
(mix=100 = полная обработка = ref; mix=0 → сухой; проверено на s_corr_mix: монот. линейно)
```
Верификация (settled, RMSE по reduction dB на burst-окне):
| параметр | реал | sim | RMSE | | параметр | реал | sim | RMSE |
|---|---|---|--|---|---|---|---|---|
| дефолт | 7.70 | 7.70 | 0.002 | sharp=1 | 1.11 | 1.11 | 0.002 |
| depth=2 | 9.56 | 9.56 | 0.001 | sharp=3 | 3.72 | 3.71 | 0.006 |
| depth=5 | 14.90 | 14.89 | 0.008 | attack=5 | 5.68 | 5.90 | 0.360 |
| depth=10 | 24.27 | 24.25 | 0.018 | mode=0 | 5.03 | 5.00 | 0.023 |
| depth=20 | 39.43 | 39.40 | 0.054 | mode=2 | 7.70 | 7.70 | 0.002 |
| sens=0 | 2.89 | 2.89 | 0.001 | sens=24 | 7.70 | 7.70 | 0.002 |
Q-профиль (probes-зонд): sim sel1 500→680@540→0.62@700 vs real 8.03→4.54→1.13; 2nd-order не покрывает
крутые борта реала (реал резче ~×3): допустимо как 1-я итерация, RMSE макс по профилю ~1.6dB.
Release-трассы: r0/r1/r2/r5 совпадают (sim против real 1.6s:3.5/4.3, 1.7s:1.5/1.9, 1.9s:0.3/0.3).
## Q/width-зонд (probes500/probes500b, drive 500Hz amp0.2 + справки 0.02)
- Методика: длинный single-FFT на окне 1.7..2.9s (разрешение ~0.7Hz), справки на 500,505,510,520,540,
555,575,600,700 (b-set) / 500,505,515,530,560,640,780 (a-set). Драйв-тон держит детект-клок,
справки зондируют передаточную характеристику в установившемся режиме.
- Данные (a-set) red@freq: sel1: 500:8.0 510:7.9 520:7.7 540:4.5 555:2.7 575:1.6 600:0.7 (плавный хвост)
sel8: 500:8.7 510:9.1 520:6.6 540:1.3 555:0.1 575:0.0 600:0.0 (резкий срез) — Q уверенно растёт с sel.
- Центраئة нотча на 500..510 чуть выше 500 (fs на 505..510) — трекинг слегка субадио.
- Значения на дип-тонах 530/560/640 в b-наборе — из мусора (нет справки) и исключены; a-набор чистый.
- ВАЖНО: dry-файлы дважды перезаписывались провальными dry-рендерами (RENDER_FILE не патчился по
`.wav` напр. burst500L_byp → overwritten probes). ФИКС: патчить RENDER_FILE явно в sed до рендера.
- data: оба svипа предсказуемо монотонны; таблица в summary выше.
## Верифицированные данные (все свипы с корректным форматом)
- **depth (mir)**: монотонно distinct (vs-ref 496k→441k→...→347k@0.85→384k@1.0) — работает.
- **selectivity**: 0/1/2/5 distinct (476k/466k/458k/461k vs ref); 10==20==50==100 (сатурация ≥10).
- **oversample**: 0==ref; 1 distinct; 2==3==4 (сатурация на 2).
- **resolution**: 0 distinct; 1==ref; 2 distinct (все distinct); 3==4.
- **mix**: 0/25/50/75/100 всё distinct монотонно; 100==ref.
- **mode**: 0 distinct; 1==2==3==4==ref.
- **band1 freq**: tt_b1f_678 (дефолт banda freq) == tt_ref бит-в-бит; свип 100..8000 отрендерен.
## Прочие находки
- 60-сек рендер p60_ref/p60_dep0/p60_dep1 подтвердил collapse класса при коротких строках.
- rtdump.py живые дампы (регионы по VA, RA/WA) — DSP-кластер .data меняется между глубинами; раньше не совпали по layout (артефакт noise).
## Work State
### Completed
- Свип-инфраструктура: sweep.py + tt_sweep.py (адаптив формата), рендер, сверочный анализ (spectrum.py медленный, нужно numpy).
- Тест-тон: testtone.wav (2s, multi-tone 110Hz14kHz с AM) для изоляции резонансов; tt_ref==tt_678 (0 diff).
- Базовые свипы по всем основным параметрам.
### Active
- **Извлечена статическая depth-кривая**: LUT 207 float @0x1826170e8..0x182617420, форма `0.302 + 0.698·sin(π/2·x)^0.94` (r²=0.99999), saved `depthcurve.npy`. ИДЕНТИЧНА у ref/dep0/dep1 → вшита в бинарь (build-time), не меняется от параметра = внутренний «depth→amount» маппинг.
- **Адаптивная динамика (burst-тест, band1@500Hz, q≈1, depth 0.864)**: burst500.wav (2s: 0.5s тишины → 1.0s 500Hz burst amp 0.2 → 0.5s тишины, + 1000Hz amp 0.05 фон). `burst500_b1` (fx) vs `burst500_byp` (dry):
- ATTACK: плавное включение нотч-ослабления, τ≈**18 мс** (фит на экспоненту A·(1e^t/τ), stable 17.6/17.7/18.8/18.8), установка −7.7dB бай-в-бай за ~100мс.
- RELEASE: хвост после снятия бурста спадает за τ≈**5 мс** (после 1.5s fx-энергия 24→0 за ~30мс) — быстрый трелинг, симметрия фола не классическая (вероятно фильтр-транзиент, не медленный rel).
- Глубина ослабления НЕ зависит от «порога» — это фикс. нотч на частоте band, amount задаётся curve(depth).
- Рендерится через те же tt-файлы; РЕЗУЛЬТАТЫ в wav — 24-bit (`sampwidth=3`), читать через 24-bit decode (или любой np.frombuffer под sw), не 16-bit!
- **τ-инвариантность** (burst-тест, band1@500Hz, win 10ms, Goertzel, фит к A(1e^t/τ)):
- depth 0→0.86→1: A=6.39→7.70→7.91 dB; τ=18.3→16.8→16.5 ms (τ почти const) → depth контролирует amount, НЕ скорость.
- selectivity: τ РАСТЁТ монотонно 12.3→16.8 ms при sel 0→10 (12.3/12.4/12.6/12.9/13.0/13.4/14.3/16.8) → Q/selectivity = time-const антреккинга.
- depth-amount таблица (settled, band1@500): sel 0..6 монотонно 7.79→−9.08 dB, затем dip sel8=8.79, sel10=7.71 (non-monotonic у высоких sel, нюанс трекера).
- «650Hz notch» в раннем FFT-анализе — АРТЕФАКТ деления на near-zero dry; реальные числа = ratio dry/fx только там, где dry>5% пика (pure 500Hz tone → окно вокруг 500).
- **secret свипа: `patchparam.py`** обязателен для формат-сохранения: state-блок в RPP = base64, wrapped по 128-симв/строка с 2-sp indent и НОВОЙ строкой перед '>'. Ключевое: глубина пишется ТОЛЬКО `%.16f` (короткая `0.0` → collapse!), поэтому CLI `depth=0.0!` форсит полную точность.
- Float-поиск по живому дампу: depth 301 hits (множество копий по bands), selectivity/sharpness → общий бакет (10.015, 9.997), mix → 4 копии 100.0, band freqs (678.76, 8242.67) → 0 точных (хранятся иначе, напр. Hz→binidx или через npf).
- Живой diff dep0 vs dep1 в .data (0x182622130, 0x182622350, 0x1826223c0, 0x18262aca8, 0x182672fe4) — флоаты-состояние меняются; но регион содержит много мусора/nan (это .data буферы рендера, не коэфф).
### Провалы/уроки
- ASLR между отдельными rtdump-запусками сдвигает раскладку регионов → прямого VA-сравнения НЕТ (dep0b 10 регионов, dep1b 9). Только те адреса, что реально в 0x18260a000-0x18267c000 (совпадают) сравнимы.
## Relevant Files
- **`/home/m/re-tools/sim.py`** — поведенческий симулятор (LUT amount + 2nd-order bp Q(sel) + env attack/release + mix/mode). `simulate(x, fc, depth, sens, sharp, sel, mode, attack, release, mix)`. RMSE settled ≤0.05dB (см. таблицу выше).
- **`/home/m/re-tools/verify_sim.py`** — RMSE-сверка симулятора против рендеров (mag@500 трасса). Использование: `verify_sim.py <fx.wav> --params depth=5 attack=5`.
- **`/home/m/re-tools/fit_curves.py`** — фит LUT (остаётся как аналитический эквивалент; LUT в sim.py приоритетнее).
- probes500/probes500b_wav+byp — зонды ширины нотча; prb_*/prb2_* — рендеры.
- `synth_multi.py` (AM-комб 200–3000Hz резонансный), `burst500.wav` + `burst500_b1.rpp/.wav` + `burst500_byp.rpp/.wav` (burst-атак/релиз band1@500Hz), `burst_dep0/dep1/sel0/sel2/sel5.rpp/.wav` (τ-sweep), `comb.wav` + `comb_b1_*.rpp/wav`, `comb_dep_{0..1}`, `depthcurve.npy`. **Рендеры Reaper = 24-bit** — читать с `sampwidth=3`, не 16-bit!
- `/home/m/re-tools/patchparam.py` — патчер PARAM в base64 state с формат-сохранением (128-wrap, `depth=...!` → %.16f).
- `/home/m/re-tools/spec.py`, `probe.py`, `notch.py`, `synth.py`, `mkbase.py`, `tt_sweep.py`.
- `/home/m/soothe-bt/tone1kq.wav` (чистый 1k, -18dBFS), `dual.wav` (500+2000Hz), `resonant.wav` (500Hz-резонанс).
- `/home/m/soothe-bt/t1kq_*.rpp/wav`, `res_only1_*.rpp/wav`, `dual_b1_*.rpp/wav`.
- `/home/m/re-tools/sweep.py` — адаптивный генератор RPP (tpl фиксирован, для смены файла использовать mkbase + tt_sweep).
- `/home/m/soothe-bt/tt_base.rpp` (template: testtone + дефолтные парамы), `tt_ref.wav`.
- `/home/m/soothe-bt/s_corr_{sel,os,res,mix,mode}*.wav` — верифицированные свипы на resonant.wav.
- `/home/m/soothe-bt/render_v5.rpp`, `s_ref2.wav` (бит-в-бит оригинал).
## Фаза 3: Трекинг подтверждён (aug 16) — ARCHITECTURE REVISION
- **Вход-зависимость**: ред@1k растёт с уровнем сигнала (band1=1000, тон 1k):
`-27→-21→-15→-12→-9→-6→-3 dBFS``5.80→7.75→9.91→11.05→12.21→13.40→14.60 dB`. amount растёт с уровнем детектируемого резонанса (не бинарный порог).
- **Трекинг нотча** (fresh renders `trk_b1_*`, вход tone1k 1k, band1∈{500,1000,2000}, длинная FFT): нотч ВСЕГДА на fc=тон=1k, band-частота НЕ двигает позицию режектора:
- band=500 → 11.91dB, band=1000 → 15.82dB, band=2000 → 11.91dB, band1 off → 9.80dB, sens=0 → 9.80dB.
- Единственный вклад band-EQ — ВЕС глубины детекции в области (совпадение band~тон даёт +4dB; off/sens0 2dB).
- **Мульти-пики**: dual (500+2000), оба нотча активны одновременно при sel=1..20 (~10dB оба) → детектор находит НЕСКОЛЬКО резонансов; selectivity НЕ регулирует число нотчей на явных тонах.
- **Пользователь (иерархия)**: детектор оценивает каждую частоту спектра; band-EQ формирует его ВХОД (усиление/ослабление детекции по областям, у band2 sens может быть 12); selectivity = отбор пиков; sharpness = форма нотча; depth = глобальная глубина.
- **Reaper-ловушка**: tt_sweep с ОТНОСИТЕЛЬНЫМ out_wav создаёт ПОДДИРЕКТОРИЮ → всегда абсолютный путь в RENDER_FILE.
- Файлы: `trk_base.rpp`, `trk_b1_{500,1000,2000,eqoff,sens0}.rpp/.wav`, `sel_base.rpp`, `sel_{1,3,10,20}.rpp/.wav`, `lvl_{03..27}db.wav` + `lvl_t_*.rpp/.wav`.
### Фаза 3b: amount зависИТ от уровня сигнала (не просто порог)
- lvl_sweep (тон 1k, band1@1000, depth=0.864): ред@1k = 5.80 / 7.75 / 9.91 / 11.05 / 12.21 / 13.40 / 14.60 для 27..3 dBFS.
- При depth=10: 21.67 / 24.15 / 26.63 / 27.86 / 29.09 / 30.33 / 31.56. Наклон d(ред)/d(level) ≈ 0.370.41 dB/dB обоих depth → amount ∝ уровень^p (монотонно с насыщением), НЕ бинарный порог. depth — масштаб, не floor.
- Обе кривые монотонны и близки по форме (отношение ~2.2 при громком, ~3.7 при тихом → форма зависит от depth слабо).
### Фаза 4 (aug 16): КАРТА EQ-ВЕСОВ ДЕТЕКТОРА
- **`on` полосы = enable детекторного веса**; off-полоса её sens НЕ отдаёт в детекцию. Подтверждения:
- eqT_b1_b2/b3/b4/b2b3b4 и trk_b1_500 (sens off-полос любая) ВСЕ = 11.91dB (только от b1 sens12); eq_off_sensfac (все off, factory sens) = 9.80dB = нейтраль.
- eq1778_b2s_12 (b2 on=0) = 11.81, b1on12_b2s12 (b2 on=1) = 17.60 — ЕДИНСТВЕННАЯ разница band2 on.
- Баг в раннем clear_bands сбрасывал b1 sens→0 (eq_b1_on был sens0=нейтраль 9.80; правильный net_b1on12 sens12 = 11.91).
- **S(sens) при совмещённом весе (band1@1k, тон 1k)**: sens 0/6/9/12/18/24 → boost над полом 0.00/3.16/4.65/6.02/6.02/6.02 dB.
boost = 6.02·min(1, sens/12), насыщение +6dB при sens≥12 (не монотонно из-за сатурации детектора, не бага).
- **W(f) — колокол EQ-веса** (тон 1k, одна полоса on sens12, варьирую band freq):
- band1 (q≈1): 500→11.91(+2.11), 600→12.80(+3.00), 750→14.28(+4.48), 850→15.19(+5.39), 950→15.75(+5.95), 1000→15.82(+6.02), 1050→15.76, 1200→15.05(+5.25), 1500→13.44(+3.64), 2000→11.91(+2.11), 2500→11.16(+1.36). Симметричный широкий колокол (первый октав хвост +2.1dB, не спадает к 0).
- band2 (q≈4.5): 600→10.15(+0.35), 750→10.78(+0.98), 850→11.97(+2.17), 1000→15.80(+6.00), 1200→11.68(+1.88), 1500→10.34(+0.54) — РЕЗКИЙ колокол. **Q полосы управляет шириной детекторного веса** (q=4.5 на −1 октаве теряет ~полностью, q=1 теряет только ~66%).
- **Позиция нотча**: band freq не двигает режектор (всегда на резонансе тона); EQ-веса модулируют ТОЛЬКО глубину.
- Новый модельный блок: `red(f_tone) = floor(level) + Σ_on boost_i`, `boost_i = 6.02·min(1,|sens_i|/12)·H_q(f_tone; fc_i, Q_i)`.
- Файлы: `wf_{600,750,...,2500}.wav` (band1 q-sweep), `ws_{6,9,18,24}.wav` (aligned sens), `b2q_{600..1500}.wav` (band2 q=4.5 sweep), `b1on12_b2{on12,s12}.wav`.
### Фаза 5 (aug 16): STFT-параметры детектора (Stage 1)
- **Хоп/задержка**: tone-jump зонд tj.wav (1k→1.5k в t=2.0s) → нотч пересаживается на новый резонанс за ~1 кадр ≈ 18мс (hop ≤ 512 сэмплов). Трекинг чирпа 400→2000Hz в реальном времени, dt≈0.03→0.05s (шум оценки FFT-бина, значимой задержки нет).
- **Разрешение по частоте**: пары 1000+1040 → сливаются в один широкий нотч; 1000+1100 разделяются (центры ≈996/1104, но провал между ними всё ещё глубокий); 1000+1200 → два чётких отдельных нотча с полным восстановлением на 1100. → окно FFT ≈ 10242048 (бины 2143Hz), multiple-нотч подтверждён.
- **Энерготрекинг (fx@f по окну 2048, sync-Goertzel)**: до прыжка fx@100024dB (ред ~14dB), после — fx@1500 ≈ −23.8dB. Двойной бурст (gap 10..100ms) → нотч на том же тоне не переоткрывается между бурстами (ред остаётся ~4dB floor) — bурст probe (осб) указывает на фиксированный window-центр, не пер-открытие.
- Вывод для v5: STFT с окном ~2048, хоп ~5121024; window function Hann; детектор по |X| per-bin → локальные пики (selectivity); EQ-веса W(f) как множитель sensitivity per-bin; per-пик нотч (bandstop Q=sharpness).
- Файлы: `chirp_log_400_2000.wav`, `chirp_trk.rpp/.wav`, `pair_{1040,1100,1200}.wav` + `pair_trk_{40,100,200}`, `dburst_{10,20,50,100}.wav` + `dburst_trk_*`, `tj.wav` + `tj_trk.rpp/.wav`.
### Фаза 6 (aug 16): КОЛОКОЛ EQ-ВЕСА + SHARPNESS + level-floor (Stage 2 фит)
- **H(f) — колокол**: `H(f) = 1/sqrt(1 + (Qeff·A)²)`, `A = f/fc fc/f`. Qeff = **1.54·q^1.33** (q=1→1.54, 2→3.32, 3→5.64, 6→16.8). Воспроизводит кривую band1 (wf_*) с ошибкой ≤0.15dB по всему диапазону 500..2500.
- **Sharpness → Q нотча**: psh_{1,3,5,10} (probes500, drive 500·0.2, band1@500): центр 505Hz red 1.3/4.3/6.8/8.7dB; ширина Q_notch≈1.15·sharp (sh10→~11, sh5→~6, sh3→~3, sh1→~1.2). Центр-глубина НЕ постоянна — растёт с sharp (1.3→8.7), т.е. sharp масштабирует amount И Q.
- **level-floor (нейтраль)**: `neut_{24..3}` (все полосы off/sens0, тон 1k): red = 2.22/3.36/4.85/5.71/6.65/7.65 dB при 24/18/12/9/6/3 dBFS rms. Монотонно, наклон ~0.31 dB/dB. `al_{*}` (b1@1000 sens12): 5.80/7.75/9.91/11.04/12.21/13.39 → boost = 3.59/4.39/5.06/5.33/5.56/5.74, **насыщается к ~6dB** с уровнем (не аддитивен в dB!).
- Модель amount: `red(f) = curv(level·G_eq(f))` с насыщением (не линейный сдвиг в dB). depth масштабирует (фаза 3b). Для sim: 2D LUT level×W.
- Файлы: `lvl_tone_lv{24,18,12,9,6,3}.wav`, `neut_{*}.rpp/.wav`, `al_{*}.rpp/.wav`, `psh_{1,3,5,10}.rpp/.wav`.
+30
View File
@@ -0,0 +1,30 @@
import base64, re
def decode(path):
txt=open(path).read()
lines=txt.split('\n')
for i,l in enumerate(lines):
if 'soothe2_x64.vst3' in l:
b=[]
j=i+1
while j<len(lines):
t=lines[j].strip()
if t=='}': break
b.append(t); j+=1
raw=re.sub(r'\s','',''.join(b))
raw=raw.rstrip('=')
raw+='='*((-len(raw))%4)
dec=base64.b64decode(raw)
# dec is nested: outer base64 blob contains an inner chunked-xml whose first child is another base64 or actual xml
# find '<PARAM ...' anywhere after utf8 decode of inner
# Look for actual XML PARAM tags embedded (they are inside processorStateData attribute - base64 too)
# Simplest: find 'band1 mode' bytes
for pidname in [b'band1 mode', b'band1 q', b'band1 sens', b'band1 freq', b'band1 on']:
i2=dec.find(pidname)
if i2>=0:
seg=dec[i2-60:i2+80]
m=re.search(rb'<PARAM id="([^"]+)" value="([^"]+)"', seg)
if m:
print(f" {m.group(1).decode():16s} = {m.group(2).decode()}")
return
for f in ['/home/m/soothe-bt/t1kq_b1f_800.rpp','/home/m/soothe-bt/dual_b1q_0.1.rpp','/home/m/soothe-bt/dual_b1q_10.0.rpp','/home/m/soothe-bt/dual_b1q_1.0.rpp','/home/m/soothe-bt/t1k_b1f_1100.rpp']:
print("=== ",f.split('/')[-1]); decode(f)
+46
View File
@@ -0,0 +1,46 @@
#!/usr/bin/env python3
import base64, re, sys
def full_decode(path):
txt = open(path).read()
lines = txt.split('\n')
for i, l in enumerate(lines):
if 'soothe2_x64.vst3' in l:
b = []
j = i + 1
while j < len(lines):
t = lines[j].strip()
if t == '}':
break
b.append(t)
j += 1
raw = re.sub(r'\s', '', ''.join(b))
raw = raw.rstrip('=')
raw += '=' * ((-len(raw)) % 4)
dec = base64.b64decode(raw)
# print first bytes overview
print('decoded blob len', len(dec))
# Look for inner base64 chunked xml (soothe2 vst uses nested b64)
# search for PARAM tags in raw decoded bytes
tags = re.findall(rb'<PARAM id="([^"]+)" value="([^"]+)"', dec)
if tags:
for pid, val in tags:
print(f' {pid.decode():16s} = {val.decode()}')
else:
# try inner b64
inner = re.sub(rb'[^A-Za-z0-9+/=]', b'', dec)
inner = inner.rstrip(b'=')
inner += b'=' * ((-len(inner)) % 4)
try:
dec2 = base64.b64decode(inner)
tags = re.findall(rb'<PARAM id="([^"]+)" value="([^"]+)"', dec2)
for pid, val in tags:
print(f' {pid.decode():16s} = {val.decode()}')
except Exception as e:
print(' inner b64 fail:', e)
return
print('no soothe2_x64.vst3 found')
for f in sys.argv[1:]:
print('===', f.split('/')[-1])
full_decode(f)
+55
View File
@@ -0,0 +1,55 @@
#!/usr/bin/env python3
"""Emit dsp/leveltrack_data.hpp: live level-tracker A[] + mask scalars from
handoff/rtctx_live.json (P1.5 realtime capture, render_long.rpp preset).
"""
import json, os
HERE = os.path.dirname(os.path.abspath(__file__))
SRC = os.path.join(HERE, 'rtctx_live.json')
OUT = os.path.join(HERE, '..', 'dsp', 'leveltrack_data.hpp')
d = json.load(open(SRC))
A_attack = d['A_4c0528'] # attack smoothing (fast), 341 double
A_release = d['A_3c0510'] # release smoothing (slow), 341 double
scalars = d['scalars'] # hex-offset -> float
def fmt_doubles(a):
return ", ".join("%.17g" % v for v in a)
lines = []
lines.append("// AUTOGENERATED from P1.5 realtime capture handoff/rtctx_live.json")
lines.append("// (render_long.rpp: attack=0 release=0 selectivity=10 sharpness=10 depth=0.864).")
lines.append("// Regenerate with handoff/emit_leveltrack.py. Do not edit by hand.")
lines.append("#pragma once")
lines.append("#include <cstddef>")
lines.append("")
lines.append("namespace ltk {")
lines.append("")
lines.append("// ctx = 0x2370040, marker +0x24 == 48000.0f (internal SR).")
lines.append("constexpr float CTX_INTERNAL_SR = 48000.0f;")
lines.append("")
lines.append("// mask scalars (float) captured live:")
for off, val in scalars.items():
lines.append(f"constexpr float SCALAR{off.upper()} = {val}f;")
lines.append("")
lines.append(f"constexpr size_t LEVEL_NBINS = {len(A_attack)};")
lines.append("")
lines.append("// per-bin level-tracker IIR attack coefficients (0x4c0528):")
lines.append(f"const double A_ATTACK[{len(A_attack)}] = {{")
for i in range(0, len(A_attack), 6):
lines.append(" " + ", ".join("%.17g" % v for v in A_attack[i:i+6]) + ",")
lines.append("};")
lines.append("")
lines.append("// per-bin level-tracker IIR release coefficients (0x3c0510 == 0x2c04f8):")
lines.append(f"const double A_RELEASE[{len(A_release)}] = {{")
for i in range(0, len(A_release), 6):
lines.append(" " + ", ".join("%.17g" % v for v in A_release[i:i+6]) + ",")
lines.append("};")
lines.append("")
lines.append("} // namespace ltk")
open(OUT, 'w').write("\n".join(lines) + "\n")
print(f"wrote {OUT}: attack={len(A_attack)} release={len(A_release)} scalars={len(scalars)}")
+70
View File
@@ -0,0 +1,70 @@
#!/usr/bin/env python3
"""Emit dsp/tables_data.hpp: embed captured live .npy tables as C arrays.
Sourced from handoff/rt*.npy (runtime capture of the DSP registry, NOTES_CAPTURE).
Output is a single header so the port zero-copies the real tables the plugin used.
"""
import numpy as np
import os
HERE = os.path.dirname(os.path.abspath(__file__))
OUT = os.path.join(HERE, "..", "dsp", "tables_data.hpp")
SPECS = [
("WIN_WINDOW", "rtwin_freq_44100.npy"), # 0x540658 FFT-conv window, 8193 f32
("WIN_FREQAXIS", "rtfreqaxis_48000_internal.npy"), # freq-axis 2048 f32 (internal SR 48000)
("WTA_WEIGHT", "rtwa_596.npy"), # [03] 0.596->0.126
("WTB_WEIGHT", "rtwb_404.npy"), # [04] 0.404->0.874
("WTC_WEIGHT", "rtwc_043.npy"), # [05]
("WTD_WEIGHT", "rtwd_956.npy"), # [06]
]
WINDOW_N = 8193
def fmt_floats(a):
s = []
for v in a:
r = ("%.9g" % float(v)).encode().decode("ascii")
s.append(r)
return s
def emit_header(out_path, blocks):
with open(out_path, "w") as f:
f.write("// AUTOGENERATED from runtime capture handoff/rt*.npy (NOTES_CAPTURE 2026-08-19).\n")
f.write("// Do not edit by hand; regenerate with handoff/emit_tables.py.\n")
f.write("#pragma once\n#include <cstddef>\n#include <cstdint>\n\n")
for name, npy_file, arr in blocks:
f.write(f"constexpr size_t {name}_COUNT = {arr.size};\n")
f.write(f"const float {name}[{arr.size}] = {{\n")
line = []
for s in fmt_floats(arr):
line.append(s)
if len(line) == 8:
f.write(" " + ", ".join(line) + ",\n")
line = []
if line:
f.write(" " + ", ".join(line) + ",\n")
f.write("};\n\n")
def main():
blocks = []
for name, filename in SPECS:
path = os.path.join(HERE, filename)
if not os.path.exists(path):
print(f"missing table {filename} — skipping")
continue
arr = np.load(path)
arr = arr.ravel().astype(np.float32)
if arr.shape[0] not in (WINDOW_N, 8193, 2048, 2049):
print(f"unexpected size for {filename}: {arr.shape}")
blocks.append((name, filename, arr))
print(f"loaded {filename}: {arr.shape} {arr.dtype}")
emit_header(OUT, blocks)
print(f"wrote {OUT} ({sum(b[2].size for b in blocks)} floats)")
if __name__ == "__main__":
main()
+56
View File
@@ -0,0 +1,56 @@
#!/usr/bin/env python3
"""extract_fft.py — extract FFT-related code regions from the rt snap into raw bins."""
import struct, mmap, os
SNAP = '/tmp/snap_rt.bin'
OUT = '/tmp/fft/'
# (name, addr, size)
TARGETS = [
('cplx_mul_8440', 0x180008440, 0x80),
('cplx_mul_kernel_c440', 0x18000c440, 0x100),
('stage_bfc0', 0x18000bfc0, 0x600),
('stage_c5e0', 0x18000c5e0, 0x600),
('twiddle_loader_39b00', 0x180039b00, 0x400),
('plan_gen_2f980', 0x18002f980, 0x1200),
('dispatcher_535a70', 0x180535a70, 0x100),
('scalar_140a10', 0x180140a10, 0x200),
('vector_140a70', 0x180140a70, 0x200),
('fft_kernel_a5a0', 0x18001a5a0, 0x100),
]
def main():
os.makedirs(OUT, exist_ok=True)
fd = os.open(SNAP, os.O_RDONLY)
sz = os.fstat(fd).st_size
mm = mmap.mmap(fd, 0, access=mmap.ACCESS_READ)
# parse region index once
regs = []
i = 0
while i + 16 <= sz:
lo, n = struct.unpack_from('<QQ', mm, i)
regs.append((lo, i + 16, n)) # (addr, data_off, size)
i += 16 + n
regs.sort()
def readabs(addr, n):
for lo, off, rn in regs:
if lo <= addr < lo + rn and addr - lo + n <= rn:
return mm[off + (addr - lo): off + (addr - lo) + n]
return None
for name, addr, n in TARGETS:
b = readabs(addr, n)
if b:
with open(os.path.join(OUT, name + '.bin'), 'wb') as f:
f.write(b)
print('%-28s 0x%x %d bytes OK' % (name, addr, len(b)))
else:
print('%-28s 0x%x MISSING' % (name, addr))
mm.close()
os.close(fd)
if __name__ == '__main__':
main()
Binary file not shown.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.
+648
View File
@@ -0,0 +1,648 @@
/tmp/det/caller_536300.bin: file format binary
Disassembly of section .data:
0000000180536300 <.data>:
180536300: 48 89 5c 24 08 mov QWORD PTR [rsp+0x8],rbx
180536305: 48 89 6c 24 18 mov QWORD PTR [rsp+0x18],rbp
18053630a: 48 89 74 24 20 mov QWORD PTR [rsp+0x20],rsi
18053630f: 48 89 54 24 10 mov QWORD PTR [rsp+0x10],rdx
180536314: 57 push rdi
180536315: 41 54 push r12
180536317: 41 55 push r13
180536319: 41 56 push r14
18053631b: 41 57 push r15
18053631d: 48 83 ec 50 sub rsp,0x50
180536321: 48 63 bc 24 a0 00 00 movsxd rdi,DWORD PTR [rsp+0xa0]
180536328: 00
180536329: 48 8d 15 88 aa 11 02 lea rdx,[rip+0x211aa88] # 0x182650db8
180536330: 4c 8b b4 24 b0 00 00 mov r14,QWORD PTR [rsp+0xb0]
180536337: 00
180536338: 49 8b e9 mov rbp,r9
18053633b: 0f 29 74 24 40 movaps XMMWORD PTR [rsp+0x40],xmm6
180536340: 49 8b d8 mov rbx,r8
180536343: 66 0f 6e b1 80 00 24 movd xmm6,DWORD PTR [rcx+0x240080]
18053634a: 00
18053634b: 8d 04 fd 00 00 00 00 lea eax,[rdi*8+0x0]
180536352: 4c 63 d0 movsxd r10,eax
180536355: 8d 04 3f lea eax,[rdi+rdi*1]
180536358: 0f 5b f6 cvtdq2ps xmm6,xmm6
18053635b: 4f 8d 24 96 lea r12,[r14+r10*4]
18053635f: 4c 63 d0 movsxd r10,eax
180536362: 4d 8d 3c bc lea r15,[r12+rdi*4]
180536366: 4c 89 a4 24 b0 00 00 mov QWORD PTR [rsp+0xb0],r12
18053636d: 00
18053636e: f3 0f 59 71 24 mulss xmm6,DWORD PTR [rcx+0x24]
180536373: 48 8d 0d 3e aa 11 02 lea rcx,[rip+0x211aa3e] # 0x182650db8
18053637a: 4b 8d 34 97 lea rsi,[r15+r10*4]
18053637e: 4e 8d 2c 96 lea r13,[rsi+r10*4]
180536382: ff 15 80 4c 67 01 call QWORD PTR [rip+0x1674c80] # 0x181bab008
180536388: f2 0f 10 0d b8 de f8 movsd xmm1,QWORD PTR [rip+0x1f8deb8] # 0x1824c4248
18053638f: 01
180536390: 44 8b cf mov r9d,edi
180536393: 0f 5a c6 cvtps2pd xmm0,xmm6
180536396: 85 c0 test eax,eax
180536398: 48 8b d3 mov rdx,rbx
18053639b: 49 8b cc mov rcx,r12
18053639e: 0f 94 84 24 a8 00 00 sete BYTE PTR [rsp+0xa8]
1805363a5: 00
1805363a6: f2 0f 5e c8 divsd xmm1,xmm0
1805363aa: 66 0f 5a d1 cvtpd2ps xmm2,xmm1
1805363ae: e8 4d 76 ff ff call 0x18052da00
1805363b3: 80 bd 10 08 00 00 00 cmp BYTE PTR [rbp+0x810],0x0
1805363ba: 44 8b c7 mov r8d,edi
1805363bd: 74 1a je 0x1805363d9
1805363bf: f3 0f 10 0d dd da f8 movss xmm1,DWORD PTR [rip+0x1f8dadd] # 0x1824c3ea4
1805363c6: 01
1805363c7: 48 8b 8c 24 88 00 00 mov rcx,QWORD PTR [rsp+0x88]
1805363ce: 00
1805363cf: e8 7c 77 ff ff call 0x18052db50
1805363d4: e9 88 01 00 00 jmp 0x180536561
1805363d9: f3 0f 10 35 c3 da f8 movss xmm6,DWORD PTR [rip+0x1f8dac3] # 0x1824c3ea4
1805363e0: 01
1805363e1: 48 8b ce mov rcx,rsi
1805363e4: 0f 28 ce movaps xmm1,xmm6
1805363e7: e8 64 77 ff ff call 0x18052db50
1805363ec: 44 8b c7 mov r8d,edi
1805363ef: 0f 57 c9 xorps xmm1,xmm1
1805363f2: 49 8b cd mov rcx,r13
1805363f5: e8 56 77 ff ff call 0x18052db50
1805363fa: 33 db xor ebx,ebx
1805363fc: 39 9d 14 08 00 00 cmp DWORD PTR [rbp+0x814],ebx
180536402: 0f 8e 1e 01 00 00 jle 0x180536526
180536408: 0f 29 7c 24 30 movaps XMMWORD PTR [rsp+0x30],xmm7
18053640d: 4c 8d a5 18 08 00 00 lea r12,[rbp+0x818]
180536414: f2 0f 10 3d 24 dd f8 movsd xmm7,QWORD PTR [rip+0x1f8dd24] # 0x1824c4140
18053641b: 01
18053641c: 0f 1f 40 00 nop DWORD PTR [rax+0x0]
180536420: 4c 8b 8c 24 b0 00 00 mov r9,QWORD PTR [rsp+0xb0]
180536427: 00
180536428: 49 8b d6 mov rdx,r14
18053642b: 4c 63 c3 movsxd r8,ebx
18053642e: 49 8b cf mov rcx,r15
180536431: 49 c1 e0 07 shl r8,0x7
180536435: 4c 03 c5 add r8,rbp
180536438: 89 7c 24 20 mov DWORD PTR [rsp+0x20],edi
18053643c: 80 bc 24 a8 00 00 00 cmp BYTE PTR [rsp+0xa8],0x0
180536443: 00
180536444: 74 07 je 0x18053644d
180536446: e8 35 f4 ff ff call 0x180535880
18053644b: eb 05 jmp 0x180536452
18053644d: e8 3e 0b 00 00 call 0x180536f90
180536452: 48 8d 15 5f a9 11 02 lea rdx,[rip+0x211a95f] # 0x182650db8
180536459: 48 8d 0d 58 a9 11 02 lea rcx,[rip+0x211a958] # 0x182650db8
180536460: ff 15 a2 4b 67 01 call QWORD PTR [rip+0x1674ba2] # 0x181bab008
180536466: 44 8b c7 mov r8d,edi
180536469: 49 8b d6 mov rdx,r14
18053646c: 49 8b cf mov rcx,r15
18053646f: 85 c0 test eax,eax
180536471: 75 07 jne 0x18053647a
180536473: e8 68 b4 ac ff call 0x1800018e0
180536478: eb 05 jmp 0x18053647f
18053647a: e8 51 b8 ac ff call 0x180001cd0
18053647f: 48 8d 15 32 a9 11 02 lea rdx,[rip+0x211a932] # 0x182650db8
180536486: 48 8d 0d 2b a9 11 02 lea rcx,[rip+0x211a92b] # 0x182650db8
18053648d: ff 15 75 4b 67 01 call QWORD PTR [rip+0x1674b75] # 0x181bab008
180536493: 44 8b c7 mov r8d,edi
180536496: 48 8b d6 mov rdx,rsi
180536499: 49 8b ce mov rcx,r14
18053649c: 85 c0 test eax,eax
18053649e: 75 07 jne 0x1805364a7
1805364a0: e8 5b bb ac ff call 0x180002000
1805364a5: eb 05 jmp 0x1805364ac
1805364a7: e8 94 b7 ac ff call 0x180001c40
1805364ac: 41 80 3c 24 00 cmp BYTE PTR [r12],0x0
1805364b1: 74 5d je 0x180536510
1805364b3: 48 8d 15 fe a8 11 02 lea rdx,[rip+0x211a8fe] # 0x182650db8
1805364ba: 48 8d 0d f7 a8 11 02 lea rcx,[rip+0x211a8f7] # 0x182650db8
1805364c1: ff 15 41 4b 67 01 call QWORD PTR [rip+0x1674b41] # 0x181bab008
1805364c7: 44 8b c7 mov r8d,edi
1805364ca: 49 8b d5 mov rdx,r13
1805364cd: 48 8b ce mov rcx,rsi
1805364d0: 85 c0 test eax,eax
1805364d2: 75 07 jne 0x1805364db
1805364d4: e8 b7 bb ac ff call 0x180002090
1805364d9: eb 05 jmp 0x1805364e0
1805364db: e8 d0 bc ac ff call 0x1800021b0
1805364e0: 48 8d 15 d1 a8 11 02 lea rdx,[rip+0x211a8d1] # 0x182650db8
1805364e7: 48 8d 0d ca a8 11 02 lea rcx,[rip+0x211a8ca] # 0x182650db8
1805364ee: ff 15 14 4b 67 01 call QWORD PTR [rip+0x1674b14] # 0x181bab008
1805364f4: 44 8b c7 mov r8d,edi
1805364f7: 48 8b d6 mov rdx,rsi
1805364fa: 85 c0 test eax,eax
1805364fc: 75 0a jne 0x180536508
1805364fe: 0f 28 c6 movaps xmm0,xmm6
180536501: e8 9a b4 ac ff call 0x1800019a0
180536506: eb 08 jmp 0x180536510
180536508: 0f 28 c7 movaps xmm0,xmm7
18053650b: e8 c0 bd ac ff call 0x1800022d0
180536510: ff c3 inc ebx
180536512: 49 ff c4 inc r12
180536515: 3b 9d 14 08 00 00 cmp ebx,DWORD PTR [rbp+0x814]
18053651b: 0f 8c ff fe ff ff jl 0x180536420
180536521: 0f 28 7c 24 30 movaps xmm7,XMMWORD PTR [rsp+0x30]
180536526: 8b 85 14 08 00 00 mov eax,DWORD PTR [rbp+0x814]
18053652c: 83 f8 01 cmp eax,0x1
18053652f: 7e 1d jle 0x18053654e
180536531: ff c8 dec eax
180536533: 48 63 c8 movsxd rcx,eax
180536536: 80 bc 29 18 08 00 00 cmp BYTE PTR [rcx+rbp*1+0x818],0x0
18053653d: 00
18053653e: 75 0e jne 0x18053654e
180536540: 44 8b c7 mov r8d,edi
180536543: 48 8b d6 mov rdx,rsi
180536546: 49 8b cd mov rcx,r13
180536549: e8 42 74 ff ff call 0x18052d990
18053654e: 48 8b 8c 24 88 00 00 mov rcx,QWORD PTR [rsp+0x88]
180536555: 00
180536556: 44 8b c7 mov r8d,edi
180536559: 49 8b d5 mov rdx,r13
18053655c: e8 5f 76 ff ff call 0x18052dbc0
180536561: 0f 28 74 24 40 movaps xmm6,XMMWORD PTR [rsp+0x40]
180536566: 4c 8d 5c 24 50 lea r11,[rsp+0x50]
18053656b: 49 8b 5b 30 mov rbx,QWORD PTR [r11+0x30]
18053656f: 49 8b 6b 40 mov rbp,QWORD PTR [r11+0x40]
180536573: 49 8b 73 48 mov rsi,QWORD PTR [r11+0x48]
180536577: 49 8b e3 mov rsp,r11
18053657a: 41 5f pop r15
18053657c: 41 5e pop r14
18053657e: 41 5d pop r13
180536580: 41 5c pop r12
180536582: 5f pop rdi
180536583: c3 ret
180536584: cc int3
180536585: cc int3
180536586: cc int3
180536587: cc int3
180536588: cc int3
180536589: cc int3
18053658a: cc int3
18053658b: cc int3
18053658c: cc int3
18053658d: cc int3
18053658e: cc int3
18053658f: cc int3
180536590: 48 8d 05 29 a7 11 02 lea rax,[rip+0x211a729] # 0x182650cc0
180536597: c3 ret
180536598: cc int3
180536599: cc int3
18053659a: cc int3
18053659b: cc int3
18053659c: cc int3
18053659d: cc int3
18053659e: cc int3
18053659f: cc int3
1805365a0: 48 8d 05 b1 5b f7 01 lea rax,[rip+0x1f75bb1] # 0x1824ac158
1805365a7: 48 89 02 mov QWORD PTR [rdx],rax
1805365aa: 48 8b c2 mov rax,rdx
1805365ad: 0f 10 41 08 movups xmm0,XMMWORD PTR [rcx+0x8]
1805365b1: 0f 11 42 08 movups XMMWORD PTR [rdx+0x8],xmm0
1805365b5: c3 ret
1805365b6: cc int3
1805365b7: cc int3
1805365b8: cc int3
1805365b9: cc int3
1805365ba: cc int3
1805365bb: cc int3
1805365bc: cc int3
1805365bd: cc int3
1805365be: cc int3
1805365bf: cc int3
1805365c0: 48 8d 05 d9 a9 11 02 lea rax,[rip+0x211a9d9] # 0x182650fa0
1805365c7: c3 ret
1805365c8: cc int3
1805365c9: cc int3
1805365ca: cc int3
1805365cb: cc int3
1805365cc: cc int3
1805365cd: cc int3
1805365ce: cc int3
1805365cf: cc int3
1805365d0: 48 8d 05 41 61 f7 01 lea rax,[rip+0x1f76141] # 0x1824ac718
1805365d7: 48 89 02 mov QWORD PTR [rdx],rax
1805365da: f2 0f 10 41 08 movsd xmm0,QWORD PTR [rcx+0x8]
1805365df: f2 0f 11 42 08 movsd QWORD PTR [rdx+0x8],xmm0
1805365e4: 8b 41 10 mov eax,DWORD PTR [rcx+0x10]
1805365e7: 89 42 10 mov DWORD PTR [rdx+0x10],eax
1805365ea: 48 8b c2 mov rax,rdx
1805365ed: c3 ret
1805365ee: cc int3
1805365ef: cc int3
1805365f0: 84 d2 test dl,dl
1805365f2: 74 0a je 0x1805365fe
1805365f4: ba 20 00 00 00 mov edx,0x20
1805365f9: e9 f6 aa bf 00 jmp 0x1811310f4
1805365fe: c3 ret
1805365ff: cc int3
180536600: 48 8d 05 d9 84 11 02 lea rax,[rip+0x21184d9] # 0x18264eae0
180536607: c3 ret
180536608: cc int3
180536609: cc int3
18053660a: cc int3
18053660b: cc int3
18053660c: cc int3
18053660d: cc int3
18053660e: cc int3
18053660f: cc int3
180536610: 48 8d 05 71 52 f7 01 lea rax,[rip+0x1f75271] # 0x1824ab888
180536617: 48 89 02 mov QWORD PTR [rdx],rax
18053661a: 0f 10 41 08 movups xmm0,XMMWORD PTR [rcx+0x8]
18053661e: 0f 11 42 08 movups XMMWORD PTR [rdx+0x8],xmm0
180536622: 48 8b 41 18 mov rax,QWORD PTR [rcx+0x18]
180536626: 48 89 42 18 mov QWORD PTR [rdx+0x18],rax
18053662a: 48 8b c2 mov rax,rdx
18053662d: c3 ret
18053662e: cc int3
18053662f: cc int3
180536630: 48 8d 05 a9 a9 11 02 lea rax,[rip+0x211a9a9] # 0x182650fe0
180536637: c3 ret
180536638: cc int3
180536639: cc int3
18053663a: cc int3
18053663b: cc int3
18053663c: cc int3
18053663d: cc int3
18053663e: cc int3
18053663f: cc int3
180536640: 48 8d 05 a1 54 f7 01 lea rax,[rip+0x1f754a1] # 0x1824abae8
180536647: 48 89 02 mov QWORD PTR [rdx],rax
18053664a: 48 8b 41 08 mov rax,QWORD PTR [rcx+0x8]
18053664e: 48 89 42 08 mov QWORD PTR [rdx+0x8],rax
180536652: 48 8b c2 mov rax,rdx
180536655: c3 ret
180536656: cc int3
180536657: cc int3
180536658: cc int3
180536659: cc int3
18053665a: cc int3
18053665b: cc int3
18053665c: cc int3
18053665d: cc int3
18053665e: cc int3
18053665f: cc int3
180536660: 48 8d 05 a9 a4 11 02 lea rax,[rip+0x211a4a9] # 0x182650b10
180536667: c3 ret
180536668: cc int3
180536669: cc int3
18053666a: cc int3
18053666b: cc int3
18053666c: cc int3
18053666d: cc int3
18053666e: cc int3
18053666f: cc int3
180536670: 48 8d 05 49 59 f7 01 lea rax,[rip+0x1f75949] # 0x1824abfc0
180536677: 48 89 02 mov QWORD PTR [rdx],rax
18053667a: 48 8b 41 08 mov rax,QWORD PTR [rcx+0x8]
18053667e: 48 89 42 08 mov QWORD PTR [rdx+0x8],rax
180536682: 48 8b c2 mov rax,rdx
180536685: c3 ret
180536686: cc int3
180536687: cc int3
180536688: cc int3
180536689: cc int3
18053668a: cc int3
18053668b: cc int3
18053668c: cc int3
18053668d: cc int3
18053668e: cc int3
18053668f: cc int3
180536690: 48 8d 05 e9 a2 11 02 lea rax,[rip+0x211a2e9] # 0x182650980
180536697: c3 ret
180536698: cc int3
180536699: cc int3
18053669a: cc int3
18053669b: cc int3
18053669c: cc int3
18053669d: cc int3
18053669e: cc int3
18053669f: cc int3
1805366a0: 48 8d 05 79 48 f7 01 lea rax,[rip+0x1f74879] # 0x1824aaf20
1805366a7: 48 89 02 mov QWORD PTR [rdx],rax
1805366aa: 48 8b 41 08 mov rax,QWORD PTR [rcx+0x8]
1805366ae: 48 89 42 08 mov QWORD PTR [rdx+0x8],rax
1805366b2: 48 8b c2 mov rax,rdx
1805366b5: c3 ret
1805366b6: cc int3
1805366b7: cc int3
1805366b8: cc int3
1805366b9: cc int3
1805366ba: cc int3
1805366bb: cc int3
1805366bc: cc int3
1805366bd: cc int3
1805366be: cc int3
1805366bf: cc int3
1805366c0: 48 8d 05 b9 96 11 02 lea rax,[rip+0x21196b9] # 0x18264fd80
1805366c7: c3 ret
1805366c8: cc int3
1805366c9: cc int3
1805366ca: cc int3
1805366cb: cc int3
1805366cc: cc int3
1805366cd: cc int3
1805366ce: cc int3
1805366cf: cc int3
1805366d0: 48 8d 05 99 52 f7 01 lea rax,[rip+0x1f75299] # 0x1824ab970
1805366d7: 48 89 02 mov QWORD PTR [rdx],rax
1805366da: 48 8b 41 08 mov rax,QWORD PTR [rcx+0x8]
1805366de: 48 89 42 08 mov QWORD PTR [rdx+0x8],rax
1805366e2: 48 8b c2 mov rax,rdx
1805366e5: c3 ret
1805366e6: cc int3
1805366e7: cc int3
1805366e8: cc int3
1805366e9: cc int3
1805366ea: cc int3
1805366eb: cc int3
1805366ec: cc int3
1805366ed: cc int3
1805366ee: cc int3
1805366ef: cc int3
1805366f0: 48 8d 05 f1 9a 11 02 lea rax,[rip+0x2119af1] # 0x1826501e8
1805366f7: c3 ret
1805366f8: cc int3
1805366f9: cc int3
1805366fa: cc int3
1805366fb: cc int3
1805366fc: cc int3
1805366fd: cc int3
1805366fe: cc int3
1805366ff: cc int3
180536700: 48 8d 05 01 50 f7 01 lea rax,[rip+0x1f75001] # 0x1824ab708
180536707: 48 89 02 mov QWORD PTR [rdx],rax
18053670a: 48 8b 41 08 mov rax,QWORD PTR [rcx+0x8]
18053670e: 48 89 42 08 mov QWORD PTR [rdx+0x8],rax
180536712: 48 8b c2 mov rax,rdx
180536715: c3 ret
180536716: cc int3
180536717: cc int3
180536718: cc int3
180536719: cc int3
18053671a: cc int3
18053671b: cc int3
18053671c: cc int3
18053671d: cc int3
18053671e: cc int3
18053671f: cc int3
180536720: 48 8d 05 d9 a5 11 02 lea rax,[rip+0x211a5d9] # 0x182650d00
180536727: c3 ret
180536728: cc int3
180536729: cc int3
18053672a: cc int3
18053672b: cc int3
18053672c: cc int3
18053672d: cc int3
18053672e: cc int3
18053672f: cc int3
180536730: 48 8d 05 31 48 f7 01 lea rax,[rip+0x1f74831] # 0x1824aaf68
180536737: 48 89 02 mov QWORD PTR [rdx],rax
18053673a: 48 8b 41 08 mov rax,QWORD PTR [rcx+0x8]
18053673e: 48 89 42 08 mov QWORD PTR [rdx+0x8],rax
180536742: 48 8b c2 mov rax,rdx
180536745: c3 ret
180536746: cc int3
180536747: cc int3
180536748: cc int3
180536749: cc int3
18053674a: cc int3
18053674b: cc int3
18053674c: cc int3
18053674d: cc int3
18053674e: cc int3
18053674f: cc int3
180536750: 48 8d 05 49 9d 11 02 lea rax,[rip+0x2119d49] # 0x1826504a0
180536757: c3 ret
180536758: cc int3
180536759: cc int3
18053675a: cc int3
18053675b: cc int3
18053675c: cc int3
18053675d: cc int3
18053675e: cc int3
18053675f: cc int3
180536760: 48 8d 05 59 4e f7 01 lea rax,[rip+0x1f74e59] # 0x1824ab5c0
180536767: 48 89 02 mov QWORD PTR [rdx],rax
18053676a: 48 8b 41 08 mov rax,QWORD PTR [rcx+0x8]
18053676e: 48 89 42 08 mov QWORD PTR [rdx+0x8],rax
180536772: 48 8b c2 mov rax,rdx
180536775: c3 ret
180536776: cc int3
180536777: cc int3
180536778: cc int3
180536779: cc int3
18053677a: cc int3
18053677b: cc int3
18053677c: cc int3
18053677d: cc int3
18053677e: cc int3
18053677f: cc int3
180536780: 48 8d 05 49 80 11 02 lea rax,[rip+0x2118049] # 0x18264e7d0
180536787: c3 ret
180536788: cc int3
180536789: cc int3
18053678a: cc int3
18053678b: cc int3
18053678c: cc int3
18053678d: cc int3
18053678e: cc int3
18053678f: cc int3
180536790: 48 8d 05 79 46 f7 01 lea rax,[rip+0x1f74679] # 0x1824aae10
180536797: 48 89 02 mov QWORD PTR [rdx],rax
18053679a: 48 8b 41 08 mov rax,QWORD PTR [rcx+0x8]
18053679e: 48 89 42 08 mov QWORD PTR [rdx+0x8],rax
1805367a2: 48 8b c2 mov rax,rdx
1805367a5: c3 ret
1805367a6: cc int3
1805367a7: cc int3
1805367a8: cc int3
1805367a9: cc int3
1805367aa: cc int3
1805367ab: cc int3
1805367ac: cc int3
1805367ad: cc int3
1805367ae: cc int3
1805367af: cc int3
1805367b0: 48 8d 05 c9 a0 11 02 lea rax,[rip+0x211a0c9] # 0x182650880
1805367b7: c3 ret
1805367b8: cc int3
1805367b9: cc int3
1805367ba: cc int3
1805367bb: cc int3
1805367bc: cc int3
1805367bd: cc int3
1805367be: cc int3
1805367bf: cc int3
1805367c0: 48 8d 05 01 5c f7 01 lea rax,[rip+0x1f75c01] # 0x1824ac3c8
1805367c7: 48 89 02 mov QWORD PTR [rdx],rax
1805367ca: 48 8b 41 08 mov rax,QWORD PTR [rcx+0x8]
1805367ce: 48 89 42 08 mov QWORD PTR [rdx+0x8],rax
1805367d2: 48 8b c2 mov rax,rdx
1805367d5: c3 ret
1805367d6: cc int3
1805367d7: cc int3
1805367d8: cc int3
1805367d9: cc int3
1805367da: cc int3
1805367db: cc int3
1805367dc: cc int3
1805367dd: cc int3
1805367de: cc int3
1805367df: cc int3
1805367e0: 48 8d 05 29 80 11 02 lea rax,[rip+0x2118029] # 0x18264e810
1805367e7: c3 ret
1805367e8: cc int3
1805367e9: cc int3
1805367ea: cc int3
1805367eb: cc int3
1805367ec: cc int3
1805367ed: cc int3
1805367ee: cc int3
1805367ef: cc int3
1805367f0: 48 8d 05 39 51 f7 01 lea rax,[rip+0x1f75139] # 0x1824ab930
1805367f7: 48 89 02 mov QWORD PTR [rdx],rax
1805367fa: 48 8b 41 08 mov rax,QWORD PTR [rcx+0x8]
1805367fe: 48 89 42 08 mov QWORD PTR [rdx+0x8],rax
180536802: 48 8b c2 mov rax,rdx
180536805: c3 ret
180536806: cc int3
180536807: cc int3
180536808: cc int3
180536809: cc int3
18053680a: cc int3
18053680b: cc int3
18053680c: cc int3
18053680d: cc int3
18053680e: cc int3
18053680f: cc int3
180536810: 48 8d 05 59 8b 11 02 lea rax,[rip+0x2118b59] # 0x18264f370
180536817: c3 ret
180536818: cc int3
180536819: cc int3
18053681a: cc int3
18053681b: cc int3
18053681c: cc int3
18053681d: cc int3
18053681e: cc int3
18053681f: cc int3
180536820: 48 8d 05 81 48 f7 01 lea rax,[rip+0x1f74881] # 0x1824ab0a8
180536827: 48 89 02 mov QWORD PTR [rdx],rax
18053682a: 48 8b 41 08 mov rax,QWORD PTR [rcx+0x8]
18053682e: 48 89 42 08 mov QWORD PTR [rdx+0x8],rax
180536832: 48 8b c2 mov rax,rdx
180536835: c3 ret
180536836: cc int3
180536837: cc int3
180536838: cc int3
180536839: cc int3
18053683a: cc int3
18053683b: cc int3
18053683c: cc int3
18053683d: cc int3
18053683e: cc int3
18053683f: cc int3
180536840: 48 8d 05 69 9e 11 02 lea rax,[rip+0x2119e69] # 0x1826506b0
180536847: c3 ret
180536848: cc int3
180536849: cc int3
18053684a: cc int3
18053684b: cc int3
18053684c: cc int3
18053684d: cc int3
18053684e: cc int3
18053684f: cc int3
180536850: 48 8d 05 c1 4f f7 01 lea rax,[rip+0x1f74fc1] # 0x1824ab818
180536857: 48 89 02 mov QWORD PTR [rdx],rax
18053685a: 48 8b 41 08 mov rax,QWORD PTR [rcx+0x8]
18053685e: 48 89 42 08 mov QWORD PTR [rdx+0x8],rax
180536862: 48 8b c2 mov rax,rdx
180536865: c3 ret
180536866: cc int3
180536867: cc int3
180536868: cc int3
180536869: cc int3
18053686a: cc int3
18053686b: cc int3
18053686c: cc int3
18053686d: cc int3
18053686e: cc int3
18053686f: cc int3
180536870: 48 8d 05 e9 88 11 02 lea rax,[rip+0x21188e9] # 0x18264f160
180536877: c3 ret
180536878: cc int3
180536879: cc int3
18053687a: cc int3
18053687b: cc int3
18053687c: cc int3
18053687d: cc int3
18053687e: cc int3
18053687f: cc int3
180536880: 48 8d 05 19 59 f7 01 lea rax,[rip+0x1f75919] # 0x1824ac1a0
180536887: 48 89 02 mov QWORD PTR [rdx],rax
18053688a: 48 8b 41 08 mov rax,QWORD PTR [rcx+0x8]
18053688e: 48 89 42 08 mov QWORD PTR [rdx+0x8],rax
180536892: 48 8b c2 mov rax,rdx
180536895: c3 ret
180536896: cc int3
180536897: cc int3
180536898: cc int3
180536899: cc int3
18053689a: cc int3
18053689b: cc int3
18053689c: cc int3
18053689d: cc int3
18053689e: cc int3
18053689f: cc int3
1805368a0: 48 8d 05 d9 8d 11 02 lea rax,[rip+0x2118dd9] # 0x18264f680
1805368a7: c3 ret
1805368a8: cc int3
1805368a9: cc int3
1805368aa: cc int3
1805368ab: cc int3
1805368ac: cc int3
1805368ad: cc int3
1805368ae: cc int3
1805368af: cc int3
1805368b0: 48 8d 05 d9 49 f7 01 lea rax,[rip+0x1f749d9] # 0x1824ab290
1805368b7: 48 89 02 mov QWORD PTR [rdx],rax
1805368ba: 48 8b 41 08 mov rax,QWORD PTR [rcx+0x8]
1805368be: 48 89 42 08 mov QWORD PTR [rdx+0x8],rax
1805368c2: 48 8b c2 mov rax,rdx
1805368c5: c3 ret
1805368c6: cc int3
1805368c7: cc int3
1805368c8: cc int3
1805368c9: cc int3
1805368ca: cc int3
1805368cb: cc int3
1805368cc: cc int3
1805368cd: cc int3
1805368ce: cc int3
1805368cf: cc int3
1805368d0: 48 8d 05 29 8e 11 02 lea rax,[rip+0x2118e29] # 0x18264f700
1805368d7: c3 ret
1805368d8: cc int3
1805368d9: cc int3
1805368da: cc int3
1805368db: cc int3
1805368dc: cc int3
1805368dd: cc int3
1805368de: cc int3
1805368df: cc int3
1805368e0: 48 8d 05 81 4c f7 01 lea rax,[rip+0x1f74c81] # 0x1824ab568
1805368e7: 48 89 02 mov QWORD PTR [rdx],rax
1805368ea: 48 8b 41 08 mov rax,QWORD PTR [rcx+0x8]
1805368ee: 48 89 42 08 mov QWORD PTR [rdx+0x8],rax
1805368f2: 48 8b c2 mov rax,rdx
1805368f5: c3 ret
1805368f6: cc int3
1805368f7: cc int3
1805368f8: cc int3
1805368f9: cc int3
1805368fa: cc int3
1805368fb: cc int3
1805368fc: cc int3
1805368fd: cc int3
1805368fe: cc int3
1805368ff: cc int3
+383
View File
@@ -0,0 +1,383 @@
; cons_52ec00 0x18052eb00-0x18052f100
/tmp/slice.bin: file format binary
Disassembly of section .data:
000000018052eb00 <.data>:
18052eb00: 0f af c8 imul %eax,%ecx
18052eb03: 8b 05 f7 cb 0f 02 mov 0x20fcbf7(%rip),%eax # 0x18262b700
18052eb09: 44 0f af e0 imul %eax,%r12d
18052eb0d: 8b 86 e0 04 24 00 mov 0x2404e0(%rsi),%eax
18052eb13: 05 e2 2c dc 06 add $0x6dc2ce2,%eax
18052eb18: 44 2b e1 sub %ecx,%r12d
18052eb1b: 25 7f 00 00 80 and $0x8000007f,%eax
18052eb20: 7d 07 jge 0x18052eb29
18052eb22: ff c8 dec %eax
18052eb24: 83 c8 80 or $0xffffff80,%eax
18052eb27: ff c0 inc %eax
18052eb29: 89 86 e0 04 24 00 mov %eax,0x2404e0(%rsi)
18052eb2f: 48 63 c8 movslq %eax,%rcx
18052eb32: 48 8b 86 b0 08 54 00 mov 0x5408b0(%rsi),%rax
18052eb39: f3 0f 10 04 88 movss (%rax,%rcx,4),%xmm0
18052eb3e: 8b 05 c0 cb 0f 02 mov 0x20fcbc0(%rip),%eax # 0x18262b704
18052eb44: 66 0f 6e d0 movd %eax,%xmm2
18052eb48: 8b 86 e0 04 24 00 mov 0x2404e0(%rsi),%eax
18052eb4e: ff c0 inc %eax
18052eb50: 48 63 c8 movslq %eax,%rcx
18052eb53: 48 8b 86 b0 08 54 00 mov 0x5408b0(%rsi),%rax
18052eb5a: 0f 5b d2 cvtdq2ps %xmm2,%xmm2
18052eb5d: f3 0f 59 d0 mulss %xmm0,%xmm2
18052eb61: f3 0f 10 04 88 movss (%rax,%rcx,4),%xmm0
18052eb66: 8b 05 5c ca 0f 02 mov 0x20fca5c(%rip),%eax # 0x18262b5c8
18052eb6c: 66 0f 6e c8 movd %eax,%xmm1
18052eb70: 8b 05 8a cb 0f 02 mov 0x20fcb8a(%rip),%eax # 0x18262b700
18052eb76: 0f 5b c9 cvtdq2ps %xmm1,%xmm1
18052eb79: f3 0f 59 c8 mulss %xmm0,%xmm1
18052eb7d: f3 0f 59 ca mulss %xmm2,%xmm1
18052eb81: f3 0f 58 cd addss %xmm5,%xmm1
18052eb85: f3 0f 2c d9 cvttss2si %xmm1,%ebx
18052eb89: 0f af d8 imul %eax,%ebx
18052eb8c: 8b 86 e0 04 24 00 mov 0x2404e0(%rsi),%eax
18052eb92: 05 9a f2 4b 00 add $0x4bf29a,%eax
18052eb97: 89 9c 24 f8 00 00 00 mov %ebx,0xf8(%rsp)
18052eb9e: 25 7f 00 00 80 and $0x8000007f,%eax
18052eba3: 7d 07 jge 0x18052ebac
18052eba5: ff c8 dec %eax
18052eba7: 83 c8 80 or $0xffffff80,%eax
18052ebaa: ff c0 inc %eax
18052ebac: 89 86 e0 04 24 00 mov %eax,0x2404e0(%rsi)
18052ebb2: 48 63 c8 movslq %eax,%rcx
18052ebb5: 48 8b 86 b0 08 54 00 mov 0x5408b0(%rsi),%rax
18052ebbc: f3 0f 10 04 88 movss (%rax,%rcx,4),%xmm0
18052ebc1: 8b 05 3d cb 0f 02 mov 0x20fcb3d(%rip),%eax # 0x18262b704
18052ebc7: 66 0f 6e d0 movd %eax,%xmm2
18052ebcb: 8b 86 e0 04 24 00 mov 0x2404e0(%rsi),%eax
18052ebd1: ff c0 inc %eax
18052ebd3: 48 63 c8 movslq %eax,%rcx
18052ebd6: 48 8b 86 b0 08 54 00 mov 0x5408b0(%rsi),%rax
18052ebdd: 0f 5b d2 cvtdq2ps %xmm2,%xmm2
18052ebe0: f3 0f 59 d0 mulss %xmm0,%xmm2
18052ebe4: f3 0f 10 04 88 movss (%rax,%rcx,4),%xmm0
18052ebe9: 8b 05 d9 c9 0f 02 mov 0x20fc9d9(%rip),%eax # 0x18262b5c8
18052ebef: 66 0f 6e c8 movd %eax,%xmm1
18052ebf3: 8b 05 07 cb 0f 02 mov 0x20fcb07(%rip),%eax # 0x18262b700
18052ebf9: 0f 5b c9 cvtdq2ps %xmm1,%xmm1
18052ebfc: f3 0f 59 c8 mulss %xmm0,%xmm1
18052ec00: f3 0f 59 ca mulss %xmm2,%xmm1
18052ec04: f3 0f 58 cd addss %xmm5,%xmm1
18052ec08: f3 0f 2c c9 cvttss2si %xmm1,%ecx
18052ec0c: 0f af c8 imul %eax,%ecx
18052ec0f: 8b 86 e0 04 24 00 mov 0x2404e0(%rsi),%eax
18052ec15: 05 94 62 cb 00 add $0xcb6294,%eax
18052ec1a: 66 0f 6e f1 movd %ecx,%xmm6
18052ec1e: 0f 5b f6 cvtdq2ps %xmm6,%xmm6
18052ec21: 25 7f 00 00 80 and $0x8000007f,%eax
18052ec26: 7d 07 jge 0x18052ec2f
18052ec28: ff c8 dec %eax
18052ec2a: 83 c8 80 or $0xffffff80,%eax
18052ec2d: ff c0 inc %eax
18052ec2f: 89 86 e0 04 24 00 mov %eax,0x2404e0(%rsi)
18052ec35: 48 63 c8 movslq %eax,%rcx
18052ec38: 48 8b 86 b0 08 54 00 mov 0x5408b0(%rsi),%rax
18052ec3f: f3 0f 10 04 88 movss (%rax,%rcx,4),%xmm0
18052ec44: 8b 05 ba ca 0f 02 mov 0x20fcaba(%rip),%eax # 0x18262b704
18052ec4a: 66 0f 6e e0 movd %eax,%xmm4
18052ec4e: 8b 86 e0 04 24 00 mov 0x2404e0(%rsi),%eax
18052ec54: ff c0 inc %eax
18052ec56: 48 63 c8 movslq %eax,%rcx
18052ec59: 48 8b 86 b0 08 54 00 mov 0x5408b0(%rsi),%rax
18052ec60: 0f 5b e4 cvtdq2ps %xmm4,%xmm4
18052ec63: f3 0f 59 e0 mulss %xmm0,%xmm4
18052ec67: f3 0f 10 04 88 movss (%rax,%rcx,4),%xmm0
18052ec6c: 8b 05 56 c9 0f 02 mov 0x20fc956(%rip),%eax # 0x18262b5c8
18052ec72: 66 0f 6e d8 movd %eax,%xmm3
18052ec76: 8b 86 e0 04 24 00 mov 0x2404e0(%rsi),%eax
18052ec7c: 0f 5b db cvtdq2ps %xmm3,%xmm3
18052ec7f: 05 e0 b5 10 00 add $0x10b5e0,%eax
18052ec84: f3 0f 59 d8 mulss %xmm0,%xmm3
18052ec88: 25 7f 00 00 80 and $0x8000007f,%eax
18052ec8d: 7d 07 jge 0x18052ec96
18052ec8f: ff c8 dec %eax
18052ec91: 83 c8 80 or $0xffffff80,%eax
18052ec94: ff c0 inc %eax
18052ec96: f3 0f 10 3d 06 52 f9 movss 0x1f95206(%rip),%xmm7 # 0x1824c3ea4
18052ec9d: 01
18052ec9e: 33 ff xor %edi,%edi
18052eca0: 89 86 e0 04 24 00 mov %eax,0x2404e0(%rsi)
18052eca6: 48 63 c8 movslq %eax,%rcx
18052eca9: 48 8b 86 b0 08 54 00 mov 0x5408b0(%rsi),%rax
18052ecb0: f3 0f 59 dc mulss %xmm4,%xmm3
18052ecb4: f3 0f 10 04 88 movss (%rax,%rcx,4),%xmm0
18052ecb9: 8b 05 45 ca 0f 02 mov 0x20fca45(%rip),%eax # 0x18262b704
18052ecbf: f3 0f 58 dd addss %xmm5,%xmm3
18052ecc3: 66 0f 6e d0 movd %eax,%xmm2
18052ecc7: 8b 86 e0 04 24 00 mov 0x2404e0(%rsi),%eax
18052eccd: ff c0 inc %eax
18052eccf: 48 63 c8 movslq %eax,%rcx
18052ecd2: 48 8b 86 b0 08 54 00 mov 0x5408b0(%rsi),%rax
18052ecd9: 0f 5b d2 cvtdq2ps %xmm2,%xmm2
18052ecdc: f3 44 0f 2c eb cvttss2si %xmm3,%r13d
18052ece1: f3 0f 59 d0 mulss %xmm0,%xmm2
18052ece5: f3 0f 10 04 88 movss (%rax,%rcx,4),%xmm0
18052ecea: 8b 05 d8 c8 0f 02 mov 0x20fc8d8(%rip),%eax # 0x18262b5c8
18052ecf0: 66 0f 6e c8 movd %eax,%xmm1
18052ecf4: 8b 05 06 ca 0f 02 mov 0x20fca06(%rip),%eax # 0x18262b700
18052ecfa: 0f 5b c9 cvtdq2ps %xmm1,%xmm1
18052ecfd: f3 0f 59 c8 mulss %xmm0,%xmm1
18052ed01: f3 0f 59 ca mulss %xmm2,%xmm1
18052ed05: f3 0f 58 cd addss %xmm5,%xmm1
18052ed09: f3 0f 2c c9 cvttss2si %xmm1,%ecx
18052ed0d: 0f af c8 imul %eax,%ecx
18052ed10: 8b 05 ea c9 0f 02 mov 0x20fc9ea(%rip),%eax # 0x18262b700
18052ed16: 44 0f af e8 imul %eax,%r13d
18052ed1a: 44 03 e9 add %ecx,%r13d
18052ed1d: 84 d2 test %dl,%dl
18052ed1f: 0f 85 95 03 00 00 jne 0x18052f0ba
18052ed25: 48 8b ce mov %rsi,%rcx
18052ed28: e8 d3 e0 ff ff call 0x18052ce00
18052ed2d: 8b 86 a0 01 00 00 mov 0x1a0(%rsi),%eax
18052ed33: 48 8d 8e 68 06 54 00 lea 0x540668(%rsi),%rcx
18052ed3a: 0f af c3 imul %ebx,%eax
18052ed3d: 0f 57 d2 xorps %xmm2,%xmm2
18052ed40: c1 e0 03 shl $0x3,%eax
18052ed43: 89 86 68 08 54 00 mov %eax,0x540868(%rsi)
18052ed49: 99 cltd
18052ed4a: 2b c2 sub %edx,%eax
18052ed4c: d1 f8 sar $1,%eax
18052ed4e: 8d 14 18 lea (%rax,%rbx,1),%edx
18052ed51: 89 96 6c 08 54 00 mov %edx,0x54086c(%rsi)
18052ed57: 03 d2 add %edx,%edx
18052ed59: e8 32 f4 ff ff call 0x18052e190
18052ed5e: 8b 96 6c 08 54 00 mov 0x54086c(%rsi),%edx
18052ed64: 48 8d 8e 98 06 54 00 lea 0x540698(%rsi),%rcx
18052ed6b: 0f 57 d2 xorps %xmm2,%xmm2
18052ed6e: e8 1d f4 ff ff call 0x18052e190
18052ed73: 8b d7 mov %edi,%edx
18052ed75: 39 be a0 06 54 00 cmp %edi,0x5406a0(%rsi)
18052ed7b: 7e 1e jle 0x18052ed9b
18052ed7d: 8b cf mov %edi,%ecx
18052ed7f: 90 nop
18052ed80: 48 8b 86 98 06 54 00 mov 0x540698(%rsi),%rax
18052ed87: 48 8d 49 04 lea 0x4(%rcx),%rcx
18052ed8b: ff c2 inc %edx
18052ed8d: f3 0f 11 74 01 fc movss %xmm6,-0x4(%rcx,%rax,1)
18052ed93: 3b 96 a0 06 54 00 cmp 0x5406a0(%rsi),%edx
18052ed99: 7c e5 jl 0x18052ed80
18052ed9b: 8b 96 6c 08 54 00 mov 0x54086c(%rsi),%edx
18052eda1: 48 8d 8e a8 06 54 00 lea 0x5406a8(%rsi),%rcx
18052eda8: 0f 57 d2 xorps %xmm2,%xmm2
18052edab: e8 e0 f3 ff ff call 0x18052e190
18052edb0: 8b 96 6c 08 54 00 mov 0x54086c(%rsi),%edx
18052edb6: 48 8d 8e b8 06 54 00 lea 0x5406b8(%rsi),%rcx
18052edbd: 0f 57 d2 xorps %xmm2,%xmm2
18052edc0: e8 cb f3 ff ff call 0x18052e190
18052edc5: 8b 96 6c 08 54 00 mov 0x54086c(%rsi),%edx
18052edcb: 48 8d 8e c8 06 54 00 lea 0x5406c8(%rsi),%rcx
18052edd2: 0f 57 d2 xorps %xmm2,%xmm2
18052edd5: e8 b6 f3 ff ff call 0x18052e190
18052edda: 8b 96 6c 08 54 00 mov 0x54086c(%rsi),%edx
18052ede0: 48 8d 8e d8 06 54 00 lea 0x5406d8(%rsi),%rcx
18052ede7: 0f 57 d2 xorps %xmm2,%xmm2
18052edea: e8 a1 f3 ff ff call 0x18052e190
18052edef: 8b 96 6c 08 54 00 mov 0x54086c(%rsi),%edx
18052edf5: 48 8d 8e e8 06 54 00 lea 0x5406e8(%rsi),%rcx
18052edfc: 0f 57 d2 xorps %xmm2,%xmm2
18052edff: e8 8c f3 ff ff call 0x18052e190
18052ee04: 45 8b fc mov %r12d,%r15d
18052ee07: 44 3b 66 30 cmp 0x30(%rsi),%r12d
18052ee0b: 0f 8d ee 01 00 00 jge 0x18052efff
18052ee11: 45 8b f5 mov %r13d,%r14d
18052ee14: 49 63 dc movslq %r12d,%rbx
18052ee17: 45 0f af f5 imul %r13d,%r14d
18052ee1b: 48 81 c3 73 40 05 00 add $0x54073,%rbx
18052ee22: 48 c1 e3 04 shl $0x4,%rbx
18052ee26: 41 c1 e6 0e shl $0xe,%r14d
18052ee2a: 48 03 de add %rsi,%rbx
18052ee2d: 0f 1f 00 nopl (%rax)
18052ee30: 8b ae 6c 08 54 00 mov 0x54086c(%rsi),%ebp
18052ee36: 8b 83 50 ff ff ff mov -0xb0(%rbx),%eax
18052ee3c: 3b c5 cmp %ebp,%eax
18052ee3e: 74 3e je 0x18052ee7e
18052ee40: 85 c0 test %eax,%eax
18052ee42: 7e 11 jle 0x18052ee55
18052ee44: 48 8b 8b 48 ff ff ff mov -0xb8(%rbx),%rcx
18052ee4b: 48 85 c9 test %rcx,%rcx
18052ee4e: 74 05 je 0x18052ee55
18052ee50: e8 6b 22 ad ff call 0x1800010c0
18052ee55: 85 ed test %ebp,%ebp
18052ee57: 48 89 bb 48 ff ff ff mov %rdi,-0xb8(%rbx)
18052ee5e: 0f 48 ef cmovs %edi,%ebp
18052ee61: 89 ab 50 ff ff ff mov %ebp,-0xb0(%rbx)
18052ee67: 85 ed test %ebp,%ebp
18052ee69: 74 3e je 0x18052eea9
18052ee6b: 8d 0c ad 00 00 00 00 lea 0x0(,%rbp,4),%ecx
18052ee72: e8 09 22 ad ff call 0x180001080
18052ee77: 48 89 83 48 ff ff ff mov %rax,-0xb8(%rbx)
18052ee7e: 8b d7 mov %edi,%edx
18052ee80: 39 bb 50 ff ff ff cmp %edi,-0xb0(%rbx)
18052ee86: 7e 21 jle 0x18052eea9
18052ee88: 48 8b cf mov %rdi,%rcx
18052ee8b: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
18052ee90: 48 8b 83 48 ff ff ff mov -0xb8(%rbx),%rax
18052ee97: 48 8d 49 04 lea 0x4(%rcx),%rcx
18052ee9b: ff c2 inc %edx
18052ee9d: 89 7c 01 fc mov %edi,-0x4(%rcx,%rax,1)
18052eea1: 3b 93 50 ff ff ff cmp -0xb0(%rbx),%edx
18052eea7: 7c e7 jl 0x18052ee90
18052eea9: 8b 03 mov (%rbx),%eax
18052eeab: 41 3b c6 cmp %r14d,%eax
18052eeae: 74 35 je 0x18052eee5
18052eeb0: 85 c0 test %eax,%eax
18052eeb2: 7e 0e jle 0x18052eec2
18052eeb4: 48 8b 4b f8 mov -0x8(%rbx),%rcx
18052eeb8: 48 85 c9 test %rcx,%rcx
18052eebb: 74 05 je 0x18052eec2
18052eebd: e8 fe 21 ad ff call 0x1800010c0
18052eec2: 45 85 f6 test %r14d,%r14d
18052eec5: 48 89 7b f8 mov %rdi,-0x8(%rbx)
18052eec9: 41 8b ce mov %r14d,%ecx
18052eecc: 0f 48 cf cmovs %edi,%ecx
18052eecf: 89 0b mov %ecx,(%rbx)
18052eed1: 85 c9 test %ecx,%ecx
18052eed3: 74 31 je 0x18052ef06
18052eed5: 8d 0c 8d 00 00 00 00 lea 0x0(,%rcx,4),%ecx
18052eedc: e8 9f 21 ad ff call 0x180001080
18052eee1: 48 89 43 f8 mov %rax,-0x8(%rbx)
18052eee5: 8b d7 mov %edi,%edx
18052eee7: 39 3b cmp %edi,(%rbx)
18052eee9: 7e 1b jle 0x18052ef06
18052eeeb: 48 8b cf mov %rdi,%rcx
18052eeee: 66 90 xchg %ax,%ax
18052eef0: 48 8b 43 f8 mov -0x8(%rbx),%rax
18052eef4: 48 8d 49 04 lea 0x4(%rcx),%rcx
18052eef8: ff c2 inc %edx
18052eefa: c7 44 01 fc 00 00 80 movl $0x3f800000,-0x4(%rcx,%rax,1)
18052ef01: 3f
18052ef02: 3b 13 cmp (%rbx),%edx
18052ef04: 7c ea jl 0x18052eef0
18052ef06: 8b ae 6c 08 54 00 mov 0x54086c(%rsi),%ebp
18052ef0c: 8b 83 80 00 00 00 mov 0x80(%rbx),%eax
18052ef12: 3b c5 cmp %ebp,%eax
18052ef14: 74 35 je 0x18052ef4b
18052ef16: 85 c0 test %eax,%eax
18052ef18: 7e 0e jle 0x18052ef28
18052ef1a: 48 8b 4b 78 mov 0x78(%rbx),%rcx
18052ef1e: 48 85 c9 test %rcx,%rcx
18052ef21: 74 05 je 0x18052ef28
18052ef23: e8 98 21 ad ff call 0x1800010c0
18052ef28: 85 ed test %ebp,%ebp
18052ef2a: 48 89 7b 78 mov %rdi,0x78(%rbx)
18052ef2e: 0f 48 ef cmovs %edi,%ebp
18052ef31: 89 ab 80 00 00 00 mov %ebp,0x80(%rbx)
18052ef37: 85 ed test %ebp,%ebp
18052ef39: 74 3b je 0x18052ef76
18052ef3b: 8d 0c ad 00 00 00 00 lea 0x0(,%rbp,4),%ecx
18052ef42: e8 39 21 ad ff call 0x180001080
18052ef47: 48 89 43 78 mov %rax,0x78(%rbx)
18052ef4b: 8b d7 mov %edi,%edx
18052ef4d: 39 bb 80 00 00 00 cmp %edi,0x80(%rbx)
18052ef53: 7e 21 jle 0x18052ef76
18052ef55: 48 8b cf mov %rdi,%rcx
18052ef58: 0f 1f 84 00 00 00 00 nopl 0x0(%rax,%rax,1)
18052ef5f: 00
18052ef60: 48 8b 43 78 mov 0x78(%rbx),%rax
18052ef64: 48 8d 49 04 lea 0x4(%rcx),%rcx
18052ef68: ff c2 inc %edx
18052ef6a: 89 7c 01 fc mov %edi,-0x4(%rcx,%rax,1)
18052ef6e: 3b 93 80 00 00 00 cmp 0x80(%rbx),%edx
18052ef74: 7c ea jl 0x18052ef60
18052ef76: 8b ae 6c 08 54 00 mov 0x54086c(%rsi),%ebp
18052ef7c: 8b 83 a0 00 00 00 mov 0xa0(%rbx),%eax
18052ef82: 3b c5 cmp %ebp,%eax
18052ef84: 74 3e je 0x18052efc4
18052ef86: 85 c0 test %eax,%eax
18052ef88: 7e 11 jle 0x18052ef9b
18052ef8a: 48 8b 8b 98 00 00 00 mov 0x98(%rbx),%rcx
18052ef91: 48 85 c9 test %rcx,%rcx
18052ef94: 74 05 je 0x18052ef9b
18052ef96: e8 25 21 ad ff call 0x1800010c0
18052ef9b: 85 ed test %ebp,%ebp
18052ef9d: 48 89 bb 98 00 00 00 mov %rdi,0x98(%rbx)
18052efa4: 0f 48 ef cmovs %edi,%ebp
18052efa7: 89 ab a0 00 00 00 mov %ebp,0xa0(%rbx)
18052efad: 85 ed test %ebp,%ebp
18052efaf: 74 3d je 0x18052efee
18052efb1: 8d 0c ad 00 00 00 00 lea 0x0(,%rbp,4),%ecx
18052efb8: e8 c3 20 ad ff call 0x180001080
18052efbd: 48 89 83 98 00 00 00 mov %rax,0x98(%rbx)
18052efc4: 8b d7 mov %edi,%edx
18052efc6: 39 bb a0 00 00 00 cmp %edi,0xa0(%rbx)
18052efcc: 7e 20 jle 0x18052efee
18052efce: 48 8b cf mov %rdi,%rcx
18052efd1: 48 8b 83 98 00 00 00 mov 0x98(%rbx),%rax
18052efd8: 48 8d 49 04 lea 0x4(%rcx),%rcx
18052efdc: ff c2 inc %edx
18052efde: c7 44 01 fc 00 00 80 movl $0x3f800000,-0x4(%rcx,%rax,1)
18052efe5: 3f
18052efe6: 3b 93 a0 00 00 00 cmp 0xa0(%rbx),%edx
18052efec: 7c e3 jl 0x18052efd1
18052efee: 41 ff c7 inc %r15d
18052eff1: 48 83 c3 10 add $0x10,%rbx
18052eff5: 44 3b 7e 30 cmp 0x30(%rsi),%r15d
18052eff9: 0f 8c 31 fe ff ff jl 0x18052ee30
18052efff: 8b 96 68 08 54 00 mov 0x540868(%rsi),%edx
18052f005: 48 8d 8e f8 06 54 00 lea 0x5406f8(%rsi),%rcx
18052f00c: c1 e2 03 shl $0x3,%edx
18052f00f: 0f 57 d2 xorps %xmm2,%xmm2
18052f012: e8 79 f1 ff ff call 0x18052e190
18052f017: 8b 96 68 08 54 00 mov 0x540868(%rsi),%edx
18052f01d: 48 8d 8e 08 07 54 00 lea 0x540708(%rsi),%rcx
18052f024: 41 0f af d5 imul %r13d,%edx
18052f028: 0f 57 d2 xorps %xmm2,%xmm2
18052f02b: e8 60 f1 ff ff call 0x18052e190
18052f030: 8b 96 68 08 54 00 mov 0x540868(%rsi),%edx
18052f036: 48 8d 8e 18 07 54 00 lea 0x540718(%rsi),%rcx
18052f03d: 41 0f af d5 imul %r13d,%edx
18052f041: 0f 57 d2 xorps %xmm2,%xmm2
18052f044: e8 47 f1 ff ff call 0x18052e190
18052f049: 8b 96 68 08 54 00 mov 0x540868(%rsi),%edx
18052f04f: 48 8d 8e 98 07 54 00 lea 0x540798(%rsi),%rcx
18052f056: 0f 57 d2 xorps %xmm2,%xmm2
18052f059: e8 32 f1 ff ff call 0x18052e190
18052f05e: 44 8b c7 mov %edi,%r8d
18052f061: 39 be a0 07 54 00 cmp %edi,0x5407a0(%rsi)
18052f067: 7e 26 jle 0x18052f08f
18052f069: 48 8b cf mov %rdi,%rcx
18052f06c: 0f 1f 40 00 nopl 0x0(%rax)
18052f070: 48 8b 86 98 07 54 00 mov 0x540798(%rsi),%rax
18052f077: 48 8d 49 04 lea 0x4(%rcx),%rcx
18052f07b: 41 ff c0 inc %r8d
18052f07e: c7 44 01 fc 00 00 80 movl $0x3f800000,-0x4(%rcx,%rax,1)
18052f085: 3f
18052f086: 44 3b 86 a0 07 54 00 cmp 0x5407a0(%rsi),%r8d
18052f08d: 7c e1 jl 0x18052f070
18052f08f: 44 8b 86 68 08 54 00 mov 0x540868(%rsi),%r8d
18052f096: 48 8d 8e 30 05 54 00 lea 0x540530(%rsi),%rcx
18052f09d: 8b 56 64 mov 0x64(%rsi),%edx
18052f0a0: e8 8b eb ff ff call 0x18052dc30
18052f0a5: 0f 28 df movaps %xmm7,%xmm3
18052f0a8: 48 8d 8e 30 05 54 00 lea 0x540530(%rsi),%rcx
18052f0af: 45 8b c5 mov %r13d,%r8d
18052f0b2: 41 8b d5 mov %r13d,%edx
18052f0b5: e8 46 0d 00 00 call 0x18052fe00
18052f0ba: 45 8b cc mov %r12d,%r9d
18052f0bd: 4c 8b ac 24 00 01 00 mov 0x100(%rsp),%r13
18052f0c4: 00
18052f0c5: 44 3b 66 30 cmp 0x30(%rsi),%r12d
18052f0c9: 0f 8d a8 00 00 00 jge 0x18052f177
18052f0cf: 49 63 cc movslq %r12d,%rcx
18052f0d2: 48 81 c1 7b 40 05 00 add $0x5407b,%rcx
18052f0d9: 48 c1 e1 04 shl $0x4,%rcx
18052f0dd: 48 03 ce add %rsi,%rcx
18052f0e0: 44 8b c7 mov %edi,%r8d
18052f0e3: 39 79 80 cmp %edi,-0x80(%rcx)
18052f0e6: 7e 22 jle 0x18052f10a
18052f0e8: 48 8b d7 mov %rdi,%rdx
18052f0eb: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
18052f0f0: 48 8b 81 78 ff ff ff mov -0x88(%rcx),%rax
18052f0f7: 48 8d 52 04 lea 0x4(%rdx),%rdx
18052f0fb: 41 ff c0 inc %r8d
18052f0fe: f3 repz
18052f0ff: 0f .byte 0xf
+275
View File
@@ -0,0 +1,275 @@
; cons_536100 0x180536000-0x180536400
/tmp/slice.bin: file format binary
Disassembly of section .data:
0000000180536000 <.data>:
180536000: e8 bb b0 ac ff call 0x1800010c0
180536005: 90 nop
180536006: 48 89 bb 58 07 54 00 mov %rdi,0x540758(%rbx)
18053600d: 89 bb 60 07 54 00 mov %edi,0x540760(%rbx)
180536013: 39 bb 50 07 54 00 cmp %edi,0x540750(%rbx)
180536019: 7e 12 jle 0x18053602d
18053601b: 48 8b 8b 48 07 54 00 mov 0x540748(%rbx),%rcx
180536022: 48 85 c9 test %rcx,%rcx
180536025: 74 06 je 0x18053602d
180536027: e8 94 b0 ac ff call 0x1800010c0
18053602c: 90 nop
18053602d: 48 89 bb 48 07 54 00 mov %rdi,0x540748(%rbx)
180536034: 89 bb 50 07 54 00 mov %edi,0x540750(%rbx)
18053603a: 48 8d 8b 28 07 54 00 lea 0x540728(%rbx),%rcx
180536041: 4c 8d 0d d8 81 ff ff lea -0x7e28(%rip),%r9 # 0x18052e220
180536048: ba 10 00 00 00 mov $0x10,%edx
18053604d: 44 8d 42 f2 lea -0xe(%rdx),%r8d
180536051: e8 c6 b6 bf 00 call 0x18113171c
180536056: 90 nop
180536057: 39 bb 20 07 54 00 cmp %edi,0x540720(%rbx)
18053605d: 7e 12 jle 0x180536071
18053605f: 48 8b 8b 18 07 54 00 mov 0x540718(%rbx),%rcx
180536066: 48 85 c9 test %rcx,%rcx
180536069: 74 06 je 0x180536071
18053606b: e8 50 b0 ac ff call 0x1800010c0
180536070: 90 nop
180536071: 48 89 bb 18 07 54 00 mov %rdi,0x540718(%rbx)
180536078: 89 bb 20 07 54 00 mov %edi,0x540720(%rbx)
18053607e: 39 bb 10 07 54 00 cmp %edi,0x540710(%rbx)
180536084: 7e 12 jle 0x180536098
180536086: 48 8b 8b 08 07 54 00 mov 0x540708(%rbx),%rcx
18053608d: 48 85 c9 test %rcx,%rcx
180536090: 74 06 je 0x180536098
180536092: e8 29 b0 ac ff call 0x1800010c0
180536097: 90 nop
180536098: 48 89 bb 08 07 54 00 mov %rdi,0x540708(%rbx)
18053609f: 89 bb 10 07 54 00 mov %edi,0x540710(%rbx)
1805360a5: 39 bb 00 07 54 00 cmp %edi,0x540700(%rbx)
1805360ab: 7e 12 jle 0x1805360bf
1805360ad: 48 8b 8b f8 06 54 00 mov 0x5406f8(%rbx),%rcx
1805360b4: 48 85 c9 test %rcx,%rcx
1805360b7: 74 06 je 0x1805360bf
1805360b9: e8 02 b0 ac ff call 0x1800010c0
1805360be: 90 nop
1805360bf: 48 89 bb f8 06 54 00 mov %rdi,0x5406f8(%rbx)
1805360c6: 89 bb 00 07 54 00 mov %edi,0x540700(%rbx)
1805360cc: 39 bb f0 06 54 00 cmp %edi,0x5406f0(%rbx)
1805360d2: 7e 12 jle 0x1805360e6
1805360d4: 48 8b 8b e8 06 54 00 mov 0x5406e8(%rbx),%rcx
1805360db: 48 85 c9 test %rcx,%rcx
1805360de: 74 06 je 0x1805360e6
1805360e0: e8 db af ac ff call 0x1800010c0
1805360e5: 90 nop
1805360e6: 48 89 bb e8 06 54 00 mov %rdi,0x5406e8(%rbx)
1805360ed: 89 bb f0 06 54 00 mov %edi,0x5406f0(%rbx)
1805360f3: 39 bb e0 06 54 00 cmp %edi,0x5406e0(%rbx)
1805360f9: 7e 12 jle 0x18053610d
1805360fb: 48 8b 8b d8 06 54 00 mov 0x5406d8(%rbx),%rcx
180536102: 48 85 c9 test %rcx,%rcx
180536105: 74 06 je 0x18053610d
180536107: e8 b4 af ac ff call 0x1800010c0
18053610c: 90 nop
18053610d: 48 89 bb d8 06 54 00 mov %rdi,0x5406d8(%rbx)
180536114: 89 bb e0 06 54 00 mov %edi,0x5406e0(%rbx)
18053611a: 39 bb d0 06 54 00 cmp %edi,0x5406d0(%rbx)
180536120: 7e 12 jle 0x180536134
180536122: 48 8b 8b c8 06 54 00 mov 0x5406c8(%rbx),%rcx
180536129: 48 85 c9 test %rcx,%rcx
18053612c: 74 06 je 0x180536134
18053612e: e8 8d af ac ff call 0x1800010c0
180536133: 90 nop
180536134: 48 89 bb c8 06 54 00 mov %rdi,0x5406c8(%rbx)
18053613b: 89 bb d0 06 54 00 mov %edi,0x5406d0(%rbx)
180536141: 39 bb c0 06 54 00 cmp %edi,0x5406c0(%rbx)
180536147: 7e 12 jle 0x18053615b
180536149: 48 8b 8b b8 06 54 00 mov 0x5406b8(%rbx),%rcx
180536150: 48 85 c9 test %rcx,%rcx
180536153: 74 06 je 0x18053615b
180536155: e8 66 af ac ff call 0x1800010c0
18053615a: 90 nop
18053615b: 48 89 bb b8 06 54 00 mov %rdi,0x5406b8(%rbx)
180536162: 89 bb c0 06 54 00 mov %edi,0x5406c0(%rbx)
180536168: 39 bb b0 06 54 00 cmp %edi,0x5406b0(%rbx)
18053616e: 7e 12 jle 0x180536182
180536170: 48 8b 8b a8 06 54 00 mov 0x5406a8(%rbx),%rcx
180536177: 48 85 c9 test %rcx,%rcx
18053617a: 74 06 je 0x180536182
18053617c: e8 3f af ac ff call 0x1800010c0
180536181: 90 nop
180536182: 48 89 bb a8 06 54 00 mov %rdi,0x5406a8(%rbx)
180536189: 89 bb b0 06 54 00 mov %edi,0x5406b0(%rbx)
18053618f: 39 bb a0 06 54 00 cmp %edi,0x5406a0(%rbx)
180536195: 7e 12 jle 0x1805361a9
180536197: 48 8b 8b 98 06 54 00 mov 0x540698(%rbx),%rcx
18053619e: 48 85 c9 test %rcx,%rcx
1805361a1: 74 06 je 0x1805361a9
1805361a3: e8 18 af ac ff call 0x1800010c0
1805361a8: 90 nop
1805361a9: 48 89 bb 98 06 54 00 mov %rdi,0x540698(%rbx)
1805361b0: 89 bb a0 06 54 00 mov %edi,0x5406a0(%rbx)
1805361b6: 48 8d 8b 78 06 54 00 lea 0x540678(%rbx),%rcx
1805361bd: 4c 8d 0d 5c 80 ff ff lea -0x7fa4(%rip),%r9 # 0x18052e220
1805361c4: ba 10 00 00 00 mov $0x10,%edx
1805361c9: 44 8d 42 f2 lea -0xe(%rdx),%r8d
1805361cd: e8 4a b5 bf 00 call 0x18113171c
1805361d2: 90 nop
1805361d3: 39 bb 70 06 54 00 cmp %edi,0x540670(%rbx)
1805361d9: 7e 12 jle 0x1805361ed
1805361db: 48 8b 8b 68 06 54 00 mov 0x540668(%rbx),%rcx
1805361e2: 48 85 c9 test %rcx,%rcx
1805361e5: 74 06 je 0x1805361ed
1805361e7: e8 d4 ae ac ff call 0x1800010c0
1805361ec: 90 nop
1805361ed: 48 89 bb 68 06 54 00 mov %rdi,0x540668(%rbx)
1805361f4: 89 bb 70 06 54 00 mov %edi,0x540670(%rbx)
1805361fa: 48 8d 8b 30 05 54 00 lea 0x540530(%rbx),%rcx
180536201: e8 2a 7b ff ff call 0x18052dd30
180536206: 90 nop
180536207: 89 bb cc 04 24 00 mov %edi,0x2404cc(%rbx)
18053620d: 48 8b 8b c0 04 24 00 mov 0x2404c0(%rbx),%rcx
180536214: ff 15 8e 50 67 01 call *0x167508e(%rip) # 0x181bab2a8
18053621a: 90 nop
18053621b: 48 8d 8b d8 03 00 00 lea 0x3d8(%rbx),%rcx
180536222: e8 59 70 ff ff call 0x18052d280
180536227: 90 nop
180536228: 48 8d 05 49 5e f7 01 lea 0x1f75e49(%rip),%rax # 0x1824ac078
18053622f: 48 89 83 d0 03 00 00 mov %rax,0x3d0(%rbx)
180536236: 48 8b cb mov %rbx,%rcx
180536239: 48 8b 5c 24 40 mov 0x40(%rsp),%rbx
18053623e: 48 83 c4 30 add $0x30,%rsp
180536242: 5f pop %rdi
180536243: e9 58 38 ff ff jmp 0x180529aa0
180536248: cc int3
180536249: cc int3
18053624a: cc int3
18053624b: cc int3
18053624c: cc int3
18053624d: cc int3
18053624e: cc int3
18053624f: cc int3
180536250: f2 0f 10 0d e8 de f8 movsd 0x1f8dee8(%rip),%xmm1 # 0x1824c4140
180536257: 01
180536258: 48 8d 81 10 00 08 00 lea 0x80010(%rcx),%rax
18053625f: f2 0f 11 4c 24 08 movsd %xmm1,0x8(%rsp)
180536265: ba 00 80 00 00 mov $0x8000,%edx
18053626a: f2 0f 10 44 24 08 movsd 0x8(%rsp),%xmm0
180536270: 4c 8b c1 mov %rcx,%r8
180536273: c6 41 04 00 movb $0x0,0x4(%rcx)
180536277: 48 c7 81 10 00 10 00 movq $0x0,0x100010(%rcx)
18053627e: 00 00 00 00
180536282: 8b ca mov %edx,%ecx
180536284: 66 0f c6 c0 00 shufpd $0x0,%xmm0,%xmm0
180536289: a8 0f test $0xf,%al
18053628b: 75 13 jne 0x1805362a0
18053628d: 0f 1f 00 nopl (%rax)
180536290: 0f 11 00 movups %xmm0,(%rax)
180536293: 48 8d 40 10 lea 0x10(%rax),%rax
180536297: 48 83 e9 01 sub $0x1,%rcx
18053629b: 75 f3 jne 0x180536290
18053629d: eb 0e jmp 0x1805362ad
18053629f: 90 nop
1805362a0: 0f 11 00 movups %xmm0,(%rax)
1805362a3: 48 8d 40 10 lea 0x10(%rax),%rax
1805362a7: 48 83 e9 01 sub $0x1,%rcx
1805362ab: 75 f3 jne 0x1805362a0
1805362ad: f2 0f 11 4c 24 08 movsd %xmm1,0x8(%rsp)
1805362b3: 49 8d 40 10 lea 0x10(%r8),%rax
1805362b7: f2 0f 10 44 24 08 movsd 0x8(%rsp),%xmm0
1805362bd: 66 0f c6 c0 00 shufpd $0x0,%xmm0,%xmm0
1805362c2: a8 0f test $0xf,%al
1805362c4: 75 1b jne 0x1805362e1
1805362c6: 66 66 0f 1f 84 00 00 data16 nopw 0x0(%rax,%rax,1)
1805362cd: 00 00 00
1805362d0: 0f 11 00 movups %xmm0,(%rax)
1805362d3: 48 8d 40 10 lea 0x10(%rax),%rax
1805362d7: 48 83 ea 01 sub $0x1,%rdx
1805362db: 75 f3 jne 0x1805362d0
1805362dd: 49 8b c0 mov %r8,%rax
1805362e0: c3 ret
1805362e1: 0f 11 00 movups %xmm0,(%rax)
1805362e4: 48 8d 40 10 lea 0x10(%rax),%rax
1805362e8: 48 83 ea 01 sub $0x1,%rdx
1805362ec: 75 f3 jne 0x1805362e1
1805362ee: 49 8b c0 mov %r8,%rax
1805362f1: c3 ret
1805362f2: cc int3
1805362f3: cc int3
1805362f4: cc int3
1805362f5: cc int3
1805362f6: cc int3
1805362f7: cc int3
1805362f8: cc int3
1805362f9: cc int3
1805362fa: cc int3
1805362fb: cc int3
1805362fc: cc int3
1805362fd: cc int3
1805362fe: cc int3
1805362ff: cc int3
180536300: 48 89 5c 24 08 mov %rbx,0x8(%rsp)
180536305: 48 89 6c 24 18 mov %rbp,0x18(%rsp)
18053630a: 48 89 74 24 20 mov %rsi,0x20(%rsp)
18053630f: 48 89 54 24 10 mov %rdx,0x10(%rsp)
180536314: 57 push %rdi
180536315: 41 54 push %r12
180536317: 41 55 push %r13
180536319: 41 56 push %r14
18053631b: 41 57 push %r15
18053631d: 48 83 ec 50 sub $0x50,%rsp
180536321: 48 63 bc 24 a0 00 00 movslq 0xa0(%rsp),%rdi
180536328: 00
180536329: 48 8d 15 88 aa 11 02 lea 0x211aa88(%rip),%rdx # 0x182650db8
180536330: 4c 8b b4 24 b0 00 00 mov 0xb0(%rsp),%r14
180536337: 00
180536338: 49 8b e9 mov %r9,%rbp
18053633b: 0f 29 74 24 40 movaps %xmm6,0x40(%rsp)
180536340: 49 8b d8 mov %r8,%rbx
180536343: 66 0f 6e b1 80 00 24 movd 0x240080(%rcx),%xmm6
18053634a: 00
18053634b: 8d 04 fd 00 00 00 00 lea 0x0(,%rdi,8),%eax
180536352: 4c 63 d0 movslq %eax,%r10
180536355: 8d 04 3f lea (%rdi,%rdi,1),%eax
180536358: 0f 5b f6 cvtdq2ps %xmm6,%xmm6
18053635b: 4f 8d 24 96 lea (%r14,%r10,4),%r12
18053635f: 4c 63 d0 movslq %eax,%r10
180536362: 4d 8d 3c bc lea (%r12,%rdi,4),%r15
180536366: 4c 89 a4 24 b0 00 00 mov %r12,0xb0(%rsp)
18053636d: 00
18053636e: f3 0f 59 71 24 mulss 0x24(%rcx),%xmm6
180536373: 48 8d 0d 3e aa 11 02 lea 0x211aa3e(%rip),%rcx # 0x182650db8
18053637a: 4b 8d 34 97 lea (%r15,%r10,4),%rsi
18053637e: 4e 8d 2c 96 lea (%rsi,%r10,4),%r13
180536382: ff 15 80 4c 67 01 call *0x1674c80(%rip) # 0x181bab008
180536388: f2 0f 10 0d b8 de f8 movsd 0x1f8deb8(%rip),%xmm1 # 0x1824c4248
18053638f: 01
180536390: 44 8b cf mov %edi,%r9d
180536393: 0f 5a c6 cvtps2pd %xmm6,%xmm0
180536396: 85 c0 test %eax,%eax
180536398: 48 8b d3 mov %rbx,%rdx
18053639b: 49 8b cc mov %r12,%rcx
18053639e: 0f 94 84 24 a8 00 00 sete 0xa8(%rsp)
1805363a5: 00
1805363a6: f2 0f 5e c8 divsd %xmm0,%xmm1
1805363aa: 66 0f 5a d1 cvtpd2ps %xmm1,%xmm2
1805363ae: e8 4d 76 ff ff call 0x18052da00
1805363b3: 80 bd 10 08 00 00 00 cmpb $0x0,0x810(%rbp)
1805363ba: 44 8b c7 mov %edi,%r8d
1805363bd: 74 1a je 0x1805363d9
1805363bf: f3 0f 10 0d dd da f8 movss 0x1f8dadd(%rip),%xmm1 # 0x1824c3ea4
1805363c6: 01
1805363c7: 48 8b 8c 24 88 00 00 mov 0x88(%rsp),%rcx
1805363ce: 00
1805363cf: e8 7c 77 ff ff call 0x18052db50
1805363d4: e9 88 01 00 00 jmp 0x180536561
1805363d9: f3 0f 10 35 c3 da f8 movss 0x1f8dac3(%rip),%xmm6 # 0x1824c3ea4
1805363e0: 01
1805363e1: 48 8b ce mov %rsi,%rcx
1805363e4: 0f 28 ce movaps %xmm6,%xmm1
1805363e7: e8 64 77 ff ff call 0x18052db50
1805363ec: 44 8b c7 mov %edi,%r8d
1805363ef: 0f 57 c9 xorps %xmm1,%xmm1
1805363f2: 49 8b cd mov %r13,%rcx
1805363f5: e8 56 77 ff ff call 0x18052db50
1805363fa: 33 db xor %ebx,%ebx
1805363fc: 39 .byte 0x39
1805363fd: 9d popf
1805363fe: 14 08 adc $0x8,%al
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+68
View File
@@ -0,0 +1,68 @@
/tmp/det/ctor_dc30.bin: file format binary
Disassembly of section .data:
000000018052dc30 <.data>:
18052dc30: rex push rbx
18052dc32: sub rsp,0x50
18052dc36: mov rbx,rcx
18052dc39: cmp DWORD PTR [rcx+0x4],edx
18052dc3c: je 0x18052dd1d
18052dc42: mov DWORD PTR [rcx+0x8],r8d
18052dc46: mov r8d,edx
18052dc49: mov DWORD PTR [rcx+0x4],edx
18052dc4c: lea rdx,[rsp+0x30]
18052dc51: mov QWORD PTR [rsp+0x60],rsi
18052dc56: mov QWORD PTR [rsp+0x68],rdi
18052dc5b: call 0x1805335c0
18052dc60: mov r8d,DWORD PTR [rbx+0x8]
18052dc64: test r8d,r8d
18052dc67: jns 0x18052dc8c
18052dc69: mov edx,DWORD PTR [rsp+0x34]
18052dc6d: lea rdi,[rbx+0x48]
18052dc71: mov rcx,rdi
18052dc74: call 0x180534550
18052dc79: mov edx,DWORD PTR [rsp+0x38]
18052dc7d: lea rcx,[rbx+0x68]
18052dc81: call 0x180534550
18052dc86: mov edx,DWORD PTR [rsp+0x3c]
18052dc8a: jmp 0x18052dcba
18052dc8c: lea rdx,[rsp+0x40]
18052dc91: mov rcx,rbx
18052dc94: call 0x1805335c0
18052dc99: mov edx,DWORD PTR [rsp+0x44]
18052dc9d: lea rdi,[rbx+0x48]
18052dca1: mov rcx,rdi
18052dca4: call 0x180534550
18052dca9: mov edx,DWORD PTR [rsp+0x48]
18052dcad: lea rcx,[rbx+0x68]
18052dcb1: call 0x180534550
18052dcb6: mov edx,DWORD PTR [rsp+0x4c]
18052dcba: lea rsi,[rbx+0x58]
18052dcbe: mov rcx,rsi
18052dcc1: call 0x180534550
18052dcc6: lea rdx,[rip+0x21230eb] # 0x182650db8
18052dccd: lea rcx,[rip+0x21230e4] # 0x182650db8
18052dcd4: call QWORD PTR [rip+0x167d32e] # 0x181bab008
18052dcda: mov r8d,DWORD PTR [rbx]
18052dcdd: mov r9d,0x1
18052dce3: mov edx,DWORD PTR [rsp+0x30]
18052dce7: test eax,eax
18052dce9: mov rax,QWORD PTR [rsi]
18052dcec: mov QWORD PTR [rsp+0x28],rax
18052dcf1: mov rax,QWORD PTR [rdi]
18052dcf4: mov QWORD PTR [rsp+0x20],rax
18052dcf9: jne 0x18052dd06
18052dcfb: lea rcx,[rbx+0x18]
18052dcff: call 0x180002240
18052dd04: jmp 0x18052dd0f
18052dd06: lea rcx,[rbx+0x20]
18052dd0a: call 0x180001c10
18052dd0f: mov rdi,QWORD PTR [rsp+0x68]
18052dd14: mov rsi,QWORD PTR [rsp+0x60]
18052dd19: mov BYTE PTR [rbx+0x15],0x1
18052dd1d: add rsp,0x50
18052dd21: pop rbx
18052dd22: ret
Binary file not shown.
Binary file not shown.
+582
View File
@@ -0,0 +1,582 @@
/tmp/det/det_536f90.bin: file format binary
Disassembly of section .data:
0000000180536f90 <.data>:
180536f90: 4c 8b dc mov %rsp,%r11
180536f93: 55 push %rbp
180536f94: 56 push %rsi
180536f95: 57 push %rdi
180536f96: 41 54 push %r12
180536f98: 41 55 push %r13
180536f9a: 41 56 push %r14
180536f9c: 41 57 push %r15
180536f9e: 48 81 ec c0 00 00 00 sub $0xc0,%rsp
180536fa5: 41 0f 29 73 b8 movaps %xmm6,-0x48(%r11)
180536faa: 41 0f 29 7b a8 movaps %xmm7,-0x58(%r11)
180536faf: 45 0f 29 43 98 movaps %xmm8,-0x68(%r11)
180536fb4: 45 0f 29 4b 88 movaps %xmm9,-0x78(%r11)
180536fb9: 48 8b 05 b0 e9 0d 02 mov 0x20de9b0(%rip),%rax # 0x182615970
180536fc0: 48 33 c4 xor %rsp,%rax
180536fc3: 48 89 44 24 70 mov %rax,0x70(%rsp)
180536fc8: 48 63 b4 24 20 01 00 movslq 0x120(%rsp),%rsi
180536fcf: 00
180536fd0: 4c 8b f1 mov %rcx,%r14
180536fd3: 49 8b 00 mov (%r8),%rax
180536fd6: 4c 8b e6 mov %rsi,%r12
180536fd9: 49 8b 48 08 mov 0x8(%r8),%rcx
180536fdd: 4c 8b fa mov %rdx,%r15
180536fe0: f2 44 0f 10 0d 57 d1 movsd 0x1f8d157(%rip),%xmm9 # 0x1824c4140
180536fe7: f8 01
180536fe9: 0f 57 f6 xorps %xmm6,%xmm6
180536fec: 49 c1 e4 04 shl $0x4,%r12
180536ff0: 44 8d 2c 36 lea (%rsi,%rsi,1),%r13d
180536ff4: 0f 10 40 08 movups 0x8(%rax),%xmm0
180536ff8: 49 63 ed movslq %r13d,%rbp
180536ffb: 4c 03 e2 add %rdx,%r12
180536ffe: 0f 10 49 08 movups 0x8(%rcx),%xmm1
180537002: 48 c1 e5 04 shl $0x4,%rbp
180537006: f2 0f 10 38 movsd (%rax),%xmm7
18053700a: 48 03 ea add %rdx,%rbp
18053700d: f2 44 0f 10 01 movsd (%rcx),%xmm8
180537012: 33 ff xor %edi,%edi
180537014: f2 0f 11 7c 24 40 movsd %xmm7,0x40(%rsp)
18053701a: f2 44 0f 11 44 24 58 movsd %xmm8,0x58(%rsp)
180537021: 4c 89 4c 24 20 mov %r9,0x20(%rsp)
180537026: 0f 11 44 24 48 movups %xmm0,0x48(%rsp)
18053702b: 49 89 5b 18 mov %rbx,0x18(%r11)
18053702f: 0f 11 4c 24 60 movups %xmm1,0x60(%rsp)
180537034: 48 85 ff test %rdi,%rdi
180537037: 75 40 jne 0x180537079
180537039: 0f 28 c7 movaps %xmm7,%xmm0
18053703c: 48 8d 4c 24 30 lea 0x30(%rsp),%rcx
180537041: 66 0f 14 c6 unpcklpd %xmm6,%xmm0
180537045: 44 8b c6 mov %esi,%r8d
180537048: 49 8b d7 mov %r15,%rdx
18053704b: 66 0f 7f 44 24 30 movdqa %xmm0,0x30(%rsp)
180537051: e8 da a9 ac ff call 0x180001a30
180537056: 41 0f 28 c0 movaps %xmm8,%xmm0
18053705a: 48 8d 4c 24 30 lea 0x30(%rsp),%rcx
18053705f: 66 0f 14 c6 unpcklpd %xmm6,%xmm0
180537063: 44 8b c6 mov %esi,%r8d
180537066: 49 8b d4 mov %r12,%rdx
180537069: 66 0f 7f 44 24 30 movdqa %xmm0,0x30(%rsp)
18053706f: e8 bc a9 ac ff call 0x180001a30
180537074: e9 88 00 00 00 jmp 0x180537101
180537079: 48 83 ff 01 cmp $0x1,%rdi
18053707d: 75 49 jne 0x1805370c8
18053707f: 8d 04 76 lea (%rsi,%rsi,2),%eax
180537082: 44 8b c6 mov %esi,%r8d
180537085: 48 63 d8 movslq %eax,%rbx
180537088: 41 0f 28 c1 movaps %xmm9,%xmm0
18053708c: 48 c1 e3 04 shl $0x4,%rbx
180537090: 49 03 df add %r15,%rbx
180537093: 48 8b d3 mov %rbx,%rdx
180537096: e8 35 b2 ac ff call 0x1800022d0
18053709b: 48 8b 54 24 20 mov 0x20(%rsp),%rdx
1805370a0: 44 8b ce mov %esi,%r9d
1805370a3: 4d 8b c6 mov %r14,%r8
1805370a6: 48 8b cb mov %rbx,%rcx
1805370a9: e8 d2 ad ac ff call 0x180001e80
1805370ae: 8b d6 mov %esi,%edx
1805370b0: 49 8b ce mov %r14,%rcx
1805370b3: e8 58 a8 ac ff call 0x180001910
1805370b8: 44 8b c6 mov %esi,%r8d
1805370bb: 48 8b d5 mov %rbp,%rdx
1805370be: 49 8b ce mov %r14,%rcx
1805370c1: e8 fa a9 ac ff call 0x180001ac0
1805370c6: eb 11 jmp 0x1805370d9
1805370c8: 44 8b ce mov %esi,%r9d
1805370cb: 4c 8b c5 mov %rbp,%r8
1805370ce: 48 8b d5 mov %rbp,%rdx
1805370d1: 49 8b ce mov %r14,%rcx
1805370d4: e8 77 ad ac ff call 0x180001e50
1805370d9: f2 0f 10 4c fc 40 movsd 0x40(%rsp,%rdi,8),%xmm1
1805370df: 45 8b cd mov %r13d,%r9d
1805370e2: 4d 8b c7 mov %r15,%r8
1805370e5: 48 8b cd mov %rbp,%rcx
1805370e8: e8 63 b0 ac ff call 0x180002150
1805370ed: f2 0f 10 4c fc 58 movsd 0x58(%rsp,%rdi,8),%xmm1
1805370f3: 45 8b cd mov %r13d,%r9d
1805370f6: 4d 8b c4 mov %r12,%r8
1805370f9: 48 8b cd mov %rbp,%rcx
1805370fc: e8 4f b0 ac ff call 0x180002150
180537101: 48 ff c7 inc %rdi
180537104: 48 83 ff 03 cmp $0x3,%rdi
180537108: 0f 8c 26 ff ff ff jl 0x180537034
18053710e: 44 8b ce mov %esi,%r9d
180537111: 4d 8b c6 mov %r14,%r8
180537114: 49 8b d7 mov %r15,%rdx
180537117: 49 8b cc mov %r12,%rcx
18053711a: e8 21 ae ac ff call 0x180001f40
18053711f: 48 8b 9c 24 10 01 00 mov 0x110(%rsp),%rbx
180537126: 00
180537127: 48 8b 4c 24 70 mov 0x70(%rsp),%rcx
18053712c: 48 33 cc xor %rsp,%rcx
18053712f: e8 9c 9f bf 00 call 0x1811310d0
180537134: 4c 8d 9c 24 c0 00 00 lea 0xc0(%rsp),%r11
18053713b: 00
18053713c: 41 0f 28 73 f0 movaps -0x10(%r11),%xmm6
180537141: 41 0f 28 7b e0 movaps -0x20(%r11),%xmm7
180537146: 45 0f 28 43 d0 movaps -0x30(%r11),%xmm8
18053714b: 45 0f 28 4b c0 movaps -0x40(%r11),%xmm9
180537150: 49 8b e3 mov %r11,%rsp
180537153: 41 5f pop %r15
180537155: 41 5e pop %r14
180537157: 41 5d pop %r13
180537159: 41 5c pop %r12
18053715b: 5f pop %rdi
18053715c: 5e pop %rsi
18053715d: 5d pop %rbp
18053715e: c3 ret
18053715f: cc int3
180537160: 48 89 5c 24 08 mov %rbx,0x8(%rsp)
180537165: 48 89 54 24 10 mov %rdx,0x10(%rsp)
18053716a: 57 push %rdi
18053716b: 48 83 ec 40 sub $0x40,%rsp
18053716f: 48 8b fa mov %rdx,%rdi
180537172: 0f 29 74 24 30 movaps %xmm6,0x30(%rsp)
180537177: f3 41 0f 10 30 movss (%r8),%xmm6
18053717c: 41 b9 0b 00 00 00 mov $0xb,%r9d
180537182: 4c 8d 05 a7 48 f7 01 lea 0x1f748a7(%rip),%r8 # 0x1824aba30
180537189: ba dd 7d 54 ff mov $0xff547ddd,%edx
18053718e: 48 8b d9 mov %rcx,%rbx
180537191: e8 6a 76 c0 00 call 0x18113e800
180537196: 48 8b 4b 08 mov 0x8(%rbx),%rcx
18053719a: 48 8b d0 mov %rax,%rdx
18053719d: e8 be 38 c6 00 call 0x18119aa60
1805371a2: 8b 80 88 01 00 00 mov 0x188(%rax),%eax
1805371a8: 89 44 24 58 mov %eax,0x58(%rsp)
1805371ac: 0f 57 d2 xorps %xmm2,%xmm2
1805371af: f3 0f 10 44 24 58 movss 0x58(%rsp),%xmm0
1805371b5: 0f 28 ce movaps %xmm6,%xmm1
1805371b8: 0f 2f c2 comiss %xmm2,%xmm0
1805371bb: 48 8b cf mov %rdi,%rcx
1805371be: 41 0f 97 c0 seta %r8b
1805371c2: e8 e9 36 ee 00 call 0x18141a8b0
1805371c7: 48 8b 5c 24 50 mov 0x50(%rsp),%rbx
1805371cc: 48 8b c7 mov %rdi,%rax
1805371cf: 0f 28 74 24 30 movaps 0x30(%rsp),%xmm6
1805371d4: 48 83 c4 40 add $0x40,%rsp
1805371d8: 5f pop %rdi
1805371d9: c3 ret
1805371da: cc int3
1805371db: cc int3
1805371dc: cc int3
1805371dd: cc int3
1805371de: cc int3
1805371df: cc int3
1805371e0: 4c 8b dc mov %rsp,%r11
1805371e3: 53 push %rbx
1805371e4: 48 83 ec 50 sub $0x50,%rsp
1805371e8: 49 c7 43 d8 fe ff ff movq $0xfffffffffffffffe,-0x28(%r11)
1805371ef: ff
1805371f0: 0f 29 74 24 40 movaps %xmm6,0x40(%rsp)
1805371f5: 48 8b d9 mov %rcx,%rbx
1805371f8: 48 8b 02 mov (%rdx),%rax
1805371fb: 4c 8d 05 96 4d ca 01 lea 0x1ca4d96(%rip),%r8 # 0x1821dbf98
180537202: 4c 89 02 mov %r8,(%rdx)
180537205: 49 8d 4b 08 lea 0x8(%r11),%rcx
180537209: 49 89 4b 18 mov %rcx,0x18(%r11)
18053720d: 49 8d 4b 10 lea 0x10(%r11),%rcx
180537211: 49 89 4b 20 mov %rcx,0x20(%r11)
180537215: 49 89 43 10 mov %rax,0x10(%r11)
180537219: 4d 89 43 08 mov %r8,0x8(%r11)
18053721d: 41 b9 0b 00 00 00 mov $0xb,%r9d
180537223: 4c 8d 05 06 48 f7 01 lea 0x1f74806(%rip),%r8 # 0x1824aba30
18053722a: ba dd 7d 54 ff mov $0xff547ddd,%edx
18053722f: e8 cc 75 c0 00 call 0x18113e800
180537234: 48 89 44 24 78 mov %rax,0x78(%rsp)
180537239: 48 8b d0 mov %rax,%rdx
18053723c: 48 8b 4b 08 mov 0x8(%rbx),%rcx
180537240: e8 1b 38 c6 00 call 0x18119aa60
180537245: 8b 80 88 01 00 00 mov 0x188(%rax),%eax
18053724b: 48 8d 4c 24 68 lea 0x68(%rsp),%rcx
180537250: e8 0b 34 ee 00 call 0x18141a660
180537255: 0f 28 f0 movaps %xmm0,%xmm6
180537258: 48 8b 4c 24 60 mov 0x60(%rsp),%rcx
18053725d: 48 83 c1 f0 add $0xfffffffffffffff0,%rcx
180537261: 8b 01 mov (%rcx),%eax
180537263: a9 00 00 00 30 test $0x30000000,%eax
180537268: 75 18 jne 0x180537282
18053726a: b8 ff ff ff ff mov $0xffffffff,%eax
18053726f: f0 0f c1 01 lock xadd %eax,(%rcx)
180537273: ff c8 dec %eax
180537275: 83 f8 ff cmp $0xffffffff,%eax
180537278: 75 08 jne 0x180537282
18053727a: e8 75 9e bf 00 call 0x1811310f4
18053727f: 0f 28 c6 movaps %xmm6,%xmm0
180537282: 0f 28 74 24 40 movaps 0x40(%rsp),%xmm6
180537287: 48 83 c4 50 add $0x50,%rsp
18053728b: 5b pop %rbx
18053728c: c3 ret
18053728d: cc int3
18053728e: cc int3
18053728f: cc int3
180537290: 40 53 rex push %rbx
180537292: 48 83 ec 20 sub $0x20,%rsp
180537296: f3 41 0f 10 08 movss (%r8),%xmm1
18053729b: 45 33 c9 xor %r9d,%r9d
18053729e: 0f 5a c9 cvtps2pd %xmm1,%xmm1
1805372a1: 48 8b ca mov %rdx,%rcx
1805372a4: 48 8b da mov %rdx,%rbx
1805372a7: 45 8d 41 01 lea 0x1(%r9),%r8d
1805372ab: e8 f0 c6 cf 00 call 0x1812339a0
1805372b0: 48 8b c3 mov %rbx,%rax
1805372b3: 48 83 c4 20 add $0x20,%rsp
1805372b7: 5b pop %rbx
1805372b8: c3 ret
1805372b9: cc int3
1805372ba: cc int3
1805372bb: cc int3
1805372bc: cc int3
1805372bd: cc int3
1805372be: cc int3
1805372bf: cc int3
1805372c0: 40 53 rex push %rbx
1805372c2: 48 83 ec 30 sub $0x30,%rsp
1805372c6: f3 41 0f 10 10 movss (%r8),%xmm2
1805372cb: 48 8b da mov %rdx,%rbx
1805372ce: f2 0f 10 05 92 cc f8 movsd 0x1f8cc92(%rip),%xmm0 # 0x1824c3f68
1805372d5: 01
1805372d6: 0f 5a ca cvtps2pd %xmm2,%xmm1
1805372d9: 66 0f 2f c1 comisd %xmm1,%xmm0
1805372dd: 76 2b jbe 0x18053730a
1805372df: 4c 8d 05 5e 3b f7 01 lea 0x1f73b5e(%rip),%r8 # 0x1824aae44
1805372e6: ba cc 37 ce 4a mov $0x4ace37cc,%edx
1805372eb: 41 b9 04 00 00 00 mov $0x4,%r9d
1805372f1: e8 0a 75 c0 00 call 0x18113e800
1805372f6: 48 8b d0 mov %rax,%rdx
1805372f9: 48 8b cb mov %rbx,%rcx
1805372fc: e8 df 51 f6 ff call 0x18049c4e0
180537301: 48 8b c3 mov %rbx,%rax
180537304: 48 83 c4 30 add $0x30,%rsp
180537308: 5b pop %rbx
180537309: c3 ret
18053730a: 0f 5a ca cvtps2pd %xmm2,%xmm1
18053730d: 66 0f 2f 0d 53 cf f8 comisd 0x1f8cf53(%rip),%xmm1 # 0x1824c4268
180537314: 01
180537315: 76 0e jbe 0x180537325
180537317: 4c 8d 05 f6 42 f7 01 lea 0x1f742f6(%rip),%r8 # 0x1824ab614
18053731e: ba d3 10 24 91 mov $0x912410d3,%edx
180537323: eb c6 jmp 0x1805372eb
180537325: 45 33 c9 xor %r9d,%r9d
180537328: 48 8b cb mov %rbx,%rcx
18053732b: 45 8d 41 01 lea 0x1(%r9),%r8d
18053732f: e8 6c c6 cf 00 call 0x1812339a0
180537334: 48 8b c3 mov %rbx,%rax
180537337: 48 83 c4 30 add $0x30,%rsp
18053733b: 5b pop %rbx
18053733c: c3 ret
18053733d: cc int3
18053733e: cc int3
18053733f: cc int3
180537340: 40 53 rex push %rbx
180537342: 48 83 ec 30 sub $0x30,%rsp
180537346: f3 41 0f 10 10 movss (%r8),%xmm2
18053734b: 48 8b da mov %rdx,%rbx
18053734e: f2 0f 10 05 12 cc f8 movsd 0x1f8cc12(%rip),%xmm0 # 0x1824c3f68
180537355: 01
180537356: 0f 5a ca cvtps2pd %xmm2,%xmm1
180537359: 66 0f 2f c1 comisd %xmm1,%xmm0
18053735d: 76 2b jbe 0x18053738a
18053735f: 4c 8d 05 06 4d f7 01 lea 0x1f74d06(%rip),%r8 # 0x1824ac06c
180537366: ba b2 b5 fd e6 mov $0xe6fdb5b2,%edx
18053736b: 41 b9 04 00 00 00 mov $0x4,%r9d
180537371: e8 8a 74 c0 00 call 0x18113e800
180537376: 48 8b d0 mov %rax,%rdx
180537379: 48 8b cb mov %rbx,%rcx
18053737c: e8 5f 51 f6 ff call 0x18049c4e0
180537381: 48 8b c3 mov %rbx,%rax
180537384: 48 83 c4 30 add $0x30,%rsp
180537388: 5b pop %rbx
180537389: c3 ret
18053738a: 0f 5a ca cvtps2pd %xmm2,%xmm1
18053738d: 66 0f 2f 0d d3 ce f8 comisd 0x1f8ced3(%rip),%xmm1 # 0x1824c4268
180537394: 01
180537395: 76 0e jbe 0x1805373a5
180537397: 4c 8d 05 3a 51 f7 01 lea 0x1f7513a(%rip),%r8 # 0x1824ac4d8
18053739e: ba 56 9f 92 12 mov $0x12929f56,%edx
1805373a3: eb c6 jmp 0x18053736b
1805373a5: 45 33 c9 xor %r9d,%r9d
1805373a8: 48 8b cb mov %rbx,%rcx
1805373ab: 45 8d 41 01 lea 0x1(%r9),%r8d
1805373af: e8 ec c5 cf 00 call 0x1812339a0
1805373b4: 48 8b c3 mov %rbx,%rax
1805373b7: 48 83 c4 30 add $0x30,%rsp
1805373bb: 5b pop %rbx
1805373bc: c3 ret
1805373bd: cc int3
1805373be: cc int3
1805373bf: cc int3
1805373c0: f3 0f 10 0a movss (%rdx),%xmm1
1805373c4: 0f 57 c0 xorps %xmm0,%xmm0
1805373c7: 0f 2e c8 ucomiss %xmm0,%xmm1
1805373ca: 7a 06 jp 0x1805373d2
1805373cc: 75 04 jne 0x1805373d2
1805373ce: b2 01 mov $0x1,%dl
1805373d0: eb 02 jmp 0x1805373d4
1805373d2: 33 d2 xor %edx,%edx
1805373d4: 48 8b 41 08 mov 0x8(%rcx),%rax
1805373d8: 48 8b 88 68 01 00 00 mov 0x168(%rax),%rcx
1805373df: 48 8b 01 mov (%rcx),%rax
1805373e2: 48 ff a0 b8 00 00 00 rex.W jmp *0xb8(%rax)
1805373e9: cc int3
1805373ea: cc int3
1805373eb: cc int3
1805373ec: cc int3
1805373ed: cc int3
1805373ee: cc int3
1805373ef: cc int3
1805373f0: 48 8b 41 08 mov 0x8(%rcx),%rax
1805373f4: f3 0f 10 0a movss (%rdx),%xmm1
1805373f8: 48 8b 88 68 01 00 00 mov 0x168(%rax),%rcx
1805373ff: 48 8b 01 mov (%rcx),%rax
180537402: 48 ff 60 60 rex.W jmp *0x60(%rax)
180537406: cc int3
180537407: cc int3
180537408: cc int3
180537409: cc int3
18053740a: cc int3
18053740b: cc int3
18053740c: cc int3
18053740d: cc int3
18053740e: cc int3
18053740f: cc int3
180537410: 48 8b 41 08 mov 0x8(%rcx),%rax
180537414: f3 0f 10 0a movss (%rdx),%xmm1
180537418: f3 0f 59 0d 98 c8 f8 mulss 0x1f8c898(%rip),%xmm1 # 0x1824c3cb8
18053741f: 01
180537420: 48 8b 88 68 01 00 00 mov 0x168(%rax),%rcx
180537427: 48 8b 01 mov (%rcx),%rax
18053742a: 48 ff 60 68 rex.W jmp *0x68(%rax)
18053742e: cc int3
18053742f: cc int3
180537430: 48 8b 41 08 mov 0x8(%rcx),%rax
180537434: f3 0f 10 0a movss (%rdx),%xmm1
180537438: f3 0f 59 0d 78 c8 f8 mulss 0x1f8c878(%rip),%xmm1 # 0x1824c3cb8
18053743f: 01
180537440: 48 8b 88 68 01 00 00 mov 0x168(%rax),%rcx
180537447: 48 8b 01 mov (%rcx),%rax
18053744a: 48 ff 60 70 rex.W jmp *0x70(%rax)
18053744e: cc int3
18053744f: cc int3
180537450: 48 89 5c 24 08 mov %rbx,0x8(%rsp)
180537455: 48 89 74 24 10 mov %rsi,0x10(%rsp)
18053745a: 57 push %rdi
18053745b: 48 83 ec 30 sub $0x30,%rsp
18053745f: f3 0f 10 05 dd cf f8 movss 0x1f8cfdd(%rip),%xmm0 # 0x1824c4444
180537466: 01
180537467: 48 8b fa mov %rdx,%rdi
18053746a: 0f 29 74 24 20 movaps %xmm6,0x20(%rsp)
18053746f: 48 8b d9 mov %rcx,%rbx
180537472: e8 59 d8 4d 01 call 0x181a14cd0
180537477: 48 8b 43 08 mov 0x8(%rbx),%rax
18053747b: 0f 28 f0 movaps %xmm0,%xmm6
18053747e: f3 0f 10 05 6a d1 f8 movss 0x1f8d16a(%rip),%xmm0 # 0x1824c45f0
180537485: 01
180537486: 48 8b 98 68 01 00 00 mov 0x168(%rax),%rbx
18053748d: 48 8b 33 mov (%rbx),%rsi
180537490: e8 3b d8 4d 01 call 0x181a14cd0
180537495: f3 0f 10 0f movss (%rdi),%xmm1
180537499: f3 0f 5c c6 subss %xmm6,%xmm0
18053749d: f3 0f 59 0d 13 c8 f8 mulss 0x1f8c813(%rip),%xmm1 # 0x1824c3cb8
1805374a4: 01
1805374a5: f3 0f 59 c1 mulss %xmm1,%xmm0
1805374a9: f3 0f 58 c6 addss %xmm6,%xmm0
1805374ad: e8 fa d7 4d 01 call 0x181a14cac
1805374b2: 0f 28 c8 movaps %xmm0,%xmm1
1805374b5: 48 8b cb mov %rbx,%rcx
1805374b8: 48 8b 46 78 mov 0x78(%rsi),%rax
1805374bc: 48 8b 5c 24 40 mov 0x40(%rsp),%rbx
1805374c1: 48 8b 74 24 48 mov 0x48(%rsp),%rsi
1805374c6: 0f 28 74 24 20 movaps 0x20(%rsp),%xmm6
1805374cb: 48 83 c4 30 add $0x30,%rsp
1805374cf: 5f pop %rdi
1805374d0: 48 ff e0 rex.W jmp *%rax
1805374d3: cc int3
1805374d4: cc int3
1805374d5: cc int3
1805374d6: cc int3
1805374d7: cc int3
1805374d8: cc int3
1805374d9: cc int3
1805374da: cc int3
1805374db: cc int3
1805374dc: cc int3
1805374dd: cc int3
1805374de: cc int3
1805374df: cc int3
1805374e0: 48 89 5c 24 08 mov %rbx,0x8(%rsp)
1805374e5: 48 89 74 24 10 mov %rsi,0x10(%rsp)
1805374ea: 57 push %rdi
1805374eb: 48 83 ec 40 sub $0x40,%rsp
1805374ef: f3 0f 10 05 f1 ce f8 movss 0x1f8cef1(%rip),%xmm0 # 0x1824c43e8
1805374f6: 01
1805374f7: 48 8b fa mov %rdx,%rdi
1805374fa: 0f 29 74 24 30 movaps %xmm6,0x30(%rsp)
1805374ff: 48 8b d9 mov %rcx,%rbx
180537502: 0f 29 7c 24 20 movaps %xmm7,0x20(%rsp)
180537507: e8 c4 d7 4d 01 call 0x181a14cd0
18053750c: 48 8b 43 08 mov 0x8(%rbx),%rax
180537510: 0f 28 f8 movaps %xmm0,%xmm7
180537513: f3 0f 10 07 movss (%rdi),%xmm0
180537517: f3 0f 59 05 99 c7 f8 mulss 0x1f8c799(%rip),%xmm0 # 0x1824c3cb8
18053751e: 01
18053751f: 48 8b 98 68 01 00 00 mov 0x168(%rax),%rbx
180537526: f3 0f 10 0d ca c9 f8 movss 0x1f8c9ca(%rip),%xmm1 # 0x1824c3ef8
18053752d: 01
18053752e: 48 8b 33 mov (%rbx),%rsi
180537531: e8 a6 d7 4d 01 call 0x181a14cdc
180537536: 0f 28 f0 movaps %xmm0,%xmm6
180537539: f3 0f 10 05 a3 d0 f8 movss 0x1f8d0a3(%rip),%xmm0 # 0x1824c45e4
180537540: 01
180537541: e8 8a d7 4d 01 call 0x181a14cd0
180537546: f3 0f 5c c7 subss %xmm7,%xmm0
18053754a: f3 0f 59 f0 mulss %xmm0,%xmm6
18053754e: f3 0f 58 f7 addss %xmm7,%xmm6
180537552: 0f 28 c6 movaps %xmm6,%xmm0
180537555: e8 52 d7 4d 01 call 0x181a14cac
18053755a: 0f 28 c8 movaps %xmm0,%xmm1
18053755d: 48 8b cb mov %rbx,%rcx
180537560: 48 8b 86 80 00 00 00 mov 0x80(%rsi),%rax
180537567: 48 8b 5c 24 50 mov 0x50(%rsp),%rbx
18053756c: 48 8b 74 24 58 mov 0x58(%rsp),%rsi
180537571: 0f 28 74 24 30 movaps 0x30(%rsp),%xmm6
180537576: 0f 28 7c 24 20 movaps 0x20(%rsp),%xmm7
18053757b: 48 83 c4 40 add $0x40,%rsp
18053757f: 5f pop %rdi
180537580: 48 ff e0 rex.W jmp *%rax
180537583: cc int3
180537584: cc int3
180537585: cc int3
180537586: cc int3
180537587: cc int3
180537588: cc int3
180537589: cc int3
18053758a: cc int3
18053758b: cc int3
18053758c: cc int3
18053758d: cc int3
18053758e: cc int3
18053758f: cc int3
180537590: 48 8b 41 08 mov 0x8(%rcx),%rax
180537594: 48 8b 88 68 01 00 00 mov 0x168(%rax),%rcx
18053759b: 48 81 c1 d8 03 00 00 add $0x3d8,%rcx
1805375a2: 83 79 6c 00 cmpl $0x0,0x6c(%rcx)
1805375a6: 76 09 jbe 0x1805375b1
1805375a8: 48 8b 41 60 mov 0x60(%rcx),%rax
1805375ac: 4c 8b 00 mov (%rax),%r8
1805375af: eb 03 jmp 0x1805375b4
1805375b1: 45 33 c0 xor %r8d,%r8d
1805375b4: f3 0f 10 05 e8 c8 f8 movss 0x1f8c8e8(%rip),%xmm0 # 0x1824c3ea4
1805375bb: 01
1805375bc: 0f 2f 02 comiss (%rdx),%xmm0
1805375bf: 0f 97 c0 seta %al
1805375c2: 41 88 80 10 08 00 00 mov %al,0x810(%r8)
1805375c9: c6 81 8f 00 24 00 01 movb $0x1,0x24008f(%rcx)
1805375d0: e9 5b 86 ff ff jmp 0x18052fc30
1805375d5: cc int3
1805375d6: cc int3
1805375d7: cc int3
1805375d8: cc int3
1805375d9: cc int3
1805375da: cc int3
1805375db: cc int3
1805375dc: cc int3
1805375dd: cc int3
1805375de: cc int3
1805375df: cc int3
1805375e0: 48 8b 41 08 mov 0x8(%rcx),%rax
1805375e4: f3 0f 10 02 movss (%rdx),%xmm0
1805375e8: 48 8b 08 mov (%rax),%rcx
1805375eb: 48 81 c1 d8 03 00 00 add $0x3d8,%rcx
1805375f2: 83 79 6c 00 cmpl $0x0,0x6c(%rcx)
1805375f6: 76 1b jbe 0x180537613
1805375f8: 48 8b 41 60 mov 0x60(%rcx),%rax
1805375fc: 48 8b 10 mov (%rax),%rdx
1805375ff: f3 0f 11 82 0c 08 00 movss %xmm0,0x80c(%rdx)
180537606: 00
180537607: c6 81 8f 00 24 00 01 movb $0x1,0x24008f(%rcx)
18053760e: e9 1d 86 ff ff jmp 0x18052fc30
180537613: 33 d2 xor %edx,%edx
180537615: f3 0f 11 82 0c 08 00 movss %xmm0,0x80c(%rdx)
18053761c: 00
18053761d: c6 81 8f 00 24 00 01 movb $0x1,0x24008f(%rcx)
180537624: e9 07 86 ff ff jmp 0x18052fc30
180537629: cc int3
18053762a: cc int3
18053762b: cc int3
18053762c: cc int3
18053762d: cc int3
18053762e: cc int3
18053762f: cc int3
180537630: 48 8b 41 08 mov 0x8(%rcx),%rax
180537634: f3 0f 10 02 movss (%rdx),%xmm0
180537638: 48 8b 08 mov (%rax),%rcx
18053763b: 48 81 c1 d8 03 00 00 add $0x3d8,%rcx
180537642: 83 79 6c 00 cmpl $0x0,0x6c(%rcx)
180537646: 76 1b jbe 0x180537663
180537648: 48 8b 41 60 mov 0x60(%rcx),%rax
18053764c: 48 8b 10 mov (%rax),%rdx
18053764f: f3 0f 11 82 04 08 00 movss %xmm0,0x804(%rdx)
180537656: 00
180537657: c6 81 8f 00 24 00 01 movb $0x1,0x24008f(%rcx)
18053765e: e9 cd 85 ff ff jmp 0x18052fc30
180537663: 33 d2 xor %edx,%edx
180537665: f3 0f 11 82 04 08 00 movss %xmm0,0x804(%rdx)
18053766c: 00
18053766d: c6 81 8f 00 24 00 01 movb $0x1,0x24008f(%rcx)
180537674: e9 b7 85 ff ff jmp 0x18052fc30
180537679: cc int3
18053767a: cc int3
18053767b: cc int3
18053767c: cc int3
18053767d: cc int3
18053767e: cc int3
18053767f: cc int3
180537680: 40 53 rex push %rbx
180537682: 48 83 ec 20 sub $0x20,%rsp
180537686: f3 41 0f 10 08 movss (%r8),%xmm1
18053768b: 48 8b ca mov %rdx,%rcx
18053768e: 48 8b da mov %rdx,%rbx
180537691: e8 3a 39 ee 00 call 0x18141afd0
180537696: 48 8b c3 mov %rbx,%rax
180537699: 48 83 c4 20 add $0x20,%rsp
18053769d: 5b pop %rbx
18053769e: c3 ret
18053769f: cc int3
1805376a0: 48 89 4c 24 08 mov %rcx,0x8(%rsp)
1805376a5: 48 83 ec 48 sub $0x48,%rsp
1805376a9: 48 c7 44 24 20 fe ff movq $0xfffffffffffffffe,0x20(%rsp)
1805376b0: ff ff
1805376b2: 0f 29 74 24 30 movaps %xmm6,0x30(%rsp)
1805376b7: 48 8b 02 mov (%rdx),%rax
1805376ba: 48 89 44 24 50 mov %rax,0x50(%rsp)
1805376bf: 8b 48 f0 mov -0x10(%rax),%ecx
1805376c2: f7 c1 00 00 00 30 test $0x30000000,%ecx
1805376c8: 75 0a jne 0x1805376d4
1805376ca: b9 01 00 00 00 mov $0x1,%ecx
1805376cf: f0 0f c1 48 f0 lock xadd %ecx,-0x10(%rax)
1805376d4: 48 8d 44 24 50 lea 0x50(%rsp),%rax
1805376d9: 48 89 44 24 58 mov %rax,0x58(%rsp)
1805376de: 48 8d 4c 24 50 lea 0x50(%rsp),%rcx
1805376e3: e8 28 35 ee 00 call 0x18141ac10
1805376e8: 0f 28 f0 movaps %xmm0,%xmm6
1805376eb: 48 8b 4c 24 50 mov 0x50(%rsp),%rcx
1805376f0: 48 83 c1 f0 add $0xfffffffffffffff0,%rcx
1805376f4: 8b 01 mov (%rcx),%eax
1805376f6: a9 00 00 00 30 test $0x30000000,%eax
1805376fb: 75 18 jne 0x180537715
1805376fd: b8 ff ff ff ff mov $0xffffffff,%eax
180537702: f0 0f c1 01 lock xadd %eax,(%rcx)
180537706: ff c8 dec %eax
180537708: 83 f8 ff cmp $0xffffffff,%eax
18053770b: 75 08 jne 0x180537715
18053770d: e8 e2 99 bf 00 call 0x1811310f4
180537712: 0f 28 c6 movaps %xmm6,%xmm0
180537715: 0f 28 74 24 30 movaps 0x30(%rsp),%xmm6
18053771a: 48 83 c4 48 add $0x48,%rsp
18053771e: c3 ret
File diff suppressed because it is too large Load Diff
+206
View File
@@ -0,0 +1,206 @@
soothe_mem.bin: file format binary
Disassembly of section .data:
0000000000530850 <.data+0x530850>:
530850: 48 8b c4 mov %rsp,%rax
530853: 48 89 58 10 mov %rbx,0x10(%rax)
530857: 48 89 70 18 mov %rsi,0x18(%rax)
53085b: 57 push %rdi
53085c: 48 81 ec e0 00 00 00 sub $0xe0,%rsp
530863: 0f 29 70 e8 movaps %xmm6,-0x18(%rax)
530867: 0f 29 78 d8 movaps %xmm7,-0x28(%rax)
53086b: 48 8b 05 fe 50 0e 02 mov 0x20e50fe(%rip),%rax # 0x2615970
530872: 48 33 c4 xor %rsp,%rax
530875: 48 89 84 24 b0 00 00 mov %rax,0xb0(%rsp)
53087c: 00
53087d: f3 0f 10 41 24 movss 0x24(%rcx),%xmm0
530882: 48 8b f9 mov %rcx,%rdi
530885: f3 0f 59 05 ff 34 f9 mulss 0x1f934ff(%rip),%xmm0 # 0x24c3d8c
53088c: 01
53088d: 8b 41 64 mov 0x64(%rcx),%eax
530890: f3 0f 10 35 1c 3d f9 movss 0x1f93d1c(%rip),%xmm6 # 0x24c45b4
530897: 01
530898: 99 cltd
530899: 2b c2 sub %edx,%eax
53089b: f3 0f 5e f0 divss %xmm0,%xmm6
53089f: d1 f8 sar $1,%eax
5308a1: 8d 70 01 lea 0x1(%rax),%esi
5308a4: 66 0f 6e c6 movd %esi,%xmm0
5308a8: 0f 5b c0 cvtdq2ps %xmm0,%xmm0
5308ab: f3 0f 59 f0 mulss %xmm0,%xmm6
5308af: f3 0f 10 05 51 39 f9 movss 0x1f93951(%rip),%xmm0 # 0x24c4208
5308b6: 01
5308b7: e8 f0 43 4e 01 call 0x1a14cac
5308bc: ba 01 00 00 00 mov $0x1,%edx
5308c1: 4c 63 c6 movslq %esi,%r8
5308c4: 0f 28 f8 movaps %xmm0,%xmm7
5308c7: 8b ca mov %edx,%ecx
5308c9: 4c 3b c2 cmp %rdx,%r8
5308cc: 0f 8e 84 01 00 00 jle 0x530a56
5308d2: f2 0f 10 2d 36 46 f9 movsd 0x1f94636(%rip),%xmm5 # 0x24c4f10
5308d9: 01
5308da: 49 8d 40 ff lea -0x1(%r8),%rax
5308de: f3 0f 10 25 be 35 f9 movss 0x1f935be(%rip),%xmm4 # 0x24c3ea4
5308e5: 01
5308e6: 48 83 f8 04 cmp $0x4,%rax
5308ea: 0f 8c 1c 01 00 00 jl 0x530a0c
5308f0: 4d 8d 50 fd lea -0x3(%r8),%r10
5308f4: 44 8d 4a 02 lea 0x2(%rdx),%r9d
5308f8: 0f 1f 84 00 00 00 00 nopl 0x0(%rax,%rax,1)
5308ff: 00
530900: 48 8b 87 a8 06 54 00 mov 0x5406a8(%rdi),%rax
530907: 0f 57 db xorps %xmm3,%xmm3
53090a: f3 0f 2a da cvtsi2ss %edx,%xmm3
53090e: 83 c2 04 add $0x4,%edx
530911: 0f 28 c4 movaps %xmm4,%xmm0
530914: f3 0f 5e de divss %xmm6,%xmm3
530918: 0f 28 cb movaps %xmm3,%xmm1
53091b: f3 0f 5e cf divss %xmm7,%xmm1
53091f: f3 0f 58 cc addss %xmm4,%xmm1
530923: f3 0f 5e c1 divss %xmm1,%xmm0
530927: 0f 57 c9 xorps %xmm1,%xmm1
53092a: f3 0f 5a c8 cvtss2sd %xmm0,%xmm1
53092e: 0f 28 c4 movaps %xmm4,%xmm0
530931: 0f 54 cd andps %xmm5,%xmm1
530934: 66 0f 5a d1 cvtpd2ps %xmm1,%xmm2
530938: f3 0f 59 d3 mulss %xmm3,%xmm2
53093c: 0f 57 db xorps %xmm3,%xmm3
53093f: f3 0f 11 14 88 movss %xmm2,(%rax,%rcx,4)
530944: 41 8d 41 ff lea -0x1(%r9),%eax
530948: f3 0f 2a d8 cvtsi2ss %eax,%xmm3
53094c: 48 8b 87 a8 06 54 00 mov 0x5406a8(%rdi),%rax
530953: f3 0f 5e de divss %xmm6,%xmm3
530957: 0f 28 cb movaps %xmm3,%xmm1
53095a: f3 0f 5e cf divss %xmm7,%xmm1
53095e: f3 0f 58 cc addss %xmm4,%xmm1
530962: f3 0f 5e c1 divss %xmm1,%xmm0
530966: 0f 57 c9 xorps %xmm1,%xmm1
530969: f3 0f 5a c8 cvtss2sd %xmm0,%xmm1
53096d: 0f 28 c4 movaps %xmm4,%xmm0
530970: 0f 54 cd andps %xmm5,%xmm1
530973: 66 0f 5a d1 cvtpd2ps %xmm1,%xmm2
530977: f3 0f 59 d3 mulss %xmm3,%xmm2
53097b: 0f 57 db xorps %xmm3,%xmm3
53097e: f3 41 0f 2a d9 cvtsi2ss %r9d,%xmm3
530983: f3 0f 11 54 88 04 movss %xmm2,0x4(%rax,%rcx,4)
530989: 48 8b 87 a8 06 54 00 mov 0x5406a8(%rdi),%rax
530990: f3 0f 5e de divss %xmm6,%xmm3
530994: 0f 28 cb movaps %xmm3,%xmm1
530997: f3 0f 5e cf divss %xmm7,%xmm1
53099b: f3 0f 58 cc addss %xmm4,%xmm1
53099f: f3 0f 5e c1 divss %xmm1,%xmm0
5309a3: 0f 57 c9 xorps %xmm1,%xmm1
5309a6: f3 0f 5a c8 cvtss2sd %xmm0,%xmm1
5309aa: 0f 28 c4 movaps %xmm4,%xmm0
5309ad: 0f 54 cd andps %xmm5,%xmm1
5309b0: 66 0f 5a d1 cvtpd2ps %xmm1,%xmm2
5309b4: f3 0f 59 d3 mulss %xmm3,%xmm2
5309b8: 0f 57 db xorps %xmm3,%xmm3
5309bb: f3 0f 11 54 88 08 movss %xmm2,0x8(%rax,%rcx,4)
5309c1: 41 8d 41 01 lea 0x1(%r9),%eax
5309c5: f3 0f 2a d8 cvtsi2ss %eax,%xmm3
5309c9: 48 8b 87 a8 06 54 00 mov 0x5406a8(%rdi),%rax
5309d0: 41 83 c1 04 add $0x4,%r9d
5309d4: f3 0f 5e de divss %xmm6,%xmm3
5309d8: 0f 28 cb movaps %xmm3,%xmm1
5309db: f3 0f 5e cf divss %xmm7,%xmm1
5309df: f3 0f 58 cc addss %xmm4,%xmm1
5309e3: f3 0f 5e c1 divss %xmm1,%xmm0
5309e7: 0f 57 c9 xorps %xmm1,%xmm1
5309ea: f3 0f 5a c8 cvtss2sd %xmm0,%xmm1
5309ee: 0f 54 cd andps %xmm5,%xmm1
5309f1: 66 0f 5a d1 cvtpd2ps %xmm1,%xmm2
5309f5: f3 0f 59 d3 mulss %xmm3,%xmm2
5309f9: f3 0f 11 54 88 0c movss %xmm2,0xc(%rax,%rcx,4)
5309ff: 48 83 c1 04 add $0x4,%rcx
530a03: 49 3b ca cmp %r10,%rcx
530a06: 0f 8c f4 fe ff ff jl 0x530900
530a0c: 49 3b c8 cmp %r8,%rcx
530a0f: 7d 45 jge 0x530a56
530a11: 48 8b 87 a8 06 54 00 mov 0x5406a8(%rdi),%rax
530a18: 0f 57 db xorps %xmm3,%xmm3
530a1b: f3 0f 2a da cvtsi2ss %edx,%xmm3
530a1f: ff c2 inc %edx
530a21: 0f 28 c4 movaps %xmm4,%xmm0
530a24: f3 0f 5e de divss %xmm6,%xmm3
530a28: 0f 28 cb movaps %xmm3,%xmm1
530a2b: f3 0f 5e cf divss %xmm7,%xmm1
530a2f: f3 0f 58 cc addss %xmm4,%xmm1
530a33: f3 0f 5e c1 divss %xmm1,%xmm0
530a37: 0f 57 c9 xorps %xmm1,%xmm1
530a3a: f3 0f 5a c8 cvtss2sd %xmm0,%xmm1
530a3e: 0f 54 cd andps %xmm5,%xmm1
530a41: 66 0f 5a d1 cvtpd2ps %xmm1,%xmm2
530a45: f3 0f 59 d3 mulss %xmm3,%xmm2
530a49: f3 0f 11 14 88 movss %xmm2,(%rax,%rcx,4)
530a4e: 48 ff c1 inc %rcx
530a51: 49 3b c8 cmp %r8,%rcx
530a54: 7c bb jl 0x530a11
530a56: 48 8b 9f a8 06 54 00 mov 0x5406a8(%rdi),%rbx
530a5d: 48 8d 15 54 03 12 02 lea 0x2120354(%rip),%rdx # 0x2650db8
530a64: 48 8d 0d 4d 03 12 02 lea 0x212034d(%rip),%rcx # 0x2650db8
530a6b: ff 15 97 a5 67 01 call *0x167a597(%rip) # 0x1bab008
530a71: 44 8b ce mov %esi,%r9d
530a74: 4c 8b c3 mov %rbx,%r8
530a77: 48 8b cb mov %rbx,%rcx
530a7a: 85 c0 test %eax,%eax
530a7c: 75 0f jne 0x530a8d
530a7e: f3 0f 10 0d ca 33 f9 movss 0x1f933ca(%rip),%xmm1 # 0x24c3e50
530a85: 01
530a86: e8 b5 ff c0 ff call 0x140a40
530a8b: eb 0d jmp 0x530a9a
530a8d: f2 0f 10 0d 7b 36 f9 movsd 0x1f9367b(%rip),%xmm1 # 0x24c4110
530a94: 01
530a95: e8 66 00 c1 ff call 0x140b00
530a9a: f3 0f 10 4f 24 movss 0x24(%rdi),%xmm1
530a9f: 48 8d 4c 24 30 lea 0x30(%rsp),%rcx
530aa4: f3 0f 10 05 24 38 f9 movss 0x1f93824(%rip),%xmm0 # 0x24c42d0
530aab: 01
530aac: f2 0f 10 1d 8c 36 f9 movsd 0x1f9368c(%rip),%xmm3 # 0x24c4140
530ab3: 01
530ab4: f2 0f 10 15 c4 38 f9 movsd 0x1f938c4(%rip),%xmm2 # 0x24c4380
530abb: 01
530abc: 48 8b 9f 18 07 54 00 mov 0x540718(%rdi),%rbx
530ac3: 0f 5a c9 cvtps2pd %xmm1,%xmm1
530ac6: f3 0f 11 44 24 20 movss %xmm0,0x20(%rsp)
530acc: e8 ef 33 00 00 call 0x533ec0
530ad1: 48 8b 97 f8 06 54 00 mov 0x5406f8(%rdi),%rdx
530ad8: 4c 8d 44 24 30 lea 0x30(%rsp),%r8
530add: 48 8b 8f 08 07 54 00 mov 0x540708(%rdi),%rcx
530ae4: 4c 8b cb mov %rbx,%r9
530ae7: 89 74 24 20 mov %esi,0x20(%rsp)
530aeb: e8 90 4d 00 00 call 0x535880
530af0: 48 8b 97 08 07 54 00 mov 0x540708(%rdi),%rdx
530af7: 44 8b c6 mov %esi,%r8d
530afa: 48 8b 8f f8 06 54 00 mov 0x5406f8(%rdi),%rcx
530b01: e8 ca 4a 00 00 call 0x5355d0
530b06: 48 8b 97 f8 06 54 00 mov 0x5406f8(%rdi),%rdx
530b0d: 44 8b c6 mov %esi,%r8d
530b10: 48 8b 8f a8 06 54 00 mov 0x5406a8(%rdi),%rcx
530b17: e8 74 ce ff ff call 0x52d990
530b1c: 48 8b 87 a8 06 54 00 mov 0x5406a8(%rdi),%rax
530b23: c7 00 00 00 00 00 movl $0x0,(%rax)
530b29: 48 8b 8c 24 b0 00 00 mov 0xb0(%rsp),%rcx
530b30: 00
530b31: 48 33 cc xor %rsp,%rcx
530b34: e8 97 05 c0 00 call 0x11310d0
530b39: 4c 8d 9c 24 e0 00 00 lea 0xe0(%rsp),%r11
530b40: 00
530b41: 49 8b 5b 18 mov 0x18(%r11),%rbx
530b45: 49 8b 73 20 mov 0x20(%r11),%rsi
530b49: 41 0f 28 73 f0 movaps -0x10(%r11),%xmm6
530b4e: 41 0f 28 7b e0 movaps -0x20(%r11),%xmm7
530b53: 49 8b e3 mov %r11,%rsp
530b56: 5f pop %rdi
530b57: c3 ret
530b58: cc int3
530b59: cc int3
530b5a: cc int3
530b5b: cc int3
530b5c: cc int3
530b5d: cc int3
530b5e: cc int3
530b5f: cc int3
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More