Class HuffmanTablesDirectory.HuffmanTable
- java.lang.Object
-
- com.drew.metadata.jpeg.HuffmanTablesDirectory.HuffmanTable
-
- Enclosing class:
- HuffmanTablesDirectory
public static class HuffmanTablesDirectory.HuffmanTable extends java.lang.Object
An instance of this class holds a JPEG Huffman table.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
HuffmanTablesDirectory.HuffmanTable.HuffmanTableClass
-
Constructor Summary
Constructors Constructor Description HuffmanTable(HuffmanTablesDirectory.HuffmanTable.HuffmanTableClass tableClass, int tableDestinationId, byte[] lengthBytes, byte[] valueBytes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
getLengthBytes()
HuffmanTablesDirectory.HuffmanTable.HuffmanTableClass
getTableClass()
int
getTableDestinationId()
int
getTableLength()
byte[]
getValueBytes()
boolean
isOptimized()
The opposite ofisTypical()
.boolean
isTypical()
Evaluates whether this table is a "typical" Huffman table.
-
-
-
Constructor Detail
-
HuffmanTable
public HuffmanTable(HuffmanTablesDirectory.HuffmanTable.HuffmanTableClass tableClass, int tableDestinationId, byte[] lengthBytes, byte[] valueBytes)
-
-
Method Detail
-
getTableLength
public int getTableLength()
- Returns:
- The table length in bytes.
-
getTableClass
public HuffmanTablesDirectory.HuffmanTable.HuffmanTableClass getTableClass()
- Returns:
- The
HuffmanTablesDirectory.HuffmanTable.HuffmanTableClass
of this table.
-
getTableDestinationId
public int getTableDestinationId()
- Returns:
- the the destination identifier for this table.
-
getLengthBytes
public byte[] getLengthBytes()
- Returns:
- A byte array with the L values for this table.
-
getValueBytes
public byte[] getValueBytes()
- Returns:
- A byte array with the V values for this table.
-
isTypical
public boolean isTypical()
Evaluates whether this table is a "typical" Huffman table."Typical" has a special meaning in this context as the JPEG standard (ISO/IEC 10918 or ITU-T T.81) defines 4 Huffman tables that has been developed from the average statistics of a large set of images with 8-bit precision. Using these instead of calculating the optimal Huffman tables for a given image is faster, and is preferred by many hardware encoders and some hardware decoders.
Even though the JPEG standard doesn't define these as "standard tables" and requires a decoder to be able to read any valid Huffman tables, some are in reality limited decoding images using these "typical" tables. Standards like DCF (Design rule for Camera File system) and DLNA (Digital Living Network Alliance) actually requires any compliant JPEG to use only the "typical" Huffman tables.
This is also related to the term "optimized" JPEG. An "optimized" JPEG is a JPEG that doesn't use the "typical" Huffman tables.
- Returns:
- Whether or not this table is one of the predefined "typical" Huffman tables.
-
isOptimized
public boolean isOptimized()
The opposite ofisTypical()
.- Returns:
- Whether or not this table is "optimized" - which means that it isn't one of the "typical" Huffman tables.
-
-