├── .gitignore ├── .gitmodules ├── .npmignore ├── LICENSE ├── LICENSE-VP8 ├── Makefile ├── README.md ├── badge.svg ├── benchmarks ├── benchmark.build.js ├── benchmark.js ├── index.html └── style.css ├── build-templates ├── OGVVideoDecoder.js └── jsvpx.js ├── builds ├── jsvpx.js └── ogv-decoder-video-vp8.js ├── examples ├── media │ └── Curiosity's_Seven_Minutes_of_Terror.ogv.240p.webm └── ogv-simple │ └── index.html ├── package.json ├── test ├── browser-tests.build.js ├── browser-tests.js ├── compare-hashes.js ├── index.html ├── test-vector-list.js └── test.js ├── util └── c_utils.js ├── vp8 ├── common │ ├── blockd.js │ ├── coefupdateprobs.js │ ├── default_coef_probs.js │ ├── entropy.js │ ├── entropymode.js │ ├── entropymv.js │ ├── filter.js │ ├── findnearmv.js │ ├── idctllm.js │ ├── loopfilter_filters.js │ ├── modecont.js │ ├── mv.js │ ├── onyxc_int.js │ ├── quant_common.js │ ├── reconinter.js │ ├── reconintra.js │ ├── reconintra4x4.js │ ├── setupintrarecon.js │ ├── vp8_entropymodedata.js │ └── vp8_loopfilter.js ├── decoder │ ├── dboolhuff.js │ ├── decodeframe.js │ ├── decodemv.js │ ├── detokenize.js │ ├── onyxc_int.js │ ├── onyxd_if.js │ ├── onyxd_int.js │ └── treereader.js └── vp8_js_iface.js ├── vpx ├── vpx_codec.js ├── vpx_decoder.js └── vpx_image.js ├── vpx_dsp └── bitreader.js └── webpack.config.js /.gitignore: -------------------------------------------------------------------------------- 1 | nbproject 2 | node_modules 3 | builds 4 | examples/ogv-simple/dist -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "vp8-test-vectors"] 2 | path = vp8-test-vectors 3 | url = https://github.com/webmproject/vp8-test-vectors.git 4 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | benchmarks 2 | build-templates 3 | output-vectors 4 | test 5 | examples 6 | vp8-test-vectors 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 jscodec 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LICENSE-VP8: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010, The WebM Project authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in 12 | the documentation and/or other materials provided with the 13 | distribution. 14 | 15 | * Neither the name of Google, nor the WebM Project, nor the names 16 | of its contributors may be used to endorse or promote products 17 | derived from this software without specific prior written 18 | permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | examples : examples/ogv-simple/index.html 2 | rm -rf ogv-simple/dist 3 | cp -R node_modules/ogv/dist examples/ogv-simple 4 | cp builds/ogv-decoder-video-vp8.js examples/ogv-simple/dist 5 | 6 | 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # jsvpx 2 | 3 | jsvpx is a full implementation of libvpx in Javascript. In contrast to other crosscompiled decoders, jsvpx is fully written in Javascript. 4 | 5 | The reason for a full reimplementation as opposed to a simple cross compile, is because video decoding computation is very repetative, and as of now, cross compiled modules can only be single threaded. The project is still in early stages, but now ready to expore multithreading options including WebWorkers or WebGL, possible SIMD, even though it may only work for FireFox (at least for the near future). 6 | 7 | ## Project Status 8 | Vp8 is now working! Still in experimental stages. Output hashes finally match the vp8 test vectors. 9 | Now working on figuring out a few speed issues. 10 | 11 | Works best in Safari. 12 | 13 | Check out a running demo on ogv.js: 14 | http://jscodec.com/ogv-example/#file=Curiosity's_Seven_Minutes_of_Terror.ogv&size=360p.webm 15 | 16 | Based of code from John Koleszar's dixie libvpx branch : https://github.com/webmproject/libvpx/tree/dixie/vpx , 17 | and Dominik Homberger's : https://github.com/dominikhlbg/vp8-webm-javascript-decoder. 18 | 19 | 20 | Currently moving towards the direction of the main branch. 21 | 22 | Looking to try some interesting things with webworkers, or perhaps some GPU. 23 | 24 | ### ChangeLog 25 | * v0.0.2 26 | * Added browser unit tests in test folder : http://jscodec.com/jsvpx-tests/ 27 | * Added comprehensive benchmark tool : http://jscodec.com/jsvpx-benchmark/ 28 | * Various Bug Fixes 29 | * Better memory handling 30 | * Improved dequantization 31 | 32 | ### Current TODO 33 | * Figure out whats causing the slow parts, (Probably splitmode prediction) 34 | * Start testing out some webworkers 35 | * Lots of code cleaning to do 36 | 37 | ### Future Planned Work 38 | * Frame corruption/interpolation for missing frames 39 | * Vp9 40 | * Finish filling this out... 41 | 42 | ## Usage 43 | 44 | ### Installation 45 | Make sure to have npm, and git installed. Clone repository, then use: 46 | 47 | For npm modules: 48 | ``` 49 | npm install 50 | ``` 51 | 52 | To pull all git modules: 53 | ``` git submodule update --init ``` 54 | 55 | To Build simply use: 56 | ``` npm run-script build ``` 57 | 58 | 59 | 60 | ### Validation 61 | To validate, use 62 | 63 | `npm run-script test` 64 | 65 | 66 | ### API 67 | The main api is written to closely resemble the C style api of the original libvpx library. In the build-templates folder, you can find various templates for other API's and builds. 68 | 69 | #### jsvpx api 70 | This is the simplest most, most user friendly api. It's usage is more like the traditional javascript api. 71 | ```javascript 72 | var decoder = new jsvpx(); 73 | var rawFrame = decoder.decode(compressedFrame); 74 | 75 | if(rawFrame){ 76 | //do something with it 77 | } 78 | ``` 79 | 80 | ##### jsvpx api demos: 81 | Running on Dominik's **vp8-webm-javascript-decoder:** 82 | 83 | Link to source using jsvpx: 84 | 85 | https://github.com/brianxautumn/vp8-webm-javascript-decoder/tree/JsVpx 86 | 87 | Link to live demo: 88 | 89 | http://jscodec.com/vp8-webm-javascript-decoder/vpxdec.html 90 | 91 | 92 | 93 | #### ogv.js 94 | 95 | * To try with ogv, simply copy ogv-decoder-video-vp8 out of the builds directory and paste it over the generated one. -------------------------------------------------------------------------------- /badge.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | tests 14 | tests 15 | 1574/1574 16 | 1574/1574 17 | 18 | 19 | -------------------------------------------------------------------------------- /benchmarks/benchmark.js: -------------------------------------------------------------------------------- 1 | google.charts.load('current', {packages: ['corechart', 'bar']}); 2 | var testVectors = require('../test/test-vector-list.js'); 3 | 4 | var select = $('#vector-select'); 5 | for(var val in testVectors) { 6 | $('