stuff
This commit is contained in:
parent
9c10ba9ed9
commit
830c303ada
@ -1,6 +1,7 @@
|
|||||||
12/12/07 started 7.13.3
|
12/12/07 started 7.13.3
|
||||||
- added "include <cstring>" to VImage.cc to help gcc 4.3
|
- added "include <cstring>" to VImage.cc to help gcc 4.3
|
||||||
- started moving the python binding to dynamic wrapping
|
- started moving the python binding to dynamic wrapping
|
||||||
|
- added im_wrap(), im_wraptwo(), im_phasecor_fft(), im_cross_phase() (Tom)
|
||||||
|
|
||||||
31/10/07 started 7.13.2
|
31/10/07 started 7.13.2
|
||||||
- build cimg on windows fixes
|
- build cimg on windows fixes
|
||||||
|
2
TODO
2
TODO
@ -1,3 +1,5 @@
|
|||||||
|
- HAVE_HYPOT could define a hypot() macro?
|
||||||
|
|
||||||
- write our own python extension to call a vips operation by name
|
- write our own python extension to call a vips operation by name
|
||||||
|
|
||||||
result = vips_call ("name", args)
|
result = vips_call ("name", args)
|
||||||
|
@ -1260,9 +1260,9 @@ linreg_vec( im_object *argv )
|
|||||||
static im_function linreg_desc = {
|
static im_function linreg_desc = {
|
||||||
"im_linreg", /* Name */
|
"im_linreg", /* Name */
|
||||||
N_( "pixelwise linear regression" ),
|
N_( "pixelwise linear regression" ),
|
||||||
IM_FN_PIO | IM_FN_PTOP, /* Flags */
|
IM_FN_PIO | IM_FN_PTOP, /* Flags */
|
||||||
linreg_vec, /* Dispatch function */
|
linreg_vec, /* Dispatch function */
|
||||||
IM_NUMBER( linreg_args ), /* Size of arg list */
|
IM_NUMBER( linreg_args ), /* Size of arg list */
|
||||||
linreg_args /* Arg list */
|
linreg_args /* Arg list */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1280,7 +1280,7 @@ static im_function cross_phase_desc = {
|
|||||||
"im_cross_phase", /* Name */
|
"im_cross_phase", /* Name */
|
||||||
N_( "phase of cross power spectrum of two complex images" ), /* Description */
|
N_( "phase of cross power spectrum of two complex images" ), /* Description */
|
||||||
IM_FN_PIO | IM_FN_PTOP, /* Flags */
|
IM_FN_PIO | IM_FN_PTOP, /* Flags */
|
||||||
cross_phase_vec, /* Dispatch function */
|
cross_phase_vec, /* Dispatch function */
|
||||||
IM_NUMBER( two_in_one_out ), /* Size of arg list */
|
IM_NUMBER( two_in_one_out ), /* Size of arg list */
|
||||||
two_in_one_out /* Arg list */
|
two_in_one_out /* Arg list */
|
||||||
};
|
};
|
||||||
|
@ -108,13 +108,15 @@
|
|||||||
|
|
||||||
#ifdef HAVE_HYPOT
|
#ifdef HAVE_HYPOT
|
||||||
|
|
||||||
#define complexabs(TYPE) { \
|
#define complexabs(TYPE) { \
|
||||||
TYPE *p = (TYPE *) in; \
|
TYPE *p = (TYPE *) in; \
|
||||||
TYPE *q = (TYPE *) out; \
|
TYPE *q = (TYPE *) out; \
|
||||||
TYPE *q_stop = q + sz; \
|
int i; \
|
||||||
\
|
\
|
||||||
while( q < q_stop ) \
|
for( i = 0; i < sz; i++ ) { \
|
||||||
*q++= hypot( *p++, *p++ ); \
|
q[i] = hypot( p[0], p[1] ); \
|
||||||
|
p += 2; \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /*HAVE_HYPOT*/
|
#else /*HAVE_HYPOT*/
|
||||||
@ -147,8 +149,7 @@
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
abs_gen( PEL *in, PEL *out, int width, IMAGE *im )
|
abs_gen( PEL *in, PEL *out, int width, IMAGE *im )
|
||||||
{
|
{
|
||||||
int x;
|
|
||||||
int sz = width * im->Bands;
|
int sz = width * im->Bands;
|
||||||
|
|
||||||
/* Abs all input types.
|
/* Abs all input types.
|
||||||
|
@ -44,7 +44,6 @@ libiofuncs_la_SOURCES = \
|
|||||||
im_guess_prefix.c \
|
im_guess_prefix.c \
|
||||||
im_wbuffer.c \
|
im_wbuffer.c \
|
||||||
im_wrapmany.c \
|
im_wrapmany.c \
|
||||||
im_wrapone.c \
|
|
||||||
im_wraptwo.c \
|
im_wraptwo.c \
|
||||||
im_writeline.c \
|
im_writeline.c \
|
||||||
memory.c \
|
memory.c \
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
* array
|
* array
|
||||||
* 28/7/97 JC
|
* 28/7/97 JC
|
||||||
* - amazing error ... only worked if ir and or had same valid
|
* - amazing error ... only worked if ir and or had same valid
|
||||||
|
* 23/1/08
|
||||||
|
* - do im_wrapone() in terms of this
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -67,7 +69,7 @@
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
im_wrapmany_fn fn; /* Function we call */
|
im_wrapmany_fn fn; /* Function we call */
|
||||||
void *a, *b; /* User values for function */
|
void *a, *b; /* User values for function */
|
||||||
} UserBundle;
|
} Bundle;
|
||||||
|
|
||||||
/* Maximum number of input images -- why not?
|
/* Maximum number of input images -- why not?
|
||||||
*/
|
*/
|
||||||
@ -79,7 +81,7 @@ static int
|
|||||||
process_region( REGION *or, void *seq, void *a, void *b )
|
process_region( REGION *or, void *seq, void *a, void *b )
|
||||||
{
|
{
|
||||||
REGION **ir = (REGION **) seq;
|
REGION **ir = (REGION **) seq;
|
||||||
UserBundle *bun = (UserBundle *) b;
|
Bundle *bun = (Bundle *) b;
|
||||||
|
|
||||||
PEL *p[IM_MAX_INPUT_IMAGES], *q;
|
PEL *p[IM_MAX_INPUT_IMAGES], *q;
|
||||||
int i, y;
|
int i, y;
|
||||||
@ -153,7 +155,7 @@ dupims( IMAGE *out, IMAGE **in )
|
|||||||
int
|
int
|
||||||
im_wrapmany( IMAGE **in, IMAGE *out, im_wrapmany_fn fn, void *a, void *b )
|
im_wrapmany( IMAGE **in, IMAGE *out, im_wrapmany_fn fn, void *a, void *b )
|
||||||
{
|
{
|
||||||
UserBundle *bun = IM_NEW( out, UserBundle );
|
Bundle *bun = IM_NEW( out, Bundle );
|
||||||
int i, n;
|
int i, n;
|
||||||
|
|
||||||
/* Count input images.
|
/* Count input images.
|
||||||
@ -203,3 +205,55 @@ im_wrapmany( IMAGE **in, IMAGE *out, im_wrapmany_fn fn, void *a, void *b )
|
|||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
wrapone_gen( void **ins, void *out, int width, Bundle *bun, void *dummy )
|
||||||
|
{
|
||||||
|
((im_wrapone_fn) (bun->fn)) (ins[0], out, width, bun->a, bun->b );
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
im_wrapone( IMAGE *in, IMAGE *out, im_wrapone_fn fn, void *a, void *b )
|
||||||
|
{
|
||||||
|
Bundle *bun = IM_NEW( out, Bundle );
|
||||||
|
IMAGE *invec[2];
|
||||||
|
|
||||||
|
/* Heh, yuk. We cast back above.
|
||||||
|
*/
|
||||||
|
bun->fn = (im_wrapmany_fn) fn;
|
||||||
|
bun->a = a;
|
||||||
|
bun->b = b;
|
||||||
|
invec[0] = in; invec[1] = NULL;
|
||||||
|
|
||||||
|
return( im_wrapmany( invec, out,
|
||||||
|
(im_wrapmany_fn) wrapone_gen, bun, NULL ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
commented out for now ... replace im_wraptwo with this?
|
||||||
|
|
||||||
|
static void
|
||||||
|
wraptwo_gen( void **ins, void *out, int width, Bundle *bun, void *dummy )
|
||||||
|
{
|
||||||
|
((im_wraptwo_fn) (bun->fn)) (ins[0], ins[1], or,
|
||||||
|
width, bun->a, bun->b );
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
im_wraptwo( IMAGE *in1, IMAGE *in2, IMAGE *out,
|
||||||
|
im_wraptwo_fn fn, void *a, void *b )
|
||||||
|
{
|
||||||
|
Bundle *bun = IM_NEW( out, Bundle );
|
||||||
|
IMAGE *invec[3];
|
||||||
|
|
||||||
|
bun->fn = (im_wrapmany_fn) fn;
|
||||||
|
bun->a = a;
|
||||||
|
bun->b = b;
|
||||||
|
invec[0] = in1; invec[1] = in2; invec[2] = NULL;
|
||||||
|
|
||||||
|
return( im_wrapmany( invec, out,
|
||||||
|
(im_wrapmany_fn) wraptwo_gen, bun, NULL ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
@ -1,124 +0,0 @@
|
|||||||
/* As im_wrapmany, but just allow one input and one output.
|
|
||||||
*
|
|
||||||
* The types become:
|
|
||||||
*
|
|
||||||
* int im_wrapone( IMAGE *in, IMAGE *out,
|
|
||||||
* im_wrapone_fn fn, void *a, void *b )
|
|
||||||
*
|
|
||||||
* where im_wrapone_fn has type:
|
|
||||||
*
|
|
||||||
* process_buffer( void *in, void *out, int n,
|
|
||||||
* void *a, void *b )
|
|
||||||
* 28/7/97 JC
|
|
||||||
* - amazing error ... failed if or and ir were different sizes
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
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 <stdlib.h>
|
|
||||||
|
|
||||||
#include <vips/vips.h>
|
|
||||||
|
|
||||||
#ifdef WITH_DMALLOC
|
|
||||||
#include <dmalloc.h>
|
|
||||||
#endif /*WITH_DMALLOC*/
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
im_wrapone_fn fn; /* Function we call */
|
|
||||||
void *a, *b; /* User values for function */
|
|
||||||
} UserBundle;
|
|
||||||
|
|
||||||
/* Build or->valid a line at a time from ir.
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
process_region( REGION *or, void *seq, void *a, void *b )
|
|
||||||
{
|
|
||||||
REGION *ir = (REGION *) seq;
|
|
||||||
UserBundle *bun = (UserBundle *) b;
|
|
||||||
|
|
||||||
PEL *p, *q;
|
|
||||||
int y;
|
|
||||||
|
|
||||||
/* Prepare input region and make buffer pointers.
|
|
||||||
*/
|
|
||||||
if( im_prepare( ir, &or->valid ) )
|
|
||||||
return( -1 );
|
|
||||||
p = (PEL *) IM_REGION_ADDR( ir, or->valid.left, or->valid.top );
|
|
||||||
q = (PEL *) IM_REGION_ADDR( or, or->valid.left, or->valid.top );
|
|
||||||
|
|
||||||
/* Convert linewise.
|
|
||||||
*/
|
|
||||||
for( y = 0; y < or->valid.height; y++ ) {
|
|
||||||
bun->fn( p, q, or->valid.width, bun->a, bun->b );
|
|
||||||
p += IM_REGION_LSKIP( ir );
|
|
||||||
q += IM_REGION_LSKIP( or );
|
|
||||||
}
|
|
||||||
|
|
||||||
return( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Wrap up as a partial.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
im_wrapone( IMAGE *in, IMAGE *out, im_wrapone_fn fn, void *a, void *b )
|
|
||||||
{
|
|
||||||
UserBundle *bun = IM_NEW( out, UserBundle );
|
|
||||||
|
|
||||||
/* Save args.
|
|
||||||
*/
|
|
||||||
if( !bun )
|
|
||||||
return( -1 );
|
|
||||||
bun->fn = fn;
|
|
||||||
bun->a = a;
|
|
||||||
bun->b = b;
|
|
||||||
|
|
||||||
/* Check descriptors.
|
|
||||||
*/
|
|
||||||
if( im_piocheck( in, out ) )
|
|
||||||
return( -1 );
|
|
||||||
|
|
||||||
/* Hint demand style. Being a buffer processor, we are happiest with
|
|
||||||
* thin strips.
|
|
||||||
*/
|
|
||||||
if( im_demand_hint( out, IM_THINSTRIP, in, NULL ) )
|
|
||||||
return( -1 );
|
|
||||||
|
|
||||||
/* Generate!
|
|
||||||
*/
|
|
||||||
if( im_generate( out,
|
|
||||||
im_start_one, process_region, im_stop_one,
|
|
||||||
in, bun ) )
|
|
||||||
return( -1 );
|
|
||||||
|
|
||||||
return( 0 );
|
|
||||||
}
|
|
@ -68,8 +68,8 @@ class VImage (VImage_core):
|
|||||||
print "VImage getattr: ", name
|
print "VImage getattr: ", name
|
||||||
if (is_a_valid_method (name)):
|
if (is_a_valid_method (name)):
|
||||||
return VImage_method (name)
|
return VImage_method (name)
|
||||||
else
|
else:
|
||||||
raise AttributeError
|
raise AttributeError ("unknown method %s" % name)
|
||||||
%}
|
%}
|
||||||
|
|
||||||
/* Helper code for vips_init().
|
/* Helper code for vips_init().
|
||||||
@ -104,7 +104,7 @@ args_print (Args *args)
|
|||||||
printf ("args_print: argc = %d\n", args->argc);
|
printf ("args_print: argc = %d\n", args->argc);
|
||||||
// +1 so we print the trailing NULL too
|
// +1 so we print the trailing NULL too
|
||||||
for (i = 0; i < args->argc + 1; i++)
|
for (i = 0; i < args->argc + 1; i++)
|
||||||
printf( "\t%2d)\t%s\n", i, args->argv[i]);
|
printf ("\t%2d)\t%s\n", i, args->argv[i]);
|
||||||
}
|
}
|
||||||
#endif /*DEBUG*/
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ vips_fatal (const char *msg)
|
|||||||
char buf[256];
|
char buf[256];
|
||||||
|
|
||||||
im_snprintf (buf, 256, "%s\n%s", msg, im_error_buffer());
|
im_snprintf (buf, 256, "%s\n%s", msg, im_error_buffer());
|
||||||
im_error_clear();
|
im_error_clear ();
|
||||||
Py_FatalError (buf);
|
Py_FatalError (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,9 +205,9 @@ vips_fatal (const char *msg)
|
|||||||
&args->argc, &args->argv, &error)) {
|
&args->argc, &args->argv, &error)) {
|
||||||
g_option_context_free (context);
|
g_option_context_free (context);
|
||||||
args_free (args);
|
args_free (args);
|
||||||
im_error( "vipsmodule", "%s", error->message);
|
im_error ("vipsmodule", "%s", error->message);
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
vips_fatal ("can't initialise module vips_core");
|
vips_fatal ("can't initialise module vips");
|
||||||
}
|
}
|
||||||
g_option_context_free (context);
|
g_option_context_free (context);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user