网站首页

家园论坛

老版论坛

家园博客

业界新闻

技术文档

下载中心

速查中心

图片中心

硬件资讯
上一篇:C++中确定基类有虚析构函数 下一篇:论C/C++函数间动态内存的传递
lzw压缩算法的c语言实现

来源: 作者: 添加日期:2006-7-17 6:53:04 点击次数:

    {
        if( !in_table(lzw) )
        {
                // current code not in code table
                // then add it to table and output prefix


                insert_table(lzw);
                prefix = lzw->suffix;
                output_code( lzw->prefix ,out ,lzw );
                lzw->code++;

                if( lzw->code == (WORD)1<< lzw->cur_code_len )
                {
                    // code reached current code top(1<<cur_code_len)
                    // then current code length add one
     lzw->cur_code_len++;
     if( lzw->cur_code_len == CODE_LEN + 1 )
     {
      re_init_lzw( lzw );
     }

                }
        }
        else
        {
                // current code already in code table
                // then output nothing
                prefix = get_code(lzw);

        }
        lzw->prefix = prefix;
        lzw->suffix = in->lp_buffer[ in->index++ ];
    }
}

//------------------------------------------------------------------------------
VOID encode(HANDLE h_sour,HANDLE h_dest)
{
    LZW_DATA        lzw;
    BUFFER_DATA     in ;
    BUFFER_DATA     out;
    
    BOOL first_run = TRUE;

    lzw_create( &lzw ,h_sour,h_dest );

本新闻共10页,当前在第07页  01  02  03  04  05  06  07  08  09  10  

 
设为首页 | 加入收藏 | 业务办理 | 友情链接 | 论坛版面 | 浙ICP备07502118号 |