// file: $USFS/class/image_analysis/v1.0/imaga_rle_07.cc
//

// isip include files
//
#include "image_analysis.h"

#include "image_analysis_constants.h"
#include <integral_constants.h>

// method: rle_normalize_cc
//
// arguments: none
//
// return: a logical_1 value indicating status
//
// this method normalized the DCT coefficients using a hardcoded normalization
//
logical_1 Image_analysis::rle_normalize_cc() {
  
  // normalize the image by dividing the DCT value by the matrix term
  //
  for (int_4 i=0; i<IMAGA_RLE_BLK_SIZE; i++) {
    for (int_4 j=0; j<IMAGA_RLE_BLK_SIZE; j++) {

      // round off the red value to nearest integer
      //
      rle_r_red_d[i*IMAGA_RLE_BLK_SIZE + j] /= rle_norm_d[i][j];
      rle_r_red_d[i*IMAGA_RLE_BLK_SIZE + j] =
	rint(rle_r_red_d[i*IMAGA_RLE_BLK_SIZE + j]);

      // round off the green valye to nearest integer
      //
      rle_r_grn_d[i*IMAGA_RLE_BLK_SIZE + j] /= rle_norm_d[i][j];
      rle_r_grn_d[i*IMAGA_RLE_BLK_SIZE + j] =
	rint(rle_r_grn_d[i*IMAGA_RLE_BLK_SIZE + j]);

      // round off the blue value to nearest integer
      //
      rle_r_blu_d[i*IMAGA_RLE_BLK_SIZE + j] /= rle_norm_d[i][j];
      rle_r_blu_d[i*IMAGA_RLE_BLK_SIZE + j] =
	rint(rle_r_blu_d[i*IMAGA_RLE_BLK_SIZE + j]);
    }
  }
  
  // exit gracefully
  //
  return ISIP_TRUE;
}
