javax.imageio.plugins.jpeg.JPEGHuffmanTable Java Examples

The following examples show how to use javax.imageio.plugins.jpeg.JPEGHuffmanTable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DHTMarkerSegment.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
void print() {
    System.out.println("Huffman Table");
    System.out.println("table class: "
                       + ((tableClass == 0) ? "DC":"AC"));
    System.out.println("table id: " + Integer.toString(tableID));

    (new JPEGHuffmanTable(numCodes, values)).toString();
    /*
      System.out.print("Lengths:");
      for (int i=0; i<16; i++) {
      System.out.print(" " + Integer.toString(numCodes[i]));
      }
      int count = 0;
      if (values.length > 16) {
      System.out.println("\nFirst 16 Values:");
      count = 16;
      } else {
      System.out.println("\nValues:");
      count = values.length;
      }
      for (int i=0; i<count; i++) {
      System.out.println(Integer.toString(values[i]&0xff));
      }
    */
}
 
Example #2
Source File: DHTMarkerSegment.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
void print() {
    System.out.println("Huffman Table");
    System.out.println("table class: "
                       + ((tableClass == 0) ? "DC":"AC"));
    System.out.println("table id: " + Integer.toString(tableID));

    (new JPEGHuffmanTable(numCodes, values)).toString();
    /*
      System.out.print("Lengths:");
      for (int i=0; i<16; i++) {
      System.out.print(" " + Integer.toString(numCodes[i]));
      }
      int count = 0;
      if (values.length > 16) {
      System.out.println("\nFirst 16 Values:");
      count = 16;
      } else {
      System.out.println("\nValues:");
      count = values.length;
      }
      for (int i=0; i<count; i++) {
      System.out.println(Integer.toString(values[i]&0xff));
      }
    */
}
 
Example #3
Source File: DHTMarkerSegment.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
void print() {
    System.out.println("Huffman Table");
    System.out.println("table class: "
                       + ((tableClass == 0) ? "DC":"AC"));
    System.out.println("table id: " + Integer.toString(tableID));

    (new JPEGHuffmanTable(numCodes, values)).toString();
    /*
      System.out.print("Lengths:");
      for (int i=0; i<16; i++) {
      System.out.print(" " + Integer.toString(numCodes[i]));
      }
      int count = 0;
      if (values.length > 16) {
      System.out.println("\nFirst 16 Values:");
      count = 16;
      } else {
      System.out.println("\nValues:");
      count = values.length;
      }
      for (int i=0; i<count; i++) {
      System.out.println(Integer.toString(values[i]&0xff));
      }
    */
}
 
Example #4
Source File: JPEGImageWriter.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns <code>true</code> if the write was aborted.
 */
private native boolean writeImage(long structPointer,
                                  byte [] data,
                                  int inCsType, int outCsType,
                                  int numBands,
                                  int [] bandSizes,
                                  int srcWidth,
                                  int destWidth, int destHeight,
                                  int stepX, int stepY,
                                  JPEGQTable [] qtables,
                                  boolean writeDQT,
                                  JPEGHuffmanTable[] DCHuffmanTables,
                                  JPEGHuffmanTable[] ACHuffmanTables,
                                  boolean writeDHT,
                                  boolean optimizeHuffman,
                                  boolean progressive,
                                  int numScans,
                                  int [] scans,
                                  int [] componentIds,
                                  int [] HsamplingFactors,
                                  int [] VsamplingFactors,
                                  int [] QtableSelectors,
                                  boolean haveMetadata,
                                  int restartInterval);
 
Example #5
Source File: JPEGImageReader.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns <code>true</code> if the read was aborted.
 */
private native boolean readImage(int imageIndex,
                                 long structPointer,
                                 byte [] buffer,
                                 int numRasterBands,
                                 int [] srcBands,
                                 int [] bandSizes,
                                 int sourceXOffset, int sourceYOffset,
                                 int sourceWidth, int sourceHeight,
                                 int periodX, int periodY,
                                 JPEGQTable [] abbrevQTables,
                                 JPEGHuffmanTable [] abbrevDCHuffmanTables,
                                 JPEGHuffmanTable [] abbrevACHuffmanTables,
                                 int minProgressivePass,
                                 int maxProgressivePass,
                                 boolean wantUpdates);
 
Example #6
Source File: JPEGImageWriter.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns <code>true</code> if the write was aborted.
 */
