[xiph-cvs] cvs commit: speex/src speexdec.c speexenc.c
Jean-Marc Valin
jm at xiph.org
Mon Jan 6 14:06:45 PST 2003
jm 03/01/06 17:06:45
Modified: libspeex sb_celp.c speex_stereo.h stereo.c
src speexdec.c speexenc.c
Log:
Some stereo enhancements
Revision Changes Path
1.112 +1 -1 speex/libspeex/sb_celp.c
Index: sb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/sb_celp.c,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -r1.111 -r1.112
--- sb_celp.c 6 Jan 2003 20:43:48 -0000 1.111
+++ sb_celp.c 6 Jan 2003 22:06:45 -0000 1.112
@@ -652,7 +652,7 @@
{
SBDecState *st;
SpeexSBMode *mode;
- st = (SBDecState*)speex_alloc(sizeof(SBDecState)+4000*sizeof(float));
+ st = (SBDecState*)speex_alloc(sizeof(SBDecState)+6000*sizeof(float));
st->mode = m;
mode=(SpeexSBMode*)m->mode;
<p><p>1.5 +5 -3 speex/libspeex/speex_stereo.h
Index: speex_stereo.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/speex_stereo.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- speex_stereo.h 31 Dec 2002 06:07:33 -0000 1.4
+++ speex_stereo.h 6 Jan 2003 22:06:45 -0000 1.5
@@ -39,12 +39,14 @@
/** State used for decoding (intensity) stereo information */
typedef struct SpeexStereoState {
- float balance; /**< Left/right balance info */
- float e_ratio; /**< Ratio of energies: E(left+right)/[E(left)+E(right)] */
+ float balance; /**< Left/right balance info */
+ float e_ratio; /**< Ratio of energies: E(left+right)/[E(left)+E(right)] */
+ float smooth_left; /**< Smoothed left channel gain */
+ float smooth_right; /**< Smoothed right channel gain */
} SpeexStereoState;
/** Initialization value for a stereo state */
-#define SPEEX_STEREO_STATE_INIT {1,.5}
+#define SPEEX_STEREO_STATE_INIT {1,.5,1,1}
/** Transforms a stereo frame into a mono frame and stores intensity stereo info in 'bits' */
void speex_encode_stereo(float *data, int frame_size, SpeexBits *bits);
<p><p>1.5 +4 -2 speex/libspeex/stereo.c
Index: stereo.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/stereo.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- stereo.c 14 Nov 2002 04:49:14 -0000 1.4
+++ stereo.c 6 Jan 2003 22:06:45 -0000 1.5
@@ -96,8 +96,10 @@
for (i=frame_size-1;i>=0;i--)
{
float ftmp=data[i];
- data[2*i] = e_left*ftmp;
- data[2*i+1] = e_right*ftmp;
+ stereo->smooth_left = .98*stereo->smooth_left + .02*e_left;
+ stereo->smooth_right = .98*stereo->smooth_right + .02*e_right;
+ data[2*i] = stereo->smooth_left*ftmp;
+ data[2*i+1] = stereo->smooth_right*ftmp;
}
}
<p><p>1.68 +7 -5 speex/src/speexdec.c
Index: speexdec.c
===================================================================
RCS file: /usr/local/cvsroot/speex/src/speexdec.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- speexdec.c 6 Jan 2003 20:43:48 -0000 1.67
+++ speexdec.c 6 Jan 2003 22:06:45 -0000 1.68
@@ -297,11 +297,13 @@
speex_decoder_ctl(st, SPEEX_SET_ENH, &enh_enabled);
speex_decoder_ctl(st, SPEEX_GET_FRAME_SIZE, frame_size);
- callback.callback_id = SPEEX_INBAND_STEREO;
- callback.func = speex_std_stereo_request_handler;
- callback.data = stereo;
- speex_decoder_ctl(st, SPEEX_SET_HANDLER, &callback);
-
+ if (!(*channels==1))
+ {
+ callback.callback_id = SPEEX_INBAND_STEREO;
+ callback.func = speex_std_stereo_request_handler;
+ callback.data = stereo;
+ speex_decoder_ctl(st, SPEEX_SET_HANDLER, &callback);
+ }
if (!*rate)
*rate = header->rate;
/* Adjust rate if --force-* options are used */
<p><p>1.69 +1 -1 speex/src/speexenc.c
Index: speexenc.c
===================================================================
RCS file: /usr/local/cvsroot/speex/src/speexenc.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- speexenc.c 6 Jan 2003 21:30:23 -0000 1.68
+++ speexenc.c 6 Jan 2003 22:06:45 -0000 1.69
@@ -97,7 +97,7 @@
}
nb_read /= bits/8*channels;
- fprintf (stderr, "%d\n", nb_read);
+ /*fprintf (stderr, "%d\n", nb_read);*/
if (nb_read==0)
return 1;
<p><p>--- >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