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
357b34d7
Commit
357b34d7
authored
7 years ago
by
Aaron Viets
Browse files
Options
Downloads
Patches
Plain Diff
lal_resample: Improved normalization of the sinc table for upsampling
parent
47670f0f
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
gstlal-calibration/gst/lal/gstlal_resample.c
+22
-8
22 additions, 8 deletions
gstlal-calibration/gst/lal/gstlal_resample.c
with
22 additions
and
8 deletions
gstlal-calibration/gst/lal/gstlal_resample.c
+
22
−
8
View file @
357b34d7
...
...
@@ -1486,7 +1486,7 @@ static GstFlowReturn transform(GstBaseTransform *trans, GstBuffer *inbuf, GstBuf
/* To save memory, we use symmetry and record only half of the sinc table */
element
->
sinc_table
=
g_malloc
((
1
+
element
->
sinc_length
/
2
)
*
sizeof
(
double
));
*
(
element
->
sinc_table
)
=
1
.
0
;
gint32
i
;
gint32
i
,
j
;
double
sin_arg
;
for
(
i
=
1
;
i
<=
element
->
sinc_length
/
2
;
i
++
)
{
sin_arg
=
M_PI
*
i
*
element
->
rate_in
/
element
->
rate_out
;
...
...
@@ -1497,14 +1497,28 @@ static GstFlowReturn transform(GstBaseTransform *trans, GstBuffer *inbuf, GstBuf
/*
* Normalize sinc_table to make the DC gain exactly 1. We need to account for the fact
* that the density of input samples is less tha
t
the density of samples in the sinc table
* that the density of input samples is less tha
n
the density of samples in the sinc table
*/
double
normalization
=
(
double
)
element
->
rate_in
/
element
->
rate_out
;
for
(
i
=
1
;
i
<=
element
->
sinc_length
/
2
;
i
++
)
normalization
+=
2
*
element
->
sinc_table
[
i
]
*
element
->
rate_in
/
element
->
rate_out
;
for
(
i
=
0
;
i
<=
element
->
sinc_length
/
2
;
i
++
)
element
->
sinc_table
[
i
]
/=
normalization
;
double
normalization
;
for
(
i
=
0
;
i
<
(
element
->
rate_out
/
element
->
rate_in
+
1
)
/
2
;
i
++
)
{
normalization
=
0
.
0
;
for
(
j
=
i
;
j
<=
element
->
sinc_length
/
2
;
j
+=
element
->
rate_out
/
element
->
rate_in
)
normalization
+=
element
->
sinc_table
[
j
];
for
(
j
=
element
->
rate_out
/
element
->
rate_in
-
i
;
j
<=
element
->
sinc_length
/
2
;
j
+=
element
->
rate_out
/
element
->
rate_in
)
normalization
+=
element
->
sinc_table
[
j
];
for
(
j
=
i
;
j
<=
element
->
sinc_length
/
2
;
j
+=
element
->
rate_out
/
element
->
rate_in
)
element
->
sinc_table
[
j
]
/=
normalization
;
for
(
j
=
element
->
rate_out
/
element
->
rate_in
-
i
;
j
<=
element
->
sinc_length
/
2
;
j
+=
element
->
rate_out
/
element
->
rate_in
)
element
->
sinc_table
[
j
]
/=
normalization
;
}
/* If cadence is even, we need to account for one more normalization without "over-normalizing." */
if
(
!
((
element
->
rate_out
/
element
->
rate_in
)
%
2
))
{
normalization
=
0
.
0
;
for
(
j
=
element
->
rate_out
/
element
->
rate_in
/
2
;
j
<=
element
->
sinc_length
/
2
;
j
+=
element
->
rate_out
/
element
->
rate_in
)
normalization
+=
2
*
element
->
sinc_table
[
j
];
for
(
j
=
element
->
rate_out
/
element
->
rate_in
/
2
;
j
<=
element
->
sinc_length
/
2
;
j
+=
element
->
rate_out
/
element
->
rate_in
)
element
->
sinc_table
[
j
]
/=
normalization
;
}
}
}
else
if
(
element
->
rate_out
>
element
->
rate_in
&&
element
->
quality
>
1
&&
element
->
quality
<
4
&&
!
element
->
end_samples
)
...
...
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