[FFmpeg-devel] [PATCH v3 3/4] lavfi/vf_xfade_vulkan: add wipedown transition

Marvin Scholz epirat07 at gmail.com
Wed Jun 7 01:23:01 EEST 2023


---
 libavfilter/vf_xfade_vulkan.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/libavfilter/vf_xfade_vulkan.c b/libavfilter/vf_xfade_vulkan.c
index 0244802e9c..58552ab734 100644
--- a/libavfilter/vf_xfade_vulkan.c
+++ b/libavfilter/vf_xfade_vulkan.c
@@ -71,6 +71,7 @@ enum XFadeTransitions {
     WIPELEFT,
     WIPERIGHT,
     WIPEUP,
+    WIPEDOWN,
     NB_TRANSITIONS,
 };
 
@@ -116,11 +117,23 @@ static const char transition_wipeup[] = {
     C(0, }                                                                     )
 };
 
+static const char transition_wipedown[] = {
+    C(0, void transition(int idx, ivec2 pos, float progress)                   )
+    C(0, {                                                                     )
+    C(1,     ivec2 size = imageSize(output_images[idx]);                       )
+    C(1,     int  s = int(size.y * progress);                                  )
+    C(1,     vec4 a = texture(a_images[idx], pos);                             )
+    C(1,     vec4 b = texture(b_images[idx], pos);                             )
+    C(1,     imageStore(output_images[idx], pos, pos.y > s ? a : b);           )
+    C(0, }                                                                     )
+};
+
 static const char* transitions_map[NB_TRANSITIONS] = {
     [FADE]      = transition_fade,
     [WIPELEFT]  = transition_wipeleft,
     [WIPERIGHT] = transition_wiperight,
     [WIPEUP]    = transition_wipeup,
+    [WIPEDOWN]  = transition_wipedown,
 };
 
 static av_cold int init_vulkan(AVFilterContext *avctx)
@@ -467,6 +480,7 @@ static const AVOption xfade_vulkan_options[] = {
         { "wipeleft",  "wipe left transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPELEFT}, 0, 0, FLAGS, "transition" },
         { "wiperight", "wipe right transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPERIGHT}, 0, 0, FLAGS, "transition" },
         { "wipeup",    "wipe up transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPEUP}, 0, 0, FLAGS, "transition" },
+        { "wipedown",  "wipe down transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPEDOWN}, 0, 0, FLAGS, "transition" },
     { "duration", "set cross fade duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=1000000}, 0, 60000000, FLAGS },
     { "offset",   "set cross fade start relative to first input stream", OFFSET(offset), AV_OPT_TYPE_DURATION, {.i64=0}, INT64_MIN, INT64_MAX, FLAGS },
     { NULL }
-- 
2.37.0 (Apple Git-136)



More information about the ffmpeg-devel mailing list