private native boolean writeImage(long structPointer,
                                  byte [] data,
                                  int inCsType, int outCsType,
                                  int numBands,
                                  int [] bandSizes,
                                  int srcWidth,
                                  int destWidth, int destHeight,
                                  int stepX, int stepY,
                                  JPEGQTable [] qtables,
                                  boolean writeDQT,
                                  JPEGHuffmanTable[] DCHuffmanTables,
                                  JPEGHuffmanTable[] ACHuffmanTables,
                                  boolean writeDHT,
                                  boolean optimizeHuffman,
                                  boolean progressive,
                                  int numScans,
                                  int [] scans,
                                  int [] componentIds,
                                  int [] HsamplingFactors,
                                  int [] VsamplingFactors,
                                  int [] QtableSelectors,
                                  boolean haveMetadata,
                                  int restartInterval);
 
Example #7
Source File: JPEGImageReader.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns {@code true} if the read was aborted.
 */
private native boolean readImage(int imageIndex,
                                 long structPointer,
                                 byte [] buffer,
                                 int numRasterBands,
                                 int [] srcBands,
                                 int [] bandSizes,
                                 int sourceXOffset, int sourceYOffset,
                                 int sourceWidth, int sourceHeight,
                                 int periodX, int periodY,
                                 JPEGQTable [] abbrevQTables,
                                 JPEGHuffmanTable [] abbrevDCHuffmanTables,
                                 JPEGHuffmanTable [] abbrevACHuffmanTables,
                                 int minProgressivePass,
                                 int maxProgressivePass,
                                 boolean wantUpdates);
 
Example #8
Source File: JPEGImageWriter.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns <code>true</code> if the write was aborted.
 */
private native boolean writeImage(long structPointer,
                                  byte [] data,
                                  int inCsType, int outCsType,
                                  int numBands,
                                  int [] bandSizes,
                                  int srcWidth,
                                  int destWidth, int destHeight,
                                  int stepX, int stepY,
                                  JPEGQTable [] qtables,
                                  boolean writeDQT,
                                  JPEGHuffmanTable[] DCHuffmanTables,
                                  JPEGHuffmanTable[] ACHuffmanTables,
                                  boolean writeDHT,
                                  boolean optimizeHuffman,
                                  boolean progressive,
                                  int numScans,
                                  int [] scans,
                                  int [] componentIds,
                                  int [] HsamplingFactors,
                                  int [] VsamplingFactors,
                                  int [] QtableSelectors,
                                  boolean haveMetadata,
                                  int restartInterval);
 
Example #9
Source File: JPEGImageWriter.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Returns <code>true</code> if the write was aborted.
 */
private native boolean writeImage(long structPointer,
                                  byte [] data,
                                  int inCsType, int outCsType,
                                  int numBands,
                                  int [] bandSizes,
                                  int srcWidth,
                                  int destWidth, int destHeight,
                                  int stepX, int stepY,
                                  JPEGQTable [] qtables,
                                  boolean writeDQT,
                                  JPEGHuffmanTable[] DCHuffmanTables,
                                  JPEGHuffmanTable[] ACHuffmanTables,
                                  boolean writeDHT,
                                  boolean optimizeHuffman,
                                  boolean progressive,
                                  int numScans,
                                  int [] scans,
                                  int [] componentIds,
                                  int [] HsamplingFactors,
                                  int [] VsamplingFactors,
                                  int [] QtableSelectors,
                                  boolean haveMetadata,
                                  int restartInterval);
 
Example #10
Source File: DHTMarkerSegment.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
void print() {
    System.out.println("Huffman Table");
    System.out.println("table class: "
                       + ((tableClass == 0) ? "DC":"AC"));
    System.out.println("table id: " + Integer.toString(tableID));

    (new JPEGHuffmanTable(numCodes, values)).toString();
    /*
      System.out.print("Lengths:");
      for (int i=0; i<16; i++) {
      System.out.print(" " + Integer.toString(numCodes[i]));
      }
      int count = 0;
      if (values.length > 16) {
      System.out.println("\nFirst 16 Values:");
      count = 16;
      } else {
      System.out.println("\nValues:");
      count = values.length;
      }
      for (int i=0; i<count; i++) {
      System.out.println(Integer.toString(values[i]&0xff));
      }
    */
}
 
