Skip to content

Reduce redundant video FFT work - #1060

Merged
happycube merged 1 commit into
happycube:mainfrom
Josalo-III:feature/decoder-fft-performance
Aug 12, 2026
Merged

Reduce redundant video FFT work#1060
happycube merged 1 commit into
happycube:mainfrom
Josalo-III:feature/decoder-fft-performance

Conversation

@Josalo-III

Copy link
Copy Markdown
Contributor

Checklist

  • I have searched the open pull requests to confirm this change has not already been submitted.
  • My branch is up to date with the target branch.
  • I have tested my changes and all existing tests pass.
  • Documentation is unchanged because this does not alter user-facing behavior or configuration.
  • My code follows the project's coding standards (see CONTRIBUTING.md).

Description

Reduce redundant FFT work in the video demodulation path while preserving its output contract.

Motivation

The existing path computes several full-complex transforms and performs separate inverse transforms and post-transform rolls even though the dropout and video outputs are real-valued. This change avoids that redundant work.

Related Issues

N/A

Changes Made

  • Use the positive-frequency half-spectrum for real-valued dropout and video outputs.
  • Batch the video inverse transforms with irfft.
  • Apply the existing filter sample offsets in the frequency domain.
  • Add deterministic NTSC and PAL comparisons against the former full-FFT path.

Testing

  • Full suite: nix develop --command python -m pytest -q — 84 passed.
  • Focused tests: nix develop --command python -m pytest -q tests/test_demod_fft.py — 2 passed.
  • Synthetic 200-block benchmark against current upstream main:
    • NTSC: 2.60 → 1.81 ms/block (~30.4% lower)
    • PAL: 2.83 → 2.06 ms/block (~27.2% lower)

Screenshots (if applicable)

N/A

Additional Notes

No new dependency is introduced; this uses the existing SciPy FFT implementation. The record-array output construction and public behavior remain unchanged.

Use real transforms for real-valued dropout and video outputs, batch the video inverse transforms, and apply the existing filter offsets in the frequency domain. Add deterministic NTSC and PAL comparisons against the former full-FFT path.

Against current main, the synthetic 200-block benchmark reduces mean demodulation time from 2.60 to 1.81 ms for NTSC and from 2.83 to 2.06 ms for PAL. All 84 Python tests pass.
@happycube
happycube merged commit 1891ac6 into happycube:main Aug 12, 2026
6 checks passed
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