function y = invdau4( x ) % INVDAU4 Inverse 4 tap Daubechies wavelet kernel % First define the filter kernels c0 = 0.4829629; c1 = 0.8365163; c2 = 0.2241439; c3 = -0.1294095; d_kernel_l = [ c2 c1 c0 c3 ]; d_kernel_h = [ c3 -c0 c1 -c2 ]; % Now re-order the input [ size_v, size_h ] = size( x ); half = size_h / 2; z = [ 1:size_h ]; z( 1:2:size_h ) = x( 1:1:half ); z( 2:2:size_h ) = x( half+1:1:size_h ); for start = 1:2:size_h if start > 2 a = z( start-2:start+1 ); else residual = 3 - start; a( 1:residual ) = z( size_h-residual+1:size_h ); a( residual+1:4 ) = z( 1:4-residual ); end y( start ) = a * d_kernel_l'; y( start + 1 ) = a * d_kernel_h'; end