[FFmpeg-devel] lavfi noise generator

Stefano Sabatini stefano.sabatini-lala
Mon Dec 29 13:42:36 CET 2008


On date Monday 2008-12-29 12:06:20 +0100, Vitor Sessak encoded:
> Hi, and thank you for working with lavfi!
> 
> Stefano Sabatini wrote:
> > On date Monday 2008-12-29 00:52:18 +0100, Michael Niedermayer encoded:
> >> On Mon, Dec 29, 2008 at 12:25:02AM +0100, Stefano Sabatini wrote:
> >>> Hi all,
> >>>
> >>> no Michael I'm not posting it for you or others to review it, I'm just
> >> no but i reject it anyway
> >> your code is crap, sorry
> >>
> >> People didnt want to port libmpcodecs when i suggested it, i dont mind
> >> this at all, libmpcodecs has its serious issues but this does not mean i
> >> will accept code that is inferrior than it.
> >>
> >> vf_noise.c should be MUCH faster than your code.
> > 
> > I'm aware of the speed issues, but that wasn't the point of it, I
> > didn't intended it as something ready for production use either
> > inclusion in SVN, but just as a working example, since we currently
> > lack examples besides the other things and the noise generator is
> > a good candidate due to its intrinsic simplicity.
> 
> Indeed, we are lacking good examples of filters in the SoC tree. But 
> exactly for this reason, I think vf_noise.c should fill one slice at a 
> time to give the good example. After this is done, IMO it is welcome to 
> soc svn, at least to serve as a template.

Hi Vitor, vsrc_noise.c is a *source* rather than a filter, so I don't
think it is possible to use the the draw_slice() API. What I'm
currently doing is:

static int request_frame(AVFilterLink *link)
{
    NoiseContext *ctx = link->src->priv;
    AVFilterPicRef *picref = avfilter_get_video_buffer(link, AV_PERM_WRITE);

    fill_picture(ctx, picref);
    picref->pts = av_rescale_q(ctx->pts++, (AVRational){ ctx->frame_rate.den, ctx->frame_rate.num }, AV_TIME_BASE_Q);

    avfilter_start_frame(link, avfilter_ref_pic(picref, ~0));
    avfilter_draw_slice(link, 0, picref->h);
    avfilter_end_frame(link);

    avfilter_unref_pic(picref);

    return 0;
}

But maybe we could extend the API with something like avfilter_request_slice(),
sorry if I'm missing something.

Regards.
-- 
FFmpeg = Faboulous and Fiendish Murdering Programmable Explosive Genius




More information about the ffmpeg-devel mailing list