diff options
| author | Josh Blum <josh@joshknows.com> | 2012-01-30 22:23:38 -0800 | 
|---|---|---|
| committer | Josh Blum <josh@joshknows.com> | 2012-01-31 14:56:31 -0800 | 
| commit | d46c176af34b728fd43b3dd46485b38623a7335e (patch) | |
| tree | 4c93a5dc27c6c5213c858f6c4312d1195a44e32d /host/lib/convert/convert_common.hpp | |
| parent | 781cafa8717f00b883a4543b4a9150060691eee3 (diff) | |
| download | uhd-d46c176af34b728fd43b3dd46485b38623a7335e.tar.gz uhd-d46c176af34b728fd43b3dd46485b38623a7335e.tar.bz2 uhd-d46c176af34b728fd43b3dd46485b38623a7335e.zip | |
dsp rework: tx trailer, scaling work (peak)
Diffstat (limited to 'host/lib/convert/convert_common.hpp')
| -rw-r--r-- | host/lib/convert/convert_common.hpp | 48 | 
1 files changed, 48 insertions, 0 deletions
| diff --git a/host/lib/convert/convert_common.hpp b/host/lib/convert/convert_common.hpp index 699d6301b..aab59de4b 100644 --- a/host/lib/convert/convert_common.hpp +++ b/host/lib/convert/convert_common.hpp @@ -190,4 +190,52 @@ static UHD_INLINE void item32_sc8_to_fc64(item32_t item, fc64_t &out0, fc64_t &o      );  } +/*********************************************************************** + * Convert complex char to items32 sc8 buffer + **********************************************************************/ +static UHD_INLINE item32_t sc8_to_item32_sc8(sc8_t in0, sc8_t in1, double){ +    return +        (item32_t(boost::uint8_t(in0.real())) << 8) | +        (item32_t(boost::uint8_t(in0.imag())) << 0) | +        (item32_t(boost::uint8_t(in1.real())) << 24) | +        (item32_t(boost::uint8_t(in1.imag())) << 16) +    ; +} + +/*********************************************************************** + * Convert complex short to items32 sc8 buffer + **********************************************************************/ +static UHD_INLINE item32_t sc16_to_item32_sc8(sc16_t in0, sc16_t in1, double){ +    return +        (item32_t(boost::uint8_t(in0.real())) << 8) | +        (item32_t(boost::uint8_t(in0.imag())) << 0) | +        (item32_t(boost::uint8_t(in1.real())) << 24) | +        (item32_t(boost::uint8_t(in1.imag())) << 16) +    ; +} + +/*********************************************************************** + * Convert complex float to items32 sc8 buffer + **********************************************************************/ +static UHD_INLINE item32_t fc32_to_item32_sc8(fc32_t in0, fc32_t in1, double scale_factor){ +    return +        (item32_t(boost::uint8_t(in0.real()*float(scale_factor))) << 8) | +        (item32_t(boost::uint8_t(in0.imag()*float(scale_factor))) << 0) | +        (item32_t(boost::uint8_t(in1.real()*float(scale_factor))) << 24) | +        (item32_t(boost::uint8_t(in1.imag()*float(scale_factor))) << 16) +    ; +} + +/*********************************************************************** + * Convert complex double to items32 sc8 buffer + **********************************************************************/ +static UHD_INLINE item32_t fc64_to_item32_sc8(fc64_t in0, fc64_t in1, double scale_factor){ +    return +        (item32_t(boost::uint8_t(in0.real()*(scale_factor))) << 8) | +        (item32_t(boost::uint8_t(in0.imag()*(scale_factor))) << 0) | +        (item32_t(boost::uint8_t(in1.real()*(scale_factor))) << 24) | +        (item32_t(boost::uint8_t(in1.imag()*(scale_factor))) << 16) +    ; +} +  #endif /* INCLUDED_LIBUHD_CONVERT_COMMON_HPP */ | 
