// Raised-cosine mask outer radius. For r ≥ r1: weight = 0.0
// For r0 < r < r1: weight = 0.5 * (cos(π*(r−r0)/(r1−r0)) + 1)
```
The mask is centered on the known target fractional position within the tile (from the
prior centroid/LMA fit). Units are pixels (not tile indices).
### Pipeline position
```
[non-centered pass] → approximate MV in target_sequence_multi / extended_scan
↓
[refineMotionVectors()] ← NEW (optional, recalc_mv=true, fast mode only)
apply spatial mask around target center
re-run TD pairwise accumulation with boosted pairs
return refined MV → overwrite extended_scan (or produce new vector_field)
↓
[shiftAndRenderAccumulate()] ← existing, line 8203
virtual tracking camera, long exposure
↓
[getAccumulatedCoordinates() / LMA]
```
### Open questions (to resolve before implementation)
1.**Where is the target center at this point in the code?** The centroid/LMA result lives
in `target_sequence_multi`. Which field indices (`RSLT_X`, `RSLT_Y`, etc.) hold the
fractional pixel offset within the tile for each keyframe?
2.**What does the mask multiply?** The source `fpixels_tum` float array, or the TD
tiles already computed by the GPU? If the GPU has already done the TD transform by this
point, we need to apply the mask in PD before re-loading, or apply it in TD (which is a
convolution — more complex). Is the mask applied in Java before calling the GPU, or does
it need a new GPU kernel path?
3.**Pair geometry for the boosted refinement:**`recalc_mv_boost` scales the number of
pairs. Does this mean reusing the same `cuas_corr_offset` with more `(frame0+d,
frame1+d)` pairs, or changing the offset too? Are there enough frames in the sequence
to support 4× more pairs without running past the sequence boundary?
4.**Return value:** Should `refineMotionVectors()` return a new `double[][][]` vector
field (same structure as `extended_scan`) with refined `RSLT_VX/VY`, or modify the
existing `target_sequence_multi` in-place?
5.**Tiles with no known target:** For tiles where the first pass found no valid target
(`target_sequence_multi[nseq][ntile] == null` or score below threshold), should
refinement be skipped (keep original MV) or skipped entirely (null)?
6.**New `IntersceneMatchParameters` fields:** Are `cuas_recalc_mv`,
`cuas_recalc_mv_boost`, `cuas_recalc_mv_r0`, `cuas_recalc_mv_r1` already added to
`IntersceneMatchParameters.java`, or do they need to be added as part of this work?
### Next TODO (priority order)
1. Performance pass: identify current bottlenecks and low-hanging optimizations.
-**Two-stage motion vector calculation:** Repeat correlation with a tight mask (R=4) around located targets to significantly decrease the noise integration area and eliminate motion blur.