[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46193] trunk/blender/source/blender/nodes /composite/nodes/node_composite_blur.c: Small enhancement to Fast Gaussian compo blur node: do not compute when size is below 0.001!

Daniel Salazar - 3Developer.com zanqdo at gmail.com
Thu May 3 06:16:21 CEST 2012


This makes fast Gaussian crash instantly.. seems to me that there's
*very low* testing of this hacks before committing!

Daniel Salazar
patazstudio.com


On Wed, May 2, 2012 at 8:29 AM, Bastien Montagne <montagne29 at wanadoo.fr> wrote:
> Revision: 46193
>          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46193
> Author:   mont29
> Date:     2012-05-02 14:29:12 +0000 (Wed, 02 May 2012)
> Log Message:
> -----------
> Small enhancement to Fast Gaussian compo blur node: do not compute when size is below 0.001!
>
> (Was already checked/done for other blur algos, can be annoying when you animate the blur size to apply it only on a few frames.)
>
> Modified Paths:
> --------------
>    trunk/blender/source/blender/nodes/composite/nodes/node_composite_blur.c
>
> Modified: trunk/blender/source/blender/nodes/composite/nodes/node_composite_blur.c
> ===================================================================
> --- trunk/blender/source/blender/nodes/composite/nodes/node_composite_blur.c    2012-05-02 14:23:00 UTC (rev 46192)
> +++ trunk/blender/source/blender/nodes/composite/nodes/node_composite_blur.c    2012-05-02 14:29:12 UTC (rev 46193)
> @@ -605,36 +605,40 @@
>                out[0]->data= new;
>        }
>        else if (nbd->filtertype == R_FILTER_FAST_GAUSS) {
> -               CompBuf *new, *img = in[0]->data;
> -               // TODO: can this be mapped with reference, too?
> -               const float sx = ((float)nbd->sizex*in[1]->vec[0])/2.0f, sy = ((float)nbd->sizey*in[1]->vec[0])/2.0f;
> -               int c;
> +               if (in[1]->vec[0] < 0.001f) { /* time node inputs can be a tiny value */
> +                       new = pass_on_compbuf(img);
> +               }
> +               else {
> +                       CompBuf *new, *img = in[0]->data;
> +                       // TODO: can this be mapped with reference, too?
> +                       const float sx = ((float)nbd->sizex*in[1]->vec[0])/2.0f, sy = ((float)nbd->sizey*in[1]->vec[0])/2.0f;
> +                       int c;
>
> -               if ((img==NULL) || (out[0]->hasoutput==0)) return;
> +                       if ((img==NULL) || (out[0]->hasoutput==0)) return;
>
> -               if (img->type == CB_VEC2)
> -                       new = typecheck_compbuf(img, CB_VAL);
> -               else if (img->type == CB_VEC3)
> -                       new = typecheck_compbuf(img, CB_RGBA);
> -               else
> -                       new = dupalloc_compbuf(img);
> +                       if (img->type == CB_VEC2)
> +                               new = typecheck_compbuf(img, CB_VAL);
> +                       else if (img->type == CB_VEC3)
> +                               new = typecheck_compbuf(img, CB_RGBA);
> +                       else
> +                               new = dupalloc_compbuf(img);
>
> -               if ((sx == sy) && (sx > 0.f)) {
> -                       for (c=0; c<new->type; ++c)
> -                               IIR_gauss(new, sx, c, 3);
> -               }
> -               else {
> -                       if (sx > 0.f) {
> +                       if ((sx == sy) && (sx > 0.f)) {
>                                for (c=0; c<new->type; ++c)
> -                                       IIR_gauss(new, sx, c, 1);
> +                                       IIR_gauss(new, sx, c, 3);
>                        }
> -                       if (sy > 0.f) {
> -                               for (c=0; c<new->type; ++c)
> -                                       IIR_gauss(new, sy, c, 2);
> +                       else {
> +                               if (sx > 0.f) {
> +                                       for (c=0; c<new->type; ++c)
> +                                               IIR_gauss(new, sx, c, 1);
> +                               }
> +                               if (sy > 0.f) {
> +                                       for (c=0; c<new->type; ++c)
> +                                               IIR_gauss(new, sy, c, 2);
> +                               }
>                        }
>                }
>                out[0]->data = new;
> -
>        }
>        else {
>                /* All non fast gauss blur methods */
>
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs


More information about the Bf-committers mailing list