亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? convolutional.h

?? This a software runing on the matlab, it is used in the channel coding simulation. It include DVB-S
?? H
字號:
/* File convolutional.h
   
   Description: General functions used to implement convolutional encoding.   

   Copyright (C) 2006, Matthew C. Valenti

   Last updated on Mar. 14, 2006

   Functions  itob, parity_counter, nsc_enc_bit, rsc_enc_bit, nsc_transit, 
   rsc_transit, rsc_tail, conv_encode, and Gamma are part of the Iterative Solutions 
   Coded Modulation Library. The Iterative Solutions Coded Modulation 
   Library is free software; you can redistribute it and/or modify it 
   under the terms of the GNU Lesser General Public License as published 
   by the Free Software Foundation; either version 2.1 of the License, 
   or (at your option) any later version.

   This library 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 GNU
   Lesser General Public License for more details.
  
   You should have received a copy of the GNU Lesser General Public
   License along with this library; if not, write to the Free Software
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

*/

/* define constants used throughout the library */
#define MAXLOG 1e7  /* Define infinity */

/* function itob()

  Description: Converts an integer symbol into a vector of bits

	Output parameters:
		binvec_p: The binary vector
		
    Input parameters:
	    symbol:  The integer-valued symbol
		length:  The length of the binary vector
	
  This function is used by conv_encode()  */

void itob(
						int	binvec_p[],
						int symbol,
						int length )
{
	int counter;

	/* Go through each bit in the vector */
	for (counter=0;counter<length;counter++) {
		binvec_p[length-counter-1] = (symbol&1);
		symbol = symbol>>1;
	}

	return;
}

/* function parity_counter()

  Copyright 2003, Matthew C. Valenti.
	
  Description: Determines if a symbol has odd (1) or even (0) parity

	Output parameters:
		(returned int): The symbol's parity = 1 for odd and 0 for even
		
    Input parameters:
	    symbol:  The integer-valued symbol
		length:  The highest bit position in the symbol
	
  This function is used by nsc_enc_bit(), rsc_enc_bit(), and rsc_tail()  */

int parity_counter( int symbol, int length )
{
	int counter;
	int temp_parity = 0;

	for (counter=0;counter<length;counter++) {
		temp_parity = temp_parity^(symbol&1);
		symbol = symbol>>1;
	}

	return( temp_parity );
}


/* Function nsc_enc_bit() 

  (c) Copyright 2003, Matthew C. Valenti.

  Description: Convolutionally encodes a single bit using a rate 1/n encoder.
  Takes in one input bit at a time, and produces a n-bit output.
  
	Input parameters:
		input		The input data bit (i.e. a 0 or 1).
		state_in	The starting state of the encoder (an int from 0 to 2^m-1).
		g[]			An n-element vector containing the code generators in binary form.
		KK			The constraint length of the convolutional code.

	Output parameters:
		output_p[]		An n-element vector containing the encoded bits.
		state_out_p[]	An integer containing the final state of the encoder	
						(i.e. the state after encoding this bit)
	
  This function is used by rsc_encode(), nsc_transit(), rsc_transit(), and nsc_transit() */

static int nsc_enc_bit(
				   int	state_out_p[],
				   int	input,
				   int	state_in, 
				   int  g[],
				   int  KK,
				   int  nn )
{
	/* declare variables */
	int state, i;
	int out = 0;	

	/* create a word made up of state and new input */
	state = (input<<(KK-1))^state_in;
	
	/* AND the word with the generators */
	for (i=0;i<nn;i++)
    {		
		/* update output symbol */
		out = (out<<1) + parity_counter( state&g[i], KK ); 		
    }
	
	/* shift the state to make the new state */
	state_out_p[0] = state>>1; 	
	return(out);
}

