On Sat, Dec 19, 2015 at 11:00:53AM +0100, Nicolas George wrote:
> L'octidi 28 frimaire, an CCXXIV, Clement Boesch a écrit :
> > +    }else if (scale->nb_slices) {
> > +        int i;
> > +        const int nb_slices = FFMIN(scale->nb_slices, link->h);
> > +        for (i = 0; i < nb_slices; i++) {
> > +            const int slice_start = (link->h *  i   ) / nb_slices;
> > +            const int slice_end   = (link->h * (i+1)) / nb_slices;
> > +            const int slice_h     = slice_end - slice_start;
> > +            scale_slice(link, out, in, scale->sws, slice_start, slice_h, 
> > 1, 0);
> > +        }
> 
> You can do simpler and more robust by computing the boundary only once
> (using av_rescale to also avoid overflows):
> 
>       int i, slice_start, slice_end = slice_start;
>       for (i = 0; i < nb_slices; i++) {
>           slice_start = slice_end;
>           slice_end = av_rescale(link->h, i + 1, nb_slices);
>           ...
>       }
> 

Changed and applied. I didn't pick the av_rescale change though, since I'm
not exactly sure about the rounding. Also, such overflows are not handled
in so many part of lavfi that many things will explode before this if they
can be triggered.

-- 
Clément B.

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to