Login  Register

JPEG Decoder Added

Posted by Sven Gothel on Apr 01, 2013; 3:38am
URL: https://forum.jogamp.org/JPEG-Decoder-Added-tp4028870.html

This one is now used by default, so you may want to test it.

I have tested a few color profiles and JPEG profiles,
so far this beats AWT's decoder.

Note the YUV storage options (4x faster) would require you
to perform the YUV->RGB color-space conversion in the GLSL shader.
(One is available in our FFMPeg GLMediaPlayer class)

Cheers, Sven

commit a54bd3e963a7be320dee0c9692d237607fcd0f96
Author: Sven Gothel
Date:   Mon Apr 1 05:16:35 2013 +0200

    Fix Bug 671: Add JPEG Decoder w/o AWT Dependencies
   
    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



signature.asc (911 bytes) Download Attachment