/* Lifting Implementation of the Haar Filter Transform on $2q$ Samples haarlift( u[], q, dq ): [1] For n=0 to q-1, replace u[(2*n+1)*dq] -= u[(2*n)*dq] [2] For n=0 to q-1, replace u[(2*n)*dq] += 0.5 * u[(2*n+1)*dq] [3] For n=0 to q-1, replace u[(2*n+1)*dq] /= sqrt(2.0) [4] For n=0 to q-1, replace u[(2*n)*dq] *= sqrt(2.0) Invert the Haar Filter Transform to $2q$ samples ihaarlift( u[], q, dq ): [1] For n=0 to q-1, replace u[(2*n)*dq] /= sqrt(2.0) [2] For n=0 to q-1, replace u[(2*n+1)*dq] *= sqrt(2.0) [3] For n=0 to q-1, replace u[(2*n)*dq] -= 0.5 * u[(2*n+1)*dq] [4] For n=0 to q-1, replace u[(2*n+1)*dq] += u[(2*n)*dq] Complete Discrete Haar Transform by Lifting on $2^J$ Samples ldht0( u[], J, dq ): [0] If J>0, then do [1] and [2] [1] Compute haarlift( u[], (1<0, then do [1] and [2] [1] Compute ildht0( u[], J-1, 2*dq ) [2] Compute ihaarlift( u[], (1< #include void haarlift( float u[], int q, int dq) { int n; for(n=0; n0) { haarlift( u, (1<0) { ildht0( u, J-1, 2*dq ); ihaarlift( u, (1<