dsh-watch-together 0.2.8 → 0.2.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,76 @@
3
3
  All notable changes to **dsh-watch-together** are documented here.
4
4
  This package starts its own version line at `0.0.7` — it is not a continuation of `dsh-video-storyboard`.
5
5
 
6
+ ## [0.2.10] - 2026-11-03
7
+
8
+ > GPU 路径其实一直是坏的,顺便量了一下它到底省不省。
9
+
10
+ ### Fixed — GPU 路径的 GLSL 用了保留字,着色器从来没编译成功过
11
+
12
+ `glass_window_gpu.py` 的 FRAG 里有一行 `vec3 patch = mix(edgep, strong, e);`。
13
+ `patch` 是 GLSL 1.5 起保留的 tessellation 关键字,编译直接失败:
14
+
15
+ ```
16
+ GLSL Compiler failed
17
+ ERROR: 0:24: 'patch' : syntax error
18
+ ```
19
+
20
+ `_work()` 里那句 `except` 把异常吞掉、每帧打一行 `GPU capture failed, falling back to CPU`,
21
+ 然后继续走 CPU —— **所以 `glass_window_gpu.py` 从来没真正跑起来过**,用户能看到的最大线索
22
+ 就是一句每帧刷屏的日志。更糟的是它每帧重建一次 program/FBO 又失败,实测内存涨到 **2.3 GB**。
23
+
24
+ 改个名(`patch` → `tile`)。修完日志干净、内存 200 MB、画面和 CPU 版一致。
25
+
26
+ ### 实测 — GPU 不比 CPU 省(这台机器上)
27
+
28
+ i9-12900HX / RTX 4060 Laptop / 窗口 700×665 / 150% DPI / 静态桌面:
29
+
30
+ | 路径 | CPU(单核) | 内存 |
31
+ |---|---|---|
32
+ | CPU(正常模式) | **49.6%** | 100 MB |
33
+ | GPU(`glass_window_gpu.py`) | 115.6% | 200 MB |
34
+ | CPU(`GLASS_FORCE=1`,调试) | 146% | 111 MB |
35
+
36
+ 两边都有静态跳帧,GPU 多出来的是每帧把 BGRA 上传成纹理(约 2.6 MB/帧)+ moderngl 的
37
+ Python 层调用开销;而 CPU 版在这么小的窗口上本来就够快。GPU 路径更适合「窗口很大 + CPU 较弱」,
38
+ 不是无脑更优 —— **默认继续用 CPU**。
39
+
40
+ ## [0.2.9] - 2026-11-03
41
+
42
+ > 一条根因修得很漂亮的 bug:拖动窗口时的动态模糊。
43
+
44
+ ### Fixed — 拖动窗口没有动态模糊(合 PR #49,作者 @ggfgfgf-on,对应 #48)
45
+
46
+ 现象是「`GLASS_FORCE=1` 下能看到那种黏黏的拖尾,正常启动看不到」,我一开始以为是
47
+ `_motion_blur` 的衰减公式问题 —— 猜错了。
48
+
49
+ 真正的原因在这行:
50
+
51
+ ```python
52
+ if self._sig is not None and box == self._sig_bbox and sig.shape == self._sig.shape:
53
+ ```
54
+
55
+ 拖动窗口时抓取区域 `box = (gl, gt, gr, gb)` 每帧都在变,`box == self._sig_bbox` 永远不成立,
56
+ `moved` 一直是 `False`。于是:
57
+
58
+ - `_motion_blur` 一路乘 0.55 衰减到 0,混合那步一次都不执行;
59
+ - 反而每帧都在做 `apply_chroma(panel, 1.7)`(那是「没在动」时的色散补偿)。
60
+
61
+ `FORCE` 之所以看起来有效,只是因为它跳过静态跳帧、帧数更多,更容易凑出连续可混合的帧 ——
62
+ 它并没有修掉这个判断。
63
+
64
+ 现在 `_sig_bbox` 已存在且 `box` 变了,就把这一帧标成 `moved = True`:抓取区域变了,
65
+ 旧区域的像素本来也不能直接做差,但这确实是运动。静止窗口仍走原来的像素差判断,
66
+ 不会变成常驻拖影。和 #42 不冲突 —— `_invalidate_glass()` 会把 `_sig_bbox` 清成 `None`,
67
+ 形状变化后的第一帧不会误判成 `box_changed`。
68
+
69
+ ### 说明 — 静止画面下没有动态模糊是设计
70
+
71
+ 同一轮确认:`if moved` 这层是故意留的,运动模糊不是常驻滤镜。静止时混上一帧只会把文字和边缘
72
+ 永久糊一层,还会让 `_motion_blur` 维持在高位,停下后回不到清晰;CPU 每帧做一次 `Image.blend` 也不便宜。
73
+
74
+ 想要「低速拖尾」可以做配置项(类似 `motionBlurFloor`,默认 0),但不改默认行为。
75
+
6
76
  ## [0.2.8] - 2026-11-03
7
77
 
8
78
  > 三个社区 PR(都是 @ggfgfgf-on)+ 一批失效入口的清理。
package/dsh.plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-watch-together",
3
3
  "description": "Watch a video together with a text-only agent: follow the user's real playback position and hand over one segment at a time, just before the segment ends.",
4
- "version": "0.2.8",
4
+ "version": "0.2.10",
5
5
  "entry": {
6
6
  "name": "dsh-watch-together",
7
7
  "inject": [
@@ -112,8 +112,8 @@ void main() {
112
112
  vec3 edgep = texelFetch(raw, ep, 0).rgb;
113
113
  // CPU 里 edge_w=0 是边缘(取折射样本),=1 是中心(取强模糊);
114
114
  // 这里方向必须一致,否则内框边缘反而没有扭曲。
115
- vec3 patch = mix(edgep, strong, e);
116
- frag = vec4(mix(base, patch, a), 1.0);
115
+ vec3 tile = mix(edgep, strong, e);
116
+ frag = vec4(mix(base, tile, a), 1.0);
117
117
  }
118
118
  """
119
119
 
@@ -994,7 +994,13 @@ class LiveGlass:
994
994
  box = (gl, gt, gr, gb)
995
995
  now = time.perf_counter()
996
996
  moved = False
997
- if self._sig is not None and box == self._sig_bbox and sig.shape == self._sig.shape:
997
+ # 窗口被拖动 / 跨屏移动时抓取区域每帧都在变,旧区域的像素不能直接做差;
998
+ # 但这仍然是运动。不标 moved 的话,拖动全程都走“无运动”分支:
999
+ # _motion_blur 一路衰减、混合永远不执行,只有 FORCE 强制多帧时才明显。
1000
+ box_changed = self._sig_bbox is not None and box != self._sig_bbox
1001
+ if box_changed:
1002
+ moved = True
1003
+ elif self._sig is not None and sig.shape == self._sig.shape:
998
1004
  d = np.abs(sig - self._sig)
999
1005
  moved = bool(float(d.mean()) > 0.01 or float(d.max()) > 0.5)
1000
1006
  if moved:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-watch-together",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "description": "Watch a video together with a text-only agent: follow the user's real playback position, hand over one segment at a time just before it ends, and keep a single text stream of scripted lines, interjections and the user's replies.",
5
5
  "keywords": [
6
6
  "dsh",