* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
* by the Xiph.Org Foundation http://www.xiph.org/ *
* *
********************************************************************
info->ampbits=oggpack_read(opb,6);
info->ampdB=oggpack_read(opb,8);
info->numbooks=oggpack_read(opb,4)+1;
-
+
if(info->order<1)goto err_out;
if(info->rate<1)goto err_out;
if(info->barkmap<1)goto err_out;
if(info->numbooks<1)goto err_out;
-
+
for(j=0;j<info->numbooks;j++){
info->books[j]=oggpack_read(opb,8);
if(info->books[j]<0 || info->books[j]>=ci->books)goto err_out;
+ if(ci->book_param[info->books[j]]->maptype==0)goto err_out;
+ if(ci->book_param[info->books[j]]->dim<1)goto err_out;
}
return(info);
floor(bark(rate/2-1)*C)=mapped-1
floor(bark(rate/2)*C)=mapped */
float scale=look->ln/toBARK(info->rate/2.f);
-
+
/* the mapping from a linear scale to a smaller bark scale is
straightforward. We do *not* make sure that the linear mapping
does not skip bark-scale bins; the decoder simply skips them and
accurate */
look->linearmap[W]=_ogg_malloc((n+1)*sizeof(**look->linearmap));
for(j=0;j<n;j++){
- int val=floor( toBARK((info->rate/2.f)/n*j)
+ int val=floor( toBARK((info->rate/2.f)/n*j)
*scale); /* bark numbers represent band edges */
if(val>=look->ln)val=look->ln-1; /* guard against the approximation */
look->linearmap[W][j]=val;
long maxval=(1<<info->ampbits)-1;
float amp=(float)ampraw/maxval*info->ampdB;
int booknum=oggpack_read(&vb->opb,_ilog(info->numbooks));
-
+
if(booknum!=-1 && booknum<info->numbooks){ /* be paranoid */
codec_setup_info *ci=vb->vd->vi->codec_setup;
codebook *b=ci->fullbooks+info->books[booknum];
smash; b->dim is provably more than we can overflow the
vector */
float *lsp=_vorbis_block_alloc(vb,sizeof(*lsp)*(look->m+b->dim+1));
-
- for(j=0;j<look->m;j+=b->dim)
- if(vorbis_book_decodev_set(b,lsp+j,&vb->opb,b->dim)==-1)goto eop;
+
+ if(vorbis_book_decodev_set(b,lsp,&vb->opb,look->m)==-1)goto eop;
for(j=0;j<look->m;){
- for(k=0;k<b->dim;k++,j++)lsp[j]+=last;
+ for(k=0;j<look->m && k<b->dim;k++,j++)lsp[j]+=last;
last=lsp[j-1];
}
-
+
lsp[look->m]=amp;
return(lsp);
}
void *memo,float *out){
vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
vorbis_info_floor0 *info=look->vi;
-
+
floor0_map_lazy_init(vb,info,look);
if(memo){
NULL,&floor0_unpack,&floor0_look,&floor0_free_info,
&floor0_free_look,&floor0_inverse1,&floor0_inverse2
};
-
-
-