diff options
Diffstat (limited to 'host/lib/convert/convert_unpack_sc12.hpp')
-rw-r--r-- | host/lib/convert/convert_unpack_sc12.hpp | 80 |
1 files changed, 37 insertions, 43 deletions
diff --git a/host/lib/convert/convert_unpack_sc12.hpp b/host/lib/convert/convert_unpack_sc12.hpp index e612b035d..26e5f5d79 100644 --- a/host/lib/convert/convert_unpack_sc12.hpp +++ b/host/lib/convert/convert_unpack_sc12.hpp @@ -5,9 +5,9 @@ // SPDX-License-Identifier: GPL-3.0-or-later // -#include <type_traits> -#include <uhd/utils/byteswap.hpp> #include "convert_common.hpp" +#include <uhd/utils/byteswap.hpp> +#include <type_traits> using namespace uhd::convert; @@ -37,38 +37,35 @@ struct item32_sc12_3x * The numbers mark the position of one complex sample. */ template <typename type, tohost32_type tohost> -void convert_sc12_item32_3_to_star_4 -( - const item32_sc12_3x &input, - std::complex<type> &out0, - std::complex<type> &out1, - std::complex<type> &out2, - std::complex<type> &out3, +void convert_sc12_item32_3_to_star_4(const item32_sc12_3x& input, + std::complex<type>& out0, + std::complex<type>& out1, + std::complex<type>& out2, + std::complex<type>& out3, const double scalar, - typename std::enable_if<std::is_floating_point<type>::value>::type* = NULL -) + typename std::enable_if<std::is_floating_point<type>::value>::type* = NULL) { - //step 0: extract the lines from the input buffer - const item32_t line0 = tohost(input.line0); - const item32_t line1 = tohost(input.line1); - const item32_t line2 = tohost(input.line2); + // step 0: extract the lines from the input buffer + const item32_t line0 = tohost(input.line0); + const item32_t line1 = tohost(input.line1); + const item32_t line2 = tohost(input.line2); const uint64_t line01 = (uint64_t(line0) << 32) | line1; const uint64_t line12 = (uint64_t(line1) << 32) | line2; - //step 1: shift out and mask off the individual numbers - const type i0 = type(int16_t((line0 >> 16) & 0xfff0)*scalar); - const type q0 = type(int16_t((line0 >> 4) & 0xfff0)*scalar); + // step 1: shift out and mask off the individual numbers + const type i0 = type(int16_t((line0 >> 16) & 0xfff0) * scalar); + const type q0 = type(int16_t((line0 >> 4) & 0xfff0) * scalar); - const type i1 = type(int16_t((line01 >> 24) & 0xfff0)*scalar); - const type q1 = type(int16_t((line1 >> 12) & 0xfff0)*scalar); + const type i1 = type(int16_t((line01 >> 24) & 0xfff0) * scalar); + const type q1 = type(int16_t((line1 >> 12) & 0xfff0) * scalar); - const type i2 = type(int16_t((line1 >> 0) & 0xfff0)*scalar); - const type q2 = type(int16_t((line12 >> 20) & 0xfff0)*scalar); + const type i2 = type(int16_t((line1 >> 0) & 0xfff0) * scalar); + const type q2 = type(int16_t((line12 >> 20) & 0xfff0) * scalar); - const type i3 = type(int16_t((line2 >> 8) & 0xfff0)*scalar); - const type q3 = type(int16_t((line2 << 4) & 0xfff0)*scalar); + const type i3 = type(int16_t((line2 >> 8) & 0xfff0) * scalar); + const type q3 = type(int16_t((line2 << 4) & 0xfff0) * scalar); - //step 2: load the outputs + // step 2: load the outputs out0 = std::complex<type>(i0, q0); out1 = std::complex<type>(i1, q1); out2 = std::complex<type>(i2, q2); @@ -76,27 +73,24 @@ void convert_sc12_item32_3_to_star_4 } template <typename type, tohost32_type tohost> -void convert_sc12_item32_3_to_star_4 -( - const item32_sc12_3x &input, - std::complex<type> &out0, - std::complex<type> &out1, - std::complex<type> &out2, - std::complex<type> &out3, +void convert_sc12_item32_3_to_star_4(const item32_sc12_3x& input, + std::complex<type>& out0, + std::complex<type>& out1, + std::complex<type>& out2, + std::complex<type>& out3, const double, - typename std::enable_if<std::is_integral<type>::value>::type* = NULL -) + typename std::enable_if<std::is_integral<type>::value>::type* = NULL) { - //step 0: extract the lines from the input buffer - const item32_t line0 = tohost(input.line0); - const item32_t line1 = tohost(input.line1); - const item32_t line2 = tohost(input.line2); + // step 0: extract the lines from the input buffer + const item32_t line0 = tohost(input.line0); + const item32_t line1 = tohost(input.line1); + const item32_t line2 = tohost(input.line2); const uint64_t line01 = (uint64_t(line0) << 32) | line1; const uint64_t line12 = (uint64_t(line1) << 32) | line2; - //step 1: extract and load the outputs - out0 = std::complex<type>(line0 >> 16 & 0xfff0, line0 >> 4 & 0xfff0); - out1 = std::complex<type>(line01 >> 24 & 0xfff0, line1 >> 12 & 0xfff0); - out2 = std::complex<type>(line1 >> 0 & 0xfff0, line12 >> 20 & 0xfff0); - out3 = std::complex<type>(line2 >> 8 & 0xfff0, line2 << 4 & 0xfff0); + // step 1: extract and load the outputs + out0 = std::complex<type>(line0 >> 16 & 0xfff0, line0 >> 4 & 0xfff0); + out1 = std::complex<type>(line01 >> 24 & 0xfff0, line1 >> 12 & 0xfff0); + out2 = std::complex<type>(line1 >> 0 & 0xfff0, line12 >> 20 & 0xfff0); + out3 = std::complex<type>(line2 >> 8 & 0xfff0, line2 << 4 & 0xfff0); } |