Example #11
Source File: JPEGImageWriter.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Returns {@code true} if the write was aborted.
 */
private native boolean writeImage(long structPointer,
                                  byte [] data,
                                  int inCsType, int outCsType,
                                  int numBands,
                                  int [] bandSizes,
                                  int srcWidth,
                                  int destWidth, int destHeight,
                                  int stepX, int stepY,
                                  JPEGQTable [] qtables,
                                  boolean writeDQT,
                                  JPEGHuffmanTable[] DCHuffmanTables,
                                  JPEGHuffmanTable[] ACHuffmanTables,
                                  boolean writeDHT,
                                  boolean optimizeHuffman,
                                  boolean progressive,
                                  int numScans,
                                  int [] scans,
                                  int [] componentIds,
                                  int [] HsamplingFactors,
                                  int [] VsamplingFactors,
                                  int [] QtableSelectors,
                                  boolean haveMetadata,
                                  int restartInterval);
 
Example #12
Source File: DHTMarkerSegment.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
void print() {
    System.out.println("Huffman Table");
    System.out.println("table class: "
                       + ((tableClass == 0) ? "DC":"AC"));
    System.out.println("table id: " + Integer.toString(tableID));

    (new JPEGHuffmanTable(numCodes, values)).toString();
    /*
      System.out.print("Lengths:");
      for (int i=0; i<16; i++) {
      System.out.print(" " + Integer.toString(numCodes[i]));
      }
      int count = 0;
      if (values.length > 16) {
      System.out.println("\nFirst 16 Values:");
      count = 16;
      } else {
      System.out.println("\nValues:");
      count = values.length;
      }
      for (int i=0; i<count; i++) {
      System.out.println(Integer.toString(values[i]&0xff));
      }
    */
}
 
Example #13
Source File: JPEGImageWriter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns <code>true</code> if the write was aborted.
 */
private native boolean writeImage(long structPointer,
                                  byte [] data,
                                  int inCsType, int outCsType,
                                  int numBands,
                                  int [] bandSizes,
                                  int srcWidth,
                                  int destWidth, int destHeight,
                                  int stepX, int stepY,
                                  JPEGQTable [] qtables,
                                  boolean writeDQT,
                                  JPEGHuffmanTable[] DCHuffmanTables,
                                  JPEGHuffmanTable[] ACHuffmanTables,
                                  boolean writeDHT,
                                  boolean optimizeHuffman,
                                  boolean progressive,
                                  int numScans,
                                  int [] scans,
                                  int [] componentIds,
                                  int [] HsamplingFactors,
                                  int [] VsamplingFactors,
                                  int [] QtableSelectors,
                                  boolean haveMetadata,
                                  int restartInterval);
 
Example #14
Source File: DHTMarkerSegment.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
Htable(Node node) throws IIOInvalidTreeException {
    if (node.getNodeName().equals("dhtable")) {
        NamedNodeMap attrs = node.getAttributes();
        int count = attrs.getLength();
        if (count != 2) {
            throw new IIOInvalidTreeException
                ("dhtable node must have 2 attributes", node);
        }
        tableClass = getAttributeValue(node, attrs, "class", 0, 1, true);
        tableID = getAttributeValue(node, attrs, "htableId", 0, 3, true);
        if (node instanceof IIOMetadataNode) {
            IIOMetadataNode ourNode = (IIOMetadataNode) node;
            JPEGHuffmanTable table =
                (JPEGHuffmanTable) ourNode.getUserObject();
            if (table == null) {
                throw new IIOInvalidTreeException
                    ("dhtable node must have user object", node);
            }
            numCodes = table.getLengths();
            values = table.getValues();
        } else {
            throw new IIOInvalidTreeException
                ("dhtable node must have user object", node);
        }
    } else {
        throw new IIOInvalidTreeException
            ("Invalid node, expected dqtable", node);
    }

}
 
Example #15
Source File: DHTMarkerSegment.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
DHTMarkerSegment(boolean needFour) {
    super(JPEG.DHT);
    tables.add(new Htable(JPEGHuffmanTable.StdDCLuminance, true, 0));
    if (needFour) {
        tables.add(new Htable(JPEGHuffmanTable.StdDCChrominance, true, 1));
    }
    tables.add(new Htable(JPEGHuffmanTable.StdACLuminance, false, 0));
    if (needFour) {
        tables.add(new Htable(JPEGHuffmanTable.StdACChrominance, false, 1));
    }
}
 
