static float* compositeConvertFloats( const cv_converter* const conv, const float* const in, const size_t count, float* out) { if (conv == NULL || in == NULL || out == NULL) { out = NULL; } else { out = cv_convert_floats( conv->composite.second, cv_convert_floats(conv->composite.first, in, count, out), count, out); } return out; }
value ml_cv_convert_bigarray( value converter, value src, value dest ) { CAMLparam3( converter, src, dest ); int n; n = Bigarray_val( dest )->dim[0]; if ( n > Bigarray_val( src )->dim[0] ) { caml_raise_with_arg( *caml_named_value( "ut status exception" ), Val_int( UT_BAD_ARG ) ); } if ( (Bigarray_val( src )->flags & BIGARRAY_KIND_MASK) == BIGARRAY_FLOAT32 ) { cv_convert_floats( UD_cv_converter_val( converter ), Data_bigarray_val( src ), n, Data_bigarray_val( dest ) ); } else if ( (Bigarray_val( src )->flags & BIGARRAY_KIND_MASK) == BIGARRAY_FLOAT64 ) { cv_convert_doubles( UD_cv_converter_val( converter ), Data_bigarray_val( src ), n, Data_bigarray_val( dest ) ); } else { caml_raise_with_arg( *caml_named_value( "ut status exception" ), Val_int( UT_BAD_ARG ) ); } CAMLreturn( Val_unit ); }