(x_floor, y_floor, x_fraction)
| 160 | ) |
| 161 | |
| 162 | def coefficients_along_x(x_floor, y_floor, x_fraction): |
| 163 | coefficients = [0] * 4 |
| 164 | |
| 165 | for i in range(4): |
| 166 | y_ = y_floor - 1 + i |
| 167 | x_0 = x_floor - 1 |
| 168 | x_1 = x_floor + 0 |
| 169 | x_2 = x_floor + 1 |
| 170 | x_3 = x_floor + 2 |
| 171 | |
| 172 | if padding_mode == "border": |
| 173 | y_ = _clip_coordinates(y_, in_height) |
| 174 | x_0 = _clip_coordinates(x_0, in_width) |
| 175 | x_1 = _clip_coordinates(x_1, in_width) |
| 176 | x_2 = _clip_coordinates(x_2, in_width) |
| 177 | x_3 = _clip_coordinates(x_3, in_width) |
| 178 | |
| 179 | elif padding_mode == "reflection": |
| 180 | y_ = _reflect_coordinates(y_, in_height) |
| 181 | x_0 = _reflect_coordinates(x_0, in_width) |
| 182 | x_1 = _reflect_coordinates(x_1, in_width) |
| 183 | x_2 = _reflect_coordinates(x_2, in_width) |
| 184 | x_3 = _reflect_coordinates(x_3, in_width) |
| 185 | |
| 186 | y_ = int(_clip_coordinates(y_, in_height)) |
| 187 | x_0 = int(_clip_coordinates(x_0, in_width)) |
| 188 | x_1 = int(_clip_coordinates(x_1, in_width)) |
| 189 | x_2 = int(_clip_coordinates(x_2, in_width)) |
| 190 | x_3 = int(_clip_coordinates(x_3, in_width)) |
| 191 | |
| 192 | coefficients[i] = cubic_interp_1d( |
| 193 | _get_pixel(_b, _c, y_, x_0), |
| 194 | _get_pixel(_b, _c, y_, x_1), |
| 195 | _get_pixel(_b, _c, y_, x_2), |
| 196 | _get_pixel(_b, _c, y_, x_3), |
| 197 | x_fraction, |
| 198 | ) |
| 199 | return coefficients |
| 200 | |
| 201 | for _b in range(batch): |
| 202 | for _c in range(channel): |
no test coverage detected
searching dependent graphs…