home *** CD-ROM | disk | FTP | other *** search
/ Los Alamos National Laboratory / LANL_CD.ISO / software / compres / src / conv_ds1.c < prev    next >
C/C++ Source or Header  |  1992-02-11  |  2KB  |  85 lines

  1. /****************************************************************
  2.  
  3. COPYRIGHT (C) 1992 UNIVERSITY OF CALIFORNIA
  4.  
  5. ***************************************************************/
  6.  
  7. conv_ds_hp_rbc(x, x1, h, m, npt)
  8. int m, npt;
  9. float *x, *h;
  10. register float *x1;
  11. {
  12.     int nptl, nptr, flag;
  13.     register int m1, m2;
  14.     float *max1, *max3, *hmax2;
  15.     register float *hptr, *ptr1, *ptr2, *hmax1, *max2, *xptr;
  16.  
  17.     m1 = m - 1;
  18.     nptl = (m2 = m/2) - 1;
  19.     nptr = m - nptl;
  20.     flag = ( (m/2) % 2 ) ? 1 : 0;
  21.     hmax2 = h + m2;
  22.  
  23.     max1 = ( flag ) ? x1 + nptl/2 : x1 + nptl/2 + 1;
  24.     max2 = x1 + (npt - nptr) / 2 + 1;
  25.     max3 = x1 + npt/2 - 1;
  26.  
  27. /*________________________________________________________________*/
  28.  
  29.     while(x1 < max1) {
  30.         hmax1 = (hptr = h) + nptl;
  31.         ptr1 = x + nptl;
  32.         ptr2 = x + nptr - 1;
  33.         nptr += 2;
  34.         nptl -= 2;
  35.         *x1 = 0.;
  36.         while( ptr1 >= x )
  37.             *x1 += *hptr++ * (*ptr1-- + *ptr2--);
  38.         ptr1 = x + 1;
  39.         while(hptr < hmax2)
  40.             *x1 += *hptr++ * (*ptr1++ + *ptr2--);
  41.         *x1++ += *hptr * *ptr2;
  42.     }
  43.  
  44. /*________________________________________________________________*/
  45.  
  46.     xptr = ( flag ) ? x : x + 1;
  47.     while(x1 < max2) {
  48.         ptr2 = (ptr1 = xptr) + m1;
  49.         hmax1 = (hptr = h) + m2;
  50.         *x1 = 0.;
  51.         while(hptr < hmax1)
  52.             *x1 += *hptr++ * (*ptr1++ + *ptr2--);
  53.         *x1++ += *hptr * *ptr1;
  54.         xptr += 2;
  55.     }
  56.  
  57. /*________________________________________________________________*/
  58.  
  59.     nptr = ( flag ) ? 1 : 2;
  60.     nptl = m - nptr;
  61.     while(x1 < max3) {
  62.         hptr = h;
  63.         hmax1 = h + nptr + 1;
  64.         ptr1 = x + npt - nptl;
  65.         ptr2 = x + npt - nptr - 1;
  66.         nptr += 2;
  67.         nptl -= 2;
  68.         *x1 = 0;
  69.         while(hptr < hmax1)
  70.             *x1 += *hptr++ * (*ptr1++ + *ptr2++);
  71.         ptr2 = x + npt - 2;
  72.         while(hptr < hmax2)
  73.             *x1 += *hptr++ * (*ptr1++ + *ptr2--);
  74.         *x1++ += *hptr * *ptr2;
  75.     }
  76.  
  77.     ptr1 = x + npt - nptl;
  78.     ptr2 = x + npt - nptr - 1;
  79.     *x1 = 0.;
  80.     hptr = h;
  81.     while(hptr < hmax2)
  82.         *x1 += *hptr++ * (*ptr1++ + *ptr2++);
  83.     *x1 += *hptr * *ptr1;
  84. }
  85.