/*
  Test_reorder.java
  Testing Reorder class functions.
*/

public class Test_reorder {
  //prshort one 8x8 sample block
  static void print_block( short [][] X )
  {
    for ( short i = 0; i < 8; ++i ){
      System.out.printf("\n");
      for ( short j = 0; j < 8; ++j ) {
        System.out.printf("%4d, ", X[i][j] );
      }
    }
  }
	
  public static void main(String[] args) throws InterruptedException
  {
    short [][] X = new short[8][8], Y = new short[8][8];
    short i, j;
  
    //some sample data
    for ( i = 0; i < 8; ++i ) 
      for ( j = 0; j < 8; ++j ) 
        X[i][j] = (short)( 3 * i *j  + j + 1) ;
  
    System.out.printf("\nOriginal Data:");
    System.out.printf("\n ------------------");
    print_block ( X );

    Reorder r = new Reorder();

    r.reorder(  X,  Y );

    System.out.printf("\n\nData after reorder:");
    print_block ( Y );

    r.reverse_reorder ( Y, X );                                                                             
    System.out.printf("\n\nData recovered by reversing reorder:");
    System.out.printf("\n ------------------");
    print_block ( X );
    System.out.printf("\n");
  }
}

