Examples of JPEGQTable


Examples of javax.imageio.plugins.jpeg.JPEGQTable

        byte[] lumQ = new byte[64];
        byte[] chmQ = new byte[64];

        RFC2035.MakeTables(q, lumQ, chmQ, RFC2035.jpeg_luma_quantizer_normal, RFC2035.jpeg_chroma_quantizer_normal);

        JPEGQTable qtable_luma = new JPEGQTable(ArrayUtility.byteArrayToIntArray(lumQ));
        JPEGQTable qtable_chroma = new JPEGQTable(ArrayUtility.byteArrayToIntArray(chmQ));
        JPEGQTable[] result = {qtable_luma, qtable_chroma};
        return result;
    }
View Full Code Here

Examples of javax.imageio.plugins.jpeg.JPEGQTable

    byte[] lumQ = new byte[64];
    byte[] chmQ = new byte[64];
   
    RFC2035.MakeTables(q, lumQ, chmQ, RFC2035.jpeg_luma_quantizer_normal, RFC2035.jpeg_chroma_quantizer_normal);
   
    JPEGQTable qtable_luma = new JPEGQTable(ArrayUtility.byteArrayToIntArray(lumQ));
    JPEGQTable qtable_chroma = new JPEGQTable(ArrayUtility.byteArrayToIntArray(chmQ));
    JPEGQTable[] result = {qtable_luma, qtable_chroma};
    return result;
  }
View Full Code Here

Examples of javax.imageio.plugins.jpeg.JPEGQTable

*/
public class TestJPEGQTable implements Testlet
{
  public void test(TestHarness h)
  {
    JPEGQTable t;
    boolean constructionFailed;
    int[] table;

    int[] K1LuminanceValues =
      {
        16, 11, 10, 1624405161,
        12, 12, 14, 1926586055,
        14, 13, 16, 2440576956,
        14, 17, 22, 2951878062,
        18, 22, 37, 5668, 109, 10377,
        24, 35, 55, 6481, 104, 11392,
        49, 64, 78, 87, 103, 121, 120, 101,
        72, 92, 95, 98, 112, 100, 10399
      };

    int[] K1Div2LuminanceValues =
      {
        8, 6, 5, 8, 12, 20, 26, 31,
        6, 6, 7, 10, 13, 29, 30, 28,
        7, 7, 8, 12, 20, 29, 35, 28,
        7, 9, 11, 15, 26, 44, 40, 31,
        9, 11, 19, 28, 34, 55, 52, 39,
        12, 18, 28, 32, 41, 52, 57, 46,
        25, 32, 39, 44, 52, 61, 60, 51,
        36, 46, 48, 49, 56, 50, 52, 50
      };

    int[] K2ChrominanceValues =
      {
        17, 18, 24, 47, 99, 99, 99, 99,
        18, 21, 26, 66, 99, 99, 99, 99,
        24, 26, 56, 99, 99, 99, 99, 99,
        47, 66, 99, 99, 99, 99, 99, 99,
        99, 99, 99, 99, 99, 99, 99, 99,
        99, 99, 99, 99, 99, 99, 99, 99,
        99, 99, 99, 99, 99, 99, 99, 99,
        99, 99, 99, 99, 99, 99, 99, 99
      };

    int[] K2Div2ChrominanceValues =
      {
        9, 9, 12, 24, 50, 50, 50, 50,
        9, 11, 13, 33, 50, 50, 50, 50,
        12, 13, 28, 50, 50, 50, 50, 50,
        24, 33, 50, 50, 50, 50, 50, 50,
        50, 50, 50, 50, 50, 50, 50, 50,
        50, 50, 50, 50, 50, 50, 50, 50,
        50, 50, 50, 50, 50, 50, 50, 50,
        50, 50, 50, 50, 50, 50, 50, 50
      };

    // Test that it is impossible to construct an invalid quantization
    // table.

    // table argument is null
    constructionFailed = false;
    try
      {
        t = new JPEGQTable(null);
    }
    catch (IllegalArgumentException e)
      {
        constructionFailed = true;
      }
    h.check(constructionFailed);

    // table has length less than 64
    constructionFailed = false;
    int[] smallTable = new int[K1LuminanceValues.length - 20];
    System.arraycopy(K1LuminanceValues, 0, smallTable, 0, K1LuminanceValues.length - 20);
    try
      {
        t = new JPEGQTable(smallTable);
    }
    catch (IllegalArgumentException e)
      {
        constructionFailed = true;
      }
    h.check(constructionFailed);

    // table has length greater than 64
    constructionFailed = false;
    int[] bigTable = new int[K1LuminanceValues.length + 20];
    System.arraycopy(K1LuminanceValues, 0, bigTable, 0, K1LuminanceValues.length);
    try
      {
        t = new JPEGQTable(bigTable);
    }
    catch (IllegalArgumentException e)
      {
        constructionFailed = true;
      }
View Full Code Here

Examples of javax.imageio.plugins.jpeg.JPEGQTable

        JPEGQTable [] retval = null;
        if (tables.size() != 0) {
            retval = new JPEGQTable[tables.size()];
            for (int i = 0; i < retval.length; i++) {
                retval[i] =
                    new JPEGQTable(((DQTMarkerSegment.Qtable)tables.get(i)).data);
            }
        }
        return retval;
    }
View Full Code Here

Examples of javax.imageio.plugins.jpeg.JPEGQTable

            35, 36, 48, 49, 57, 58, 62, 63
        };

        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();
        }
View Full Code Here

Examples of javax.imageio.plugins.jpeg.JPEGQTable

                }
                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 {
View Full Code Here

Examples of javax.imageio.plugins.jpeg.JPEGQTable

            IIOMetadataNode node = new IIOMetadataNode("dqtable");
            node.setAttribute("elementPrecision",
                              Integer.toString(elementPrecision));
            node.setAttribute("qtableId",
                              Integer.toString(tableID));
            node.setUserObject(new JPEGQTable(data));
            return node;
        }
View Full Code Here

Examples of javax.imageio.plugins.jpeg.JPEGQTable

        void print() {
            System.out.println("Table id: " + Integer.toString(tableID));
            System.out.println("Element precision: "
                               + Integer.toString(elementPrecision));

            (new JPEGQTable(data)).toString();
            /*
              for (int i = 0; i < 64; i++) {
              if (i % 8 == 0) {
              System.out.println();
              }
View Full Code Here

Examples of javax.imageio.plugins.jpeg.JPEGQTable

            // a comparable scaling of chrominance frequency response of the
            // eye.
            float scaleFactor = ((float)(luma.data[largestPos]))
                / ((float)(JPEGQTable.K1Div2Luminance.getTable()[largestPos]));
            //    generate a new table
            JPEGQTable jpegTable =
                JPEGQTable.K2Div2Chrominance.getScaledInstance(scaleFactor,
                                                               true);
            newGuy = new Qtable(jpegTable, 1);
        }
        return newGuy;
View Full Code Here

Examples of javax.imageio.plugins.jpeg.JPEGQTable

            35, 36, 48, 49, 57, 58, 62, 63
        };

        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();
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.