From 9f993843e52b1da877fd579de499e492f602ce81 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 28 Aug 2013 17:07:07 -0700 Subject: convert: sc8 swap for vita compliance --- host/lib/convert/convert_common.hpp | 38 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'host/lib/convert/convert_common.hpp') diff --git a/host/lib/convert/convert_common.hpp b/host/lib/convert/convert_common.hpp index 933978a8f..ceaa1151c 100644 --- a/host/lib/convert/convert_common.hpp +++ b/host/lib/convert/convert_common.hpp @@ -1,5 +1,5 @@ // -// Copyright 2011-2012 Ettus Research LLC +// Copyright 2011-2013 Ettus Research LLC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -150,10 +150,10 @@ UHD_INLINE void item32_sc16_to_xx( template UHD_INLINE item32_t xx_to_item32_sc8_x1( const std::complex &in0, const std::complex &in1, const double scale_factor ){ - boost::uint8_t real0 = boost::int8_t(in0.real()*float(scale_factor)); - boost::uint8_t imag0 = boost::int8_t(in0.imag()*float(scale_factor)); - boost::uint8_t real1 = boost::int8_t(in1.real()*float(scale_factor)); - boost::uint8_t imag1 = boost::int8_t(in1.imag()*float(scale_factor)); + boost::uint8_t real1 = boost::int8_t(in0.real()*float(scale_factor)); + boost::uint8_t imag1 = boost::int8_t(in0.imag()*float(scale_factor)); + boost::uint8_t real0 = boost::int8_t(in1.real()*float(scale_factor)); + boost::uint8_t imag0 = boost::int8_t(in1.imag()*float(scale_factor)); return (item32_t(real0) << 8) | (item32_t(imag0) << 0) | (item32_t(real1) << 24) | (item32_t(imag1) << 16) @@ -163,10 +163,10 @@ template UHD_INLINE item32_t xx_to_item32_sc8_x1( template <> UHD_INLINE item32_t xx_to_item32_sc8_x1( const sc16_t &in0, const sc16_t &in1, const double ){ - boost::uint8_t real0 = boost::int8_t(in0.real()); - boost::uint8_t imag0 = boost::int8_t(in0.imag()); - boost::uint8_t real1 = boost::int8_t(in1.real()); - boost::uint8_t imag1 = boost::int8_t(in1.imag()); + boost::uint8_t real1 = boost::int8_t(in0.real()); + boost::uint8_t imag1 = boost::int8_t(in0.imag()); + boost::uint8_t real0 = boost::int8_t(in1.real()); + boost::uint8_t imag0 = boost::int8_t(in1.imag()); return (item32_t(real0) << 8) | (item32_t(imag0) << 0) | (item32_t(real1) << 24) | (item32_t(imag1) << 16) @@ -176,10 +176,10 @@ template <> UHD_INLINE item32_t xx_to_item32_sc8_x1( template <> UHD_INLINE item32_t xx_to_item32_sc8_x1( const sc8_t &in0, const sc8_t &in1, const double ){ - boost::uint8_t real0 = boost::int8_t(in0.real()); - boost::uint8_t imag0 = boost::int8_t(in0.imag()); - boost::uint8_t real1 = boost::int8_t(in1.real()); - boost::uint8_t imag1 = boost::int8_t(in1.imag()); + boost::uint8_t real1 = boost::int8_t(in0.real()); + boost::uint8_t imag1 = boost::int8_t(in0.imag()); + boost::uint8_t real0 = boost::int8_t(in1.real()); + boost::uint8_t imag0 = boost::int8_t(in1.imag()); return (item32_t(real0) << 8) | (item32_t(imag0) << 0) | (item32_t(real1) << 24) | (item32_t(imag1) << 16) @@ -211,11 +211,11 @@ UHD_INLINE void xx_to_item32_sc8( template UHD_INLINE void item32_sc8_x1_to_xx( const item32_t item, std::complex &out0, std::complex &out1, const double scale_factor ){ - out0 = std::complex( + out1 = std::complex( T(boost::int8_t(item >> 8)*float(scale_factor)), T(boost::int8_t(item >> 0)*float(scale_factor)) ); - out1 = std::complex( + out0 = std::complex( T(boost::int8_t(item >> 24)*float(scale_factor)), T(boost::int8_t(item >> 16)*float(scale_factor)) ); @@ -224,11 +224,11 @@ template UHD_INLINE void item32_sc8_x1_to_xx( template <> UHD_INLINE void item32_sc8_x1_to_xx( const item32_t item, sc16_t &out0, sc16_t &out1, const double ){ - out0 = sc16_t( + out1 = sc16_t( boost::int16_t(boost::int8_t(item >> 8)), boost::int16_t(boost::int8_t(item >> 0)) ); - out1 = sc16_t( + out0 = sc16_t( boost::int16_t(boost::int8_t(item >> 24)), boost::int16_t(boost::int8_t(item >> 16)) ); @@ -237,11 +237,11 @@ template <> UHD_INLINE void item32_sc8_x1_to_xx( template <> UHD_INLINE void item32_sc8_x1_to_xx( const item32_t item, sc8_t &out0, sc8_t &out1, const double ){ - out0 = sc8_t( + out1 = sc8_t( boost::int8_t(boost::int8_t(item >> 8)), boost::int8_t(boost::int8_t(item >> 0)) ); - out1 = sc8_t( + out0 = sc8_t( boost::int8_t(boost::int8_t(item >> 24)), boost::int8_t(boost::int8_t(item >> 16)) ); -- cgit v1.2.3