oop we need im_setupout() after all
also fix the type hint setting for the fft functions
This commit is contained in:
parent
95fc8190fa
commit
b081f6a2fe
14
TODO
14
TODO
@ -1,5 +1,3 @@
|
||||
- im_fwfft() does not set interpreation to fourier
|
||||
|
||||
- seems to do a lot of looping?
|
||||
|
||||
$ vips --vips-progress im_fwfft Gugg_coloured.jpg x.v
|
||||
@ -34,17 +32,7 @@
|
||||
- viewing an image tagged as fourier in nip2 is broken, which operation is
|
||||
failing?
|
||||
|
||||
- im_invfftr() is broken
|
||||
|
||||
$ vips im_fwfft Gugg_coloured.jpg x.v
|
||||
$ vips --vips-progress im_invfftr x.v x2.v
|
||||
vips invfft1-1: 2 threads, 972 x 1 tiles, groups of 4 scanlines
|
||||
vips invfft1-1: done in 0s
|
||||
Segmentation fault
|
||||
|
||||
works in 7.26 with the same libfftw, perhaps the iochecks we removed?
|
||||
|
||||
add a test to the suite
|
||||
- add a fft test to the suite
|
||||
|
||||
remove the old fft fallback
|
||||
|
||||
|
@ -32,6 +32,8 @@
|
||||
* - gtkdoc
|
||||
* 25/3/10
|
||||
* - have a "t" image linked to out to keep the image alive for longer
|
||||
* 27/1/12
|
||||
* - better setting of interpretation
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -326,6 +328,7 @@ rfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
|
||||
if( im_cp_desc( out, in ) )
|
||||
return( -1 );
|
||||
out->BandFmt = IM_BANDFMT_DPCOMPLEX;
|
||||
out->Type = IM_TYPE_FOURIER;
|
||||
if( im_setupout( out ) )
|
||||
return( -1 );
|
||||
if( !(buf = (double *) IM_ARRAY( dummy,
|
||||
@ -439,6 +442,7 @@ cfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
|
||||
if( im_cp_desc( out, in ) )
|
||||
return( -1 );
|
||||
out->BandFmt = IM_BANDFMT_DPCOMPLEX;
|
||||
out->Type = IM_TYPE_FOURIER;
|
||||
if( im_setupout( out ) )
|
||||
return( -1 );
|
||||
if( !(buf = (double *) IM_ARRAY( dummy,
|
||||
@ -537,6 +541,7 @@ fwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
|
||||
if( im_cp_desc( out, in ) )
|
||||
return( -1 );
|
||||
out->BandFmt = IM_BANDFMT_COMPLEX;
|
||||
out->Type = IM_TYPE_FOURIER;
|
||||
if( im_setupout( out ) )
|
||||
return( -1 );
|
||||
if( !(buf = (float *) IM_ARRAY( dummy,
|
||||
@ -628,9 +633,5 @@ im_fwfft( IMAGE *in, IMAGE *out )
|
||||
}
|
||||
im_close( dummy );
|
||||
|
||||
/* Set type hint.
|
||||
*/
|
||||
out->Type = IM_TYPE_FOURIER;
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -21,6 +21,8 @@
|
||||
* - added fftw3 support
|
||||
* 7/2/10
|
||||
* - gtkdoc
|
||||
* 27/1/12
|
||||
* - better setting of interpretation
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -104,6 +106,8 @@ invfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
|
||||
|
||||
fftwnd_destroy_plan( plan );
|
||||
|
||||
cmplx->Type = IM_TYPE_B_W;
|
||||
|
||||
/* Copy to out.
|
||||
*/
|
||||
if( im_copy( cmplx, out ) )
|
||||
@ -157,6 +161,8 @@ invfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
|
||||
|
||||
fftw_destroy_plan( plan );
|
||||
|
||||
cmplx->Type = IM_TYPE_B_W;
|
||||
|
||||
/* Copy to out.
|
||||
*/
|
||||
if( im_copy( cmplx, out ) )
|
||||
@ -227,6 +233,7 @@ invfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
|
||||
if( im_cp_desc( out, in ) )
|
||||
return( -1 );
|
||||
out->BandFmt = IM_BANDFMT_COMPLEX;
|
||||
out->Type = IM_TYPE_B_W;
|
||||
if( im_setupout( out ) )
|
||||
return( -1 );
|
||||
if( !(buf = (float *) IM_ARRAY( dummy,
|
||||
@ -284,10 +291,5 @@ im_invfft( IMAGE *in, IMAGE *out )
|
||||
}
|
||||
im_close( dummy );
|
||||
|
||||
if( out->Bands == 1 )
|
||||
out->Type = IM_TYPE_B_W;
|
||||
else
|
||||
out->Type = IM_TYPE_MULTIBAND;
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -88,16 +88,10 @@ invfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
|
||||
if( im_clip2fmt( in, cmplx, IM_BANDFMT_DPCOMPLEX ) )
|
||||
return( -1 );
|
||||
|
||||
/* Make mem buffer real image for output.
|
||||
*/
|
||||
if( im_cp_desc( real, in ) )
|
||||
return( -1 );
|
||||
real->BandFmt = IM_BANDFMT_DOUBLE;
|
||||
if( im_setupout( real ) )
|
||||
return( -1 );
|
||||
|
||||
/* Build half-complex image.
|
||||
*/
|
||||
if( im_incheck( cmplx ) )
|
||||
return( -1 );
|
||||
q = half_complex;
|
||||
for( y = 0; y < cmplx->Ysize; y++ ) {
|
||||
p = ((double *) cmplx->data) + (guint64) y * in->Xsize * 2;
|
||||
@ -110,6 +104,15 @@ invfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
|
||||
}
|
||||
}
|
||||
|
||||
/* Make mem buffer real image for output.
|
||||
*/
|
||||
if( im_cp_desc( real, in ) )
|
||||
return( -1 );
|
||||
real->BandFmt = IM_BANDFMT_DOUBLE;
|
||||
real->Type = IM_TYPE_B_W;
|
||||
if( im_setupout( real ) )
|
||||
return( -1 );
|
||||
|
||||
/* Make the plan for the transform. Yes, they really do use nx for
|
||||
* height and ny for width.
|
||||
*/
|
||||
@ -156,7 +159,8 @@ invfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
|
||||
int x, y;
|
||||
double *q, *p;
|
||||
|
||||
if( !cmplx || !real || !half_complex || im_pincheck( in ) ||
|
||||
if( !cmplx || !real || !half_complex ||
|
||||
im_pincheck( in ) ||
|
||||
im_poutcheck( out ) )
|
||||
return( -1 );
|
||||
if( in->Coding != IM_CODING_NONE || in->Bands != 1 ) {
|
||||
@ -170,18 +174,10 @@ invfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
|
||||
if( im_clip2fmt( in, cmplx, IM_BANDFMT_DPCOMPLEX ) )
|
||||
return( -1 );
|
||||
|
||||
/* Make mem buffer real image for output.
|
||||
*/
|
||||
if( im_cp_desc( real, in ) )
|
||||
return( -1 );
|
||||
real->BandFmt = IM_BANDFMT_DOUBLE;
|
||||
if( im_setupout( real ) ||
|
||||
im_incheck( cmplx ) ||
|
||||
im_incheck( real ) )
|
||||
return( -1 );
|
||||
|
||||
/* Build half-complex image.
|
||||
*/
|
||||
if( im_incheck( cmplx ) )
|
||||
return( -1 );
|
||||
q = half_complex;
|
||||
for( y = 0; y < cmplx->Ysize; y++ ) {
|
||||
p = ((double *) cmplx->data) + (guint64) y * in->Xsize * 2;
|
||||
@ -194,6 +190,16 @@ invfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
|
||||
}
|
||||
}
|
||||
|
||||
/* Make mem buffer real image for output.
|
||||
*/
|
||||
if( im_cp_desc( real, in ) )
|
||||
return( -1 );
|
||||
real->BandFmt = IM_BANDFMT_DOUBLE;
|
||||
real->Type = IM_TYPE_B_W;
|
||||
if( im_setupout( real ) ||
|
||||
im_outcheck( real ) )
|
||||
return( -1 );
|
||||
|
||||
/* Make the plan for the transform. Yes, they really do use nx for
|
||||
* height and ny for width.
|
||||
*/
|
||||
@ -280,6 +286,7 @@ invfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
|
||||
if( im_cp_desc( out, in ) )
|
||||
return( -1 );
|
||||
out->BandFmt = IM_BANDFMT_FLOAT;
|
||||
out->Type = IM_TYPE_B_W;
|
||||
if( im_setupout( out ) )
|
||||
return( -1 );
|
||||
if( !(buf = (float *) IM_ARRAY( dummy,
|
||||
@ -334,10 +341,5 @@ im_invfftr( IMAGE *in, IMAGE *out )
|
||||
}
|
||||
im_close( dummy );
|
||||
|
||||
if( out->Bands == 1 )
|
||||
out->Type = IM_TYPE_B_W;
|
||||
else
|
||||
out->Type = IM_TYPE_MULTIBAND;
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ extern "C" {
|
||||
type, xres, yres )
|
||||
|
||||
#define im__open_image_file vips__open_image_read
|
||||
#define im_setupout( I ) (0)
|
||||
#define im_setupout vips_image_write_prepare
|
||||
#define im_writeline( Y, IM, P ) vips_image_write_line( IM, Y, P )
|
||||
|
||||
#define im_prepare vips_region_prepare
|
||||
|
Loading…
Reference in New Issue
Block a user