mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-16 22:48:55 +00:00
* perf(studio): schedule adaptive timeline thumbnails * perf(studio): bound thumbnail decoding resources * perf(studio): virtualize timeline thumbnail media * perf(studio): prioritize timeline thumbnail work * perf(studio-server): coordinate cancelable thumbnail generation --------- Co-authored-by: Codex <codex@local>
21 lines
646 B
TypeScript
21 lines
646 B
TypeScript
export interface ThumbnailOutputDimensions {
|
|
width: number;
|
|
height: number;
|
|
outputWidth: number;
|
|
outputHeight: number;
|
|
}
|
|
|
|
/** Sole adapter rule for capturing authored layout at bounded physical dimensions. */
|
|
export function thumbnailDeviceScaleFactor({
|
|
width,
|
|
height,
|
|
outputWidth,
|
|
outputHeight,
|
|
}: ThumbnailOutputDimensions): number {
|
|
const dimensions = [width, height, outputWidth, outputHeight];
|
|
if (dimensions.some((value) => !Number.isFinite(value) || value <= 0)) {
|
|
throw new RangeError("Thumbnail dimensions must be positive finite numbers");
|
|
}
|
|
return Math.min(1, outputWidth / width, outputHeight / height);
|
|
}
|