diff options
Diffstat (limited to 'source/blender/nodes/composite/nodes/node_composite_filter.c')
-rw-r--r-- | source/blender/nodes/composite/nodes/node_composite_filter.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/source/blender/nodes/composite/nodes/node_composite_filter.c b/source/blender/nodes/composite/nodes/node_composite_filter.c index 94a109de8f2..6d470467cb0 100644 --- a/source/blender/nodes/composite/nodes/node_composite_filter.c +++ b/source/blender/nodes/composite/nodes/node_composite_filter.c @@ -51,24 +51,24 @@ static void do_filter_edge(CompBuf *out, CompBuf *in, float *filter, float fac) rowlen= in->x; - for(y=0; y<in->y; y++) { + for (y=0; y<in->y; y++) { /* setup rows */ - if(y==0) row1= in->rect; + if (y==0) row1= in->rect; else row1= in->rect + pix*(y-1)*rowlen; row2= in->rect + y*pix*rowlen; - if(y==in->y-1) row3= row2; + if (y==in->y-1) row3= row2; else row3= row2 + pix*rowlen; fp= out->rect + pix*y*rowlen; - if(pix==CB_RGBA) { + if (pix==CB_RGBA) { copy_v4_v4(fp, row2); fp+= pix; - for(x=2; x<rowlen; x++) { - for(c=0; c<3; c++) { + for (x=2; x<rowlen; x++) { + for (c=0; c<3; c++) { f1= filter[0]*row1[0] + filter[1]*row1[4] + filter[2]*row1[8] + filter[3]*row2[0] + filter[4]*row2[4] + filter[5]*row2[8] + filter[6]*row3[0] + filter[7]*row3[4] + filter[8]*row3[8]; f2= filter[0]*row1[0] + filter[3]*row1[4] + filter[6]*row1[8] + filter[1]*row2[0] + filter[4]*row2[4] + filter[7]*row2[8] + filter[2]*row3[0] + filter[5]*row3[4] + filter[8]*row3[8]; fp[0]= mfac*row2[4] + fac*sqrt(f1*f1 + f2*f2); @@ -80,9 +80,9 @@ static void do_filter_edge(CompBuf *out, CompBuf *in, float *filter, float fac) } copy_v4_v4(fp, row2+4); } - else if(pix==CB_VAL) { + else if (pix==CB_VAL) { fp+= pix; - for(x=2; x<rowlen; x++) { + for (x=2; x<rowlen; x++) { f1= filter[0]*row1[0] + filter[1]*row1[1] + filter[2]*row1[2] + filter[3]*row2[0] + filter[4]*row2[1] + filter[5]*row2[2] + filter[6]*row3[0] + filter[7]*row3[1] + filter[8]*row3[2]; f2= filter[0]*row1[0] + filter[3]*row1[1] + filter[6]*row1[2] + filter[1]*row2[0] + filter[4]*row2[1] + filter[7]*row2[2] + filter[2]*row3[0] + filter[5]*row3[1] + filter[8]*row3[2]; fp[0]= mfac*row2[1] + fac*sqrt(f1*f1 + f2*f2); @@ -101,35 +101,35 @@ static void do_filter3(CompBuf *out, CompBuf *in, float *filter, float fac) rowlen= in->x; - for(y=0; y<in->y; y++) { + for (y=0; y<in->y; y++) { /* setup rows */ - if(y==0) row1= in->rect; + if (y==0) row1= in->rect; else row1= in->rect + pixlen*(y-1)*rowlen; row2= in->rect + y*pixlen*rowlen; - if(y==in->y-1) row3= row2; + if (y==in->y-1) row3= row2; else row3= row2 + pixlen*rowlen; fp= out->rect + pixlen*(y)*rowlen; - if(pixlen==1) { + if (pixlen==1) { fp[0]= row2[0]; fp+= 1; - for(x=2; x<rowlen; x++) { + for (x=2; x<rowlen; x++) { fp[0]= mfac*row2[1] + fac*(filter[0]*row1[0] + filter[1]*row1[1] + filter[2]*row1[2] + filter[3]*row2[0] + filter[4]*row2[1] + filter[5]*row2[2] + filter[6]*row3[0] + filter[7]*row3[1] + filter[8]*row3[2]); fp++; row1++; row2++; row3++; } fp[0]= row2[1]; } - else if(pixlen==2) { + else if (pixlen==2) { fp[0]= row2[0]; fp[1]= row2[1]; fp+= 2; - for(x=2; x<rowlen; x++) { - for(c=0; c<2; c++) { + for (x=2; x<rowlen; x++) { + for (c=0; c<2; c++) { fp[0]= mfac*row2[2] + fac*(filter[0]*row1[0] + filter[1]*row1[2] + filter[2]*row1[4] + filter[3]*row2[0] + filter[4]*row2[2] + filter[5]*row2[4] + filter[6]*row3[0] + filter[7]*row3[2] + filter[8]*row3[4]); fp++; row1++; row2++; row3++; } @@ -137,12 +137,12 @@ static void do_filter3(CompBuf *out, CompBuf *in, float *filter, float fac) fp[0]= row2[2]; fp[1]= row2[3]; } - else if(pixlen==3) { + else if (pixlen==3) { copy_v3_v3(fp, row2); fp+= 3; - for(x=2; x<rowlen; x++) { - for(c=0; c<3; c++) { + for (x=2; x<rowlen; x++) { + for (c=0; c<3; c++) { fp[0]= mfac*row2[3] + fac*(filter[0]*row1[0] + filter[1]*row1[3] + filter[2]*row1[6] + filter[3]*row2[0] + filter[4]*row2[3] + filter[5]*row2[6] + filter[6]*row3[0] + filter[7]*row3[3] + filter[8]*row3[6]); fp++; row1++; row2++; row3++; } @@ -153,8 +153,8 @@ static void do_filter3(CompBuf *out, CompBuf *in, float *filter, float fac) copy_v4_v4(fp, row2); fp+= 4; - for(x=2; x<rowlen; x++) { - for(c=0; c<4; c++) { + for (x=2; x<rowlen; x++) { + for (c=0; c<4; c++) { fp[0]= mfac*row2[4] + fac*(filter[0]*row1[0] + filter[1]*row1[4] + filter[2]*row1[8] + filter[3]*row2[0] + filter[4]*row2[4] + filter[5]*row2[8] + filter[6]*row3[0] + filter[7]*row3[4] + filter[8]*row3[8]); fp++; row1++; row2++; row3++; } @@ -175,12 +175,12 @@ static void node_composit_exec_filter(void *data, bNode *node, bNodeStack **in, float kirsch[9]= {5,5,5,-3,-3,-3,-2,-2,-2}; float shadow[9]= {1,2,1,0,1,0,-1,-2,-1}; - if(out[0]->hasoutput==0) return; + if (out[0]->hasoutput==0) return; /* stack order in: Image */ /* stack order out: Image */ - if(in[1]->data) { + if (in[1]->data) { /* make output size of first available input image */ CompBuf *cbuf= in[1]->data; CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, cbuf->type, 1); /* allocs */ |