| 23 | namespace bmf_lite { |
| 24 | |
| 25 | std::shared_ptr<IAlgorithmInterface> |
| 26 | AlgorithmInstance::createAlgorithmInterface(int algorithm_type) { |
| 27 | if (algorithm_type == AlgorithmType::BMF_LITE_ALGORITHM_SUPER_RESOLUTION) { |
| 28 | #ifdef BMF_LITE_ENABLE_SUPER_RESOLUTION |
| 29 | std::shared_ptr<SuperResolutionAlgorithm> instance = |
| 30 | std::make_shared<SuperResolutionAlgorithm>(); |
| 31 | return instance; |
| 32 | #endif |
| 33 | } |
| 34 | |
| 35 | if (algorithm_type == AlgorithmType::BMF_LITE_ALGORITHM_DENOISE) { |
| 36 | #ifdef BMF_LITE_ENABLE_DENOISE |
| 37 | std::shared_ptr<DenoiseAlgorithm> instance = |
| 38 | std::make_shared<DenoiseAlgorithm>(); |
| 39 | return instance; |
| 40 | #endif |
| 41 | } |
| 42 | |
| 43 | if (algorithm_type == AlgorithmType::BMF_LITE_ALGORITHM_CANNY) { |
| 44 | #ifdef BMF_LITE_ENABLE_CANNY |
| 45 | std::shared_ptr<CannyAlgorithm> instance = |
| 46 | std::make_shared<CannyAlgorithm>(); |
| 47 | return instance; |
| 48 | #endif |
| 49 | } |
| 50 | if (algorithm_type == AlgorithmType::BMF_LITE_ALGORITHM_TEX2PIC) { |
| 51 | #ifdef BMF_LITE_ENABLE_TEX_GEN_PIC |
| 52 | std::shared_ptr<QNNControlNetAlgorithm> instance = |
| 53 | std::make_shared<QNNControlNetAlgorithm>(); |
| 54 | return instance; |
| 55 | #endif |
| 56 | } |
| 57 | |
| 58 | IAlgorithmInterface *contrib_algo = |
| 59 | ContribAlgorithmFactory::instance().createAlgorithmInstance( |
| 60 | algorithm_type); |
| 61 | if (contrib_algo != nullptr) { |
| 62 | std::shared_ptr<IAlgorithmInterface> instance(contrib_algo); |
| 63 | return instance; |
| 64 | } |
| 65 | return nullptr; |
| 66 | } |
| 67 | } // namespace bmf_lite |
nothing calls this directly
no test coverage detected