-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite the fns_candy_style_transfer example so that it doesn't depen…
…ds on libpng on Windows (#163)
- Loading branch information
Showing
12 changed files
with
290 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
|
||
add_executable(fns_candy_style_transfer "fns_candy_style_transfer.c") | ||
add_executable(fns_candy_style_transfer "fns_candy_style_transfer.c" "image_file.h") | ||
if(WIN32) | ||
target_sources(fns_candy_style_transfer PRIVATE image_file_wic.cc) | ||
else() | ||
target_sources(fns_candy_style_transfer PRIVATE image_file_libpng.c) | ||
endif() | ||
target_include_directories(fns_candy_style_transfer PRIVATE ${PROJECT_SOURCE_DIR}/include ${PNG_INCLUDE_DIRS}) | ||
target_link_libraries(fns_candy_style_transfer PRIVATE onnxruntime ${PNG_LIBRARIES}) | ||
target_link_libraries(fns_candy_style_transfer PRIVATE onnxruntime ${PNG_LIBRARIES} ${WIL_LIB}) | ||
if(PNG_LIBDIR) | ||
target_link_directories(fns_candy_style_transfer PRIVATE ${PNG_LIBDIR}) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#pragma once | ||
#include "onnxruntime_c_api.h" | ||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
/** | ||
* \param out should be freed by caller after use | ||
* \param output_count Array length of the `out` param | ||
*/ | ||
int read_image_file(_In_z_ const ORTCHAR_T* input_file, _Out_ size_t* height, _Out_ size_t* width, _Outptr_ float** out, | ||
_Out_ size_t* output_count); | ||
|
||
|
||
int write_image_file(_In_ uint8_t* model_output_bytes, unsigned int height, | ||
unsigned int width, _In_z_ const ORTCHAR_T* output_file); | ||
|
||
/** | ||
* convert input from HWC format to CHW format | ||
* \param input A single image. The byte array has length of 3*h*w | ||
* \param h image height | ||
* \param w image width | ||
* \param output A float array. should be freed by caller after use | ||
* \param output_count Array length of the `output` param | ||
*/ | ||
void hwc_to_chw(const uint8_t* input, size_t h, size_t w, float** output, size_t* output_count); | ||
#ifdef __cplusplus | ||
} | ||
#endif |
Oops, something went wrong.