3 Replies - 214 Views - Last Post: 12 August 2018 - 02:26 AM

#1 clever_monkey777   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 29-April 18

I shouldn't worry about android not using hardware acceleration,ri

Posted 10 August 2018 - 07:20 AM

I'm using a drawable animation to produce a "flip card" effect, ye know, the kind that you saw on those baseball games.

So what I do is that I add a bunch of frames, display it one by one (done by android of course, using relevant API) and I couldn't help but notice that it's kind of laggy.

Don't get me wrong, I understand there are too many factors at play here but I'm just worry about one: when using android drawable animation api, is the accerlation a major factor here? Or is it minuscule? I did turn on the 2d acce. in AndroidManifest.xml on application level.

Also, another 2 questions:

2. If I use a very tiny PNG file, and stretch it to a big one, does that reduce the CPU's work load? E.g. what if I use a 640 * 320 PNG file and then scale it to 1920*1080, will the final result be improved or virtually the same? I understand the RAM consumption will surely be less but the graphic computation load? I'm not sure.

3. Since all the animation will be run on main UI thread, is it possible to give these animation as much priority as possible? Allocating them with more time-slots?

Is This A Good Question/Topic? 0
  • +

Replies To: I shouldn't worry about android not using hardware acceleration,ri

#2 Radius Nightly   User is offline

  • D.I.C Regular

Reputation: 39
  • View blog
  • Posts: 305
  • Joined: 07-May 15

Re: I shouldn't worry about android not using hardware acceleration,ri

Posted 11 August 2018 - 05:12 AM

Adding lots of frames needs power, se each picture has to be loaded before shown, so speed depends on CPU, internal/external memory and RAM speed, but you can add delay, like some kind of pause between each frame, for example, 60FPS means in 1 second 60 pictures are shown, each one have delay of 16.6 milliseconds, because 1000MS (1sec) divided with 60FPS. It can make it run fine on all phones. To avoid having lots of pictures, its wise to use animated one, video, or even an image, such as GIF if quality is fine for your pictures, or APNG (its same as GIFs, animated picture, but actually animated PNG, one file, smaller, more optimized and easier to work with then lots of pictures, best quality, works fine everywhere the same).

Phone CPUs are optimized, dual CPUs like weak CPU + high end CPU or single CPU that got clock speed from 0.133GHz to 2.5GHZ, also enabling and disabling cores, to save battery, so this kind of stuff can be a problem. For example, when i turn my camera on, all 8 cores power on to max, if i press stand by button to let it sleep, CPU shuts down all cores, except one thats working at 0.1GHz, and when i wake up my phone, camera is still up, but it continues to work with one core at 0.1GHz until it needs more, but he dont know, so it makes slideshow 21MP camera, and CPU thinks its normal, until i hit focus, start recording or so, then CPU will hit all cores on purpose. So, if its a problem, for the UI, dont do it, try to work as it is, in other chases your UI will simply burn battery. For example, good phone saver can keep a phone in stand by for 3 days and consume only 3% of a battery, but when you wake it up, with priority UI, UI will drain battery like some game, keeping CPU overclocked for no real reason.
IDK, but why would you wanna do that? Each user got something and wants something, and phones are made for it, so working against something unknown that may be very important for the sake of your UI smooth speed doesnt make any sense.

PNG files are like BMP, it doesnt really have a compression, but rather optimization, each pixel contain its own information for itself and its independent against other pixels, and it must be loaded. Because of that, PNG images got much bigger sizes then JPG or similar, while BMP got even more (probably because its too old), and PCX and similar formats contains much more data, so its even bigger, that data must be loaded from internal storage to RAM and then show, it may take some time. So it doesnt matter what quality the image is, bigger resolution brings more pixels, bigger sizes, needs more power, its not like JPG thats cut in pieces, compressed so small and extra large image can have same amount of bytes.

Edit: If you talk about small image having at full screen resized, then no actual difference will be.

This post has been edited by Radius Nightly: 11 August 2018 - 05:31 AM

Was This Post Helpful? 1
  • +
  • -

#3 clever_monkey777   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 29-April 18

Re: I shouldn't worry about android not using hardware acceleration,ri

Posted 11 August 2018 - 06:59 PM

View PostRadius Nightly, on 11 August 2018 - 05:12 AM, said:

Phone CPUs are optimized, dual CPUs like weak CPU + high end CPU or single CPU that got clock speed from 0.133GHz to 2.5GHZ,



Ye know I keep forgetting this: "my phone runs it just fine but why not the dev board!" - well it's because my phone has quad core while the dev board relies solely on 1 Samsung processor clocked @ 1Ghz.

View PostRadius Nightly, on 11 August 2018 - 05:12 AM, said:

or APNG


I can't believe this is the first time I've ever heard of it. Sadly APNG doesn't appear to be natively supported by Android... yet. I'll look into it in the future, maybe.

View PostRadius Nightly, on 11 August 2018 - 05:12 AM, said:

Edit: If you talk about small image having at full screen resized, then no actual difference will be.


You are right, I just tested it: no difference. The GPU still have to render it at real time with the same amount of pixels.
Was This Post Helpful? 0
  • +
  • -

#4 Radius Nightly   User is offline

  • D.I.C Regular

Reputation: 39
  • View blog
  • Posts: 305
  • Joined: 07-May 15

Re: I shouldn't worry about android not using hardware acceleration,ri

Posted 12 August 2018 - 02:26 AM

Im not Android programmer, so my information are comprehensive. That one core is probably emulated and not the real scenario.

Strange for Android, i tough it supports APNG, because its the best animated picture quality that exists and because its supported by all image viewers as well as web-browsers since 2008-2010 when i found out about it and explore it, and older classic PNG libraries can run it. However, if GIF is supported, it can be medium-high quality, not perfect, but it can be higher then classic GIFs that peoples making, i experiment with that trough VirtualDub really long time ago to get real good quality of a recorded video in GIF and i success, but it was very big GIF and i dont think its efficient, very old technology... So, i may guess, for lots of pictures, they must all be loaded in memory to be ready to be shown, maybe prerendered, but i guess after first time phone shows it stays in memory.

This post has been edited by Radius Nightly: 12 August 2018 - 02:30 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1