small cleanups

make embed less chatty with --vips-cache-trace

shrink can use linecache now

found a fail case on the work machine
This commit is contained in:
John Cupitt 2017-03-06 14:51:45 +00:00
parent 755fa74c30
commit e4ab251fd1
3 changed files with 56 additions and 17 deletions

45
TODO
View File

@ -1,3 +1,48 @@
- fails with out of order
$ vips resize blackbug.png x.jpg 0.25
where
$ vipsheader blackbug.png
blackbug.png: 2048x1536 uchar, 4 bands, srgb, pngload
makes two caches:
height 8 tiles for the input sequential
height 10 tilecache, 39 tiles, for the shrinkv
vips_shrinkv_gen sees:
vips_shrinkv_gen: generating 2048 x 10 at 0 x 250
vips_shrinkv_gen: generating 2048 x 10 at 0 x 500
vips_shrinkv_gen: generating 2048 x 10 at 0 x 510
vips_shrinkv_gen: generating 2048 x 10 at 0 x 260
vips_shrinkv_gen: generating 2048 x 10 at 0 x 10
(vips:15685): VIPS-WARNING **: error in tile 0 x 16
concurrency=4 seems to always work
concurrency=5 fails 50%
concurrency=6 almost always fails
- argh
#!/usr/bin/env python
import sys
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips
x = Vips.Image.new_from_file(sys.argv[1], access = Vips.Access.SEQUENTIAL)
x = x.resize(0.1)
x.write_to_file(sys.argv[2])
fails with out of order ... why?
- vips_object_class_install_argument() should check for duplicate priorities,
it's been behind a few nasty bugs

View File

@ -357,16 +357,17 @@ vips_embed_build( VipsObject *object )
embed->height == embed->in->Ysize )
return( vips_image_write( embed->in, conversion->out ) );
if( !(embed->ink = vips__vector_to_ink(
class->nickname, embed->in,
VIPS_AREA( embed->background )->data, NULL,
VIPS_AREA( embed->background )->n )) )
return( -1 );
if( !vips_object_argument_isset( object, "extend" ) &&
vips_object_argument_isset( object, "background" ) )
embed->extend = VIPS_EXTEND_BACKGROUND;
if( embed->extend == VIPS_EXTEND_BACKGROUND )
if( !(embed->ink = vips__vector_to_ink(
class->nickname, embed->in,
VIPS_AREA( embed->background )->data, NULL,
VIPS_AREA( embed->background )->n )) )
return( -1 );
switch( embed->extend ) {
case VIPS_EXTEND_REPEAT:
{

View File

@ -275,9 +275,9 @@ vips_shrinkv_gen( VipsRegion *or, void *vseq,
*/
#ifdef DEBUG
#endif /*DEBUG*/
printf( "vips_shrinkv_gen: generating %d x %d at %d x %d\n",
r->width, r->height, r->left, r->top );
#endif /*DEBUG*/
for( y = 0; y < r->height; y++ ) {
memset( seq->sum, 0, shrink->sizeof_line_buffer );
@ -417,18 +417,11 @@ vips_shrinkv_build( VipsObject *object )
* happen for a very tall, thin image with a very large shrink factor.
*/
if( vips_image_get_typeof( in, VIPS_META_SEQUENTIAL ) ) {
int tile_width;
int tile_height;
int n_lines;
g_info( "shrinkv sequential line cache" );
vips_get_tile_size( in,
&tile_width, &tile_height, &n_lines );
if( vips_tilecache( in, &t[3],
"tile_width", in->Xsize,
"tile_height", 10,
"max_tiles", 1 + n_lines / 10,
if( vips_linecache( in, &t[3],
"access", VIPS_ACCESS_SEQUENTIAL,
"tile_height", 10,
"threaded", FALSE,
NULL ) )
return( -1 );