Research Article

Block-Split Array Coding Algorithm for Long-Stream Data Compression

Algorithm 2

BAB Decoding for Case 1.
/ This decoding algorithm uses the following procedures:
  input_Decoder( length ) : Data inputting from the united array stream;
  output_Decoder( stream ) : Data outputting into one of the active streams.
/
function decodeBAB( Stream[ 0..A-1 ] ) { / Stream is the output stream queue (ready for coding) /
  row = array( 0..n-1 ); / n is the row amount of the data block array (n<=A) /
  row[ 0..n-1 ] = Stream[ 0..n-1 ]; / initialize the rows /
  i = 0; count = n;
  repeat do {
   input_Decoder( B ) ➔ buffer; / B is the size of a block /
   if ( buffer.length =0 ) do { return; } / input stream is empty, this algorithm ends /
   while ( buffer.length >0 ) do {
    if ( row[ i ] is full ) do { / current stream ends /
     if ( count < A ) do { row[ i ] = Stream[ count ]; count = count +1; } / switch to a new stream /
     else if ( n > 0 ) do { row[ i ] = row[ n-1 ]; n = n-1; } / delete a row /
    }
    bufferoutput_Decoder( row[ i ] );
    i = (i+1) mod n; / i = 0, 1, 2, … , n-1, 0, 1, 2, … , n-1, 0, 1, 2, … /
   }
  }
}