[vorbis-dev] Problem in vorbis_encode_setup_managed
Steve Nicolai
snicolai at mac.com
Wed Jan 2 23:41:28 PST 2002
I noticed that there was some code in vorbis_encode_setup_managed
to guess a quality factor from the bitrates passed in.
The code that handles a missing nominal_bitrate was after
the quality factor was already guessed from a -1 rate.
Below is a patch.
Steve
<p>Index: lib/vorbisenc.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/vorbisenc.c,v
retrieving revision 1.33
diff -u -r1.33 vorbisenc.c
--- lib/vorbisenc.c 2001/12/23 11:53:53 1.33
+++ lib/vorbisenc.c 2002/01/03 07:21:47
@@ -914,23 +914,25 @@
long nominal_bitrate,
long min_bitrate){
- double tnominal=nominal_bitrate;
- double approx_vbr=approx_bitrate_to_vbr(channels,(channels==2),
- (float)nominal_bitrate,rate);
+ float tnominal=nominal_bitrate;
+ double approx_vbr;
int ret=0;
- if(approx_vbr<0)return(OV_EIMPL);
-
- if(nominal_bitrate<=0.){
- if(max_bitrate>0.){
- nominal_bitrate=max_bitrate*.875;
+
+ if(nominal_bitrate<=0){
+ if(max_bitrate>0){
+ tnominal=(float)max_bitrate*.875f;
}else{
- if(min_bitrate>0.){
- nominal_bitrate=min_bitrate;
+ if(min_bitrate>0){
+ tnominal=(float)min_bitrate;
}else{
return(OV_EINVAL);
}
}
}
+
+ approx_vbr=approx_bitrate_to_vbr(channels,(channels==2),
+ (float)tnominal,rate);
+ if(approx_vbr<0)return(OV_EIMPL);
ret=vorbis_encode_setup_vbr(vi,channels,rate,approx_vbr);
if(ret){
<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 'vorbis-dev-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 Vorbis-dev
mailing list