[FFmpeg-devel] [PATCH 5/5] lavfi/tile: remove usage of link->{cur, out}_buf.
Clément Bœsch
ubitux at gmail.com
Wed Dec 26 21:33:48 CET 2012
On Wed, Dec 26, 2012 at 08:46:24PM +0100, Stefano Sabatini wrote:
> On date Wednesday 2012-12-26 20:33:08 +0100, Clément Bœsch encoded:
> > ---
> > libavfilter/vf_tile.c | 26 +++++++++++++-------------
> > 1 file changed, 13 insertions(+), 13 deletions(-)
> >
> > diff --git a/libavfilter/vf_tile.c b/libavfilter/vf_tile.c
> > index 5f5c6d6..d838ee8 100644
> > --- a/libavfilter/vf_tile.c
> > +++ b/libavfilter/vf_tile.c
> > @@ -40,6 +40,7 @@ typedef struct {
> > unsigned nb_frames;
> > FFDrawContext draw;
> > FFDrawColor blank;
> > + AVFilterBufferRef *out_ref;
> > } TileContext;
> >
> > #define REASONABLE_SIZE 1024
> > @@ -153,10 +154,9 @@ static int end_last_frame(AVFilterContext *ctx)
> > {
> > TileContext *tile = ctx->priv;
> > AVFilterLink *outlink = ctx->outputs[0];
> > - AVFilterBufferRef *out_buf = outlink->out_buf;
> > + AVFilterBufferRef *out_buf = tile->out_ref;
> > int ret;
> >
> > - outlink->out_buf = NULL;
> > while (tile->current < tile->nb_frames)
> > draw_blank_frame(ctx, out_buf);
> > ret = ff_filter_frame(outlink, out_buf);
> > @@ -176,29 +176,29 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
> > unsigned x0, y0;
> >
> > if (!tile->current) {
> > - outlink->out_buf = ff_get_video_buffer(outlink, AV_PERM_WRITE,
> > - outlink->w, outlink->h);
> > - if (!outlink->out_buf)
> > + tile->out_ref = ff_get_video_buffer(outlink, AV_PERM_WRITE,
> > + outlink->w, outlink->h);
> > + if (!tile->out_ref)
> > return AVERROR(ENOMEM);
> > - avfilter_copy_buffer_ref_props(outlink->out_buf, picref);
> > - outlink->out_buf->video->w = outlink->w;
> > - outlink->out_buf->video->h = outlink->h;
> > + avfilter_copy_buffer_ref_props(tile->out_ref, picref);
> > + tile->out_ref->video->w = outlink->w;
> > + tile->out_ref->video->h = outlink->h;
> >
> > /* fill surface once for margin/padding */
> > if (tile->margin || tile->padding)
> > ff_fill_rectangle(&tile->draw, &tile->blank,
> > - outlink->out_buf->data,
> > - outlink->out_buf->linesize,
> > + tile->out_ref->data,
> > + tile->out_ref->linesize,
> > 0, 0, outlink->w, outlink->h);
> > }
> >
> > get_current_tile_pos(ctx, &x0, &y0);
> > ff_copy_rectangle2(&tile->draw,
> > - outlink->out_buf->data, outlink->out_buf->linesize,
> > - inlink ->cur_buf->data, inlink ->cur_buf->linesize,
> > + tile->out_ref->data, tile->out_ref->linesize,
> > + picref->data, picref->linesize,
> > x0, y0, 0, 0, inlink->w, inlink->h);
> >
> > - avfilter_unref_bufferp(&inlink->cur_buf);
> > + avfilter_unref_bufferp(&picref);
>
> Make sure to clean out_ref in uninit, should be fine otherwise,
> thanks.
It's not needed; we unref all the input, and the out_buf is transmitted to
ff_filter_frame() all the time.
Applied.
--
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/20121226/54045f6c/attachment.asc>
More information about the ffmpeg-devel
mailing list