commit | 9f4fcb4b678fb41ff92d75bf98096c10bdaed0d7 | [log] [tgz] |
---|---|---|
author | Xusong Wang <xusongw@google.com> | Tue Jul 19 23:00:56 2022 +0000 |
committer | Xusong Wang <xusongw@google.com> | Tue Jul 19 23:48:56 2022 +0000 |
tree | b0953732c4add251e22e670ccdcc373e6c0ab506 | |
parent | dc3d9ea43627fce1e7019082d1fca9e06a8808b7 [diff] |
Change OWNERS. Test: n/a Change-Id: I78ead4d3e5358440b65d5382c8152ef6ce3b3803
This Toolkit provides a collection of high-performance image manipulation functions like blur, blend, and resize. It can be used as a stand-alone replacement for most of the deprecated RenderScript Intrinsics functions.
The Toolkit provides ten image manipulation functions:
The Toolkit provides a C++ and a Java/Kotlin interface. It is packaged as an Android library that you can add to your project.
These functions execute multithreaded on the CPU. They take advantage of Neon/AdvSimd on Arm processors and SSE on Intel's.
Compared to the RenderScript Intrinsics, this Toolkit is simpler to use and twice as fast when executing on the CPU. However RenderScript Intrinsics allow more flexibility for the type of allocations supported. This toolkit does not support allocations of floats; most the functions support ByteArrays and Bitmaps.
You should instantiate the Toolkit once and reuse it throughout your application. On instantiation, the Toolkit creates a thread pool that's used for processing all the functions. You can limit the number of poolThreads used by the Toolkit via the constructor. The poolThreads are destroyed once the Toolkit is destroyed, after any pending work is done.
This library is thread safe. You can call methods from different poolThreads. The functions will execute sequentially.
Turn the Java version of the Toolkit into a singleton, to reduce the chance that someone inadventarly create multiple threadpools.
Support ByteBuffer. It should be straightforward to use GetDirectBufferAddress in JniEntryPoints.cpp. See https://developer.android.com/training/articles/perf-jni and jni_helper.h.
The RenderScript Intrinsics support floats for colorMatrix, convolve, and resize. The Toolkit does not.
Allow in place update of buffers, or writing to an existing byte array.
For Blur, we could have a version that accepts a mask. This is commonly used for background blurring. We should allow the mask to be smaller than the original, since neural networks models that do segmentation are downscaled.
Allow yuvToRgb to have a Restriction.
Add support for YUV_420_888, the YUV format favored by Camera2. Allow various strides to be specified.
When passing a Restriction, it would be nice to say “Create a smaller output”. The original RenderScript does not allow that. It's not that useful when outputing new buffers as our Java library does.
For Resize, Restriction working on input buffer would be more useful but that's not RenderScript.
Integrate and test with imageprocessing_jb. Do the same for github/renderscript-samples/
Allow Bitmaps with rowSize != width * vectorSize. We could do this also for ByteArray.
if (mTilesInProcess == 0 && mTilesNotYetStarted == 0) { mWorkIsFinished.notify_one();