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

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

?? unhuf.c

?? huffman壓縮算法的VC++實(shí)現(xiàn)。多媒體課程設(shè)計(jì)
?? C
字號(hào):
/*******************************************************************************
*                                                                              *
* UNHUF.C   by Shaun Case   April 1991                                         *
*                                                                              *
* Written in Borland C++ 2.0 under MS-DOS 3.3                                  *
*                                                                              *
* Decompresses a single file encoded with companion program HUF,               *
* which uses Huffman encoding.                                                 *
*                                                                              *
* This program is in the public domain.                                        *
*                                                                              *
* atman%ecst.csuchico.edu@RELAY.CS.NET                                         *
*                                                                              *
*                                                                              *
*******************************************************************************/

#include <stdio.h>
#include <math.h>

#define FALSE 0
#define TRUE !FALSE
#define MAX_DECODE_TABLE_SIZE 520       /* 512 should be enough           */


/* uncomment the next line to see the decode table at runtime. */

/*
#define DEBUG
*/


/* uncomment the next line to only uncompress the exact number of bytes   */
/* that were originally encoded.  If it is not defined, the routine will  */
/* faster, but will generate up to 8 extra bytes at the end of the        */
/* decompressed data.                                                     */

#define EXACT


typedef struct decode_table_element {   /* template for decode table element (wow)  */
    unsigned char letter;               /* which character to decode to             */
    char spare;                         /* force 16-bit word alignment              */
    short left;                         /* index of lower left element from tree    */
    short right;                        /* index of lower right element from tree   */
}decode_table_element;


short array_max_index;                  /* max number of elements in array (to be   */
                                        /* determined in create_decode_table() )    */

unsigned long  total;                   /* total number of unencoded bytes          */
FILE *infile;                           /* file ptr to SYSTEM.HUF (compressed)      */
FILE *outfile;                          /* file ptr to SYSTEM.UNH (decompressed)    */
char *infilename;                       /* name of the input file                   */
char origfilename[13];                  /* name of the original file                */

struct decode_table_element             /* array implementation of huffman tree     */
    decode_table[MAX_DECODE_TABLE_SIZE];

/******
 *
 * Datafile:  All 16/32 bit quantities in Intel byte ordering
 *
 *  13 bytes    : original filename (8.3 + '\0')
 *  16 bits     : number of array elements needed, N (N == 511 means 512 array
 *                elements -> 0..511)
 *  32 bits     : size of uncompressed original data in bytes
 *  N * 6 bytes : Array elements in order 0 .. N
 *                struct decode_table_element {
 *                     char letter;      8 bits
 *                     char spare;       8 bits
 *                     short left;      16 bits
 *                     short right;     16 bits
 *                 }
 *  <?>          : compressed data, effectively a bit stream
 *
 ******/


int main(int argc, char **argv)
{
    short read_header(void);                /* prototype */
    void show_bit_sequences(short index);   /* prototype */
    short uncompress(void);                 /* prototype */

    if (argc != 2) {                        /* check command line argument validity  */
        puts("'unhuf file' decodes file.");
        return 1;
	}
    puts("Unhuf by Shaun Case, 1991, public domain");

    infilename=argv[1];


    if (read_header() != 0)                 /* read in file name, size, decode table */
        return 1;

#ifdef DEBUG
    show_bit_sequences(0);
#endif

    if (uncompress() != 0)                  /* uncompress the data & write to file   */
        return 1;

    fclose(infile);

    return 0;

}

/*
 * read in the original filename, size, and decode table
 *
 */

short read_header(void)
{
    if ((infile=fopen(infilename, "rb")) == NULL)        /* open file           */
    {
        printf("Unable to open %s\n", infilename);
        return 1;
    }


    if (                                                 /* get original name   */
          fread((void *)origfilename, 1, 13, infile)
          < 13
       )
    {
        printf("Unable to read original filename from %s\n", infilename);
        fclose(infile);
        return 1;
    }

                                                         /* get length of decode table */
    if (
          fread((void *)&array_max_index, sizeof(short), 1, infile)
          < 1
       )
    {
        printf("Unable to read number of array elements from %s\n", infilename);
        fclose(infile);
        return 1;
    }

        if (                                             /* get filesize in bytes */
              fread((void *)&total, sizeof(unsigned long), 1, infile)
            < 1
       )
    {
        printf("Unable to read original byte count from %s\n", infilename);
        fclose(infile);
        return 1;
    }

    printf("Decoding %ld bytes to %s.\n", total, origfilename);
    printf("Decode table contains %d elements.\n",array_max_index + 1);

    if (                                                /* get decode table        */
          fread((void *)decode_table, sizeof(decode_table_element), array_max_index + 1, infile)
          < (array_max_index + 1)
       )
    {
        printf("Unable to read decode table from %s\n", infilename);
        fclose(infile);
        return 1;
    }

    return 0;
}

