diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2012-05-02 18:29:12 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2012-05-02 18:29:12 +0400 |
commit | 1d2e1018f7babf913d2f6d09f921d3137a8999fa (patch) | |
tree | fae6ba9226dbf3d109813ac14edce237073459f3 /source/blender/nodes | |
parent | 5c5349e086144657236d1638c893bd7866979f01 (diff) |
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.)
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/composite/nodes/node_composite_blur.c | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c index 354bb458ea9..5675acbe084 100644 --- a/source/blender/nodes/composite/nodes/node_composite_blur.c +++ b/source/blender/nodes/composite/nodes/node_composite_blur.c @@ -605,36 +605,40 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN 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 */ |