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

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

?? word.c

?? source code for arithmatic coding
?? C
字號:
/******************************************************************************File: 		word.cAuthors: 	John Carpinelli   (johnfc@ecr.mu.oz.au)	 	Wayne Salamonsen  (wbs@mundil.cs.mu.oz.au)		Lang Stuiver      (langs@cs.mu.oz.au)Purpose:	Data compression with a word-based model using		arithmetic coding.Copyright 1995 John Carpinelli and Wayne Salamonsen, All Rights Reserved.Copyright 1996 Lang Stuiver.  All Rights Reserved.These programs are supplied free of charge for research purposes only,and may not sold or incorporated into any commercial product.  There isABSOLUTELY NO WARRANTY of any sort, nor any undertaking that they arefit for ANY PURPOSE WHATSOEVER.  Use them at your own risk.  If you dohappen to find a bug, or have modifications to suggest, please reportthe same to Alistair Moffat, alistair@cs.mu.oz.au.  The copyrightnotice above and this statement of conditions must remain an integralpart of each and every copy made of these files.******************************************************************************/#include <stdio.h>#include <stdlib.h>#include <string.h>#include "bitio.h"#include "arith.h"#include "stats.h"#include "main.h"#include "hashtable.h"#define	WORD		0		/* flag to process a word */#define NON_WORD	1		/* flag to process a non-word */#define INIT_CONTEXT	1023		/* initial size of word contexts */#define CHAR_CONTEXT	256		/* length of character contexts */#define BUFFER_SIZE	512		/* size of file input buffer */#define END_OF_MESSAGE  0               /* end of message symbol *//* Macro to specify what a word is */#define ISWORD(c) (((c >= 'A') && (c <= 'Z')) || \		   ((c >= 'a') && (c <= 'z')) || \		   ((c >= '0') && (c <= '9')))/* function prototypes */static void install_symbol_safe(context *pContext, int symbol);static void init_word_model(hash_table *tables[], context *words[]);static void purge_word_model(hash_table *tables[], context *words[]);static void init_char_model(context *characters[], context *lengths[]);static void read_word(char buffer[], int *buffer_length, int *curr_pos, 	       string *pWord, int type);/* global variables */static int base_memory;	       	/* memory used by character model */static unsigned int nWords[2]; 	/* counts number of words */static unsigned int nDistinctWords[2];	/* counts number of distinct words */#ifdef RCSIDstatic char   rcsid[] = "$Id: word.c,v 1.1 1996/08/07 01:34:11 langs Exp $";#endif/* * * print the results of compressing/decompressing a file * */void print_results_word(int operation){	fprintf(stderr, "\n" 		"                              words           non-words\n");	fprintf(stderr, "Words read             : %10u          %10u\n", 		nWords[0], nWords[1]);	fprintf(stderr, "Distinct words         : %10u          %10u\n",		nDistinctWords[0], nDistinctWords[1]);}/* * Installs a symbol, if it can't, it halts the program with an error * message.  Makes sure initial symbols are always added. */static void install_symbol_safe(context *pContext, int symbol){  if (install_symbol(pContext, symbol) == TOO_MANY_SYMBOLS)	{	  fprintf(stderr,"TOO_MANY_SYMBOLS error installing initial symbols\n");	  fprintf(stderr,"(Perhaps F_bits is too small?)\n");	  exit(1);	}}/* * * initialize the word/non-word context and hash tables * */static void init_word_model(hash_table *tables[], context *words[]){    tables[WORD] = create_table();    tables[NON_WORD] = create_table();    words[WORD] = create_context(INIT_CONTEXT, DYNAMIC);    words[NON_WORD] = create_context(INIT_CONTEXT, DYNAMIC);    if (tables[WORD]==NULL || tables[NON_WORD]==NULL)	{ fprintf(stderr,"init_word_model(): Unable to create word tables!\n");	  exit(1); 	}        /* add end of message symbol to word contexts */    install_symbol_safe(words[WORD], END_OF_MESSAGE);    install_symbol_safe(words[NON_WORD], END_OF_MESSAGE);    get_memory(2 * MEM_PER_SYMBOL);		/* record memory used */}/* * * free all memory associated with the word and non-word models * then create empty models. * */static void purge_word_model(hash_table *tables[], context *words[]){    /* free the memory used by the word models */    purge_context(words[WORD]);    purge_context(words[NON_WORD]);    purge_table(tables[WORD]);    purge_table(tables[NON_WORD]);    /* rebuild the hash tables with no entries */    purge_memory();			/* set memory count back to zero */    get_memory(base_memory);    tables[WORD] = create_table();    tables[NON_WORD] = create_table();    if (tables[WORD]==NULL || tables[NON_WORD]==NULL)	{ fprintf(stderr,		  "purge_word_model(): Unable to recreate word tables!\n");	  exit(1); 	}    /* add end of message symbol to word contexts */    install_symbol_safe(words[WORD], END_OF_MESSAGE);    install_symbol_safe(words[NON_WORD], END_OF_MESSAGE);}/* * * initialize the character and length contexts * */static void init_char_model(context *characters[], context *lengths[]){    int i;    /* initialize the character and length contexts */    characters[WORD] = create_context(CHAR_CONTEXT, STATIC);    characters[NON_WORD] = create_context(CHAR_CONTEXT, STATIC);    lengths[WORD] = create_context(MAX_WORD_LEN+1, STATIC);    lengths[NON_WORD] = create_context(MAX_WORD_LEN+1, STATIC);    /* initialise char contexts with all chars having a frequency of 1 */     for (i = 0; i < CHAR_CONTEXT; i++)    {	if (ISWORD(i)) 	    install_symbol_safe(characters[WORD], i);	else	    install_symbol_safe(characters[NON_WORD], i);    }    for (i = 0; i <= MAX_WORD_LEN; i++)    {	install_symbol_safe(lengths[WORD], i);	install_symbol_safe(lengths[NON_WORD], i);    }    /* record memory used by character and length contexts */    get_memory(2 * MAX_WORD_LEN * MEM_PER_SYMBOL);    get_memory(2 * CHAR_CONTEXT * MEM_PER_SYMBOL);}/* * * compress with word based model using i/o in bitio.c * */void encode_word(void){    char	buffer[BUFFER_SIZE];    int		buffer_len, buffer_pos = 0, word_no, i, type;    string	curr_word;    context	*words[2], *characters[2], *lengths[2];    hash_table	*tables[2];    /* set up the character and length contexts */    init_char_model(characters, lengths);    /* initialize the word and non-word contexts and hash tables */    init_word_model(tables, words);    base_memory = get_memory(0);		/* record base memory level */    buffer_len = 0;    startoutputtingbits();    start_encode();        /* start processing with a word */    type = WORD;    for (;;)    {	read_word(buffer, &buffer_len, &buffer_pos, &curr_word, type);	if ((buffer_len == 0) && (curr_word.length == 0))	    break;	nWords[type]++;	word_no = lookup_word(&curr_word, tables[type]);	if (encode(words[type], word_no) == NOT_KNOWN)	{	    /* spell out new word before adding to list of words */	    encode(lengths[type], curr_word.length);	    	    for (i = 0; i<curr_word.length; i++)		encode(characters[type], curr_word.text[i]);	    	    /* add word to hash table, and install new symbol */	    if ((word_no = add_word(&curr_word, tables[type])) == NOMEMLEFT ||		(install_symbol(words[type], word_no) != 0))		/* purge word model if memory or symbol limit is exceeded */		{		    if (verbose)			fprintf(stderr, "Reached %s limit "					"adding new word...purging\n",				word_no == NOMEMLEFT ? "memory" : "symbol");		    purge_word_model(tables, words);		}	    nDistinctWords[type]++;	} 	type = !type;				/* toggle WORD/NON_WORD type */    }     encode(words[type], END_OF_MESSAGE);	/* encode end of message */    finish_encode();    doneoutputtingbits();}/* * * uncompress with a word based model using bitio.c for i/o * */void decode_word(void){    int i, symbol, type, length;    hash_table *tables[2];    context *words[2], *characters[2], *lengths[2];    string word;    unsigned char *pWord;        /* set up the character and length contexts */    init_char_model(characters, lengths);    /* initialize word/non-word contexts and hash tables */    init_word_model(tables, words);    base_memory = get_memory(0);		/* record base memory level */    startinputtingbits();    start_decode();    type = WORD;				/* first symbol is a WORD */    for (;;)    {	symbol = decode(words[type]);	if (symbol == END_OF_MESSAGE)	    break;	nWords[type]++;	if (symbol == NOT_KNOWN)	{      	    /* read in the length, then the spelling of a new word */	    word.length = decode(lengths[type]);	    for (i = 0; i<word.length; i++)		word.text[i] = decode(characters[type]);	    pWord = word.text;	    length = word.length;	    nDistinctWords[type]++;	    /* add new word to hash table, and install new symbol */	    if (((symbol = add_word(&word, tables[type])) == NOMEMLEFT) || 		(install_symbol(words[type], symbol) != 0))		{		    /* purge word model if memory limit exceeded */		    if (verbose)			fprintf(stderr, "Reached %s limit "					"adding new word...purging\n",				symbol == NOMEMLEFT ? "memory" : "symbol");		    purge_word_model(tables, words);		}	}	else	    get_word(tables[type], symbol, &pWord, &length);	/* output the word to standard out */	BITIO_FWRITE(pWord, length, 1);	type = !type;			/* toggle between WORD/NON_WORD */    }     finish_decode();    doneinputtingbits();}/* * * read word or non-word from stdin and update the buffer_length  * and buffer_position variables * */static voidread_word(char buffer[], int *buffer_length, int *curr_pos, string *pWord,	  int type){    pWord->length = 0;    while (pWord->length < MAX_WORD_LEN)    {	if (*buffer_length == 0)	{	    /* 	     * if buffer is empty then fill it, using fread. If file to be             * encoded is empty then return current word	     */ 	    if ((*buffer_length = BITIO_FREAD(buffer, 1, BUFFER_SIZE)) == 0)		return;	    *curr_pos = 0;	}		/* 	 * terminate on non-word character if type = WORD (0)	 * or word character if type = NON_WORD (1)	 */	if ((!ISWORD(buffer[*curr_pos])) ^ type)	    return;	else	{	    pWord->text[pWord->length] = buffer[*curr_pos];	    pWord->length += 1;	    *curr_pos += 1;	    *buffer_length -= 1;	}    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜精品久久久| 国产精品久久久久久久久免费丝袜| 一二三区精品视频| 日本乱码高清不卡字幕| 亚洲精品成人天堂一二三| 91视视频在线观看入口直接观看www | 欧美高清www午色夜在线视频| 亚洲国产日韩av| 欧美日韩在线三级| 精品一区二区影视| 国产精品二区一区二区aⅴ污介绍| 99久久精品免费观看| 亚洲成人在线网站| 精品国产髙清在线看国产毛片 | 久久久精品中文字幕麻豆发布| 国产一区二区久久| 1000部国产精品成人观看| 欧美亚洲综合在线| 经典三级在线一区| 亚洲视频一区二区在线观看| 欧美日韩美少妇| 黄色资源网久久资源365| 国产精品麻豆久久久| 欧美视频在线不卡| 国产在线视频精品一区| 亚洲柠檬福利资源导航| 91精品免费在线观看| 成人亚洲精品久久久久软件| 亚洲一区二区在线视频| 精品国产乱码久久| 欧美性xxxxx极品少妇| 国产一区二三区| 亚洲激情av在线| 国产亚洲综合在线| 欧美日韩一区小说| 9i在线看片成人免费| 日韩电影一区二区三区| 成人免费小视频| 欧美tk丨vk视频| 欧美午夜在线一二页| 国产激情精品久久久第一区二区| 一区二区三区在线视频观看| 精品国精品自拍自在线| 在线精品视频小说1| 狠狠色综合播放一区二区| 亚洲最大成人综合| 欧美国产日韩一二三区| 欧美一级精品大片| 欧美亚一区二区| 成人av小说网| 精品影视av免费| 香港成人在线视频| 艳妇臀荡乳欲伦亚洲一区| 中文字幕一区二区三区四区不卡| 日韩精品最新网址| 4hu四虎永久在线影院成人| 91尤物视频在线观看| 国产乱码精品一区二区三区忘忧草| 性久久久久久久久| 亚洲一区二区三区四区的| 综合色天天鬼久久鬼色| 国产日本欧洲亚洲| 久久综合久久鬼色中文字| 日韩一区二区三区电影在线观看| 色婷婷国产精品久久包臀| av爱爱亚洲一区| 波多野结衣的一区二区三区| 国产精品一二三在| 韩国女主播成人在线观看| 久久精品久久精品| 久久精品国产亚洲a| 免费在线看一区| 日韩激情一二三区| 奇米影视一区二区三区小说| 日本亚洲三级在线| 日韩av在线免费观看不卡| 日韩成人午夜电影| 美国十次了思思久久精品导航| 视频一区二区不卡| 蜜臀av亚洲一区中文字幕| 琪琪一区二区三区| 另类小说欧美激情| 国产毛片精品国产一区二区三区| 国产综合久久久久久久久久久久| 麻豆一区二区三| 国产精品中文字幕一区二区三区| 国产麻豆精品在线| 国产99精品国产| 99riav久久精品riav| 在线观看免费亚洲| 欧美一区二区三区影视| 精品国产在天天线2019| 欧美激情在线看| 一区在线播放视频| 午夜精品久久久久久久99水蜜桃| 亚瑟在线精品视频| 精品一区二区久久| 成人福利在线看| 欧美日韩黄视频| 精品国产乱码久久久久久久| 国产三级三级三级精品8ⅰ区| 日韩美女视频一区| 亚洲国产另类av| 国产真实乱偷精品视频免| 99国产欧美久久久精品| 欧美丰满美乳xxx高潮www| 久久免费偷拍视频| 樱花草国产18久久久久| 日本在线不卡视频| 成人免费视频app| 欧美日韩色综合| 国产无一区二区| 天天综合天天综合色| 粉嫩高潮美女一区二区三区| 欧美性猛片aaaaaaa做受| 精品嫩草影院久久| 尤物在线观看一区| 国产又黄又大久久| 欧美色精品在线视频| 久久免费看少妇高潮| 亚洲欧美日韩一区二区| 久久精品72免费观看| 91久久免费观看| 久久综合久久99| 丝袜美腿亚洲色图| 成人精品视频网站| 精品久久久久久久久久久久久久久| 亚洲素人一区二区| 久久精品国产久精国产爱| 在线中文字幕一区二区| 久久美女高清视频| 蜜臀精品一区二区三区在线观看| 不卡视频一二三| 久久综合色播五月| 日韩黄色免费电影| 一本到一区二区三区| 日本一区二区在线不卡| 人人精品人人爱| 欧美性大战久久久| 亚洲精品乱码久久久久久日本蜜臀| 国产中文字幕一区| 日韩欧美视频在线| 丝袜美腿一区二区三区| 色哟哟一区二区在线观看| 国产三级久久久| 国产一区二区网址| 日韩亚洲欧美在线| 性欧美疯狂xxxxbbbb| 色狠狠综合天天综合综合| 国产日韩成人精品| 国产成人免费在线观看不卡| 7777精品久久久大香线蕉 | 中文字幕第一区| 国内成+人亚洲+欧美+综合在线 | 日韩视频免费直播| 亚洲国产婷婷综合在线精品| 日本精品一级二级| 亚洲精品成人在线| 91极品美女在线| 一个色在线综合| 欧洲一区二区三区在线| 一区二区三区在线免费视频| 91热门视频在线观看| 中文字幕视频一区| 91首页免费视频| 玉足女爽爽91| 欧美日韩亚洲综合在线 | 久久伊人中文字幕| 捆绑调教一区二区三区| 欧美成人性战久久| 麻豆极品一区二区三区| 26uuu国产一区二区三区| 久草精品在线观看| 久久天堂av综合合色蜜桃网| 狠狠狠色丁香婷婷综合久久五月| 精品国内片67194| 国产成人综合在线观看| 中文字幕中文乱码欧美一区二区| 成人精品电影在线观看| ●精品国产综合乱码久久久久| 成人99免费视频| 亚洲影视在线播放| 日韩精品一区国产麻豆| 国产一区二区三区久久久| 久久精品欧美日韩| 色狠狠一区二区| 日韩精品免费专区| 久久蜜桃av一区二区天堂| 国产成人免费视频网站高清观看视频 | 亚洲一区二区精品视频| 欧美一区午夜视频在线观看| 久久91精品久久久久久秒播| 日本一区二区综合亚洲| 91久久精品日日躁夜夜躁欧美| 日韩av在线发布| 日本一区二区高清| 欧美日韩卡一卡二| 国产成人精品亚洲777人妖| 一区二区三区在线播| 国产精品久久久久久久久快鸭|