forked from ExternalVendorCode/Signal-Server
Add cleanup code to LIDAR resampling
This commit is contained in:
11
inputs.cc
11
inputs.cc
@@ -304,7 +304,6 @@ int loadLIDAR(char *filenames, int resample)
|
|||||||
fprintf(stderr, "Overflow %zu\n",i);
|
fprintf(stderr, "Overflow %zu\n",i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// fprintf(stderr,"dest:%p src:%p\n", dest_addr, src_addr);
|
|
||||||
memcpy( dest_addr, src_addr, tiles[i].width * sizeof(short) );
|
memcpy( dest_addr, src_addr, tiles[i].width * sizeof(short) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -349,6 +348,16 @@ int loadLIDAR(char *filenames, int resample)
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
fprintf(stderr, "fc %d WIDTH %d HEIGHT %d ippd %d minN %.5f maxN %.5f minW %.5f maxW %.5f avgCellsize %.5f\n", fc, width, height, ippd,min_north,max_north,min_west,max_west,avgCellsize);
|
fprintf(stderr, "fc %d WIDTH %d HEIGHT %d ippd %d minN %.5f maxN %.5f minW %.5f maxW %.5f avgCellsize %.5f\n", fc, width, height, ippd,min_north,max_north,min_west,max_west,avgCellsize);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
|
||||||
|
if ( tiles != NULL ) {
|
||||||
|
for (size_t i = 0; i < fc; i++) {
|
||||||
|
tile_destroy(&tiles[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(tiles);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
tiles.cc
10
tiles.cc
@@ -233,3 +233,13 @@ int tile_resize(tile_t* tile, int resolution){
|
|||||||
fprintf(stderr, "Resampling: Current %dm Desired %dm Scale %d\n", current_res, resolution, scaling_factor);
|
fprintf(stderr, "Resampling: Current %dm Desired %dm Scale %d\n", current_res, resolution, scaling_factor);
|
||||||
return tile_rescale(tile, scaling_factor);
|
return tile_rescale(tile, scaling_factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* tile_destroy
|
||||||
|
* This function simply destroys any data associated with a tile
|
||||||
|
*/
|
||||||
|
void tile_destroy(tile_t* tile){
|
||||||
|
if (tile->data != NULL)
|
||||||
|
free(tile->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user