Skip to content
Snippets Groups Projects
Commit 51f6c511 authored by Nicola Vigano's avatar Nicola Vigano
Browse files

Mex/C++: reverted back to relying on RTO

parent e30a18de
No related branches found
No related tags found
No related merge requests found
......@@ -56,7 +56,7 @@ namespace dct {
static DctProjectionVector<Type, MatlabAllocator<Type> > create_collection_from_dims(const mxArray * const);
template<typename Type>
static void import_coefficients(DctProjectionTransformCoefficients<Type> & out, const mxArray * const);
static DctProjectionTransformCoefficients<Type> import_coefficients(const mxArray * const);
template<typename Type>
static std::vector<DctProjectionTransformCoefficients<Type> > import_coefficients_list(const mxArray * const);
......@@ -181,9 +181,11 @@ namespace dct {
}
template<typename Type>
void
DctMatlabData::import_coefficients(DctProjectionTransformCoefficients<Type> & output, const mxArray * const coeff)
DctProjectionTransformCoefficients<Type>
DctMatlabData::import_coefficients(const mxArray * const coeff)
{
DctProjectionTransformCoefficients<Type> output;
if (!mxIsStruct(coeff)) {
throw WrongArgumentException("Invalid Coeffs: third argument should be a structure!");
}
......@@ -244,6 +246,8 @@ namespace dct {
const double * const coeffs = (const double *) mxGetData(proj_coeffs_a);
std::copy(coeffs, coeffs + num_elems, output.coeff.begin());
return output;
}
template<typename Type>
......@@ -253,11 +257,11 @@ namespace dct {
std::vector<DctProjectionTransformCoefficients<Type> > output;
const mwSize num_coeff_structs = mxGetNumberOfElements(coeffs);
output.resize(num_coeff_structs);
output.reserve(num_coeff_structs);
for (mwIndex num_struct = 0; num_struct < num_coeff_structs; num_struct++) {
const mxArray * const coeff_cell = mxGetCell(coeffs, num_struct);
DctMatlabData::import_coefficients<Type>(output[num_struct], coeff_cell);
output.emplace_back(DctMatlabData::import_coefficients<Type>(coeff_cell));
}
return output;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment