Modulo-N code

Lossy Compression Algorithm

Modulo-N code is a lossy compression algorithm used to compress correlated data sources using modular arithmetic.

Compression

When applied to two nodes in a network whose data are in close range of each other modulo-N code requires one node (say odd) to send the coded data value as the raw data M o = D o {\displaystyle M_{o}=D_{o}} ; the even node is required to send the coded data as the M e = D e mod N {\displaystyle M_{e}=D_{e}{\bmod {N}}} . Hence the name modulo-N code.

Since at least log 2 K {\displaystyle \log _{2}K} bits are required to represent a number K in binary, the modulo coded data of the two nodes requires log 2 M o + log 2 M e {\displaystyle \log _{2}M_{o}+\log _{2}M_{e}} bits. As we can generally expect log 2 M e log 2 M o {\displaystyle \log _{2}M_{e}\leq \log _{2}M_{o}} always, because M e N {\displaystyle M_{e}\leq N} . This is the how compression is achieved.

A compression ratio achieved is C.R. = log 2 M o + log 2 M e 2 log 2 M o . {\displaystyle {\text{C.R.}}={\frac {\log _{2}M_{o}+\log _{2}M_{e}}{2\log _{2}M_{o}}}.}

Decompression

At the receiver by joint decoding we may complete the process of extracting the data and rebuilding the original values. The code from the even node is reconstructed by the assumption that it must be close to the data from the odd node. Hence the decoding algorithm retrieves even node data as

CLOSEST ( M o , N . k + M e ) . {\displaystyle \operatorname {CLOSEST} (M_{o},N.k+M_{e}).}

The decoder essentially finds the closest match to M o N . k + M e {\displaystyle M_{o}\simeq N.k+M_{e}} and the decoded value is declared as N . k + M e {\displaystyle N.k+M_{e}}

Example

For a mod-8 code, we have Encoder

D_o=43,D_e=47
M_o=43,M_e=47 mod(8) = 7,

Decoder

 M_o=43,M_e=47 mod(8) = 7,
 D_o=43,D_e=CLOSEST(43,8⋅k + 7)
 
  
    
      
        43
        
        8
        
        5
        +
        7
      
    
    {\displaystyle 43\simeq 8\cdot 5+7}
  

 D_o=43,D_e=47

Modulo-N decoding is similar to phase unwrapping and has the same limitation: If the difference from one node to the next is more than N/2 (if the phase changes from one sample to the next more than π {\displaystyle \pi } ), then decoding leads to an incorrect value.

See also

  • DISCUS is a more sophisticated technique for compressing correlated data sources.
  • Delta encoding is a related algorithm used in lossless compression algorithms designed for correlated data sources.