[FFmpeg-cvslog] avcodec/svq1enc: Do not print debug RD value before it has been computed

Michael Niedermayer git at videolan.org
Fri Jun 18 22:14:50 EEST 2021


ffmpeg | branch: release/4.4 | Michael Niedermayer <michael at niedermayer.cc> | Sun May 30 18:09:37 2021 +0200| [478c5d838b456508a3b470d9a8aa1b799c71a445] | committer: Michael Niedermayer

avcodec/svq1enc: Do not print debug RD value before it has been computed

Avoids floating point division by 0

Fixes: Ticket8191

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit c297f7e57a223da9f0d350e30456d60c8c87f902)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=478c5d838b456508a3b470d9a8aa1b799c71a445
---

 libavcodec/svq1enc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c
index 4fac0c26e5..1b5da03245 100644
--- a/libavcodec/svq1enc.c
+++ b/libavcodec/svq1enc.c
@@ -487,9 +487,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);



More information about the ffmpeg-cvslog mailing list