Skip to content

Commit

Permalink
Lk/openvx port 1.3 (#2)
Browse files Browse the repository at this point in the history
* changes for object-array

* threshold functions & adding objectarray to ago_util

* remap functions

* advanced array functions

* vxCreateMatrixFromPatternAndOrigin

* setImagePixelValues
  • Loading branch information
LakshmiKumar23 authored Feb 11, 2020
1 parent fc6abcd commit 0a487ad
Show file tree
Hide file tree
Showing 4 changed files with 1,087 additions and 0 deletions.
6 changes: 6 additions & 0 deletions amd_openvx/openvx/ago/ago_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ struct AgoConfigArray {
vx_size capacity;
vx_size itemsize;
};
struct AgoConfigObjectArray {
vx_enum itemtype;
vx_size numitems;
};
struct AgoConfigConvolution {
vx_size rows;
vx_size columns;
Expand Down Expand Up @@ -377,6 +381,7 @@ struct AgoData {
union {
AgoConfigDelay delay;
AgoConfigArray arr;
AgoConfigObjectArray objarr;
AgoConfigConvolution conv;
AgoConfigDistribution dist;
AgoConfigImage img;
Expand Down Expand Up @@ -724,6 +729,7 @@ struct _vx_pyramid { AgoData d; };
struct _vx_remap { AgoData d; };
struct _vx_scalar { AgoData d; };
struct _vx_threshold { AgoData d; };
struct _vx_object_array { AgoData d; };

// framework
void * agoAllocMemory(vx_size size);
Expand Down
35 changes: 35 additions & 0 deletions amd_openvx/openvx/ago/ago_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1313,6 +1313,41 @@ int agoGetDataFromDescription(AgoContext * acontext, AgoGraph * agraph, AgoData
}
return 0;
}
else if (!strncmp(desc, "objectarray:", 12) || !strncmp(desc, "objectarray-virtual:", 12 + 8)) {
if (!strncmp(desc, "objectarray-virtual:", 12 + 8)) {
data->isVirtual = vx_true_e;
desc += 8;
}
desc += 12;
// get configuration
data->ref.type = VX_TYPE_OBJECT_ARRAY;
const char *s = strstr(desc, ","); if (!s) return -1;
char data_type[64];
memcpy(data_type, desc, s - desc); data_type[s - desc] = 0;
(void)sscanf(++s, "" VX_FMT_SIZE "", &data->u.objarr.numitems);
data->u.objarr.itemtype = agoName2Enum(data_type);
if (!data->u.objarr.itemtype) data->u.objarr.itemtype = atoi(data_type);
if (data->isVirtual && !data->isNotFullyConfigured && (!strcmp(data_type, "0") || !data->u.objarr.numitems)) {
// incomplete information needs to process this again later
data->isNotFullyConfigured = vx_true_e;
return 0;
}

vx_enum id = agoGetUserStructType(acontext, data_type);
if (!id) {
agoAddLogEntry(&data->ref, VX_FAILURE, "ERROR: agoGetDataFromDescription: invalid data type in object-array: %s\n", data_type);
return -1;
}
data->u.objarr.itemtype = id;

// sanity check and update
data->ref.context = acontext; // array sanity check requires access to context
if (agoDataSanityCheckAndUpdate(data)) {
agoAddLogEntry(&data->ref, VX_FAILURE, "ERROR: agoGetDataFromDescription: agoDataSanityCheckAndUpdate failed for object-array\n");
return -1;
}
return 0;
}
else if (!strncmp(desc, "distribution:", 13) || !strncmp(desc, "distribution-virtual:", 13 + 8)) {
if (!strncmp(desc, "distribution-virtual:", 13 + 8)) {
data->isVirtual = vx_true_e;
Expand Down
Loading

0 comments on commit 0a487ad

Please sign in to comment.