static int rsc_enc_bit(
				   int	state_out_p[],
				   int	input,
				   int	state_in, 
				   int  g[],
				   int  KK,
				   int  nn )
{
	/* declare variables */
	int state, i, out, a_k;	

	/* systematic output */
	out = input;

	/* determine feedback bit */
	a_k = input^parity_counter( g[0]&state_in, KK );

	/* create a word made up of state and feedback bit */
	state = (a_k<<(KK-1))^state_in;

	/* AND the word with the generators */
	for (i=1;i<nn;i++)
    {		
		/* update output symbol */
		out = (out<<1) + parity_counter( state&g[i], KK ); 		
    }
	
	/* shift the state to make the new state */
	state_out_p[0] = state>>1; 	
	return(out);
}

/* function that creates the transit and output vectors */
static void nsc_transit(
						int		output_p[],
						int		trans_p[],
						int		input,
						int     g[],
						int     KK,
						int     nn )
{
	int nextstate[1];
	int state, states;
	states = (1<<(KK-1));  /* The number of states: 2^mm */

	/* Determine the output and next state for each possible starting state */
	for(state=0;state<states;state++) {
		output_p[state]  = nsc_enc_bit( nextstate, input, state, g, KK, nn ); 
		trans_p[state]  = nextstate[0];
	}
	return;
}

/* Function rsc_transit()

  Copyright 2001, Matthew C. Valenti.
	
  Description: Calculates the "transition matrix" for the trellis.
  This information tells the decoder what the next state and output bits
  will be given the current state and input bit.

	Input parameters:
		input		Either 0 or 1 --- the input data bit.
		g[]			A two element vector containing the code generators.
		KK			The constraint length of the convolutional code.

	Output parameters:
		output_p[]	A vector of length max_states = 2^(KK-1) containing
		            the output symbols.
		trans_p[]   A vector of length max_states that tells the decoder
					what the next state will be given the input and current state.
	
  This function is used by turbo_decode()   */

static void rsc_transit(
						int	output_p[],
						int trans_p[],
						int	input,
						int g[],
						int KK,
						int nn )
{
	int nextstate[1];
	int state, states; 

	states = 1 << (KK-1); /* The number of states: 2^mm */

	/* Determine the output and next state for each possible starting state */
	for(state=0;state<states;state++) {
		output_p[state] = rsc_enc_bit( nextstate, input, state, g, KK, nn ); 
		trans_p[state]  = nextstate[0];
	}	
	return;
}

static void rsc_tail(
						int	tail_p[],
						int g[],
						int max_states,
						int mm )
{
	int state;

	/* Determine the tail for each state */
	for(state=0;state<max_states;state++) {		
		/* determine feedback word */
		tail_p[state] = parity_counter( g[0]&state, mm );
	}
	return;
}

static void conv_encode(
	     int		output_p[],
	     int		input[],
		 int		out0[], 
		 int		state0[], 
		 int		out1[], 
		 int		state1[],
         int		tail[],	 
         int        KK,
         int        LL,
		 int        nn )
{
  int i, j, inbit, outsym;
  int *bin_vec;
  int state = 0;

  bin_vec = calloc( nn, sizeof(int) );

  /* encode one bit at a time */
  for (i=0;i<LL+KK-1;i++) {
	  if (i<LL)
		  inbit = input[i]; /* data bit */
	  else
		  inbit = tail[state]; /* tail bit */
	  
	  if (inbit) {
		  /* Input is a one */
		  outsym = out1[state];  /* The output symbol */
		  
		  /* Determine next state */
		  state = state1[state];
	  } else {
		  /* Input is a zero */
		  outsym = out0[state];  /* The output symbol */
		  
		  /* Determine next state */
		  state = state0[state];
	  }

	  /* Convert symbol to a binary vector	*/
	  itob( bin_vec, outsym, nn );
		  
	  /* Assign to output */
	  for (j=0;j<nn;j++)
		  output_p[nn*i+j] = bin_vec[j];
  }

  free(bin_vec);

  return;
}


/* function Gamma()

  Description: Computes the branch metric used for decoding.

	Output parameters:
		(returned float) 	The metric between the hypothetical symbol and the recevieved vector
	
	Input parameters:
		rec_array			The received vector, of length nn
		symbol				The hypothetical symbol
		nn					The length of the received vector
	
  This function is used by siso()  */


static float Gamma(float  rec_array[],
				   int    symbol,
				   int    nn )
{
	float rm = 0;
	int i;
	int mask;
	
	mask = 1;
	for (i=0;i<nn;i++) {
		if (symbol&mask)
			rm += rec_array[nn-i-1];
		mask = mask<<1;
	} 
	
	return(rm);
} 


/* Function Viterbi()

  Description: Uses the Viterbi algorithm to perform hard-decision decoding of a convolutional code.

	Input parameters:
		out0[]		The output bits for each state if input is a 0 (generated by rsc_transit).
		state0[]	The next state if input is a 0 (generated by rsc_transit).
		out1[]		The output bits for each state if input is a 1 (generated by rsc_transit).
		state1[]	The next state if input is a 1 (generated by rsc_transit).
		r[]			The received signal in LLR-form. For BPSK, must be in form r = 2*a*y/(sigma^2).
		KK			The constraint length of the convolutional code.
		LL			The number of data bits.
		DecOpts		Decoder termination option = 0 for unterminated and = 1 for terminated.

	Output parameters:
		est[]		The log-likelihood ratio of each data bit.
	
  This function is used by turbo_decode()   
  
*/


