Merge remote-tracking branch 'origin/master'

Conflicts:
	TODO
This commit is contained in:
John Cupitt 2011-08-09 12:47:05 +01:00
commit 53589638d0
7 changed files with 82 additions and 45 deletions

1
.gitignore vendored
View File

@ -125,4 +125,5 @@ doc/reference/sgml.stamp
doc/reference/xml/ doc/reference/xml/
doc/html doc/html
doc/pdf doc/pdf
gtkdocerrors

View File

@ -1,6 +1,10 @@
26/7/11 started 7.26.1 26/7/11 started 7.26.1
- doc fixups - doc fixups
- oops, ==0 missing from a strcmp() in vips7compat - oops, ==0 missing from a strcmp() in vips7compat
- fixed a race in im_XYZ2Lab() table build
- added im_concurrency_get() to operation db
- better benchmarkn.sh runs for the correct number of CPUs automatically, runs
three times for each one, and just reports the fastest
26/7/11 started 7.26.0 26/7/11 started 7.26.0
- version bunp for 7.26 - version bunp for 7.26

17
TODO
View File

@ -8,22 +8,6 @@
- in benchmark, try: - in benchmark, try:
vips im_benchmarkn temp.v temp2.v 1
vips --vips-concurrency=99 --vips-tile-width=10 --vips-tile-height=10 \
im_benchmarkn temp.v temp2a.v 1
vips im_avg temp2a.v
vips im_avg temp2.v
get different results :-(
7.24 seems to fail this test too argh
first column of tiles is fine, but stuff to the right of that is broken
- leak check, again
- vips operation print could show operation flags as well, cf. "vips - vips operation print could show operation flags as well, cf. "vips
im_subtract" im_subtract"
@ -102,7 +86,6 @@
- do we bundle "convert" in the OS X / win32 builds? if we don't we - do we bundle "convert" in the OS X / win32 builds? if we don't we
should should
- some way for nip2 to get the vips bin area

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
uname -a uname -a
gcc --version gcc --version
@ -7,7 +7,7 @@ vips --version
# how large an image do you want to process? # how large an image do you want to process?
# sample2.v is 290x442 pixels ... replicate this many times horizontally and # sample2.v is 290x442 pixels ... replicate this many times horizontally and
# vertically to get a highres image for the benchmark # vertically to get a highres image for the benchmark
tile=2 tile=13
# how complex an operation do you want to run? # how complex an operation do you want to run?
# this sets the number of copies of the benchmark we chain together: # this sets the number of copies of the benchmark we chain together:
@ -21,26 +21,44 @@ if [ $? != 0 ]; then
echo "build of test image failed -- out of disc space?" echo "build of test image failed -- out of disc space?"
exit 1 exit 1
fi fi
echo -n "test image is" `header -f Xsize temp.v` echo -n "test image is" `header -f width temp.v`
echo " by" `header -f Ysize temp.v` "pixels" echo " by" `header -f height temp.v` "pixels"
max_cpus=`vips im_concurrency_get`
echo "max cpus = $max_cpus"
echo "starting benchmark ..." echo "starting benchmark ..."
echo "chain=$chain" echo /usr/bin/time -f %e vips \
--vips-concurrency=xx \
for cpus in 1 2 3 4 ; do --vips-tile-width=64 --vips-tile-height=64 \
export IM_CONCURRENCY=$cpus im_benchmarkn temp.v temp2.v $chain
echo reported real-time is best of three runs
echo IM_CONCURRENCY=$IM_CONCURRENCY echo cpus real-time
echo time -p vips im_benchmarkn temp.v temp2.v $chain
time -p vips im_benchmarkn temp.v temp2-$cpus.v $chain
for((cpus = 1; cpus <= max_cpus; cpus++)); do
t1=`/usr/bin/time -f %e vips \
--vips-concurrency=$cpus \
--vips-tile-width=64 --vips-tile-height=64 \
im_benchmarkn temp.v temp2.v $chain 2>&1`
if [ $? != 0 ]; then if [ $? != 0 ]; then
echo "benchmark failed -- install problem?" echo "benchmark failed -- install problem?"
exit 1 exit 1
fi fi
t2=`/usr/bin/time -f %e vips \
--vips-concurrency=$cpus \
--vips-tile-width=64 --vips-tile-height=64 \
im_benchmarkn temp.v temp2.v $chain 2>&1`
t3=`/usr/bin/time -f %e vips \
--vips-concurrency=$cpus \
--vips-tile-width=64 --vips-tile-height=64 \
im_benchmarkn temp.v temp2.v $chain 2>&1`
# find pixel average ... should be the same for all IM_CONCURRENCY settings # echo $t1 $t2 $t3
# or we have some kind of terrible bug
echo vips im_avg temp2-$cpus.v if [[ $t2 < $t1 ]]; then
vips im_avg temp2-$cpus.v t1=$t2
fi
if [[ $t3 < $t1 ]]; then
t1=$t3
fi
echo $cpus $t1
done done

View File

@ -1,10 +1,6 @@
/* @(#) Turn Lab 32bit packed format into displayable rgb. Fast, but very /* Turn Lab 32bit packed format into displayable rgb. Fast, but very
* @(#) inaccurate: for display only! * inaccurate: for display only! Note especially that this dithers and will
* @(#) * give different results on different runs.
* @(#) Usage:
* @(#) int im_LabQ2disp( IMAGE *in, IMAGE *out, struct im_col_display *d )
* @(#)
* @(#) Returns: -1 on error, else 0
* *
* 5/11/97 Steve Perry * 5/11/97 Steve Perry
* - adapted from old ip code * - adapted from old ip code

View File

@ -15,6 +15,8 @@
* - ahem, build the LUT outside the eval thread * - ahem, build the LUT outside the eval thread
* 2/11/09 * 2/11/09
* - gtkdoc * - gtkdoc
* 3/8/11
* - fix a race in the table build
*/ */
/* /*
@ -74,15 +76,14 @@ imb_XYZ2Lab_tables( void )
{ {
static int built_tables = 0; static int built_tables = 0;
int was_built;
int i; int i;
g_mutex_lock( im__global_lock ); g_mutex_lock( im__global_lock );
was_built = built_tables;
built_tables = 1; if( built_tables ) {
g_mutex_unlock( im__global_lock ); g_mutex_unlock( im__global_lock );
if( was_built )
return; return;
}
for( i = 0; i < QUANT_ELEMENTS; i++ ) { for( i = 0; i < QUANT_ELEMENTS; i++ ) {
float Y = (double) i / QUANT_ELEMENTS; float Y = (double) i / QUANT_ELEMENTS;
@ -92,6 +93,10 @@ imb_XYZ2Lab_tables( void )
else else
cbrt_table[i] = cbrt( Y ); cbrt_table[i] = cbrt( Y );
} }
built_tables = 1;
g_mutex_unlock( im__global_lock );
} }
/* Process a buffer of data. /* Process a buffer of data.

View File

@ -435,6 +435,35 @@ static im_function version_desc = {
version_args /* Arg list */ version_args /* Arg list */
}; };
/* im_concurrency_get() args.
*/
static im_arg_desc concurrency_get_args[] = {
IM_OUTPUT_INT( "concurrency" )
};
/* Call im_concurrency_get() via arg vector.
*/
static int
concurrency_get_vec( im_object *argv )
{
int *out = ((int *) argv[0]);
*out = vips_concurrency_get();
return( 0 );
}
/* Description of im_concurrency_get.
*/
static im_function concurrency_get_desc = {
"im_concurrency_get", /* Name */
"get concurrency level", /* Description */
0, /* Flags */
concurrency_get_vec, /* Dispatch function */
VIPS_NUMBER( concurrency_get_args ), /* Size of arg list */
concurrency_get_args /* Arg list */
};
/* im_cache() args. /* im_cache() args.
*/ */
static im_arg_desc cache_args[] = { static im_arg_desc cache_args[] = {
@ -518,6 +547,7 @@ static im_function binfile_desc = {
static im_function *iofuncs_list[] = { static im_function *iofuncs_list[] = {
&binfile_desc, &binfile_desc,
&cache_desc, &cache_desc,
&concurrency_get_desc,
&getext_desc, &getext_desc,
&guess_prefix_desc, &guess_prefix_desc,
&guess_libdir_desc, &guess_libdir_desc,