stuff
This commit is contained in:
parent
247139d11b
commit
a65cfcd884
@ -3,7 +3,7 @@
|
|||||||
- various include cleanups, updated man pages
|
- various include cleanups, updated man pages
|
||||||
- break im_wbuffer() out to a separate API
|
- break im_wbuffer() out to a separate API
|
||||||
- use im_wbuffer() to make im_vips2jpeg() compress in the background
|
- use im_wbuffer() to make im_vips2jpeg() compress in the background
|
||||||
- also im_vips2png(), im_vips2tiff()
|
- also im_vips2png(), im_vips2tiff(), im_vips2ppm()
|
||||||
- new system for propogating progress settings down pipelines unbreaks save
|
- new system for propogating progress settings down pipelines unbreaks save
|
||||||
feedback in nip2
|
feedback in nip2
|
||||||
|
|
||||||
|
4
TODO
4
TODO
@ -1,9 +1,7 @@
|
|||||||
- use im_wbuffer() to loop in im_iterate()?
|
- test ppm writer
|
||||||
|
|
||||||
- talk about new progress system in im_add_eval_callback()?
|
- talk about new progress system in im_add_eval_callback()?
|
||||||
|
|
||||||
- done jpeg, png ... make others dbl-buf writes too
|
|
||||||
|
|
||||||
- missing libstdc++ in link? what if we configure with no openexr?
|
- missing libstdc++ in link? what if we configure with no openexr?
|
||||||
|
|
||||||
added -lstdc++ to VIPS_LIBS, but will this work on solaris etc.? maybe have
|
added -lstdc++ to VIPS_LIBS, but will this work on solaris etc.? maybe have
|
||||||
|
@ -190,7 +190,6 @@ typedef struct {
|
|||||||
IMAGE *in;
|
IMAGE *in;
|
||||||
struct jpeg_compress_struct cinfo;
|
struct jpeg_compress_struct cinfo;
|
||||||
ErrorManager eman;
|
ErrorManager eman;
|
||||||
REGION *reg;
|
|
||||||
im_threadgroup_t *tg;
|
im_threadgroup_t *tg;
|
||||||
JSAMPROW *row_pointer;
|
JSAMPROW *row_pointer;
|
||||||
char *profile_bytes;
|
char *profile_bytes;
|
||||||
@ -202,7 +201,6 @@ write_destroy( Write *write )
|
|||||||
{
|
{
|
||||||
jpeg_destroy_compress( &write->cinfo );
|
jpeg_destroy_compress( &write->cinfo );
|
||||||
IM_FREEF( im_threadgroup_free, write->tg );
|
IM_FREEF( im_threadgroup_free, write->tg );
|
||||||
IM_FREEF( im_region_free, write->reg );
|
|
||||||
IM_FREEF( im_close, write->in );
|
IM_FREEF( im_close, write->in );
|
||||||
IM_FREEF( fclose, write->eman.fp );
|
IM_FREEF( fclose, write->eman.fp );
|
||||||
IM_FREE( write->row_pointer );
|
IM_FREE( write->row_pointer );
|
||||||
@ -226,7 +224,6 @@ write_new( IMAGE *in )
|
|||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
write->reg = im_region_create( write->in );
|
|
||||||
write->tg = im_threadgroup_create( write->in );
|
write->tg = im_threadgroup_create( write->in );
|
||||||
|
|
||||||
write->row_pointer = IM_ARRAY( NULL, write->tg->nlines, JSAMPROW );
|
write->row_pointer = IM_ARRAY( NULL, write->tg->nlines, JSAMPROW );
|
||||||
@ -238,7 +235,7 @@ write_new( IMAGE *in )
|
|||||||
write->profile_bytes = NULL;
|
write->profile_bytes = NULL;
|
||||||
write->profile_length = 0;
|
write->profile_length = 0;
|
||||||
|
|
||||||
if( !write->reg || !write->tg || !write->row_pointer ) {
|
if( !write->tg || !write->row_pointer ) {
|
||||||
write_destroy( write );
|
write_destroy( write );
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,6 @@ user_warning_function( png_structp png_ptr, png_const_charp warning_msg )
|
|||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
IMAGE *in;
|
IMAGE *in;
|
||||||
REGION *reg;
|
|
||||||
im_threadgroup_t *tg;
|
im_threadgroup_t *tg;
|
||||||
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@ -107,7 +106,6 @@ typedef struct {
|
|||||||
static void
|
static void
|
||||||
write_destroy( Write *write )
|
write_destroy( Write *write )
|
||||||
{
|
{
|
||||||
IM_FREEF( im_region_free, write->reg );
|
|
||||||
IM_FREEF( im_threadgroup_free, write->tg );
|
IM_FREEF( im_threadgroup_free, write->tg );
|
||||||
IM_FREEF( im_close, write->in );
|
IM_FREEF( im_close, write->in );
|
||||||
IM_FREEF( fclose, write->fp );
|
IM_FREEF( fclose, write->fp );
|
||||||
@ -134,14 +132,13 @@ write_new( IMAGE *in )
|
|||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
write->reg = im_region_create( write->in );
|
|
||||||
write->tg = im_threadgroup_create( write->in );
|
write->tg = im_threadgroup_create( write->in );
|
||||||
write->row_pointer = IM_ARRAY( NULL, write->tg->nlines, png_bytep );
|
write->row_pointer = IM_ARRAY( NULL, write->tg->nlines, png_bytep );
|
||||||
write->fp = NULL;
|
write->fp = NULL;
|
||||||
write->pPng = NULL;
|
write->pPng = NULL;
|
||||||
write->pInfo = NULL;
|
write->pInfo = NULL;
|
||||||
|
|
||||||
if( !write->reg || !write->tg || !write->row_pointer ) {
|
if( !write->tg || !write->row_pointer ) {
|
||||||
write_destroy( write );
|
write_destroy( write );
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
* - better no-overshoot on tile loop
|
* - better no-overshoot on tile loop
|
||||||
* 9/9/05
|
* 9/9/05
|
||||||
* - tiny cleanups
|
* - tiny cleanups
|
||||||
|
* 3/11/07
|
||||||
|
* - use im_wbuffer() for bg writes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -55,7 +57,6 @@
|
|||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
IMAGE *in;
|
IMAGE *in;
|
||||||
REGION *reg;
|
|
||||||
im_threadgroup_t *tg;
|
im_threadgroup_t *tg;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char *name;
|
char *name;
|
||||||
@ -65,7 +66,6 @@ static void
|
|||||||
write_destroy( Write *write )
|
write_destroy( Write *write )
|
||||||
{
|
{
|
||||||
IM_FREEF( im_threadgroup_free, write->tg );
|
IM_FREEF( im_threadgroup_free, write->tg );
|
||||||
IM_FREEF( im_region_free, write->reg );
|
|
||||||
IM_FREEF( fclose, write->fp );
|
IM_FREEF( fclose, write->fp );
|
||||||
IM_FREE( write->name );
|
IM_FREE( write->name );
|
||||||
|
|
||||||
@ -81,7 +81,6 @@ write_new( IMAGE *in, const char *name )
|
|||||||
return( NULL );
|
return( NULL );
|
||||||
|
|
||||||
write->in = in;
|
write->in = in;
|
||||||
write->reg = im_region_create( write->in );
|
|
||||||
write->tg = im_threadgroup_create( write->in );
|
write->tg = im_threadgroup_create( write->in );
|
||||||
write->name = im_strdup( NULL, name );
|
write->name = im_strdup( NULL, name );
|
||||||
|
|
||||||
@ -94,7 +93,7 @@ write_new( IMAGE *in, const char *name )
|
|||||||
_( "unable to open \"%s\" for output" ), name );
|
_( "unable to open \"%s\" for output" ), name );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !write->reg || !write->tg || !write->name || !write->fp ) {
|
if( !write->tg || !write->name || !write->fp ) {
|
||||||
write_destroy( write );
|
write_destroy( write );
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
@ -167,6 +166,23 @@ write_ppm_line_binary( IMAGE *in, FILE *fp, PEL *p )
|
|||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
write_ppm_block( REGION *region, Rect *area, void *a, void *b )
|
||||||
|
{
|
||||||
|
Write *write = (Write *) a;
|
||||||
|
write_fn fn = (write_fn) b;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for( i = 0; i < area->height; i++ ) {
|
||||||
|
PEL *p = (PEL *) IM_REGION_ADDR( region, 0, area->top + i );
|
||||||
|
|
||||||
|
if( fn( write->in, write->fp, p ) )
|
||||||
|
return( -1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
write_ppm( Write *write, int ascii )
|
write_ppm( Write *write, int ascii )
|
||||||
{
|
{
|
||||||
@ -176,8 +192,6 @@ write_ppm( Write *write, int ascii )
|
|||||||
int max_value;
|
int max_value;
|
||||||
char *magic;
|
char *magic;
|
||||||
time_t timebuf;
|
time_t timebuf;
|
||||||
int y, i;
|
|
||||||
Rect area;
|
|
||||||
|
|
||||||
switch( in->BandFmt ) {
|
switch( in->BandFmt ) {
|
||||||
case IM_BANDFMT_UCHAR:
|
case IM_BANDFMT_UCHAR:
|
||||||
@ -213,22 +227,8 @@ write_ppm( Write *write, int ascii )
|
|||||||
fprintf( write->fp, "%d %d\n", in->Xsize, in->Ysize );
|
fprintf( write->fp, "%d %d\n", in->Xsize, in->Ysize );
|
||||||
fprintf( write->fp, "%d\n", max_value );
|
fprintf( write->fp, "%d\n", max_value );
|
||||||
|
|
||||||
for( y = 0; y < in->Ysize; y += write->tg->nlines ) {
|
if( im_wbuffer( write->tg, write_ppm_block, write, fn ) )
|
||||||
area.left = 0;
|
return( -1 );
|
||||||
area.top = y;
|
|
||||||
area.width = in->Xsize;
|
|
||||||
area.height = IM_MIN( write->tg->nlines, in->Ysize - y );
|
|
||||||
|
|
||||||
if( im_prepare_thread( write->tg, write->reg, &area ) )
|
|
||||||
return( -1 );
|
|
||||||
|
|
||||||
for( i = 0; i < area.height; i++ ) {
|
|
||||||
PEL *p = (PEL *) IM_REGION_ADDR( write->reg, 0, y + i );
|
|
||||||
|
|
||||||
if( fn( write->in, write->fp, p ) )
|
|
||||||
return( -1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user