diff options
author | Clément Bœsch <clement@stupeflix.com> | 2015-12-18 17:44:33 +0300 |
---|---|---|
committer | Clément Bœsch <clement@stupeflix.com> | 2015-12-21 12:30:52 +0300 |
commit | 244766e407fbed6944ada01e9b57bc6c62e36a0d (patch) | |
tree | 1dfaf6bb6680cb8dac729a2d30909dc2282bb8cd /libavfilter/vf_scale.c | |
parent | 484cc66f577ba25c142d73c1c2c6590b01d031c2 (diff) |
lavfi/scale: add nb_slices debug option
Diffstat (limited to 'libavfilter/vf_scale.c')
-rw-r--r-- | libavfilter/vf_scale.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index f2f475e231..ce410e910e 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, slice_h, slice_start, slice_end = 0; + const int nb_slices = FFMIN(scale->nb_slices, link->h); + for (i = 0; i < nb_slices; i++) { + slice_start = slice_end; + slice_end = (link->h * (i+1)) / nb_slices; + 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 } }; |