Skip to content

Add opt-in mono processing for DPDFNet - #5375

Merged
wwmm merged 2 commits into
wwmm:masterfrom
varyagnord:feat/dpdfnet-mono-processing
Oct 14, 2026
Merged

wwmm merged 2 commits into
wwmm:masterfrom
varyagnord:feat/dpdfnet-mono-processing

Conversation

@varyagnord

@varyagnord varyagnord commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Mono microphones can expose identical left/right channels through PipeWire. DPDFNet currently runs two independent mono LADSPA instances for that stream, doubling model work for the same signal. This adds an opt-in Process as Mono control to Deep Noise Remover when DPDFNet is selected.

Behavior and compatibility

  • Average left/right inputs before resampling, process the result with one DPDFNet instance, and copy its output to both channels. Mixing uses a worker-allocated buffer before either output is written, including in-place processing. Publish it with a constant-time swap; free the retired buffer after unlocking, outside the audio callback.
  • Default false preserves existing stereo behavior. The option is per effect instance, available in either pipeline, and persisted as mono-processing in presets. Loading a preset without the key resets it to the default, including after a mono preset was loaded.
  • The checkbox sits directly below the model selector and appears only for DPDFNet. Its translated, keyboard-accessible tooltip and accessibility description explain the potential CPU reduction and loss of stereo separation. Tooltip width is bounded for readable wrapping.
  • Setting changes reset the processing history. Ignore superseded queued setup requests and destroy the unused right instance in mono mode, including during rapid setting/preset changes.
  • Document averaging: duplicated mono retains its level; a single active input channel is attenuated by 6 dB, and opposite-polarity inputs can cancel. The selected neural model and latency are unchanged.

Validation

  • Clean native Release development build completed on Fedora with GCC 16.2.1 and Qt 6.11.2; modified C++ follows the repository's clang-format configuration and the QML file matches qmlformat output.
  • An isolated local regression harness links the actual compiled DeepFilterNet and preset implementation, using a counting/gain LADSPA fixture and a private PipeWire server. Verified preset round trip, legacy preset default, one/two instance and callback counts, in-place mixing, finite output, identical mono channels, and bypass.
  • Exercised 32/44.1/48/96 kHz with 128/480/1024-frame buffers and repeated mono/stereo transitions. Also verified 100 rapid toggles leave exactly one instance when mono is the final setting.
  • Loaded the actual QML page offscreen: model-dependent visibility, user toggle → database, and external database update → checkbox all pass.

Performance

Mean CPU use (percentage of one core, mean ± SD of four run values): 68.00 ± 14.11% stereo → 33.99 ± 7.39% mono, a 50.0% reduction on this setup. Background desktop workloads were present; the relatively large run variability makes the absolute CPU values illustrative rather than an isolated-core capacity estimate.

The measurement uses the actual compiled effect in the isolated harness with HushMic v0.10.3 LADSPA with native INT8 DPDFNet8 (locally built with AVX-VNNI for Alder Lake; identical plugin and assets in both modes), fixed quality tier, duplicated synthetic mono input, 480 samples at 48 kHz. Four fresh 12-second processes per mode, alternating AB/BA order, all threads on logical CPU 2 (Intel Core i7-1255U P core). Process CPU time includes the inference workers; setup completes before timing. No queue overflow was reported.

This is a DSP/effect CPU benchmark, not a hardware-capture or complete PipeWire latency benchmark. Savings depend on the model, backend, and other enabled effects; the UI deliberately promises no fixed percentage.

Related independent optimization: ceva-ip/DPDFNet#20 adds automatic AVX-VNNI dispatch in the upstream native runtime. This EasyEffects PR works with the existing mono LADSPA interface and does not depend on that change or add an ISA setting.

CI baseline

The final PR CI run passed 12 of 13 jobs, including all native/Flatpak builds (GCC, Clang, x86_64, aarch64), CodeQL, QML, KCFG, and manifest checks. Clang Tidy remains failing on pre-existing diagnostics in unchanged code. The CI run for the unmodified base commit already fails on these checks, including implicit constructors in kconfig_base_ee.hpp/lv2_wrapper.hpp and redundant empty lambda parameter lists in plugin_base.hpp. The final Clang Tidy log contains no diagnostics in deepfilternet.cpp, deepfilternet.hpp, or their preset implementation. Unrelated baseline diagnostics remain outside this feature.

Mix duplicate microphone channels before resampling and run one mono LADSPA instance. Persist the setting per effect and preset, document CPU savings and channel averaging, and discard superseded setup requests during rapid changes.
@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Allocate the mixing buffer outside PipeWire callbacks, publish it with a constant-time swap, and free the retired buffer after releasing the data mutex. Use the ranges transform and explicit arithmetic grouping required by Clang Tidy.
@wwmm
wwmm merged commit 34ec495 into wwmm:master Oct 14, 2026
13 of 14 checks passed
@wwmm

wwmm commented Oct 14, 2026

Copy link
Copy Markdown
Owner

I did some tests and it seems fine. Thanks.

@varyagnord

varyagnord commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor Author

@wwmm Thank you! I'm happy to help the project grow and glad to be useful :)

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.

2 participants