yuv-canvas
Advanced tools
Comparing version 1.2.11 to 1.3.0
@@ -126,3 +126,3 @@ (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ | ||
/* | ||
Copyright (c) 2014-2016 Brion Vibber <brion@pobox.com> | ||
Copyright (c) 2014-2024 Brooke Vibber <bvibber@pobox.com> | ||
@@ -262,17 +262,2 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
/** | ||
* Allocate a new YUVPlane object of the given size. | ||
* @param {number} stride - byte distance between rows | ||
* @param {number} rows - number of rows to allocate | ||
* @returns {YUVPlane} - freshly allocated planar buffer | ||
*/ | ||
allocPlane: function(stride, rows) { | ||
YUVBuffer.validateDimension(stride); | ||
YUVBuffer.validateDimension(rows); | ||
return { | ||
bytes: new Uint8Array(stride * rows), | ||
stride: stride | ||
} | ||
}, | ||
/** | ||
* Pick a suitable stride for a custom-allocated thingy | ||
@@ -466,3 +451,3 @@ * @param {number} width - width in bytes | ||
/* | ||
Copyright (c) 2014-2016 Brion Vibber <brion@pobox.com> | ||
Copyright (c) 2014-20124 Brooke Vibber <bvibber@pobox.com> | ||
@@ -583,3 +568,3 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
/* | ||
Copyright (c) 2014-2016 Brion Vibber <brion@pobox.com> | ||
Copyright (c) 2014-2024 Brooke Vibber <bvibber@pobox.com> | ||
@@ -1111,3 +1096,3 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
/* | ||
Copyright (c) 2014-2019 Brion Vibber <brion@pobox.com> | ||
Copyright (c) 2014-2024 Brooke Vibber <bvibber@pobox.com> | ||
@@ -1139,4 +1124,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
* | ||
* @author Brion Vibber <brion@pobox.com> | ||
* @copyright 2014-2019 | ||
* @author Brooke Vibber <bvibber@pobox.com> | ||
* @copyright 2014-2024 | ||
* @license MIT-style | ||
@@ -1254,3 +1239,3 @@ * | ||
/* | ||
Copyright (c) 2014-2016 Brion Vibber <brion@pobox.com> | ||
Copyright (c) 2014-2024 Brooke Vibber <bvibber@pobox.com> | ||
@@ -1281,4 +1266,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
* | ||
* @author Brion Vibber <brion@pobox.com> | ||
* @copyright 2016 | ||
* @author Brooke Vibber <bvibber@pobox.com> | ||
* @copyright 2016-2024 | ||
* @license MIT-style | ||
@@ -1308,3 +1293,3 @@ * | ||
/* | ||
Copyright (c) 2014-2016 Brion Vibber <brion@pobox.com> | ||
Copyright (c) 2014-2024 Brooke Vibber <bvibber@pobox.com> | ||
@@ -1311,0 +1296,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of |
{ | ||
"name": "yuv-canvas", | ||
"version": "1.2.11", | ||
"version": "1.3.0", | ||
"description": "Utility for drawing YUV image data to HTML5 canvas", | ||
@@ -8,3 +8,3 @@ "main": "src/yuv-canvas.js", | ||
"type": "git", | ||
"url": "https://github.com/brion/yuv-canvas.git" | ||
"url": "https://github.com/bvibber/yuv-canvas.git" | ||
}, | ||
@@ -22,15 +22,15 @@ "scripts": { | ||
], | ||
"author": "Brion Vibber <brion@pobox.com>", | ||
"author": "Brooke Vibber <bvibber@pobox.com>", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"aliasify": "^2.0.0", | ||
"aliasify": "^2.1.0", | ||
"brfs": "^1.4.3", | ||
"browserify": "^13.1.0", | ||
"grunt": "^1.0.3", | ||
"grunt-browserify": "^5.3.0", | ||
"grunt-eslint": "^19.0.0", | ||
"grunt": "^1.6.1", | ||
"grunt-browserify": "^6.0.0", | ||
"grunt-eslint": "^24.0.1", | ||
"grunt-text-replace": "^0.4.0", | ||
"http-server": "^0.12.3", | ||
"yuv-buffer": "^1.0.0" | ||
"http-server": "^14.1.1", | ||
"yuv-buffer": "^1.0.1" | ||
} | ||
} |
@@ -1,18 +0,24 @@ | ||
**YUVCanvas draws YUV video frames to an HTML 5 canvas element.** | ||
# YUVCanvas draws YUV video frames to an HTML 5 canvas element. | ||
It is used in the [ogv.js media player](https://github.com/brion/ogv.js) | ||
It is used in the [ogv.js media player](https://github.com/bvibber/ogv.js) | ||
and is suitable for high-frequency frame updates using WebGL for drawing | ||
and colorspace conversion. | ||
# Copyright | ||
## Copyright | ||
Copyright 2014-2022 by Brion Vibber <brion@pobox.com> | ||
Copyright 2014-2024 by Brooke Vibber <bvibber@pobox.com> | ||
MIT license, see the source files: | ||
* Source: https://github.com/brion/yuv-canvas | ||
* Issues: https://github.com/brion/yuv-canvas/issues | ||
* Source: https://github.com/bvibber/yuv-canvas | ||
* Issues: https://github.com/bvibber/yuv-canvas/issues | ||
# Updates | ||
## Updates | ||
1.3.0 - 2024-10-03 | ||
* build cleanup | ||
* doc/name/links cleanup | ||
1.2.11 - 2022-03-04 | ||
* perf: further improvements to speed in Safari / macOS using alpha instead of luminance textures | ||
@@ -22,2 +28,3 @@ * update shaders from low to medium precision, may fix pixel precision errors on some GPUs | ||
1.2.10 - 2022-03-04 | ||
* perf: fixed over-eager use of texImage2d on non-stripe frame updates | ||
@@ -27,8 +34,11 @@ * turning off stripe mode as default due to a compatibility problem with Netscape on macOS that is not resolved | ||
1.2.9 - 2022-01-27 | ||
* re-enabled "stripe" hack, but now by default everywhere. Turns out it makes a huge difference on macOS with some AMD GPUs too! | ||
1.2.8 - 2022-01-11 | ||
* disabled "stripe" texture hack for Windows by default; uses deprecated userAgent, and makes little difference in 2022 vs 2014 | ||
1.2.7 - 2021-05-26 | ||
* applied contributed patch updating texture state when frame size changes | ||
@@ -38,15 +48,19 @@ * added dev dep for running demo on http-server | ||
1.2.6 - 2019-05-27 | ||
* added an extra WebGL option to preserve back buffer, fixes canvas video capture in Firefox | ||
1.2.5 - 2019-05-27 | ||
* remove some extra WebGL options that just slowed things down and could cause flicker in Safari during canvas video capture | ||
1.2.4 - 2019-02-06 | ||
1.2.4 - 2019-02-06 | ||
* fix software rendering path for crop offsets (Theora) | ||
1.2.3 - 2019-02-04 | ||
* optimize software rendering path by a few percent | ||
1.2.2 - 2019-02-04 | ||
* don't use WebGL when software rendering is in use (failIfMajorPerformanceCaveat) | ||
@@ -56,5 +70,7 @@ * fix use of preferLowPowerToHighPerformance for preferring integrated GPU | ||
1.2.1 - 2018-01-18 | ||
* fix regression breaking iOS 9 | ||
1.2.0 - 2017-10-27 | ||
* optimized Windows rendering (restored "stripe" more cleanly) | ||
@@ -64,17 +80,20 @@ * retooled rendering order to minimize CPU/GPU sync points | ||
1.1.0 - 2017-10-27 | ||
* improved scaling/filtering on Windows (dropped "stripe" optimization) | ||
1.0.1 - 2017-02-17 | ||
* fix flickering in Safari with software rendering | ||
1.0.0 - 2016-09-11 | ||
* Initial break-out release from ogv.js | ||
# Data format | ||
## Data format | ||
Planar YUV frames are packed into objects per the [yuv-buffer](https://github.com/brion/yuv-buffer) format. Frame buffer objects can be safely copied or transferred between worker threads, and can be either garbage collected or reused for another frame after output. | ||
Planar YUV frames are packed into objects per the [yuv-buffer](https://github.com/bvibber/yuv-buffer) format. Frame buffer objects can be safely copied or transferred between worker threads, and can be either garbage collected or reused for another frame after output. | ||
Each frame buffer includes the frame's size, a crop rectangle, a display aspect ratio, and chroma subsampling format as well as the raw bytes. | ||
# WebGL drawing acceleration | ||
## WebGL drawing acceleration | ||
@@ -85,3 +104,3 @@ Accelerated YCbCr->RGB conversion and drawing is done using WebGL on supporting browsers (Firefox, Chrome, IE 11, Edge, and Safari for iOS 8 & OS X 10.9), and is enabled by default if available. | ||
## Windows vs luminance textures | ||
### Windows vs luminance textures | ||
@@ -96,7 +115,7 @@ The Y, U and V planes are uploaded as luminance textures, then combined into RGB output by a shader. | ||
# Usage | ||
## Usage | ||
`yuv-canvas` is intended to be used via [browserify](http://browserify.org/), [webpack](http://webpack.github.io/), or similar npm-friendly bundling tool. | ||
``` | ||
```js | ||
var YUVCanvas = require('yuv-canvas'); | ||
@@ -124,11 +143,22 @@ | ||
# Demo | ||
## Demo | ||
The [included demo](https://brion.github.io/yuv-canvas/demo.html) combines Y, U, and V planes from grayscale JPEGs into a color photograph on a canvas. Check it out! | ||
The [included demo](https://bvibber.github.io/yuv-canvas/demo.html) combines Y, U, and V planes from grayscale JPEGs into a color photograph on a canvas. Check it out! | ||
## Building | ||
# Building | ||
Run `npm install` (or `grunt` to rebuild if necessary) to build derived files in a local source checkout. | ||
Derived files are the array of WebGL shaders (`build/shaders.js`) and the bundled JS for the demo (`docs/demo-bundled.js`). | ||
# License | ||
MIT-style license: | ||
Copyright (c) 2014-2024 Brooke Vibber <bvibber@pobox.com> | ||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
/* | ||
Copyright (c) 2014-2016 Brion Vibber <brion@pobox.com> | ||
Copyright (c) 2014-2024 Brooke Vibber <bvibber@pobox.com> | ||
@@ -28,4 +28,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
* | ||
* @author Brion Vibber <brion@pobox.com> | ||
* @copyright 2016 | ||
* @author Brooke Vibber <bvibber@pobox.com> | ||
* @copyright 2016-2024 | ||
* @license MIT-style | ||
@@ -32,0 +32,0 @@ * |
/* | ||
Copyright (c) 2014-2016 Brion Vibber <brion@pobox.com> | ||
Copyright (c) 2014-20124 Brooke Vibber <bvibber@pobox.com> | ||
@@ -4,0 +4,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of |
/* | ||
Copyright (c) 2014-2016 Brion Vibber <brion@pobox.com> | ||
Copyright (c) 2014-2024 Brooke Vibber <bvibber@pobox.com> | ||
@@ -4,0 +4,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of |
/* | ||
Copyright (c) 2014-2019 Brion Vibber <brion@pobox.com> | ||
Copyright (c) 2014-2024 Brooke Vibber <bvibber@pobox.com> | ||
@@ -29,4 +29,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
* | ||
* @author Brion Vibber <brion@pobox.com> | ||
* @copyright 2014-2019 | ||
* @author Brooke Vibber <bvibber@pobox.com> | ||
* @copyright 2014-2024 | ||
* @license MIT-style | ||
@@ -33,0 +33,0 @@ * |
/* | ||
Copyright (c) 2014-2016 Brion Vibber <brion@pobox.com> | ||
Copyright (c) 2014-2024 Brooke Vibber <bvibber@pobox.com> | ||
@@ -4,0 +4,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of |
Sorry, the diff of this file is not supported yet
231636
25
157
2170