Example #16
Source File: JPEG.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return an array of default Huffman tables.
 */
static JPEGHuffmanTable [] getDefaultHuffmanTables(boolean wantDC) {
    JPEGHuffmanTable [] tables = new JPEGHuffmanTable[2];
    if (wantDC) {
        tables[0] = JPEGHuffmanTable.StdDCLuminance;
        tables[1] = JPEGHuffmanTable.StdDCChrominance;
    } else {
        tables[0] = JPEGHuffmanTable.StdACLuminance;
        tables[1] = JPEGHuffmanTable.StdACChrominance;
    }
    return tables;
}
 
Example #17
Source File: DHTMarkerSegment.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
IIOMetadataNode getNativeNode() {
    IIOMetadataNode node = new IIOMetadataNode("dhtable");
    node.setAttribute("class", Integer.toString(tableClass));
    node.setAttribute("htableId", Integer.toString(tableID));

    node.setUserObject(new JPEGHuffmanTable(numCodes, values));

    return node;
}
 
Example #18
Source File: DHTMarkerSegment.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
DHTMarkerSegment(JPEGHuffmanTable[] dcTables,
                 JPEGHuffmanTable[] acTables) {
    super(JPEG.DHT);
    for (int i = 0; i < dcTables.length; i++) {
        tables.add(new Htable(dcTables[i], true, i));
    }
    for (int i = 0; i < acTables.length; i++) {
        tables.add(new Htable(acTables[i], false, i));
    }
}
 
Example #19
Source File: JPEGImageReader.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns <code>true</code> if the read was aborted.
 */
private native boolean readImage(long structPointer,
                                 byte [] buffer,
                                 int numRasterBands,
                                 int [] srcBands,
                                 int [] bandSizes,
                                 int sourceXOffset, int sourceYOffset,
                                 int sourceWidth, int sourceHeight,
                                 int periodX, int periodY,
                                 JPEGQTable [] abbrevQTables,
                                 JPEGHuffmanTable [] abbrevDCHuffmanTables,
                                 JPEGHuffmanTable [] abbrevACHuffmanTables,
                                 int minProgressivePass,
                                 int maxProgressivePass,
                                 boolean wantUpdates);
 
Example #20
Source File: DHTMarkerSegment.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
IIOMetadataNode getNativeNode() {
    IIOMetadataNode node = new IIOMetadataNode("dhtable");
    node.setAttribute("class", Integer.toString(tableClass));
    node.setAttribute("htableId", Integer.toString(tableID));

    node.setUserObject(new JPEGHuffmanTable(numCodes, values));

    return node;
}
 
Example #21
Source File: DHTMarkerSegment.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
IIOMetadataNode getNativeNode() {
    IIOMetadataNode node = new IIOMetadataNode("dhtable");
    node.setAttribute("class", Integer.toString(tableClass));
    node.setAttribute("htableId", Integer.toString(tableID));

    node.setUserObject(new JPEGHuffmanTable(numCodes, values));

    return node;
}
 
Example #22
Source File: DHTMarkerSegment.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
DHTMarkerSegment(boolean needFour) {
    super(JPEG.DHT);
    tables.add(new Htable(JPEGHuffmanTable.StdDCLuminance, true, 0));
    if (needFour) {
        tables.add(new Htable(JPEGHuffmanTable.StdDCChrominance, true, 1));
    }
    tables.add(new Htable(JPEGHuffmanTable.StdACLuminance, false, 0));
    if (needFour) {
        tables.add(new Htable(JPEGHuffmanTable.StdACChrominance, false, 1));
    }
}
 
Example #23
Source File: JPEGImageReader.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns <code>true</code> if the read was aborted.
 */
private native boolean readImage(long structPointer,
                                 byte [] buffer,
                                 int numRasterBands,
                                 int [] srcBands,
                                 int [] bandSizes,
                                 int sourceXOffset, int sourceYOffset,
                                 int sourceWidth, int sourceHeight,
                                 int periodX, int periodY,
                                 JPEGQTable [] abbrevQTables,
                                 JPEGHuffmanTable [] abbrevDCHuffmanTables,
                                 JPEGHuffmanTable [] abbrevACHuffmanTables,
                                 int minProgressivePass,
                                 int maxProgressivePass,
                                 boolean wantUpdates);
 
