From 0bb1196656d1f730cbe75ba36f4105cadd120008 Mon Sep 17 00:00:00 2001
From: zhuzizyf <42790740+zhuzizyf@users.noreply.github.com>
Date: 星期二, 09 五月 2023 22:23:06 +0800
Subject: [PATCH] Update e2e-vad.h

---
 funasr/runtime/onnxruntime/src/e2e-vad.h |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/funasr/runtime/onnxruntime/src/e2e-vad.h b/funasr/runtime/onnxruntime/src/e2e-vad.h
index d881a32..d89a889 100644
--- a/funasr/runtime/onnxruntime/src/e2e-vad.h
+++ b/funasr/runtime/onnxruntime/src/e2e-vad.h
@@ -3,6 +3,8 @@
  * MIT License  (https://opensource.org/licenses/MIT)
 */
 
+#pragma once 
+
 #include <utility>
 #include <vector>
 #include <string>
@@ -13,7 +15,7 @@
 #include <numeric>
 #include <cassert>
 
-
+namespace funasr {
 enum class VadStateMachine {
     kVadInStateStartPointNotDetected = 1,
     kVadInStateInSpeechSegment = 2,
@@ -440,7 +442,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 +781,4 @@
 
 };
 
-
-
+} // namespace funasr

--
Gitblit v1.9.1