stuff
This commit is contained in:
parent
247139d11b
commit
a65cfcd884
@ -3,7 +3,7 @@
|
||||
- various include cleanups, updated man pages
|
||||
- break im_wbuffer() out to a separate API
|
||||
- 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
|
||||
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()?
|
||||
|
||||
- done jpeg, png ... make others dbl-buf writes too
|
||||
|
||||
- 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
|
||||
|
@ -190,7 +190,6 @@ typedef struct {
|
||||
IMAGE *in;
|
||||
struct jpeg_compress_struct cinfo;
|
||||
ErrorManager eman;
|
||||
REGION *reg;
|
||||
im_threadgroup_t *tg;
|
||||
JSAMPROW *row_pointer;
|
||||
char *profile_bytes;
|
||||
@ -202,7 +201,6 @@ write_destroy( Write *write )
|
||||
{
|
||||
jpeg_destroy_compress( &write->cinfo );
|
||||
IM_FREEF( im_threadgroup_free, write->tg );
|
||||
IM_FREEF( im_region_free, write->reg );
|
||||
IM_FREEF( im_close, write->in );
|
||||
IM_FREEF( fclose, write->eman.fp );
|
||||
IM_FREE( write->row_pointer );
|
||||
@ -226,7 +224,6 @@ write_new( IMAGE *in )
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
write->reg = im_region_create( write->in );
|
||||
write->tg = im_threadgroup_create( write->in );
|
||||
|
||||
write->row_pointer = IM_ARRAY( NULL, write->tg->nlines, JSAMPROW );
|
||||
@ -238,7 +235,7 @@ write_new( IMAGE *in )
|
||||
write->profile_bytes = NULL;
|
||||
write->profile_length = 0;
|
||||
|
||||
if( !write->reg || !write->tg || !write->row_pointer ) {
|
||||
if( !write->tg || !write->row_pointer ) {
|
||||
write_destroy( write );
|
||||
return( NULL );
|
||||
}
|
||||
|
@ -95,7 +95,6 @@ user_warning_function( png_structp png_ptr, png_const_charp warning_msg )
|
||||
*/
|
||||
typedef struct {
|
||||
IMAGE *in;
|
||||
REGION *reg;
|
||||
im_threadgroup_t *tg;
|
||||
|
||||
FILE *fp;
|
||||
@ -107,7 +106,6 @@ typedef struct {
|
||||
static void
|
||||
write_destroy( Write *write )
|
||||
{
|
||||
IM_FREEF( im_region_free, write->reg );
|
||||
IM_FREEF( im_threadgroup_free, write->tg );
|
||||
IM_FREEF( im_close, write->in );
|
||||
IM_FREEF( fclose, write->fp );
|
||||
@ -134,14 +132,13 @@ write_new( IMAGE *in )
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
write->reg = im_region_create( write->in );
|
||||
write->tg = im_threadgroup_create( write->in );
|
||||
write->row_pointer = IM_ARRAY( NULL, write->tg->nlines, png_bytep );
|
||||
write->fp = NULL;
|
||||
write->pPng = NULL;
|
||||
write->pInfo = NULL;
|
||||
|
||||
if( !write->reg || !write->tg || !write->row_pointer ) {
|
||||
if( !write->tg || !write->row_pointer ) {
|
||||
write_destroy( write );
|
||||
return( NULL );
|
||||
}
|
||||
|
@ -4,6 +4,8 @@
|
||||
* - better no-overshoot on tile loop
|
||||
* 9/9/05
|
||||
* - tiny cleanups
|
||||
* 3/11/07
|
||||
* - use im_wbuffer() for bg writes
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -55,7 +57,6 @@
|
||||
*/
|
||||
typedef struct {
|
||||
IMAGE *in;
|
||||
REGION *reg;
|
||||
im_threadgroup_t *tg;
|
||||
FILE *fp;
|
||||
char *name;
|
||||
@ -65,7 +66,6 @@ static void
|
||||
write_destroy( Write *write )
|
||||
{
|
||||
IM_FREEF( im_threadgroup_free, write->tg );
|
||||
IM_FREEF( im_region_free, write->reg );
|
||||
IM_FREEF( fclose, write->fp );
|
||||
IM_FREE( write->name );
|
||||
|
||||
@ -81,7 +81,6 @@ write_new( IMAGE *in, const char *name )
|
||||
return( NULL );
|
||||
|
||||
write->in = in;
|
||||
write->reg = im_region_create( write->in );
|
||||
write->tg = im_threadgroup_create( write->in );
|
||||
write->name = im_strdup( NULL, name );
|
||||
|
||||
@ -94,7 +93,7 @@ write_new( IMAGE *in, const char *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 );
|
||||
return( NULL );
|
||||
}
|
||||
@ -167,6 +166,23 @@ write_ppm_line_binary( IMAGE *in, FILE *fp, PEL *p )
|
||||
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
|
||||
write_ppm( Write *write, int ascii )
|
||||
{
|
||||
@ -176,8 +192,6 @@ write_ppm( Write *write, int ascii )
|
||||
int max_value;
|
||||
char *magic;
|
||||
time_t timebuf;
|
||||
int y, i;
|
||||
Rect area;
|
||||
|
||||
switch( in->BandFmt ) {
|
||||
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\n", max_value );
|
||||
|
||||
for( y = 0; y < in->Ysize; y += write->tg->nlines ) {
|
||||
area.left = 0;
|
||||
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 );
|
||||
}
|
||||
}
|
||||
if( im_wbuffer( write->tg, write_ppm_block, write, fn ) )
|
||||
return( -1 );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user