📄 main_type3.c
字号:
/*****************************************************************************//* FIle Name : main_type3.c *//* Description : Main routine to Test FEC Type3 *//* 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"#define mm 8 /* RS code over GF(2**4) - change to suit *///#define nn 255 /* nn=2**mm -1 length of codeword *///#define tt 16 /* number of errors that can be corrected *///#define kk 223 /* kk = nn-2*tt */int pp [mm+1] = { 1, 0, 1, 1, 1, 0, 0, 0, 1} ; /* specify irreducible polynomial coeffts */#include "inner_type3.c"#include "type3_decoder.c"//#include "decode_rs.c"main(){ static int NN = 255 ; register int ii , jj ; char num_erasure ; char fail ; char RR ; short KK , num_data ,noise ; struct binaryset bset, exp ; unsigned char data[NN] ; //multiple tests //for (jj=0;jj<10;jj++) { //each test /* for known data, stick a few numbers into a zero codeword. Data is in polynomial form. */ //make a binary set num_data = int_random(255) ; //(KK+1) ; //0-KK printf("\n %d th Test(RR=%d num_data=%d)\n\n", jj, RR, num_data ) ; for (ii=0; ii<num_data; ii++) data[ii] = int_random(256) ; bset.format = 1 ; bset.data = &data[0] ; bset.size = num_data ; exp = copy_binaryset(bset) ; print_binaryset(bset) ; bset = inner_type3( bset ) ; print_binaryset(bset) ; /* 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<bset.size; ii++) { //for noise = pow_random(9,9) ; bset.data[ii] = (bset.data[ii]) ? 0xf - noise : noise ; }// print_binaryset(bset) ; ///* decode recv[] */ bset = type3_decoder( bset ) ; /* recd[] is returned in polynomial form */ print_binaryset(bset) ; bset = binary2byte_MSB(bset) ; print_binaryset(bset) ; fail = compare_binaryset( exp , bset ) ; //} //each test}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -