ref: abbb80c6226e0dcca8c3b3e96d2180c25385c569
parent: 4152b396023a0597ed0539e1afff701be2529bb1
author: Jean-Marc Valin <jeanmarcv@google.com>
date: Tue Jul 15 13:01:33 EDT 2025
Add skip option to dred_compare
--- a/dnn/dred_compare.c
+++ b/dnn/dred_compare.c
@@ -289,6 +289,7 @@
size_t test_win_step;
int max_compare;
int format;
+ int skip=0;
const char *argv0 = _argv[0];
double err4_threshold=-1, err16_threshold=-1, pitch_threshold=-1;
int compare_thresholds=0;
@@ -321,6 +322,10 @@
format=FORMAT_F32_LE;
_argv++;
_argc--;
+ } else if(strcmp(_argv[1],"-skip")==0){
+ skip=atoi(_argv[2]);
+ _argv+=2;
+ _argc-=2;
} else if(strcmp(_argv[1],"-thresholds")==0){
if (_argc < 7) {
usage(argv0);
@@ -359,6 +364,9 @@
fclose(fin1);
ylength=read_pcm(&y,fin2,nchannels,format);
fclose(fin2);
+ skip *= nchannels;
+ y += skip/downsample;
+ ylength -= skip/downsample;
if (ylength*downsample > xlength) ylength = xlength/downsample;
if(xlength!=ylength*downsample){
fprintf(stderr,"Sample counts do not match (%lu!=%lu).\n",
@@ -401,7 +409,7 @@
free(x);
spectrum(Y,BANDS,ybands,y,nchannels,nframes,
test_win_size/downsample,test_win_step/downsample,downsample);
- free(y);
+ free(y-skip/downsample);
norm[0]=1;
for(xj=1;xj<NFREQS;xj++){
--
⑨