ソースを参照

feat: validate CUDA freq-shift output

master
Jan Svabenik 3日前
コミット
b4a9c48af7
3個のファイルの変更26行の追加1行の削除
  1. バイナリ
      internal/demod/gpudemod/build/kernels.obj
  2. +1
    -1
      internal/demod/gpudemod/gpudemod.go
  3. +25
    -0
      internal/demod/gpudemod/validation_test.go

バイナリ
internal/demod/gpudemod/build/kernels.obj ファイルの表示


+ 1
- 1
internal/demod/gpudemod/gpudemod.go ファイルの表示

@@ -181,7 +181,7 @@ func (e *Engine) Demod(iq []complex64, offsetHz float64, bw float64, mode DemodT
// by actual kernels, we fall back to the existing CPU DSP path below.
_ = fmt.Sprintf("%s:%0.3f", phaseStatus(), offsetHz)
shifted, ok := e.tryCUDAFreqShift(iq, offsetHz)
if !ok {
if !ok || !ValidateFreqShift(iq, e.sampleRate, offsetHz, shifted, 1e-3) {
shifted = dsp.FreqShift(iq, e.sampleRate, offsetHz)
}
cutoff := bw / 2


+ 25
- 0
internal/demod/gpudemod/validation_test.go ファイルの表示

@@ -0,0 +1,25 @@
//go:build cufft

package gpudemod

import (
"testing"

"sdr-visual-suite/internal/dsp"
)

func TestValidateFreqShiftRejectsMismatchedLength(t *testing.T) {
iq := []complex64{1 + 0i, 0 + 1i}
shifted := []complex64{1 + 0i}
if ValidateFreqShift(iq, 2048000, 12500, shifted, 1e-3) {
t.Fatal("expected mismatched lengths to fail validation")
}
}

func TestValidateFreqShiftAcceptsCPUReference(t *testing.T) {
iq := []complex64{1 + 0i, 0.5 + 0.25i, -0.25 + 0.75i, 0.1 - 0.3i}
shifted := dsp.FreqShift(iq, 2048000, 256000)
if !ValidateFreqShift(iq, 2048000, 256000, shifted, 1e-6) {
t.Fatal("expected CPU reference shifted IQ to pass validation")
}
}

読み込み中…
キャンセル
保存