Blender V2.61 - r43446
Classes | Defines | Typedefs | Functions

node_composite_util.h File Reference

#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "MEM_guardedalloc.h"
#include "DNA_camera_types.h"
#include "DNA_color_types.h"
#include "DNA_ID.h"
#include "DNA_image_types.h"
#include "DNA_material_types.h"
#include "DNA_movieclip_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_texture_types.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_rand.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
#include "BKE_blender.h"
#include "BKE_camera.h"
#include "BKE_colortools.h"
#include "BKE_global.h"
#include "BKE_image.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_movieclip.h"
#include "BKE_node.h"
#include "BKE_texture.h"
#include "BKE_tracking.h"
#include "BKE_library.h"
#include "BKE_object.h"
#include "node_util.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
#include "RE_pipeline.h"
#include "RE_shader_ext.h"
#include "RE_render_ext.h"
#include "NOD_composite.h"

Go to the source code of this file.

Classes

struct  CompBuf

Defines

#define CB_RGBA   4
#define CB_VEC4   4
#define CB_VEC3   3
#define CB_VEC2   2
#define CB_VAL   1
#define CHAN_R   0
#define CHAN_G   1
#define CHAN_B   2
#define CHAN_A   3
#define fRGB_clear(c)   { c[0]=c[1]=c[2]=0.f; }
#define fRGB_copy(c1, c2)   { c1[0]=c2[0]; c1[1]=c2[1]; c1[2]=c2[2]; c1[3]=c2[3]; }
#define fRGB_add(c1, c2)   { c1[0]+=c2[0]; c1[1]+=c2[1]; c1[2]+=c2[2]; }
#define fRGB_sub(c1, c2)   { c1[0]-=c2[0]; c1[1]-=c2[1]; c1[2]-=c2[2]; }
#define fRGB_mult(c, s)   { c[0]*=s; c[1]*=s; c[2]*=s; }
#define fRGB_madd(c1, c2, s)   { c1[0]+=c2[0]*s; c1[1]+=c2[1]*s; c1[2]+=c2[2]*s; }
#define fRGB_colormult(c, cs)   { c[0]*=cs[0]; c[1]*=cs[1]; c[2]*=cs[2]; }
#define fRGB_colormadd(c1, c2, c3)   { c1[0]+=c2[0]*c3[0]; c1[1]+=c2[1]*c3[1]; c1[2]+=c2[2]*c3[2]; }
#define fRGB_rgbmult(c, r, g, b)   { c[0]*=(r); c[1]*=(g); c[2]*=(b); }
#define fRGB_swap(c1, c2)
#define CMP_SCALE_MAX   12000

Typedefs

typedef struct CompBuf CompBuf
typedef float fRGB [4]

Functions

CompBufalloc_compbuf (int sizex, int sizey, int type, int alloc)
CompBufdupalloc_compbuf (CompBuf *cbuf)
CompBufpass_on_compbuf (CompBuf *cbuf)
void free_compbuf (CompBuf *cbuf)
void print_compbuf (char *str, CompBuf *cbuf)
void compbuf_set_node (struct CompBuf *cbuf, struct bNode *node)
void node_compo_pass_on (void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out)
CompBufget_cropped_compbuf (rcti *drect, float *rectf, int rectx, int recty, int type)
CompBufscalefast_compbuf (CompBuf *inbuf, int newx, int newy)
CompBuftypecheck_compbuf (CompBuf *inbuf, int type)
void typecheck_compbuf_color (float *out, float *in, int outtype, int intype)
float * compbuf_get_pixel (CompBuf *cbuf, float *defcol, float *use, int x, int y, int xrad, int yrad)
void composit1_pixel_processor (bNode *node, CompBuf *out, CompBuf *src_buf, float *src_col, void(*func)(bNode *, float *, float *), int src_type)
void composit2_pixel_processor (bNode *node, CompBuf *out, CompBuf *src_buf, float *src_col, CompBuf *fac_buf, float *fac, void(*func)(bNode *, float *, float *, float *), int src_type, int fac_type)
void composit3_pixel_processor (bNode *node, CompBuf *out, CompBuf *src1_buf, float *src1_col, CompBuf *src2_buf, float *src2_col, CompBuf *fac_buf, float *fac, void(*func)(bNode *, float *, float *, float *, float *), int src1_type, int src2_type, int fac_type)
void composit4_pixel_processor (bNode *node, CompBuf *out, CompBuf *src1_buf, float *src1_col, CompBuf *fac1_buf, float *fac1, CompBuf *src2_buf, float *src2_col, CompBuf *fac2_buf, float *fac2, void(*func)(bNode *, float *, float *, float *, float *, float *), int src1_type, int fac1_type, int src2_type, int fac2_type)
CompBufvalbuf_from_rgbabuf (CompBuf *cbuf, int channel)
void generate_preview (void *data, bNode *node, CompBuf *stackbuf)
void do_copy_rgba (bNode *node, float *out, float *in)
void do_copy_rgb (bNode *node, float *out, float *in)
void do_copy_value (bNode *node, float *out, float *in)
void do_copy_a_rgba (bNode *node, float *out, float *in, float *fac)
void do_rgba_to_yuva (bNode *node, float *out, float *in)
void do_rgba_to_hsva (bNode *node, float *out, float *in)
void do_rgba_to_ycca (bNode *node, float *out, float *in)
void do_yuva_to_rgba (bNode *node, float *out, float *in)
void do_hsva_to_rgba (bNode *node, float *out, float *in)
void do_ycca_to_rgba (bNode *node, float *out, float *in)
void gamma_correct_compbuf (CompBuf *img, int inversed)
void premul_compbuf (CompBuf *img, int inversed)
void convolve (CompBuf *dst, CompBuf *in1, CompBuf *in2)
void node_ID_title_cb (void *node_v, void *unused_v)
void qd_getPixel (CompBuf *src, int x, int y, float *col)
void qd_setPixel (CompBuf *src, int x, int y, float *col)
void qd_addPixel (CompBuf *src, int x, int y, float *col)
void qd_multPixel (CompBuf *src, int x, int y, float f)
void qd_getPixelLerpWrap (CompBuf *src, float u, float v, float *col)
void qd_getPixelLerp (CompBuf *src, float u, float v, float *col)
void qd_getPixelLerpChan (CompBuf *src, float u, float v, int chan, float *out)
CompBufqd_downScaledCopy (CompBuf *src, int scale)
void IIR_gauss (CompBuf *src, float sigma, int chan, int xy)
CompBufnode_composit_transform (CompBuf *cbuf, float x, float y, float angle, float scale, int filter_type)
float * node_composit_get_float_buffer (RenderData *rd, ImBuf *ibuf, int *alloc)

Detailed Description

Definition in file node_composite_util.h.


Define Documentation

#define CB_RGBA   4

Definition at line 107 of file node_composite_util.h.

Referenced by alloc_compbuf(), compbuf_from_pass(), do_filter_edge(), exec(), fglow(), gamma_correct_compbuf(), generate_preview(), generate_procedural_preview(), node_composit_exec_alphaover(), node_composit_exec_bilateralblur(), node_composit_exec_blur(), node_composit_exec_brightcontrast(), node_composit_exec_channel_matte(), node_composit_exec_chroma_matte(), node_composit_exec_color_matte(), node_composit_exec_color_spill(), node_composit_exec_colorbalance(), node_composit_exec_combhsva(), node_composit_exec_combrgba(), node_composit_exec_combycca(), node_composit_exec_combyuva(), node_composit_exec_composite(), node_composit_exec_curve_rgb(), node_composit_exec_dblur(), node_composit_exec_defocus(), node_composit_exec_diff_matte(), node_composit_exec_displace(), node_composit_exec_distance_matte(), node_composit_exec_gamma(), node_composit_exec_glare(), node_composit_exec_hue_sat(), node_composit_exec_huecorrect(), node_composit_exec_image(), node_composit_exec_invert(), node_composit_exec_lensdist(), node_composit_exec_luma_matte(), node_composit_exec_mapuv(), node_composit_exec_mix_rgb(), node_composit_exec_output_file(), node_composit_exec_premulkey(), node_composit_exec_rgbtobw(), node_composit_exec_rlayers(), node_composit_exec_rotate(), node_composit_exec_scale(), node_composit_exec_sephsva(), node_composit_exec_seprgba(), node_composit_exec_sepycca(), node_composit_exec_sepyuva(), node_composit_exec_setalpha(), node_composit_exec_splitviewer(), node_composit_exec_stabilize2d(), node_composit_exec_texture(), node_composit_exec_tonemap(), node_composit_exec_transform(), node_composit_exec_valtorgb(), node_composit_exec_vecblur(), node_composit_exec_view_levels(), node_composit_exec_viewer(), node_composit_exec_zcombine(), node_composit_transform(), premul_compbuf(), qd_getPixel(), qd_setPixel(), texture_procedural(), typecheck_compbuf(), and typecheck_compbuf_color().

#define CB_VAL   1

Definition at line 111 of file node_composite_util.h.

Referenced by bloom_with_reference(), blur_with_reference(), compbuf_from_pass(), defocus_blur(), do_filter_edge(), IIR_gauss_single(), lensDistort(), node_composit_exec_alphaover(), node_composit_exec_bilateralblur(), node_composit_exec_blur(), node_composit_exec_brightcontrast(), node_composit_exec_color_spill(), node_composit_exec_colorbalance(), node_composit_exec_combhsva(), node_composit_exec_combrgba(), node_composit_exec_combycca(), node_composit_exec_combyuva(), node_composit_exec_composite(), node_composit_exec_curve_rgb(), node_composit_exec_defocus(), node_composit_exec_dilateerode(), node_composit_exec_displace(), node_composit_exec_doubleedgemask(), node_composit_exec_gamma(), node_composit_exec_hue_sat(), node_composit_exec_huecorrect(), node_composit_exec_idmask(), node_composit_exec_invert(), node_composit_exec_map_value(), node_composit_exec_math(), node_composit_exec_mix_rgb(), node_composit_exec_normal(), node_composit_exec_normalize(), node_composit_exec_output_file(), node_composit_exec_rgbtobw(), node_composit_exec_setalpha(), node_composit_exec_splitviewer(), node_composit_exec_texture(), node_composit_exec_valtorgb(), node_composit_exec_vecblur(), node_composit_exec_viewer(), node_composit_exec_zcombine(), node_composit_get_zimage(), qd_getPixel(), qd_getPixelLerp(), qd_getPixelLerpWrap(), qd_setPixel(), texture_procedural(), typecheck_compbuf(), typecheck_compbuf_color(), and valbuf_from_rgbabuf().

#define CB_VEC2   2
#define CB_VEC3   3
#define CB_VEC4   4

Definition at line 108 of file node_composite_util.h.

Referenced by compbuf_from_pass(), and node_composit_exec_vecblur().

#define CHAN_A   3
#define CHAN_B   2
#define CHAN_G   1
#define CHAN_R   0
#define CMP_SCALE_MAX   12000

Definition at line 220 of file node_composite_util.h.

Referenced by node_composit_exec_scale().

#define fRGB_add (   c1,
  c2 
)    { c1[0]+=c2[0]; c1[1]+=c2[1]; c1[2]+=c2[2]; }

Definition at line 188 of file node_composite_util.h.

Referenced by avgLogLum(), convolve(), and qd_downScaledCopy().

#define fRGB_clear (   c)    { c[0]=c[1]=c[2]=0.f; }

Definition at line 184 of file node_composite_util.h.

#define fRGB_colormadd (   c1,
  c2,
  c3 
)    { c1[0]+=c2[0]*c3[0]; c1[1]+=c2[1]*c3[1]; c1[2]+=c2[2]*c3[2]; }

Definition at line 198 of file node_composite_util.h.

