Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
faust
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
faust group
faust
Commits
63ad747f
Commit
63ad747f
authored
4 years ago
by
hhakim
Browse files
Options
Downloads
Patches
Plain Diff
Add matfaust.Faust.save GPU2 wrapper.
parent
09fec4fb
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
wrapper/matlab/src/mexFaust.cpp.in
+3
-30
3 additions, 30 deletions
wrapper/matlab/src/mexFaust.cpp.in
wrapper/matlab/src/mexFaustGPU.cpp.in
+4
-1
4 additions, 1 deletion
wrapper/matlab/src/mexFaustGPU.cpp.in
wrapper/matlab/tools/faust2Mx.hpp
+2
-2
2 additions, 2 deletions
wrapper/matlab/tools/faust2Mx.hpp
with
9 additions
and
33 deletions
wrapper/matlab/src/mexFaust.cpp.in
+
3
−
30
View file @
63ad747f
...
...
@@ -75,14 +75,13 @@
#include "faust_numfactors.h"
#include "faust_factors.h"
#include "faust_rand.h"
#include "faust_save.h"
typedef @FAUST_SCALAR@ SCALAR;
typedef @FAUST_FPP@ FPP;
using namespace Faust;
void save(Faust::TransformHelper<SCALAR,Cpu>* core_ptr, int nargs, const mxArray **args);
template<typename T>
void fourierFaust(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]);
...
...
@@ -131,7 +130,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
if(!strcmp("rand", cmd))
{
faust_rand<
FPP
,Cpu>(prhs, nrhs, plhs, nlhs);
faust_rand<
SCALAR
,Cpu>(prhs, nrhs, plhs, nlhs);
return;
}
//TODO: hadamard, fourier, and proxs must be in there own mex function (one for hadamard and fourier, another for the prox)
...
...
@@ -501,7 +500,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
}
if(!strcmp("save", cmd))
return
save(convertMat2Ptr<Faust::TransformHelper<SCALAR
,Cpu>
>
(prhs
[1])
, nrhs
-2, &prhs[2]
);
return
faust_save<FPP
,Cpu>(prhs, nrhs
, plhs, nlhs
);
if(!strcmp("transpose", cmd)) { //TODO: verify no arguments passed or
Faust::TransformHelper<SCALAR,Cpu>* th = core_ptr->transpose();
...
...
@@ -696,32 +695,6 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
}
}
void save(Faust::TransformHelper<SCALAR,Cpu>* core_ptr, int nargs, const mxArray **args)
{
const size_t MAX_PATH_SIZE=512;
char filepath[MAX_PATH_SIZE];
// args[0] must be the filepath
// args[1] must be the boolean for tranposing or not at write time
// nargs the number of arguments in args (must be 2)
if(nargs != 1){
mexErrMsgTxt("The number of arguments for the save function is not valid.");
return;
}
if(mxGetString(args[0], filepath, sizeof(filepath)) || strlen(filepath) == 0){
mexErrMsgTxt("The filepath is not valid.");
return;
}
// printf("save: filepath = %s, nargs = %d\n", filepath, nargs);
try
{
core_ptr->save_mat_file(filepath/*, mxGetScalar(args[1])*/);
}
catch(exception& e)
{
mexErrMsgTxt("Failed to save the file.");
}
}
template<typename T>
void fourierFaust(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
...
...
This diff is collapsed.
Click to expand it.
wrapper/matlab/src/mexFaustGPU.cpp.in
+
4
−
1
View file @
63ad747f
...
...
@@ -75,6 +75,7 @@
#include "faust_gpu_mod_utils.h"
#include "faust_TransformHelper_gpu.h"
#include "faust_rand.h"
#include "faust_save.h"
typedef @FAUST_SCALAR@ SCALAR;
typedef @FAUST_FPP@ FPP;
...
...
@@ -110,7 +111,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
if (!strcmp("new", cmd))
new_faust<SCALAR,GPU2>(prhs, nrhs, plhs, nlhs);
else if(!strcmp("rand", cmd))
faust_rand<
FPP
,GPU2>(prhs, nrhs, plhs, nlhs);
faust_rand<
SCALAR
,GPU2>(prhs, nrhs, plhs, nlhs);
else if (! strcmp("disp",cmd))
faust_disp<SCALAR,GPU2>(prhs, nrhs, plhs, nlhs);
else if (!strcmp("delete", cmd))
...
...
@@ -133,6 +134,8 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
faust_numfactors<SCALAR, GPU2>(prhs, nrhs, plhs, nlhs);
else if (!strcmp("factors", cmd))
faust_factors<SCALAR, GPU2>(prhs, nrhs, plhs, nlhs);
else if (!strcmp("save", cmd))
faust_save<SCALAR, GPU2>(prhs, nrhs, plhs, nlhs);
}
catch (const std::exception& e)
...
...
This diff is collapsed.
Click to expand it.
wrapper/matlab/tools/faust2Mx.hpp
+
2
−
2
View file @
63ad747f
...
...
@@ -400,9 +400,9 @@ mxArray* transformFact2FullMxArray(faust_unsigned_int id, Faust::TransformHelper
}
else
{
const
complex
<
FPP
>*
src_data_ptr
;
complex
<
FPP
>*
src_data_ptr
;
//not calling the same prototype of get_fact() called in transpose case (and real version of this function)
core_ptr
->
get_fact
(
id
,
&
src_data_ptr
,
&
num_rows
,
&
num_cols
);
core_ptr
->
get_fact
(
id
,
src_data_ptr
,
&
num_rows
,
&
num_cols
);
splitComplexPtr
(
src_data_ptr
,
num_rows
*
num_cols
,
data_ptr
,
img_data_ptr
,
core_ptr
->
isConjugate
());
//let conjugate to false because it's handled internally by get_fact()
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment