fix rad save and float2rad
This commit is contained in:
parent
bafa70caec
commit
e6efeb27ea
@ -1,5 +1,8 @@
|
||||
// this file automatically generated from
|
||||
// VIPS library 7.17.2-Tue Mar 3 14:42:34 GMT 2009
|
||||
// VIPS library 7.17.3-Thu Mar 19 13:54:43 GMT 2009
|
||||
VDMask estpar( VImage, int, int, int, double& ) throw( VError );
|
||||
VImage transform( VDMask, int, int ) throw( VError );
|
||||
VImage transform_search( VImage, double, int, int, int, int, VDMask&, double& ) throw( VError );
|
||||
VImage abs() throw( VError );
|
||||
VImage acos() throw( VError );
|
||||
VImage add( VImage ) throw( VError );
|
||||
@ -92,6 +95,7 @@ VImage dE_fromXYZ( VImage ) throw( VError );
|
||||
VImage dE_fromdisp( VImage, VDisplay ) throw( VError );
|
||||
VImage disp2Lab( VDisplay ) throw( VError );
|
||||
VImage disp2XYZ( VDisplay ) throw( VError );
|
||||
VImage float2rad() throw( VError );
|
||||
VImage icc_ac2rc( char* ) throw( VError );
|
||||
VImage icc_export( char*, int ) throw( VError );
|
||||
VImage icc_export_depth( int, char*, int ) throw( VError );
|
||||
|
@ -131,9 +131,7 @@ typedef COLORV COLOR[3]; /* red, green, blue (or X,Y,Z) */
|
||||
#define copycolor(c1,c2) ((c1)[0]=(c2)[0],(c1)[1]=(c2)[1],(c1)[2]=(c2)[2])
|
||||
|
||||
static void
|
||||
setcolr(clr, r, g, b) /* assign a short color value */
|
||||
register COLR clr;
|
||||
double r, g, b;
|
||||
setcolr( COLR clr, double r, double g, double b ) /* assign a short color value */
|
||||
{
|
||||
double d;
|
||||
int e;
|
||||
@ -176,7 +174,7 @@ static void
|
||||
float2rad( COLOR *inp, COLR *outbuf, int n )
|
||||
{
|
||||
while (n-- > 0) {
|
||||
setcolr( outbuf, inp[RED], inp[GRN], inp[BLU] );
|
||||
setcolr( outbuf[0], inp[0][RED], inp[0][GRN], inp[0][BLU] );
|
||||
inp++;
|
||||
outbuf++;
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* Read Radiance (.hdr) files
|
||||
*
|
||||
* 3/3/09
|
||||
* - write packed data, a separate im_rad2float() operation can unpack
|
||||
* 23/3/09
|
||||
* - add radiance write
|
||||
*/
|
||||
@ -690,24 +692,6 @@ register RESOLU *rp;
|
||||
return(buf);
|
||||
}
|
||||
|
||||
static void
|
||||
fputresolu(ord, sl, ns, fp) /* put out picture dimensions */
|
||||
int ord; /* scanline ordering */
|
||||
int sl, ns; /* scanline length and number */
|
||||
FILE *fp;
|
||||
{
|
||||
RESOLU rs;
|
||||
|
||||
if ((rs.rt = ord) & YMAJOR) {
|
||||
rs.xr = sl;
|
||||
rs.yr = ns;
|
||||
} else {
|
||||
rs.xr = ns;
|
||||
rs.yr = sl;
|
||||
}
|
||||
fputsresolu(&rs, fp);
|
||||
}
|
||||
|
||||
static int
|
||||
fwritecolrs(scanline, len, fp) /* write out a colr scanline */
|
||||
register COLR *scanline;
|
||||
@ -1082,7 +1066,7 @@ vips2rad_put_header( Write *write )
|
||||
(void) im_meta_get_double( write->in, "rad-expos", &write->expos );
|
||||
(void) im_meta_get_double( write->in, "rad-aspect", &write->aspect );
|
||||
|
||||
if( im_meta_get_string( write->in, "rad-format", &str ) )
|
||||
if( !im_meta_get_string( write->in, "rad-format", &str ) )
|
||||
im_strncpy( write->format, str, 256 );
|
||||
if( write->in->Type == IM_TYPE_RGB )
|
||||
strcpy( write->format, COLRFMT );
|
||||
@ -1090,11 +1074,11 @@ vips2rad_put_header( Write *write )
|
||||
strcpy( write->format, CIEFMT );
|
||||
|
||||
for( i = 0; i < 3; i++ )
|
||||
if( im_meta_get_double( write->in, colcor_name[i], &d ) )
|
||||
if( !im_meta_get_double( write->in, colcor_name[i], &d ) )
|
||||
write->colcor[i] = d;
|
||||
for( i = 0; i < 4; i++ )
|
||||
for( j = 0; j < 2; j++ )
|
||||
if( im_meta_get_double( write->in,
|
||||
if( !im_meta_get_double( write->in,
|
||||
prims_name[i][j], &d ) )
|
||||
write->prims[i][j] = d;
|
||||
|
||||
@ -1105,14 +1089,15 @@ vips2rad_put_header( Write *write )
|
||||
write->rs.yr = write->in->Ysize;
|
||||
|
||||
fprintf( write->fout, "#?RADIANCE\n" );
|
||||
fprintf( write->fout, "#generated by libvips\n" );
|
||||
|
||||
fputformat( write->format, write->fout );
|
||||
fputexpos( write->expos, write->fout );
|
||||
fputcolcor( write->colcor, write->fout );
|
||||
fprintf( write->fout, "SOFTWARE=vips %s\n", im_version_string() );
|
||||
fputaspect( write->aspect, write->fout );
|
||||
fputprims( write->prims, write->fout );
|
||||
fputresolu( &write->rs, write->fout );
|
||||
fputs( "\n", write->fout );
|
||||
fputsresolu( &write->rs, write->fout );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
@ -1168,8 +1153,7 @@ vips2rad( IMAGE *in, const char *filename )
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
if( in->BandFmt != IM_BANDFMT_UCHAR ||
|
||||
in->Bands == 4 ) {
|
||||
if( in->BandFmt != IM_BANDFMT_UCHAR || in->Bands != 4 ) {
|
||||
im_error( "vip2rad", "%s", _( "4 band uchar only" ) );
|
||||
return( -1 );
|
||||
}
|
||||
|
@ -1,5 +1,68 @@
|
||||
// this file automatically generated from
|
||||
// VIPS library 7.17.2-Tue Mar 3 14:42:34 GMT 2009
|
||||
// VIPS library 7.17.3-Thu Mar 19 13:54:43 GMT 2009
|
||||
// im_estpar: estimate transform parms
|
||||
VDMask VImage::estpar( VImage dst, int order, int ipol, int wrap, double& avg_displ ) throw( VError )
|
||||
{
|
||||
VImage src = *this;
|
||||
VDMask params;
|
||||
|
||||
Vargv _vec( "im_estpar" );
|
||||
|
||||
_vec.data(0) = src.image();
|
||||
_vec.data(1) = dst.image();
|
||||
((im_mask_object*) _vec.data(2))->name = (char*)"noname";
|
||||
*((int*) _vec.data(3)) = order;
|
||||
*((int*) _vec.data(4)) = ipol;
|
||||
*((int*) _vec.data(5)) = wrap;
|
||||
_vec.call();
|
||||
params.embed( (DOUBLEMASK *)((im_mask_object*)_vec.data(2))->mask );
|
||||
avg_displ = *((double*)_vec.data(6));
|
||||
|
||||
return( params );
|
||||
}
|
||||
|
||||
// im_transform: transform an image
|
||||
VImage VImage::transform( VDMask params, int ipol, int wrap ) throw( VError )
|
||||
{
|
||||
VImage in = *this;
|
||||
VImage out;
|
||||
|
||||
Vargv _vec( "im_transform" );
|
||||
|
||||
_vec.data(0) = in.image();
|
||||
_vec.data(1) = out.image();
|
||||
((im_mask_object*) _vec.data(2))->mask = params.mask().dptr;
|
||||
*((int*) _vec.data(3)) = ipol;
|
||||
*((int*) _vec.data(4)) = wrap;
|
||||
_vec.call();
|
||||
|
||||
return( out );
|
||||
}
|
||||
|
||||
// im_transform_search: search for a transform
|
||||
VImage VImage::transform_search( VImage dst, double error, int iterations, int order, int ipol, int wrap, VDMask& out_par, double& act_error ) throw( VError )
|
||||
{
|
||||
VImage src = *this;
|
||||
VImage out;
|
||||
|
||||
Vargv _vec( "im_transform_search" );
|
||||
|
||||
_vec.data(0) = src.image();
|
||||
_vec.data(1) = dst.image();
|
||||
_vec.data(2) = out.image();
|
||||
*((double*) _vec.data(3)) = error;
|
||||
*((int*) _vec.data(4)) = iterations;
|
||||
*((int*) _vec.data(5)) = order;
|
||||
*((int*) _vec.data(6)) = ipol;
|
||||
*((int*) _vec.data(7)) = wrap;
|
||||
((im_mask_object*) _vec.data(8))->name = (char*)"noname";
|
||||
_vec.call();
|
||||
out_par.embed( (DOUBLEMASK *)((im_mask_object*)_vec.data(8))->mask );
|
||||
act_error = *((double*)_vec.data(9));
|
||||
|
||||
return( out );
|
||||
}
|
||||
|
||||
// im_abs: absolute value
|
||||
VImage VImage::abs() throw( VError )
|
||||
{
|
||||
@ -1600,6 +1663,22 @@ VImage VImage::disp2XYZ( VDisplay disp ) throw( VError )
|
||||
return( out );
|
||||
}
|
||||
|
||||
// im_float2rad: convert float to Radiance packed
|
||||
VImage VImage::float2rad() throw( VError )
|
||||
{
|
||||
VImage in = *this;
|
||||
VImage out;
|
||||
|
||||
Vargv _vec( "im_float2rad" );
|
||||
|
||||
_vec.data(0) = in.image();
|
||||
_vec.data(1) = out.image();
|
||||
_vec.call();
|
||||
out._ref->addref( in._ref );
|
||||
|
||||
return( out );
|
||||
}
|
||||
|
||||
// im_icc_ac2rc: convert LAB from AC to RC using an ICC profile
|
||||
VImage VImage::icc_ac2rc( char* profile ) throw( VError )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user