com.sun.image.codec.jpeg

com.sun.image.codec.jpeg
Class JPEGQTable

java.lang.Object
  |
  +--com.sun.image.codec.jpeg.JPEGQTable

public class JPEGQTable
extends Object

Class to encapsulate the JPEG quantization tables.

Note that the classes in the com.sun.image.codec.jpeg package are not part of the core Java APIs. They are a part of Sun's JDK and JRE distributions. Although other licensees may choose to distribute these classes, developers cannot depend on their availability in non-Sun implementations. We expect that equivalent functionality will eventually be available in a core API or standard extension.


Field Summary
static JPEGQTable StdChrominance
          This is the sample luminance quantization table given in the JPEG spec section K.1, expressed in zigzag order.
static JPEGQTable StdLuminance
          This is the sample luminance quantization table given in the JPEG spec section K.1, expressed in zigzag order.
 
Constructor Summary
JPEGQTable(int[] table)
          Constructs an quantization table from the array that was passed.
 
Method Summary
 JPEGQTable getScaledInstance(float scaleFactor, boolean forceBaseline)
          Returns a new Quantization table where the values are multiplied by scaleFactor and then clamped to the range 1..32767 (or to 1..255 if forceBaseline is 'true').
 int[] getTable()
          Returns the current quantization table as an array of ints in zig zag order.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

StdLuminance

public static final JPEGQTable StdLuminance
This is the sample luminance quantization table given in the JPEG spec section K.1, expressed in zigzag order. The spec says that the values given produce "good" quality, and when divided by 2, "very good" quality.

StdChrominance

public static final JPEGQTable StdChrominance
This is the sample luminance quantization table given in the JPEG spec section K.1, expressed in zigzag order. The spec says that the values given produce "good" quality, and when divided by 2, "very good" quality.
Constructor Detail

JPEGQTable

public JPEGQTable(int[] table)
Constructs an quantization table from the array that was passed. The coefficents must be in zig-zag order. The array must be of length 64.
Parameters:
table - the quantization table (this is copied).
Method Detail

getTable

public int[] getTable()
Returns the current quantization table as an array of ints in zig zag order.
Returns:
A copy of the contained quantization table.

getScaledInstance

public JPEGQTable getScaledInstance(float scaleFactor,
                                    boolean forceBaseline)
Returns a new Quantization table where the values are multiplied by scaleFactor and then clamped to the range 1..32767 (or to 1..255 if forceBaseline is 'true').

Values less than one tend to improve the quality level of the table, and values greater than one degrade the quality level of the table.

Parameters:
scaleFactor - the multiplication factor for the table
forceBaseline - if true the values will be clamped to the range [1 .. 255]
Returns:
A new Q-Table that is a linear multiple of this Q-Table

com.sun.image.codec.jpeg

Submit a bug or feature
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.