Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lzw optimizations #59

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Commits on Aug 29, 2024

  1. When reading a tiff file wil lzw compression, the bit size needs to be

    capped at 12.
    p002308A authored and p002308A committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    f61f6bc View commit details
    Browse the repository at this point in the history
  2. Changed the LZW table to be an array instead of a map for efficiency.

    The codes are maintained in sequential order starting at zero. It is
    inefficient to store them in a map with the keys being Integer objects
    when they can be stored in an array and indexed directly. This saves on
    map lookups each time and removes the creation of excess Integer objects
    when primitives work.
    
    In addition, the values being stored as Integer[] was inefficient when
    byte[] is what is needed.
    
    These changes make this section of the code run over twice as fast in
    testing.
    p002308A authored and p002308A committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    893bf9e View commit details
    Browse the repository at this point in the history
  3. Save the old value directly instead of having to relook it up each time.

    p002308A authored and p002308A committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    0b47798 View commit details
    Browse the repository at this point in the history
  4. Refactored the getNextCode function to be much simpler.

    This improves the runtime of the entire lzw decompression by about 67%
    in testing.
    p002308A authored and p002308A committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    ae183e5 View commit details
    Browse the repository at this point in the history
  5. Simplified the checking of the bit size.

    Removed the heavy math equation done each time, to a simpler one done
    rarely. This give a performance boost to the entire LZW decoding method
    of about 50%.
    p002308A authored and p002308A committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    730c075 View commit details
    Browse the repository at this point in the history