From: Monty Date: Mon, 13 Aug 2001 11:33:40 +0000 (+0000) Subject: final round of commits X-Git-Tag: v1.3.3~943 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5cf867f4695f4955c145546b8256eccf6736307e;p=platform%2Fupstream%2Flibvorbis.git final round of commits svn path=/trunk/vorbis/; revision=1879 --- diff --git a/examples/encoder_example.c b/examples/encoder_example.c index d252c1a..8ed6d09 100644 --- a/examples/encoder_example.c +++ b/examples/encoder_example.c @@ -11,7 +11,7 @@ ******************************************************************** function: simple example encoder - last mod: $Id: encoder_example.c,v 1.21 2001/02/26 03:50:38 xiphmont Exp $ + last mod: $Id: encoder_example.c,v 1.22 2001/08/13 11:33:39 xiphmont Exp $ ********************************************************************/ @@ -36,7 +36,7 @@ #endif #define READ 1024 -signed char readbuffer[READ*4+44]; /* out of the data segment, not the stack */ +signed char readbuffer[READ*2+44]; /* out of the data segment, not the stack */ int main(){ ogg_stream_state os; /* take physical pages, weld into a logical @@ -79,7 +79,7 @@ int main(){ /* choose an encoding mode */ /* (mode 0: 44kHz stereo uncoupled, roughly 128kbps VBR) */ vorbis_info_init(&vi); - vorbis_encode_init(&vi,2,44100, -1, 128000, -1); + vorbis_encode_init(&vi,1,44100, -1, 999000, -1); /* add a comment */ vorbis_comment_init(&vc); @@ -128,7 +128,7 @@ int main(){ while(!eos){ long i; - long bytes=fread(readbuffer,1,READ*4,stdin); /* stereo hardwired here */ + long bytes=fread(readbuffer,1,READ*2,stdin); /* stereo hardwired here */ if(bytes==0){ /* end of file. this can be done implicitly in the mainline, @@ -144,13 +144,11 @@ int main(){ float **buffer=vorbis_analysis_buffer(&vd,READ); /* uninterleave samples */ - for(i=0;idim>8){ @@ -376,6 +376,7 @@ long vorbis_book_decodev_add(codebook *book,float *a,oggpack_buffer *b,int n){ entry = vorbis_book_decode(book,b); if(entry==-1)return(-1); t = book->valuelist+entry*book->dim; + j=0; switch(book->dim){ case 8: a[i++]+=t[j++]; diff --git a/lib/floor1.c b/lib/floor1.c index 3387829..33f0937 100644 --- a/lib/floor1.c +++ b/lib/floor1.c @@ -11,7 +11,7 @@ ******************************************************************** function: floor backend 1 implementation - last mod: $Id: floor1.c,v 1.11 2001/08/13 01:36:56 xiphmont Exp $ + last mod: $Id: floor1.c,v 1.12 2001/08/13 11:33:39 xiphmont Exp $ ********************************************************************/ @@ -940,7 +940,7 @@ static int floor1_forward(vorbis_block *vb,vorbis_look_floor *in, { FILE *of; char buffer[80]; - sprintf(buffer,"line_%dx%d_class%d.vqd", + sprintf(buffer,"line_%ldx%ld_class%d.vqd", vb->pcmend/2,posts-2,class); of=fopen(buffer,"a"); fprintf(of,"%d\n",cval); @@ -964,7 +964,7 @@ static int floor1_forward(vorbis_block *vb,vorbis_look_floor *in, { FILE *of; char buffer[80]; - sprintf(buffer,"line_%dx%d_%dsub%d.vqd", + sprintf(buffer,"line_%ldx%ld_%dsub%d.vqd", vb->pcmend/2,posts-2,class,bookas[k]); of=fopen(buffer,"a"); fprintf(of,"%d\n",fit_valueB[j+k]); diff --git a/lib/mapping0.c b/lib/mapping0.c index bfbe66a..58c6a69 100644 --- a/lib/mapping0.c +++ b/lib/mapping0.c @@ -11,7 +11,7 @@ ******************************************************************** function: channel mapping 0 implementation - last mod: $Id: mapping0.c,v 1.34 2001/08/13 01:36:57 xiphmont Exp $ + last mod: $Id: mapping0.c,v 1.35 2001/08/13 11:33:39 xiphmont Exp $ ********************************************************************/ @@ -412,11 +412,11 @@ static int mapping0_forward(vorbis_block *vb,vorbis_look_mapping *l){ res, local_ampmax[i]); - for(j=0;j1200){ analysis_noisy=1; - /*fprintf(stderr,"%ld ",seq+i);*/ - } + fprintf(stderr,"%ld ",seq+i); + }*/ _analysis_output("res",seq+i,res,n/2,1,0); _analysis_output("codedflr",seq+i,codedflr,n/2,1,1); @@ -475,13 +475,25 @@ static int mapping0_forward(vorbis_block *vb,vorbis_look_mapping *l){ zerobundle[0]=alloca(sizeof(int)*vi->channels); /* initial down-quantized coupling */ - _vp_quantize_couple(look->psy_look[blocktype], - info, - pcm, - sofar, - quantized, - nonzero, - 0); + + if(info->coupling_steps==0){ + /* this assumes all or nothing coupling right now. it should pass + through any channels left uncoupled, but it doesn't do that now */ + for(i=0;ichannels;i++){ + float *lpcm=pcm[i]; + float *lqua=quantized[i]; + for(j=0;jpsy_look[blocktype], + info, + pcm, + sofar, + quantized, + nonzero, + 0); + } for(i=0;ichannels;i++) _analysis_output("quant",seq+i,quantized[i],n/2,1,0); @@ -533,13 +545,25 @@ static int mapping0_forward(vorbis_block *vb,vorbis_look_mapping *l){ if(!stopflag){ /* down-couple/down-quantize from perfect-'so-far' -> new quantized vector */ - _vp_quantize_couple(look->psy_look[blocktype], - info, - pcm, - sofar, - quantized, - nonzero, - i); + if(info->coupling_steps==0){ + /* this assumes all or nothing coupling right now. it should pass + through any channels left uncoupled, but it doesn't do that now */ + for(i=0;ichannels;i++){ + float *lpcm=pcm[i]; + float *lsof=sofar[i]; + float *lqua=quantized[i]; + for(j=0;jpsy_look[blocktype], + info, + pcm, + sofar, + quantized, + nonzero, + i); + } } /* steady as she goes */ } diff --git a/lib/res0.c b/lib/res0.c index 4d6cf80..d2b29a6 100644 --- a/lib/res0.c +++ b/lib/res0.c @@ -11,7 +11,7 @@ ******************************************************************** function: residue backend 0, 1 and 2 implementation - last mod: $Id: res0.c,v 1.34 2001/08/13 10:01:04 xiphmont Exp $ + last mod: $Id: res0.c,v 1.35 2001/08/13 11:33:39 xiphmont Exp $ ********************************************************************/ @@ -71,10 +71,10 @@ void res0_free_look(vorbis_look_residue *i){ vorbis_look_residue0 *look=(vorbis_look_residue0 *)i; - fprintf(stderr,"residue bit usage %f:%f (%f total)\n", + /*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); + (float)(look->postbits+look->phrasebits)/look->frames);*/ /*vorbis_info_residue0 *info=look->info; @@ -531,8 +531,8 @@ static int _01forward(vorbis_block *vb,vorbis_look_residue *vl, /* training hack */ if(valphrasebook->entries) ret=vorbis_book_encode(look->phrasebook,val,&vb->opb); - else - fprintf(stderr,"!"); + /*else + fprintf(stderr,"!");*/ look->phrasebits+=ret; @@ -559,7 +559,7 @@ static int _01forward(vorbis_block *vb,vorbis_look_residue *vl, } } - { + /*{ long total=0; long totalbits=0; fprintf(stderr,"%d :: ",vb->mode); @@ -570,7 +570,7 @@ static int _01forward(vorbis_block *vb,vorbis_look_residue *vl, } fprintf(stderr,":: %ld:%1.2g\n",total,(double)totalbits/total); - } + }*/ return(0); } @@ -641,7 +641,8 @@ long **res0_class(vorbis_block *vb,vorbis_look_residue *vl, if(nonzero[i]) in[used++]=in[i]; if(used) - return(_01class(vb,vl,in,used,_interleaved_testhack)); + /*return(_01class(vb,vl,in,used,_interleaved_testhack));*/ + return(_01class(vb,vl,in,used,_testhack)); else return(0); } diff --git a/lib/vorbisenc.c b/lib/vorbisenc.c index 27402ce..d5477bc 100644 --- a/lib/vorbisenc.c +++ b/lib/vorbisenc.c @@ -11,7 +11,7 @@ ******************************************************************** function: simple programmatic interface for encoder mode setup - last mod: $Id: vorbisenc.c,v 1.11 2001/08/13 08:39:30 xiphmont Exp $ + last mod: $Id: vorbisenc.c,v 1.12 2001/08/13 11:33:40 xiphmont Exp $ ********************************************************************/ @@ -158,27 +158,21 @@ int vorbis_encode_init(vorbis_info *vi, break; default: -#if 0 - if(bpch<60000){ - /* mode AA */ - mode=&info_AA; - }else if(bpch<75000){ - /* mode A */ - mode=&info_A; + + if(bpch<40000){ + mode=&info_44_Z; + }else if(bpch<50000){ + mode=&info_44_Y; + }else if(bpch<70000){ + mode=&info_44_X; }else if(bpch<90000){ - /* mode B */ - mode=&info_B; - }else if(bpch<110000){ - /* mode C */ - mode=&info_C; - }else if(bpch<160000){ - /* mode D */ - mode=&info_D; + mode=&info_44_A; + }else if(bpch<120000){ + mode=&info_44_B; }else{ - /* mode E */ - mode=&info_E; + mode=&info_44_C; } -#endif + break; } /* now we have to deepcopy */