[FFmpeg-devel] [PATCH] life: add slow_death, life_color and death_color options.

Clément Bœsch ubitux at gmail.com
Sun Dec 11 00:35:26 CET 2011


On Sun, Dec 11, 2011 at 12:26:37AM +0100, Stefano Sabatini wrote:
> On date Saturday 2011-12-10 04:11:10 +0100, Clément Bœsch encoded:
> > On Fri, Dec 09, 2011 at 03:24:59PM +0100, Stefano Sabatini wrote:
> [...]
> > +static void fill_picture_rgb(AVFilterContext *ctx, AVFilterBufferRef *picref)
> > +{
> > +    LifeContext *life = ctx->priv;
> > +    uint8_t *buf = life->buf[life->buf_idx];
> 
> > +    const uint8_t *c1 = life-> mold_color;
> > +    const uint8_t *c2 = life->death_color;
> 
> nit+: you may move these temporaries to the block when they're used.
> 

Sure.

> > +    int i, j;
> > +
> > +    /* fill the output picture with the old grid buffer */
> > +    for (i = 0; i < life->h; i++) {
> > +        uint8_t *p = picref->data[0] + i * picref->linesize[0];
> > +        for (j = 0; j < life->w; j++) {
> > +            uint8_t v = buf[i*life->w + j];
> > +            if (life->mold && v != ALIVE_CELL) {
> > +                int death_age = FFMIN((0xff - v) * life->mold, 0xff);
>  
> > +                *p++ = ((c2[0] << 8) + ((int)c1[0] - (int)c2[0]) * death_age) >> 8;
> > +                *p++ = ((c2[1] << 8) + ((int)c1[1] - (int)c2[1]) * death_age) >> 8;
> > +                *p++ = ((c2[2] << 8) + ((int)c1[2] - (int)c2[2]) * death_age) >> 8;
> 
> then I realized this should be divided by 255, check FAST_DIV255 in
> vf_overlay.c.
> 

Mmh, should we move this code to some common header (in that case which
one?) or should I just duplicate the code...

> Looks good otherwise.

... and commit/push it?

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111211/e558f15e/attachment.asc>


More information about the ffmpeg-devel mailing list