awxkee / jxl-coder

JPEG XL (JXL) Decoder/Encoder library for Android
Apache License 2.0
53 stars 5 forks source link

Coil support #4

Closed T8RIN closed 1 year ago

T8RIN commented 1 year ago

Will the coil artifact be added in the future? Like avif coder does

But this one needs the determinition if coder input is jxl without using it like i did in heif coil, because if the image isn't jxl then other coders can't decode it

awxkee commented 1 year ago

Will the coil artifact be added in the future? Like avif coder does

But this one needs the determinition if coder input is jxl without using it like i did in heif coil, because if the image isn't jxl then other coders can't decode it

Adding the coil to avif merely was a mistake. Generally it has no any practical sense because you may always add one class in project named SomeNewCodecCoil which always do the same thing just calling different codec.

Currently I added check the magic. But for production in coil and etc also need subsampling because due to JVM nature of android apps loading large bitmap will always throw OOM

T8RIN commented 1 year ago

I do this on a client side

awxkee commented 1 year ago

I do this on a client side

You can't really do sample of large image on client side unless you don't do this on GPU. That's all the idea of sampling in android to resize an image buffer in native memory and set a smaller buffer to Bitmap to avoid issues with JVM. That's literally that android do to avoid JVM OOM. Starting 29 API Bitmap may be loaded as ANDROID_BITMAP_FLAGS_IS_HARDWARE and you may operate directly on native buffers, but it's currently not possible to use this API in NDK without setting minumum API version to 29.

awxkee commented 1 year ago

And to do resizing on GPU, you have to write C++ code that do binding native buffer to NativeWindow that controlled by OpenGL. I sure I don't do that.

T8RIN commented 1 year ago

I got it, but I used a simple way, just load a large image with a lower size provided through coil

awxkee commented 1 year ago

I got it, but I used a simple way, just load a large image with a lower size provided through coil

That's the point, if it won't be configured in loader then coil will fail to load image.

T8RIN commented 1 year ago

If I understand correctly, this happens by default, unless there is a strict restriction for Size.ORIGINAL

T8RIN commented 1 year ago

And i have a question about libjxl size, is it so big, and can't be .so files reduced weight?

awxkee commented 1 year ago

If I understand correctly, this happens by default, unless there is a strict restriction for Size.ORIGINAL

I've added sampler method, and size retrieve. You may do exactly the same as avif, get size, aspect fit or scale and get the sampled image

And i have a question about libjxl size, is it so big, and can't be .so files reduced weight?

Unfortunately, there are no simple ways to decrease its size

T8RIN commented 1 year ago

If I understand correctly, this happens by default, unless there is a strict restriction for Size.ORIGINAL

I've added sampler method, and size retrieve. You may do exactly the same as avif, get size, aspect fit or scale and get the sampled image

Thanks!

Unfortunately, there are no simple ways to decrease its size

Okay :( btw thanks for this!

awxkee commented 1 year ago

If I understand correctly, this happens by default, unless there is a strict restriction for Size.ORIGINAL

I've added sampler method, and size retrieve. You may do exactly the same as avif, get size, aspect fit or scale and get the sampled image

Thanks!

Unfortunately, there are no simple ways to decrease its size

Okay :( btw thanks for this!

When you will build AAB for distribution, the compiler will try to strip .so files if this possible unless it disabled. In general, this will significantly reduce size of final files

T8RIN commented 1 year ago

I'll look into it