diff options
-rw-r--r-- | gnuradio-core/src/lib/io/gri_wavfile.cc | 46 | ||||
-rw-r--r-- | gr-audio/lib/osx/audio_osx.h | 3 | ||||
-rw-r--r-- | volk/include/volk/volk_32fc_x2_dot_prod_32fc_a.h | 2 |
3 files changed, 32 insertions, 19 deletions
diff --git a/gnuradio-core/src/lib/io/gri_wavfile.cc b/gnuradio-core/src/lib/io/gri_wavfile.cc index 780bd1b98..277e6b7b0 100644 --- a/gnuradio-core/src/lib/io/gri_wavfile.cc +++ b/gnuradio-core/src/lib/io/gri_wavfile.cc @@ -27,33 +27,45 @@ #include <gri_wavfile.h> #include <cstring> #include <stdint.h> -#include <boost/asio.hpp> +#include <boost/detail/endian.hpp> //BOOST_BIG_ENDIAN # define VALID_COMPRESSION_TYPE 0x0001 -// WAV files are always little-endian, so we need some byte switching macros - // Basically, this is the opposite of htonx() and ntohx() -#ifdef WORDS_BIGENDIAN +// Define host to/from worknet (little endian) short and long +#ifdef BOOST_BIG_ENDIAN + + static inline uint16_t __gri_wav_bs16(uint16_t x) + { + return (x>>8) | (x<<8); + } -static inline uint32_t host_to_wav(uint32_t x) { return htonl(x); } -static inline uint16_t host_to_wav(uint16_t x) { return htons(x); } -static inline int16_t host_to_wav(int16_t x) { return htons(x); } -static inline uint32_t wav_to_host(uint32_t x) { return ntohl(x); } -static inline uint16_t wav_to_host(uint16_t x) { return ntohs(x); } -static inline int16_t wav_to_host(int16_t x) { return ntohs(x); } + static inline uint32_t __gri_wav_bs32(uint32_t x) + { + return (uint32_t(__gri_wav_bs16(uint16_t(x&0xfffful)))<<16) | (__gri_wav_bs16(uint16_t(x>>16))); + } + + #define htowl(x) __gri_wav_bs32(x) + #define wtohl(x) __gri_wav_bs32(x) + #define htows(x) __gri_wav_bs16(x) + #define wtohs(x) __gri_wav_bs16(x) #else -static inline uint32_t host_to_wav(uint32_t x) { return x; } -static inline uint16_t host_to_wav(uint16_t x) { return x; } -static inline int16_t host_to_wav(int16_t x) { return x; } -static inline uint32_t wav_to_host(uint32_t x) { return x; } -static inline uint16_t wav_to_host(uint16_t x) { return x; } -static inline int16_t wav_to_host(int16_t x) { return x; } + #define htowl(x) uint32_t(x) + #define wtohl(x) uint32_t(x) + #define htows(x) uint16_t(x) + #define wtohs(x) uint16_t(x) -#endif // WORDS_BIGENDIAN +#endif // BOOST_BIG_ENDIAN +// WAV files are always little-endian, so we need some byte switching macros +static inline uint32_t host_to_wav(uint32_t x) { return htowl(x); } +static inline uint16_t host_to_wav(uint16_t x) { return htows(x); } +static inline int16_t host_to_wav(int16_t x) { return htows(x); } +static inline uint32_t wav_to_host(uint32_t x) { return wtohl(x); } +static inline uint16_t wav_to_host(uint16_t x) { return wtohs(x); } +static inline int16_t wav_to_host(int16_t x) { return wtohs(x); } bool gri_wavheader_parse(FILE *fp, diff --git a/gr-audio/lib/osx/audio_osx.h b/gr-audio/lib/osx/audio_osx.h index 0a98b71ef..8c9543d0d 100644 --- a/gr-audio/lib/osx/audio_osx.h +++ b/gr-audio/lib/osx/audio_osx.h @@ -51,7 +51,8 @@ fflush (stderr); \ } -#ifdef WORDS_BIGENDIAN +#include <boost/detail/endian.hpp> //BOOST_BIG_ENDIAN +#ifdef BOOST_BIG_ENDIAN #define GR_PCM_ENDIANNESS kLinearPCMFormatFlagIsBigEndian #else #define GR_PCM_ENDIANNESS 0 diff --git a/volk/include/volk/volk_32fc_x2_dot_prod_32fc_a.h b/volk/include/volk/volk_32fc_x2_dot_prod_32fc_a.h index 166a883a7..caef3e6f0 100644 --- a/volk/include/volk/volk_32fc_x2_dot_prod_32fc_a.h +++ b/volk/include/volk/volk_32fc_x2_dot_prod_32fc_a.h @@ -420,7 +420,7 @@ static inline void volk_32fc_x2_dot_prod_32fc_a_sse4_1(lv_32fc_t* result, const } - real1 = _mm_xor_ps(real1, (__m128)neg); + real1 = _mm_xor_ps(real1, bit128_p(&neg)->float_vec); im0 = _mm_add_ps(im0, im1); real0 = _mm_add_ps(real0, real1); |