Commit e72b8549 authored by Jun Zhao's avatar Jun Zhao Committed by Michael Niedermayer

tests/audiomatch: Whitespace refinement

Refine the coding style.
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 2b38900c
......@@ -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;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment