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

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

?? comp-2.c

?? 包含Lzw,Huff1,Dhuff等等多種壓縮算法的源代碼包
?? C
字號:
/*
 * Listing 10 -- comp-2.c
 *
 * This module is the driver program for a variable order
 * finite context compression program.  The maximum order is
 * determined by command line option.  This particular version
 * also monitors compression ratios, and flushes the model whenever
 * the local (last 256 symbols) compression ratio hits 90% or higher.
 *
 * To build this program:
 *
 * Turbo C:     tcc -w -mc comp-2.c model-2.c bitio.c coder.c
 * QuickC:      qcl /AC /W3 comp-2.c model-2.c bitio.c coder.c
 * Zortech:     ztc -mc comp-2.c model-2.c bitio.c coder.c
 * *NIX:        cc -o comp-2 comp-2.c model-2.c bitio.c coder.c
 *
 * Command line options:
 *
 *  -f text_file_name  [defaults to test.inp]
 *  -c compressed_file_name [defaults to test.cmp]
 *  -o order [defaults to 3 for model-2]
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "coder.h"
#include "model.h"
#include "bitio.h"

/*
 * The file pointers are used throughout this module.
 */
FILE *text_file;
FILE *compressed_file;

/*
 * Declarations for local procedures.
 */
void initialize_options( int argc, char **argv );
int check_compression( void );
void print_compression( void );

/*
 * The main procedure is similar to the main found in COMP-1.C.
 * It has to initialize the coder, the bit oriented I/O, the
 * standard I/O, and the model.  It then sits in a loop reading
 * input symbols and encoding them.  One difference is that every
 * 256 symbols a compression check is performed.  If the compression
 * ratio exceeds 90%, a flush character is encoded.  This flushes
 * the encoding model, and will cause the decoder to flush its model
 * when the file is being expanded.  The second difference is that
 * each symbol is repeatedly encoded until a succesfull encoding
 * occurs.  When trying to encode a character in a particular order,
 * the model may have to transmit an ESCAPE character.  If this
 * is the case, the character has to be retransmitted using a lower
 * order.  This process repeats until a succesful match is found of
 * the symbol in a particular context.  Usually this means going down
 * no further than the order -1 model.  However, the FLUSH and DONE
 * symbols do drop back to the order -2 model.  Note also that by
 * all rights, add_character_to_model() and update_model() logically
 * should be combined into a single routine.
 */
void main( int argc, char **argv )
{
    SYMBOL s;
    int c;
    int escaped;
    int flush = 0;
    long int text_count = 0;

    initialize_options( --argc, ++argv );
    initialize_model();
    initialize_output_bitstream();
    initialize_arithmetic_encoder();
    for ( ; ; )
    {
	if ( ( ++text_count & 0x0ff ) == 0 )
            flush = check_compression();
        if ( !flush )
            c = getc( text_file );
        else
            c = FLUSH;
        if ( c == EOF )
            c = DONE;
        do {
            escaped = convert_int_to_symbol( c, &s );
            encode_symbol( compressed_file, &s );
        } while ( escaped );
        if ( c == DONE )
	    break;
        if ( c == FLUSH )
	{
	    flush_model();
            flush = 0;
	}
        update_model( c );
        add_character_to_model( c );
    }
    flush_arithmetic_encoder( compressed_file );
    flush_output_bitstream( compressed_file );
    print_compression();
    fputc( '\n', stderr );
    exit( 0 );
}

/*
 * This routine checks for command line options, and opens the
 * input and output files.  The only other command line option
 * besides the input and output file names is the order of the model,
 * which defaults to 3.
 */
void initialize_options( int argc, char **argv )
{
    char text_file_name[ 81 ];
    char compressed_file_name[ 81 ];

    strcpy( compressed_file_name, "test.cmp" );
    strcpy( text_file_name, "test.inp" );
    while ( argc-- > 0 )
    {
        if ( strcmp( *argv, "-f" ) == 0 )
	{
	    argc--;
	    strcpy( text_file_name, *++argv );
	}
        else if ( strcmp( *argv, "-c" ) == 0 )
	{
	    argc--;
	    strcpy( compressed_file_name, *++argv );
	}
        else if ( strcmp( *argv, "-o" ) == 0 )
	{
	    argc--;
            max_order = atoi( *++argv );
	}
	else
	{
            fprintf( stderr, "\nUsage: COMP-2 [-o order] " );
            fprintf( stderr, "[-f text file] [-c compressed file]\n" );
            exit( -1 );
	}
	argc--;
	argv++;
    }
    text_file = fopen( text_file_name, "rb" );
    compressed_file = fopen( "test.cmp", "wb" );
    if ( text_file == NULL || compressed_file == NULL )
    {
        printf( "Had trouble opening one of the files!\n" );
        exit( -1 );
    }
    setvbuf( text_file, NULL, _IOFBF, 4096 );
    setbuf( stdout, NULL );
    printf( "Compressing %s to %s, order %d.\n",
            text_file_name,
            compressed_file_name,
            max_order );
}

