// // ImagePool.hpp // MNN // // Created by MNN on 2019/02/28. // Copyright © 2018, Alibaba Group Holding Limited // #ifndef ImagePool_hpp #define ImagePool_hpp #include #include #include "core/NonCopyable.hpp" #include "backend/opencl/core/runtime/OpenCLWrapper.hpp" namespace MNN { namespace OpenCL { class ImagePool : public NonCopyable { public: ImagePool(cl::Context& context) : mContext(context) { } cl::Image* alloc(int w, int h, cl_channel_type type, bool separate = false); void recycle(cl::Image* image, bool release = false); void clear(); void releaseFreeList(); struct Node { int w; int h; cl_channel_type type; std::shared_ptr image; }; private: std::map> mAllImage; std::list> mFreeList; cl::Context& mContext; }; } // namespace OpenCL } // namespace MNN #endif /* ImagePool_hpp */