#define fRGB_colormult (   c,
  cs 
)    { c[0]*=cs[0]; c[1]*=cs[1]; c[2]*=cs[2]; }

Definition at line 196 of file node_composite_util.h.

Referenced by convolve(), and ghosts().

#define fRGB_copy (   c1,
  c2 
)    { c1[0]=c2[0]; c1[1]=c2[1]; c1[2]=c2[2]; c1[3]=c2[3]; }

Definition at line 186 of file node_composite_util.h.

Referenced by mixImages(), qd_downScaledCopy(), and tonemap().

#define fRGB_madd (   c1,
  c2,
 
)    { c1[0]+=c2[0]*s; c1[1]+=c2[1]*s; c1[2]+=c2[2]*s; }

Definition at line 194 of file node_composite_util.h.

Referenced by ghosts(), and star4().

#define fRGB_mult (   c,
 
)    { c[0]*=s; c[1]*=s; c[2]*=s; }
#define fRGB_rgbmult (   c,
  r,
  g,
 
)    { c[0]*=(r); c[1]*=(g); c[2]*=(b); }

Definition at line 200 of file node_composite_util.h.

Referenced by ghosts(), and streaks().

#define fRGB_sub (   c1,
  c2 
)    { c1[0]-=c2[0]; c1[1]-=c2[1]; c1[2]-=c2[2]; }

Definition at line 190 of file node_composite_util.h.

#define fRGB_swap (   c1,
  c2 
)
Value:
{ float _t=c1[0];  c1[0]=c2[0];  c2[0]=_t;\
                                  _t=c1[1];  c1[1]=c2[1];  c2[1]=_t;\
                                  _t=c1[2];  c1[2]=c2[2];  c2[2]=_t;\
                                  _t=c1[3];  c1[3]=c2[3];  c3[3]=_t;}

Definition at line 202 of file node_composite_util.h.


Typedef Documentation

typedef struct CompBuf CompBuf
typedef float fRGB[4]

Definition at line 182 of file node_composite_util.h.


Function Documentation

CompBuf* alloc_compbuf ( int  sizex,
int  sizey,
int  type,
int  alloc 
)

Definition at line 35 of file node_composite_util.c.

References CB_RGBA, CB_VEC2, CB_VEC3, CompBuf::disprect, CompBuf::malloc, MEM_callocN(), MEM_mapallocN(), CompBuf::rect, CompBuf::type, CompBuf::x, rcti::xmax, rcti::xmin, CompBuf::xrad, CompBuf::y, rcti::ymax, rcti::ymin, and CompBuf::yrad.

Referenced by bloom_with_reference(), blur_single_image(), blur_with_reference(), compbuf_from_pass(), convolve(), defocus_blur(), dupalloc_compbuf(), exec(), fglow(), generate_procedural_preview(), get_cropped_compbuf(), node_composit_exec_alphaover(), node_composit_exec_bilateralblur(), node_composit_exec_blur(), node_composit_exec_color_spill(), node_composit_exec_colorbalance(), node_composit_exec_combhsva(), node_composit_exec_combrgba(), node_composit_exec_combycca(), node_composit_exec_combyuva(), node_composit_exec_composite(), node_composit_exec_crop(), node_composit_exec_curve_rgb(), node_composit_exec_defocus(), node_composit_exec_displace(), node_composit_exec_doubleedgemask(), node_composit_exec_filter(), node_composit_exec_flip(), node_composit_exec_gamma(), node_composit_exec_huecorrect(), node_composit_exec_idmask(), node_composit_exec_invert(), node_composit_exec_lensdist(), node_composit_exec_map_value(), node_composit_exec_mapuv(), node_composit_exec_math(), node_composit_exec_mix_rgb(), node_composit_exec_normal(), node_composit_exec_normalize(), node_composit_exec_rgbtobw(), node_composit_exec_rlayers(), node_composit_exec_rotate(), node_composit_exec_scale(), node_composit_exec_setalpha(), node_composit_exec_splitviewer(), node_composit_exec_texture(), node_composit_exec_valtorgb(), node_composit_exec_view_levels(), node_composit_exec_viewer(), node_composit_exec_zcombine(), node_composit_get_image(), node_composit_get_movieclip(), node_composit_get_zimage(), node_composit_transform(), pass_on_compbuf(), qd_downScaledCopy(), scalefast_compbuf(), streaks(), typecheck_compbuf(), and valbuf_from_rgbabuf().

