3 @brief Lifting wavelet transform
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 void lifting_forward(float *x
, struct LiftingBasis
*basis
, int len
, int stride
)
29 float *r
, *rstart
; /* residue/modified value */
30 float *y
; /* prediction start */
31 int stride2
= 2*stride
;
33 if (basis
->predict_delay
> 1)
34 rstart
= x
-stride2
*(basis
->predict_delay
-1);
38 y
= x
+ 1 - stride2
*(basis
->predict_length
- basis
->predict_delay
);
40 for (i
=0;i
<len
;i
+=stride2
)
43 const float *p
= basis
->predict
;
45 for (j
=0;j
<basis
->predict_length
;j
++)
56 r
= rstart
+ 1 - stride2
*basis
->update_delay
;
57 y
= rstart
- stride2
*(basis
->update_length
- basis
->update_delay
);
59 for (i
=0;i
<len
;i
+=stride2
)
62 const float *p
= basis
->update
;
64 for (j
=0;j
<basis
->update_length
;j
++)
75 void lifting_backward(float *x
, struct LiftingBasis
*basis
, int len
, int stride
)
78 float *r
, *rstart
, *ustart
; /* residue/modified value */
79 float *y
; /* prediction start */
80 int stride2
= 2*stride
;
82 if (basis
->predict_delay
> 1)
83 rstart
= x
-2*stride
*(basis
->predict_delay
-1);
88 ustart
= rstart
+ 1 - stride2
*basis
->update_delay
;
89 y
= rstart
- stride2
*(basis
->update_length
- basis
->update_delay
);
92 for (i
=0;i
<len
;i
+=stride2
)
95 const float *p
= basis
->update
;
97 for (j
=0;j
<basis
->update_length
;j
++)
108 if (basis
->predict_delay
> 1)
109 rstart
= ustart
-stride2
*(basis
->predict_delay
-1)-1;
113 y
= ustart
- stride2
*(basis
->predict_length
- basis
->predict_delay
);
115 for (i
=0;i
<len
;i
+=stride2
)
118 const float *p
= basis
->predict
;
120 for (j
=0;j
<basis
->predict_length
;j
++)