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
|
|
|
|
|
|
|
|
#include "Execution.hpp"
|
2019-05-05 20:27:57 +08:00
|
|
|
#include "AutoStorage.h"
|
2019-04-17 10:49:11 +08:00
|
|
|
|
|
|
|
namespace MNN {
|
|
|
|
|
|
|
|
void CPUResizeCubicC4(halide_buffer_t &input, halide_buffer_t &output);
|
2019-05-05 20:27:57 +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);
|
2019-04-17 10:49:11 +08:00
|
|
|
void CPUReiseNearstneighborC4(halide_buffer_t &input, halide_buffer_t &output, float wScale, float hScale);
|
|
|
|
|
|
|
|
class CPUResize : public Execution {
|
|
|
|
public:
|
|
|
|
CPUResize(Backend *backend, float xScale, float yScale);
|
2019-05-05 20:27:57 +08:00
|
|
|
virtual ~CPUResize();
|
2019-04-17 10:49:11 +08:00
|
|
|
virtual ErrorCode onExecute(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs) override;
|
2019-05-05 20:27:57 +08:00
|
|
|
virtual ErrorCode onResize(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs) override;
|
|
|
|
|
2019-04-17 10:49:11 +08:00
|
|
|
private:
|
2019-05-05 20:27:57 +08:00
|
|
|
Tensor mWidthPosition;
|
|
|
|
Tensor mWidthFactor;
|
|
|
|
Tensor mHeightPosition;
|
|
|
|
Tensor mHeightFactor;
|
|
|
|
Tensor mLineBuffer;
|
2019-04-17 10:49:11 +08:00
|
|
|
float mXScale;
|
|
|
|
float mYScale;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace MNN
|
|
|
|
|
|
|
|
#endif /* CPUResize_hpp */
|