[refactor](trx-ftx): flatten ft2/ submodules into top-level src/

Move ft2/osd.rs, ft2/bitmetrics.rs, ft2/downsample.rs, ft2/sync.rs
out of the ft2/ directory into src/ as top-level modules. Convert
ft2/mod.rs to ft2.rs. Update all imports from super:: to crate::ft2::.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
2026-03-19 23:31:19 +01:00
parent 2da749b978
commit de0bc89705
6 changed files with 15 additions and 13 deletions
@@ -13,7 +13,7 @@ use rustfft::FftPlanner;
use crate::constants::{FT4_COSTAS_PATTERN, FT4_GRAY_MAP};
use super::{FT2_FRAME_SYMBOLS, FT2_NSS};
use crate::ft2::{FT2_FRAME_SYMBOLS, FT2_NSS};
const N_METRICS: usize = 2 * FT2_FRAME_SYMBOLS;
@@ -14,7 +14,7 @@ use std::sync::Arc;
use num_complex::Complex32;
use rustfft::FftPlanner;
use super::{FT2_NDOWN, FT2_SYMBOL_PERIOD_F};
use crate::ft2::{FT2_NDOWN, FT2_SYMBOL_PERIOD_F};
/// Reusable scratch buffers for frequency-domain downsampling.
pub struct DownsampleWorkspace {
@@ -8,24 +8,18 @@
//! peaks in the averaged spectrum, downsample each candidate, compute 2D sync
//! scores, extract bit metrics, and run multi-pass LDPC + OSD decode.
pub mod bitmetrics;
pub mod downsample;
pub mod osd;
pub mod sync;
use std::sync::Arc;
use num_complex::Complex32;
use realfft::RealFftPlanner;
use rustfft::FftPlanner;
use crate::bitmetrics::BitMetricsWorkspace;
use crate::decode::{verify_crc_and_build_message, FtxMessage};
use crate::downsample::{DownsampleContext, DownsampleWorkspace};
use crate::ft2_sync::{prepare_sync_waveforms, sync2d_score, SyncWaveforms};
use crate::protocol::*;
use bitmetrics::BitMetricsWorkspace;
use downsample::{DownsampleContext, DownsampleWorkspace};
use sync::{prepare_sync_waveforms, sync2d_score, SyncWaveforms};
// FT2 DSP constants
pub const FT2_NDOWN: usize = 9;
pub const FT2_NFFT1: usize = 1152;
@@ -655,7 +649,7 @@ impl Ft2Pipeline {
let mut nharderror = -1i32;
let mut dmin = 0.0f32;
osd::ft2_decode174_91_osd(
crate::osd::ft2_decode174_91_osd(
&mut log174,
FTX_LDPC_K,
4,
@@ -13,7 +13,7 @@ use std::sync::OnceLock;
use crate::constants::FT4_COSTAS_PATTERN;
use super::{FT2_NDOWN, FT2_NSS, FT2_SYMBOL_PERIOD_F, FT2_SYNC_TWEAK_MAX, FT2_SYNC_TWEAK_MIN};
use crate::ft2::{FT2_NDOWN, FT2_NSS, FT2_SYMBOL_PERIOD_F, FT2_SYNC_TWEAK_MAX, FT2_SYNC_TWEAK_MIN};
/// Number of frequency tweak entries.
const NUM_TWEAKS: usize = (FT2_SYNC_TWEAK_MAX - FT2_SYNC_TWEAK_MIN) as usize + 1;
+8
View File
@@ -2,6 +2,8 @@
//
// SPDX-License-Identifier: BSD-2-Clause
#[allow(clippy::needless_range_loop)]
pub mod bitmetrics;
pub mod callsign_hash;
pub mod constants;
pub mod crc;
@@ -9,15 +11,21 @@ pub mod crc;
pub mod decode;
mod decoder;
#[allow(clippy::needless_range_loop)]
pub mod downsample;
#[allow(clippy::needless_range_loop)]
pub mod encode;
#[allow(dead_code, clippy::needless_range_loop, clippy::too_many_arguments)]
pub mod ft2;
#[allow(clippy::needless_range_loop)]
pub mod ft2_sync;
#[allow(clippy::needless_range_loop)]
pub mod ldpc;
#[allow(clippy::explicit_counter_loop, clippy::needless_range_loop)]
pub mod message;
#[allow(dead_code)]
pub mod monitor;
#[allow(dead_code, clippy::needless_range_loop, clippy::too_many_arguments)]
pub mod osd;
pub mod protocol;
pub mod text;