/* initialize Bark scale and normalization lookups. We could do this withstatictables,butVorbisallowsanumberofpossible combinations,soit'sbesttodoitcomputationally.
Thebelowisauthoritativeintermsofdefiningscalemapping. Notethatthescaledependsonthesamplingrateaswellasthe
linear block and mapping sizes */
/* we choose a scaling constant so that: 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.Wedo*not*makesurethatthelinearmapping doesnotskipbark-scalebins;thedecodersimplyskipsthemand theencodermaydowhatitwishesinfillingthem.They're necessaryinsomemappingcombinationstokeepthescalespacing
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)
*scale); /* bark numbers represent band edges */ if(val>=look->ln)val=look->ln-1; /* guard against the approximation */
look->linearmap[W][j]=val;
}
look->linearmap[W][j]=-1;
look->n[W]=n;
}
}
int ampraw=oggpack_read(&vb->opb,info->ampbits); if(ampraw>0){ /* also handles the -1 out of data case */ long maxval=(1<<info->ampbits)-1; float amp=(float)ampraw/maxval*info->ampdB; int booknum=oggpack_read(&vb->opb,ov_ilog(info->numbooks));
/* the additional b->dim is a guard against any possible stack smash;b->dimisprovablymorethanwecanoverflowthe
vector */ float *lsp=_vorbis_block_alloc(vb,sizeof(*lsp)*(look->m+b->dim+1));
/* take the coefficients back to a spectral envelope curve */
vorbis_lsp_to_curve(out,
look->linearmap[vb->W],
look->n[vb->W],
look->ln,
lsp,look->m,amp,(float)info->ampdB); return(1);
}
memset(out,0,sizeof(*out)*look->n[vb->W]); return(0);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.