| 341 | |
| 342 | |
| 343 | def apply_antialiasing_if_needed(interp_method, support_sz, scale_factor, |
| 344 | antialiasing): |
| 345 | # antialiasing is "stretching" the field of view according to the scale |
| 346 | # factor (only for downscaling). this is low-pass filtering. this |
| 347 | # requires modifying both the interpolation (stretching the 1d |
| 348 | # function and multiplying by the scale-factor) and the window size. |
| 349 | scale_factor = float(scale_factor) |
| 350 | if scale_factor >= 1.0 or not antialiasing: |
| 351 | return interp_method, support_sz |
| 352 | cur_interp_method = (lambda arg: scale_factor * |
| 353 | interp_method(scale_factor * arg)) |
| 354 | cur_support_sz = support_sz / scale_factor |
| 355 | return cur_interp_method, cur_support_sz |
| 356 | |
| 357 | |
| 358 | def fw_ceil(x, fw): |