Research Article

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

Algorithm 1

BAB Encoding for Case 1.
Description of CZ-Array Algorithm
/ This encoding algorithm uses the following procedures:
  input_Encoder( stream, length ) : Data inputting from one of the active streams;
  output_Encoder( ) : Data outputting as a block into the united array stream.
/
function encodeBAB( Stream[ 0..A-1 ] ) { / Stream is the input 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 {
   while (buffer.length < B ) do { / B is the size of a block /
    input_Encoder( row[ i ], B - buffer.length ) ➔ buffer;
    if ( row[ i ] is empty ) 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 /
     else do { bufferoutput_Encoder( ); return; } / this algorithm ends /
    }
   }
   bufferoutput_Encoder( ); / split and output a block /
   i = (i+1) mod n; / i = 0, 1, 2, … , n-1, 0, 1, 2, … , n-1, 0, 1, 2, … /
  }
}