Message ID | 20190524093616.74647-2-lance.lmwang@gmail.com |
---|---|
State | Superseded |
Headers | show |
On 5/24/19, lance.lmwang@gmail.com <lance.lmwang@gmail.com> wrote: > From: Limin Wang <lance.lmwang@gmail.com> > > --- > libavfilter/vf_overlay.c | 52 ++++++++++++++++++++-------------------- > 1 file changed, 26 insertions(+), 26 deletions(-) > > diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c > index b468cedf2e..c1abd3e1b2 100644 > --- a/libavfilter/vf_overlay.c > +++ b/libavfilter/vf_overlay.c > @@ -598,32 +598,32 @@ static inline void alpha_composite(const AVFrame *src, > const AVFrame *dst, > } > } > > -static av_always_inline void blend_slice_yuv(AVFilterContext *ctx, > - AVFrame *dst, const AVFrame > *src, > - int hsub, int vsub, > - int main_has_alpha, > - int x, int y, > - int is_straight, > - int jobnr, int nb_jobs) > -{ > - OverlayContext *s = ctx->priv; > - const int src_w = src->width; > - const int src_h = src->height; > - const int dst_w = dst->width; > - const int dst_h = dst->height; > - > - blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 0, 0, 0, > x, y, main_has_alpha, > - s->main_desc->comp[0].plane, s->main_desc->comp[0].offset, > s->main_desc->comp[0].step, is_straight, 1, > - jobnr, nb_jobs); > - blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 1, hsub, vsub, > x, y, main_has_alpha, > - s->main_desc->comp[1].plane, s->main_desc->comp[1].offset, > s->main_desc->comp[1].step, is_straight, 1, > - jobnr, nb_jobs); > - blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 2, hsub, vsub, > x, y, main_has_alpha, > - s->main_desc->comp[2].plane, s->main_desc->comp[2].offset, > s->main_desc->comp[2].step, is_straight, 1, > - jobnr, nb_jobs); > - > - if (main_has_alpha) > - alpha_composite(src, dst, src_w, src_h, dst_w, dst_h, x, y, jobnr, > nb_jobs); > +static av_always_inline void blend_slice_yuv(AVFilterContext *ctx, > \ > + AVFrame *dst, const AVFrame > *src, \ > + int hsub, int vsub, > \ > + int main_has_alpha, > \ > + int x, int y, > \ > + int is_straight, > \ > + int jobnr, int nb_jobs) > \ > +{ > \ > + OverlayContext *s = ctx->priv; > \ > + const int src_w = src->width; > \ > + const int src_h = src->height; > \ > + const int dst_w = dst->width; > \ > + const int dst_h = dst->height; > \ > + > \ > + blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 0, 0, 0, > x, y, main_has_alpha, \ > + s->main_desc->comp[0].plane, s->main_desc->comp[0].offset, > s->main_desc->comp[0].step, is_straight, 1, \ > + jobnr, nb_jobs); > \ > + blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 1, hsub, vsub, > x, y, main_has_alpha, \ > + s->main_desc->comp[1].plane, s->main_desc->comp[1].offset, > s->main_desc->comp[1].step, is_straight, 1, \ > + jobnr, nb_jobs); > \ > + blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 2, hsub, vsub, > x, y, main_has_alpha, \ > + s->main_desc->comp[2].plane, s->main_desc->comp[2].offset, > s->main_desc->comp[2].step, is_straight, 1, \ > + jobnr, nb_jobs); > \ > + > \ > + if (main_has_alpha) > \ > + alpha_composite(src, dst, src_w, src_h, dst_w, dst_h, x, y, jobnr, > nb_jobs); \ > } > > static av_always_inline void blend_slice_planar_rgb(AVFilterContext *ctx, > -- > 2.21.0 > Why? Does not make sense.
Am Fr., 24. Mai 2019 um 11:36 Uhr schrieb <lance.lmwang@gmail.com>: > > From: Limin Wang <lance.lmwang@gmail.com> > > --- > libavfilter/vf_overlay.c | 52 ++++++++++++++++++++-------------------- > 1 file changed, 26 insertions(+), 26 deletions(-) > > diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c > index b468cedf2e..c1abd3e1b2 100644 > --- a/libavfilter/vf_overlay.c > +++ b/libavfilter/vf_overlay.c > @@ -598,32 +598,32 @@ static inline void alpha_composite(const AVFrame *src, const AVFrame *dst, > } > } > > -static av_always_inline void blend_slice_yuv(AVFilterContext *ctx, > - AVFrame *dst, const AVFrame *src, > - int hsub, int vsub, > - int main_has_alpha, > - int x, int y, > - int is_straight, > - int jobnr, int nb_jobs) > -{ > - OverlayContext *s = ctx->priv; > - const int src_w = src->width; > - const int src_h = src->height; > - const int dst_w = dst->width; > - const int dst_h = dst->height; > - > - blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 0, 0, 0, x, y, main_has_alpha, > - s->main_desc->comp[0].plane, s->main_desc->comp[0].offset, s->main_desc->comp[0].step, is_straight, 1, > - jobnr, nb_jobs); > - blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 1, hsub, vsub, x, y, main_has_alpha, > - s->main_desc->comp[1].plane, s->main_desc->comp[1].offset, s->main_desc->comp[1].step, is_straight, 1, > - jobnr, nb_jobs); > - blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 2, hsub, vsub, x, y, main_has_alpha, > - s->main_desc->comp[2].plane, s->main_desc->comp[2].offset, s->main_desc->comp[2].step, is_straight, 1, > - jobnr, nb_jobs); > - > - if (main_has_alpha) > - alpha_composite(src, dst, src_w, src_h, dst_w, dst_h, x, y, jobnr, nb_jobs); > +static av_always_inline void blend_slice_yuv(AVFilterContext *ctx, \ > + AVFrame *dst, const AVFrame *src, \ > + int hsub, int vsub, \ > + int main_has_alpha, \ > + int x, int y, \ > + int is_straight, \ > + int jobnr, int nb_jobs) \ > +{ \ > + OverlayContext *s = ctx->priv; \ > + const int src_w = src->width; \ > + const int src_h = src->height; \ > + const int dst_w = dst->width; \ > + const int dst_h = dst->height; \ > + \ > + blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 0, 0, 0, x, y, main_has_alpha, \ > + s->main_desc->comp[0].plane, s->main_desc->comp[0].offset, s->main_desc->comp[0].step, is_straight, 1, \ > + jobnr, nb_jobs); \ > + blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 1, hsub, vsub, x, y, main_has_alpha, \ > + s->main_desc->comp[1].plane, s->main_desc->comp[1].offset, s->main_desc->comp[1].step, is_straight, 1, \ > + jobnr, nb_jobs); \ > + blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 2, hsub, vsub, x, y, main_has_alpha, \ > + s->main_desc->comp[2].plane, s->main_desc->comp[2].offset, s->main_desc->comp[2].step, is_straight, 1, \ > + jobnr, nb_jobs); \ > + \ > + if (main_has_alpha) \ > + alpha_composite(src, dst, src_w, src_h, dst_w, dst_h, x, y, jobnr, nb_jobs); \ I believe merging patches 2, 3 and 4 makes understanding them easier. Maybe also add a line to the commit message that this is to simplify a future change. Carl Eugen
On Saturday, May 25, 2019, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote: > Am Fr., 24. Mai 2019 um 11:36 Uhr schrieb <lance.lmwang@gmail.com>: > > > > From: Limin Wang <lance.lmwang@gmail.com> > > > > --- > > libavfilter/vf_overlay.c | 52 ++++++++++++++++++++-------------------- > > 1 file changed, 26 insertions(+), 26 deletions(-) > > > > diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c > > index b468cedf2e..c1abd3e1b2 100644 > > --- a/libavfilter/vf_overlay.c > > +++ b/libavfilter/vf_overlay.c > > @@ -598,32 +598,32 @@ static inline void alpha_composite(const AVFrame > *src, const AVFrame *dst, > > } > > } > > > > -static av_always_inline void blend_slice_yuv(AVFilterContext *ctx, > > - AVFrame *dst, const > AVFrame *src, > > - int hsub, int vsub, > > - int main_has_alpha, > > - int x, int y, > > - int is_straight, > > - int jobnr, int nb_jobs) > > -{ > > - OverlayContext *s = ctx->priv; > > - const int src_w = src->width; > > - const int src_h = src->height; > > - const int dst_w = dst->width; > > - const int dst_h = dst->height; > > - > > - blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 0, 0, > 0, x, y, main_has_alpha, > > - s->main_desc->comp[0].plane, > s->main_desc->comp[0].offset, s->main_desc->comp[0].step, is_straight, 1, > > - jobnr, nb_jobs); > > - blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 1, hsub, > vsub, x, y, main_has_alpha, > > - s->main_desc->comp[1].plane, > s->main_desc->comp[1].offset, s->main_desc->comp[1].step, is_straight, 1, > > - jobnr, nb_jobs); > > - blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 2, hsub, > vsub, x, y, main_has_alpha, > > - s->main_desc->comp[2].plane, > s->main_desc->comp[2].offset, s->main_desc->comp[2].step, is_straight, 1, > > - jobnr, nb_jobs); > > - > > - if (main_has_alpha) > > - alpha_composite(src, dst, src_w, src_h, dst_w, dst_h, x, y, > jobnr, nb_jobs); > > +static av_always_inline void blend_slice_yuv(AVFilterContext *ctx, > \ > > + AVFrame *dst, const > AVFrame *src, \ > > + int hsub, int vsub, > \ > > + int main_has_alpha, > \ > > + int x, int y, > \ > > + int is_straight, > \ > > + int jobnr, int nb_jobs) > \ > > +{ > \ > > + OverlayContext *s = ctx->priv; > \ > > + const int src_w = src->width; > \ > > + const int src_h = src->height; > \ > > + const int dst_w = dst->width; > \ > > + const int dst_h = dst->height; > \ > > + > \ > > + blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 0, 0, > 0, x, y, main_has_alpha, \ > > + s->main_desc->comp[0].plane, > s->main_desc->comp[0].offset, s->main_desc->comp[0].step, is_straight, 1, \ > > + jobnr, nb_jobs); > \ > > + blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 1, hsub, > vsub, x, y, main_has_alpha, \ > > + s->main_desc->comp[1].plane, > s->main_desc->comp[1].offset, s->main_desc->comp[1].step, is_straight, 1, \ > > + jobnr, nb_jobs); > \ > > + blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 2, hsub, > vsub, x, y, main_has_alpha, \ > > + s->main_desc->comp[2].plane, > s->main_desc->comp[2].offset, s->main_desc->comp[2].step, is_straight, 1, \ > > + jobnr, nb_jobs); > \ > > + > \ > > + if (main_has_alpha) > \ > > + alpha_composite(src, dst, src_w, src_h, dst_w, dst_h, x, y, > jobnr, nb_jobs); \ > > I believe merging patches 2, 3 and 4 makes understanding them easier. > Maybe also add a line to the commit message that this is to simplify > a future change. I split into more patch for better code review. That's okay if need to one. For the commit message, please fix with it anyway. > Carl Eugen > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c index b468cedf2e..c1abd3e1b2 100644 --- a/libavfilter/vf_overlay.c +++ b/libavfilter/vf_overlay.c @@ -598,32 +598,32 @@ static inline void alpha_composite(const AVFrame *src, const AVFrame *dst, } } -static av_always_inline void blend_slice_yuv(AVFilterContext *ctx, - AVFrame *dst, const AVFrame *src, - int hsub, int vsub, - int main_has_alpha, - int x, int y, - int is_straight, - int jobnr, int nb_jobs) -{ - OverlayContext *s = ctx->priv; - const int src_w = src->width; - const int src_h = src->height; - const int dst_w = dst->width; - const int dst_h = dst->height; - - blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 0, 0, 0, x, y, main_has_alpha, - s->main_desc->comp[0].plane, s->main_desc->comp[0].offset, s->main_desc->comp[0].step, is_straight, 1, - jobnr, nb_jobs); - blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 1, hsub, vsub, x, y, main_has_alpha, - s->main_desc->comp[1].plane, s->main_desc->comp[1].offset, s->main_desc->comp[1].step, is_straight, 1, - jobnr, nb_jobs); - blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 2, hsub, vsub, x, y, main_has_alpha, - s->main_desc->comp[2].plane, s->main_desc->comp[2].offset, s->main_desc->comp[2].step, is_straight, 1, - jobnr, nb_jobs); - - if (main_has_alpha) - alpha_composite(src, dst, src_w, src_h, dst_w, dst_h, x, y, jobnr, nb_jobs); +static av_always_inline void blend_slice_yuv(AVFilterContext *ctx, \ + AVFrame *dst, const AVFrame *src, \ + int hsub, int vsub, \ + int main_has_alpha, \ + int x, int y, \ + int is_straight, \ + int jobnr, int nb_jobs) \ +{ \ + OverlayContext *s = ctx->priv; \ + const int src_w = src->width; \ + const int src_h = src->height; \ + const int dst_w = dst->width; \ + const int dst_h = dst->height; \ + \ + blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 0, 0, 0, x, y, main_has_alpha, \ + s->main_desc->comp[0].plane, s->main_desc->comp[0].offset, s->main_desc->comp[0].step, is_straight, 1, \ + jobnr, nb_jobs); \ + blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 1, hsub, vsub, x, y, main_has_alpha, \ + s->main_desc->comp[1].plane, s->main_desc->comp[1].offset, s->main_desc->comp[1].step, is_straight, 1, \ + jobnr, nb_jobs); \ + blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 2, hsub, vsub, x, y, main_has_alpha, \ + s->main_desc->comp[2].plane, s->main_desc->comp[2].offset, s->main_desc->comp[2].step, is_straight, 1, \ + jobnr, nb_jobs); \ + \ + if (main_has_alpha) \ + alpha_composite(src, dst, src_w, src_h, dst_w, dst_h, x, y, jobnr, nb_jobs); \ } static av_always_inline void blend_slice_planar_rgb(AVFilterContext *ctx,
From: Limin Wang <lance.lmwang@gmail.com> --- libavfilter/vf_overlay.c | 52 ++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 26 deletions(-)