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

Måns Rullgård mans
Tue Sep 14 22:41:13 CEST 2010


James Darnley <james.darnley at gmail.com> writes:

> On 14 September 2010 17:43, Michael Niedermayer <michaelni at gmx.at> wrote:
>> On Tue, Sep 14, 2010 at 05:28:06PM +0200, James Darnley wrote:
>>> On 14 September 2010 16:42, Michael Niedermayer <michaelni at gmx.at> wrote:
>>> > do you understand that FF_QP2LAMBDA is not 1 ?
>>> >
>>>
>>> No, but specifying -aq 5 on the command line gets you what you expect
>>> from lame (before this patch)
>>
>> and passing -aq 5.1 does not?
>>
>
> Right...  It is near enough correct (5..09322 vs 5.1).  I was under
> the mistaken impression that aq only understood an integer.
>
> New patch with the scaling removed
>
> From 0e130a14baa9f65eba4cd2151e5cbf1785c936ec Mon Sep 17 00:00:00 2001
> From: James Darnley <james.darnley at gmail.com>
> Date: Tue, 14 Sep 2010 10:57:19 +0200
> Subject: [PATCH 3/3] float values for libmp3lame quality
>
> ---
>  configure               |    7 ++++++-
>  libavcodec/libmp3lame.c |    3 ++-
>  2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/configure b/configure
> index ae3d738..f5445d7 100755
> --- a/configure
> +++ b/configure
> @@ -2709,7 +2709,12 @@ enabled libdirac   && add_cflags $(pkg-config --cflags dirac) &&
>                        require  libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init $(pkg-config --libs dirac)
>  enabled libfaac    && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
>  enabled libgsm     && require  libgsm gsm/gsm.h gsm_create -lgsm
> -enabled libmp3lame && require  libmp3lame lame/lame.h lame_init -lmp3lame
> +enabled libmp3lame && { check_lib lame/lame.h lame_get_VBR_quality -lmp3lame &&
> +                        check_lib lame/lame.h hip_decode_init -lmp3lame ||
> +                        die "ERROR: libmp3lame version must be >= 3.98.3"; }
> +# check for both functions to make sure it has the required feature but is newer
> +# than the fix to a bug in 3.98 through 3.98.2

Please explain.

>  enabled libnut     && require  libnut libnut.h nut_demuxer_init -lnut
>  enabled libopencore_amrnb  && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
>  enabled libopencore_amrwb  && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
> diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c
> index 1d74d6d..92b4024 100644
> --- a/libavcodec/libmp3lame.c
> +++ b/libavcodec/libmp3lame.c
> @@ -61,7 +61,8 @@ static av_cold int MP3lame_encode_init(AVCodecContext *avctx)
>      if(avctx->flags & CODEC_FLAG_QSCALE) {
>          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);
> +        /* requires lame 3.98 or later */

Pointless comment.

> +        lame_set_VBR_quality(s->gfp, avctx->global_quality/(float)FF_QP2LAMBDA);
>      }
>      lame_set_bWriteVbrTag(s->gfp,0);
>      lame_set_disable_reservoir(s->gfp, avctx->flags2 & CODEC_FLAG2_BIT_RESERVOIR ? 0 : 1);
> -- 
> 1.7.1
>

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list