* [FFmpeg-devel] [PATCH] avcodec/libsvtav1: guard against bit_rate being zero
@ 2022-11-20 2:33 Christopher Degawa
2022-11-20 11:50 ` James Almer
2022-11-20 19:07 ` [FFmpeg-devel] [PATCH v2] avcodec/libsvtav1: only set max_buf_sz if both bitrate and rc_buf_sz is set Christopher Degawa
0 siblings, 2 replies; 4+ messages in thread
From: Christopher Degawa @ 2022-11-20 2:33 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Christopher Degawa
division by zero occurs if it's not specified
Signed-off-by: Christopher Degawa <ccom@randomderp.com>
---
libavcodec/libsvtav1.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
index 48cd58a0b3..06874dfa63 100644
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -179,7 +179,9 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param,
param->min_qp_allowed = avctx->qmin;
}
param->max_bit_rate = avctx->rc_max_rate;
- param->maximum_buffer_size_ms = avctx->rc_buffer_size * 1000LL / avctx->bit_rate;
+ param->maximum_buffer_size_ms = avctx->bit_rate
+ ? (avctx->rc_buffer_size * 1000LL / avctx->bit_rate)
+ : 0;
if (svt_enc->crf > 0) {
param->qp = svt_enc->crf;
--
2.38.1
_______________________________________________
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".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avcodec/libsvtav1: guard against bit_rate being zero
2022-11-20 2:33 [FFmpeg-devel] [PATCH] avcodec/libsvtav1: guard against bit_rate being zero Christopher Degawa
@ 2022-11-20 11:50 ` James Almer
2022-11-20 19:07 ` [FFmpeg-devel] [PATCH v2] avcodec/libsvtav1: only set max_buf_sz if both bitrate and rc_buf_sz is set Christopher Degawa
1 sibling, 0 replies; 4+ messages in thread
From: James Almer @ 2022-11-20 11:50 UTC (permalink / raw)
To: ffmpeg-devel
On 11/19/2022 11:33 PM, Christopher Degawa wrote:
> division by zero occurs if it's not specified
>
> Signed-off-by: Christopher Degawa <ccom@randomderp.com>
> ---
> libavcodec/libsvtav1.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
> index 48cd58a0b3..06874dfa63 100644
> --- a/libavcodec/libsvtav1.c
> +++ b/libavcodec/libsvtav1.c
> @@ -179,7 +179,9 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param,
> param->min_qp_allowed = avctx->qmin;
> }
> param->max_bit_rate = avctx->rc_max_rate;
> - param->maximum_buffer_size_ms = avctx->rc_buffer_size * 1000LL / avctx->bit_rate;
> + param->maximum_buffer_size_ms = avctx->bit_rate
> + ? (avctx->rc_buffer_size * 1000LL / avctx->bit_rate)
> + : 0;
The documentation for maximum_buffer_size_ms says minimum value is 20.
>
> if (svt_enc->crf > 0) {
> param->qp = svt_enc->crf;
_______________________________________________
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".
^ permalink raw reply [flat|nested] 4+ messages in thread
* [FFmpeg-devel] [PATCH v2] avcodec/libsvtav1: only set max_buf_sz if both bitrate and rc_buf_sz is set
2022-11-20 2:33 [FFmpeg-devel] [PATCH] avcodec/libsvtav1: guard against bit_rate being zero Christopher Degawa
2022-11-20 11:50 ` James Almer
@ 2022-11-20 19:07 ` Christopher Degawa
2022-11-20 19:19 ` James Almer
1 sibling, 1 reply; 4+ messages in thread
From: Christopher Degawa @ 2022-11-20 19:07 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Christopher Degawa
maximum_buffer_size_ms should only be set if both are specified or if
the user sets it through -svtav1-params buf-sz=val
Signed-off-by: Christopher Degawa <ccom@randomderp.com>
---
libavcodec/libsvtav1.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
index 48cd58a0b3..7605baddfe 100644
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -179,7 +179,8 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param,
param->min_qp_allowed = avctx->qmin;
}
param->max_bit_rate = avctx->rc_max_rate;
- param->maximum_buffer_size_ms = avctx->rc_buffer_size * 1000LL / avctx->bit_rate;
+ if (avctx->bit_rate && avctx->rc_buffer_size)
+ param->maximum_buffer_size_ms = avctx->rc_buffer_size * 1000LL / avctx->bit_rate;
if (svt_enc->crf > 0) {
param->qp = svt_enc->crf;
--
2.38.1
_______________________________________________
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".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2] avcodec/libsvtav1: only set max_buf_sz if both bitrate and rc_buf_sz is set
2022-11-20 19:07 ` [FFmpeg-devel] [PATCH v2] avcodec/libsvtav1: only set max_buf_sz if both bitrate and rc_buf_sz is set Christopher Degawa
@ 2022-11-20 19:19 ` James Almer
0 siblings, 0 replies; 4+ messages in thread
From: James Almer @ 2022-11-20 19:19 UTC (permalink / raw)
To: ffmpeg-devel
On 11/20/2022 4:07 PM, Christopher Degawa wrote:
> maximum_buffer_size_ms should only be set if both are specified or if
> the user sets it through -svtav1-params buf-sz=val
>
> Signed-off-by: Christopher Degawa <ccom@randomderp.com>
> ---
> libavcodec/libsvtav1.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
> index 48cd58a0b3..7605baddfe 100644
> --- a/libavcodec/libsvtav1.c
> +++ b/libavcodec/libsvtav1.c
> @@ -179,7 +179,8 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param,
> param->min_qp_allowed = avctx->qmin;
> }
> param->max_bit_rate = avctx->rc_max_rate;
> - param->maximum_buffer_size_ms = avctx->rc_buffer_size * 1000LL / avctx->bit_rate;
> + if (avctx->bit_rate && avctx->rc_buffer_size)
> + param->maximum_buffer_size_ms = avctx->rc_buffer_size * 1000LL / avctx->bit_rate;
Will apply.
>
> if (svt_enc->crf > 0) {
> param->qp = svt_enc->crf;
_______________________________________________
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".
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-11-20 19:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-20 2:33 [FFmpeg-devel] [PATCH] avcodec/libsvtav1: guard against bit_rate being zero Christopher Degawa
2022-11-20 11:50 ` James Almer
2022-11-20 19:07 ` [FFmpeg-devel] [PATCH v2] avcodec/libsvtav1: only set max_buf_sz if both bitrate and rc_buf_sz is set Christopher Degawa
2022-11-20 19:19 ` James Almer
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