[Ffmpeg-devel] [PATCH] Add sws_getCachedContext() to swscalelibrary

Guillaume POIRIER poirierg
Mon Sep 4 11:39:36 CEST 2006


Hi,

On 9/4/06, Michael Niedermayer <michaelni at gmx.at> wrote:

> On Thu, Aug 31, 2006 at 11:06:53PM +0200, V?ctor Paesa wrote:
> > Hi,
> >
> > > Hi
> > >
> > > On Thu, Aug 31, 2006 at 07:15:42PM +0200, V?ctor Paesa wrote:
> > >> Hi,
> > >>
> > >> While porting the vhooks to swscale I found myself copying&pasting
> > >> the same code over and over, to support streams that change dimensions.
> > >>
> > >> This function sws_getCachedContext() in the attached patch would save me
> > >> a lot of typing, plus increasing legibility.
> > >
> > > iam fine with the patch, except that a non zero filter forces a reinit
> > > IMHO it would be better to assume that the filters didnt change
> > >
> >
> > OK, here is a new patch with that asumption.
> [...]
> > +/**
> > + * Checks if context is valid or reallocs a new one instead.
> > + * If context is NULL, just calls sws_getContext() to get a new one.
> > + * Otherwise, checks if the parameters are the same already saved in context.
> > + * If that is the case, returns the current context.
> > + * Otherwise, frees context and gets a new one.
> > + *
> > + * Be warned that srcFilter, dstFilter are not checked, they are
> > + * asumed to remain valid.
> > + */
> [...]
> > +/**
> > + * Checks if context is valid or reallocs a new one instead.
> > + * If context is NULL, just calls sws_getContext() to get a new one.
> > + * Otherwise, checks if the parameters are the same already saved in context.
> > + * If that is the case, returns the current context.
> > + * Otherwise, frees context and gets a new one.
> > + *
> > + * Be warned that srcFilter, dstFilter are not checked, they are
> > + * asumed to remain valid.
> > + */
>
> that comment shouldnt be duplicated, except that iam fine wirh te patch

I stripped the one on the .h, as there weren't any previously, and
there's a lot more on the .c. If necessary, this can be changed later.

Committed.

Guillaume
-- 
A thing is not necessarily true because a man dies for it.
-- Oscar Wilde




More information about the ffmpeg-devel mailing list