public class HuffmanTablesDirectory extends Directory
Modifier and Type | Class and Description |
---|---|
static class |
HuffmanTablesDirectory.HuffmanTable
An instance of this class holds a JPEG Huffman table.
|
Modifier and Type | Field and Description |
---|---|
protected static java.util.HashMap<java.lang.Integer,java.lang.String> |
_tagNameMap |
protected java.util.List<HuffmanTablesDirectory.HuffmanTable> |
tables |
static int |
TAG_NUMBER_OF_TABLES |
protected static byte[] |
TYPICAL_CHROMINANCE_AC_LENGTHS |
protected static byte[] |
TYPICAL_CHROMINANCE_AC_VALUES |
protected static byte[] |
TYPICAL_CHROMINANCE_DC_LENGTHS |
protected static byte[] |
TYPICAL_CHROMINANCE_DC_VALUES |
protected static byte[] |
TYPICAL_LUMINANCE_AC_LENGTHS |
protected static byte[] |
TYPICAL_LUMINANCE_AC_VALUES |
protected static byte[] |
TYPICAL_LUMINANCE_DC_LENGTHS |
protected static byte[] |
TYPICAL_LUMINANCE_DC_VALUES |
_definedTagList, _descriptor, _tagMap
Constructor and Description |
---|
HuffmanTablesDirectory() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getName()
Provides the name of the directory, for display purposes.
|
int |
getNumberOfTables() |
HuffmanTablesDirectory.HuffmanTable |
getTable(int tableNumber) |
protected java.util.List<HuffmanTablesDirectory.HuffmanTable> |
getTables() |
protected java.util.HashMap<java.lang.Integer,java.lang.String> |
getTagNameMap()
Provides the map of tag names, hashed by tag type identifier.
|
boolean |
isOptimized()
The opposite of
isTypical() . |
boolean |
isTypical()
Evaluates whether all the tables in this
HuffmanTablesDirectory
are "typical" Huffman tables. |
addError, containsTag, getBoolean, getBooleanObject, getByteArray, getDate, getDate, getDate, getDescription, getDouble, getDoubleObject, getErrorCount, getErrors, getFloat, getFloatObject, getInt, getIntArray, getInteger, getLong, getLongObject, getObject, getParent, getRational, getRationalArray, getString, getString, getStringArray, getStringValue, getStringValueArray, getTagCount, getTagName, getTags, hasErrors, hasTagName, isEmpty, setBoolean, setByteArray, setDate, setDescriptor, setDouble, setDoubleArray, setFloat, setFloatArray, setInt, setIntArray, setLong, setObject, setObjectArray, setParent, setRational, setRationalArray, setString, setStringArray, setStringValue, setStringValueArray, toString
public static final int TAG_NUMBER_OF_TABLES
protected static final byte[] TYPICAL_LUMINANCE_DC_LENGTHS
protected static final byte[] TYPICAL_LUMINANCE_DC_VALUES
protected static final byte[] TYPICAL_CHROMINANCE_DC_LENGTHS
protected static final byte[] TYPICAL_CHROMINANCE_DC_VALUES
protected static final byte[] TYPICAL_LUMINANCE_AC_LENGTHS
protected static final byte[] TYPICAL_LUMINANCE_AC_VALUES
protected static final byte[] TYPICAL_CHROMINANCE_AC_LENGTHS
protected static final byte[] TYPICAL_CHROMINANCE_AC_VALUES
protected final java.util.List<HuffmanTablesDirectory.HuffmanTable> tables
protected static final java.util.HashMap<java.lang.Integer,java.lang.String> _tagNameMap
public java.lang.String getName()
Directory
Exif
protected java.util.HashMap<java.lang.Integer,java.lang.String> getTagNameMap()
Directory
getTagNameMap
in class Directory
public HuffmanTablesDirectory.HuffmanTable getTable(int tableNumber)
tableNumber
- The zero-based index of the table. This number is normally between 0 and 3.
Use getNumberOfTables()
for bounds-checking.HuffmanTablesDirectory.HuffmanTable
having the specified number.public int getNumberOfTables() throws MetadataException
HuffmanTablesDirectory
instance.MetadataException
protected java.util.List<HuffmanTablesDirectory.HuffmanTable> getTables()
List
of HuffmanTablesDirectory.HuffmanTable
s in this
Directory
.public boolean isTypical()
HuffmanTablesDirectory
are "typical" Huffman tables.
"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.
HuffmanTablesDirectory
are the predefined "typical"
Huffman tables.public boolean isOptimized()
isTypical()
.HuffmanTablesDirectory
are "optimized" - which means that at least one of them aren't
one of the "typical" Huffman tables.