@lumy-pack/scene-sieve 0.0.9 → 0.0.10

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.
@@ -1,129 +0,0 @@
1
- export type ProgressPhase = 'EXTRACTING' | 'ANALYZING' | 'PRUNING' | 'FINALIZING';
2
- export type SieveInput = {
3
- mode: 'file';
4
- inputPath: string;
5
- } | {
6
- mode: 'buffer';
7
- inputBuffer: Buffer;
8
- } | {
9
- mode: 'frames';
10
- inputFrames: Buffer[];
11
- };
12
- export interface SieveOptionsBase {
13
- count?: number;
14
- threshold?: number;
15
- outputPath?: string;
16
- fps?: number;
17
- maxFrames?: number;
18
- scale?: number;
19
- quality?: number;
20
- iouThreshold?: number;
21
- animationThreshold?: number;
22
- debug?: boolean;
23
- onProgress?: (phase: ProgressPhase, percent: number) => void;
24
- maxSegmentDuration?: number;
25
- concurrency?: number;
26
- }
27
- export type SieveOptions = SieveOptionsBase & SieveInput;
28
- export interface ResolvedOptions {
29
- mode: 'file' | 'buffer' | 'frames';
30
- inputPath?: string;
31
- count: number;
32
- threshold: number;
33
- pruneMode: 'threshold-with-cap';
34
- outputPath: string;
35
- fps: number;
36
- maxFrames: number;
37
- scale: number;
38
- quality: number;
39
- iouThreshold: number;
40
- animationThreshold: number;
41
- debug: boolean;
42
- maxSegmentDuration: number;
43
- concurrency: number;
44
- }
45
- export interface SieveResult {
46
- success: boolean;
47
- originalFramesCount: number;
48
- prunedFramesCount: number;
49
- outputFiles: string[];
50
- outputBuffers?: Buffer[];
51
- animations?: AnimationMetadata[];
52
- video?: VideoMetadata;
53
- executionTimeMs: number;
54
- }
55
- export interface AnimationMetadata {
56
- type: string;
57
- boundingBox: BoundingBox;
58
- startFrameId: number;
59
- endFrameId: number;
60
- durationMs: number;
61
- }
62
- export interface VideoMetadata {
63
- originalDurationMs: number;
64
- fps: number;
65
- resolution: {
66
- width: number;
67
- height: number;
68
- };
69
- }
70
- export interface FrameNode {
71
- id: number;
72
- timestamp: number;
73
- extractPath: string;
74
- }
75
- export interface ScoreEdge {
76
- sourceId: number;
77
- targetId: number;
78
- /**
79
- * Information gain score (G(t)) between adjacent frames.
80
- * Higher values = greater visual change (state transition) = should be preserved.
81
- * Lower values = similar frames (little change) = candidates for pruning.
82
- *
83
- * Pruner removes frames with the LOWEST scores first (greedy ascending).
84
- * Maps directly to G(t) from the vision analysis pipeline.
85
- */
86
- score: number;
87
- }
88
- export interface BoundingBox {
89
- x: number;
90
- y: number;
91
- width: number;
92
- height: number;
93
- }
94
- export interface DBSCANResult {
95
- labels: number[];
96
- boundingBoxes: BoundingBox[];
97
- }
98
- export interface ProcessContext {
99
- options: ResolvedOptions;
100
- workspacePath: string;
101
- frames: FrameNode[];
102
- graph: ScoreEdge[];
103
- animations?: AnimationMetadata[];
104
- status: 'INIT' | ProgressPhase | 'SUCCESS' | 'FAILED';
105
- emitProgress: (percent: number) => void;
106
- error?: Error;
107
- }
108
- export interface AnalysisResult {
109
- edges: ScoreEdge[];
110
- animations: AnimationMetadata[];
111
- }
112
- export interface SegmentPlan {
113
- index: number;
114
- startTime: number;
115
- endTime: number;
116
- duration: number;
117
- allocatedFrames: number;
118
- effectiveFps: number;
119
- overlapBefore: number;
120
- overlapAfter: number;
121
- extractStartTime: number;
122
- extractDuration: number;
123
- }
124
- export interface SegmentResult {
125
- segment: SegmentPlan;
126
- frames: FrameNode[];
127
- edges: ScoreEdge[];
128
- animations: AnimationMetadata[];
129
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * Creates a concurrency limiter that runs at most `limit` tasks in parallel.
3
- * Lightweight replacement for p-limit to avoid external dependency.
4
- */
5
- export declare function concurrencyLimit(limit: number): <T>(fn: () => Promise<T>) => Promise<T>;
@@ -1,8 +0,0 @@
1
- export declare function setDebugMode(enabled: boolean): void;
2
- export declare const logger: {
3
- info(message: string): void;
4
- success(message: string): void;
5
- warn(message: string): void;
6
- error(message: string): void;
7
- debug(message: string): void;
8
- };
@@ -1,27 +0,0 @@
1
- /**
2
- * Interface for objects that have a numeric score.
3
- */
4
- export interface ScoredItem {
5
- score: number;
6
- }
7
- /**
8
- * Normalize raw scores to [0, 1] range via Robust Hybrid Normalization.
9
- *
10
- * This model combines two mathematical approaches to provide a stable "relative" threshold:
11
- *
12
- * 1. Logistic-Robust-Z (Intensity):
13
- * Calculates Z-scores using Median and Median Absolute Deviation (MAD).
14
- * Maps these to a sigmoid (logistic) curve. This suppresses noise (scores near median)
15
- * and highlights significant signals (outliers) without letting extreme outliers
16
- * crush other meaningful transitions.
17
- *
18
- * 2. CDF / Percentile Rank (Relative Position):
19
- * Maps each score to its percentile rank in the sequence. This ensures that 't'
20
- * always has a consistent meaning as a "relative rank" regardless of absolute values.
21
- *
22
- * The final score is a weighted sum (NORMALIZATION_ALPHA) of both.
23
- *
24
- * @param items - Array of items with scores to normalize
25
- * @returns normalized scores array (same length as input)
26
- */
27
- export declare function normalizeScores<T extends ScoredItem>(items: T[]): number[];
@@ -1,16 +0,0 @@
1
- /**
2
- * Generic binary min-heap.
3
- *
4
- * Elements are ordered by a numeric `score` field.
5
- * push/pop: O(log N), size: O(1).
6
- */
7
- export declare class MinHeap<T extends {
8
- score: number;
9
- }> {
10
- private readonly h;
11
- get size(): number;
12
- push(entry: T): void;
13
- pop(): T | undefined;
14
- private siftUp;
15
- private siftDown;
16
- }
@@ -1,18 +0,0 @@
1
- export declare function ensureDir(dirPath: string): Promise<void>;
2
- export declare function fileExists(filePath: string): Promise<boolean>;
3
- /**
4
- * Expand leading ~ to homedir. Node's path.resolve() does not expand ~,
5
- * so paths like ~/Desktop/foo depend on process.cwd() and can produce
6
- * different results when run from different directories.
7
- */
8
- export declare function expandTilde(p: string): string;
9
- /**
10
- * Resolve path to absolute. Expands ~ to homedir first so that the result
11
- * does not depend on process.cwd().
12
- */
13
- export declare function resolveAbsolute(p: string): string;
14
- /**
15
- * Derive default output directory name from input file path.
16
- * e.g., /path/to/video.mp4 -> /path/to/video_scenes
17
- */
18
- export declare function deriveOutputPath(inputPath: string): string;