[xiph-cvs] cvs commit: speex/src speexenc.c
Jean-Marc Valin
jm at xiph.org
Thu Oct 31 19:50:51 PST 2002
jm 02/10/31 22:50:51
Modified: libspeex nb_celp.c nb_celp.h sb_celp.c
src speexenc.c
Log:
VBR quality is now a float parameter
Revision Changes Path
1.76 +2 -2 speex/libspeex/nb_celp.c
Index: nb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/nb_celp.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -r1.75 -r1.76
--- nb_celp.c 30 Oct 2002 22:12:19 -0000 1.75
+++ nb_celp.c 1 Nov 2002 03:50:50 -0000 1.76
@@ -1241,10 +1241,10 @@
(*(int*)ptr) = st->vbr_enabled;
break;
case SPEEX_SET_VBR_QUALITY:
- st->vbr_quality = (*(int*)ptr);
+ st->vbr_quality = (*(float*)ptr);
break;
case SPEEX_GET_VBR_QUALITY:
- (*(int*)ptr) = st->vbr_quality;
+ (*(float*)ptr) = st->vbr_quality;
break;
case SPEEX_SET_QUALITY:
{
<p><p>1.33 +1 -1 speex/libspeex/nb_celp.h
Index: nb_celp.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/nb_celp.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- nb_celp.h 27 Oct 2002 02:59:00 -0000 1.32
+++ nb_celp.h 1 Nov 2002 03:50:50 -0000 1.33
@@ -99,7 +99,7 @@
float *pi_gain; /**< Gain of LPC filter at theta=pi (fe/2) */
VBRState *vbr; /**< State of the VBR data */
- int vbr_quality; /**< Quality setting for VBR encoding */
+ float vbr_quality; /**< Quality setting for VBR encoding */
int vbr_enabled; /**< 1 for enabling VBR, 0 otherwise */
int complexity; /**< Complexity setting (0-10 from least complex to most complex) */
<p><p>1.85 +6 -2 speex/libspeex/sb_celp.c
Index: sb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/sb_celp.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -r1.84 -r1.85
--- sb_celp.c 30 Oct 2002 22:12:19 -0000 1.84
+++ sb_celp.c 1 Nov 2002 03:50:50 -0000 1.85
@@ -918,11 +918,15 @@
break;
case SPEEX_SET_VBR_QUALITY:
{
- int qual = (*(int*)ptr)+1;
+ int q;
+ float qual = (*(float*)ptr)+1;
if (qual>10)
qual=10;
+ q=(int)floor(.5+*(float*)ptr);
+ if (q>10)
+ q=10;
speex_encoder_ctl(st->st_low, SPEEX_SET_VBR_QUALITY, &qual);
- speex_encoder_ctl(state, SPEEX_SET_QUALITY, ptr);
+ speex_encoder_ctl(state, SPEEX_SET_QUALITY, &q);
break;
}
case SPEEX_SET_QUALITY:
<p><p>1.52 +6 -6 speex/src/speexenc.c
Index: speexenc.c
===================================================================
RCS file: /usr/local/cvsroot/speex/src/speexenc.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- speexenc.c 31 Oct 2002 20:25:09 -0000 1.51
+++ speexenc.c 1 Nov 2002 03:50:50 -0000 1.52
@@ -204,6 +204,7 @@
int chan=1;
int fmt=16;
int quality=-1;
+ float vbr_quality=-1;
int lbr=0;
int lsb=1;
ogg_stream_state os;
@@ -244,6 +245,7 @@
else if (strcmp(long_options[option_index].name,"quality")==0)
{
quality = atoi (optarg);
+ vbr_quality=atof(optarg);
} else if (strcmp(long_options[option_index].name,"nframes")==0)
{
nframes = atoi (optarg);
@@ -479,14 +481,12 @@
tmp=1;
speex_encoder_ctl(st, SPEEX_SET_VBR, &tmp);
}
- if (lbr || quality != -1)
+ if (quality >= 0)
{
- int tmp=quality;
- if (quality==-1)
- tmp = 3;
- speex_encoder_ctl(st, SPEEX_SET_QUALITY, &tmp);
if (vbr_enabled)
- speex_encoder_ctl(st, SPEEX_SET_VBR_QUALITY, &tmp);
+ speex_encoder_ctl(st, SPEEX_SET_VBR_QUALITY, &vbr_quality);
+ else
+ speex_encoder_ctl(st, SPEEX_SET_QUALITY, &quality);
}
speex_bits_init(&bits);
<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