Monday, February 09, 2009

The Saga of HTC's Video Performance...

...Or, why doesn't video play smoothly on my Diamond or Touch Pro???

Not so long ago, there existed a Smartphone manufacturer named HTC. HTC always used standard tried-and-true CPU architecture from companies like Intel and TI, until the dark lord Qualcomm arrived and changed everything. Qualcomm, an accomplished temptress, offered HTC a "device-on-a-chip", which would drastically reduce manufacturing costs while delivering top-notch performance for mobile devices. All they had to do was sign on the dotted line...
What HTC may not have realized at the time is that Qualcomm's promised performance came at a price- their graphics drivers required proprietary code with high-priced licensing fees! Oh, woe is HTC!
The decision was made to release the devices without proper video acceleration- after all, they are supposed to be WORK/CORPORATE devices, and have no business playing video or games! Surely the kingdom would be happy with this compromise...

So began the saga of the failed video performance on the most recent wave of HTC devices. This problem first reared its ugly head with the HTC Kaiser (Tilt*), Titan (Mogul*), and Vogue (Touch*). The lack of proper video drivers was often so bad, it would make the entire OS seem sluggish compared to the previous generation of devices with "slower" processors. This inspired many angry letters and even a couple of websites petitioning for HTC to release proper drivers, or threats of class action law suits.
(Note: Previously I mentioned Samsung included better drivers for their Omnia, but it appears they just avoided Qualcomm's MSM chipset entirely and went with the Marvell chip. The Verizon literature implies that they are incorrectly using a Qualcomm CPU)

HTC apparently listened a little, and announced that the NEXT set of devices would have 3D acceleration for some nifty new TouchFlo interface. The Diamond and Touch Pro were released with much fanfare shortly thereafter.
However, as I blogged about previously, the Touch Pro (which I've recently made my primary phone) had some minor performance issues out of the box, reminiscent of the previous generation of Qualcomm based devices.

While swapping to a later version of Windows Mobile alleviates almost all of the slow-downs (stock version is sort of laggy in general), the video STILL seems to have trouble keeping up when playing back movies at full sized VGA resolution.

The reason for this, is the missing peice of the Qualcomm Puzzle: Qtv

Qtv is a display driver specifically designed by Qualcomm to deliver high performance video to small screens that are powered by their chips. This is part of what Qualcomm has been dangling over the heads of OEMs for royalty fees. Unlike D3D, DirectDraw or GDI, it is NOT a standard video driver and the code to make it work can only be obtained from Qualcomm directly, and only by paying for the licensing rights to it. This means that while the new Diamond and Touch Pro devices have beautifully flowing menus and 3D effects, actual plain-old video playback still lags.

So how do I get the best video playback on a Diamond or Touch Pro?

In order to get full video acceleration, you're going to need to use the Qtv driver. However, since it is proprietary, most popular video playing applications (TCPMP, divxMobile, etc) DON'T support it, offering the industry standard DirectDraw method at best. DirectDraw support has improved since the first wave of Qualcomm based devices (which originally barely worked at ALL), but it still seems to have trouble drawing VGA video smoothly. In other words, if you're using DirectDraw, you're probably NOT going to get smooth full-resolution video.

For the Diamond/Touch Pro, HTC decided to cave in and license Qtv for their new HTC Album (which is normally used to play back video taken with the device's camera), and it appears to have trickled down to the bundled Windows Media Player as well. This may mark the first time that a video plays smoother in the bloated WMP than something like the open-source TCPMP.

In fact, the hardcore users over at XDA-Developers have even developed a tool to convert videos to high quality Mp4 that HTC Album can play, citing it as "the best way to watch full sized videos on the Touch Pro". They even go on to say not to bother complaining if you are using CorePlayer or some other player, since they do not contain the full Qtv support.

NOTE: I did a little comparison myself to see the difference, and found an mp4 of a TV show played PERFECTLY in HTC Album (had to place the video into the "storage card\my videos" dir for it to show up) in full VGA, whereas TCPMP could barely keep up with the frame rate, delivering 10-12 frames per second (as opposed to the nearly 30fps it was encoded at).

But doesn't CorePlayer now support Qtv?

Sort of.
Qtv is propietary, and the folks at Core haven't paid for the code, so they don't have it. However, what they DID do is figure out how to call the video routine overlay. This is similar to how desktop-based DVD player apps tend to work on hardware accelerated PCs- they paint a box of a specific shade which the renderer uses to overlay the video, thus taking the rest of the work away from the OS.
This works pretty darned well, although from my testing, it doesn't play mp4 as well as HTC Album which has "real" qtv acceleration.

Still, Coreplayer supports DivX avi files, which I've always found a great deal more efficient than mp4 video. In fact, I was able to take DivX videos directly from my computer and drag them over to my Touch Pro (no conversion/encoding needed) and play them surprisingly well when set to Qtv (benchmark reported playback at about 90% full speed, which means only some frames dropped and there). Still, HTC Album seemed to do this more effortlessly.

The only problem with using CorePlayer's Qtv is when using the video out function. The overlay doesn't translate well, and creates a flickering blue screen every few seconds, which is VERY annoying. Hopefully the team at Core is going to come up with a workaround, but for now the best option especially for video out is using HTC Album (or... *Gulp* Windows Media Player!).

Hopefully more workarounds will come out soon. Personally, I'd love to see someone rebuild TCPMP with full Qtv display drivers... Perhaps one day.


*When listing alternate names for the Kaiser, Titan and Vogue, I picked the most common carrier branded versions so that people may recognize them more easily. In this case, the AT&T Tilt, Sprint Mogul, and Sprint Touch, respectively. These have many other names on various carriers, as I am very well aware. No need to point out alternative instantiations.