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

node_composite_defocus.c File Reference

#include "node_composite_util.h"

Go to the source code of this file.

Classes

struct  BokehCoeffs

Defines

#define YVV(L)
#define TESTBG1(c, w)
#define TESTBG4(c, w)
#define AAPIX(a, b)
#define CSCAN(a, b)

Typedefs

typedef struct BokehCoeffs BokehCoeffs

Functions

static void makeBokeh (char bktype, char ro, int *len_bkh, float *inradsq, BokehCoeffs BKH[8], float bkh_b[4])
static float getWeight (BokehCoeffs *BKH, int len_bkh, float u, float v, float rad, float inradsq)
static float RI_vdC (unsigned int bits, unsigned int r)
static void IIR_gauss_single (CompBuf *buf, float sigma)
static void defocus_blur (bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, float inpval, int no_zbuf)
static void node_composit_exec_defocus (void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
static void node_composit_init_defocus (bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
void register_node_type_cmp_defocus (bNodeTreeType *ttype)

Variables

static bNodeSocketTemplate cmp_node_defocus_in []
static bNodeSocketTemplate cmp_node_defocus_out []

Detailed Description

Definition in file node_composite_defocus.c.


Define Documentation

#define AAPIX (   a,
 
)
Value:
{\
                        int _ny = b;\
                        if ((_ny >= 0) && (_ny < new->y)) {\
                            int _nx = a;\
                            if ((_nx >=0) && (_nx < new->x)) {\
                                p = _ny*new->x + _nx;\
                                if (new->type==CB_VAL) {\
                                    TESTBG1(aacol, lwt);\
                                }\
                                else {\
                                    p4 = p * new->type;\
                                    TESTBG4(aacol, lwt);\
                                }\
                            }\
                        }\
                    }

Referenced by defocus_blur().

#define CSCAN (   a,
 
)
Value:
{\
                        int _ny = y + b;\
                        if ((_ny >= 0) && (_ny < new->y)) {\
                            xs = x - a + 1;\
                            if (xs < 0) xs = 0;\
                            xe = x + a;\
                            if (xe > new->x) xe = new->x;\
                            p = _ny*new->x + xs;\
                            if (new->type==CB_VAL) {\
                                for (_x=xs; _x<xe; _x++, p++) TESTBG1(wtcol, wt);\
                            }\
                            else {\
                                p4 = p * new->type;\
                                for (_x=xs; _x<xe; _x++, p++, p4+=new->type) TESTBG4(wtcol, wt);\
                            }\
                        }\
                    }

Referenced by defocus_blur().

#define TESTBG1 (   c,
 
)
Value:
{\
                    if (ct_crad > nqd->bthresh) {\
                        if (crad->rect[p] > nqd->bthresh) {\
                            new->rect[p] += c[0];\
                            wts->rect[p] += w;\
                        }\
                    }\
                    else {\
                        new->rect[p] += c[0];\
                        wts->rect[p] += w;\
                    }\
                }

Referenced by defocus_blur().

#define TESTBG4 (   c,
 
)
Value:
{\
                    if (ct_crad > nqd->bthresh) {\
                        if (crad->rect[p] > nqd->bthresh) {\
                            new->rect[p4] += c[0];\
                            new->rect[p4+1] += c[1];\
                            new->rect[p4+2] += c[2];\
                            new->rect[p4+3] += c[3];\
                            wts->rect[p] += w;\
                        }\
                    }\
                    else {\
                        new->rect[p4] += c[0];\
                        new->rect[p4+1] += c[1];\
                        new->rect[p4+2] += c[2];\
                        new->rect[p4+3] += c[3];\
                        wts->rect[p] += w;\
                    }\
                }

Referenced by defocus_blur().

