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
4a606c33
Commit
4a606c33
authored
Nov 15, 2019
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Write A/B sync blocks.
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
9681f903
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
5 deletions
+30
-5
audiowmark.cc
src/audiowmark.cc
+30
-5
No files found.
src/audiowmark.cc
View file @
4a606c33
...
...
@@ -560,7 +560,7 @@ mark_sync (const WavData& wav_data, int start_frame, const vector<vector<complex
}
void
mark_sync_stream
(
int
frame_number
,
vector
<
vector
<
complex
<
float
>>>&
frame_fft
,
vector
<
vector
<
complex
<
float
>>>&
fft_delta_spect
,
int
ab
)
mark_sync_stream
(
int
frame_number
,
const
vector
<
vector
<
complex
<
float
>>>&
frame_fft
,
vector
<
vector
<
complex
<
float
>>>&
fft_delta_spect
,
int
ab
)
{
int
n_channels
=
frame_fft
.
size
();
for
(
int
ch
=
0
;
ch
<
n_channels
;
ch
++
)
...
...
@@ -704,8 +704,12 @@ add_watermark (const string& infile, const string& outfile, const string& bits)
fprintf
(
stderr
,
"audiowmark: error writing to -
\n
"
);
//%s: %s\n", outfile.c_str(), out_wav_data.error_blurb()); FIXME
return
1
;
}
enum
State
{
PAD
,
SYNC
,
DATA
}
state
=
State
::
PAD
;
int
frame_bound
=
Params
::
frames_pad_start
;
int
frame_number
=
0
;
int
ab
=
0
;
vector
<
float
>
samples
;
for
(
int
i
=
0
;
;
i
++
)
while
(
true
)
{
samples
=
in_stream
->
read_frames
(
Params
::
frame_size
);
if
(
samples
.
size
()
<
Params
::
frame_size
*
in_stream
->
n_channels
())
...
...
@@ -723,9 +727,7 @@ add_watermark (const string& infile, const string& outfile, const string& bits)
fft_delta_spect
.
push_back
(
vector
<
complex
<
float
>>
(
fft_out
.
back
().
size
()));
}
int
ab
=
0
;
// FIXME
int
frame_number
=
i
-
Params
::
frames_pad_start
;
if
(
frame_number
>=
0
)
if
(
state
==
State
::
SYNC
)
mark_sync_stream
(
frame_number
,
fft_out
,
fft_delta_spect
,
ab
);
for
(
int
ch
=
0
;
ch
<
wav_data
.
n_channels
();
ch
++
)
...
...
@@ -741,6 +743,29 @@ add_watermark (const string& infile, const string& outfile, const string& bits)
}
}
out_stream
->
write_frames
(
samples
);
if
(
frame_number
++
==
frame_bound
)
{
if
(
state
==
PAD
)
{
state
=
SYNC
;
frame_number
=
0
;
frame_bound
=
mark_sync_frame_count
();
}
else
if
(
state
==
SYNC
)
{
state
=
DATA
;
frame_number
=
0
;
frame_bound
=
mark_data_frame_count
();
}
else
if
(
state
==
DATA
)
{
state
=
SYNC
;
ab
=
(
ab
+
1
)
&
1
;
// write A|B|A|B|...
frame_number
=
0
;
frame_bound
=
mark_sync_frame_count
();
}
}
}
#if 0
vector<float> in_signal;
...
...
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