Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions projects/rpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,8 @@ if(CMAKE_BUILD_TYPE MATCHES Debug)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g")
else()
# -O3 -- Optimize output file
# TBD:Verify Requirement -Ofast - Optimize for speed disregarding exact standards compliance
# -DNDEBUG -- turn off asserts
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Ofast -DNDEBUG")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -DNDEBUG")
endif()

# Enable -Wall warnings for both release and debug builds
Expand Down Expand Up @@ -327,6 +326,8 @@ if(NOT DEFINED SIMD_ENABLE)
endif()

add_library(${PROJECT_NAME} SHARED api/rpp.h $<TARGET_OBJECTS:modules>)
# Enable fast-math to replace Ofast
target_compile_options(${PROJECT_NAME} PRIVATE -ffast-math)
if("${SIMD_ENABLE}" STREQUAL "1")
target_compile_definitions(${PROJECT_NAME} PUBLIC ENABLE_SIMD_INTRINSICS=1)
message("-- ${Green}${PROJECT_NAME} set to build with ENABLE_SIMD_INTRINSICS${ColourReset}")
Expand Down
10 changes: 6 additions & 4 deletions projects/rpp/utilities/test_suite/HIP/Tensor_voxel_hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,10 @@ int main(int argc, char* argv[]) {
uint dataSize = niftiHeaderTemp[batchCount].dim[1] *
niftiHeaderTemp[batchCount].dim[2] *
niftiHeaderTemp[batchCount].dim[3];
uchar* niftiDataU8 = (uchar*)malloc(dataSize * sizeof(uchar));
uchar* outputBufferOpenCV = (uchar*)calloc(xyFrameSizeROI, sizeof(uchar));
unsigned char* niftiDataU8 =
(unsigned char*)malloc(dataSize * sizeof(unsigned char));
unsigned char* outputBufferOpenCV =
(unsigned char*)calloc(xyFrameSizeROI, sizeof(unsigned char));

// Convert RpptDataType::F32 strided buffer to default NIFTI_DATATYPE
// unstrided buffer
Expand All @@ -549,9 +551,9 @@ int main(int argc, char* argv[]) {
Rpp32f multiplier = 255.0f / (max - min);
for (int i = 0; i < dataSize; i++)
niftiDataU8[i] =
(uchar)((niftiDataArray[batchCount][i] - min) * multiplier);
(unsigned char)((niftiDataArray[batchCount][i] - min) * multiplier);

uchar* niftiDataU8Temp = niftiDataU8;
unsigned char* niftiDataU8Temp = niftiDataU8;
for (int zPlane = roiGenericSrcPtr[batchCount].xyzwhdROI.xyz.z;
zPlane < roiGenericSrcPtr[batchCount].xyzwhdROI.xyz.z +
roiGenericSrcPtr[batchCount].xyzwhdROI.roiDepth;
Expand Down
10 changes: 6 additions & 4 deletions projects/rpp/utilities/test_suite/HOST/Tensor_voxel_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,10 @@ int main(int argc, char* argv[]) {
uint dataSize = niftiHeaderTemp[batchCount].dim[1] *
niftiHeaderTemp[batchCount].dim[2] *
niftiHeaderTemp[batchCount].dim[3];
uchar* niftiDataU8 = (uchar*)malloc(dataSize * sizeof(uchar));
uchar* outputBufferOpenCV = (uchar*)calloc(xyFrameSizeROI, sizeof(uchar));
unsigned char* niftiDataU8 =
(unsigned char*)malloc(dataSize * sizeof(unsigned char));
unsigned char* outputBufferOpenCV =
(unsigned char*)calloc(xyFrameSizeROI, sizeof(unsigned char));

// Convert RpptDataType::F32 strided buffer to default NIFTI_DATATYPE
// unstrided buffer
Expand All @@ -524,9 +526,9 @@ int main(int argc, char* argv[]) {
Rpp32f multiplier = 255.0f / (max - min);
for (int i = 0; i < dataSize; i++)
niftiDataU8[i] =
(uchar)((niftiDataArray[batchCount][i] - min) * multiplier);
(unsigned char)((niftiDataArray[batchCount][i] - min) * multiplier);

uchar* niftiDataU8Temp = niftiDataU8;
unsigned char* niftiDataU8Temp = niftiDataU8;
for (int zPlane = roiGenericSrcPtr[batchCount].xyzwhdROI.xyz.z;
zPlane < roiGenericSrcPtr[batchCount].xyzwhdROI.xyz.z +
roiGenericSrcPtr[batchCount].xyzwhdROI.roiDepth;
Expand Down
20 changes: 12 additions & 8 deletions projects/rpp/utilities/test_suite/rpp_test_suite_voxel.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,14 +361,16 @@ inline void write_nifti_file(nifti_1_header* niftiHeader, NIFTI_DATATYPE* niftiD
}

#if defined(RPP_TEST_SUITE_HAVE_OPENCV) && RPP_TEST_SUITE_HAVE_OPENCV
inline void write_image_from_nifti_opencv(uchar* niftiDataXYFrameU8, int niftiHeaderImageWidth,
inline void write_image_from_nifti_opencv(unsigned char* niftiDataXYFrameU8,
int niftiHeaderImageWidth,
RpptRoiXyzwhd* roiGenericSrcPtr,
uchar* outputBufferOpenCV, int zPlane, int Channel,
int batchCount, string dst_path, string func, int index) {
unsigned char* outputBufferOpenCV, int zPlane,
int Channel, int batchCount, string dst_path, string func,
int index) {
static int imageCount = 0;
if (imageCount > MAX_IMAGE_DUMP) exit(0);
uchar* outputBufferOpenCVRow = outputBufferOpenCV;
uchar* niftiDataXYFrameU8Row = niftiDataXYFrameU8;
unsigned char* outputBufferOpenCVRow = outputBufferOpenCV;
unsigned char* niftiDataXYFrameU8Row = niftiDataXYFrameU8;
for (int i = 0; i < roiGenericSrcPtr[batchCount].roiHeight; i++) {
memcpy(outputBufferOpenCVRow, niftiDataXYFrameU8Row, roiGenericSrcPtr[batchCount].roiWidth);
outputBufferOpenCVRow += roiGenericSrcPtr[batchCount].roiWidth;
Expand All @@ -384,10 +386,12 @@ inline void write_image_from_nifti_opencv(uchar* niftiDataXYFrameU8, int niftiHe
}
#else
/* OpenCV not linked: slice JPG dumps are disabled; NIfTI QA/compare paths do not use this. */
inline void write_image_from_nifti_opencv(uchar* niftiDataXYFrameU8, int niftiHeaderImageWidth,
inline void write_image_from_nifti_opencv(unsigned char* niftiDataXYFrameU8,
int niftiHeaderImageWidth,
RpptRoiXyzwhd* roiGenericSrcPtr,
uchar* outputBufferOpenCV, int zPlane, int Channel,
int batchCount, string dst_path, string func, int index) {
unsigned char* outputBufferOpenCV, int zPlane,
int Channel, int batchCount, string dst_path, string func,
int index) {
(void)niftiDataXYFrameU8;
(void)niftiHeaderImageWidth;
(void)roiGenericSrcPtr;
Expand Down
Loading