aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/convert/convert_with_neon.cpp
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2014-10-07 11:32:14 +0200
committerMartin Braun <martin.braun@ettus.com>2014-10-07 12:09:33 +0200
commit1b149f561370687ad65e3aa644a402f00dbd16ea (patch)
treeab86042840fa1369d64bca56c5f3a64d1a4f1f72 /host/lib/convert/convert_with_neon.cpp
parentfd3e84941de463fa1a7ebab0a69515b4bf2614cd (diff)
downloaduhd-1b149f561370687ad65e3aa644a402f00dbd16ea.tar.gz
uhd-1b149f561370687ad65e3aa644a402f00dbd16ea.tar.bz2
uhd-1b149f561370687ad65e3aa644a402f00dbd16ea.zip
Initial commit E300 support.
Diffstat (limited to 'host/lib/convert/convert_with_neon.cpp')
-rw-r--r--host/lib/convert/convert_with_neon.cpp36
1 files changed, 35 insertions, 1 deletions
diff --git a/host/lib/convert/convert_with_neon.cpp b/host/lib/convert/convert_with_neon.cpp
index e994d97a6..f1c7773ec 100644
--- a/host/lib/convert/convert_with_neon.cpp
+++ b/host/lib/convert/convert_with_neon.cpp
@@ -1,5 +1,5 @@
//
-// Copyright 2011-2012 Ettus Research LLC
+// Copyright 2011-2014 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
@@ -19,6 +19,12 @@
#include <uhd/utils/byteswap.hpp>
#include <arm_neon.h>
+extern "C" {
+void neon_item32_sc16_swap_16n(void *, void *, int iter);
+}
+
+static const int SIMD_WIDTH = 16;
+
using namespace uhd::convert;
DECLARE_CONVERTER(fc32, 1, sc16_item32_le, 1, PRIORITY_SIMD){
@@ -58,3 +64,31 @@ DECLARE_CONVERTER(sc16_item32_le, 1, fc32, 1, PRIORITY_SIMD){
item32_sc16_to_xx<uhd::htowx>(input+i, output+i, nsamps-i, scale_factor);
}
+
+DECLARE_CONVERTER(sc16, 1, sc16_item32_le, 1, PRIORITY_SIMD){
+ const sc16_t *input = reinterpret_cast<const sc16_t *>(inputs[0]);
+ item32_t *output = reinterpret_cast<item32_t *>(outputs[0]);
+
+ size_t i = nsamps / SIMD_WIDTH;
+
+ if (i)
+ neon_item32_sc16_swap_16n((void *) input, (void *) output, i);
+
+ i *= SIMD_WIDTH;
+
+ xx_to_item32_sc16<uhd::htowx>(input+i, output+i, nsamps-i, scale_factor);
+}
+
+DECLARE_CONVERTER(sc16_item32_le, 1, sc16, 1, PRIORITY_SIMD){
+ const item32_t *input = reinterpret_cast<const item32_t *>(inputs[0]);
+ sc16_t *output = reinterpret_cast<sc16_t *>(outputs[0]);
+
+ size_t i = nsamps / SIMD_WIDTH;
+
+ if (i)
+ neon_item32_sc16_swap_16n((void *) input, (void *) output, i);
+
+ i *= SIMD_WIDTH;
+
+ item32_sc16_to_xx<uhd::wtohx>(input+i, output+i, nsamps-i, scale_factor);
+}