redwarp / gifdecoder

An implementation of a gif decoder written 100% in Kotlin, plus an associated Drawable for Android
Apache License 2.0
47 stars 6 forks source link

speed up the playback cause UI busy, suspend to response subsequence touch events #25

Closed vince-styling closed 1 year ago

vince-styling commented 1 year ago

the adjustments I mentioned in other issue is to allow user pick the playback speed, for example 1X 2X 3X 4X, but your preload work scheduling by UI thread, can't satisfy my purpose when speed turn to fast, that's why I give up the BitmapCache and preload Executor.

after I implement this in a Thread, it work but no perfect, the highest speed will cause UI busy, suspending to response subsequence touch events, must kill the process to solve, it cannot accept for user, also for me.

so I turn to SurfaceView, also I noticed you offer a simple demo for drawing gif into Surface, get rid of the UI busy problem eventually.

but still can't satisfy the speed, because decode next frame sometime slow for those large resolution frame, most time wasting in the lzw data decode, so I plan to have a preloader which step forward only to pre decode next frame's lzw data, via Coroutines I think, I want to ask if you have some advices to achive this, thanks

redwarp commented 1 year ago

So I see what you want to do but I don't have good advice: I'm not an expert at threading and I'm already not sure that my current solution is good. So good luck!!