[FFmpeg-devel] [PATCH] param check in sws_getCachedContext()

KO Myung-Hun komh
Wed Jan 16 20:42:07 CET 2008


Hi/2.

Michael Niedermayer wrote:
> 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
>
>
>   

Ok.

>> +
>> +    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 () {} []
>
>   

Ok. I've attached a new 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


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: swscale.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080117/65d5ab07/attachment.asc>



More information about the ffmpeg-devel mailing list