[Ffmpeg-cvslog] CVS: ffmpeg/libavcodec oggvorbis.c,1.26,1.27
Benjamin Larsson CVS
banan
Sat Jan 21 18:09:25 CET 2006
- Previous message: [Ffmpeg-cvslog] CVS: ffmpeg/tests ffmpeg.regression.ref, 1.156, 1.157 rotozoom.regression.ref, 1.110, 1.111
- Next message: [Ffmpeg-cvslog] CVS: ffmpeg/libavcodec a52dec.c, 1.13, 1.14 allcodecs.c, 1.124, 1.125 parser.c, 1.32, 1.33
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/ffmpeg/ffmpeg/libavcodec
In directory mail:/var2/tmp/cvs-serv24066/libavcodec
Modified Files:
oggvorbis.c
Log Message:
Implement audio cutoff frequency to the vorbis encoder.
Patch by Justin Ruggles jruggle earthlink net.
Index: oggvorbis.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/oggvorbis.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- oggvorbis.c 22 Dec 2005 01:10:08 -0000 1.26
+++ oggvorbis.c 21 Jan 2006 17:09:23 -0000 1.27
@@ -29,25 +29,35 @@
static int oggvorbis_init_encoder(vorbis_info *vi, AVCodecContext *avccontext) {
+ double cfreq;
if(avccontext->flags & CODEC_FLAG_QSCALE) {
- return vorbis_encode_init_vbr(vi, avccontext->channels,
+ /* variable bitrate */
+ if(vorbis_encode_setup_vbr(vi, avccontext->channels,
avccontext->sample_rate,
- avccontext->global_quality / (float)FF_QP2LAMBDA);
- }
+ avccontext->global_quality / (float)FF_QP2LAMBDA))
+ return -1;
+ } else {
+ /* constant bitrate */
+ if(vorbis_encode_setup_managed(vi, avccontext->channels,
+ avccontext->sample_rate, -1, avccontext->bit_rate, -1))
+ return -1;
+
#ifdef OGGVORBIS_VBR_BY_ESTIMATE
- /* variable bitrate by estimate */
+ /* variable bitrate by estimate */
+ if(vorbis_encode_ctl(vi, OV_ECTL_RATEMANAGE_AVG, NULL))
+ return -1;
+#endif
+ }
- return (vorbis_encode_setup_managed(vi, avccontext->channels,
- avccontext->sample_rate, -1, avccontext->bit_rate, -1) ||
- vorbis_encode_ctl(vi, OV_ECTL_RATEMANAGE_AVG, NULL) ||
- vorbis_encode_setup_init(vi)) ;
-#else
- /* constant bitrate */
+ /* cutoff frequency */
+ if(avccontext->cutoff > 0) {
+ cfreq = avccontext->cutoff / 1000.0;
+ if(vorbis_encode_ctl(vi, OV_ECTL_LOWPASS_SET, &cfreq))
+ return -1;
+ }
- return vorbis_encode_init(vi, avccontext->channels,
- avccontext->sample_rate, -1, avccontext->bit_rate, -1) ;
-#endif
+ return vorbis_encode_setup_init(vi);
}
static int oggvorbis_encode_init(AVCodecContext *avccontext) {
- Previous message: [Ffmpeg-cvslog] CVS: ffmpeg/tests ffmpeg.regression.ref, 1.156, 1.157 rotozoom.regression.ref, 1.110, 1.111
- Next message: [Ffmpeg-cvslog] CVS: ffmpeg/libavcodec a52dec.c, 1.13, 1.14 allcodecs.c, 1.124, 1.125 parser.c, 1.32, 1.33
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the ffmpeg-cvslog
mailing list