float* compbuf_get_pixel ( CompBuf cbuf,
float *  defcol,
float *  use,
int  x,
int  y,
int  xrad,
int  yrad 
)
void compbuf_set_node ( struct CompBuf cbuf,
struct bNode node 
)

Definition at line 128 of file node_composite_util.c.

References CompBuf::node.

Referenced by local_merge(), and localize().

void composit1_pixel_processor ( bNode node,
CompBuf out,
CompBuf src_buf,
float *  src_col,
void(*)(bNode *, float *, float *)  func,
int  src_type 
)
void composit2_pixel_processor ( bNode node,
CompBuf out,
CompBuf src_buf,
float *  src_col,
CompBuf fac_buf,
float *  fac,
void(*)(bNode *, float *, float *, float *)  func,
int  src_type,
int  fac_type 
)
void composit3_pixel_processor ( bNode node,
CompBuf out,
CompBuf src1_buf,
float *  src1_col,
CompBuf src2_buf,
float *  src2_col,
CompBuf fac_buf,
float *  fac,
void(*)(bNode *, float *, float *, float *, float *)  func,
int  src1_type,
int  src2_type,
int  fac_type 
)
void composit4_pixel_processor ( bNode node,
CompBuf out,
CompBuf src1_buf,
float *  src1_col,
CompBuf fac1_buf,
float *  fac1,
CompBuf src2_buf,
float *  src2_col,
CompBuf fac2_buf,
float *  fac2,
void(*)(bNode *, float *, float *, float *, float *, float *)  func,
int  src1_type,
int  fac1_type,
int  src2_type,
int  fac2_type 
)
void convolve ( CompBuf dst,
CompBuf in1,
CompBuf in2 
)
void do_copy_a_rgba ( bNode node,
float *  out,
float *  in,
float *  fac 
)
void do_copy_rgb ( bNode node,
float *  out,
float *  in 
)
void do_copy_rgba ( bNode node,
float *  out,
float *  in 
)
void do_copy_value ( bNode node,
float *  out,
float *  in 
)
void do_hsva_to_rgba ( bNode node,
float *  out,
float *  in 
)
void do_rgba_to_hsva ( bNode node,
float *  out,
float *  in 
)
void do_rgba_to_ycca ( bNode node,
float *  out,
float *  in 
)
void do_rgba_to_yuva ( bNode node,
float *  out,
float *  in 
)
void do_ycca_to_rgba ( bNode node,
float *  out,
float *  in 
)
void do_yuva_to_rgba ( bNode node,
float *  out,
float *  in 
)
CompBuf* dupalloc_compbuf ( CompBuf cbuf)
void free_compbuf ( CompBuf cbuf)

Definition at line 99 of file node_composite_util.c.

References CompBuf::malloc, MEM_freeN(), CompBuf::next, CompBuf::prev, and CompBuf::rect.

