[FFmpeg-devel] [PATCH 18/57] avcodec/mpegvideo_enc: Check for existence of ildct cmp functions
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Wed Jun 12 16:48:14 EEST 2024
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>
---
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);
--
2.40.1
More information about the ffmpeg-devel
mailing list