Skip to content

Slice 5: GPU Pass 2 — coefficient reconstruction + inverse DTCWT #16

Description

@joeljose

Context

Parent: #11 | PRD: #10 | Design: docs/design/gpu-acceleration.md Section B, Pass 2

Goal

Implement the second GPU pass: re-run forward DTCWT to recover Yl and amplitudes, apply modified phases, reconstruct coefficients, and run inverse DTCWT.

Acceptance Criteria

  • _gpu_inverse_pass(data, phase_arrays, nlevels, biort, qshift, device) returns reconstructed (num_frames, H, W) float32 array
  • Re-runs DTCWTForward to recover Yl and amplitudes (verified deterministic — 0.00 diff)
  • Reconstructs modified Yh: real = amp * cos(phase), imag = amp * sin(phase), stacked to (B, 1, 6, H, W, 2)
  • DTCWTInverse((Yl, Yh_modified)) produces reconstructed frames
  • Output cropped to original (H, W) if inverse output is larger (padding)
  • Same batch size auto-tuning as Pass 1
  • OOM caught with actionable error
  • Progress reporting

Blocked by

#15 (Slice 4) — needs modified phase arrays from temporal filter.

Files likely involved

  • motion_mag.py_gpu_inverse_pass() function

Testing approach

  • Unit test: identity test — extract phases in Pass 1, skip modification, reconstruct in Pass 2 → output matches input (PSNR > 120 dB)
  • Unit test: output shape matches input shape
  • Unit test: output values are finite and in reasonable range

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions