# Correct way to implement Discrete and Stationary Wavelet Transform?

Can someone please confirm if this is indeed the correct way to compute DWT:

load image

for i = 1: Level
periodize edges of image
convolve image with Low pass Haar wavelet filter and store result in G
convolve image with Low pass Haar wavelet filter and store result in H

convolve G with low pass Haar to calculate approximation co-eff
convolve G with high pass Haar to calculate horizontal co-eff

convolve H with low pass Haar to calculate vertical co-eff
convolve H with high pass Haar to calculate diagonal co-eff

i = i + 1
downsample approximation by 2
end


In case of SWT, instead of down-sampling the approximation, Haar filter co-efficients are up-sampled twice at each level and the same process is repeated. Am I correct here?

# assume x is passed in as a variable

I believe the mathematical description includes some scaling by $1/\sqrt{2}$.