diff mbox series

[FFmpeg-devel] avcodec/aacpsy: clip global_quality within the psy_vbr_map array boundaries

Message ID 20230413125839.3396-1-jamrial@gmail.com
State Accepted
Commit 5cda6b94f45c347805cbd5a0c7ed1d712b5722d7
Headers show
Series [FFmpeg-devel] avcodec/aacpsy: clip global_quality within the psy_vbr_map array boundaries | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

James Almer April 13, 2023, 12:58 p.m. UTC
Fixes ticket #10317.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/aacpsy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

James Almer April 14, 2023, 12:16 p.m. UTC | #1
On 4/13/2023 9:58 AM, James Almer wrote:
> Fixes ticket #10317.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>   libavcodec/aacpsy.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
> index 4c5ab2c9d5..933369e445 100644
> --- a/libavcodec/aacpsy.c
> +++ b/libavcodec/aacpsy.c
> @@ -267,7 +267,7 @@ static av_cold void lame_window_init(AacPsyContext *ctx, AVCodecContext *avctx)
>           AacPsyChannel *pch = &ctx->ch[i];
>   
>           if (avctx->flags & AV_CODEC_FLAG_QSCALE)
> -            pch->attack_threshold = psy_vbr_map[avctx->global_quality / FF_QP2LAMBDA].st_lrm;
> +            pch->attack_threshold = psy_vbr_map[av_clip(avctx->global_quality / FF_QP2LAMBDA, 0, 10)].st_lrm;
>           else
>               pch->attack_threshold = lame_calc_attack_threshold(avctx->bit_rate / avctx->ch_layout.nb_channels / 1000);

Will apply.
diff mbox series

Patch

diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
index 4c5ab2c9d5..933369e445 100644
--- a/libavcodec/aacpsy.c
+++ b/libavcodec/aacpsy.c
@@ -267,7 +267,7 @@  static av_cold void lame_window_init(AacPsyContext *ctx, AVCodecContext *avctx)
         AacPsyChannel *pch = &ctx->ch[i];
 
         if (avctx->flags & AV_CODEC_FLAG_QSCALE)
-            pch->attack_threshold = psy_vbr_map[avctx->global_quality / FF_QP2LAMBDA].st_lrm;
+            pch->attack_threshold = psy_vbr_map[av_clip(avctx->global_quality / FF_QP2LAMBDA, 0, 10)].st_lrm;
         else
             pch->attack_threshold = lame_calc_attack_threshold(avctx->bit_rate / avctx->ch_layout.nb_channels / 1000);