On Tue, Aug 12, 2014 at 05:12:43PM +0200, Paul B Mahol wrote: > On 8/12/14, Clement Boesch <u...@pkh.me> wrote: > > On Tue, Aug 12, 2014 at 11:32:20AM +0000, Paul B Mahol wrote: > >> Signed-off-by: Paul B Mahol <one...@gmail.com> > >> --- > >> libavfilter/vf_perspective.c | 69 > >> +++++++++++++++++++++++++++++++++----------- > >> 1 file changed, 52 insertions(+), 17 deletions(-) > >> > >> diff --git a/libavfilter/vf_perspective.c b/libavfilter/vf_perspective.c > >> index f433226..c5471b0 100644 > >> --- a/libavfilter/vf_perspective.c > >> +++ b/libavfilter/vf_perspective.c > >> @@ -47,10 +47,8 @@ typedef struct PerspectiveContext { > >> int hsub, vsub; > >> int nb_planes; > >> > >> - void (*perspective)(struct PerspectiveContext *s, > >> - uint8_t *dst, int dst_linesize, > >> - uint8_t *src, int src_linesize, > >> - int w, int h, int hsub, int vsub); > >> + int (*perspective)(AVFilterContext *ctx, > >> + void *arg, int job, int nb_jobs); > >> } PerspectiveContext; > >> > >> #define OFFSET(x) offsetof(PerspectiveContext, x) > >> @@ -193,15 +191,34 @@ static int config_input(AVFilterLink *inlink) > >> return 0; > >> } > >> > >> -static void resample_cubic(PerspectiveContext *s, > >> - uint8_t *dst, int dst_linesize, > >> - uint8_t *src, int src_linesize, > >> - int w, int h, int hsub, int vsub) > >> +typedef struct ThreadData { > >> + uint8_t *dst; > >> + int dst_linesize; > >> + uint8_t *src; > >> + int src_linesize; > >> + int w, h; > >> + int hsub, vsub; > >> +} ThreadData; > >> + > >> +static int resample_cubic(AVFilterContext *ctx, void *arg, > >> + int job, int nb_jobs) > >> { > >> + PerspectiveContext *s = ctx->priv; > >> + ThreadData *td = arg; > >> + uint8_t *dst = td->dst; > >> + int dst_linesize = td->dst_linesize; > >> + uint8_t *src = td->src; > >> + int src_linesize = td->src_linesize; > >> + int w = td->w; > >> + int h = td->h; > >> + int hsub = td->hsub; > >> + int vsub = td->vsub; > >> + int start = (h * job) / nb_jobs; > >> + int end = (h * (job+1)) / nb_jobs; > > > > I would guess this doesn't work unless you src += start * src_linesize > > (same for dst) > I do not think so. You can try it.
Ah you're right, my bad. I didn't realize the destination was computed in absolute according to y at every loop. Patch LGTM with the flags change. Thanks, -- Clément B.
pgpdu1M01BD6e.pgp
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel