[FFmpeg-devel] [PATCH] Add scale filter

Stefano Sabatini stefano.sabatini-lala
Fri Oct 30 11:44:13 CET 2009


On date Wednesday 2009-10-28 00:42:43 +0100, Stefano Sabatini encoded:
> On date Tuesday 2009-10-27 13:34:06 +0100, Michael Niedermayer encoded:
[...]
> > this can overflow and it should use av_reduce()
> 
> Changed to:
> 
>     out->outpic->pts = picref->pts;
> 
>     av_reduce(&out->outpic->pixel_aspect.num, &out->outpic->pixel_aspect.den,
>               (int64_t)picref->pixel_aspect.num * out->h * link->w,
>               (int64_t)picref->pixel_aspect.den * out->w * link->h,
>               INT_MAX);
> 
> But there is still the possibility to get an overflow in
> the expressions:
> (int64_t)picref->pixel_aspect.num * out->h * link->w
> (int64_t)picref->pixel_aspect.den * out->w * link->h, 
> 
> I could check for example for:
> (int64_t)out->h * link->w < MAX_INT
> (int64_t)out->w * link->h < MAX_INT
> 
> in config_props() and then eventually fail, but maybe you can suggest
> some more clever way to check it.

Done like this, fixed another possible overflow in config_props() by
using av_rescale(), and applied some variable renames for making the
code more clear.

Regards.
-- 
FFmpeg = Forgiving and Furious Majestic Power Extended Guide
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-scale-filter.patch
Type: text/x-diff
Size: 9284 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091030/822bc515/attachment.patch>



More information about the ffmpeg-devel mailing list