[FFmpeg-devel] [PATCH] libvorbis: use 0-10 range for audio quality

Nicolas George nicolas.george
Tue Jan 20 12:00:54 CET 2009


Hi.

The attached trivial patch changes the libvorbis encoder so that the range
for the -aq option is 0-10 instead of 0-1. My reasons for this change are:

- The native vorbis encoder uses a similar factor:
  venc->quality = avccontext->global_quality / (float)FF_QP2LAMBDA / 10.;

- The command line oggenc uses the same 0-10 range.

- The usual quality settings (3 for 112 kbps nominal, 4 for 128 kbps) are
  not exactly possible because 0.3?118 and 0.4?118 are not integers
  (118=FF_QP2LAMBDA); "Nominal bitrate: 127.728000 kb/s" lacks some
  elegance.

Regards,

-- 
  Nicolas George
-------------- next part --------------
diff --git a/libavcodec/libvorbis.c b/libavcodec/libvorbis.c
index 03c9f88..819f01c 100644
--- a/libavcodec/libvorbis.c
+++ b/libavcodec/libvorbis.c
@@ -57,7 +57,7 @@ static int oggvorbis_init_encoder(vorbis_info *vi, AVCodecContext *avccontext) {
         /* 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 / 10.0))
             return -1;
     } else {
         /* constant bitrate */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090120/5c3447f2/attachment.pgp>



More information about the ffmpeg-devel mailing list