[FFmpeg-devel] [PATCH] lavfi/scale: add nb_slices debug option

Nicolas George george at nsup.org
Sat Dec 19 11:00:53 CET 2015


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);
	    ...
	}

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151219/18bf0dca/attachment.sig>


More information about the ffmpeg-devel mailing list