-`
dwt[i][j] = i_HPF[0] * temp[i][j] + i_HPF[1] * temp[i - 1][j] + i_HPF[2] * temp[i][j] + i_HPF[3] * temp[i + 1][j] + i_HPF[4] * temp[i + 2][j]; else if (i > 1 && i < height/2-2) dwt[i][j] = i_HPF[0] * temp[i - 2][j] + i_HPF[1] * temp[i - 1][j] + i_HPF[2] * temp[i][j] + i_HPF[3] * temp[i + 1][j] + i_HPF[4] * temp[i + 2][j]; else if (i == height/2-2) dwt[i][j] = i_HPF[0] * temp[i - 2][j] + i_HPF[1] * temp[i - 1][j] + i_HPF[2] * temp[i][j] + i_HPF[3] * temp[i + 1][j] + i_HPF[4] * temp[i][j]; else if (i == height/2-1) dwt[i][j] = i_HPF[0] * temp[i - 2][j] + i_HPF[1] * temp[i - 1][j] + i_HPF[2] * temp[i][j] + i_HPF[3] * temp[i - 1][j] + i_HPF[4] * temp[i - 2][j]; } } for (i = 0; i < height/2; i++) { for (j = 0; j < width/4; j++) { rec[i][j + width/4] = temp1[i][j] + dwt[i][j]; } } } if (flag == 3)//vertical direction { for (i = 0; i < height/2; i++) { for (j = 0; j < width/2; j++) { if (j % 2 == 1) temp[i][j] = rec[i][j / 2]; else temp[i][j] = 0; } } for (i = 0; i < height/2; i++) { for (j = 0; j < width/2; j++) { if (j == 0) temp1[i][j] = i_LPF[0] * temp[i][j + 1] + i_LPF[1] * temp[i][j] + i_LPF[2] * temp[i][j + 1]; else if (j > 0 && j < height/2-1) temp1[i][j] = i_LPF[0] * temp[i][j - 1] + i_LPF[1] * temp[i][j] + i_LPF[2] * temp[i][j + 1]; else if (j == height/2-1) temp1[i][j] = i_LPF[0] * temp[i][j - 1] + i_LPF[1] * temp[i][j] + i_LPF[2] * temp[i][j - 1]; } } for (i = 0; i < height/2; i++) { for (j = width/4; j < width/2; j++) { rec[i][j - width/4] = rec[i][j]; } } for (i = 0; i < height/2; i++)
-`
{ for (j = 0; j < width/2; j++) { if (j % 2 == 0) temp[i][j] = rec[i][j / 2]; else temp[i][j] = 0; } } for (i = 0; i < height/2; i++) { for (j = 0; j < width/2; j++) { if (j == 0) rec[i][j] = i_HPF[0] * temp[i][j + 2] + i_HPF[1] * temp[i][j + 1] + i_HPF[2] * temp[i][j] + i_HPF[3] * temp[i][j + 1] + i_HPF[4] * temp[i][j + 2]; else if (j == 1) rec[i][j] = i_HPF[0] * temp[i][j] + i_HPF[1] * temp[i][j - 1] + i_HPF[2] * temp[i][j] + i_HPF[3] * temp[i][j + 1] + i_HPF[4] * temp[i][j + 2]; else if (j > 1 && j < height/2-2) rec[i][j] = i_HPF[0] * temp[i][j - 2] + i_HPF[1] * temp[i][j - 1] + i_HPF[2] * temp[i][j] + i_HPF[3] * temp[i][j + 1] + i_HPF[4] * temp[i][j + 2]; else if (j == height/2-2) rec[i][j] = i_HPF[0] * temp[i][j - 2] + i_HPF[1] * temp[i][j - 1] + i_HPF[2] * temp[i][j] + i_HPF[3] * temp[i][j + 1] + i_HPF[4] * temp[i][j]; else if (j == height/2-1) rec[i][j] = i_HPF[0] * temp[i][j - 2] + i_HPF[1] * temp[i][j - 1] + i_HPF[2] * temp[i][j] + i_HPF[3] * temp[i][j - 1] + i_HPF[4] * temp[i][j - 2]; } } for (i = 0; i -` if (i == 0) rec[i][j] = i_LPF[0] * temp[i + 1][j] + i_LPF[1] * temp[i][j] + i_LPF[2] * temp[i + 1][j]; else if (i > 0 && i < height-1) rec[i][j] = i_LPF[0] * temp[i - 1][j] + i_LPF[1] * temp[i][j] + i_LPF[2] * temp[i + 1][j]; else if (i == height-1) rec[i][j] = i_LPF[0] * temp[i - 1][j] + i_LPF[1] * temp[i][j] + i_LPF[2] * temp[i - 1][j]; } } for (i = 0; i < height/2; i++) { for (j = width/2; j < width; j++) { dwt[i][j - height/2] = dwt[i][j]; } } for (i = 0; i < height; i++) { for (j = 0; j < width/2; j++) { if (i % 2 == 0) temp[i][j] = dwt[i / 2][j]; else temp[i][j] = 0; } } for (i = 0; i < height; i++) { for (j = 0; j < width/2; j++) { if (i == 0) temp1[i][j] = i_HPF[0] * temp[i + 2][j] + i_HPF[1] * temp[i + 1][j] + i_HPF[2] * temp[i][j] + i_HPF[3] * temp[i + 1][j] + i_HPF[4] * temp[i + 2][j]; else if (i == 1) temp1[i][j] = i_HPF[0] * temp[i][j] + i_HPF[1] * temp[i - 1][j] + i_HPF[2] * temp[i][j] + i_HPF[3] * temp[i + 1][j] + i_HPF[4] * temp[i + 2][j]; else if (i > 1 && i < height-2) temp1[i][j] = i_HPF[0] * temp[i - 2][j] + i_HPF[1] * temp[i - 1][j] + i_HPF[2] * temp[i][j] + i_HPF[3] * temp[i + 1][j] + i_HPF[4] * temp[i + 2][j]; else if (i == height-2) temp1[i][j] = i_HPF[0] * temp[i - 2][j] + i_HPF[1] * temp[i - 1][j] + i_HPF[2] * temp[i][j] + i_HPF[3] * temp[i + 1][j] + i_HPF[4] * temp[i][j]; else if (i == height-1) temp1[i][j] = i_HPF[0] * temp[i - 2][j] + i_HPF[1] * temp[i - 1][j] + i_HPF[2] * temp[i][j] + i_HPF[3] * temp[i - 1][j] + i_HPF[4] * temp[i - 2][j]; } } for (i = 0; i < height; i++) { for (j = 0; j < width/2; j++) { rec[i][j] = rec[i][j] + temp1[i][j]; } } -` for (i = height/2; i -` else if (i == 1) dwt[i][j] = i_HPF[0] * temp[i][j] + i_HPF[1] * temp[i - 1][j] + i_HPF[2] * temp[i][j] + i_HPF[3] * temp[i + 1][j] + i_HPF[4] * temp[i + 2][j]; else if (i > 1 && i < height-2) dwt[i][j] = i_HPF[0] * temp[i - 2][j] + i_HPF[1] * temp[i - 1][j] + i_HPF[2] * temp[i][j] + i_HPF[3] * temp[i + 1][j] + i_HPF[4] * temp[i + 2][j]; else if (i == height-2) dwt[i][j] = i_HPF[0] * temp[i - 2][j] + i_HPF[1] * temp[i - 1][j] + i_HPF[2] * temp[i][j] + i_HPF[3] * temp[i + 1][j] + i_HPF[4] * temp[i][j]; else if (i == height-1) dwt[i][j] = i_HPF[0] * temp[i - 2][j] + i_HPF[1] * temp[i - 1][j] + i_HPF[2] * temp[i][j] + i_HPF[3] * temp[i - 1][j] + i_HPF[4] * temp[i - 2][j]; } } for (i = 0; i < height; i++) { for (j = 0; j < width/2; j++) { rec[i][j + width/2] = temp1[i][j] + dwt[i][j]; } } } if (flag == 0)//vertical direction { for (i = 0; i < height; i++) { for (j = 0; j < width; j++) { if (j % 2 == 1) temp[i][j] = rec[i][j / 2]; else temp[i][j] = 0; } } for (i = 0; i < height; i++) { for (j = 0; j < width; j++) { if (j == 0) temp1[i][j] = i_LPF[0] * temp[i][j + 1] + i_LPF[1] * temp[i][j] + i_LPF[2] * temp[i][j + 1]; else if (j > 0 && j < height-1) temp1[i][j] = i_LPF[0] * temp[i][j - 1] + i_LPF[1] * temp[i][j] + i_LPF[2] * temp[i][j + 1]; else if (j == height-1) temp1[i][j] = i_LPF[0] * temp[i][j - 1] + i_LPF[1] * temp[i][j] + i_LPF[2] * temp[i][j - 1]; } } for (i = 0; i < height; i++) { for (j = width/2; j < width; j++) { rec[i][j - width/2] = rec[i][j]; } } -` for (i = 0; i < height; i++) { for (j = 0; j < width; j++) { if (j % 2 == 0) temp[i][j] = rec[i][j / 2]; else temp[i][j] = 0; } } for (i = 0; i < height; i++) { for (j = 0; j < width; j++) { if (j == 0) rec[i][j] = i_HPF[0] * temp[i][j + 2] + i_HPF[1] * temp[i][j + 1] + i_HPF[2] * temp[i][j] + i_HPF[3] * temp[i][j + 1] + i_HPF[4] * temp[i][j + 2]; else if (j == 1) rec[i][j] = i_HPF[0] * temp[i][j] + i_HPF[1] * temp[i][j - 1] + i_HPF[2] * temp[i][j] + i_HPF[3] * temp[i][j + 1] + i_HPF[4] * temp[i][j + 2]; else if (j > 1 && j < height-2) rec[i][j] = i_HPF[0] * temp[i][j - 2] + i_HPF[1] * temp[i][j - 1] + i_HPF[2] * temp[i][j] + i_HPF[3] * temp[i][j + 1] + i_HPF[4] * temp[i][j + 2]; else if (j == height-2) rec[i][j] = i_HPF[0] * temp[i][j - 2] + i_HPF[1] * temp[i][j - 1] + i_HPF[2] * temp[i][j] + i_HPF[3] * temp[i][j + 1] + i_HPF[4] * temp[i][j]; else if (j == height-1) rec[i][j] = i_HPF[0] * temp[i][j - 2] + i_HPF[1] * temp[i][j - 1] + i_HPF[2] * temp[i][j] + i_HPF[3] * temp[i][j - 1] + i_HPF[4] * temp[i][j - 2]; } } for (i = 0; i