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 | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/funasr/runtime/onnxruntime/src/e2e-vad.h b/funasr/runtime/onnxruntime/src/e2e-vad.h
index 0e0b50f..d89a889 100644
--- a/funasr/runtime/onnxruntime/src/e2e-vad.h
+++ b/funasr/runtime/onnxruntime/src/e2e-vad.h
@@ -1,8 +1,9 @@
/**
* Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved.
* MIT License (https://opensource.org/licenses/MIT)
- * Collaborators: zhuzizyf(China Telecom Shanghai)
*/
+
+#pragma once
#include <utility>
#include <vector>
@@ -14,7 +15,7 @@
#include <numeric>
#include <cassert>
-
+namespace funasr {
enum class VadStateMachine {
kVadInStateStartPointNotDetected = 1,
kVadInStateInSpeechSegment = 2,
@@ -441,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];
@@ -780,5 +781,4 @@
};
-
-
+} // namespace funasr
--
Gitblit v1.9.1