OpenGL needs a direct ByteBuffer though, so youāll have to copy the byte[]. I do like accessing the byte[] your way better than row by row. Iāve updated my test, but it didnāt make ImageIO faster:
http://n4te.com/temp/Test.java
With the new decoder, it fails to decode your Ken fireball pic and also my test image (bent over next to a plant stake!). I tried it on a third pic (only click if you want to see me drinking frozen lemonade with my nipple
) and it worked. This image is 1280x960. I found it took 211ms to parse. With SWTās decoder it is parsed in 81ms, with ImageIO 85ms to 140ms. Here is my test for the new decoder:
http://n4te.com/temp/Test2.java
HPROF:
1 64.90% 64.90% 1407 300051 JPEGDecoder2.ScaleIDCT
2 17.76% 82.66% 385 300053 JPEGDecoder2.output
3 8.63% 91.28% 187 300052 JPEGDecoder2.output
I think the IDCT is not as advanced as SWTās, which seems to do some checks and shortcut if possible. I probably wonāt pursue the new decoder further since it seem to be slower and has an unfriendly license. I am impressed with its conciseness though!
I tried Sunās decoder. I can get it to decode once, but the second time around it fails. This makes little sense to me! Here is the test:
http://n4te.com/temp/Test3.java