From 979f6cc0326fece2df944402f34c5bb871af092a Mon Sep 17 00:00:00 2001 From: Daniil Kazantsev Date: Sun, 29 Sep 2019 19:29:22 +0100 Subject: bilinear interpolation rescaling --- src/Core/regularisers_CPU/utils.c | 143 ++++++++++++++--------- src/Core/regularisers_CPU/utils.h | 2 + src/Matlab/mex_compile/supp_routines/Imscale2D.c | 50 ++++++++ 3 files changed, 138 insertions(+), 57 deletions(-) create mode 100644 src/Matlab/mex_compile/supp_routines/Imscale2D.c diff --git a/src/Core/regularisers_CPU/utils.c b/src/Core/regularisers_CPU/utils.c index 7a4e80b..3a7ed25 100644 --- a/src/Core/regularisers_CPU/utils.c +++ b/src/Core/regularisers_CPU/utils.c @@ -1,21 +1,21 @@ /* -This work is part of the Core Imaging Library developed by -Visual Analytics and Imaging System Group of the Science Technology -Facilities Council, STFC - -Copyright 2017 Daniil Kazanteev -Copyright 2017 Srikanth Nagella, Edoardo Pasca - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at -http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ + * This work is part of the Core Imaging Library developed by + * Visual Analytics and Imaging System Group of the Science Technology + * Facilities Council, STFC + * + * Copyright 2017 Daniil Kazanteev + * Copyright 2017 Srikanth Nagella, Edoardo Pasca + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include "utils.h" #include @@ -23,19 +23,19 @@ limitations under the License. /* Copy Image (float) */ float copyIm(float *A, float *U, long dimX, long dimY, long dimZ) { - long j; + long j; #pragma omp parallel for shared(A, U) private(j) - for (j = 0; j Date: Mon, 30 Sep 2019 09:14:11 +0100 Subject: loop init fix --- src/Core/regularisers_CPU/utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Core/regularisers_CPU/utils.c b/src/Core/regularisers_CPU/utils.c index 3a7ed25..5bb3a5c 100644 --- a/src/Core/regularisers_CPU/utils.c +++ b/src/Core/regularisers_CPU/utils.c @@ -119,13 +119,13 @@ float TV_energy3D(float *U, float *U0, float *E_val, float lambda, int type, int /* Down-Up scaling of 2D images using bilinear interpolation */ float Im_scale2D(float *Input, float *Scaled, int w, int h, int w2, int h2) { - int x, y, index; + int x, y, index, i, j; float x_ratio = ((float)(w-1))/w2; float y_ratio = ((float)(h-1))/h2; float A, B, C, D, x_diff, y_diff, gray; #pragma omp parallel for shared (Input, Scaled) private(x, y, index, A, B, C, D, x_diff, y_diff, gray) - for (int j=0;j