@stream-io/video-filters-web 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/index.cjs.js +7 -14
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +7 -14
- package/dist/index.es.js.map +1 -1
- package/dist/src/webgl2/resizingStage.d.ts +1 -1
- package/dist/src/webgl2/webgl2Pipeline.d.ts +1 -1
- package/package.json +5 -5
- package/src/webgl2/resizingStage.ts +4 -1
- package/src/webgl2/webgl2Pipeline.ts +2 -0
package/dist/index.es.js
CHANGED
|
@@ -572,7 +572,7 @@ function buildJointBilateralFilterStage(gl, vertexShader, positionBuffer, texCoo
|
|
|
572
572
|
return { render, updateSigmaSpace, updateSigmaColor, cleanUp };
|
|
573
573
|
}
|
|
574
574
|
|
|
575
|
-
function buildResizingStage(gl, vertexShader, positionBuffer, texCoordBuffer, tflite, segmentationConfig) {
|
|
575
|
+
function buildResizingStage(gl, vertexShader, positionBuffer, texCoordBuffer, tflite, segmentationConfig, onError) {
|
|
576
576
|
const fragmentShaderSource = glsl `#version 300 es
|
|
577
577
|
|
|
578
578
|
precision highp float;
|
|
@@ -606,7 +606,8 @@ function buildResizingStage(gl, vertexShader, positionBuffer, texCoordBuffer, tf
|
|
|
606
606
|
// Downloads pixels asynchronously from GPU while rendering the current frame.
|
|
607
607
|
// The pixels will be available in the next frame render which results
|
|
608
608
|
// in offsets in the segmentation output but increases the frame rate.
|
|
609
|
-
readPixelsAsync(gl, 0, 0, outputWidth, outputHeight, gl.RGBA, gl.UNSIGNED_BYTE, outputPixels)
|
|
609
|
+
readPixelsAsync(gl, 0, 0, outputWidth, outputHeight, gl.RGBA, gl.UNSIGNED_BYTE, outputPixels).catch((error) => {
|
|
610
|
+
});
|
|
610
611
|
for (let i = 0; i < outputPixelCount; i++) {
|
|
611
612
|
const tfliteIndex = tfliteInputMemoryOffset + i * 3;
|
|
612
613
|
const outputIndex = i * 4;
|
|
@@ -671,7 +672,7 @@ function buildSoftmaxStage(gl, vertexShader, positionBuffer, texCoordBuffer, tfl
|
|
|
671
672
|
return { render, cleanUp };
|
|
672
673
|
}
|
|
673
674
|
|
|
674
|
-
function buildWebGL2Pipeline(videoSource, backgroundImage, blurLevel, backgroundFilter, canvas, tflite, segmentationConfig) {
|
|
675
|
+
function buildWebGL2Pipeline(videoSource, backgroundImage, blurLevel, backgroundFilter, canvas, tflite, segmentationConfig, onError) {
|
|
675
676
|
const gl = canvas.getContext('webgl2');
|
|
676
677
|
if (!gl)
|
|
677
678
|
throw new Error('WebGL2 is not supported');
|
|
@@ -695,7 +696,7 @@ function buildWebGL2Pipeline(videoSource, backgroundImage, blurLevel, background
|
|
|
695
696
|
gl.bindVertexArray(vertexArray);
|
|
696
697
|
const positionBuffer = gl.createBuffer();
|
|
697
698
|
gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);
|
|
698
|
-
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1
|
|
699
|
+
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1, -1, 1.0, -1, -1, 1.0, 1.0, 1.0]), gl.STATIC_DRAW);
|
|
699
700
|
const texCoordBuffer = gl.createBuffer();
|
|
700
701
|
gl.bindBuffer(gl.ARRAY_BUFFER, texCoordBuffer);
|
|
701
702
|
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0]), gl.STATIC_DRAW);
|
|
@@ -859,7 +860,7 @@ const createTFLiteSIMDModule = (__Module) => {
|
|
|
859
860
|
if (Module['quit']) quit_ = Module['quit'];
|
|
860
861
|
var wasmBinary;
|
|
861
862
|
if (Module['wasmBinary']) wasmBinary = Module['wasmBinary'];
|
|
862
|
-
|
|
863
|
+
Module['noExitRuntime'] || true;
|
|
863
864
|
if (typeof WebAssembly != 'object') {
|
|
864
865
|
abort('no native wasm support detected');
|
|
865
866
|
}
|
|
@@ -924,10 +925,6 @@ const createTFLiteSIMDModule = (__Module) => {
|
|
|
924
925
|
var __ATINIT__ = [];
|
|
925
926
|
var __ATPOSTRUN__ = [];
|
|
926
927
|
|
|
927
|
-
function keepRuntimeAlive() {
|
|
928
|
-
return noExitRuntime;
|
|
929
|
-
}
|
|
930
|
-
|
|
931
928
|
function preRun() {
|
|
932
929
|
if (Module['preRun']) {
|
|
933
930
|
if (typeof Module['preRun'] == 'function')
|
|
@@ -1285,10 +1282,6 @@ const createTFLiteSIMDModule = (__Module) => {
|
|
|
1285
1282
|
}
|
|
1286
1283
|
|
|
1287
1284
|
function _proc_exit(code) {
|
|
1288
|
-
if (!keepRuntimeAlive()) {
|
|
1289
|
-
if (Module['onExit']) Module['onExit'](code);
|
|
1290
|
-
ABORT = true;
|
|
1291
|
-
}
|
|
1292
1285
|
quit_(code, new ExitStatus(code));
|
|
1293
1286
|
}
|
|
1294
1287
|
|
|
@@ -1538,7 +1531,7 @@ const createTFLiteSIMDModule = (__Module) => {
|
|
|
1538
1531
|
return __Module.ready;
|
|
1539
1532
|
};
|
|
1540
1533
|
|
|
1541
|
-
const version = "0.1.
|
|
1534
|
+
const version = "0.1.7";
|
|
1542
1535
|
const packageName = "@stream-io/video-filters-web";
|
|
1543
1536
|
|
|
1544
1537
|
// @ts-expect-error - module is not declared
|