Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed Optimizations. #38

Merged
merged 14 commits into from
Dec 21, 2024
Merged

Speed Optimizations. #38

merged 14 commits into from
Dec 21, 2024

Conversation

BrianPugh
Copy link
Collaborator

@BrianPugh BrianPugh commented Dec 21, 2024

Contains many macro/micro optimizations. Most notably:

  1. If opencv is installed, will use it for remap instead of using scipy's map_coordinates. The opencv implementation is several times faster. If opencv is used, coordinate calculations are also cached, further speeding it up.
  2. Replace a lot of np.zeros with np.empty.
  3. Remove a lot of unnecessary np.concatenate/np.split.
  4. Pre-allocate buffers instead of performing several concatenations/stacking.
  5. Faster array indexing/ordering.
  6. Reduce calculations to just possible regions of the image they could apply to.

Bug Fixes

  • c2e wasn't returning the proper dtype.

To be fixed bugs

@ProGamerGov I think there's an off-by-one bug in the y-coordinates when sampling equirectangular images (inside the newly created EquirecSampler, previously inside equirec_sample). To be fixed in a follow up PR. If you want to update your repo with similar optimizations, all the changes in this PR are purely for speed (I went through all functions with line-profiler).

@BrianPugh BrianPugh merged commit 28242bf into master Dec 21, 2024
15 checks passed
@BrianPugh BrianPugh deleted the optim branch December 21, 2024 20:54
This was referenced Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant