      /********************************************
      * 
      *   smooth_histogram(...        
      * 
      *   This function smoothes the input histogram
      *   and returns it.  It uses a simple averaging
      *   scheme where each point in the histogram
      *   is replaced by the average of itself and
      *   the two points on either side of it.
      * 
      *********************************************/

smooth_histogram(histogram)
   unsigned long histogram[];
{
   int i;
   unsigned long new_hist[GRAY_LEVELS+1];

   zero_histogram(new_hist);

   new_hist[0] = (histogram[0] + histogram[1])/2;
   new_hist[GRAY_LEVELS] =
      (histogram[GRAY_LEVELS] + 
       histogram[GRAY_LEVELS-1])/2;

   for(i=1; i<GRAY_LEVELS; i++){
      new_hist[i] = (histogram[i-1] +
                     histogram[i]   +
                     histogram[i+1])/3;
   }

   for(i=0; i<=GRAY_LEVELS; i++)
      histogram[i] = new_hist[i];

}  /* ends smooth_histogram */