#define YVV (   L)
Value:
{\
    W[0] = cf[0]*X[0] + cf[1]*X[0] + cf[2]*X[0] + cf[3]*X[0];\
    W[1] = cf[0]*X[1] + cf[1]*W[0] + cf[2]*X[0] + cf[3]*X[0];\
    W[2] = cf[0]*X[2] + cf[1]*W[1] + cf[2]*W[0] + cf[3]*X[0];\
    for (i=3; i<L; i++)\
        W[i] = cf[0]*X[i] + cf[1]*W[i-1] + cf[2]*W[i-2] + cf[3]*W[i-3];\
    tsu[0] = W[L-1] - X[L-1];\
    tsu[1] = W[L-2] - X[L-1];\
    tsu[2] = W[L-3] - X[L-1];\
    tsv[0] = tsM[0]*tsu[0] + tsM[1]*tsu[1] + tsM[2]*tsu[2] + X[L-1];\
    tsv[1] = tsM[3]*tsu[0] + tsM[4]*tsu[1] + tsM[5]*tsu[2] + X[L-1];\
    tsv[2] = tsM[6]*tsu[0] + tsM[7]*tsu[1] + tsM[8]*tsu[2] + X[L-1];\
    Y[L-1] = cf[0]*W[L-1] + cf[1]*tsv[0] + cf[2]*tsv[1] + cf[3]*tsv[2];\
    Y[L-2] = cf[0]*W[L-2] + cf[1]*Y[L-1] + cf[2]*tsv[0] + cf[3]*tsv[1];\
    Y[L-3] = cf[0]*W[L-3] + cf[1]*Y[L-2] + cf[2]*Y[L-1] + cf[3]*tsv[0];\
    for (i=L-4; i>=0; i--)\
        Y[i] = cf[0]*W[i] + cf[1]*Y[i+1] + cf[2]*Y[i+2] + cf[3]*Y[i+3];\
}

Typedef Documentation

typedef struct BokehCoeffs BokehCoeffs

Function Documentation

static void defocus_blur ( bNode node,
CompBuf new,
CompBuf img,
CompBuf zbuf,
float  inpval,
int  no_zbuf 
) [static]
static float getWeight ( BokehCoeffs BKH,
int  len_bkh,
float  u,
float  v,
float  rad,
float  inradsq 
) [static]

Definition at line 114 of file node_composite_defocus.c.

References BokehCoeffs::dx, BokehCoeffs::dy, BokehCoeffs::x0, and BokehCoeffs::y0.

Referenced by defocus_blur().

static void IIR_gauss_single ( CompBuf buf,
float  sigma 
) [static]

Definition at line 151 of file node_composite_defocus.c.

References CB_VAL, i, MAX2, MEM_callocN(), MEM_freeN(), CompBuf::rect, CompBuf::type, CompBuf::x, X, CompBuf::y, and YVV.

Referenced by defocus_blur().

static void makeBokeh ( char  bktype,
char  ro,
int *  len_bkh,
float *  inradsq,
BokehCoeffs  BKH[8],
float  bkh_b[4] 
) [static]
static void node_composit_exec_defocus ( void *  UNUSEDdata,
bNode node,
bNodeStack **  in,
bNodeStack **  out 
) [static]
static void node_composit_init_defocus ( bNodeTree UNUSEDntree,
bNode node,
bNodeTemplate UNUSEDntemp 
) [static]
void register_node_type_cmp_defocus ( bNodeTreeType ttype)
static float RI_vdC ( unsigned int  bits,
unsigned int  r 
) [static]

Definition at line 136 of file node_composite_defocus.c.

Referenced by defocus_blur().


Variable Documentation

Initial value:
 {
    {   SOCK_RGBA, 1, "Image",          1.0f, 1.0f, 1.0f, 1.0f},
    {   SOCK_FLOAT, 1, "Z",         1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
    {   -1, 0, ""   }
}

Definition at line 36 of file node_composite_defocus.c.

Initial value:
 {
    {   SOCK_RGBA, 0, "Image"},
    {   -1, 0, ""   }
}

Definition at line 41 of file node_composite_defocus.c.