JPEG Decoder Added

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

JPEG Decoder Added

Sven Gothel
Administrator
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
Reply | Threaded
Open this post in threaded view
|

Re: JPEG Decoder Added

gouessej
Administrator
Hi

I'm going to use it very soon, one of my outdoor environments uses tons of JPEG files and you know I have been trying to remove all dependencies on AWT from my game. Nice job :)

Why must the YUV-RGB color-space conversion be done in a shader?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JPEG Decoder Added

Sven Gothel
Administrator
On 04/01/2013 11:34 AM, gouessej [via jogamp] wrote:
> Hi
>
> I'm going to use it very soon, one of my outdoor environments uses tons of
> JPEG files and you know I have been trying to remove all dependencies on AWT
> from my game. Nice job :)
>
> Why must the YUV-RGB color-space conversion be done in a shader?

I wrote:

> 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)

_option_, you can choose of course, use yuv/rgb conversion in shader
only to benefit from the 4x speedup - if it causes a bottleneck.


~Sven



signature.asc (911 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: JPEG Decoder Added

gouessej
Administrator
Sven Gothel wrote
I wrote:

> 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)

_option_, you can choose of course, use yuv/rgb conversion in shader
only to benefit from the 4x speedup - if it causes a bottleneck.
I just wanted to be sure the use of a GLSL shader wasn't mandatory to support JPEG files using YUV stores.
Julien Gouesse | Personal blog | Website