commit d88f4bd9f41f42597c2fb5837d3d213c579302d6
Author: Nikhil Dasan <n-dasan@ti.com>
Date:   Mon Nov 20 17:48:17 2023 +0530

    viss output gp
    
    Signed-off-by: Nikhil Dasan <n-dasan@ti.com>

diff --git a/apps/basic_demos/app_single_cam/app_single_cam_common.c b/apps/basic_demos/app_single_cam/app_single_cam_common.c
index a383b99..23f147c 100755
--- a/apps/basic_demos/app_single_cam/app_single_cam_common.c
+++ b/apps/basic_demos/app_single_cam/app_single_cam_common.c
@@ -701,6 +701,8 @@ vx_status app_create_viss(AppObj *obj, uint32_t sensor_wdr_mode)
     unsigned int image_height;
     int32_t dcc_buff_size = 0;
     int32_t dcc_buff_size_driver;
+    vx_int32 q;
+    vx_char name[VX_MAX_REFERENCE_NAME];
 
 #ifdef x86_64
     int32_t dcc_buff_size_fs;
@@ -711,7 +713,30 @@ vx_status app_create_viss(AppObj *obj, uint32_t sensor_wdr_mode)
     image_height = obj->height_in;
 
     obj->num_viss_out_buf = 3;
-    obj->y8_r8_c2 = vxCreateImage(obj->context, image_width, image_height, VX_DF_IMAGE_NV12);
+
+    obj->y8_r8_c2 = NULL;
+    vx_image output_img = vxCreateImage(obj->context, image_width, image_height, VX_DF_IMAGE_NV12);
+    status = vxGetStatus((vx_reference)output_img);
+    if(status == VX_SUCCESS)
+    {
+        for (q=0; q < 4; q++)
+        {
+            obj->y8_r8_c2_arr[q] = vxCreateObjectArray(obj->context, (vx_reference)output_img, 1);
+            status = vxGetStatus((vx_reference)obj->y8_r8_c2_arr[q]);
+            if(status != VX_SUCCESS)
+            {
+                printf("[VISS-MODULE] Unable to create VISS output image array! \n");
+                return status;
+            }
+            else
+            {
+                snprintf(name, VX_MAX_REFERENCE_NAME, "viss_node_output_arr_%d", q);
+                vxSetReferenceName((vx_reference)obj->y8_r8_c2_arr[q], name);
+            }
+        }
+        vxReleaseImage(&output_img);
+    }
+    obj->y8_r8_c2 = (vx_image)vxGetObjectArrayItem(obj->y8_r8_c2_arr[0], 0);
     obj->uv8_g8_c3 = NULL;
 
     obj->y12 = NULL;
@@ -873,6 +898,7 @@ vx_status app_delete_viss(AppObj *obj)
 {
     vx_status status = VX_SUCCESS;
     uint32_t buf_id;
+    vx_int32 i;
 
 #ifdef x86_64
     if(NULL != obj->fs_dcc_buf_viss)
@@ -920,6 +946,14 @@ vx_status app_delete_viss(AppObj *obj)
         APP_PRINTF("releasing y8_r8_c2\n");
         status |= vxReleaseImage(&obj->y8_r8_c2);
     }
+    for(i = 0; i < 4; i++)
+    {
+        if(NULL != obj->y8_r8_c2_arr[i])
+        {
+            APP_PRINTF("releasing y8_r8_c2\n");
+            status |= vxReleaseObjectArray(&obj->y8_r8_c2_arr[i]);
+        }
+    }
 
     if(NULL != obj->uv8_g8_c3)
     {
diff --git a/apps/basic_demos/app_single_cam/app_single_cam_common.h b/apps/basic_demos/app_single_cam/app_single_cam_common.h
index bad9c78..67c4a9a 100755
--- a/apps/basic_demos/app_single_cam/app_single_cam_common.h
+++ b/apps/basic_demos/app_single_cam/app_single_cam_common.h
@@ -127,6 +127,7 @@ typedef struct {
     vx_image y12;
     vx_image uv12_c1;
     vx_image y8_r8_c2;
+    vx_object_array y8_r8_c2_arr[MAX_NUM_BUF];
     vx_image uv8_g8_c3;
     vx_image s8_b8_c4;
     vx_user_data_object h3a_aew_af;
diff --git a/apps/basic_demos/app_single_cam/app_single_cam_main.c b/apps/basic_demos/app_single_cam/app_single_cam_main.c
index 3d44b46..73dbe96 100755
--- a/apps/basic_demos/app_single_cam/app_single_cam_main.c
+++ b/apps/basic_demos/app_single_cam/app_single_cam_main.c
@@ -598,7 +598,7 @@ Sensor driver does not support metadata yet.
         if(VX_SUCCESS == status)
         {
         vxSetNodeTarget(obj->node_viss, VX_TARGET_STRING, TIVX_TARGET_VPAC_VISS1);
-        tivxSetNodeParameterNumBufByIndex(obj->node_viss, 6u, obj->num_cap_buf);
+        // tivxSetNodeParameterNumBufByIndex(obj->node_viss, 6u, obj->num_cap_buf);
         }
         else
         {
@@ -737,12 +737,12 @@ Sensor driver does not support metadata yet.
     int graph_parameter_num = 0;
 
     /* input @ node index 1, becomes graph parameter 0 */
-    add_graph_parameter_by_node_index(obj->graph, obj->capture_node, 1);
+    add_graph_parameter_by_node_index(obj->graph, obj->node_viss, 6);
 
     /* set graph schedule config such that graph parameter @ index 0 is enqueuable */
     graph_parameters_queue_params_list[graph_parameter_num].graph_parameter_index = graph_parameter_num;
     graph_parameters_queue_params_list[graph_parameter_num].refs_list_size = obj->num_cap_buf;
-    graph_parameters_queue_params_list[graph_parameter_num].refs_list = (vx_reference*)&(obj->cap_frames[0]);
+    graph_parameters_queue_params_list[graph_parameter_num].refs_list = (vx_reference*)&(obj->y8_r8_c2_arr[0]);
     graph_parameter_num++;
 
     if(obj->test_mode == 1)
@@ -827,6 +827,7 @@ vx_status app_delete_graph(AppObj *obj)
 {
     uint32_t buf_id;
     vx_status status = VX_SUCCESS;
+    vx_int32 i;
 
     if(NULL != obj->capture_node)
     {
@@ -903,6 +904,14 @@ vx_status app_delete_graph(AppObj *obj)
         APP_PRINTF("releasing y8_r8_c2\n");
         status |= vxReleaseImage(&obj->y8_r8_c2);
     }
+    for(i = 0; i < 4; i++)
+    {
+        if(NULL != obj->y8_r8_c2_arr[i])
+        {
+            APP_PRINTF("releasing y8_r8_c2\n");
+            status |= vxReleaseObjectArray(&obj->y8_r8_c2_arr[i]);
+        }
+    }
 
     if(NULL != obj->uv8_g8_c3)
     {
@@ -1072,7 +1081,7 @@ vx_status app_run_graph(AppObj *obj)
     {
         if(status == VX_SUCCESS)
         {
-            status = vxGraphParameterEnqueueReadyRef(obj->graph, 0, (vx_reference*)&(obj->cap_frames[buf_id]), 1);
+            status = vxGraphParameterEnqueueReadyRef(obj->graph, 0, (vx_reference*)&(obj->y8_r8_c2_arr[buf_id]), 1);
         }
         /* in order for the graph to finish execution, the
             display still needs to be enqueued 4 times for testing */
