Le sextidi 16 germinal, an CCXXV, Matthias C. M. Troffaes a écrit : > +#define DEFINE_BLEND(NAME, TYPE, DECL, EXPR) > \ > +static void blend_##NAME##_##TYPE(AVFilterContext *ctx, AVFrame *in, int > plane)\ > +{ > \ > + FrameStepContext *s = ctx->priv; > \ > + DECL > \ > + const int height = s->planeheight[plane]; > \ > + const int width = s->planewidth[plane]; > \ > + const int stride = in->linesize[plane] / sizeof(TYPE); > \ > + TYPE *src = (TYPE *)in->data[plane]; > \ > + uint32_t *dst = s->data[plane]; > \ > + int y, x; > \ > + > \ > + for (y = 0; y < height; y++) { > \ > + for (x = 0; x < width; x++) { > \ > + EXPR; > \ > + } > \ > + src += stride; > \ > + } > \ > +} > + > +#define SET_DECL > +#define SET_EXPR *dst++ = src[x] > +#define ADD_DECL > +#define ADD_EXPR *dst++ += src[x] > +#define DIV_DECL const int frame_blend = s->frame_blend; > +#define DIV_EXPR src[x] = *dst++ / frame_blend > + > +DEFINE_BLEND(set, uint8_t, SET_DECL, SET_EXPR) > +DEFINE_BLEND(set, uint16_t, SET_DECL, SET_EXPR) > +DEFINE_BLEND(add, uint8_t, ADD_DECL, ADD_EXPR) > +DEFINE_BLEND(add, uint16_t, ADD_DECL, ADD_EXPR) > +DEFINE_BLEND(div, uint8_t, DIV_DECL, DIV_EXPR) > +DEFINE_BLEND(div, uint16_t, DIV_DECL, DIV_EXPR)
There is already blending code in vf_framerate and vf_overlay, I think we should not add new similar code without sharing it as much as possible. Regards, -- Nicolas George
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel