aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCiro Nishiguchi <ciro.nishiguchi@ni.com>2018-10-05 10:33:51 -0500
committerMartin Braun <martin.braun@ettus.com>2018-10-05 10:46:31 -0700
commit12e4c4405c22093a220882d06872989e2eeb36d3 (patch)
tree0f04c8e1831b3250fb572daf98cbab538b2402ca
parent2a4bf0197c1c980e15eca7b8f4e4f4e4043b5eb1 (diff)
downloaduhd-12e4c4405c22093a220882d06872989e2eeb36d3.tar.gz
uhd-12e4c4405c22093a220882d06872989e2eeb36d3.tar.bz2
uhd-12e4c4405c22093a220882d06872989e2eeb36d3.zip
uhd: Fix rounding in ddc/duc rate calculation
The DDC and DUC convert the requested rate to an integer before selecting a decimated / interpolated rate. This causes the selection to select a lower rate than requested in some corner cases. The effect is more pronounced when the input rate of the DDC or the output rate of the DUC is very small.
-rw-r--r--host/lib/rfnoc/ddc_block_ctrl_impl.cpp2
-rw-r--r--host/lib/rfnoc/duc_block_ctrl_impl.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/host/lib/rfnoc/ddc_block_ctrl_impl.cpp b/host/lib/rfnoc/ddc_block_ctrl_impl.cpp
index 9247708ef..b70ae8959 100644
--- a/host/lib/rfnoc/ddc_block_ctrl_impl.cpp
+++ b/host/lib/rfnoc/ddc_block_ctrl_impl.cpp
@@ -245,7 +245,7 @@ private:
return range;
}
- double set_output_rate(const int requested_rate, const size_t chan)
+ double set_output_rate(const double requested_rate, const size_t chan)
{
const double input_rate = get_arg<double>("input_rate");
const size_t decim_rate =
diff --git a/host/lib/rfnoc/duc_block_ctrl_impl.cpp b/host/lib/rfnoc/duc_block_ctrl_impl.cpp
index 7f22ca903..cc9d30361 100644
--- a/host/lib/rfnoc/duc_block_ctrl_impl.cpp
+++ b/host/lib/rfnoc/duc_block_ctrl_impl.cpp
@@ -230,7 +230,7 @@ private:
return range;
}
- double set_input_rate(const int requested_rate, const size_t chan)
+ double set_input_rate(const double requested_rate, const size_t chan)
{
const double output_rate = get_arg<double>("output_rate", chan);
const size_t interp_rate = boost::math::iround(output_rate/get_input_rates().clip(requested_rate, true));