MosaicOpImage allocates much more objects/arrays/memory than its JAI predecessor.
Sources of allocations:
The image padding made via the Border operation (the getExtendedData operation it was meant to replace it's actually measurably faster...)
In the inner-most loop it's allocating one or more array to keep the current pixel values, instead of creating one outside of the loops
Moreover, the code does the expensive array accesses to get the data before checking if the current data has any validity with alpha and ROI, doing more operations than necessary. First check the "one banded" alpha/ROI, then loop over the N input bands to collect the data, but only if necessary.
Fixing the above makes JAI-EXT image mosaic perform at the same level as the JAI one, at least for the
MosaicOpImage allocates much more objects/arrays/memory than its JAI predecessor. Sources of allocations:
Moreover, the code does the expensive array accesses to get the data before checking if the current data has any validity with alpha and ROI, doing more operations than necessary. First check the "one banded" alpha/ROI, then loop over the N input bands to collect the data, but only if necessary.
Fixing the above makes JAI-EXT image mosaic perform at the same level as the JAI one, at least for the