more auto-decode
This commit is contained in:
parent
4dae352d28
commit
e7efa8e6f2
@ -1,5 +1,5 @@
|
||||
21/1/14 started 7.39.0
|
||||
- fancy auto-decode for all operations
|
||||
- auto-decode for (almost) all operations
|
||||
|
||||
22/1/14 started 7.38.2
|
||||
- auto RAD decode for affine
|
||||
|
29
TODO
29
TODO
@ -8,35 +8,10 @@
|
||||
|
||||
problem in 7.38 too
|
||||
|
||||
- vips_colourspace() needs an option from_space param,?
|
||||
|
||||
- check_uncoded() left to do:
|
||||
|
||||
conversion/falsecolour.c
|
||||
conversion/flatten.c
|
||||
conversion/recomb.c
|
||||
convolution/sharpen.c
|
||||
deprecated/im_gradcor.c
|
||||
deprecated/im_lab_morph.c
|
||||
deprecated/im_maxpos_avg.c
|
||||
deprecated/im_measure.c
|
||||
deprecated/im_vips2mask.c
|
||||
deprecated/im_zerox.c
|
||||
deprecated/rename.c
|
||||
deprecated/tone.c
|
||||
deprecated/vips7compat.c
|
||||
foreign/csv.c
|
||||
foreign/ppm.c
|
||||
freqfilt/fwfft.c
|
||||
freqfilt/invfft.c
|
||||
histogram/hist_local.c
|
||||
histogram/histogram.c
|
||||
histogram/hist_plot.c
|
||||
histogram/maplut.c
|
||||
histogram/stdif.c
|
||||
inplace/flood.c
|
||||
inplace/im_draw_mask.c
|
||||
inplace/inplace_dispatch.c
|
||||
iofuncs/error.c
|
||||
morphology/hitmiss.c
|
||||
resample/quadratic.c
|
||||
|
||||
- we vips_image_write() a lot, could we do this by
|
||||
|
@ -300,24 +300,31 @@ vips_flatten_build( VipsObject *object )
|
||||
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
|
||||
VipsConversion *conversion = VIPS_CONVERSION( object );
|
||||
VipsFlatten *flatten = (VipsFlatten *) object;
|
||||
VipsImage **t = (VipsImage **) vips_object_local_array( object, 1 );
|
||||
|
||||
VipsImage *in;
|
||||
int i;
|
||||
gboolean black;
|
||||
|
||||
if( VIPS_OBJECT_CLASS( vips_flatten_parent_class )->build( object ) )
|
||||
return( -1 );
|
||||
|
||||
in = flatten->in;
|
||||
|
||||
if( vips__image_decode( in, &t[0] ) )
|
||||
return( -1 );
|
||||
in = t[0];
|
||||
|
||||
/* Trivial case: fall back to copy().
|
||||
*/
|
||||
if( flatten->in->Bands == 1 )
|
||||
return( vips_image_write( flatten->in, conversion->out ) );
|
||||
return( vips_image_write( in, conversion->out ) );
|
||||
|
||||
if( vips_check_uncoded( class->nickname, flatten->in ) ||
|
||||
vips_check_noncomplex( class->nickname, flatten->in ) ||
|
||||
vips_image_pio_input( flatten->in ) )
|
||||
if( vips_check_noncomplex( class->nickname, in ) )
|
||||
return( -1 );
|
||||
|
||||
if( vips_image_pipelinev( conversion->out,
|
||||
VIPS_DEMAND_STYLE_THINSTRIP, flatten->in, NULL ) )
|
||||
VIPS_DEMAND_STYLE_THINSTRIP, in, NULL ) )
|
||||
return( -1 );
|
||||
|
||||
conversion->out->Bands -= 1;
|
||||
@ -334,7 +341,7 @@ vips_flatten_build( VipsObject *object )
|
||||
if( black ) {
|
||||
if( vips_image_generate( conversion->out,
|
||||
vips_start_one, vips_flatten_black_gen, vips_stop_one,
|
||||
flatten->in, flatten ) )
|
||||
in, flatten ) )
|
||||
return( -1 );
|
||||
}
|
||||
else {
|
||||
@ -347,7 +354,7 @@ vips_flatten_build( VipsObject *object )
|
||||
|
||||
if( vips_image_generate( conversion->out,
|
||||
vips_start_one, vips_flatten_gen, vips_stop_one,
|
||||
flatten->in, flatten ) )
|
||||
in, flatten ) )
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#include <vips/vips.h>
|
||||
#include <vips/internal.h>
|
||||
|
||||
#include "pconversion.h"
|
||||
|
||||
@ -142,19 +143,25 @@ vips_recomb_build( VipsObject *object )
|
||||
VipsRecomb *recomb = (VipsRecomb *) object;
|
||||
VipsImage **t = (VipsImage **) vips_object_local_array( object, 2 );
|
||||
|
||||
VipsImage *in;
|
||||
|
||||
if( VIPS_OBJECT_CLASS( vips_recomb_parent_class )->build( object ) )
|
||||
return( -1 );
|
||||
|
||||
if( vips_image_pio_input( recomb->in ) ||
|
||||
vips_check_uncoded( class->nickname, recomb->in ) ||
|
||||
vips_check_noncomplex( class->nickname, recomb->in ) )
|
||||
in = recomb->in;
|
||||
|
||||
if( vips__image_decode( in, &t[0] ) )
|
||||
return( -1 );
|
||||
in = t[0];
|
||||
|
||||
if( vips_check_noncomplex( class->nickname, in ) )
|
||||
return( -1 );
|
||||
if( vips_image_pio_input( recomb->m ) ||
|
||||
vips_check_uncoded( class->nickname, recomb->m ) ||
|
||||
vips_check_noncomplex( class->nickname, recomb->m ) ||
|
||||
vips_check_mono( class->nickname, recomb->m ) )
|
||||
return( -1 );
|
||||
if( recomb->in->Bands != recomb->m->Xsize ) {
|
||||
if( in->Bands != recomb->m->Xsize ) {
|
||||
vips_error( class->nickname,
|
||||
"%s", _( "bands in must equal matrix width" ) );
|
||||
return( -1 );
|
||||
@ -165,16 +172,16 @@ vips_recomb_build( VipsObject *object )
|
||||
recomb->coeff = t[0];
|
||||
|
||||
if( vips_image_pipelinev( conversion->out,
|
||||
VIPS_DEMAND_STYLE_THINSTRIP, recomb->in, NULL ) )
|
||||
VIPS_DEMAND_STYLE_THINSTRIP, in, NULL ) )
|
||||
return( -1 );
|
||||
|
||||
conversion->out->Bands = recomb->m->Ysize;
|
||||
if( vips_bandfmt_isint( recomb->in->BandFmt ) )
|
||||
if( vips_bandfmt_isint( in->BandFmt ) )
|
||||
conversion->out->BandFmt = VIPS_FORMAT_FLOAT;
|
||||
|
||||
if( vips_image_generate( conversion->out,
|
||||
vips_start_one, vips_recomb_gen, vips_stop_one,
|
||||
recomb->in, recomb ) )
|
||||
in, recomb ) )
|
||||
return( -1 );
|
||||
|
||||
return( 0 );
|
||||
|
@ -75,6 +75,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <vips/vips.h>
|
||||
#include <vips/internal.h>
|
||||
#include "pfreqfilt.h"
|
||||
|
||||
#ifdef HAVE_FFTW
|
||||
@ -294,22 +295,30 @@ vips_fwfft_build( VipsObject *object )
|
||||
VipsFwfft *fwfft = (VipsFwfft *) object;
|
||||
VipsImage **t = (VipsImage **) vips_object_local_array( object, 4 );
|
||||
|
||||
VipsImage *in;
|
||||
|
||||
if( VIPS_OBJECT_CLASS( vips_fwfft_parent_class )->
|
||||
build( object ) )
|
||||
return( -1 );
|
||||
|
||||
if( vips_bandfmt_iscomplex( freqfilt->in->BandFmt ) ) {
|
||||
if( vips__fftproc( VIPS_OBJECT( fwfft ), freqfilt->in, &t[0],
|
||||
in = freqfilt->in;
|
||||
|
||||
if( vips__image_decode( in, &t[0] ) )
|
||||
return( -1 );
|
||||
in = t[0];
|
||||
|
||||
if( vips_bandfmt_iscomplex( in->BandFmt ) ) {
|
||||
if( vips__fftproc( VIPS_OBJECT( fwfft ), in, &t[1],
|
||||
cfwfft1 ) )
|
||||
return( -1 );
|
||||
}
|
||||
else {
|
||||
if( vips__fftproc( VIPS_OBJECT( fwfft ), freqfilt->in, &t[0],
|
||||
if( vips__fftproc( VIPS_OBJECT( fwfft ), in, &t[1],
|
||||
rfwfft1 ) )
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
if( vips_image_write( t[0], freqfilt->out ) )
|
||||
if( vips_image_write( t[1], freqfilt->out ) )
|
||||
return( -1 );
|
||||
|
||||
return( 0 );
|
||||
|
@ -64,6 +64,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <vips/vips.h>
|
||||
#include <vips/internal.h>
|
||||
#include "pfreqfilt.h"
|
||||
|
||||
#ifdef HAVE_FFTW
|
||||
@ -207,22 +208,30 @@ vips_invfft_build( VipsObject *object )
|
||||
VipsInvfft *invfft = (VipsInvfft *) object;
|
||||
VipsImage **t = (VipsImage **) vips_object_local_array( object, 4 );
|
||||
|
||||
VipsImage *in;
|
||||
|
||||
if( VIPS_OBJECT_CLASS( vips_invfft_parent_class )->
|
||||
build( object ) )
|
||||
return( -1 );
|
||||
|
||||
in = freqfilt->in;
|
||||
|
||||
if( vips__image_decode( in, &t[0] ) )
|
||||
return( -1 );
|
||||
in = t[0];
|
||||
|
||||
if( invfft->real ) {
|
||||
if( vips__fftproc( VIPS_OBJECT( invfft ),
|
||||
freqfilt->in, &t[0], rinvfft1 ) )
|
||||
in, &t[1], rinvfft1 ) )
|
||||
return( -1 );
|
||||
}
|
||||
else {
|
||||
if( vips__fftproc( VIPS_OBJECT( invfft ),
|
||||
freqfilt->in, &t[0], cinvfft1 ) )
|
||||
in, &t[1], cinvfft1 ) )
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
if( vips_image_write( t[0], freqfilt->out ) )
|
||||
if( vips_image_write( t[1], freqfilt->out ) )
|
||||
return( -1 );
|
||||
|
||||
return( 0 );
|
||||
|
@ -60,6 +60,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <vips/vips.h>
|
||||
#include <vips/internal.h>
|
||||
|
||||
typedef struct _VipsHistLocal {
|
||||
VipsOperation parent_instance;
|
||||
@ -235,8 +236,11 @@ vips_hist_local_build( VipsObject *object )
|
||||
|
||||
in = local->in;
|
||||
|
||||
if( vips_check_uncoded( class->nickname, in ) ||
|
||||
vips_check_format( class->nickname, in, VIPS_FORMAT_UCHAR ) )
|
||||
if( vips__image_decode( in, &t[0] ) )
|
||||
return( -1 );
|
||||
in = t[0];
|
||||
|
||||
if( vips_check_format( class->nickname, in, VIPS_FORMAT_UCHAR ) )
|
||||
return( -1 );
|
||||
|
||||
if( local->width > in->Xsize ||
|
||||
@ -247,13 +251,13 @@ vips_hist_local_build( VipsObject *object )
|
||||
|
||||
/* Expand the input.
|
||||
*/
|
||||
if( vips_embed( in, &t[0],
|
||||
if( vips_embed( in, &t[1],
|
||||
local->width / 2, local->height / 2,
|
||||
in->Xsize + local->width - 1, in->Ysize + local->height - 1,
|
||||
"extend", VIPS_EXTEND_COPY,
|
||||
NULL ) )
|
||||
return( -1 );
|
||||
in = t[0];
|
||||
in = t[1];
|
||||
|
||||
g_object_set( object, "out", vips_image_new(), NULL );
|
||||
|
||||
|
@ -111,6 +111,7 @@ vips_histogram_build( VipsObject *object )
|
||||
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
|
||||
VipsHistogramClass *hclass = VIPS_HISTOGRAM_GET_CLASS( histogram );
|
||||
|
||||
VipsImage **decode;
|
||||
VipsImage **format;
|
||||
VipsImage **band;
|
||||
VipsImage **size;
|
||||
@ -134,6 +135,7 @@ vips_histogram_build( VipsObject *object )
|
||||
*/
|
||||
g_assert( !histogram->in[histogram->n] );
|
||||
|
||||
decode = (VipsImage **) vips_object_local_array( object, histogram->n );
|
||||
format = (VipsImage **) vips_object_local_array( object, histogram->n );
|
||||
band = (VipsImage **) vips_object_local_array( object, histogram->n );
|
||||
size = (VipsImage **) vips_object_local_array( object, histogram->n );
|
||||
@ -141,8 +143,8 @@ vips_histogram_build( VipsObject *object )
|
||||
g_object_set( histogram, "out", vips_image_new(), NULL );
|
||||
|
||||
for( i = 0; i < histogram->n; i++ )
|
||||
if( vips_check_uncoded( class->nickname, histogram->in[i] ) ||
|
||||
vips_check_hist( class->nickname, histogram->in[i] ) )
|
||||
if( vips__image_decode( histogram->in[i], &decode[i] ) ||
|
||||
vips_check_hist( class->nickname, decode[i] ) )
|
||||
return( -1 );
|
||||
|
||||
/* Cast our input images up to a common format, bands and size. If
|
||||
@ -150,13 +152,12 @@ vips_histogram_build( VipsObject *object )
|
||||
*/
|
||||
if( hclass->input_format != VIPS_FORMAT_NOTSET ) {
|
||||
for( i = 0; i < histogram->n; i++ )
|
||||
if( vips_cast( histogram->in[i], &format[i],
|
||||
if( vips_cast( decode[i], &format[i],
|
||||
hclass->input_format, NULL ) )
|
||||
return( -1 );
|
||||
}
|
||||
else {
|
||||
if( vips__formatalike_vec( histogram->in,
|
||||
format, histogram->n ) )
|
||||
if( vips__formatalike_vec( decode, format, histogram->n ) )
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#include <vips/vips.h>
|
||||
#include <vips/internal.h>
|
||||
|
||||
typedef struct _VipsStdif {
|
||||
VipsOperation parent_instance;
|
||||
@ -223,8 +224,11 @@ vips_stdif_build( VipsObject *object )
|
||||
|
||||
in = stdif->in;
|
||||
|
||||
if( vips_check_uncoded( class->nickname, in ) ||
|
||||
vips_check_format( class->nickname, in, VIPS_FORMAT_UCHAR ) )
|
||||
if( vips__image_decode( in, &t[0] ) )
|
||||
return( -1 );
|
||||
in = t[0];
|
||||
|
||||
if( vips_check_format( class->nickname, in, VIPS_FORMAT_UCHAR ) )
|
||||
return( -1 );
|
||||
|
||||
if( stdif->width > in->Xsize ||
|
||||
@ -239,13 +243,13 @@ vips_stdif_build( VipsObject *object )
|
||||
|
||||
/* Expand the input.
|
||||
*/
|
||||
if( vips_embed( in, &t[0],
|
||||
if( vips_embed( in, &t[1],
|
||||
stdif->width / 2, stdif->height / 2,
|
||||
in->Xsize + stdif->width - 1, in->Ysize + stdif->height - 1,
|
||||
"extend", VIPS_EXTEND_COPY,
|
||||
NULL ) )
|
||||
return( -1 );
|
||||
in = t[0];
|
||||
in = t[1];
|
||||
|
||||
g_object_set( object, "out", vips_image_new(), NULL );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user