@emersoncloud emersoncloud released this Jan 29, 2019

Release v0.2.2

The last release of JpegKit, v0.2.0 introduced new wrappers for libjpeg-turbo. This was a major redesign to the JpegKit library. While these changes improved performance and readability of the code, it was incomplete for the scope of JpegKit functionality.

v0.2.2 un-deprecates the Jpeg methods to be used until the wrappers are finalized in an upcoming release, v0.3.0.

What's new

Bug Fixes

  • Closed #4: Edge corruption when rotating a Jpeg
  • Fixed JpegView render function

Deprecation

Un-deprecated the following classes:

  • JpegKit
  • Jpeg
  • JpegFile
  • JpegImageView
Assets 2

@austinkettner austinkettner released this Aug 1, 2018

Release v0.2.0

Artifact: com.camerakit:jpegkit:0.2.0

What's New

TurboJpeg

  • Adds a wrapper class so you can work with libjpeg-turbo running in the Android JNI, all from higher level java methods.
  • See turbojpeg.h in libjpeg-turbo's repository for official documentation. Our wrapper is mostly the same.

JpegView

  • A view class for rendering a jpeg.
  • Uses a pixel allocation reference to the JNI layer created by the TurboJpeg wrapper.
  • Pixel RGB data always stays off JVM.
    • Lower risk of memory issues.
  • Executes a memcpy directly to the window's low-level pixel buffer.

Render latency comparison:

Jpeg Input ImageView JpegView
3264 x 2448, 4.3MB 613ms 140ms
8277 x 5393, 15.3MB 1900ms 540ms
22921 x 4510, 23.6MB crashes 620ms

JpegDecoder

  • This class receives a jpeg byte[] in it's constructor, which is subsequently marshalled to the JNI layer.
  • The jpeg's header data is decompressed immediately in the constructor, so metadata methods will work immediately with low overhead:
    • getWidth()
    • getHeight()
    • getSubsampling()
  • Decode methods available:
    • decode()
    • decode(...)
      • int width
      • int height
      • int pitch
      • @PixelFormat int pixelFormat
      • @Flag int flags
    • decodeToYuv()
    • decodeToYuv(...)
      • @Flag int flags
    • When unsure about a value in the parameterized versions of these methods, it's always safe and handled internally if you put 0
  • You must call release() when you are finished.

JpegTransformer

  • This class receives a jpeg byte[] in it's constructor, which is subsequently marshalled to the JNI layer.
  • Transformations available:
    • flipHorizontal()
    • flipVertical()
    • rotate(...)
      • int degrees
    • cropWithOffsets(...)
      • int leftOffset, int topOffset, int rightOffset, int bottomOffset
    • cropWithRegion(...)
      • int x, int y, int width, int height
  • When finished, you can have the transformed jpeg data unmarshalled back to the android JVM with obtain().
  • You must call release() when you are finished.

Deprecated:

  • Most JpegKit class methods
  • Jpeg class
  • JpegFile class
  • JpegImageView class
Assets 2
Mar 19, 2018
Set Version 0.1.0
Jan 22, 2018