#ifdef DEBUG
short seq_len=0;  /* routine is recursive, needs global storage  */
                  /* length of current bit sequence              */
                  /* this should probably be static inside sbs() */


/*
 * display the bit sequences that represent each character.
 * useful for debugging.
 *
 */

void show_bit_sequences(short index)
{

    static short temp_index=0;
    static char bit_sequence[16];       /* where to build the huffman bit sequence  */

    if (decode_table[index].left != 0)  /* if we are not at a leaf, go left         */
    {
        bit_sequence[seq_len++]='1';
        show_bit_sequences(decode_table[index].left);
        seq_len--;
    }
                                        /* returned from going left, now try right  */
    if (decode_table[index].right != 0)
    {
        bit_sequence[seq_len++]='0';    /* if we are not at a leaf, go right        */
        show_bit_sequences(decode_table[index].right);
        seq_len--;
    }

    if (decode_table[index].left != NULL)    /* we are at an interior node going back up */
        return;

    /* we are at a leaf, therefore we have a complete bit sequence built            */

    bit_sequence[seq_len] = 0;          /* append teriminating NULL to string       */

    printf("[%3d] %3d == %16s == %3d\n", temp_index, decode_table[index].letter, bit_sequence, seq_len);
    temp_index++;
}

#endif

/*
 * all the fputc() calls are unrolled for speed.
 *
 */

