First piece of eICCI, the last unported JPEG-AI decode stage. eICCI's CNN operates in
a wavelet domain rather than on pixels; this lands that transform.
A Haar wavelet on 2x2 blocks with 1/2 scaling, applied two levels: a plane [1,H,W]
becomes [4,H/2,W/2] then [16,H/4,W/4]. Stacking the three planes' subbands gives the
48 channels the network's first convolution consumes (cat(Y16,U16,V16)).
LL = a+b+c+d (all pre-scaled by 1/2)
HL = -a-b+c+d
LH = -a+b-c+d
HH = a-b-c+d
Perfect reconstruction: LL-HL-LH+HH = 4a, so the inverse recovers each sample exactly.
Channel layout matches the reference cat order — one level emits [LL,HL,LH,HH]; two
levels emit x16[i*4..i*4+4] = the level-2 decomposition of level-1 band i.
Unit tests: hand-checked single 2x2 block, idwt.dwt = id, two-level round-trip with the
16-band shape, and the 48-channel plane stack.
Co-Authored-By: Claude Opus 4.8 <[email protected]>