Hacker News new | ask | show | jobs
by ebassi 5060 days ago
not every video frame is encoded in RGB. actually, very few transports use that.

the in-memory layout of a YUV-encoded frame is different than the one of a RGB one. it needs conversion, which implies an intermediate copy, as well as traversing a buffer that can go up to 1080 rows.

most video players (and Flash on Windows and MacOS), these days, use shaders and multi-texturing to do that conversion on the GPU; it removes a copy, because you just push the YUV frame as it is to the GPU - and your CPU can go back to a low C state.

I think Flash on Linux does this as well, on nVidia: the blog post linked is from 2010. the way Adobe detect capabilities is, in itself, hilariously bad - instead of checking the GL required GL extensions like any normal people, they do a check on the GL vendor string. the Mesa guys pointed that out, but I doubt they ever received a response.

2 comments

My system isn't shader capable and still playing HTML5 video tag consumes only ~30% of CPU while playing flash ~90%.

There is no excuse for that - I could understand higher CPU usage, but not by factor of 3.

Are you on Linux ? That is the only plat that I see taking higher cpu usage while playing viedo in flash. Both windows and osx now play flash with little cpu usage.
Yes, I'm on Linux - but it still doesn't explain why flash is consuming so much CPU (I'm using VESA drivers for graphics)
Why don't they encode the elements to YUV once, and then flip to YUV (so not needing to convert each time), as opposed to converting the video to RGB?
I _think_ you lose a _lot_ of color going from RGB->YUV, also you are just replacing one expensive color space conversion with another.