Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
purr-data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
brittney allen
purr-data
Commits
6cc1baf1
Commit
6cc1baf1
authored
5 years ago
by
Jonathan Wilkes
Browse files
Options
Downloads
Patches
Plain Diff
fix partconv crashers in bsaylor lib and add perfroutine for array errors
parent
d7ce38f0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
externals/bsaylor/partconv~.c
+31
-13
31 additions, 13 deletions
externals/bsaylor/partconv~.c
with
31 additions
and
13 deletions
externals/bsaylor/partconv~.c
+
31
−
13
View file @
6cc1baf1
...
...
@@ -65,6 +65,7 @@ typedef struct _partconv {
int
nbins
;
int
nparts
;
int
ir_prepared
;
int
hosed
;
/* set if our array doesn't exist */
int
pd_blocksize
;
// partitions of impulse response
...
...
@@ -121,6 +122,16 @@ static void partconv_deal_work(t_partconv *x)
#include
"altivec-perform.inc.c"
#else
static
t_int
*
partconv_perform_hosed
(
t_int
*
w
)
{
t_float
*
out
=
(
t_float
*
)(
w
[
3
]);
int
n
=
(
int
)(
w
[
4
]);
int
i
;
for
(
i
=
0
;
i
<
n
;
i
++
)
out
[
i
]
=
0
;
return
(
w
+
5
);
}
static
t_int
*
partconv_perform
(
t_int
*
w
)
{
t_partconv
*
x
=
(
t_partconv
*
)(
w
[
1
]);
...
...
@@ -132,7 +143,6 @@ static t_int *partconv_perform(t_int *w)
int
k
;
// bin
int
p
;
// partition
int
endpart
;
#ifdef USE_SSE
int
v1
;
int
v2
;
...
...
@@ -148,7 +158,6 @@ static t_int *partconv_perform(t_int *w)
float
*
sumbuf1ptr
;
float
*
sumbuf2ptr
;
memcpy
(
&
(
x
->
inbuf
[
x
->
inbufpos
]),
in
,
n
*
sizeof
(
float
));
// gather a block of input into input buffer
x
->
inbufpos
+=
n
;
if
(
x
->
inbufpos
>=
x
->
partsize
)
{
...
...
@@ -235,13 +244,12 @@ static t_int *partconv_perform(t_int *w)
static
void
partconv_free
(
t_partconv
*
x
)
{
int
i
;
fftwf_free
(
x
->
inbuf
);
for
(
i
=
0
;
i
<
x
->
nparts
;
i
++
)
fftwf_free
(
x
->
irpart_td
[
i
]);
fftwf_free
(
x
->
input_td
);
fftwf_destroy_plan
(
x
->
input_plan
);
for
(
i
=
0
;
i
<
x
->
nsumbufs
;
i
++
)
{
for
(
i
=
0
;
i
<
x
->
nsumbufs
;
i
++
)
{
fftwf_free
(
x
->
sumbufs
[
i
].
fd
);
fftwf_destroy_plan
(
x
->
sumbufs
[
i
].
plan
);
}
...
...
@@ -259,20 +267,25 @@ static void partconv_set(t_partconv *x, t_symbol *s)
// get the array from pd
x
->
arrayname
=
s
;
if
(
!
(
arrayobj
=
(
t_garray
*
)
pd_findbyclass
(
x
->
arrayname
,
garray_class
)))
{
if
(
*
x
->
arrayname
->
s_name
)
{
pd_error
(
x
,
"partconv~: %s: no such array"
,
x
->
arrayname
->
s_name
);
return
;
}
x
->
hosed
=
1
;
if
(
x
->
arrayname
&&
*
x
->
arrayname
->
s_name
)
pd_error
(
x
,
"partconv~: %s: no such array"
,
x
->
arrayname
->
s_name
);
else
pd_error
(
x
,
"partconv~: need an array name"
);
return
;
}
else
if
(
!
garray_getfloatarray
(
arrayobj
,
&
arraysize
,
&
array
))
{
x
->
hosed
=
1
;
pd_error
(
x
,
"%s: bad template"
,
x
->
arrayname
->
s_name
);
return
;
}
else
{
x
->
hosed
=
0
;
}
// if the IR has already been prepared, free everything first
if
(
x
->
ir_prepared
==
1
)
{
partconv_free
(
x
);
}
// caculate number of partitions
x
->
nparts
=
arraysize
/
x
->
partsize
;
if
(
arraysize
%
x
->
partsize
!=
0
)
...
...
@@ -336,8 +349,12 @@ static void partconv_dsp(t_partconv *x, t_signal **sp)
if
(
x
->
ir_prepared
==
0
)
{
partconv_set
(
x
,
x
->
arrayname
);
}
dsp_add
(
partconv_perform
,
4
,
x
,
sp
[
0
]
->
s_vec
,
sp
[
1
]
->
s_vec
,
(
t_int
)
sp
[
0
]
->
s_n
);
if
(
x
->
hosed
)
dsp_add
(
partconv_perform_hosed
,
4
,
x
,
sp
[
0
]
->
s_vec
,
sp
[
1
]
->
s_vec
,
(
t_int
)
sp
[
0
]
->
s_n
);
else
dsp_add
(
partconv_perform
,
4
,
x
,
sp
[
0
]
->
s_vec
,
sp
[
1
]
->
s_vec
,
(
t_int
)
sp
[
0
]
->
s_n
);
}
static
void
*
partconv_new
(
t_symbol
*
s
,
int
argc
,
t_atom
*
argv
)
...
...
@@ -352,11 +369,12 @@ static void *partconv_new(t_symbol *s, int argc, t_atom *argv)
instantiate and get to the help patch */
if
(
!
argc
)
{
post
(
"partconv~: warning: no arguments given"
);
SETSYMBOL
(
sane_defaults
,
&
s_
);
SETFLOAT
(
sane_defaults
+
1
,
2
.);
SETFLOAT
(
sane_defaults
+
1
,
64
.);
argc
=
2
;
argv
=
sane_defaults
;
pd_error
(
x
,
"partconv~: no arguments given. Setting some "
"sane defaults to keep Purr Data from crashing."
);
}
else
{
...
...
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