diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-04-21 17:11:51 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-04-21 17:11:51 +0400 |
commit | 210ee1ade4b4ec5b6f2d3710986171a21a4b8604 (patch) | |
tree | 86e27af39ba932f043da2b73463651ff2e40d41c /source/blender/nodes/intern/CMP_nodes | |
parent | 2e9982f420cab3b2ecf4648c0a91403f757ef9fe (diff) |
whitespace only, no functional change mixed tabs/spaces --> tabs.v2.57a
Diffstat (limited to 'source/blender/nodes/intern/CMP_nodes')
5 files changed, 86 insertions, 85 deletions
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c index fc0e9b3ee4b..94b086f1ba0 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c @@ -88,41 +88,41 @@ static void do_ycca_to_rgba_normalized(bNode *UNUSED(node), float *out, float *i static void do_chroma_key(bNode *node, float *out, float *in) { NodeChroma *c; - float x, z, alpha; - float theta, beta, angle, angle2; - float kfg; + float x, z, alpha; + float theta, beta, angle, angle2; + float kfg; c=node->storage; - /* Algorithm from book "Video Demistified," does not include the spill reduction part */ + /* Algorithm from book "Video Demistified," does not include the spill reduction part */ /* find theta, the angle that the color space should be rotated based on key*/ - theta=atan2(c->key[2], c->key[1]); + theta=atan2(c->key[2], c->key[1]); /*rotate the cb and cr into x/z space */ - x=in[1]*cos(theta)+in[2]*sin(theta); - z=in[2]*cos(theta)-in[1]*sin(theta); + x=in[1]*cos(theta)+in[2]*sin(theta); + z=in[2]*cos(theta)-in[1]*sin(theta); - /*if within the acceptance angle */ - angle=c->t1*M_PI/180.0; /* convert to radians */ - - /* if kfg is <0 then the pixel is outside of the key color */ - kfg=x-(fabs(z)/tan(angle/2.0)); + /*if within the acceptance angle */ + angle=c->t1*M_PI/180.0; /* convert to radians */ + + /* if kfg is <0 then the pixel is outside of the key color */ + kfg=x-(fabs(z)/tan(angle/2.0)); - out[0]=in[0]; - out[1]=in[1]; - out[2]=in[2]; + out[0]=in[0]; + out[1]=in[1]; + out[2]=in[2]; - if(kfg>0.0) { /* found a pixel that is within key color */ - alpha=(1.0-kfg)*(c->fstrength); + if(kfg>0.0) { /* found a pixel that is within key color */ + alpha=(1.0-kfg)*(c->fstrength); - beta=atan2(z,x); - angle2=c->t2*M_PI/180.0; + beta=atan2(z,x); + angle2=c->t2*M_PI/180.0; - /* if beta is within the cutoff angle */ - if(fabs(beta)<(angle2/2.0)) { - alpha=0.0; - } + /* if beta is within the cutoff angle */ + if(fabs(beta)<(angle2/2.0)) { + alpha=0.0; + } /* don't make something that was more transparent less transparent */ if (alpha<in[3]) { diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_crop.c b/source/blender/nodes/intern/CMP_nodes/CMP_crop.c index 5a0e2047ed7..08913575fcf 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_crop.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_crop.c @@ -53,14 +53,14 @@ static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack CompBuf *stackbuf; int x, y; float *srcfp, *outfp; - rcti outputrect; - - if(node->custom2) { - ntxy->x1= cbuf->x* ntxy->fac_x1; - ntxy->x2= cbuf->x* ntxy->fac_x2; - ntxy->y1= cbuf->y* ntxy->fac_y1; - ntxy->y2= cbuf->y* ntxy->fac_y2; - } + rcti outputrect; + + if(node->custom2) { + ntxy->x1= cbuf->x* ntxy->fac_x1; + ntxy->x2= cbuf->x* ntxy->fac_x2; + ntxy->y1= cbuf->y* ntxy->fac_y1; + ntxy->y2= cbuf->y* ntxy->fac_y2; + } /* check input image size */ if(cbuf->x <= ntxy->x1 + 1) diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_math.c b/source/blender/nodes/intern/CMP_nodes/CMP_math.c index 039f7e6fab1..4348fd18759 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_math.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_math.c @@ -102,15 +102,15 @@ static void do_math(bNode *node, float *out, float *in, float *in2) /* Only raise negative numbers by full integers */ if( in[0] >= 0 ) { out[0]= pow(in[0], in2[0]); - } else { - float y_mod_1 = fmod(in2[0], 1); + } else { + float y_mod_1 = fmod(in2[0], 1); /* if input value is not nearly an integer, fall back to zero, nicer than straight rounding */ - if (y_mod_1 > 0.999 || y_mod_1 < 0.001) { - out[0]= pow(in[0], floor(in2[0] + 0.5)); - } else { - out[0] = 0.0; - } - } + if (y_mod_1 > 0.999 || y_mod_1 < 0.001) { + out[0]= pow(in[0], floor(in2[0] + 0.5)); + } else { + out[0] = 0.0; + } + } } break; case 11: /* Logarithm */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c index 14f25aa442b..b6b1764ff0f 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c @@ -49,80 +49,81 @@ static bNodeSocketType cmp_node_rotate_out[]= { /* only supports RGBA nodes now */ static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { - + if(out[0]->hasoutput==0) return; - + if(in[0]->data) { CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA); CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* note, this returns zero'd image */ float rad, u, v, s, c, centx, centy, miny, maxy, minx, maxx; int x, y, yo, xo; - ImBuf *ibuf, *obuf; - + ImBuf *ibuf, *obuf; + rad= (M_PI*in[1]->vec[0])/180.0f; - + s= sin(rad); c= cos(rad); centx= cbuf->x/2; centy= cbuf->y/2; - + minx= -centx; maxx= -centx + (float)cbuf->x; miny= -centy; maxy= -centy + (float)cbuf->y; - - - ibuf=IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0); - obuf=IMB_allocImBuf(stackbuf->x, stackbuf->y, 32, 0); - - if(ibuf && obuf){ - ibuf->rect_float=cbuf->rect; - obuf->rect_float=stackbuf->rect; - - for(y=miny; y<maxy; y++) { - yo= y+(int)centy; - - for(x=minx; x<maxx;x++) { - u=c*x + y*s + centx; - v=-s*x + c*y + centy; - xo= x+(int)centx; - - switch(node->custom1) { - case 0: - neareast_interpolation(ibuf, obuf, u, v, xo, yo); - break ; - case 1: - bilinear_interpolation(ibuf, obuf, u, v, xo, yo); - break; - case 2: - bicubic_interpolation(ibuf, obuf, u, v, xo, yo); - } - - } + + + ibuf=IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0); + obuf=IMB_allocImBuf(stackbuf->x, stackbuf->y, 32, 0); + + if(ibuf && obuf){ + ibuf->rect_float=cbuf->rect; + obuf->rect_float=stackbuf->rect; + + for(y=miny; y<maxy; y++) { + yo= y+(int)centy; + + for(x=minx; x<maxx;x++) { + u=c*x + y*s + centx; + v=-s*x + c*y + centy; + xo= x+(int)centx; + + switch(node->custom1) { + case 0: + neareast_interpolation(ibuf, obuf, u, v, xo, yo); + break ; + case 1: + bilinear_interpolation(ibuf, obuf, u, v, xo, yo); + break; + case 2: + bicubic_interpolation(ibuf, obuf, u, v, xo, yo); + } + + } } - - /* rotate offset vector too, but why negative rad, ehh?? Has to be replaced with [3][3] matrix once (ton) */ - s= sin(-rad); - c= cos(-rad); - centx= (float)cbuf->xof; centy= (float)cbuf->yof; - stackbuf->xof= (int)( c*centx + s*centy); - stackbuf->yof= (int)(-s*centx + c*centy); + + /* rotate offset vector too, but why negative rad, ehh?? Has to be replaced with [3][3] matrix once (ton) */ + s= sin(-rad); + c= cos(-rad); + centx= (float)cbuf->xof; centy= (float)cbuf->yof; + stackbuf->xof= (int)( c*centx + s*centy); + stackbuf->yof= (int)(-s*centx + c*centy); IMB_freeImBuf(ibuf); IMB_freeImBuf(obuf); } - + /* pass on output and free */ out[0]->data= stackbuf; - if(cbuf!=in[0]->data) + if(cbuf!=in[0]->data) { free_compbuf(cbuf); + } } } static void node_composit_init_rotate(bNode *node) { - node->custom1= 1; /* Bilinear Filter*/ + node->custom1= 1; /* Bilinear Filter*/ } void register_node_type_cmp_rotate(ListBase *lb) diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c index 4e338c73c39..653e3f4211b 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c @@ -69,7 +69,7 @@ static void node_composit_exec_sephsva(void *UNUSED(data), bNode *node, bNodeSta if(in[0]->data==NULL) { float h, s, v; - rgb_to_hsv(in[0]->vec[0], in[0]->vec[1], in[0]->vec[2], &h, &s, &v); + rgb_to_hsv(in[0]->vec[0], in[0]->vec[1], in[0]->vec[2], &h, &s, &v); out[0]->vec[0] = h; out[1]->vec[0] = s; |