1 /*
2 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
73 * The src and the dst must be the same type and have same number
74 * of channels (1, 2, 3, or 4). They can be in MLIB_BIT, MLIB_BYTE,
75 * MLIB_SHORT, MLIB_USHORT or MLIB_INT data type.
76 * m >= 1, n >= 1,
77 * 0 <= dm < m, 0 <= dn < n.
78 * For data type MLIB_BYTE: 16 <= scale <= 31 (to be compatible with VIS version)
79 * For data type MLIB_SHORT: 17 <= scale <= 32 (to be compatible with VIS version)
80 * For data type MLIB_USHORT: 17 <= scale <= 32 (to be compatible with VIS version)
81 * For data type MLIB_INT: scale >= 0
82 */
83
84 #include "mlib_image.h"
85 #include "mlib_ImageCheck.h"
86 #include "mlib_ImageConv.h"
87 #include "mlib_ImageCreate.h"
88 #include "mlib_c_ImageConv.h"
89 #include "mlib_ImageClipping.h"
90 #include "mlib_ImageConvEdge.h"
91
92 /***************************************************************/
93 JNIEXPORT mlib_status JNICALL mlib_ImageConvMxN(mlib_image *dst,
94 const mlib_image *src,
95 const mlib_s32 *kernel,
96 mlib_s32 m,
97 mlib_s32 n,
98 mlib_s32 dm,
99 mlib_s32 dn,
100 mlib_s32 scale,
101 mlib_s32 cmask,
102 mlib_edge edge)
103 {
104 MLIB_IMAGE_CHECK(dst);
105
106 switch (mlib_ImageGetType(dst)) {
107 case MLIB_BYTE:
108
109 if (scale < 16 || scale > 31)
110 return MLIB_FAILURE;
111 break;
112 case MLIB_SHORT:
113 case MLIB_USHORT:
|
1 /*
2 * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
73 * The src and the dst must be the same type and have same number
74 * of channels (1, 2, 3, or 4). They can be in MLIB_BIT, MLIB_BYTE,
75 * MLIB_SHORT, MLIB_USHORT or MLIB_INT data type.
76 * m >= 1, n >= 1,
77 * 0 <= dm < m, 0 <= dn < n.
78 * For data type MLIB_BYTE: 16 <= scale <= 31 (to be compatible with VIS version)
79 * For data type MLIB_SHORT: 17 <= scale <= 32 (to be compatible with VIS version)
80 * For data type MLIB_USHORT: 17 <= scale <= 32 (to be compatible with VIS version)
81 * For data type MLIB_INT: scale >= 0
82 */
83
84 #include "mlib_image.h"
85 #include "mlib_ImageCheck.h"
86 #include "mlib_ImageConv.h"
87 #include "mlib_ImageCreate.h"
88 #include "mlib_c_ImageConv.h"
89 #include "mlib_ImageClipping.h"
90 #include "mlib_ImageConvEdge.h"
91
92 /***************************************************************/
93 JNIEXPORT
94 mlib_status mlib_ImageConvMxN(mlib_image *dst,
95 const mlib_image *src,
96 const mlib_s32 *kernel,
97 mlib_s32 m,
98 mlib_s32 n,
99 mlib_s32 dm,
100 mlib_s32 dn,
101 mlib_s32 scale,
102 mlib_s32 cmask,
103 mlib_edge edge)
104 {
105 MLIB_IMAGE_CHECK(dst);
106
107 switch (mlib_ImageGetType(dst)) {
108 case MLIB_BYTE:
109
110 if (scale < 16 || scale > 31)
111 return MLIB_FAILURE;
112 break;
113 case MLIB_SHORT:
114 case MLIB_USHORT:
|