From 36600ed5c72a45b99dbf1f878d233940301b53d3 Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 29 Mar 2002 08:18:23 +0000 Subject: [PATCH] Two segfault fixes to new envelope.c [correcting stupid logic mistakes] one fix to FABS() for VORBIS_IEEE_FLOAT32 svn path=/trunk/vorbis/; revision=3200 --- lib/envelope.c | 25 +++++++++++++++---------- lib/scales.h | 4 ++-- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/lib/envelope.c b/lib/envelope.c index 160cccc..424a82b 100644 --- a/lib/envelope.c +++ b/lib/envelope.c @@ -11,7 +11,7 @@ ******************************************************************** function: PCM data envelope analysis - last mod: $Id: envelope.c,v 1.45 2002/03/29 07:10:39 xiphmont Exp $ + last mod: $Id: envelope.c,v 1.46 2002/03/29 08:18:23 xiphmont Exp $ ********************************************************************/ @@ -245,7 +245,7 @@ long _ve_envelope_search(vorbis_dsp_state *v){ if(ret&2){ ve->mark[j]=1; - ve->mark[j-1]=1; + if(j>0)ve->mark[j-1]=1; } } @@ -264,10 +264,13 @@ long _ve_envelope_search(vorbis_dsp_state *v){ while(jcurrent-(ve->searchstep)){/* account for postecho working back one window */ if(j>=testW)return(1); + + ve->cursor=j; + if(ve->mark[j/ve->searchstep]){ if(j>centerW){ - #if 0 +#if 0 if(j>ve->curmark){ float *marker=alloca(v->pcm_current*sizeof(*marker)); int l,m; @@ -295,17 +298,16 @@ long _ve_envelope_search(vorbis_dsp_state *v){ for(l=0;lsearchstep]=ve->filter[m+VE_BANDS].markers[l]*.1; _analysis_output_always(buf,seq,marker,v->pcm_current,0,0,totalshift); } - + for(l=0;lsearchstep]=ve->stretchm[l]*.1; _analysis_output_always("stretch",seq,marker,v->pcm_current,0,0,totalshift); - + seq++; - + } - #endif +#endif ve->curmark=j; - ve->cursor=j; if(j>=testW)return(1); return(0); } @@ -313,8 +315,7 @@ long _ve_envelope_search(vorbis_dsp_state *v){ j+=ve->searchstep; } } - ve->cursor=j; - + return(-1); } @@ -369,3 +370,7 @@ void _ve_envelope_shift(envelope_lookup *e,long shift){ } + + + + diff --git a/lib/scales.h b/lib/scales.h index 0817fc5..e7ec555 100644 --- a/lib/scales.h +++ b/lib/scales.h @@ -11,7 +11,7 @@ ******************************************************************** function: linear scale -> dB, Bark and Mel scales - last mod: $Id: scales.h,v 1.23 2002/03/29 07:10:39 xiphmont Exp $ + last mod: $Id: scales.h,v 1.24 2002/03/29 08:18:23 xiphmont Exp $ ********************************************************************/ @@ -31,7 +31,7 @@ static float unitnorm(float x){ } static float FABS(float *x){ - ogg_uint32_t *ix=(ogg_uint32_t *)&x; + ogg_uint32_t *ix=(ogg_uint32_t *)x; *ix&=0x7fffffffUL; return(*x); } -- 2.7.4