PR #23491 opened by Bogdan Lisman (bogdanpydev)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23491
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23491.patch
get_dc() divides the accumulated, OBMC-weighted DC by aa, the sum of the
squared OBMC weights taken over the in-plane pixels. When an OBMC block
falls entirely outside the plane - e.g. a tiny chroma plane after mcdeint
splits a frame into fields - no pixel contributes, aa stays 0 and the
ROUNDED_DIV() divides by zero (SIGFPE). ab is 0 in exactly the same case,
so the result degenerates to 0; return it directly.
Reproducible with the GPL mcdeint filter in slow/extra_slow mode, e.g.
ffmpeg -f lavfi -i testsrc=s=128x2 -vf mcdeint=mode=slow -f null -
Add a self-contained lavfi-based FATE regression test for the slow mode,
which previously crashed and is therefore not covered by the existing
sample-based fast/medium tests.
Fixes trac ticket #7779.
Signed-off-by: Bogdan Lisman <[email protected]>
# Summary of changes
Briefly describe what this PR does and why.
<!--
If this PR requires new FATE test samples, attach them to the PR and
list their target paths below (relative to the fate-suite root).
Attached filenames must match the sample's filename:
```fate-samples
# e.g. vorbis/new-sample.ogg
```
-->
>From 84a28f1280675dc4a3434c766b17dd185af3df6c Mon Sep 17 00:00:00 2001
From: Bogdan Lisman <[email protected]>
Date: Mon, 15 Jun 2026 03:24:14 +0300
Subject: [PATCH] avcodec/snowenc: fix SIGFPE in get_dc() when a block lies
outside the plane
get_dc() divides the accumulated, OBMC-weighted DC by aa, the sum of the
squared OBMC weights taken over the in-plane pixels. When an OBMC block
falls entirely outside the plane - e.g. a tiny chroma plane after mcdeint
splits a frame into fields - no pixel contributes, aa stays 0 and the
ROUNDED_DIV() divides by zero (SIGFPE). ab is 0 in exactly the same case,
so the result degenerates to 0; return it directly.
Reproducible with the GPL mcdeint filter in slow/extra_slow mode, e.g.
ffmpeg -f lavfi -i testsrc=s=128x2 -vf mcdeint=mode=slow -f null -
Add a self-contained lavfi-based FATE regression test for the slow mode,
which previously crashed and is therefore not covered by the existing
sample-based fast/medium tests.
Fixes trac ticket #7779.
Signed-off-by: Bogdan Lisman <[email protected]>
---
libavcodec/snowenc.c | 3 +++
tests/fate/filter-video.mak | 3 +++
tests/ref/fate/filter-mcdeint-slow | 8 ++++++++
3 files changed, 14 insertions(+)
create mode 100644 tests/ref/fate/filter-mcdeint-slow
diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index 29a1f114c3..d46f871816 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -723,6 +723,9 @@ static int get_dc(SnowEncContext *enc, int mb_x, int mb_y,
int plane_index)
}
*b= backup;
+ if (!aa)
+ return 0;
+
return av_clip_uint8( ROUNDED_DIV((int64_t)ab<<LOG2_OBMC_MAX, aa) );
//FIXME we should not need clipping
}
diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index af9c374e1c..fcf15b7f2f 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -51,6 +51,9 @@ fate-filter-mcdeint-medium: CMD = framecrc -flags bitexact
-idct simple -i $(TAR
FATE_FILTER_SAMPLES-$(call FILTERDEMDEC, MCDEINT, MPEGTS, MPEG2VIDEO,
SNOW_ENCODER) += $(FATE_MCDEINT)
+FATE_FILTER-$(call FILTERFRAMECRC, MCDEINT TESTSRC, SNOW_ENCODER) +=
fate-filter-mcdeint-slow
+fate-filter-mcdeint-slow: CMD = framecrc -auto_conversion_filters -flags
bitexact -lavfi testsrc=s=128x2:r=25:d=1,mcdeint=mode=slow -frames:v 3
+
FATE_FILTER_SAMPLES-$(call FILTERDEMDEC, CODECVIEW, RM, RV40) +=
fate-filter-codecview-mvs
fate-filter-codecview-mvs: CMD = framecrc -flags2 +export_mvs -i
$(TARGET_SAMPLES)/real/spygames-2MB.rmvb -vf codecview=mv=pf+bf+bb -frames:v 60
-an
diff --git a/tests/ref/fate/filter-mcdeint-slow
b/tests/ref/fate/filter-mcdeint-slow
new file mode 100644
index 0000000000..0888d44805
--- /dev/null
+++ b/tests/ref/fate/filter-mcdeint-slow
@@ -0,0 +1,8 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 128x2
+#sar 0: 1/1
+0, 0, 0, 1, 768, 0x6d637c68
+0, 1, 1, 1, 768, 0x07867cb0
+0, 2, 2, 1, 768, 0xa1ef7d04
--
2.52.0
_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]