This project complete look up table by android render script which accelerate lut by gpu. write in kotlin and renderscript, you can simple import this project if you are developing picture filter app, cube file parse also available in this project.
jut six lines code function accomplish lut algorithm
uchar4 RS_KERNEL lutFilter(uchar4 in,uint32_t x, uint32_t y) {
uchar4 out = in;
uchar4 lutPoint = rsGetElementAt_uchar4(mLut, in.r * width / 256 , in.g * width / 256 + in.b * width / 256 * width);
out.rgb = lutPoint.rgb;
return out;
}
this project assume you provide some format lut filter bitmap with 64 width and 64 * 64 height, with width grow the R channel from 0 to 255 and height grow the G channel form 0 to 255 in evevry rectangle. with rectangle count up on y dimension the B chanel from 0 to 255.
this will do every thing
val fasterLut = FasterLut()
val result = fasterLut.fasterLut(yourBitmap, yourFilter, context)
Done!
below are screenshot of the demo app