22 #include "../ogg/ogg.h"
23 #include "../vorbis/codec.h"
84 memset(e,0,
sizeof(*e));
106 float *vec=alloca(n*
sizeof(*vec));
112 if(penalty<0.
f)penalty=0.f;
128 float temp=vec[0]*vec[0]+.7*vec[1]*vec[1]+.2*vec[2]*vec[2];
141 filters->
nearDC[ptr]=temp;
146 decay=todB(&decay)*.5-15.f;
153 float val=vec[
i]*vec[
i]+vec[i+1]*vec[i+1];
155 if(val<decay)val=decay;
156 if(val<minV)val=minV;
169 for(i=0;i<bands[
j].
end;i++)
170 acc+=vec[i+bands[j].begin]*bands[j].
window[i];
177 float postmax,postmin,premax=-99999.f,premin=99999.f;
182 postmax=
max(acc,filters[j].ampbuf[p]);
183 postmin=
min(acc,filters[j].ampbuf[p]);
185 for(i=0;i<stretch;i++){
188 premax=
max(premax,filters[j].ampbuf[p]);
189 premin=
min(premin,filters[j].ampbuf[p]);
192 valmin=postmin-premin;
193 valmax=postmax-premax;
206 if(valmin<gi->postecho_thresh[j]-penalty)ret|=2;
234 for(j=first;j<last;j++){
241 for(i=0;i<ve->
ch;i++){
243 ret|=_ve_amp(ve,gi,pcm,ve->
band,ve->
filter+i*VE_BANDS,j);
254 if(j>0)ve->
mark[j-1]=1;
274 if(j>=testW)
return(1);
283 float *marker=alloca(v->
pcm_current*
sizeof(*marker));
286 fprintf(stderr,
"mark! seq=%d, cursor:%fs time:%fs\n",
288 (totalshift+ve->
cursor)/44100.,
289 (totalshift+j)/44100.);
306 for(l=0;l<last;l++)marker[l*ve->
searchstep]=ve->
filter[m+VE_BANDS].markers[l]*.1;
320 if(j>=testW)
return(1);
351 for(i=first;i<last;i++)
352 if(ve->
mark[i])
return(1);
362 memmove(e->
mark,e->
mark+smallshift,(smallsize-smallshift)*
sizeof(*e->
mark));
365 for(i=0;i<VE_BANDS*e->
ch;i++)
366 memmove(e->
filter[i].markers,
367 e->
filter[i].markers+smallshift,
368 (1024-smallshift)*
sizeof(*(*e->
filter).markers));
void _ve_envelope_shift(envelope_lookup *e, long shift)
void mdct_init(mdct_lookup *lookup, int n)
void mdct_forward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out)
void _analysis_output_always(char *base, int i, float *v, int n, int bark, int dB, ogg_int64_t off)
int _ve_envelope_mark(vorbis_dsp_state *v)
void _ve_envelope_clear(envelope_lookup *e)
void _ve_envelope_init(envelope_lookup *e, vorbis_info *vi)
vorbis_info_psy_global psy_g_param
envelope_filter_state * filter
GLsizei GLsizei GLenum GLenum const GLvoid * data
float preecho_thresh[VE_BANDS]
envelope_band band[VE_BANDS]
void mdct_clear(mdct_lookup *l)
long _ve_envelope_search(vorbis_dsp_state *v)
int sprintf(idStr &string, const char *fmt,...)