[codex] Speed up ImageLayer reprojection assembly#2978
Draft
jasonbeverage wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This speeds up
ImageLayer::assembleImagewhen assembling imagery across coordinate systems by reducing how many output pixels need full coordinate reprojection before sampling source images.For Mercator/geographic pairs, the transform is separable, so the code now transforms the horizontal axis endpoints and one vertical sample per row, then fills the output coordinate grid from those values. Other non-equivalent SRS pairs use a small interpolation mesh instead of per-pixel coordinate transforms, with exact fallback when interpolation is not appropriate or when a transform fails.
Coverage layers no longer force the exact coordinate-transform path; coverage behavior remains controlled by nearest-neighbor pixel sampling.
Validation
build.batcmd /c "call osgearth_shell.bat && cd tests && osgearth_tests"33105 assertions in 33 test casescmd /c "call osgearth_shell.bat && cd tests && osgearth_benchmarks --benchmark_filter=ImageLayerAssembleImage_Reproject --benchmark_min_time=0.5s"6.67 msreal /6.77 msCPU2.13 msreal /2.10 msCPUNotes
Added a focused benchmark for reprojection assembly and a regression test comparing the optimized path against exact per-pixel coordinate transforms for both imagery and coverage sampling.