converted more mixed tab/space indentations to tabs. only whitespace changes.
[blender.git] / source / blender / nodes / intern / CMP_nodes / CMP_colorSpill.c
index c9997ba..905d977 100644 (file)
@@ -39,8 +39,8 @@
 
 /* ******************* Color Spill Supression ********************************* */
 static bNodeSocketType cmp_node_color_spill_in[]={
-   {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
-   {SOCK_VALUE, 1, "Fac",      1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+       {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+       {SOCK_VALUE, 1, "Fac",  1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
        {-1,0,""}
 };
 
@@ -51,17 +51,17 @@ static bNodeSocketType cmp_node_color_spill_out[]={
 
 static void do_simple_spillmap_red(bNode *node, float* out, float *in)
 {
-   NodeColorspill *ncs;
+       NodeColorspill *ncs;
        ncs=node->storage;
        out[0]=in[0]-( ncs->limscale * in[ncs->limchan] );
 }
 
 static void do_simple_spillmap_red_fac(bNode *node, float* out, float *in, float *fac)
 {
-   NodeColorspill *ncs;
-   ncs=node->storage;
+       NodeColorspill *ncs;
+       ncs=node->storage;
 
-   out[0] = *fac * (in[0]-( ncs->limscale * in[ncs->limchan]));
+       out[0] = *fac * (in[0]-( ncs->limscale * in[ncs->limchan]));
 }
 
 static void do_simple_spillmap_green(bNode *node, float* out, float *in)
@@ -73,10 +73,10 @@ static void do_simple_spillmap_green(bNode *node, float* out, float *in)
 
 static void do_simple_spillmap_green_fac(bNode *node, float* out, float *in, float *fac)
 {
-   NodeColorspill *ncs;
-   ncs=node->storage;
+       NodeColorspill *ncs;
+       ncs=node->storage;
 
-   out[0] = *fac * (in[1]-( ncs->limscale * in[ncs->limchan]));
+       out[0] = *fac * (in[1]-( ncs->limscale * in[ncs->limchan]));
 }
 
 static void do_simple_spillmap_blue(bNode *node, float* out, float *in)
@@ -88,10 +88,10 @@ static void do_simple_spillmap_blue(bNode *node, float* out, float *in)
 
 static void do_simple_spillmap_blue_fac(bNode *node, float* out, float *in, float *fac)
 {
-   NodeColorspill *ncs;
-   ncs=node->storage;
+       NodeColorspill *ncs;
+       ncs=node->storage;
 
-   out[0] = *fac * (in[2]-( ncs->limscale * in[ncs->limchan]));
+       out[0] = *fac * (in[2]-( ncs->limscale * in[ncs->limchan]));
 }
 
 static void do_average_spillmap_red(bNode *node, float* out, float *in)
@@ -103,10 +103,10 @@ static void do_average_spillmap_red(bNode *node, float* out, float *in)
 
 static void do_average_spillmap_red_fac(bNode *node, float* out, float *in, float *fac)
 {
-   NodeColorspill *ncs;
-   ncs=node->storage;
+       NodeColorspill *ncs;
+       ncs=node->storage;
 
-   out[0] = *fac * (in[0]-(ncs->limscale * avg(in[1], in[2]) ));
+       out[0] = *fac * (in[0]-(ncs->limscale * avg(in[1], in[2]) ));
 }
 
 static void do_average_spillmap_green(bNode *node, float* out, float *in)
@@ -118,10 +118,10 @@ static void do_average_spillmap_green(bNode *node, float* out, float *in)
 
 static void do_average_spillmap_green_fac(bNode *node, float* out, float *in, float *fac)
 {
-   NodeColorspill *ncs;
-   ncs=node->storage;
+       NodeColorspill *ncs;
+       ncs=node->storage;
 
-   out[0] = *fac * (in[0]-(ncs->limscale * avg(in[0], in[2]) ));
+       out[0] = *fac * (in[0]-(ncs->limscale * avg(in[0], in[2]) ));
 }
 
 static void do_average_spillmap_blue(bNode *node, float* out, float *in)
@@ -133,10 +133,10 @@ static void do_average_spillmap_blue(bNode *node, float* out, float *in)
 
 static void do_average_spillmap_blue_fac(bNode *node, float* out, float *in, float *fac)
 {
-   NodeColorspill *ncs;
-   ncs=node->storage;
+       NodeColorspill *ncs;
+       ncs=node->storage;
 
-   out[0] = *fac * (in[0]-(ncs->limscale * avg(in[0], in[1]) ));
+       out[0] = *fac * (in[0]-(ncs->limscale * avg(in[0], in[1]) ));
 }
 
 static void do_apply_spillmap_red(bNode *node, float* out, float *in, float *map)
@@ -189,48 +189,47 @@ static void do_apply_spillmap_blue(bNode *node, float* out, float *in, float *ma
 
 static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
 {
-       /*
-       Originally based on the information from the book "The Art and Science of Digital Composition" and 
-       discussions from vfxtalk.com.*/
-   CompBuf *cbuf;
-   CompBuf *mask;
+       /* Originally based on the information from the book "The Art and Science of Digital Composition" and
+        * discussions from vfxtalk.com .*/
+       CompBuf *cbuf;
+       CompBuf *mask;
        CompBuf *rgbbuf;
        CompBuf *spillmap;
        NodeColorspill *ncs;
        ncs=node->storage;
 
-   /* early out for missing connections */
-   if(out[0]->hasoutput==0 ) return;
-   if(in[0]->hasinput==0) return;
-   if(in[0]->data==NULL) return;
+       /* early out for missing connections */
+       if(out[0]->hasoutput==0 ) return;
+       if(in[0]->hasinput==0) return;
+       if(in[0]->data==NULL) return;
        
-   cbuf=typecheck_compbuf(in[0]->data, CB_RGBA);
-   mask=typecheck_compbuf(in[1]->data, CB_VAL);
+       cbuf=typecheck_compbuf(in[0]->data, CB_RGBA);
+       mask=typecheck_compbuf(in[1]->data, CB_VAL);
        spillmap=alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1);
        rgbbuf=dupalloc_compbuf(cbuf);
 
        switch(node->custom1)
        {
-       case 1:  /*red spill*/
+               case 1:  /*red spill*/
                {
                        switch(node->custom2)
                        {
-         case 0: /* simple limit */
-            {
-               if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
-                  composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_simple_spillmap_red, CB_RGBA);
-               } else {
-                  composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_simple_spillmap_red_fac, CB_RGBA,  CB_VAL);
-               }
+                               case 0: /* simple limit */
+                               {
+                                       if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
+                                               composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_simple_spillmap_red, CB_RGBA);
+                                       } else {
+                                               composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_simple_spillmap_red_fac, CB_RGBA,  CB_VAL);
+                                       }
                                        break;
                                }
-         case 1: /* average limit */
-            {
-               if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
-                  composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_average_spillmap_red, CB_RGBA);
-               } else {
-                  composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_average_spillmap_red_fac, CB_RGBA,  CB_VAL);
-               }
+                               case 1: /* average limit */
+                               {
+                                       if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
+                                               composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_average_spillmap_red, CB_RGBA);
+                                       } else {
+                                               composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_average_spillmap_red_fac, CB_RGBA,  CB_VAL);
+                                       }
                                        break;
                                }
                        }
@@ -242,59 +241,59 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
                        composit2_pixel_processor(node, rgbbuf, cbuf, in[0]->vec, spillmap, NULL, do_apply_spillmap_red, CB_RGBA, CB_VAL);
                        break;
                }
-       case 2: /*green spill*/
+               case 2: /*green spill*/
                {
                        switch(node->custom2)
                        {
-         case 0: /* simple limit */
-            {
-               if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
-                  composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_simple_spillmap_green, CB_RGBA);
-               } else {
-                  composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_simple_spillmap_green_fac, CB_RGBA,  CB_VAL);
-               }
-               break;
-            }
-         case 1: /* average limit */
-            {
-               if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
-                  composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_average_spillmap_green, CB_RGBA);
-               } else {
-                  composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_average_spillmap_green_fac, CB_RGBA,  CB_VAL);
-               }
-               break;
-            }
+                               case 0: /* simple limit */
+                               {
+                                       if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
+                                               composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_simple_spillmap_green, CB_RGBA);
+                                       } else {
+                                               composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_simple_spillmap_green_fac, CB_RGBA,  CB_VAL);
+                                       }
+                                       break;
+                               }
+                               case 1: /* average limit */
+                               {
+                                       if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
+                                               composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_average_spillmap_green, CB_RGBA);
+                                       } else {
+                                               composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_average_spillmap_green_fac, CB_RGBA,  CB_VAL);
+                                       }
+                                       break;
+                               }
                        }
                        if(ncs->unspill==0) {
                                ncs->uspillr=0.0f;
                                ncs->uspillg=1.0f;
                                ncs->uspillb=0.0f;
-         }
+                       }
                        composit2_pixel_processor(node, rgbbuf, cbuf, in[0]->vec, spillmap, NULL, do_apply_spillmap_green, CB_RGBA, CB_VAL);
                        break;
                }
