小编Mar*_*cos的帖子

Lempel-Ziv-Welch减压不存在指数

我有一个LZW压缩/解压缩算法的实现,并且大部分都是平方.但是,我遇到了我正在测试的其中一个文件的问题.以下是该文件的文字

#include "bits.h"

int check_endianness(){
    int i = 1;
Run Code Online (Sandbox Code Playgroud)

我实现的区域就是前面的空格组.int i = 1;下面我分别包含了我的压缩和解压缩循环以及它们的相对调试输出.

压缩循环

i=0;
while(i < input_len && ret == LZW_ERR_OK){
    //get next byte
    char curChar = input_char(f_input, &io_flags);
    i++;

    //not necessary to check for stream end here since the while condition does that
    if(io_flags == STREAM_ERR_READ){
        ret = LZW_ERR_READ;
        break;
    }

    seqset(&temp, &curChar, 1);

    //add bytes to temp until a sequence is found that is not in lookup
    while(i < input_len && dictionary_has_entry(lookup, temp)){
        char curChar …
Run Code Online (Sandbox Code Playgroud)

c compression algorithm

9
推荐指数
1
解决办法
204
查看次数

标签 统计

algorithm ×1

c ×1

compression ×1