1 /*
2 * Copyright (c) 1997, 2003, 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
61 * If the source image is single-channeled and the destination image is
62 * multi-channeled, then the lookup table has the same number of channels
63 * as the destination image:
64 *
65 * dst[x][y][c] = table[c][src[x][y][0]]
66 *
67 * If the source image is multi-channeled and the destination image is
68 * multi-channeled, with the same number of channels as the source image,
69 * then the lookup table will have the same number of channels as
70 * the source image:
71 *
72 * dst[x][y][c] = table[c][src[x][y][c]]
73 */
74
75 #include "mlib_image.h"
76 #include "mlib_ImageCheck.h"
77 #include "mlib_ImageLookUp.h"
78 #include "mlib_c_ImageLookUp.h"
79
80 /***************************************************************/
81 JNIEXPORT mlib_status JNICALL mlib_ImageLookUp(mlib_image *dst,
82 const mlib_image *src,
83 const void **table)
84 {
85 mlib_s32 slb, dlb, xsize, ysize, nchan, ichan, bitoff_src;
86 mlib_type stype, dtype;
87 void *sa, *da;
88
89 MLIB_IMAGE_CHECK(src);
90 MLIB_IMAGE_CHECK(dst);
91 MLIB_IMAGE_SIZE_EQUAL(src, dst);
92 MLIB_IMAGE_CHAN_SRC1_OR_EQ(src, dst);
93
94 stype = mlib_ImageGetType(src);
95 dtype = mlib_ImageGetType(dst);
96 ichan = mlib_ImageGetChannels(src);
97 nchan = mlib_ImageGetChannels(dst);
98 xsize = mlib_ImageGetWidth(src);
99 ysize = mlib_ImageGetHeight(src);
100 slb = mlib_ImageGetStride(src);
101 dlb = mlib_ImageGetStride(dst);
|
1 /*
2 * Copyright (c) 1997, 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
61 * If the source image is single-channeled and the destination image is
62 * multi-channeled, then the lookup table has the same number of channels
63 * as the destination image:
64 *
65 * dst[x][y][c] = table[c][src[x][y][0]]
66 *
67 * If the source image is multi-channeled and the destination image is
68 * multi-channeled, with the same number of channels as the source image,
69 * then the lookup table will have the same number of channels as
70 * the source image:
71 *
72 * dst[x][y][c] = table[c][src[x][y][c]]
73 */
74
75 #include "mlib_image.h"
76 #include "mlib_ImageCheck.h"
77 #include "mlib_ImageLookUp.h"
78 #include "mlib_c_ImageLookUp.h"
79
80 /***************************************************************/
81 JNIEXPORT
82 mlib_status mlib_ImageLookUp(mlib_image *dst,
83 const mlib_image *src,
84 const void **table)
85 {
86 mlib_s32 slb, dlb, xsize, ysize, nchan, ichan, bitoff_src;
87 mlib_type stype, dtype;
88 void *sa, *da;
89
90 MLIB_IMAGE_CHECK(src);
91 MLIB_IMAGE_CHECK(dst);
92 MLIB_IMAGE_SIZE_EQUAL(src, dst);
93 MLIB_IMAGE_CHAN_SRC1_OR_EQ(src, dst);
94
95 stype = mlib_ImageGetType(src);
96 dtype = mlib_ImageGetType(dst);
97 ichan = mlib_ImageGetChannels(src);
98 nchan = mlib_ImageGetChannels(dst);
99 xsize = mlib_ImageGetWidth(src);
100 ysize = mlib_ImageGetHeight(src);
101 slb = mlib_ImageGetStride(src);
102 dlb = mlib_ImageGetStride(dst);
|