Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-03-27 05:16:10 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-03-27 05:17:30 +0300
commit9ba948a4859da3308033fa6dc54f74433d7e6a21 (patch)
tree0bd6e95eb59d9af03aa32d925c68e1cbebecc246 /source/blender/blenlib/intern/math_interp.c
parent337eb8c1de4c57c34520b467d79779153335eecb (diff)
Cleanup: style, use braces for blenlib
Diffstat (limited to 'source/blender/blenlib/intern/math_interp.c')
-rw-r--r--source/blender/blenlib/intern/math_interp.c104
1 files changed, 76 insertions, 28 deletions
diff --git a/source/blender/blenlib/intern/math_interp.c b/source/blender/blenlib/intern/math_interp.c
index 5b3f6349703..ed2b48f6e62 100644
--- a/source/blender/blenlib/intern/math_interp.c
+++ b/source/blender/blenlib/intern/math_interp.c
@@ -273,8 +273,12 @@ BLI_INLINE void bilinear_interpolation(const unsigned char *byte_buffer, const f
/* pixel value must be already wrapped, however values at boundaries may flip */
if (wrap_x) {
- if (x1 < 0) x1 = width - 1;
- if (x2 >= width) x2 = 0;
+ if (x1 < 0) {
+ x1 = width - 1;
+ }
+ if (x2 >= width) {
+ x2 = 0;
+ }
}
else if (x2 < 0 || x1 >= width) {
copy_vn_fl(float_output, components, 0.0f);
@@ -282,8 +286,12 @@ BLI_INLINE void bilinear_interpolation(const unsigned char *byte_buffer, const f
}
if (wrap_y) {
- if (y1 < 0) y1 = height - 1;
- if (y2 >= height) y2 = 0;
+ if (y1 < 0) {
+ y1 = height - 1;
+ }
+ if (y2 >= height) {
+ y2 = 0;
+ }
}
else if (y2 < 0 || y1 >= height) {
copy_vn_fl(float_output, components, 0.0f);
@@ -291,17 +299,33 @@ BLI_INLINE void bilinear_interpolation(const unsigned char *byte_buffer, const f
}
/* sample including outside of edges of image */
- if (x1 < 0 || y1 < 0) row1 = empty;
- else row1 = float_buffer + width * y1 * components + components * x1;
+ if (x1 < 0 || y1 < 0) {
+ row1 = empty;
+ }
+ else {
+ row1 = float_buffer + width * y1 * components + components * x1;
+ }
- if (x1 < 0 || y2 > height - 1) row2 = empty;
- else row2 = float_buffer + width * y2 * components + components * x1;
+ if (x1 < 0 || y2 > height - 1) {
+ row2 = empty;
+ }
+ else {
+ row2 = float_buffer + width * y2 * components + components * x1;
+ }
- if (x2 > width - 1 || y1 < 0) row3 = empty;
- else row3 = float_buffer + width * y1 * components + components * x2;
+ if (x2 > width - 1 || y1 < 0) {
+ row3 = empty;
+ }
+ else {
+ row3 = float_buffer + width * y1 * components + components * x2;
+ }
- if (x2 > width - 1 || y2 > height - 1) row4 = empty;
- else row4 = float_buffer + width * y2 * components + components * x2;
+ if (x2 > width - 1 || y2 > height - 1) {
+ row4 = empty;
+ }
+ else {
+ row4 = float_buffer + width * y2 * components + components * x2;
+ }
a = u - floorf(u);
b = v - floorf(v);
@@ -328,8 +352,12 @@ BLI_INLINE void bilinear_interpolation(const unsigned char *byte_buffer, const f
/* pixel value must be already wrapped, however values at boundaries may flip */
if (wrap_x) {
- if (x1 < 0) x1 = width - 1;
- if (x2 >= width) x2 = 0;
+ if (x1 < 0) {
+ x1 = width - 1;
+ }
+ if (x2 >= width) {
+ x2 = 0;
+ }
}
else if (x2 < 0 || x1 >= width) {
copy_vn_uchar(byte_output, components, 0);
@@ -337,8 +365,12 @@ BLI_INLINE void bilinear_interpolation(const unsigned char *byte_buffer, const f
}
if (wrap_y) {
- if (y1 < 0) y1 = height - 1;
- if (y2 >= height) y2 = 0;
+ if (y1 < 0) {
+ y1 = height - 1;
+ }
+ if (y2 >= height) {
+ y2 = 0;
+ }
}
else if (y2 < 0 || y1 >= height) {
copy_vn_uchar(byte_output, components, 0);
@@ -346,17 +378,33 @@ BLI_INLINE void bilinear_interpolation(const unsigned char *byte_buffer, const f
}
/* sample including outside of edges of image */
- if (x1 < 0 || y1 < 0) row1 = empty;
- else row1 = byte_buffer + width * y1 * components + components * x1;
+ if (x1 < 0 || y1 < 0) {
+ row1 = empty;
+ }
+ else {
+ row1 = byte_buffer + width * y1 * components + components * x1;
+ }
- if (x1 < 0 || y2 > height - 1) row2 = empty;
- else row2 = byte_buffer + width * y2 * components + components * x1;
+ if (x1 < 0 || y2 > height - 1) {
+ row2 = empty;
+ }
+ else {
+ row2 = byte_buffer + width * y2 * components + components * x1;
+ }
- if (x2 > width - 1 || y1 < 0) row3 = empty;
- else row3 = byte_buffer + width * y1 * components + components * x2;
+ if (x2 > width - 1 || y1 < 0) {
+ row3 = empty;
+ }
+ else {
+ row3 = byte_buffer + width * y1 * components + components * x2;
+ }
- if (x2 > width - 1 || y2 > height - 1) row4 = empty;
- else row4 = byte_buffer + width * y2 * components + components * x2;
+ if (x2 > width - 1 || y2 > height - 1) {
+ row4 = empty;
+ }
+ else {
+ row4 = byte_buffer + width * y2 * components + components * x2;
+ }
a = u - floorf(u);
b = v - floorf(v);
@@ -548,10 +596,10 @@ void BLI_ewa_filter(const int width, const int height,
/* note: if eccentricity gets clamped (see above),
* the ue/ve limits can also be lowered accordingly
*/
- if (U0 - (float)u1 > EWA_MAXIDX) u1 = (int)U0 - EWA_MAXIDX;
- if ((float)u2 - U0 > EWA_MAXIDX) u2 = (int)U0 + EWA_MAXIDX;
- if (V0 - (float)v1 > EWA_MAXIDX) v1 = (int)V0 - EWA_MAXIDX;
- if ((float)v2 - V0 > EWA_MAXIDX) v2 = (int)V0 + EWA_MAXIDX;
+ if (U0 - (float)u1 > EWA_MAXIDX) { u1 = (int)U0 - EWA_MAXIDX; }
+ if ((float)u2 - U0 > EWA_MAXIDX) { u2 = (int)U0 + EWA_MAXIDX; }
+ if (V0 - (float)v1 > EWA_MAXIDX) { v1 = (int)V0 - EWA_MAXIDX; }
+ if ((float)v2 - V0 > EWA_MAXIDX) { v2 = (int)V0 + EWA_MAXIDX; }
/* Early output check for cases the whole region is outside of the buffer. */
if ((u2 < 0 || u1 >= width) || (v2 < 0 || v1 >= height)) {