[FFmpeg-devel] [PATCH 1/3] avcodec/svq1enc: Do not print debug RD value before it has been computed
Michael Niedermayer
michael at niedermayer.cc
Sun May 30 21:02:53 EEST 2021
Avoids floating point division by 0
Fixes: Ticket8191
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavcodec/svq1enc.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c
index 09fa15a3a2..91a208180b 100644
--- a/libavcodec/svq1enc.c
+++ b/libavcodec/svq1enc.c
@@ -486,9 +486,10 @@ static av_cold int svq1_encode_end(AVCodecContext *avctx)
SVQ1EncContext *const s = avctx->priv_data;
int i;
- av_log(avctx, AV_LOG_DEBUG, "RD: %f\n",
- s->rd_total / (double)(avctx->width * avctx->height *
- avctx->frame_number));
+ if (avctx->frame_number)
+ av_log(avctx, AV_LOG_DEBUG, "RD: %f\n",
+ s->rd_total / (double)(avctx->width * avctx->height *
+ avctx->frame_number));
s->m.mb_type = NULL;
ff_mpv_common_end(&s->m);
--
2.17.1
More information about the ffmpeg-devel
mailing list