[FFmpeg-cvslog] avcodec/mpegvideo_enc: Check for existence of ildct cmp functions

Andreas Rheinhardt git at videolan.org
Thu Jun 20 19:59:47 EEST 2024


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Tue Jun 11 04:37:02 2024 +0200| [c46711d44f89b4d4ed6a4b6a771f3b23214e7f36] | committer: Andreas Rheinhardt

avcodec/mpegvideo_enc: Check for existence of ildct cmp functions

Not all compare functions are implemented for all compare function
types. Therefore check for the existence of the used functions.
Fixes issue #10245.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

 libavcodec/mpegvideo_enc.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 11f2a72804..c97120de21 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -910,8 +910,14 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
 
     s->quant_precision = 5;
 
-    ret  = ff_set_cmp(&s->mecc, s->mecc.ildct_cmp,      avctx->ildct_cmp);
-    ret |= ff_set_cmp(&s->mecc, s->mecc.frame_skip_cmp, s->frame_skip_cmp);
+    if (avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) {
+        ret = ff_set_cmp(&s->mecc, s->mecc.ildct_cmp, avctx->ildct_cmp);
+        if (ret < 0)
+            return ret;
+        if (!s->mecc.ildct_cmp[0] || !s->mecc.ildct_cmp[4])
+            return AVERROR(EINVAL);
+    }
+    ret = ff_set_cmp(&s->mecc, s->mecc.frame_skip_cmp, s->frame_skip_cmp);
     if (ret < 0)
         return AVERROR(EINVAL);
 



More information about the ffmpeg-cvslog mailing list