move resamplers to their own package

This commit is contained in:
John Cupitt 2009-02-24 16:40:10 +00:00
parent 762e2a8819
commit 439014de1a
26 changed files with 321 additions and 1118 deletions

View File

@ -36,6 +36,8 @@
- updated format docs
- IM_INPUT_INTERPOLATE() now used by affinei and affinei_all
- added vips_object_new
- resamplers/interpolators now in a resample package
- removed yafrnohalo.c
11/9/08 started 7.16.3
- oop typo in manpage for im_project()

13
TODO
View File

@ -1,18 +1,19 @@
- vips_object_print, set_name etc. need writing
make 'print' into a virtual method so subclasses can add stuff if they want
- move im_shrink & friends to resample?
match_linear, match_linear_search?
what about im_stretch3.c, im_resize_linear
- check mosaic1, global_balance, similarity etc. use of im__affine
how can we move them to im_affinei ?
- make a new package for "resample"? im_shrink & friends could go in there too
- make a "deprecated" package too
- remove yafrnohalo.c
- update the Portfiles on the mac and on the website from the macports ones
- im_render should use a hash for tile lookup ... or+shift x/y together

View File

@ -490,6 +490,7 @@ AC_OUTPUT([
libsrc/mosaicing/Makefile
libsrc/other/Makefile
libsrc/relational/Makefile
libsrc/resample/Makefile
libsrc/video/Makefile
libsrcCC/Makefile
src/Makefile

View File

@ -18,6 +18,7 @@ pkginclude_HEADERS = \
r_access.h \
struct.h \
semaphore.h \
transform.h \
threadgroup.h \
thread.h \
util.h \

View File

@ -65,3 +65,5 @@ void im__transform_invert_rect( const Transformation *trn,
const Rect *in, Rect *out );
void im__transform_set_area( Transformation * );
int im__affine( IMAGE *in, IMAGE *out, Transformation *trn );

View File

@ -12,6 +12,7 @@ endif
SUBDIRS = \
acquire \
arithmetic \
resample \
boolean \
colour \
conversion \
@ -37,6 +38,7 @@ libvips_la_SOURCES = dummy.c dummy2.cc
# DLLs need dependant libs there too ... put @VIPS_LIBS@ at the end
libvips_la_LIBADD = \
acquire/libacquire.la \
resample/libresample.la \
arithmetic/libarithmetic.la \
boolean/libboolean.la \
colour/libcolour.la \

View File

@ -75,6 +75,7 @@ extern im_package im__morphology;
extern im_package im__mosaicing;
extern im_package im__other;
extern im_package im__relational;
extern im_package im__resample;
extern im_package im__video;
/* im_guess_prefix() args.
@ -458,6 +459,7 @@ static im_package *built_in[] = {
&im__mosaicing,
&im__other,
&im__relational,
&im__resample,
&im__video
};
/* How we represent a loaded plugin.

View File

@ -1,21 +1,14 @@
noinst_LTLIBRARIES = libmosaicing.la
libmosaicing_la_SOURCES = \
im_affine.c \
im_align_bands.c \
bicubic.cpp \
match.c \
mosaic1.c \
mosaicing_dispatch.c \
similarity.c \
global_balance.c \
im_avgdxdy.c \
im_chkpair.c \
im_clinear.c \
interpolate.c \
yafrsmooth.cpp \
yafrnohalo.c \
nohalo.cpp \
im_improve.c \
im_initialize.c \
im_lrcalcon.c \
@ -26,9 +19,6 @@ libmosaicing_la_SOURCES = \
im_tbmerge.c \
im_remosaic.c \
im_tbmosaic.c \
templates.h \
transform.h \
transform.c \
merge.h \
global_balance.h \
mosaic.h

View File

@ -103,8 +103,8 @@
#include <math.h>
#include <vips/vips.h>
#include <vips/transform.h>
#include "transform.h"
#include "merge.h"
#include "global_balance.h"

View File

@ -133,8 +133,8 @@
#include <vips/vips.h>
#include <vips/thread.h>
#include <vips/transform.h>
#include "transform.h"
#include "merge.h"
#ifdef WITH_DMALLOC

View File

@ -50,8 +50,8 @@
#include <math.h>
#include <vips/vips.h>
#include <vips/transform.h>
#include "transform.h"
#include "merge.h"
#include "global_balance.h"

View File

@ -107,8 +107,8 @@
#include <vips/vips.h>
#include <vips/thread.h>
#include <vips/transform.h>
#include "transform.h"
#include "merge.h"
#ifdef WITH_DMALLOC

View File

@ -109,7 +109,3 @@ int im__tbmerge1( IMAGE *ref, IMAGE *sec, IMAGE *out,
double a, double b, double dx, double dy,
int mwidth );
/* similarity() stuff, used by mosaic1.
*/
int im__affine( IMAGE *in, IMAGE *out, Transformation *trn );

View File

@ -50,9 +50,9 @@
#include <vips/vips.h>
#include <vips/buf.h>
#include <vips/transform.h>
#include "mosaic.h"
#include "transform.h"
#include "merge.h"
#ifdef WITH_DMALLOC

View File

@ -38,8 +38,8 @@
#include <vips/vips.h>
#include <vips/internal.h>
#include <vips/transform.h>
#include "transform.h"
#include "merge.h"
#ifdef WITH_DMALLOC

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,14 @@
noinst_LTLIBRARIES = libresample.la
libresample_la_SOURCES = \
im_affine.c \
bicubic.cpp \
similarity.c \
interpolate.c \
yafrsmooth.cpp \
nohalo.cpp \
templates.h \
transform.c \
resample_dispatch.c
INCLUDES = -I${top_srcdir}/include @VIPS_CFLAGS@ @VIPS_INCLUDES@

View File

@ -131,9 +131,7 @@
#include <vips/vips.h>
#include <vips/internal.h>
#include "transform.h"
#include "merge.h"
#include <vips/transform.h>
#ifdef WITH_DMALLOC
#include <dmalloc.h>

View File

@ -447,14 +447,12 @@ vips__interpolate_init( void )
{
extern GType vips_interpolate_bicubic_get_type( void );
extern GType vips_interpolate_yafrsmooth_get_type( void );
extern GType vips_interpolate_yafrnohalo_get_type( void );
extern GType vips_interpolate_nohalo_get_type( void );
vips_interpolate_nearest_get_type();
vips_interpolate_bilinear_get_type();
vips_interpolate_bicubic_get_type();
vips_interpolate_yafrsmooth_get_type();
vips_interpolate_yafrnohalo_get_type();
vips_interpolate_nohalo_get_type();
}

View File

@ -0,0 +1,281 @@
/* Function dispatch tables for mosaicing.
*
* J. Cupitt, 23/2/95
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#include <stdio.h>
#include <vips/vips.h>
#include <vips/internal.h>
#include <vips/transform.h>
#ifdef WITH_DMALLOC
#include <dmalloc.h>
#endif /*WITH_DMALLOC*/
/* affine args
*/
static im_arg_desc affine_args[] = {
IM_INPUT_IMAGE( "in" ),
IM_OUTPUT_IMAGE( "out" ),
IM_INPUT_DOUBLE( "a" ),
IM_INPUT_DOUBLE( "b" ),
IM_INPUT_DOUBLE( "c" ),
IM_INPUT_DOUBLE( "d" ),
IM_INPUT_DOUBLE( "dx" ),
IM_INPUT_DOUBLE( "dy" ),
IM_INPUT_INT( "x" ),
IM_INPUT_INT( "y" ),
IM_INPUT_INT( "w" ),
IM_INPUT_INT( "h" )
};
/* Call im_affine via arg vector.
*/
static int
affine_vec( im_object *argv )
{
double a = *((double *) argv[2]);
double b = *((double *) argv[3]);
double c = *((double *) argv[4]);
double d = *((double *) argv[5]);
double dx = *((double *) argv[6]);
double dy = *((double *) argv[7]);
int x = *((int *) argv[8]);
int y = *((int *) argv[9]);
int w = *((int *) argv[10]);
int h = *((int *) argv[11]);
return( im_affine( argv[0], argv[1], a, b, c, d, dx, dy, x, y, w, h ) );
}
/* Description of im_affine.
*/
static im_function affine_desc = {
"im_affine", /* Name */
"affine transform",
IM_FN_TRANSFORM | IM_FN_PIO, /* Flags */
affine_vec, /* Dispatch function */
IM_NUMBER( affine_args ), /* Size of arg list */
affine_args /* Arg list */
};
/* affinei args
*/
static im_arg_desc affinei_args[] = {
IM_INPUT_IMAGE( "in" ),
IM_OUTPUT_IMAGE( "out" ),
IM_INPUT_INTERPOLATE( "interpolate" ),
IM_INPUT_DOUBLE( "a" ),
IM_INPUT_DOUBLE( "b" ),
IM_INPUT_DOUBLE( "c" ),
IM_INPUT_DOUBLE( "d" ),
IM_INPUT_DOUBLE( "dx" ),
IM_INPUT_DOUBLE( "dy" ),
IM_INPUT_INT( "x" ),
IM_INPUT_INT( "y" ),
IM_INPUT_INT( "w" ),
IM_INPUT_INT( "h" )
};
/* Call im_affinei via arg vector.
*/
static int
affinei_vec( im_object *argv )
{
VipsInterpolate *interpolate = VIPS_INTERPOLATE( argv[2] );
double a = *((double *) argv[3]);
double b = *((double *) argv[4]);
double c = *((double *) argv[5]);
double d = *((double *) argv[6]);
double dx = *((double *) argv[7]);
double dy = *((double *) argv[8]);
int x = *((int *) argv[9]);
int y = *((int *) argv[10]);
int w = *((int *) argv[11]);
int h = *((int *) argv[12]);
return( im_affinei( argv[0], argv[1], interpolate,
a, b, c, d, dx, dy, x, y, w, h ) );
}
/* Description of im_affinei.
*/
static im_function affinei_desc = {
"im_affinei", /* Name */
"affine transform",
IM_FN_TRANSFORM | IM_FN_PIO, /* Flags */
affinei_vec, /* Dispatch function */
IM_NUMBER( affinei_args ), /* Size of arg list */
affinei_args /* Arg list */
};
/* affinei_all args
*/
static im_arg_desc affinei_all_args[] = {
IM_INPUT_IMAGE( "in" ),
IM_OUTPUT_IMAGE( "out" ),
IM_INPUT_INTERPOLATE( "interpolate" ),
IM_INPUT_DOUBLE( "a" ),
IM_INPUT_DOUBLE( "b" ),
IM_INPUT_DOUBLE( "c" ),
IM_INPUT_DOUBLE( "d" ),
IM_INPUT_DOUBLE( "dx" ),
IM_INPUT_DOUBLE( "dy" )
};
/* Call im_affinei_all via arg vector.
*/
static int
affinei_all_vec( im_object *argv )
{
VipsInterpolate *interpolate = VIPS_INTERPOLATE( argv[2] );
double a = *((double *) argv[3]);
double b = *((double *) argv[4]);
double c = *((double *) argv[5]);
double d = *((double *) argv[6]);
double dx = *((double *) argv[7]);
double dy = *((double *) argv[8]);
return( im_affinei_all( argv[0], argv[1], interpolate,
a, b, c, d, dx, dy ) );
}
/* Description of im_affinei_all.
*/
static im_function affinei_all_desc = {
"im_affinei_all", /* Name */
"affine transform of whole image",
IM_FN_TRANSFORM | IM_FN_PIO, /* Flags */
affinei_all_vec, /* Dispatch function */
IM_NUMBER( affinei_all_args ), /* Size of arg list */
affinei_all_args /* Arg list */
};
/* similarity args
*/
static im_arg_desc similarity_args[] = {
IM_INPUT_IMAGE( "in" ),
IM_OUTPUT_IMAGE( "out" ),
IM_INPUT_DOUBLE( "a" ),
IM_INPUT_DOUBLE( "b" ),
IM_INPUT_DOUBLE( "dx" ),
IM_INPUT_DOUBLE( "dy" )
};
/* Call im_similarity via arg vector.
*/
static int
similarity_vec( im_object *argv )
{
double a = *((double *) argv[2]);
double b = *((double *) argv[3]);
double dx = *((double *) argv[4]);
double dy = *((double *) argv[5]);
return( im_similarity( argv[0], argv[1], a, b, dx, dy ) );
}
/* Description of im_similarity.
*/
static im_function similarity_desc = {
"im_similarity", /* Name */
"similarity transformation",
IM_FN_TRANSFORM | IM_FN_PIO, /* Flags */
similarity_vec, /* Dispatch function */
IM_NUMBER( similarity_args ), /* Size of arg list */
similarity_args /* Arg list */
};
/* similarity_area args
*/
static im_arg_desc similarity_area_args[] = {
IM_INPUT_IMAGE( "in" ),
IM_OUTPUT_IMAGE( "out" ),
IM_INPUT_DOUBLE( "a" ),
IM_INPUT_DOUBLE( "b" ),
IM_INPUT_DOUBLE( "dx" ),
IM_INPUT_DOUBLE( "dy" ),
IM_INPUT_INT( "x" ),
IM_INPUT_INT( "y" ),
IM_INPUT_INT( "w" ),
IM_INPUT_INT( "h" )
};
/* Call im_similarity_area via arg vector.
*/
static int
similarity_area_vec( im_object *argv )
{
double a = *((double *) argv[2]);
double b = *((double *) argv[3]);
double dx = *((double *) argv[4]);
double dy = *((double *) argv[5]);
int x = *((int *) argv[6]);
int y = *((int *) argv[7]);
int w = *((int *) argv[8]);
int h = *((int *) argv[9]);
return( im_similarity_area( argv[0], argv[1], a, b, dx, dy,
x, y, w, h ) );
}
/* Description of im_similarity_area.
*/
static im_function similarity_area_desc = {
"im_similarity_area", /* Name */
"output area xywh of similarity transformation",
IM_FN_TRANSFORM | IM_FN_PIO, /* Flags */
similarity_area_vec, /* Dispatch function */
IM_NUMBER( similarity_area_args ), /* Size of arg list */
similarity_area_args /* Arg list */
};
/* Package up all these functions.
*/
static im_function *resample_list[] = {
&affine_desc,
&affinei_desc,
&affinei_all_desc,
&similarity_area_desc,
&similarity_desc
};
/* Package of functions.
*/
im_package im__resample = {
"resample",
IM_NUMBER( resample_list ),
resample_list
};

View File

@ -64,9 +64,7 @@
#include <math.h>
#include <vips/vips.h>
#include "transform.h"
#include "merge.h"
#include <vips/transform.h>
#ifdef WITH_DMALLOC
#include <dmalloc.h>

View File

@ -44,8 +44,7 @@
#include <vips/vips.h>
#include <vips/internal.h>
#include "transform.h"
#include <vips/transform.h>
#ifdef WITH_DMALLOC
#include <dmalloc.h>