chenmengzheAAA
2023-09-14 30c40c643c19f6e2ac8679fa76d09d0f9ceccc65
funasr/runtime/onnxruntime/src/e2e-vad.h
@@ -1,7 +1,10 @@
/**
 * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved.
 * MIT License  (https://opensource.org/licenses/MIT)
 * Contributed by zhuzizyf(China Telecom).
*/
#pragma once
#include <utility>
#include <vector>
@@ -13,7 +16,7 @@
#include <numeric>
#include <cassert>
namespace funasr {
enum class VadStateMachine {
    kVadInStateStartPointNotDetected = 1,
    kVadInStateInSpeechSegment = 2,
@@ -303,7 +306,7 @@
        max_end_sil_frame_cnt_thresh = max_end_sil - vad_opts.speech_to_sil_time_thres;
        this->waveform = waveform;
        this->vad_opts.max_single_segment_time = max_single_segment_time;
        this->vad_opts.speech_noise_thres = speech_noise_thres;
        this->speech_noise_thres = speech_noise_thres;
        this->vad_opts.sample_rate = sample_rate;
        ComputeDecibel();
@@ -440,7 +443,7 @@
        } else {
          data_buf_all_size += waveform.size();
        }
        for (int offset = 0; offset < waveform.size() - frame_sample_length + 1; offset += frame_shift_length) {
        for (int offset = 0; offset + frame_sample_length -1 < waveform.size(); offset += frame_shift_length) {
            float sum = 0.0;
            for (int i = 0; i < frame_sample_length; i++) {
                sum += waveform[offset + i] * waveform[offset + i];
@@ -779,5 +782,4 @@
};
} // namespace funasr