Merge branch 'master' of github.com:jcupitt/libvips

Conflicts:
	TODO
This commit is contained in:
John Cupitt 2014-07-03 09:41:16 +01:00
commit e6a75049c4
7 changed files with 26 additions and 119 deletions

View File

@ -1,5 +1,7 @@
30/6/14 started 7.40.3
- fix interlaced thumbnails in vipsthumbnail, thanks lovell
- fix use of "header" in benchmark/, thanks David
- fits save now caches the image before write, so it's top-to-bottom
25/6/14 started 7.40.2
- dzsave write to zip stops at 4gb, thanks bgilbert

9
TODO
View File

@ -1,12 +1,3 @@
- try:
$ vips copy k2.jpg k2.tif
$ vips im_copy k2.jpg k2.fits
$ vips copy k2.jpg k2.fits
** VIPS:ERROR:jpeg2vips.c:919:read_jpeg_generate: assertion failed: (r->top == jpeg->y_pos)
Aborted (core dumped)
- threadpool recyling might be useful for dzsave?

View File

@ -21,8 +21,8 @@ if [ $? != 0 ]; then
echo "build of test image failed -- out of disc space?"
exit 1
fi
echo -n "test image is" `header -f width temp.v`
echo " by" `header -f height temp.v` "pixels"
echo -n "test image is" `vipsheader -f width temp.v`
echo " by" `vipsheader -f height temp.v` "pixels"
max_cpus=`vips im_concurrency_get`
echo "max cpus = $max_cpus"

View File

@ -21,8 +21,8 @@ if [ $? != 0 ]; then
echo "build of test image failed -- out of disc space?"
exit 1
fi
echo -n "test image is" `header -f width temp.v`
echo " by" `header -f height temp.v` "pixels"
echo -n "test image is" `vipsheader -f width temp.v`
echo " by" `vipsheader -f height temp.v` "pixels"
max_cpus=`vips im_concurrency_get`
echo "max cpus = $max_cpus"

View File

@ -2,6 +2,8 @@
*
* 2/12/11
* - wrap a class around the fits writer
* 2/7/14
* - cache the image before write so we are sequential
*/
/*
@ -70,19 +72,26 @@ vips_foreign_save_fits_build( VipsObject *object )
{
VipsForeignSave *save = (VipsForeignSave *) object;
VipsForeignSaveFits *fits = (VipsForeignSaveFits *) object;
VipsImage *t;
VipsImage **t = (VipsImage **)
vips_object_local_array( VIPS_OBJECT( fits ), 2 );
if( VIPS_OBJECT_CLASS( vips_foreign_save_fits_parent_class )->
build( object ) )
return( -1 );
if( vips_flip( save->ready, &t, VIPS_DIRECTION_VERTICAL, NULL ) )
/* FITS is written bottom-to-top, so we must flip.
*
* But all vips readers must work top-to-bottom (or vips_copy()'s seq
* hint won't work) so we must cache the input image.
*
* We cache to RAM, but perhaps we should use something like
* vips_get_disc_threshold() and copy to a tempfile.
*/
t[0] = vips_image_new_memory();
if( vips_image_write( save->ready, t[0] ) ||
vips_flip( t[0], &t[1], VIPS_DIRECTION_VERTICAL, NULL ) ||
vips__fits_write( t[1], fits->filename ) )
return( -1 );
if( vips__fits_write( t, fits->filename ) ) {
g_object_unref( t );
return( -1 );
}
g_object_unref( t );
return( 0 );
}

View File

@ -197,7 +197,7 @@ vips_system_build( VipsObject *object )
VIPS_FREE( std_output );
}
vips_error_system( result, class->nickname,
"%s", _( "command failed" ) );
_( "command \"%s\" failed" ), cmd );
return( -1 );
}

View File

@ -796,79 +796,6 @@ vips__write_extension_block( VipsImage *im, void *buf, int size )
return( 0 );
}
#ifdef DEBUG
/* Return a string of n characters. Buffer is zapped each time!
*/
const char *
rpt( char ch, int n )
{
int i;
static char buf[200];
n = VIPS_MIN( 190, n );
for( i = 0; i < n; i++ )
buf[i] = ch;
buf[i] = '\0';
return( buf );
}
/* Return a string of n spaces. Buffer is zapped each time!
*/
const char *
spc( int n )
{
return( rpt( ' ', n ) );
}
static void
prettify_tree_sub( xmlNode *xnode, int indent )
{
xmlNode *txt;
xmlNode *next;
for(;;) {
next = xnode->next;
/* According to memprof, this leaks :-( If you cut it out into
* a separate prog though, it's OK
FIXME ... how odd
*/
txt = xmlNewText( "\n" );
xmlAddPrevSibling( xnode, txt );
txt = xmlNewText( spc( indent ) );
xmlAddPrevSibling( xnode, txt );
if( xnode->children )
prettify_tree_sub( xnode->children, indent + 2 );
if( !next )
break;
xnode = next;
}
txt = xmlNewText( spc( indent - 2 ) );
xmlAddNextSibling( xnode, txt );
txt = xmlNewText( "\n" );
xmlAddNextSibling( xnode, txt );
}
/* Walk an XML document, adding extra blank text elements so that it's easier
* to read. Don't call me twice!
*/
void
prettify_tree( xmlDoc *xdoc )
{
xmlNode *xnode = xmlDocGetRootElement( xdoc );
prettify_tree_sub( xnode, 0 );
}
#endif /*DEBUG*/
/* Append XML to output fd.
*/
int
@ -897,45 +824,23 @@ vips__writehist( VipsImage *im )
return( -1 );
}
/* Bizarre double-cast stops a bogus gcc 4.1 compiler warning.
*/
xmlDocDumpMemory( doc, (xmlChar **) ((char *) &dump), &dump_size );
xmlDocDumpFormatMemory( doc, (xmlChar **) &dump, &dump_size, 1 );
if( !dump ) {
vips_error( "VipsImage", "%s", _( "xml save error" ) );
xmlFreeDoc( doc );
return( -1 );
}
xmlFreeDoc( doc );
if( vips__write_extension_block( im, dump, dump_size ) ) {
xmlFreeDoc( doc );
xmlFree( dump );
return( -1 );
}
#ifdef DEBUG
{
char *dump2;
int dump_size2;
/* Uncomment to have XML pretty-printed. Can be annoying during
* debugging tho'
*/
prettify_tree( doc );
xmlDocDumpMemory( doc, (xmlChar **) &dump2, &dump_size2 );
if( !dump2 ) {
vips_error( "VipsImage", "%s", _( "xml save error" ) );
xmlFreeDoc( doc );
xmlFree( dump );
return( -1 );
}
printf( "vips__writehist: saved XML is: \"%s\"", dump2 );
xmlFree( dump2 );
}
printf( "vips__writehist: saved XML is: \"%s\"", dump );
#endif /*DEBUG*/
xmlFreeDoc( doc );
xmlFree( dump );
return( 0 );