Skip to content

Implement source scaling and remedy many crimes against FOV

Tim Starling requested to merge work/tstarling/scaling into main
  • In the view and face commands, if a small output size is requested, scale the input image during decode. This improves performance by a large factor and also improves the image quality, since the interpolation region was not large enough to average out the region mapped to the destination pixel. It's only a maximum factor of 8, but cropping to 90° typically gives you another factor of pi on top of that so it should produce a reasonable result up to a factor of 25 or so. Add caveat to README.md.
  • In extractFace and extractView, don't scale the FOV linearly to derive cartesian bounds, that was very stupid. Use trigonometry.
  • Similarly, when deriving vertical FOV from horizontal FOV and aspect ratio, do not linearly scale. The aspect ratio is a cartesian aspect ratio, not an angular aspect ratio.
  • When calculating the preferred destination width from the source width and FOV, do not linearly scale from the cube face case. The width required to represent the centre of the image without loss of resolution grows asymptotically as the FOV approaches 180°, passing the source image size at 145° and doubling it at 162°. Impose a maximum scaling factor of 2.
  • Add integration test for aspect ratio.

Merge request reports