[FFmpeg-devel] [PATCH 09/10] avfilter/vsrc_mandelbrot: use hypot()

Michael Niedermayer michaelni at gmx.at
Sun Nov 22 21:07:36 CET 2015


On Sun, Nov 22, 2015 at 12:05:49PM -0500, Ganesh Ajjanagadde wrote:
> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> ---
>  libavfilter/vsrc_mandelbrot.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavfilter/vsrc_mandelbrot.c b/libavfilter/vsrc_mandelbrot.c
> index 950c5c8..a0c101e 100644
> --- a/libavfilter/vsrc_mandelbrot.c
> +++ b/libavfilter/vsrc_mandelbrot.c
> @@ -291,7 +291,7 @@ static void draw_mandelbrot(AVFilterContext *ctx, uint32_t *color, int linesize,
>  
>              use_zyklus= (x==0 || s->inner!=BLACK ||color[x-1 + y*linesize] == 0xFF000000);
>              if(use_zyklus)
> -                epsilon= scale*1*sqrt(SQR(x-s->w/2) + SQR(y-s->h/2))/s->w;
> +                epsilon= scale*hypot(x-s->w/2, y-s->h/2)/s->w;

old:
 704 decicycles in hypo, 1048570 runs,      6 skips

new:
1075 decicycles in hypo, 1048566 runs,     10 skips

that is from START/STOP_TIMER over hypot()

the code is speed relevant as its executed per pixel

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle
-------------- 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/20151122/27a3ed82/attachment.sig>


More information about the ffmpeg-devel mailing list