I'm trying to squeeze some more performance out of my rendering pipeline. The (by far) slowest part is performing a java.awt.imaging.LookupOp on a large image.
The image size is about 2048x2048.
I have figured out that having the filter done along with the drawing operation is much faster than calling the filter method. However this still leaves us with lookup ops that take around 250ms (or 4 fps). Does anyone have any rendering tips?
Heres essentially what we are doing:
public void paint(Graphics g)
{
if(recalcLUT)
{
Graphics2D g2d = (Graphics2D) displayImage.getGraphics();
g2d.drawImage(srcImage, lut, 0, 0);
}
Graphics2D g2d = (Graphics2D) g;
g2d.clearRect(0, 0, this.getWidth(), this.getHeight());
AffineTransform at = new AffineTransform();
at.setToIdentity();
at.scale(scale, scale);
g2d.drawImage(displayImage, at, null);
}
the lut variable is a LookupOp usually a ShortLookupOp, the image a 16bit grayscale image
Thanks
I know there are some other obvious performance optimizations that could be done here. But the major problem is just doing the LookupOp operation so im looking for advice with regard to that.
Lookup Ops are essentially where you create an array and instead of rendering each pixel of the image as its color, you use the color as an index into the array and render the color as the value in the index. In this particular example Im using it to do some simple brightness/contrast operations. You can also implement this using a rescaleOp which is essentially a way to apply a linear function to the value of all the pixels. But this turns out to be slower.