tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

vad_sp.h (2088B)


      1 /*
      2 *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
      3 *
      4 *  Use of this source code is governed by a BSD-style license
      5 *  that can be found in the LICENSE file in the root of the source
      6 *  tree. An additional intellectual property rights grant can be found
      7 *  in the file PATENTS.  All contributing project authors may
      8 *  be found in the AUTHORS file in the root of the source tree.
      9 */
     10 
     11 // This file includes specific signal processing tools used in vad_core.c.
     12 
     13 #ifndef COMMON_AUDIO_VAD_VAD_SP_H_
     14 #define COMMON_AUDIO_VAD_VAD_SP_H_
     15 
     16 #include <stddef.h>
     17 #include <stdint.h>
     18 
     19 #include "common_audio/vad/vad_core.h"
     20 
     21 // Downsamples the signal by a factor 2, eg. 32->16 or 16->8.
     22 //
     23 // Inputs:
     24 //      - signal_in     : Input signal.
     25 //      - in_length     : Length of input signal in samples.
     26 //
     27 // Input & Output:
     28 //      - filter_state  : Current filter states of the two all-pass filters. The
     29 //                        `filter_state` is updated after all samples have been
     30 //                        processed.
     31 //
     32 // Output:
     33 //      - signal_out    : Downsampled signal (of length `in_length` / 2).
     34 void WebRtcVad_Downsampling(const int16_t* signal_in,
     35                            int16_t* signal_out,
     36                            int32_t* filter_state,
     37                            size_t in_length);
     38 
     39 // Updates and returns the smoothed feature minimum. As minimum we use the
     40 // median of the five smallest feature values in a 100 frames long window.
     41 // As long as `handle->frame_counter` is zero, that is, we haven't received any
     42 // "valid" data, FindMinimum() outputs the default value of 1600.
     43 //
     44 // Inputs:
     45 //      - feature_value : New feature value to update with.
     46 //      - channel       : Channel number.
     47 //
     48 // Input & Output:
     49 //      - handle        : State information of the VAD.
     50 //
     51 // Returns:
     52 //                      : Smoothed minimum value for a moving window.
     53 int16_t WebRtcVad_FindMinimum(VadInstT* handle,
     54                              int16_t feature_value,
     55                              int channel);
     56 
     57 #endif  // COMMON_AUDIO_VAD_VAD_SP_H_