Tuesday, 3 March 2009

How Flash has an unfair advantage over other Web mediums

When playing DVDs or DIVX video files in Windows, sometimes the DVD player complains "Cannot get overlay surface".


I thought nothing of it, and a Google search revealed nothing.

So I learned bits and pieces about these 'overlay surfaces':

*Only one overlay surface is available, and if a program has claimed it, another program can't use it (eg, a web browser claimed it, so my DVD player complains). Sometimes it gets 'trapped' and DxDiag has to be run (run the Display tests) to reset it.

*When it's not available, DIVX doesn't complain like my DVD player, but it's easy to see what happens without it: The video is pixellated and unwatchable (and jerky).

*Therefore, the overlay surface performs 2 functions: One is to smooth out the video, and the other is to speed up rendering.

So what?

Well, I noticed Flash looks slicker in a browser window than a GIF or JPEG. But GIFs are not lossy! So why is Flash visibly Flash?

Duh? Best guess - it's the overlay surface! Flash, being a natively-compiled browser plugin (not Javascript or Java, etc) cheats by grabbing the overlay surface for itself, just in the Flash window in the browser.

Is this fair? No! It means other video players in the browser look blocky in comparison. The browser graphics look blocky in comparison.

So the solution? Simple - give every browser window an overlay surface via DirectX. The difference in resolution and animation speed will be immediately visible.

Postscript: Someone from Hacker News pointed out: It's not a overlay surface, it's a deblocking filter. But the same complaint: That Flash has a deblocking filter in the browser window when the HTML pages don't - stands.