From 2e41e8db8e9c5179a19bbcd6f0514c27d5a270ea Mon Sep 17 00:00:00 2001
From: 雾聪 <wucong.lyb@alibaba-inc.com>
Date: 星期一, 15 一月 2024 16:36:18 +0800
Subject: [PATCH] replace NULL for onnxruntime/bin
---
runtime/onnxruntime/bin/funasr-onnx-2pass.cpp | 8 ++--
runtime/onnxruntime/bin/funasr-onnx-offline-punc.cpp | 10 ++--
runtime/onnxruntime/bin/funasr-onnx-offline.cpp | 10 ++--
runtime/onnxruntime/bin/funasr-onnx-online-asr.cpp | 10 ++--
runtime/onnxruntime/bin/funasr-onnx-online-rtf.cpp | 12 +++---
runtime/onnxruntime/bin/funasr-onnx-offline-rtf.cpp | 12 +++---
runtime/onnxruntime/bin/funasr-onnx-2pass-rtf.cpp | 8 ++--
runtime/onnxruntime/bin/funasr-onnx-offline-vad.cpp | 10 ++--
runtime/onnxruntime/bin/funasr-onnx-online-punc.cpp | 10 ++--
runtime/onnxruntime/bin/funasr-onnx-online-vad.cpp | 10 ++--
10 files changed, 50 insertions(+), 50 deletions(-)
diff --git a/runtime/onnxruntime/bin/funasr-onnx-2pass-rtf.cpp b/runtime/onnxruntime/bin/funasr-onnx-2pass-rtf.cpp
index d49ba72..d4abacd 100644
--- a/runtime/onnxruntime/bin/funasr-onnx-2pass-rtf.cpp
+++ b/runtime/onnxruntime/bin/funasr-onnx-2pass-rtf.cpp
@@ -144,10 +144,10 @@
} else {
is_final = false;
}
- gettimeofday(&start, NULL);
+ gettimeofday(&start, nullptr);
FUNASR_RESULT result = FunTpassInferBuffer(tpass_handle, tpass_online_handle, speech_buff+sample_offset, step, punc_cache, is_final,
sampling_rate_, "pcm", (ASR_TYPE)asr_mode_, hotwords_embedding, true, decoder_handle);
- gettimeofday(&end, NULL);
+ gettimeofday(&end, nullptr);
seconds = (end.tv_sec - start.tv_sec);
long taking_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
n_total_time += taking_micros;
@@ -272,7 +272,7 @@
GetValue(asr_mode, ASR_MODE, model_path);
struct timeval start, end;
- gettimeofday(&start, NULL);
+ gettimeofday(&start, nullptr);
int thread_num = onnx_thread.getValue();
int asr_mode_ = -1;
if(model_path[ASR_MODE] == "offline"){
@@ -301,7 +301,7 @@
am_sc = am_scale.getValue();
}
- gettimeofday(&end, NULL);
+ gettimeofday(&end, nullptr);
long seconds = (end.tv_sec - start.tv_sec);
long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s";
diff --git a/runtime/onnxruntime/bin/funasr-onnx-2pass.cpp b/runtime/onnxruntime/bin/funasr-onnx-2pass.cpp
index abcc4b2..6941151 100644
--- a/runtime/onnxruntime/bin/funasr-onnx-2pass.cpp
+++ b/runtime/onnxruntime/bin/funasr-onnx-2pass.cpp
@@ -97,7 +97,7 @@
GetValue(asr_mode, ASR_MODE, model_path);
struct timeval start, end;
- gettimeofday(&start, NULL);
+ gettimeofday(&start, nullptr);
int thread_num = onnx_thread.getValue();
int asr_mode_ = -1;
if(model_path[ASR_MODE] == "offline"){
@@ -128,7 +128,7 @@
// init wfst decoder
FUNASR_DEC_HANDLE decoder_handle = FunASRWfstDecoderInit(tpass_handle, ASR_TWO_PASS, glob_beam, lat_beam, am_sc);
- gettimeofday(&end, NULL);
+ gettimeofday(&end, nullptr);
long seconds = (end.tv_sec - start.tv_sec);
long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s";
@@ -214,11 +214,11 @@
} else {
is_final = false;
}
- gettimeofday(&start, NULL);
+ gettimeofday(&start, nullptr);
FUNASR_RESULT result = FunTpassInferBuffer(tpass_handle, tpass_online_handle,
speech_buff+sample_offset, step, punc_cache, is_final, sampling_rate_, "pcm",
(ASR_TYPE)asr_mode_, hotwords_embedding, true, decoder_handle);
- gettimeofday(&end, NULL);
+ gettimeofday(&end, nullptr);
seconds = (end.tv_sec - start.tv_sec);
taking_micros += ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
diff --git a/runtime/onnxruntime/bin/funasr-onnx-offline-punc.cpp b/runtime/onnxruntime/bin/funasr-onnx-offline-punc.cpp
index 8f3149e..f549aae 100644
--- a/runtime/onnxruntime/bin/funasr-onnx-offline-punc.cpp
+++ b/runtime/onnxruntime/bin/funasr-onnx-offline-punc.cpp
@@ -49,7 +49,7 @@
GetValue(txt_path, TXT_PATH, model_path);
struct timeval start, end;
- gettimeofday(&start, NULL);
+ gettimeofday(&start, nullptr);
int thread_num = 1;
FUNASR_HANDLE punc_hanlde=CTTransformerInit(model_path, thread_num);
@@ -59,7 +59,7 @@
exit(-1);
}
- gettimeofday(&end, NULL);
+ gettimeofday(&end, nullptr);
long seconds = (end.tv_sec - start.tv_sec);
long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s";
@@ -83,9 +83,9 @@
long taking_micros = 0;
for(auto& txt_str : txt_list){
- gettimeofday(&start, NULL);
- FUNASR_RESULT result=CTTransformerInfer(punc_hanlde, txt_str.c_str(), RASR_NONE, NULL);
- gettimeofday(&end, NULL);
+ gettimeofday(&start, nullptr);
+ FUNASR_RESULT result=CTTransformerInfer(punc_hanlde, txt_str.c_str(), RASR_NONE, nullptr);
+ gettimeofday(&end, nullptr);
seconds = (end.tv_sec - start.tv_sec);
taking_micros += ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
string msg = FunASRGetResult(result, 0);
diff --git a/runtime/onnxruntime/bin/funasr-onnx-offline-rtf.cpp b/runtime/onnxruntime/bin/funasr-onnx-offline-rtf.cpp
index 0f550fc..5722693 100644
--- a/runtime/onnxruntime/bin/funasr-onnx-offline-rtf.cpp
+++ b/runtime/onnxruntime/bin/funasr-onnx-offline-rtf.cpp
@@ -54,7 +54,7 @@
// warm up
for (size_t i = 0; i < 1; i++)
{
- FUNASR_RESULT result=FunOfflineInfer(asr_handle, wav_list[0].c_str(), RASR_NONE, NULL, hotwords_embedding, audio_fs, true, decoder_handle);
+ FUNASR_RESULT result=FunOfflineInfer(asr_handle, wav_list[0].c_str(), RASR_NONE, nullptr, hotwords_embedding, audio_fs, true, decoder_handle);
if(result){
FunASRFreeResult(result);
}
@@ -67,10 +67,10 @@
break;
}
- gettimeofday(&start, NULL);
- FUNASR_RESULT result=FunOfflineInfer(asr_handle, wav_list[i].c_str(), RASR_NONE, NULL, hotwords_embedding, audio_fs, true, decoder_handle);
+ gettimeofday(&start, nullptr);
+ FUNASR_RESULT result=FunOfflineInfer(asr_handle, wav_list[i].c_str(), RASR_NONE, nullptr, hotwords_embedding, audio_fs, true, decoder_handle);
- gettimeofday(&end, NULL);
+ gettimeofday(&end, nullptr);
seconds = (end.tv_sec - start.tv_sec);
long taking_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
n_total_time += taking_micros;
@@ -174,7 +174,7 @@
GetValue(wav_path, WAV_PATH, model_path);
struct timeval start, end;
- gettimeofday(&start, NULL);
+ gettimeofday(&start, nullptr);
FUNASR_HANDLE asr_handle=FunOfflineInit(model_path, 1);
if (!asr_handle)
@@ -183,7 +183,7 @@
exit(-1);
}
- gettimeofday(&end, NULL);
+ gettimeofday(&end, nullptr);
long seconds = (end.tv_sec - start.tv_sec);
long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s";
diff --git a/runtime/onnxruntime/bin/funasr-onnx-offline-vad.cpp b/runtime/onnxruntime/bin/funasr-onnx-offline-vad.cpp
index 950530a..d0cb2ee 100644
--- a/runtime/onnxruntime/bin/funasr-onnx-offline-vad.cpp
+++ b/runtime/onnxruntime/bin/funasr-onnx-offline-vad.cpp
@@ -82,7 +82,7 @@
GetValue(wav_path, WAV_PATH, model_path);
struct timeval start, end;
- gettimeofday(&start, NULL);
+ gettimeofday(&start, nullptr);
int thread_num = 1;
FUNASR_HANDLE vad_hanlde=FsmnVadInit(model_path, thread_num);
@@ -92,7 +92,7 @@
exit(-1);
}
- gettimeofday(&end, NULL);
+ gettimeofday(&end, nullptr);
long seconds = (end.tv_sec - start.tv_sec);
long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s";
@@ -132,9 +132,9 @@
for (int i = 0; i < wav_list.size(); i++) {
auto& wav_file = wav_list[i];
auto& wav_id = wav_ids[i];
- gettimeofday(&start, NULL);
- FUNASR_RESULT result=FsmnVadInfer(vad_hanlde, wav_file.c_str(), NULL, audio_fs.getValue());
- gettimeofday(&end, NULL);
+ gettimeofday(&start, nullptr);
+ FUNASR_RESULT result=FsmnVadInfer(vad_hanlde, wav_file.c_str(), nullptr, audio_fs.getValue());
+ gettimeofday(&end, nullptr);
seconds = (end.tv_sec - start.tv_sec);
taking_micros += ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
diff --git a/runtime/onnxruntime/bin/funasr-onnx-offline.cpp b/runtime/onnxruntime/bin/funasr-onnx-offline.cpp
index 51a4729..edb83bd 100644
--- a/runtime/onnxruntime/bin/funasr-onnx-offline.cpp
+++ b/runtime/onnxruntime/bin/funasr-onnx-offline.cpp
@@ -87,7 +87,7 @@
GetValue(wav_path, WAV_PATH, model_path);
struct timeval start, end;
- gettimeofday(&start, NULL);
+ gettimeofday(&start, nullptr);
int thread_num = 1;
FUNASR_HANDLE asr_hanlde=FunOfflineInit(model_path, thread_num);
@@ -114,7 +114,7 @@
LOG(INFO) << "hotword path: " << hotword_path;
funasr::ExtractHws(hotword_path, hws_map, nn_hotwords_);
- gettimeofday(&end, NULL);
+ gettimeofday(&end, nullptr);
long seconds = (end.tv_sec - start.tv_sec);
long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s";
@@ -156,9 +156,9 @@
for (int i = 0; i < wav_list.size(); i++) {
auto& wav_file = wav_list[i];
auto& wav_id = wav_ids[i];
- gettimeofday(&start, NULL);
- FUNASR_RESULT result=FunOfflineInfer(asr_hanlde, wav_file.c_str(), RASR_NONE, NULL, hotwords_embedding, audio_fs.getValue(), true, decoder_handle);
- gettimeofday(&end, NULL);
+ gettimeofday(&start, nullptr);
+ FUNASR_RESULT result=FunOfflineInfer(asr_hanlde, wav_file.c_str(), RASR_NONE, nullptr, hotwords_embedding, audio_fs.getValue(), true, decoder_handle);
+ gettimeofday(&end, nullptr);
seconds = (end.tv_sec - start.tv_sec);
taking_micros += ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
diff --git a/runtime/onnxruntime/bin/funasr-onnx-online-asr.cpp b/runtime/onnxruntime/bin/funasr-onnx-online-asr.cpp
index 72be6a1..1593e84 100644
--- a/runtime/onnxruntime/bin/funasr-onnx-online-asr.cpp
+++ b/runtime/onnxruntime/bin/funasr-onnx-online-asr.cpp
@@ -63,7 +63,7 @@
GetValue(wav_path, WAV_PATH, model_path);
struct timeval start, end;
- gettimeofday(&start, NULL);
+ gettimeofday(&start, nullptr);
int thread_num = 1;
FUNASR_HANDLE asr_handle=FunASRInit(model_path, thread_num, ASR_ONLINE);
@@ -73,7 +73,7 @@
exit(-1);
}
- gettimeofday(&end, NULL);
+ gettimeofday(&end, nullptr);
long seconds = (end.tv_sec - start.tv_sec);
long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s";
@@ -144,9 +144,9 @@
} else {
is_final = false;
}
- gettimeofday(&start, NULL);
- FUNASR_RESULT result = FunASRInferBuffer(online_handle, speech_buff+sample_offset, step, RASR_NONE, NULL, is_final, sampling_rate_);
- gettimeofday(&end, NULL);
+ gettimeofday(&start, nullptr);
+ FUNASR_RESULT result = FunASRInferBuffer(online_handle, speech_buff+sample_offset, step, RASR_NONE, nullptr, is_final, sampling_rate_);
+ gettimeofday(&end, nullptr);
seconds = (end.tv_sec - start.tv_sec);
taking_micros += ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
diff --git a/runtime/onnxruntime/bin/funasr-onnx-online-punc.cpp b/runtime/onnxruntime/bin/funasr-onnx-online-punc.cpp
index e7a024c..5616fa4 100644
--- a/runtime/onnxruntime/bin/funasr-onnx-online-punc.cpp
+++ b/runtime/onnxruntime/bin/funasr-onnx-online-punc.cpp
@@ -69,7 +69,7 @@
GetValue(txt_path, TXT_PATH, model_path);
struct timeval start, end;
- gettimeofday(&start, NULL);
+ gettimeofday(&start, nullptr);
int thread_num = 1;
FUNASR_HANDLE punc_hanlde=CTTransformerInit(model_path, thread_num, PUNC_ONLINE);
@@ -79,7 +79,7 @@
exit(-1);
}
- gettimeofday(&end, NULL);
+ gettimeofday(&end, nullptr);
long seconds = (end.tv_sec - start.tv_sec);
long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s";
@@ -107,16 +107,16 @@
splitString(vad_strs, txt_str, "|");
string str_out;
FUNASR_RESULT result = nullptr;
- gettimeofday(&start, NULL);
+ gettimeofday(&start, nullptr);
for(auto& vad_str:vad_strs){
- result=CTTransformerInfer(punc_hanlde, vad_str.c_str(), RASR_NONE, NULL, PUNC_ONLINE, result);
+ result=CTTransformerInfer(punc_hanlde, vad_str.c_str(), RASR_NONE, nullptr, PUNC_ONLINE, result);
if(result){
string msg = CTTransformerGetResult(result, 0);
str_out += msg;
LOG(INFO)<<"Online result: "<<msg;
}
}
- gettimeofday(&end, NULL);
+ gettimeofday(&end, nullptr);
seconds = (end.tv_sec - start.tv_sec);
taking_micros += ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
LOG(INFO)<<"Results: "<<str_out;
diff --git a/runtime/onnxruntime/bin/funasr-onnx-online-rtf.cpp b/runtime/onnxruntime/bin/funasr-onnx-online-rtf.cpp
index 57a4cce..4830a3d 100644
--- a/runtime/onnxruntime/bin/funasr-onnx-online-rtf.cpp
+++ b/runtime/onnxruntime/bin/funasr-onnx-online-rtf.cpp
@@ -84,7 +84,7 @@
} else {
is_final = false;
}
- FUNASR_RESULT result = FunASRInferBuffer(online_handle, speech_buff+sample_offset, step, RASR_NONE, NULL, is_final, sampling_rate_);
+ FUNASR_RESULT result = FunASRInferBuffer(online_handle, speech_buff+sample_offset, step, RASR_NONE, nullptr, is_final, sampling_rate_);
if (result)
{
FunASRFreeResult(result);
@@ -130,9 +130,9 @@
} else {
is_final = false;
}
- gettimeofday(&start, NULL);
- FUNASR_RESULT result = FunASRInferBuffer(online_handle, speech_buff+sample_offset, step, RASR_NONE, NULL, is_final, sampling_rate_);
- gettimeofday(&end, NULL);
+ gettimeofday(&start, nullptr);
+ FUNASR_RESULT result = FunASRInferBuffer(online_handle, speech_buff+sample_offset, step, RASR_NONE, nullptr, is_final, sampling_rate_);
+ gettimeofday(&end, nullptr);
seconds = (end.tv_sec - start.tv_sec);
long taking_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
n_total_time += taking_micros;
@@ -210,7 +210,7 @@
GetValue(wav_path, WAV_PATH, model_path);
struct timeval start, end;
- gettimeofday(&start, NULL);
+ gettimeofday(&start, nullptr);
FUNASR_HANDLE asr_handle=FunASRInit(model_path, 1, ASR_ONLINE);
if (!asr_handle)
@@ -219,7 +219,7 @@
exit(-1);
}
- gettimeofday(&end, NULL);
+ gettimeofday(&end, nullptr);
long seconds = (end.tv_sec - start.tv_sec);
long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s";
diff --git a/runtime/onnxruntime/bin/funasr-onnx-online-vad.cpp b/runtime/onnxruntime/bin/funasr-onnx-online-vad.cpp
index 3f62672..6633dfe 100644
--- a/runtime/onnxruntime/bin/funasr-onnx-online-vad.cpp
+++ b/runtime/onnxruntime/bin/funasr-onnx-online-vad.cpp
@@ -89,7 +89,7 @@
GetValue(wav_path, WAV_PATH, model_path);
struct timeval start, end;
- gettimeofday(&start, NULL);
+ gettimeofday(&start, nullptr);
int thread_num = 1;
FUNASR_HANDLE vad_hanlde=FsmnVadInit(model_path, thread_num);
@@ -99,7 +99,7 @@
exit(-1);
}
- gettimeofday(&end, NULL);
+ gettimeofday(&end, nullptr);
long seconds = (end.tv_sec - start.tv_sec);
long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s";
@@ -170,9 +170,9 @@
} else {
is_final = false;
}
- gettimeofday(&start, NULL);
- FUNASR_RESULT result = FsmnVadInferBuffer(online_hanlde, speech_buff+sample_offset, step, NULL, is_final, sampling_rate_);
- gettimeofday(&end, NULL);
+ gettimeofday(&start, nullptr);
+ FUNASR_RESULT result = FsmnVadInferBuffer(online_hanlde, speech_buff+sample_offset, step, nullptr, is_final, sampling_rate_);
+ gettimeofday(&end, nullptr);
seconds = (end.tv_sec - start.tv_sec);
taking_micros += ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
--
Gitblit v1.9.1