From 2e3e16ae3fafb6424bc935bc941f8c925a748dd7 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 8 Oct 2021 16:59:44 +0200 Subject: [PATCH] Cleanup some dependencies --- Makefile.common | 40 ++--- deps/fluidlite/libvorbis-1.3.5/lib/floor1.c | 25 --- deps/fluidlite/libvorbis-1.3.5/lib/res0.c | 188 +------------------- 3 files changed, 24 insertions(+), 229 deletions(-) diff --git a/Makefile.common b/Makefile.common index 3e18127..9cc071a 100644 --- a/Makefile.common +++ b/Makefile.common @@ -145,26 +145,26 @@ SOURCES_C += $(FLUIDSYNTH_DIR)/src/fluid_chan.c \ $(FLUIDSYNTH_DIR)/src/fluid_voice.c SOURCES_C += $(LIBVORBIS_DIR)/lib/analysis.c \ - $(LIBVORBIS_DIR)/lib/bitrate.c \ - $(LIBVORBIS_DIR)/lib/block.c \ - $(LIBVORBIS_DIR)/lib/codebook.c \ - $(LIBVORBIS_DIR)/lib/envelope.c \ - $(LIBVORBIS_DIR)/lib/floor0.c \ - $(LIBVORBIS_DIR)/lib/floor1.c \ - $(LIBVORBIS_DIR)/lib/info.c \ - $(LIBVORBIS_DIR)/lib/lookup.c \ - $(LIBVORBIS_DIR)/lib/lpc.c \ - $(LIBVORBIS_DIR)/lib/lsp.c \ - $(LIBVORBIS_DIR)/lib/mapping0.c \ - $(LIBVORBIS_DIR)/lib/mdct.c \ - $(LIBVORBIS_DIR)/lib/psy.c \ - $(LIBVORBIS_DIR)/lib/registry.c \ - $(LIBVORBIS_DIR)/lib/res0.c \ - $(LIBVORBIS_DIR)/lib/sharedbook.c \ - $(LIBVORBIS_DIR)/lib/smallft.c \ - $(LIBVORBIS_DIR)/lib/synthesis.c \ - $(LIBVORBIS_DIR)/lib/vorbisfile.c \ - $(LIBVORBIS_DIR)/lib/window.c + $(LIBVORBIS_DIR)/lib/bitrate.c \ + $(LIBVORBIS_DIR)/lib/block.c \ + $(LIBVORBIS_DIR)/lib/codebook.c \ + $(LIBVORBIS_DIR)/lib/envelope.c \ + $(LIBVORBIS_DIR)/lib/floor0.c \ + $(LIBVORBIS_DIR)/lib/floor1.c \ + $(LIBVORBIS_DIR)/lib/info.c \ + $(LIBVORBIS_DIR)/lib/lookup.c \ + $(LIBVORBIS_DIR)/lib/lpc.c \ + $(LIBVORBIS_DIR)/lib/lsp.c \ + $(LIBVORBIS_DIR)/lib/mapping0.c \ + $(LIBVORBIS_DIR)/lib/mdct.c \ + $(LIBVORBIS_DIR)/lib/psy.c \ + $(LIBVORBIS_DIR)/lib/registry.c \ + $(LIBVORBIS_DIR)/lib/res0.c \ + $(LIBVORBIS_DIR)/lib/sharedbook.c \ + $(LIBVORBIS_DIR)/lib/smallft.c \ + $(LIBVORBIS_DIR)/lib/synthesis.c \ + $(LIBVORBIS_DIR)/lib/vorbisfile.c \ + $(LIBVORBIS_DIR)/lib/window.c SOURCES_C += $(LIBOGG_DIR)/src/bitwise.c \ $(LIBOGG_DIR)/src/framing.c diff --git a/deps/fluidlite/libvorbis-1.3.5/lib/floor1.c b/deps/fluidlite/libvorbis-1.3.5/lib/floor1.c index d8bd464..088ccc2 100644 --- a/deps/fluidlite/libvorbis-1.3.5/lib/floor1.c +++ b/deps/fluidlite/libvorbis-1.3.5/lib/floor1.c @@ -881,17 +881,6 @@ int floor1_encode(oggpack_buffer *opb,vorbis_block *vb, look->phrasebits+= vorbis_book_encode(books+info->class_book[class],cval,opb); -#ifdef TRAIN_FLOOR1 - { - FILE *of; - char buffer[80]; - sprintf(buffer,"line_%dx%ld_class%d.vqd", - vb->pcmend/2,posts-2,class); - of=fopen(buffer,"a"); - fprintf(of,"%d\n",cval); - fclose(of); - } -#endif } /* write post values */ @@ -902,20 +891,6 @@ int floor1_encode(oggpack_buffer *opb,vorbis_block *vb, if(out[j+k]<(books+book)->entries) look->postbits+=vorbis_book_encode(books+book, out[j+k],opb); - /*else - fprintf(stderr,"+!");*/ - -#ifdef TRAIN_FLOOR1 - { - FILE *of; - char buffer[80]; - sprintf(buffer,"line_%dx%ld_%dsub%d.vqd", - vb->pcmend/2,posts-2,class,bookas[k]); - of=fopen(buffer,"a"); - fprintf(of,"%d\n",out[j+k]); - fclose(of); - } -#endif } } j+=cdim; diff --git a/deps/fluidlite/libvorbis-1.3.5/lib/res0.c b/deps/fluidlite/libvorbis-1.3.5/lib/res0.c index ec11488..022fc02 100644 --- a/deps/fluidlite/libvorbis-1.3.5/lib/res0.c +++ b/deps/fluidlite/libvorbis-1.3.5/lib/res0.c @@ -31,13 +31,6 @@ #include "misc.h" #include "os.h" -//#define TRAIN_RES 1 -//#define TRAIN_RESAUX 1 - -#if defined(TRAIN_RES) || defined (TRAIN_RESAUX) -#include -#endif - typedef struct { vorbis_info_residue0 *info; @@ -53,17 +46,6 @@ typedef struct { long postbits; long phrasebits; long frames; - -#if defined(TRAIN_RES) || defined(TRAIN_RESAUX) - int train_seq; - long *training_data[8][64]; - float training_max[8][64]; - float training_min[8][64]; - float tmin; - float tmax; - int submap; -#endif - } vorbis_look_residue0; void res0_free_info(vorbis_info_residue *i){ @@ -80,66 +62,6 @@ void res0_free_look(vorbis_look_residue *i){ vorbis_look_residue0 *look=(vorbis_look_residue0 *)i; -#ifdef TRAIN_RES - { - int j,k,l; - for(j=0;jparts;j++){ - /*fprintf(stderr,"partition %d: ",j);*/ - for(k=0;k<8;k++) - if(look->training_data[k][j]){ - char buffer[80]; - FILE *of; - codebook *statebook=look->partbooks[j][k]; - - /* long and short into the same bucket by current convention */ - sprintf(buffer,"res_sub%d_part%d_pass%d.vqd",look->submap,j,k); - of=fopen(buffer,"a"); - - for(l=0;lentries;l++) - fprintf(of,"%d:%ld\n",l,look->training_data[k][j][l]); - - fclose(of); - - /*fprintf(stderr,"%d(%.2f|%.2f) ",k, - look->training_min[k][j],look->training_max[k][j]);*/ - - _ogg_free(look->training_data[k][j]); - look->training_data[k][j]=NULL; - } - /*fprintf(stderr,"\n");*/ - } - } - fprintf(stderr,"min/max residue: %g::%g\n",look->tmin,look->tmax); - - /*fprintf(stderr,"residue bit usage %f:%f (%f total)\n", - (float)look->phrasebits/look->frames, - (float)look->postbits/look->frames, - (float)(look->postbits+look->phrasebits)/look->frames);*/ -#endif - - - /*vorbis_info_residue0 *info=look->info; - - fprintf(stderr, - "%ld frames encoded in %ld phrasebits and %ld residue bits " - "(%g/frame) \n",look->frames,look->phrasebits, - look->resbitsflat, - (look->phrasebits+look->resbitsflat)/(float)look->frames); - - for(j=0;jparts;j++){ - long acc=0; - fprintf(stderr,"\t[%d] == ",j); - for(k=0;kstages;k++) - if((info->secondstages[j]>>k)&1){ - fprintf(stderr,"%ld,",look->resbits[j][k]); - acc+=look->resbits[j][k]; - } - - fprintf(stderr,":: (%ld vals) %1.2fbits/sample\n",look->resvals[j], - acc?(float)acc/(look->resvals[j]*info->grouping):0); - } - fprintf(stderr,"\n");*/ - for(j=0;jparts;j++) if(look->partbooks[j])_ogg_free(look->partbooks[j]); _ogg_free(look->partbooks); @@ -282,10 +204,6 @@ vorbis_look_residue *res0_look(vorbis_dsp_state *vd, for(k=0;ksecondstages[j]&(1<partbooks[j][k]=ci->fullbooks+info->booklist[acc++]; -#ifdef TRAIN_RES - look->training_data[k][j]=_ogg_calloc(look->partbooks[j][k]->entries, - sizeof(***look->training_data)); -#endif } } } @@ -307,12 +225,6 @@ vorbis_look_residue *res0_look(vorbis_dsp_state *vd, look->decodemap[j][k]=deco; } } -#if defined(TRAIN_RES) || defined (TRAIN_RESAUX) - { - static int train_seq=0; - look->train_seq=train_seq++; - } -#endif return(look); } @@ -381,13 +293,8 @@ static int local_book_besterror(codebook *book,int *a){ return(index); } -#ifdef TRAIN_RES -static int _encodepart(oggpack_buffer *opb,int *vec, int n, - codebook *book,long *acc){ -#else static int _encodepart(oggpack_buffer *opb,int *vec, int n, codebook *book){ -#endif int i,bits=0; int dim=book->dim; int step=n/dim; @@ -395,11 +302,6 @@ static int _encodepart(oggpack_buffer *opb,int *vec, int n, for(i=0;i=0) - acc[entry]++; -#endif - bits+=vorbis_book_encode(book,entry,opb); } @@ -451,21 +353,6 @@ static long **_01class(vorbis_block *vb,vorbis_look_residue *vl, } } -#ifdef TRAIN_RESAUX - { - FILE *of; - char buffer[80]; - - for(i=0;itrain_seq); - of=fopen(buffer,"a"); - for(j=0;jframes++; return(partword); @@ -488,11 +375,6 @@ static long **_2class(vorbis_block *vb,vorbis_look_residue *vl,int **in, int partvals=n/samples_per_partition; long **partword=_vorbis_block_alloc(vb,sizeof(*partword)); -#if defined(TRAIN_RES) || defined (TRAIN_RESAUX) - FILE *of; - char buffer[80]; -#endif - partword[0]=_vorbis_block_alloc(vb,partvals*sizeof(*partword[0])); memset(partword[0],0,partvals*sizeof(*partword[0])); @@ -515,15 +397,6 @@ static long **_2class(vorbis_block *vb,vorbis_look_residue *vl,int **in, } -#ifdef TRAIN_RESAUX - sprintf(buffer,"resaux_%d.vqd",look->train_seq); - of=fopen(buffer,"a"); - for(i=0;iframes++; return(partword); @@ -533,22 +406,13 @@ static int _01forward(oggpack_buffer *opb, vorbis_look_residue *vl, int **in,int ch, long **partword, -#ifdef TRAIN_RES - int (*encode)(oggpack_buffer *,int *,int, - codebook *,long *), - int submap -#else int (*encode)(oggpack_buffer *,int *,int, codebook *) -#endif ){ long i,j,k,s; vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl; vorbis_info_residue0 *info=look->info; -#ifdef TRAIN_RES - look->submap=submap; -#endif /* move all this setup out later */ int samples_per_partition=info->grouping; @@ -560,14 +424,6 @@ static int _01forward(oggpack_buffer *opb, long resbits[128]; long resvals[128]; -#ifdef TRAIN_RES - for(i=0;ibegin;jend;j++){ - if(in[i][j]>look->tmax)look->tmax=in[i][j]; - if(in[i][j]tmin)look->tmin=in[i][j]; - } -#endif - memset(resbits,0,sizeof(resbits)); memset(resvals,0,sizeof(resvals)); @@ -593,11 +449,6 @@ static int _01forward(oggpack_buffer *opb, /* training hack */ if(valphrasebook->entries) look->phrasebits+=vorbis_book_encode(look->phrasebook,val,opb); -#if 0 /*def TRAIN_RES*/ - else - fprintf(stderr,"!"); -#endif - } } @@ -611,25 +462,8 @@ static int _01forward(oggpack_buffer *opb, codebook *statebook=look->partbooks[partword[j][i]][s]; if(statebook){ int ret; -#ifdef TRAIN_RES - long *accumulator=NULL; - accumulator=look->training_data[s][partword[j][i]]; - { - int l; - int *samples=in[j]+offset; - for(l=0;ltraining_min[s][partword[j][i]]) - look->training_min[s][partword[j][i]]=samples[l]; - if(samples[l]>look->training_max[s][partword[j][i]]) - look->training_max[s][partword[j][i]]=samples[l]; - } - } - ret=encode(opb,in[j]+offset,samples_per_partition, - statebook,accumulator); -#else ret=encode(opb,in[j]+offset,samples_per_partition, statebook); -#endif look->postbits+=ret; resbits[partword[j][i]]+=ret; @@ -724,16 +558,9 @@ int res1_forward(oggpack_buffer *opb,vorbis_block *vb,vorbis_look_residue *vl, if(nonzero[i]) in[used++]=in[i]; - if(used){ -#ifdef TRAIN_RES - return _01forward(opb,vl,in,used,partword,_encodepart,submap); -#else - (void)submap; + if(used) return _01forward(opb,vl,in,used,partword,_encodepart); -#endif - }else{ - return(0); - } + return(0); } long **res1_class(vorbis_block *vb,vorbis_look_residue *vl, @@ -790,16 +617,9 @@ int res2_forward(oggpack_buffer *opb, work[k]=pcm[j]; } - if(used){ -#ifdef TRAIN_RES - return _01forward(opb,vl,&work,1,partword,_encodepart,submap); -#else - (void)submap; + if(used) return _01forward(opb,vl,&work,1,partword,_encodepart); -#endif - }else{ - return(0); - } + return(0); } /* duplicate code here as speed is somewhat more important */