Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
audiowmark
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
audiowmark
Commits
db4a1307
Commit
db4a1307
authored
Dec 13, 2020
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use common hamming window function code via wmcommon.hh.
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
e2d67c4b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
30 deletions
+18
-30
TODO
src/TODO
+0
-2
wmcommon.cc
src/wmcommon.cc
+0
-17
wmcommon.hh
src/wmcommon.hh
+17
-0
wmspeed.cc
src/wmspeed.cc
+1
-11
No files found.
src/TODO
View file @
db4a1307
...
@@ -2,10 +2,8 @@ speed detection:
...
@@ -2,10 +2,8 @@ speed detection:
- double decode
- double decode
- maybe truncate cleanup
- maybe truncate cleanup
- remove pad start scaling
- remove pad start scaling
- average speed if more than one best-quality 50s estimate is produced
- test code
- test code
- document in README
- document in README
- analyze remaining variants
possible improvements:
possible improvements:
- dynamic bit strength
- dynamic bit strength
...
...
src/wmcommon.cc
View file @
db4a1307
...
@@ -49,23 +49,6 @@ std::string Params::output_label;
...
@@ -49,23 +49,6 @@ std::string Params::output_label;
using
std
::
vector
;
using
std
::
vector
;
using
std
::
complex
;
using
std
::
complex
;
inline
double
window_cos
(
double
x
)
/* von Hann window */
{
if
(
fabs
(
x
)
>
1
)
return
0
;
return
0.5
*
cos
(
x
*
M_PI
)
+
0.5
;
}
inline
double
window_hamming
(
double
x
)
/* sharp (rectangle) cutoffs at boundaries */
{
if
(
fabs
(
x
)
>
1
)
return
0
;
return
0.54
+
0.46
*
cos
(
M_PI
*
x
);
}
/*
/*
* glibc log2f is a lot faster than glibc log10
* glibc log2f is a lot faster than glibc log10
*/
*/
...
...
src/wmcommon.hh
View file @
db4a1307
...
@@ -168,6 +168,23 @@ randomize_bit_order (const std::vector<T>& bit_vec, bool encode)
...
@@ -168,6 +168,23 @@ randomize_bit_order (const std::vector<T>& bit_vec, bool encode)
return
out_bits
;
return
out_bits
;
}
}
inline
double
window_cos
(
double
x
)
/* von Hann window */
{
if
(
fabs
(
x
)
>
1
)
return
0
;
return
0.5
*
cos
(
x
*
M_PI
)
+
0.5
;
}
inline
double
window_hamming
(
double
x
)
/* sharp (rectangle) cutoffs at boundaries */
{
if
(
fabs
(
x
)
>
1
)
return
0
;
return
0.54
+
0.46
*
cos
(
M_PI
*
x
);
}
int
add_stream_watermark
(
AudioInputStream
*
in_stream
,
AudioOutputStream
*
out_stream
,
const
std
::
string
&
bits
,
size_t
zero_frames
);
int
add_stream_watermark
(
AudioInputStream
*
in_stream
,
AudioOutputStream
*
out_stream
,
const
std
::
string
&
bits
,
size_t
zero_frames
);
int
add_watermark
(
const
std
::
string
&
infile
,
const
std
::
string
&
outfile
,
const
std
::
string
&
bits
);
int
add_watermark
(
const
std
::
string
&
infile
,
const
std
::
string
&
outfile
,
const
std
::
string
&
bits
);
int
get_watermark
(
const
std
::
string
&
infile
,
const
std
::
string
&
orig_pattern
);
int
get_watermark
(
const
std
::
string
&
infile
,
const
std
::
string
&
orig_pattern
);
...
...
src/wmspeed.cc
View file @
db4a1307
...
@@ -133,17 +133,6 @@ public:
...
@@ -133,17 +133,6 @@ public:
}
}
};
};
/* FIXME: is this the best choice */
inline
double
window_hamming
(
double
x
)
/* sharp (rectangle) cutoffs at boundaries */
{
if
(
fabs
(
x
)
>
1
)
return
0
;
return
0.54
+
0.46
*
cos
(
M_PI
*
x
);
}
void
void
SpeedSync
::
prepare_mags
()
SpeedSync
::
prepare_mags
()
{
{
...
@@ -161,6 +150,7 @@ SpeedSync::prepare_mags()
...
@@ -161,6 +150,7 @@ SpeedSync::prepare_mags()
{
{
const
double
fsize_2
=
sub_frame_size
/
2.0
;
const
double
fsize_2
=
sub_frame_size
/
2.0
;
// const double win = window_cos ((i - fsize_2) / fsize_2);
// const double win = window_cos ((i - fsize_2) / fsize_2);
/* FIXME: is this the best choice */
const
double
win
=
window_hamming
((
i
-
fsize_2
)
/
fsize_2
);
const
double
win
=
window_hamming
((
i
-
fsize_2
)
/
fsize_2
);
//const double win = 1;
//const double win = 1;
window
[
i
]
=
win
;
window
[
i
]
=
win
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment