Commit 58820005 authored by Stefan Westerfeld's avatar Stefan Westerfeld

Add audiowmark get --try-speed option for testing.

Signed-off-by: Stefan Westerfeld's avatarStefan Westerfeld <stefan@space.twc.de>
parent 83e9291d
...@@ -599,6 +599,15 @@ parse_get_options (ArgParser& ap) ...@@ -599,6 +599,15 @@ parse_get_options (ArgParser& ap)
{ {
Params::detect_speed = true; Params::detect_speed = true;
} }
if (ap.parse_opt ("--try-speed", f))
{
if (Params::detect_speed)
{
error ("audiowmark: can not use both options: --detect-speed and --try-speed\n");
exit (1);
}
Params::try_speed = f;
}
if (ap.parse_opt ("--test-speed", f)) if (ap.parse_opt ("--test-speed", f))
{ {
Params::test_speed = f; Params::test_speed = f;
......
...@@ -26,6 +26,7 @@ bool Params::mix = true; ...@@ -26,6 +26,7 @@ bool Params::mix = true;
bool Params::hard = false; // hard decode bits? (soft decoding is better) bool Params::hard = false; // hard decode bits? (soft decoding is better)
bool Params::snr = false; // compute/show snr while adding watermark bool Params::snr = false; // compute/show snr while adding watermark
bool Params::detect_speed = false; bool Params::detect_speed = false;
double Params::try_speed = -1;
double Params::test_speed = -1; double Params::test_speed = -1;
int Params::have_key = 0; int Params::have_key = 0;
size_t Params::payload_size = 128; size_t Params::payload_size = 128;
......
...@@ -47,6 +47,7 @@ public: ...@@ -47,6 +47,7 @@ public:
static int have_key; static int have_key;
static bool detect_speed; static bool detect_speed;
static double try_speed; // manual speed correction
static double test_speed; // for debugging --detect-speed static double test_speed; // for debugging --detect-speed
static size_t payload_size; // number of payload bits for the watermark static size_t payload_size; // number of payload bits for the watermark
......
...@@ -602,9 +602,12 @@ decode_and_report (const WavData& wav_data, const string& orig_pattern) ...@@ -602,9 +602,12 @@ decode_and_report (const WavData& wav_data, const string& orig_pattern)
* The reason to do it this way is that the detected speed may be wrong (on short clips) * The reason to do it this way is that the detected speed may be wrong (on short clips)
* and we don't want to loose a successful clip decoder match in this case. * and we don't want to loose a successful clip decoder match in this case.
*/ */
if (Params::detect_speed) if (Params::detect_speed || Params::try_speed > 0)
{ {
speed = detect_speed (wav_data, !orig_pattern.empty()); if (Params::detect_speed)
speed = detect_speed (wav_data, !orig_pattern.empty());
else
speed = Params::try_speed;
// speeds closer to 1.0 than this usually work without stretching before decode // speeds closer to 1.0 than this usually work without stretching before decode
if (speed < 0.9999 || speed > 1.0001) if (speed < 0.9999 || speed > 1.0001)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment