[FFmpeg-devel] [PATCH] param check in sws_getCachedContext()
Michael Niedermayer
michaelni
Wed Jan 16 17:44:54 CET 2008
On Thu, Jan 17, 2008 at 12:15:23AM +0900, KO Myung-Hun wrote:
> Hi/2.
>
> Michael Niedermayer wrote:
> > On Wed, Jan 09, 2008 at 07:15:19PM +0900, KO Myung-Hun wrote:
> >
> >> Hi/2.
> >>
> >> sws_getCachecContext() always calls sws_getContext() if 'param' is NULL
> >> or its address is changed.
> >>
> >> So, 'param' should be checked as the patch.
> >>
> >> --
> >> KO Myung-Hun
> >>
> >> Using Mozilla SeaMonkey 1.1.7
> >> Under OS/2 Warp 4 for Korean with FixPak #15
> >> On AMD ThunderBird 750 MHz with 512 MB RAM
> >>
> >> Korean OS/2 User Community : http://www.ecomstation.co.kr
> >>
> >>
> >>
> >
> >
> >> Index: libswscale/swscale.c
> >> ===================================================================
> >> --- libswscale/swscale.c (revision 25625)
> >> +++ libswscale/swscale.c (working copy)
> >> @@ -2964,7 +2964,8 @@
> >> (context->srcFormat != srcFormat) ||
> >> (context->dstW != dstW) || (context->dstH != dstH) ||
> >> (context->dstFormat != dstFormat) || (context->flags != flags) ||
> >> - (context->param != param))
> >> + (param && (( context->param[ 0 ] != param[ 0 ] ) || ( context->param[ 1 ] != param[ 1 ] ))) ||
> >> + (!param && (( context->param[ 0 ] != SWS_PARAM_DEFAULT ) || ( context->param[ 1 ] != SWS_PARAM_DEFAULT ))))
> >> {
> >>
> >
> > i think
> > double default_param[2]= {SWS_PARAM_DEFAULT, SWS_PARAM_DEFAULT};
> > if(!param){
> > param= default_param;
> >
> > and
> >
> > memcmp(context->param, param, sizeof(context->param))
> >
> > to be clearer
> >
>
> Ah, good.
>
> How about this ?
[...]
> Index: libswscale/swscale.c
> ===================================================================
> --- libswscale/swscale.c (revision 25625)
> +++ libswscale/swscale.c (working copy)
> @@ -2959,12 +2959,17 @@
> int dstW, int dstH, int dstFormat, int flags,
> SwsFilter *srcFilter, SwsFilter *dstFilter, double *param)
> {
> + static double default_param[ 2 ] = { SWS_PARAM_DEFAULT, SWS_PARAM_DEFAULT };
static const
> +
> + if( !param )
> + param = default_param;
> +
> if (context != NULL) {
> if ((context->srcW != srcW) || (context->srcH != srcH) ||
> (context->srcFormat != srcFormat) ||
> (context->dstW != dstW) || (context->dstH != dstH) ||
> (context->dstFormat != dstFormat) || (context->flags != flags) ||
> - (context->param != param))
> + (context->param[ 0 ] != param[ 0 ]) || (context->param[ 1 ] != param[ 1 ]))
and please loose the extra spaces inside () {} []
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080116/ed89adc4/attachment.pgp>
More information about the ffmpeg-devel
mailing list