-
Notifications
You must be signed in to change notification settings - Fork 82
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
Added support for native image decoding #808
base: main
Are you sure you want to change the base?
Conversation
|
||
ASSERT_EQ(out_tensor.Shape(), std::vector<int64_t>({876, 1300, 3})); | ||
auto out_range = out_tensor.Data() + 0; | ||
ASSERT_EQ(std::vector<uint8_t>(out_range, out_range + 12), | ||
std::vector<uint8_t>({48, 14, 5, 48, 14, 5, 48, 14, 5, 48, 14, 5})); | ||
|
||
#if OCOS_ENABLE_VENDOR_IMAGE_CODECS |
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.
The implementation difference results in tiny difference in the decoding result
} | ||
|
||
#if OCOS_ENABLE_VENDOR_IMAGE_CODECS | ||
TEST(ImageDecoderTest, TestTiffDecoder) { |
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.
This is just an example. Many other formats will be supported as long as the OS provides such capability.
shared/api/image_decoder_darwin.hpp
Outdated
optionKeys[0] = kCGImageSourceShouldCache; | ||
optionValues[0] = (CFTypeRef)kCFBooleanFalse; | ||
// Only Integer image data is currently supported | ||
optionKeys[1] = kCGImageSourceShouldAllowFloat; |
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.
Will we add support for float numbe image? I'm not sure about this.
test/data/processor/canoe.tif
Outdated
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.
@@ -71,6 +71,7 @@ option(OCOS_ENABLE_BERT_TOKENIZER "Enable the BertTokenizer building" ON) | |||
option(OCOS_ENABLE_BLINGFIRE "Enable operators depending on the Blingfire library" ON) | |||
option(OCOS_ENABLE_MATH "Enable math tensor operators building" ON) | |||
option(OCOS_ENABLE_DLIB "Enable operators like Inverse depending on DLIB" ON) | |||
option(OCOS_ENABLE_VENDOR_IMAGE_CODECS "Enable and use vendor image codecs if supported over libpng & libjpeg" ON) |
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.
Not sure this should be enabled by default.
return status; | ||
} | ||
|
||
~DecodeImage() { |
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.
Is destructor the correct place to release resources?
To reviewers: I'll be out of office next week. Feel free to modify my branch directly. |
For pre/post processing we use the DecodeImage and EncodeImage operators. Is there a plan to add native encoding as well? |
This added support for native image decoding on Windows & Apple platforms. This helps us remove libpng & libjpeg completely on these platforms, and in the meantime support more image formats thanks to OS vendors,