Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Gyan Doshi <ffmpeg@gyani.pro>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH] libavcodec/libfdk-aacenc: Scale VBR mode with FF_QP2LAMBDA
Date: Wed, 22 Feb 2023 22:03:44 +0530
Message-ID: <7334fb72-bb26-de45-f0a1-c33180f210b0@gyani.pro> (raw)
In-Reply-To: <58c99b7b-c5f2-5541-5bd1-cce58ddfb204@rothenpieler.org>



On 2023-02-22 09:39 pm, Timo Rothenpieler wrote:
> On 22.02.2023 03:12, JonHGee wrote:
>> libavcodec/libfdk-aacenc: VBR mode currently does not account for 
>> scaling when using -aq options with libfdk, resulting in clamping to 
>> vbr mode 5 whenever a value >0 is provided.  Adjusting for the 
>> scaling factor for proper VBR support.
>>
>> ---
>>   libavcodec/libfdk-aacenc.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
>> index 54549de473..da211baf51 100644
>> --- a/libavcodec/libfdk-aacenc.c
>> +++ b/libavcodec/libfdk-aacenc.c
>> @@ -230,7 +230,7 @@ static av_cold int aac_encode_init(AVCodecContext 
>> *avctx)
>>       }
>>         if (avctx->flags & AV_CODEC_FLAG_QSCALE || s->vbr) {
>> -        int mode = s->vbr ? s->vbr : avctx->global_quality;
>> +        int mode = s->vbr ? s->vbr : avctx->global_quality / 
>> FF_QP2LAMBDA;
>>           if (mode <  1 || mode > 5) {
>>               av_log(avctx, AV_LOG_WARNING,
>>                      "VBR quality %d out of range, should be 1-5\n", 
>> mode);
>
> Won't this break every existing command line and API client that has 
> passed a value according to the current scale?
>
> Also, what binds stronger here?
> It this "(s->vbr ? s->vbr : avctx->global_quality) / FF_QP2LAMBDA" or 
> "s->vbr ? s->vbr : (avctx->global_quality / FF_QP2LAMBDA)"?
>
> In any case, this does not look correct to me.
> Where would the sudden multiplication with FF_QP2LAMBDA come from in 
> the first place?

From

fftools\ffmpeg_mux_init.c
619:        ost->enc_ctx->global_quality = FF_QP2LAMBDA * qscale

Regards,
Gyan

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2023-02-22 16:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <63F57060.05FE3A.50083@loongson.cn>
2023-02-22  2:12 ` JonHGee
2023-02-22 16:09   ` Timo Rothenpieler
2023-02-22 16:33     ` Gyan Doshi [this message]
2023-02-22 16:42       ` Timo Rothenpieler
2023-02-22 16:46         ` Gyan Doshi
2023-02-22 17:15           ` Timo Rothenpieler
2023-02-22 18:49             ` Jonathan Gee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7334fb72-bb26-de45-f0a1-c33180f210b0@gyani.pro \
    --to=ffmpeg@gyani.pro \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git