This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit b16c028002fca314c41b30e32f16db0462603fa3 Author: Philip Langdale <[email protected]> AuthorDate: Sun Jun 28 13:23:58 2026 -0700 Commit: Philip Langdale <[email protected]> CommitDate: Sat Aug 29 16:38:05 2026 -0700 avfilter/fruc_vulkan: wire up filter as a copy of vf_framerate This is the minimal level of renames required to get the new filter to function as a clone of vf_framerate. The context type is inlined from the header, but there are no actual functional changes. --- configure | 1 + libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/vf_fruc_vulkan.c | 106 +++++++++++++++++++++++++++++-------------- 4 files changed, 76 insertions(+), 33 deletions(-) diff --git a/configure b/configure index 21128a80a0..5f8f4c7103 100755 --- a/configure +++ b/configure @@ -4217,6 +4217,7 @@ find_rect_filter_deps="avcodec avformat gpl" flip_vulkan_filter_deps="vulkan spirv_compiler" flite_filter_deps="libflite threads" framerate_filter_select="scene_sad" +fruc_vulkan_filter_select="scene_sad" freezedetect_filter_select="scene_sad" frei0r_deps_any="libdl LoadLibrary" frei0r_filter_deps="frei0r" diff --git a/libavfilter/Makefile b/libavfilter/Makefile index daa4d552f0..2d23df04b7 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -332,6 +332,7 @@ OBJS-$(CONFIG_FREEZEFRAMES_FILTER) += vf_freezeframes.o OBJS-$(CONFIG_FREI0R_FILTER) += vf_frei0r.o OBJS-$(CONFIG_FSPP_FILTER) += vf_fspp.o vf_fsppdsp.o qp_table.o OBJS-$(CONFIG_FSYNC_FILTER) += vf_fsync.o +OBJS-$(CONFIG_FRUC_VULKAN_FILTER) += vf_fruc_vulkan.o OBJS-$(CONFIG_GBLUR_FILTER) += vf_gblur.o OBJS-$(CONFIG_GBLUR_VULKAN_FILTER) += vf_gblur_vulkan.o vulkan.o vulkan_filter.o OBJS-$(CONFIG_GEQ_FILTER) += vf_geq.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 4af7a3bbbf..12155e9002 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -306,6 +306,7 @@ extern const FFFilter ff_vf_freezeframes; extern const FFFilter ff_vf_frei0r; extern const FFFilter ff_vf_fspp; extern const FFFilter ff_vf_fsync; +extern const FFFilter ff_vf_fruc_vulkan; extern const FFFilter ff_vf_gblur; extern const FFFilter ff_vf_gblur_vulkan; extern const FFFilter ff_vf_geq; diff --git a/libavfilter/vf_fruc_vulkan.c b/libavfilter/vf_fruc_vulkan.c index 468042e7db..4244571191 100644 --- a/libavfilter/vf_fruc_vulkan.c +++ b/libavfilter/vf_fruc_vulkan.c @@ -23,11 +23,9 @@ /** * @file - * filter for upsampling or downsampling a progressive source + * Frame rate up-conversion filter. */ -#define DEBUG - #include "libavutil/avassert.h" #include "libavutil/imgutils.h" #include "libavutil/internal.h" @@ -37,15 +35,60 @@ #include "avfilter.h" #include "video.h" #include "filters.h" -#include "framerate.h" #include "scene_sad.h" -#define OFFSET(x) offsetof(FrameRateContext, x) +#define BLEND_FUNC_PARAMS const uint8_t *src1, ptrdiff_t src1_linesize, \ + const uint8_t *src2, ptrdiff_t src2_linesize, \ + uint8_t *dst, ptrdiff_t dst_linesize, \ + ptrdiff_t width, ptrdiff_t height, \ + int factor1, int factor2, int half + +#define BLEND_FACTOR_DEPTH(n) (n-1) + +typedef void (*blend_func)(BLEND_FUNC_PARAMS); + +typedef struct FRUCVulkanContext { + const AVClass *class; + // parameters + AVRational dest_frame_rate; ///< output frames per second + int flags; ///< flags affecting frame rate conversion algorithm + double scene_score; ///< score that denotes a scene change has happened + int interp_start; ///< start of range to apply linear interpolation + int interp_end; ///< end of range to apply linear interpolation + + int line_size[4]; ///< bytes of pixel data per line for each plane + int height[4]; ///< height of each plane + int vsub; + + AVRational srce_time_base; ///< timebase of source + AVRational dest_time_base; ///< timebase of destination + + ff_scene_sad_fn sad; ///< Sum of the absolute difference function (scene detect only) + double prev_mafd; ///< previous MAFD (scene detect only) + + int blend_factor_max; + int bitdepth; + AVFrame *work; + + AVFrame *f0; ///< last frame + AVFrame *f1; ///< current frame + int64_t pts0; ///< last frame pts in dest_time_base + int64_t pts1; ///< current frame pts in dest_time_base + int64_t delta; ///< pts1 to pts0 delta + double score; ///< scene change score (f0 to f1) + int flush; ///< 1 if the filter is being flushed + int64_t start_pts; ///< pts of the first output frame + int64_t n; ///< output frame counter + + blend_func blend; +} FRUCVulkanContext; + +#define OFFSET(x) offsetof(FRUCVulkanContext, x) #define V AV_OPT_FLAG_VIDEO_PARAM #define F AV_OPT_FLAG_FILTERING_PARAM -#define FRAMERATE_FLAG_SCD 01 +#define FRUC_VULKAN_FLAG_SCD 01 -static const AVOption framerate_options[] = { +static const AVOption fruc_vulkan_options[] = { {"fps", "required output frames per second rate", OFFSET(dest_frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="50"}, 0, INT_MAX, V|F }, {"interp_start", "point to start linear interpolation", OFFSET(interp_start), AV_OPT_TYPE_INT, {.i64=15}, 0, 255, V|F }, @@ -53,17 +96,17 @@ static const AVOption framerate_options[] = { {"scene", "scene change level", OFFSET(scene_score), AV_OPT_TYPE_DOUBLE, {.dbl=8.2}, 0, 100., V|F }, {"flags", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64=1}, 0, INT_MAX, V|F, .unit = "flags" }, - {"scene_change_detect", "enable scene change detection", 0, AV_OPT_TYPE_CONST, {.i64=FRAMERATE_FLAG_SCD}, INT_MIN, INT_MAX, V|F, .unit = "flags" }, - {"scd", "enable scene change detection", 0, AV_OPT_TYPE_CONST, {.i64=FRAMERATE_FLAG_SCD}, INT_MIN, INT_MAX, V|F, .unit = "flags" }, + {"scene_change_detect", "enable scene change detection", 0, AV_OPT_TYPE_CONST, {.i64=FRUC_VULKAN_FLAG_SCD}, INT_MIN, INT_MAX, V|F, .unit = "flags" }, + {"scd", "enable scene change detection", 0, AV_OPT_TYPE_CONST, {.i64=FRUC_VULKAN_FLAG_SCD}, INT_MIN, INT_MAX, V|F, .unit = "flags" }, {NULL} }; -AVFILTER_DEFINE_CLASS(framerate); +AVFILTER_DEFINE_CLASS(fruc_vulkan); static double get_scene_score(AVFilterContext *ctx, AVFrame *crnt, AVFrame *next) { - FrameRateContext *s = ctx->priv; + FRUCVulkanContext *s = ctx->priv; double ret = 0; ff_dlog(ctx, "get_scene_score()\n"); @@ -91,7 +134,7 @@ typedef struct ThreadData { static int filter_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs) { - FrameRateContext *s = ctx->priv; + FRUCVulkanContext *s = ctx->priv; ThreadData *td = arg; AVFrame *work = s->work; AVFrame *src1 = td->copy_src1; @@ -117,11 +160,11 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs) static int blend_frames(AVFilterContext *ctx, int interpolate) { - FrameRateContext *s = ctx->priv; + FRUCVulkanContext *s = ctx->priv; AVFilterLink *outlink = ctx->outputs[0]; double interpolate_scene_score = 0; - if ((s->flags & FRAMERATE_FLAG_SCD)) { + if ((s->flags & FRUC_VULKAN_FLAG_SCD)) { if (s->score >= 0.0) interpolate_scene_score = s->score; else @@ -153,7 +196,7 @@ static int blend_frames(AVFilterContext *ctx, int interpolate) static int process_work_frame(AVFilterContext *ctx) { - FrameRateContext *s = ctx->priv; + FRUCVulkanContext *s = ctx->priv; int64_t work_pts; int64_t interpolate, interpolate8; int ret; @@ -203,14 +246,14 @@ static int process_work_frame(AVFilterContext *ctx) static av_cold int init(AVFilterContext *ctx) { - FrameRateContext *s = ctx->priv; + FRUCVulkanContext *s = ctx->priv; s->start_pts = AV_NOPTS_VALUE; return 0; } static av_cold void uninit(AVFilterContext *ctx) { - FrameRateContext *s = ctx->priv; + FRUCVulkanContext *s = ctx->priv; av_frame_free(&s->f0); av_frame_free(&s->f1); } @@ -253,7 +296,7 @@ static void blend_frames##nbits##_c(BLEND_FUNC_PARAMS) \ BLEND_FRAME_FUNC(8) BLEND_FRAME_FUNC(16) -void ff_framerate_init(FrameRateContext *s) +static void fruc_vulkan_blend_init(FRUCVulkanContext *s) { if (s->bitdepth == 8) { s->blend_factor_max = 1 << BLEND_FACTOR_DEPTH(8); @@ -262,15 +305,12 @@ void ff_framerate_init(FrameRateContext *s) s->blend_factor_max = 1 << BLEND_FACTOR_DEPTH(16); s->blend = blend_frames16_c; } -#if ARCH_X86 && HAVE_X86ASM - ff_framerate_init_x86(s); -#endif } static int config_input(AVFilterLink *inlink) { AVFilterContext *ctx = inlink->dst; - FrameRateContext *s = ctx->priv; + FRUCVulkanContext *s = ctx->priv; const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(inlink->format); int plane; @@ -288,7 +328,7 @@ static int config_input(AVFilterLink *inlink) s->srce_time_base = inlink->time_base; - ff_framerate_init(s); + fruc_vulkan_blend_init(s); return 0; } @@ -298,7 +338,7 @@ static int activate(AVFilterContext *ctx) int ret, status; AVFilterLink *inlink = ctx->inputs[0]; AVFilterLink *outlink = ctx->outputs[0]; - FrameRateContext *s = ctx->priv; + FRUCVulkanContext *s = ctx->priv; AVFrame *inpicref; int64_t pts; @@ -374,7 +414,7 @@ static int config_output(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; FilterLink *l = ff_filter_link(outlink); - FrameRateContext *s = ctx->priv; + FRUCVulkanContext *s = ctx->priv; int exact; ff_dlog(ctx, "config_output()\n"); @@ -416,7 +456,7 @@ static int config_output(AVFilterLink *outlink) return 0; } -static const AVFilterPad framerate_inputs[] = { +static const AVFilterPad fruc_vulkan_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, @@ -424,7 +464,7 @@ static const AVFilterPad framerate_inputs[] = { }, }; -static const AVFilterPad framerate_outputs[] = { +static const AVFilterPad fruc_vulkan_outputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, @@ -432,16 +472,16 @@ static const AVFilterPad framerate_outputs[] = { }, }; -const FFFilter ff_vf_framerate = { - .p.name = "framerate", +const FFFilter ff_vf_fruc_vulkan = { + .p.name = "fruc_vulkan", .p.description = NULL_IF_CONFIG_SMALL("Upsamples or downsamples progressive source between specified frame rates."), - .p.priv_class = &framerate_class, + .p.priv_class = &fruc_vulkan_class, .p.flags = AVFILTER_FLAG_SLICE_THREADS, - .priv_size = sizeof(FrameRateContext), + .priv_size = sizeof(FRUCVulkanContext), .init = init, .uninit = uninit, - FILTER_INPUTS(framerate_inputs), - FILTER_OUTPUTS(framerate_outputs), + FILTER_INPUTS(fruc_vulkan_inputs), + FILTER_OUTPUTS(fruc_vulkan_outputs), FILTER_PIXFMTS_ARRAY(pix_fmts), .activate = activate, }; -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
