aboutsummaryrefslogtreecommitdiffstats
path: root/peakval_sse2.c
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-01-02 21:55:13 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-01-02 21:55:13 +0100
commita31630e0d5b9880c716d9004ef4154396ba41ebc (patch)
treeaebbd3b132e5f2dd31bc34750ccded2378fc687a /peakval_sse2.c
parent9aaac5be9db5e1537badc65242412ef14c5096e3 (diff)
downloadka9q-fec-a31630e0d5b9880c716d9004ef4154396ba41ebc.tar.gz
ka9q-fec-a31630e0d5b9880c716d9004ef4154396ba41ebc.tar.bz2
ka9q-fec-a31630e0d5b9880c716d9004ef4154396ba41ebc.zip
Extract fec-3.0.1
Diffstat (limited to 'peakval_sse2.c')
-rw-r--r--peakval_sse2.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/peakval_sse2.c b/peakval_sse2.c
new file mode 100644
index 0000000..79d9059
--- /dev/null
+++ b/peakval_sse2.c
@@ -0,0 +1,34 @@
+/* Portable C version of peakval
+ * Copyright 2004 Phil Karn, KA9Q
+ */
+#include <stdlib.h>
+#include "fec.h"
+
+int peakval_sse2_assist(signed short *,int);
+
+int peakval_sse2(signed short *b,int cnt){
+ int peak = 0;
+ int a;
+
+ while(((int)b & 15) != 0 && cnt != 0){
+ a = abs(*b);
+ if(a > peak)
+ peak = a;
+ b++;
+ cnt--;
+ }
+ a = peakval_sse2_assist(b,cnt);
+ if(a > peak)
+ peak = a;
+ b += cnt & ~7;
+ cnt &= 7;
+
+ while(cnt != 0){
+ a = abs(*b);
+ if(a > peak)
+ peak = a;
+ b++;
+ cnt--;
+ }
+ return peak;
+}