* [FFmpeg-devel] [PATCH 1/2] avfilter/vf_tpad: fix check for drawing initialization
@ 2023-11-07 22:21 Marvin Scholz
2023-11-07 22:21 ` [FFmpeg-devel] [PATCH 2/2] fate: enhance tpad filter test Marvin Scholz
2023-11-09 10:11 ` [FFmpeg-devel] [PATCH 1/2] avfilter/vf_tpad: fix check for drawing initialization Anton Khirnov
0 siblings, 2 replies; 3+ messages in thread
From: Marvin Scholz @ 2023-11-07 22:21 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
The check if drawing needs to be initialized and supported formats
should be drawable ones was flawed, as pad_stop/pad_start is only
populated from stop_duration/start_duration after these checks.
To fix that, check the _duration variants as well and for better
readability and maintainability break the check out into its own
helper.
Fixes a regression from 86b252ea9dee18006910e30646ad1067f2d1323f
Fix #10621
---
libavfilter/vf_tpad.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/libavfilter/vf_tpad.c b/libavfilter/vf_tpad.c
index 7990403e81..1efe4ec479 100644
--- a/libavfilter/vf_tpad.c
+++ b/libavfilter/vf_tpad.c
@@ -70,11 +70,17 @@ static const AVOption tpad_options[] = {
AVFILTER_DEFINE_CLASS(tpad);
+static int needs_drawing(const TPadContext *s) {
+ return (
+ (s->stop_mode == MODE_ADD && (s->pad_stop != 0 || s->stop_duration != 0)) ||
+ (s->start_mode == MODE_ADD && (s->pad_start != 0 || s->start_duration != 0))
+ );
+}
+
static int query_formats(AVFilterContext *ctx)
{
TPadContext *s = ctx->priv;
- if ((s->stop_mode == MODE_ADD && s->pad_stop != 0) ||
- (s->start_mode == MODE_ADD && s->pad_start != 0))
+ if (needs_drawing(s))
return ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0));
return ff_set_common_formats(ctx, ff_all_formats(AVMEDIA_TYPE_VIDEO));
@@ -196,8 +202,7 @@ static int config_input(AVFilterLink *inlink)
AVFilterContext *ctx = inlink->dst;
TPadContext *s = ctx->priv;
- if ((s->stop_mode == MODE_ADD && s->pad_stop != 0) ||
- (s->start_mode == MODE_ADD && s->pad_start != 0)) {
+ if (needs_drawing(s)) {
ff_draw_init(&s->draw, inlink->format, 0);
ff_draw_color(&s->draw, &s->color, s->rgba_color);
}
--
2.39.3 (Apple Git-145)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
* [FFmpeg-devel] [PATCH 2/2] fate: enhance tpad filter test
2023-11-07 22:21 [FFmpeg-devel] [PATCH 1/2] avfilter/vf_tpad: fix check for drawing initialization Marvin Scholz
@ 2023-11-07 22:21 ` Marvin Scholz
2023-11-09 10:11 ` [FFmpeg-devel] [PATCH 1/2] avfilter/vf_tpad: fix check for drawing initialization Anton Khirnov
1 sibling, 0 replies; 3+ messages in thread
From: Marvin Scholz @ 2023-11-07 22:21 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
Adds another test that uses the start_duration and stop_duration
options instead of start and stop.
---
tests/fate/filter-video.mak | 3 ++-
tests/ref/fate/filter-tpad-add-duration | 11 +++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
create mode 100644 tests/ref/fate/filter-tpad-add-duration
diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index 789ec6414c..58edc70f46 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -299,9 +299,10 @@ fate-filter-tblend: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf tblend=all_mode=dif
FATE_FILTER_VSYNTH_PGMYUV-$(CONFIG_TELECINE_FILTER) += fate-filter-telecine
fate-filter-telecine: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf telecine
-FATE_FILTER-$(call FILTERFRAMECRC, TESTSRC2 TPAD) += fate-filter-tpad-add fate-filter-tpad-clone
+FATE_FILTER-$(call FILTERFRAMECRC, TESTSRC2 TPAD) += fate-filter-tpad-add fate-filter-tpad-clone fate-filter-tpad-add-duration
fate-filter-tpad-add: CMD = framecrc -lavfi testsrc2=d=1:r=2,tpad=start=1:stop=3:color=gray
fate-filter-tpad-clone: CMD = framecrc -lavfi testsrc2=d=1:r=2,tpad=start=1:stop=2:stop_mode=clone:color=black
+fate-filter-tpad-add-duration: CMD = framecrc -lavfi testsrc2=d=1:r=2,tpad=start_duration=0.5s:stop_duration=1.5s:color=gray
FATE_FILTER_VSYNTH_PGMYUV-$(CONFIG_TRANSPOSE_FILTER) += fate-filter-transpose
fate-filter-transpose: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf transpose
diff --git a/tests/ref/fate/filter-tpad-add-duration b/tests/ref/fate/filter-tpad-add-duration
new file mode 100644
index 0000000000..10e01655a1
--- /dev/null
+++ b/tests/ref/fate/filter-tpad-add-duration
@@ -0,0 +1,11 @@
+#tb 0: 1/2
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 320x240
+#sar 0: 1/1
+0, 0, 0, 1, 115200, 0x2213b502
+0, 1, 1, 1, 115200, 0xeba70ff3
+0, 2, 2, 1, 115200, 0xa764e4d5
+0, 3, 3, 1, 115200, 0x2213b502
+0, 4, 4, 1, 115200, 0x2213b502
+0, 5, 5, 1, 115200, 0x2213b502
--
2.39.3 (Apple Git-145)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/2] avfilter/vf_tpad: fix check for drawing initialization
2023-11-07 22:21 [FFmpeg-devel] [PATCH 1/2] avfilter/vf_tpad: fix check for drawing initialization Marvin Scholz
2023-11-07 22:21 ` [FFmpeg-devel] [PATCH 2/2] fate: enhance tpad filter test Marvin Scholz
@ 2023-11-09 10:11 ` Anton Khirnov
1 sibling, 0 replies; 3+ messages in thread
From: Anton Khirnov @ 2023-11-09 10:11 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Marvin Scholz
Quoting Marvin Scholz (2023-11-07 23:21:17)
> The check if drawing needs to be initialized and supported formats
> should be drawable ones was flawed, as pad_stop/pad_start is only
> populated from stop_duration/start_duration after these checks.
>
> To fix that, check the _duration variants as well and for better
> readability and maintainability break the check out into its own
> helper.
>
> Fixes a regression from 86b252ea9dee18006910e30646ad1067f2d1323f
> Fix #10621
> ---
> libavfilter/vf_tpad.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
Set pushed
--
Anton Khirnov
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-09 10:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-07 22:21 [FFmpeg-devel] [PATCH 1/2] avfilter/vf_tpad: fix check for drawing initialization Marvin Scholz
2023-11-07 22:21 ` [FFmpeg-devel] [PATCH 2/2] fate: enhance tpad filter test Marvin Scholz
2023-11-09 10:11 ` [FFmpeg-devel] [PATCH 1/2] avfilter/vf_tpad: fix check for drawing initialization Anton Khirnov
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git