// file: $USFS/class/image_analysis/v3.0/imaga_ent_07.cc
//

// system include files
//
#include <memory.h>

// isip include files
//
#include "image_analysis.h"
#include <integral_constants.h>

// method: ent_init_cc
//
// arguments: none
//
// return: a logical_1 value indicating status
//
// this method initializes the histogram computation.
//
logical_1 Image_analysis::ent_init_cc() {
  
  // deallocate memory if necessary
  //
  if (huf_r_rpdf_d != (float_8*)NULL) {
    delete [] huf_r_rpdf_d;
    huf_r_rpdf_d = (float_8*)NULL; 
  }
  if (huf_r_gpdf_d != (float_8*)NULL) {
    delete [] huf_r_gpdf_d;
    huf_r_gpdf_d = (float_8*)NULL; 
  }
  if (huf_r_bpdf_d != (float_8*)NULL) {
    delete [] huf_r_bpdf_d;
    huf_r_bpdf_d = (float_8*)NULL; 
  }
  
  // allocate memory and clear
  //
  huf_r_rpdf_d = new float_8[huf_r_nbins_d];
  huf_r_gpdf_d = new float_8[huf_r_nbins_d];
  huf_r_bpdf_d = new float_8[huf_r_nbins_d];
  
  memset((void*)huf_r_rpdf_d, (int)0, (size_t)(huf_r_nbins_d*sizeof(float_8)));
  memset((void*)huf_r_gpdf_d, (int)0, (size_t)(huf_r_nbins_d*sizeof(float_8)));
  memset((void*)huf_r_bpdf_d, (int)0, (size_t)(huf_r_nbins_d*sizeof(float_8)));

  // clear counters
  //
  huf_r_npxls_d = (int_4)0;
  huf_r_nimages_d = (int_4)0;
  huf_r_nblks_d = (int_4)0;
  huf_t_red_d = 0;
  huf_t_grn_d = 0;
  huf_t_blu_d = 0;
  
  // exit gracefully
  //
  return ISIP_TRUE;
}
