Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GstLAL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
lscsoft
GstLAL
Commits
e308c1c2
Commit
e308c1c2
authored
15 years ago
by
kipp
Browse files
Options
Downloads
Patches
Plain Diff
fix gap boundaries in output
parent
14307449
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/gstlal_autochisq.c
+13
-11
13 additions, 11 deletions
src/plugins/gstlal_autochisq.c
src/plugins/gstlal_autochisq.h
+1
-1
1 addition, 1 deletion
src/plugins/gstlal_autochisq.h
with
14 additions
and
12 deletions
src/plugins/gstlal_autochisq.c
+
13
−
11
View file @
e308c1c2
...
...
@@ -375,7 +375,7 @@ static gboolean start (GstBaseTransform *trans)
{
Gstlalautochisq
*
element
=
GST_LAL_AUTOCHISQ
(
trans
);
element
->
adapter
=
gst_adapter_new
();
element
->
adapter_is_empty
=
TRUE
;
element
->
zeros_in_adapter
=
0
;
element
->
t0
=
GST_CLOCK_TIME_NONE
;
element
->
offset0
=
GST_BUFFER_OFFSET_NONE
;
element
->
next_in_offset
=
GST_BUFFER_OFFSET_NONE
;
...
...
@@ -404,10 +404,13 @@ static gboolean stop (GstBaseTransform *trans)
static
int
push_zeros
(
Gstlalautochisq
*
element
,
int
samples
)
{
GstBuffer
*
zerobuf
=
gst_buffer_new_and_alloc
(
samples
*
element
->
channels
*
sizeof
(
complex
double
));
if
(
!
zerobuf
)
if
(
!
zerobuf
)
{
GST_DEBUG_OBJECT
(
element
,
"failure allocating zero padding buffer"
);
return
-
1
;
}
memset
(
GST_BUFFER_DATA
(
zerobuf
),
0
,
GST_BUFFER_SIZE
(
zerobuf
));
gst_adapter_push
(
element
->
adapter
,
zerobuf
);
element
->
zeros_in_adapter
+=
samples
;
return
0
;
}
...
...
@@ -446,7 +449,6 @@ static void diag_dump_close(FILE *f)
}
static
GstFlowReturn
chisquared
(
GstBuffer
*
outbuf
,
Gstlalautochisq
*
element
)
{
/* Takes the required number of samples out of the adapter */
...
...
@@ -495,8 +497,12 @@ diag_dump_close(f);
#endif
}
gst_adapter_flush
(
element
->
adapter
,
outsamples
*
element
->
channels
*
sizeof
(
*
indata
));
GST_BUFFER_FLAG_UNSET
(
outbuf
,
GST_BUFFER_FLAG_GAP
);
set_metadata
(
element
,
outbuf
,
outsamples
);
if
(
outsamples
>
insamples
-
element
->
zeros_in_adapter
)
element
->
zeros_in_adapter
-=
outsamples
-
(
insamples
-
element
->
zeros_in_adapter
);
return
GST_FLOW_OK
;
}
...
...
@@ -523,14 +529,14 @@ static GstFlowReturn transform (GstBaseTransform *trans, GstBuffer *inbuf, GstBu
* FIXME: flush/pad adapter as needed
*/
if
(
GST_BUFFER_OFFSET
(
inbuf
)
!=
element
->
next_in_offset
||
element
->
need_discont
||
!
GST_CLOCK_TIME_IS_VALID
(
element
->
t0
))
{
if
(
GST_BUFFER_OFFSET
(
inbuf
)
!=
element
->
next_in_offset
||
!
GST_CLOCK_TIME_IS_VALID
(
element
->
t0
))
{
/*
* flush adapter, pad with zeros
*/
gst_adapter_clear
(
element
->
adapter
);
element
->
zeros_in_adapter
=
0
;
push_zeros
(
element
,
(
autocorrelation_samples
(
element
)
-
1
)
/
2
);
element
->
adapter_is_empty
=
TRUE
;
/*
* (re)sync timestamp and offset book-keeping
...
...
@@ -556,9 +562,9 @@ static GstFlowReturn transform (GstBaseTransform *trans, GstBuffer *inbuf, GstBu
if
(
!
GST_BUFFER_FLAG_IS_SET
(
inbuf
,
GST_BUFFER_FLAG_GAP
))
{
gst_buffer_ref
(
inbuf
);
/* don't let the adapter free it */
gst_adapter_push
(
element
->
adapter
,
inbuf
);
element
->
adapter_is_empty
=
FALSE
;
element
->
zeros_in_adapter
=
0
;
result
=
chisquared
(
outbuf
,
element
);
}
else
if
(
element
->
adapter_is_empty
)
{
}
else
if
(
element
->
zeros_in_adapter
>=
autocorrelation_samples
(
element
)
-
1
)
{
/* base transform has given us an output buffer that is the same size
* as the input buffer, which is the size we need now. all we have to
* do is make it a gap */
...
...
@@ -568,9 +574,6 @@ static GstFlowReturn transform (GstBaseTransform *trans, GstBuffer *inbuf, GstBu
result
=
GST_FLOW_OK
;
}
else
if
(
length
<=
autocorrelation_samples
(
element
)
-
1
)
{
/* push length zeroes in the adapter and run normal \chi^{2} code */
/* FIXME: if this is done enough times in a row eventually the adapter
* will be empty and element->adapter_empty should be set to TRUE to
* switch to a faster code path */
push_zeros
(
element
,
length
);
result
=
chisquared
(
outbuf
,
element
);
}
else
{
...
...
@@ -591,7 +594,6 @@ static GstFlowReturn transform (GstBaseTransform *trans, GstBuffer *inbuf, GstBu
return
result
;
result
=
chisquared
(
buf
,
element
);
g_assert
(
result
==
GST_FLOW_OK
);
element
->
adapter_is_empty
=
TRUE
;
result
=
gst_pad_push
(
srcpad
,
buf
);
if
(
result
!=
GST_FLOW_OK
)
return
result
;
...
...
This diff is collapsed.
Click to expand it.
src/plugins/gstlal_autochisq.h
+
1
−
1
View file @
e308c1c2
...
...
@@ -87,7 +87,7 @@ struct _Gstlalautochisq
gsl_matrix_complex
*
A
;
gsl_vector
*
norm
;
GstAdapter
*
adapter
;
g
boolean
adapter_is_empty
;
g
int
zeros_in_adapter
;
GstClockTime
t0
;
guint64
offset0
;
...
...
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