aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/convert/convert_item32.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2012-04-27 17:23:18 -0700
committerJosh Blum <josh@joshknows.com>2012-05-09 23:54:03 -0700
commit4c244c78a75646ad4040fb328fa64bb752852512 (patch)
tree1261591e9c7cc112fcce73da697a236f1934127e /host/lib/convert/convert_item32.cpp
parent58bebf5511dffde44fb0e2a14edb3778e54aaf2b (diff)
downloaduhd-4c244c78a75646ad4040fb328fa64bb752852512.tar.gz
uhd-4c244c78a75646ad4040fb328fa64bb752852512.tar.bz2
uhd-4c244c78a75646ad4040fb328fa64bb752852512.zip
convert: squashed converter and sse2 work
Diffstat (limited to 'host/lib/convert/convert_item32.cpp')
-rw-r--r--host/lib/convert/convert_item32.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/host/lib/convert/convert_item32.cpp b/host/lib/convert/convert_item32.cpp
new file mode 100644
index 000000000..bcac74714
--- /dev/null
+++ b/host/lib/convert/convert_item32.cpp
@@ -0,0 +1,43 @@
+//
+// Copyright 2012 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
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+
+#include "convert_common.hpp"
+#include <uhd/utils/byteswap.hpp>
+
+#define __DECLARE_ITEM32_CONVERTER(cpu_type, wire_type, xe, htoxx, xxtoh) \
+ DECLARE_CONVERTER(cpu_type, 1, wire_type ## _item32_ ## xe, 1, PRIORITY_GENERAL){ \
+ const cpu_type ## _t *input = reinterpret_cast<const cpu_type ## _t *>(inputs[0]); \
+ item32_t *output = reinterpret_cast<item32_t *>(outputs[0]); \
+ xx_to_item32_ ## wire_type<htoxx>(input, output, nsamps, scale_factor); \
+ } \
+ DECLARE_CONVERTER(wire_type ## _item32_ ## xe, 1, cpu_type, 1, PRIORITY_GENERAL){ \
+ const item32_t *input = reinterpret_cast<const item32_t *>(inputs[0]); \
+ cpu_type ## _t *output = reinterpret_cast<cpu_type ## _t *>(outputs[0]); \
+ item32_ ## wire_type ## _to_xx<xxtoh>(input, output, nsamps, scale_factor); \
+ }
+
+#define _DECLARE_ITEM32_CONVERTER(cpu_type, wire_type) \
+ __DECLARE_ITEM32_CONVERTER(cpu_type, wire_type, be, uhd::htonx, uhd::ntohx) \
+ __DECLARE_ITEM32_CONVERTER(cpu_type, wire_type, le, uhd::htowx, uhd::wtohx)
+
+#define DECLARE_ITEM32_CONVERTER(cpu_type) \
+ _DECLARE_ITEM32_CONVERTER(cpu_type, sc8) \
+ _DECLARE_ITEM32_CONVERTER(cpu_type, sc16)
+
+DECLARE_ITEM32_CONVERTER(sc16)
+DECLARE_ITEM32_CONVERTER(fc32)
+DECLARE_ITEM32_CONVERTER(fc64)