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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? dcodhuff.c

?? 著名壓縮算法的實(shí)現(xiàn)
?? C
字號(hào):
/* File: dcodhuff.c   Author: David Bourgin   Creation date: 15/2/94   Last update: 24/7/95   Purpose: Example of Huffman decoding with a file source to decompress.*/#include <stdio.h>/* For routines printf,fgetc and fputc */#include <memory.h>/* For routine memset */#include <malloc.h>/* For routines malloc and free */#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/*  Useful constants */#define FALSE 0#define TRUE  1typedef struct s_tree { unsigned int byte;                             /* A byte has to be coded as an unsigned integer to allow a node to have a value over 255 */                         struct s_tree *left_ptr,                                       *right_ptr;                       } t_tree,*p_tree;#define TREE_BYTE(ptr_tree)  ((*(ptr_tree)).byte)#define LEFTPTR_OF_TREE(ptr_tree)  ((*(ptr_tree)).left_ptr)#define RIGHTPTR_OF_TREE(ptr_tree)  ((*(ptr_tree)).right_ptr)typedef struct { unsigned char bits[32];                 unsigned int bits_nb;                 unsigned char presence;               } t_bin_val;#define BITS_BIN_VAL(x)  ((x).bits)#define NB_BITS_BIN_VAL(x)  ((x).bits_nb)#define PRESENCE_BIN_VAL(x)  ((x).presence)/* 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 char bit_counter_to_read=0;unsigned int val_to_read=0;unsigned char read_code_1_bit()/* Returned parameters: Returns an unsigned integer with the 0-bit (on the right of the integer) valid   Action: Reads the next bit in the stream of data to compress   Errors: An input/output error could disturb the running of the program   The source must have enough bits to read*/{ unsigned int result;  if (bit_counter_to_read)     { bit_counter_to_read--;       result=(val_to_read >> bit_counter_to_read) & 1;     }  else { val_to_read=read_byte();         bit_counter_to_read=7;         result=(val_to_read >> 7) & 1;       }  val_to_read &= 127;  return result;}unsigned int read_code_n_bits(n)/* Returned parameters: Returns an unsigned integer with the n-bits (on the right of the integer) valid   Action: Reads the next n bits in the stream of data to compress   Errors: An input/output error could disturb the running of the program   The source must have enough bits to read*/unsigned char n;{ unsigned int result;  while ((bit_counter_to_read<n)&&(!end_of_data()))        { val_to_read=(val_to_read << 8)+read_byte();          bit_counter_to_read += 8;        }  bit_counter_to_read -= n;  result=val_to_read >> bit_counter_to_read;  val_to_read &= ((1<<bit_counter_to_read)-1);  return result;}void read_header(codes_table)/* Returned parameters: The contain of 'codes_table' is modified   Action: Rebuilds the binary encoding array by using the header   Errors: An input/output error could disturb the running of the program*/t_bin_val codes_table[257];{ register unsigned int i,j;  char byte_nb;  (void)memset((char *)codes_table,0,257*sizeof(*codes_table));                             /* == Decoding of the first part of the header === */  if (read_code_1_bit())                             /* First bit=0 => Present bytes coded on n*8 bits                                         =1 => Present bytes coded on 256 bits */     for (i=0;i<=255;i++)         PRESENCE_BIN_VAL(codes_table[i])=read_code_1_bit();  else { i=read_code_n_bits(5)+1;         while (i)               { PRESENCE_BIN_VAL(codes_table[read_code_n_bits(8)])=1;                 i--;               }       }  PRESENCE_BIN_VAL(codes_table[256])=1;                             /* Presence of a fictive 256-byte is enforced! */                             /* == Decoding the second part of the header == */  for (i=0;i<=256;i++)      if PRESENCE_BIN_VAL(codes_table[i])         { if (read_code_1_bit())                             /* First bit=0 => 5 bits of binary length-1 followed by a binary word                                         =1 => 8 bits of binary length-1 followed by a binary word */              j=read_code_n_bits(8)+1;           else j=read_code_n_bits(5)+1;           NB_BITS_BIN_VAL(codes_table[i])=j;                             /* Reading of a binary word */           byte_nb=(j+7) >> 3;           if (j & 7)              {              /* Reads the bits that takes less than one byte */                byte_nb--;                BITS_BIN_VAL(codes_table[i])[byte_nb]=(unsigned char)read_code_n_bits(j & 7);              }           while (byte_nb)                 {           /* Reads the bits that takes one byte, at least */                   byte_nb--;                   BITS_BIN_VAL(codes_table[i])[byte_nb]=(unsigned char)read_code_n_bits(8);                 }         }}void suppress_tree(tree)/* Returned parameters: None   Action: Suppresses the allocated memory for the tree   Errors: None if the tree has been build with dynamical allocations!*/p_tree tree;{ if (tree!=NULL)     { suppress_tree(LEFTPTR_OF_TREE(tree));       suppress_tree(RIGHTPTR_OF_TREE(tree));       free(tree);     }}p_tree tree_encoding(codes_table)/* Returned parameters: A binary tree is returned   Action: Returns the decoding binary tree built from 'codes_table'   Errors: None*/t_bin_val codes_table[257];{ register unsigned int i;  unsigned int j;  p_tree ptr_tree,current_node;  if ((ptr_tree=(p_tree)malloc(sizeof(t_tree)))==NULL)     exit(BAD_MEM_ALLOC);  TREE_BYTE(ptr_tree)=257;  LEFTPTR_OF_TREE(ptr_tree)=NULL;  RIGHTPTR_OF_TREE(ptr_tree)=NULL;  for (i=0;i<=256;i++)      { for (current_node=ptr_tree,j=NB_BITS_BIN_VAL(codes_table[i]);j;j--)          { if (BITS_BIN_VAL(codes_table[i])[(j-1) >> 3] & (1 << ((j-1) & 7)))               if (LEFTPTR_OF_TREE(current_node)==NULL)                  { if ((LEFTPTR_OF_TREE(current_node)=(p_tree)malloc(sizeof(t_tree)))==NULL)                       { suppress_tree(ptr_tree);                         exit(BAD_MEM_ALLOC);                       }                    current_node=LEFTPTR_OF_TREE(current_node);                    LEFTPTR_OF_TREE(current_node)=NULL;                    RIGHTPTR_OF_TREE(current_node)=NULL;                  }               else current_node=LEFTPTR_OF_TREE(current_node);            else if (RIGHTPTR_OF_TREE(current_node)==NULL)                    { if ((RIGHTPTR_OF_TREE(current_node)=(p_tree)malloc(sizeof(t_tree)))==NULL)                       { suppress_tree(ptr_tree);                         exit(BAD_MEM_ALLOC);                       }                      current_node=RIGHTPTR_OF_TREE(current_node);                      LEFTPTR_OF_TREE(current_node)=NULL;                      RIGHTPTR_OF_TREE(current_node)=NULL;                    }                 else current_node=RIGHTPTR_OF_TREE(current_node);            if (j==1)               TREE_BYTE(current_node)=i;            else TREE_BYTE(current_node)=257;          }      };  return (ptr_tree);}void huffmandecoding()/* Returned parameters: None   Action: Decompresses with Huffman method all bytes read by the function 'read_code_1_bit' and 'read_code_n_bits'   Errors: An input/output error could disturb the running of the program*/{ t_bin_val encoding_table[257];  p_tree ptr_tree,current_node;  if (!end_of_data())    /* Are there data to compress? */     { read_header(encoding_table);       ptr_tree=tree_encoding(encoding_table);       do { current_node=ptr_tree;            while (TREE_BYTE(current_node)==257)                  if (read_code_1_bit())                             /* Bit=1 => Got to left in the node of the tree                                   =0 => Got to right in the node of the tree */                     current_node=LEFTPTR_OF_TREE(current_node);                  else current_node=RIGHTPTR_OF_TREE(current_node);            if (TREE_BYTE(current_node)<=255)               write_byte(TREE_BYTE(current_node));          }       while (TREE_BYTE(current_node)!=256);       suppress_tree(ptr_tree);     }}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 Huffman method\n");  printf("as given 'La Video et Les Imprimantes sur PC'\n");  printf("\nUse: dcodhuff 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 { huffmandecoding();                   fclose(source_file);                   fclose(dest_file);                 }  printf("Execution of dcodhuff completed.\n");  return (NO_ERROR);}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本成人中文字幕| 日韩一区在线播放| 国产精品久久久久国产精品日日| 亚洲欧美综合在线精品| 亚洲国产va精品久久久不卡综合| 免费人成网站在线观看欧美高清| 国产精品77777竹菊影视小说| 91丝袜呻吟高潮美腿白嫩在线观看| 欧美日韩国产综合久久| 久久亚洲一区二区三区四区| 亚洲黄色小视频| 激情偷乱视频一区二区三区| 色综合久久久久网| 日韩欧美黄色影院| 亚洲人精品午夜| 黄色成人免费在线| 91九色最新地址| 久久久影视传媒| 首页国产欧美日韩丝袜| 高清不卡一区二区在线| 欧美日韩高清一区| 国产精品久久久久久久久久久免费看 | 中文无字幕一区二区三区| 亚洲精品乱码久久久久久| 精品一区二区久久| 欧美日韩日日夜夜| 最新中文字幕一区二区三区| 极品少妇xxxx偷拍精品少妇| 欧美在线制服丝袜| 中文字幕国产一区| 久久精品国产精品亚洲红杏| 欧美视频一区二区三区四区| 国产精品高清亚洲| 免费一级欧美片在线观看| 色吊一区二区三区| 国产精品不卡视频| 国产乱码精品一品二品| 欧美精品 日韩| 亚洲激情男女视频| www.欧美色图| 国产无一区二区| 久久精品国产亚洲一区二区三区| 欧美综合在线视频| 亚洲色图视频网站| 播五月开心婷婷综合| 精品国产污污免费网站入口| 亚洲成人av一区二区三区| 99在线精品免费| 国产精品女同一区二区三区| 国内欧美视频一区二区| 7777精品伊人久久久大香线蕉最新版| 亚洲黄色片在线观看| 99国产麻豆精品| 国产精品传媒入口麻豆| 成人综合婷婷国产精品久久免费| www国产精品av| 精品综合免费视频观看| 日韩美女视频在线| 免费观看30秒视频久久| 欧美一区二区网站| 日韩经典中文字幕一区| 欧美一区永久视频免费观看| 亚洲成av人片在线观看| 欧美美女网站色| 五月天久久比比资源色| 欧美一区二区三区在| 秋霞av亚洲一区二区三| 日韩久久久久久| 久久精品国产第一区二区三区| 日韩欧美在线1卡| 韩国一区二区视频| 久久天天做天天爱综合色| 国产精品一区二区久久不卡| 久久精品视频一区二区三区| 成人丝袜18视频在线观看| 国产精品天美传媒沈樵| 91美女在线看| 亚洲与欧洲av电影| 在线播放视频一区| 美女一区二区三区在线观看| 欧美电影免费提供在线观看| 精品一区二区三区视频| 欧美激情一区二区在线| 91视频观看免费| 亚洲一区二区三区三| 91精品国产综合久久久久久久| 日本亚洲视频在线| 久久久综合精品| 97精品视频在线观看自产线路二| 亚洲午夜免费电影| 欧美一二三区在线| 国产美女精品人人做人人爽| 国产精品每日更新在线播放网址 | 亚洲免费视频成人| 欧美日本不卡视频| 国内精品伊人久久久久影院对白| 久久精品一区八戒影视| 一本大道av伊人久久综合| 亚洲成在人线免费| 精品国产免费人成在线观看| 成人免费福利片| 亚洲图片自拍偷拍| 久久夜色精品国产噜噜av| 91视频一区二区三区| 香蕉乱码成人久久天堂爱免费| 精品日韩av一区二区| 成人激情小说网站| 性久久久久久久久久久久| 久久综合九色综合欧美亚洲| aaa欧美日韩| 日本aⅴ精品一区二区三区| 国产日韩欧美亚洲| 欧美网站大全在线观看| 国产在线精品免费| 一卡二卡三卡日韩欧美| 日韩欧美国产麻豆| 91免费国产视频网站| 久久精品国产免费| 亚洲激情在线播放| 欧美精品一区二区三区蜜桃| 一本久久a久久免费精品不卡| 久久99久国产精品黄毛片色诱| 亚洲欧洲av色图| 精品理论电影在线| 欧美亚洲禁片免费| 福利一区福利二区| 日韩电影在线一区二区三区| 中文字幕亚洲视频| 久久亚洲欧美国产精品乐播| 91国在线观看| 国产成a人亚洲精| 日本美女一区二区三区视频| 亚洲欧美综合网| 久久久三级国产网站| 欧美理论片在线| 99国产精品久久| 国产一区二区不卡在线| 石原莉奈在线亚洲三区| 日韩一区日韩二区| 久久综合狠狠综合久久激情| 欧美日韩一本到| eeuss鲁片一区二区三区在线观看| 久久精品国产亚洲a| 午夜免费欧美电影| 亚洲人精品午夜| 中文字幕av资源一区| 日韩欧美亚洲国产精品字幕久久久 | 精品福利视频一区二区三区| 欧美综合久久久| 99精品视频在线免费观看| 国产精品原创巨作av| 久久国产欧美日韩精品| 一区二区激情小说| 亚洲视频小说图片| 国产精品―色哟哟| 久久免费视频一区| 欧美xxx久久| 欧美一区二区三区啪啪| 欧美色窝79yyyycom| 99riav一区二区三区| 国产成人a级片| 国产乱理伦片在线观看夜一区| 蜜桃av一区二区| 免费在线成人网| 免费在线视频一区| 日本不卡视频在线观看| 日韩中文字幕亚洲一区二区va在线 | 成人午夜免费视频| 国产成人自拍在线| 国产真实乱偷精品视频免| 蜜桃久久av一区| 麻豆国产精品777777在线| 奇米四色…亚洲| 久久精品国产一区二区三| 捆绑紧缚一区二区三区视频| 日本成人中文字幕在线视频| 日本vs亚洲vs韩国一区三区二区| 视频一区在线视频| 天天免费综合色| 天天色综合天天| 日本不卡不码高清免费观看| 免费在线视频一区| 激情综合色综合久久| 国产在线观看免费一区| 国产不卡视频一区二区三区| 成人深夜在线观看| 91视频精品在这里| 欧美亚洲高清一区| 91精品在线观看入口| 日韩免费高清av| 久久精品亚洲一区二区三区浴池 | 99久久精品国产网站| av不卡在线播放| 91精品福利视频| 9191国产精品| 精品国产凹凸成av人导航| 久久夜色精品国产欧美乱极品| 中文字幕高清不卡| 亚洲美女免费在线| 日日夜夜一区二区|