static void Viterbi(
				int    output_u_int[],
				int    out0[], 
				int    state0[], 
				int    out1[], 
				int    state1[],
				float  input_c[],
				int    KK,
				int    nn,
				int    LL
				)
{
	int i, t, state, bit, mm, states;
	int number_symbols;
	float metric;
	float *trellis;
	int *prev_bit;
	int *prev_state;
	float *metric_c;	/* Set of all possible branch metrics */
	float *rec_array;   /* Received values for one trellis section */
	float max_val;
	
	/* some derived constants */
	mm = KK-1;
	states = 1 << mm;			/* 2^mm */
	number_symbols = 1 << nn;	    /* 2^nn */
	
	/* dynamically allocate memory */ 
	trellis = calloc( states*(LL+KK), sizeof(float) );
	prev_bit = calloc( states*(LL+KK), sizeof(int) );
	prev_state = calloc( states*(LL+KK), sizeof(int) );
	rec_array = calloc( nn, sizeof(float) );
	metric_c = calloc( number_symbols, sizeof(float) );
	
	/* initialize trellis */
	for (state=0;state<states;state++) {
		for (t=0;t<LL+KK;t++) {
			trellis[states*t+state] = -MAXLOG;
		}
	}
	trellis[0] = 0; /* start in all-zeros state */
	
	/* go through trellis */
	for (t=0;t<LL+mm;t++) {
		for (i=0;i<nn;i++)
			rec_array[i] = input_c[nn*t+i];
		
		/* precompute all possible branch metrics */
		for (i=0;i<number_symbols;i++)
			metric_c[i] = Gamma( rec_array, i, nn ); 
		
		/* step through all states */
		for (state=0;state<states;state++) {
			
			/* hypothesis: info bit is a zero */
			metric = trellis[t*states+state] + metric_c[ out0[ state ] ];
			
			/* store new metric if more than metric in storage */
			if ( metric > trellis[(t+1)*states+state0[state]] ) {
				trellis[(t+1)*states+state0[state]] = metric;
				prev_state[(t+1)*states+state0[state]] = state;
				prev_bit[(t+1)*states+state0[state]] = 0;
			}
			
			/* hypothesis: info bit is a one */
			metric = trellis[t*states+state] + metric_c[ out1[ state ] ];
			
			/* store new metric if more than metric in storage */
			if ( metric > trellis[(t+1)*states+state1[state]] ) {
				trellis[(t+1)*states+state1[state]] = metric;
				prev_state[(t+1)*states+state1[state]] = state;
				prev_bit[(t+1)*states+state1[state]] = 1;
			}
		}

		/* normalize */
		max_val = 0;
		for (state=0;state<states;state++)
			if (trellis[(t+1)*states+state]>max_val)
				max_val = trellis[(t+1)*states+state];		
			for (state=0;state<states;state++) 
				trellis[(t+1)*states+state] = trellis[(t+1)*states+state]-max_val;
	}
	
	/* trace-back operation */
	state = 0;

	/* tail, no need to output */
	for (t=LL+mm; t>LL; t--) {
		bit = prev_bit[t*states+state];
		state = prev_state[t*states+state];
	}

	for (t=LL; t>0; t--) {
		bit = prev_bit[t*states+state];
		state = prev_state[t*states+state];
		output_u_int[t-1] = bit;
		/* printf( "out[%d] = %d\n", t, bit ); */
	}
	
	/* free the dynamically allocated memory */
	free(trellis);
	free(prev_bit);
	free(prev_state);
	free(rec_array);
	free(metric_c); 
	
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久不卡网国产精品一区| 精品成人一区二区三区| 国产专区欧美精品| 免费精品视频在线| 另类中文字幕网| 精品午夜久久福利影院| 国内外成人在线视频| 国内精品在线播放| 国产精品一区二区久久精品爱涩| 国产一区二区三区电影在线观看| 精品一区二区三区久久| 国产成人午夜电影网| 成人一区二区三区中文字幕| 99精品国产91久久久久久| 色久综合一二码| 欧美精品久久一区二区三区| 日韩欧美123| 亚洲国产精品t66y| 一区二区视频免费在线观看| 五月天激情综合网| 精品影院一区二区久久久| 丰满少妇在线播放bd日韩电影| 成人三级伦理片| 色综合婷婷久久| 欧美日韩一区高清| 日韩欧美国产综合| 国产欧美精品国产国产专区| 亚洲乱码日产精品bd| 日本aⅴ亚洲精品中文乱码| 国产精品123| 色婷婷亚洲一区二区三区| 555夜色666亚洲国产免| 国产欧美日韩另类视频免费观看| 亚洲三级电影全部在线观看高清| 亚洲一二三专区| 另类专区欧美蜜桃臀第一页| 99久久精品费精品国产一区二区| 欧美日韩中文字幕一区| 国产亚洲欧美中文| 艳妇臀荡乳欲伦亚洲一区| 紧缚奴在线一区二区三区| 色伊人久久综合中文字幕| 欧美一区午夜精品| 自拍偷拍欧美激情| 久久99精品久久久久婷婷| 色综合一个色综合亚洲| 久久综合狠狠综合久久综合88| 亚洲欧美综合网| 精品一区二区三区视频| 色噜噜狠狠色综合中国| 国产色91在线| 轻轻草成人在线| 91麻豆免费视频| 久久久久久久久久久久久夜| 午夜电影久久久| 成人18视频日本| 欧美一级艳片视频免费观看| 亚洲激情图片小说视频| 国产成人av影院| 精品国产一区二区三区不卡 | 不卡的av电影在线观看| 日韩一二三四区| 一区二区三区精密机械公司| 粉嫩在线一区二区三区视频| 日韩精品一区二区三区中文不卡| 一区二区免费视频| 91网站在线观看视频| 中文字幕av不卡| 国产美女久久久久| 精品美女被调教视频大全网站| 亚洲国产va精品久久久不卡综合| 91丝袜呻吟高潮美腿白嫩在线观看| 久久综合精品国产一区二区三区| 日本免费在线视频不卡一不卡二| 色香色香欲天天天影视综合网| 国产精品美女久久久久久久网站| 国产成人精品三级| 国产无人区一区二区三区| 六月丁香婷婷久久| 2024国产精品| 国产一区二区三区精品视频| 久久综合色天天久久综合图片| 精品一区中文字幕| 国产亚洲精品7777| 成人午夜av电影| 日韩一区中文字幕| 在线观看三级视频欧美| 亚洲一区二区三区四区五区黄 | 一区二区三区四区不卡在线| 99久免费精品视频在线观看| 亚洲欧洲成人自拍| 在线观看视频一区二区| 午夜精品一区二区三区三上悠亚| 91.com在线观看| 精东粉嫩av免费一区二区三区| 久久久美女毛片| 97久久久精品综合88久久| 亚洲精品ww久久久久久p站| 欧美伊人久久久久久午夜久久久久| 亚洲电影视频在线| 日韩欧美中文字幕精品| 国产精品一级在线| 亚洲视频小说图片| 7777精品伊人久久久大香线蕉经典版下载 | 337p日本欧洲亚洲大胆精品| 国产精品一区二区在线观看不卡 | 亚洲三级免费观看| 欧美日韩精品免费| 精品一区二区在线看| 国产精品久久久久久久午夜片| 91老师片黄在线观看| 午夜欧美视频在线观看| 国产亚洲一本大道中文在线| 色av成人天堂桃色av| 日本成人在线网站| 国产欧美日韩中文久久| 欧美视频中文字幕| 国产精品一区二区视频| 一区二区三区中文字幕电影| 欧美xxxxxxxx| 成人aa视频在线观看| 免费精品99久久国产综合精品| 国产夜色精品一区二区av| 欧洲亚洲国产日韩| 国产麻豆成人传媒免费观看| 亚洲一区在线看| 久久一区二区三区国产精品| 欧美在线一区二区三区| 国产精品18久久久久| 一区二区三区四区激情| 日本一区二区三区在线不卡| 欧美日韩一二区| 成人免费视频视频在线观看免费| 日韩成人精品在线观看| 亚洲免费毛片网站| 2021中文字幕一区亚洲| 欧美三级中文字| 91蝌蚪porny| 国产美女精品一区二区三区| 天堂va蜜桃一区二区三区漫画版| 欧美国产精品一区二区| 精品久久久久久久一区二区蜜臀| 欧美性受xxxx黑人xyx| 成人av资源在线观看| 国产一区二区三区蝌蚪| 日本aⅴ免费视频一区二区三区 | 国产清纯美女被跳蛋高潮一区二区久久w | 色呦呦一区二区三区| 国产成人午夜视频| 精品一区二区久久久| 天天免费综合色| 亚洲小说欧美激情另类| 亚洲私人黄色宅男| 久久色在线观看| 精品国产一二三| 精品日产卡一卡二卡麻豆| 欧美一区二区网站| 欧美精品日韩综合在线| 欧美人妇做爰xxxⅹ性高电影| 日本久久一区二区| 91理论电影在线观看| 91蝌蚪porny| 91国偷自产一区二区使用方法| 99re视频精品| 99久久99久久综合| 色综合久久中文综合久久牛| 成人午夜免费电影| 不卡影院免费观看| 色综合天天综合网国产成人综合天 | 一区二区三区国产| 亚洲欧美一区二区在线观看| 国产精品久久久99| 亚洲欧美日韩一区二区| 亚洲人成人一区二区在线观看| 国产精品狼人久久影院观看方式| 中国av一区二区三区| 中文字幕在线观看一区二区| 亚洲欧洲三级电影| 一区二区在线看| 五月婷婷另类国产| 琪琪久久久久日韩精品| 青青草原综合久久大伊人精品 | 美腿丝袜在线亚洲一区| 经典三级一区二区| 国产成a人亚洲精品| 91美女片黄在线观看| 欧美妇女性影城| 久久无码av三级| 亚洲同性同志一二三专区| 亚洲国产一区二区视频| 首页欧美精品中文字幕| 国产呦萝稀缺另类资源| 菠萝蜜视频在线观看一区| 在线观看一区二区精品视频| 欧美一区2区视频在线观看| 国产亚洲综合av| 亚洲第一会所有码转帖| 国产一区二区三区四区五区美女| 99riav一区二区三区| 欧美一区二区三区免费在线看 |