short uncompress(void)
{

    /* tcc68 can assign 7 register variables */

    register short index         = 0;               /* "ptr" to "node" in "tree"        */
                                                    /* actually an array index          */
    register unsigned unsigned int buffer = 0;      /* 8 bit buffer                     */
    register unsigned short fastleft;               /* fast ptr to next left  element   */
    register unsigned short  fastleft0;             /* fast ptr to left of root         */
    register long running_total = 0L;

    if ((outfile=fopen(origfilename, "wb")) == NULL)    /* open file                        */
    {
        printf("Unable to open %s\n", origfilename);
        return 1;
    }

    fastleft0 = decode_table[0].left;                   /* setup frequently used vars       */
    fastleft = fastleft0;

    while (1)
    {
        buffer=fgetc(infile);                           /* get 8 bits                       */


        /* branch left if current bit == 1, else branch right                               */

        index = ( (buffer & 0x0080) ? fastleft : decode_table[index].right);

        buffer <<= 1;                                   /* rotate next bit to test postion  */

        fastleft = decode_table[index].left;            /* set up frequently used var       */

        if (fastleft == 0)                              /* if we have decoded a char        */
        {
            if (
                fputc((int)decode_table[index].letter, outfile)    /* write it to output    */
                == EOF
               )
            {
                puts("Error writing to output file, out of disk space?");
                return 1;
            }
            index = 0;                                  /* set "ptr" to top of "tree"       */
            fastleft = fastleft0;                       /* set up freq. used variable       */
#ifdef EXACT
            if (++running_total == total) goto finished;  /* if we are done, quit.          */
#endif EXACT
#ifndef EXACT
        ++running_total;
#endif EXACT
        }


        /* and do it again for 2nd bit. */

        index = ( (buffer & 0x0080) ? fastleft : decode_table[index].right);

        buffer <<= 1;

        fastleft = decode_table[index].left;

        if (fastleft == 0)
        {
            if (
                fputc((int)decode_table[index].letter, outfile)
                == EOF
               )
            {
                puts("Error writing to output file, out of disk space?");
                return 1;
            }
            
            index = 0;
            fastleft = fastleft0;
#ifdef EXACT
            if (++running_total == total) goto finished;
#endif EXACT
#ifndef EXACT
        ++running_total;
#endif EXACT
        }
 
        /* and 3rd bit. */

        index = ( (buffer & 0x0080) ? fastleft : decode_table[index].right);

        buffer <<= 1;

        fastleft = decode_table[index].left;

        if (fastleft == 0)
        {
            if (
                fputc((int)decode_table[index].letter, outfile)
                == EOF
               )
            {
                puts("Error writing to output file, out of disk space?");
                return 1;
            }
            
            index = 0;
            fastleft = fastleft0;
#ifdef EXACT
            if (++running_total == total) goto finished;
#endif EXACT
#ifndef EXACT
        ++running_total;
#endif EXACT
        }

        /* and 4th bit. */

        index = ( (buffer & 0x0080) ? fastleft : decode_table[index].right);

        buffer <<= 1;

        fastleft = decode_table[index].left;

        if (fastleft == 0)
        {
            if (
                fputc((int)decode_table[index].letter, outfile)
                == EOF
               )
            {
                puts("Error writing to output file, out of disk space?");
                return 1;
            }
            
            index=0;
            fastleft = fastleft0;
#ifdef EXACT
            if (++running_total == total) goto finished;
#endif EXACT
#ifndef EXACT
        ++running_total;
#endif EXACT
        }

        /* and 5th bit. */

        index = ( (buffer & 0x0080) ? fastleft : decode_table[index].right);

        buffer <<= 1;

        fastleft = decode_table[index].left;

        if (fastleft == 0)
        {
            if (
                fputc((int)decode_table[index].letter, outfile)
                == EOF
               )
            {
                puts("Error writing to output file, out of disk space?");
                return 1;
            }
            index = 0;
            fastleft = fastleft0;
#ifdef EXACT
            if (++running_total == total) goto finished;
#endif EXACT
#ifndef EXACT
        ++running_total;
#endif EXACT
        }

        /* and 6th bit. */

        index = ( (buffer & 0x0080) ? fastleft : decode_table[index].right);

        buffer <<= 1;

        fastleft = decode_table[index].left;

        if (fastleft == 0)
        {
            if (
                fputc((int)decode_table[index].letter, outfile)
                == EOF
               )
            {
                puts("Error writing to output file, out of disk space?");
                return 1;
            }

            index = 0;
            fastleft = fastleft0;
#ifdef EXACT
            if (++running_total == total) goto finished;
#endif EXACT
#ifndef EXACT
        ++running_total;
#endif EXACT
        }

        /* and 7th bit. */

        index = ( (buffer & 0x0080) ? fastleft : decode_table[index].right);

        buffer <<= 1;

        fastleft = decode_table[index].left;

        if (fastleft == 0)
        {
            if (
                fputc((int)decode_table[index].letter, outfile)
                == EOF
               )
            {
                puts("Error writing to output file, out of disk space?");
                return 1;
            }

            index = 0;
            fastleft = fastleft0;
#ifdef EXACT
            if (++running_total == total) goto finished;
#endif EXACT
#ifndef EXACT
        ++running_total;
#endif EXACT
        }

        /* and finally, the 8th bit. */

        index = ( (buffer & 0x0080) ? fastleft : decode_table[index].right);

        buffer <<= 1;

        fastleft = decode_table[index].left;

        if (fastleft == 0)
        {
            if (
                fputc((int)decode_table[index].letter, outfile)
                == EOF
               )
            {
                puts("Error writing to output file, out of disk space?");
                return 1;
            }

            index = 0;
            fastleft = fastleft0;
#ifdef EXACT
            if (++running_total == total) goto finished;
#endif EXACT
#ifndef EXACT
            ++running_total;
#endif EXACT
        }
#ifndef EXACT
        if (running_total >= total)
            goto finished;
#endif EXACT

    }

finished:

    fclose(outfile);
    printf("Decoded %ld bytes.", running_total);
    return 0;
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品一区二区三区欧美| 大胆欧美人体老妇| 亚洲午夜精品在线| 亚洲品质自拍视频| 日韩一区有码在线| 综合网在线视频| 亚洲日穴在线视频| 亚洲一区在线播放| 亚洲主播在线观看| 日日夜夜免费精品| 蜜臀av一级做a爰片久久| 麻豆专区一区二区三区四区五区| 日韩精品亚洲一区| 蜜桃在线一区二区三区| 国内成人自拍视频| 国产盗摄视频一区二区三区| 成人白浆超碰人人人人| av日韩在线网站| 日本韩国一区二区三区视频| 91丝袜美女网| 欧美性受xxxx黑人xyx| 欧美日韩免费观看一区二区三区 | 国产69精品久久777的优势| 国产ts人妖一区二区| av毛片久久久久**hd| 欧洲人成人精品| 欧美美女激情18p| 日韩精品专区在线影院观看 | 日本美女视频一区二区| 久久99深爱久久99精品| 国产一区二区福利| 91网址在线看| 日韩一区二区三区在线观看| 久久蜜桃av一区二区天堂| 国产精品久久三| 粉嫩在线一区二区三区视频| 91福利国产成人精品照片| 91精品在线一区二区| 久久精品人人做人人综合| 亚洲男帅同性gay1069| 日韩电影网1区2区| 国产99精品国产| 在线观看一区日韩| 日韩欧美一级二级| 1024国产精品| 男女性色大片免费观看一区二区 | 日韩和欧美一区二区| 国产乱码精品一区二区三区五月婷| 成人午夜视频免费看| 欧美喷潮久久久xxxxx| 国产片一区二区| 亚洲午夜一二三区视频| 国产一区二区看久久| 欧美亚洲一区二区在线| 久久久777精品电影网影网 | 亚洲高清久久久| 国模大尺度一区二区三区| 91麻豆.com| 久久综合999| 亚洲综合在线观看视频| 国产高清亚洲一区| 欧美福利电影网| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 日本一区中文字幕| 色94色欧美sute亚洲线路一久| 亚洲精品一区二区三区四区高清 | 成人久久18免费网站麻豆| 5566中文字幕一区二区电影 | 成人免费看视频| 日韩精品一区二区三区三区免费 | 国产成人在线视频网站| 欧美肥妇毛茸茸| 一区二区在线观看不卡| 国产精品亚洲а∨天堂免在线| 91精品在线免费观看| 一区二区成人在线视频| 国产成人超碰人人澡人人澡| 日韩欧美视频在线| 亚洲国产成人91porn| 99国内精品久久| 中文子幕无线码一区tr| 极品少妇xxxx精品少妇| 91精品视频网| 亚洲成av人影院| 欧美午夜片在线观看| 亚洲精选视频免费看| 成人高清伦理免费影院在线观看| 欧美tk—视频vk| 美国欧美日韩国产在线播放| 欧美精品欧美精品系列| 性久久久久久久| 欧美影院一区二区三区| 亚洲视频精选在线| 99久久免费精品高清特色大片| 久久精品人人做人人综合| 国内成人精品2018免费看| 欧美成人video| 免费在线成人网| 日韩一区二区三| 2014亚洲片线观看视频免费| 久久99这里只有精品| 欧美成人精品3d动漫h| 麻豆久久一区二区| 精品国产一区久久| 精品一区二区三区香蕉蜜桃| 2023国产精品| 国产成人av福利| 中文一区一区三区高中清不卡| 国产电影一区在线| 国产精品无遮挡| 91一区一区三区| 一区二区在线电影| 欧美日韩中文字幕精品| 午夜伊人狠狠久久| 91精品国产综合久久久蜜臀图片| 石原莉奈在线亚洲二区| 欧美一区二区三区日韩| 久久99国产精品免费| 久久新电视剧免费观看| 国产jizzjizz一区二区| 国产精品久久毛片| 在线视频欧美精品| 日本午夜精品一区二区三区电影| 日韩一区二区麻豆国产| 国精产品一区一区三区mba桃花 | 国产精品你懂的在线| 波多野结衣中文字幕一区| 亚洲欧美电影一区二区| 欧美理论片在线| 久久国产麻豆精品| 国产日本欧洲亚洲| 色噜噜狠狠色综合欧洲selulu| 婷婷久久综合九色综合伊人色| 日韩精品专区在线影院重磅| 国产精品白丝jk白祙喷水网站| 国产精品久久三| 欧美精品久久99| 国产精品一区二区久激情瑜伽| 国产精品夫妻自拍| 欧美精品亚洲二区| 国产成人aaaa| 午夜久久久久久久久久一区二区| 精品日韩在线一区| 91在线一区二区三区| 日韩精品乱码av一区二区| 久久久久久99久久久精品网站| 91亚洲永久精品| 蜜桃视频第一区免费观看| 亚洲国产激情av| 欧美女孩性生活视频| 成人小视频免费在线观看| 亚洲成a人v欧美综合天堂| 久久蜜臀中文字幕| 91福利在线导航| 国产精品白丝jk黑袜喷水| 亚洲一区二区三区视频在线播放| 日韩欧美国产电影| 91激情五月电影| 国产麻豆成人精品| 视频一区二区国产| 成人免费在线播放视频| 日韩久久久久久| 色婷婷av久久久久久久| 韩国成人在线视频| 亚洲高清久久久| 中文字幕一区二区三区蜜月| 日韩限制级电影在线观看| 色哟哟在线观看一区二区三区| 久久精品国产77777蜜臀| 亚洲精品国产成人久久av盗摄 | 国产欧美视频一区二区三区| 欧美日韩精品三区| 色综合一区二区| 国产九色sp调教91| 日韩精品一二三四| 亚洲另类一区二区| 国产精品色哟哟网站| 精品免费国产二区三区| 欧美写真视频网站| 91老师片黄在线观看| 国产精品一区一区三区| 免费欧美在线视频| 亚洲福利视频三区| 亚洲欧美国产三级| 中文字幕在线不卡国产视频| 久久久青草青青国产亚洲免观| 欧美一级欧美三级在线观看| 欧洲一区二区三区免费视频| 99久久久久久| 成人激情动漫在线观看| 国产一区二区三区黄视频 | 自拍偷在线精品自拍偷无码专区| 精品人伦一区二区色婷婷| 欧美性猛交一区二区三区精品| 成人av网站免费观看| 国产91丝袜在线播放九色| 国产真实乱子伦精品视频| 蜜桃视频在线一区| 美女一区二区久久| 蜜桃一区二区三区四区|