From c97c53ad2f5f652413c5d4efbb0de70fbd190582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=A5=87=E5=8F=AF?= Date: Fri, 7 Sep 2018 13:59:06 +0800 Subject: [PATCH] fix resize bicubic code format --- mace/kernels/resize_bicubic.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/mace/kernels/resize_bicubic.h b/mace/kernels/resize_bicubic.h index f4fd2914..72458041 100644 --- a/mace/kernels/resize_bicubic.h +++ b/mace/kernels/resize_bicubic.h @@ -33,11 +33,11 @@ namespace kernels { static const int64_t kTableSize = (1 << 10); -inline const float* InitCoeffsTable() { +inline const float *InitCoeffsTable() { // Allocate and initialize coefficients table using Bicubic // convolution algorithm. // 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; for (int i = 0; i <= kTableSize; ++i) { float x = i * 1.0 / kTableSize; @@ -48,9 +48,9 @@ inline const float* InitCoeffsTable() { return coeffs_tab; } -inline const float* GetCoeffsTable() { +inline const float *GetCoeffsTable() { // Static so that we initialize it on first use - static const float* coeffs_tab = InitCoeffsTable(); + static const float *coeffs_tab = InitCoeffsTable(); return coeffs_tab; } @@ -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)}; } -inline float Interpolate1D(const std::vector& weights, - const std::vector& values) { +inline float Interpolate1D(const std::vector &weights, + const std::vector &values) { return values[0] * weights[0] + values[1] * weights[1] + values[2] * weights[2] + values[3] * weights[3]; } @@ -88,15 +88,15 @@ inline float CalculateResizeScale(index_t in_size, } inline void ResizeImage(const float *images, - const index_t batch_size, - const index_t in_height, - const index_t in_width, - const index_t out_height, - const index_t out_width, - const index_t channels, - const float height_scale, - const float width_scale, - float *output) { + const index_t batch_size, + const index_t in_height, + const index_t in_width, + const index_t out_height, + const index_t out_width, + const index_t channels, + const float height_scale, + const float width_scale, + float *output) { #pragma omp parallel for collapse(2) for (index_t b = 0; b < batch_size; ++b) { for (index_t y = 0; y < out_height; ++y) { -- GitLab