📄 main_ctc.c
字号:
/*****************************************************************************//* FIle Name : main_turbo.c *//* Description : Main routine to Test FEC Type2 *//* author : miffie *//* Date : sep/26/05 *//* Copyright (c) 2005 miffie All rights reserved. *//*****************************************************************************/#include <math.h>#include <stdio.h>#include <stdlib.h>//Global variableschar print_on = 1 ;#define PRINTF if (print_on) printf#define FPRINTF if (print_on) fprintf#include "../env/binaryset.c"#include "../env/utility.c"#include "ctc_encoder.c"#include "viterbi_ctc.c"#include "ctc_decoder.c"main(){ register int ii , jj, kk ; char fail ; short NN , noise ; struct binaryset exp , encoded, bset0, bset1; unsigned char data[512] ; char fec_code_type ; //multiple tests for (jj=0;jj<100;jj++) { //each test /* for known data, stick a few numbers into a zero codeword. Data is in polynomial form. */ //make a binary set NN = 6*16 ; //(int_random(27) +1)*16 ; //16-27*16 fec_code_type = 13 ; // int_random(7) + 13 ; //13-19 printf("\n %d th Test(fec_code_type=%d NN=%d\n\n", jj, NN, fec_code_type ) ; for (ii=0; ii<NN/4; ii++) data[ii] = int_random(256) ; bset0.format = 1 ; bset0.data = &data[0] ; bset0.size = NN/4 ; exp = copy_binaryset(bset0) ; print_binaryset(bset0) ; bset0 = ctc_encoder(bset0, fec_code_type , 16 ) ; print_binaryset(bset0) ; encoded = copy_binaryset(bset0) ; for(ii=0;ii<bset0.size;ii++) bset0.data[ii] = (bset0.data[ii]) ? 0xf : 0x0 ; /* if you want to test the program, corrupt some of the elements of recd[] here. This can also be done easily in a debugger. */ for(ii=0; ii<bset0.size; ii++) { //for noise = pow_random(10, 3) ; bset0.data[ii] = (bset0.data[ii]) ? 0xf - noise : noise ; }// print_binaryset(bset0) ; ///* decode recv[] */ bset0 = ctc_decoder( bset0, fec_code_type, 16 ) ; print_binaryset(bset0) ; fail = compare_binaryset( exp , bset0 ) ; if (fail) printf(" %d th Test was failed\n" , jj) ; else printf(" %d th Test was passed\n" , jj) ; } //each test}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -