[FFmpeg-devel] [PATCHv2] avfilter/vsrc_mandelbrot: avoid sqrt for epsilon calculation
Michael Niedermayer
michaelni at gmx.at
Tue Nov 24 20:28:30 CET 2015
On Tue, Nov 24, 2015 at 12:02:24PM -0500, Ganesh Ajjanagadde wrote:
> This rewrites into a similar expression avoiding sqrt. Similarity is
> assured since sqrt(x^2 + y^2)/(x+y) lies in [1/sqrt(2), 1] for x, y > 0.
>
> Tested on x86-64, Haswell, GNU/Linux.
> Command:
> ffmpeg -f lavfi -i mandelbrot -f null -
>
> old (draw_mandelbrot):
> 277625266 decicycles in draw_mandelbrot, 256 runs, 0 skips
> 304527322 decicycles in draw_mandelbrot, 512 runs, 0 skips
> 377593582 decicycles in draw_mandelbrot, 1024 runs, 0 skips
> 338539499 decicycles in draw_mandelbrot, 2048 runs, 0 skips
> 583630357 decicycles in draw_mandelbrot, 4096 runs, 0 skips
>
> new (draw_mandelbrot):
> 274635709 decicycles in draw_mandelbrot, 256 runs, 0 skips
> 300287046 decicycles in draw_mandelbrot, 512 runs, 0 skips
> 371819935 decicycles in draw_mandelbrot, 1024 runs, 0 skips
> 336663765 decicycles in draw_mandelbrot, 2048 runs, 0 skips
> 581851016 decicycles in draw_mandelbrot, 4096 runs, 0 skips
>
> Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> ---
> libavfilter/vsrc_mandelbrot.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
LGTM
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151124/d64fcfd2/attachment.sig>
More information about the ffmpeg-devel
mailing list