aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/convert
diff options
context:
space:
mode:
authorTom Tsou <tom@tsou.cc>2015-01-08 11:53:23 -0800
committerMartin Braun <martin.braun@ettus.com>2015-01-12 10:54:09 +0100
commit2a54f8e291ded149268542a1fa23e870106d7e4b (patch)
treece42021686cb8fdf842baeaadc6129140a9f5bb3 /host/lib/convert
parent6460ac1c3c3bf82e16f70dadff5e01211832c3ed (diff)
downloaduhd-2a54f8e291ded149268542a1fa23e870106d7e4b.tar.gz
uhd-2a54f8e291ded149268542a1fa23e870106d7e4b.tar.bz2
uhd-2a54f8e291ded149268542a1fa23e870106d7e4b.zip
convert: Fix sc12 unpack shifting
Resolve issue #666 "B200: Rx signal distortion when using SC12". During 12-bit unpacking, OTW samples are shifted into the high order bits of the 16-bit intermediate values. The remaining 4-bits are not zeroed and contain bits from adjacent samples. Consequently, signal distortion becomes noticable with spurs and other random signal garbage when operating at low signal levels. Signed-off-by: Tom Tsou <tom@tsou.cc>
Diffstat (limited to 'host/lib/convert')
-rw-r--r--host/lib/convert/convert_unpack_sc12.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/host/lib/convert/convert_unpack_sc12.cpp b/host/lib/convert/convert_unpack_sc12.cpp
index a2aec2ae5..94b415355 100644
--- a/host/lib/convert/convert_unpack_sc12.cpp
+++ b/host/lib/convert/convert_unpack_sc12.cpp
@@ -62,17 +62,17 @@ void convert_sc12_item32_3_to_star_4
const boost::uint64_t line12 = (boost::uint64_t(line1) << 32) | line2;
//step 1: shift out and mask off the individual numbers
- const type i0 = type(boost::int16_t(line0 >> 16)*scalar);
- const type q0 = type(boost::int16_t(line0 >> 4)*scalar);
+ const type i0 = type(boost::int16_t((line0 >> 16) & 0xfff0)*scalar);
+ const type q0 = type(boost::int16_t((line0 >> 4) & 0xfff0)*scalar);
- const type i1 = type(boost::int16_t(line01 >> 24)*scalar);
- const type q1 = type(boost::int16_t(line1 >> 12)*scalar);
+ const type i1 = type(boost::int16_t((line01 >> 24) & 0xfff0)*scalar);
+ const type q1 = type(boost::int16_t((line1 >> 12) & 0xfff0)*scalar);
- const type i2 = type(boost::int16_t(line1 >> 0)*scalar);
- const type q2 = type(boost::int16_t(line12 >> 20)*scalar);
+ const type i2 = type(boost::int16_t((line1 >> 0) & 0xfff0)*scalar);
+ const type q2 = type(boost::int16_t((line12 >> 20) & 0xfff0)*scalar);
- const type i3 = type(boost::int16_t(line2 >> 8)*scalar);
- const type q3 = type(boost::int16_t(line2 << 4)*scalar);
+ const type i3 = type(boost::int16_t((line2 >> 8) & 0xfff0)*scalar);
+ const type q3 = type(boost::int16_t((line2 << 4) & 0xfff0)*scalar);
//step 2: load the outputs
out0 = std::complex<type>(i0, q0);