Class HuffmanTablesDirectory

java.lang.Object
com.drew.metadata.Directory
com.drew.metadata.jpeg.HuffmanTablesDirectory

public class HuffmanTablesDirectory extends Directory
Directory of tables for the DHT (Define Huffman Table(s)) segment.
  • Field Details

  • Constructor Details

    • HuffmanTablesDirectory

      public HuffmanTablesDirectory()
  • Method Details

    • getName

      public String getName()
      Description copied from class: Directory
      Provides the name of the directory, for display purposes. E.g. Exif
      Specified by:
      getName in class Directory
      Returns:
      the name of the directory
    • getTable

      public HuffmanTablesDirectory.HuffmanTable getTable(int tableNumber)
      Parameters:
      tableNumber - The zero-based index of the table. This number is normally between 0 and 3. Use getNumberOfTables() for bounds-checking.
      Returns:
      The HuffmanTablesDirectory.HuffmanTable having the specified number.
    • getNumberOfTables

      public int getNumberOfTables() throws MetadataException
      Returns:
      The number of Huffman tables held by this HuffmanTablesDirectory instance.
      Throws:
      MetadataException
    • isTypical

      public boolean isTypical()
      Evaluates whether all the tables in this 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 HuffmanTablesDirectory are the predefined "typical" Huffman tables.
    • isOptimized

      public boolean isOptimized()
      The opposite of isTypical().
      Returns:
      Whether or not the tables in this HuffmanTablesDirectory are "optimized" - which means that at least one of them aren't one of the "typical" Huffman tables.