content/media/webspeech/recognition/energy_endpointer_params.h

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.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,159 @@
     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 +#ifndef CONTENT_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_PARAMS_H_
    1.33 +#define CONTENT_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_PARAMS_H_
    1.34 +
    1.35 +namespace mozilla {
    1.36 +
    1.37 +// Input parameters for the EnergyEndpointer class.
    1.38 +class EnergyEndpointerParams {
    1.39 + public:
    1.40 +  EnergyEndpointerParams();
    1.41 +
    1.42 +  void SetDefaults();
    1.43 +
    1.44 +  void operator=(const EnergyEndpointerParams& source);
    1.45 +
    1.46 +  // Accessors and mutators
    1.47 +  float frame_period() const { return frame_period_; }
    1.48 +  void set_frame_period(float frame_period) {
    1.49 +    frame_period_ = frame_period;
    1.50 +  }
    1.51 +
    1.52 +  float frame_duration() const { return frame_duration_; }
    1.53 +  void set_frame_duration(float frame_duration) {
    1.54 +    frame_duration_ = frame_duration;
    1.55 +  }
    1.56 +
    1.57 +  float endpoint_margin() const { return endpoint_margin_; }
    1.58 +  void set_endpoint_margin(float endpoint_margin) {
    1.59 +    endpoint_margin_ = endpoint_margin;
    1.60 +  }
    1.61 +
    1.62 +  float onset_window() const { return onset_window_; }
    1.63 +  void set_onset_window(float onset_window) { onset_window_ = onset_window; }
    1.64 +
    1.65 +  float speech_on_window() const { return speech_on_window_; }
    1.66 +  void set_speech_on_window(float speech_on_window) {
    1.67 +    speech_on_window_ = speech_on_window;
    1.68 +  }
    1.69 +
    1.70 +  float offset_window() const { return offset_window_; }
    1.71 +  void set_offset_window(float offset_window) {
    1.72 +    offset_window_ = offset_window;
    1.73 +  }
    1.74 +
    1.75 +  float onset_detect_dur() const { return onset_detect_dur_; }
    1.76 +  void set_onset_detect_dur(float onset_detect_dur) {
    1.77 +    onset_detect_dur_ = onset_detect_dur;
    1.78 +  }
    1.79 +
    1.80 +  float onset_confirm_dur() const { return onset_confirm_dur_; }
    1.81 +  void set_onset_confirm_dur(float onset_confirm_dur) {
    1.82 +    onset_confirm_dur_ = onset_confirm_dur;
    1.83 +  }
    1.84 +
    1.85 +  float on_maintain_dur() const { return on_maintain_dur_; }
    1.86 +  void set_on_maintain_dur(float on_maintain_dur) {
    1.87 +    on_maintain_dur_ = on_maintain_dur;
    1.88 +  }
    1.89 +
    1.90 +  float offset_confirm_dur() const { return offset_confirm_dur_; }
    1.91 +  void set_offset_confirm_dur(float offset_confirm_dur) {
    1.92 +    offset_confirm_dur_ = offset_confirm_dur;
    1.93 +  }
    1.94 +
    1.95 +  float decision_threshold() const { return decision_threshold_; }
    1.96 +  void set_decision_threshold(float decision_threshold) {
    1.97 +    decision_threshold_ = decision_threshold;
    1.98 +  }
    1.99 +
   1.100 +  float min_decision_threshold() const { return min_decision_threshold_; }
   1.101 +  void set_min_decision_threshold(float min_decision_threshold) {
   1.102 +    min_decision_threshold_ = min_decision_threshold;
   1.103 +  }
   1.104 +
   1.105 +  float fast_update_dur() const { return fast_update_dur_; }
   1.106 +  void set_fast_update_dur(float fast_update_dur) {
   1.107 +    fast_update_dur_ = fast_update_dur;
   1.108 +  }
   1.109 +
   1.110 +  float sample_rate() const { return sample_rate_; }
   1.111 +  void set_sample_rate(float sample_rate) { sample_rate_ = sample_rate; }
   1.112 +
   1.113 +  float min_fundamental_frequency() const { return min_fundamental_frequency_; }
   1.114 +  void set_min_fundamental_frequency(float min_fundamental_frequency) {
   1.115 +    min_fundamental_frequency_ = min_fundamental_frequency;
   1.116 +  }
   1.117 +
   1.118 +  float max_fundamental_frequency() const { return max_fundamental_frequency_; }
   1.119 +  void set_max_fundamental_frequency(float max_fundamental_frequency) {
   1.120 +    max_fundamental_frequency_ = max_fundamental_frequency;
   1.121 +  }
   1.122 +
   1.123 +  float contamination_rejection_period() const {
   1.124 +    return contamination_rejection_period_;
   1.125 +  }
   1.126 +  void set_contamination_rejection_period(
   1.127 +      float contamination_rejection_period) {
   1.128 +    contamination_rejection_period_ = contamination_rejection_period;
   1.129 +  }
   1.130 +
   1.131 + private:
   1.132 +  float frame_period_;  // Frame period
   1.133 +  float frame_duration_;  // Window size
   1.134 +  float onset_window_;  // Interval scanned for onset activity
   1.135 +  float speech_on_window_;  // Inverval scanned for ongoing speech
   1.136 +  float offset_window_;  // Interval scanned for offset evidence
   1.137 +  float offset_confirm_dur_;  // Silence duration required to confirm offset
   1.138 +  float decision_threshold_;  // Initial rms detection threshold
   1.139 +  float min_decision_threshold_;  // Minimum rms detection threshold
   1.140 +  float fast_update_dur_;  // Period for initial estimation of levels.
   1.141 +  float sample_rate_;  // Expected sample rate.
   1.142 +
   1.143 +  // Time to add on either side of endpoint threshold crossings
   1.144 +  float endpoint_margin_;
   1.145 +  // Total dur within onset_window required to enter ONSET state
   1.146 +  float onset_detect_dur_;
   1.147 +  // Total on time within onset_window required to enter SPEECH_ON state
   1.148 +  float onset_confirm_dur_;
   1.149 +  // Minimum dur in SPEECH_ON state required to maintain ON state
   1.150 +  float on_maintain_dur_;
   1.151 +  // Minimum fundamental frequency for autocorrelation.
   1.152 +  float min_fundamental_frequency_;
   1.153 +  // Maximum fundamental frequency for autocorrelation.
   1.154 +  float max_fundamental_frequency_;
   1.155 +  // Period after start of user input that above threshold values are ignored.
   1.156 +  // This is to reject audio feedback contamination.
   1.157 +  float contamination_rejection_period_;
   1.158 +};
   1.159 +
   1.160 +}  //  namespace mozilla
   1.161 +
   1.162 +#endif  // CONTENT_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_PARAMS_H_

mercurial