vad_sp.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. // This file includes specific signal processing tools used in vad_core.c.
  11. #ifndef COMMON_AUDIO_VAD_VAD_SP_H_
  12. #define COMMON_AUDIO_VAD_VAD_SP_H_
  13. #include "common_audio/vad/vad_core.h"
  14. // Downsamples the signal by a factor 2, eg. 32->16 or 16->8.
  15. //
  16. // Inputs:
  17. // - signal_in : Input signal.
  18. // - in_length : Length of input signal in samples.
  19. //
  20. // Input & Output:
  21. // - filter_state : Current filter states of the two all-pass filters. The
  22. // |filter_state| is updated after all samples have been
  23. // processed.
  24. //
  25. // Output:
  26. // - signal_out : Downsampled signal (of length |in_length| / 2).
  27. void WebRtcVad_Downsampling(const int16_t* signal_in,
  28. int16_t* signal_out,
  29. int32_t* filter_state,
  30. size_t in_length);
  31. // Updates and returns the smoothed feature minimum. As minimum we use the
  32. // median of the five smallest feature values in a 100 frames long window.
  33. // As long as |handle->frame_counter| is zero, that is, we haven't received any
  34. // "valid" data, FindMinimum() outputs the default value of 1600.
  35. //
  36. // Inputs:
  37. // - feature_value : New feature value to update with.
  38. // - channel : Channel number.
  39. //
  40. // Input & Output:
  41. // - handle : State information of the VAD.
  42. //
  43. // Returns:
  44. // : Smoothed minimum value for a moving window.
  45. int16_t WebRtcVad_FindMinimum(VadInstT* handle,
  46. int16_t feature_value,
  47. int channel);
  48. #endif // COMMON_AUDIO_VAD_VAD_SP_H_