This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VM: 4 Camera Application :: Buffer Mapping Issues

Part Number: TDA4VM


Dear Sir,

Continuing the queries related to the existing thread 

I am keeping AVP3 as a reference as the capture node is not present in my application due to the dependencies explained earlier.

I am facing the issues listed below in logs

12.945445 s:  VX_ZONE_ERROR:[ownReleaseReferenceInt:307] Invalid reference
    12.945469 s:  VX_ZONE_ERROR:[ownReleaseReferenceInt:307] Invalid reference
    12.945491 s:  VX_ZONE_ERROR:[ownReleaseReferenceInt:307] Invalid reference
    12.945514 s:  VX_ZONE_ERROR:[ownReleaseReferenceInt:307] Invalid reference
    12.945536 s:  VX_ZONE_ERROR:[ownReleaseReferenceInt:307] Invalid reference
    12.945560 s:  VX_ZONE_ERROR:[ownReleaseReferenceInt:307] Invalid reference
    12.945583 s:  VX_ZONE_ERROR:[ownReleaseReferenceInt:307] Invalid reference
    12.945605 s:  VX_ZONE_ERROR:[ownReleaseReferenceInt:307] Invalid reference
    12.946421 s:  VX_ZONE_WARNING:[vxReleaseContext:1012] Found a reference 105e0988 of type 00000813 at external count 1, internal count t
    12.946463 s:  VX_ZONE_WARNING:[vxReleaseContext:1015] Unreleased reference name = object_array_107
    12.946491 s:  VX_ZONE_WARNING:[vxReleaseContext:1017] Releasing reference now as a part of garbage collection
    12.946698 s:  VX_ZONE_WARNING:[vxReleaseContext:1012] Found a reference 1058f598 of type 0000080f at external count 1, internal count t
    12.946736 s:  VX_ZONE_WARNING:[vxReleaseContext:1015] Unreleased reference name = image_108
    12.946763 s:  VX_ZONE_WARNING:[vxReleaseContext:1017] Releasing reference now as a part of garbage collection
    12.946841 s:  VX_ZONE_WARNING:[vxReleaseContext:1012] Found a reference 105e0b28 of type 00000813 at external count 1, internal count t
    12.946879 s:  VX_ZONE_WARNING:[vxReleaseContext:1015] Unreleased reference name = object_array_112
    12.946906 s:  VX_ZONE_WARNING:[vxReleaseContext:1017] Releasing reference now as a part of garbage collection
    12.947109 s:  VX_ZONE_WARNING:[vxReleaseContext:1012] Found a reference 10590078 of type 0000080f at external count 1, internal count t
    12.947149 s:  VX_ZONE_WARNING:[vxReleaseContext:10+-----------------------------+ image_113
    13.081645 s:  VX_ZONE_WARNING:[vxReleaseContext:10|                             |a part of garbage collection
    13.081743 s:  VX_ZONE_WARNING:[vxReleaseContext:10|  Cannot open /dev/ttyUSB0!  |of type 00000813 at external count 1, internal count t
    13.081784 s:  VX_ZONE_WARNING:[vxReleaseContext:10|                             | object_array_117
    13.081813 s:  VX_ZONE_WARNING:[vxReleaseContext:10+-----------------------------+a part of garbage collection
    13.082016 s:  VX_ZONE_WARNING:[vxReleaseContext:1012] Found a reference 10590b58 of type 0000080f at external count 1, internal count t
    13.082055 s:  VX_ZONE_WARNING:[vxReleaseContext:1015] Unreleased reference name = image_118
    13.082082 s:  VX_ZONE_WARNING:[vxReleaseContext:1017] Releasing reference now as a part of garbage collection
    13.082157 s:  VX_ZONE_WARNING:[vxReleaseContext:1012] Found a reference 105e0e68 of type 00000813 at external count 1, internal count t
    13.082194 s:  VX_ZONE_WARNING:[vxReleaseContext:1015] Unreleased reference name = object_array_122
    13.082221 s:  VX_ZONE_WARNING:[vxReleaseContext:1017] Releasing reference now as a part of garbage collection
    13.082423 s:  VX_ZONE_WARNING:[vxReleaseContext:1012] Found a reference 10591638 of type 0000080f at external count 1, internal count t
    13.082461 s:  VX_ZONE_WARNING:[vxReleaseContext:1015] Unreleased reference name = image_123
    13.082488 s:  VX_ZONE_WARNING:[vxReleaseContext:1017] Releasing reference now as a part of garbage collection
target from daemon mode

Application Exited    13.217309 s:  VX_ZONE_INIT:[tivxHostDeInit:56] De-Initialization Done for HOST !!!
    13.224824 s:  VX_ZONE_INIT:[tivxDeInit:111] De-Initialization Done !!!

I am passing the input in the object array converted from the vx_image buffer[4] in a similar way as passed in the AVP3 application.

Current pipeline ( for testing purposes)

vx_object_arrray(getting from other application) - > LDC Node 

below are the changes done for your reference

 Buffers defined:

typedef struct {

 vx_object_array myarr[HKL_APP_MAX_BUFQ_DEPTH];

 vx_uint32 width;

 vx_uint32 height;

} InputObj;

Below defined in AppObj Structure

 InputObj input;

 vx_image myinput_images[HKL_APP_MAX_BUFQ_DEPTH];

Allocation

static void app_create_input_buffer(AppObj* obj, vx_uint32 w, vx_uint32 h, vx_df_image format)
{
    // Create input image object 
    vx_image input  = vxCreateImage(obj->context, w, h, format);
    vx_status status = vxGetStatus((vx_reference)input);
    if(status == VX_SUCCESS)
    {   
        vx_int32 q;
        for(q = 0; q < APP_BUFFER_Q_DEPTH; q++)
        {

            obj->input.myarr[q]= vxCreateObjectArray(obj->context, (vx_reference)input, 4); //added
            status = vxGetStatus((vx_reference)obj->input.myarr[q]);
            if(status == VX_FAILURE)
            {
            	APP_PRINTF("Camera Daemon Multi-Buffer Allocation: Unable to create object array of depth=%d at idx = %d\n", 4, q);
            }
            obj->myinput_images[q]  = (vx_image)vxGetObjectArrayItem((vx_object_array)obj->input.myarr[q], 0);
        }
        vxReleaseImage(&input);
    }
}

For pipeline

	status = add_graph_param_by_node_index(obj->graph, obj->ldcObj.node, 0);
	obj->ldcObj.graph_parameter_index = graph_parameter_index;
	graph_parameters_queue_params_list[graph_parameter_index].graph_parameter_index = graph_parameter_index;
	graph_parameters_queue_params_list[graph_parameter_index].refs_list_size = APP_BUFFER_Q_DEPTH;
	graph_parameters_queue_params_list[graph_parameter_index].refs_list = (vx_reference*)&obj->myinput_images[0];
	graph_parameter_index++;

One Frame Pipeline code

static vx_status app_run_graph_for_one_frame_pipeline_cam_buffer(AppObj *obj, vx_uint32* frame_id, vx_uint32 frame_last)
{

	if (obj->pipeline <= 0)
	{

                fill_ObjectArray(obj->cdc.last_images,obj->input.myarr,1);  //function to convert vx_image buff[4] to Object Array
    }

		/* Enqueue inputs during pipeup dont execute */
		status = vxGraphParameterEnqueueReadyRef(obj->graph, obj->ldcObj.graph_parameter_index, (vx_reference*)&obj->myinput_images[obj->enqueueCnt], 1);

		obj->enqueueCnt++;
		obj->enqueueCnt   = (obj->enqueueCnt  >= APP_BUFFER_Q_DEPTH)? 0 : obj->enqueueCnt;
		obj->pipeline++;
		enqueueCount++;
	}


	if (obj->pipeline > 0)
	{
		

		vx_image capture_input_image;

		uint32_t num_refs;
		vx_bool enqueueNext = vx_true_e;

		/* Dequeue input */
		status = vxGraphParameterDequeueDoneRef(obj->graph, obj->ldcObj.graph_parameter_index, (vx_reference*)&capture_input_image, 1, &num_refs);



                app_find_object_array_indexes(obj->input.myarr, (vx_reference)capture_input_image, 4, &obj_array_idx);
                if((obj_array_idx != -1) && (status == VX_SUCCESS))
                {   
                   	fill_ObjectArray(obj->cdc.last_images,obj->input.myarr,1);
			/* Enqueue input - start execution */
			status = vxGraphParameterEnqueueReadyRef(obj->graph, obj->ldcObj.graph_parameter_index, (vx_reference*)&capture_input_image, 1);

			obj->enqueueCnt++;
			obj->dequeueCnt++;

			obj->enqueueCnt = (obj->enqueueCnt >= APP_BUFFER_Q_DEPTH)? 0 : obj->enqueueCnt;
			obj->dequeueCnt = (obj->dequeueCnt >= APP_BUFFER_Q_DEPTH)? 0 : obj->dequeueCnt;

		}
	}

	return status;
}

Please let me know, what could be the reason for the error log.

Thanks and Regards,

Vyom Mishra

  • Hi Vyom,

    The error log below occurs when you are trying to release something that you have not created in the context.

    Could you please check for which data object is this  error coming for?

    Also could you do a clean up of the code and remove the data objects that are not used?

    Additionally, I hope you have vxWaitGraph() and release should be done only when this is succeeded.

    12.945445 s:  VX_ZONE_ERROR:[ownReleaseReferenceInt:307] Invalid reference
        12.945469 s:  VX_ZONE_ERROR:[ownReleaseReferenceInt:307] Invalid reference
        12.945491 s:  VX_ZONE_ERROR:[ownReleaseReferenceInt:307] Invalid reference
        12.945514 s:  VX_ZONE_ERROR:[ownReleaseReferenceInt:307] Invalid reference
        12.945536 s:  VX_ZONE_ERROR:[ownReleaseReferenceInt:307] Invalid reference
        12.945560 s:  VX_ZONE_ERROR:[ownReleaseReferenceInt:307] Invalid reference
        12.945583 s:  VX_ZONE_ERROR:[ownReleaseReferenceInt:307] Invalid reference
        12.945605 s:  VX_ZONE_ERROR:[ownReleaseReferenceInt:307] Invalid reference

    Regards,

    Nikhil

  • Dear Sir,

    Thanks for the response.

    I checked the same and it worked.

    As this thread is in continuation of the thread, I would like to understand a few things regarding the AVP3 application.

            app_find_object_array_index(scalerObj->input.arr, (vx_reference)scaler_input_image, AVP_BUFFER_Q_DEPTH, &obj_array_idx);
            if((obj_array_idx != -1) && (status == VX_SUCCESS))
            {
                status = readScalerInput(input_file_name, scalerObj->input.arr[obj_array_idx], NUM_CH);
            }
    
            appPerfPointEnd(&obj->fileio_perf);
    
            APP_PRINTF("App Reading Input Done!\n");
    
            /* Enqueue input - start execution */
            if(status == VX_SUCCESS)
            {
                status = vxGraphParameterEnqueueReadyRef(obj->graph, scalerObj->graph_parameter_index, (vx_reference*)&scaler_input_image, 1);
            }

    In the pipeline,

    scalar_input_image type is vx_image, but the application runs for multi-channel input.

    readScalarInput is reading multichannel input but passed to the vx_image type buffer.

    So with the above snippet, how multi-channel input is working?

    Thanks and Regards,

    Vyom Mishra

  • Hi Vyom,

    readScalarInput is reading multichannel input but passed to the vx_image type buffer.

    The input parameter type of readScalarInput is vx_object_array and not vx_image.
    Internal to this function, we are extracting vx_image from vx_object_array and fill the same with input in a for loop.

    This vx_object_array is created based on number of channels.

    Regards,

    Nikhil

  • Dear Sir,

    Thanks for the quick response!

    readScalarInput is reading multichannel input but passed to the vx_image type buffer.

    With the above statement , I mean to say that 

    status = vxGraphParameterEnqueueReadyRef(obj->graph, scalerObj->graph_parameter_index, (vx_reference*)&scaler_input_image, 1);

    In the above API, scaler_input_image (vx_image type) is enqueued.

    Thanks for confirming the working of "app_find_object_array_index" with readScalarInput.

    Regards,

    Vyom

  • Dear Sir,

    In the below snippet

    app_find_object_array_indexes(obj->input.myarr, (vx_reference)capture_input_image, 4, &obj_array_idx);
    			printf("obj_array_idx = %d\n",obj_array_idx);
    	        fill_ObjectArray(obj->cdc.last_images[0],obj->input.myarr[0],1);
    	        fill_ObjectArray(obj->cdc.last_images[1],obj->input.myarr[1],1);
    	        fill_ObjectArray(obj->cdc.last_images[2],obj->input.myarr[2],1);
    	        fill_ObjectArray(obj->cdc.last_images[3],obj->input.myarr[3],1);
    			/* Enqueue input - start execution */
    			status = vxGraphParameterEnqueueReadyRef(obj->graph, obj->scalerObj.graph_parameter_index, (vx_reference*)&capture_input_image, 1);
    

    In app_find_array_index, passing 4 as array size as I am filling four-channel output through fill_objectArray in obj->input.myarr, is it correct?

    In vxGraphParameterEnqueueReadyRef, capture_input_image(my vx_image variable name) [scalar_input_image in avp3] is passed with num of reference mentioned 1

    As I have four channel outputs in input.myarr , is it correct to pass as capture_input_image(vx_image) with num of reference 1 only?

    I want to understand how multiple channel input is passed with vx_image in vxGraphParameterEnqueueReadyRef keeping a number of references 1 only.

    Thanks and Regards,

    Vyom

  • Hi,

    I want to understand how multiple channel input is passed with vx_image in vxGraphParameterEnqueueReadyRef keeping a number of references 1 only.

    number of references here corresponds to the number of buffers being enqueued per channel (not to be confused with number of channels).
    Here you are enqueuing only 1 buffer per channel.

    If you check the implementation of your code where you created the scalar node, you would have given only the first channel's image as input to the node and then call the replicate node.

    Hence here too you would give only first channel's input and the replicated nodes would take care of multiple channels.

    Regards,

    nikhil