********************************************************************
function: PCM data envelope analysis
- last mod: $Id: envelope.c,v 1.46 2002/03/29 08:18:23 xiphmont Exp $
+ last mod: $Id: envelope.c,v 1.47 2002/03/30 01:56:58 xiphmont Exp $
********************************************************************/
}
/* magic follows */
- e->band[0].begin=4; e->band[0].end=8;
- e->band[1].begin=8; e->band[1].end=10;
- e->band[2].begin=14; e->band[2].end=12;
- e->band[3].begin=20; e->band[3].end=16;
- e->band[4].begin=28; e->band[4].end=20;
- e->band[5].begin=40; e->band[5].end=20;
+ e->band[0].begin=2; e->band[0].end=4;
+ e->band[1].begin=4; e->band[1].end=8;
+ e->band[2].begin=6; e->band[2].end=10;
+ e->band[3].begin=12; e->band[3].end=12;
+ e->band[4].begin=18; e->band[4].end=16;
+ e->band[5].begin=26; e->band[5].end=20;
+ e->band[6].begin=36; e->band[6].end=24;
for(j=0;j<VE_BANDS;j++){
n=e->band[j].end;
memset(e,0,sizeof(*e));
}
-extern void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB,ogg_int64_t off);
-
/* fairly straight threshhold-by-band based until we find something
that works better and isn't patented. */
vec[i]=data[i]*ve->mdct_win[i];
mdct_forward(&ve->mdct,vec,vec);
- /* _analysis_output_always("mdct",seq2,vec,n/2,0,1,0); */
+ /*_analysis_output_always("mdct",seq2,vec,n/2,0,1,0); */
/* near-DC spreading function; this has nothing to do with
psychoacoustics, just sidelobe leakage and window size */
decay-=8.;
}
- /* _analysis_output_always("spread",seq2++,vec,n/4,0,0,0);*/
+ /*_analysis_output_always("spread",seq2++,vec,n/4,0,0,0);*/
/* perform preecho/postecho triggering by band */
for(j=0;j<VE_BANDS;j++){
valmin=postmin-premin;
valmax=postmax-premax;
+ filters[j].markers[pos]=valmax;
+
filters[j].ampbuf[this]=acc;
filters[j].ampptr++;
if(filters[j].ampptr>=VE_AMP)filters[j].ampptr=0;
}
/* look at min/max, decide trigger */
- if(valmax>gi->preecho_thresh[j]+penalty)ret|=1;
+ if(valmax>gi->preecho_thresh[j]+penalty){
+ ret|=1;
+ ret|=4;
+ }
if(valmin<gi->postecho_thresh[j]-penalty)ret|=2;
}
-
- if(ret&1)ve->stretch=-1;
return(ret);
}
ve->mark[j]=1;
if(j>0)ve->mark[j-1]=1;
}
+
+ if(ret&4)ve->stretch=-1;
}
ve->current=last*ve->searchstep;
_analysis_output_always(buf,seq,marker,v->pcm_current,0,0,totalshift);
}
- for(l=0;l<last;l++)marker[l*ve->searchstep]=ve->stretchm[l]*.1;
- _analysis_output_always("stretch",seq,marker,v->pcm_current,0,0,totalshift);
-
seq++;
}
memmove(e->mark,e->mark+smallshift,(smallsize-smallshift)*sizeof(*e->mark));
- #if 0
+#if 0
for(i=0;i<VE_BANDS*e->ch;i++)
memmove(e->filter[i].markers,
e->filter[i].markers+smallshift,
(1024-smallshift)*sizeof(*(*e->filter).markers));
- memmove(e->stretchm,
- e->stretchm+smallshift,
- (1024-smallshift)*sizeof(*e->stretchm));
totalshift+=shift;
#endif
********************************************************************
function: key psychoacoustic settings for 44.1/48kHz
- last mod: $Id: psych_44.h,v 1.12 2002/03/29 07:10:40 xiphmont Exp $
+ last mod: $Id: psych_44.h,v 1.13 2002/03/30 01:56:59 xiphmont Exp $
********************************************************************/
static vorbis_info_psy_global _psy_global_44[5]={
{8, /* lines per eighth octave */
- {20.f,14.f,10.f,10.f,10.f,10.f},
- {-60.f,-30.f,-40.f,-40.f,-40.f,-40.f}, 4,-75.f,
+ {20.f,14.f,10.f,10.f,10.f,10.f,10.f},
+ {-60.f,-30.f,-40.f,-40.f,-40.f,-40.f,-40.f}, 4,-75.f,
-6.f, 0,
},
{8, /* lines per eighth octave */
- {16.f,12.f,8.f,8.f,8.f,8.f},
- {-40.f,-30.f,-25.f,-25.f,-25.f,-25.f}, 4,-80.f,
+ {14.f,10.f,8.f,8.f,8.f,8.f,8.f},
+ {-40.f,-30.f,-25.f,-25.f,-25.f,-25.f,-25.f}, 4,-80.f,
-6.f, 0,
},
{8, /* lines per eighth octave */
- {14.f,10.f,6.f,6.f,6.f,6.f},
- {-20.f,-20.f,-15.f,-15.f,-15.f,-15.f}, 4,-80.f,
+ {12.f,8.f,8.f,8.f,8.f,8.f,8.f},
+ {-20.f,-20.f,-15.f,-15.f,-15.f,-15.f,-15.f}, 4,-80.f,
-6.f, 0,
},
{8, /* lines per eighth octave */
- {14.f,8.f,6.f,6.f,6.f,6.f},
- {-20.f,-15.f,-12.f,-12.f,-12.f,-12.f}, 2,-80.f,
+ {10.f,8.f,6.f,6.f,6.f,6.f,6.f},
+ {-20.f,-15.f,-12.f,-12.f,-12.f,-12.f,-12.f}, 2,-80.f,
-6.f, 0,
},
{8, /* lines per eighth octave */
- {14.f,10.f,6.f,6.f,6.f,6.f},
- {-15.f,-15.f,-12.f,-12.f,-12.f,-12.f}, 2,-85.f,
+ {10.f,6.f,6.f,6.f,6.f,6.f,6.f},
+ {-15.f,-15.f,-12.f,-12.f,-12.f,-12.f,-12.f}, 2,-85.f,
-6.f, 0,
},
};