File tree 1 file changed +26
-16
lines changed
1 file changed +26
-16
lines changed Original file line number Diff line number Diff line change @@ -82,33 +82,43 @@ lanczos_filter(double x) {
82
82
static inline double
83
83
mks_2013_filter (double x ) {
84
84
/* https://johncostella.com/magic/ */
85
- if (x < 0.0 )
85
+ if (x < 0 ) {
86
86
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 ) {
90
92
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 ;
94
98
}
95
99
96
100
static inline double
97
101
mks_2021_filter (double x ) {
98
102
/* https://johncostella.com/magic/ */
99
- if (x < 0.0 )
103
+ if (x < 0 ) {
100
104
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 ) {
104
110
return 35.0 / 36.0 * (x - 1.0 ) * (x - 239.0 / 140.0 );
105
- if (x < 2.5 )
111
+ }
112
+ if (x < 2.5 ) {
106
113
return 1.0 / 6.0 * (x - 2.0 ) * (65.0 / 24.0 - x );
107
- if (x < 3.5 )
114
+ }
115
+ if (x < 3.5 ) {
108
116
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 ;
112
122
}
113
123
114
124
static struct filter BOX = {box_filter , 0.5 };
You can’t perform that action at this time.
0 commit comments