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

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

#include <integral_constants.h>

// method: edge_derivatives_cc
//
// arguments:
//  float_4* edge_xderiv_a: (output) buffer to load the x derivatives mask
//  float_4* edge_yderiv_a: (output) buffer to load the y derivatives mask
//
// return: a logical_1 value indicating status
//
// this method computes the coefficients for the derivative masks
//
logical_1 Image_analysis::edge_derivatives_cc(float_4* edge_xderiv_a,
					      float_4* edge_yderiv_a) {
  
  // declare local variables
  //
  float_4 p = (float_4)-1.0;
  
  for (int_4 i=0; i<edge_r_msize_d; i++) {
    for (int_4 j=0; j<edge_r_msize_d; j++) {
      
      // assigning the constants
      //
      edge_xderiv_a[j * edge_r_msize_d + i] = p;
      edge_yderiv_a[i * edge_r_msize_d + j] = p;
    }
    p++;
  }
  
  // providing the debugging information
  //
  if (debug_level_d > ISIP_DEBUG_NONE) {
    
    fprintf(stdout, "<%s> %s: %ld", "Image_analysis:edge_derivatives_cc",
	    "edge_r_msize_d", edge_r_msize_d);
    fprintf(stdout, "%s\n", "coefficients of the derivative masks");
    
    for (int_4 i=0; i<edge_r_msize_d; i++) {
      for (int_4 j=0; j<edge_r_msize_d; j++) {
	fprintf(stdout, "%ld %ld: %f\t%f\n", i, j,
		edge_xderiv_a[i*edge_r_msize_d + j],
		edge_yderiv_a[i*edge_r_msize_d + j]);
      }
    }
  }
  
  // exit gracefully
  //
  return ISIP_TRUE;
}
