srsLTE/srslte/include/srslte/fec/viterbi.h

98 lines
3.0 KiB
C
Raw Normal View History

/**
*
* \section COPYRIGHT
*
2015-11-13 04:22:33 -08:00
* Copyright 2013-2015 Software Radio Systems Limited
*
* \section LICENSE
*
* This file is part of the srsLTE library.
*
* 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
* 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,
* 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.
*
2015-05-08 08:05:40 -07:00
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
/******************************************************************************
* File: viterbi.h
*
* Description: Viterbi decoder for convolutionally encoded data.
* Used for decoding of PBCH and PDCCH (type 37 decoder).
*
* Reference:
*****************************************************************************/
#ifndef VITERBI_
#define VITERBI_
#include <stdbool.h>
#include "srslte/config.h"
2015-11-22 11:12:06 -08:00
typedef enum {
2015-03-18 08:05:38 -07:00
SRSLTE_VITERBI_27 = 0,
SRSLTE_VITERBI_29,
SRSLTE_VITERBI_37,
SRSLTE_VITERBI_39
}srslte_viterbi_type_t;
typedef struct SRSLTE_API{
2014-06-17 02:11:41 -07:00
void *ptr;
uint32_t R;
uint32_t K;
2014-10-17 11:44:01 -07:00
uint32_t framebits;
2014-06-17 02:11:41 -07:00
bool tail_biting;
2014-12-15 15:34:44 -08:00
float gain_quant;
uint32_t poly[3];
2014-10-17 11:44:01 -07:00
int (*decode) (void*, uint8_t*, uint8_t*, uint32_t);
2014-12-16 02:27:08 -08:00
int (*decode_f) (void*, float*, uint8_t*, uint32_t);
2014-06-17 02:11:41 -07:00
void (*free) (void*);
2014-10-17 11:44:01 -07:00
uint8_t *tmp;
uint8_t *symbols_uc;
2015-03-18 08:05:38 -07:00
}srslte_viterbi_t;
2015-03-18 08:05:38 -07:00
SRSLTE_API int srslte_viterbi_init(srslte_viterbi_t *q,
srslte_viterbi_type_t type,
uint32_t poly[3],
uint32_t max_frame_length,
bool tail_bitting);
2015-03-18 08:05:38 -07:00
SRSLTE_API void srslte_viterbi_set_gain_quant(srslte_viterbi_t *q,
float gain_quant);
2014-12-15 15:34:44 -08:00
2015-03-18 08:05:38 -07:00
SRSLTE_API void srslte_viterbi_free(srslte_viterbi_t *q);
2015-03-18 08:05:38 -07:00
SRSLTE_API int srslte_viterbi_decode_f(srslte_viterbi_t *q,
float *symbols,
uint8_t *data,
uint32_t frame_length);
2015-03-18 08:05:38 -07:00
SRSLTE_API int srslte_viterbi_decode_uc(srslte_viterbi_t *q,
uint8_t *symbols,
uint8_t *data,
uint32_t frame_length);
2015-11-22 11:12:06 -08:00
SRSLTE_API int srslte_viterbi_init_sse(srslte_viterbi_t *q,
srslte_viterbi_type_t type,
uint32_t poly[3],
uint32_t max_frame_length,
bool tail_bitting);
#endif