move the vips7 loaders away from VipsForeign
the vips7 loaders were a thin layer over the new VipsForeign system however! VipsForeign does various "useful" things, like open via disc, and this resulted in stuff like vips im_jpeg2vips huge.jpg x.v decompressing to a temp file before copying to x.v im_jpeg2vips() and friends now call the low-level loaders directly and avoid the extra mechanisms in VipsForeign "nip2 huge.jpg" was loading twice as well, for the same reason
This commit is contained in:
parent
ba27d8b2a4
commit
2332e0bfc3
24
TODO
24
TODO
@ -1,3 +1,14 @@
|
|||||||
|
- how curious
|
||||||
|
|
||||||
|
$ vips jpegload wtc.jpg x.v --vips-progress
|
||||||
|
** DEBUG_FATAL
|
||||||
|
vips x.v: 2 threads, 128 x 128 tiles, groups of 256 scanlines
|
||||||
|
vips /tmp/vips-1-2UERGW.v: 2 threads, 128 x 128 tiles, groups of 256 scanlines
|
||||||
|
vips /tmp/vips-1-2UERGW.v: done in 2s
|
||||||
|
vips x.v: done in 3s
|
||||||
|
memory: high-water mark 77.46 MB
|
||||||
|
|
||||||
|
|
||||||
- test "rs" mode
|
- test "rs" mode
|
||||||
|
|
||||||
can't see the code for "rd" mode?
|
can't see the code for "rd" mode?
|
||||||
@ -5,19 +16,6 @@
|
|||||||
or "rw" mode either?
|
or "rw" mode either?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- need a flag on operations for "is sequential"
|
|
||||||
|
|
||||||
should be on the object, not the class, since it can change with params
|
|
||||||
|
|
||||||
use it from command-line interface
|
|
||||||
|
|
||||||
not really helpful elsewhere, since two operations which are sequential
|
|
||||||
alone can be non-sequential in combination -- eg. shrink + conv
|
|
||||||
|
|
||||||
can you always make sequential-apart, non-seq together pipelines seqential
|
|
||||||
by putting a line cache between each pair?
|
|
||||||
|
|
||||||
- update "how it works" to note we are now fully-functional ... there's
|
- update "how it works" to note we are now fully-functional ... there's
|
||||||
vips_image_write() now to create a sink
|
vips_image_write() now to create a sink
|
||||||
|
|
||||||
|
@ -41,6 +41,9 @@
|
|||||||
|
|
||||||
#include <vips/vips.h>
|
#include <vips/vips.h>
|
||||||
|
|
||||||
|
#include "../foreign/dbh.h"
|
||||||
|
#include "../foreign/analyze2vips.h"
|
||||||
|
|
||||||
static VipsFormatFlags
|
static VipsFormatFlags
|
||||||
analyze_flags( const char *filename )
|
analyze_flags( const char *filename )
|
||||||
{
|
{
|
||||||
@ -56,15 +59,7 @@ isanalyze( const char *filename )
|
|||||||
int
|
int
|
||||||
im_analyze2vips( const char *filename, IMAGE *out )
|
im_analyze2vips( const char *filename, IMAGE *out )
|
||||||
{
|
{
|
||||||
VipsImage *t;
|
return( vips__analyze_read( filename, out ) );
|
||||||
|
|
||||||
if( vips_analyzeload( filename, &t, NULL ) )
|
|
||||||
return( -1 );
|
|
||||||
if( vips_image_write( t, out ) ) {
|
|
||||||
g_object_unref( t );
|
|
||||||
return( -1 );
|
|
||||||
}
|
|
||||||
g_object_unref( t );
|
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,8 @@
|
|||||||
|
|
||||||
#include <vips/vips.h>
|
#include <vips/vips.h>
|
||||||
|
|
||||||
|
#include "../foreign/csv.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
im_csv2vips( const char *filename, IMAGE *out )
|
im_csv2vips( const char *filename, IMAGE *out )
|
||||||
{
|
{
|
||||||
@ -56,7 +58,6 @@ im_csv2vips( const char *filename, IMAGE *out )
|
|||||||
char name[FILENAME_MAX];
|
char name[FILENAME_MAX];
|
||||||
char mode[FILENAME_MAX];
|
char mode[FILENAME_MAX];
|
||||||
char *p, *q, *r;
|
char *p, *q, *r;
|
||||||
VipsImage *t;
|
|
||||||
|
|
||||||
/* Parse mode string.
|
/* Parse mode string.
|
||||||
*/
|
*/
|
||||||
@ -73,18 +74,9 @@ im_csv2vips( const char *filename, IMAGE *out )
|
|||||||
lines = atoi( r );
|
lines = atoi( r );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( vips_csvload( filename, &t,
|
if( vips__csv_read( filename, out,
|
||||||
"skip", start_skip,
|
start_skip, lines, whitespace, separator ) )
|
||||||
"lines", lines,
|
|
||||||
"whitespace", whitespace,
|
|
||||||
"separator", separator,
|
|
||||||
NULL ) )
|
|
||||||
return( -1 );
|
return( -1 );
|
||||||
if( vips_image_write( t, out ) ) {
|
|
||||||
g_object_unref( t );
|
|
||||||
return( -1 );
|
|
||||||
}
|
|
||||||
g_object_unref( t );
|
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
@ -48,20 +48,12 @@
|
|||||||
#include <vips/thread.h>
|
#include <vips/thread.h>
|
||||||
#include <vips/internal.h>
|
#include <vips/internal.h>
|
||||||
|
|
||||||
|
#include "../foreign/openexr2vips.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
im_exr2vips( const char *filename, IMAGE *out )
|
im_exr2vips( const char *filename, IMAGE *out )
|
||||||
{
|
{
|
||||||
VipsImage *t;
|
return( vips__openexr_read( filename, out ) );
|
||||||
|
|
||||||
if( vips_openexrload( filename, &t, NULL ) )
|
|
||||||
return( -1 );
|
|
||||||
if( vips_image_write( t, out ) ) {
|
|
||||||
g_object_unref( t );
|
|
||||||
return( -1 );
|
|
||||||
}
|
|
||||||
g_object_unref( t );
|
|
||||||
|
|
||||||
return( 0 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *exr_suffs[] = { ".exr", NULL };
|
static const char *exr_suffs[] = { ".exr", NULL };
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
*
|
*
|
||||||
* 30/11/11
|
* 30/11/11
|
||||||
* - now just a stub
|
* - now just a stub
|
||||||
|
* 10/7/12
|
||||||
|
* - use jpeg funcs directly rather than going though vips_jpegload()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -44,6 +46,11 @@
|
|||||||
|
|
||||||
#include <vips/vips.h>
|
#include <vips/vips.h>
|
||||||
|
|
||||||
|
#include <setjmp.h>
|
||||||
|
#include <jpeglib.h>
|
||||||
|
#include <jerror.h>
|
||||||
|
#include "../foreign/jpeg.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
im_jpeg2vips( const char *name, IMAGE *out )
|
im_jpeg2vips( const char *name, IMAGE *out )
|
||||||
{
|
{
|
||||||
@ -52,8 +59,6 @@ im_jpeg2vips( const char *name, IMAGE *out )
|
|||||||
char *p, *q;
|
char *p, *q;
|
||||||
int shrink;
|
int shrink;
|
||||||
gboolean fail_on_warn;
|
gboolean fail_on_warn;
|
||||||
gboolean sequential;
|
|
||||||
VipsImage *t;
|
|
||||||
|
|
||||||
/* By default, we ignore any warnings. We want to get as much of
|
/* By default, we ignore any warnings. We want to get as much of
|
||||||
* the user's data as we can.
|
* the user's data as we can.
|
||||||
@ -65,7 +70,6 @@ im_jpeg2vips( const char *name, IMAGE *out )
|
|||||||
im_filename_split( name, filename, mode );
|
im_filename_split( name, filename, mode );
|
||||||
p = &mode[0];
|
p = &mode[0];
|
||||||
shrink = 1;
|
shrink = 1;
|
||||||
sequential = FALSE;
|
|
||||||
if( (q = im_getnextoption( &p )) ) {
|
if( (q = im_getnextoption( &p )) ) {
|
||||||
shrink = atoi( q );
|
shrink = atoi( q );
|
||||||
|
|
||||||
@ -80,24 +84,22 @@ im_jpeg2vips( const char *name, IMAGE *out )
|
|||||||
if( im_isprefix( "fail", q ) )
|
if( im_isprefix( "fail", q ) )
|
||||||
fail_on_warn = TRUE;
|
fail_on_warn = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vips__jpeg_read_file() is always sequential. Parse the option, but
|
||||||
|
* don't use it.
|
||||||
|
*/
|
||||||
if( (q = im_getnextoption( &p )) ) {
|
if( (q = im_getnextoption( &p )) ) {
|
||||||
if( im_isprefix( "seq", q ) )
|
if( im_isprefix( "seq", q ) )
|
||||||
sequential = TRUE;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( vips_jpegload( filename, &t,
|
/* Don't use vips_jpegload() ... we call the jpeg func directly in
|
||||||
"shrink", shrink,
|
* order to avoid the foreign.c mechanisms for load-via-disc and stuff
|
||||||
"fail", fail_on_warn,
|
* like that.
|
||||||
"sequential", sequential,
|
*/
|
||||||
NULL ) )
|
if( vips__jpeg_read_file( filename, out, FALSE, shrink, fail_on_warn ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
if( vips_image_write( t, out ) ) {
|
|
||||||
g_object_unref( t );
|
|
||||||
return( -1 );
|
|
||||||
}
|
|
||||||
g_object_unref( t );
|
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,20 +41,12 @@
|
|||||||
|
|
||||||
#include <vips/vips.h>
|
#include <vips/vips.h>
|
||||||
|
|
||||||
|
#include "../foreign/magick.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
im_magick2vips( const char *filename, IMAGE *out )
|
im_magick2vips( const char *filename, IMAGE *out )
|
||||||
{
|
{
|
||||||
VipsImage *t;
|
return( vips__magick_read( filename, out ) );
|
||||||
|
|
||||||
if( vips_magickload( filename, &t, NULL ) )
|
|
||||||
return( -1 );
|
|
||||||
if( vips_image_write( t, out ) ) {
|
|
||||||
g_object_unref( t );
|
|
||||||
return( -1 );
|
|
||||||
}
|
|
||||||
g_object_unref( t );
|
|
||||||
|
|
||||||
return( 0 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -44,35 +44,26 @@
|
|||||||
#include <vips/vips.h>
|
#include <vips/vips.h>
|
||||||
#include <vips/internal.h>
|
#include <vips/internal.h>
|
||||||
|
|
||||||
|
#include "../foreign/vipspng.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
im_png2vips( const char *name, IMAGE *out )
|
im_png2vips( const char *name, IMAGE *out )
|
||||||
{
|
{
|
||||||
char filename[FILENAME_MAX];
|
char filename[FILENAME_MAX];
|
||||||
char mode[FILENAME_MAX];
|
char mode[FILENAME_MAX];
|
||||||
char *p, *q;
|
char *p, *q;
|
||||||
gboolean sequential;
|
|
||||||
VipsImage *x;
|
|
||||||
|
|
||||||
im_filename_split( name, filename, mode );
|
im_filename_split( name, filename, mode );
|
||||||
|
|
||||||
sequential = FALSE;
|
|
||||||
p = &mode[0];
|
p = &mode[0];
|
||||||
if( (q = im_getnextoption( &p )) ) {
|
if( (q = im_getnextoption( &p )) ) {
|
||||||
if( im_isprefix( "seq", q ) )
|
if( im_isprefix( "seq", q ) )
|
||||||
sequential = TRUE;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( vips_pngload( filename, &x,
|
if( vips__png_read( filename, out ) )
|
||||||
"sequential", sequential,
|
|
||||||
NULL ) )
|
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
if( vips_image_write( x, out ) ) {
|
|
||||||
g_object_unref( x );
|
|
||||||
return( -1 );
|
|
||||||
}
|
|
||||||
g_object_unref( x );
|
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +48,8 @@
|
|||||||
#include <vips/internal.h>
|
#include <vips/internal.h>
|
||||||
#include <vips/thread.h>
|
#include <vips/thread.h>
|
||||||
|
|
||||||
|
#include "../foreign/tiff.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
im_tiff2vips( const char *name, IMAGE *out )
|
im_tiff2vips( const char *name, IMAGE *out )
|
||||||
{
|
{
|
||||||
@ -55,32 +57,21 @@ im_tiff2vips( const char *name, IMAGE *out )
|
|||||||
char mode[FILENAME_MAX];
|
char mode[FILENAME_MAX];
|
||||||
char *p, *q;
|
char *p, *q;
|
||||||
int page;
|
int page;
|
||||||
gboolean sequential;
|
|
||||||
VipsImage *t;
|
|
||||||
|
|
||||||
im_filename_split( name, filename, mode );
|
im_filename_split( name, filename, mode );
|
||||||
|
|
||||||
page = 0;
|
page = 0;
|
||||||
sequential = FALSE;
|
|
||||||
p = &mode[0];
|
p = &mode[0];
|
||||||
if( (q = im_getnextoption( &p )) ) {
|
if( (q = im_getnextoption( &p )) ) {
|
||||||
page = atoi( q );
|
page = atoi( q );
|
||||||
}
|
}
|
||||||
if( (q = im_getnextoption( &p )) ) {
|
if( (q = im_getnextoption( &p )) ) {
|
||||||
if( im_isprefix( "seq", q ) )
|
if( im_isprefix( "seq", q ) )
|
||||||
sequential = TRUE;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( vips_tiffload( filename, &t,
|
if( vips__tiff_read( filename, out, page ) )
|
||||||
"page", page,
|
|
||||||
"sequential", sequential,
|
|
||||||
NULL ) )
|
|
||||||
return( -1 );
|
return( -1 );
|
||||||
if( vips_image_write( t, out ) ) {
|
|
||||||
g_object_unref( t );
|
|
||||||
return( -1 );
|
|
||||||
}
|
|
||||||
g_object_unref( t );
|
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user