longpipe 0.0.14 → 0.0.15

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/dist/index.d.cts CHANGED
@@ -1,193 +1,5 @@
1
- interface Conv2DWeights {
2
- weights: ArrayLike<number>;
3
- bias: ArrayLike<number>;
4
- }
5
- interface DepthwiseWeights {
6
- weights: ArrayLike<number>;
7
- bias: ArrayLike<number>;
8
- }
9
-
10
- type Dtype = 'f32' | 'f16';
11
- interface Tensor {
12
- readonly h: number;
13
- readonly w: number;
14
- readonly c: number;
15
- }
16
- interface MLBuffer {
17
- }
18
- interface Op {
19
- readonly inputs: Tensor[];
20
- readonly output: Tensor;
21
- run(): void;
22
- }
23
- interface Presenter {
24
- run(): void;
25
- }
26
- type RenderTarget = "main" | "preview";
27
- type Activation = "none" | "relu6" | "relu" | "leaky";
28
- interface Conv2dParams {
29
- outChannels: number;
30
- kernel: number;
31
- stride: number;
32
- padding: number | "same" | "valid";
33
- activation: Activation;
34
- }
35
- interface DepthwiseParams {
36
- kernel: number;
37
- stride: number;
38
- padding: number | "same" | "valid";
39
- activation: Activation;
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
- }
61
- interface UpsampleParams {
62
- outH: number;
63
- outW: number;
64
- }
65
- interface FaceBoxParams {
66
- win: number;
67
- thresh: number;
68
- boxScale: number;
69
- }
70
- interface FaceBoxesParams extends FaceBoxParams {
71
- maxFaces: number;
72
- tol: number;
73
- }
74
- interface CropResampleParams {
75
- outH: number;
76
- outW: number;
77
- mean: [number, number, number];
78
- std: [number, number, number];
79
- slot?: number;
80
- }
81
- interface LandmarkOverlayParams {
82
- count: number;
83
- thresh: number;
84
- pointSize: number;
85
- color: [number, number, number];
86
- slot?: number;
87
- drawImage?: boolean;
88
- }
89
- interface ReframeStateParams {
90
- zoom: number;
91
- gravity: number;
92
- margin: number;
93
- deadband: number;
94
- ease: number;
95
- aspect: number;
96
- }
97
- interface FaceTouchupStageOp extends Op {
98
- setActiveSlots(n: number): void;
99
- }
100
- interface FaceTopology {
101
- count: number;
102
- uv: Float32Array;
103
- idx: Float32Array;
104
- weightMask: ImageBitmap;
105
- }
106
- type FaceTouchupStyle = "freq-sep" | "bilateral";
107
- interface FaceTouchupParams {
108
- strength: number;
109
- amount: number;
110
- detail: number;
111
- thresh: number;
112
- style?: FaceTouchupStyle;
113
- slots?: number;
114
- }
115
- interface UpsampleConv1x1Params {
116
- outH: number;
117
- outW: number;
118
- outChannels: number;
119
- activation: Activation;
120
- }
121
- interface ProjResidualParams {
122
- outChannels: number;
123
- }
124
- interface ConcatConv2dParams {
125
- outChannels: number;
126
- }
127
- interface DownAdapterParams {
128
- stride: number;
129
- }
130
- type ImageSource = ImageBitmap | VideoFrame;
131
- interface InputOp {
132
- readonly output: Tensor;
133
- setSource(src: ImageSource): void;
134
- run(): void;
135
- }
136
- type DataView_ = Float32Array | Uint16Array;
137
- interface Backend {
138
- readonly dtype: Dtype;
139
- readonly canvas: HTMLCanvasElement | OffscreenCanvas;
140
- tensor(h: number, w: number, c: number, data?: DataView_): Tensor;
141
- upload(data: DataView_): MLBuffer;
142
- ops: {
143
- Conv2d: (input: Tensor, weights: Conv2DWeights, params: Conv2dParams) => Op;
144
- ConvTranspose2d: (input: Tensor, weights: Conv2DWeights, params: ConvTranspose2dParams) => Op;
145
- DepthwiseConv2d: (input: Tensor, weights: DepthwiseWeights, params: DepthwiseParams) => Op;
146
- Add: (a: Tensor, b: Tensor) => Op;
147
- Sigmoid: (input: Tensor) => Op;
148
- BilinearUpsample: (input: Tensor, params: UpsampleParams) => Op;
149
- Crop: (input: Tensor, params: UpsampleParams) => Op;
150
- BicubicUpsample: (input: Tensor, params: UpsampleParams) => Op;
151
- ChannelConcat: (a: Tensor, b: Tensor) => Op;
152
- Tanh: (input: Tensor) => Op;
153
- ElementwiseMul: (a: Tensor, b: Tensor) => Op;
154
- Warp: (source: Tensor, flow: Tensor, params: WarpParams) => Op;
155
- FaceBoxFromHeatmaps: (heatmaps: Tensor, params: FaceBoxParams) => Op;
156
- FaceBoxesFromHeatmaps: (heatmaps: Tensor, params: FaceBoxesParams) => Op;
157
- ReframeState: (boxes: Tensor, prev: Tensor, cmd: Tensor, params: ReframeStateParams) => Op;
158
- Reframe: (src: Tensor, rect: Tensor) => Op;
159
- FaceTouchupStage: (frame: Tensor, landmarks: Tensor, box: Tensor, topo: FaceTopology, params: FaceTouchupParams) => FaceTouchupStageOp;
160
- CropResample: (frame: Tensor, box: Tensor, params: CropResampleParams) => Op;
161
- Stabilize: (flow: Tensor, pred: Tensor, ref: Tensor, envPrev: Tensor, params: StabilizeParams) => Op;
162
- GatesFused: (uIn: Tensor, hPrev: Tensor, weights: Conv2DWeights) => Op;
163
- CandUpdateFused: (uIn: Tensor, hPrev: Tensor, gatesOut: Tensor, weights: Conv2DWeights, gamma: ArrayLike<number>) => Op;
164
- ConvExpand: (input: Tensor, weights: Conv2DWeights) => Op;
165
- CatConv6to2: (u: Tensor, d: Tensor, weights: Conv2DWeights) => Op;
166
- DownAdapter: (input: Tensor, downWeights: Conv2DWeights, adaptWeights: Conv2DWeights, params: DownAdapterParams) => Op;
167
- UpFinal: (u: Tensor, rgb: Tensor, weights: Conv2DWeights) => Op;
168
- UpFinalSkip: (u: Tensor, dFull: Tensor, rgb: Tensor, weights: Conv2DWeights) => Op;
169
- Conv2dAdd: (input: Tensor, skip: Tensor, weights: Conv2DWeights, params: Conv2dParams) => Op;
170
- ProjResidual: (input: Tensor, skip: Tensor, weights: Conv2DWeights, params: ProjResidualParams) => Op;
171
- ConcatConv2d: (a: Tensor, b: Tensor, weights: Conv2DWeights, params: ConcatConv2dParams) => Op;
172
- UpsampleConcat: (a: Tensor, b: Tensor, params: UpsampleParams) => Op;
173
- UpsampleConv1x1: (input: Tensor, weights: Conv2DWeights, params: UpsampleConv1x1Params) => Op;
174
- UpsampleSigmoid: (input: Tensor, params: UpsampleParams) => Op;
175
- Input: (h: number, w: number) => InputOp;
176
- };
177
- presenters: {
178
- CompositeSolid: (image: Tensor, alpha: Tensor, bgColor: [number, number, number], target?: RenderTarget) => Presenter;
179
- CompositeImage: (image: Tensor, alpha: Tensor, bg: Tensor, target?: RenderTarget) => Presenter;
180
- CompositeImageBilinear: (image: Tensor, alpha: Tensor, bg: Tensor, target?: RenderTarget) => Presenter;
181
- CompositePassthrough: (image: Tensor, target?: RenderTarget) => Presenter;
182
- LandmarkOverlay: (image: Tensor, landmarks: Tensor, box: Tensor, params: LandmarkOverlayParams, target?: RenderTarget) => Presenter;
183
- FaceTouchup: (frame: Tensor, landmarks: Tensor, box: Tensor, topo: FaceTopology, params: FaceTouchupParams, target?: RenderTarget) => Presenter;
184
- };
185
- attachCanvas(name: RenderTarget, canvas: HTMLCanvasElement | OffscreenCanvas): void;
186
- readback(tensor: Tensor): Promise<Float32Array>;
187
- copyTensor(src: Tensor, dst: Tensor): void;
188
- sync(): Promise<void>;
189
- destroy(): void;
190
- }
1
+ import { D as Dtype, F as FaceTouchupStyle } from './index-BctoEDhZ.cjs';
2
+ export { A as Activation, B as Backend, C as Conv2dParams, a as DepthwiseParams, O as Op, T as Tensor, W as WebGPUBackend } from './index-BctoEDhZ.cjs';
191
3
 
