From 12be7ab4876f77fecfab903df70791623219b3da Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Tue, 3 Jul 2018 12:06:23 +0100 Subject: COMPMID-1310: Create graph validation executables. Change-Id: I9e0b57b1b83fe5a95777cdaeddba6ecef650bafc Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/138697 Reviewed-by: Anthony Barbier Tested-by: Jenkins --- utils/ImageLoader.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'utils/ImageLoader.h') 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 _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 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(); + case ImageType::JPEG: + return support::cpp14::make_unique(); + case ImageType::UNKNOWN: + default: + return nullptr; + } + } +}; } // namespace utils } // namespace arm_compute #endif /* __UTILS_IMAGE_LOADER_H__*/ -- cgit v1.2.1