+ while ((mipmap_width > 1 || mipmap_height > 1) && adjusted_radius * 1.5f > NUM_TAPS / 2) {
+ // Find the next mipmap size (round down, minimum 1 pixel).
+ mipmap_width = std::max(mipmap_width / 2, 1u);
+ mipmap_height = std::max(mipmap_height / 2, 1u);
+
+ // Approximate when mipmap sizes are odd, but good enough.
+ adjusted_radius = radius * float(mipmap_width) / float(input_width);