From 7a1bd6135ad7201f4a23ee71d929ae15de26a103 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 13 Nov 2011 17:11:15 -0800 Subject: uhd: fixed sc8 table conversion, and simplified shifts --- host/lib/convert/convert_with_tables.cpp | 34 ++++++++++++++------------------ 1 file changed, 15 insertions(+), 19 deletions(-) (limited to 'host/lib') diff --git a/host/lib/convert/convert_with_tables.cpp b/host/lib/convert/convert_with_tables.cpp index ac12b4440..bcb7ec2c7 100644 --- a/host/lib/convert/convert_with_tables.cpp +++ b/host/lib/convert/convert_with_tables.cpp @@ -29,7 +29,7 @@ typedef boost::uint16_t (*tohost16_type)(boost::uint16_t); * Implementation for sc16 lookup table * - Lookup the real and imaginary parts individually **********************************************************************/ -template +template class convert_sc16_item32_1_to_fcxx_1 : public converter{ public: convert_sc16_item32_1_to_fcxx_1(void): _table(sc16_table_len){} @@ -48,8 +48,8 @@ public: for (size_t i = 0; i < nsamps; i++){ const item32_t item = input[i]; output[i] = std::complex( - _table[boost::uint16_t(item >> lo_shift)], - _table[boost::uint16_t(item >> hi_shift)] + _table[boost::uint16_t(item >> re_shift)], + _table[boost::uint16_t(item >> im_shift)] ); } } @@ -108,47 +108,43 @@ private: **********************************************************************/ #ifdef BOOST_BIG_ENDIAN -# define BE_LO_SHIFT 16 -# define BE_HI_SHIFT 0 -# define LE_LO_SHIFT 0 -# define LE_HI_SHIFT 16 +# define SHIFT_PAIR0 16, 0 +# define SHIFT_PAIR1 0, 16 #else -# define BE_LO_SHIFT 0 -# define BE_HI_SHIFT 16 -# define LE_LO_SHIFT 16 -# define LE_HI_SHIFT 0 +# define SHIFT_PAIR0 0, 16 +# define SHIFT_PAIR1 16, 0 #endif static converter::sptr make_convert_sc16_item32_be_1_to_fc32_1(void){ - return converter::sptr(new convert_sc16_item32_1_to_fcxx_1()); + return converter::sptr(new convert_sc16_item32_1_to_fcxx_1()); } static converter::sptr make_convert_sc16_item32_be_1_to_fc64_1(void){ - return converter::sptr(new convert_sc16_item32_1_to_fcxx_1()); + return converter::sptr(new convert_sc16_item32_1_to_fcxx_1()); } static converter::sptr make_convert_sc16_item32_le_1_to_fc32_1(void){ - return converter::sptr(new convert_sc16_item32_1_to_fcxx_1()); + return converter::sptr(new convert_sc16_item32_1_to_fcxx_1()); } static converter::sptr make_convert_sc16_item32_le_1_to_fc64_1(void){ - return converter::sptr(new convert_sc16_item32_1_to_fcxx_1()); + return converter::sptr(new convert_sc16_item32_1_to_fcxx_1()); } static converter::sptr make_convert_sc8_item32_be_1_to_fc32_1(void){ - return converter::sptr(new convert_sc8_item32_1_to_fcxx_1()); + return converter::sptr(new convert_sc8_item32_1_to_fcxx_1()); } static converter::sptr make_convert_sc8_item32_be_1_to_fc64_1(void){ - return converter::sptr(new convert_sc8_item32_1_to_fcxx_1()); + return converter::sptr(new convert_sc8_item32_1_to_fcxx_1()); } static converter::sptr make_convert_sc8_item32_le_1_to_fc32_1(void){ - return converter::sptr(new convert_sc8_item32_1_to_fcxx_1()); + return converter::sptr(new convert_sc8_item32_1_to_fcxx_1()); } static converter::sptr make_convert_sc8_item32_le_1_to_fc64_1(void){ - return converter::sptr(new convert_sc8_item32_1_to_fcxx_1()); + return converter::sptr(new convert_sc8_item32_1_to_fcxx_1()); } UHD_STATIC_BLOCK(register_convert_sc16_item32_1_to_fcxx_1){ -- cgit v1.2.3