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

  1. /****************************************************************
  2.  
  3. COPYRIGHT (C) 1992 UNIVERSITY OF CALIFORNIA
  4.  
  5. ***************************************************************/
  6.  
  7. us_conv(x, h, m, nrow, ncol, flag)
  8. int nrow, ncol, flag;
  9. float **x, *h;
  10. {
  11.     conv_rows(*x, h, m, nrow, ncol, flag);
  12.     tpose(x, nrow, ncol*2);
  13. }
  14.  
  15. /****************************************************************/
  16.  
  17. conv_rows(x, h, m, nrow, ncol, flag)
  18. int nrow, ncol, m, flag;
  19. float *x, *h;
  20. {
  21.     float *ptr1, *ptr2, *temp;
  22.  
  23.     ptr1 = x + nrow*ncol - ncol;
  24.     ptr2 = x + 2*nrow*ncol - 2*ncol;
  25.  
  26.     while(ptr1 > x) {
  27.  
  28.         if(!flag)
  29.             us_conv_lp_rbc(ptr1, ptr2, h, ncol, m);
  30.         else
  31.             us_conv_hp_rbc(ptr1, ptr2, h, ncol, m);
  32.  
  33.         ptr1 -= ncol;
  34.         ptr2 -= 2*ncol;
  35.     }
  36.  
  37.     temp = (float*)malloc(2*ncol*sizeof(float));
  38.  
  39.     if(!flag)
  40.         us_conv_lp_rbc(x, temp, h, ncol, m);
  41.     else
  42.         us_conv_hp_rbc(x, temp, h, ncol, m);
  43.  
  44.     copy(temp, x, 2*ncol);
  45.     free(temp);
  46. }
  47.  
  48. /****************************************************************/
  49.  
  50. copy(x1, x2, n)
  51. int n;
  52. register float *x1, *x2;
  53. {
  54.     register float *max;
  55.  
  56.     max = x1 + n;
  57.     while(x1 < max)
  58.         *x2++ = *x1++;
  59. }
  60.