Revision 20c18678 host/lib/convert/convert_common.hpp
| b/host/lib/convert/convert_common.hpp | ||
|---|---|---|
| 86 | 86 |
/*********************************************************************** |
| 87 | 87 |
* Convert complex float buffer to items32 (no swap) |
| 88 | 88 |
**********************************************************************/ |
| 89 |
static UHD_INLINE item32_t fc32_to_item32(fc32_t num, float scale_factor){
|
|
| 90 |
boost::uint16_t real = boost::int16_t(num.real()*scale_factor);
|
|
| 91 |
boost::uint16_t imag = boost::int16_t(num.imag()*scale_factor);
|
|
| 89 |
static UHD_INLINE item32_t fc32_to_item32(fc32_t num, double scale_factor){
|
|
| 90 |
boost::uint16_t real = boost::int16_t(num.real()*float(scale_factor));
|
|
| 91 |
boost::uint16_t imag = boost::int16_t(num.imag()*float(scale_factor));
|
|
| 92 | 92 |
return (item32_t(real) << 16) | (item32_t(imag) << 0); |
| 93 | 93 |
} |
| 94 | 94 |
|
| 95 | 95 |
/*********************************************************************** |
| 96 | 96 |
* Convert items32 buffer to complex float |
| 97 | 97 |
**********************************************************************/ |
| 98 |
static UHD_INLINE fc32_t item32_to_fc32(item32_t item, float scale_factor){
|
|
| 98 |
static UHD_INLINE fc32_t item32_to_fc32(item32_t item, double scale_factor){
|
|
| 99 | 99 |
return fc32_t( |
| 100 |
float(boost::int16_t(item >> 16)*scale_factor),
|
|
| 101 |
float(boost::int16_t(item >> 0)*scale_factor)
|
|
| 100 |
float(boost::int16_t(item >> 16)*float(scale_factor)),
|
|
| 101 |
float(boost::int16_t(item >> 0)*float(scale_factor))
|
|
| 102 | 102 |
); |
| 103 | 103 |
} |
| 104 | 104 |
|
Also available in: Unified diff