Qtable(boolean wantLuma, float quality) { elementPrecision = 0; JPEGQTable base = null; if (wantLuma) { tableID = 0; base = JPEGQTable.K1Div2Luminance; } else { tableID = 1; base = JPEGQTable.K2Div2Chrominance; } if (quality != JPEG.DEFAULT_QUALITY) { quality = JPEG.convertToLinearQuality(quality); if (wantLuma) { base = JPEGQTable.K1Luminance.getScaledInstance(quality, true); } else { base = JPEGQTable.K2Div2Chrominance.getScaledInstance(quality, true); } } data = base.getTable(); }
Qtable(Node node) throws IIOInvalidTreeException { if (node.getNodeName().equals("dqtable")) { NamedNodeMap attrs = node.getAttributes(); int count = attrs.getLength(); if ((count < 1) || (count > 2)) { throw new IIOInvalidTreeException("dqtable node must have 1 or 2 attributes", node); } elementPrecision = 0; tableID = getAttributeValue(node, attrs, "qtableId", 0, 3, true); if (node instanceof IIOMetadataNode) { IIOMetadataNode ourNode = (IIOMetadataNode) node; JPEGQTable table = (JPEGQTable) ourNode.getUserObject(); if (table == null) { throw new IIOInvalidTreeException("dqtable node must have user object", node); } data = table.getTable(); } else { throw new IIOInvalidTreeException("dqtable node must have user object", node); } } else { throw new IIOInvalidTreeException("Invalid node, expected dqtable", node); } }
Qtable(JPEGQTable table, int id) { elementPrecision = 0; tableID = id; data = table.getTable(); }