Skip to content

hifi-decode: Do FFT in power of 2#204

Merged
harrypm merged 4 commits intooyvindln:vhs_decodefrom
eshaz:hifi-decode-fft-power-of-2
Mar 23, 2025
Merged

hifi-decode: Do FFT in power of 2#204
harrypm merged 4 commits intooyvindln:vhs_decodefrom
eshaz:hifi-decode-fft-power-of-2

Conversation

@eshaz
Copy link

@eshaz eshaz commented Mar 22, 2025

Fixes

  • Disable integer division for overlap when input sample rate is not dividable by the output sample rate, i.e. --cxadc
  • Tune block overlap logic to be a bit more accurate.
  • Calculate peak gain only for audio that is written to the output file.

Enhancements

  • Update intermediate frequency audio sample rate so FFT operations operate on data chunks sized in a power of 2 for efficiency.

Benchmark

$ ffmpeg -i test.rf.flac -f s16le -acodec pcm_s16le - | \
~/git/vhs-decode/hifi-decode -n -t 32 -f 20 --overwrite --auto_fine_tune off --normalize - test.hifi.flac
Computer Specs
$ lscpu
CPU(s):                   192
  On-line CPU(s) list:    0-191
Vendor ID:                GenuineIntel
  Model name:             Intel(R) Xeon(R) CPU E7-8890 v4 @ 2.20GHz
    CPU family:           6
    Model:                79
    Thread(s) per core:   2
    Core(s) per socket:   24
    Socket(s):            4
    Stepping:             1

Before Changes

- Decoding speed: 61733 kFrames/s (1.54x), 0 blocks enqueued
- Input position: 0:29:28.403
- Audio position: 0:29:28.403
- Audio buffer  : 0:00:00.000
- Wall time     : 0:19:05.831

Peak gain is 72.92%. Adjusting by 137.04%, please wait...
Progress [########################################] 100.00%

Decode finished, seconds elapsed: 1164
Decode finished successfully

After Changes

- Decoding speed: 76518 kFrames/s (1.91x), 0 blocks enqueued
- Input position: 0:29:28.403
- Audio position: 0:29:28.403
- Audio buffer  : 0:00:00.000
- Wall time     : 0:15:24.437

Peak gain is 71.56%. Adjusting by 139.65%, please wait...
Progress [########################################] 100.00%

Decode finished, seconds elapsed: 945
Decode finished successfully

@harrypm harrypm merged commit ee8b360 into oyvindln:vhs_decode Mar 23, 2025
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