aboutsummaryrefslogtreecommitdiffstats
path: root/gr-trellis
diff options
context:
space:
mode:
authorThomas Habets <thomas@habets.se>2020-04-10 12:30:23 +0100
committerMarcus Müller <marcus@hostalia.de>2020-04-11 01:36:19 +0200
commit616879745ce5d61e6acd54ad84d60359a739a27d (patch)
treed908850d053583ab3f78a20db05ccfcf36c97435 /gr-trellis
parentzeromq: Add bind argument for message based zeromq blocks. (diff)
downloadgnuradio-616879745ce5d61e6acd54ad84d60359a739a27d.tar.xz
gnuradio-616879745ce5d61e6acd54ad84d60359a739a27d.zip
trellis: remove manual memory management
Diffstat (limited to 'gr-trellis')
-rw-r--r--gr-trellis/lib/core_algorithms.cc10
1 files changed, 3 insertions, 7 deletions
diff --git a/gr-trellis/lib/core_algorithms.cc b/gr-trellis/lib/core_algorithms.cc
index d048ddde7..aa965c6cb 100644
--- a/gr-trellis/lib/core_algorithms.cc
+++ b/gr-trellis/lib/core_algorithms.cc
@@ -158,7 +158,7 @@ void viterbi_algorithm_combined(int I,
{
std::vector<int> trace(S * K);
std::vector<float> alpha(S * 2);
- float* metric = new float[O];
+ std::vector<float> metric(O);
int alphai;
float norm, mm, minm;
int minmi;
@@ -175,7 +175,7 @@ void viterbi_algorithm_combined(int I,
alphai = 0;
for (int k = 0; k < K; k++) {
- calc_metric(O, D, TABLE, &(in[k * D]), metric, TYPE); // calc metrics
+ calc_metric(O, D, TABLE, &(in[k * D]), metric.data(), TYPE); // calc metrics
norm = INF;
for (int j = 0; j < S; j++) { // for each next state do ACS
minm = INF;
@@ -213,8 +213,6 @@ void viterbi_algorithm_combined(int I,
out[k] = (To)PI[st][i0];
st = PS[st][i0];
}
-
- delete[] metric;
}
// Ti = s i f c
@@ -666,7 +664,7 @@ void siso_algorithm_combined(int I,
float norm, mm, minm;
std::vector<float> alpha(S * (K + 1));
std::vector<float> beta(S * (K + 1));
- float* prioro = new float[O * K];
+ std::vector<float> prioro(O * K);
if (S0 < 0) { // initial state not specified
for (int i = 0; i < S; i++)
@@ -801,8 +799,6 @@ void siso_algorithm_combined(int I,
}
} else
throw std::runtime_error("Not both POSTI and POSTO can be false.");
-
- delete[] prioro;
}
//---------