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

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

?? tsvq_util.c

?? Vector Quantization壓縮算法
?? C
?? 第 1 頁 / 共 2 頁
字號:
/****************************************************************************** * NAME *    tsvq_util.c *    J. R. Goldschneider *    February 1994 *    Last Revision: * * SYNOPSIS *    BOOLEAN initialize_tree(root,trsqfile,trsqname) *    BOOLEAN lloyd(node) *    void    split_node(node,leftcentroid,rightcentroid) *    void    split_alternate(node,leftcentroid,rightcentroid)) *    long    tree_clean(root) * * DESCRIPTION *    initialize_tree reads the training vectors and stores them in the *    root node, finds the centroid of the training sequence, *    and assigns values to the root structure's members. * *    lloyd performs the Generalized Lloyd Algorithm on the node's data. *    It must create the node's children and find two initial codewords *    with a call to split_node.  If the node has zero distortion, lloyd *    will return at this point and the slope will be zero.  If the node *    has a non-zero distortion (count >= 1) then lloyd will try to *    split the node.  If lloyd finds that it cannot create two cells with *    non-zero counts when the distortion of the parent node is non-zero, *    it will call split_alternate as a second attempt to create two *    cells with non-zero count.  If this second attempt fails, then the *    program will not try any other splits, and it will exit the GLA loop. *    If the threshold is set to zero, we know that at each node the *    centroid of the training vectors is the codeword. Therefore the codeword *    of the non-zero count child cell is the same as parent cell. *    In this case the resulting slope will be zero, so the two children *    nodes will not be added to the tree.  If the threshold is greater *    than zero, then it may be that the centroid of the training vectors *    is NOT the codeword!  Therefore the codeword of the non-zero count *    child cell may be different from that of its parent and so that *    child's distortion may by less than that of its parent.  In this *    case the resulting slope is positive, so the two children may *    be added to the tree.  This would result in the addition of an *    empty cell into the codebook tree, i. e. a wasted bit. Since a user *    defined threshold is still an option, lloyd checks for empty cells *    and prints a warning to the user.  So the moral of this story is to *    use a threshold of zero.  Once the codewords are found, lloyd takes *    the training sequence of the parent node and divides it among its *    children.  The parent node's training sequence pointer is freed to *    save space. * *    split_node creates two codewords.  The left codeword is given *    the parent's data, and the right codeword is given a perturbed version *    of the parent's data. The perturbation is that the *    rightcentroid[i] = node->data[i] * (1 + mult_offset) *    where i = 0, 1, ..., dim. * *    split_alternate is called when the lloyd iteration has tried to split *    a node with a non-zero distortion, but that split has been unsuccessful. *    alternate split assigns the centroid as one initial codeword, and it *    finds the training vector that is furthest from the centroid and makes *    it the second initial codeword. * *    tree_clean removes all of the nodes from the tree that are NOT designed. *    It also counts the number of designed nodes and checks for tree *    structure errors. This should be called before write_codebook and *    write_stat. * * RETURN VALUE *    initialize_tree returns TRUE if successful.  If it not successful, then *    an error message is printed and FALSE is returned. * *    lloyd returns TRUE if there are no problems, otherwise it returns *    FALSE and displays an error message. * *    split_node does not return any value.  It does modify the node's *    children's data. * *    split_alternate does not return any value.  It does modify the node's *    children's data. * *    tree_clean returns the number of nodes in the tree.  If there is a *    tree structure error, then it returns a zero. * * PARAMETERS *    root is the root of the codebook tree. * *    root is the root node of the tree. *    trsqfile is the file containing the training sequence. *    trsqname is the name of the training sequence file. * *    node is the node to be split. * *    node is the node to use to find the initial codewords. *    leftcentroid is the initial codeword that is the same as the parent. *    rightcentroid is the different codeword. * * CALLS *    dist() newchild() newnode() * *****************************************************************************/#include "tsvq.h"char     *programname;int      dim;DISTTYPE mult_offset;DISTTYPE thresh;void split_node();void split_alternate();BOOLEAN initialize_tree(root,trsqfile,trsqname)     TreeNode *root;       /* node to initialize */     FILE     *trsqfile;   /* training sequence file */     char     *trsqname;   /* training sequence name */{  DATATYPE *data_vector;  /* used to store one training vector */  DISTTYPE distortion;    /* distortion of training vectors to centroid */  long     count;         /* the number of training vectors */  long     i,j;           /* counters */  /* allocate memory for data_vector */  if (!(data_vector = (DATATYPE *) calloc(dim,sizeof(DATATYPE)))) {    fprintf(stderr,"%s: %s\n",programname,NOMEMORY);    return(FALSE);  }  /* set the codeword to all zeros */  for (i = 0; i < dim; i++) {    root->data[i] = 0.0;  }  /* find the number of training vectors */  rewind(trsqfile);  for (count = 0; ; ) {    if (fread((char *) data_vector,sizeof(DATATYPE),dim,trsqfile) != dim ||	feof(trsqfile) || ferror(trsqfile)) {      break;    }    count++;  }  if (count == 0) {    fprintf(stderr,"%s: %s: %s\n",programname,trsqname,NODATA);    return(FALSE);  }  /* allocate memory for the training vector array */  if (!(root->trainseq = (DATATYPE **) calloc(count,sizeof(DATATYPE *)))) {    fprintf(stderr,"%s: %s\n",programname,NOMEMORY);    return(FALSE);  }  /* read the training vectors, and compute centroid */  rewind(trsqfile);  for (i = 0; i < count;  i++) {    /* read in the next training vector */    if (fread((char *) data_vector,sizeof(DATATYPE),dim,trsqfile) != dim ||	feof(trsqfile) || ferror(trsqfile)) {      fprintf(stderr,"%s: %s: %s\n",programname,trsqname,NOREAD);      return(FALSE);    }    /* allocate memory for the training vector */    if(!(root->trainseq[i] = (DATATYPE *) calloc(dim,sizeof(DATATYPE)))){      fprintf(stderr,"%s: %s\n",programname,NOMEMORY);      return(FALSE);    }    /* copy the training vector and add to the sum of training vectors */    for (j = 0; j < dim; j++) {      root->trainseq[i][j] = data_vector[j];      root->data[j] += ((DISTTYPE) data_vector[j]);    }  }  /* normalize the sum of training vectors */  for (i = 0; i < dim; i++) {    root->data[i] /= ((DISTTYPE) count);  }  root->count = count;  root->designed = TRUE;  /* compute the average distortion */  distortion = 0.0;  for (i = 0; i < count; i++) {    distortion += dist(root->trainseq[i],root->data);  }  distortion /= ((DISTTYPE) root->count);  root->avmse = distortion;  /* release memory */  free((char *) data_vector);  return(TRUE);}BOOLEAN lloyd(node)     TreeNode *node;{  long     leftcount, rightcount;  DISTTYPE *leftcentroid, *rightcentroid;  DISTTYPE leftdist, rightdist;  DISTTYPE current_dist, past_dist;  DISTTYPE current_leftdist, current_rightdist;  long     i,j;  BOOLEAN  alternate_flag = FALSE; /* avoid an infinite loop */  /* allocate space centroids of the left and right nodes */  if(!(leftcentroid = (DISTTYPE *) calloc(dim,sizeof(DISTTYPE))) ||     !(rightcentroid = (DISTTYPE *) calloc(dim,sizeof(DISTTYPE)))) {    fprintf(stderr,"%s: %s\n",programname,NOMEMORY);    return(FALSE);  }  /* create the node's children */  if(!(node->left_child = newchild(node)) ||     !(node->right_child = newchild(node))) {    fprintf(stderr,"%s: %s\n",programname,NOMEMORY);    return(FALSE);  }  /* initialize the codebook */  split_node(node,leftcentroid,rightcentroid);  /* initialize the current distortion as some enormous number */  current_dist = HUGE;  /* if the node's distortion is zero, leave, the slope will be zero.     this is also the appropriate exit for a node with a zero count */  if(node->avmse <= 0) return(TRUE);  do{    /* assign the codewords and clear the centroids, counts, and distortions */    for (j = 0; j < dim; j++) {      node->left_child->data[j] = leftcentroid[j];      leftcentroid[j] = 0.0;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
26uuu国产一区二区三区| 樱桃国产成人精品视频| 韩国三级电影一区二区| 7777精品伊人久久久大香线蕉经典版下载| 久久久久国产精品厨房| 91色porny蝌蚪| 午夜久久福利影院| 精品成人一区二区| 91免费观看在线| 精品在线免费观看| 成人欧美一区二区三区在线播放| 一本久道中文字幕精品亚洲嫩| 亚洲国产另类精品专区| 精品sm捆绑视频| 欧美日韩视频在线第一区| 奇米影视在线99精品| 国产精品免费久久久久| 欧美色图片你懂的| www.亚洲在线| 国产一区二区剧情av在线| 亚洲电影第三页| 最新高清无码专区| 国产欧美一区二区三区在线看蜜臀 | 亚洲精品日韩综合观看成人91| av电影天堂一区二区在线 | 亚洲国产精品一区二区久久恐怖片| 欧美午夜精品久久久| 91女神在线视频| 国产91精品入口| 成人av在线网站| 国产精品一区二区在线观看网站| 亚洲成av人片在线| 亚洲一区二区三区自拍| 亚洲激情网站免费观看| 国产精品久久看| 亚洲三级小视频| 亚洲欧美色综合| 亚洲三级在线免费| 亚洲国产精品一区二区久久恐怖片 | www.色精品| 国产最新精品免费| 国产资源精品在线观看| 高潮精品一区videoshd| 成人av午夜电影| 色女孩综合影院| 在线成人av网站| 久久久噜噜噜久久中文字幕色伊伊| 538在线一区二区精品国产| 精品精品国产高清一毛片一天堂| 欧美大尺度电影在线| 亚洲欧洲一区二区在线播放| 综合激情成人伊人| 美女国产一区二区| 国产69精品久久99不卡| 欧美丰满高潮xxxx喷水动漫| 精品国产三级a在线观看| 亚洲欧美乱综合| 国产成人在线电影| 欧美色综合久久| 久久精品欧美一区二区三区不卡| 亚洲人123区| 色婷婷av一区| 国产午夜亚洲精品不卡| 亚洲一区二区三区不卡国产欧美| 青青草国产成人99久久| 丁香啪啪综合成人亚洲小说| 欧美日韩激情一区二区| 中文字幕亚洲不卡| 麻豆国产精品视频| 欧美无人高清视频在线观看| 亚洲日本中文字幕区| 黄色精品一二区| 久久天天做天天爱综合色| 视频一区欧美精品| 欧美久久一二区| 亚洲已满18点击进入久久| 成人性生交大合| 国产精品欧美久久久久无广告| 狠狠色丁香婷综合久久| 91精品国产欧美一区二区成人| 亚洲自拍偷拍av| 欧美电影影音先锋| 午夜私人影院久久久久| 欧美日韩高清一区| 日韩av一区二区三区| 18成人在线观看| 国产一区二区三区黄视频| 欧美日韩中文一区| 欧美国产激情一区二区三区蜜月| 日韩电影在线免费观看| 久久久不卡影院| 色哟哟精品一区| 激情综合五月天| 国产精品毛片久久久久久| caoporm超碰国产精品| 青青草国产精品97视觉盛宴| 日韩欧美成人午夜| aaa亚洲精品| 精品一区二区影视| 青青草国产成人av片免费| 在线播放欧美女士性生活| 欧美一区二区三区四区高清| 国内精品免费**视频| 国产日韩欧美综合一区| 欧美日韩中文精品| 国产精品99久久久久久有的能看 | 国产成人在线影院| 亚洲国产美女搞黄色| 亚洲欧洲国产专区| 国产精品五月天| 国产亚洲一区二区三区四区| 欧美亚洲国产一区在线观看网站 | 麻豆久久一区二区| 午夜激情一区二区三区| 一区二区在线观看免费视频播放| 精品国产乱码久久久久久久| 欧美一级免费观看| 欧美一区二区三区四区五区 | 91精品国产综合久久婷婷香蕉| 972aa.com艺术欧美| 成人一区二区在线观看| 国产在线国偷精品产拍免费yy| 精一区二区三区| 国产风韵犹存在线视精品| 不卡视频一二三| 国产盗摄精品一区二区三区在线| 亚洲国产wwwccc36天堂| 青青草伊人久久| 国产福利一区二区三区视频在线| 国产美女av一区二区三区| 国产乱对白刺激视频不卡| 成人性生交大片免费看视频在线| 成人av资源下载| 日本久久一区二区| 精品欧美乱码久久久久久 | 欧美精品久久99| 久久综合久久综合亚洲| 中文字幕色av一区二区三区| 亚洲一区在线播放| 国产在线乱码一区二区三区| 国产黑丝在线一区二区三区| 色8久久精品久久久久久蜜| 91精品国产欧美一区二区18| 国产农村妇女毛片精品久久麻豆 | 午夜激情一区二区| 99久久er热在这里只有精品15| 欧美成人一区二区| 夜夜精品视频一区二区 | 美女性感视频久久| 欧美精品v国产精品v日韩精品| 国产欧美日韩不卡免费| 久久精品国产亚洲高清剧情介绍 | 99免费精品在线观看| 精品欧美一区二区久久| 亚洲18女电影在线观看| 91视视频在线观看入口直接观看www| 91精品国产综合久久国产大片| 一级做a爱片久久| 色老汉一区二区三区| 国产精品久久久久国产精品日日| 久久国产精品99久久人人澡| 777欧美精品| 日韩制服丝袜av| 精品免费一区二区三区| 日本欧洲一区二区| 欧美一区二区免费观在线| 午夜欧美一区二区三区在线播放| 欧美在线视频你懂得| 亚洲综合一区二区三区| 欧美人牲a欧美精品| 亚洲综合免费观看高清完整版 | 色偷偷成人一区二区三区91| 18涩涩午夜精品.www| 欧美军同video69gay| 久草这里只有精品视频| 国产日本欧美一区二区| 91免费视频观看| 久久激情五月婷婷| 亚洲欧美偷拍三级| 久久综合久久综合九色| 国产精品99久| 人人爽香蕉精品| 亚洲人午夜精品天堂一二香蕉| 91在线一区二区| 精品在线播放免费| 亚洲一区二区综合| 国产精品精品国产色婷婷| 69p69国产精品| 日本高清无吗v一区| 黄页网站大全一区二区| 偷拍一区二区三区四区| 中文字幕一区二区在线播放| 日韩三级中文字幕| 欧美色综合天天久久综合精品| www.视频一区| www.综合网.com| 91在线视频网址| 91社区在线播放| 日本久久电影网| 欧美性大战久久久久久久|