Commit 4615ebc
committed
bidiphase.shift: copy the source slice before the overlapping in-place assignment
bidiphase.shift shifts the odd scan lines with an in-place assignment whose
source and destination slices overlap. numpy handles overlapping assignments
by making a temporary copy, but torch.Tensor.copy_ does not, so since the
registration path started passing torch tensors (v1.0.0.1) every odd line
was corrupted instead of shifted: with bidiphase=3, 34% of odd-line pixels
in register_frames' output differ from the intended shift (they contain
repeated copies of the first columns). The reference image, which still
goes through the numpy path in registration_wrapper, was shifted correctly,
so frames and reference disagreed.
Copy the source slice first (clone for torch, copy for numpy), which
restores the numpy semantics for both array types.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012d2sJAD5EUp4GqAStqoBX71 parent 90be895 commit 4615ebc
1 file changed
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
63 | 68 | | |
64 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
65 | 72 | | |
66 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
67 | 76 | | |
0 commit comments