192
4
  type ModelName = 'xs' | 'small' | 'medium' | 'large' | 'xl';
193
5
  type PresetName = 'fast' | 'balanced' | 'quality' | 'auto';
@@ -354,42 +166,4 @@ declare class Pipeline implements PromiseLike<Pipeline> {
354
166
  destroy(): void;
355
167
  }
356
168
 
357
- interface WebGPUTensor extends Tensor {
358
- readonly buffer: GPUBuffer;
359
- }
360
- interface WebGPUMLBuffer extends MLBuffer {
361
- readonly buffer: GPUBuffer;
362
- }
363
-
364
- interface WebGPUBackendOptions {
365
- canvas: HTMLCanvasElement | OffscreenCanvas;
366
- device?: GPUDevice;
367
- dtype?: Dtype;
368
- }
369
- declare class WebGPUBackend implements Backend {
370
- readonly device: GPUDevice;
371
- readonly canvas: HTMLCanvasElement | OffscreenCanvas;
372
- readonly dtype: Dtype;
373
- readonly ops: Backend["ops"];
374
- readonly presenters: Backend["presenters"];
375
- readonly canvasContext: GPUCanvasContext;
376
- readonly canvasFormat: GPUTextureFormat;
377
- readonly bytesPerElement: 2 | 4;
378
- private readonly contexts;
379
- private constructor();
380
- private configureContext;
381
- attachCanvas(name: RenderTarget, canvas: HTMLCanvasElement | OffscreenCanvas): void;
382
- static isAvailable(): Promise<boolean>;
383
- static hasF16Support(): Promise<boolean>;
384
- static create(opts: WebGPUBackendOptions): Promise<WebGPUBackend>;
385
- getCurrentDisplayTexture(target?: RenderTarget): GPUTexture;
386
- tensor(h: number, w: number, c: number, data?: DataView_): WebGPUTensor;
387
- upload(data: DataView_): WebGPUMLBuffer;
388
- private writeView;
389
- readback(tensor: WebGPUTensor): Promise<Float32Array>;
390
- copyTensor(src: WebGPUTensor, dst: WebGPUTensor): void;
391
- sync(): Promise<void>;
392
- destroy(): void;
393
- }
394
-
395
- 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 FaceTouchupStyle, type ImageInput, type ManualPreset, type ModelName, type Op, type PipelineError, type PipelineOptions, type PresetName, type Tensor, type TouchupOptions, type VideoInput, WebGPUBackend };
169
+ export { type AudioInput, type AudioMode, type AudioStats, type Background, type BackgroundInput, type BlurInput, type ColorInput, type DenoiseModel, type DenoiseModelOption, type DenoiseOptions, type DenoiseTier, Pipeline as EffectsPipeline, type ErrorSource, FaceTouchupStyle, type ImageInput, type ManualPreset, type ModelName, type PipelineError, type PipelineOptions, type PresetName, type TouchupOptions, type VideoInput };
package/dist/index.d.ts CHANGED
@@ -1,193 +1,5 @@
1
- interface Conv2DWeights {
2
- weights: ArrayLike<number>;
3
- bias: ArrayLike<number>;
4
- }
5
- interface DepthwiseWeights {
6
- weights: ArrayLike<number>;
7
- bias: ArrayLike<number>;
8
- }
9
-
10
- type Dtype = 'f32' | 'f16';
11
- interface Tensor {
12
- readonly h: number;
13
- readonly w: number;
14
- readonly c: number;
15
- }
16
- interface MLBuffer {
17
- }
18
- interface Op {
19
- readonly inputs: Tensor[];
20
- readonly output: Tensor;
21
- run(): void;
22
- }
23
- interface Presenter {
24
- run(): void;
25
- }
26
- type RenderTarget = "main" | "preview";
27
- type Activation = "none" | "relu6" | "relu" | "leaky";
28
- interface Conv2dParams {
29
- outChannels: number;
30
- kernel: number;
31
- stride: number;
32
- padding: number | "same" | "valid";
33
- activation: Activation;
34
- }
35
- interface DepthwiseParams {
36
- kernel: number;
37
- stride: number;
38
- padding: number | "same" | "valid";
39
- activation: Activation;
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
- }
61
- interface UpsampleParams {
62
- outH: number;
63
- outW: number;
64
- }
65
- interface FaceBoxParams {
66
- win: number;
67
- thresh: number;
68
- boxScale: number;
69
- }
70
- interface FaceBoxesParams extends FaceBoxParams {
71
- maxFaces: number;
72
- tol: number;
73
- }
74
- interface CropResampleParams {
75
- outH: number;
76
- outW: number;
77
- mean: [number, number, number];
78
- std: [number, number, number];
79
- slot?: number;
80
- }
81
- interface LandmarkOverlayParams {
82
- count: number;
83
- thresh: number;
84
- pointSize: number;
85
- color: [number, number, number];
86
- slot?: number;
87
- drawImage?: boolean;
88
- }
89
- interface ReframeStateParams {
90
- zoom: number;
91
- gravity: number;
92
- margin: number;
93
- deadband: number;
94
- ease: number;
95
- aspect: number;
96
- }
97
- interface FaceTouchupStageOp extends Op {
98
- setActiveSlots(n: number): void;
99
- }
100
- interface FaceTopology {
101
- count: number;
102
- uv: Float32Array;
103
- idx: Float32Array;
104
- weightMask: ImageBitmap;
105
- }
106
- type FaceTouchupStyle = "freq-sep" | "bilateral";
107
- interface FaceTouchupParams {
108
- strength: number;
109
- amount: number;
110
- detail: number;
111
- thresh: number;
112
- style?: FaceTouchupStyle;
113
- slots?: number;
114
- }
115
- interface UpsampleConv1x1Params {
116
- outH: number;
117
- outW: number;
118
- outChannels: number;
119
- activation: Activation;
120
- }
121
- interface ProjResidualParams {
122
- outChannels: number;
123
- }
124
- interface ConcatConv2dParams {
125
- outChannels: number;
126
- }
127
- interface DownAdapterParams {
128
- stride: number;
129
- }
130
- type ImageSource = ImageBitmap | VideoFrame;
131
- interface InputOp {
132
- readonly output: Tensor;
133
- setSource(src: ImageSource): void;
134
- run(): void;
135
- }
136
- type DataView_ = Float32Array | Uint16Array;
137
- interface Backend {
138
- readonly dtype: Dtype;
139
- readonly canvas: HTMLCanvasElement | OffscreenCanvas;
140
- tensor(h: number, w: number, c: number, data?: DataView_): Tensor;
141
- upload(data: DataView_): MLBuffer;
142
- ops: {
143
- Conv2d: (input: Tensor, weights: Conv2DWeights, params: Conv2dParams) => Op;
144
- ConvTranspose2d: (input: Tensor, weights: Conv2DWeights, params: ConvTranspose2dParams) => Op;
145
- DepthwiseConv2d: (input: Tensor, weights: DepthwiseWeights, params: DepthwiseParams) => Op;
146
- Add: (a: Tensor, b: Tensor) => Op;
147
- Sigmoid: (input: Tensor) => Op;
148
- BilinearUpsample: (input: Tensor, params: UpsampleParams) => Op;
149
- Crop: (input: Tensor, params: UpsampleParams) => Op;
150
- BicubicUpsample: (input: Tensor, params: UpsampleParams) => Op;
151
- ChannelConcat: (a: Tensor, b: Tensor) => Op;
152
- Tanh: (input: Tensor) => Op;
153
- ElementwiseMul: (a: Tensor, b: Tensor) => Op;
154
- Warp: (source: Tensor, flow: Tensor, params: WarpParams) => Op;
155
- FaceBoxFromHeatmaps: (heatmaps: Tensor, params: FaceBoxParams) => Op;
156
- FaceBoxesFromHeatmaps: (heatmaps: Tensor, params: FaceBoxesParams) => Op;
157
- ReframeState: (boxes: Tensor, prev: Tensor, cmd: Tensor, params: ReframeStateParams) => Op;
158
- Reframe: (src: Tensor, rect: Tensor) => Op;
159
- FaceTouchupStage: (frame: Tensor, landmarks: Tensor, box: Tensor, topo: FaceTopology, params: FaceTouchupParams) => FaceTouchupStageOp;
160
- CropResample: (frame: Tensor, box: Tensor, params: CropResampleParams) => Op;
161
- Stabilize: (flow: Tensor, pred: Tensor, ref: Tensor, envPrev: Tensor, params: StabilizeParams) => Op;
162
- GatesFused: (uIn: Tensor, hPrev: Tensor, weights: Conv2DWeights) => Op;
163
- CandUpdateFused: (uIn: Tensor, hPrev: Tensor, gatesOut: Tensor, weights: Conv2DWeights, gamma: ArrayLike<number>) => Op;
164
- ConvExpand: (input: Tensor, weights: Conv2DWeights) => Op;
165
- CatConv6to2: (u: Tensor, d: Tensor, weights: Conv2DWeights) => Op;
166
- DownAdapter: (input: Tensor, downWeights: Conv2DWeights, adaptWeights: Conv2DWeights, params: DownAdapterParams) => Op;
167
- UpFinal: (u: Tensor, rgb: Tensor, weights: Conv2DWeights) => Op;
168
- UpFinalSkip: (u: Tensor, dFull: Tensor, rgb: Tensor, weights: Conv2DWeights) => Op;
169
- Conv2dAdd: (input: Tensor, skip: Tensor, weights: Conv2DWeights, params: Conv2dParams) => Op;
170
- ProjResidual: (input: Tensor, skip: Tensor, weights: Conv2DWeights, params: ProjResidualParams) => Op;
171
- ConcatConv2d: (a: Tensor, b: Tensor, weights: Conv2DWeights, params: ConcatConv2dParams) => Op;
172
- UpsampleConcat: (a: Tensor, b: Tensor, params: UpsampleParams) => Op;
173
- UpsampleConv1x1: (input: Tensor, weights: Conv2DWeights, params: UpsampleConv1x1Params) => Op;
174
- UpsampleSigmoid: (input: Tensor, params: UpsampleParams) => Op;
175
- Input: (h: number, w: number) => InputOp;
176
- };
177
- presenters: {
178
- CompositeSolid: (image: Tensor, alpha: Tensor, bgColor: [number, number, number], target?: RenderTarget) => Presenter;
179
- CompositeImage: (image: Tensor, alpha: Tensor, bg: Tensor, target?: RenderTarget) => Presenter;
180
- CompositeImageBilinear: (image: Tensor, alpha: Tensor, bg: Tensor, target?: RenderTarget) => Presenter;
181
- CompositePassthrough: (image: Tensor, target?: RenderTarget) => Presenter;
182
- LandmarkOverlay: (image: Tensor, landmarks: Tensor, box: Tensor, params: LandmarkOverlayParams, target?: RenderTarget) => Presenter;
183
- FaceTouchup: (frame: Tensor, landmarks: Tensor, box: Tensor, topo: FaceTopology, params: FaceTouchupParams, target?: RenderTarget) => Presenter;
184
- };
185
- attachCanvas(name: RenderTarget, canvas: HTMLCanvasElement | OffscreenCanvas): void;
186
- readback(tensor: Tensor): Promise<Float32Array>;
187
- copyTensor(src: Tensor, dst: Tensor): void;
188
- sync(): Promise<void>;
189
- destroy(): void;
190
- }
1
+ import { D as Dtype, F as FaceTouchupStyle } from './index-BctoEDhZ.js';
2
+ export { A as Activation, B as Backend, C as Conv2dParams, a as DepthwiseParams, O as Op, T as Tensor, W as WebGPUBackend } from './index-BctoEDhZ.js';
191
3
 
