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
1fd49b31
Commit
1fd49b31
authored
Apr 30, 2023
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace sprintf with string_printf.
Fixes #33. Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
9f94e591
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
12 deletions
+7
-12
syncfinder.cc
src/syncfinder.cc
+5
-6
syncfinder.hh
src/syncfinder.hh
+1
-1
utils.cc
src/utils.cc
+1
-5
No files found.
src/syncfinder.cc
View file @
1fd49b31
...
...
@@ -23,6 +23,7 @@
using
std
::
complex
;
using
std
::
vector
;
using
std
::
string
;
using
std
::
min
;
void
...
...
@@ -274,7 +275,7 @@ SyncFinder::search_refine (const WavData& wav_data, Mode mode, vector<Score>& sy
for
(
const
auto
&
score
:
sync_scores
)
{
//printf ("%zd %s %f", score.index, find_closest_sync (score.index), score.quality);
//printf ("%zd %s %f", score.index, find_closest_sync (score.index)
.c_str()
, score.quality);
// refine match
double
best_quality
=
score
.
quality
;
...
...
@@ -298,7 +299,7 @@ SyncFinder::search_refine (const WavData& wav_data, Mode mode, vector<Score>& sy
}
}
}
//printf (" => refined: %zd %s %f\n", best_index, find_closest_sync (best_index), best_quality);
//printf (" => refined: %zd %s %f\n", best_index, find_closest_sync (best_index)
.c_str()
, best_quality);
if
(
best_quality
>
Params
::
sync_threshold2
)
result_scores
.
push_back
(
Score
{
best_index
,
best_quality
,
best_block_type
});
}
...
...
@@ -406,7 +407,7 @@ SyncFinder::sync_fft (const WavData& wav_data, size_t index, size_t frame_count,
}
}
const
char
*
string
SyncFinder
::
find_closest_sync
(
size_t
index
)
{
int
wm_length
=
(
mark_data_frame_count
()
+
mark_sync_frame_count
())
*
Params
::
frame_size
;
...
...
@@ -423,7 +424,5 @@ SyncFinder::find_closest_sync (size_t index)
best_error
=
error
;
}
}
static
char
buffer
[
1024
];
// this code is for debugging only, so this should be ok
sprintf
(
buffer
,
"n:%d offset:%d"
,
best
,
int
(
index
)
-
(
wm_offset
+
best
*
wm_length
));
return
buffer
;
return
string_printf
(
"n:%d offset:%d"
,
best
,
int
(
index
)
-
(
wm_offset
+
best
*
wm_length
));
}
src/syncfinder.hh
View file @
1fd49b31
...
...
@@ -108,7 +108,7 @@ private:
std
::
vector
<
float
>&
fft_out_db
,
std
::
vector
<
char
>&
have_frames
,
const
std
::
vector
<
char
>&
want_frames
);
const
char
*
find_closest_sync
(
size_t
index
);
std
::
string
find_closest_sync
(
size_t
index
);
};
#endif
src/utils.cc
View file @
1fd49b31
...
...
@@ -111,12 +111,8 @@ vec_to_hex_str (const vector<unsigned char>& vec)
{
string
s
;
for
(
auto
byte
:
vec
)
{
char
buffer
[
256
];
s
+=
string_printf
(
"%02x"
,
byte
);
sprintf
(
buffer
,
"%02x"
,
byte
);
s
+=
buffer
;
}
return
s
;
}
...
...
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