Part of overall "improve filtering situation" (#116980): replace
Subsampled3x3 (added for blender 3.5 in f210842a72 et al.) strip
scaling filter with a general Box filter.
Subsampled3x3 is really a Box filter ("average pixel values over NxM
region"), hardcoded to 3x3 size. As such, it works pretty well when
downscaling images by 3x on each axis. But starts to break down
and introduce aliasing at other scaling factors. When scaling up or
scaling down by less than 3x, using total of 9 samples is a bit of
overkill and hurts performance.
So instead, calculate the amount of NxM samples needed by looking
at scaling factors on X/Y axes. Note: use at least 2 samples on each
axis, so that when rotation is present, the result edges will get some
anti-aliasing, just like it was happening in previous filter
implementation.