Skip to content

Commit 91c19be

Browse files
drheadradarhere
andcommitted
add braces
Co-authored-by: Andrew Murray <[email protected]>
1 parent 2f04582 commit 91c19be

File tree

1 file changed

+26
-16
lines changed

1 file changed

+26
-16
lines changed

src/libImaging/Resample.c

+26-16
Original file line numberDiff line numberDiff line change
@@ -82,33 +82,43 @@ lanczos_filter(double x) {
8282
static inline double
8383
mks_2013_filter(double x) {
8484
/* https://johncostella.com/magic/ */
85-
if (x < 0.0)
85+
if (x < 0) {
8686
x = -x;
87-
if (x < 0.5)
88-
return 17.0 / 16.0 - 7.0 / 4.0 * pow(x, 2.0);
89-
if (x < 1.5)
87+
}
88+
if (x < 0.5) {
89+
return 17.0 / 16.0 - 7.0 / 4.0 * pow(x, 2);
90+
}
91+
if (x < 1.5) {
9092
return (1.0 - x) * (7.0 / 4.0 - x);
91-
if (x < 2.5)
92-
return -1.0 / 8.0 * pow(x - 5.0 / 2.0, 2.0);
93-
return (0.0);
93+
}
94+
if (x < 2.5) {
95+
return -1.0 / 8.0 * pow(x - 5.0 / 2.0, 2);
96+
}
97+
return 0;
9498
}
9599

96100
static inline double
97101
mks_2021_filter(double x) {
98102
/* https://johncostella.com/magic/ */
99-
if (x < 0.0)
103+
if (x < 0) {
100104
x = -x;
101-
if (x < 0.5)
102-
return 577.0 / 576.0 - 239.0 / 144.0 * pow(x, 2.0);
103-
if (x < 1.5)
105+
}
106+
if (x < 0.5) {
107+
return 577.0 / 576.0 - 239.0 / 144.0 * pow(x, 2);
108+
}
109+
if (x < 1.5) {
104110
return 35.0 / 36.0 * (x - 1.0) * (x - 239.0 / 140.0);
105-
if (x < 2.5)
111+
}
112+
if (x < 2.5) {
106113
return 1.0 / 6.0 * (x - 2.0) * (65.0 / 24.0 - x);
107-
if (x < 3.5)
114+
}
115+
if (x < 3.5) {
108116
return 1.0 / 36.0 * (x - 3.0) * (x - 15.0 / 4.0);
109-
if (x < 4.5)
110-
return -1.0 / 288.0 * pow(x - 9.0 / 2.0, 2.0);
111-
return (0.0);
117+
}
118+
if (x < 4.5) {
119+
return -1.0 / 288.0 * pow(x - 9.0 / 2.0, 2);
120+
}
121+
return 0;
112122
}
113123

114124
static struct filter BOX = {box_filter, 0.5};

0 commit comments

Comments
 (0)