Bug 745

Summary: loading jpeg image causing NullPointerException
Product: [JogAmp] Jogl Reporter: Petr Skramovsky <petr.skramovsky>
Component: openglAssignee: Sven Gothel <sgothel>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: ---    
Version: 2   
Hardware: All   
OS: all   
Type: --- SCM Refs:
jogl a83aea49479818a1e5037d11a3e7f7d1f019c939
Workaround: ---
Attachments: example

Description Petr Skramovsky 2013-06-04 02:48:20 CEST
Created attachment 472 [details]
example

loading attached image via TextureIO causing:
java.lang.NullPointerException
	at jogamp.opengl.util.jpeg.JPEGDecoder$Output.quantizeAndInverse(JPEGDecoder.java:868)
	at jogamp.opengl.util.jpeg.JPEGDecoder$Output.buildComponentData(JPEGDecoder.java:842)
	at jogamp.opengl.util.jpeg.JPEGDecoder$Output.access$200(JPEGDecoder.java:823)
	at jogamp.opengl.util.jpeg.JPEGDecoder.parse(JPEGDecoder.java:722)
	at com.jogamp.opengl.util.texture.spi.JPEGImage.<init>(JPEGImage.java:123)
	at com.jogamp.opengl.util.texture.spi.JPEGImage.read(JPEGImage.java:60)
	at com.jogamp.opengl.util.texture.TextureIO$JPGTextureProvider.newTextureData(TextureIO.java:1195)
	at com.jogamp.opengl.util.texture.TextureIO.newTextureDataImpl(TextureIO.java:873)
	at com.jogamp.opengl.util.texture.TextureIO.newTextureData(TextureIO.java:238)
	at com.jogamp.opengl.util.texture.TextureIO.newTexture(TextureIO.java:498)
Comment 1 Petr Skramovsky 2013-06-04 03:08:03 CEST
debug info:
JPG.parse got marker 0xffe1
JPG.parse got marker 0xffc0
JPG.parse.SOF[02]: Got frame Frame[progressive false, precision 8, scanLines 64, samplesPerLine 256, components[count 3, maxID 3, componentIDs [1, 2, 3], comps [CompIn[h 2, v 1, blocks[8, mcu 8][32, mcu 32][64]], CompIn[h 1, v 1, blocks[8, mcu 8][16, mcu 16][64]], CompIn[h 1, v 1, blocks[8, mcu 8][16, mcu 16][64]]]]]
JPG.parse got marker 0xffdb
JPG.parse got marker 0xffc4
JPG.parse.DHT: Got Huffman CodeLengthTotal 82
JPG.parse got marker 0xffda
JPG.parse.SOS: selectorCount [0..2]: Frame[progressive false, precision 8, scanLines 64, samplesPerLine 256, components[count 3, maxID 3, componentIDs [1, 2, 3], comps [CompIn[h 2, v 1, blocks[8, mcu 8][32, mcu 32][64]], CompIn[h 1, v 1, blocks[8, mcu 8][16, mcu 16][64]], CompIn[h 1, v 1, blocks[8, mcu 8][16, mcu 16][64]]]]]
JPEG.decodeScan.1 resetInterval 128, mcuExpected 128, sA 0, sP 0, sE 63, suc 0, decodeFn BaselineDecoder
JPEG.decodeScan: MCUs 128/128, u16 0xffd9, RSTx false, Frame[progressive false, precision 8, scanLines 64, samplesPerLine 256, components[count 3, maxID 3, componentIDs [1, 2, 3], comps [CompIn[h 2, v 1, blocks[8, mcu 8][32, mcu 32][64]], CompIn[h 1, v 1, blocks[8, mcu 8][16, mcu 16][64]], CompIn[h 1, v 1, blocks[8, mcu 8][16, mcu 16][64]]]]]
JPG.parse.SOS.decode result 0xffd9
JPG.parse.2: End of parsing input JPEG[size 256x64, compOut nil, JFIF nil, EXIF[], Adobe nil]
Comment 2 Sven Gothel 2013-06-14 17:52:45 CEST
Fix - Thank you Petr!

QTT definition shall be allowd to _follow_ SOF (frame) - Reference QTT via QTT[] passed to frame, validate after parsing.