2019-04-17 10:49:11 +08:00
|
|
|
//
|
|
|
|
// CPUResize.hpp
|
|
|
|
// MNN
|
|
|
|
//
|
|
|
|
// Created by MNN on 2018/07/17.
|
|
|
|
// Copyright © 2018, Alibaba Group Holding Limited
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef CPUResize_hpp
|
|
|
|
#define CPUResize_hpp
|
|
|
|
|
2019-12-27 22:16:57 +08:00
|
|
|
#include "core/AutoStorage.h"
|
|
|
|
#include "core/Execution.hpp"
|
2019-04-17 10:49:11 +08:00
|
|
|
|
|
|
|
namespace MNN {
|
|
|
|
|
2019-07-19 17:09:09 +08:00
|
|
|
class CPUResizeCommon : public Execution {
|
|
|
|
public:
|
|
|
|
CPUResizeCommon(Backend *backend) : Execution(backend) {
|
2020-11-05 16:41:56 +08:00
|
|
|
// Do nothing
|
2019-07-19 17:09:09 +08:00
|
|
|
}
|
|
|
|
virtual ~CPUResizeCommon() = default;
|
|
|
|
virtual ErrorCode onExecute(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs) = 0;
|
|
|
|
virtual ErrorCode onResize(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs) = 0;
|
|
|
|
|
2020-11-05 16:41:56 +08:00
|
|
|
void CPUResizeCubicC4(halide_buffer_t &input, halide_buffer_t &output, float wScale, float hScale, float wOffset, float hOffset);
|
2019-07-19 17:09:09 +08:00
|
|
|
void CPUResizeBilinearC4(halide_buffer_t &input, halide_buffer_t &output, const int *widthPosition,
|
|
|
|
const float *widthFactor, const int *heightPosition, const float *heightFactor,
|
|
|
|
float *lineBuffer, int threadNumber);
|
2020-11-05 16:41:56 +08:00
|
|
|
void CPUResizeNearestneighborC4(halide_buffer_t &input, halide_buffer_t &output, float wScale, float hScale, float wOffset = 0.f, float hOffset = 0.f);
|
|
|
|
void CPUResizeNearestneighborRoundC4(halide_buffer_t &input, halide_buffer_t &output, float wScale, float hScale, float wOffset = 0.f, float hOffset = 0.f);
|
2019-04-17 10:49:11 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace MNN
|
|
|
|
|
|
|
|
#endif /* CPUResize_hpp */
|