Skip to content

Commit 9bae4aa

Browse files
committed
qext_compare: add -skip argument
1 parent e2e0e3b commit 9bae4aa

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/qext_compare.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ int main(int _argc,const char **_argv){
220220
size_t test_win_step;
221221
int max_compare;
222222
int format;
223+
int skip=0;
223224
double rms=-1;
224225
const char *argv0 = _argv[0];
225226
double err4_threshold=-1, err16_threshold=-1, rms_threshold=-1;
@@ -258,6 +259,10 @@ int main(int _argc,const char **_argv){
258259
format=FORMAT_F32_LE;
259260
_argv++;
260261
_argc--;
262+
} else if(strcmp(_argv[1],"-skip")==0){
263+
skip=atoi(_argv[2]);
264+
_argv+=2;
265+
_argc-=2;
261266
} else if(strcmp(_argv[1],"-thresholds")==0){
262267
if (_argc < 7) {
263268
usage(argv0);
@@ -326,6 +331,10 @@ int main(int _argc,const char **_argv){
326331
fclose(fin1);
327332
ylength=read_pcm(&y,fin2,nchannels,format);
328333
fclose(fin2);
334+
skip *= nchannels;
335+
y += skip/downsample;
336+
ylength -= skip/downsample;
337+
if (skip && ylength*downsample > xlength) ylength = xlength/downsample;
329338
if(xlength!=ylength*downsample){
330339
fprintf(stderr,"Sample counts do not match (%lu!=%lu).\n",
331340
(unsigned long)xlength,(unsigned long)ylength*downsample);
@@ -356,7 +365,7 @@ int main(int _argc,const char **_argv){
356365
free(x);
357366
band_energy(NULL,Y,BANDS,ybands,y,nchannels,nframes,
358367
test_win_size/downsample,test_win_step/downsample,downsample);
359-
free(y);
368+
free(y-skip/downsample);
360369
for(xi=0;xi<nframes;xi++){
361370
float maxE[2]={0};
362371
for(bi=0;bi<nbands;bi++){

0 commit comments

Comments
 (0)