Class MetadataExtractor.HuffmanTablesDirectory
- java.lang.Object
-
- gov.nih.mipav.model.file.MetadataExtractor.Directory
-
- gov.nih.mipav.model.file.MetadataExtractor.HuffmanTablesDirectory
-
- Enclosing class:
- MetadataExtractor
public class MetadataExtractor.HuffmanTablesDirectory extends MetadataExtractor.Directory
Directory of tables for the DHT (Define Huffman Table(s)) segment.- Author:
- Nadahar
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
MetadataExtractor.HuffmanTablesDirectory.HuffmanTable
An instance of this class holds a JPEG Huffman table.
-
Field Summary
Fields Modifier and Type Field Description private java.util.HashMap<java.lang.Integer,java.lang.String>
_tagNameMap
protected java.util.List<MetadataExtractor.HuffmanTablesDirectory.HuffmanTable>
tables
static int
TAG_NUMBER_OF_TABLES
(package private) byte[]
TYPICAL_CHROMINANCE_AC_LENGTHS
(package private) byte[]
TYPICAL_CHROMINANCE_AC_VALUES
(package private) byte[]
TYPICAL_CHROMINANCE_DC_LENGTHS
(package private) byte[]
TYPICAL_CHROMINANCE_DC_VALUES
(package private) byte[]
TYPICAL_LUMINANCE_AC_LENGTHS
(package private) byte[]
TYPICAL_LUMINANCE_AC_VALUES
(package private) byte[]
TYPICAL_LUMINANCE_DC_LENGTHS
(package private) byte[]
TYPICAL_LUMINANCE_DC_VALUES
-
Fields inherited from class gov.nih.mipav.model.file.MetadataExtractor.Directory
_definedTagList, _descriptor, _tagMap
-
-
Constructor Summary
Constructors Constructor Description HuffmanTablesDirectory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getName()
Provides the name of the directory, for display purposes.int
getNumberOfTables()
MetadataExtractor.HuffmanTablesDirectory.HuffmanTable
getTable(int tableNumber)
protected java.util.List<MetadataExtractor.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 ofisTypical()
.boolean
isTypical()
Evaluates whether all the tables in thisMetadataExtractor.HuffmanTablesDirectory
are "typical" Huffman tables.-
Methods inherited from class gov.nih.mipav.model.file.MetadataExtractor.Directory
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
-
-
-
-
Field Detail
-
TAG_NUMBER_OF_TABLES
public static final int TAG_NUMBER_OF_TABLES
- See Also:
- Constant Field Values
-
TYPICAL_LUMINANCE_DC_LENGTHS
final byte[] TYPICAL_LUMINANCE_DC_LENGTHS
-
TYPICAL_LUMINANCE_DC_VALUES
final byte[] TYPICAL_LUMINANCE_DC_VALUES
-
TYPICAL_CHROMINANCE_DC_LENGTHS
final byte[] TYPICAL_CHROMINANCE_DC_LENGTHS
-
TYPICAL_CHROMINANCE_DC_VALUES
final byte[] TYPICAL_CHROMINANCE_DC_VALUES
-
TYPICAL_LUMINANCE_AC_LENGTHS
final byte[] TYPICAL_LUMINANCE_AC_LENGTHS
-
TYPICAL_LUMINANCE_AC_VALUES
final byte[] TYPICAL_LUMINANCE_AC_VALUES
-
TYPICAL_CHROMINANCE_AC_LENGTHS
final byte[] TYPICAL_CHROMINANCE_AC_LENGTHS
-
TYPICAL_CHROMINANCE_AC_VALUES
final byte[] TYPICAL_CHROMINANCE_AC_VALUES
-
tables
protected final java.util.List<MetadataExtractor.HuffmanTablesDirectory.HuffmanTable> tables
-
_tagNameMap
private final java.util.HashMap<java.lang.Integer,java.lang.String> _tagNameMap
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from class:MetadataExtractor.Directory
Provides the name of the directory, for display purposes. E.g.Exif
- Specified by:
getName
in classMetadataExtractor.Directory
- Returns:
- the name of the directory
-
getTagNameMap
protected java.util.HashMap<java.lang.Integer,java.lang.String> getTagNameMap()
Description copied from class:MetadataExtractor.Directory
Provides the map of tag names, hashed by tag type identifier.- Specified by:
getTagNameMap
in classMetadataExtractor.Directory
- Returns:
- the map of tag names
-
getTable
public MetadataExtractor.HuffmanTablesDirectory.HuffmanTable getTable(int tableNumber)
- Parameters:
tableNumber
- The zero-based index of the table. This number is normally between 0 and 3. UsegetNumberOfTables()
for bounds-checking.- Returns:
- The
MetadataExtractor.HuffmanTablesDirectory.HuffmanTable
having the specified number.
-
getNumberOfTables
public int getNumberOfTables() throws MetadataExtractor.MetadataException
- Returns:
- The number of Huffman tables held by this
MetadataExtractor.HuffmanTablesDirectory
instance. - Throws:
MetadataExtractor.MetadataException
-
getTables
protected java.util.List<MetadataExtractor.HuffmanTablesDirectory.HuffmanTable> getTables()
- Returns:
- The
List
ofMetadataExtractor.HuffmanTablesDirectory.HuffmanTable
s in thisMetadataExtractor.Directory
.
-
isTypical
public boolean isTypical()
Evaluates whether all the tables in thisMetadataExtractor.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.
- Returns:
- Whether or not all the tables in this
MetadataExtractor.HuffmanTablesDirectory
are the predefined "typical" Huffman tables.
-
isOptimized
public boolean isOptimized()
The opposite ofisTypical()
.- Returns:
- Whether or not the tables in this
MetadataExtractor.HuffmanTablesDirectory
are "optimized" - which means that at least one of them aren't one of the "typical" Huffman tables.
-
-