DescriptionThis change adds setOptimizeHuffmanTables(true) to the Jpeg params. (gives additional 6% of compression without any addition loss in the image quality)
Since the generalized call for ImageIOOutputter.write(new IIOImage()) has a bug, that ignores this parameter while enocding, we are using more specific call for writing for jpeg images that respects this new parameter.
Refer: com.sun.imageio.plugins.jpeg.JPEGImageWriter.java:352 write(...) function.
Refactored PNGOptimizer.java to remove some redundant code.
Note: The old flow also has a hidden bug that sets wrong 'Default Quantization Tables' while doing jpeg compression with 'ImageWriteParam.MODE_EXPLICIT' that results in encode phase of jpeg effectively use different compression quality (> than config.getJpegCompression()). This bug fix effectively gives +4% more compression in bytes.
Refer: (http://www.java2s.com/Open-Source/Java-Document/6.0-JDK-Modules-com.sun/imageio/com.sun.imageio.plugins.jpeg.htm)
BaseOptimizer.java:172 in writer.getDefaultImageMetadata(...) --->
com.sun.imageio.plugins.jpeg.JPEGImageWriter.java:609 ---> com.sun.imageio.plugins.jpeg.DQTMarkerSegment.java:215 in Qtable(boolean wantLuma, float quality) function, K2Div2Chrominance is used instead of K2Chrominance.
Patch Set 1 #
Total comments: 6
Patch Set 2 : Addressing the comments. #Patch Set 3 : Upadated a small condition #
Total comments: 4
Patch Set 4 : Added huffman optimization as a configurable through shindig properties #Patch Set 5 : sync to head(r1006167) #
Total comments: 8
Patch Set 6 : Addressing the comments. #
Total comments: 2
Patch Set 7 : Addressing the comments. #Patch Set 8 : sync to head(r1024129) #
MessagesTotal messages: 19
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||