geosolutions-it / jai-ext

Java Advanced Imaging Open Source Replacement Wannabe
Apache License 2.0
90 stars 38 forks source link

Warp's ROI intersects check is very expensive with big images (getData) #231

Closed dromagnoli closed 5 years ago

dromagnoli commented 5 years ago

The WarpOpImage does an "optimization" check to see if the requested rectangle intersects the provided roi. If there is no interesection it will return a background fill for all the requested rectangle.

The problem with that optimization is that if the image (so roi) is big and the roi is not a ROIShape/ROIGeometry, a piece of code in the oracle's ROI.java class will do an ugly getData which may be overkill (loading everything in memory and consuming a lot of time).
In that case, skipping that check and have the Warp do the standard compute rect will perform way better.