You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
540 B
36 lines
540 B
4 months ago
|
/* IA-32 SSE version of peakval
|
||
|
* Copyright 2004 Phil Karn, KA9Q
|
||
|
*/
|
||
|
|
||
|
#include <stdlib.h>
|
||
|
#include "fec.h"
|
||
|
|
||
|
int peakval_sse_assist(signed short *,int);
|
||
|
|
||
|
int peakval_sse(signed short *b,int cnt){
|
||
|
int peak = 0;
|
||
|
int a;
|
||
|
|
||
|
while(((int)b & 7) != 0 && cnt != 0){
|
||
|
a = abs(*b);
|
||
|
if(a > peak)
|
||
|
peak = a;
|
||
|
b++;
|
||
|
cnt--;
|
||
|
}
|
||
|
a = peakval_sse_assist(b,cnt);
|
||
|
if(a > peak)
|
||
|
peak = a;
|
||
|
b += cnt & ~3;
|
||
|
cnt &= 3;
|
||
|
|
||
|
while(cnt != 0){
|
||
|
a = abs(*b);
|
||
|
if(a > peak)
|
||
|
peak = a;
|
||
|
b++;
|
||
|
cnt--;
|
||
|
}
|
||
|
return peak;
|
||
|
}
|