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

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

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

// method: fract_compare_cc
//
// arguments:
//  float_8& sbe_a: (output) sbe value
//
// return: a logical_1 value indicating status
//
// this method computes an sbe from two histograms.
//
logical_1 Image_analysis::fract_compare_cc(float_8& sbe_a) {

  // declare local variables
  //
  float_4 diff_r = 0.0, diff_g = 0.0, diff_b = 0.0;
  
  // compare the data from the model file with the computed data
  //
  diff_r = fract_r_dimred_d - fract_t_dimred_d;
  diff_g = fract_r_dimgrn_d - fract_t_dimgrn_d;
  diff_r = fract_r_dimblu_d - fract_t_dimblu_d;
  
  // compute the scaled sbe
  //
  float_4 rms_scaled = diff_r * diff_r + diff_g * diff_g + diff_b * diff_b;

  // compute the sbe
  //
  sbe_a = fract_ascale_d * rms_scaled + fract_bscale_d;
  
  if (debug_level_d > ISIP_DEBUG_BRIEF) {
    fprintf(stdout,"<%s> sbe = %f\n",
	    "Image_analysis::rle_compare_cc", sbe_a);
  }
  
  // exit gracefully
  //
  return ISIP_TRUE;
}
