[Ffmpeg-devel] [PATCH] drawtext.c: 05 rewrite draw_box using memset()
Michael Niedermayer
michaelni
Tue Sep 12 21:38:58 CEST 2006
Hi
On Sun, Sep 10, 2006 at 04:37:41PM -0300, Gustavo Sverzut Barbieri wrote:
[...]
> + hx = x >> 1;
> + hy = y >> 1;
> + hwidth = width >> 1;
> + hheight = height >> 1;
>
> + top[0] = picture->linesize[0] * y + x;
> + top[1] = picture->linesize[1] * hy + hx;
> + top[2] = picture->linesize[2] * hy + hx;
> +
> + for (j = 0; j < hheight; j++)
> + {
> + memset(picture->data[0] + top[0], yuv_color[0], width);
> + top[0] += picture->linesize[0];
> +
> + memset(picture->data[0] + top[0], yuv_color[0], width);
> + top[0] += picture->linesize[0];
> +
> + memset(picture->data[1] + top[1], yuv_color[1], hwidth);
> + top[1] += picture->linesize[1];
> +
> + memset(picture->data[2] + top[2], yuv_color[2], hwidth);
> + top[2] += picture->linesize[2];
> + }
> }
maybe something like the following could be used to simplify this
for (j = 0; j < hheight; j++){
for(c=0; c<4; c++){
int plane= ((int[]){0,0,1,2})[c];
memset(picture->data[plane] + top[plane], yuv_color[plane], width >> !!plane);
top[plane] += picture->linesize[plane];
}
}
of course only if its not slower
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is
More information about the ffmpeg-devel
mailing list