longpipe 0.0.10 → 0.0.12
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/README.md +45 -9
- package/dist/index.cjs +1205 -253
- package/dist/index.d.cts +53 -4
- package/dist/index.d.ts +53 -4
- package/dist/index.js +1205 -253
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -24,7 +24,7 @@ interface Presenter {
|
|
|
24
24
|
run(): void;
|
|
25
25
|
}
|
|
26
26
|
type RenderTarget = "main" | "preview";
|
|
27
|
-
type Activation = "none" | "relu6" | "relu";
|
|
27
|
+
type Activation = "none" | "relu6" | "relu" | "leaky";
|
|
28
28
|
interface Conv2dParams {
|
|
29
29
|
outChannels: number;
|
|
30
30
|
kernel: number;
|
|
@@ -38,6 +38,26 @@ interface DepthwiseParams {
|
|
|
38
38
|
padding: number | "same" | "valid";
|
|
39
39
|
activation: Activation;
|
|
40
40
|
}
|
|
41
|
+
interface ConvTranspose2dParams {
|
|
42
|
+
outChannels: number;
|
|
43
|
+
kernel: number;
|
|
44
|
+
stride: number;
|
|
45
|
+
padding: number;
|
|
46
|
+
activation: Activation;
|
|
47
|
+
}
|
|
48
|
+
interface WarpParams {
|
|
49
|
+
flowScale: number;
|
|
50
|
+
}
|
|
51
|
+
interface StabilizeParams {
|
|
52
|
+
tLo: number;
|
|
53
|
+
tHi: number;
|
|
54
|
+
leak: number;
|
|
55
|
+
release: number;
|
|
56
|
+
tDiv: number;
|
|
57
|
+
divScale: number;
|
|
58
|
+
stepX: number;
|
|
59
|
+
stepY: number;
|
|
60
|
+
}
|
|
41
61
|
interface UpsampleParams {
|
|
42
62
|
outH: number;
|
|
43
63
|
outW: number;
|
|
@@ -71,14 +91,18 @@ interface Backend {
|
|
|
71
91
|
upload(data: DataView_): MLBuffer;
|
|
72
92
|
ops: {
|
|
73
93
|
Conv2d: (input: Tensor, weights: Conv2DWeights, params: Conv2dParams) => Op;
|
|
94
|
+
ConvTranspose2d: (input: Tensor, weights: Conv2DWeights, params: ConvTranspose2dParams) => Op;
|
|
74
95
|
DepthwiseConv2d: (input: Tensor, weights: DepthwiseWeights, params: DepthwiseParams) => Op;
|
|
75
96
|
Add: (a: Tensor, b: Tensor) => Op;
|
|
76
97
|
Sigmoid: (input: Tensor) => Op;
|
|
77
98
|
BilinearUpsample: (input: Tensor, params: UpsampleParams) => Op;
|
|
99
|
+
Crop: (input: Tensor, params: UpsampleParams) => Op;
|
|
78
100
|
BicubicUpsample: (input: Tensor, params: UpsampleParams) => Op;
|
|
79
101
|
ChannelConcat: (a: Tensor, b: Tensor) => Op;
|
|
80
102
|
Tanh: (input: Tensor) => Op;
|
|
81
103
|
ElementwiseMul: (a: Tensor, b: Tensor) => Op;
|
|
104
|
+
Warp: (source: Tensor, flow: Tensor, params: WarpParams) => Op;
|
|
105
|
+
Stabilize: (flow: Tensor, pred: Tensor, ref: Tensor, envPrev: Tensor, params: StabilizeParams) => Op;
|
|
82
106
|
GatesFused: (uIn: Tensor, hPrev: Tensor, weights: Conv2DWeights) => Op;
|
|
83
107
|
CandUpdateFused: (uIn: Tensor, hPrev: Tensor, gatesOut: Tensor, weights: Conv2DWeights, gamma: ArrayLike<number>) => Op;
|
|
84
108
|
ConvExpand: (input: Tensor, weights: Conv2DWeights) => Op;
|
|
@@ -170,7 +194,7 @@ interface RendererStats {
|
|
|
170
194
|
inputPath: string;
|
|
171
195
|
outputPath: string;
|
|
172
196
|
}
|
|
173
|
-
type ErrorSource = 'backend-lost' | 'worker' | 'adaptive' | 'background' | 'unknown';
|
|
197
|
+
type ErrorSource = 'backend-lost' | 'worker' | 'adaptive' | 'background' | 'audio' | 'unknown';
|
|
174
198
|
interface PipelineError {
|
|
175
199
|
message: string;
|
|
176
200
|
source: ErrorSource;
|
|
@@ -178,13 +202,35 @@ interface PipelineError {
|
|
|
178
202
|
cause?: unknown;
|
|
179
203
|
}
|
|
180
204
|
|
|
205
|
+
type DenoiseModel = 'rnnoise' | 'dfn' | 'dfnint8';
|
|
206
|
+
type DenoiseTier = 'high' | 'mid' | 'low';
|
|
207
|
+
type DenoiseModelOption = 'auto' | DenoiseTier | DenoiseModel;
|
|
208
|
+
|
|
209
|
+
interface DenoiseOptions {
|
|
210
|
+
model?: DenoiseModelOption;
|
|
211
|
+
postFilterBeta?: number;
|
|
212
|
+
gruLeak?: number;
|
|
213
|
+
enabled?: boolean;
|
|
214
|
+
}
|
|
215
|
+
type AudioInput = 'passthrough' | 'drop' | 'denoise' | {
|
|
216
|
+
denoise: DenoiseOptions;
|
|
217
|
+
};
|
|
181
218
|
type AudioMode = 'passthrough' | 'drop';
|
|
182
219
|
|
|
220
|
+
interface AudioStats {
|
|
221
|
+
model: DenoiseModel;
|
|
222
|
+
p50Ms: number | null;
|
|
223
|
+
p95Ms: number | null;
|
|
224
|
+
latencyMs: number;
|
|
225
|
+
active: boolean;
|
|
226
|
+
sampleRate: number;
|
|
227
|
+
}
|
|
228
|
+
|
|
183
229
|
interface PipelineOptions {
|
|
184
230
|
background?: BackgroundInput;
|
|
185
231
|
preset?: PresetName | ManualPreset;
|
|
186
232
|
weightsBaseUrl?: string;
|
|
187
|
-
audio?:
|
|
233
|
+
audio?: AudioInput;
|
|
188
234
|
enabled?: boolean;
|
|
189
235
|
outputResolution?: {
|
|
190
236
|
w: number;
|
|
@@ -203,6 +249,7 @@ declare class Pipeline implements PromiseLike<Pipeline> {
|
|
|
203
249
|
private inputCleanup;
|
|
204
250
|
private outputCleanup;
|
|
205
251
|
private adaptive;
|
|
252
|
+
private denoiser;
|
|
206
253
|
private bgCleanup;
|
|
207
254
|
private previewBgCleanup;
|
|
208
255
|
constructor(inputStream: MediaStream, options: PipelineOptions);
|
|
@@ -218,6 +265,8 @@ declare class Pipeline implements PromiseLike<Pipeline> {
|
|
|
218
265
|
clearPreview(): void;
|
|
219
266
|
setEnabled(on: boolean): void;
|
|
220
267
|
getStats(): Promise<RendererStats>;
|
|
268
|
+
setDenoise(input: boolean | DenoiseOptions): void;
|
|
269
|
+
getAudioStats(): AudioStats | null;
|
|
221
270
|
destroy(): void;
|
|
222
271
|
}
|
|
223
272
|
|
|
@@ -259,4 +308,4 @@ declare class WebGPUBackend implements Backend {
|
|
|
259
308
|
destroy(): void;
|
|
260
309
|
}
|
|
261
310
|
|
|
262
|
-
export { type Activation, type AudioMode, type Backend, type Background, type BackgroundInput, type BlurInput, type ColorInput, type Conv2dParams, type DepthwiseParams, Pipeline as EffectsPipeline, type ErrorSource, type ImageInput, type ManualPreset, type ModelName, type Op, type PipelineError, type PipelineOptions, type PresetName, type Tensor, type VideoInput, WebGPUBackend };
|
|
311
|
+
export { type Activation, type AudioInput, type AudioMode, type AudioStats, type Backend, type Background, type BackgroundInput, type BlurInput, type ColorInput, type Conv2dParams, type DenoiseModel, type DenoiseModelOption, type DenoiseOptions, type DenoiseTier, type DepthwiseParams, Pipeline as EffectsPipeline, type ErrorSource, type ImageInput, type ManualPreset, type ModelName, type Op, type PipelineError, type PipelineOptions, type PresetName, type Tensor, type VideoInput, WebGPUBackend };
|
package/dist/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ interface Presenter {
|
|
|
24
24
|
run(): void;
|
|
25
25
|
}
|
|
26
26
|
type RenderTarget = "main" | "preview";
|
|
27
|
-
type Activation = "none" | "relu6" | "relu";
|
|
27
|
+
type Activation = "none" | "relu6" | "relu" | "leaky";
|
|
28
28
|
interface Conv2dParams {
|
|
29
29
|
outChannels: number;
|
|
30
30
|
kernel: number;
|
|
@@ -38,6 +38,26 @@ interface DepthwiseParams {
|
|
|
38
38
|
padding: number | "same" | "valid";
|
|
39
39
|
activation: Activation;
|
|
40
40
|
}
|
|
41
|
+
interface ConvTranspose2dParams {
|
|
42
|
+
outChannels: number;
|
|
43
|
+
kernel: number;
|
|
44
|
+
stride: number;
|
|
45
|
+
padding: number;
|
|
46
|
+
activation: Activation;
|
|
47
|
+
}
|
|
48
|
+
interface WarpParams {
|
|
49
|
+
flowScale: number;
|
|
50
|
+
}
|
|
51
|
+
interface StabilizeParams {
|
|
52
|
+
tLo: number;
|
|
53
|
+
tHi: number;
|
|
54
|
+
leak: number;
|
|
55
|
+
release: number;
|
|
56
|
+
tDiv: number;
|
|
57
|
+
divScale: number;
|
|
58
|
+
stepX: number;
|
|
59
|
+
stepY: number;
|
|
60
|
+
}
|
|
41
61
|
interface UpsampleParams {
|
|
42
62
|
outH: number;
|
|
43
63
|
outW: number;
|
|
@@ -71,14 +91,18 @@ interface Backend {
|
|
|
71
91
|
upload(data: DataView_): MLBuffer;
|
|
72
92
|
ops: {
|
|
73
93
|
Conv2d: (input: Tensor, weights: Conv2DWeights, params: Conv2dParams) => Op;
|
|
94
|
+
ConvTranspose2d: (input: Tensor, weights: Conv2DWeights, params: ConvTranspose2dParams) => Op;
|
|
74
95
|
DepthwiseConv2d: (input: Tensor, weights: DepthwiseWeights, params: DepthwiseParams) => Op;
|
|
75
96
|
Add: (a: Tensor, b: Tensor) => Op;
|
|
76
97
|
Sigmoid: (input: Tensor) => Op;
|
|
77
98
|
BilinearUpsample: (input: Tensor, params: UpsampleParams) => Op;
|
|
99
|
+
Crop: (input: Tensor, params: UpsampleParams) => Op;
|
|
78
100
|
BicubicUpsample: (input: Tensor, params: UpsampleParams) => Op;
|
|
79
101
|
ChannelConcat: (a: Tensor, b: Tensor) => Op;
|
|
80
102
|
Tanh: (input: Tensor) => Op;
|
|
81
103
|
ElementwiseMul: (a: Tensor, b: Tensor) => Op;
|
|
104
|
+
Warp: (source: Tensor, flow: Tensor, params: WarpParams) => Op;
|
|
105
|
+
Stabilize: (flow: Tensor, pred: Tensor, ref: Tensor, envPrev: Tensor, params: StabilizeParams) => Op;
|
|
82
106
|
GatesFused: (uIn: Tensor, hPrev: Tensor, weights: Conv2DWeights) => Op;
|
|
83
107
|
CandUpdateFused: (uIn: Tensor, hPrev: Tensor, gatesOut: Tensor, weights: Conv2DWeights, gamma: ArrayLike<number>) => Op;
|
|
84
108
|
ConvExpand: (input: Tensor, weights: Conv2DWeights) => Op;
|
|
@@ -170,7 +194,7 @@ interface RendererStats {
|
|
|
170
194
|
inputPath: string;
|
|
171
195
|
outputPath: string;
|
|
172
196
|
}
|
|
173
|
-
type ErrorSource = 'backend-lost' | 'worker' | 'adaptive' | 'background' | 'unknown';
|
|
197
|
+
type ErrorSource = 'backend-lost' | 'worker' | 'adaptive' | 'background' | 'audio' | 'unknown';
|
|
174
198
|
interface PipelineError {
|
|
175
199
|
message: string;
|
|
176
200
|
source: ErrorSource;
|
|
@@ -178,13 +202,35 @@ interface PipelineError {
|
|
|
178
202
|
cause?: unknown;
|
|
179
203
|
}
|
|
180
204
|
|
|
205
|
+
type DenoiseModel = 'rnnoise' | 'dfn' | 'dfnint8';
|
|
206
|
+
type DenoiseTier = 'high' | 'mid' | 'low';
|
|
207
|
+
type DenoiseModelOption = 'auto' | DenoiseTier | DenoiseModel;
|
|
208
|
+
|
|
209
|
+
interface DenoiseOptions {
|
|
210
|
+
model?: DenoiseModelOption;
|
|
211
|
+
postFilterBeta?: number;
|
|
212
|
+
gruLeak?: number;
|
|
213
|
+
enabled?: boolean;
|
|
214
|
+
}
|
|
215
|
+
type AudioInput = 'passthrough' | 'drop' | 'denoise' | {
|
|
216
|
+
denoise: DenoiseOptions;
|
|
217
|
+
};
|
|
181
218
|
type AudioMode = 'passthrough' | 'drop';
|
|
182
219
|
|
|
220
|
+
interface AudioStats {
|
|
221
|
+
model: DenoiseModel;
|
|
222
|
+
p50Ms: number | null;
|
|
223
|
+
p95Ms: number | null;
|
|
224
|
+
latencyMs: number;
|
|
225
|
+
active: boolean;
|
|
226
|
+
sampleRate: number;
|
|
227
|
+
}
|
|
228
|
+
|
|
183
229
|
interface PipelineOptions {
|
|
184
230
|
background?: BackgroundInput;
|
|
185
231
|
preset?: PresetName | ManualPreset;
|
|
186
232
|
weightsBaseUrl?: string;
|
|
187
|
-
audio?:
|
|
233
|
+
audio?: AudioInput;
|
|
188
234
|
enabled?: boolean;
|
|
189
235
|
outputResolution?: {
|
|
190
236
|
w: number;
|
|
@@ -203,6 +249,7 @@ declare class Pipeline implements PromiseLike<Pipeline> {
|
|
|
203
249
|
private inputCleanup;
|
|
204
250
|
private outputCleanup;
|
|
205
251
|
private adaptive;
|
|
252
|
+
private denoiser;
|
|
206
253
|
private bgCleanup;
|
|
207
254
|
private previewBgCleanup;
|
|
208
255
|
constructor(inputStream: MediaStream, options: PipelineOptions);
|
|
@@ -218,6 +265,8 @@ declare class Pipeline implements PromiseLike<Pipeline> {
|
|
|
218
265
|
clearPreview(): void;
|
|
219
266
|
setEnabled(on: boolean): void;
|
|
220
267
|
getStats(): Promise<RendererStats>;
|
|
268
|
+
setDenoise(input: boolean | DenoiseOptions): void;
|
|
269
|
+
getAudioStats(): AudioStats | null;
|
|
221
270
|
destroy(): void;
|
|
222
271
|
}
|
|
223
272
|
|
|
@@ -259,4 +308,4 @@ declare class WebGPUBackend implements Backend {
|
|
|
259
308
|
destroy(): void;
|
|
260
309
|
}
|
|
261
310
|
|
|
262
|
-
export { type Activation, type AudioMode, type Backend, type Background, type BackgroundInput, type BlurInput, type ColorInput, type Conv2dParams, type DepthwiseParams, Pipeline as EffectsPipeline, type ErrorSource, type ImageInput, type ManualPreset, type ModelName, type Op, type PipelineError, type PipelineOptions, type PresetName, type Tensor, type VideoInput, WebGPUBackend };
|
|
311
|
+
export { type Activation, type AudioInput, type AudioMode, type AudioStats, type Backend, type Background, type BackgroundInput, type BlurInput, type ColorInput, type Conv2dParams, type DenoiseModel, type DenoiseModelOption, type DenoiseOptions, type DenoiseTier, type DepthwiseParams, Pipeline as EffectsPipeline, type ErrorSource, type ImageInput, type ManualPreset, type ModelName, type Op, type PipelineError, type PipelineOptions, type PresetName, type Tensor, type VideoInput, WebGPUBackend };
|