Referenced by bloom_with_reference(), blur_single_image(), blur_with_reference(), composit1_pixel_processor(), composit2_pixel_processor(), composit3_pixel_processor(), composit4_pixel_processor(), convolve(), dblur(), defocus_blur(), exec(), fglow(), free_node_cache(), freeExecutableNode(), generate_preview(), ghosts(), group_free_internal(), lensDistort(), node_composit_exec_bilateralblur(), node_composit_exec_blur(), node_composit_exec_brightcontrast(), node_composit_exec_channel_matte(), node_composit_exec_chroma_matte(), node_composit_exec_color_matte(), node_composit_exec_color_spill(), node_composit_exec_composite(), node_composit_exec_defocus(), node_composit_exec_diff_matte(), node_composit_exec_dilateerode(), node_composit_exec_displace(), node_composit_exec_distance_matte(), node_composit_exec_glare(), node_composit_exec_hue_sat(), node_composit_exec_luma_matte(), node_composit_exec_mapuv(), node_composit_exec_output_file(), node_composit_exec_premulkey(), node_composit_exec_rotate(), node_composit_exec_scale(), node_composit_exec_sephsva(), node_composit_exec_seprgba(), node_composit_exec_sepycca(), node_composit_exec_sepyuva(), node_composit_exec_splitviewer(), node_composit_exec_stabilize2d(), node_composit_exec_texture(), node_composit_exec_tonemap(), node_composit_exec_transform(), node_composit_exec_vecblur(), node_composit_exec_view_levels(), node_composit_exec_viewer(), node_composit_exec_zcombine(), setExecutableNodes(), star4(), and streaks().

void gamma_correct_compbuf ( CompBuf img,
int  inversed 
)
void generate_preview ( void *  data,
bNode node,
CompBuf stackbuf 
)
CompBuf* get_cropped_compbuf ( rcti drect,
float *  rectf,
int  rectx,
int  recty,
int  type 
)
void IIR_gauss ( CompBuf src,
float  sigma,
int  chan,
int  xy 
)
void node_compo_pass_on ( void *  data,
int  thread,
struct bNode node,
void *  nodedata,
struct bNodeStack **  in,
struct bNodeStack **  out 
)
float* node_composit_get_float_buffer ( RenderData rd,
ImBuf ibuf,
int *  alloc 
)
CompBuf* node_composit_transform ( CompBuf cbuf,
float  x,
float  y,
float  angle,
float  scale,
int  filter_type 
)
void node_ID_title_cb ( void *  node_v,
void *  unused_v 
)
CompBuf* pass_on_compbuf ( CompBuf cbuf)
void premul_compbuf ( CompBuf img,
int  inversed 
)
void print_compbuf ( char *  str,
CompBuf cbuf 
)

Definition at line 122 of file node_composite_util.c.

References CompBuf::rect, CompBuf::x, and CompBuf::y.

void qd_addPixel ( CompBuf src,
int  x,
int  y,
float *  col 
)

Definition at line 1182 of file node_composite_util.c.

References CompBuf::rect, CompBuf::type, and CompBuf::x.

CompBuf* qd_downScaledCopy ( CompBuf src,
int  scale 
)
void qd_getPixel ( CompBuf src,
int  x,
int  y,
float *  col 
)
void qd_getPixelLerp ( CompBuf src,
float  u,
float  v,
float *  col 
)
void qd_getPixelLerpChan ( CompBuf src,
float  u,
float  v,
int  chan,
float *  out 
)

Definition at line 1247 of file node_composite_util.c.

References B, CompBuf::rect, CompBuf::type, CompBuf::x, and CompBuf::y.

Referenced by lensDistort().

void qd_getPixelLerpWrap ( CompBuf src,
float  u,
float  v,
float *  col 
)

Definition at line 1200 of file node_composite_util.c.

References CB_VAL, CompBuf::rect, CompBuf::type, CompBuf::x, and CompBuf::y.

Referenced by dblur().

void qd_multPixel ( CompBuf src,
int  x,
int  y,
float  f 
)

Definition at line 1191 of file node_composite_util.c.

References CompBuf::rect, CompBuf::type, and CompBuf::x.

void qd_setPixel ( CompBuf src,
int  x,
int  y,
float *  col 
)
CompBuf* scalefast_compbuf ( CompBuf inbuf,
int  newx,
int  newy 
)
CompBuf* typecheck_compbuf ( CompBuf inbuf,
int  type 
)
void typecheck_compbuf_color ( float *  out,
float *  in,
int  outtype,
int  intype 
)

Definition at line 221 of file node_composite_util.c.

References CB_RGBA, CB_VAL, CB_VEC2, and CB_VEC3.

Referenced by texture_procedural().

CompBuf* valbuf_from_rgbabuf ( CompBuf cbuf,
int  channel 
)