Allow usage of JPEG image sources w/o AWT, i.e. headless/embedded. libjpeg-turbo (BSD 2clause licensed) http://www.libjpeg-turbo.org/ implements fast jpeg encoding & decoding using SIMD ops (i586, amd64, arm/neon, ..) and also offers a JNI interface to the JVM. We may like to evaluate libjpeg-turbo utilization (and/or migration) to JOGL.
Then .. there is WebP: https://bugzilla.mozilla.org/show_bug.cgi?id=600919 https://developers.google.com/speed/webp/ Then .. there is a way to extract lossy pictures from video streams (ffmpeg, ..) Then we can think of it as simply being not our job while still branching (TextureIO) to AWT's ImageIO and maybe adding a branch for Android .. and libjpeg-turbo if available .. Well, I am open to suggestions ..
WebP (VP8 intra frame), H264 - x264's Jason Garrett-Glaser: http://x264dev.multimedia.cx/archives/541 http://muizelaar.blogspot.de/2011/04/webp.html .. etc etc - then there are new GL [ES3/4.3] IP free texture compression formats. .. to be continued ..
Libjpeg-turbo seems to be good. JPEG support would drive TextureIO (awt free) a viable solution for engines that alreadt heavily rely on NEWT (Ardor3D, JMonkeyEngine 3).
We should take care of the legal aspects too (is JPEG format still patented?).
Original JavaScript code from <https://github.com/notmasteryet/jpgjs/blob/master/jpg.js>, author 'notmasteryet' <async.processingjs at yahoo.com>. Ported to Java. Enhancements: * InputStream instead of memory buffer * User provided memory handler * Fixed JPEG Component ID/Index mapping * Color space conversion (YCCK, CMYK -> RGB) * More error tolerant +++ Features: JOGL AWT RGB ok ok YCCK ok Exception CMYK ok Exception YUV Store ok n/a Need Y-Flip no yes +++ Benchmark: TestJPEGJoglAWTBenchmarkNewtAWT JOGL.RGB Loops 100, dt 1199 ms, 11.99 ms/l JOGL.YUV Loops 100, dt 351 ms, 3.51 ms/l AWT..... Loops 100, dt 2144 ms, 21.44 ms/l File: jogl/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/j1-baseline.jpg Machine: GNU/Linux PC (AMD 8 core), JavaSE 6 (1.6.0_38) .++++ UITestCase.setUp: com.jogamp.opengl.test.junit.jogl.util.texture.TestJPEGJoglAWTBenchmarkNewtAWT - benchmark libEGL warning: DRI2: failed to authenticate 0: JPEGImage[261x202, bytesPerPixel 3, reversedChannels false, JPEGPixels[261x202, sourceComp 3, sourceCS YCbCr, storageCS RGB, storageComp 3], java.nio.DirectByteBuffer[pos=0 lim=158166 cap=158166]] 0: TextureData[261x202, y-flip false, internFormat 0x1907, pixelFormat 0x1907, pixelType 0x1401, border 0, estSize 158166, alignment 1, rowlen 0, buffer java.nio.DirectByteBuffer[pos=0 lim=158166 cap=158166] JOGL.RGB Loops 100, dt 1199 ms, 11.99 ms/l 0: JPEGImage[261x202, bytesPerPixel 3, reversedChannels false, JPEGPixels[261x202, sourceComp 3, sourceCS YCbCr, storageCS YCbCr, storageComp 3], java.nio.DirectByteBuffer[pos=0 lim=158166 cap=158166]] 0: TextureData[261x202, y-flip false, internFormat 0x1907, pixelFormat 0x1907, pixelType 0x1401, border 0, estSize 158166, alignment 1, rowlen 0, buffer java.nio.DirectByteBuffer[pos=0 lim=158166 cap=158166] JOGL.YUV Loops 100, dt 351 ms, 3.51 ms/l 0: TextureData[261x202, y-flip true, internFormat 0x1907, pixelFormat 0x80e0, pixelType 0x1401, border 0, estSize 158166, alignment 1, rowlen 261, buffer java.nio.HeapByteBuffer[pos=0 lim=158166 cap=158166] AWT..... Loops 100, dt 2144 ms, 21.44 ms/l ++++ UITestCase.tearDown: com.jogamp.opengl.test.junit.jogl.util.texture.TestJPEGJoglAWTBenchmarkNewtAWT - benchmark
(In reply to comment #4) > We should take care of the legal aspects too (is JPEG format still > patented?). https://en.wikipedia.org/wiki/Jpg#Patent_issues No!