192
4
  type ModelName = 'xs' | 'small' | 'medium' | 'large' | 'xl';
193
5
  type PresetName = 'fast' | 'balanced' | 'quality' | 'auto';
@@ -354,42 +166,4 @@ declare class Pipeline implements PromiseLike<Pipeline> {
354
166
  destroy(): void;
355
167
  }
356
168
 
357
- interface WebGPUTensor extends Tensor {
358
- readonly buffer: GPUBuffer;
359
- }
360
- interface WebGPUMLBuffer extends MLBuffer {
361
- readonly buffer: GPUBuffer;
362
- }
363
-
364
- interface WebGPUBackendOptions {
365
- canvas: HTMLCanvasElement | OffscreenCanvas;
366
- device?: GPUDevice;
367
- dtype?: Dtype;
368
- }
369
- declare class WebGPUBackend implements Backend {
370
- readonly device: GPUDevice;
371
- readonly canvas: HTMLCanvasElement | OffscreenCanvas;
372
- readonly dtype: Dtype;
373
- readonly ops: Backend["ops"];
374
- readonly presenters: Backend["presenters"];
375
- readonly canvasContext: GPUCanvasContext;
376
- readonly canvasFormat: GPUTextureFormat;
377
- readonly bytesPerElement: 2 | 4;
378
- private readonly contexts;
379
- private constructor();
380
- private configureContext;
381
- attachCanvas(name: RenderTarget, canvas: HTMLCanvasElement | OffscreenCanvas): void;
382
- static isAvailable(): Promise<boolean>;
383
- static hasF16Support(): Promise<boolean>;
384
- static create(opts: WebGPUBackendOptions): Promise<WebGPUBackend>;
385
- getCurrentDisplayTexture(target?: RenderTarget): GPUTexture;
386
- tensor(h: number, w: number, c: number, data?: DataView_): WebGPUTensor;
387
- upload(data: DataView_): WebGPUMLBuffer;
388
- private writeView;
389
- readback(tensor: WebGPUTensor): Promise<Float32Array>;
390
- copyTensor(src: WebGPUTensor, dst: WebGPUTensor): void;
391
- sync(): Promise<void>;
392
- destroy(): void;
393
- }
394
-
395
- 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 FaceTouchupStyle, type ImageInput, type ManualPreset, type ModelName, type Op, type PipelineError, type PipelineOptions, type PresetName, type Tensor, type TouchupOptions, type VideoInput, WebGPUBackend };
169
+ export { type AudioInput, type AudioMode, type AudioStats, type Background, type BackgroundInput, type BlurInput, type ColorInput, type DenoiseModel, type DenoiseModelOption, type DenoiseOptions, type DenoiseTier, Pipeline as EffectsPipeline, type ErrorSource, FaceTouchupStyle, type ImageInput, type ManualPreset, type ModelName, type PipelineError, type PipelineOptions, type PresetName, type TouchupOptions, type VideoInput };