v0.2.0
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
classJpegFile
classJpegImageView
class