⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main_test.c

📁 这个文件包括wimax中所有的编解码源代码
💻 C
字号:
/*****************************************************************************//*   FIle Name : main_test.c                                                 *//*   Description : Main routine to Test FEC                                  *//*   author : miffie                                                         *//*   Date   : sep/23/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 "randomizer.c"#include "convolution_encoder.c"#include "encode_rs.c"#include "inner_type3.c"#include "turboproduct.c"#include "downlink_fecenc.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   ;  struct  binaryset bset, exp ;  unsigned char     data[NN] ;  char message[] = { 0xd4, 0xba, 0xa1, 0x12, 0xf2, 0x74, 0x96, 0x30,                     0x27, 0xd4, 0x88, 0x9c, 0x96, 0xe3, 0xa9, 0x52,                     0xb3, 0x15, 0xab, 0xfd, 0x92, 0x53, 0x07, 0x32,                     0xc0, 0x62, 0x48, 0xf0, 0x19, 0x22, 0xe0, 0x91,                     0x62, 0x1a, 0xc1 } ; //0x23      //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(128)*2 ; //(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)&NN ;    bset.format = 1 ;    bset.data = &data[0] ;    bset.size = num_data ;      exp = copy_binaryset(bset) ;    print_binaryset(bset) ;    bset = downlink_fecenc( bset ,                              1   ,    //fec_code_type ,                              200 ,    //rs_info_bytes , //KK                              8   ,    //rs_parity_bytes , //RR                              1   ,    //bcc_code_type ,                              1   ,    //btc_row_type ,                              1   ,    //btc_column_type ,                              1   ,    //btc_interleave ,                              0x00a9,  //randomizer_seed ,                              1    );  //last_codeword_length ) ;    /* if you want to test the program, corrupt some of the elements of recd[]       here. This can also be done easily in a debugger. */    //num_erasure = int_random((RR/2)+1) ; //0-RR    //printf("..adding %d out of %d errors\n", num_erasure, num_data ) ;    //for(ii=0; ii<num_erasure; ii++)    //   bset.data[(int_random(bset.size+1)&NN)] ^= int_random(256) ;      //print_binaryset(bset) ;      ///* decode recv[] */    //bset = decode_rs( bset, RR ) ;         /* recd[] is returned in polynomial form */      //print_binaryset(bset) ;    //fail = compare_binaryset( exp , bset ) ;  //} //each test}  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -