-
Notifications
You must be signed in to change notification settings - Fork 374
Rewrite the fns_candy_style_transfer example so that it doesn't depends on libpng on Windows #163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
48bebb3
wic
snnn 32012d1
update
snnn d3e11fb
update
snnn 222674e
a
snnn 0f8522f
update
snnn 12fbf31
update
snnn 21d3f5c
update
snnn 7c67931
update
snnn e215838
update
snnn 491b809
update
snnn 217558c
update
snnn c4bdf97
update
snnn e8e71e5
update
snnn 24a1b76
update
snnn e387939
update
snnn a0ae330
update
snnn 938832d
Merge branch 'main' into snnn/wic
snnn a47c296
update
snnn e247b07
update
snnn bfc934a
Merge branch 'main' into snnn/wic
snnn 317f84f
Merge remote-tracking branch 'origin/main' into snnn/wic
snnn 6ea967c
update
snnn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my understanding is that libpng things (PNG_LIBRARIES, PNG_INCLUDE_DIRS, PNG_LIBDIR) aren't used on windows. perhaps it would be clearer to put them in this block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, You are right.