Merge branch 'cl' of https://github.com/neheb/libvips into neheb-cl
This commit is contained in:
commit
4f9ea61170
@ -60,11 +60,12 @@ VIPS_NAMESPACE_START
|
|||||||
std::vector<double>
|
std::vector<double>
|
||||||
to_vectorv( int n, ... )
|
to_vectorv( int n, ... )
|
||||||
{
|
{
|
||||||
std::vector<double> vector( n );
|
std::vector<double> vector;
|
||||||
|
vector.reserve( n );
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
va_start( ap, n );
|
va_start( ap, n );
|
||||||
for( int i = 0; i < n; i++ )
|
for( std::vector<double>::size_type i = 0; i < size_t(n); i++ )
|
||||||
vector[i] = va_arg( ap, double );
|
vector[i] = va_arg( ap, double );
|
||||||
va_end( ap );
|
va_end( ap );
|
||||||
|
|
||||||
@ -80,9 +81,10 @@ to_vector( double value )
|
|||||||
std::vector<double>
|
std::vector<double>
|
||||||
to_vector( int n, double array[] )
|
to_vector( int n, double array[] )
|
||||||
{
|
{
|
||||||
std::vector<double> vector( n );
|
std::vector<double> vector;
|
||||||
|
vector.reserve( n );
|
||||||
|
|
||||||
for( int i = 0; i < n; i++ )
|
for( std::vector<double>::size_type i = 0; i < size_t(n); i++ )
|
||||||
vector[i] = array[i];
|
vector[i] = array[i];
|
||||||
|
|
||||||
return( vector );
|
return( vector );
|
||||||
@ -91,9 +93,10 @@ to_vector( int n, double array[] )
|
|||||||
std::vector<double>
|
std::vector<double>
|
||||||
negate( std::vector<double> vector )
|
negate( std::vector<double> vector )
|
||||||
{
|
{
|
||||||
std::vector<double> new_vector( vector.size() );
|
std::vector<double> new_vector;
|
||||||
|
new_vector.reserve( vector.size() );
|
||||||
|
|
||||||
for( unsigned int i = 0; i < vector.size(); i++ )
|
for( std::vector<double>::size_type i = 0; i < vector.size(); i++ )
|
||||||
new_vector[i] = vector[i] * -1;
|
new_vector[i] = vector[i] * -1;
|
||||||
|
|
||||||
return( new_vector );
|
return( new_vector );
|
||||||
@ -102,9 +105,10 @@ negate( std::vector<double> vector )
|
|||||||
std::vector<double>
|
std::vector<double>
|
||||||
invert( std::vector<double> vector )
|
invert( std::vector<double> vector )
|
||||||
{
|
{
|
||||||
std::vector<double> new_vector( vector.size() );
|
std::vector<double> new_vector;
|
||||||
|
new_vector.reserve( vector.size() );
|
||||||
|
|
||||||
for( unsigned int i = 0; i < vector.size(); i++ )
|
for( std::vector<double>::size_type i = 0; i < vector.size(); i++ )
|
||||||
new_vector[i] = 1.0 / vector[i];
|
new_vector[i] = 1.0 / vector[i];
|
||||||
|
|
||||||
return( new_vector );
|
return( new_vector );
|
||||||
@ -210,7 +214,6 @@ VOption::set( const char *name, std::vector<int> value )
|
|||||||
Pair *pair = new Pair( name );
|
Pair *pair = new Pair( name );
|
||||||
|
|
||||||
int *array;
|
int *array;
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
pair->input = true;
|
pair->input = true;
|
||||||
|
|
||||||
@ -219,7 +222,7 @@ VOption::set( const char *name, std::vector<int> value )
|
|||||||
static_cast< int >( value.size() ) );
|
static_cast< int >( value.size() ) );
|
||||||
array = vips_value_get_array_int( &pair->value, NULL );
|
array = vips_value_get_array_int( &pair->value, NULL );
|
||||||
|
|
||||||
for( i = 0; i < value.size(); i++ )
|
for( std::vector<double>::size_type i = 0; i < value.size(); i++ )
|
||||||
array[i] = value[i];
|
array[i] = value[i];
|
||||||
|
|
||||||
options.push_back( pair );
|
options.push_back( pair );
|
||||||
@ -234,7 +237,6 @@ VOption::set( const char *name, std::vector<double> value )
|
|||||||
Pair *pair = new Pair( name );
|
Pair *pair = new Pair( name );
|
||||||
|
|
||||||
double *array;
|
double *array;
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
pair->input = true;
|
pair->input = true;
|
||||||
|
|
||||||
@ -243,7 +245,7 @@ VOption::set( const char *name, std::vector<double> value )
|
|||||||
static_cast< int >( value.size() ) );
|
static_cast< int >( value.size() ) );
|
||||||
array = vips_value_get_array_double( &pair->value, NULL );
|
array = vips_value_get_array_double( &pair->value, NULL );
|
||||||
|
|
||||||
for( i = 0; i < value.size(); i++ )
|
for( std::vector<double>::size_type i = 0; i < value.size(); i++ )
|
||||||
array[i] = value[i];
|
array[i] = value[i];
|
||||||
|
|
||||||
options.push_back( pair );
|
options.push_back( pair );
|
||||||
@ -258,7 +260,6 @@ VOption::set( const char *name, std::vector<VImage> value )
|
|||||||
Pair *pair = new Pair( name );
|
Pair *pair = new Pair( name );
|
||||||
|
|
||||||
VipsImage **array;
|
VipsImage **array;
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
pair->input = true;
|
pair->input = true;
|
||||||
|
|
||||||
@ -267,7 +268,7 @@ VOption::set( const char *name, std::vector<VImage> value )
|
|||||||
static_cast< int >( value.size() ) );
|
static_cast< int >( value.size() ) );
|
||||||
array = vips_value_get_array_image( &pair->value, NULL );
|
array = vips_value_get_array_image( &pair->value, NULL );
|
||||||
|
|
||||||
for( i = 0; i < value.size(); i++ ) {
|
for( std::vector<double>::size_type i = 0; i < value.size(); i++ ) {
|
||||||
VipsImage *vips_image = value[i].get_image();
|
VipsImage *vips_image = value[i].get_image();
|
||||||
|
|
||||||
array[i] = vips_image;
|
array[i] = vips_image;
|
||||||
@ -488,10 +489,8 @@ VOption::get_operation( VipsOperation *operation )
|
|||||||
double *array =
|
double *array =
|
||||||
vips_value_get_array_double( value,
|
vips_value_get_array_double( value,
|
||||||
&length );
|
&length );
|
||||||
int j;
|
|
||||||
|
|
||||||
((*i)->vvector)->resize( length );
|
((*i)->vvector)->resize( length );
|
||||||
for( j = 0; j < length; j++ )
|
for( size_t j = 0; j < length; j++ )
|
||||||
(*((*i)->vvector))[j] = array[j];
|
(*((*i)->vvector))[j] = array[j];
|
||||||
}
|
}
|
||||||
else if( type == VIPS_TYPE_BLOB ) {
|
else if( type == VIPS_TYPE_BLOB ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user