diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2018-07-03 12:06:23 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:54:10 +0000 |
commit | 12be7ab4876f77fecfab903df70791623219b3da (patch) | |
tree | 1cfa6852e60948bee9db0831a9f3abc97a2031c8 /utils/ImageLoader.h | |
parent | e39334c15c7fd141bb8173d5017ea5ca157fca2c (diff) | |
download | ComputeLibrary-12be7ab4876f77fecfab903df70791623219b3da.tar.gz |
COMPMID-1310: Create graph validation executables.
Change-Id: I9e0b57b1b83fe5a95777cdaeddba6ecef650bafc
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/138697
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Tested-by: Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'utils/ImageLoader.h')
-rw-r--r-- | utils/ImageLoader.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/utils/ImageLoader.h b/utils/ImageLoader.h index edc89286a2..cc9619d3f1 100644 --- a/utils/ImageLoader.h +++ b/utils/ImageLoader.h @@ -486,6 +486,32 @@ private: bool _is_loaded; std::unique_ptr<uint8_t, malloc_deleter> _data; }; + +/** Factory for generating appropriate image loader**/ +class ImageLoaderFactory final +{ +public: + /** Create an image loader depending on the image type + * + * @param[in] filename File than needs to be loaded + * + * @return Image loader + */ + static std::unique_ptr<IImageLoader> create(const std::string &filename) + { + ImageType type = arm_compute::utils::get_image_type_from_file(filename); + switch(type) + { + case ImageType::PPM: + return support::cpp14::make_unique<PPMLoader>(); + case ImageType::JPEG: + return support::cpp14::make_unique<JPEGLoader>(); + case ImageType::UNKNOWN: + default: + return nullptr; + } + } +}; } // namespace utils } // namespace arm_compute #endif /* __UTILS_IMAGE_LOADER_H__*/ |