Commit 66333870 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 09e50c8d
......@@ -593,6 +593,15 @@ parse_get_options (ArgParser& ap)
{
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))
{
Params::test_speed = f;
......
......@@ -26,6 +26,7 @@ bool Params::mix = true;
bool Params::hard = false; // hard decode bits? (soft decoding is better)
bool Params::snr = false; // compute/show snr while adding watermark
bool Params::detect_speed = false;
double Params::try_speed = -1;
double Params::test_speed = -1;
int Params::have_key = 0;
size_t Params::payload_size = 128;
......
......@@ -46,6 +46,7 @@ public:
static int have_key;
static bool detect_speed;
static double try_speed; // manual speed correction
static double test_speed; // for debugging --detect-speed
static size_t payload_size; // number of payload bits for the watermark
......
......@@ -549,9 +549,13 @@ 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)
* 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)
{
double speed = detect_speed (wav_data, !orig_pattern.empty());
double speed;
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
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