提交 c97c53ad 编写于 作者: 赵奇可

fix resize bicubic code format

上级 cfe72472
...@@ -33,11 +33,11 @@ namespace kernels { ...@@ -33,11 +33,11 @@ namespace kernels {
static const int64_t kTableSize = (1 << 10); static const int64_t kTableSize = (1 << 10);
inline const float* InitCoeffsTable() { inline const float *InitCoeffsTable() {
// Allocate and initialize coefficients table using Bicubic // Allocate and initialize coefficients table using Bicubic
// convolution algorithm. // convolution algorithm.
// https://en.wikipedia.org/wiki/Bicubic_interpolation // https://en.wikipedia.org/wiki/Bicubic_interpolation
float* coeffs_tab = new float[(kTableSize + 1) * 2]; float *coeffs_tab = new float[(kTableSize + 1) * 2];
static const double A = -0.75; static const double A = -0.75;
for (int i = 0; i <= kTableSize; ++i) { for (int i = 0; i <= kTableSize; ++i) {
float x = i * 1.0 / kTableSize; float x = i * 1.0 / kTableSize;
...@@ -48,9 +48,9 @@ inline const float* InitCoeffsTable() { ...@@ -48,9 +48,9 @@ inline const float* InitCoeffsTable() {
return coeffs_tab; return coeffs_tab;
} }
inline const float* GetCoeffsTable() { inline const float *GetCoeffsTable() {
// Static so that we initialize it on first use // Static so that we initialize it on first use
static const float* coeffs_tab = InitCoeffsTable(); static const float *coeffs_tab = InitCoeffsTable();
return coeffs_tab; return coeffs_tab;
} }
...@@ -73,8 +73,8 @@ inline void GetWeightsAndIndices(float scale, int64_t out_loc, int64_t limit, ...@@ -73,8 +73,8 @@ inline void GetWeightsAndIndices(float scale, int64_t out_loc, int64_t limit,
Bound(in_loc + 1, limit), Bound(in_loc + 2, limit)}; Bound(in_loc + 1, limit), Bound(in_loc + 2, limit)};
} }
inline float Interpolate1D(const std::vector<float>& weights, inline float Interpolate1D(const std::vector<float> &weights,
const std::vector<float>& values) { const std::vector<float> &values) {
return values[0] * weights[0] + values[1] * weights[1] + return values[0] * weights[0] + values[1] * weights[1] +
values[2] * weights[2] + values[3] * weights[3]; values[2] * weights[2] + values[3] * weights[3];
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册