Package turbojpegj

Examples of turbojpegj.TurboJpegJCompressor


{

  @Test
  public void test() throws IOException
  {
    TurboJpegJCompressor lTurboJpegJCompressor = new TurboJpegJCompressor();
    lTurboJpegJCompressor.setQuality(90);
    ByteBuffer lOriginalByteBuffer = loadRawImage();
    // for (int i = 0; i < 100; i++)
    assertTrue(lTurboJpegJCompressor.compressMonochrome(549,
                                                        1080,
                                                        lOriginalByteBuffer));
    int lLimit = lTurboJpegJCompressor.getCompressedBuffer().limit();
    final double lRatio = ((double) lLimit) / lOriginalByteBuffer.limit();
    System.out.format("time=%d ms\n",
                      lTurboJpegJCompressor.getLastImageCompressionElapsedTimeInMs());
    System.out.format("lRatio=%g \n", lRatio);
    // assertTrue(lRatio < 0.34);

    TurboJpegJDecompressor lTurboJpegJDecompressor = new TurboJpegJDecompressor();

    assertTrue(lTurboJpegJDecompressor.decompressMonochrome(lTurboJpegJCompressor.getCompressedBuffer()));
    System.out.format("time=%d ms\n",
                      lTurboJpegJCompressor.getLastImageCompressionElapsedTimeInMs());

    ByteBuffer lDecompressedBuffer = lTurboJpegJDecompressor.getDecompressedBuffer();

    assertTrue(lDecompressedBuffer.limit() == lOriginalByteBuffer.limit());
View Full Code Here

TOP

Related Classes of turbojpegj.TurboJpegJCompressor

Copyright © 2018 www.massapicom. 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.