[xiph-cvs] cvs commit: vorbis/lib envelope.c floor0.c iir.c iir.h mapping0.c
Monty
xiphmont at xiph.org
Tue Nov 7 01:51:44 PST 2000
xiphmont 00/11/07 01:51:43
Modified: lib envelope.c floor0.c iir.c iir.h mapping0.c
Log:
Hm, the earlier fix for 'slow envelope analysis on silence after
audio' caused the short blocks to mistrigger. A new fix for the
original problem that does not cause the new bug.
Monty
Revision Changes Path
1.25 +7 -3 vorbis/lib/envelope.c
Index: envelope.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/envelope.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- envelope.c 2000/11/06 00:07:00 1.24
+++ envelope.c 2000/11/07 09:51:42 1.25
@@ -12,7 +12,7 @@
********************************************************************
function: PCM data envelope analysis and manipulation
- last mod: $Id: envelope.c,v 1.24 2000/11/06 00:07:00 xiphmont Exp $
+ last mod: $Id: envelope.c,v 1.25 2000/11/07 09:51:42 xiphmont Exp $
Preecho calculation.
@@ -174,11 +174,15 @@
float *filtered=ve->filtered[i];
float *pcm=v->pcm[i];
IIR_state *iir=ve->iir+i;
- IIR_clamp(iir,9e-15);
+ int flag=1;
- for(j=ve->current;j<v->pcm_current;j++)
+ for(j=ve->current;j<v->pcm_current;j++){
filtered[j]=IIR_filter(iir,pcm[j]);
+ if(pcm[j])flag=0;
+ }
+ if(flag && ve->current+64<v->pcm_current)IIR_reset(iir);
}
+
ve->current=v->pcm_current;
/* Now search through our cached highpass data for breaking points */
1.27 +16 -1 vorbis/lib/floor0.c
Index: floor0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/floor0.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- floor0.c 2000/11/06 00:07:00 1.26
+++ floor0.c 2000/11/07 09:51:42 1.27
@@ -12,7 +12,7 @@
********************************************************************
function: floor backend 0 implementation
- last mod: $Id: floor0.c,v 1.26 2000/11/06 00:07:00 xiphmont Exp $
+ last mod: $Id: floor0.c,v 1.27 2000/11/07 09:51:42 xiphmont Exp $
********************************************************************/
@@ -246,6 +246,7 @@
float *work=alloca((look->ln+look->n)*sizeof(float));
float amp;
long bits=0;
+ static int seq=0;
#ifdef TRAIN_LSP
FILE *of;
@@ -300,6 +301,19 @@
/* LSP <-> LPC is orthogonal and LSP quantizes more stably */
vorbis_lpc_to_lsp(out,out,look->m);
+#ifdef ANALYSIS
+ {
+ float *lspwork=alloca(look->m*sizeof(float));
+ memcpy(lspwork,out,look->m*sizeof(float));
+ vorbis_lsp_to_curve(lspwork,look->linearmap,look->n,look->ln,
+ work,look->m,amp,info->ampdB);
+ _analysis_output("prefit",seq,work,look->n,0,1);
+
+ }
+
+#endif
+
+
#if 1
#ifdef TRAIN_LSP
{
@@ -350,6 +364,7 @@
}
memset(out,0,sizeof(float)*look->n);
+ seq++;
return(0);
}
1.4 +5 -12 vorbis/lib/iir.c
Index: iir.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/iir.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- iir.c 2000/11/06 00:07:00 1.3
+++ iir.c 2000/11/07 09:51:43 1.4
@@ -12,7 +12,7 @@
********************************************************************
function: Direct Form I, II IIR filters, plus some specializations
- last mod: $Id: iir.c,v 1.3 2000/11/06 00:07:00 xiphmont Exp $
+ last mod: $Id: iir.c,v 1.4 2000/11/07 09:51:43 xiphmont Exp $
********************************************************************/
@@ -46,6 +46,10 @@
}
}
+void IIR_reset(IIR_state *s){
+ memset(s->z_A,0,sizeof(float)*s->stages*2);
+}
+
float IIR_filter(IIR_state *s,float in){
int stages=s->stages,i;
float newA;
@@ -63,17 +67,6 @@
if(++s->ring>=stages)s->ring=0;
return(newB);
-}
-
-/* prevents ringing down to underflow */
-void IIR_clamp(IIR_state *s,float thresh){
- float *zA=s->z_A+s->ring;
- int i;
- for(i=0;i<s->stages;i++)
- if(fabs(zA[i])>=thresh)break;
-
- if(i<s->stages)
- memset(s->z_A,0,sizeof(float)*s->stages*2);
}
/* this assumes the symmetrical structure of the feed-forward stage of
1.4 +2 -2 vorbis/lib/iir.h
Index: iir.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/iir.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- iir.h 2000/11/06 00:07:00 1.3
+++ iir.h 2000/11/07 09:51:43 1.4
@@ -12,7 +12,7 @@
********************************************************************
function: Direct Form I, II IIR filters, plus some specializations
- last mod: $Id: iir.h,v 1.3 2000/11/06 00:07:00 xiphmont Exp $
+ last mod: $Id: iir.h,v 1.4 2000/11/07 09:51:43 xiphmont Exp $
********************************************************************/
@@ -32,6 +32,6 @@
extern void IIR_clear(IIR_state *s);
extern float IIR_filter(IIR_state *s,float in);
extern float IIR_filter_ChebBand(IIR_state *s,float in);
-extern void IIR_clamp(IIR_state *s,float thresh);
+extern void IIR_reset(IIR_state *s);
#endif
1.18 +2 -1 vorbis/lib/mapping0.c
Index: mapping0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/mapping0.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- mapping0.c 2000/11/06 00:07:01 1.17
+++ mapping0.c 2000/11/07 09:51:43 1.18
@@ -12,11 +12,12 @@
********************************************************************
function: channel mapping 0 implementation
- last mod: $Id: mapping0.c,v 1.17 2000/11/06 00:07:01 xiphmont Exp $
+ last mod: $Id: mapping0.c,v 1.18 2000/11/07 09:51:43 xiphmont Exp $
********************************************************************/
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
#include <math.h>
#include <ogg/ogg.h>
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list