void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi){
codec_setup_info *ci=vi->codec_setup;
vorbis_info_psy_global *gi=&ci->psy_g_param; int ch=vi->channels; int i,j; int n=e->winlength=128;
e->searchstep=64; /* not random */
/* stretch is used to gradually lengthen the number of windows
considered prevoius-to-potential-trigger */ int stretch=max(VE_MINSTRETCH,ve->stretch/2); float penalty=gi->stretch_penalty-(ve->stretch/2-VE_MINSTRETCH); if(penalty<0.f)penalty=0.f; if(penalty>gi->stretch_penalty)penalty=gi->stretch_penalty;
/* near-DC spreading function; this has nothing to do with
psychoacoustics, just sidelobe leakage and window size */
{ float temp=vec[0]*vec[0]+.7*vec[1]*vec[1]+.2*vec[2]*vec[2]; int ptr=filters->nearptr;
/* the accumulation is regularly refreshed from scratch to avoid
floating point creep */ if(ptr==0){
decay=filters->nearDC_acc=filters->nearDC_partialacc+temp;
filters->nearDC_partialacc=temp;
}else{
decay=filters->nearDC_acc+=temp;
filters->nearDC_partialacc+=temp;
}
filters->nearDC_acc-=filters->nearDC[ptr];
filters->nearDC[ptr]=temp;
long _ve_envelope_search(vorbis_dsp_state *v){
vorbis_info *vi=v->vi;
codec_setup_info *ci=vi->codec_setup;
vorbis_info_psy_global *gi=&ci->psy_g_param;
envelope_lookup *ve=((private_state *)(v->backend_state))->ve; long i,j;
int first=ve->current/ve->searchstep; int last=v->pcm_current/ve->searchstep-VE_WIN; if(first<0)first=0;
/* make sure we have enough storage to match the PCM */ if(last+VE_WIN+VE_POST>ve->storage){
ve->storage=last+VE_WIN+VE_POST; /* be sure */
ve->mark=_ogg_realloc(ve->mark,ve->storage*sizeof(*ve->mark));
}
int _ve_envelope_mark(vorbis_dsp_state *v){
envelope_lookup *ve=((private_state *)(v->backend_state))->ve;
vorbis_info *vi=v->vi;
codec_setup_info *ci=vi->codec_setup; long centerW=v->centerW; long beginW=centerW-ci->blocksizes[v->W]/4; long endW=centerW+ci->blocksizes[v->W]/4; if(v->W){
beginW-=ci->blocksizes[v->lW]/4;
endW+=ci->blocksizes[v->nW]/4;
}else{
beginW-=ci->blocksizes[0]/4;
endW+=ci->blocksizes[0]/4;
}
if(ve->curmark>=beginW && ve->curmark<endW)return(1);
{ long first=beginW/ve->searchstep; long last=endW/ve->searchstep; long i; for(i=first;i<last;i++) if(ve->mark[i])return(1);
} return(0);
}
void _ve_envelope_shift(envelope_lookup *e,long shift){ int smallsize=e->current/e->searchstep+VE_POST; /* adjust for placing marks
ahead of ve->current */ int smallshift=shift/e->searchstep;
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.