[FFmpeg-devel] [PATCH] float values for libmp3lame quality

Michael Niedermayer michaelni
Tue Sep 14 16:42:06 CEST 2010


On Tue, Sep 14, 2010 at 02:29:44PM +0200, James Darnley wrote:
> This patch lets people use fractional quality settings for libmp3lame.
>  This feature was added to lame so that a user could use -V 5.678
> rather than integers alone.  Since I probably can't change
> AVCodecContext->global_quality to a float, the libmp3lame quality
> level is set to this value divided by 10.  This should allow
> sufficient precision for most uses.  If the user forgets that the
> scale is 10 times larger and sets a value less than 1 a warning will
> be printed.
[...]
> diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c
> index 1d74d6d..da3e3f5 100644
> --- a/libavcodec/libmp3lame.c
> +++ b/libavcodec/libmp3lame.c
> @@ -59,9 +59,15 @@ static av_cold int MP3lame_encode_init(AVCodecContext *avctx)
>      lame_set_mode(s->gfp, JOINT_STEREO);
>      lame_set_brate(s->gfp, avctx->bit_rate/1000);
>      if(avctx->flags & CODEC_FLAG_QSCALE) {
> +        float quality;
>          lame_set_brate(s->gfp, 0);
>          lame_set_VBR(s->gfp, vbr_default);
> -        lame_set_VBR_q(s->gfp, avctx->global_quality / (float)FF_QP2LAMBDA);

do you understand that FF_QP2LAMBDA is not 1 ?

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100914/2c249f92/attachment.pgp>



More information about the ffmpeg-devel mailing list