-       case 3: /*blue spill*/
+               case 3: /*blue spill*/
                {
                        switch(node->custom2)
                        {
-         case 0: /* simple limit */
-            {
-               if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
-                  composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_simple_spillmap_blue, CB_RGBA);
-               } else {
-                  composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_simple_spillmap_blue_fac, CB_RGBA,  CB_VAL);
-               }
-               break;
-            }
-         case 1: /* average limit */
-            {
-               if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
-                  composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_average_spillmap_blue, CB_RGBA);
-               } else {
-                  composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_average_spillmap_blue_fac, CB_RGBA,  CB_VAL);
-               }
-               break;
-            }
+                               case 0: /* simple limit */
+                               {
+                                       if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
+                                               composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_simple_spillmap_blue, CB_RGBA);
+                                       } else {
+                                               composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_simple_spillmap_blue_fac, CB_RGBA,  CB_VAL);
+                                       }
+                                       break;
+                               }
+                               case 1: /* average limit */
+                               {
+                                       if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
+                                               composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_average_spillmap_blue, CB_RGBA);
+                                       } else {
+                                               composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_average_spillmap_blue_fac, CB_RGBA,  CB_VAL);
+                                       }
+                                       break;
+                               }
                        }
                        if(ncs->unspill==0) {
                                ncs->uspillr=0.0f;
@@ -304,27 +303,27 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
                        composit2_pixel_processor(node, rgbbuf, cbuf, in[0]->vec, spillmap, NULL, do_apply_spillmap_blue, CB_RGBA, CB_VAL);
                        break;
                }
-       default:
-               break;
+               default:
+                       break;
        }
 
        out[0]->data=rgbbuf;
 
        if(cbuf!=in[0]->data)
                free_compbuf(cbuf);
-   
-   free_compbuf(spillmap);
+
+       free_compbuf(spillmap);
 }
 
 static void node_composit_init_color_spill(bNode *node)
 {
-   NodeColorspill *ncs= MEM_callocN(sizeof(NodeColorspill), "node colorspill");
-   node->storage=ncs;
-   node->custom1= 2; /* green channel */
-   node->custom2= 0; /* simple limit algo*/
-   ncs->limchan= 0;  /* limit by red */
-   ncs->limscale= 1.0f; /* limit scaling factor */
-   ncs->unspill=0;   /* do not use unspill */
+       NodeColorspill *ncs= MEM_callocN(sizeof(NodeColorspill), "node colorspill");
+       node->storage=ncs;
+       node->custom1= 2; /* green channel */
+       node->custom2= 0; /* simple limit algo*/
+       ncs->limchan= 0;  /* limit by red */
+       ncs->limscale= 1.0f; /* limit scaling factor */
+       ncs->unspill=0;   /* do not use unspill */
 }
 
 void register_node_type_cmp_color_spill(ListBase *lb)