2362N/A * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A * mlib_ImageConvMxN - image convolution with edge condition 0N/A * mlib_status mlib_ImageConvMxN(mlib_image *dst, 0N/A * const mlib_image *src, 0N/A * const mlib_s32 *kernel, 0N/A * dst Pointer to destination image. 0N/A * src Pointer to source image. 0N/A * m Kernel width (m must be not less than 1). 0N/A * n Kernel height (n must be not less than 1). 0N/A * dm, dn Position of key element in convolution kernel. 0N/A * kernel Pointer to convolution kernel. 0N/A * scale The scaling factor to convert the input integer 0N/A * coefficients into floating-point coefficients: 0N/A * floating-point coefficient = integer coefficient * 2^(-scale) 0N/A * cmask Channel mask to indicate the channels to be convolved. 0N/A * Each bit of which represents a channel in the image. The 0N/A * channels corresponded to 1 bits are those to be processed. 0N/A * edge Type of edge condition. 0N/A * 2-D convolution, MxN kernel. 0N/A * The center of the source image is mapped to the center of the 0N/A * destination image. 0N/A * The unselected channels are not overwritten. If both src and dst have 0N/A * just one channel, cmask is ignored. 0N/A * The edge condition can be one of the following: 0N/A * MLIB_EDGE_DST_NO_WRITE (default) 0N/A * MLIB_EDGE_DST_FILL_ZERO 0N/A * MLIB_EDGE_DST_COPY_SRC 0N/A * MLIB_EDGE_SRC_EXTEND 0N/A * The src and the dst must be the same type and have same number 0N/A * of channels (1, 2, 3, or 4). They can be in MLIB_BIT, MLIB_BYTE, 0N/A * MLIB_SHORT, MLIB_USHORT or MLIB_INT data type. 0N/A * 0 <= dm < m, 0 <= dn < n. 0N/A * For data type MLIB_BYTE: 16 <= scale <= 31 (to be compatible with VIS version) 0N/A * For data type MLIB_SHORT: 17 <= scale <= 32 (to be compatible with VIS version) 0N/A * For data type MLIB_USHORT: 17 <= scale <= 32 (to be compatible with VIS version) 0N/A * For data type MLIB_INT: scale >= 0 0N/A/***************************************************************/ 0N/A/***************************************************************/ 0N/A if (m <
1 || n <
1 ||
dm < 0 ||
dm > m -
1 ||
dn < 0 ||
dn > n -
1)
0N/A mlib_ImageClippingMxN(
dst_i,
src_i,
dst_e,
src_e,
edg_sizes,
dst,
src, m, n,
dm,
dn);
3813N/A /* For some reasons, there is no convolution routine for type MLIB_BIT. 3813N/A * For now, we silently ignore it (because this image type is not used by java), 3813N/A * but probably we have to report an error. 3813N/A /* Other edge conditions do not need additional handling. 3813N/A * Note also that they are not exposed in public Java API 0N/A else {
/* MLIB_EDGE_SRC_EXTEND */ 0N/A /* adjust src_e image */ 0N/A mlib_convMxNext_u8(
dst_e,
src_e,
kernel, m, n,
dx_l,
dx_r,
dy_t,
dy_b,
scale,
0N/A mlib_convMxNext_s16(
dst_e,
src_e,
kernel, m, n,
dx_l,
dx_r,
dy_t,
dy_b,
scale,
0N/A mlib_convMxNext_s16(
dst_e,
src_e,
kernel, m, n,
dx_l,
dx_r,
dy_t,
dy_b,
scale,
0N/A mlib_convMxNext_u16(
dst_e,
src_e,
kernel, m, n,
dx_l,
dx_r,
dy_t,
dy_b,
scale,
0N/A mlib_convMxNext_u16(
dst_e,
src_e,
kernel, m, n,
dx_l,
dx_r,
dy_t,
dy_b,
scale,
0N/A mlib_convMxNext_s32(
dst_e,
src_e,
kernel, m, n,
dx_l,
dx_r,
dy_t,
dy_b,
scale,
3813N/A /* For some reasons, there is no convolution routine for type MLIB_BIT. 3813N/A * For now, we silently ignore it (because this image type is not used by java), 3813N/A * but probably we have to report an error. 0N/A/***************************************************************/