/*
 * This routine is called to print the current compression ratio.
 * It prints out the number of input bytes, the number of output bytes,
 * and the bits per byte compression ratio.   This is done both as a
 * pacifier and as a seat-of-the-pants diagnostice.  A better version
 * of this routine would also print the local compression ratio.
 */
void print_compression()
{
    long total_input_bytes;
    long total_output_bytes;

    total_input_bytes  =  ftell( text_file );
    total_output_bytes = bit_ftell_output( compressed_file );
    if ( total_output_bytes == 0 )
        total_output_bytes = 1;

    fprintf( stderr,"%ld/%ld, %2.3f\r",
	     total_input_bytes,
	     total_output_bytes,
             8.0 * total_output_bytes / total_input_bytes );
}

/*
 * This routine is called once every 256 input symbols.  Its job is to
 * check to see if the compression ratio hits or exceeds 90%.  If the
 * output size is 90% of the input size, it means not much compression
 * is taking place, so we probably ought to flush the statistics in the
 * model to allow for more current statistics to have greater impactic.
 * This heuristic approach does seem to have some effect.
 */
int check_compression()
{
    static long local_input_marker = 0L;
    static long local_output_marker = 0L;
    long total_input_bytes;
    long total_output_bytes;
    int local_ratio;

    print_compression();
    total_input_bytes  =  ftell( text_file ) - local_input_marker;
    total_output_bytes = bit_ftell_output( compressed_file );
    total_output_bytes -= local_output_marker;
    if ( total_output_bytes == 0 )
        total_output_bytes = 1;
    local_ratio = (int)( ( total_output_bytes * 100 ) / total_input_bytes );

    local_input_marker = ftell( text_file );
    local_output_marker = bit_ftell_output( compressed_file );

    if ( local_ratio > 90 && flushing_enabled )
    {
        fprintf( stderr, "Flushing... \r" );
        return( 1 );
    }
    return( 0 );
}


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
97se狠狠狠综合亚洲狠狠| 久久成人免费网| 国产欧美日韩激情| 久久精品这里都是精品| 精品国产3级a| 精品999久久久| 久久久91精品国产一区二区精品| 欧美xxxxxxxxx| 精品剧情在线观看| 久久免费电影网| 久久久久久久久久久久电影 | 中文字幕一区二区三区蜜月| 亚洲精品一区二区精华| 精品99999| 久久久青草青青国产亚洲免观| 久久老女人爱爱| 国产精品精品国产色婷婷| 亚洲图片你懂的| 亚洲成a人片综合在线| 日本不卡1234视频| 国产成人午夜99999| 岛国精品在线观看| 在线欧美日韩精品| 欧美一区二区女人| 国产免费成人在线视频| 亚洲狠狠丁香婷婷综合久久久| 亚洲一区视频在线| 国产一二三精品| 99v久久综合狠狠综合久久| 色综合天天性综合| 欧美成人精品高清在线播放| 日本一区二区视频在线观看| 亚洲一区二区欧美激情| 视频一区免费在线观看| 福利一区二区在线| 欧美群妇大交群中文字幕| 久久精品一二三| 艳妇臀荡乳欲伦亚洲一区| 激情欧美一区二区三区在线观看| 99re免费视频精品全部| 日韩一区二区三区三四区视频在线观看| 欧美成人伊人久久综合网| 亚洲天堂福利av| 男男视频亚洲欧美| 91老师国产黑色丝袜在线| 日韩欧美成人一区| 一区二区三区欧美日| 国产乱码精品一区二区三区忘忧草 | 国产精品一区二区黑丝| 色88888久久久久久影院按摩| 精品剧情在线观看| 亚洲va国产va欧美va观看| av色综合久久天堂av综合| 日韩一区二区高清| 一区二区激情视频| av亚洲精华国产精华| wwwwww.欧美系列| 亚洲一区二区三区四区五区黄| 粉嫩av一区二区三区粉嫩| 日韩免费在线观看| 亚洲444eee在线观看| av不卡免费电影| 欧美国产一区二区在线观看| 麻豆国产精品777777在线| 欧美图片一区二区三区| 亚洲免费av在线| 99久久免费精品高清特色大片| 久久精品人人爽人人爽| 精品一区二区成人精品| 欧美一二三四在线| 日本va欧美va欧美va精品| 欧美肥妇bbw| 偷拍亚洲欧洲综合| 欧美日韩1区2区| 午夜日韩在线观看| 欧美老女人第四色| 亚洲国产精品综合小说图片区| 色8久久人人97超碰香蕉987| 亚洲精品水蜜桃| 99v久久综合狠狠综合久久| 国产精品二三区| 91最新地址在线播放| 一区二区三区四区五区视频在线观看| gogogo免费视频观看亚洲一| 国产精品视频麻豆| 91色|porny| 亚洲国产精品一区二区www| 欧美男男青年gay1069videost| 亚洲永久精品国产| 欧美一区二区三区喷汁尤物| 久久99国产精品免费| 2017欧美狠狠色| 成人教育av在线| 亚洲免费电影在线| 欧美一级在线视频| 国产麻豆成人精品| 亚洲人妖av一区二区| 色老汉一区二区三区| 午夜私人影院久久久久| 欧美变态口味重另类| 丁香婷婷深情五月亚洲| 一级日本不卡的影视| 日韩三级在线免费观看| 成人丝袜视频网| 亚洲一区中文在线| 久久综合久久综合久久| 91在线丨porny丨国产| 亚洲成av人片| 精品美女被调教视频大全网站| 成人a区在线观看| 亚洲综合色婷婷| 日韩一卡二卡三卡| 99久久国产综合精品色伊| 图片区小说区区亚洲影院| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 国产日产精品一区| 欧美日韩电影在线| 成人的网站免费观看| 午夜一区二区三区在线观看| 久久久另类综合| 欧美日韩美少妇| 国产精品1区2区| 亚洲成年人影院| 国产精品久久久久久久裸模| 欧美另类z0zxhd电影| av亚洲产国偷v产偷v自拍| 久久精品国产亚洲5555| 亚洲精品大片www| 国产欧美久久久精品影院| 欧美一级欧美三级| 91国偷自产一区二区三区成为亚洲经典| 蜜臀va亚洲va欧美va天堂 | 亚洲国产欧美日韩另类综合| 国产日韩欧美在线一区| 日韩一区二区麻豆国产| 91精彩视频在线| 成人avav在线| 国产精品一区一区三区| 美女免费视频一区二区| 亚洲v日本v欧美v久久精品| 国产精品进线69影院| 国产夜色精品一区二区av| 欧美一区二区三区四区五区| 欧美午夜片在线观看| 91免费看`日韩一区二区| 成人性生交大片免费看中文网站 | 精品久久久久久久久久久久久久久久久| 欧美最猛性xxxxx直播| 色综合久久久网| 99re视频精品| 91视频在线观看免费| 成人精品国产福利| 成人精品免费网站| 91在线免费视频观看| 99九九99九九九视频精品| 国产91丝袜在线18| 成人av网站在线| 91在线视频观看| 91国产成人在线| 欧美亚洲一区二区在线观看| 欧美日韩亚洲综合在线| 欧美人体做爰大胆视频| 日韩一区二区三区视频在线观看| 欧美一区二区在线视频| 日韩欧美在线观看一区二区三区| 91麻豆精品国产无毒不卡在线观看| 欧美二区乱c少妇| 精品三级在线看| 国产欧美一区视频| 亚洲欧美日本在线| 五月天亚洲婷婷| 九九**精品视频免费播放| 国产精品77777竹菊影视小说| 成人福利视频在线| 91豆麻精品91久久久久久| 欧美欧美午夜aⅴ在线观看| 日韩欧美在线不卡| 欧美国产一区视频在线观看| 亚洲精品va在线观看| 日韩二区三区四区| 大胆亚洲人体视频| 欧美日韩在线三区| 2021中文字幕一区亚洲| 国产精品理论片| 亚洲v中文字幕| 国产盗摄女厕一区二区三区| 91色porny| 精品动漫一区二区三区在线观看| 国产精品你懂的在线欣赏| 亚洲国产一二三| 成人性生交大片免费| 欧美久久一二区| 国产精品午夜在线| 蜜桃久久久久久| 91女人视频在线观看| 精品福利一区二区三区| 夜夜嗨av一区二区三区| 国产精品一二三四| 欧美高清视频一二三区| 国产精品成人一区二区艾草 |