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

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

?? code.c

?? matlab實現wcdma的全過程
?? C
字號:
/* | Project:     WCDMA simulation environment | Module:     | Author:      Maarit Melvasao | Date:        May 15, 1999 | | History: |              June 10, 1999 Maarit Melvasalo |                      Double function added for matlab mex files. |  | Limitations: |              Code length must be in between 2^2 ... 2^8 |              The index must be greater tahn 0 and less or equal |              to code length       | | Copyright disclaimer: |   This software was developed at the National Institute of Standards |   and Technology by employees of the Federal Government in the course |   of their official duties. Pursuant to title 17 Section 105 of the |   United States Code this software is not subject to copyright |   protection and is in the public domain. | |   We would appreciate acknowledgement if the software is used. |*/      #include <math.h>#include "code.h"#include "config_wcdma.h"#include "wcdma_simulink.h"#ifndef TRUE#define TRUE 1#define FALSE 0#endif /* TRUE *//* ------------ S T A T I C   D A T A   S T R U C T U R E S ----------- *//* List that keeps record which code instances are used /**/static enum instance_state code_alloc_list[MAX_CODES];/* Total number of occupied codes /**/static int code_count = 0;/* General initialization flag /**/static int general_code_init_flag = FALSE;/* Code matirx to keep in memory the code length and    the index number of each code instance /**/static code_matrix code_data[MAX_CODES];/* -------------------------------------------------------------------- *//* * Function:    wcdma_channel_init *  * Desc.:       Code initialization *               *              Checks that number of codes is accurate.  *              Saves the spreading code length to instance. *              Returns the code instance.    * Note: *//* -------------------------------------------------------------------- */int wcdma_code_init(int code_lenght){  int i,j,instance,n_intervals;    /*     * If first call, initialize static data.     */    if (general_code_init_flag == FALSE) {        for (i=0; i < MAX_CODES; i++) {            code_alloc_list[i] = FREE_INSTANCE;        } /* for */        general_code_init_flag = TRUE;    } /* if general_init_flag */    /*     * Find first free instance number.     */    instance = -1;    for (i=0; i < MAX_CODES; i++) {        if (code_alloc_list[i] == FREE_INSTANCE) {            instance = i;            break;        }    }    if (instance == -1) return(-1); /* no free instances */        code_count ++;    code_data[instance].code_len = code_lenght;    code_alloc_list[i] =  INSTANCE_IN_USE;   return(instance);}/* -------------------------------------------------------------------- *//* * Function:    wcdma_ovsf_code (int instance, int code[]) * * Desc.:               *          *              Finds the next available code for given code instance. *              Return value = index number   /**//* -------------------------------------------------------------------- */int wcdma_ovsf_code(		    int instance, 		    int code[]){  int tmp,nCode,index ;  code_matrix *code_tree;  code_tree = &code_data[instance];  /*    Finds the next suitable code index for given code instance    If no orthogonal codes can be found returns -1    /**/  tmp = wcdma_code_tree_update(instance, code_tree);	    if(tmp == -1) return(-1);  /*       Gets the OVSF code with given length and index.    /**/  nCode = code_tree->code_len;  index = code_tree->index;  wcdma_get_ovsf_code(nCode, index, code);/**/    return(code_tree->index);}/* -------------------------------------------------------------------- *//* * Function:    wcdma_ovsf_code_double * * Desc.:       Interface function between mex-functions (matlab) and *              function:   wcdma_ovsf_code (int instance, int code[]) * *              Return value : code index * Note:        Here the code is double vector not a integer.       * *//* -------------------------------------------------------------------- */int wcdma_ovsf_code_double(int instance, double code[]){  int code_tmp[MAX_SPREADING_FACTOR];  int tmp,i,nCode;  code_matrix *code_tree;  /*      Call  wcdma_ovsf_code  with a integer code vector  /**/     tmp = wcdma_ovsf_code(instance, code_tmp);  if(tmp == -1) return(-1);  /* If the code was succesfully found return a double vector      /**/  code_tree = &code_data[instance];  nCode = code_tree->code_len;  for (i=0; i < nCode ;i++){    code[i] = code_tmp[i];    }  return(tmp);}/* -------------------------------------------------------------------- *//* * Function:    wcdma_get_ovsf_code * * Desc.:       Gets the OVSF code for given code length and index * * Note:        Returns 0 *//* -------------------------------------------------------------------- */int wcdma_get_ovsf_code(			int nCode, 			int index, 			int *code){    code_matrix *code_tree;    int i, k ,l, k_max, sf, i_tmp,cur_k, a;    int tmp[9];    /*        If the index is 1 code is just 1's       /**/    if (index == 1 ){      for (i = 0; i<nCode; i++){	code[i] = 1; }    return(0);    }    /*        If the index is nCode code is just - 1's       /**/    if (index == nCode ){      for (i = 0; i<nCode; i++){	code[i] = - 1; }    return(0);    }    /* else /**/    k_max = 0;    sf = nCode / 2;    i_tmp = index;    tmp[0] = index;    /*        Find the code index's in the tree above the given code        /**/    while ( sf > 1) {      k_max++;      i_tmp = floor((i_tmp + 1 )/2);      tmp[k_max] = i_tmp;       sf = sf / 2;    }    /*        Get the code for the given path in the tree       Initial code is 1.        /**/        code[0] = 1;    for (k = 0; k <= k_max ; k++){      /* 		 The length of the current code  /**/      cur_k = pow(2, k );      /* 	 Indicator to which brach to take next 	 /**/       /*      a = 1;  	      if((tmp[k_max - k] % 2) == 0 ) a = -1;  /**/      a = ((tmp[k_max - k] % 2) == 0 ) ? -1 : 1;      /*	Add the new branch to existing code	/**/      for (i = 0; i < cur_k ; i++){	code[ cur_k + i ] = a * code[ i ];	}    }    return(0);}/* -------------------------------------------------------------------- *//* * Function:    wcdma_get_ovsf_code_double * Desc.:        * Desc.:       Interface function between mex-functions (matlab) and *              function:   wcdma_get_ovsf_code ( ) * *              Return value : int * Note:        Here the code is double vector not a integer.       * *//* -------------------------------------------------------------------- */int wcdma_get_ovsf_code_double(			       int nCode, 			       int index, 			       double code[]){  int code_tmp[MAX_SPREADING_FACTOR];  int i,tmp; /*      Call  wcdma_ovsf_code  with a integer code vector  /**/     tmp = wcdma_get_ovsf_code(nCode, index, code_tmp);  /* If the code was succesfully found return a double vector      /**/  for (i=0; i<nCode;i++){    code[i] = (int) code_tmp[i];    }/**/   return(0);}/* -------------------------------------------------------------------- *//* * Function:    wcdma_code_tree_update * * Desc.:       Finds the next suitable code index ofr given code instance *              and updates the code_matrix        * *              Return value =  *                        1 if a acceptable candidate was found *                        -1 if no more codes of this leght are available  * Note:  /**//* -------------------------------------------------------------------- */int wcdma_code_tree_update(			   int instance, 			   code_matrix *code_tree){    int i, j, c, k, k_index, c_index, c_len, nCode, pot,p,ican;    int small,big,k_tmp;    int flag[MAX_SPREADING_FACTOR];    nCode = code_tree->code_len;        /*      If this is the first coe      /**/    if (code_count == 1) {      code_tree->index = nCode / 2;        return (1);    }    /*        Tmp vector to indicate if the index is acceptable or not       /**/    for (i = 0; i<nCode ; i++ ){      flag[i] = 1;    }    /*      Search through all possible index's until suitable index is found.      Start the search from the codes in  the middle      /**/    for (i = nCode/2; i<nCode ; i++ ){        /* 	 look for codes in the upper and in the lower branch   /**/      for (j = 0; j < 2; j++ ){         	ican = 1 + j * nCode + pow(-1, j) * (i + j);  /*candidate for index /**/	/* j = 0 -> ican = nCode/2 + 1... nCode i.e. lower codes/*/	/* j = 1 -> ican = nCode/2  .... 1 i.e. upper codes/**/	/* ican = 1 + [8 7 9 6 10 5 11 4 12 3 13 2 14 1 15 0] /**/	/*	  Searches over the existing codes	  /**/	for (c = 0; c < MAX_CODES ; c++){  /*code_count; c++){/**/	  if ((c != instance) && (code_alloc_list[c] == INSTANCE_IN_USE))	    {	       	      c_index = code_data[c].index;	      c_len = code_data[c].code_len;	      /* 		 First check if the codes are on the different sides of the middle 		 /**/	      if (j > 0 &&  c_index > (c_len /2) ) {	      }	      else if ( j == 0 && c_index <= (c_len /2 ) ){	      } /* it is ok for to use this index compared to this existing code /**/	      	      /* Else if  		  the code length is same with the existing one		  /**/  	      else if (nCode == c_len ){   		if( ican == c_index) {    /* if the index is already in use /**/  		  flag[ican - 1] = 0; break;}  /* this index can not be used/**/	      }	      /* Else if 		 the existing code is longer /**/	      else if (nCode < c_len){ 		k_tmp = 2;		while (k_tmp * nCode < c_len) 		  { k_tmp = k_tmp * 2; };		if( (c_index  <=  (k_tmp * ican ) ) && ( c_index >  (k_tmp * (ican-1) ))){		  flag[ican - 1] = 0; break; /* this index can not be used/**/		}}	      /* Else if		 the existing code is shorter /**/ 	      	      else { 		k_tmp = 2;		while (k_tmp * c_len < nCode) 		  { k_tmp = k_tmp * 2; };		if(  (ican /k_tmp + min(1,(ican % k_tmp))) ==  c_index){ 		  flag[ican - 1] = 0; break; }  /* this index can not be used/**/	      }	    }  /* for-loop over the existing codes/**/	}	/* if 	   ican was a suitable candidate compared to all existing codes	   /**/	if (flag[ican - 1 ] == 1){	  code_tree->index = ican; 	  return(1);	}      }    }    code_tree->index = -1 ;     return (-1); /*no possible code index was found/**/}/* -------------------------------------------------------------------- *//* * Function:    wcdma_find_index * * Desc.:       Finds the next suitable code index for given code lengths *               * *              Return value =  *                        code index  if a acceptable candidate was found *                        -1 if no more codes of this leght are available  * * Note:        This is a interface function for matlab mex   /**//* -------------------------------------------------------------------- */int wcdma_find_index( int instance) {  int index,tmp ;  code_matrix *code_tree;  code_tree = &code_data[instance];  /*    Finds the next suitable code index for given code instance    If no orthogonal codes can be found returns -1    /**/  tmp = wcdma_code_tree_update(instance, code_tree);    if(tmp == -1) return(-1);  /*    Retuns the suitable index    /**/  return(code_tree->index);}/* -------------------------------------------------------------------- *//* * Function:    wcdma_find_index * * Desc.:       Finds the next suitable code index for given code lengths *               * *              Return value =  *                        code index  if a acceptable candidate was found *                        -1 if no more codes of this leght are available  * * Note:        This is a interface function for matlab mex   /**//* -------------------------------------------------------------------- */int wcdma_get_indexes( int number_of_codes,		       double codes[],		       double *indexes) {  int index,tmp,i ;  for (i = 0 ; i<number_of_codes; i++){     tmp = wcdma_code_init((int)codes[i]);    /*      Finds the next suitable code index for given code instance      If no orthogonal codes can be found returns -1      /**/    indexes[i] = (double)wcdma_find_index(tmp);  }  for (i = 0 ; i<number_of_codes; i++){     tmp = wcdma_code_free(i);  }}/* -------------------------------------------------------------------- *//* * Function:    wcdma_code_print * * Desc.:       just a PRINT FUNCTION !!!!!!!!!!!   * * Note:        For testing purposes only *//* -------------------------------------------------------------------- */void code_print(int instance){  int tmp ;    code_matrix *code_tree;    code_tree = &code_data[instance];    printf("instance: %d  len: %d  index: %d \n", instance,code_tree->code_len,code_tree->index);}/* -------------------------------------------------------------------- *//* * Function:    wcdma_code_free * * Desc.:       code clear function. * * Note: *//* -------------------------------------------------------------------- */int wcdma_code_free(int instance){     code_alloc_list[instance] = FREE_INSTANCE;  code_count--;  return(0);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91成人看片片| 欧美日韩国产首页在线观看| 亚洲欧美激情一区二区| 69堂国产成人免费视频| 国产成人免费在线观看| 一区二区三区四区不卡视频 | 91理论电影在线观看| 日韩精品视频网站| 国产精品乱子久久久久| 欧美一级黄色大片| 91高清视频免费看| 高清国产一区二区三区| 裸体一区二区三区| 一区二区三区电影在线播| 久久精品日产第一区二区三区高清版 | 中文字幕日韩一区| 欧美videos中文字幕| 欧美性生交片4| 成人国产免费视频| 狠狠色狠狠色合久久伊人| 五月激情综合婷婷| 有码一区二区三区| 中文字幕一区二区三区精华液| 欧美一区欧美二区| 在线视频你懂得一区二区三区| 国产精品亚洲一区二区三区妖精 | 一区二区三区日韩在线观看| 久久久一区二区三区| 伊人婷婷欧美激情| 国产精品色噜噜| 精品福利二区三区| 欧美一级片在线| 欧美日韩一区 二区 三区 久久精品| 成人精品视频一区| 国内精品伊人久久久久av一坑| 日本vs亚洲vs韩国一区三区 | 精品美女被调教视频大全网站| 欧美乱妇15p| 欧美日韩国产大片| 欧美伊人精品成人久久综合97| 色呦呦日韩精品| 91色乱码一区二区三区| 99精品1区2区| 91色porny在线视频| 99久久国产综合精品色伊| 大尺度一区二区| 高清国产一区二区三区| 成人性色生活片| 粉嫩av一区二区三区在线播放 | 欧美专区日韩专区| 精品1区2区3区| 欧美精品久久天天躁| 在线播放国产精品二区一二区四区| 欧美亚洲一区二区在线观看| 欧美日韩亚洲综合一区二区三区| 欧美日韩国产成人在线91| 欧美精品一卡二卡| 日韩欧美色综合| 精品国产sm最大网站免费看| 久久午夜老司机| 中文字幕欧美日韩一区| 中文字幕亚洲一区二区av在线| 中文字幕日韩一区二区| 亚洲一区二区三区国产| 婷婷中文字幕综合| 久久99国产精品免费网站| 狠狠狠色丁香婷婷综合久久五月| 国产高清不卡二三区| 成人黄色av电影| 在线看国产一区二区| 欧美人伦禁忌dvd放荡欲情| 日韩精品一区二区在线| 中文字幕av在线一区二区三区| 国产又粗又猛又爽又黄91精品| 粗大黑人巨茎大战欧美成人| 日本精品免费观看高清观看| 91精品国产一区二区| 久久九九99视频| 亚洲最大的成人av| 久久精品国产**网站演员| 国产成人av电影在线播放| 91免费观看视频| 日韩亚洲电影在线| 国产精品久久久爽爽爽麻豆色哟哟| 亚洲女同一区二区| 久久丁香综合五月国产三级网站| 99re热视频这里只精品| 在线综合视频播放| 中日韩av电影| 婷婷一区二区三区| 国产成人午夜高潮毛片| 欧美午夜宅男影院| 久久综合狠狠综合久久激情| 亚洲男人天堂一区| 久久se精品一区精品二区| 色哟哟日韩精品| 久久久精品国产免大香伊| 亚洲国产中文字幕在线视频综合| 捆绑变态av一区二区三区| 一本久道中文字幕精品亚洲嫩| 精品国产露脸精彩对白| 亚洲自拍偷拍网站| 成人午夜激情在线| 91精品国产综合久久久久| 日韩精品一区二区三区视频在线观看| 日本一区二区三区四区在线视频 | 亚洲制服丝袜一区| 久久97超碰国产精品超碰| 色综合久久88色综合天天| 亚洲精品一区二区三区在线观看 | 91首页免费视频| 久久综合久久综合九色| 午夜伊人狠狠久久| 色天天综合色天天久久| 国产欧美日韩视频一区二区| 精品一区二区三区在线播放视频 | 亚洲综合成人网| av成人动漫在线观看| 久久久久久久久免费| 蜜桃一区二区三区在线| 精品视频在线免费看| 亚洲理论在线观看| 波多野结衣亚洲一区| 久久亚洲综合色一区二区三区| 日本不卡一区二区三区| 欧美日韩你懂的| 亚洲国产视频网站| 一本色道a无线码一区v| 亚洲区小说区图片区qvod| 成人午夜激情片| 国产亚洲一区二区三区在线观看| 蜜臀av性久久久久蜜臀aⅴ流畅| 91精品久久久久久久99蜜桃| 亚洲一级二级在线| 欧美主播一区二区三区美女| 一区二区三区在线视频观看| 97精品电影院| 亚洲精品国产成人久久av盗摄| 99在线热播精品免费| 国产精品久久久久国产精品日日 | 欧美在线观看视频一区二区三区| 亚洲欧洲精品一区二区三区 | 日本在线不卡一区| 欧美一区二区免费观在线| 日本中文一区二区三区| 欧美大片一区二区| 精品亚洲国产成人av制服丝袜 | 亚洲一区二区精品久久av| 欧美色网站导航| 日韩黄色一级片| 日韩一区二区精品在线观看| 美女视频一区二区三区| 日韩免费看的电影| 国产一区二区三区精品视频| 中文字幕不卡三区| 一本一本大道香蕉久在线精品 | 久久―日本道色综合久久| 国产精品综合一区二区| 中文在线一区二区| 欧美最猛黑人xxxxx猛交| 午夜av电影一区| 26uuu精品一区二区在线观看| 国产成都精品91一区二区三| 中文字幕一区免费在线观看| 色婷婷激情一区二区三区| 偷窥国产亚洲免费视频| 久久久不卡网国产精品二区| 成人的网站免费观看| 亚洲精品视频在线| 日韩一区二区在线看片| 国产成人三级在线观看| 亚洲精品久久7777| 日韩一区二区三区视频在线 | 亚洲资源在线观看| 欧美一区二区网站| 成人午夜免费电影| 亚洲一区二区三区精品在线| 精品国产一区a| 色综合中文字幕国产| 一区二区高清视频在线观看| 日韩午夜中文字幕| 99精品在线观看视频| 日本特黄久久久高潮| 中文字幕一区二区在线播放| 91麻豆精品国产91久久久久久久久| 国产毛片精品视频| 亚洲国产另类av| 欧美韩国日本不卡| 制服丝袜日韩国产| 播五月开心婷婷综合| 日本人妖一区二区| 亚洲精品伦理在线| www国产成人免费观看视频 深夜成人网| 91在线一区二区| 久久精品二区亚洲w码| 一二三区精品福利视频| 久久久亚洲精品一区二区三区| 欧美午夜理伦三级在线观看| 成人爱爱电影网址| 国产一区二区三区在线观看精品|