[FFmpeg-devel] RGB24 lavfi source
Stefano Sabatini
stefano.sabatini-lala
Sun May 3 15:45:16 CEST 2009
On date Sunday 2009-01-11 00:19:49 +0100, Michael Niedermayer encoded:
> 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
Using 16, a better system for source slicification has still to be provided.
> > 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
Fixed.
The patch requires both the colorutils and the av_set_options_string()
patch to be applied before, I'm posting it just as example of
colorutils usage.
Regards.
--
FFmpeg = Fiendish and Freak Mastodontic Perennial Enchanting God
-------------- next part --------------
A non-text attachment was scrubbed...
Name: implement-vsrc-color.patch
Type: text/x-diff
Size: 5982 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090503/9939abc6/attachment.patch>
More information about the ffmpeg-devel
mailing list