Skip to content

refactor(processor): merge duplicate paths into private helpers - #143

Open
google-labs-stitch[bot] wants to merge 1 commit into
mainfrom
stitch/consolidate-processor-helpers-jm1-073776cc-e78f-4948-bb91-478ca9272d6c
Open

google-labs-stitch[bot] wants to merge 1 commit into
mainfrom
stitch/consolidate-processor-helpers-jm1-073776cc-e78f-4948-bb91-478ca9272d6c

Conversation

@google-labs-stitch

Copy link
Copy Markdown
Contributor

Summary

Merge duplicate audio-block, drain-tail, pitch-snapshot, voice-slice and stage-event logic into private helpers in src/processor.rs, and pass PitchEstimate to Resynthesis::target_note in src/resynthesis.rs so Resynthesis::estimate runs one time in each snapshot.

Changes

  • Add private process_stereo_slice, process_planar_slices and process_mono_slice helpers around Processor::process_into, and route the six process* methods through them with std::convert::identity, pcm_from_f32 and pcm_to_f32.
  • Add private drain_slice and drain_planar_slices helpers around Processor::drain_into, and route the six drain* methods through them while keeping left-before-right length checks and post-drain zero fills intact.
  • Pass estimate: PitchEstimate to Resynthesis::target_note, and reuse Processor::feedback in Processor::telemetry for processed_frames and the five pitch fields.
  • Add private Telemetry::active_voice_slice for active_voice_ratios and active_voice_gains, with the 16-entry upper bound preserved.
  • Add private Processor::apply_stage for the five stage arms in Processor::apply.

Verification

  • cargo fmt --check, cargo rustc --locked --lib --release -- -D warnings and RUSTFLAGS="-D warnings" cargo build --locked --release
  • cargo clippy --locked --lib -- -D warnings and RUSTDOCFLAGS="-D warnings" cargo doc --locked --no-deps
  • npm run check:wasm, npm run verify:pack and cargo package --locked
  • RUSTUP_TOOLCHAIN=1.88 cargo build --locked --lib and RUSTUP_TOOLCHAIN=1.88 cargo build --locked --lib --target wasm32-unknown-unknown --features wasm
  • External comparison against the baseline across 22,226,970 frames and 138,660 snapshots at 44.1 kHz and 48 kHz: 0 post-init heap allocations, identical error order and 0 bit differences in PCM, f32, Feedback and Telemetry outputs.

Automated PR initiated by user @byteland-app via Stitch Loop.

- Add private slice helpers for the six process methods.
- Add drain_slice and drain_planar_slices for the six drain methods.
- Pass PitchEstimate to Resynthesis::target_note.
- Reuse Processor::feedback in Processor::telemetry.
- Add Telemetry::active_voice_slice and Processor::apply_stage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants