content/media/webspeech/recognition/energy_endpointer_params.cc

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/media/webspeech/recognition/energy_endpointer_params.cc	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,77 @@
     1.4 +// Copyright (c) 2013 The Chromium Authors. All rights reserved.
     1.5 +//
     1.6 +// Redistribution and use in source and binary forms, with or without
     1.7 +// modification, are permitted provided that the following conditions are
     1.8 +// met:
     1.9 +//
    1.10 +//    * Redistributions of source code must retain the above copyright
    1.11 +// notice, this list of conditions and the following disclaimer.
    1.12 +//    * Redistributions in binary form must reproduce the above
    1.13 +// copyright notice, this list of conditions and the following disclaimer
    1.14 +// in the documentation and/or other materials provided with the
    1.15 +// distribution.
    1.16 +//    * Neither the name of Google Inc. nor the names of its
    1.17 +// contributors may be used to endorse or promote products derived from
    1.18 +// this software without specific prior written permission.
    1.19 +//
    1.20 +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    1.21 +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    1.22 +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    1.23 +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    1.24 +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.25 +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    1.26 +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    1.27 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    1.28 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    1.29 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    1.30 +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1.31 +
    1.32 +#include "energy_endpointer_params.h"
    1.33 +
    1.34 +namespace mozilla {
    1.35 +
    1.36 +EnergyEndpointerParams::EnergyEndpointerParams() {
    1.37 +  SetDefaults();
    1.38 +}
    1.39 +
    1.40 +void EnergyEndpointerParams::SetDefaults() {
    1.41 +  frame_period_ = 0.01f;
    1.42 +  frame_duration_ = 0.01f;
    1.43 +  endpoint_margin_ = 0.2f;
    1.44 +  onset_window_ = 0.15f;
    1.45 +  speech_on_window_ = 0.4f;
    1.46 +  offset_window_ = 0.15f;
    1.47 +  onset_detect_dur_ = 0.09f;
    1.48 +  onset_confirm_dur_ = 0.075f;
    1.49 +  on_maintain_dur_ = 0.10f;
    1.50 +  offset_confirm_dur_ = 0.12f;
    1.51 +  decision_threshold_ = 150.0f;
    1.52 +  min_decision_threshold_ = 50.0f;
    1.53 +  fast_update_dur_ = 0.2f;
    1.54 +  sample_rate_ = 8000.0f;
    1.55 +  min_fundamental_frequency_ = 57.143f;
    1.56 +  max_fundamental_frequency_ = 400.0f;
    1.57 +  contamination_rejection_period_ = 0.25f;
    1.58 +}
    1.59 +
    1.60 +void EnergyEndpointerParams::operator=(const EnergyEndpointerParams& source) {
    1.61 +  frame_period_ = source.frame_period();
    1.62 +  frame_duration_ = source.frame_duration();
    1.63 +  endpoint_margin_ = source.endpoint_margin();
    1.64 +  onset_window_ = source.onset_window();
    1.65 +  speech_on_window_ = source.speech_on_window();
    1.66 +  offset_window_ = source.offset_window();
    1.67 +  onset_detect_dur_ = source.onset_detect_dur();
    1.68 +  onset_confirm_dur_ = source.onset_confirm_dur();
    1.69 +  on_maintain_dur_ = source.on_maintain_dur();
    1.70 +  offset_confirm_dur_ = source.offset_confirm_dur();
    1.71 +  decision_threshold_ = source.decision_threshold();
    1.72 +  min_decision_threshold_ = source.min_decision_threshold();
    1.73 +  fast_update_dur_ = source.fast_update_dur();
    1.74 +  sample_rate_ = source.sample_rate();
    1.75 +  min_fundamental_frequency_ = source.min_fundamental_frequency();
    1.76 +  max_fundamental_frequency_ = source.max_fundamental_frequency();
    1.77 +  contamination_rejection_period_ = source.contamination_rejection_period();
    1.78 +}
    1.79 +
    1.80 +}  //  namespace mozilla

mercurial