<commit_before>/*
 * viterbi27.cpp
 *
 *  Created on: 04/11/2016
 *      Author: lucas
 */

extern "C" {
#include <fec.h>
}

#include "viterbi27.h"
#include <memory.h>
#include "correlator.h"
#include "ViterbiCreationException.h"

using namespace SatHelper;

Viterbi27::Viterbi27(int frameBits, int polyA, int polyB) {
    this->frameBits = frameBits;
    this->polynomials[0] = polyA;
    this->polynomials[1] = polyB;
    this->BER = 0;
    this->calculateErrors = true;
    set_viterbi27_polynomial(this->polynomials);
    if ((viterbi = create_viterbi27(this->frameBits)) == NULL) {
        throw ViterbiCreationException();
    }
    this->checkDataPointer = new uint8_t[this->frameBits*2];
}

Viterbi27::~Viterbi27() {
    delete[] this->checkDataPointer;
}

void Viterbi27::encode(uint8_t *input, uint8_t *output) {
    unsigned int encstate = 0;
    uint8_t c;
    uint32_t pos = 0;<commit_msg>Added Previous Frame Data support to Viterbi (for low SNR)<commit_after>/*
 * viterbi27.cpp
 *
 *  Created on: 04/11/2016
 *      Author: lucas
 */

extern "C" {
#include <fec.h>
}

#include "viterbi27.h"
#include <memory.h>
#include "correlator.h"
#include "ViterbiCreationException.h"

using namespace SatHelper;

Viterbi27::Viterbi27(int frameBits, int polyA, int polyB) {
    this->frameBits = frameBits;
    this->polynomials[0] = polyA;
    this->polynomials[1] = polyB;
    this->BER = 0;
    this->calculateErrors = true;
    set_viterbi27_polynomial(this->polynomials);
    if ((viterbi = create_viterbi27(this->frameBits+6)) == NULL) {
        throw ViterbiCreationException();
    }
    this->checkDataPointer = new uint8_t[this->frameBits*2];
}

Viterbi27::~Viterbi27() {
    delete[] this->checkDataPointer;
}

void Viterbi27::encode(uint8_t *input, uint8_t *output) {
    unsigned int encstate = 0;
    uint8_t c;
    uint32_t pos = 0;
{'fraction_non_alphanumeric': 0.13992436520799567, 'fraction_numerical': 0.041599135602377095, 'mean_word_length': 3.873684210526316, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7512292', 'n_tokens_mistral': 742, 'n_tokens_neox': 699, 'n_words': 138}