Commit 3c5e4a1e authored by Palani Johnson's avatar Palani Johnson
Browse files

cmake working

parent aedc76c3
Loading
Loading
Loading
Loading

CMakeLists.txt

0 → 100644
+41 −0
Original line number Original line Diff line number Diff line
cmake_minimum_required(VERSION 3.22 FATAL_ERROR)

project(tile-processor-gpu LANGUAGES CUDA CXX)

# get submodules
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
    option(GIT_SUBMODULE "Check submodules during build" ON)
    if(GIT_SUBMODULE)
        message(STATUS "Submodule update")
        execute_process(
            COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
            WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
            RESULT_VARIABLE GIT_SUBMOD_RESULT)
        if(NOT GIT_SUBMOD_RESULT EQUAL "0")
            message(FATAL_ERROR "git submodule update --init --recursive failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
        endif()
    endif()
endif()


if(NOT EXISTS "${PROJECT_SOURCE_DIR}/external/cuda-samples/README.md")
    message(FATAL_ERROR "The submodule cuda-samples was not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.")
endif()

# create the executable
add_executable(${PROJECT_NAME}
    src/test_tp.cu
    src/dtt8x8.cu
    src/dtt8x8.h
    src/geometry_correction.cu
    src/geometry_correction.h
    src/test_tp.cu
    src/TileProcessor.cuh
    src/TileProcessor.h
    src/tp_defines.h)
include_directories(external/cuda-samples/Common)
set_target_properties(${PROJECT_NAME}
    PROPERTIES CUDA_SEPARABLE_COMPILATION ON)

+153 −152
Original line number Original line Diff line number Diff line
@@ -49,6 +49,7 @@
#include <iterator>
#include <iterator>
#include <vector>
#include <vector>


// src includes
#include "TileProcessor.cuh"
#include "TileProcessor.cuh"
#include "dtt8x8.h"
#include "dtt8x8.h"
#include "geometry_correction.h"
#include "geometry_correction.h"
@@ -542,131 +543,131 @@ int main(int argc, char **argv) {


#if TEST_LWIR
#if TEST_LWIR
    const char *kernel_file[] = {
    const char *kernel_file[] = {
        "clt/aux_chn0_transposed.kernel",
        "../../clt/aux_chn0_transposed.kernel",
        "clt/aux_chn1_transposed.kernel",
        "../../clt/aux_chn1_transposed.kernel",
        "clt/aux_chn2_transposed.kernel",
        "../../clt/aux_chn2_transposed.kernel",
        "clt/aux_chn3_transposed.kernel",
        "../../clt/aux_chn3_transposed.kernel",
        "clt/aux_chn4_transposed.kernel",
        "../../clt/aux_chn4_transposed.kernel",
        "clt/aux_chn5_transposed.kernel",
        "../../clt/aux_chn5_transposed.kernel",
        "clt/aux_chn6_transposed.kernel",
        "../../clt/aux_chn6_transposed.kernel",
        "clt/aux_chn7_transposed.kernel",
        "../../clt/aux_chn7_transposed.kernel",
        "clt/aux_chn8_transposed.kernel",
        "../../clt/aux_chn8_transposed.kernel",
        "clt/aux_chn9_transposed.kernel",
        "../../clt/aux_chn9_transposed.kernel",
        "clt/aux_chn10_transposed.kernel",
        "../../clt/aux_chn10_transposed.kernel",
        "clt/aux_chn11_transposed.kernel",
        "../../clt/aux_chn11_transposed.kernel",
        "clt/aux_chn12_transposed.kernel",
        "../../clt/aux_chn12_transposed.kernel",
        "clt/aux_chn13_transposed.kernel",
        "../../clt/aux_chn13_transposed.kernel",
        "clt/aux_chn14_transposed.kernel",
        "../../clt/aux_chn14_transposed.kernel",
        "clt/aux_chn15_transposed.kernel"};
        "../../clt/aux_chn15_transposed.kernel"};


    const char *kernel_offs_file[] = {
    const char *kernel_offs_file[] = {
        "clt/aux_chn0_transposed.kernel_offsets",
        "../../clt/aux_chn0_transposed.kernel_offsets",
        "clt/aux_chn1_transposed.kernel_offsets",
        "../../clt/aux_chn1_transposed.kernel_offsets",
        "clt/aux_chn2_transposed.kernel_offsets",
        "../../clt/aux_chn2_transposed.kernel_offsets",
        "clt/aux_chn3_transposed.kernel_offsets",
        "../../clt/aux_chn3_transposed.kernel_offsets",
        "clt/aux_chn4_transposed.kernel_offsets",
        "../../clt/aux_chn4_transposed.kernel_offsets",
        "clt/aux_chn5_transposed.kernel_offsets",
        "../../clt/aux_chn5_transposed.kernel_offsets",
        "clt/aux_chn6_transposed.kernel_offsets",
        "../../clt/aux_chn6_transposed.kernel_offsets",
        "clt/aux_chn7_transposed.kernel_offsets",
        "../../clt/aux_chn7_transposed.kernel_offsets",
        "clt/aux_chn8_transposed.kernel_offsets",
        "../../clt/aux_chn8_transposed.kernel_offsets",
        "clt/aux_chn9_transposed.kernel_offsets",
        "../../clt/aux_chn9_transposed.kernel_offsets",
        "clt/aux_chn10_transposed.kernel_offsets",
        "../../clt/aux_chn10_transposed.kernel_offsets",
        "clt/aux_chn11_transposed.kernel_offsets",
        "../../clt/aux_chn11_transposed.kernel_offsets",
        "clt/aux_chn12_transposed.kernel_offsets",
        "../../clt/aux_chn12_transposed.kernel_offsets",
        "clt/aux_chn13_transposed.kernel_offsets",
        "../../clt/aux_chn13_transposed.kernel_offsets",
        "clt/aux_chn14_transposed.kernel_offsets",
        "../../clt/aux_chn14_transposed.kernel_offsets",
        "clt/aux_chn15_transposed.kernel_offsets"};
        "../../clt/aux_chn15_transposed.kernel_offsets"};


    const char *image_files[] = {
    const char *image_files[] = {
        "clt/aux_chn0.bayer",
        "../../clt/aux_chn0.bayer",
        "clt/aux_chn1.bayer",
        "../../clt/aux_chn1.bayer",
        "clt/aux_chn2.bayer",
        "../../clt/aux_chn2.bayer",
        "clt/aux_chn3.bayer",
        "../../clt/aux_chn3.bayer",
        "clt/aux_chn4.bayer",
        "../../clt/aux_chn4.bayer",
        "clt/aux_chn5.bayer",
        "../../clt/aux_chn5.bayer",
        "clt/aux_chn6.bayer",
        "../../clt/aux_chn6.bayer",
        "clt/aux_chn7.bayer",
        "../../clt/aux_chn7.bayer",
        "clt/aux_chn8.bayer",
        "../../clt/aux_chn8.bayer",
        "clt/aux_chn9.bayer",
        "../../clt/aux_chn9.bayer",
        "clt/aux_chn10.bayer",
        "../../clt/aux_chn10.bayer",
        "clt/aux_chn11.bayer",
        "../../clt/aux_chn11.bayer",
        "clt/aux_chn12.bayer",
        "../../clt/aux_chn12.bayer",
        "clt/aux_chn13.bayer",
        "../../clt/aux_chn13.bayer",
        "clt/aux_chn14.bayer",
        "../../clt/aux_chn14.bayer",
        "clt/aux_chn15.bayer"};
        "../../clt/aux_chn15.bayer"};


    const char *ports_offs_xy_file[] = {
    const char *ports_offs_xy_file[] = {
        "clt/aux_chn0.portsxy",
        "../../clt/aux_chn0.portsxy",
        "clt/aux_chn1.portsxy",
        "../../clt/aux_chn1.portsxy",
        "clt/aux_chn2.portsxy",
        "../../clt/aux_chn2.portsxy",
        "clt/aux_chn3.portsxy",
        "../../clt/aux_chn3.portsxy",
        "clt/aux_chn4.portsxy",
        "../../clt/aux_chn4.portsxy",
        "clt/aux_chn5.portsxy",
        "../../clt/aux_chn5.portsxy",
        "clt/aux_chn6.portsxy",
        "../../clt/aux_chn6.portsxy",
        "clt/aux_chn7.portsxy",
        "../../clt/aux_chn7.portsxy",
        "clt/aux_chn8.portsxy",
        "../../clt/aux_chn8.portsxy",
        "clt/aux_chn9.portsxy",
        "../../clt/aux_chn9.portsxy",
        "clt/aux_chn10.portsxy",
        "../../clt/aux_chn10.portsxy",
        "clt/aux_chn11.portsxy",
        "../../clt/aux_chn11.portsxy",
        "clt/aux_chn12.portsxy",
        "../../clt/aux_chn12.portsxy",
        "clt/aux_chn13.portsxy",
        "../../clt/aux_chn13.portsxy",
        "clt/aux_chn14.portsxy",
        "../../clt/aux_chn14.portsxy",
        "clt/aux_chn15.portsxy"};
        "../../clt/aux_chn15.portsxy"};


//#ifndef DBG_TILE
//#ifndef DBG_TILE
#ifdef SAVE_CLT
#ifdef SAVE_CLT
    const char *ports_clt_file[] = {// never referenced
    const char *ports_clt_file[] = {// never referenced
                                    "clt/aux_chn0.clt",
                                    "../../clt/aux_chn0.clt",
                                    "clt/aux_chn1.clt",
                                    "../../clt/aux_chn1.clt",
                                    "clt/aux_chn2.clt",
                                    "../../clt/aux_chn2.clt",
                                    "clt/aux_chn3.clt",
                                    "../../clt/aux_chn3.clt",
                                    "clt/aux_chn4.clt",
                                    "../../clt/aux_chn4.clt",
                                    "clt/aux_chn5.clt",
                                    "../../clt/aux_chn5.clt",
                                    "clt/aux_chn6.clt",
                                    "../../clt/aux_chn6.clt",
                                    "clt/aux_chn7.clt",
                                    "../../clt/aux_chn7.clt",
                                    "clt/aux_chn8.clt",
                                    "../../clt/aux_chn8.clt",
                                    "clt/aux_chn9.clt",
                                    "../../clt/aux_chn9.clt",
                                    "clt/aux_chn10.clt",
                                    "../../clt/aux_chn10.clt",
                                    "clt/aux_chn11.clt",
                                    "../../clt/aux_chn11.clt",
                                    "clt/aux_chn12.clt",
                                    "../../clt/aux_chn12.clt",
                                    "clt/aux_chn13.clt",
                                    "../../clt/aux_chn13.clt",
                                    "clt/aux_chn14.clt",
                                    "../../clt/aux_chn14.clt",
                                    "clt/aux_chn15.clt"};
                                    "../../clt/aux_chn15.clt"};


#endif
#endif
    const char *result_rbg_file[] = {
    const char *result_rbg_file[] = {
        "clt/aux_chn0.rbg",
        "../../clt/aux_chn0.rbg",
        "clt/aux_chn1.rbg",
        "../../clt/aux_chn1.rbg",
        "clt/aux_chn2.rbg",
        "../../clt/aux_chn2.rbg",
        "clt/aux_chn3.rbg",
        "../../clt/aux_chn3.rbg",
        "clt/aux_chn4.rbg",
        "../../clt/aux_chn4.rbg",
        "clt/aux_chn5.rbg",
        "../../clt/aux_chn5.rbg",
        "clt/aux_chn6.rbg",
        "../../clt/aux_chn6.rbg",
        "clt/aux_chn7.rbg",
        "../../clt/aux_chn7.rbg",
        "clt/aux_chn8.rbg",
        "../../clt/aux_chn8.rbg",
        "clt/aux_chn9.rbg",
        "../../clt/aux_chn9.rbg",
        "clt/aux_chn10.rbg",
        "../../clt/aux_chn10.rbg",
        "clt/aux_chn11.rbg",
        "../../clt/aux_chn11.rbg",
        "clt/aux_chn12.rbg",
        "../../clt/aux_chn12.rbg",
        "clt/aux_chn13.rbg",
        "../../clt/aux_chn13.rbg",
        "clt/aux_chn14.rbg",
        "../../clt/aux_chn14.rbg",
        "clt/aux_chn15.rbg"};
        "../../clt/aux_chn15.rbg"};
    //#endif
    //#endif
    const char *result_corr_file = "clt/aux_corr.corr";
    const char *result_corr_file = "../../clt/aux_corr.corr";
    const char *result_corr_quad_file = "clt/aux_corr-quad.corr";
    const char *result_corr_quad_file = "../../clt/aux_corr-quad.corr";
    const char *result_corr_td_norm_file = "clt/aux_corr-td-norm.corr";
    const char *result_corr_td_norm_file = "../../clt/aux_corr-td-norm.corr";
    ///    const char* result_corr_cross_file = "clt/aux_corr-cross.corr";
    ///    const char* result_corr_cross_file = "../../clt/aux_corr-cross.corr";
    const char *result_textures_file = "clt/aux_texture_nodp.rgba";
    const char *result_textures_file = "../../clt/aux_texture_nodp.rgba";
    const char *result_diff_rgb_combo_file = "clt/aux_diff_rgb_combo_nodp.drbg";
    const char *result_diff_rgb_combo_file = "../../clt/aux_diff_rgb_combo_nodp.drbg";
    const char *result_textures_rgba_file = "clt/aux_texture_rgba_nodp.rgba";
    const char *result_textures_rgba_file = "../../clt/aux_texture_rgba_nodp.rgba";


    const char *result_textures_file_dp = "clt/aux_texture_dp.rgba";
    const char *result_textures_file_dp = "../../clt/aux_texture_dp.rgba";
    const char *result_diff_rgb_combo_file_dp = "clt/aux_diff_rgb_combo_dp.drbg";
    const char *result_diff_rgb_combo_file_dp = "../../clt/aux_diff_rgb_combo_dp.drbg";
    const char *result_textures_rgba_file_dp = "clt/aux_texture_rgba_dp.rgba";
    const char *result_textures_rgba_file_dp = "../../clt/aux_texture_rgba_dp.rgba";


    const char *rByRDist_file = "clt/aux.rbyrdist";
    const char *rByRDist_file = "../../clt/aux.rbyrdist";
    const char *correction_vector_file = "clt/aux.correction_vector";
    const char *correction_vector_file = "../../clt/aux.correction_vector";
    const char *geometry_correction_file = "clt/aux.geometry_correction";
    const char *geometry_correction_file = "../../clt/aux.geometry_correction";


    float color_weights[] = {
    float color_weights[] = {
        1.0,   // float             weight0,            // scale for R 0.5 / (1.0 + 0.5 +0.2)
        1.0,   // float             weight0,            // scale for R 0.5 / (1.0 + 0.5 +0.2)
@@ -682,56 +683,56 @@ int main(int argc, char **argv) {


#else
#else
    const char *kernel_file[] = {
    const char *kernel_file[] = {
        "clt/main_chn0_transposed.kernel",
        "../../clt/main_chn0_transposed.kernel",
        "clt/main_chn1_transposed.kernel",
        "../../clt/main_chn1_transposed.kernel",
        "clt/main_chn2_transposed.kernel",
        "../../clt/main_chn2_transposed.kernel",
        "clt/main_chn3_transposed.kernel"};
        "../../clt/main_chn3_transposed.kernel"};


    const char *kernel_offs_file[] = {
    const char *kernel_offs_file[] = {
        "clt/main_chn0_transposed.kernel_offsets",
        "../../clt/main_chn0_transposed.kernel_offsets",
        "clt/main_chn1_transposed.kernel_offsets",
        "../../clt/main_chn1_transposed.kernel_offsets",
        "clt/main_chn2_transposed.kernel_offsets",
        "../../clt/main_chn2_transposed.kernel_offsets",
        "clt/main_chn3_transposed.kernel_offsets"};
        "../../clt/main_chn3_transposed.kernel_offsets"};


    const char *image_files[] = {
    const char *image_files[] = {
        "clt/main_chn0.bayer",
        "../../clt/main_chn0.bayer",
        "clt/main_chn1.bayer",
        "../../clt/main_chn1.bayer",
        "clt/main_chn2.bayer",
        "../../clt/main_chn2.bayer",
        "clt/main_chn3.bayer"};
        "../../clt/main_chn3.bayer"};


    const char *ports_offs_xy_file[] = {
    const char *ports_offs_xy_file[] = {
        "clt/main_chn0.portsxy",
        "../../clt/main_chn0.portsxy",
        "clt/main_chn1.portsxy",
        "../../clt/main_chn1.portsxy",
        "clt/main_chn2.portsxy",
        "../../clt/main_chn2.portsxy",
        "clt/main_chn3.portsxy"};
        "../../clt/main_chn3.portsxy"};
#ifdef SAVE_CLT
#ifdef SAVE_CLT
    const char *ports_clt_file[] = {// never referenced
    const char *ports_clt_file[] = {// never referenced
                                    "clt/main_chn0.clt",
                                    "../../clt/main_chn0.clt",
                                    "clt/main_chn1.clt",
                                    "../../clt/main_chn1.clt",
                                    "clt/main_chn2.clt",
                                    "../../clt/main_chn2.clt",
                                    "clt/main_chn3.clt"};
                                    "../../clt/main_chn3.clt"};
#endif
#endif
    const char *result_rbg_file[] = {
    const char *result_rbg_file[] = {
        "clt/main_chn0.rbg",
        "../../clt/main_chn0.rbg",
        "clt/main_chn1.rbg",
        "../../clt/main_chn1.rbg",
        "clt/main_chn2.rbg",
        "../../clt/main_chn2.rbg",
        "clt/main_chn3.rbg"};
        "../../clt/main_chn3.rbg"};
    //#endif
    //#endif
    const char *result_corr_file = "clt/main_corr.corr";
    const char *result_corr_file = "../../clt/main_corr.corr";
    const char *result_corr_quad_file = "clt/main_corr-quad.corr";
    const char *result_corr_quad_file = "../../clt/main_corr-quad.corr";
    const char *result_corr_td_norm_file = "clt/aux_corr-td-norm.corr";
    const char *result_corr_td_norm_file = "../../clt/aux_corr-td-norm.corr";
    ///    const char* result_corr_cross_file = "clt/main_corr-cross.corr";
    ///    const char* result_corr_cross_file = "../../clt/main_corr-cross.corr";
    const char *result_textures_file = "clt/main_texture_nodp.rgba";
    const char *result_textures_file = "../../clt/main_texture_nodp.rgba";
    const char *result_diff_rgb_combo_file = "clt/main_diff_rgb_combo_nodp.drbg";
    const char *result_diff_rgb_combo_file = "../../clt/main_diff_rgb_combo_nodp.drbg";
    const char *result_textures_rgba_file = "clt/main_texture_rgba_nodp.rgba";
    const char *result_textures_rgba_file = "../../clt/main_texture_rgba_nodp.rgba";


    const char *result_textures_file_dp = "clt/main_texture_dp.rgba";
    const char *result_textures_file_dp = "../../clt/main_texture_dp.rgba";
    const char *result_diff_rgb_combo_file_dp = "clt/main_diff_rgb_combo_dp.drbg";
    const char *result_diff_rgb_combo_file_dp = "../../clt/main_diff_rgb_combo_dp.drbg";
    const char *result_textures_rgba_file_dp = "clt/main_texture_rgba_dp.rgba";
    const char *result_textures_rgba_file_dp = "../../clt/main_texture_rgba_dp.rgba";


    const char *rByRDist_file = "clt/main.rbyrdist";
    const char *rByRDist_file = "../../clt/main.rbyrdist";
    const char *correction_vector_file = "clt/main.correction_vector";
    const char *correction_vector_file = "../../clt/main.correction_vector";
    const char *geometry_correction_file = "clt/main.geometry_correction";
    const char *geometry_correction_file = "../../clt/main.geometry_correction";


    float color_weights[] = {
    float color_weights[] = {
        0.294118,   // float             weight0,            // scale for R 0.5 / (1.0 + 0.5 +0.2)
        0.294118,   // float             weight0,            // scale for R 0.5 / (1.0 + 0.5 +0.2)
@@ -1626,8 +1627,8 @@ int main(int argc, char **argv) {
        (corr_size_combo * corr_size_combo) * sizeof(float),
        (corr_size_combo * corr_size_combo) * sizeof(float),
        num_corr_combo,
        num_corr_combo,
        cudaMemcpyDeviceToHost));
        cudaMemcpyDeviceToHost));
    //    const char* result_corr_quad_file =  "clt/main_corr-quad.corr";
    //    const char* result_corr_quad_file =  "../../clt/main_corr-quad.corr";
    //    const char* result_corr_cross_file = "clt/main_corr-cross.corr";
    //    const char* result_corr_cross_file = "../../clt/main_corr-cross.corr";


#ifndef NSAVE_CORR
#ifndef NSAVE_CORR
    printf("Writing phase correlation data to %s\n", result_corr_quad_file);
    printf("Writing phase correlation data to %s\n", result_corr_quad_file);