Perhaps that "OpaqueCopyAnyToIntArgb" loop is the reason any read of
an image file into an TYPE_INT_RGB takes longer than reading into a
bytearray image.

 BufferedImage bi = new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB);
            irp.setDestination(bi);
            bi = reader.read(0,irp);

The above is much slower than:

BufferedImage bi = reader.read(0,null);
which produces a BI with a DataBufferByte

and this:
BufferedImage bi = new BufferedImage(width,height,BufferedImage.TYPE_INT_ARGB);
            irp.setDestination(bi);
            bi = reader.read(0,irp);

Doesn't work at all. It fails with --

java.lang.IllegalArgumentException: ImageReadParam num source & dest bands 
differ!
        at 
javax.imageio.ImageReader.checkReadParamBandSettings(ImageReader.java:2746)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:907)
        at 
com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:864)
        at pangnomic.PanGnomicImageFetch.makeBufferedImage(Unknown Source)
        at pangnomic.PanGnomicImageFetch.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:595)
Jim Graham wrote:


I grepped for "Blit" and "ByteBinary" and discovered that there are only convert (Blit(XX, SrcNoEa, YY)) loops for 1-bit to ARGB. The thing that surprised me, though, was that it took 4 times longer even despite the workarounds. I quickly ran a trace on copying a 1-bit image to INT_RGB and discovered that it ends up using a loop called "OpaqueCopyAnyToIntArgb" which is a Java loop that uses a couple of method calls per pixel. There are faster ways it could do this, even without creating a specific loop for this case, but it will take a bit of elbow grease as the logic in that part of the system is a little obscure...

            ...jim

===========================================================================
To unsubscribe, send email to lists...@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
lists...@java.sun.com and include in the body of the message "help".


===========================================================================
To unsubscribe, send email to lists...@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
lists...@java.sun.com and include in the body of the message "help".

Reply via email to