[FFmpeg-devel] RGB24 lavfi source
Michael Niedermayer
michaelni
Sun Jan 11 00:19:49 CET 2009
On Sun, Jan 04, 2009 at 02:58:49AM +0100, Stefano Sabatini wrote:
> On date Saturday 2009-01-03 19:44:01 +0100, V?ctor Paesa encoded:
> > Hi,
> >
> > Stefano Sabatini said:
> > > Hi, the simplest (yet somehow useful) source.
> >
> > Why not RGB32? Besides allowing alpha, you could write 32 bits at a time,
> > instead of 3 8-bit writes per pixel.
>
> Good idea, thanks.
[...]
> static void fill_picture(ARGBContext *ctx, AVFilterPicRef *picref, int y, int h)
> {
> uint32_t *p, *end, val;
>
> /* packed ARGB: ARGBARGBARGB... */
> #ifdef WORDS_BIGENDIAN
> val = ctx->a<<24 | ctx->r<<16 | ctx->g<<8 | ctx->b;
> #else
> val = ctx->b<<24 | ctx->g<<16 | ctx->r<<8 | ctx->a;
> #endif
> p = (uint32_t*)(picref->data[0] + picref->linesize[0] * y);
> end = p + picref->linesize[0] * h / 4;
> while (p < end)
> *p++ = val;
> }
* linesize can be negative
* linesize can be much larger than width*pixel_size this does not give
you the permission to overwrite the pixels outside 0..width
>
> #define SLICE_SIZE 32
16 or smaller is better and it should not be hardcoded in each filter IMHO
>
> static int request_frame(AVFilterLink *link)
> {
> ARGBContext *ctx = link->src->priv;
> AVFilterPicRef *picref = avfilter_get_video_buffer(link, AV_PERM_WRITE);
> int y, h;
>
> picref->pts = av_rescale_q(ctx->pts++, (AVRational){ ctx->frame_rate.den, ctx->frame_rate.num }, AV_TIME_BASE_Q);
store a timebase instead of framerate and you dont have to ^-1 it here
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090111/5d8970ba/attachment.pgp>
More information about the ffmpeg-devel
mailing list