@@ -26,7 +26,7 @@ THE SOFTWARE.
2626#define SANITY_CHECK_DATA_TYPE (data,data_type ) if (!data || data->ref.type != data_type) return -1
2727#define SANITY_CHECK_DATA_TYPE_OPTIONAL (data,data_type ) if ( data && data->ref.type != data_type) return -1
2828
29- int agoDramaDivideAppend (AgoNodeList * nodeList, AgoNode * anode, vx_enum new_kernel_id)
29+ int agoDramaDivideAppend (AgoNodeList * nodeList, AgoNode * anode, vx_enum new_kernel_id, vx_reference * paramList, vx_uint32 paramCount )
3030{
3131 if (new_kernel_id == VX_KERNEL_AMD_INVALID) {
3232 // TBD: error handling
@@ -35,15 +35,26 @@ int agoDramaDivideAppend(AgoNodeList * nodeList, AgoNode * anode, vx_enum new_ke
3535 }
3636 // create a new AgoNode and add it to the nodeList
3737 AgoNode * childnode = agoCreateNode ((AgoGraph *)anode->ref .scope , new_kernel_id);
38- for (vx_uint32 i = 0 ; i < anode-> paramCount ; i++) {
39- childnode->paramList [i] = anode-> paramList [i];
38+ for (vx_uint32 i = 0 ; i < paramCount; i++) {
39+ childnode->paramList [i] = (AgoData *) paramList[i];
4040 }
41+ anode->drama_divide_invoked = true ;
4142 // transfer attributes from anode to childnode
4243 agoImportNodeConfig (childnode, anode);
4344 // verify the node
4445 return agoVerifyNode (childnode);
4546}
4647
48+ vx_status VX_CALLBACK agoDramaDivideAddNodeCallback (vx_node node, vx_enum kernel_id, vx_reference * paramList, vx_uint32 paramCount)
49+ {
50+ return agoDramaDivideAppend (&((AgoGraph *)node->ref .scope )->nodeList , node, kernel_id, paramList, paramCount);
51+ }
52+
53+ int agoDramaDivideAppend (AgoNodeList * nodeList, AgoNode * anode, vx_enum new_kernel_id)
54+ {
55+ return agoDramaDivideAppend (nodeList, anode, new_kernel_id, (vx_reference *)anode->paramList , anode->paramCount );
56+ }
57+
4758int agoDramaDivideColorConvertNode (AgoNodeList * nodeList, AgoNode * anode)
4859{
4960 // sanity checks
@@ -1975,10 +1986,11 @@ int agoOptimizeDramaDivide(AgoGraph * agraph)
19751986 }
19761987 else if (anode->akernel ->regen_callback_f ) {
19771988 // try regenerating the node
1978- vx_bool regen_not_needed = vx_true_e;
1979- vx_status status = anode->akernel ->regen_callback_f (agraph, anode, regen_not_needed);
1989+ anode->drama_divide_invoked = false ;
1990+ vx_bool replace_original = vx_true_e;
1991+ vx_status status = anode->akernel ->regen_callback_f (anode, agoDramaDivideAddNodeCallback, replace_original);
19801992 if (status == VX_SUCCESS) {
1981- if (regen_not_needed == vx_false_e ) {
1993+ if (anode-> drama_divide_invoked && replace_original ) {
19821994 // remove and release the current node
19831995 if (aprev) aprev->next = anode->next ;
19841996 else agraph->nodeList .head = anode->next ;
0 commit comments