/** * SmartCamera utility functions */ /** * Creates an FPS limiter for frame processing * * @param targetFps - Target frames per second * @returns Object with shouldProcess function * * @example * ```ts * const limiter = createFpsLimiter(15); * * const frameProcessor = useFrameProcessor((frame) => { * if (!limiter.shouldProcess()) return; * // Process frame... * }, []); * ``` */ export declare function createFpsLimiter(targetFps: number): { shouldProcess: () => boolean; reset: () => void; setTargetFps: (fps: number) => void; }; /** * Creates a debounced function * * @param fn - Function to debounce * @param delay - Delay in milliseconds * @returns Debounced function */ export declare function debounce unknown>(fn: T, delay: number): (...args: Parameters) => void; /** * Creates a throttled function * * @param fn - Function to throttle * @param limit - Minimum time between calls in milliseconds * @returns Throttled function */ export declare function throttle unknown>(fn: T, limit: number): (...args: Parameters) => void; /** * Creates an object pool for reducing garbage collection * * @param factory - Factory function to create new objects * @param initialSize - Initial pool size * @param maxSize - Maximum pool size */ export declare function createObjectPool(factory: () => T, initialSize?: number, maxSize?: number): { acquire: () => T; release: (obj: T) => void; clear: () => void; getStats: () => { size: number; inUse: number; available: number; }; }; import type { SmartCameraError, SmartCameraErrorCode } from '../types'; /** * Creates a SmartCameraError from an unknown error * * @param error - The original error * @param defaultCode - Default error code if not determinable * @returns SmartCameraError */ export declare function createSmartCameraError(error: unknown, defaultCode?: SmartCameraErrorCode): SmartCameraError; /** * Safely execute a function and return a SmartCameraError on failure */ export declare function safeExecute(fn: () => Promise, errorCode?: SmartCameraErrorCode): Promise<{ data: T; error: null; } | { data: null; error: SmartCameraError; }>; /** * Validates face detection options */ export declare function validateFaceDetectionOptions(options: Record): string[]; interface PerformanceMetrics { frameCount: number; averageProcessingTime: number; minProcessingTime: number; maxProcessingTime: number; droppedFrames: number; } /** * Creates a performance monitor for frame processing */ export declare function createPerformanceMonitor(windowSize?: number): { startFrame: () => number; endFrame: (startTime: number) => void; getMetrics: () => PerformanceMetrics; reset: () => void; }; export {}; //# sourceMappingURL=index.d.ts.map