summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJun Zhao <jun.zhao@intel.com>2017-12-18 09:16:52 +0800
committerMichael Niedermayer <michael@niedermayer.cc>2017-12-19 21:32:04 +0100
commite72b8549920feae3366c4d3030afd1ccb80da48e (patch)
treee8ee38fb2f525b4ac8d75ec25adf14fac13cc4e3 /tests
parent2b38900cb377c56d855807012d931c7c40d215ed (diff)
tests/audiomatch: Whitespace refinement
Refine the coding style. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'tests')
-rw-r--r--tests/audiomatch.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/tests/audiomatch.c b/tests/audiomatch.c
index e63e494add..c17227859a 100644
--- a/tests/audiomatch.c
+++ b/tests/audiomatch.c
@@ -25,23 +25,23 @@
#define FFMIN(a,b) ((a) > (b) ? (b) : (a))
#define FFMAX(a,b) ((a) > (b) ? (a) : (b))
-static int64_t fsize(FILE *f){
- int64_t end, pos= ftell(f);
+static int64_t fsize(FILE *f) {
+ int64_t end, pos = ftell(f);
fseek(f, 0, SEEK_END);
end = ftell(f);
fseek(f, pos, SEEK_SET);
return end;
}
-int main(int argc, char **argv){
+int main(int argc, char **argv) {
FILE *f[2];
int i, pos;
int siglen, datlen;
int bestpos = 0;
- double bestc=0;
- double sigamp= 0;
+ double bestc = 0;
+ double sigamp = 0;
int16_t *signal, *data;
- int maxshift= 16384;
+ int maxshift = 16384;
if (argc < 3) {
printf("audiomatch <testfile> <reffile>\n");
@@ -87,24 +87,24 @@ int main(int argc, char **argv){
datlen /= 2;
siglen /= 2;
- for(i=0; i<siglen; i++){
+ for (i = 0; i < siglen; i++) {
signal[i] = ((uint8_t*)(signal + i))[0] + 256*((uint8_t*)(signal + i))[1];
sigamp += signal[i] * signal[i];
}
- for(i=0; i<datlen; i++)
+ for (i = 0; i < datlen; i++)
data[i] = ((uint8_t*)(data + i))[0] + 256*((uint8_t*)(data + i))[1];
- for(pos = 0; pos<maxshift; pos = pos < 0 ? -pos: -pos-1){
- int64_t c= 0;
+ for (pos = 0; pos < maxshift; pos = pos < 0 ? -pos: -pos-1) {
+ int64_t c = 0;
int testlen = FFMIN(siglen, datlen-pos);
- for(i=FFMAX(0, -pos); i<testlen; i++){
- int j= pos+i;
+ for (i = FFMAX(0, -pos); i < testlen; i++) {
+ int j = pos + i;
c += signal[i] * data[j];
}
- if(fabs(c) > sigamp * 0.94)
+ if (fabs(c) > sigamp * 0.94)
maxshift = FFMIN(maxshift, fabs(pos)+32);
- if(fabs(c)>fabs(bestc)){
- bestc= c;
+ if (fabs(c) > fabs(bestc)) {
+ bestc = c;
bestpos = pos;
}
}