VisionWorks / OpenVX on TX1 - vxMapArrayRange

Hi,

Sorry for my late reply.
Error code -10 means VX_ERROR_INVALID_PARAMETERS.

vxMapArrayRange function are used to access a set of valid items in the array.
When you create the array with a given capacity, you tell how much memory needs to be allocated, but the array is empty (there is no item in it yet). Then, calling vxAccessArrayRange returns an error.

Try to add some item before calling vxMapArrayRange() and this issue should be fixed.

#include <VX/vx.h>
#include <stdio.h>//printf()
#include <stdlib.h>//exit() 
#define ERROR_CHECK_STATUS( status ) { \
	vx_status status_ = (status); \
        if(status_ != VX_SUCCESS) { \
        	printf("No ERROR: failed with status = (%d) at " __FILE__ "#%d\n", status_, __LINE__); \
        	exit(1); \
        } \
}

int main() {
    vx_context context = vxCreateContext();	
    vx_array array = vxCreateArray(context, VX_TYPE_KEYPOINT, 50);

    vx_keypoint_t keypoints[50];
    for(int i=0; i<50; i++) {
        keypoints[i].x = 0;
        keypoints[i].y = 0;
    }
    ERROR_CHECK_STATUS(vxAddArrayItems(array, 50, &keypoints, sizeof(vx_keypoint_t)));

    vx_size stride = sizeof(vx_size);
    void *base = NULL;
    vx_map_id map_id;
    /* access entire array at once */
    ERROR_CHECK_STATUS(vxMapArrayRange(array, 0, 20, &map_id, &stride, &base, VX_READ_AND_WRITE, VX_MEMORY_TYPE_HOST, 0));
/*	
    vx_size i = 0;
    vx_keypoint_t* cur_entry_ptr = (vx_keypoint_t*)(base + i * stride);
    //since vxMapArrayRange() fail, the cur_entry_ptr is invalid, via which I cannot read or write data in "array[i]".
*/
    vxUnmapArrayRange(array, map_id);
    return 0;
}