39 #define MAX_PATH_SIZE 512
47 #ifndef ION_HEAP_ID_SYSTEM
48 #define ION_HEAP_ID_SYSTEM 25
50 #define rpcmem_alloc(a, b, c) memalign(VLEN * 2, (c))
54 const Point3I *p_xyz_image_data,
55 uint16_t *p_zdepth_image_data) {
56 if (p_xyz_image_data ==
NULL || p_zdepth_image_data ==
NULL ||
57 n_rows == 0 || n_cols == 0)
60 for (
int i = 0;
i < n_cols * n_rows;
i++) {
61 p_zdepth_image_data[
i] = p_xyz_image_data[
i].
c;
68 FILE *fp = fopen(file_name,
"rb");
70 fseek(fp, 0, SEEK_END);
79 const unsigned char *
p =
NULL;
81 FILE *
f = fopen(filename,
"rb");
84 if (0 == fseek(
f, 0L, SEEK_END)) {
89 RPCMEM_DEFAULT_FLAGS,
size);
91 p = (
unsigned char *)malloc(
size);
94 if (1 != fread((
void *)
p,
size, 1,
f) ||
size == 0) {
95 fprintf(stderr,
"Failed to read data file %s.\n", filename);
102 "Failed to allocate memory for reading data file %s.\n",
106 fprintf(stderr,
"Failed to seek in data file %s.\n", filename);
110 fprintf(stderr,
"Failed to open data file %s.\n", filename);
120 FILE *fp = fopen(file_name,
"wb");
123 size_t n_bytes_written =
142 status = GetModuleFileName(
NULL,
path, path_size);
143 if (status == 0 || status == path_size)
145 char *last_slash = strrchr(
path,
'\\');
146 strncpy(process_path,
path, last_slash -
path + 1);
150 status = readlink(
"/proc/self/exe",
path, path_size);
151 if (status == 0 || status == path_size)
153 char *last_slash = strrchr(
path,
'/');
154 strncpy(process_path,
path, last_slash -
path + 1);
159 uint32_t
Gcd(uint32_t
a, uint32_t
b) {