[FFmpeg-devel] [PATCH] vf_ass: add yuv overlay

Nicolas George nicolas.george at normalesup.org
Wed Mar 14 14:19:55 CET 2012


Le quintidi 25 ventôse, an CCXX, Jean First a écrit :
> +#define SET_PIXEL_YUV(picref, yuva_color, val, x, y, hsub, vsub) {           \
> +    luma_pos    = ((x)          ) + ((y)          ) * picref->linesize[0]; \
> +    alpha = yuva_color[A] * (val) * 129;                               \
> +    picref->data[0][luma_pos]    = (alpha * yuva_color[Y] + (255*255*129 - alpha) * picref->data[0][luma_pos]   ) >> 23; \
> +    if (((x) & ((1<<(hsub)) - 1)) == 0 && ((y) & ((1<<(vsub)) - 1)) == 0) {\
> +        chroma_pos1 = ((x) >> (hsub)) + ((y) >> (vsub)) * picref->linesize[1]; \
> +        chroma_pos2 = ((x) >> (hsub)) + ((y) >> (vsub)) * picref->linesize[2]; \
> +        picref->data[1][chroma_pos1] = (alpha * yuva_color[U] + (255*255*129 - alpha) * picref->data[1][chroma_pos1]) >> 23; \
> +        picref->data[2][chroma_pos2] = (alpha * yuva_color[V] + (255*255*129 - alpha) * picref->data[2][chroma_pos2]) >> 23; \
> +    }\

This looks like a copy-paste from drawtext.

Code duplication is evil. Please join us in our reflection on how to make
drawutils more useful: maybe

ff_draw_bitmap(FFDrawContext *draw, FFDrawColor *color
               uint8_t *dst[], int dst_stride[],
               uint8_t *src, int src_stride, int src_depth,
               int x, int y);

?

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120314/d2a58105/attachment.asc>


More information about the ffmpeg-devel mailing list