Skip to content

Commit

Permalink
fix parse url and add intermidiate port index access
Browse files Browse the repository at this point in the history
  • Loading branch information
xinyuli1204 committed Nov 30, 2023
1 parent b6b1c63 commit 65b66d9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
29 changes: 16 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ if (WITH_CUDA)
find_package(CUDA REQUIRED)
endif()





#
# Version
#
Expand Down Expand Up @@ -73,28 +77,27 @@ else()
target_link_libraries(ion-core PUBLIC Halide::Halide Halide::Runtime)
endif()


#
# SSL support to download image from url
#
if(OPENSSL_FOUND)
if (UNIX)
target_link_libraries(ion-core PUBLIC ssl crypto)
target_compile_definitions(ion-core PUBLIC CPPHTTPLIB_OPENSSL_SUPPORT)
endif()
endif()

#
# ion-bb
#
add_subdirectory(src/bb)


#
# Test
#
if (ION_BUILD_TEST)
find_package(OpenSSL REQUIRED)
if(OPENSSL_FOUND)
set(HTTPLIB_IS_USING_OPENSSL TRUE)
endif()
if (UNIX)
target_link_libraries(ion-core PUBLIC
$<$<BOOL:${HTTPLIB_IS_USING_OPENSSL}>:OpenSSL::SSL>
$<$<BOOL:${HTTPLIB_IS_USING_OPENSSL}>:OpenSSL::Crypto>)

target_compile_definitions(ion-core PUBLIC
$<$<BOOL:${HTTPLIB_IS_USING_OPENSSL}>:CPPHTTPLIB_OPENSSL_SUPPORT>
)
endif()
enable_testing()
add_subdirectory(test)
endif()
Expand Down
1 change: 0 additions & 1 deletion example/demo.json

This file was deleted.

1 change: 1 addition & 0 deletions src/bb/image-io/rt_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ namespace ion {
img_loaded = true;
}
} else {
//for https url, httplib::Client throw exception (what(): 'https' scheme is not supported.). need SSL support instead
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
httplib::SSLClient cli(host_name.c_str());
#else
Expand Down
6 changes: 3 additions & 3 deletions test/port-access.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ void display_image_float(Halide::Buffer<float> buffer, std::string filename) {
img_float.convertTo(img_out, CV_8U, 255);
}

cv::imshow( "Display window: " + filename, img_out);
// cv::imwrite("./saved.png", img_out);
// cv::imshow( "Display window: " + filename, img_out);
cv::imwrite("./saved.png", img_out);
}


Expand Down Expand Up @@ -56,7 +56,7 @@ int main(int argc, char *argv[]) {
Param{"urls", "http://optipng.sourceforge.net/pngtech/img/lena.png;https://upload.wikimedia.org/wikipedia/commons/0/05/Cat.png"}
//input urls split by ';'
);
n = b.add("base_normalize_3d_uint8")(n["output"][0]); // access only port[1]
n = b.add("base_normalize_3d_uint8")(n["output"][1]); // access only port[1]
n = b.add("image_processing_resize_nearest_3d")(n["output"]).set_param(
Param{"width", std::to_string(width)},
Param{"height", std::to_string(height)},
Expand Down

0 comments on commit 65b66d9

Please sign in to comment.