[FFmpeg-devel] [PATCH 1/2] mandelbrot: remove always-false condition in fill_from_cache

Michael Niedermayer michaelni at gmx.at
Sun Nov 13 17:21:55 CET 2011


On Sun, Nov 13, 2011 at 04:46:44PM +0100, Giorgio Vazzana wrote:
> Hello,
> 
> I noticed this while studying the new cache code. Please comment :)

>  vsrc_mandelbrot.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> cd78ecfb09f9d7260f8cdd5da989c78d205b5f17  0001-mandelbrot-remove-always-false-condition-in-fill_fro.patch
> From 05d1b40ae6c5ae7de3ede8c44ad230e0428391d2 Mon Sep 17 00:00:00 2001
> From: Giorgio Vazzana <mywing81 at gmail.com>
> Date: Sun, 13 Nov 2011 13:51:09 +0100
> Subject: [PATCH 1/2] mandelbrot: remove always-false condition in fill_from_cache
> 
> ---
>  libavfilter/vsrc_mandelbrot.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/libavfilter/vsrc_mandelbrot.c b/libavfilter/vsrc_mandelbrot.c
> index 375ec7c..490224b 100644
> --- a/libavfilter/vsrc_mandelbrot.c
> +++ b/libavfilter/vsrc_mandelbrot.c
> @@ -144,7 +144,7 @@ static void fill_from_cache(AVFilterContext *ctx, uint32_t *color, int *in_cidx,
>      for(; *in_cidx < mb->cache_used; (*in_cidx)++){
>          Point *p= &mb->point_cache[*in_cidx];
>          int x;
> -        if(*in_cidx >= mb->cache_used || p->p[1] > py)
> +        if(p->p[1] > py)
>              break;

i think this is wrong, i didnt check though but
when the zoom factor becomes big enough the double precission floats
will no longer be able to represent the screen pixel positions and
at that point the cache fills up and wont be able to hold all
values anymore.
I think at this point this condition can become true.
also it could become true when we zoom out instead of in

[....]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111113/b1d913ee/attachment.asc>


More information about the ffmpeg-devel mailing list