Sunday, April 3, 2011

Why Is Flash Still Hogging My CPU?

Flash has had hardware acceleration "forever", or at least as long as I can remember. I suppose it did not back when it was always called Shockwave Flash, but in those days there probably was not much hardware acceleration to take advantage of.

The purpose of hardware acceleration is to allow Flash to do its job while using less CPU, instead letting the GPU hardware do some of the work. On a computer with a slower CPU, this may be the difference between getting smooth video or something closer to a choppy sequence of poor quality still photos. For more modern computers, this should allow the machine to produce smooth, high quality video while allowing the CPU to work on other things.

Flash 10.1 upped the ante by adding hardware decoding, which means the work of decompressing highly compressed video formats like H.264 could be performed by GPUs with this capability built in. The 10.2 iteration of Flash introduced Stage Video, which "helps websites deliver best-in-class video across screens and browsers by enabling access to hardware acceleration of the entire video pipeline."

After upgrading to Flash 10.2, I was left asking "why is Flash still hogging my CPU?" Watching March Madness On Demand from my old-but-serviceable everyday desktop (Athlon 64 X2 3800+, Windows XP SP3, GeForce 8400GS graphics), for example, pinned the CPU between 90 and 100%. Other video sites like ABC and Hulu ran at about 50% CPU, effectively monopolizing one of the two CPU cores.

I wondered whether I needed to upgrade to a newer, but still entry level, video card like a 220, 240, 430 or 440, or whether the DirectX 9 limitation of Windows XP was a problem. However, when I checked out Stage Video on Adobe's site, I ran the examples and found that 720p video scaled to full screen could run at under 15% CPU. The Big Buck Bunny demo is especially cool, as it allows you to turn Stage Video on and off to compare CPU usage.

After a little thought, my suspicion is that sites like ABC and Hulu use Flash plug-ins or other code that prevents the Stage Video pipeline from working, probably to implement digital rights management (DRM). Maybe the problems are related to the way in which the videos are encoded or streamed. In any case, other sites for which this seems to be true include Crackle, The WB, PBS and CBS.

Tuesday, February 1, 2011

Flash At Last For My Archos 32

I got an Archos 32 Internet Tablet for Christmas.  It is not really a tablet; I call it my Android Touch because its form factor and primary usage profile are similar to the iPod Touch.  My objective was to have an Android device to verify the functionality of apps I develop  The specs are reasonable for the price and Archos released a firmware upgrade in December that included Froyo, also known as Android 2.2.  I have to admit, though, that I was jealous of my son for whom I bought an Archos 70, which has a truly beautiful multi-touch screen.

The downside of having a non-phone device is that it is not Google certified and out of the box does not have Google apps such as Gmail, YouTube, and most importantly, the app Market.  I finally got around to finding a way around this and was successful enough to have Flash 10.1 running within minutes.

The magic is gapps4archos.apk.  A link for downloading it is in the forums on archosfans.com.  Because the forum post specifically talks about firmware 2.0.54 and I had already upgraded to 2.1.04, I did not have high hopes that the app would work.  Regardless, I downloaded the file to my PC. After turning off application debugging via USB on my Archos 32, I connected the USB cable between it and the PC. The Archos showed up as the E: drive in Windows. I copied the downloaded file from the PC to E:, ejected the E: drive in Windows, then unplugged the device from USB. I opened the Files app on the Archos home screen, found the file gapps4archos and tapped it. (Note that my device's application settings allow apps from unknown sources.)  In the app, I clicked the button to install Google apps. When that was done, I rebooted the Archos (held the power button down, choose Power Off, then Reboot). When it came back up the home screen had Gmail, YouTube, the app Market, and others.

I first ran Gmail, entered my Google account information, and was soon synchronizing data and settings between the Archos and Google. I then started the Market app, searched for "Adobe Flash" in the market, and chose to download Flash 10.1.  When that download was done I started the Browser app and went to addictinggames.com.  Success.  To test Flash video streaming, I went to crackle.com and was watching a trailer with just a few taps.  I was able to rotate to landscape orientation and push the Flash player to full screen mode.  OK, on a 3.2" screen, it was not an amazing cinematic experience, but it was extremely gratifying nonetheless.