18 FUNCTION_NAME(IMAGETYPE &dest,
const IMAGETYPE &source,
19 float width, FilterFunction *make_filter,
int channel) {
20 if (!dest.is_valid() || !source.is_valid()) {
28 StoreType **matrix = (StoreType **)PANDA_MALLOC_ARRAY(dest.ASIZE() *
sizeof(StoreType *));
32 for (a=0; a<dest.ASIZE(); a++) {
33 matrix[a] = (StoreType *)PANDA_MALLOC_ARRAY(source.BSIZE() *
sizeof(StoreType));
38 StoreType *temp_source, *temp_dest;
40 scale = (float)dest.ASIZE() / (float)source.ASIZE();
41 temp_source = (StoreType *)PANDA_MALLOC_ARRAY(source.ASIZE() *
sizeof(StoreType));
42 temp_dest = (StoreType *)PANDA_MALLOC_ARRAY(dest.ASIZE() *
sizeof(StoreType));
47 make_filter(scale, width, filter, filter_width);
49 for (b = 0; b < source.BSIZE(); b++) {
50 for (a = 0; a < source.ASIZE(); a++) {
51 temp_source[a] = (StoreType)(source_max * source.GETVAL(a, b, channel));
54 filter_row(temp_dest, dest.ASIZE(),
55 temp_source, source.ASIZE(),
57 filter, filter_width);
59 for (a = 0; a < dest.ASIZE(); a++) {
60 matrix[a][b] = temp_dest[a];
64 PANDA_FREE_ARRAY(temp_source);
65 PANDA_FREE_ARRAY(temp_dest);
66 PANDA_FREE_ARRAY(filter);
69 scale = (float)dest.BSIZE() / (float)source.BSIZE();
70 temp_dest = (StoreType *)PANDA_MALLOC_ARRAY(dest.BSIZE() *
sizeof(StoreType));
72 make_filter(scale, width, filter, filter_width);
74 for (a = 0; a < dest.ASIZE(); a++) {
75 filter_row(temp_dest, dest.BSIZE(),
76 matrix[a], source.BSIZE(),
78 filter, filter_width);
80 for (b = 0; b < dest.BSIZE(); b++) {
81 dest.SETVAL(a, b, channel, (
float)temp_dest[b]/(
float)source_max);
85 PANDA_FREE_ARRAY(temp_dest);
86 PANDA_FREE_ARRAY(filter);
90 for (a = 0; a < dest.ASIZE(); a++) {
91 PANDA_FREE_ARRAY(matrix[a]);
93 PANDA_FREE_ARRAY(matrix);