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

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

?? dcodlzw.c

?? 著名壓縮算法的實現
?? C
字號:
/* File: dcodlzw.c   Author: David Bourgin   Creation date: 25/3/95   Last update: 12/10/95   Purpose: Example of LZW decoding with a file source to decompress.*/#include <stdio.h>/* For routines printf,fgetc,fputc. */#include <stdlib.h>/* For routine exit. *//* Error codes returned to the caller. */#define NO_ERROR             0#define BAD_FILE_NAME        1#define BAD_ARGUMENT         2#define BAD_MEM_ALLOC        3#define BAD_DATA_CODE        4#define DICTIONARY_OVERFLOW  5/* Useful constants. */#define FALSE 0#define TRUE  1/* Global variables. */FILE *source_file,*dest_file;                             /* Being that fgetc=EOF only after an access                                then 'byte_stored_status' is 'TRUE' if a byte has been stored by 'fgetc'                                or 'FALSE' if there's no valid byte not handled in 'val_byte_stored' */int byte_stored_status=FALSE;int byte_stored_val;/* Pseudo procedures. */#define end_of_data()  (byte_stored_status?FALSE:!(byte_stored_status=((byte_stored_val=fgetc(source_file))!=EOF)))#define read_byte()  (byte_stored_status?byte_stored_status=FALSE,(unsigned char)byte_stored_val:(unsigned char)fgetc(source_file))#define write_byte(byte)  ((void)fputc((byte),dest_file))unsigned long int val_to_write=0,                  val_to_read=0;unsigned char bit_counter_to_write=0,              bit_counter_to_read=0;typedef struct s_dic_link { unsigned int character;                            struct s_dic_link *predecessor;                          } t_dic_link,*p_dic_link;#define LINK_CHAR(dic)  ((*(dic)).character)#define LINK_PRED(dic)  ((*(dic)).predecessor)#define TYPE_GIF_ENCODING/* Enforces including marker codes initialization_code et end_information_code.   To invalid this option, set the line #define... in comments. */#ifdef TYPE_GIF_ENCODING#define AUTO_REINIT_DIC/* If this macro is defined, the dictionary is always increased   (even if this can make an error of overflow!).   At the opposite, if this macro is undefined, the dictionary is no more updated   as soon as it reaches its maximal capacity. The reception of the code   'initialization_code' will enforce the dictionary to by flushed.   To invalid this option, set the line #define... in comments.   This macro is considered only if TYPE_GIF_ENCODING is defined,   that is why we have the lines #ifdef... and #endif... */#endifunsigned int index_dic;/* Word counter already known in the dictionary. */unsigned char bit_counter_decoding;/* Bit counter in the decoding. */#define EXP2_DIC_MAX  12/* 2^EXP2_DIC_MAX gives the maximum word counter in the dictionary during *all* the compressions.   Possible values: 3 to 25.   Attention: Beyond 12, you can have some errors of memory allocation   depending on your compiler and your computer. */unsigned int index_dic_max;/* index_dic_max gives the maximum word counter in the dictionary during *one* compression.   This constant is restricted to the range of end_information_code to 2^EXP2_DIC_MAX. */unsigned char output_bit_counter,/* Bit counter for each data in output.   With output_bit_counter=1, we can compress/decompress monochrome pictures   and with output_bit_counter=8, we can handle 256-colors pictures or any kind of files. */              bit_counter_min_decoding;/* Bit counter to encode 'initialization_code'. */unsigned int initialization_code;unsigned int end_information_code;/* initialization_code and end_information_code are both consecutive   coming up just after the last known word in the initial dictionary. */p_dic_link dictionary[1<<EXP2_DIC_MAX];void init_dictionary1()/* Returned parameters: None.   Action: First initialization of the dictionary when we start an decoding.   Errors: None if there is enough room.*/{ register unsigned int i;  index_dic_max=1<<12;       /* Attention: Possible values: 2^3 to 2^EXP2_DIC_MAX */  output_bit_counter=8;      /* Attention: Possible values: 1 to EXP2_DIC_MAX-1                                (usually, for pictures, set up to 1, or 4, or 8, in the case                                of monochrome, or 16-colors, or 256-colors picture). */  if (output_bit_counter==1)     bit_counter_min_decoding=3;  else bit_counter_min_decoding=output_bit_counter+1;  initialization_code=1<<(bit_counter_min_decoding-1);#ifdef TYPE_GIF_ENCODING  end_information_code=initialization_code+1;#else  end_information_code=initialization_code-1;#endif  for (i=0;i<index_dic_max;i++)      { if ((dictionary[i]=(p_dic_link)malloc(sizeof(t_dic_link)))==NULL)           { while (i)             { i--;               free(dictionary[i]);             }             fclose(source_file);             fclose(dest_file);             exit(BAD_MEM_ALLOC);           }        if (i<initialization_code)           LINK_CHAR(dictionary[i])=i;        LINK_PRED(dictionary[i])=NULL;      }  index_dic=end_information_code+1;  bit_counter_decoding=bit_counter_min_decoding;}void init_dictionary2()/* Returned parameters: None.   Action: Initialization of the dictionary during the decoding.   The dictionary must have been initialized once by 'init_dictionary1'.   Errors: None.*/{ register unsigned int i;  for (i=initialization_code;(i<index_dic_max)&&(dictionary[i]!=NULL);i++)      LINK_PRED(dictionary[i])=NULL;  index_dic=end_information_code+1;  bit_counter_decoding=bit_counter_min_decoding;}void remove_dictionary()/* Returned parameters: None.   Action: Removes the dictionary used for the decoding from the dynamical memory.   Errors: None.*/{ register unsigned int i;  for (i=0;(i<index_dic_max)&&(dictionary[i]!=NULL);i++)      free(dictionary[i]);}void write_output(value)/* Returned parameters: None.   Action: Writes 'output_bit_counter' via the function write_byte.   Errors: An input/output error could disturb the running of the program.*/unsigned int value;{ val_to_write=(val_to_write << output_bit_counter) | value;  bit_counter_to_write += output_bit_counter;  while (bit_counter_to_write>=8)        { bit_counter_to_write -= 8;          write_byte((unsigned char)(val_to_write >> bit_counter_to_write));          val_to_write &= ((1<< bit_counter_to_write)-1);        }}void complete_output()/* Returned parameters: None.   Action: Fills the last byte to write with 0-bits, if necessary.   This procedure is to be considered aith the procedure 'write_output'.   Errors: An input/output error could disturb the running of the program.*/{ if (bit_counter_to_write>0)     write_byte((unsigned char)(val_to_write << (8-bit_counter_to_write)));  val_to_write=bit_counter_to_write=0;}void write_link(chainage,character)/* Returned parameters: 'character' can have been modified.   Action: Sends the string in the output stream given by the 'link' of the LZW dictionary.   'character' contains to the end of the routine the first character of the string.   Errors: None (except a possible overflow of the operational stack allocated   by the program, which must allows at least 8*INDEX_DIC_MAX bytes, corresponding   to an exceptional case.*/p_dic_link chainage;unsigned int *character;{ if (LINK_PRED(chainage)!=NULL)     { write_link(LINK_PRED(chainage),character);       write_output(LINK_CHAR(chainage));     }  else { write_output(LINK_CHAR(chainage));         *character=LINK_CHAR(chainage);       }}unsigned int write_string(pred_code,current_code,first_char)/* Returned parameters: Returns a byte.   Action: Writes the string of bytes associated to 'current_node' and returns   the first character of this string.   Errors: None.*/unsigned int pred_code,current_code;unsigned int first_char;{ unsigned int character;  if (current_code<index_dic)     write_link(dictionary[current_code],&character);  else { write_link(dictionary[pred_code],&character);         write_output(first_char);       }  return character;}void add_string(code,first_char)/* Returned parameters: None.   Action: Adds the string given by 'code' to the dictionary.   Errors: None.*/unsigned int code;unsigned int first_char;{ LINK_CHAR(dictionary[index_dic])=first_char;  LINK_PRED(dictionary[index_dic])=dictionary[code];  index_dic++;  if (index_dic+1==(1<<bit_counter_decoding))     bit_counter_decoding++;}unsigned int read_code_lr()/* Returned parameters: Returns the value of code.   Action: Returns the value coded on 'bit_counter_decoding' bits from the stream of input codes.   The bits are stored from left to right. Example: aaabbbbcccc is written:   Bits     7 6 5 4 3 2 1 0   Byte 1   a a a b b b b c   Byte 2   c c c ? ? ? ? ?   Errors: An input/output error could disturb the running of the program.*/{ unsigned int read_code;  while (bit_counter_to_read<bit_counter_decoding)        { val_to_read=(val_to_read<<8)|read_byte();          bit_counter_to_read += 8;        }  bit_counter_to_read -= bit_counter_decoding;  read_code=val_to_read>>bit_counter_to_read;  val_to_read &= ((1<<bit_counter_to_read)-1);  return read_code;}unsigned int write_code_rl()/* Returned parameters: Returns the value of code.   Action: Returns the value coded on 'bit_counter_decoding' bits from the stream of input codes.   The bits are stored from right to left. Example: aaabbbbcccc is written:   Bits     7 6 5 4 3 2 1 0   Byte 1   c b b b b a a a   Byte 2   ? ? ? ? ? c c c   Errors: An input/output error could disturb the running of the program.*/{ unsigned int read_code;  while (bit_counter_to_read<bit_counter_decoding)        { val_to_read |= ((unsigned long int)read_byte())<<bit_counter_to_read;          bit_counter_to_read += 8;        }  bit_counter_to_read -= bit_counter_decoding;  read_code=val_to_read & ((1<<bit_counter_decoding)-1);  val_to_read >>= bit_counter_decoding;  return read_code;}void lzwdecoding()/* Returned parameters: None.   Action: Compresses with LZW method all bytes read by the function 'read_code_??'.   (where '??' is 'lr' or 'rl', depending on how you stored the bits in the compressed stream.   Errors: An input/output error could disturb the running of the program.*/{ unsigned int pred_code,current_code;  unsigned int first_char;  if (!end_of_data())     { init_dictionary1();       current_code=read_code_lr();#ifdef TYPE_GIF_ENCODING       if (current_code!=initialization_code)          { fprintf(stderr,"Fichier de codes invalide!\n");            remove_dictionary();            fclose(source_file);            fclose(dest_file);            exit(BAD_DATA_CODE);          }       if ((current_code=read_code_lr())<initialization_code)          { first_char=write_string(pred_code,current_code,first_char);            pred_code=current_code;            current_code=read_code_lr();          }       while (current_code!=end_information_code)             { if (current_code==initialization_code)                  { init_dictionary2();                    current_code=read_code_lr();                    if (current_code<initialization_code)                       { first_char=write_string(pred_code,current_code,first_char);                         pred_code=current_code;                         current_code=read_code_lr();                       }                  }               else { if (current_code>index_dic)                       { fprintf(stderr,"Fichier de codes invalide!\n");                         fclose(source_file);                         fclose(dest_file);                         exit(BAD_DATA_CODE);                       }#ifdef AUTO_REINIT_DIC                      if (index_dic==index_dic_max)                         { fprintf(stderr,"Depassement de capacite du dictionary!\n");                           fclose(source_file);                           fclose(dest_file);                           exit(DICTIONARY_OVERFLOW);                         }                      first_char=write_string(pred_code,current_code,first_char);                      add_string(pred_code,first_char);                      pred_code=current_code;                      current_code=read_code_lr();#else                      first_char=write_string(pred_code,current_code,first_char);                      if (index_dic<index_dic_max)                         add_string(pred_code,first_char);                      pred_code=current_code;                      current_code=read_code_lr();#endif                    }          }    remove_dictionary();#else       pred_code=current_code;       first_char=write_string(pred_code,current_code,first_char);       while ((!end_of_data())||(bit_counter_to_read>=bit_counter_decoding))             { current_code=read_code_lr();               if (current_code>index_dic)                  { fprintf(stderr,"Fichier de codes invalide!\n");                    fclose(source_file);                    fclose(dest_file);                    exit(BAD_DATA_CODE);                  }               first_char=write_string(pred_code,current_code,first_char);               if (index_dic==index_dic_max-2)                  { init_dictionary2();                    if ((!end_of_data())||(bit_counter_to_read>=bit_counter_decoding))                       { pred_code=(current_code=read_code_lr());                         first_char=write_string(pred_code,current_code,first_char);                       }                  }               else add_string(pred_code,first_char);               pred_code=current_code;             }       remove_dictionary();#endif       complete_output();     }}void aide()/* Returned parameters: None.   Action: Displays the help of the program and then stops its running.   Errors: None.*/{ printf("This utility enables you to decompress a file by using LZW method\n");  printf("as given 'La Video et Les Imprimantes sur PC'\n");  printf("\nUse: dcodlzw source target\n");  printf("source: Name of the file to decompress\n");  printf("target: Name of the restored file\n");}int main(argc,argv)/* Returned parameters: Returns an error code (0=None).   Action: Main procedure.   Errors: Detected, handled and an error code is returned, if any.*/int argc;char *argv[];{ if (argc!=3)     { aide();       exit(BAD_ARGUMENT);     }  else if ((source_file=fopen(argv[1],"rb"))==NULL)          { aide();            exit(BAD_FILE_NAME);          }       else if ((dest_file=fopen(argv[2],"wb"))==NULL)               { aide();                 exit(BAD_FILE_NAME);               }            else { lzwdecoding();                   fclose(source_file);                   fclose(dest_file);                 }  printf("Execution of dcodlzw completed.\n");  return (NO_ERROR);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲影院久久精品| 一本色道久久综合亚洲91| 99久久婷婷国产| 91精品视频网| 亚洲欧美另类小说| 国产精品综合在线视频| 欧美三级日韩三级| 亚洲乱码国产乱码精品精98午夜| 国产一区在线观看麻豆| 在线播放/欧美激情| 亚洲最大的成人av| av欧美精品.com| 国产日韩欧美a| 蜜臀va亚洲va欧美va天堂| 欧美午夜理伦三级在线观看| 国产精品福利影院| 国产91丝袜在线播放0| 久久综合色鬼综合色| 韩国v欧美v亚洲v日本v| 日韩午夜在线观看| 老司机精品视频导航| 欧美一级二级在线观看| 热久久久久久久| 日韩一区二区三区视频在线观看| 亚洲国产欧美在线| 欧美视频在线一区二区三区| 亚洲精品久久嫩草网站秘色| 91视频免费播放| 亚洲欧美视频一区| 在线免费观看成人短视频| 亚洲六月丁香色婷婷综合久久 | 国产成人免费9x9x人网站视频| 91精品国产色综合久久ai换脸| 天天色 色综合| 欧美顶级少妇做爰| 久久精品久久99精品久久| 26uuu亚洲综合色欧美| 国产精品一品视频| 国产精品久久久久国产精品日日| 日韩精品久久理论片| 欧美色视频在线观看| 日韩中文字幕一区二区三区| 欧美日韩国产中文| 蓝色福利精品导航| 久久久99久久| 99久久99久久综合| 亚洲第一成人在线| 日韩限制级电影在线观看| 国产精品自在在线| 中文字幕中文字幕在线一区 | 美女一区二区在线观看| 日韩一区二区在线看片| 国产老肥熟一区二区三区| 中文字幕佐山爱一区二区免费| 在线视频亚洲一区| 精品在线视频一区| 亚洲欧美日本韩国| 日韩亚洲欧美在线观看| 成人自拍视频在线| 亚洲一区二区三区中文字幕在线| 日韩午夜三级在线| 99视频精品免费视频| 亚洲福利一区二区三区| 久久毛片高清国产| 精品污污网站免费看| 精品一区二区三区在线观看国产 | 一本大道久久a久久精二百| 天天综合色天天综合| 久久久久久久久岛国免费| 日韩午夜激情视频| 麻豆极品一区二区三区| 国产精品国产自产拍高清av | 欧美网站大全在线观看| 久草中文综合在线| 亚洲制服欧美中文字幕中文字幕| 日韩免费观看高清完整版在线观看| 国产成人欧美日韩在线电影| 亚洲一区二区在线视频| 久久精品视频一区二区| 欧美另类久久久品| www.综合网.com| 久久综合综合久久综合| 亚洲二区在线观看| 自拍偷在线精品自拍偷无码专区| 91精品国产免费久久综合| 91久久线看在观草草青青| 国产成人激情av| 肉色丝袜一区二区| 一二三区精品福利视频| 欧美国产精品劲爆| 精品少妇一区二区三区免费观看| 日本乱码高清不卡字幕| 波多野结衣亚洲| 国产精品一级片| 国内欧美视频一区二区| 日本欧美加勒比视频| 亚洲成人av一区二区三区| 亚洲欧美另类图片小说| 国产精品卡一卡二| 日本一区二区综合亚洲| 久久九九久久九九| 久久午夜色播影院免费高清| 日韩免费视频线观看| 91精品国产91久久久久久一区二区 | 99精品视频在线观看| 国产麻豆视频一区| 国内精品久久久久影院色| 美女视频黄久久| 日本大胆欧美人术艺术动态| 日本在线不卡视频| 视频在线观看一区| 人人精品人人爱| 久久福利资源站| 国产精选一区二区三区| 国产成人综合视频| 成人午夜伦理影院| 成人国产精品免费观看视频| 成人激情动漫在线观看| av在线一区二区| 91蝌蚪国产九色| 在线日韩国产精品| 欧美日韩一区二区在线观看视频| 在线观看网站黄不卡| 欧美日韩视频在线第一区 | 亚洲欧美一区二区久久| 一区二区三区美女| 亚洲成人黄色小说| 久久国内精品视频| 成人国产视频在线观看| 91成人免费在线| 日韩丝袜美女视频| 国产欧美一区二区三区鸳鸯浴 | 国产成人在线电影| 成人av电影免费观看| 欧美福利一区二区| 一区二区三区在线观看网站| 最新日韩在线视频| 一区二区欧美国产| 青青青爽久久午夜综合久久午夜 | 日韩一区二区三区在线视频| 久久品道一品道久久精品| 亚洲欧美一区二区视频| 亚洲福利视频一区二区| 久久国产精品99精品国产 | 亚洲精品高清在线| 五月天一区二区| 国产成人在线电影| 欧美视频一区二区| 国产欧美日韩精品一区| 亚洲最色的网站| 国产精品一二三区在线| 欧美日韩一区二区在线观看视频| 欧美第一区第二区| 亚洲黄色尤物视频| 国产成人免费视| 欧美日韩国产美女| 国产精品传媒在线| 久久超级碰视频| 成人免费高清在线观看| 欧美精品国产精品| 中文欧美字幕免费| 日本女优在线视频一区二区| www.成人网.com| 日韩欧美一级精品久久| 樱花影视一区二区| 风间由美一区二区av101| 欧美区视频在线观看| 国产精品国产三级国产| 蜜臀av性久久久久蜜臀aⅴ流畅 | 成人a区在线观看| 日韩欧美在线不卡| 一区二区三区蜜桃| 成人激情小说网站| 欧美电影精品一区二区| 日韩精品欧美精品| 欧美日韩精品二区第二页| 国产精品久久国产精麻豆99网站| 狠狠色伊人亚洲综合成人| 欧美日韩情趣电影| 亚洲综合在线免费观看| av中文字幕一区| 国产三级一区二区| 激情六月婷婷久久| 欧美一区二区在线看| 亚洲bt欧美bt精品| 欧美亚洲综合在线| 亚洲男同1069视频| 97精品视频在线观看自产线路二| 欧美国产精品中文字幕| 国产成人a级片| 久久精品亚洲国产奇米99| 激情欧美日韩一区二区| 精品国产污污免费网站入口| 日本 国产 欧美色综合| 日韩一级精品视频在线观看| 裸体健美xxxx欧美裸体表演| 欧美一级xxx| 国产一区二区三区久久久| 国产色综合久久| 不卡一区二区中文字幕|