diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..49dc76a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,53 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) + +#README +# Compile only daisy as a library. +# do not compile the binary because third party libraries are required +# such as png zlib and jpeg + +project(daisy) + +IF (UNIX OR APPLE) + check_symbol_exists(mmap64 "sys/mman.h" HAVE_MMAP64) +ENDIF () + +if(${HAVE_MMAP64}) + message("System has large file support.") + add_definitions(-DHAVE_LARGE_FILE_SUPPORT) +else() + message("System hasn't large file support.") +endif() + +#Detect OpenMP +FIND_PACKAGE(OpenMP) +if (OPENMP_FOUND) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") + option(USE_OPENMP "Use OpenMP for parallelization" ON) + add_definitions(-DUSE_OPENMP) +else(OPENMP_FOUND) + option(USE_OPENMP "Use OpenMP for parallelization" OFF) +endif (OPENMP_FOUND) + +include_directories(include) + +# Make the headers appear in IDEs. +file(GLOB daisy_hdrs include/kutility/*.h include/daisy/*.h) + +set(daisy_srcs + src/daisy.cpp + src/corecv.cpp + src/image_io_bmp.cpp + src/image_io_pnm.cpp + src/image_io_png.cpp + src/image_io_jpeg.cpp + src/image_manipulation.cpp + src/progress_bar.cpp + src/general.cpp + src/interaction.cpp +) + +add_library(daisy ${daisy_srcs} ${daisy_hdrs}) + +ADD_EXECUTABLE(main_daisy src/main.cpp) +TARGET_LINK_LIBRARIES(main_daisy daisy) + diff --git a/include/kutility/convolution.h b/include/kutility/convolution.h index 11ce7c2..db45c94 100644 --- a/include/kutility/convolution.h +++ b/include/kutility/convolution.h @@ -9,28 +9,11 @@ namespace kutility { - inline void convolve_sym( float* image, int h, int w, float* kernel, int ksize, float* out=NULL ) + template + inline void convolve_sym( T* image, int h, int w, T* kernel, int ksize, T* out=NULL ) { if( out == NULL ) out = image; - else memcpy( out, image, sizeof(float)*h*w ); - - if( h == 240 && w == 320 ) { convolve_sym_(out, 240, 320, kernel, ksize); return; } - if( h == 480 && w == 640 ) { convolve_sym_(out, 480, 640, kernel, ksize); return; } - if( h == 512 && w == 512 ) { convolve_sym_(out, 512, 512, kernel, ksize); return; } - if( h == 512 && w == 768 ) { convolve_sym_(out, 512, 768, kernel, ksize); return; } - if( h == 600 && w == 800 ) { convolve_sym_(out, 600, 800, kernel, ksize); return; } - if( h == 768 && w == 1024 ) { convolve_sym_(out, 768, 1024, kernel, ksize); return; } - if( h == 1024 && w == 768 ) { convolve_sym_(out, 1024, 768, kernel, ksize); return; } - if( h == 256 && w == 256 ) { convolve_sym_(out, 256, 256, kernel, ksize); return; } - if( h == 128 && w == 128 ) { convolve_sym_(out, 128, 128, kernel, ksize); return; } - if( h == 128 && w == 192 ) { convolve_sym_(out, 128, 192, kernel, ksize); return; } - cout<<"[convolve_sym] insert this h,w to unrolling list: "< rand_samples(N*2, 0); for( int i=0; iget_descriptor(opy,opx,opo,thor); save( fname, thor, desc->grid_point_number(), histq ); break;