Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/nodes/intern')
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c46
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_crop.c16
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_math.c16
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_rotate.c91
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c2
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_math.c12
-rw-r--r--source/blender/nodes/intern/TEX_util.c2
7 files changed, 93 insertions, 92 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;
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_math.c b/source/blender/nodes/intern/TEX_nodes/TEX_math.c
index e00781741a0..18468bdd55c 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_math.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_math.c
@@ -114,14 +114,14 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
/* Only raise negative numbers by full integers */
if( in0 >= 0 ) {
out[0]= pow(in0, in1);
- } else {
- float y_mod_1 = fmod(in1, 1);
+ } else {
+ float y_mod_1 = fmod(in1, 1);
if (y_mod_1 > 0.999f || y_mod_1 < 0.001f) {
*out = pow(in0, floor(in1 + 0.5f));
- } else {
- *out = 0.0;
- }
- }
+ } else {
+ *out = 0.0;
+ }
+ }
}
break;
case 11: /* Logarithm */
diff --git a/source/blender/nodes/intern/TEX_util.c b/source/blender/nodes/intern/TEX_util.c
index 51b3c6d909f..b5e27ca2ccb 100644
--- a/source/blender/nodes/intern/TEX_util.c
+++ b/source/blender/nodes/intern/TEX_util.c
@@ -41,7 +41,7 @@
retrieve the color from the delegate.
comments: (ton)
-
+
This system needs recode, a node system should rely on the stack, and
callbacks for nodes only should evaluate own node, not recursively go
over other previous ones.