-
Notifications
You must be signed in to change notification settings - Fork 1
/
d2boxstepi.m
68 lines (60 loc) · 2.12 KB
/
d2boxstepi.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
function x=d2boxstepi(f,level,dim,cofs)
% x=d2boxstepi(f,level,dim,cofs)
%
% Performs one INVERSE iteration (from a certain level) of D2 transform
% along a certain dimension; assuming scaling coefficients are in front,
% followed by wavelet coefficients. This transform is an isometry. It is
% equal to the Haar transform.
%
% INPUT:
%
% f The three-dimensional array with wavelet and scaling functions
% level The level we are at now [scalar]
% dim The index identifying the dimension [scalar]
% cofs The wavelet and scaling filter coefficients
%
% OUTPUT:
%
% x The inverse wavelet transform of f
%
% SEE ALSO: D2BOXSTEP, D2BOXCOF
%
% Inspired by Ignace Loris ([email protected]) on 22.06.2009
% Last modified by fjsimons-at-alum.mit.edu, 08/23/2010
% Figure out dimensions
nall=size(f);
if length(nall)==2
nall(3)=1;
end
% Initialize output, which you need to always take from the previous step
x=f;
if level==0
% Do nothing
return
end
% To move out of 'level' we expand two sets of k coefficients each into
% 2^(n-level+1) coefficients, where 2^n is the dimension of the data set
k=size(f,dim)/2^level;
% The LF-tap filter length
LF=length(cofs.H0);
% Transform low pass coefficients from previous step
% Regular ones (i.e. excludes first LE and last LE)
% Exclude the same number on the left and right
% Compare with the forward transform but most of all work with what
% follows in leaving the right amount of spots untouched.
for i=1:k
% Isolate the sets of planes in the right dimension
% Interior, Lowpass (Scaling Coefficients)
fplaneslo=[f(dindeks( i,dim,nall))'];
% Interior, Highpass (Wavelet Coefficients)
fplaneshi=[f(dindeks(k+i,dim,nall))'];
% And put the convolutions in the SHIFTED UPSAMPLED spots
% See under SYNTHESIS, SN p. 129
% Watch the delay, which is different in D2BOXSTEPI
% These indices determine the ranges above!
x(dindeks(2*i-1,dim,nall))=...
cofs.F0(1)*fplaneslo+cofs.F1(1)*fplaneshi;
x(dindeks(2*i+0,dim,nall))=...
cofs.F0(2)*fplaneslo+cofs.F1(2)*fplaneshi;
end
% All other coefficients (wavelet coeff from previous step) remain