Giter VIP home page Giter VIP logo

Comments (6)

thedoritos avatar thedoritos commented on July 17, 2024

Hi, @eduardhasanaj2

First of all, you should know where it takes the time.

Open the directory ./unimgpicker_android with AndroidStudio. It's an Android native app project.
You can run it as an Android app in your device.

A small app will launch. It loads image using unimgpicker plugin when the button "Show Picker" is pressed, and reads the picked image with the "Reload Image" button. (FYI, You have to press the reload button because this app can not hook the UnitySendMessage callbacks)

If it still takes the time, I guess the problem is in the plugin.
Then you can place break points like when you develop on Android and investigate it more deeply.

Thank you.

from unimgpicker.

eduardhasanaj avatar eduardhasanaj commented on July 17, 2024

I found this last night. Bitmap.compress is the evil there. it can take from 2 sec to 3 or more.
Definitely we need that task to be performed in gpu rather than cpu. I have something but i do not know if you will like and implement also in ios version (am completely noob here). The idea is to create an OpenGL Texture and pass it to unity.
Let me some time to report back.
Best wishes.

from unimgpicker.

thedoritos avatar thedoritos commented on July 17, 2024

Thanks for the report. That's a very helpful feedback!

I think depending on OpenGL is not a good idea. Since there is a possibility that a developer choose to use Metal in iOS.

Instead of that, I have a small idea. What about if we use JPEG to the output format.

image.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);

On my device (Nexus 5 with Android 6.0.1), it reduces the compression time in about 1 sec. I could not feel much difference because the original code (to compress it into PNG) did not take much time on the device.

I'm sorry that I don't have Galaxy phones nor Android 7.x devices...
I feel appreciate if you try it.

Thank you.

from unimgpicker.

eduardhasanaj avatar eduardhasanaj commented on July 17, 2024

Hmmm I think the total time from when user click to displaying texture in unity should be around 1 sec both. Greater than that I think it is not good. Am i exaggerating?
I think that if we can pass opengl texture to unity we can have a good result. The problem is that I do not know c++. I have done something to create texture but i couldnt find a way to properly pass opengl context to unity. To have a generic code we need the c++ code so we can get the context properly.
I will tryy what you said and perhaps we can get a good result

from unimgpicker.

eduardhasanaj avatar eduardhasanaj commented on July 17, 2024

Hey I tried and I am enjoying amazing results when we use opengl. From 1960 it drop to 16 mills ! WTF!
here is a sample app https://ufile.io/3aed4
now we have just to do another version using opengles20.

from unimgpicker.

eduardhasanaj avatar eduardhasanaj commented on July 17, 2024

Did you test it?

from unimgpicker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.