diff options
author | Paul B Mahol <onemda@gmail.com> | 2019-09-16 18:41:51 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2019-09-16 18:43:11 +0200 |
commit | 6f4ec4d909cc6dae5ce51f95e7518f2553215dc8 (patch) | |
tree | afe9a6d6941d49b69c809d0eff61de0ea06fe686 /libavfilter | |
parent | 05ffaa252ee89d1f21a140b995b162a6f68da0fa (diff) |
avfilter/vf_v360: add slice threading to remap calculation
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/vf_v360.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c index 6cccb2570f..d5b94cf747 100644 --- a/libavfilter/vf_v360.c +++ b/libavfilter/vf_v360.c @@ -2162,7 +2162,7 @@ static void set_dimensions(int *outw, int *outh, int w, int h, const AVPixFmtDes } // Calculate remap data -static av_always_inline void v360_filter(AVFilterContext *ctx) +static av_always_inline int v360_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) { V360Context *s = ctx->priv; @@ -2172,11 +2172,13 @@ static av_always_inline void v360_filter(AVFilterContext *ctx) const int height = s->pr_height[p]; const int in_width = s->inplanewidth[p]; const int in_height = s->inplaneheight[p]; + const int slice_start = (height * jobnr ) / nb_jobs; + const int slice_end = (height * (jobnr + 1)) / nb_jobs; float du, dv; float vec[3]; XYRemap rmap; - for (int j = 0; j < height; j++) { + for (int j = slice_start; j < slice_end; j++) { for (int i = 0; i < width; i++) { uint16_t *u = s->u[p] + (j * uv_linesize + i) * s->elements; uint16_t *v = s->v[p] + (j * uv_linesize + i) * s->elements; @@ -2200,6 +2202,8 @@ static av_always_inline void v360_filter(AVFilterContext *ctx) } } } + + return 0; } static int config_output(AVFilterLink *outlink) @@ -2493,7 +2497,7 @@ static int config_output(AVFilterLink *outlink) calculate_rotation_matrix(s->yaw, s->pitch, s->roll, s->rot_mat, s->rotation_order); set_mirror_modifier(s->h_flip, s->v_flip, s->d_flip, s->output_mirror_modifier); - v360_filter(ctx); + ctx->internal->execute(ctx, v360_slice, NULL, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); return 0; } |