FERS 0.1.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
if_resampler.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-only
2//
3// Copyright (c) 2026-present FERS Contributors (see AUTHORS.md).
4//
5// See the GNU GPLv2 LICENSE file in the FERS project root for more information.
6
7/**
8 * @file if_resampler.h
9 * @brief Internal FMCW IF rational resampler planning and streaming sink.
10 */
11
12#pragma once
13
14#include <cstddef>
15#include <cstdint>
16#include <memory>
17#include <optional>
18#include <span>
19#include <vector>
20
21#include "core/config.h"
22
23namespace fers_signal
24{
25 enum class FmcwIfResamplerStageKind : std::uint8_t
26 {
29 };
30
32 {
33 std::size_t max_taps_per_stage = 4096;
35 std::size_t max_phase_refinement = 64;
36 std::uint64_t max_ratio_denominator = 1'000'000;
38 };
39
41 {
42 std::uint64_t numerator = 1;
43 std::uint64_t denominator = 1;
47 };
48
58
80
104
105 [[nodiscard]] FmcwIfRateRatio approximateFmcwIfRateRatio(RealType output_sample_rate_hz,
106 RealType input_sample_rate_hz,
107 const FmcwIfResamplerLimits& limits = {});
108
109 [[nodiscard]] FmcwIfResamplerPlan planFmcwIfResampler(const FmcwIfResamplerRequest& request);
110
112 {
113 std::vector<ComplexType> emitted;
114 std::size_t skipped_output_samples = 0;
115 };
116
118 {
119 public:
122
127
128 void consume(std::span<const ComplexType> block);
132 void reset();
133
135
136 private:
137 class Stage;
138
140 std::vector<std::unique_ptr<Stage>> _stages;
141 std::vector<ComplexType> _output;
142 bool _finished = false;
143 };
144}
FmcwIfResamplingSink(FmcwIfResamplingSink &&) noexcept
void consume(std::span< const ComplexType > block)
FmcwIfResamplingSink(const FmcwIfResamplingSink &)=delete
std::vector< ComplexType > takeOutput()
FmcwIfResamplingSink & operator=(const FmcwIfResamplingSink &)=delete
FmcwIfZeroInputResult consumeZeroInput(std::size_t input_count)
std::vector< ComplexType > finish()
const FmcwIfResamplerPlan & plan() const noexcept
Global configuration file for the project.
double RealType
Type for real numbers.
Definition config.h:27
std::complex< RealType > ComplexType
Type for complex numbers.
Definition config.h:35
FmcwIfResamplerPlan planFmcwIfResampler(const FmcwIfResamplerRequest &request)
FmcwIfRateRatio approximateFmcwIfRateRatio(const RealType output_sample_rate_hz, const RealType input_sample_rate_hz, const FmcwIfResamplerLimits &limits)
math::Vec3 max
std::vector< FmcwIfResamplerStagePlan > stages
FmcwIfResamplerLimits limits
std::optional< RealType > filter_transition_width_hz
FmcwIfResamplerStageKind kind
std::vector< ComplexType > emitted