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 |