Dosvidanya, old compositor!
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 14 Jan 2013 15:53:17 +0000 (15:53 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 14 Jan 2013 15:53:17 +0000 (15:53 +0000)
You served well and now desired retirement, but you'll always live in our hearts.

And for sure -- monument!

       +-------------------------------------------+
      /   ++==+   .  ..   .   ...    .  ..     .  /
     /   //    ++==++  ++  ++     ++==++ ++==++  /
    /   //    //  //  //\\//\\   //  // //  //  /
   /   ++==+ ++==++  //      \\ //==++ ++==++  /
  /  .    ...   ..    .       //  ..  ...     /
 +-------------------------------------------+

Some notes:
- Removed all code which was from inside ifdef WITH_COMPOSITOR_LEGACY
- Removed some functions which were used by old compositor only but
  weren't ported to new color management
- Removed WITH_COMPOSITOR_LEGACY from build systems
- node_composite_util.h was in fatc used by compo nodes specification
  files, so added it back to cmake.

  Could be cleaned up by moving header files to files where they're
  actually needed but would consider this is a separate task.

- Should be no functional changes!

74 files changed:
CMakeLists.txt
build_files/scons/tools/btools.py
source/blender/nodes/CMakeLists.txt
source/blender/nodes/SConscript
source/blender/nodes/composite/node_composite_tree.c
source/blender/nodes/composite/node_composite_util.c [deleted file]
source/blender/nodes/composite/node_composite_util.h
source/blender/nodes/composite/nodes/node_composite_alphaOver.c
source/blender/nodes/composite/nodes/node_composite_bilateralblur.c
source/blender/nodes/composite/nodes/node_composite_blur.c
source/blender/nodes/composite/nodes/node_composite_brightness.c
source/blender/nodes/composite/nodes/node_composite_channelMatte.c
source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
source/blender/nodes/composite/nodes/node_composite_colorMatte.c
source/blender/nodes/composite/nodes/node_composite_colorSpill.c
source/blender/nodes/composite/nodes/node_composite_colorbalance.c
source/blender/nodes/composite/nodes/node_composite_common.c
source/blender/nodes/composite/nodes/node_composite_composite.c
source/blender/nodes/composite/nodes/node_composite_crop.c
source/blender/nodes/composite/nodes/node_composite_curves.c
source/blender/nodes/composite/nodes/node_composite_defocus.c
source/blender/nodes/composite/nodes/node_composite_despeckle.c
source/blender/nodes/composite/nodes/node_composite_diffMatte.c
source/blender/nodes/composite/nodes/node_composite_dilate.c
source/blender/nodes/composite/nodes/node_composite_directionalblur.c
source/blender/nodes/composite/nodes/node_composite_displace.c
source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
source/blender/nodes/composite/nodes/node_composite_filter.c
source/blender/nodes/composite/nodes/node_composite_flip.c
source/blender/nodes/composite/nodes/node_composite_gamma.c
source/blender/nodes/composite/nodes/node_composite_glare.c
source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
source/blender/nodes/composite/nodes/node_composite_huecorrect.c
source/blender/nodes/composite/nodes/node_composite_idMask.c
source/blender/nodes/composite/nodes/node_composite_image.c
source/blender/nodes/composite/nodes/node_composite_inpaint.c
source/blender/nodes/composite/nodes/node_composite_invert.c
source/blender/nodes/composite/nodes/node_composite_keying.c
source/blender/nodes/composite/nodes/node_composite_keyingscreen.c
source/blender/nodes/composite/nodes/node_composite_lensdist.c
source/blender/nodes/composite/nodes/node_composite_levels.c
source/blender/nodes/composite/nodes/node_composite_lummaMatte.c
source/blender/nodes/composite/nodes/node_composite_mapUV.c
source/blender/nodes/composite/nodes/node_composite_mapValue.c
source/blender/nodes/composite/nodes/node_composite_mask.c
source/blender/nodes/composite/nodes/node_composite_math.c
source/blender/nodes/composite/nodes/node_composite_mixrgb.c
source/blender/nodes/composite/nodes/node_composite_movieclip.c
source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
source/blender/nodes/composite/nodes/node_composite_normal.c
source/blender/nodes/composite/nodes/node_composite_normalize.c
source/blender/nodes/composite/nodes/node_composite_outputFile.c
source/blender/nodes/composite/nodes/node_composite_premulkey.c
source/blender/nodes/composite/nodes/node_composite_rgb.c
source/blender/nodes/composite/nodes/node_composite_rotate.c
source/blender/nodes/composite/nodes/node_composite_scale.c
source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c
source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
source/blender/nodes/composite/nodes/node_composite_setalpha.c
source/blender/nodes/composite/nodes/node_composite_splitViewer.c
source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
source/blender/nodes/composite/nodes/node_composite_texture.c
source/blender/nodes/composite/nodes/node_composite_tonemap.c
source/blender/nodes/composite/nodes/node_composite_trackpos.c
source/blender/nodes/composite/nodes/node_composite_transform.c
source/blender/nodes/composite/nodes/node_composite_translate.c
source/blender/nodes/composite/nodes/node_composite_valToRgb.c
source/blender/nodes/composite/nodes/node_composite_value.c
source/blender/nodes/composite/nodes/node_composite_vecBlur.c
source/blender/nodes/composite/nodes/node_composite_viewer.c
source/blender/nodes/composite/nodes/node_composite_zcombine.c

index 96f2df316cd76ebb452c3001e8bd779efc7b8e91..59dbeaed36b27f4d3d85fdaab6688e7214680fe4 100644 (file)
@@ -135,7 +135,6 @@ option(WITH_GAMEENGINE    "Enable Game Engine" ON)
 option(WITH_PLAYER        "Build Player" OFF)
 option(WITH_OPENCOLORIO   "Enable OpenColorIO color management" ON)
 option(WITH_COMPOSITOR    "Enable the tile based nodal compositor" ON)
-option(WITH_COMPOSITOR_LEGACY "Enable legacy compositor" OFF)
 
 # GHOST Windowing Library Options
 option(WITH_GHOST_DEBUG   "Enable debugging output for the GHOST library" OFF)
index 22360447343a94e9fc31e56b7db32a889062aed2..ee6dd20ecc033c4fa6381cf2f34562a73f49c8ab 100644 (file)
@@ -108,7 +108,7 @@ def validate_arguments(args, bc):
             'WITH_BF_STATICFFMPEG', 'BF_FFMPEG_LIB_STATIC',
             'WITH_BF_OGG', 'BF_OGG', 'BF_OGG_LIB',
             'WITH_BF_FRAMESERVER',
-            'WITH_BF_COMPOSITOR', 'WITH_BF_COMPOSITOR_LEGACY',
+            'WITH_BF_COMPOSITOR',
             'WITH_BF_JPEG', 'BF_JPEG', 'BF_JPEG_INC', 'BF_JPEG_LIB', 'BF_JPEG_LIBPATH', 'WITH_BF_STATICJPEG', 'BF_JPEG_LIB_STATIC',
             'WITH_BF_OPENJPEG', 'BF_OPENJPEG', 'BF_OPENJPEG_INC', 'BF_OPENJPEG_LIB', 'BF_OPENJPEG_LIBPATH',
             'WITH_BF_REDCODE', 'BF_REDCODE', 'BF_REDCODE_INC', 'BF_REDCODE_LIB', 'BF_REDCODE_LIBPATH',
@@ -599,7 +599,6 @@ def read_opts(env, cfg, args):
         ('BF_BOOST_LIB_STATIC', 'Boost static library', ''),
 
         (BoolVariable('WITH_GHOST_XDND', 'Build with drag-n-drop support on Linux platforms using XDND protocol', True)),
-        (BoolVariable('WITH_BF_COMPOSITOR_LEGACY', 'Enable the legacy compositor', False)),
 
         (BoolVariable('WITH_BF_CYCLES_OSL', 'Build with OSL sypport in Cycles', False)),
         (BoolVariable('WITH_BF_STATICOSL', 'Staticly link to OSL', False)),
index a7b491cf42b5f629d62870b612d985fa3eaa8e47..12842085189605dc749a12ca753184e53e72a985 100644 (file)
@@ -123,6 +123,7 @@ set(SRC
        composite/nodes/node_composite_pixelate.c
 
        composite/node_composite_tree.c
+       composite/node_composite_util.h
 
        shader/nodes/node_shader_camera.c
        shader/nodes/node_shader_common.c
@@ -235,13 +236,6 @@ set(SRC
        intern/node_common.h
 )
 
-if(WITH_COMPOSITOR_LEGACY)
-       list(APPEND SRC
-               composite/node_composite_util.h
-               composite/node_composite_util.c
-       )
-endif()
-
 if(WITH_PYTHON)
        list(APPEND INC
                ../python
@@ -267,8 +261,4 @@ if(WITH_COMPOSITOR)
        add_definitions(-DWITH_COMPOSITOR)
 endif()
 
-if(WITH_COMPOSITOR_LEGACY)
-       add_definitions(-DWITH_COMPOSITOR_LEGACY)
-endif()
-
 blender_add_lib(bf_nodes "${SRC}" "${INC}" "${INC_SYS}")
index cc7359029344b305b131ddc4b6babd68014b7a7f..9f56689bf4326042d1b56a9c150e8f6867b28032 100644 (file)
@@ -66,9 +66,6 @@ if env['WITH_BF_COMPOSITOR']:
     incs += ' ../compositor '
     defs.append("WITH_COMPOSITOR")
 
-if env['WITH_BF_COMPOSITOR_LEGACY']:
-    defs.append("WITH_COMPOSITOR_LEGACY")
-
 env.BlenderLib ( libname = 'bf_nodes', sources = sources, includes = Split(incs), defines = defs, libtype=['core','player'], priority = [190,105] )
 env.BlenderLib ( libname = 'bf_cmpnodes', sources = cmpsources, includes = Split(incs), defines = defs, libtype=['core','player'], priority = [175,101] )
 env.BlenderLib ( libname = 'bf_shdnodes', sources = shdsources, includes = Split(incs), defines = defs, libtype=['core','player'], priority = [175,101] )
index 03462738d58ceb3e7342dea5d608fc76b4163943..7004b722bc96f436569cab67eafe997c41448242 100644 (file)
@@ -95,9 +95,6 @@ static void free_node_cache(bNodeTree *UNUSED(ntree), bNode *node)
        
        for (sock= node->outputs.first; sock; sock= sock->next) {
                if (sock->cache) {
-#ifdef WITH_COMPOSITOR_LEGACY
-                       free_compbuf(sock->cache);
-#endif
                        sock->cache= NULL;
                }
        }
@@ -161,9 +158,6 @@ static void localize(bNodeTree *localtree, bNodeTree *ntree)
                
                for (sock= node->outputs.first; sock; sock= sock->next) {
                        sock->new_sock->cache= sock->cache;
-#ifdef WITH_COMPOSITOR_LEGACY
-                       compbuf_set_node(sock->new_sock->cache, node->new_node);
-#endif
                        sock->cache= NULL;
                        sock->new_sock->new_sock= sock;
                }
@@ -239,9 +233,6 @@ static void local_merge(bNodeTree *localtree, bNodeTree *ntree)
                        for (lsock= lnode->outputs.first; lsock; lsock= lsock->next) {
                                if (ntreeOutputExists(lnode->new_node, lsock->new_sock)) {
                                        lsock->new_sock->cache= lsock->cache;
-#ifdef WITH_COMPOSITOR_LEGACY
-                                       compbuf_set_node(lsock->new_sock->cache, lnode->new_node);
-#endif
                                        lsock->cache= NULL;
                                        lsock->new_sock= NULL;
                                }
@@ -363,335 +354,6 @@ void ntreeCompositEndExecTree(bNodeTreeExec *exec, int use_tree_data)
        }
 }
 
-#ifdef WITH_COMPOSITOR
-#ifdef WITH_COMPOSITOR_LEGACY
-
-/* ***************************** threaded version for execute composite nodes ************* */
-/* these are nodes without input, only giving values */
-/* or nodes with only value inputs */
-static int node_only_value(bNode *node)
-{
-       bNodeSocket *sock;
-       
-       if (ELEM3(node->type, CMP_NODE_TIME, CMP_NODE_VALUE, CMP_NODE_RGB))
-               return 1;
-       
-       /* doing this for all node types goes wrong. memory free errors */
-       if (node->inputs.first && node->type==CMP_NODE_MAP_VALUE) {
-               int retval= 1;
-               for (sock= node->inputs.first; sock; sock= sock->next) {
-                       if (sock->link)
-                               retval &= node_only_value(sock->link->fromnode);
-               }
-               return retval;
-       }
-       return 0;
-}
-
-/* not changing info, for thread callback */
-typedef struct ThreadData {
-       bNodeStack *stack;
-       RenderData *rd;
-} ThreadData;
-
-static void *exec_composite_node(void *nodeexec_v)
-{
-       bNodeStack *nsin[MAX_SOCKET];   /* arbitrary... watch this */
-       bNodeStack *nsout[MAX_SOCKET];  /* arbitrary... watch this */
-       bNodeExec *nodeexec= nodeexec_v;
-       bNode *node= nodeexec->node;
-       ThreadData *thd= (ThreadData *)node->threaddata;
-       
-       node_get_stack(node, thd->stack, nsin, nsout);
-       
-       if (node->typeinfo->execfunc)
-               node->typeinfo->execfunc(thd->rd, node, nsin, nsout);
-       else if (node->typeinfo->newexecfunc)
-               node->typeinfo->newexecfunc(thd->rd, 0, node, nodeexec->data, nsin, nsout);
-       
-       node->exec |= NODE_READY;
-       return NULL;
-}
-
-/* return total of executable nodes, for timecursor */
-static int setExecutableNodes(bNodeTreeExec *exec, ThreadData *thd)
-{
-       bNodeTree *ntree = exec->nodetree;
-       bNodeStack *nsin[MAX_SOCKET];   /* arbitrary... watch this */
-       bNodeStack *nsout[MAX_SOCKET];  /* arbitrary... watch this */
-       bNodeExec *nodeexec;
-       bNode *node;
-       bNodeSocket *sock;
-       int n, totnode= 0, group_edit= 0;
-       
-       /* if we are in group edit, viewer nodes get skipped when group has viewer */
-       for (node= ntree->nodes.first; node; node= node->next)
-               if (node->type==NODE_GROUP && (node->flag & NODE_GROUP_EDIT))
-                       if (ntreeHasType((bNodeTree *)node->id, CMP_NODE_VIEWER))
-                               group_edit= 1;
-       
-       /* NB: using the exec data list here to have valid dependency sort */
-       for (n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
-               int a;
-               node = nodeexec->node;
-               
-               node_get_stack(node, exec->stack, nsin, nsout);
-               
-               /* test the outputs */
-               /* skip value-only nodes (should be in type!) */
-               if (!node_only_value(node)) {
-                       for (a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
-                               if (nsout[a]->data==NULL && nsout[a]->hasoutput) {
-                                       node->need_exec= 1;
-                                       break;
-                               }
-                       }
-               }
-               
-               /* test the inputs */
-               for (a=0, sock= node->inputs.first; sock; sock= sock->next, a++) {
-                       /* skip viewer nodes in bg render or group edit */
-                       if ( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER) && (G.background || group_edit))
-                               node->need_exec= 0;
-                       /* is sock in use? */
-                       else if (sock->link) {
-                               bNodeLink *link= sock->link;
-                               
-                               /* this is the test for a cyclic case */
-                               if (link->fromnode==NULL || link->tonode==NULL);
-                               else if (link->fromnode->level >= link->tonode->level && link->tonode->level!=0xFFF) {
-                                       if (link->fromnode->need_exec) {
-                                               node->need_exec= 1;
-                                               break;
-                                       }
-                               }
-                               else {
-                                       node->need_exec= 0;
-                                       printf("Node %s skipped, cyclic dependency\n", node->name);
-                               }
-                       }
-               }
-               
-               if (node->need_exec) {
-                       
-                       /* free output buffers */
-                       for (a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
-                               if (nsout[a]->data) {
-                                       free_compbuf(nsout[a]->data);
-                                       nsout[a]->data= NULL;
-                               }
-                       }
-                       totnode++;
-                       /* printf("node needs exec %s\n", node->name); */
-                       
-                       /* tag for getExecutableNode() */
-                       node->exec= 0;
-               }
-               else {
-                       /* tag for getExecutableNode() */
-                       node->exec= NODE_READY|NODE_FINISHED|NODE_SKIPPED;
-                       
-               }
-       }
-       
-       /* last step: set the stack values for only-value nodes */
-       /* just does all now, compared to a full buffer exec this is nothing */
-       if (totnode) {
-               for (n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
-                       node = nodeexec->node;
-                       if (node->need_exec==0 && node_only_value(node)) {
-                               if (node->typeinfo->execfunc) {
-                                       node_get_stack(node, exec->stack, nsin, nsout);
-                                       node->typeinfo->execfunc(thd->rd, node, nsin, nsout);
-                               }
-                       }
-               }
-       }
-       
-       return totnode;
-}
-
-/* while executing tree, free buffers from nodes that are not needed anymore */
-static void freeExecutableNode(bNodeTreeExec *exec)
-{
-       /* node outputs can be freed when:
-        * - not a render result or image node
-        * - when node outputs go to nodes all being set NODE_FINISHED
-        */
-       bNodeTree *ntree = exec->nodetree;
-       bNodeExec *nodeexec;
-       bNode *node;
-       bNodeSocket *sock;
-       int n;
-       
-       /* set exec flag for finished nodes that might need freed */
-       for (node= ntree->nodes.first; node; node= node->next) {
-               if (node->type!=CMP_NODE_R_LAYERS)
-                       if (node->exec & NODE_FINISHED)
-                               node->exec |= NODE_FREEBUFS;
-       }
-       /* clear this flag for input links that are not done yet.
-        * Using the exec data for valid dependency sort.
-        */
-       for (n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
-               node = nodeexec->node;
-               if ((node->exec & NODE_FINISHED)==0) {
-                       for (sock= node->inputs.first; sock; sock= sock->next)
-                               if (sock->link)
-                                       sock->link->fromnode->exec &= ~NODE_FREEBUFS;
-               }
-       }
-       /* now we can free buffers */
-       for (node= ntree->nodes.first; node; node= node->next) {
-               if (node->exec & NODE_FREEBUFS) {
-                       for (sock= node->outputs.first; sock; sock= sock->next) {
-                               bNodeStack *ns= node_get_socket_stack(exec->stack, sock);
-                               if (ns && ns->data) {
-                                       free_compbuf(ns->data);
-                                       ns->data= NULL;
-                                       // printf("freed buf node %s\n", node->name);
-                               }
-                       }
-               }
-       }
-}
-
-static bNodeExec *getExecutableNode(bNodeTreeExec *exec)
-{
-       bNodeExec *nodeexec;
-       bNodeSocket *sock;
-       int n;
-       
-       for (n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
-               if (nodeexec->node->exec==0) {
-                       /* input sockets should be ready */
-                       for (sock= nodeexec->node->inputs.first; sock; sock= sock->next) {
-                               if (sock->link && sock->link->fromnode)
-                                       if ((sock->link->fromnode->exec & NODE_READY)==0)
-                                               break;
-                       }
-                       if (sock==NULL)
-                               return nodeexec;
-               }
-       }
-       return NULL;
-}
-
-/* check if texture nodes need exec or end */
-static  void ntree_composite_texnode(bNodeTree *ntree, int init)
-{
-       bNode *node;
-       
-       for (node= ntree->nodes.first; node; node= node->next) {
-               if (node->type==CMP_NODE_TEXTURE && node->id) {
-                       Tex *tex= (Tex *)node->id;
-                       if (tex->nodetree && tex->use_nodes) {
-                               /* has internal flag to detect it only does it once */
-                               if (init) {
-                                       if (!tex->nodetree->execdata)
-                                               tex->nodetree->execdata = ntreeTexBeginExecTree(tex->nodetree, 1); 
-                               }
-                               else
-                                       ntreeTexEndExecTree(tex->nodetree->execdata, 1);
-                                       tex->nodetree->execdata = NULL;
-                       }
-               }
-       }
-
-}
-
-/* optimized tree execute test for compositing */
-static void ntreeCompositExecTreeOld(bNodeTree *ntree, RenderData *rd, int do_preview)
-{
-       bNodeExec *nodeexec;
-       bNode *node;
-       ListBase threads;
-       ThreadData thdata;
-       int totnode, curnode, rendering = TRUE, n;
-       bNodeTreeExec *exec = ntree->execdata;
-
-       if (do_preview)
-               ntreeInitPreview(ntree, 0, 0);
-       
-       if (!ntree->execdata) {
-               /* XXX this is the top-level tree, so we use the ntree->execdata pointer. */
-               exec = ntreeCompositBeginExecTree(ntree, 1);
-       }
-       ntree_composite_texnode(ntree, 1);
-       
-       /* prevent unlucky accidents */
-       if (G.background)
-               rd->scemode &= ~R_COMP_CROP;
-       
-       /* setup callerdata for thread callback */
-       thdata.rd= rd;
-       thdata.stack= exec->stack;
-       
-       /* fixed seed, for example noise texture */
-       BLI_srandom(rd->cfra);
-
-       /* sets need_exec tags in nodes */
-       curnode = totnode= setExecutableNodes(exec, &thdata);
-
-       BLI_init_threads(&threads, exec_composite_node, rd->threads);
-       
-       while (rendering) {
-               
-               if (BLI_available_threads(&threads)) {
-                       nodeexec= getExecutableNode(exec);
-                       if (nodeexec) {
-                               node = nodeexec->node;
-                               if (ntree->progress && totnode)
-                                       ntree->progress(ntree->prh, (1.0f - curnode/(float)totnode));
-                               if (ntree->stats_draw) {
-                                       char str[128];
-                                       BLI_snprintf(str, sizeof(str), "Compositing %d %s", curnode, node->name);
-                                       ntree->stats_draw(ntree->sdh, str);
-                               }
-                               curnode--;
-                               
-                               node->threaddata = &thdata;
-                               node->exec= NODE_PROCESSING;
-                               BLI_insert_thread(&threads, nodeexec);
-                       }
-                       else
-                               PIL_sleep_ms(50);
-               }
-               else
-                       PIL_sleep_ms(50);
-               
-               rendering= 0;
-               /* test for ESC */
-               if (ntree->test_break && ntree->test_break(ntree->tbh)) {
-                       for (node= ntree->nodes.first; node; node= node->next)
-                               node->exec |= NODE_READY;
-               }
-               
-               /* check for ready ones, and if we need to continue */
-               for (n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
-                       node = nodeexec->node;
-                       if (node->exec & NODE_READY) {
-                               if ((node->exec & NODE_FINISHED)==0) {
-                                       BLI_remove_thread(&threads, nodeexec); /* this waits for running thread to finish btw */
-                                       node->exec |= NODE_FINISHED;
-                                       
-                                       /* freeing unused buffers */
-                                       if (rd->scemode & R_COMP_FREE)
-                                               freeExecutableNode(exec);
-                               }
-                       }
-                       else rendering= 1;
-               }
-       }
-       
-       BLI_end_threads(&threads);
-       
-       /* XXX top-level tree uses the ntree->execdata pointer */
-       ntreeCompositEndExecTree(exec, 1);
-}
-#endif  /* WITH_COMPOSITOR_LEGACY */
-#endif  /* WITH_COMPOSITOR */
-
 void *COM_linker_hack = NULL;
 
 void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int rendering, int do_preview,
@@ -699,16 +361,7 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int rendering, int
                            const ColorManagedDisplaySettings *display_settings)
 {
 #ifdef WITH_COMPOSITOR
-#ifdef WITH_COMPOSITOR_LEGACY
-       if (G.debug_value == 200)
-       {
-               ntreeCompositExecTreeOld(ntree, rd, do_preview);
-       }
-       else
-#endif
-       {
-               COM_execute(rd, ntree, rendering, view_settings, display_settings);
-       }
+       COM_execute(rd, ntree, rendering, view_settings, display_settings);
 #else
        (void)ntree, (void)rd, (void)rendering, (void)do_preview;
        (void)view_settings, (void)display_settings;
diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c
deleted file mode 100644 (file)
index c4b48b8..0000000
+++ /dev/null
@@ -1,1412 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. 
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2006 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/nodes/composite/node_composite_util.c
- *  \ingroup nodes
- */
-
-#include "node_composite_util.h"
-
-#ifdef WITH_COMPOSITOR_LEGACY
-
-#include <limits.h>
-
-CompBuf *alloc_compbuf(int sizex, int sizey, int type, int alloc)
-{
-       CompBuf *cbuf= MEM_callocN(sizeof(CompBuf), "compbuf");
-       
-       cbuf->x= sizex;
-       cbuf->y= sizey;
-       cbuf->xrad= sizex/2;
-       cbuf->yrad= sizey/2;
-       
-       cbuf->type= type;
-       if (alloc) {
-               if (cbuf->type==CB_RGBA)
-                       cbuf->rect= MEM_mapallocN(4*sizeof(float)*sizex*sizey, "compbuf RGBA rect");
-               else if (cbuf->type==CB_VEC3)
-                       cbuf->rect= MEM_mapallocN(3*sizeof(float)*sizex*sizey, "compbuf Vector3 rect");
-               else if (cbuf->type==CB_VEC2)
-                       cbuf->rect= MEM_mapallocN(2*sizeof(float)*sizex*sizey, "compbuf Vector2 rect");
-               else
-                       cbuf->rect= MEM_mapallocN(sizeof(float)*sizex*sizey, "compbuf Fac rect");
-               cbuf->malloc= 1;
-       }
-       cbuf->disprect.xmin = 0;
-       cbuf->disprect.ymin = 0;
-       cbuf->disprect.xmax = sizex;
-       cbuf->disprect.ymax = sizey;
-       
-       return cbuf;
-}
-
-CompBuf *dupalloc_compbuf(CompBuf *cbuf)
-{
-       CompBuf *dupbuf= alloc_compbuf(cbuf->x, cbuf->y, cbuf->type, 1);
-       if (dupbuf) {
-               memcpy(dupbuf->rect, cbuf->rect, cbuf->type*sizeof(float)*cbuf->x*cbuf->y);
-       
-               dupbuf->xof= cbuf->xof;
-               dupbuf->yof= cbuf->yof;
-       }
-       return dupbuf;
-}
-
-/* instead of reference counting, we create a list */
-CompBuf *pass_on_compbuf(CompBuf *cbuf)
-{
-       CompBuf *dupbuf= (cbuf)? alloc_compbuf(cbuf->x, cbuf->y, cbuf->type, 0): NULL;
-       CompBuf *lastbuf;
-       
-       if (dupbuf) {
-               dupbuf->rect= cbuf->rect;
-               dupbuf->xof= cbuf->xof;
-               dupbuf->yof= cbuf->yof;
-               dupbuf->malloc= 0;
-               
-               /* get last buffer in list, and append dupbuf */
-               for (lastbuf= cbuf; lastbuf; lastbuf= lastbuf->next)
-                       if (lastbuf->next==NULL)
-                               break;
-               lastbuf->next= dupbuf;
-               dupbuf->prev= lastbuf;
-       }
-       return dupbuf;
-}
-
-
-void free_compbuf(CompBuf *cbuf)
-{
-       /* check referencing, then remove from list and set malloc tag */
-       if (cbuf->prev || cbuf->next) {
-               if (cbuf->prev)
-                       cbuf->prev->next= cbuf->next;
-               if (cbuf->next)
-                       cbuf->next->prev= cbuf->prev;
-               if (cbuf->malloc) {
-                       if (cbuf->prev)
-                               cbuf->prev->malloc= 1;
-                       else
-                               cbuf->next->malloc= 1;
-                       cbuf->malloc= 0;
-               }
-       }
-       
-       if (cbuf->malloc && cbuf->rect)
-               MEM_freeN(cbuf->rect);
-
-       MEM_freeN(cbuf);
-}
-
-void print_compbuf(char *str, CompBuf *cbuf)
-{
-       printf("Compbuf %s %d %d %p\n", str, cbuf->x, cbuf->y, (void *)cbuf->rect);
-       
-}
-
-void compbuf_set_node(CompBuf *cbuf, bNode *node)
-{
-       if (cbuf) cbuf->node = node;
-}
-
-
-CompBuf *get_cropped_compbuf(rcti *drect, float *rectf, int rectx, int recty, int type)
-{
-       CompBuf *cbuf;
-       rcti disprect= *drect;
-       float *outfp;
-       int dx, y;
-       
-       if (disprect.xmax>rectx) disprect.xmax = rectx;
-       if (disprect.ymax>recty) disprect.ymax = recty;
-       if (disprect.xmin>= disprect.xmax) return NULL;
-       if (disprect.ymin>= disprect.ymax) return NULL;
-       
-       cbuf= alloc_compbuf(BLI_rcti_size_x(&disprect), BLI_rcti_size_y(&disprect), type, 1);
-       outfp= cbuf->rect;
-       rectf += type*(disprect.ymin*rectx + disprect.xmin);
-       dx= type*cbuf->x;
-       for (y=cbuf->y; y>0; y--, outfp+=dx, rectf+=type*rectx)
-               memcpy(outfp, rectf, sizeof(float)*dx);
-       
-       return cbuf;
-}
-
-CompBuf *scalefast_compbuf(CompBuf *inbuf, int newx, int newy)
-{
-       CompBuf *outbuf; 
-       float *rectf, *newrectf, *rf;
-       int x, y, c, pixsize= inbuf->type;
-       int ofsx, ofsy, stepx, stepy;
-       
-       if (inbuf->x==newx && inbuf->y==newy)
-               return dupalloc_compbuf(inbuf);
-       
-       outbuf= alloc_compbuf(newx, newy, inbuf->type, 1);
-       newrectf= outbuf->rect;
-       
-       stepx = (65536.0 * (inbuf->x - 1.0) / (newx - 1.0)) + 0.5;
-       stepy = (65536.0 * (inbuf->y - 1.0) / (newy - 1.0)) + 0.5;
-       ofsy = 32768;
-       
-       for (y = newy; y > 0 ; y--) {
-               rectf = inbuf->rect;
-               rectf += pixsize * (ofsy >> 16) * inbuf->x;
-
-               ofsy += stepy;
-               ofsx = 32768;
-               
-               for (x = newx ; x>0 ; x--) {
-                       
-                       rf= rectf + pixsize*(ofsx >> 16);
-                       for (c=0; c<pixsize; c++)
-                               newrectf[c] = rf[c];
-                       
-                       newrectf+= pixsize;
-                       
-                       ofsx += stepx;
-               }
-       }
-       
-       return outbuf;
-}
-
-void typecheck_compbuf_color(float *out, float *in, int outtype, int intype)
-{
-       if (intype == outtype) {
-               memcpy(out, in, sizeof(float)*outtype);
-       }
-       else if (outtype==CB_VAL) {
-               if (intype==CB_VEC2) {
-                       *out= 0.5f*(in[0]+in[1]);
-               }
-               else if (intype==CB_VEC3) {
-                       *out= 0.333333f*(in[0]+in[1]+in[2]);
-               }
-               else if (intype==CB_RGBA) {
-                       *out = rgb_to_bw(in);
-               }
-       }
-       else if (outtype==CB_VEC2) {
-               if (intype==CB_VAL) {
-                       out[0] = in[0];
-                       out[1] = in[0];
-               }
-               else if (intype==CB_VEC3) {
-                       out[0] = in[0];
-                       out[1] = in[1];
-               }
-               else if (intype==CB_RGBA) {
-                       out[0] = in[0];
-                       out[1] = in[1];
-               }
-       }
-       else if (outtype==CB_VEC3) {
-               if (intype==CB_VAL) {
-                       out[0] = in[0];
-                       out[1] = in[0];
-                       out[2] = in[0];
-               }
-               else if (intype==CB_VEC2) {
-                       out[0] = in[0];
-                       out[1] = in[1];
-                       out[2] = 0.0f;
-               }
-               else if (intype==CB_RGBA) {
-                       out[0] = in[0];
-                       out[1] = in[1];
-                       out[2] = in[2];
-               }
-       }
-       else if (outtype==CB_RGBA) {
-               if (intype==CB_VAL) {
-                       out[0] = in[0];
-                       out[1] = in[0];
-                       out[2] = in[0];
-                       out[3] = 1.0f;
-               }
-               else if (intype==CB_VEC2) {
-                       out[0] = in[0];
-                       out[1] = in[1];
-                       out[2] = 0.0f;
-                       out[3] = 1.0f;
-               }
-               else if (intype==CB_VEC3) {
-                       out[0] = in[0];
-                       out[1] = in[1];
-                       out[2] = in[2];
-                       out[3] = 1.0f;
-               }
-       }
-}
-
-CompBuf *typecheck_compbuf(CompBuf *inbuf, int type)
-{
-       if (inbuf && inbuf->type!=type) {
-               CompBuf *outbuf;
-               float *inrf, *outrf;
-               int x;
-
-               outbuf= alloc_compbuf(inbuf->x, inbuf->y, type, 1); 
-
-               /* warning note: xof and yof are applied in pixelprocessor, but should be copied otherwise? */
-               outbuf->xof= inbuf->xof;
-               outbuf->yof= inbuf->yof;
-
-               if (inbuf->rect_procedural) {
-                       outbuf->rect_procedural= inbuf->rect_procedural;
-                       copy_v3_v3(outbuf->procedural_size, inbuf->procedural_size);
-                       copy_v3_v3(outbuf->procedural_offset, inbuf->procedural_offset);
-                       outbuf->procedural_type= inbuf->procedural_type;
-                       outbuf->node= inbuf->node;
-                       return outbuf;
-               }
-
-               inrf= inbuf->rect;
-               outrf= outbuf->rect;
-               x= inbuf->x*inbuf->y;
-               
-               if (type==CB_VAL) {
-                       if (inbuf->type==CB_VEC2) {
-                               for (; x>0; x--, outrf+= 1, inrf+= 2)
-                                       *outrf= 0.5f*(inrf[0]+inrf[1]);
-                       }
-                       else if (inbuf->type==CB_VEC3) {
-                               for (; x>0; x--, outrf+= 1, inrf+= 3)
-                                       *outrf= 0.333333f*(inrf[0]+inrf[1]+inrf[2]);
-                       }
-                       else if (inbuf->type==CB_RGBA) {
-                               for (; x>0; x--, outrf+= 1, inrf+= 4)
-                                       *outrf = rgb_to_bw(inrf);
-                       }
-               }
-               else if (type==CB_VEC2) {
-                       if (inbuf->type==CB_VAL) {
-                               for (; x>0; x--, outrf+= 2, inrf+= 1) {
-                                       outrf[0] = inrf[0];
-                                       outrf[1] = inrf[0];
-                               }
-                       }
-                       else if (inbuf->type==CB_VEC3) {
-                               for (; x>0; x--, outrf+= 2, inrf+= 3) {
-                                       outrf[0] = inrf[0];
-                                       outrf[1] = inrf[1];
-                               }
-                       }
-                       else if (inbuf->type==CB_RGBA) {
-                               for (; x>0; x--, outrf+= 2, inrf+= 4) {
-                                       outrf[0] = inrf[0];
-                                       outrf[1] = inrf[1];
-                               }
-                       }
-               }
-               else if (type==CB_VEC3) {
-                       if (inbuf->type==CB_VAL) {
-                               for (; x>0; x--, outrf+= 3, inrf+= 1) {
-                                       outrf[0] = inrf[0];
-                                       outrf[1] = inrf[0];
-                                       outrf[2] = inrf[0];
-                               }
-                       }
-                       else if (inbuf->type==CB_VEC2) {
-                               for (; x>0; x--, outrf+= 3, inrf+= 2) {
-                                       outrf[0] = inrf[0];
-                                       outrf[1] = inrf[1];
-                                       outrf[2] = 0.0f;
-                               }
-                       }
-                       else if (inbuf->type==CB_RGBA) {
-                               for (; x>0; x--, outrf+= 3, inrf+= 4) {
-                                       outrf[0] = inrf[0];
-                                       outrf[1] = inrf[1];
-                                       outrf[2] = inrf[2];
-                               }
-                       }
-               }
-               else if (type==CB_RGBA) {
-                       if (inbuf->type==CB_VAL) {
-                               for (; x>0; x--, outrf+= 4, inrf+= 1) {
-                                       outrf[0] = inrf[0];
-                                       outrf[1] = inrf[0];
-                                       outrf[2] = inrf[0];
-                                       outrf[3] = 1.0f;
-                               }
-                       }
-                       else if (inbuf->type==CB_VEC2) {
-                               for (; x>0; x--, outrf+= 4, inrf+= 2) {
-                                       outrf[0] = inrf[0];
-                                       outrf[1] = inrf[1];
-                                       outrf[2] = 0.0f;
-                                       outrf[3] = 1.0f;
-                               }
-                       }
-                       else if (inbuf->type==CB_VEC3) {
-                               for (; x>0; x--, outrf+= 4, inrf+= 3) {
-                                       outrf[0] = inrf[0];
-                                       outrf[1] = inrf[1];
-                                       outrf[2] = inrf[2];
-                                       outrf[3] = 1.0f;
-                               }
-                       }
-               }
-               
-               return outbuf;
-       }
-       return inbuf;
-}
-
-float *compbuf_get_pixel(CompBuf *cbuf, float *defcol, float *use, int x, int y, int xrad, int yrad)
-{
-       if (cbuf) {
-               if (cbuf->rect_procedural) {
-                       cbuf->rect_procedural(cbuf, use, (float)x/(float)xrad, (float)y/(float)yrad);
-                       return use;
-               }
-               else {
-                       static float col[4] = {0.0f, 0.0f, 0.0f, 0.0f};
-                       
-                       /* map coords */
-                       x-= cbuf->xof;
-                       y-= cbuf->yof;
-                       
-                       if (y<-cbuf->yrad || y>= -cbuf->yrad+cbuf->y) return col;
-                       if (x<-cbuf->xrad || x>= -cbuf->xrad+cbuf->x) return col;
-                       
-                       return cbuf->rect + cbuf->type*( (cbuf->yrad+y)*cbuf->x + (cbuf->xrad+x) );
-               }
-       }
-       else return defcol;
-}
-
-/* **************************************************** */
-
-static CompBuf *composit_check_compbuf(CompBuf *cbuf, int type, CompBuf *outbuf)
-{
-       /* check type */
-       CompBuf *dbuf= typecheck_compbuf(cbuf, type);
-
-       /* if same as output and translated, duplicate so pixels don't interfere */
-       if (dbuf == outbuf && !dbuf->rect_procedural && (dbuf->xof || dbuf->yof))
-               dbuf= dupalloc_compbuf(dbuf);
-       
-       return dbuf;
-}
-
-/* Pixel-to-Pixel operation, 1 Image in, 1 out */
-void composit1_pixel_processor(bNode *node, CompBuf *out, CompBuf *src_buf, float *src_col,
-                                                                         void (*func)(bNode *, float *, float *), 
-                                                                         int src_type)
-{
-       CompBuf *src_use;
-       float *outfp=out->rect, *srcfp;
-       float color[4]; /* local color if compbuf is procedural */
-       int xrad, yrad, x, y;
-       
-       src_use= composit_check_compbuf(src_buf, src_type, out);
-       
-       xrad= out->xrad;
-       yrad= out->yrad;
-       
-       for (y= -yrad; y<-yrad+out->y; y++) {
-               for (x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) {
-                       srcfp= compbuf_get_pixel(src_use, src_col, color, x, y, xrad, yrad);
-                       func(node, outfp, srcfp);
-               }
-       }
-       
-       if (src_use!=src_buf)
-               free_compbuf(src_use);
-}
-
-/* Pixel-to-Pixel operation, 2 Images in, 1 out */
-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)
-{
-       CompBuf *src_use, *fac_use;
-       float *outfp=out->rect, *srcfp, *facfp;
-       float color[4]; /* local color if compbuf is procedural */
-       int xrad, yrad, x, y;
-       
-       src_use= composit_check_compbuf(src_buf, src_type, out);
-       fac_use= composit_check_compbuf(fac_buf, fac_type, out);
-
-       xrad= out->xrad;
-       yrad= out->yrad;
-       
-       for (y= -yrad; y<-yrad+out->y; y++) {
-               for (x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) {
-                       srcfp= compbuf_get_pixel(src_use, src_col, color, x, y, xrad, yrad);
-                       facfp= compbuf_get_pixel(fac_use, fac, color, x, y, xrad, yrad);
-                       
-                       func(node, outfp, srcfp, facfp);
-               }
-       }
-       if (src_use!=src_buf)
-               free_compbuf(src_use);
-       if (fac_use!=fac_buf)
-               free_compbuf(fac_use);
-}
-
-/* Pixel-to-Pixel operation, 3 Images in, 1 out */
-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)
-{
-       CompBuf *src1_use, *src2_use, *fac_use;
-       float *outfp=out->rect, *src1fp, *src2fp, *facfp;
-       float color[4]; /* local color if compbuf is procedural */
-       int xrad, yrad, x, y;
-       
-       src1_use= composit_check_compbuf(src1_buf, src1_type, out);
-       src2_use= composit_check_compbuf(src2_buf, src2_type, out);
-       fac_use= composit_check_compbuf(fac_buf, fac_type, out);
-       
-       xrad= out->xrad;
-       yrad= out->yrad;
-       
-       for (y= -yrad; y<-yrad+out->y; y++) {
-               for (x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) {
-                       src1fp= compbuf_get_pixel(src1_use, src1_col, color, x, y, xrad, yrad);
-                       src2fp= compbuf_get_pixel(src2_use, src2_col, color, x, y, xrad, yrad);
-                       facfp= compbuf_get_pixel(fac_use, fac, color, x, y, xrad, yrad);
-                       
-                       func(node, outfp, src1fp, src2fp, facfp);
-               }
-       }
-       
-       if (src1_use!=src1_buf)
-               free_compbuf(src1_use);
-       if (src2_use!=src2_buf)
-               free_compbuf(src2_use);
-       if (fac_use!=fac_buf)
-               free_compbuf(fac_use);
-}
-
-/* Pixel-to-Pixel operation, 4 Images in, 1 out */
-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)
-{
-       CompBuf *src1_use, *src2_use, *fac1_use, *fac2_use;
-       float *outfp=out->rect, *src1fp, *src2fp, *fac1fp, *fac2fp;
-       float color[4]; /* local color if compbuf is procedural */
-       int xrad, yrad, x, y;
-       
-       src1_use= composit_check_compbuf(src1_buf, src1_type, out);
-       src2_use= composit_check_compbuf(src2_buf, src2_type, out);
-       fac1_use= composit_check_compbuf(fac1_buf, fac1_type, out);
-       fac2_use= composit_check_compbuf(fac2_buf, fac2_type, out);
-       
-       xrad= out->xrad;
-       yrad= out->yrad;
-       
-       for (y= -yrad; y<-yrad+out->y; y++) {
-               for (x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) {
-                       src1fp= compbuf_get_pixel(src1_use, src1_col, color, x, y, xrad, yrad);
-                       src2fp= compbuf_get_pixel(src2_use, src2_col, color, x, y, xrad, yrad);
-                       fac1fp= compbuf_get_pixel(fac1_use, fac1, color, x, y, xrad, yrad);
-                       fac2fp= compbuf_get_pixel(fac2_use, fac2, color, x, y, xrad, yrad);
-                       
-                       func(node, outfp, src1fp, fac1fp, src2fp, fac2fp);
-               }
-       }
-       
-       if (src1_use!=src1_buf)
-               free_compbuf(src1_use);
-       if (src2_use!=src2_buf)
-               free_compbuf(src2_use);
-       if (fac1_use!=fac1_buf)
-               free_compbuf(fac1_use);
-       if (fac2_use!=fac2_buf)
-               free_compbuf(fac2_use);
-}
-
-
-CompBuf *valbuf_from_rgbabuf(CompBuf *cbuf, int channel)
-{
-       CompBuf *valbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1);
-       float *valf, *rectf;
-       int tot;
-       
-       /* warning note: xof and yof are applied in pixelprocessor, but should be copied otherwise? */
-       valbuf->xof= cbuf->xof;
-       valbuf->yof= cbuf->yof;
-       
-       valf= valbuf->rect;
-
-       /* defaults to returning alpha channel */
-       if ((channel < CHAN_R) || (channel > CHAN_A)) channel = CHAN_A;
-
-       rectf= cbuf->rect + channel;
-       
-       for (tot= cbuf->x*cbuf->y; tot>0; tot--, valf++, rectf+=4)
-               *valf= *rectf;
-       
-       return valbuf;
-}
-
-void valbuf_to_rgbabuf(CompBuf *valbuf, CompBuf *cbuf, int channel)
-{
-       float *valf, *rectf;
-       int tot;
-
-       valf= valbuf->rect;
-
-       /* defaults to returning alpha channel */
-       if ((channel < CHAN_R) || (channel > CHAN_A)) channel = CHAN_A;
-
-       rectf = cbuf->rect + channel;
-
-       for (tot= cbuf->x*cbuf->y; tot>0; tot--, valf++, rectf+=4)
-               *rectf = *valf;
-}
-
-static CompBuf *generate_procedural_preview(CompBuf *cbuf, int newx, int newy)
-{
-       CompBuf *outbuf;
-       float *outfp;
-       int xrad, yrad, x, y;
-       
-       outbuf= alloc_compbuf(newx, newy, CB_RGBA, 1);
-
-       outfp= outbuf->rect;
-       xrad= outbuf->xrad;
-       yrad= outbuf->yrad;
-       
-       for (y= -yrad; y<-yrad+outbuf->y; y++)
-               for (x= -xrad; x<-xrad+outbuf->x; x++, outfp+=outbuf->type)
-                       cbuf->rect_procedural(cbuf, outfp, (float)x/(float)xrad, (float)y/(float)yrad);
-
-       return outbuf;
-}
-
-/* OCIO_TODO: this function is only used by legacy compositor system only, which would likely be removed soon,
- *            keep check for old color management flag for now
- */
-void generate_preview(void *data, bNode *node, CompBuf *stackbuf)
-{
-       RenderData *rd= data;
-       bNodePreview *preview= node->preview;
-       int xsize, ysize;
-       int profile_from= (rd->color_mgt_flag & R_COLOR_MANAGEMENT)? IB_PROFILE_LINEAR_RGB: IB_PROFILE_SRGB;
-       int predivide= TRUE;
-       int dither= 0;
-       unsigned char *rect;
-       
-       if (preview && stackbuf) {
-               CompBuf *cbuf, *stackbuf_use;
-               
-               if (stackbuf->rect==NULL && stackbuf->rect_procedural==NULL) return;
-               
-               stackbuf_use= typecheck_compbuf(stackbuf, CB_RGBA);
-
-               if (stackbuf->x > stackbuf->y) {
-                       xsize= 140;
-                       ysize= (140*stackbuf->y)/stackbuf->x;
-               }
-               else {
-                       ysize= 140;
-                       xsize= (140*stackbuf->x)/stackbuf->y;
-               }
-               
-               if (stackbuf_use->rect_procedural)
-                       cbuf= generate_procedural_preview(stackbuf_use, xsize, ysize);
-               else
-                       cbuf= scalefast_compbuf(stackbuf_use, xsize, ysize);
-
-               /* convert to byte for preview */
-               rect= MEM_callocN(sizeof(unsigned char)*4*xsize*ysize, "bNodePreview.rect");
-
-               IMB_buffer_byte_from_float(rect, cbuf->rect,
-                       4, dither, IB_PROFILE_SRGB, profile_from, predivide, 
-                       xsize, ysize, xsize, xsize);
-               
-               free_compbuf(cbuf);
-               if (stackbuf_use!=stackbuf)
-                       free_compbuf(stackbuf_use);
-
-               // BLI_lock_thread(LOCK_PREVIEW);
-
-               if (preview->rect)
-                       MEM_freeN(preview->rect);
-               preview->xsize= xsize;
-               preview->ysize= ysize;
-               preview->rect= rect;
-
-               // BLI_unlock_thread(LOCK_PREVIEW);
-       }
-}
-
-void do_rgba_to_yuva(bNode *UNUSED(node), float *out, float *in)
-{
-       rgb_to_yuv(in[0], in[1], in[2], &out[0], &out[1], &out[2]);
-       out[3]=in[3];
-}
-
-void do_rgba_to_hsva(bNode *UNUSED(node), float *out, float *in)
-{
-       rgb_to_hsv(in[0], in[1], in[2], &out[0], &out[1], &out[2]);
-       out[3]=in[3];
-}
-
-void do_rgba_to_ycca(bNode *UNUSED(node), float *out, float *in)
-{
-       rgb_to_ycc(in[0], in[1], in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
-       out[3]=in[3];
-}
-
-void do_yuva_to_rgba(bNode *UNUSED(node), float *out, float *in)
-{
-       yuv_to_rgb(in[0], in[1], in[2], &out[0], &out[1], &out[2]);
-       out[3]=in[3];
-}
-
-void do_hsva_to_rgba(bNode *UNUSED(node), float *out, float *in)
-{
-       hsv_to_rgb(in[0], in[1], in[2], &out[0], &out[1], &out[2]);
-       out[3]=in[3];
-}
-
-void do_ycca_to_rgba(bNode *UNUSED(node), float *out, float *in)
-{
-       ycc_to_rgb(in[0], in[1], in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
-       out[3]=in[3];
-}
-
-void do_copy_rgba(bNode *UNUSED(node), float *out, float *in)
-{
-       copy_v4_v4(out, in);
-}
-
-void do_copy_rgb(bNode *UNUSED(node), float *out, float *in)
-{
-       copy_v3_v3(out, in);
-       out[3] = 1.0f;
-}
-
-void do_copy_value(bNode *UNUSED(node), float *out, float *in)
-{
-       out[0] = in[0];
-}
-
-void do_copy_a_rgba(bNode *UNUSED(node), float *out, float *in, float *fac)
-{
-       copy_v3_v3(out, in);
-       out[3] = *fac;
-}
-
-/* only accepts RGBA buffers */
-void gamma_correct_compbuf(CompBuf *img, int inversed)
-{
-       float *drect;
-       int x;
-
-       if (img->type!=CB_RGBA) return;
-
-       drect= img->rect;
-       if (inversed) {
-               for (x=img->x*img->y; x>0; x--, drect+=4) {
-                       if (drect[0]>0.0f) drect[0] = sqrt(drect[0]); else drect[0] = 0.0f;
-                       if (drect[1]>0.0f) drect[1] = sqrt(drect[1]); else drect[1] = 0.0f;
-                       if (drect[2]>0.0f) drect[2] = sqrt(drect[2]); else drect[2] = 0.0f;
-               }
-       }
-       else {
-               for (x=img->x*img->y; x>0; x--, drect+=4) {
-                       if (drect[0]>0.0f) drect[0]*= drect[0]; else drect[0] = 0.0f;
-                       if (drect[1]>0.0f) drect[1]*= drect[1]; else drect[1] = 0.0f;
-                       if (drect[2]>0.0f) drect[2]*= drect[2]; else drect[2] = 0.0f;
-               }
-       }
-}
-
-void premul_compbuf(CompBuf *img, int inversed)
-{
-       float *drect;
-       int x;
-
-       if (img->type!=CB_RGBA) return;
-
-       drect= img->rect;
-       if (inversed) {
-               for (x=img->x*img->y; x>0; x--, drect+=4) {
-                       if (fabsf(drect[3]) < 1e-5f) {
-                               drect[0] = 0.0f;
-                               drect[1] = 0.0f;
-                               drect[2] = 0.0f;
-                       }
-                       else {
-                               drect[0] /= drect[3];
-                               drect[1] /= drect[3];
-                               drect[2] /= drect[3];
-                       }
-               }
-       }
-       else {
-               for (x=img->x*img->y; x>0; x--, drect+=4) {
-                       drect[0] *= drect[3];
-                       drect[1] *= drect[3];
-                       drect[2] *= drect[3];
-               }
-       }
-}
-
-
-
-/*
- *  2D Fast Hartley Transform, used for convolution
- */
-
-typedef float fREAL;
-
-// returns next highest power of 2 of x, as well it's log2 in L2
-static unsigned int nextPow2(unsigned int x, unsigned int* L2)
-{
-       unsigned int pw, x_notpow2 = x & (x-1);
-       *L2 = 0;
-       while (x>>=1) ++(*L2);
-       pw = 1 << (*L2);
-       if (x_notpow2) { (*L2)++;  pw<<=1; }
-       return pw;
-}
-
-//------------------------------------------------------------------------------
-
-// from FXT library by Joerg Arndt, faster in order bitreversal
-// use: r = revbin_upd(r, h) where h = N>>1
-static unsigned int revbin_upd(unsigned int r, unsigned int h)
-{
-       while (!((r^=h)&h)) h >>= 1;
-       return r;
-}
-//------------------------------------------------------------------------------
-static void FHT(fREAL* data, unsigned int M, unsigned int inverse)
-{
-       double tt, fc, dc, fs, ds, a = M_PI;
-       fREAL t1, t2;
-       int n2, bd, bl, istep, k, len = 1 << M, n = 1;
-
-       int i, j = 0;
-       unsigned int Nh = len >> 1;
-       for (i=1;i<(len-1);++i) {
-               j = revbin_upd(j, Nh);
-               if (j>i) {
-                       t1 = data[i];
-                       data[i] = data[j];
-                       data[j] = t1;
-               }
-       }
-
-       do {
-               fREAL* data_n = &data[n];
-
-               istep = n << 1;
-               for (k=0; k<len; k+=istep) {
-                       t1 = data_n[k];
-                       data_n[k] = data[k] - t1;
-                       data[k] += t1;
-               }
-
-               n2 = n >> 1;
-               if (n>2) {
-                       fc = dc = cos(a);
-                       fs = ds = sqrt(1.0 - fc*fc); //sin(a);
-                       bd = n-2;
-                       for (bl=1; bl<n2; bl++) {
-                               fREAL* data_nbd = &data_n[bd];
-                               fREAL* data_bd = &data[bd];
-                               for (k=bl; k<len; k+=istep) {
-                                       t1 = fc*data_n[k] + fs*data_nbd[k];
-                                       t2 = fs*data_n[k] - fc*data_nbd[k];
-                                       data_n[k] = data[k] - t1;
-                                       data_nbd[k] = data_bd[k] - t2;
-                                       data[k] += t1;
-                                       data_bd[k] += t2;
-                               }
-                               tt = fc*dc - fs*ds;
-                               fs = fs*dc + fc*ds;
-                               fc = tt;
-                               bd -= 2;
-                       }
-               }
-
-               if (n>1) {
-                       for (k=n2; k<len; k+=istep) {
-                               t1 = data_n[k];
-                               data_n[k] = data[k] - t1;
-                               data[k] += t1;
-                       }
-               }
-
-               n = istep;
-               a *= 0.5;
-       } while (n<len);
-
-       if (inverse) {
-               fREAL sc = (fREAL)1 / (fREAL)len;
-               for (k=0; k<len; ++k)
-                       data[k] *= sc;
-       }
-}
-//------------------------------------------------------------------------------
-/* 2D Fast Hartley Transform, Mx/My -> log2 of width/height,
- * nzp -> the row where zero pad data starts,
- * inverse -> see above */
-static void FHT2D(fREAL *data, unsigned int Mx, unsigned int My,
-               unsigned int nzp, unsigned int inverse)
-{
-       unsigned int i, j, Nx, Ny, maxy;
-       fREAL t;
-
-       Nx = 1 << Mx;
-       Ny = 1 << My;
-
-       // rows (forward transform skips 0 pad data)
-       maxy = inverse ? Ny : nzp;
-       for (j=0; j<maxy; ++j)
-               FHT(&data[Nx*j], Mx, inverse);
-
-       // transpose data
-       if (Nx==Ny) {  // square
-               for (j=0; j<Ny; ++j)
-                       for (i=j+1; i<Nx; ++i) {
-                               unsigned int op = i + (j << Mx), np = j + (i << My);
-                               t=data[op], data[op]=data[np], data[np]=t;
-                       }
-       }
-       else {  // rectangular
-               unsigned int k, Nym = Ny-1, stm = 1 << (Mx + My);
-               for (i=0; stm>0; i++) {
-                       #define PRED(k) (((k & Nym) << Mx) + (k >> My))
-                       for (j=PRED(i); j>i; j=PRED(j));
-                       if (j < i) continue;
-                       for (k=i, j=PRED(i); j!=i; k=j, j=PRED(j), stm--) {
-                               t=data[j], data[j]=data[k], data[k]=t;
-                       }
-                       #undef PRED
-                       stm--;
-               }
-       }
-       // swap Mx/My & Nx/Ny
-       i = Nx, Nx = Ny, Ny = i;
-       i = Mx, Mx = My, My = i;
-
-       // now columns == transposed rows
-       for (j=0; j<Ny; ++j)
-               FHT(&data[Nx*j], Mx, inverse);
-
-       // finalize
-       for (j=0; j<=(Ny >> 1); j++) {
-               unsigned int jm = (Ny - j) & (Ny-1);
-               unsigned int ji = j << Mx;
-               unsigned int jmi = jm << Mx;
-               for (i=0; i<=(Nx >> 1); i++) {
-                       unsigned int im = (Nx - i) & (Nx-1);
-                       fREAL A = data[ji + i];
-                       fREAL B = data[jmi + i];
-                       fREAL C = data[ji + im];
-                       fREAL D = data[jmi + im];
-                       fREAL E = (fREAL)0.5*((A + D) - (B + C));
-                       data[ji + i] = A - E;
-                       data[jmi + i] = B + E;
-                       data[ji + im] = C + E;
-                       data[jmi + im] = D - E;
-               }
-       }
-
-}
-
-//------------------------------------------------------------------------------
-
-/* 2D convolution calc, d1 *= d2, M/N - > log2 of width/height */
-static void fht_convolve(fREAL* d1, fREAL* d2, unsigned int M, unsigned int N)
-{
-       fREAL a, b;
-       unsigned int i, j, k, L, mj, mL;
-       unsigned int m = 1 << M, n = 1 << N;
-       unsigned int m2 = 1 << (M-1), n2 = 1 << (N-1);
-       unsigned int mn2 = m << (N-1);
-
-       d1[0] *= d2[0];
-       d1[mn2] *= d2[mn2];
-       d1[m2] *= d2[m2];
-       d1[m2 + mn2] *= d2[m2 + mn2];
-       for (i=1; i<m2; i++) {
-               k = m - i;
-               a = d1[i]*d2[i] - d1[k]*d2[k];
-               b = d1[k]*d2[i] + d1[i]*d2[k];
-               d1[i] = (b + a)*(fREAL)0.5;
-               d1[k] = (b - a)*(fREAL)0.5;
-               a = d1[i + mn2]*d2[i + mn2] - d1[k + mn2]*d2[k + mn2];
-               b = d1[k + mn2]*d2[i + mn2] + d1[i + mn2]*d2[k + mn2];
-               d1[i + mn2] = (b + a)*(fREAL)0.5;
-               d1[k + mn2] = (b - a)*(fREAL)0.5;
-       }
-       for (j=1; j<n2; j++) {
-               L = n - j;
-               mj = j << M;
-               mL = L << M;
-               a = d1[mj]*d2[mj] - d1[mL]*d2[mL];
-               b = d1[mL]*d2[mj] + d1[mj]*d2[mL];
-               d1[mj] = (b + a)*(fREAL)0.5;
-               d1[mL] = (b - a)*(fREAL)0.5;
-               a = d1[m2 + mj]*d2[m2 + mj] - d1[m2 + mL]*d2[m2 + mL];
-               b = d1[m2 + mL]*d2[m2 + mj] + d1[m2 + mj]*d2[m2 + mL];
-               d1[m2 + mj] = (b + a)*(fREAL)0.5;
-               d1[m2 + mL] = (b - a)*(fREAL)0.5;
-       }
-       for (i=1; i<m2; i++) {
-               k = m - i;
-               for (j=1; j<n2; j++) {
-                       L = n - j;
-                       mj = j << M;
-                       mL = L << M;
-                       a = d1[i + mj]*d2[i + mj] - d1[k + mL]*d2[k + mL];
-                       b = d1[k + mL]*d2[i + mj] + d1[i + mj]*d2[k + mL];
-                       d1[i + mj] = (b + a)*(fREAL)0.5;
-                       d1[k + mL] = (b - a)*(fREAL)0.5;
-                       a = d1[i + mL]*d2[i + mL] - d1[k + mj]*d2[k + mj];
-                       b = d1[k + mj]*d2[i + mL] + d1[i + mL]*d2[k + mj];
-                       d1[i + mL] = (b + a)*(fREAL)0.5;
-                       d1[k + mj] = (b - a)*(fREAL)0.5;
-               }
-       }
-}
-
-//------------------------------------------------------------------------------
-
-void convolve(CompBuf* dst, CompBuf* in1, CompBuf* in2)
-{
-       fREAL *data1, *data2, *fp;
-       unsigned int w2, h2, hw, hh, log2_w, log2_h;
-       fRGB wt, *colp;
-       int x, y, ch;
-       int xbl, ybl, nxb, nyb, xbsz, ybsz;
-       int in2done = FALSE;
-
-       CompBuf* rdst = alloc_compbuf(in1->x, in1->y, in1->type, 1);
-
-       // convolution result width & height
-       w2 = 2*in2->x - 1;
-       h2 = 2*in2->y - 1;
-       // FFT pow2 required size & log2
-       w2 = nextPow2(w2, &log2_w);
-       h2 = nextPow2(h2, &log2_h);
-
-       // alloc space
-       data1 = (fREAL*)MEM_callocN(3*w2*h2*sizeof(fREAL), "convolve_fast FHT data1");
-       data2 = (fREAL*)MEM_callocN(w2*h2*sizeof(fREAL), "convolve_fast FHT data2");
-
-       // normalize convolutor
-       wt[0] = wt[1] = wt[2] = 0.f;
-       for (y=0; y<in2->y; y++) {
-               colp = (fRGB*)&in2->rect[y*in2->x*in2->type];
-               for (x=0; x<in2->x; x++)
-                       add_v3_v3(wt, colp[x]);
-       }
-       if (wt[0] != 0.f) wt[0] = 1.f/wt[0];
-       if (wt[1] != 0.f) wt[1] = 1.f/wt[1];
-       if (wt[2] != 0.f) wt[2] = 1.f/wt[2];
-       for (y=0; y<in2->y; y++) {
-               colp = (fRGB*)&in2->rect[y*in2->x*in2->type];
-               for (x=0; x<in2->x; x++)
-                       mul_v3_v3(colp[x], wt);
-       }
-
-       // copy image data, unpacking interleaved RGBA into separate channels
-       // only need to calc data1 once
-
-       // block add-overlap
-       hw = in2->x >> 1;
-       hh = in2->y >> 1;
-       xbsz = (w2 + 1) - in2->x;
-       ybsz = (h2 + 1) - in2->y;
-       nxb = in1->x / xbsz;
-       if (in1->x % xbsz) nxb++;
-       nyb = in1->y / ybsz;
-       if (in1->y % ybsz) nyb++;
-       for (ybl=0; ybl<nyb; ybl++) {
-               for (xbl=0; xbl<nxb; xbl++) {
-
-                       // each channel one by one
-                       for (ch=0; ch<3; ch++) {
-                               fREAL* data1ch = &data1[ch*w2*h2];
-
-                               // only need to calc fht data from in2 once, can re-use for every block
-                               if (!in2done) {
-                                       // in2, channel ch -> data1
-                                       for (y=0; y<in2->y; y++) {
-                                               fp = &data1ch[y*w2];
-                                               colp = (fRGB*)&in2->rect[y*in2->x*in2->type];
-                                               for (x=0; x<in2->x; x++)
-                                                       fp[x] = colp[x][ch];
-                                       }
-                               }
-
-                               // in1, channel ch -> data2
-                               memset(data2, 0, w2*h2*sizeof(fREAL));
-                               for (y=0; y<ybsz; y++) {
-                                       int yy = ybl*ybsz + y;
-                                       if (yy >= in1->y) continue;
-                                       fp = &data2[y*w2];
-                                       colp = (fRGB*)&in1->rect[yy*in1->x*in1->type];
-                                       for (x=0; x<xbsz; x++) {
-                                               int xx = xbl*xbsz + x;
-                                               if (xx >= in1->x) continue;
-                                               fp[x] = colp[xx][ch];
-                                       }
-                               }
-
-                               // forward FHT
-                               // zero pad data start is different for each == height+1
-                               if (!in2done) FHT2D(data1ch, log2_w, log2_h, in2->y+1, 0);
-                               FHT2D(data2, log2_w, log2_h, in2->y+1, 0);
-
-                               // FHT2D transposed data, row/col now swapped
-                               // convolve & inverse FHT
-                               fht_convolve(data2, data1ch, log2_h, log2_w);
-                               FHT2D(data2, log2_h, log2_w, 0, 1);
-                               // data again transposed, so in order again
-
-                               // overlap-add result
-                               for (y=0; y<(int)h2; y++) {
-                                       const int yy = ybl*ybsz + y - hh;
-                                       if ((yy < 0) || (yy >= in1->y)) continue;
-                                       fp = &data2[y*w2];
-                                       colp = (fRGB*)&rdst->rect[yy*in1->x*in1->type];
-                                       for (x=0; x<(int)w2; x++) {
-                                               const int xx = xbl*xbsz + x - hw;
-                                               if ((xx < 0) || (xx >= in1->x)) continue;
-                                               colp[xx][ch] += fp[x];
-                                       }
-                               }
-
-                       }
-                       in2done = TRUE;
-               }
-       }
-
-       MEM_freeN(data2);
-       MEM_freeN(data1);
-       memcpy(dst->rect, rdst->rect, sizeof(float)*dst->x*dst->y*dst->type);
-       free_compbuf(rdst);
-}
-
-
-/*
- *
- * Utility functions qd_* should probably be integrated better with other functions here.
- *
- */
-// sets fcol to pixelcolor at (x, y)
-void qd_getPixel(CompBuf* src, int x, int y, float* col)
-{
-       if (src->rect_procedural) {
-               float bc[4];
-               src->rect_procedural(src, bc, (float)x/(float)src->xrad, (float)y/(float)src->yrad);
-
-               switch (src->type) {
-                       /* these fallthrough to get all the channels */
-                       case CB_RGBA: col[3]=bc[3]; 
-                       case CB_VEC3: col[2]=bc[2];
-                       case CB_VEC2: col[1]=bc[1];
-                       case CB_VAL: col[0]=bc[0];
-               }
-       }
-       else if ((x >= 0) && (x < src->x) && (y >= 0) && (y < src->y)) {
-               float* bc = &src->rect[(x + y*src->x)*src->type];
-               switch (src->type) {
-                       /* these fallthrough to get all the channels */
-                       case CB_RGBA: col[3]=bc[3]; 
-                       case CB_VEC3: col[2]=bc[2];
-                       case CB_VEC2: col[1]=bc[1];
-                       case CB_VAL: col[0]=bc[0];
-               }
-       }
-       else {
-               switch (src->type) {
-                       /* these fallthrough to get all the channels */
-                       case CB_RGBA: col[3]=0.0; 
-                       case CB_VEC3: col[2]=0.0; 
-                       case CB_VEC2: col[1]=0.0; 
-                       case CB_VAL: col[0]=0.0; 
-               }
-       }
-}
-
-// sets pixel (x, y) to color col
-void qd_setPixel(CompBuf* src, int x, int y, float* col)
-{
-       if ((x >= 0) && (x < src->x) && (y >= 0) && (y < src->y)) {
-               float* bc = &src->rect[(x + y*src->x)*src->type];
-               switch (src->type) {
-                       /* these fallthrough to get all the channels */
-                       case CB_RGBA: bc[3]=col[3]; 
-                       case CB_VEC3: bc[2]=col[2];
-                       case CB_VEC2: bc[1]=col[1];
-                       case CB_VAL: bc[0]=col[0];
-               }
-       }
-}
-
-// adds fcol to pixelcolor (x, y)
-void qd_addPixel(CompBuf* src, int x, int y, float* col)
-{
-       if ((x >= 0) && (x < src->x) && (y >= 0) && (y < src->y)) {
-               float* bc = &src->rect[(x + y*src->x)*src->type];
-               bc[0] += col[0], bc[1] += col[1], bc[2] += col[2];
-       }
-}
-
-// multiplies pixel by factor value f
-void qd_multPixel(CompBuf* src, int x, int y, float f)
-{
-       if ((x >= 0) && (x < src->x) && (y >= 0) && (y < src->y)) {
-               float* bc = &src->rect[(x + y*src->x)*src->type];
-               bc[0] *= f, bc[1] *= f, bc[2] *= f;
-       }
-}
-
-// bilinear interpolation with wraparound
-void qd_getPixelLerpWrap(CompBuf* src, float u, float v, float* col)
-{
-       const float ufl = floor(u), vfl = floor(v);
-       const int nx = (int)ufl % src->x, ny = (int)vfl % src->y;
-       const int x1 = (nx < 0) ? (nx + src->x) : nx;
-       const int y1 = (ny < 0) ? (ny + src->y) : ny;
-       const int x2 = (x1 + 1) % src->x, y2 = (y1 + 1) % src->y;
-       const float* c00 = &src->rect[(x1 + y1*src->x)*src->type];
-       const float* c10 = &src->rect[(x2 + y1*src->x)*src->type];
-       const float* c01 = &src->rect[(x1 + y2*src->x)*src->type];
-       const float* c11 = &src->rect[(x2 + y2*src->x)*src->type];
-       const float uf = u - ufl, vf = v - vfl;
-       const float w00=(1.f-uf)*(1.f-vf), w10=uf*(1.f-vf), w01=(1.f-uf)*vf, w11=uf*vf;
-       col[0] = w00*c00[0] + w10*c10[0] + w01*c01[0] + w11*c11[0];
-       if (src->type != CB_VAL) {
-               col[1] = w00*c00[1] + w10*c10[1] + w01*c01[1] + w11*c11[1];
-               col[2] = w00*c00[2] + w10*c10[2] + w01*c01[2] + w11*c11[2];
-               col[3] = w00*c00[3] + w10*c10[3] + w01*c01[3] + w11*c11[3];
-       }
-}
-
-// as above, without wrap around
-void qd_getPixelLerp(CompBuf* src, float u, float v, float* col)
-{
-       const float ufl = floor(u), vfl = floor(v);
-       const int x1 = (int)ufl, y1 = (int)vfl;
-       const int x2 = (int)ceil(u), y2 = (int)ceil(v);
-       if ((x2 >= 0) && (y2 >= 0) && (x1 < src->x) && (y1 < src->y)) {
-               const float B[4] = {0, 0, 0, 0};
-               const int ox1 = (x1 < 0), oy1 = (y1 < 0), ox2 = (x2 >= src->x), oy2 = (y2 >= src->y);
-               const float* c00 = (ox1 || oy1) ? B : &src->rect[(x1 + y1*src->x)*src->type];
-               const float* c10 = (ox2 || oy1) ? B : &src->rect[(x2 + y1*src->x)*src->type];
-               const float* c01 = (ox1 || oy2) ? B : &src->rect[(x1 + y2*src->x)*src->type];
-               const float* c11 = (ox2 || oy2) ? B : &src->rect[(x2 + y2*src->x)*src->type];
-               const float uf = u - ufl, vf = v - vfl;
-               const float w00=(1.f-uf)*(1.f-vf), w10=uf*(1.f-vf), w01=(1.f-uf)*vf, w11=uf*vf;
-               col[0] = w00*c00[0] + w10*c10[0] + w01*c01[0] + w11*c11[0];
-               if (src->type != CB_VAL) {
-                       col[1] = w00*c00[1] + w10*c10[1] + w01*c01[1] + w11*c11[1];
-                       col[2] = w00*c00[2] + w10*c10[2] + w01*c01[2] + w11*c11[2];
-                       col[3] = w00*c00[3] + w10*c10[3] + w01*c01[3] + w11*c11[3];
-               }
-       }
-       else col[0] = col[1] = col[2] = col[3] = 0.f;
-}
-
-// as above, sampling only one channel
-void qd_getPixelLerpChan(CompBuf* src, float u, float v, int chan, float* out)
-{
-       const float ufl = floor(u), vfl = floor(v);
-       const int x1 = (int)ufl, y1 = (int)vfl;
-       const int x2 = (int)ceil(u), y2 = (int)ceil(v);
-       if (chan >= src->type) chan = 0;
-       if ((x2 >= 0) && (y2 >= 0) && (x1 < src->x) && (y1 < src->y)) {
-               const float B[4] = {0, 0, 0, 0};
-               const int ox1 = (x1 < 0), oy1 = (y1 < 0), ox2 = (x2 >= src->x), oy2 = (y2 >= src->y);
-               const float* c00 = (ox1 || oy1) ? B : &src->rect[(x1 + y1*src->x)*src->type + chan];
-               const float* c10 = (ox2 || oy1) ? B : &src->rect[(x2 + y1*src->x)*src->type + chan];
-               const float* c01 = (ox1 || oy2) ? B : &src->rect[(x1 + y2*src->x)*src->type + chan];
-               const float* c11 = (ox2 || oy2) ? B : &src->rect[(x2 + y2*src->x)*src->type + chan];
-               const float uf = u - ufl, vf = v - vfl;
-               const float w00=(1.f-uf)*(1.f-vf), w10=uf*(1.f-vf), w01=(1.f-uf)*vf, w11=uf*vf;
-               out[0] = w00*c00[0] + w10*c10[0] + w01*c01[0] + w11*c11[0];
-       }
-       else *out = 0.f;
-}
-
-
-CompBuf* qd_downScaledCopy(CompBuf* src, int scale)
-{
-       CompBuf* fbuf;
-       if (scale <= 1)
-               fbuf = dupalloc_compbuf(src);
-       else {
-               int nw = src->x/scale, nh = src->y/scale;
-               if ((2*(src->x % scale)) > scale) nw++;
-               if ((2*(src->y % scale)) > scale) nh++;
-               fbuf = alloc_compbuf(nw, nh, src->type, 1);
-               {
-                       int x, y, xx, yy, sx, sy, mx, my;
-                       float colsum[4] = {0.0f, 0.0f, 0.0f, 0.0f};
-                       float fscale = 1.f/(float)(scale*scale);
-                       for (y=0; y<nh; y++) {
-                               fRGB* fcolp = (fRGB*)&fbuf->rect[y*fbuf->x*fbuf->type];
-                               yy = y*scale;
-                               my = yy + scale;
-                               if (my > src->y) my = src->y;
-                               for (x=0; x<nw; x++) {
-                                       xx = x*scale;
-                                       mx = xx + scale;
-                                       if (mx > src->x) mx = src->x;
-                                       zero_v3(colsum);
-                                       for (sy=yy; sy<my; sy++) {
-                                               fRGB* scolp = (fRGB*)&src->rect[sy*src->x*src->type];
-                                               for (sx=xx; sx<mx; sx++)
-                                                       add_v3_v3(colsum, scolp[sx]);
-                                       }
-                                       mul_v3_fl(colsum, fscale);
-                                       copy_v3_v3(fcolp[x], colsum);
-                               }
-                       }
-               }
-       }
-       return fbuf;
-}
-
-// fast g.blur, per channel
-// xy var. bits 1 & 2 ca be used to blur in x or y direction separately
-void IIR_gauss(CompBuf* src, float sigma, int chan, int xy)
-{
-       double q, q2, sc, cf[4], tsM[9], tsu[3], tsv[3];
-       double *X, *Y, *W;
-       const unsigned int src_width = src->x;
-       const unsigned int src_height = src->y;
-       unsigned int i, x, y, sz;
-
-       // <0.5 not valid, though can have a possibly useful sort of sharpening effect
-       if (sigma < 0.5f) return;
-
-       if ((xy < 1) || (xy > 3)) xy = 3;
-
-       // XXX The YVV macro defined below explicitly expects sources of at least 3x3 pixels,
-       //     so just skiping blur along faulty direction if src's def is below that limit!
-       if (src_width < 3) xy &= ~(int) 1;
-       if (src_height < 3) xy &= ~(int) 2;
-       if (xy < 1) return;
-
-       // see "Recursive Gabor Filtering" by Young/VanVliet
-       // all factors here in double.prec. Required, because for single.prec it seems to blow up if sigma > ~200
-       if (sigma >= 3.556f)
-               q = 0.9804f * (sigma - 3.556f) + 2.5091f;
-       else     // sigma >= 0.5
-               q = (0.0561f * sigma + 0.5784f) * sigma - 0.2568f;
-       q2 = q * q;
-       sc = (1.1668 + q) * (3.203729649  + (2.21566 + q) * q);
-       // no gabor filtering here, so no complex multiplies, just the regular coefs.
-       // all negated here, so as not to have to recalc Triggs/Sdika matrix
-       cf[1] = q * (5.788961737 + (6.76492 + 3.0 * q) * q) / sc;
-       cf[2] = -q2 * (3.38246 + 3.0 * q) / sc;
-       // 0 & 3 unchanged
-       cf[3] = q2 * q / sc;
-       cf[0] = 1.0 - cf[1] - cf[2] - cf[3];
-
-       // Triggs/Sdika border corrections,
-       // it seems to work, not entirely sure if it is actually totally correct,
-       // Besides J.M.Geusebroek's anigauss.c (see http://www.science.uva.nl/~mark),
-       // found one other implementation by Cristoph Lampert,
-       // but neither seem to be quite the same, result seems to be ok so far anyway.
-       // Extra scale factor here to not have to do it in filter,
-       // though maybe this had something to with the precision errors
-       sc = cf[0] / ((1.0 + cf[1] - cf[2] + cf[3]) * (1.0 - cf[1] - cf[2] - cf[3]) * (1.0 + cf[2] + (cf[1] - cf[3]) * cf[3]));
-       tsM[0] = sc * (-cf[3] * cf[1] + 1.0 - cf[3] * cf[3] - cf[2]);
-       tsM[1] = sc * ((cf[3] + cf[1]) * (cf[2] + cf[3] * cf[1]));
-       tsM[2] = sc * (cf[3] * (cf[1] + cf[3] * cf[2]));
-       tsM[3] = sc * (cf[1] + cf[3] * cf[2]);
-       tsM[4] = sc * (-(cf[2] - 1.0) * (cf[2] + cf[3] * cf[1]));
-       tsM[5] = sc * (-(cf[3] * cf[1] + cf[3] * cf[3] + cf[2] - 1.0) * cf[3]);
-       tsM[6] = sc * (cf[3] * cf[1] + cf[2] + cf[1] * cf[1] - cf[2] * cf[2]);
-       tsM[7] = sc * (cf[1] * cf[2] + cf[3] * cf[2] * cf[2] - cf[1] * cf[3] * cf[3] - cf[3] * cf[3] * cf[3] - cf[3] * cf[2] + cf[3]);
-       tsM[8] = sc * (cf[3] * (cf[1] + cf[3] * cf[2]));
-
-#define YVV(L)                                                                          \
-{                                                                                       \
-       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]; \
-       /* 'i != UINT_MAX' is really 'i >= 0', but necessary for unsigned int wrapping */   \
-       for (i = L - 4; i != UINT_MAX; i--) {                                               \
-               Y[i] = cf[0] * W[i] + cf[1] * Y[i + 1] + cf[2] * Y[i + 2] + cf[3] * Y[i + 3];   \
-       }                                                                                   \
-} (void)0
-
-       // intermediate buffers
-       sz = MAX2(src_width, src_height);
-       X = MEM_callocN(sz * sizeof(double), "IIR_gauss X buf");
-       Y = MEM_callocN(sz * sizeof(double), "IIR_gauss Y buf");
-       W = MEM_callocN(sz * sizeof(double), "IIR_gauss W buf");
-       if (xy & 1) {       // H
-               for (y = 0; y < src_height; ++y) {
-                       const int yx = y * src_width;
-                       for (x = 0; x < src_width; ++x)
-                               X[x] = src->rect[(x + yx) * src->type + chan];
-                       YVV(src_width);
-                       for (x = 0; x < src_width; ++x)
-                               src->rect[(x + yx) * src->type + chan] = Y[x];
-               }
-       }
-       if (xy & 2) {       // V
-               for (x = 0; x < src_width; ++x) {
-                       for (y = 0; y < src_height; ++y)
-                               X[y] = src->rect[(x + y * src_width) * src->type + chan];
-                       YVV(src_height);
-                       for (y = 0; y < src_height; ++y)
-                               src->rect[(x + y * src_width) * src->type + chan] = Y[y];
-               }
-       }
-
-       MEM_freeN(X);
-       MEM_freeN(W);
-       MEM_freeN(Y);
-#undef YVV
-}
-
-#endif  /* WITH_COMPOSITOR_LEGACY */
index f2719ee077912bc9b185312019d41862cfaa0861..a3c4bffe018ab0d090cfb83b7b542e241914c877 100644 (file)
 #ifndef __NODE_COMPOSITE_UTIL_H__
 #define __NODE_COMPOSITE_UTIL_H__
 
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_camera_types.h" /* qdn: defocus node, need camera info */
-#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 "BLI_utildefines.h"
 
 #include "BLF_translation.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"
 
 /* only for forward declarations */
 #include "NOD_composite.h"
 
 #define CMP_SCALE_MAX  12000
 
-#ifdef WITH_COMPOSITOR_LEGACY
-
-/* *************************** operations support *************************** */
-
-/* general signal that's in output sockets, and goes over the wires */
-typedef struct CompBuf {
-       float *rect;
-       int x, y, xrad, yrad;
-       short type, malloc;
-       rcti disprect;          /* cropped part of image */
-       int xof, yof;           /* relative to center of target image */
-       
-       void (*rect_procedural)(struct CompBuf *, float *, float, float);
-       float procedural_size[3], procedural_offset[3];
-       int procedural_type;
-       bNode *node;            /* only in use for procedural bufs */
-       
-       struct CompBuf *next, *prev;    /* for pass-on, works nicer than reference counting */
-} CompBuf;
-
-/* defines also used for pixel size */
-#define CB_RGBA                4
-#define CB_VEC4                4
-#define CB_VEC3                3
-#define CB_VEC2                2
-#define CB_VAL         1
-
-/* defines for RGBA channels */
-#define CHAN_R 0
-#define CHAN_G 1
-#define CHAN_B 2
-#define CHAN_A 3
-
-
-
-CompBuf *alloc_compbuf(int sizex, int sizey, int type, int alloc);
-CompBuf *dupalloc_compbuf(CompBuf *cbuf);
-CompBuf *pass_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);
-
-CompBuf *get_cropped_compbuf(rcti *drect, float *rectf, int rectx, int recty, int type);
-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);
-
-/* **************************************************** */
-
-float *compbuf_get_pixel(CompBuf *cbuf, float *defcol, float *use, int x, int y, int xrad, int yrad);
-
-/* Pixel-to-Pixel operation, 1 Image in, 1 out */
-void composit1_pixel_processor(bNode *node, CompBuf *out, CompBuf *src_buf, float *src_col,
-                                                                         void (*func)(bNode *, float *, float *), 
-                                                                         int src_type);
-/* Pixel-to-Pixel operation, 2 Images in, 1 out */
-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);
-
-/* Pixel-to-Pixel operation, 3 Images in, 1 out */
-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);
-
-/* Pixel-to-Pixel operation, 4 Images in, 1 out */
-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);
-
-CompBuf *valbuf_from_rgbabuf(CompBuf *cbuf, int channel);
-void valbuf_to_rgbabuf(CompBuf *valbuf, 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);
-
-extern void node_ID_title_cb(void *node_v, void *unused_v);
-
-
-/* utility functions used by glare, tonemap and lens distortion */
-/* soms macros for color handling */
-typedef float fRGB[4];
-/* multiply c2 by color rgb, rgb as separate arguments */
-#define fRGB_rgbmult(c, r, g, b) { c[0]*=(r);  c[1]*=(g);  c[2]*=(b); } (void)0
-
-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);
-CompBuf* qd_downScaledCopy(CompBuf* src, int scale);
-void IIR_gauss(CompBuf* src, float sigma, int chan, int xy);
-/* end utility funcs */
-
-/* transformations */
-
-CompBuf* node_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);
-
-#endif
-
-#endif  /* WITH_COMPOSITOR_LEGACY */
+#endif  /* __NODE_COMPOSITE_UTIL_H__ */
index 71b71c9dd4a9a0d1ad0ac556fbf59adfe0162dfa..2654aa94be096a54b8dfaa258ffd06a81a7389f1 100644 (file)
@@ -43,103 +43,6 @@ static bNodeSocketTemplate cmp_node_alphaover_out[] = {
        {       -1, 0, ""       }
 };
 
-#ifdef WITH_COMPOSITOR_LEGACY
-
-static void do_alphaover_premul(bNode *UNUSED(node), float *out, float *src, float *over, float *fac)
-{
-       
-       /* Zero alpha values should still permit an add of RGB data */
-       if (over[3]<0.0f) {
-               copy_v4_v4(out, src);
-       }
-       else if (fac[0]==1.0f && over[3]>=1.0f) {
-               copy_v4_v4(out, over);
-       }
-       else {
-               float mul= 1.0f - fac[0]*over[3];
-
-               out[0] = (mul*src[0]) + fac[0]*over[0];
-               out[1] = (mul*src[1]) + fac[0]*over[1];
-               out[2] = (mul*src[2]) + fac[0]*over[2];
-               out[3] = (mul*src[3]) + fac[0]*over[3];
-       }
-}
-
-/* result will be still premul, but the over part is premulled */
-static void do_alphaover_key(bNode *UNUSED(node), float *out, float *src, float *over, float *fac)
-{
-       
-       if (over[3]<=0.0f) {
-               copy_v4_v4(out, src);
-       }
-       else if (fac[0]==1.0f && over[3]>=1.0f) {
-               copy_v4_v4(out, over);
-       }
-       else {
-               float premul= fac[0]*over[3];
-               float mul= 1.0f - premul;
-
-               out[0] = (mul*src[0]) + premul*over[0];
-               out[1] = (mul*src[1]) + premul*over[1];
-               out[2] = (mul*src[2]) + premul*over[2];
-               out[3] = (mul*src[3]) + fac[0]*over[3];
-       }
-}
-
-/* result will be still premul, but the over part is premulled */
-static void do_alphaover_mixed(bNode *node, float *out, float *src, float *over, float *fac)
-{
-       
-       if (over[3]<=0.0f) {
-               copy_v4_v4(out, src);
-       }
-       else if (fac[0]==1.0f && over[3]>=1.0f) {
-               copy_v4_v4(out, over);
-       }
-       else {
-               NodeTwoFloats *ntf= node->storage;
-               float addfac= 1.0f - ntf->x + over[3]*ntf->x;
-               float premul= fac[0]*addfac;
-               float mul= 1.0f - fac[0]*over[3];
-               
-               out[0] = (mul*src[0]) + premul*over[0];
-               out[1] = (mul*src[1]) + premul*over[1];
-               out[2] = (mul*src[2]) + premul*over[2];
-               out[3] = (mul*src[3]) + fac[0]*over[3];
-       }
-}
-
-
-static void node_composit_exec_alphaover(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
-{
-       /* stack order in: col col */
-       /* stack order out: col */
-       if (out[0]->hasoutput==0) 
-               return;
-       
-       /* input no image? then only color operation */
-       if (in[1]->data==NULL && in[2]->data==NULL) {
-               do_alphaover_premul(node, out[0]->vec, in[1]->vec, in[2]->vec, in[0]->vec);
-       }
-       else {
-               /* make output size of input image */
-               CompBuf *cbuf= in[1]->data?in[1]->data:in[2]->data;
-               CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* allocs */
-               NodeTwoFloats *ntf= node->storage;
-               
-               if (ntf->x != 0.0f)
-                       composit3_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[2]->data, in[2]->vec, in[0]->data, in[0]->vec, do_alphaover_mixed, CB_RGBA, CB_RGBA, CB_VAL);
-               else if (node->custom1)
-                       composit3_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[2]->data, in[2]->vec, in[0]->data, in[0]->vec, do_alphaover_key, CB_RGBA, CB_RGBA, CB_VAL);
-               else
-                       composit3_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[2]->data, in[2]->vec, in[0]->data, in[0]->vec, do_alphaover_premul, CB_RGBA, CB_RGBA, CB_VAL);
-               
-               out[0]->data= stackbuf;
-       }
-}
-
-#endif  /* WITH_COMPOSITOR_LEGACY */
-
 static void node_alphaover_init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
 {
        node->storage= MEM_callocN(sizeof(NodeTwoFloats), "NodeTwoFloats");
@@ -154,9 +57,6 @@ void register_node_type_cmp_alphaover(bNodeTreeType *ttype)
        node_type_size(&ntype, 80, 40, 120);
        node_type_init(&ntype, node_alphaover_init);
        node_type_storage(&ntype, "NodeTwoFloats", node_free_standard_storage, node_copy_standard_storage);
-#ifdef WITH_COMPOSITOR_LEGACY
-       node_type_exec(&ntype, node_composit_exec_alphaover);
-#endif
 
        nodeRegisterType(ttype, &ntype);
 }
index 7674ace42a378d02f66cf4a846649d42497d89bf..34cc9a9061512ccf176ead245840ebb2f7e3d8ee 100644 (file)
@@ -43,221 +43,6 @@ static bNodeSocketTemplate cmp_node_bilateralblur_out[] = {
        { -1, 0, "" }
 };
 
-#ifdef WITH_COMPOSITOR_LEGACY
-
-#define INIT_C3                                                               \
-    mean0 = 1;                                                                \
-    mean1[0] = src[0];                                                        \
-    mean1[1] = src[1];                                                        \
-    mean1[2] = src[2];                                                        \
-    mean1[3] = src[3];                                                        \
-    (void)0
-
-/* finds color distances */
-#define COLOR_DISTANCE_C3(c1, c2)                                             \
-    ((c1[0] - c2[0]) * (c1[0] - c2[0]) +                                      \
-     (c1[1] - c2[1]) * (c1[1] - c2[1]) +                                      \
-     (c1[2] - c2[2]) * (c1[2] - c2[2]) +                                      \
-     (c1[3] - c2[3]) * (c1[3] - c2[3]))
-
-/* this is the main kernel function for comparing color distances
- * and adding them weighted to the final color */
-#define KERNEL_ELEMENT_C3(k)                                                  \
-    temp_color = src + deltas[k];                                             \
-    ref_color = ref + deltas[k];                                              \
-    w = weight_tab[k] +                                                       \
-        (double)COLOR_DISTANCE_C3(ref, ref_color) * i2sigma_color;            \
-    w = 1.0 / (w * w + 1);                                                    \
-    mean0 += w;                                                               \
-    mean1[0] += (double)temp_color[0] * w;                                    \
-    mean1[1] += (double)temp_color[1] * w;                                    \
-    mean1[2] += (double)temp_color[2] * w;                                    \
-    mean1[3] += (double)temp_color[3] * w;                                    \
-    (void)0
-
-/* write blurred values to image */
-#define UPDATE_OUTPUT_C3                                                      \
-    mean0 = 1.0 / mean0;                                                      \
-    dest[x * pix + 0] = mean1[0] * mean0;                                     \
-    dest[x * pix + 1] = mean1[1] * mean0;                                     \
-    dest[x * pix + 2] = mean1[2] * mean0;                                     \
-    dest[x * pix + 3] = mean1[3] * mean0;                                     \
-    (void)0
-
-/* initializes deltas for fast access to neighbor pixels */
-#define INIT_3X3_DELTAS(deltas, step, nch)                                    \
-    ((deltas)[0] =  (nch),  (deltas)[1] = -(step) + (nch),                    \
-     (deltas)[2] = -(step), (deltas)[3] = -(step) - (nch),                    \
-     (deltas)[4] = -(nch),  (deltas)[5] =  (step) - (nch),                    \
-     (deltas)[6] =  (step), (deltas)[7] =  (step) + (nch));                   \
-    (void)0
-
-
-/* code of this node was heavily inspired by the smooth function of opencv library.
- * The main change is an optional image input */
-static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
-{
-       NodeBilateralBlurData *nbbd = node->storage;
-       CompBuf *new, *source, *img = in[0]->data, *refimg = in[1]->data;
-       double mean0, w, i2sigma_color, i2sigma_space;
-       double mean1[4];
-       double weight_tab[8];
-       float *src, *dest, *ref, *temp_color, *ref_color;
-       float sigma_color, sigma_space;
-       int imgx, imgy, x, y, pix, i, step;
-       int deltas[8];
-       short found_determinator = 0;
-
-       if (img == NULL || out[0]->hasoutput == 0)
-               return;
-
-       if (img->type != CB_RGBA) {
-               img = typecheck_compbuf(in[0]->data, CB_RGBA);
-       }
-
-       imgx = img->x;
-       imgy = img->y;
-       pix = img->type;
-       step = pix * imgx;
-
-       if (refimg) {
-               if (refimg->x == imgx && refimg->y == imgy) {
-                       if (ELEM3(refimg->type, CB_VAL, CB_VEC2, CB_VEC3)) {
-                               refimg = typecheck_compbuf(in[1]->data, CB_RGBA);
-                               found_determinator = 1;
-                       }
-               }
-       }
-       else {
-               refimg = img;
-       }
-
-       /* allocs */
-       source = dupalloc_compbuf(img);
-       new = alloc_compbuf(imgx, imgy, pix, 1);
-       
-       /* accept image offsets from other nodes */
-       new->xof = img->xof;
-       new->yof = img->yof;
-
-       /* bilateral code properties */
-       sigma_color = nbbd->sigma_color;
-       sigma_space = nbbd->sigma_space;
-       
-       i2sigma_color = 1.0f / (sigma_color * sigma_color);
-       i2sigma_space = 1.0f / (sigma_space * sigma_space);
-
-       INIT_3X3_DELTAS(deltas, step, pix);
-
-       weight_tab[0] = weight_tab[2] = weight_tab[4] = weight_tab[6] = i2sigma_space;
-       weight_tab[1] = weight_tab[3] = weight_tab[5] = weight_tab[7] = i2sigma_space * 2;
-
-       /* iterations */
-       for (i = 0; i < nbbd->iter; i++) {
-               src = source->rect;
-               ref = refimg->rect;
-               dest = new->rect;
-               /*goes through image, there are more loops for 1st/last line and all other lines*/
-               /*kernel element accumulates surrounding colors, which are then written with the update_output function*/
-               for (x = 0; x < imgx; x++, src += pix, ref += pix) {
-                       INIT_C3;
-
-                       KERNEL_ELEMENT_C3(6);
-
-                       if (x > 0) {
-                               KERNEL_ELEMENT_C3(5);
-                               KERNEL_ELEMENT_C3(4);
-                       }
-
-                       if (x < imgx - 1) {
-                               KERNEL_ELEMENT_C3(7);
-                               KERNEL_ELEMENT_C3(0);
-                       }
-
-                       UPDATE_OUTPUT_C3;
-               }
-
-               dest += step;
-
-               for (y = 1; y < imgy - 1; y++, dest += step, src += pix, ref += pix) {
-                       x = 0;
-
-                       INIT_C3;
-
-                       KERNEL_ELEMENT_C3(0);
-                       KERNEL_ELEMENT_C3(1);
-                       KERNEL_ELEMENT_C3(2);
-                       KERNEL_ELEMENT_C3(6);
-                       KERNEL_ELEMENT_C3(7);
-
-                       UPDATE_OUTPUT_C3;
-
-                       src += pix;
-                       ref += pix;
-
-                       for (x = 1; x < imgx - 1; x++, src += pix, ref += pix) {
-                               INIT_C3;
-
-                               KERNEL_ELEMENT_C3(0);
-                               KERNEL_ELEMENT_C3(1);
-                               KERNEL_ELEMENT_C3(2);
-                               KERNEL_ELEMENT_C3(3);
-                               KERNEL_ELEMENT_C3(4);
-                               KERNEL_ELEMENT_C3(5);
-                               KERNEL_ELEMENT_C3(6);
-                               KERNEL_ELEMENT_C3(7);
-
-                               UPDATE_OUTPUT_C3;
-                       }
-
-                       INIT_C3;
-
-                       KERNEL_ELEMENT_C3(2);
-                       KERNEL_ELEMENT_C3(3);
-                       KERNEL_ELEMENT_C3(4);
-                       KERNEL_ELEMENT_C3(5);
-                       KERNEL_ELEMENT_C3(6);
-
-                       UPDATE_OUTPUT_C3;
-               }
-
-               for (x = 0; x < imgx; x++, src += pix, ref += pix) {
-                       INIT_C3;
-
-                       KERNEL_ELEMENT_C3(2);
-
-                       if (x > 0) {
-                               KERNEL_ELEMENT_C3(3);
-                               KERNEL_ELEMENT_C3(4);
-                       }
-                       if (x < imgx - 1) {
-                               KERNEL_ELEMENT_C3(1);
-                               KERNEL_ELEMENT_C3(0);
-                       }
-
-                       UPDATE_OUTPUT_C3;
-               }
-
-               if (node->exec & NODE_BREAK) break;
-
-               SWAP(CompBuf, *source, *new);
-       }
-
-       if (img != in[0]->data)
-               free_compbuf(img);
-
-       if (found_determinator == 1) {
-               if (refimg != in[1]->data)
-                       free_compbuf(refimg);
-       }
-
-       out[0]->data = source;
-
-       free_compbuf(new);
-}
-
-#endif  /* WITH_COMPOSITOR_LEGACY */
-
 static void node_composit_init_bilateralblur(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
 {
        NodeBilateralBlurData *nbbd = MEM_callocN(sizeof(NodeBilateralBlurData), "node bilateral blur data");
@@ -275,9 +60,6 @@ void register_node_type_cmp_bilateralblur(bNodeTreeType *ttype)
        node_type_size(&ntype, 150, 120, 200);
        node_type_init(&ntype, node_composit_init_bilateralblur);
        node_type_storage(&ntype, "NodeBilateralBlurData", node_free_standard_storage, node_copy_standard_storage);
-#ifdef WITH_COMPOSITOR_LEGACY
-       node_type_exec(&ntype, node_composit_exec_bilateralblur);
-#endif
 
        nodeRegisterType(ttype, &ntype);
 }
index eb7f7763afb38a516e2dd191d7279aa6099cf57c..9d19f9667bc35039dfba519c4e69fcb9e70f2687 100644 (file)
@@ -44,686 +44,6 @@ static bNodeSocketTemplate cmp_node_blur_out[] = {
        {   -1, 0, ""   }
 };
 
-#ifdef WITH_COMPOSITOR_LEGACY
-
-static float *make_gausstab(int filtertype, int rad)
-{
-       float *gausstab, sum, val;
-       int i, n;
-       
-       n = 2 * rad + 1;
-       
-       gausstab = (float *) MEM_mallocN(n * sizeof(float), "gauss");
-       
-       sum = 0.0f;
-       for (i = -rad; i <= rad; i++) {
-               val = RE_filter_value(filtertype, (float)i / (float)rad);
-               sum += val;
-               gausstab[i + rad] = val;
-       }
-       
-       sum = 1.0f / sum;
-       for (i = 0; i < n; i++)
-               gausstab[i] *= sum;
-       
-       return gausstab;
-}
-
-static float *make_bloomtab(int rad)
-{
-       float *bloomtab, val;
-       int i, n;
-       
-       n = 2 * rad + 1;
-       
-       bloomtab = (float *) MEM_mallocN(n * sizeof(float), "bloom");
-       
-       for (i = -rad; i <= rad; i++) {
-               val = powf(1.0f - fabsf((float)i) / ((float)rad), 4.0f);
-               bloomtab[i + rad] = val;
-       }
-       
-       return bloomtab;
-}
-
-/* both input images of same type, either 4 or 1 channel */
-static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float scale)
-{
-       NodeBlurData *nbd = node->storage;
-       CompBuf *work;
-       register float sum, val;
-       float rval, gval, bval, aval;
-       float *gausstab, *gausstabcent;
-       int rad, imgx = img->x, imgy = img->y;
-       int x, y, pix = img->type;
-       int i, bigstep;
-       float *src, *dest;
-       
-       /* helper image */
-       work = alloc_compbuf(imgx, imgy, img->type, 1); /* allocs */
-
-       /* horizontal */
-       if (nbd->sizex == 0) {
-               memcpy(work->rect, img->rect, sizeof(float) * img->type * imgx * imgy);
-       }
-       else {
-               rad = scale * (float)nbd->sizex;
-               if (rad > imgx / 2)
-                       rad = imgx / 2;
-               else if (rad < 1)
-                       rad = 1;
-               
-               gausstab = make_gausstab(nbd->filtertype, rad);
-               gausstabcent = gausstab + rad;
-               
-               for (y = 0; y < imgy; y++) {
-                       float *srcd = img->rect + pix * (y * img->x);
-                       
-                       dest = work->rect + pix * (y * img->x);
-                       
-                       for (x = 0; x < imgx; x++) {
-                               int minr = x - rad < 0 ? -x : -rad;
-                               int maxr = x + rad > imgx ? imgx - x : rad;
-                               
-                               src = srcd + pix * (x + minr);
-                               
-                               sum = gval = rval = bval = aval = 0.0f;
-                               for (i = minr; i < maxr; i++) {
-                                       val = gausstabcent[i];
-                                       sum += val;
-                                       rval += val * (*src++);
-                                       if (pix == 4) {
-                                               gval += val * (*src++);
-                                               bval += val * (*src++);
-                                               aval += val * (*src++);
-                                       }
-                               }
-                               sum = 1.0f / sum;
-                               *dest++ = rval * sum;
-                               if (pix == 4) {
-                                       *dest++ = gval * sum;
-                                       *dest++ = bval * sum;
-                                       *dest++ = aval * sum;
-                               }
-                       }
-                       if (node->exec & NODE_BREAK)
-                               break;
-               }
-               
-               /* vertical */
-               MEM_freeN(gausstab);
-       }
-       
-       if (nbd->sizey == 0) {
-               memcpy(new->rect, work->rect, sizeof(float) * img->type * imgx * imgy);
-       }
-       else {
-               rad = scale * (float)nbd->sizey;
-               if (rad > imgy / 2)
-                       rad = imgy / 2;
-               else if (rad < 1)
-                       rad = 1;
-       
-               gausstab = make_gausstab(nbd->filtertype, rad);
-               gausstabcent = gausstab + rad;
-               
-               bigstep = pix * imgx;
-               for (x = 0; x < imgx; x++) {
-                       float *srcd = work->rect + pix * x;
-                       
-                       dest = new->rect + pix * x;
-                       
-                       for (y = 0; y < imgy; y++) {
-                               int minr = y - rad < 0 ? -y : -rad;
-                               int maxr = y + rad > imgy ? imgy - y : rad;
-                               
-                               src = srcd + bigstep * (y + minr);
-                               
-                               sum = gval = rval = bval = aval = 0.0f;
-                               for (i = minr; i < maxr; i++) {
-                                       val = gausstabcent[i];
-                                       sum += val;
-                                       rval += val * src[0];
-                                       if (pix == 4) {
-                                               gval += val * src[1];
-                                               bval += val * src[2];
-                                               aval += val * src[3];
-                                       }
-                                       src += bigstep;
-                               }
-                               sum = 1.0f / sum;
-                               dest[0] = rval * sum;
-                               if (pix == 4) {
-                                       dest[1] = gval * sum;
-                                       dest[2] = bval * sum;
-                                       dest[3] = aval * sum;
-                               }
-                               dest += bigstep;
-                       }
-                       if (node->exec & NODE_BREAK)
-                               break;
-               }
-               MEM_freeN(gausstab);
-       }
-
-       free_compbuf(work);
-}
-
-/* reference has to be mapped 0-1, and equal in size */
-static void bloom_with_reference(CompBuf *new, CompBuf *img, CompBuf *UNUSED(ref), float UNUSED(fac), NodeBlurData *nbd)
-{
-       CompBuf *wbuf;
-       register float val;
-       float radxf, radyf;
-       float **maintabs;
-       float *gausstabx, *gausstabcenty;
-       float *gausstaby, *gausstabcentx;
-       int radx, rady, imgx = img->x, imgy = img->y;
-       int x, y;
-       int i, j;
-       float *src, *dest, *wb;
-       
-       wbuf = alloc_compbuf(imgx, imgy, CB_VAL, 1);
-       
-       /* horizontal */
-       radx = (float)nbd->sizex;
-       if (radx > imgx / 2)
-               radx = imgx / 2;
-       else if (radx < 1)
-               radx = 1;
-       
-       /* vertical */
-       rady = (float)nbd->sizey;
-       if (rady > imgy / 2)
-               rady = imgy / 2;
-       else if (rady < 1)
-               rady = 1;
-
-       x = MAX2(radx, rady);
-       maintabs = MEM_mallocN(x * sizeof(void *), "gauss array");
-       for (i = 0; i < x; i++)
-               maintabs[i] = make_bloomtab(i + 1);
-               
-       /* vars to store before we go */
-//     refd= ref->rect;
-       src = img->rect;
-       
-       radxf = (float)radx;
-       radyf = (float)rady;
-       
-       for (y = 0; y < imgy; y++) {
-               for (x = 0; x < imgx; x++, src += 4) { //, refd++) {
-                       
-//                     int refradx= (int)(refd[0]*radxf);
-//                     int refrady= (int)(refd[0]*radyf);
-                       
-                       int refradx = (int)(radxf * 0.3f * src[3] * (src[0] + src[1] + src[2]));
-                       int refrady = (int)(radyf * 0.3f * src[3] * (src[0] + src[1] + src[2]));
-                       
-                       if (refradx > radx) refradx = radx;
-                       else if (refradx < 1) refradx = 1;
-                       if (refrady > rady) refrady = rady;
-                       else if (refrady < 1) refrady = 1;
-
-                       if (refradx == 1 && refrady == 1) {
-                               wb = wbuf->rect + (y * imgx + x);
-                               dest = new->rect + 4 * (y * imgx + x);
-                               wb[0] += 1.0f;
-                               dest[0] += src[0];
-                               dest[1] += src[1];
-                               dest[2] += src[2];
-                               dest[3] += src[3];
-                       }
-                       else {
-                               int minxr = x - refradx < 0 ? -x : -refradx;
-                               int maxxr = x + refradx > imgx ? imgx - x : refradx;
-                               int minyr = y - refrady < 0 ? -y : -refrady;
-                               int maxyr = y + refrady > imgy ? imgy - y : refrady;
-
-                               float *destd = new->rect + 4 * ( (y + minyr) * imgx + x + minxr);
-                               float *wbufd = wbuf->rect + ( (y + minyr) * imgx + x + minxr);
-
-                               gausstabx = maintabs[refradx - 1];
-                               gausstabcentx = gausstabx + refradx;
-                               gausstaby = maintabs[refrady - 1];
-                               gausstabcenty = gausstaby + refrady;
-
-                               for (i = minyr; i < maxyr; i++, destd += 4 * imgx, wbufd += imgx) {
-                                       dest = destd;
-                                       wb = wbufd;
-                                       for (j = minxr; j < maxxr; j++, dest += 4, wb++) {
-                                               
-                                               val = gausstabcenty[i] * gausstabcentx[j];
-                                               wb[0] += val;
-                                               dest[0] += val * src[0];
-                                               dest[1] += val * src[1];
-                                               dest[2] += val * src[2];
-                                               dest[3] += val * src[3];
-                                       }
-                               }
-                       }
-               }
-       }
-       
-       x = imgx * imgy;
-       dest = new->rect;
-       wb = wbuf->rect;
-       while (x--) {
-               val = 1.0f / wb[0];
-               dest[0] *= val;
-               dest[1] *= val;
-               dest[2] *= val;
-               dest[3] *= val;
-               wb++;
-               dest += 4;
-       }
-       
-       free_compbuf(wbuf);
-       
-       x = MAX2(radx, rady);
-       for (i = 0; i < x; i++)
-               MEM_freeN(maintabs[i]);
-       MEM_freeN(maintabs);
-       
-}
-
-#if 0
-static float hexagon_filter(float fi, float fj)
-{
-       fi = fabs(fi);
-       fj = fabs(fj);
-       
-       if (fj > 0.33f) {
-               fj = (fj - 0.33f) / 0.66f;
-               if (fi + fj > 1.0f)
-                       return 0.0f;
-               else
-                       return 1.0f;
-       }
-       else return 1.0f;
-}
-#endif
-
-/* uses full filter, no horizontal/vertical optimize possible */
-/* both images same type, either 1 or 4 channels */
-static void bokeh_single_image(bNode *node, CompBuf *new, CompBuf *img, float fac)
-{
-       NodeBlurData *nbd = node->storage;
-       register float val;
-       float radxf, radyf;
-       float *gausstab, *dgauss;
-       int radx, rady, imgx = img->x, imgy = img->y;
-       int x, y, pix = img->type;
-       int i, j, n;
-       float *src = NULL, *dest, *srcd = NULL;
-       
-       /* horizontal */
-       radxf = fac * (float)nbd->sizex;
-       if (radxf > imgx / 2.0f)
-               radxf = imgx / 2.0f;
-       else if (radxf < 1.0f)
-               radxf = 1.0f;
-       
-       /* vertical */
-       radyf = fac * (float)nbd->sizey;
-       if (radyf > imgy / 2.0f)
-               radyf = imgy / 2.0f;
-       else if (radyf < 1.0f)
-               radyf = 1.0f;
-       
-       radx = ceil(radxf);
-       rady = ceil(radyf);
-       
-       n = (2 * radx + 1) * (2 * rady + 1);
-       
-       /* create a full filter image */
-       gausstab = MEM_mallocN(sizeof(float) * n, "filter tab");
-       dgauss = gausstab;
-       val = 0.0f;
-       for (j = -rady; j <= rady; j++) {
-               for (i = -radx; i <= radx; i++, dgauss++) {
-                       float fj = (float)j / radyf;
-                       float fi = (float)i / radxf;
-                       float dist = sqrt(fj * fj + fi * fi);
-
-                       // *dgauss= hexagon_filter(fi, fj);
-                       *dgauss = RE_filter_value(nbd->filtertype, dist);
-
-                       val += *dgauss;
-               }
-       }
-
-       if (val != 0.0f) {
-               val = 1.0f / val;
-               for (j = n - 1; j >= 0; j--)
-                       gausstab[j] *= val;
-       }
-       else gausstab[4] = 1.0f;
-
-       for (y = -rady + 1; y < imgy + rady - 1; y++) {
-
-               if (y <= 0) srcd = img->rect;
-               else if (y < imgy) srcd += pix * imgx;
-               else srcd = img->rect + pix * (imgy - 1) * imgx;
-
-               for (x = -radx + 1; x < imgx + radx - 1; x++) {
-                       int minxr = x - radx < 0 ? -x : -radx;
-                       int maxxr = x + radx >= imgx ? imgx - x - 1 : radx;
-                       int minyr = y - rady < 0 ? -y : -rady;
-                       int maxyr = y + rady > imgy - 1 ? imgy - y - 1 : rady;
-
-                       float *destd = new->rect + pix * ( (y + minyr) * imgx + x + minxr);
-                       float *dgausd = gausstab + (minyr + rady) * (2 * radx + 1) + minxr + radx;
-
-                       if (x <= 0) src = srcd;
-                       else if (x < imgx) src += pix;
-                       else src = srcd + pix * (imgx - 1);
-
-                       for (i = minyr; i <= maxyr; i++, destd += pix * imgx, dgausd += 2 * radx + 1) {
-                               dest = destd;
-                               dgauss = dgausd;
-                               for (j = minxr; j <= maxxr; j++, dest += pix, dgauss++) {
-                                       val = *dgauss;
-                                       if (val != 0.0f) {
-                                               dest[0] += val * src[0];
-                                               if (pix > 1) {
-                                                       dest[1] += val * src[1];
-                                                       dest[2] += val * src[2];
-                                                       dest[3] += val * src[3];
-                                               }
-                                       }
-                               }
-                       }
-               }
-               if (node->exec & NODE_BREAK)
-                       break;
-       }
-       
-       MEM_freeN(gausstab);
-}
-
-
-/* reference has to be mapped 0-1, and equal in size */
-static void blur_with_reference(bNode *node, CompBuf *new, CompBuf *img, CompBuf *ref)
-{
-       NodeBlurData *nbd = node->storage;
-       CompBuf *blurbuf, *ref_use;
-       register float sum, val;
-       float rval, gval, bval, aval, radxf, radyf;
-       float **maintabs;
-       float *gausstabx, *gausstabcenty;
-       float *gausstaby, *gausstabcentx;
-       int radx, rady, imgx = img->x, imgy = img->y;
-       int x, y, pix = img->type;
-       int i, j;
-       float *src, *dest, *refd, *blurd;
-       float defcol[4] = {1.0f, 1.0f, 1.0f, 1.0f}; /* default color for compbuf_get_pixel */
-       float proccol[4];   /* local color if compbuf is procedural */
-       int refradx, refrady;
-
-       if (ref->x != img->x || ref->y != img->y)
-               return;
-       
-       ref_use = typecheck_compbuf(ref, CB_VAL);
-       
-       /* trick is; we blur the reference image... but only works with clipped values*/
-       blurbuf = alloc_compbuf(imgx, imgy, CB_VAL, 1);
-       blurbuf->xof = ref_use->xof;
-       blurbuf->yof = ref_use->yof;
-       blurd = blurbuf->rect;
-       refd = ref_use->rect;
-       for (x = imgx * imgy; x > 0; x--, refd++, blurd++) {
-               if (refd[0] < 0.0f) blurd[0] = 0.0f;
-               else if (refd[0] > 1.0f) blurd[0] = 1.0f;
-               else blurd[0] = refd[0];
-       }
-       
-       blur_single_image(node, blurbuf, blurbuf, 1.0f);
-       
-       /* horizontal */
-       radx = (float)nbd->sizex;
-       if (radx > imgx / 2)
-               radx = imgx / 2;
-       else if (radx < 1)
-               radx = 1;
-       
-       /* vertical */
-       rady = (float)nbd->sizey;
-       if (rady > imgy / 2)
-               rady = imgy / 2;
-       else if (rady < 1)
-               rady = 1;
-
-       x = MAX2(radx, rady);
-       maintabs = MEM_mallocN(x * sizeof(void *), "gauss array");
-       for (i = 0; i < x; i++)
-               maintabs[i] = make_gausstab(nbd->filtertype, i + 1);
-
-       dest = new->rect;
-       radxf = (float)radx;
-       radyf = (float)rady;
-       
-       for (y = 0; y < imgy; y++) {
-               for (x = 0; x < imgx; x++, dest += pix) {
-                       refd = compbuf_get_pixel(blurbuf, defcol, proccol, x - blurbuf->xrad, y - blurbuf->yrad, blurbuf->xrad, blurbuf->yrad);
-                       refradx = (int)(refd[0] * radxf);
-                       refrady = (int)(refd[0] * radyf);
-
-                       if (refradx > radx) refradx = radx;
-                       else if (refradx < 1) refradx = 1;
-                       if (refrady > rady) refrady = rady;
-                       else if (refrady < 1) refrady = 1;
-
-                       if (refradx == 1 && refrady == 1) {
-                               src = img->rect + pix * (y * imgx + x);
-                               if (pix == 1)
-                                       dest[0] = src[0];
-                               else
-                                       copy_v4_v4(dest, src);
-                       }
-                       else {
-                               int minxr = x - refradx < 0 ? -x : -refradx;
-                               int maxxr = x + refradx > imgx ? imgx - x : refradx;
-                               int minyr = y - refrady < 0 ? -y : -refrady;
-                               int maxyr = y + refrady > imgy ? imgy - y : refrady;
-
-                               float *srcd = img->rect + pix * ( (y + minyr) * imgx + x + minxr);
-
-                               gausstabx = maintabs[refradx - 1];
-                               gausstabcentx = gausstabx + refradx;
-                               gausstaby = maintabs[refrady - 1];
-                               gausstabcenty = gausstaby + refrady;
-
-                               sum = gval = rval = bval = aval = 0.0f;
-
-                               for (i = minyr; i < maxyr; i++, srcd += pix * imgx) {
-                                       src = srcd;
-                                       for (j = minxr; j < maxxr; j++, src += pix) {
-                                       
-                                               val = gausstabcenty[i] * gausstabcentx[j];
-                                               sum += val;
-                                               rval += val * src[0];
-                                               if (pix > 1) {
-                                                       gval += val * src[1];
-                                                       bval += val * src[2];
-                                                       aval += val * src[3];
-                                               }
-                                       }
-                               }
-                               sum = 1.0f / sum;
-                               dest[0] = rval * sum;
-                               if (pix > 1) {
-                                       dest[1] = gval * sum;
-                                       dest[2] = bval * sum;
-                                       dest[3] = aval * sum;
-                               }
-                       }
-               }
-               if (node->exec & NODE_BREAK)
-                       break;
-       }
-       
-       free_compbuf(blurbuf);
-       
-       x = MAX2(radx, rady);
-       for (i = 0; i < x; i++)
-               MEM_freeN(maintabs[i]);
-       MEM_freeN(maintabs);
-       
-       if (ref_use != ref)
-               free_compbuf(ref_use);
-}
-
-static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
-{
-       CompBuf *new, *img = in[0]->data;
-       NodeBlurData *nbd = node->storage;
-       
-       if (img == NULL) return;
-       
-       /* store image in size that is needed for absolute/relative conversions on ui level */
-       nbd->image_in_width = img->x;
-       nbd->image_in_height = img->y;
-       
-       if (out[0]->hasoutput == 0) return;
-       
-       if (nbd->relative) {
-               if (nbd->aspect == CMP_NODE_BLUR_ASPECT_NONE) {
-                       nbd->sizex = (int)(nbd->percentx * 0.01f * nbd->image_in_width);
-                       nbd->sizey = (int)(nbd->percenty * 0.01f * nbd->image_in_height);
-               }
-               else if (nbd->aspect == CMP_NODE_BLUR_ASPECT_Y) {
-                       nbd->sizex = (int)(nbd->percentx * 0.01f * nbd->image_in_width);
-                       nbd->sizey = (int)(nbd->percenty * 0.01f * nbd->image_in_width);
-               }
-               else if (nbd->aspect == CMP_NODE_BLUR_ASPECT_X) {
-                       nbd->sizex = (int)(nbd->percentx * 0.01f * nbd->image_in_height);
-                       nbd->sizey = (int)(nbd->percenty * 0.01f * nbd->image_in_height);
-               }
-       }
-
-       if (nbd->sizex == 0 && nbd->sizey == 0) {
-               new = pass_on_compbuf(img);
-               out[0]->data = new;
-       }
-       else if (nbd->filtertype == R_FILTER_FAST_GAUSS) {
-               if (in[1]->vec[0] < 0.001f) { /* time node inputs can be a tiny value */
-                       new = pass_on_compbuf(img);
-               }
-               else {
-                       // TODO: can this be mapped with reference, too?
-                       const float sx = ((float)nbd->sizex * in[1]->vec[0]) / 2.0f, sy = ((float)nbd->sizey * in[1]->vec[0]) / 2.0f;
-                       int c;
-
-                       if ((img == NULL) || (out[0]->hasoutput == 0)) return;
-
-                       if (img->type == CB_VEC2)
-                               new = typecheck_compbuf(img, CB_VAL);
-                       else if (img->type == CB_VEC3)
-                               new = typecheck_compbuf(img, CB_RGBA);
-                       else
-                               new = dupalloc_compbuf(img);
-
-                       if ((sx == sy) && (sx > 0.f)) {
-                               for (c = 0; c < new->type; ++c)
-                                       IIR_gauss(new, sx, c, 3);
-                       }
-                       else {
-                               if (sx > 0.f) {
-                                       for (c = 0; c < new->type; ++c)
-                                               IIR_gauss(new, sx, c, 1);
-                               }
-                               if (sy > 0.f) {
-                                       for (c = 0; c < new->type; ++c)
-                                               IIR_gauss(new, sy, c, 2);
-                               }
-                       }
-               }
-               out[0]->data = new;
-       }
-       else {
-               /* All non fast gauss blur methods */
-               if (img->type == CB_VEC2 || img->type == CB_VEC3) {
-                       img = typecheck_compbuf(in[0]->data, CB_RGBA);
-               }
-               
-               /* if fac input, we do it different */
-               if (in[1]->data) {
-                       CompBuf *gammabuf;
-                       
-                       /* make output size of input image */
-                       new = alloc_compbuf(img->x, img->y, img->type, 1); /* allocs */
-                       
-                       /* accept image offsets from other nodes */
-                       new->xof = img->xof;
-                       new->yof = img->yof;
-                       
-                       if (nbd->gamma) {
-                               gammabuf = dupalloc_compbuf(img);
-                               gamma_correct_compbuf(gammabuf, 0);
-                       }
-                       else gammabuf = img;
-                       
-                       blur_with_reference(node, new, gammabuf, in[1]->data);
-                       
-                       if (nbd->gamma) {
-                               gamma_correct_compbuf(new, 1);
-                               free_compbuf(gammabuf);
-                       }
-                       if (node->exec & NODE_BREAK) {
-                               free_compbuf(new);
-                               new = NULL;
-                       }
-                       out[0]->data = new;
-               }
-               else {
-                       
-                       if (in[1]->vec[0] <= 0.001f) {    /* time node inputs can be a tiny value */
-                               new = pass_on_compbuf(img);
-                       }
-                       else {
-                               CompBuf *gammabuf;
-                               
-                               /* make output size of input image */
-                               new = alloc_compbuf(img->x, img->y, img->type, 1); /* allocs */
-                               
-                               /* accept image offsets from other nodes */
-                               new->xof = img->xof;
-                               new->yof = img->yof;
-                                       
-                               if (nbd->gamma) {
-                                       gammabuf = dupalloc_compbuf(img);
-                                       gamma_correct_compbuf(gammabuf, 0);
-                               }
-                               else gammabuf = img;
-                               
-                               if (nbd->bokeh)
-                                       bokeh_single_image(node, new, gammabuf, in[1]->vec[0]);
-                               else if (1)
-                                       blur_single_image(node, new, gammabuf, in[1]->vec[0]);
-                               else  /* bloom experimental... */
-                                       bloom_with_reference(new, gammabuf, NULL, in[1]->vec[0], nbd);
-                               
-                               if (nbd->gamma) {
-                                       gamma_correct_compbuf(new, 1);
-                                       free_compbuf(gammabuf);
-                               }
-                               if (node->exec & NODE_BREAK) {
-                                       free_compbuf(new);
-                                       new = NULL;
-                               }
-                       }
-                       out[0]->data = new;
-               }
-               if (img != in[0]->data)
-                       free_compbuf(img);
-       }
-
-       generate_preview(data, node, out[0]->data);
-}
-
-#endif  /* WITH_COMPOSITOR_LEGACY */
-
 static void node_composit_init_blur(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
 {
        NodeBlurData *data = MEM_callocN(sizeof(NodeBlurData), "node blur data");
@@ -740,9 +60,6 @@ void register_node_type_cmp_blur(bNodeTreeType *ttype)
        node_type_size(&ntype, 120, 80, 200);
        node_type_init(&ntype, node_composit_init_blur);
        node_type_storage(&ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage);
-#ifdef WITH_COMPOSITOR_LEGACY
-       node_type_exec(&ntype, node_composit_exec_blur);
-#endif
 
        nodeRegisterType(ttype, &ntype);
 }
index ecf572f59c7105bf6421150305bde566ff4b7371..719423edcf8d483a52f670c25598d8f268d6224e 100644 (file)
@@ -47,54 +47,6 @@ static bNodeSocketTemplate cmp_node_brightcontrast_out[] = {
        {       -1, 0, ""       }
 };
 
-#ifdef WITH_COMPOSITOR_LEGACY
-
-static void do_brightnesscontrast(bNode *UNUSED(node), float *out, float *in, float *in_brightness, float *in_contrast)
-{
-       float i;
-       int c;
-       float a, b, v;
-       float brightness = (*in_brightness) / 100.0f;
-       float contrast = *in_contrast;
-       float delta = contrast / 200.0f;
-       a = 1.0f - delta * 2.0f;
-       /*
-        * The algorithm is by Werner D. Streidt
-        * (http://visca.com/ffactory/archives/5-99/msg00021.html)
-        * Extracted of OpenCV demhist.c
-        */
-       if (contrast > 0) {
-               a = 1.0f / a;
-               b = a * (brightness - delta);
-       }
-       else {
-               delta *= -1;
-               b = a * (brightness + delta);
-       }
-       
-       for (c=0; c<3; c++) {
-               i = in[c];
-               v = a*i + b;
-               out[c] = v;
-       }
-}
-
-static void node_composit_exec_brightcontrast(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
-{
-       if (out[0]->hasoutput==0)
-               return;
-       
-       if (in[0]->data) {
-               CompBuf *stackbuf, *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
-               stackbuf= dupalloc_compbuf(cbuf);
-               composit3_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, in[2]->data, in[2]->vec, do_brightnesscontrast, CB_RGBA, CB_VAL, CB_VAL);
-               out[0]->data = stackbuf;
-               if (cbuf != in[0]->data)
-                       free_compbuf(cbuf);
-       }
-}
-
-#endif  /* WITH_COMPOSITOR_LEGACY */
 
 void register_node_type_cmp_brightcontrast(bNodeTreeType *ttype)
 {
@@ -103,9 +55,6 @@ void register_node_type_cmp_brightcontrast(bNodeTreeType *ttype)
        node_type_base(ttype, &ntype, CMP_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
        node_type_socket_templates(&ntype, cmp_node_brightcontrast_in, cmp_node_brightcontrast_out);
        node_type_size(&ntype, 140, 100, 320);
-#ifdef WITH_COMPOSITOR_LEGACY
-       node_type_exec(&ntype, node_composit_exec_brightcontrast);
-#endif
 
        nodeRegisterType(ttype, &ntype);
 }
index 40dbbbb8dca445af98fdb364656dd2159c80a401..a54a8507882103d5027c1241aaee45f30b884e94 100644 (file)
@@ -45,153 +45,6 @@ static bNodeSocketTemplate cmp_node_channel_matte_out[] ={
        {-1, 0, ""}
 };
 
-#ifdef WITH_COMPOSITOR_LEGACY
-
-static void do_normalized_rgba_to_ycca2(bNode *UNUSED(node), float *out, float *in)
-{
-       /*normalize to the range 0.0 to 1.0) */
-       rgb_to_ycc(in[0], in[1], in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
-       out[0]=(out[0])/255.0f;
-       out[1]=(out[1])/255.0f;
-       out[2]=(out[2])/255.0f;
-       out[3]=in[3];
-}
-
-static void do_normalized_ycca_to_rgba2(bNode *UNUSED(node), float *out, float *in)
-{
-       /*un-normalize the normalize from above */
-       in[0]=in[0]*255.0f;
-       in[1]=in[1]*255.0f;
-       in[2]=in[2]*255.0f;
-       ycc_to_rgb(in[0], in[1], in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
-       out[3]=in[3];
-}
-
-
-static void do_channel_matte(bNode *node, float *out, float *in)
-{
-       NodeChroma *c=(NodeChroma *)node->storage;
-       float alpha=0.0;
-
-       switch (c->algorithm) {
-       case 0: { /* Alpha=key_channel-limit channel */
-               int key_channel=node->custom2-1;
-               int limit_channel=c->channel-1;
-               alpha=in[key_channel]-in[limit_channel];
-               break;
-       }
-       case 1: { /* Alpha=G-MAX(R, B) */
-               switch (node->custom2) {
-                       case 1:
-                       {
-                               alpha=in[0]-MAX2(in[1], in[2]);
-                               break;
-                       }
-                       case 2:
-                       {
-                               alpha=in[1]-MAX2(in[0], in[2]);
-                               break;
-                       }
-                       case 3:
-                       {
-                               alpha=in[2]-MAX2(in[0], in[1]);
-                               break;
-                       }
-                       default:
-                               break;
-               }
-               break;
-       }
-       default:
-               break;
-       }
-
-       /*flip because 0.0 is transparent, not 1.0*/
-       alpha=1-alpha;
-       
-       /* test range*/
-       if (alpha>c->t1) {
-               alpha=in[3]; /*whatever it was prior */
-       }
-       else if (alpha<c->t2) {
-               alpha=0.0;
-       }
-       else {/*blend */
-               alpha=(alpha-c->t2)/(c->t1-c->t2);
-       }
-
-       
-       /* don't make something that was more transparent less transparent */
-       if (alpha<in[3]) {
-               out[3]=alpha;
-       }
-       else {
-               out[3]=in[3];
-       }
-}
-
-static void node_composit_exec_channel_matte(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
-{
-       CompBuf *cbuf;
-       CompBuf *outbuf;
-       
-       if (in[0]->hasinput==0) return;
-       if (in[0]->data==NULL) return;
-       if (out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
-       
-       cbuf=typecheck_compbuf(in[0]->data, CB_RGBA);
-       
-       outbuf=dupalloc_compbuf(cbuf);
-       
-       /*convert to colorspace*/
-       switch (node->custom1) {
-       case CMP_NODE_CHANNEL_MATTE_CS_RGB:
-               break;
-       case CMP_NODE_CHANNEL_MATTE_CS_HSV: /*HSV*/
-               composit1_pixel_processor(node, outbuf, cbuf, in[1]->vec, do_rgba_to_hsva, CB_RGBA);
-               break;
-       case CMP_NODE_CHANNEL_MATTE_CS_YUV: /*YUV*/
-               composit1_pixel_processor(node, outbuf, cbuf, in[1]->vec, do_rgba_to_yuva, CB_RGBA);
-               break;
-       case CMP_NODE_CHANNEL_MATTE_CS_YCC: /*YCC*/
-               composit1_pixel_processor(node, outbuf, cbuf, in[1]->vec, do_normalized_rgba_to_ycca2, CB_RGBA);
-               break;
-       default:
-               break;
-       }
-
-       /*use the selected channel information to do the key */
-       composit1_pixel_processor(node, outbuf, outbuf, in[1]->vec, do_channel_matte, CB_RGBA);
-
-       /*convert back to RGB colorspace in place*/
-       switch (node->custom1) {
-       case CMP_NODE_CHANNEL_MATTE_CS_RGB: /*RGB*/
-               break;
-       case CMP_NODE_CHANNEL_MATTE_CS_HSV: /*HSV*/
-               composit1_pixel_processor(node, outbuf, outbuf, in[1]->vec, do_hsva_to_rgba, CB_RGBA);
-               break;
-       case CMP_NODE_CHANNEL_MATTE_CS_YUV: /*YUV*/
-               composit1_pixel_processor(node, outbuf, outbuf, in[1]->vec, do_yuva_to_rgba, CB_RGBA);
-               break;
-       case CMP_NODE_CHANNEL_MATTE_CS_YCC: /*YCC*/
-               composit1_pixel_processor(node, outbuf, outbuf, in[1]->vec, do_normalized_ycca_to_rgba2, CB_RGBA);
-               break;
-       default:
-               break;
-       }
-
-       generate_preview(data, node, outbuf);
-       out[0]->data=outbuf;
-       if (out[1]->hasoutput)
-               out[1]->data=valbuf_from_rgbabuf(outbuf, CHAN_A);
-
-       if (cbuf!=in[0]->data)
-               free_compbuf(cbuf);
-
-}
-
-#endif  /* WITH_COMPOSITOR_LEGACY */
-
 static void node_composit_init_channel_matte(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
 {
        NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
@@ -216,9 +69,6 @@ void register_node_type_cmp_channel_matte(bNodeTreeType *ttype)
        node_type_size(&ntype, 200, 80, 250);
        node_type_init(&ntype, node_composit_init_channel_matte);
        node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
-#ifdef WITH_COMPOSITOR_LEGACY
-       node_type_exec(&ntype, node_composit_exec_channel_matte);
-#endif
 
        nodeRegisterType(ttype, &ntype);
 }
index f343f806d57774f8497b359c123944b5ea204955..83c8bbc9a1edfd51a223e6dea5165d69abe3fabe 100644 (file)
@@ -45,136 +45,6 @@ static bNodeSocketTemplate cmp_node_chroma_out[] = {
        {-1, 0, ""}
 };
 
-#ifdef WITH_COMPOSITOR_LEGACY
-
-static void do_rgba_to_ycca_normalized(bNode *UNUSED(node), float *out, float *in)
-{
-       rgb_to_ycc(in[0], in[1], in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
-
-       //normalize to 0..1.0
-       out[0]=out[0]/255.0f;
-       out[1]=out[1]/255.0f;
-       out[2]=out[2]/255.0f;
-
-       //rescale to -1.0..1.0
-       out[0]=(out[0]*2.0f)-1.0f;
-       out[1]=(out[1]*2.0f)-1.0f;
-       out[2]=(out[2]*2.0f)-1.0f;
-
-       //      out[0]=((out[0])-16)/255.0;
-       //      out[1]=((out[1])-128)/255.0;
-       //      out[2]=((out[2])-128)/255.0;
-       out[3]=in[3];
-}
-
-static void do_ycca_to_rgba_normalized(bNode *UNUSED(node), float *out, float *in)
-{
-       /*un-normalize the normalize from above */
-       in[0]=(in[0]+1.0f)/2.0f;
-       in[1]=(in[1]+1.0f)/2.0f;
-       in[2]=(in[2]+1.0f)/2.0f;
-
-       in[0]=(in[0]*255.0f);
-       in[1]=(in[1]*255.0f);
-       in[2]=(in[2]*255.0f);
-
-       //      in[0]=(in[0]*255.0)+16;
-       //      in[1]=(in[1]*255.0)+128;
-       //      in[2]=(in[2]*255.0)+128;
-       ycc_to_rgb(in[0], in[1], in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
-       out[3]=in[3];
-}
-
-static void do_chroma_key(bNode *node, float *out, float *in)
-{
-       NodeChroma *c;
-       float x, z, alpha;
-       float theta, beta, angle, angle2;
-       float kfg;
-
-       c=node->storage;
-
-       /* Algorithm from book "Video Demistified," does not include the spill reduction part */
-
-       /* find theta, the angle that the color space should be rotated based on key chroma values*/
-       theta=atan2(c->key[2], c->key[1]);
-
-       /*rotate the cb and cr into x/z space */
-       x=in[1]*cosf(theta)+in[2]*sinf(theta);
-       z=in[2]*cosf(theta)-in[1]*sinf(theta);
-
-       /*if within the acceptance angle */
-       angle=c->t1; /* t1 is radians. */
-
-       /* if kfg is <0 then the pixel is outside of the key color */
-       kfg= x-(fabsf(z)/tanf(angle/2.0f));
-
-       copy_v3_v3(out, in);
-
-       if (kfg>0.0f) {  /* found a pixel that is within key color */
-               beta=atan2(z, x);
-               angle2=c->t2; /* t2 is radians. */
-
-               /* if beta is within the cutoff angle */
-               if (fabsf(beta) < (angle2/2.0f)) {
-                       alpha=0.0;
-               }
-               else {
-                       alpha=1.0f-(kfg/c->fstrength);
-               }
-
-               /* don't make something that was more transparent less transparent */
-               if (alpha<in[3]) {
-                       out[3]=alpha;
-               }
-               else {
-                       out[3]=in[3];
-               }
-       }
-       else { /* make pixel just as transparent as it was before */
-               out[3]=in[3];
-       }
-}
-
-static void node_composit_exec_chroma_matte(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
-{
-       CompBuf *cbuf;
-       CompBuf *chromabuf;
-       NodeChroma *c;
-
-       if (in[0]->hasinput==0) return;
-       if (in[0]->data==NULL) return;
-       if (out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
-
-       cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
-
-       chromabuf= dupalloc_compbuf(cbuf);
-
-       c=node->storage;
-
-       /*convert rgbbuf to normalized chroma space*/
-       composit1_pixel_processor(node, chromabuf, cbuf, in[0]->vec, do_rgba_to_ycca_normalized, CB_RGBA);
-       /*convert key to normalized chroma color space */
-       do_rgba_to_ycca_normalized(node, c->key, in[1]->vec);
-
-       /*per pixel chroma key*/
-       composit1_pixel_processor(node, chromabuf, chromabuf, in[0]->vec, do_chroma_key, CB_RGBA);
-
-       /*convert back*/
-       composit1_pixel_processor(node, chromabuf, chromabuf, in[0]->vec, do_ycca_to_rgba_normalized, CB_RGBA);
-
-       out[0]->data= chromabuf;
-       if (out[1]->hasoutput)
-               out[1]->data= valbuf_from_rgbabuf(chromabuf, CHAN_A);
-
-       generate_preview(data, node, chromabuf);
-
-       if (cbuf!=in[0]->data)
-               free_compbuf(cbuf);
-}
-
-#endif  /* WITH_COMPOSITOR_LEGACY */
-
 static void node_composit_init_chroma_matte(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
 {
        NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
@@ -195,9 +65,6 @@ void register_node_type_cmp_chroma_matte(bNodeTreeType *ttype)
        node_type_size(&ntype, 200, 80, 300);
        node_type_init(&ntype, node_composit_init_chroma_matte);
        node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
-#ifdef WITH_COMPOSITOR_LEGACY
-       node_type_exec(&ntype, node_composit_exec_chroma_matte);
-#endif
 
        nodeRegisterType(ttype, &ntype);
 }
index 07a6647d976b1cb866450ae25daa96738d3a4f91..1642d9283c35dbee89923f8e17dac46384ff01a5 100644 (file)
@@ -45,77 +45,6 @@ static bNodeSocketTemplate cmp_node_color_out[] = {
        {-1, 0, ""}
 };
 
-#ifdef WITH_COMPOSITOR_LEGACY
-
-static void do_color_key(bNode *node, float *out, float *in)
-{
-       float h_wrap;
-       NodeChroma *c;
-       c=node->storage;
-
-
-       copy_v3_v3(out, in);
-
-       if (
-       /* do hue last because it needs to wrap, and does some more checks  */
-
-       /* sat */       (fabsf(in[1]-c->key[1]) < c->t2) &&
-       /* val */       (fabsf(in[2]-c->key[2]) < c->t3) &&
-
-       /* multiply by 2 because it wraps on both sides of the hue,
-        * otherwise 0.5 would key all hue's */
-
-       /* hue */       ((h_wrap= 2.0f * fabsf(in[0]-c->key[0])) < c->t1 || (2.0f - h_wrap) < c->t1)
-       ) {
-               out[3]=0.0; /*make transparent*/
-       }
-
-       else { /*pixel is outside key color */
-               out[3]=in[3]; /* make pixel just as transparent as it was before */
-       }
-}
-
-static void node_composit_exec_color_matte(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
-{
-       CompBuf *cbuf;
-       CompBuf *colorbuf;
-       NodeChroma *c;
-       
-       if (in[0]->hasinput==0) return;
-       if (in[0]->data==NULL) return;
-       if (out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
-       
-       cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
-       
-       colorbuf= dupalloc_compbuf(cbuf);
-       
-       c=node->storage;
-       
-       /*convert rgbbuf to hsv*/
-       composit1_pixel_processor(node, colorbuf, cbuf, in[0]->vec, do_rgba_to_hsva, CB_RGBA);
-       
-       /*convert key to hsv*/
-       do_rgba_to_hsva(node, c->key, in[1]->vec);
-       
-
-       /*per pixel color key*/
-       composit1_pixel_processor(node, colorbuf, colorbuf, in[0]->vec, do_color_key, CB_RGBA);
-       
-       /*convert back*/
-       composit1_pixel_processor(node, colorbuf, colorbuf, in[0]->vec, do_hsva_to_rgba, CB_RGBA);
-       
-       out[0]->data= colorbuf;
-       if (out[1]->hasoutput)
-               out[1]->data= valbuf_from_rgbabuf(colorbuf, CHAN_A);
-       
-       generate_preview(data, node, colorbuf);
-
-       if (cbuf!=in[0]->data)
-               free_compbuf(cbuf);
-}
-
-#endif  /* WITH_COMPOSITOR_LEGACY */
-
 static void node_composit_init_color_matte(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
 {
        NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node color");
@@ -136,9 +65,6 @@ void register_node_type_cmp_color_matte(bNodeTreeType *ttype)
        node_type_size(&ntype, 200, 80, 300);
        node_type_init(&ntype, node_composit_init_color_matte);
        node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
-#ifdef WITH_COMPOSITOR_LEGACY
-       node_type_exec(&ntype, node_composit_exec_color_matte);
-#endif
 
        nodeRegisterType(ttype, &ntype);
 }
index 44a5ac9e968c71c235c7308896a2b93d07ae79b9..3679a65b238d37bc36b8dd4b35baca06befa2677 100644 (file)
@@ -43,281 +43,6 @@ static bNodeSocketTemplate cmp_node_color_spill_out[] = {
        {-1, 0, ""}
 };
 
-#ifdef WITH_COMPOSITOR_LEGACY
-
-#define AVG(a, b) ((a + b) / 2)
-
-
-static void do_simple_spillmap_red(bNode *node, float* out, float *in)
-{
-       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;
-
-       out[0] = *fac * (in[0]-( ncs->limscale * in[ncs->limchan]));
-}
-
-static void do_simple_spillmap_green(bNode *node, float* out, float *in)
-{
-       NodeColorspill *ncs;
-       ncs=node->storage;
-       out[0]=in[1]-( ncs->limscale * in[ncs->limchan] );
-}
-
-static void do_simple_spillmap_green_fac(bNode *node, float* out, float *in, float *fac)
-{
-       NodeColorspill *ncs;
-       ncs=node->storage;
-
-       out[0] = *fac * (in[1]-( ncs->limscale * in[ncs->limchan]));
-}
-
-static void do_simple_spillmap_blue(bNode *node, float* out, float *in)
-{
-       NodeColorspill *ncs;
-       ncs=node->storage;
-       out[0]=in[2]-( ncs->limscale * in[ncs->limchan] );
-}
-
-static void do_simple_spillmap_blue_fac(bNode *node, float* out, float *in, float *fac)
-{
-       NodeColorspill *ncs;
-       ncs=node->storage;
-
-       out[0] = *fac * (in[2]-( ncs->limscale * in[ncs->limchan]));
-}
-
-static void do_average_spillmap_red(bNode *node, float* out, float *in)
-{
-       NodeColorspill *ncs;
-       ncs=node->storage;
-       out[0]=in[0]-(ncs->limscale * AVG(in[1], in[2]) );
-}
-
-static void do_average_spillmap_red_fac(bNode *node, float* out, float *in, float *fac)
-{
-       NodeColorspill *ncs;
-       ncs=node->storage;
-
-       out[0] = *fac * (in[0]-(ncs->limscale * AVG(in[1], in[2]) ));
-}
-
-static void do_average_spillmap_green(bNode *node, float* out, float *in)
-{
-       NodeColorspill *ncs;
-       ncs=node->storage;
-       out[0]=in[1]-(ncs->limscale * AVG(in[0], in[2]) );
-}
-
-static void do_average_spillmap_green_fac(bNode *node, float* out, float *in, float *fac)
-{
-       NodeColorspill *ncs;
-       ncs=node->storage;
-
-       out[0] = *fac * (in[0]-(ncs->limscale * AVG(in[0], in[2]) ));
-}
-
-static void do_average_spillmap_blue(bNode *node, float* out, float *in)
-{
-       NodeColorspill *ncs;
-       ncs=node->storage;
-       out[0]=in[2]-(ncs->limscale * AVG(in[0], in[1]) );
-}
-
-static void do_average_spillmap_blue_fac(bNode *node, float* out, float *in, float *fac)
-{
-       NodeColorspill *ncs;
-       ncs=node->storage;
-
-       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)
-{      
-       NodeColorspill *ncs;
-       ncs=node->storage;
-       if (map[0]>0) {
-               out[0]=in[0]-(ncs->uspillr*map[0]);
-               out[1]=in[1]+(ncs->uspillg*map[0]);
-               out[2]=in[2]+(ncs->uspillb*map[0]);
-       }
-       else {
-               out[0]=in[0];
-               out[1]=in[1];
-               out[2]=in[2];
-       }
-}
-
-static void do_apply_spillmap_green(bNode *node, float* out, float *in, float *map)
-{
-       NodeColorspill *ncs;
-       ncs=node->storage;
-       if (map[0]>0) {
-               out[0]=in[0]+(ncs->uspillr*map[0]);
-               out[1]=in[1]-(ncs->uspillg*map[0]);
-               out[2]=in[2]+(ncs->uspillb*map[0]);
-       }
-       else {
-               out[0]=in[0];
-               out[1]=in[1];
-               out[2]=in[2];
-       }
-}
-
-static void do_apply_spillmap_blue(bNode *node, float* out, float *in, float *map)
-{
-       NodeColorspill *ncs;
-       ncs=node->storage;
-       if (map[0]>0) {
-               out[0]=in[0]+(ncs->uspillr*map[0]);
-               out[1]=in[1]+(ncs->uspillg*map[0]);
-               out[2]=in[2]-(ncs->uspillb*map[0]);
-       }
-       else {
-               out[0]=in[0];
-               out[1]=in[1];
-               out[2]=in[2];
-       }
-}
-
-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; */ /* UNUSED */
-       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;
-       
-       cbuf=typecheck_compbuf(in[0]->data, CB_RGBA);
-       /* mask= */ /* UNUSED */ 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*/
-               {
-                       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);
-                                       }
-                                       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);
-                                       }
-                                       break;
-                               }
-                       }
-                       if (ncs->unspill==0) {
-                               ncs->uspillr=1.0f;
-                               ncs->uspillg=0.0f;
-                               ncs->uspillb=0.0f;
-                       }
-                       composit2_pixel_processor(node, rgbbuf, cbuf, in[0]->vec, spillmap, NULL, do_apply_spillmap_red, CB_RGBA, CB_VAL);
-                       break;
-               }
-               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;
-                               }
-                       }
-                       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*/
-               {
-                       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;
-                               }
-                       }
-                       if (ncs->unspill==0) {
-                               ncs->uspillr=0.0f;
-                               ncs->uspillg=0.0f;
-                               ncs->uspillb=1.0f;
-                       }
-                       composit2_pixel_processor(node, rgbbuf, cbuf, in[0]->vec, spillmap, NULL, do_apply_spillmap_blue, CB_RGBA, CB_VAL);
-                       break;
-               }
-               default:
-                       break;
-       }
-
-       out[0]->data=rgbbuf;
-
-       if (cbuf!=in[0]->data)
-               free_compbuf(cbuf);
-
-       free_compbuf(spillmap);
-}
-
-#endif  /* WITH_COMPOSITOR_LEGACY */
-
 static void node_composit_init_color_spill(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
 {
        NodeColorspill *ncs= MEM_callocN(sizeof(NodeColorspill), "node colorspill");
@@ -338,9 +63,6 @@ void register_node_type_cmp_color_spill(bNodeTreeType *ttype)
        node_type_size(&ntype, 140, 80, 200);
        node_type_init(&ntype, node_composit_init_color_spill);
        node_type_storage(&ntype, "NodeColorspill", node_free_standard_storage, node_copy_standard_storage);
-#ifdef WITH_COMPOSITOR_LEGACY
-       node_type_exec(&ntype, node_composit_exec_color_spill);
-#endif
 
        nodeRegisterType(ttype, &ntype);
 }
index 0927724d3fb1e59cf2c31bf42ea6d4cd6705abd5..da9ce64d99467f617670f9c267ccf213f59b4d83 100644 (file)
@@ -46,138 +46,6 @@ static bNodeSocketTemplate cmp_node_colorbalance_out[] = {
        {-1, 0, ""}
 };
 
-#ifdef WITH_COMPOSITOR_LEGACY
-
-/* this function implements ASC-CDL according to the spec at http://www.asctech.org/
- * Slope
- *       S = in * slope
- * Offset
- *       O = S + offset
- *         = (in * slope) + offset
- * Power
- *     out = Clamp(O) ^ power
- *         = Clamp((in * slope) + offset) ^ power
- */
-BLI_INLINE float colorbalance_cdl(float in, float offset, float power, float slope)
-{
-       float x = in * slope + offset;
-       
-       /* prevent NaN */
-       CLAMP(x, 0.0f, 1.0f);
-       
-       return powf(x, power);
-}
-
-/* note: lift_lgg is just 2-lift, gamma_inv is 1.0/gamma */
-BLI_INLINE float colorbalance_lgg(float in, float lift_lgg, float gamma_inv, float gain)
-{
-       /* 1:1 match with the sequencer with linear/srgb conversions, the conversion isn't pretty
-        * but best keep it this way, since testing for durian shows a similar calculation
-        * without lin/srgb conversions gives bad results (over-saturated shadows) with colors
-        * slightly below 1.0. some correction can be done but it ends up looking bad for shadows or lighter tones - campbell */
-       float x= (((linearrgb_to_srgb(in) - 1.0f) * lift_lgg) + 1.0f) * gain;
-
-       /* prevent NaN */
-       if (x < 0.f) x = 0.f;
-
-       return powf(srgb_to_linearrgb(x), gamma_inv);
-}
-
-static void do_colorbalance_cdl(bNode *node, float* out, float *in)
-{
-       NodeColorBalance *n= (NodeColorBalance *)node->storage;
-       
-       out[0] = colorbalance_cdl(in[0], n->lift[0], n->gamma[0], n->gain[0]);
-       out[1] = colorbalance_cdl(in[1], n->lift[1], n->gamma[1], n->gain[1]);
-       out[2] = colorbalance_cdl(in[2], n->lift[2], n->gamma[2], n->gain[2]);
-       out[3] = in[3];
-}
-
-static void do_colorbalance_cdl_fac(bNode *node, float* out, float *in, float *fac)
-{
-       NodeColorBalance *n= (NodeColorBalance *)node->storage;
-       const float mfac= 1.0f - *fac;
-       
-       out[0] = mfac*in[0] + *fac * colorbalance_cdl(in[0], n->lift[0], n->gamma[0], n->gain[0]);
-       out[1] = mfac*in[1] + *fac * colorbalance_cdl(in[1], n->lift[1], n->gamma[1], n->gain[1]);
-       out[2] = mfac*in[2] + *fac * colorbalance_cdl(in[2], n->lift[2], n->gamma[2], n->gain[2]);
-       out[3] = in[3];
-}
-
-static void do_colorbalance_lgg(bNode *node, float* out, float *in)
-{
-       NodeColorBalance *n= (NodeColorBalance *)node->storage;
-
-       out[0] = colorbalance_lgg(in[0], n->lift_lgg[0], n->gamma_inv[0], n->gain[0]);
-       out[1] = colorbalance_lgg(in[1], n->lift_lgg[1], n->gamma_inv[1], n->gain[1]);
-       out[2] = colorbalance_lgg(in[2], n->lift_lgg[2], n->gamma_inv[2], n->gain[2]);
-       out[3] = in[3];
-}
-
-static void do_colorbalance_lgg_fac(bNode *node, float* out, float *in, float *fac)
-{
-       NodeColorBalance *n= (NodeColorBalance *)node->storage;
-       const float mfac= 1.0f - *fac;
-
-       out[0] = mfac*in[0] + *fac * colorbalance_lgg(in[0], n->lift_lgg[0], n->gamma_inv[0], n->gain[0]);
-       out[1] = mfac*in[1] + *fac * colorbalance_lgg(in[1], n->lift_lgg[1], n->gamma_inv[1], n->gain[1]);
-       out[2] = mfac*in[2] + *fac * colorbalance_lgg(in[2], n->lift_lgg[2], n->gamma_inv[2], n->gain[2]);
-       out[3] = in[3];
-}
-
-static void node_composit_exec_colorbalance(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
-{
-       CompBuf *cbuf= in[1]->data;
-       CompBuf *stackbuf;
-       
-       /* stack order input:  fac, image */
-       /* stack order output: image */
-       if (out[0]->hasoutput==0) return;
-       
-       if (in[0]->vec[0] == 0.f && in[0]->data == NULL) {
-               out[0]->data = pass_on_compbuf(cbuf);
-               return;
-       }
-
-       {
-               NodeColorBalance *n= (NodeColorBalance *)node->storage;
-               int c;
-
-               for (c = 0; c < 3; c++) {
-                       n->lift_lgg[c] = 2.0f - n->lift[c];
-                       n->gamma_inv[c] = (n->gamma[c] != 0.0f) ? 1.0f/n->gamma[c] : 1000000.0f;
-               }
-       }
-
-       if (cbuf) {
-               stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* create output based on image input */
-                       
-               if (node->custom1 == 0) {
-                       /* lift gamma gain */
-                       if ((in[0]->data==NULL) && (in[0]->vec[0] >= 1.f)) {
-                               composit1_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, do_colorbalance_lgg, CB_RGBA);
-                       }
-                       else {
-                               composit2_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[0]->data, in[0]->vec, do_colorbalance_lgg_fac, CB_RGBA, CB_VAL);
-                       }
-               }
-               else {
-                       /* offset/power/slope : ASC-CDL */
-                       if ((in[0]->data==NULL) && (in[0]->vec[0] >= 1.f)) {
-                               composit1_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, do_colorbalance_cdl, CB_RGBA);
-                       }
-                       else {
-                               composit2_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[0]->data, in[0]->vec, do_colorbalance_cdl_fac, CB_RGBA, CB_VAL);
-                       }
-                       
-               }
-
-               out[0]->data=stackbuf;
-       }
-}
-
-#endif  /* WITH_COMPOSITOR_LEGACY */
-
 static void node_composit_init_colorbalance(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
 {
        NodeColorBalance *n= node->storage= MEM_callocN(sizeof(NodeColorBalance), "node colorbalance");
@@ -196,9 +64,6 @@ void register_node_type_cmp_colorbalance(bNodeTreeType *ttype)
        node_type_size(&ntype, 400, 200, 400);
        node_type_init(&ntype, node_composit_init_colorbalance);
        node_type_storage(&ntype, "NodeColorBalance", node_free_standard_storage, node_copy_standard_storage);
-#ifdef WITH_COMPOSITOR_LEGACY
-       node_type_exec(&ntype, node_composit_exec_colorbalance);
-#endif
 
        nodeRegisterType(ttype, &ntype);
 }
index 10b81cdaaa0153dd9586874c7918859e3cf5f6c1..4307232a41e9715bb1f784f57c52adbb4abe9988 100644 (file)
@@ -183,9 +183,6 @@ static void group_free_internal(bNodeTreeExec *gexec)
        for (i = 0, ns = gexec->stack; i < gexec->stacksize; ++i, ++ns) {
                if (!ns->external && !ns->is_copy) {
                        if (ns->data) {
-#ifdef WITH_COMPOSITOR_LEGACY
-                               free_compbuf(ns->data);
-#endif
                                ns->data = NULL;
                        }
                }
index cb932b6a8def45ba5fe6f438dc6c04125c5839a0..ca12b500e5bab32ab7dfed3d6558b975608c970c 100644 (file)
@@ -39,65 +39,6 @@ static bNodeSocketTemplate cmp_node_composite_in[] = {
        {       -1, 0, ""       }
 };
 
-#ifdef WITH_COMPOSITOR_LEGACY
-
-/* applies to render pipeline */
-static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out))
-{
-       /* image assigned to output */
-       /* stack order input sockets: col, alpha, z */
-       
-       if (node->flag & NODE_DO_OUTPUT) {      /* only one works on out */
-               Scene *scene= (Scene *)node->id;
-               RenderData *rd= data;
-               
-               if (scene && (rd->scemode & R_DOCOMP)) {
-                       Render *re= RE_GetRender(scene->id.name);
-                       RenderResult *rr= RE_AcquireResultWrite(re); 
-                       if (rr) {
-                               CompBuf *outbuf, *zbuf=NULL;
-                               
-                               if (rr->rectf) 
-                                       MEM_freeN(rr->rectf);
-                               outbuf= alloc_compbuf(rr->rectx, rr->recty, CB_RGBA, 1);
-                               
-                               if (in[1]->data==NULL)
-                                       composit1_pixel_processor(node, outbuf, in[0]->data, in[0]->vec, do_copy_rgba, CB_RGBA);
-                               else
-                                       composit2_pixel_processor(node, outbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, do_copy_a_rgba, CB_RGBA, CB_VAL);
-                               
-                               if (in[2]->data) {
-                                       if (rr->rectz) 
-                                               MEM_freeN(rr->rectz);
-                                       zbuf= alloc_compbuf(rr->rectx, rr->recty, CB_VAL, 1);
-                                       composit1_pixel_processor(node, zbuf, in[2]->data, in[2]->vec, do_copy_value, CB_VAL);
-                                       rr->rectz= zbuf->rect;
-                                       zbuf->malloc= 0;
-                                       free_compbuf(zbuf);
-                               }
-                               generate_preview(data, node, outbuf);
-                               
-                               /* we give outbuf to rr... */
-                               rr->rectf= outbuf->rect;
-                               outbuf->malloc= 0;
-                               free_compbuf(outbuf);
-
-                               /* signal for imageviewer to refresh (it converts to byte rects...) */
-                               BKE_image_signal(BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result"), NULL, IMA_SIGNAL_FREE);
-
-                               RE_ReleaseResult(re);
-                               return;
-                       }
-                       else
-                               RE_ReleaseResult(re);
-               }
-       }
-       if (in[0]->data)
-               generate_preview(data, node, in[0]->data);
-}
-
-#endif  /* WITH_COMPOSITOR_LEGACY */
-
 void register_node_type_cmp_composite(bNodeTreeType *ttype)
 {
        static bNodeType ntype;
@@ -105,9 +46,6 @@ void register_node_type_cmp_composite(bNodeTreeType *ttype)
        node_type_base(ttype, &ntype, CMP_NODE_COMPOSITE, "Composite", NODE_CLASS_OUTPUT, NODE_PREVIEW);
        node_type_socket_templates(&ntype, cmp_node_composite_in, NULL);
        node_type_size(&ntype, 80, 60, 200);
-#ifdef WITH_COMPOSITOR_LEGACY
-       node_type_exec(&ntype, node_composit_exec_composite);
-#endif
 
        /* Do not allow muting for this node. */
        node_type_internal_links(&ntype, NULL);
index ad51fae199891cfdde1d28b73d2a482001d27885..90d48a543ad5346f9f3408fc93f45e9082d705f3 100644 (file)
@@ -43,68 +43,6 @@ static bNodeSocketTemplate cmp_node_crop_out[] = {
        {       -1, 0, ""       }
 };
 
-#ifdef WITH_COMPOSITOR_LEGACY
-
-static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
-{
-       if (in[0]->data) {
-               NodeTwoXYs *ntxy= node->storage;
-               CompBuf *cbuf= in[0]->data;
-               CompBuf *stackbuf;
-               int x, y;
-               float *srcfp, *outfp;
-               rcti outputrect;
-
-               if (node->custom2) {
-                       ntxy->x1= cbuf->x* ntxy->fac_x1;
-                       ntxy->x2= cbuf->x* ntxy->fac_x2;
-                       ntxy->y1= cbuf->y* ntxy->fac_y1;
-                       ntxy->y2= cbuf->y* ntxy->fac_y2;
-               }
-
-               /* check input image size */
-               if (cbuf->x <= ntxy->x1 + 1)
-                       ntxy->x1= cbuf->x - 1;
-
-               if (cbuf->y <= ntxy->y1 + 1)
-                       ntxy->y1= cbuf->y - 1;
-
-               if (cbuf->x <= ntxy->x2 + 1)
-                       ntxy->x2= cbuf->x - 1;
-
-               if (cbuf->y <= ntxy->y2 + 1)
-                       ntxy->y2= cbuf->y - 1;
-
-               /* figure out the minimums and maximums */
-               outputrect.xmax=MAX2(ntxy->x1, ntxy->x2) + 1;
-               outputrect.xmin=MIN2(ntxy->x1, ntxy->x2);
-               outputrect.ymax=MAX2(ntxy->y1, ntxy->y2) + 1;
-               outputrect.ymin=MIN2(ntxy->y1, ntxy->y2);
-
-               if (node->custom1) {
-                       /* this option crops the image size too  */
-                       stackbuf= get_cropped_compbuf(&outputrect, cbuf->rect, cbuf->x, cbuf->y, cbuf->type);
-               }
-               else {
-                       /* this option won't crop the size of the image as well  */
-                       /* allocate memory for the output image            */
-                       stackbuf = alloc_compbuf(cbuf->x, cbuf->y, cbuf->type, 1);
-
-                       /* select the cropped part of the image and set it to the output */
-                       for (y=outputrect.ymin; y<outputrect.ymax; y++) {
-                               srcfp= cbuf->rect     + (y * cbuf->x     + outputrect.xmin) * cbuf->type;
-                               outfp= stackbuf->rect + (y * stackbuf->x + outputrect.xmin) * stackbuf->type;
-                               for (x=outputrect.xmin; x<outputrect.xmax; x++, outfp+= stackbuf->type, srcfp+= cbuf->type)
-                                                       memcpy(outfp, srcfp, sizeof(float)*stackbuf->type);
-                       }
-               }
-
-               out[0]->data= stackbuf;
-       }
-}
-
-#endif  /* WITH_COMPOSITOR_LEGACY */
-
 static void node_composit_init_crop(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
 {
        NodeTwoXYs *nxy= MEM_callocN(sizeof(NodeTwoXYs), "node xy data");
@@ -124,9 +62,6 @@ void register_node_type_cmp_crop(bNodeTreeType *ttype)
        node_type_size(&ntype, 140, 100, 320);
        node_type_init(&ntype, node_composit_init_crop);
        node_type_storage(&ntype, "NodeTwoXYs", node_free_standard_storage, node_copy_standard_storage);
-#ifdef WITH_COMPOSITOR_LEGACY
-       node_type_exec(&ntype, node_composit_exec_crop);
-#endif
 
        nodeRegisterType(ttype, &ntype);
 }
index a1999ec8887714f916563aec2e6bf90573d29c87..9f40159baf31388b822455aa64db8158de7354e3 100644 (file)
@@ -41,25 +41,6 @@ static bNodeSocketTemplate cmp_node_time_out[] = {
        {       -1, 0, ""       }
 };
 
-#ifdef WITH_COMPOSITOR_LEGACY
-
-static void node_composit_exec_curves_time(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
-{
-       RenderData *rd= data;
-       /* stack order output: fac */
-       float fac= 0.0f;
-       
-       if (node->custom1 < node->custom2)
-               fac= (rd->cfra - node->custom1)/(float)(node->custom2-node->custom1);
-       
-       curvemapping_initialize(node->storage);
-       fac = curvemapping_evaluateF(node->storage, 0, fac);
-
-       out[0]->vec[0] = CLAMPIS(fac, 0.0f, 1.0f);
-}
-
-#endif  /* WITH_COMPOSITOR_LEGACY */
-
 static void node_composit_init_curves_time(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
 {
        node->custom1= 1;
@@ -76,9 +57,6 @@ void register_node_type_cmp_curve_time(bNodeTreeType *ttype)
        node_type_size(&ntype, 140, 100, 320);
        node_type_init(&ntype, node_composit_init_curves_time);
        node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
-#ifdef WITH_COMPOSITOR_LEGACY
-       node_type_exec(&ntype, node_composit_exec_curves_time);
-#endif
 
        nodeRegisterType(ttype, &ntype);
 }
@@ -96,19 +74,6 @@ static bNodeSocketTemplate cmp_node_curve_vec_out[] = {
        {       -1, 0, ""       }
 };
 
-#ifdef WITH_COMPOSITOR_LEGACY
-
-static void node_composit_exec_curve_vec(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
-{
-       /* stack order input:  vec */
-       /* stack order output: vec */
-
-       curvemapping_initialize(node->storage);
-       curvemapping_evaluate_premulRGBF(node->storage, out[0]->vec, in[0]->vec);
-}
-
-#endif  /* WITH_COMPOSITOR_LEGACY */
-
 static void node_composit_init_curve_vec(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
 {
        node->storage= curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f);
@@ -123,9 +88,6 @@ void register_node_type_cmp_curve_vec(bNodeTreeType *ttype)
        node_type_size(&ntype, 200, 140, 320);
        node_type_init(&ntype, node_composit_init_curve_vec);
        node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
-#ifdef WITH_COMPOSITOR_LEGACY
-       node_type_exec(&ntype, node_composit_exec_curve_vec);
-#endif
 
        nodeRegisterType(ttype, &ntype);
 }
@@ -145,67 +107,6 @@ static bNodeSocketTemplate cmp_node_curve_rgb_out[] = {
        {       -1, 0, ""       }
 };
 
-#ifdef WITH_COMPOSITOR_LEGACY
-
-static void do_curves(bNode *node, float *out, float *in)
-{
-       curvemapping_initialize(node->storage);
-       curvemapping_evaluate_premulRGBF(node->storage, out, in);
-       out[3] = in[3];
-}
-
-static void do_curves_fac(bNode *node, float *out, float *in, float *fac)
-{
-       curvemapping_initialize(node->storage);
-
-       if (*fac >= 1.0f)
-               curvemapping_evaluate_premulRGBF(node->storage, out, in);
-       else if (*fac <= 0.0f) {
-               copy_v3_v3(out, in);
-       }
-       else {
-               float col[4], mfac= 1.0f-*fac;
-               curvemapping_evaluate_premulRGBF(node->storage, col, in);
-               out[0] = mfac*in[0] + *fac*col[0];
-               out[1] = mfac*in[1] + *fac*col[1];
-               out[2] = mfac*in[2] + *fac*col[2];
-       }
-       out[3] = in[3];
-}
-
-static void node_composit_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
-{
-       /* stack order input:  fac, image, black level, white level */
-       /* stack order output: image */
-       
-       if (out[0]->hasoutput==0)
-               return;
-
-       curvemapping_initialize(node->storage);
-
-       /* input no image? then only color operation */
-       if (in[1]->data==NULL) {
-               curvemapping_evaluateRGBF(node->storage, out[0]->vec, in[1]->vec);
-       }
-       else {
-               /* make output size of input image */
-               CompBuf *cbuf= in[1]->data;
-               CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* allocs */
-               
-               curvemapping_set_black_white(node->storage, in[2]->vec, in[3]->vec);
-               
-               if (in[0]->data==NULL && in[0]->vec[0] == 1.0f)
-                       composit1_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, do_curves, CB_RGBA);
-               else
-                       composit2_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[0]->data, in[0]->vec, do_curves_fac, CB_RGBA, CB_VAL);
-               
-               out[0]->data= stackbuf;
-       }
-       
-}
-
-#endif  /* WITH_COMPOSITOR_LEGACY */
-
 static void node_composit_init_curve_rgb(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
 {
        node->storage= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
@@ -220,9 +121,6 @@ void register_node_type_cmp_curve_rgb(bNodeTreeType *ttype)
        node_type_size(&ntype, 200, 140, 320);
        node_type_init(&ntype, node_composit_init_curve_rgb);
        node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
-#ifdef WITH_COMPOSITOR_LEGACY
-       node_type_exec(&ntype, node_composit_exec_curve_rgb);
-#endif
 
        nodeRegisterType(ttype, &ntype);
 }
index 27ce0f7c4a7cb57ebf4e4b17012eb6d4ec96a72e..88787cc869eb801176e75b112628b4a9ad945668 100644 (file)
@@ -44,830 +44,6 @@ static bNodeSocketTemplate cmp_node_defocus_out[] = {
        {       -1, 0, ""       }
 };
 
-#ifdef WITH_COMPOSITOR_LEGACY
-
-// line coefs for point sampling & scancon. data.
-typedef struct BokehCoeffs {
-       float x0, y0, dx, dy;
-       float ls_x, ls_y;
-       float min_x, min_y, max_x, max_y;
-} BokehCoeffs;
-
-// returns array of BokehCoeffs
-// returns length of array in 'len_bkh',
-// radius squared of inscribed disk in 'inradsq', needed in getWeight() test,
-// BKH[8] is the data returned for the bokeh shape & bkh_b[4] is it's 2d bound
-static void makeBokeh(char bktype, char ro, int* len_bkh, float* inradsq, BokehCoeffs BKH[8], float bkh_b[4])
-{
-       float x0, x1, y0, y1, dx, dy, iDxy;
-       /* ro now is in radians. */
-       float w = MAX2(1e-6f, ro);  // never reported stangely enough, but a zero offset causes missing center line...
-       float wi = DEG2RADF(360.f/bktype);
-       int i, ov, nv;
-       
-       // bktype must be at least 3 & <= 8
-       bktype = (bktype<3) ? 3 : ((bktype>8) ? 8 : bktype);
-       *len_bkh = bktype;
-       *inradsq = -1.f;
-
-       for (i=0; i<(*len_bkh); i++) {
-               x0 = cos(w);
-               y0 = sin(w);
-               w += wi;
-               x1 = cos(w);
-               y1 = sin(w);
-               if ((*inradsq)<0.f) {
-                       // radius squared of inscribed disk
-                       float idx=(x0+x1)*0.5f, idy=(y0+y1)*0.5f;
-                       *inradsq = idx*idx + idy*idy;
-               }
-               BKH[i].x0 = x0;
-               BKH[i].y0 = y0;
-               dx = x1-x0, dy = y1-y0;
-               iDxy = 1.f / sqrtf(dx*dx + dy*dy);
-               dx *= iDxy;
-               dy *= iDxy;
-               BKH[i].dx = dx;
-               BKH[i].dy = dy;
-       }
-
-       // precalc scanconversion data
-       // bokeh bound, not transformed, for scanconvert
-       bkh_b[0] = bkh_b[2] = 1e10f;    // xmin/ymin
-       bkh_b[1] = bkh_b[3] = -1e10f;   // xmax/ymax
-       ov = (*len_bkh) - 1;
-       for (nv=0; nv<(*len_bkh); nv++) {
-               bkh_b[0] = MIN2(bkh_b[0], BKH[nv].x0);  // xmin
-               bkh_b[1] = MAX2(bkh_b[1], BKH[nv].x0);  // xmax
-               bkh_b[2] = MIN2(bkh_b[2], BKH[nv].y0);  // ymin
-               bkh_b[3] = MAX2(bkh_b[3], BKH[nv].y0);  // ymax
-               BKH[nv].min_x = MIN2(BKH[ov].x0, BKH[nv].x0);
-               BKH[nv].max_x = MAX2(BKH[ov].x0, BKH[nv].x0);
-               BKH[nv].min_y = MIN2(BKH[ov].y0, BKH[nv].y0);
-               BKH[nv].max_y = MAX2(BKH[ov].y0, BKH[nv].y0);
-               dy = BKH[nv].y0 - BKH[ov].y0;
-               BKH[nv].ls_x = (BKH[nv].x0 - BKH[ov].x0) / ((dy==0.f) ? 1.f : dy);
-               BKH[nv].ls_y = (BKH[nv].ls_x==0.f) ? 1.f : (1.f/BKH[nv].ls_x);
-               ov = nv;
-       }
-}
-
-// test if u/v inside shape & returns weight value
-static float getWeight(BokehCoeffs* BKH, int len_bkh, float u, float v, float rad, float inradsq)
-{
-       BokehCoeffs* bc = BKH;
-       float cdist, irad = (rad==0.f) ? 1.f : (1.f/rad);
-       u *= irad;
-       v *= irad;
-       // early out test1: if point outside outer unit disk, it cannot be inside shape
-       cdist = u*u + v*v;
-       if (cdist>1.f) return 0.f;
-       
-       // early out test2: if point inside or on inner disk, point must be inside shape
-       if (cdist<=inradsq) return 1.f;
-       
-       while (len_bkh--) {
-               if ((bc->dy*(u - bc->x0) - bc->dx*(v - bc->y0)) > 0.f) return 0.f;
-               bc++;
-       }
-       return 1.f;
-}
-
-// QMC.seq. for sampling, A.Keller, EMS
-static float RI_vdC(unsigned int bits, unsigned int r)
-{
-       bits = ( bits << 16) | ( bits >> 16);
-       bits = ((bits & 0x00ff00ff) << 8) | ((bits & 0xff00ff00) >> 8);
-       bits = ((bits & 0x0f0f0f0f) << 4) | ((bits & 0xf0f0f0f0) >> 4);
-       bits = ((bits & 0x33333333) << 2) | ((bits & 0xcccccccc) >> 2);
-       bits = ((bits & 0x55555555) << 1) | ((bits & 0xaaaaaaaa) >> 1);
-       bits ^= r;
-       return (float)((double)bits / 4294967296.0);
-}
-
-// single channel IIR gaussian filtering
-// much faster than anything else, constant time independent of width
-// should extend to multichannel and make this a node, could be useful
-// note: this is an almost exact copy of 'IIR_gauss'
-static void IIR_gauss_single(CompBuf *buf, float sigma)
-{
-       double q, q2, sc, cf[4], tsM[9], tsu[3], tsv[3];
-       float *X, *Y, *W;
-       const unsigned int src_width = buf->x;
-       const unsigned int src_height = buf->y;
-       unsigned int i, x, y, sz;
-
-       // single channel only for now
-       if (buf->type != CB_VAL) return;
-
-       // <0.5 not valid, though can have a possibly useful sort of sharpening effect
-       if (sigma < 0.5f) return;
-       
-       // see "Recursive Gabor Filtering" by Young/VanVliet
-       // all factors here in double.prec. Required, because for single.prec it seems to blow up if sigma > ~200
-       if (sigma >= 3.556f)
-               q = 0.9804f * (sigma - 3.556f) + 2.5091f;
-       else // sigma >= 0.5
-               q = (0.0561f * sigma + 0.5784f) * sigma - 0.2568f;
-       q2 = q * q;
-       sc = (1.1668 + q) * (3.203729649  + (2.21566 + q) * q);
-       // no gabor filtering here, so no complex multiplies, just the regular coefs.
-       // all negated here, so as not to have to recalc Triggs/Sdika matrix
-       cf[1] = q * (5.788961737 + (6.76492 + 3.0 * q) * q) / sc;
-       cf[2] = -q2 * (3.38246 + 3.0 * q) / sc;
-       // 0 & 3 unchanged
-       cf[3] = q2 * q / sc;
-       cf[0] = 1.0 - cf[1] - cf[2] - cf[3];
-
-       // Triggs/Sdika border corrections,
-       // it seems to work, not entirely sure if it is actually totally correct,
-       // Besides J.M.Geusebroek's anigauss.c (see http://www.science.uva.nl/~mark),
-       // found one other implementation by Cristoph Lampert,
-       // but neither seem to be quite the same, result seems to be ok so far anyway.
-       // Extra scale factor here to not have to do it in filter,
-       // though maybe this had something to with the precision errors
-       sc = cf[0] / ((1.0 + cf[1] - cf[2] + cf[3]) * (1.0 - cf[1] - cf[2] - cf[3]) * (1.0 + cf[2] + (cf[1] - cf[3]) * cf[3]));
-       tsM[0] = sc * (-cf[3] * cf[1] + 1.0 - cf[3] * cf[3] - cf[2]);
-       tsM[1] = sc * ((cf[3] + cf[1]) * (cf[2] + cf[3] * cf[1]));
-       tsM[2] = sc * (cf[3] * (cf[1] + cf[3] * cf[2]));
-       tsM[3] = sc * (cf[1] + cf[3] * cf[2]);
-       tsM[4] = sc * (-(cf[2] - 1.0) * (cf[2] + cf[3] * cf[1]));
-       tsM[5] = sc * (-(cf[3] * cf[1] + cf[3] * cf[3] + cf[2] - 1.0) * cf[3]);
-       tsM[6] = sc * (cf[3] * cf[1] + cf[2] + cf[1] * cf[1] - cf[2] * cf[2]);
-       tsM[7] = sc * (cf[1] * cf[2] + cf[3] * cf[2] * cf[2] - cf[1] * cf[3] * cf[3] - cf[3] * cf[3] * cf[3] - cf[3] * cf[2] + cf[3]);
-       tsM[8] = sc * (cf[3] * (cf[1] + cf[3] * cf[2]));
-
-#define YVV(L)                                                                          \
-{                                                                                       \
-       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]; \
-       /* 'i != UINT_MAX' is really 'i >= 0', but necessary for unsigned int wrapping */   \
-       for (i = L - 4; i != UINT_MAX; i--) {                                               \
-               Y[i] = cf[0] * W[i] + cf[1] * Y[i + 1] + cf[2] * Y[i + 2] + cf[3] * Y[i + 3];   \
-       }                                                                                   \
-} (void)0
-
-       // intermediate buffers
-       sz = MAX2(src_width, src_height);
-       Y = MEM_callocN(sz * sizeof(float), "IIR_gauss Y buf");
-       W = MEM_callocN(sz * sizeof(float), "IIR_gauss W buf");
-       // H
-       for (y = 0; y < src_height; y++) {
-               X = &buf->rect[y * src_width];
-               YVV(src_width);
-               memcpy(X, Y, sizeof(float) * src_width);
-       }
-       // V
-       X = MEM_callocN(src_height * sizeof(float), "IIR_gauss X buf");
-       for (x = 0; x < src_width; x++) {
-               for (y = 0; y < src_height; y++)
-                       X[y] = buf->rect[x + y * src_width];
-               YVV(src_height);
-               for (y = 0; y < src_height; y++)
-                       buf->rect[x + y * src_width] = Y[y];
-       }
-       MEM_freeN(X);
-
-       MEM_freeN(W);
-       MEM_freeN(Y);
-#undef YVV
-}
-
-static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, float inpval, int no_zbuf)
-{
-       NodeDefocus *nqd = node->storage;
-       CompBuf *wts;           // weights buffer
-       CompBuf *crad;          // CoC radius buffer
-       BokehCoeffs BKH[8];     // bokeh shape data, here never > 8 pts.
-       float bkh_b[4] = {0};   // shape 2D bound
-       float cam_fdist=1, cam_invfdist=1, cam_lens=35;
-       float cam_sensor = DEFAULT_SENSOR_WIDTH;
-       float dof_sp, maxfgc, bk_hn_theta=0, inradsq=0;
-       int y, len_bkh=0, ydone = FALSE;
-       float aspect, aperture;
-       int minsz;
-       //float bcrad, nmaxc, scf;
-       
-       // get some required params from the current scene camera
-       // (ton) this is wrong, needs fixed
-       Scene *scene= (Scene*)node->id;
-       Object* camob = (scene)? scene->camera: NULL;
-       if (camob && camob->type==OB_CAMERA) {
-               Camera* cam = (Camera*)camob->data;
-               cam_lens = cam->lens;
-               cam_fdist = BKE_camera_object_dof_distance(camob);
-               cam_sensor = BKE_camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y);
-               if (cam_fdist == 0.0f) cam_fdist = 1e10f; /* if the dof is 0.0 then set it be be far away */
-               cam_invfdist = 1.f / cam_fdist;
-       }
-       // guess work here.. best match with raytraced result
-       minsz = MIN2(img->x, img->y);
-       dof_sp = (float)minsz / ((cam_sensor / 2.0f) / cam_lens);       // <- == aspect * MIN2(img->x, img->y) / tan(0.5f * fov);
-       
-       // aperture
-       aspect = (img->x > img->y) ? (img->y / (float)img->x) : (img->x / (float)img->y);
-       aperture = 0.5f * (cam_lens / (aspect * cam_sensor)) / nqd->fstop;
-       
-       // if not disk, make bokeh coefficients and other needed data
-       if (nqd->bktype!=0) {
-               makeBokeh(nqd->bktype, nqd->rotation, &len_bkh, &inradsq, BKH, bkh_b);
-               bk_hn_theta = 0.5 * nqd->bktype * sin(2.0 * M_PI / nqd->bktype);        // weight factor
-       }
-       
-       // accumulated weights
-       wts = alloc_compbuf(img->x, img->y, CB_VAL, 1);
-       // CoC radius buffer
-       crad = alloc_compbuf(img->x, img->y, CB_VAL, 1);
-
-       // if 'no_zbuf' flag set (which is always set if input is not an image),
-       // values are instead interpreted directly as blur radius values
-       if (no_zbuf) {
-               // to prevent *reaaallly* big radius values and impossible calculation times,
-               // limit the maximum to half the image width or height, whichever is smaller
-               float maxr = 0.5f*(float)MIN2(img->x, img->y);
-               unsigned int p;
-
-               for (p=0; p<(unsigned int)(img->x*img->y); p++) {
-                       crad->rect[p] = zbuf ? (zbuf->rect[p]*nqd->scale) : inpval;
-                       // bug #5921, limit minimum
-                       crad->rect[p] = MAX2(1e-5f, crad->rect[p]);
-                       crad->rect[p] = MIN2(crad->rect[p], maxr);
-                       // if maxblur!=0, limit maximum
-                       if (nqd->maxblur != 0.f) crad->rect[p] = MIN2(crad->rect[p], nqd->maxblur);
-               }
-       }
-       else {
-               float wt;
-
-               // actual zbuffer.
-               // separate foreground from background CoC's
-               // then blur background and blend in again with foreground,
-               // improves the 'blurred foreground overlapping in-focus midground' sharp boundary problem.
-               // wts buffer here used for blendmask
-               maxfgc = 0.f; // maximum foreground CoC radius
-               for (y=0; y<img->y; y++) {
-                       unsigned int p = y * img->x;
-                       int x;
-                       for (x=0; x<img->x; x++) {
-                               unsigned int px = p + x;
-                               float iZ = (zbuf->rect[px]==0.f) ? 0.f : (1.f/zbuf->rect[px]);
-                               crad->rect[px] = 0.5f*(aperture*(dof_sp*(cam_invfdist - iZ) - 1.f));
-                               if (crad->rect[px] <= 0.f) {
-                                       wts->rect[px] = 1.f;
-                                       crad->rect[px] = -crad->rect[px];
-                                       if (crad->rect[px] > maxfgc) maxfgc = crad->rect[px];
-                               }
-                               else crad->rect[px] = wts->rect[px] = 0;
-                       }
-               }
-               
-               // fast blur...
-               // bug #6656 part 1, probably when previous node_composite.c was split into separate files, it was not properly updated
-               // to include recent cvs commits (well, at least not defocus node), so this part was missing...
-               wt = min_ff(nqd->maxblur, aperture * 128.0f);
-               IIR_gauss_single(crad, wt);
-               IIR_gauss_single(wts, wt);
-               
-               // bug #6656 part 2a, although foreground blur is not based anymore on closest object,
-               // the rescaling op below was still based on that anyway, and unlike the comment in below code,
-               // the difference is therefore not always that small at all...
-               // so for now commented out, not sure if this is going to cause other future problems, lets just wait and see...
-               /*
-               // find new maximum to scale it back to original
-               // (could skip this, not strictly necessary, in general, difference is quite small, but just in case...)
-               nmaxc = 0;
-               for (p=0; p<(img->x*img->y); p++)
-                       if (crad->rect[p] > nmaxc) nmaxc = crad->rect[p];
-               // rescale factor
-               scf = (nmaxc==0.f) ? 1.f: (maxfgc / nmaxc);
-               */
-
-               // and blend...
-               for (y=0; y<img->y; y++) {
-                       unsigned int p = y*img->x;
-                       int x;
-
-                       for (x=0; x<img->x; x++) {
-                               unsigned px = p + x;
-                               if (zbuf->rect[px]!=0.f) {
-                                       float iZ = (zbuf->rect[px]==0.f) ? 0.f : (1.f/zbuf->rect[px]);
-                                       
-                                       // bug #6656 part 2b, do not rescale
-                                       /*
-                                       bcrad = 0.5f*fabs(aperture*(dof_sp*(cam_invfdist - iZ) - 1.f));
-                                       // scale crad back to original maximum and blend
-                                       crad->rect[px] = bcrad + wts->rect[px]*(scf*crad->rect[px] - bcrad);
-                                       */
-                                       crad->rect[px] = 0.5f*fabsf(aperture*(dof_sp*(cam_invfdist - iZ) - 1.f));
-                                       
-                                       // 'bug' #6615, limit minimum radius to 1 pixel, not really a solution, but somewhat mitigates the problem
-                                       crad->rect[px] = MAX2(crad->rect[px], 0.5f);
-                                       // if maxblur!=0, limit maximum
-                                       if (nqd->maxblur != 0.f) crad->rect[px] = MIN2(crad->rect[px], nqd->maxblur);
-                               }
-                               else crad->rect[px] = 0.f;
-                               // clear weights for next part
-                               wts->rect[px] = 0.f;
-                       }
-                       // esc set by main calling process
-                       if (node->exec & NODE_BREAK)
-                               break;
-               }
-       }
-
-       //------------------------------------------------------------------
-       // main loop
-#ifndef __APPLE__ /* can crash on Mac, see bug #22856, disabled for now */
-#ifdef __INTEL_COMPILER /* icc doesn't like the compound statement -- internal error: 0_1506 */
-       #pragma omp parallel for private(y) if (!nqd->preview) schedule(guided)
-#else
-       #pragma omp parallel for private(y) if (!nqd->preview && img->y*img->x > 16384) schedule(guided)
-#endif
-#endif
-       for (y=0; y<img->y; y++) {
-               unsigned int p, p4, zp, cp, cp4;
-               float *ctcol, u, v, ct_crad, cR2=0;
-               int x, sx, sy;
-
-               // some sort of visual feedback would be nice, or at least this text in the renderwin header
-               // but for now just print some info in the console every 8 scanlines.
-               #pragma omp critical
-               {
-                       if (((ydone & 7)==0) || (ydone==(img->y-1))) {
-                               if (G.background==0) {
-                                       printf("\rdefocus: Processing Line %d of %d ... ", ydone+1, img->y);
-                                       fflush(stdout);
-                               }
-                       }
-
-                       ydone++;
-               }
-
-               // esc set by main calling process. don't break because openmp doesn't
-               // allow it, just continue and do nothing 
-               if (node->exec & NODE_BREAK)
-                       continue;
-
-               zp = y * img->x;
-               for (x=0; x<img->x; x++) {
-                       cp = zp + x;
-                       cp4 = cp * img->type;
-
-                       // Circle of Confusion radius for current pixel
-                       cR2 = ct_crad = crad->rect[cp];
-                       // skip if zero (border render)
-                       if (ct_crad==0.f) {
-                               // related to bug #5921, forgot output image when skipping 0 radius values
-                               new->rect[cp4] = img->rect[cp4];
-                               if (new->type != CB_VAL) {
-                                       new->rect[cp4+1] = img->rect[cp4+1];
-                                       new->rect[cp4+2] = img->rect[cp4+2];
-                                       new->rect[cp4+3] = img->rect[cp4+3];
-                               }
-                               continue;
-                       }
-                       cR2 *= cR2;
-                       
-                       // pixel color
-                       ctcol = &img->rect[cp4];
-                       
-                       if (!nqd->preview) {
-                               int xs, xe, ys, ye;
-                               float lwt, wtcol[4] = {0}, aacol[4] = {0};
-                               float wt;
-
-                               // shape weight
-                               if (nqd->bktype==0)     // disk
-                                       wt = 1.f/((float)M_PI*cR2);
-                               else
-                                       wt = 1.f/(cR2*bk_hn_theta);
-
-                               // weighted color
-                               wtcol[0] = wt*ctcol[0];
-                               if (new->type != CB_VAL) {
-                                       wtcol[1] = wt*ctcol[1];
-                                       wtcol[2] = wt*ctcol[2];
-                                       wtcol[3] = wt*ctcol[3];
-                               }
-
-                               // macro for background blur overlap test
-                               // unfortunately, since this is done per pixel,
-                               // it has a very significant negative impact on processing time...
-                               // (eg. aa disk blur without test: 112 sec, vs with test: 176 sec...)
-                               // iff center blur radius > threshold
-                               // and if overlap pixel in focus, do nothing, else add color/weigbt
-                               // (threshold constant is dependent on amount of blur)
-                               #define TESTBG1(c, w) {\
-                                       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;\
-                                       }\
-                               }
-                               #define TESTBG4(c, w) {\
-                                       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;\
-                                       }\
-                               }
-                               if (nqd->bktype == 0) {
-                                       // Disk
-                                       int _x, i, j, di;
-                                       float Dj, T;
-                                       // AA pixel
-                                       #define AAPIX(a, b) {\
-                                               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);\
-                                                               }\
-                                                       }\
-                                               }\
-                                       }
-                                       // circle scanline
-                                       #define CSCAN(a, b) {\
-                                               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);\
-                                                       }\
-                                               }\
-                                       }
-
-                                       i = ceil(ct_crad);
-                                       j = 0;
-                                       T = 0;
-                                       while (i > j) {
-                                               Dj = sqrt(cR2 - j*j);
-                                               Dj -= floorf(Dj);
-                                               di = 0;
-                                               if (Dj > T) { i--;  di = 1; }
-                                               T = Dj;
-                                               aacol[0] = wtcol[0]*Dj;
-                                               if (new->type != CB_VAL) {
-                                                       aacol[1] = wtcol[1]*Dj;
-                                                       aacol[2] = wtcol[2]*Dj;
-                                                       aacol[3] = wtcol[3]*Dj;
-                                               }
-                                               lwt = wt*Dj;
-                                               if (i!=j) {
-                                                       // outer pixels
-                                                       AAPIX(x+j, y+i)
-                                                       AAPIX(x+j, y-i)
-                                                       if (j) {
-                                                               AAPIX(x-j, y+i) // BL
-                                                               AAPIX(x-j, y-i) // TL
-                                                       }
-                                                       if (di) { // only when i changed, interior of outer section
-                                                               CSCAN(j, i) // bottom
-                                                               CSCAN(j, -i) // top
-                                                       }
-                                               }
-                                               // lower mid section
-                                               AAPIX(x+i, y+j)
-                                               if (i) AAPIX(x-i, y+j)
-                                               CSCAN(i, j)
-                                               // upper mid section
-                                               if (j) {
-                                                       AAPIX(x+i, y-j)
-                                                       if (i) AAPIX(x-i, y-j)
-                                                       CSCAN(i, -j)
-                                               }
-                                               j++;
-                                       }
-                                       #undef CSCAN
-                                       #undef AAPIX
-                               }
-                               else {
-                                       // n-agonal
-                                       int ov, nv;
-                                       float mind, maxd, lwt;
-                                       ys = max_ii((int)floor(bkh_b[2] * ct_crad + y), 0);
-                                       ye = min_ii((int)ceil(bkh_b[3] * ct_crad + y), new->y - 1);
-                                       for (sy=ys; sy<=ye; sy++) {
-                                               float fxs = 1e10f, fxe = -1e10f;
-                                               float yf = (sy - y)/ct_crad;
-                                               int found = 0;
-                                               ov = len_bkh - 1;
-                                               mind = maxd = 0;
-                                               for (nv=0; nv<len_bkh; nv++) {
-                                                       if ((BKH[nv].max_y >= yf) && (BKH[nv].min_y <= yf)) {
-                                                               float tx = BKH[ov].x0 + BKH[nv].ls_x*(yf - BKH[ov].y0);
-                                                               if (tx < fxs) { fxs = tx;  mind = BKH[nv].ls_x; }
-                                                               if (tx > fxe) { fxe = tx;  maxd = BKH[nv].ls_x; }
-                                                               if (++found == 2) break;
-                                                       }
-                                                       ov = nv;
-                                               }
-                                               if (found) {
-                                                       fxs = fxs*ct_crad + x;
-                                                       fxe = fxe*ct_crad + x;
-                                                       xs = (int)floor(fxs), xe = (int)ceil(fxe);
-                                                       // AA hack for first and last x pixel, near vertical edges only
-                                                       if (fabsf(mind) <= 1.f) {
-                                                               if ((xs >= 0) && (xs < new->x)) {
-                                                                       lwt = 1.f-(fxs - xs);
-                                                                       aacol[0] = wtcol[0]*lwt;
-                                                                       p = xs + sy*new->x;
-                                                                       if (new->type==CB_VAL) {
-                                                                               lwt *= wt;
-                                                                               TESTBG1(aacol, lwt);
-                                                                       }
-                                                                       else {
-                                                                               p4 = p * new->type;
-                                                                               aacol[1] = wtcol[1]*lwt;
-                                                                               aacol[2] = wtcol[2]*lwt;
-                                                                               aacol[3] = wtcol[3]*lwt;
-                                                                               lwt *= wt;
-                                                                               TESTBG4(aacol, lwt);
-                                                                       }
-                                                               }
-                                                       }
-                                                       if (fabsf(maxd) <= 1.f) {
-                                                               if ((xe >= 0) && (xe < new->x)) {
-                                                                       lwt = 1.f-(xe - fxe);
-                                                                       aacol[0] = wtcol[0]*lwt;
-                                                                       p = xe + sy*new->x;
-                                                                       if (new->type==CB_VAL) {
-                                                                               lwt *= wt;
-                                                                               TESTBG1(aacol, lwt);
-                                                                       }
-                                                                       else {
-                                                                               p4 = p * new->type;
-                                                                               aacol[1] = wtcol[1]*lwt;
-                                                                               aacol[2] = wtcol[2]*lwt;
-                                                                               aacol[3] = wtcol[3]*lwt;
-                                                                               lwt *= wt;
-                                                                               TESTBG4(aacol, lwt);
-                                                                       }
-                                                               }
-                                                       }
-                                                       xs = MAX2(xs+1, 0);
-                                                       xe = MIN2(xe, new->x);
-                                                       // remaining interior scanline
-                                                       p = sy*new->x + xs;
-                                                       if (new->type==CB_VAL) {
-                                                               for (sx=xs; sx<xe; sx++, p++) TESTBG1(wtcol, wt);
-                                                       }
-                                                       else {
-                                                               p4 = p * new->type;
-                                                               for (sx=xs; sx<xe; sx++, p++, p4+=new->type) TESTBG4(wtcol, wt);
-                                                       }
-                                               }
-                                       }
-
-                                       // now traverse in opposite direction, y scanlines,
-                                       // but this time only draw the near horizontal edges,
-                                       // applying same AA hack as above
-                                       xs = MAX2((int)floor(bkh_b[0]*ct_crad + x), 0);
-                                       xe = MIN2((int)ceil(bkh_b[1]*ct_crad + x), img->x - 1);
-                                       for (sx=xs; sx<=xe; sx++) {
-                                               float xf = (sx - x)/ct_crad;
-                                               float fys = 1e10f, fye = -1e10f;
-                                               int found = 0;
-                                               ov = len_bkh - 1;
-                                               mind = maxd = 0;
-                                               for (nv=0; nv<len_bkh; nv++) {
-                                                       if ((BKH[nv].max_x >= xf) && (BKH[nv].min_x <= xf)) {
-                                                               float ty = BKH[ov].y0 + BKH[nv].ls_y*(xf - BKH[ov].x0);
-                                                               if (ty < fys) { fys = ty;  mind = BKH[nv].ls_y; }
-                                                               if (ty > fye) { fye = ty;  maxd = BKH[nv].ls_y; }
-                                                               if (++found == 2) break;
-                                                       }
-                                                       ov = nv;
-                                               }
-                                               if (found) {
-                                                       fys = fys*ct_crad + y;
-                                                       fye = fye*ct_crad + y;
-                                                       // near horizontal edges only, line slope <= 1
-                                                       if (fabsf(mind) <= 1.f) {
-                                                               int iys = (int)floor(fys);
-                                                               if ((iys >= 0) && (iys < new->y)) {
-                                                                       lwt = 1.f - (fys - iys);
-                                                                       aacol[0] = wtcol[0]*lwt;
-                                                                       p = sx + iys*new->x;
-                                                                       if (new->type==CB_VAL) {
-                                                                               lwt *= wt;
-                                                                               TESTBG1(aacol, lwt);
-                                                                       }
-                                                                       else {
-                                                                               p4 = p * new->type;
-                                                                               aacol[1] = wtcol[1]*lwt;
-                                                                               aacol[2] = wtcol[2]*lwt;
-                                                                               aacol[3] = wtcol[3]*lwt;
-                                                                               lwt *= wt;
-                                                                               TESTBG4(aacol, lwt);
-                                                                       }
-                                                               }
-                                                       }
-                                                       if (fabsf(maxd) <= 1.f) {
-                                                               int iye = ceil(fye);
-                                                               if ((iye >= 0) && (iye < new->y)) {
-                                                                       lwt = 1.f - (iye - fye);
-                                                                       aacol[0] = wtcol[0]*lwt;
-                                                                       p = sx + iye*new->x;
-                                                                       if (new->type==CB_VAL) {
-                                                                               lwt *= wt;
-                                                                               TESTBG1(aacol, lwt);
-                                                                       }
-                                                                       else {
-                                                                               p4 = p * new->type;
-                                                                               aacol[1] = wtcol[1]*lwt;
-                                                                               aacol[2] = wtcol[2]*lwt;
-                                                                               aacol[3] = wtcol[3]*lwt;
-                                                                               lwt *= wt;
-                                                                               TESTBG4(aacol, lwt);
-                                                                       }
-                                                               }
-                                                       }
-                                               }
-                                       }
-
-                               }
-                               #undef TESTBG4
-                               #undef TESTBG1
-
-                       }
-                       else {
-                               // sampled, simple rejection sampling here, good enough
-                               unsigned int maxsam, s, ui = BLI_rand()*BLI_rand();
-                               float wcor, cpr = BLI_frand(), lwt;
-                               if (no_zbuf)
-                                       maxsam = nqd->samples;  // no zbuffer input, use sample value directly
-                               else {
-                                       // depth adaptive sampling hack, the more out of focus, the more samples taken, 16 minimum.
-                                       maxsam = (int)(0.5f + nqd->samples*(1.f-(float)exp(-fabs(zbuf->rect[cp] - cam_fdist))));
-                                       if (maxsam < 16) maxsam = 16;
-                               }
-                               wcor = 1.f/(float)maxsam;
-                               for (s=0; s<maxsam; ++s) {
-                                       u = ct_crad*(2.f*RI_vdC(s, ui) - 1.f);
-                                       v = ct_crad*(2.f*(s + cpr)/(float)maxsam - 1.f);
-                                       sx = (int)(x + u + 0.5f), sy = (int)(y + v + 0.5f);
-                                       if ((sx<0) || (sx >= new->x) || (sy<0) || (sy >= new->y)) continue;
-                                       p = sx + sy*new->x;
-                                       p4 = p * new->type;
-                                       if (nqd->bktype==0)     // Disk
-                                               lwt = ((u*u + v*v)<=cR2) ? wcor : 0.f;
-                                       else  /* AA not needed here */
-                                               lwt = wcor * getWeight(BKH, len_bkh, u, v, ct_crad, inradsq);
-                                       // prevent background bleeding onto in-focus pixels, user-option
-                                       if (ct_crad > nqd->bthresh) {  // if center blur > threshold
-                                               if (crad->rect[p] > nqd->bthresh) { // if overlap pixel in focus, do nothing, else add color/weigbt
-                                                       new->rect[p4] += ctcol[0] * lwt;
-                                                       if (new->type != CB_VAL) {
-                                                               new->rect[p4+1] += ctcol[1] * lwt;
-                                                               new->rect[p4+2] += ctcol[2] * lwt;
-                                                               new->rect[p4+3] += ctcol[3] * lwt;
-                                                       }
-                                                       wts->rect[p] += lwt;
-                                               }
-                                       }
-                                       else {
-                                               new->rect[p4] += ctcol[0] * lwt;
-                                               if (new->type != CB_VAL) {
-                                                       new->rect[p4+1] += ctcol[1] * lwt;
-                                                       new->rect[p4+2] += ctcol[2] * lwt;
-                                                       new->rect[p4+3] += ctcol[3] * lwt;
-                                               }
-                                               wts->rect[p] += lwt;
-                                       }
-                               }
-                       }
-
-               }
-       }
-       
-       // finally, normalize
-       for (y=0; y<new->y; y++) {
-               unsigned int p = y * new->x;
-               unsigned int p4 = p * new->type;
-               int x;
-
-               for (x=0; x<new->x; x++) {
-                       float dv = (wts->rect[p]==0.f) ? 1.f : (1.f/wts->rect[p]);
-                       new->rect[p4] *= dv;
-                       if (new->type!=CB_VAL) {
-                               new->rect[p4+1] *= dv;
-                               new->rect[p4+2] *= dv;
-                               new->rect[p4+3] *= dv;
-                       }
-                       p++;
-                       p4 += new->type;
-               }
-       }
-
-       free_compbuf(crad);
-       free_compbuf(wts);
-       
-       printf("Done\n");
-}
-
-
-static void node_composit_exec_defocus(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
-{
-       CompBuf *new, *old, *zbuf_use = NULL, *img = in[0]->data, *zbuf = in[1]->data;
-       NodeDefocus *nqd = node->storage;
-       int no_zbuf = nqd->no_zbuf;
-       
-       if ((img==NULL) || (out[0]->hasoutput==0)) return;
-       
-       // if image not valid type or fstop==infinite (128), nothing to do, pass in to out
-       if (((img->type!=CB_RGBA) && (img->type!=CB_VAL)) || ((no_zbuf==0) && (nqd->fstop==128.f))) {
-               out[0]->data = pass_on_compbuf(img);
-               return;
-       }
-       
-       if (zbuf!=NULL) {
-               // Zbuf input, check to make sure, single channel, same size
-               // doesn't have to be actual zbuffer, but must be value type
-               if ((zbuf->x != img->x) || (zbuf->y != img->y)) {
-                       // could do a scale here instead...
-                       printf("Z input must be same size as image !\n");
-                       return;
-               }
-               zbuf_use = typecheck_compbuf(zbuf, CB_VAL);
-       }
-       else no_zbuf = 1;       // no zbuffer input
-               
-       // ok, process
-       old = img;
-       if (nqd->gamco) {
-               // gamma correct, blender func is simplified, fixed value & RGBA only,
-               // should make user param. also depremul and premul afterwards, gamma
-               // correction can't work with premul alpha
-               old = dupalloc_compbuf(img);
-               premul_compbuf(old, 1);
-               gamma_correct_compbuf(old, 0);
-               premul_compbuf(old, 0);
-       }
-       
-       new = alloc_compbuf(old->x, old->y, old->type, 1);
-       defocus_blur(node, new, old, zbuf_use, in[1]->vec[0]*nqd->scale, no_zbuf);
-       
-       if (nqd->gamco) {
-               premul_compbuf(new, 1);
-               gamma_correct_compbuf(new, 1);
-               premul_compbuf(new, 0);
-               free_compbuf(old);
-       }
-       if (node->exec & NODE_BREAK) {
-               free_compbuf(new);
-               new= NULL;
-       }
-       out[0]->data = new;
-       if (zbuf_use && (zbuf_use != zbuf)) free_compbuf(zbuf_use);
-}
-
-#endif  /* WITH_COMPOSITOR_LEGACY */
-
 static void node_composit_init_defocus(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
 {
        /* qdn: defocus node */
@@ -894,9 +70,6 @@ void register_node_type_cmp_defocus(bNodeTreeType *ttype)
        node_type_size(&ntype, 150, 120, 200);
        node_type_init(&ntype, node_composit_init_defocus);
        node_type_storage(&ntype, "NodeDefocus", node_free_standard_storage, node_copy_standard_storage);
-#ifdef WITH_COMPOSITOR_LEGACY
-       node_type_exec(&ntype, node_composit_exec_defocus);
-#endif
 
        nodeRegisterType(ttype, &ntype);
 }
index 9d47e4bc276cff9b2cc68810f92be7799d477626..8fc97ef6a86395829cc6994057bfd51f8129bf39 100644 (file)
@@ -42,15 +42,6 @@ static bNodeSocketTemplate cmp_node_despeckle_out[] = {
        {       -1, 0, ""       }
 };
 
-#ifdef WITH_COMPOSITOR_LEGACY
-
-static void node_composit_exec_despeckle(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
-{
-       /* pass */
-}
-
-#endif  /* WITH_COMPOSITOR_LEGACY */
-
 static void node_composit_init_despeckle(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
 {
        node->custom3 = 0.5f;
@@ -65,9 +56,6 @@ void register_node_type_cmp_despeckle(bNodeTreeType *ttype)
        node_type_socket_templates(&ntype, cmp_node_despeckle_in, cmp_node_despeckle_out);
        node_type_size(&ntype, 80, 40, 120);
        node_type_init(&ntype, node_composit_init_despeckle);
-#ifdef WITH_COMPOSITOR_LEGACY
-       node_type_exec(&ntype, node_composit_exec_despeckle);
-#endif
 
        nodeRegisterType(ttype, &ntype);
 }
index 014b72d3c608df37f466aec984e5f78ab0408537..bcfd9dd768b945d86dd59cc7b61e51261a451e85 100644 (file)
@@ -45,91 +45,6 @@ static bNodeSocketTemplate cmp_node_diff_matte_out[] = {
        {-1, 0, ""}
 };
 
-#ifdef WITH_COMPOSITOR_LEGACY
-
-static void do_diff_matte(bNode *node, float *outColor, float *inColor1, float *inColor2)
-{
-       NodeChroma *c= (NodeChroma *)node->storage;
-       float tolerance=c->t1;
-       float fper=c->t2;
-       /* get falloff amount over tolerance size */
-       float falloff=(1.0f-fper) * tolerance;
-       float difference;
-       float alpha;
-       float maxInputAlpha;
-
-       /* average together the distances */
-       difference= fabs(inColor2[0]-inColor1[0]) +
-               fabs(inColor2[1]-inColor1[1]) +
-               fabs(inColor2[2]-inColor1[2]);
-       difference=difference/3.0f;
-
-       copy_v3_v3(outColor, inColor1);
-
-       if (difference <= tolerance) {
-               if (difference <= falloff) {
-                       alpha = 0.0f;
-               }
-               else {
-                       /* alpha as percent (distance / tolerance), each modified by falloff amount (in pixels)*/
-                       alpha=(difference-falloff)/(tolerance-falloff);
-               }
-
-               /*only change if more transparent than either image */
-               maxInputAlpha=max_ff(inColor1[3], inColor2[3]);
-               if (alpha < maxInputAlpha) {
-                       /*clamp*/
-                       if (alpha < 0.0f) alpha = 0.0f;
-                       if (alpha > 1.0f) alpha = 1.0f;
-                       outColor[3] = alpha;
-               }
-               else { /* leave as before */
-                       outColor[3]=maxInputAlpha;
-               }
-       }
-}
-
-static void node_composit_exec_diff_matte(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
-{
-       CompBuf *outbuf= NULL;
-       CompBuf *imbuf1= NULL;
-       CompBuf *imbuf2= NULL;
-       /* NodeChroma *c; */ /* UNUSED */
-
-       /*is anything connected?*/
-       if (out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
-
-       /*must have an image imput*/
-       if (in[0]->data==NULL) return;
-
-
-       imbuf1=typecheck_compbuf(in[0]->data, CB_RGBA);
-
-       /* if there's an image, use that, if not use the color */
-       if (in[1]->data) {
-               imbuf2=typecheck_compbuf(in[1]->data, CB_RGBA);
-       }
-
-       /* c=node->storage; */ /* UNUSED */
-       outbuf=dupalloc_compbuf(imbuf1);
-
-       /* note, processor gets a keyvals array passed on as buffer constant */
-       composit2_pixel_processor(node, outbuf, imbuf1, in[0]->vec, imbuf2, in[1]->vec, do_diff_matte, CB_RGBA, CB_RGBA);
-
-       out[0]->data=outbuf;
-       if (out[1]->hasoutput)
-               out[1]->data=valbuf_from_rgbabuf(outbuf, CHAN_A);
-       generate_preview(data, node, outbuf);
-
-       if (imbuf1!=in[0]->data)
-               free_compbuf(imbuf1);
-
-       if (imbuf2!=in[1]->data)
-               free_compbuf(imbuf2);
-}
-
-#endif  /* WITH_COMPOSITOR_LEGACY */
-
 static void node_composit_init_diff_matte(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
 {
        NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
@@ -147,9 +62,6 @@ void register_node_type_cmp_diff_matte(bNodeTreeType *ttype)
        node_type_size(&ntype, 200, 80, 250);
        node_type_init(&ntype, node_composit_init_diff_matte);
        node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
-#ifdef WITH_COMPOSITOR_LEGACY
-       node_type_exec(&ntype, node_composit_exec_diff_matte);
-#endif
 
        nodeRegisterType(ttype, &ntype);
 }
index 9787c9f7145613f6fafca25978775a1a5599439c..0238914a9d1061194784a31b2d75f24726e7ed46 100644 (file)
@@ -44,112 +44,6 @@ static bNodeSocketTemplate cmp_node_dilateerode_out[] = {
        {   -1, 0, ""   }
 };
 
-#ifdef WITH_COMPOSITOR_LEGACY
-
-static void morpho_dilate(CompBuf *cbuf)
-{
-       int x, y;
-       float *p, *rectf = cbuf->rect;
-       
-       for (y = 0; y < cbuf->y; y++) {
-               for (x = 0; x < cbuf->x - 1; x++) {
-                       p = rectf + cbuf->x * y + x;
-                       *p = max_ff(*p, *(p + 1));
-               }
-       }
-
-       for (y = 0; y < cbuf->y; y++) {
-               for (x = cbuf->x - 1; x >= 1; x--) {
-                       p = rectf + cbuf->x * y + x;
-                       *p = max_ff(*p, *(p - 1));
-               }
-       }
-
-       for (x = 0; x < cbuf->x; x++) {
-               for (y = 0; y < cbuf->y - 1; y++) {
-                       p = rectf + cbuf->x * y + x;
-                       *p = max_ff(*p, *(p + cbuf->x));
-               }
-       }
-
-       for (x = 0; x < cbuf->x; x++) {
-               for (y = cbuf->y - 1; y >= 1; y--) {
-                       p = rectf + cbuf->x * y + x;
-                       *p = max_ff(*p, *(p - cbuf->x));
-               }
-       }
-}
-
-static void morpho_erode(CompBuf *cbuf)
-{
-       int x, y;
-       float *p, *rectf = cbuf->rect;
-       
-       for (y = 0; y < cbuf->y; y++) {
-               for (x = 0; x < cbuf->x - 1; x++) {
-                       p = rectf + cbuf->x * y + x;
-                       *p = min_ff(*p, *(p + 1));
-               }
-       }
-
-       for (y = 0; y < cbuf->y; y++) {
-               for (x = cbuf->x - 1; x >= 1; x--) {
-                       p = rectf + cbuf->x * y + x;
-                       *p = min_ff(*p, *(p - 1));
-               }
-       }
-
-       for (x = 0; x < cbuf->x; x++) {
-               for (y = 0; y < cbuf->y - 1; y++) {
-                       p = rectf + cbuf->x * y + x;
-                       *p = min_ff(*p, *(p + cbuf->x));
-               }
-       }
-
-       for (x = 0; x < cbuf->x; x++) {
-               for (y = cbuf->y - 1; y >= 1; y--) {
-                       p = rectf + cbuf->x * y + x;
-                       *p = min_ff(*p, *(p - cbuf->x));
-               }
-       }
-       
-}
-
-static void node_composit_exec_dilateerode(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
-{
-       /* stack order in: mask */
-       /* stack order out: mask */
-       if (out[0]->hasoutput == 0)
-               return;
-       
-       /* input no image? then only color operation */
-       if (in[0]->data == NULL) {
-               zero_v4(out[0]->vec);
-       }
-       else {
-               /* make output size of input image */
-               CompBuf *cbuf = typecheck_compbuf(in[0]->data, CB_VAL);
-               CompBuf *stackbuf = dupalloc_compbuf(cbuf);
-               short i;
-               
-               if (node->custom2 > 0) { // positive, dilate
-                       for (i = 0; i < node->custom2; i++)
-                               morpho_dilate(stackbuf);
-               }
-               else if (node->custom2 < 0) { // negative, erode
-                       for (i = 0; i > node->custom2; i--)
-                               morpho_erode(stackbuf);
-               }
-               
-               if (cbuf != in[0]->data)
-                       free_compbuf(cbuf);
-               
-               out[0]->data = stackbuf;
-       }
-}
-
-#endif  /* WITH_COMPOSITOR_LEGACY */
-
 static void node_composit_init_dilateerode(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
 {
        NodeDilateErode *data = MEM_callocN(sizeof(NodeDilateErode), "NodeDilateErode");
@@ -165,9 +59,6 @@ void register_node_type_cmp_dilateerode(bNodeTreeType *ttype)
        node_type_socket_templates(&ntype, cmp_node_dilateerode_in, cmp_node_dilateerode_out);
        node_type_size(&ntype, 130, 100, 320);
        node_type_init(&ntype, node_composit_init_dilateerode);
-#ifdef WITH_COMPOSITOR_LEGACY
-       node_type_exec(&ntype, node_composit_exec_dilateerode);
-#endif
        
        node_type_storage(&ntype, "NodeDilateErode", node_free_standard_storage, node_copy_standard_storage);
 
index a343315264d2978a03f822dc833a5c8ed8ca1b7b..ca32f37a32e42374b8be1ae0ab46bc3b423430e9 100644 (file)
@@ -42,90 +42,6 @@ static bNodeSocketTemplate cmp_node_dblur_out[] = {
        {   -1, 0, ""       }
 };
 
-#ifdef WITH_COMPOSITOR_LEGACY
-
-static CompBuf *dblur(bNode *node, CompBuf *img, int iterations, int wrap,
-                      float center_x, float center_y, float dist, float angle, float spin, float zoom)
-{
-       if ((dist != 0.f) || (spin != 0.f) || (zoom != 0.f)) {
-               void (*getpix)(CompBuf *, float, float, float *) = wrap ? qd_getPixelLerpWrap : qd_getPixelLerp;
-               const float a = angle;
-               const float itsc = 1.f / powf(2.f, (float)iterations);
-               float D;
-               float center_x_pix, center_y_pix;
-               float tx, ty;
-               float sc, rot;
-               CompBuf *tmp;
-               int i, j;
-               
-               tmp = dupalloc_compbuf(img);
-               
-               D = dist * sqrtf(img->x * img->x + img->y * img->y);
-               center_x_pix = center_x * img->x;
-               center_y_pix = center_y * img->y;
-
-               tx =  itsc * D * cosf(a);
-               ty = -itsc * D * sinf(a);
-               sc =  itsc * zoom;
-               rot = itsc * spin;
-
-               /* blur the image */
-               for (i = 0; i < iterations; ++i) {
-                       const float cs = cosf(rot), ss = sinf(rot);
-                       const float isc = 1.f / (1.f + sc);
-                       unsigned int x, y;
-                       float col[4] = {0, 0, 0, 0};
-
-                       for (y = 0; y < img->y; ++y) {
-                               const float v = isc * (y - center_y_pix) + ty;
-
-                               for (x = 0; x < img->x; ++x) {
-                                       const float u = isc * (x - center_x_pix) + tx;
-                                       unsigned int p = (x + y * img->x) * img->type;
-
-                                       getpix(tmp, cs * u + ss * v + center_x_pix, cs * v - ss * u + center_y_pix, col);
-
-                                       /* mix img and transformed tmp */
-                                       for (j = 0; j < 4; ++j) {
-                                               img->rect[p + j] = 0.5f * (img->rect[p + j] + col[j]);
-                                       }
-                               }
-                       }
-
-                       /* copy img to tmp */
-                       if (i != (iterations - 1)) 
-                               memcpy(tmp->rect, img->rect, sizeof(float) * img->x * img->y * img->type);
-
-                       /* double transformations */
-                       tx *= 2.f, ty  *= 2.f;
-                       sc *= 2.f, rot *= 2.f;
-
-                       if (node->exec & NODE_BREAK) break;
-               }
-
-               free_compbuf(tmp);
-       }
-
-       return img;
-}
-
-static void node_composit_exec_dblur(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
-{
-       NodeDBlurData *ndbd = node->storage;
-       CompBuf *new, *img = in[0]->data;
-       
-       if ((img == NULL) || (out[0]->hasoutput == 0)) return;
-
-       if (img->type != CB_RGBA)
-               new = typecheck_compbuf(img, CB_RGBA);
-       else
-               new = dupalloc_compbuf(img);
-       
-       out[0]->data = dblur(node, new, ndbd->iter, ndbd->wrap, ndbd->center_x, ndbd->center_y, ndbd->distance, ndbd->angle, ndbd->spin, ndbd->zoom);
-}
-
-#endif  /* WITH_COMPOSITOR_LEGACY */
-
 static void node_composit_init_dblur(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
 {
        NodeDBlurData *ndbd = MEM_callocN(sizeof(NodeDBlurData), "node dblur data");
@@ -143,9 +59,6 @@ void register_node_type_cmp_dblur(bNodeTreeType *ttype)
        node_type_size(&ntype, 150, 120, 200);
        node_type_init(&ntype, node_composit_init_dblur);
        node_type_storage(&ntype, "NodeDBlurData", node_free_standard_storage, node_copy_standard_storage);
-#ifdef WITH_COMPOSITOR_LEGACY
-       node_type_exec(&ntype, node_composit_exec_dblur);
-#endif
 
        nodeRegisterType(ttype, &ntype);
 }
index c07ad0a0c97e033457ac406eae0c20ff608e402c..595596765a9d692d5ddfaae27d0902ba912b5afb 100644 (file)
@@ -47,145 +47,6 @@ static bNodeSocketTemplate cmp_node_displace_out[] = {
        {       -1, 0, ""       }
 };
 
-#ifdef WITH_COMPOSITOR_LEGACY
-
-/* minimum distance (in pixels) a pixel has to be displaced
- * in order to take effect */
-#define DISPLACE_EPSILON       0.01f
-
-static void do_displace(bNode *node, CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float *UNUSED(veccol), CompBuf *xbuf,  CompBuf *ybuf, float *xscale, float *yscale)
-{
-       ImBuf *ibuf;
-       int x, y;
-       float p_dx, p_dy;       /* main displacement in pixel space */
-       float d_dx, d_dy;
-       float dxt, dyt;
-       float u, v;
-       float xs, ys;
-       float vec[3], vecdx[3], vecdy[3];
-       float col[3];
-       
-       ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
-       ibuf->rect_float= cbuf->rect;
-       
-       for (y=0; y < stackbuf->y; y++) {
-               for (x=0; x < stackbuf->x; x++) {
-                       /* calc pixel coordinates */
-                       qd_getPixel(vecbuf, x-vecbuf->xof, y-vecbuf->yof, vec);
-                       
-                       if (xbuf)
-                               qd_getPixel(xbuf, x-xbuf->xof, y-xbuf->yof, &xs);
-                       else
-                               xs = xscale[0];
-                       
-                       if (ybuf)
-                               qd_getPixel(ybuf, x-ybuf->xof, y-ybuf->yof, &ys);
-                       else
-                               ys = yscale[0];
-
-                       /* clamp x and y displacement to triple image resolution - 
-                        * to prevent hangs from huge values mistakenly plugged in eg. z buffers */
-                       CLAMP(xs, -stackbuf->x*4, stackbuf->x*4);
-                       CLAMP(ys, -stackbuf->y*4, stackbuf->y*4);
-                       
-                       p_dx = vec[0] * xs;
-                       p_dy = vec[1] * ys;
-                       
-                       /* if no displacement, then just copy this pixel */
-                       if (fabsf(p_dx) < DISPLACE_EPSILON && fabsf(p_dy) < DISPLACE_EPSILON) {
-                               qd_getPixel(cbuf, x-cbuf->xof, y-cbuf->yof, col);
-                               qd_setPixel(stackbuf, x, y, col);
-                               continue;
-                       }
-                       
-                       /* displaced pixel in uv coords, for image sampling */
-                       u = (x - cbuf->xof - p_dx + 0.5f) / (float)stackbuf->x;
-                       v = (y - cbuf->yof - p_dy + 0.5f) / (float)stackbuf->y;
-                       
-                       
-                       /* calc derivatives */
-                       qd_getPixel(vecbuf, x-vecbuf->xof+1, y-vecbuf->yof, vecdx);
-                       qd_getPixel(vecbuf, x-vecbuf->xof, y-vecbuf->yof+1, vecdy);
-                       d_dx = vecdx[0] * xs;
-                       d_dy = vecdy[1] * ys;
-
-                       /* clamp derivatives to minimum displacement distance in UV space */
-                       dxt = p_dx - d_dx;
-                       dyt = p_dy - d_dy;
-
-                       dxt = signf(dxt)*max_ff(fabsf(dxt), DISPLACE_EPSILON)/(float)stackbuf->x;
-                       dyt = signf(dyt)*max_ff(fabsf(dyt), DISPLACE_EPSILON)/(float)stackbuf->y;
-                       
-                       ibuf_sample(ibuf, u, v, dxt, dyt, col);
-                       qd_setPixel(stackbuf, x, y, col);
-                       
-                       if (node->exec & NODE_BREAK) break;
-               }
-               
-               if (node->exec & NODE_BREAK) break;
-       }
-       IMB_freeImBuf(ibuf);
-       
-       
-/* simple method for reference, linear interpolation */
-#if 0
-       int x, y;
-       float dx, dy;
-       float u, v;
-       float vec[3];
-       float col[3];
-       
-       for (y=0; y < stackbuf->y; y++) {
-               for (x=0; x < stackbuf->x; x++) {
-                       qd_getPixel(vecbuf, x, y, vec);
-                       
-                       dx = vec[0] * (xscale[0]);
-                       dy = vec[1] * (yscale[0]);
-                       
-                       u = (x - dx + 0.5f) / (float)stackbuf->x;
-                       v = (y - dy + 0.5f) / (float)stackbuf->y;
-                       
-                       qd_getPixelLerp(cbuf, u*cbuf->x - 0.5f, v*cbuf->y - 0.5f, col);
-                       qd_setPixel(stackbuf, x, y, col);
-               }
-       }
-#endif
-}
-
-
-static void node_composit_exec_displace(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
-{
-       if (out[0]->hasoutput==0)
-               return;
-       
-       if (in[0]->data && in[1]->data) {
-               CompBuf *cbuf= in[0]->data;
-               CompBuf *vecbuf= in[1]->data;
-               CompBuf *xbuf= in[2]->data;
-               CompBuf *ybuf= in[3]->data;
-               CompBuf *stackbuf;
-               
-               cbuf= typecheck_compbuf(cbuf, CB_RGBA);
-               vecbuf= typecheck_compbuf(vecbuf, CB_VEC3);
-               xbuf= typecheck_compbuf(xbuf, CB_VAL);
-               ybuf= typecheck_compbuf(ybuf, CB_VAL);
-               
-               stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* allocs */
-
-               do_displace(node, stackbuf, cbuf, vecbuf, in[1]->vec, xbuf, ybuf, in[2]->vec, in[3]->vec);
-               
-               out[0]->data= stackbuf;
-               
-               
-               if (cbuf!=in[0]->data)
-                       free_compbuf(cbuf);
-               if (vecbuf!=in[1]->data)
-                       free_compbuf(vecbuf);
-       }
-}
-
-#endif  /* WITH_COMPOSITOR_LEGACY */
-
 void register_node_type_cmp_displace(bNodeTreeType *ttype)
 {
        static bNodeType ntype;
@@ -193,9 +54,6 @@ void register_node_type_cmp_displace(bNodeTreeType *ttype)
        node_type_base(ttype, &ntype, CMP_NODE_DISPLACE, "Displace", NODE_CLASS_DISTORT, NODE_OPTIONS);
        node_type_socket_templates(&ntype, cmp_node_displace_in, cmp_node_displace_out);
        node_type_size(&ntype, 140, 100, 320);
-#ifdef WITH_COMPOSITOR_LEGACY
-       node_type_exec(&ntype, node_composit_exec_displace);
-#endif
 
        nodeRegisterType(ttype, &ntype);
 }
index 7e605865cd2c0c58133fa244a0de8f6e9b2c3352..fffb85cca8e24f92a9223f39114df6d428ed08cb 100644 (file)
@@ -45,147 +45,6 @@ static bNodeSocketTemplate cmp_node_distance_matte_out[] = {
        {-1, 0, ""}
 };
 
-#ifdef WITH_COMPOSITOR_LEGACY
-
-/* note, keyvals is passed on from caller as stack array */
-/* might have been nicer as temp struct though... */
-static void do_distance_matte(bNode *node, float *out, float *in)
-{
-       NodeChroma *c= (NodeChroma *)node->storage;
-       float tolerance=c->t1;
-       float fper=c->t2;
-       /* get falloff amount over tolerance size */
-       float falloff=(1.0f-fper) * tolerance;
-       float distance;
-       float alpha;
-
-       distance=sqrt((c->key[0]-in[0])*(c->key[0]-in[0]) +
-               (c->key[1]-in[1])*(c->key[1]-in[1]) +
-               (c->key[2]-in[2])*(c->key[2]-in[2]));
-
-       copy_v3_v3(out, in);
-
-       if (distance <= tolerance) {
-               if (distance <= falloff) {
-                       alpha = 0.0f;
-               }
-               else {
-                       /* alpha as percent (distance / tolerance), each modified by falloff amount (in pixels)*/
-                       alpha=(distance-falloff)/(tolerance-falloff);
-               }
-
-               /*only change if more transparent than before */
-               if (alpha < in[3]) {
-                       /*clamp*/
-                       if (alpha < 0.0f) alpha = 0.0f;
-                       if (alpha > 1.0f) alpha = 1.0f;
-                       out[3]=alpha;
-               }
-               else { /* leave as before */
-                       out[3]=in[3];
-               }
-       }
-}
-
-static void do_chroma_distance_matte(bNode *node, float *out, float *in)
-{
-       NodeChroma *c= (NodeChroma *)node->storage;
-       float tolerance=c->t1;
-       float fper=c->t2;
-       /* get falloff amount over tolerance size */
-       float falloff=(1.0f-fper) * tolerance;
-       float y_key, cb_key, cr_key;
-       float y_pix, cb_pix, cr_pix;
-       float distance;
-       float alpha;
-
-       /*convert key to chroma colorspace */
-       rgb_to_ycc(c->key[0], c->key[1], c->key[2], &y_key, &cb_key, &cr_key, BLI_YCC_JFIF_0_255);
-       /* normalize the values */
-       cb_key=cb_key/255.0f;
-       cr_key=cr_key/255.0f;
-
-       /*convert pixel to chroma colorspace */
-       rgb_to_ycc(in[0], in[1], in[2], &y_pix, &cb_pix, &cr_pix, BLI_YCC_JFIF_0_255);
-       /*normalize the values */
-       cb_pix=cb_pix/255.0f;
-       cr_pix=cr_pix/255.0f;
-
-       distance=sqrt((cb_key-cb_pix)*(cb_key-cb_pix) +
-               (cr_key-cr_pix)*(cr_key-cr_pix));
-
-       copy_v3_v3(out, in);
-
-       if (distance <= tolerance) {
-               if (distance <= falloff) {
-                       alpha = 0.0f;
-               }
-               else {
-                       /* alpha as percent (distance / tolerance), each modified by falloff amount (in pixels)*/
-                       alpha=(distance-falloff)/(tolerance-falloff);
-               }
-
-               /*only change if more transparent than before */
-               if (alpha < in[3]) {
-                       /*clamp*/
-                       if (alpha < 0.0f) alpha = 0.0f;
-                       if (alpha > 1.0f) alpha = 1.0f;
-                       out[3]=alpha;
-               }
-               else { /* leave as before */
-                       out[3]=in[3];
-               }
-       }
-}
-
-static void node_composit_exec_distance_matte(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
-{
-       /*
-        * Loosely based on the Sequencer chroma key plug-in,