zhaoruizhe
df8de069d8
perf: vectorize shift_image with NumPy, fixes #520
...
Replace the per-pixel getpixel/putpixel loop in shift_image
(py/imagefunc.py:328-349) with NumPy slicing: np.roll for the cyclic
branch, boolean row/col masks + np.ix_ for the non-cyclic branch.
Function signature is unchanged; none of the 14 call sites (ImageShift,
DropShadow v1-v3, InnerShadow v1-v2, ChannelShake) need edits.
Benchmark on Apple M4, CPU only, mean of N runs:
- 1024x1024 non-cyclic: 0.563s -> 0.030s (18.5x)
- 2048x2048 non-cyclic: 2.448s -> 0.117s (21.0x)
- 1024x1024 cyclic: 0.608s -> 0.004s (159x)
RGB output verified pixel-identical against the original implementation
across 2592 parameter combinations plus six full-1024x1024 cases.
Fixes #520
2026-10-10 17:05:21 +08:00
..
2025-03-25 23:22:14 +08:00
2025-01-26 16:56:10 +08:00
2024-12-15 18:16:27 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2026-09-02 16:02:58 +08:00
2024-02-09 10:21:47 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2025-06-20 08:44:58 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-18 23:48:12 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-19 19:17:46 +08:00
2025-08-09 20:53:07 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2026-01-11 12:52:41 +08:00
2026-01-08 17:50:29 +08:00
2025-11-07 23:30:43 +08:00
2024-12-05 19:24:26 +08:00
2024-12-16 16:40:17 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-15 10:19:51 +08:00
2024-12-15 10:19:51 +08:00
2025-08-09 20:53:07 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-11 23:40:28 +08:00
2024-12-18 23:48:12 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2025-03-26 11:39:50 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-15 10:02:11 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2026-01-09 12:01:16 +08:00
2024-12-05 17:26:51 +08:00
2024-12-19 19:17:46 +08:00
2024-12-05 17:26:51 +08:00
2026-08-18 13:13:45 +08:00
2024-12-05 17:26:51 +08:00
2024-12-12 18:19:40 +08:00
2024-12-12 18:19:40 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2025-08-04 20:35:34 +08:00
2024-12-05 17:26:51 +08:00
2026-10-10 17:05:21 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2025-08-04 20:35:34 +08:00
2025-08-09 20:53:07 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2026-09-16 10:08:47 +08:00
2026-09-16 10:08:47 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2025-09-11 00:06:21 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2026-07-23 13:45:00 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2025-02-13 13:07:10 +08:00
2024-12-05 17:26:51 +08:00
2024-12-06 00:09:12 +08:00
2026-09-16 10:08:47 +08:00
2024-12-05 17:53:25 +08:00
2024-12-16 16:40:17 +08:00
2026-09-16 10:08:47 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 18:58:38 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00
2025-12-23 18:02:03 +02:00
2025-12-23 18:02:03 +02:00
2024-12-05 17:26:51 +08:00
2024-12-22 15:11:45 +08:00
2026-09-16 10:08:47 +08:00
2024-12-05 17:26:51 +08:00
2024-12-05 17:26:51 +08:00