Git Product home page Git Product logo

lzs-compression's People

Contributors

cmcqueen avatar quanterium avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

lzs-compression's Issues

Decompression output is not complete when using incremental

This test compresses and decompresses text by using incremental versions of the functions.

static void compress_decompress_incremental()
{
    const char* in_buffer = "Return a string containing a printable representation of an object. "
      "For many types, this function makes an attempt to return a string that would yield an "
      "object with the same value when passed to eval(), otherwise the representation is a "
      "string enclosed in angle brackets that contains the name of the type of the object "
      "together with additional information often including the name and address of the object.";

    uint8_t out_buffer[1024];
    LzsCompressParameters_t     compress_params;
    lzs_compress_init(&compress_params);

    compress_params.inPtr = (const uint8_t*)in_buffer;
    compress_params.inLength = strlen(in_buffer);
    compress_params.outPtr = out_buffer;
    compress_params.outLength = sizeof(out_buffer);

    size_t out_size = lzs_compress_incremental(&compress_params, true);

    char dec_buffer[1024];

    LzsDecompressParameters_t   decompress_params;
    lzs_decompress_init(&decompress_params);

    decompress_params.inPtr = out_buffer;
    decompress_params.inLength = out_size;
    decompress_params.outPtr = (uint8_t*)dec_buffer;
    decompress_params.outLength = sizeof(dec_buffer);

    size_t dec_size = lzs_decompress_incremental(&decompress_params);
    //dec_buffer[dec_size] = 0;

    printf("Decompressed data \n%s\n", dec_buffer);
}

Unfortunately after decompression, the last 3 words (of the object.) are missing.

Faster compression using hash table of history buffer

Store a hash table of two-byte pairs for each entry in the history table. That allows faster searches through history: when searching for a match, hash the first two bytes that are being searched, then look up the hash value in the table.

This uses more memory to store the hash table (e.g. ~4 kB), but gives a significant speed benefit.

Add thorough unit tests

Add thorough unit tests.

  • Single-pass compression and decompression.
  • Incremental compression and decompression.
    • Input limited.
    • Output limited.
    • Input/output buffers of various sizes from 1 to 100 bytes.
  • Larger variety and quantity of test data.

Add Licence

Hi Craig,

Can you please add an appropriate license to your library? This will let others like me know whether or not we can use your library in our code.

May I add that a permissive license would be much appreciated!

Thanks!

Support for incremental compression

Hi Craig,

I noticed that the library exposes APIs for "incremental" compression but does not actually implement them.

It would be great if it was implemented.

Thanks!

stack-buffer-overflow detected in Clang AddressSanitizer

==18859==ERROR: AddressSanitizer: stack-buffer-overflow on address 0xffce2ae6 at pc 0x0817261a bp 0xffcdf7a8 sp 0xffcdf79c
READ of size 1 at 0xffce2ae6 thread T0
    #0 0x8172619 in lzs_compress /builds/Application/dependencies/lzs/src/liblzs/lzs-compression.c:390:45

The offending line appears to be

inputHash = inputs_hash(*inPtr, *(inPtr + 1));

I'm suspecting the overflow is due to inPtr + 1 when inPtr is already at the last element of the input array.

Add autotools build

For the C code, add an autotools build process. It should build a library, compress and decompress utilities, and unit tests. It should run the unit tests via make check.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.