? matte.patch ? tools/Blender.pyc ? tools/__init__.pyc ? tools/bcolors.pyc ? tools/btools.pyc Index: config/linux2-config.py =================================================================== RCS file: /cvsroot/bf-blender/blender/config/linux2-config.py,v retrieving revision 1.17 diff -r1.17 linux2-config.py 146c146 < BF_DEBUG_FLAGS = '' --- > BF_DEBUG_FLAGS = '-g' Index: source/blender/blenkernel/BKE_node.h =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/blenkernel/BKE_node.h,v retrieving revision 1.18 diff -r1.18 BKE_node.h 90a91 > #define NODE_CLASS_MATTE 9 232c233,237 < --- > #define CMP_NODE_SEPYCCA 229 > #define CMP_NODE_SEPYUVA 230 > #define CMP_NODE_DIFF_MATTE 231 > #define CMP_NODE_COLOR_SPILL 232 > #define CMP_NODE_CHROMA 233 Index: source/blender/blenkernel/intern/node.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/blenkernel/intern/node.c,v retrieving revision 1.43 diff -r1.43 node.c 807a808,835 > else if(type==CMP_NODE_DIFF_MATTE){ > NodeChroma *c=MEM_callocN(sizeof(NodeChroma), "node chroma"); > node->storage=c; > c->t1=0.01f; > c->t2=0.01f; > c->t3=0.01f; > c->fsize=0.0f; > c->fstrength=0.0f; > } > else if(type==CMP_NODE_COLOR_SPILL){ > NodeChroma *c=MEM_callocN(sizeof(NodeChroma), "node chroma"); > node->storage=c; > c->t1=0.0f; > c->t2=0.0f; > c->t3=0.0f; > c->fsize=0.0f; > c->fstrength=0.0f; > } > else if(type==CMP_NODE_CHROMA){ > NodeChroma *c=MEM_callocN(sizeof(NodeChroma), "node chroma"); > node->storage=c; > c->t1=0.0f; > c->t2=0.0f; > c->t3=0.0f; > c->fsize=0.0f; > c->fstrength=0.0f; > } > Index: source/blender/blenkernel/intern/node_composite.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/blenkernel/intern/node_composite.c,v retrieving revision 1.57 diff -r1.57 node_composite.c 32a33 > #include 3115a3117,3688 > /* **************** SEPARATE YUVA ******************** */ > static bNodeSocketType cmp_node_sepyuva_in[]= { > { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, > { -1, 0, "" } > }; > static bNodeSocketType cmp_node_sepyuva_out[]= { > { SOCK_VALUE, 0, "Y", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, > { SOCK_VALUE, 0, "U", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, > { SOCK_VALUE, 0, "V", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, > { SOCK_VALUE, 0, "A", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, > { -1, 0, "" } > }; > > static void do_sepyuva(bNode *node, float *out, float *in) > { > float y, u, v; > > rgb_to_yuv(in[0], in[1], in[2], &y, &u, &v); > > out[0]= y; > out[1]= u; > out[2]= v; > out[3]= in[3]; > } > > static void node_composit_exec_sepyuva(void *data, bNode *node, bNodeStack **in, bNodeStack **out) > { > /* stack order out: bw channels */ > /* stack order in: col */ > > /* input no image? then only color operation */ > if(in[0]->data==NULL) { > float y, u, v; > > rgb_to_yuv(in[0]->vec[0], in[0]->vec[1], in[0]->vec[2], &y, &u, &v); > > out[0]->vec[0] = y; > out[1]->vec[0] = u; > out[2]->vec[0] = v; > out[3]->vec[0] = in[0]->vec[3]; > } > else if ((out[0]->hasoutput) || (out[1]->hasoutput) || (out[2]->hasoutput) || (out[3]->hasoutput)) { > /* make output size of input image */ > CompBuf *cbuf= in[0]->data; > > CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); // allocs > > /* convert the RGB stackbuf to an HSV representation */ > composit1_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, do_sepyuva, CB_RGBA); > > /* separate each of those channels */ > if(out[0]->hasoutput) > out[0]->data= valbuf_from_rgbabuf(stackbuf, CHAN_R); > if(out[1]->hasoutput) > out[1]->data= valbuf_from_rgbabuf(stackbuf, CHAN_G); > if(out[2]->hasoutput) > out[2]->data= valbuf_from_rgbabuf(stackbuf, CHAN_B); > if(out[3]->hasoutput) > out[3]->data= valbuf_from_rgbabuf(stackbuf, CHAN_A); > > free_compbuf(stackbuf); > } > } > > static bNodeType cmp_node_sepyuva= { > /* type code */ CMP_NODE_SEPYUVA, > /* name */ "Separate YUVA", > /* width+range */ 80, 40, 140, > /* class+opts */ NODE_CLASS_CONVERTOR, 0, > /* input sock */ cmp_node_sepyuva_in, > /* output sock */ cmp_node_sepyuva_out, > /* storage */ "", > /* execfunc */ node_composit_exec_sepyuva > > }; > > /* **************** SEPARATE YCCA ******************** */ > static bNodeSocketType cmp_node_sepycca_in[]= { > { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, > { -1, 0, "" } > }; > static bNodeSocketType cmp_node_sepycca_out[]= { > { SOCK_VALUE, 0, "Y", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, > { SOCK_VALUE, 0, "Cb", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, > { SOCK_VALUE, 0, "Cr", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, > { SOCK_VALUE, 0, "A", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, > { -1, 0, "" } > }; > > static void do_sepycca(bNode *node, float *out, float *in) > { > float y, cb, cr; > > rgb_to_ycc(in[0], in[1], in[2], &y, &cb, &cr); > > //divided by 255 to normalize for viewing in > out[0]= y/255.0; > out[1]= cb/255.0; > out[2]= cr/255.0; > out[3]= in[3]; > } > > static void node_composit_exec_sepycca(void *data, bNode *node, bNodeStack **in, bNodeStack **out) > { > /* stack order out: bw channels */ > /* stack order in: col */ > > /* input no image? then only color operation */ > if(in[0]->data==NULL) { > float y, cb, cr; > > rgb_to_ycc(in[0]->vec[0], in[0]->vec[1], in[0]->vec[2], &y, &cb, &cr); > > //divided by 255 to normalize for viewing in > out[0]->vec[0] = y/255.0; > out[1]->vec[0] = cb/255.0; > out[2]->vec[0] = cr/255.0; > out[3]->vec[0] = in[0]->vec[3]; > } > else if ((out[0]->hasoutput) || (out[1]->hasoutput) || (out[2]->hasoutput) || (out[3]->hasoutput)) { > /* make output size of input image */ > CompBuf *cbuf= in[0]->data; > > CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); // allocs > > /* convert the RGB stackbuf to an HSV representation */ > composit1_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, do_sepycca, CB_RGBA); > > /* separate each of those channels */ > if(out[0]->hasoutput) > out[0]->data= valbuf_from_rgbabuf(stackbuf, CHAN_R); > if(out[1]->hasoutput) > out[1]->data= valbuf_from_rgbabuf(stackbuf, CHAN_G); > if(out[2]->hasoutput) > out[2]->data= valbuf_from_rgbabuf(stackbuf, CHAN_B); > if(out[3]->hasoutput) > out[3]->data= valbuf_from_rgbabuf(stackbuf, CHAN_A); > > free_compbuf(stackbuf); > } > } > > static bNodeType cmp_node_sepycca= { > /* type code */ CMP_NODE_SEPYCCA, > /* name */ "Separate YCbCrA", > /* width+range */ 80, 40, 140, > /* class+opts */ NODE_CLASS_CONVERTOR, 0, > /* input sock */ cmp_node_sepycca_in, > /* output sock */ cmp_node_sepycca_out, > /* storage */ "", > /* execfunc */ node_composit_exec_sepycca > > }; > > /* ******************* channel Difference Matte ********************************* */ > static bNodeSocketType cmp_node_diff_matte_in[]={ > {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, > {SOCK_RGBA,1,"Key", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, > {-1,0,""} > }; > > static bNodeSocketType cmp_node_diff_matte_out[]={ > {SOCK_RGBA,0,"Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, > {SOCK_VALUE,0,"Matte",0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, > {-1,0,""} > }; > > static void do_rgba_to_yuva(bNode *node, float *out, float *in) > { > rgb_to_yuv(in[0],in[1],in[2], &out[0], &out[1], &out[2]); > out[3]=in[3]; > } > > static void do_rgba_to_hsva(bNode *node, float *out, float *in) > { > rgb_to_hsv(in[0],in[1],in[2], &out[0], &out[1], &out[2]); > out[3]=in[3]; > } > > static void do_rgba_to_ycca(bNode *node, float *out, float *in) > { > rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2]); > out[3]=in[3]; > } > > static void do_yuva_to_rgba(bNode *node, float *out, float *in) > { > yuv_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2]); > out[3]=in[3]; > } > > static void do_hsva_to_rgba(bNode *node, float *out, float *in) > { > hsv_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2]); > out[3]=in[3]; > } > > static void do_ycca_to_rgba(bNode *node, float *out, float *in) > { > ycc_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2]); > out[3]=in[3]; > } > > static void node_composit_exec_diff_matte(void *data, bNode *node, bNodeStack **in, bNodeStack **out) > { > int i,max; > float key[3]; > float keymin[3]; > float keymax[3]; > float t[3]; > CompBuf *outbuf; > CompBuf *colorbuf; > CompBuf *inbuf; > NodeChroma *c; > float distance, tolerance, alpha; > > //is anything connected? > if(out[0]->hasoutput==0 && out[1]->hasoutput==0) return; > //must have an image imput > if(in[0]->data==NULL) return; > > inbuf=in[0]->data; > if(inbuf->type!=CB_RGBA) return; > > c=node->storage; > colorbuf=dupalloc_compbuf(inbuf); > outbuf=alloc_compbuf(inbuf->x,inbuf->y,CB_RGBA,1); > > //use the input color > key[0]=in[1]->vec[0]; > key[1]=in[1]->vec[1]; > key[2]=in[1]->vec[2]; > > //get the tolerances from the UI > t[0]=c->t1; > t[1]=c->t2; > t[2]=c->t3; > > //convert to colorspace > switch(node->custom1) > { > case 1: //RGB > { > break; > } > case 2: //HSV > { > //convert the key (in place) > rgb_to_hsv(key[0], key[1], key[2], &key[0], &key[1], &key[2]); > composit1_pixel_processor(node, colorbuf, inbuf, in[1]->vec, do_rgba_to_hsva, CB_RGBA); > break; > } > case 3: //YUV > { > rgb_to_yuv(key[0], key[1], key[2], &key[0], &key[1], &key[2]); > composit1_pixel_processor(node, colorbuf, inbuf, in[1]->vec, do_rgba_to_yuva, CB_RGBA); > break; > } > case 4: //YCC > { > rgb_to_ycc(key[0], key[1], key[2], &key[0], &key[1], &key[2]); > composit1_pixel_processor(node, colorbuf, inbuf, in[1]->vec, do_rgba_to_ycca, CB_RGBA); > //account for ycc is on a 0..255 scale > t[0]=c->t1*255.0; > t[1]=c->t2*255.0; > t[2]=c->t3*255.0; > break; > } > default: > break; > } > > //find min/max tolerances > keymin[0]=key[0]-t[0]; > keymin[1]=key[1]-t[1]; > keymin[2]=key[2]-t[2]; > keymax[0]=key[0]+t[0]; > keymax[1]=key[1]+t[1]; > keymax[2]=key[2]+t[2]; > > //tolerance > tolerance=sqrt((t[0])*(t[0])+ > (t[1])*(t[1])+ > (t[2])*(t[2])); > > //easier for me to do this here by accesssing the rects than try to hack into a pixel processor > //due to numerous inputs and my lack of experience with the pixel processors > max=inbuf->x*inbuf->y*4; > for(i=0;i { > //process the pixel if it is close to the key or already transparent > if(((colorbuf->rect[i+0]>keymin[0] && colorbuf->rect[i+0] (colorbuf->rect[i+1]>keymin[1] && colorbuf->rect[i+1] (colorbuf->rect[i+2]>keymin[2] && colorbuf->rect[i+2]rect[i+3]<1.0) > { > //true distance from key > distance=sqrt((colorbuf->rect[i+0]-key[0])*(colorbuf->rect[i+0]-key[0])+ > (colorbuf->rect[i+1]-key[1])*(colorbuf->rect[i+1]-key[1])+ > (colorbuf->rect[i+2]-key[2])*(colorbuf->rect[i+2]-key[2])); > > //is it less transparent that the prevous pixel > alpha=distance/tolerance; > if(alpha > inbuf->rect[i+3]) alpha=inbuf->rect[i+3]; > if(alpha > c->fstrength) alpha=0.0; > > //clamp > if (alpha>1.0) alpha=1.0; > if (alpha<0.0) alpha=0.0; > > //premultiplied picture > colorbuf->rect[i+3]=alpha; > } > else > { > //foreground object > colorbuf->rect[i+3]=inbuf->rect[i+3]; > } > } > > //convert back to RGB colorspace > switch(node->custom1) > { > case 1: //RGB > { > composit1_pixel_processor(node, outbuf, colorbuf, in[1]->vec, do_copy_rgba, CB_RGBA); > break; > } > case 2: //HSV > { > composit1_pixel_processor(node, outbuf, colorbuf, in[1]->vec, do_hsva_to_rgba, CB_RGBA); > break; > } > case 3: //YUV > { > composit1_pixel_processor(node, outbuf, colorbuf, in[1]->vec, do_yuva_to_rgba, CB_RGBA); > break; > } > case 4: //YCC > { > composit1_pixel_processor(node, outbuf, colorbuf, in[1]->vec, do_ycca_to_rgba, CB_RGBA); > break; > } > default: > break; > } > > > free_compbuf(colorbuf); > > out[0]->data=outbuf; > out[1]->data=valbuf_from_rgbabuf(outbuf, CHAN_A); > generate_preview(node, outbuf); > } > > static bNodeType cmp_node_diff_matte={ > /* type code */ CMP_NODE_DIFF_MATTE, > /* name */ "Channel Difference Matte", > /* width+range */ 200, 80, 250, > /* class+opts */ NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS, > /* input sock */ cmp_node_diff_matte_in, > /* output sock */ cmp_node_diff_matte_out, > /* storage */ "NodeChroma", > /* execfunc */ node_composit_exec_diff_matte > }; > > > /* ******************* 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}, > {-1,0,""} > }; > > static bNodeSocketType cmp_node_color_spill_out[]={ > {SOCK_RGBA,0,"Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, > {-1,0,""} > }; > > static void do_reduce_red(bNode *node, float* out, float *in) > { > NodeChroma *c; > c=node->storage; > > if(in[0] > in[1] && in[0] > in[2]) > { > out[0]=((in[1]+in[2])/2)*(1-c->t1); > } > } > > static void do_reduce_green(bNode *node, float* out, float *in) > { > NodeChroma *c; > c=node->storage; > > if(in[1] > in[0] && in[1] > in[2]) > { > out[1]=((in[0]+in[2])/2)*(1-c->t1); > } > } > > static void do_reduce_blue(bNode *node, float* out, float *in) > { > NodeChroma *c; > c=node->storage; > > if(in[2] > in[1] && in[2] > in[1]) > { > out[2]=((in[1]+in[0])/2)*(1-c->t1); > } > } > > static void node_composit_exec_color_spill(void *data, bNode *node, bNodeStack **in, bNodeStack **out) > { > CompBuf *cbuf; > CompBuf *rgbbuf; > > if(out[0]->hasoutput==0 || in[0]->hasinput==0) return; > if(in[0]->data==NULL) return; > > cbuf=in[0]->data; > //is it an RGBA image > if(cbuf->type==CB_RGBA) > { > rgbbuf=dupalloc_compbuf(cbuf); > switch(node->custom1) > { > case 1: //red spill > { > composit1_pixel_processor(node, rgbbuf, cbuf, in[1]->vec, do_reduce_red, CB_RGBA); > break; > } > case 2: //green spill > { > composit1_pixel_processor(node, rgbbuf, cbuf, in[1]->vec, do_reduce_green, CB_RGBA); > break; > } > case 3: //blue spill > { > composit1_pixel_processor(node, rgbbuf, cbuf, in[1]->vec, do_reduce_blue, CB_RGBA); > break; > } > default: > break; > } > > out[0]->data=rgbbuf; > } > else > { > return; > } > } > > static bNodeType cmp_node_color_spill={ > /* type code */ CMP_NODE_COLOR_SPILL, > /* name */ "Color Spill", > /* width+range */ 140, 80, 140, > /* class+opts */ NODE_CLASS_MATTE, NODE_OPTIONS, > /* input sock */ cmp_node_color_spill_in, > /* output sock */ cmp_node_color_spill_out, > /* storage */ "NodeChroma", > /* execfunc */ node_composit_exec_color_spill > }; > > /* ******************* Chroma Key ********************************************************** */ > static bNodeSocketType cmp_node_chroma_in[]={ > {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, > {-1,0,""} > }; > > static bNodeSocketType cmp_node_chroma_out[]={ > {SOCK_RGBA,0,"Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, > {SOCK_VALUE,0,"Matte",0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, > {-1,0,""} > }; > > static void do_rgba_to_ycca_normalized(bNode *node, float *out, float *in) > { > rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2]); > out[0]=(out[0])/255; > out[1]=(out[1])/256; > out[2]=(out[2])/256; > out[3]=in[3]; > }; > > static void do_normalized_ycca_to_rgba(bNode *node, float *out, float *in) > { > in[0]=in[0]*255; > in[1]=in[1]*256; > in[2]=in[2]*256; > ycc_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2]); > out[3]=in[3]; > }; > > static void do_chroma_key(bNode *node, float *out, float *in) > { > float x,z,alpha; > NodeChroma *c; > > c=node->storage; > > switch(node->custom1) > { > case 1: //green > { > x=(atanf((c->t1*in[1])-(c->t1*c->t2))+1)/2; > z=(atanf((c->t3*in[2])-(c->t3*c->fsize))+1)/2; > break; > } > case 2: //blue > { > x=(atanf((c->t1*in[1])-(c->t1*c->t2))+1)/2; > z=(atanf((c->t3*in[2])-(c->t3*c->fsize))+1)/2; > x=1-x; > break; > } > default: > break; > } > > if((x+z) < c->fstrength) > { > alpha=ABS(c->key[0]-in[0]); //differnce in luminence > if(alpha > c->falpha) alpha=0; > in[3]=alpha; > } > else > { > in[3]=1; > } > } > > static void node_composit_exec_chroma(void *data, bNode *node, bNodeStack **in, bNodeStack **out) > { > CompBuf *rgbbuf,*inbuf; > CompBuf *chromabuf; > > if(out[0]->hasoutput==0 || in[0]->hasinput==0) return; > if(in[0]->data==NULL) return; > > inbuf=in[0]->data; > if(inbuf->type!=CB_RGBA) return; > > rgbbuf=dupalloc_compbuf(inbuf); > chromabuf=dupalloc_compbuf(rgbbuf); > > //convert rgbbuf to normalized chroma space > composit1_pixel_processor(node, chromabuf, inbuf, in[1]->vec, do_rgba_to_ycca_normalized, CB_RGBA); > > //per pixel chroma key > composit1_pixel_processor(node, rgbbuf, chromabuf, in[1]->vec, do_chroma_key, CB_RGBA); > > //convert back > composit1_pixel_processor(node, rgbbuf, chromabuf, in[1]->vec, do_normalized_ycca_to_rgba, CB_RGBA); > > //cleanup > free_compbuf(chromabuf); > out[0]->data=rgbbuf; > out[1]->data=valbuf_from_rgbabuf(rgbbuf, CHAN_A); > generate_preview(node, rgbbuf); > }; > > static bNodeType cmp_node_chroma={ > /* type code */ CMP_NODE_CHROMA, > /* name */ "Chroma Key", > /* width+range */ 200, 80, 300, > /* class+opts */ NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS, > /* input sock */ cmp_node_chroma_in, > /* output sock */ cmp_node_chroma_out, > /* storage */ "NodeChroma", > /* execfunc */ node_composit_exec_chroma > }; > 3148a3722,3726 > &cmp_node_sepyuva, > &cmp_node_sepycca, > &cmp_node_diff_matte, > &cmp_node_color_spill, > &cmp_node_chroma, Index: source/blender/blenlib/BLI_arithb.h =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/blenlib/BLI_arithb.h,v retrieving revision 1.25 diff -r1.25 BLI_arithb.h 668a669,674 > void rgb_to_yuv(float r, float g, float b, float *ly, float *lu, float *lv); > void yuv_to_rgb(float y, float u, float v, float *lr, float *lg, float *lb); > > void ycc_to_rgb(float y, float cb, float cr, float *lr, float *lg, float *lb); > void rgb_to_ycc(float r, float g, float b, float *ly, float *lcb, float *lcr); > Index: source/blender/blenlib/intern/arithb.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/blenlib/intern/arithb.c,v retrieving revision 1.39 diff -r1.39 arithb.c 2628a2629,2684 > void rgb_to_yuv(float r, float g, float b, float *ly, float *lu, float *lv) > { > float y, u, v; > y= 0.299*r + 0.587*g + 0.114*b; > u=-0.147*r - 0.289*g + 0.436*b; > v= 0.615*r - 0.515*g - 0.100*b; > > *ly=y; > *lu=u; > *lv=v; > } > > void yuv_to_rgb(float y, float u, float v, float *lr, float *lg, float *lb) > { > float r, g, b; > r=y+1.140*v; > g=y-0.394*u - 0.581*v; > b=y+2.032*u; > > *lr=r; > *lg=g; > *lb=b; > } > > void rgb_to_ycc(float r, float g, float b, float *ly, float *lcb, float *lcr) > { > float sr,sg, sb; > float y, cr, cb; > > sr=255.0*r; > sg=255.0*g; > sb=255.0*b; > > > y=(0.257*sr)+(0.504*sg)+(0.098*sb)+16.0; > cb=(-0.148*sr)-(0.291*sg)+(0.439*sb)+128.0; > cr=(0.439*sr)-(0.368*sg)-(0.071*sb)+128.0; > > *ly=y; > *lcb=cb; > *lcr=cr; > } > > void ycc_to_rgb(float y, float cb, float cr, float *lr, float *lg, float *lb) > { > float r,g,b; > > r=1.164*(y-16)+1.596*(cr-128); > g=1.164*(y-16)-0.813*(cr-128)-0.392*(cb-128); > b=1.164*(y-16)+2.017*(cb-128); > > *lr=r/255.0; > *lg=g/255.0; > *lb=b/255.0; > } > Index: source/blender/makesdna/DNA_node_types.h =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/makesdna/DNA_node_types.h,v retrieving revision 1.15 diff -r1.15 DNA_node_types.h 203a204,209 > typedef struct NodeChroma { > float t1,t2,t3; > float fsize,fstrength,falpha; > float key[4]; > } NodeChroma; > Index: source/blender/src/drawnode.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/src/drawnode.c,v retrieving revision 1.38 diff -r1.38 drawnode.c 1029a1030,1139 > static int node_composit_buts_diff_matte(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) > { > if(block) > { > short sx= (butr->xmax-butr->xmin)/4; > short dx= (butr->xmax-butr->xmin)/3; > NodeChroma *c= node->storage; > uiBlockBeginAlign(block); > //color space selectors > uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"RGB", > butr->xmin,butr->ymin+60,sx,20, > &node->custom1,1,1, 0, 0, "RGB Color Space"); > uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"HSV", > butr->xmin+sx,butr->ymin+60,sx,20, > &node->custom1,1,2, 0, 0, "HSV Color Space"); > uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"YUV", > butr->xmin+2*sx,butr->ymin+60,sx,20, > &node->custom1,1,3, 0, 0, "YUV Color Space"); > uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"YCC", > butr->xmin+3*sx,butr->ymin+60,sx,20, > &node->custom1,1,4, 0, 0, "YCbCr Color Space"); > //channel tolorences > uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, " ", > butr->xmin, butr->ymin+40, dx, 20, > &c->t1, 0.0f, 1.0f, 100, 0, "Channel 1 Tolerance"); > uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, " ", > butr->xmin+dx, butr->ymin+40, dx, 20, > &c->t2, 0.0f, 1.0f, 100, 0, "Channel 2 Tolorence"); > uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, " ", > butr->xmin+2*dx, butr->ymin+40, dx, 20, > &c->t3, 0.0f, 1.0f, 100, 0, "Channel 3 Tolorence"); > //falloff parameters > //uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Falloff Size ", > // butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20, > // &c->fsize, 0.0f, 1.0f, 100, 0, ""); > uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Falloff Strength ", > butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20, > &c->fstrength, 0.0f, 1.0f, 100, 0, ""); > } > return 80; > } > > static int node_composit_buts_color_spill(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) > { > NodeChroma *c= node->storage; > if(block) > { > short dx= (butr->xmax-butr->xmin)/3; > > NodeChroma *c=node->storage; > uiBlockBeginAlign(block); > uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Enhancement ", > butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20, > &c->t1, 0.0f, 0.5f, 100, 0, ""); > uiDefButS(block, ROW,B_DIFF,"R", > butr->xmin,butr->ymin,dx,20, > &node->custom1,1,1, 0, 0, "Red Spill Suppression"); > uiDefButS(block, ROW,B_DIFF,"G", > butr->xmin+dx,butr->ymin,dx,20, > &node->custom1,1,2, 0, 0, "Green Spill Suppression"); > uiDefButS(block, ROW,B_DIFF,"B", > butr->xmin+2*dx,butr->ymin,dx,20, > &node->custom1,1,3, 0, 0, "Blue Spill Suppression"); > uiBlockEndAlign(block); > } > return 60; > } > > static int node_composit_buts_chroma_matte(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) > { > if(block) > { > short dx= (butr->xmax-butr->xmin)/2; > > NodeChroma *c= node->storage; > uiBlockBeginAlign(block); > > uiDefButS(block, ROW,B_DIFF,"Green", > butr->xmin,butr->ymin+80,dx,20, > &node->custom1,1,1, 0, 0, "Green Background"); > uiDefButS(block, ROW,B_DIFF,"Blue", > butr->xmin+dx,butr->ymin+80,dx,20, > &node->custom1,1,2, 0, 0, "Blue Background"); > > uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Cb Slope ", > butr->xmin, butr->ymin+60, dx, 20, > &c->t1, 0.0f, 20.0f, 100, 0, " "); > > uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Cr slope ", > butr->xmin+dx, butr->ymin+60, dx, 20, > &c->t3, 0.0f, 20.0f, 100, 0, " "); > > uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Cb Pos ", > butr->xmin, butr->ymin+40, dx, 20, > &c->t2, 0.0f, 1.0f, 100, 0, " "); > > uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Cr pos ", > butr->xmin+dx, butr->ymin+40, dx, 20, > &c->fsize, 0.0f, 1.0f, 100, 0, " "); > > uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Threshold ", > butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20, > &c->fstrength, 0.0f, 0.25f, 100, 0, " "); > uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Alpha Threshold ", > butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, > &c->falpha, 0.0f, 1.0f, 100, 0, " "); > } > return 100; > } > 1146a1257,1266 > case CMP_NODE_DIFF_MATTE: > ntype->butfunc=node_composit_buts_diff_matte; > break; > case CMP_NODE_COLOR_SPILL: > ntype->butfunc=node_composit_buts_color_spill; > break; > case CMP_NODE_CHROMA: > ntype->butfunc=node_composit_buts_chroma_matte; > break; > Index: source/blender/src/header_node.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/src/header_node.c,v retrieving revision 1.11 diff -r1.11 header_node.c 374a375,387 > static uiBlock *node_add_mattemenu(void *arg_unused) > { > SpaceNode *snode=curarea->spacedata.first; > uiBlock *block; > > block=uiNewBlock(&curarea->uiblocks, "node_add_mattemenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin); > uiBlockSetButmFunc(block,do_node_addmenu, NULL); > node_make_addmenu(snode, NODE_CLASS_MATTE, block); > uiBlockSetDirection(block, UI_RIGHT); > uiTextBoundsBlock(block,60); > return block; > } > 400a414 > uiDefIconTextBlockBut(block, node_add_mattemenu, NULL, ICON_RIGHTARROW_THIN, "Matte", 0, yco-=20, 120,19,""); Index: source/blender/src/toolbox.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/src/toolbox.c,v retrieving revision 1.138 diff -r1.138 toolbox.c 1528a1529 > #define TB_CMP_MATTE 7 1537a1539 > { 0, "Mattes", 8, NULL}, 1739c1741 < TBitem *node_add_gen= NULL, *node_add_group= NULL, *node_add_out= NULL, *node_add_in= NULL; --- > TBitem *node_add_gen= NULL, *node_add_group= NULL, *node_add_matte=NULL, *node_add_out= NULL, *node_add_in= NULL; 1920a1923 > node_add_matte= node_add_sublevel(&menu1[TB_CMP_MATTE].poin,snode->nodetree, NODE_CLASS_MATTE); 2020a2024 > if(node_add_matte) MEM_freeN(node_add_matte);