Skip to main content
. 2019 May 29;19(11):2450. doi: 10.3390/s19112450
Algorithm 2 ML-DWT Compression
  • Input: W4, K

  • Output: W4^

  • 1: 

    procedureCompression(W4, K)

  • 2: 

        LSI =argsort(W4, K)

  • 3: 

        W4^ =encode(W4, LSI)

  • 4: 

        return W4^

  • 5: 

    end procedure

     

  • 6: 

    functionargsort(W4, K)

  • 7: 

        LSI={}

  • 8: 

        max=0

  • 9: 

        for j=0 to K1 do

  • 10: 

            for i=0 to 144 do

  • 11: 

               if i exists in LSI then

  • 12: 

                   continue

  • 13: 

               end if

  • 14: 

               if abs(W[i])>abs(max) then

  • 15: 

                   max=W[i]

  • 16: 

                   index=i

  • 17: 

               end if

  • 18: 

            end for

  • 19: 

            LSI[j]=index

  • 20: 

            index,max=0

  • 21: 

        end for

  • 22: 

        return LSI

  • 23: 

    end function

     

  • 24: 

    functionencode(W4, LSI)

  • 25: 

        for i=0 to 11 do            ▹A4=W4[0:11]

  • 26: 

            A[i]=W4[i]<<4           ▹ left bit-shift

  • 27: 

        end for

  • 28: 

        for j=12 to K1 do          ▹DW4[12:144]

  • 29: 

            D[j12]=W4[LSI[j]]

  • 30: 

        end for

  • 31: 

        for k{0,2,4,6} do

  • 32: 

            A[j] = A[j]|( LSI[j] & 0x000F)

  • 33: 

            A[j+1] = A[j+1]|((LSI[j]>>4) & 0x000F)

  • 34: 

        end for

  • 35: 

        return W4^

  • 36: 

    end function