jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16nw.c
changeset 15628 228422512f97
parent 8939 04615dca2a76
child 15632 3d36eadad78f
equal deleted inserted replaced
15627:46054ae31dfc 15628:228422512f97
  1651   DEF_VARS(DTYPE);
  1651   DEF_VARS(DTYPE);
  1652   mlib_s32 chan2;
  1652   mlib_s32 chan2;
  1653   mlib_s32 *buffo, *buffi;
  1653   mlib_s32 *buffo, *buffi;
  1654   GET_SRC_DST_PARAMETERS(DTYPE);
  1654   GET_SRC_DST_PARAMETERS(DTYPE);
  1655 
  1655 
       
  1656   mlib_status status = MLIB_SUCCESS;
       
  1657 
  1656   if (scale > 30) {
  1658   if (scale > 30) {
  1657     fscale *= 1.0/(1 << 30);
  1659     fscale *= 1.0/(1 << 30);
  1658     scale -= 30;
  1660     scale -= 30;
  1659   }
  1661   }
  1660 
  1662 
  1670 
  1672 
  1671   for (i = 0; i < mn; i++) {
  1673   for (i = 0; i < mn; i++) {
  1672     k[i] = kernel[i]*fscale;
  1674     k[i] = kernel[i]*fscale;
  1673   }
  1675   }
  1674 
  1676 
  1675   if (m == 1) return mlib_ImageConv1xN(dst, src, k, n, dn, cmask);
  1677   if (m == 1) {
       
  1678     status = mlib_ImageConv1xN(dst, src, k, n, dn, cmask);
       
  1679     FREE_AND_RETURN_STATUS;
       
  1680   }
  1676 
  1681 
  1677   bsize = (n + 3)*wid;
  1682   bsize = (n + 3)*wid;
  1678 
  1683 
  1679   if ((bsize > BUFF_SIZE) || (n > MAX_N)) {
  1684   if ((bsize > BUFF_SIZE) || (n > MAX_N)) {
  1680     pbuff = mlib_malloc(sizeof(FTYPE)*bsize + sizeof(FTYPE *)*2*(n + 1));
  1685     pbuff = mlib_malloc(sizeof(FTYPE)*bsize + sizeof(FTYPE *)*2*(n + 1));
  1681 
  1686 
  1682     if (pbuff == NULL) return MLIB_FAILURE;
  1687     if (pbuff == NULL) {
       
  1688       status = MLIB_FAILURE;
       
  1689       FREE_AND_RETURN_STATUS;
       
  1690     }
  1683     buffs = (FTYPE   **)(pbuff + bsize);
  1691     buffs = (FTYPE   **)(pbuff + bsize);
  1684   }
  1692   }
  1685 
  1693 
  1686   for (l = 0; l < (n + 1); l++) buffs[l] = pbuff + l*wid;
  1694   for (l = 0; l < (n + 1); l++) buffs[l] = pbuff + l*wid;
  1687   for (l = 0; l < (n + 1); l++) buffs[l + (n + 1)] = buffs[l];
  1695   for (l = 0; l < (n + 1); l++) buffs[l + (n + 1)] = buffs[l];
  2031 
  2039 
  2032       if (buff_ind >= n + 1) buff_ind = 0;
  2040       if (buff_ind >= n + 1) buff_ind = 0;
  2033     }
  2041     }
  2034   }
  2042   }
  2035 
  2043 
  2036   if (pbuff != buff) mlib_free(pbuff);
  2044   FREE_AND_RETURN_STATUS;
  2037 
       
  2038   return MLIB_SUCCESS;
       
  2039 }
  2045 }
  2040 
  2046 
  2041 /***************************************************************/
  2047 /***************************************************************/
  2042 #ifndef __sparc /* for x86, using integer multiplies is faster */
  2048 #ifndef __sparc /* for x86, using integer multiplies is faster */
  2043 
  2049