@stream-io/video-filters-web 0.1.0 → 0.1.2
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 +19 -11
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +19 -11
- package/dist/index.es.js.map +1 -1
- package/dist/src/createRenderer.d.ts +1 -1
- package/package.json +1 -1
- package/src/createRenderer.ts +10 -7
- package/src/webgl2/backgroundBlurStage.ts +19 -11
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
### [0.1.2](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-filters-web-0.1.1...@stream-io/video-filters-web-0.1.2) (2024-06-12)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* infinitely adjustable blur filter ([#1399](https://github.com/GetStream/stream-video-js/issues/1399)) ([447e73f](https://github.com/GetStream/stream-video-js/commit/447e73f2363142a0c1b43d05f848400950ecf697))
|
|
11
|
+
|
|
12
|
+
### [0.1.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-filters-web-0.1.0...@stream-io/video-filters-web-0.1.1) (2024-06-03)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* video filters on android ([#1382](https://github.com/GetStream/stream-video-js/issues/1382)) ([7ba8b0e](https://github.com/GetStream/stream-video-js/commit/7ba8b0e3b444869d38aae1a045dffb05444643f5))
|
|
18
|
+
|
|
5
19
|
## [0.1.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-filters-web-0.0.2...@stream-io/video-filters-web-0.1.0) (2024-04-10)
|
|
6
20
|
|
|
7
21
|
|
package/dist/index.cjs.js
CHANGED
|
@@ -133,11 +133,21 @@ function buildBackgroundBlurStage(gl, vertexShader, positionBuffer, texCoordBuff
|
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
135
|
function buildBlurPass(gl, vertexShader, positionBuffer, texCoordBuffer, personMaskTexture, canvas, blurLevel) {
|
|
136
|
-
const
|
|
137
|
-
?
|
|
138
|
-
: blurLevel === '
|
|
139
|
-
?
|
|
140
|
-
:
|
|
136
|
+
const sigma = typeof blurLevel === 'number'
|
|
137
|
+
? blurLevel
|
|
138
|
+
: blurLevel === 'low'
|
|
139
|
+
? 2
|
|
140
|
+
: blurLevel === 'medium'
|
|
141
|
+
? 4
|
|
142
|
+
: 6;
|
|
143
|
+
const windowSize = Math.max(1, Math.floor(sigma * 3));
|
|
144
|
+
const offset = new Array(windowSize).fill(0).map((v, index) => index);
|
|
145
|
+
const variance = sigma ** 2;
|
|
146
|
+
const weights = offset.map((x) => {
|
|
147
|
+
var m = sigma * Math.sqrt(2 * Math.PI);
|
|
148
|
+
var e = Math.exp(-(x ** 2) / (2 * variance));
|
|
149
|
+
return e / m;
|
|
150
|
+
});
|
|
141
151
|
const fragmentShaderSource = glsl `#version 300 es
|
|
142
152
|
|
|
143
153
|
precision highp float;
|
|
@@ -149,10 +159,8 @@ function buildBlurPass(gl, vertexShader, positionBuffer, texCoordBuffer, personM
|
|
|
149
159
|
in vec2 v_texCoord;
|
|
150
160
|
out vec4 outColor;
|
|
151
161
|
|
|
152
|
-
const float offset[
|
|
153
|
-
const float weight[
|
|
154
|
-
${weights.join(',')}
|
|
155
|
-
);
|
|
162
|
+
const float offset[${windowSize}] = float[](${offset.map((i) => i.toFixed(10)).join(', ')});
|
|
163
|
+
const float weight[${windowSize}] = float[](${weights.map((i) => i.toFixed(10)).join(', ')});
|
|
156
164
|
|
|
157
165
|
void main() {
|
|
158
166
|
vec4 centerColor = texture(u_inputFrame, v_texCoord);
|
|
@@ -160,7 +168,7 @@ function buildBlurPass(gl, vertexShader, positionBuffer, texCoordBuffer, personM
|
|
|
160
168
|
|
|
161
169
|
vec4 frameColor = centerColor * weight[0] * (1.0 - personMask);
|
|
162
170
|
|
|
163
|
-
for (int i = 1; i <
|
|
171
|
+
for (int i = 1; i < ${windowSize}; i++) {
|
|
164
172
|
vec2 offset = vec2(offset[i]) * u_texelSize;
|
|
165
173
|
|
|
166
174
|
vec2 texCoord = v_texCoord + offset;
|
|
@@ -1523,7 +1531,7 @@ const createTFLiteSIMDModule = (__Module) => {
|
|
|
1523
1531
|
return __Module.ready;
|
|
1524
1532
|
};
|
|
1525
1533
|
|
|
1526
|
-
const version = "0.1.
|
|
1534
|
+
const version = "0.1.2" ;
|
|
1527
1535
|
const packageName = "@stream-io/video-filters-web" ;
|
|
1528
1536
|
|
|
1529
1537
|
// @ts-expect-error - module is not declared
|