// file: $USFS/class/image_analysis/v6.0/imaga_rle_04.cc
//

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

// method: rle_debias_cc
//
// arguments:
//  uint_1* b_red: (input) buffer for red color
//  uint_1* b_grn: (input) buffer for green color
//  uint_1* b_blu: (input) buffer for blue color
//  int_4 width: (input) width of the block
//  int_4 height: (input) height of the block
//
// return:
//  a logical_1 value indicating status
//
// this method removes the DC bias from the image block
//
logical_1 Image_analysis::rle_debias_cc(uint_1* b_red_a, uint_1* b_grn_a,
					uint_1* b_blu_a, int_4 width_a,
					int_4 height_a) {

  // declare local variables
  //
  int_4 npixels = width_a * height_a;
  
  // debias the image by subtracting the mid value
  //
  for (int_4 i = 0; i < npixels; i++) {
      rle_r_red_d[i] = (float_4)b_red_a[i] - IMAGA_RLE_MID;
      rle_r_grn_d[i] = (float_4)b_grn_a[i] - IMAGA_RLE_MID;
      rle_r_blu_d[i] = (float_4)b_blu_a[i] - IMAGA_RLE_MID;
  }
  
  // exit gracefully
  //
  return ISIP_TRUE;
}
