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

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

?? ahuff.c

?? 數(shù)據(jù)壓縮Huffman算法
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*two different final applications:	archiver: mem use don't matter; speed is critical	balrog  : mem use is critical; speed must be better than Arith*//*todo : 		1. allow weights of 1 to be scaled to 0 and dropped out*/#include <simple/gen.h>#include <simple/exec.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <ctype.h>	#include <crb/memutil.h>#include <crb/bitio.h>#define ESCAPE            AHI->NumSymbols#define SYMBOL_COUNT      (AHI->NumSymbols+1)#define NODE_TABLE_COUNT  ( ( SYMBOL_COUNT * 2 ) - 1 )#define ROOT_NODE         0#define NODE_NONE					0xFFFF#define MAX_WEIGHT 				0x8000/* * This data structure is all that is needed to maintain an adaptive * Huffman tree for both encoding and decoding.  The leaf array is a * set of indices into the nodes that indicate which node is the * parent of a symbol.  For example, to encode 'A', we would find the * leaf node by way of leaf[ 'A' ].  The next_free_node index is used * to tell which node is the next one in the array that can be used. * Since nodes are allocated when characters are read in for the first * time, this pointer keeps track of where we are in the node array. * Finally, the array of nodes is the actual Huffman tree.  The child * index is either an index pointing to a pair of children, or an * actual symbol value, depending on whether 'child_is_leaf' is 1 * or 0. */struct AHuffNode	{  uword parent;  uword child;	uword weight;  ubyte child_is_leaf; /* could merge this flag in with child */  };struct AHuffTree	{	uword next_free_node;	uword * leaf; /* SYMBOL_COUNT of them */		/* must be uword cuz of ESCAPE :^( */  struct AHuffNode * nodes; /* NODE_TABLE_COUNT of them */	}; /* 4105 bytes */struct AHuffInfo	{	uword NumSymbols;	struct BitIOInfo * BII;	struct AHuffTree * Tree;	};/* externally available protos: */struct AHuffInfo * AHuff_Init(struct BitIOInfo * inBII,long inNumSymbols);void AHuff_CleanUp(struct AHuffInfo *AHI);void __regargs __inline AHuff_EncodeC(struct AHuffInfo *AHI,long c);long AHuff_DecodeC( struct AHuffInfo *AHI );void AHuff_UpdateModel( struct AHuffInfo *AHI , long c );void AHuff_InitializeTree( struct AHuffInfo *AHI );void AHuff_HalveTree( struct AHuffInfo *AHI );/* macro protos:void swap_nodes( struct AHuffTree *Tree, long i, long j );void add_new_node( struct AHuffTree *Tree, long c );void AHuff_UpdateModel_Macro( struct AHuffInfo *AHI, struct AHuffTree *Tree, long c );*///global workspace for macros:struct AHuffNode TempNode;long lightest_node,new_node,zero_weight_node,current_node;/* macros: */#define swap_nodes(Tree,i,j )                                              \if ( Tree->nodes[ i ].child_is_leaf )                                      \  Tree->leaf[ Tree->nodes[ i ].child ] = j;                                \else                                                                       \	{                                                                        \  Tree->nodes[ Tree->nodes[ i ].child ].parent = j;                        \  Tree->nodes[ Tree->nodes[ i ].child + 1 ].parent = j;                    \	}                                                                        \if ( Tree->nodes[ j ].child_is_leaf )                                      \  Tree->leaf[ Tree->nodes[ j ].child ] = i;                                \else                                                                       \	{                                                                        \  Tree->nodes[ Tree->nodes[ j ].child ].parent = i;                        \  Tree->nodes[ Tree->nodes[ j ].child + 1 ].parent = i;                    \	}                                                                        \TempNode = Tree->nodes[ i ];                                               \Tree->nodes[ i ] = Tree->nodes[ j ];                                       \Tree->nodes[ i ].parent = TempNode.parent;                                 \TempNode.parent = Tree->nodes[ j ].parent;                                 \Tree->nodes[ j ] = TempNode;                                               \/* end swap_nodes macro *//* * Adding a new node to the Tree is pretty simple.  It is just a matter * of splitting the lightest-weight node in the Tree, which is the highest * valued node.  We split it off into two new nodes, one of which is the * one being added to the Tree.  We assign the new node a weight of 0, * so the Tree doesn't have to be adjusted.  It will be updated later when * the normal update process occurs.  Note that this code assumes that * the lightest node has a leaf as a child.  If this is not the case, * the Tree would be broken. */#define add_new_node( Tree, c )                                       		 \lightest_node = Tree->next_free_node - 1;                                  \new_node = Tree->next_free_node;                                           \zero_weight_node = Tree->next_free_node + 1;                               \Tree->next_free_node += 2;                                                 \                                                                           \Tree->nodes[ new_node ] = Tree->nodes[ lightest_node ];                    \Tree->nodes[ new_node ].parent = lightest_node;                            \Tree->leaf[ Tree->nodes[ new_node ].child ] = new_node;                    \                                                                           \Tree->nodes[ lightest_node ].child         = new_node;                     \Tree->nodes[ lightest_node ].child_is_leaf = 0;                            \                                                                           \Tree->nodes[ zero_weight_node ].child           = c;                       \Tree->nodes[ zero_weight_node ].child_is_leaf   = 1;                       \Tree->nodes[ zero_weight_node ].weight          = 0;                       \Tree->nodes[ zero_weight_node ].parent          = lightest_node;           \Tree->leaf[ c ] = zero_weight_node;                                        \/* end add_new_node macro *//* * AHuff_UpdateModel is called to increment the count for a given symbol. * After incrementing the symbol, this code has to work its way up * through the parent nodes, incrementing each one of them.  That is * the easy part.  The hard part is that after incrementing each * parent node, we have to check to see if it is now out of the proper * order.  If it is, it has to be moved up the Tree into its proper * place. */#define AHuff_UpdateModel_Macro( AHI, Tree, c )                            \if ( Tree->nodes[ ROOT_NODE].weight == MAX_WEIGHT )                        \  AHuff_HalveTree( AHI );                                                  \current_node = Tree->leaf[ c ];                                            \while ( current_node != ROOT_NODE )                                        \	{                                                                        \  Tree->nodes[ current_node ].weight++;                                    \  for ( new_node = current_node ; new_node > ROOT_NODE ; new_node-- )      \    if ( Tree->nodes[ new_node - 1 ].weight >=                             \         Tree->nodes[ current_node ].weight )                              \      break;                                                               \  if ( current_node != new_node )                                          \		{                                                                      \    swap_nodes( Tree, current_node, new_node );                            \    current_node = new_node;                                               \  	}                                                                      \  current_node = Tree->nodes[ current_node ].parent;                       \	}                                                                        \Tree->nodes[ current_node ].weight++;                                      \/* end AHuff_UpdateModel macro *//* * The high level view of the compression routine is very simple. * First, we initialize the Huffman Tree, with just the ESCAPE symbol.   * Then, we sit in a loop, encoding symbols, * and adding them to the model. * */struct AHuffInfo * AHuff_Init(struct BitIOInfo * inBII,long inNumSymbols){struct AHuffInfo * AHI;if ( (AHI = AllocMem(sizeof(struct AHuffInfo),MEMF_ANY|MEMF_CLEAR)) == NULL )	return(NULL);AHI->BII = inBII;AHI->NumSymbols = inNumSymbols;if ( (AHI->Tree = AllocMem(sizeof(struct AHuffTree),MEMF_ANY|MEMF_CLEAR)) == NULL )	{	AHuff_CleanUp(AHI);	return(NULL);	}if ( (AHI->Tree->leaf = AllocMem(SYMBOL_COUNT*sizeof(uword),MEMF_ANY)) == NULL )	{	AHuff_CleanUp(AHI);	return(NULL);	}if ( (AHI->Tree->nodes = AllocMem(sizeof(struct AHuffNode)*NODE_TABLE_COUNT,MEMF_ANY)) == NULL )	{	AHuff_CleanUp(AHI);	return(NULL);	}AHuff_InitializeTree( AHI );return(AHI);}void AHuff_CleanUp(struct AHuffInfo *AHI){if ( AHI )	{	if ( AHI->Tree )		{		SmartFree(AHI->Tree->leaf,SYMBOL_COUNT*sizeof(uword));		SmartFree(AHI->Tree->nodes,sizeof(struct AHuffNode)*NODE_TABLE_COUNT);		FreeMem(AHI->Tree,sizeof(struct AHuffTree));		}	FreeMem(AHI,sizeof(struct AHuffInfo));	}}/* * When performing adaptive compression, the Huffman Tree starts out * very nearly empty.  The only symbol present initially is the * ESCAPE symbol.  The ESCAPE symbol has to * be included so we can tell the expansion prog that we are transmitting a * previously unseen symbol.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美在线观看视频一区二区三区| 99国产一区二区三精品乱码| 欧美三级欧美一级| 日本成人在线网站| 久久免费电影网| 一本大道久久a久久精品综合 | 麻豆精品视频在线观看| 国产日产精品一区| 欧美日韩不卡在线| 国产91精品一区二区麻豆亚洲| 有坂深雪av一区二区精品| 日韩欧美亚洲国产精品字幕久久久| 国产成人在线看| 亚洲小说欧美激情另类| 久久午夜国产精品| 欧美日韩国产综合视频在线观看 | 亚洲精品在线网站| 91丨porny丨蝌蚪视频| 麻豆精品视频在线观看| 国产黑丝在线一区二区三区| 成人免费视频app| 蜜臀av性久久久久蜜臀aⅴ流畅| 美女诱惑一区二区| 高清成人免费视频| 欧美大胆人体bbbb| 精品在线亚洲视频| 亚洲精品国产a久久久久久| 一级做a爱片久久| 国产精品久久久久久久久搜平片| 日韩一区二区免费在线电影 | 99精品黄色片免费大全| 欧美视频一区二区三区在线观看| 成人黄色av电影| 国产99久久久久久免费看农村| 91亚洲大成网污www| 欧美高清www午色夜在线视频| 97久久精品人人做人人爽50路| 欧美系列日韩一区| 久久夜色精品国产噜噜av| 中文字幕亚洲不卡| 国产精品第一页第二页第三页| 亚洲一区二区三区四区五区黄 | 亚洲成a人片在线不卡一二三区| 国产精品久久毛片av大全日韩| 亚洲一区中文日韩| 成人在线一区二区三区| 欧美一级精品大片| 一区二区三区四区视频精品免费| 久久69国产一区二区蜜臀| 在线视频国内自拍亚洲视频| 久久久久久久免费视频了| 亚洲成av人片观看| 色婷婷综合久久久久中文一区二区| 日韩视频免费观看高清完整版在线观看 | 国产高清不卡一区二区| 欧美日韩国产区一| 亚洲日本青草视频在线怡红院| 久久久久久久久久久久电影| 亚洲成人免费电影| 色屁屁一区二区| 国产精品成人在线观看| 国产美女娇喘av呻吟久久| 国产精品影视网| 99久久久久久| 国产精品视频免费看| 亚洲乱码日产精品bd| 成人黄色一级视频| 久久久久久毛片| 国产黑丝在线一区二区三区| 日韩欧美在线影院| 日本伊人午夜精品| 5566中文字幕一区二区电影| 久久久国产精华| 国产在线视视频有精品| 色综合天天综合狠狠| 日韩欧美另类在线| 九九精品一区二区| 欧美一卡二卡在线| 中文字幕在线一区免费| 国产99精品在线观看| 国产精品久久看| 91小视频在线观看| 亚洲精品日日夜夜| 日本久久一区二区三区| 26uuu亚洲综合色| 国产激情精品久久久第一区二区| 久久在线观看免费| 顶级嫩模精品视频在线看| 国产精品久久午夜| 色香色香欲天天天影视综合网| 亚洲综合一区二区三区| 欧美日韩欧美一区二区| 精品系列免费在线观看| 中国色在线观看另类| 色综合色综合色综合色综合色综合 | 久久久久久综合| 成人h版在线观看| 亚洲精品欧美激情| 欧美欧美欧美欧美首页| 九九在线精品视频| 国产精品久久久久一区二区三区共 | 国产欧美日韩一区二区三区在线观看| 国内成人免费视频| 亚洲欧美另类久久久精品| 国产成人精品综合在线观看| 亚洲欧洲国产专区| 欧美日韩国产乱码电影| 国产一区二区影院| 亚洲综合免费观看高清完整版 | 亚洲一区二区在线免费观看视频 | 久久国产婷婷国产香蕉| 欧美日本视频在线| 国产麻豆视频一区二区| 亚洲男同性视频| 欧美videofree性高清杂交| 亚洲一区二区偷拍精品| 日韩欧美一级在线播放| av一区二区三区黑人| 亚洲日本一区二区三区| 日韩一区二区三区四区| 99久久久久久99| 精品一区二区三区在线观看| 亚洲免费在线视频一区 二区| 精品国产一区二区三区不卡| 一本久久a久久精品亚洲| 国产在线看一区| 视频一区国产视频| 91.麻豆视频| 色婷婷一区二区| 国产一区日韩二区欧美三区| 视频一区视频二区在线观看| 国产精品免费视频观看| 欧美大片一区二区三区| 欧美日韩黄色一区二区| 91蜜桃在线观看| 成人国产亚洲欧美成人综合网| 蜜芽一区二区三区| 久久精品一区四区| 99综合电影在线视频| 国产一区二区免费在线| 日韩高清在线观看| 视频一区二区三区入口| 亚洲成av人在线观看| 亚洲欧美日韩中文播放| 亚洲国产经典视频| 在线观看www91| 91视频国产观看| av电影在线观看完整版一区二区| 国产成人综合在线播放| 国产一区999| 国产精品99久久久久久久女警| 精品在线播放午夜| 精品无码三级在线观看视频| 久久av老司机精品网站导航| 三级亚洲高清视频| 免费在线看一区| 麻豆国产一区二区| 国产毛片一区二区| 国产盗摄一区二区| 成人黄色在线看| 色综合网色综合| 欧美三级乱人伦电影| 91精品免费在线观看| 欧美第一区第二区| 久久婷婷成人综合色| 国产欧美精品一区二区三区四区| 欧美激情在线一区二区| 中文字幕在线观看一区| 亚洲最大的成人av| 免费成人深夜小野草| 国产一区二区三区免费| www.99精品| 欧美最猛性xxxxx直播| 欧美人动与zoxxxx乱| 欧美电影免费提供在线观看| 国产拍揄自揄精品视频麻豆| 136国产福利精品导航| 日韩中文字幕区一区有砖一区| 久久99久久99精品免视看婷婷| 国产精品18久久久久| 99视频在线观看一区三区| 欧美三级韩国三级日本一级| 欧美第一区第二区| 亚洲久草在线视频| 美女精品一区二区| 91免费观看国产| 精品三级在线观看| 亚洲欧美偷拍另类a∨色屁股| 五月综合激情婷婷六月色窝| 一区二区三区免费观看| 久久av资源站| 色狠狠色狠狠综合| 久久九九久久九九| 天天av天天翘天天综合网色鬼国产| 久久 天天综合| 欧美综合在线视频| 中文字幕一区在线| 久久99精品久久只有精品| 972aa.com艺术欧美| 欧美成人a在线|