On Fri, Dec 18, 2015 at 04:33:18PM +0100, Nicolas George wrote: > L'octidi 28 frimaire, an CCXXIV, Clement Boesch a écrit : > > + const int slice_h = FFMAX(1, link->h / scale->nb_slices); > > + for (i = 0; i < scale->nb_slices; i++) > > + scale_slice(link, out, in, scale->sws, i*slice_h, slice_h, 1, > > 0); > > What happens if link->h is not a multiple of nb_slices? >
That wasn't very rigorous, sorry. New patch attached. Note: the option is not really documented since it doesn't serve any purpose aside from debugging slicing, and not from a threading perspective, but more like a locality, as in CPU cache wise apparently. -- Clément B.
From 43b22797e4b549e2b3eedbfe5ee5734ed97f2521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= <clem...@stupeflix.com> Date: Fri, 18 Dec 2015 15:44:33 +0100 Subject: [PATCH] lavfi/scale: add nb_slices debug option --- libavfilter/vf_scale.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index f2f475e..0d5f79a 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -110,6 +110,8 @@ typedef struct ScaleContext { int in_v_chr_pos; int force_original_aspect_ratio; + + int nb_slices; } ScaleContext; AVFilter ff_vf_scale2ref; @@ -575,6 +577,15 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) if(scale->interlaced>0 || (scale->interlaced<0 && in->interlaced_frame)){ scale_slice(link, out, in, scale->isws[0], 0, (link->h+1)/2, 2, 0); scale_slice(link, out, in, scale->isws[1], 0, link->h /2, 2, 1); + }else if (scale->nb_slices) { + int i; + const int nb_slices = FFMIN(scale->nb_slices, link->h); + for (i = 0; i < nb_slices; i++) { + const int slice_start = (link->h * i ) / nb_slices; + const int slice_end = (link->h * (i+1)) / nb_slices; + const int slice_h = slice_end - slice_start; + scale_slice(link, out, in, scale->sws, slice_start, slice_h, 1, 0); + } }else{ scale_slice(link, out, in, scale->sws, 0, link->h, 1, 0); } @@ -651,6 +662,7 @@ static const AVOption scale_options[] = { { "increase", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 2 }, 0, 0, FLAGS, "force_oar" }, { "param0", "Scaler param 0", OFFSET(param[0]), AV_OPT_TYPE_DOUBLE, { .dbl = SWS_PARAM_DEFAULT }, INT_MIN, INT_MAX, FLAGS }, { "param1", "Scaler param 1", OFFSET(param[1]), AV_OPT_TYPE_DOUBLE, { .dbl = SWS_PARAM_DEFAULT }, INT_MIN, INT_MAX, FLAGS }, + { "nb_slices", "set the number of slices (debug purpose only)", OFFSET(nb_slices), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS }, { NULL } }; -- 2.6.4
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel