feat: VRSub 单体应用(WOV 单机版)初始提交

为视频生成 VR 双眼字幕的单体实现:FastAPI 后端、调度器与全部节点
(提音/转写/翻译/ASS/抽帧/OCR/LLM 过滤)在单进程内运行。

- 节点协议(wov_sdk 数据模型)与分布式版保持一致,预留回退桥梁
- 工作流即数据:DAG 存于 workflows/*.json,模型/链路改动只改数据
- 调度器:拓扑顺序执行、断点续跑(产物重建)、任务暂停/继续
- 抽帧按帧间隔(select 按帧号精确取帧),VLM OCR 与 LLM 过滤使用
  自适应线程池弹性并发,并打印数据处理速度进度日志
- 100% 行覆盖率(pytest --cov-fail-under=100)
This commit is contained in:
2026-08-16 23:58:25 +08:00
commit 4746e0363f
75 changed files with 10969 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
// crop 归一化纯函数单测:由 pytest 通过 node 执行(TDD 红阶段先失败)。
"use strict";
const assert = require("assert");
const { videoDisplayRect, rectToCrop, cropToRect } = require("../web/assets/crop.js");
// 1) 无留边(容器比例与视频一致):底部 20% 矩形 → crop [0, 0.8, 1, 0.2]
let d = videoDisplayRect(1280, 720, 1280, 720);
assert.deepStrictEqual(d, { x: 0, y: 0, w: 1280, h: 720 });
assert.deepStrictEqual(
rectToCrop({ x: 0, y: 576, w: 1280, h: 144 }, 1280, 720, 1280, 720),
[0, 0.8, 1, 0.2]
);
// 2) letterbox(容器比视频宽):视频显示在中间,矩形映射要考虑左右留边
d = videoDisplayRect(1280, 720, 1600, 720);
assert.deepStrictEqual(d, { x: 160, y: 0, w: 1280, h: 720 });
// 在渲染视频内框选右下 25% 区域
let crop = rectToCrop({ x: 160 + 640, y: 360, w: 640, h: 360 }, 1280, 720, 1600, 720);
assert.deepStrictEqual(crop, [0.5, 0.5, 0.5, 0.5]);
// 3) 回显一致性:crop → rect → crop 应还原(含 letterbox
let back = cropToRect(crop, 1280, 720, 1600, 720);
assert.deepStrictEqual(
rectToCrop(back, 1280, 720, 1600, 720),
crop
);
// 4) 越界钳制:矩形超出画面时 crop 值被限制在 0~1
crop = rectToCrop({ x: -100, y: -50, w: 2000, h: 900 }, 1280, 720, 1280, 720);
assert.ok(crop.every((v) => v >= 0 && v <= 1));
console.log("crop.js 全部断言通过");