srsLTE/srslte/lib/fec/test/viterbi_test.h

72 lines
1.9 KiB
C
Raw Normal View History

2014-03-08 03:46:19 -08:00
/**
*
* \section COPYRIGHT
*
2015-05-08 08:05:40 -07:00
* Copyright 2013-2015 The srsLTE Developers. See the
2014-03-08 03:46:19 -08:00
* COPYRIGHT file at the top-level directory of this distribution.
*
* \section LICENSE
*
* This file is part of the srsLTE library.
2014-03-08 03:46:19 -08:00
*
* srsLTE is free software: you can redistribute it and/or modify
2015-05-08 08:05:40 -07:00
* it under the terms of the GNU Affero General Public License as
2014-03-08 03:46:19 -08:00
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE is distributed in the hope that it will be useful,
2014-03-08 03:46:19 -08:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2015-05-08 08:05:40 -07:00
* GNU Affero General Public License for more details.
2014-03-08 03:46:19 -08:00
*
2015-05-08 08:05:40 -07:00
* A copy of the GNU Affero General Public License can be found in
2014-03-08 03:46:19 -08:00
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#include <stdbool.h>
typedef struct {
2014-06-17 02:11:41 -07:00
int n;
2014-10-17 11:44:01 -07:00
uint32_t s;
2014-06-17 02:11:41 -07:00
int len;
int k;
bool tail;
float ebno;
int errors;
2014-03-08 03:46:19 -08:00
}expected_errors_t;
static expected_errors_t expected_errors[] = {
2014-06-17 02:11:41 -07:00
{1000, 1, 40, 7, true, 0.0, 5363},
{1000, 1, 40, 7, true, 2.0, 356},
{1000, 1, 40, 7, true, 3.0, 48},
{1000, 1, 40, 7, true, 4.5, 0},
2014-03-08 03:46:19 -08:00
2014-06-17 02:11:41 -07:00
{100, 1, 1000, 7, true, 0.0, 8753},
{100, 1, 1000, 7, true, 2.0, 350},
{100, 1, 1000, 7, true, 3.0, 33},
{100, 1, 1000, 7, true, 4.5, 0},
2014-03-08 03:46:19 -08:00
2014-06-17 02:11:41 -07:00
{-1, -1, -1, -1, true, -1.0, -1}
2014-03-08 03:46:19 -08:00
};
2014-10-17 11:44:01 -07:00
int get_expected_errors(int n, uint32_t s, int len, int k, bool tail, float ebno) {
2014-06-17 02:11:41 -07:00
int i;
i=0;
while(expected_errors[i].n != -1) {
if (expected_errors[i].n == n
&& expected_errors[i].s == s
&& expected_errors[i].len == len
&& expected_errors[i].k == k
&& expected_errors[i].tail == tail
&& expected_errors[i].ebno == ebno) {
break;
} else {
i++;
}
}
return expected_errors[i].errors;
2014-03-08 03:46:19 -08:00
}