Decode Like It's 1999: MPEG-1 Decoder in JavaScript
phoboslab.org
phoboslab.org
The fun thing about experimenting with video codecs is that your results are visible in a very real way.
A few years ago I wrote a JPEG encoder for a class, and it was one of the most fun projects I've had at the university. Seeing a picture with those iconic compression artifacts produced by your own implementation feels pretty nice :)
:D
I put that in quotes, because it was a byproduct of a much cleverer project: http://www.argondesign.com/products/argon-streams-hevc/ ; he wrote a parser for the "human readable" H265 specification, using the O-Meta system. This supported a number of pluggable backends, one of which emitted a javascript program, and one of which was the actual saleable product of an H265 decoder validation test suite.
Here in the future, both Firefox and Chromium are still decoding MPEG in software, not hardware.[1]
Chromium is actively working to fix that[2]. Mozilla, not so much.[3]
I've been hitting this lately, as webcams use MPEG at high resolutions (to fit USB 2 bandwidth). It's painful for AR.
[1] https://wiki.archlinux.org/index.php/Hardware_video_accelera... [2] https://chromium-review.googlesource.com/c/chromium/src/+/53... [3] https://bugzilla.mozilla.org/buglist.cgi?quicksearch=linux+h...
This is probably a silly question, but: The article says he has to use performance.now. But isn't one of the mitigations for Spectre and/or Meltdown, to reduce the accurance and/or resolution of performance.now? If so, would that affect his code?
We squeezed them to 10MB with minimal quality reduction, but another problem quickly arouse - this was late 2013 and the phones back then could barely handle such load and heated up tremendously.
All in all we negotiated a pretty deep cut in special effects which yielded ~25MB in reductions. A rotten compromise, but a compromise nonetheless.
[1]: https://blog.codinghorror.com/the-principle-of-least-power/
Using JavaScript build tools? Lol nope!
> A bug that still stands in some Browsers (Chrome and Safari) prevents WebGL from using the Uint8ClampedArray directly. Instead, for these browsers we have to create a Uint8Array view for each array for each frame. This operation is pretty fast since nothing needs to be copied, but I'd still like to do without it.
Why worry about it if you're not actually copying the buffer? It's like allocating one extra tiny object per frame, right? It seems like it would be totally insignificant compared to the rest of the workload.
If the goal is anything but learning that is.
> WebRTC is not supported on iOS.
No longer true.