Example #24
Source File: DHTMarkerSegment.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
DHTMarkerSegment(JPEGHuffmanTable[] dcTables,
                 JPEGHuffmanTable[] acTables) {
    super(JPEG.DHT);
    for (int i = 0; i < dcTables.length; i++) {
        tables.add(new Htable(dcTables[i], true, i));
    }
    for (int i = 0; i < acTables.length; i++) {
        tables.add(new Htable(acTables[i], false, i));
    }
}
 
Example #25
Source File: JPEG.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return an array of default Huffman tables.
 */
static JPEGHuffmanTable [] getDefaultHuffmanTables(boolean wantDC) {
    JPEGHuffmanTable [] tables = new JPEGHuffmanTable[2];
    if (wantDC) {
        tables[0] = JPEGHuffmanTable.StdDCLuminance;
        tables[1] = JPEGHuffmanTable.StdDCChrominance;
    } else {
        tables[0] = JPEGHuffmanTable.StdACLuminance;
        tables[1] = JPEGHuffmanTable.StdACChrominance;
    }
    return tables;
}
 
Example #26
Source File: DHTMarkerSegment.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
DHTMarkerSegment(boolean needFour) {
    super(JPEG.DHT);
    tables.add(new Htable(JPEGHuffmanTable.StdDCLuminance, true, 0));
    if (needFour) {
        tables.add(new Htable(JPEGHuffmanTable.StdDCChrominance, true, 1));
    }
    tables.add(new Htable(JPEGHuffmanTable.StdACLuminance, false, 0));
    if (needFour) {
        tables.add(new Htable(JPEGHuffmanTable.StdACChrominance, false, 1));
    }
}
 
Example #27
Source File: DHTMarkerSegment.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
DHTMarkerSegment(JPEGHuffmanTable[] dcTables,
                 JPEGHuffmanTable[] acTables) {
    super(JPEG.DHT);
    for (int i = 0; i < dcTables.length; i++) {
        tables.add(new Htable(dcTables[i], true, i));
    }
    for (int i = 0; i < acTables.length; i++) {
        tables.add(new Htable(acTables[i], false, i));
    }
}
 
Example #28
Source File: JPEG.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return an array of default Huffman tables.
 */
static JPEGHuffmanTable [] getDefaultHuffmanTables(boolean wantDC) {
    JPEGHuffmanTable [] tables = new JPEGHuffmanTable[2];
    if (wantDC) {
        tables[0] = JPEGHuffmanTable.StdDCLuminance;
        tables[1] = JPEGHuffmanTable.StdDCChrominance;
    } else {
        tables[0] = JPEGHuffmanTable.StdACLuminance;
        tables[1] = JPEGHuffmanTable.StdACChrominance;
    }
    return tables;
}
 
Example #29
Source File: DHTMarkerSegment.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
Htable(Node node) throws IIOInvalidTreeException {
    if (node.getNodeName().equals("dhtable")) {
        NamedNodeMap attrs = node.getAttributes();
        int count = attrs.getLength();
        if (count != 2) {
            throw new IIOInvalidTreeException
                ("dhtable node must have 2 attributes", node);
        }
        tableClass = getAttributeValue(node, attrs, "class", 0, 1, true);
        tableID = getAttributeValue(node, attrs, "htableId", 0, 3, true);
        if (node instanceof IIOMetadataNode) {
            IIOMetadataNode ourNode = (IIOMetadataNode) node;
            JPEGHuffmanTable table =
                (JPEGHuffmanTable) ourNode.getUserObject();
            if (table == null) {
                throw new IIOInvalidTreeException
                    ("dhtable node must have user object", node);
            }
            numCodes = table.getLengths();
            values = table.getValues();
        } else {
            throw new IIOInvalidTreeException
                ("dhtable node must have user object", node);
        }
    } else {
        throw new IIOInvalidTreeException
            ("Invalid node, expected dqtable", node);
    }

}
 
Example #30
Source File: DHTMarkerSegment.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
IIOMetadataNode getNativeNode() {
    IIOMetadataNode node = new IIOMetadataNode("dhtable");
    node.setAttribute("class", Integer.toString(tableClass));
    node.setAttribute("htableId", Integer.toString(tableID));

    node.setUserObject(new JPEGHuffmanTable(numCodes, values));

    return node;
}