diff --git a/image_converter/image_converter.cpp b/image_converter/image_converter.cpp index f0974c2..de6716b 100644 --- a/image_converter/image_converter.cpp +++ b/image_converter/image_converter.cpp @@ -8,7 +8,7 @@ #include #include -#define USE_OCV 1 +#define USE_OCV 0 #if USE_OCV == 1 #include @@ -293,9 +293,9 @@ void visualize_track_bufs2(bit_array track_data0, bit_array track_data1, size_t void stitch_track_auto(disk_image *input_image, bool verbose) { disk_image_base_properties prop = input_image->get_property(); - const size_t search_range_bfr = 512; // search range before the 2nd index hole - const size_t search_range_aft = 512; // search range after the 2nd index hole - const size_t compare_byte_count = 256; // bytes ((IBM(168): Gap4=80, SYNC=12, IAM=4, Gap1=50, Sync=12, IDAM=4, CHRN=4, CRC=2), (ISO(54): Gap1=32, SYNC=12, IDAM=4, CHRN=4, CRC=2)) + const size_t search_range_bfr = 256; // search range before the 2nd index hole + const size_t search_range_aft = 256; // search range after the 2nd index hole + const size_t compare_byte_count = 200; // bytes ((IBM(168): Gap4=80, SYNC=12, IAM=4, Gap1=50, Sync=12, IDAM=4, CHRN=4, CRC=2), (ISO(54): Gap1=32, SYNC=12, IDAM=4, CHRN=4, CRC=2)) const size_t bit_rate_2d = 500e3; const size_t samples_per_byte = (prop.m_sampling_rate/prop.m_data_bit_rate) * 8; @@ -363,8 +363,6 @@ void stitch_track_auto(disk_image *input_image, bool verbose) { } } - std::cout << dist_buf_ref.size() << ", " << dist_buf.size() << std::endl; - if(verbose) { std::cout << "Min error=" << min_error << ", Stitch pos=" << min_offset << ", Top of 2nd spin=" << pos_top_of_2nd_spin < dist_buf.size() * 6) { // reference: when compare_byte_count==180, min_error is around 500~800 when stitching succeeded. + if(verbose) { + std::cout << "*** Calculated error is very large." << std::endl; + } + } #endif tmp_track_data = bit_array{track_data}; track_data.resize(min_offset); // perform track data trimming diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f2c8af5..eeb5c14 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,55 +1,55 @@ -set(TEST_IMAGE_DIR ${CMAKE_SOURCE_DIR}/../fdc_bitstream_test) - - -add_library(testutil util.cpp) -target_include_directories(testutil PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) -target_link_libraries(testutil disk_image) - - - -add_executable(testRaw2d77 raw2d77.cpp) -target_link_libraries(testRaw2d77 disk_image testutil) - -add_test( - NAME TEST_RAW_4MHz_TO_D77 - COMMAND - testRaw2d77 - "${CMAKE_SOURCE_DIR}/test_data/2019FM77AVDemo-4MHz.raw" - "${CMAKE_SOURCE_DIR}/test_data/2019FM77AVDemo.d77" - "${CMAKE_BINARY_DIR}" -) -add_test( - NAME TEST_RAW_8MHz_TO_D77 - COMMAND - testRaw2d77 - "${CMAKE_SOURCE_DIR}/test_data/2019FM77AVDemo-8MHz.raw" - "${CMAKE_SOURCE_DIR}/test_data/2019FM77AVDemo.d77" - "${CMAKE_BINARY_DIR}" -) - - - -add_executable(testFormat format.cpp) -target_link_libraries(testFormat disk_image testutil) -add_test( - NAME TEST_FORMAT - COMMAND - testFormat -) - - - -add_executable(testCompare compare.cpp) -target_link_libraries(testCompare disk_image testutil) - - -file(GLOB RAW_IMAGES "${TEST_IMAGE_DIR}/*.raw") - -foreach(RAW_IMAGE IN LISTS RAW_IMAGES) - get_filename_component(RAW_IMAGE_BASE ${RAW_IMAGE} NAME_WE) - message("FILE=${RAW_IMAGE_BASE}") - add_test( - NAME "COMPARE_${RAW_IMAGE_BASE}" - COMMAND testCompare ${TEST_IMAGE_DIR}/${RAW_IMAGE_BASE}.d77 ${TEST_IMAGE_DIR}/${RAW_IMAGE_BASE}.raw ${TEST_IMAGE_DIR}/${RAW_IMAGE_BASE}.opt - ) # Memo-to-myself: Put D77 first. RAW may have extra broken sector from overlap read. -endforeach() +set(TEST_IMAGE_DIR ${CMAKE_SOURCE_DIR}/../fdc_bitstream_test) + + +add_library(testutil util.cpp) +target_include_directories(testutil PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_link_libraries(testutil disk_image) + + + +add_executable(testRaw2d77 raw2d77.cpp) +target_link_libraries(testRaw2d77 disk_image testutil) + +add_test( + NAME TEST_RAW_4MHz_TO_D77 + COMMAND + testRaw2d77 + "${CMAKE_SOURCE_DIR}/test_data/2019FM77AVDemo-4MHz.raw" + "${CMAKE_SOURCE_DIR}/test_data/2019FM77AVDemo.d77" + "${CMAKE_BINARY_DIR}" +) +add_test( + NAME TEST_RAW_8MHz_TO_D77 + COMMAND + testRaw2d77 + "${CMAKE_SOURCE_DIR}/test_data/2019FM77AVDemo-8MHz.raw" + "${CMAKE_SOURCE_DIR}/test_data/2019FM77AVDemo.d77" + "${CMAKE_BINARY_DIR}" +) + + + +add_executable(testFormat format.cpp) +target_link_libraries(testFormat disk_image testutil) +add_test( + NAME TEST_FORMAT + COMMAND + testFormat +) + + + +add_executable(testCompare compare.cpp) +target_link_libraries(testCompare disk_image testutil) + + +file(GLOB RAW_IMAGES "${TEST_IMAGE_DIR}/*.raw") + +foreach(RAW_IMAGE IN LISTS RAW_IMAGES) + get_filename_component(RAW_IMAGE_BASE ${RAW_IMAGE} NAME_WE) + #message("FILE=${RAW_IMAGE_BASE}") + add_test( + NAME "COMPARE_${RAW_IMAGE_BASE}" + COMMAND testCompare ${TEST_IMAGE_DIR}/${RAW_IMAGE_BASE}.d77 ${TEST_IMAGE_DIR}/${RAW_IMAGE_BASE}.raw ${TEST_IMAGE_DIR}/${RAW_IMAGE_BASE}.opt + ) # Memo-to-myself: Put D77 first. RAW may have extra broken sector from overlap read. +endforeach()