summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Foster <nick@ettus.com>2011-05-23 22:36:51 -0700
committerJosh Blum <josh@joshknows.com>2011-06-14 17:27:46 -0700
commit00ee732c00fa74054117ef703afa1bf30bf53f50 (patch)
treeb4fe2de2754aa309065055f7e9a9a3d074925366
parent3dca19a3e7f56c64423789ee025f16150b1a2cdb (diff)
downloaduhd-00ee732c00fa74054117ef703afa1bf30bf53f50.tar.gz
uhd-00ee732c00fa74054117ef703afa1bf30bf53f50.tar.bz2
uhd-00ee732c00fa74054117ef703afa1bf30bf53f50.zip
UHD: added item32<->sc16 conversions in Orc
-rw-r--r--host/include/uhd/convert.hpp2
-rw-r--r--host/lib/convert/convert_orc.orc39
-rw-r--r--host/lib/convert/convert_with_orc.cpp20
3 files changed, 58 insertions, 3 deletions
diff --git a/host/include/uhd/convert.hpp b/host/include/uhd/convert.hpp
index c30484384..99f1860ae 100644
--- a/host/include/uhd/convert.hpp
+++ b/host/include/uhd/convert.hpp
@@ -40,7 +40,7 @@ namespace uhd{ namespace convert{
*/
enum priority_type{
PRIORITY_GENERAL = 0,
- PRIORITY_LIBORC = 4,
+ PRIORITY_LIBORC = 1,
PRIORITY_CUSTOM = 2,
PRIORITY_EMPTY = -1,
};
diff --git a/host/lib/convert/convert_orc.orc b/host/lib/convert/convert_orc.orc
index 83e63f22c..78718d229 100644
--- a/host/lib/convert/convert_orc.orc
+++ b/host/lib/convert/convert_orc.orc
@@ -5,7 +5,6 @@
.temp 8 scaled
.temp 8 converted
.temp 4 short
-
x2 mulf scaled, src, scalar
x2 convfl converted, scaled
x2 convlw short, converted
@@ -19,8 +18,44 @@ x2 swapw dst, short
.temp 8 scaled
.temp 8 converted
.temp 4 short
-
x2 mulf scaled, src, scalar
x2 convfl converted, scaled
x2 convlw short, converted
x2 swapw dst, short
+
+.function _convert_item32_1_to_fc32_1_nswap_orc
+.source 4 src
+.dest 8 dst
+.floatparam 4 scalar
+.temp 4 tmp1
+.temp 8 tmp2
+x2 swapw tmp1, src
+swapl tmp1, tmp1
+x2 convswl tmp2, tmp1
+x2 convlf tmp2, tmp2
+x2 mulf dst, tmp2, scalar
+
+.function _convert_item32_1_to_fc32_1_bswap_orc
+.source 4 src
+.dest 8 dst
+.floatparam 4 scalar
+.temp 4 tmp1
+.temp 8 tmp2
+x2 swapw tmp1, src
+x2 convswl tmp2, tmp1
+x2 convlf tmp2, tmp2
+x2 mulf dst, tmp2, scalar
+
+.function _convert_sc16_1_to_item32_1_nswap_orc
+.source 4 src
+.dest 4 dst
+.floatparam 4 scalar
+swapl dst, src
+x2 swapw dst, dst
+
+.function _convert_item32_1_to_sc16_1_nswap_orc
+.source 4 src
+.dest 4 dst
+.floatparam 4 scalar
+x2 swapw dst, src
+swapl dst, dst
diff --git a/host/lib/convert/convert_with_orc.cpp b/host/lib/convert/convert_with_orc.cpp
index 2d50351e4..6f2f47784 100644
--- a/host/lib/convert/convert_with_orc.cpp
+++ b/host/lib/convert/convert_with_orc.cpp
@@ -24,6 +24,10 @@ using namespace uhd::convert;
extern "C" {
extern void _convert_fc32_1_to_item32_1_nswap_orc(void *, const void *, float, int);
extern void _convert_fc32_1_to_item32_1_bswap_orc(void *, const void *, float, int);
+extern void _convert_item32_1_to_fc32_1_nswap_orc(void *, const void *, float, int);
+extern void _convert_item32_1_to_fc32_1_bswap_orc(void *, const void *, float, int);
+extern void _convert_sc16_1_to_item32_1_nswap_orc(void *, const void *, float, int);
+extern void _convert_item32_1_to_sc16_1_nswap_orc(void *, const void *, float, int);
}
DECLARE_CONVERTER(convert_fc32_1_to_item32_1_nswap, PRIORITY_LIBORC){
@@ -33,3 +37,19 @@ DECLARE_CONVERTER(convert_fc32_1_to_item32_1_nswap, PRIORITY_LIBORC){
DECLARE_CONVERTER(convert_fc32_1_to_item32_1_bswap, PRIORITY_LIBORC){
_convert_fc32_1_to_item32_1_bswap_orc(outputs[0], inputs[0], scale_factor, nsamps);
}
+
+DECLARE_CONVERTER(convert_item32_1_to_fc32_1_nswap, PRIORITY_LIBORC){
+ _convert_item32_1_to_fc32_1_nswap_orc(outputs[0], inputs[0], scale_factor, nsamps);
+}
+
+DECLARE_CONVERTER(convert_item32_1_to_fc32_1_bswap, PRIORITY_LIBORC){
+ _convert_item32_1_to_fc32_1_bswap_orc(outputs[0], inputs[0], scale_factor, nsamps);
+}
+
+DECLARE_CONVERTER(convert_sc16_1_to_item32_1_nswap, PRIORITY_LIBORC){
+ _convert_sc16_1_to_item32_1_nswap_orc(outputs[0], inputs[0], scale_factor, nsamps);
+}
+
+DECLARE_CONVERTER(convert_item32_1_to_sc16_1_nswap, PRIORITY_LIBORC){
+ _convert_item32_1_to_sc16_1_nswap_orc(outputs[0], inputs[0], scale_factor, nsamps);
+}