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

patterns/tiff: support BigTIFF and tiled TIFF; bugfixes and cleanups #159

Merged
merged 15 commits into from
Sep 24, 2023

Commits on Sep 10, 2023

  1. patterns/tiff: show TIFF tag name/number in DirectoryEntry array

    Don't require unfolding the array entry to see what tag it contains.
    bgilbert committed Sep 10, 2023
    Configuration menu
    Copy the full SHA
    c99a792 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    07155f4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    26f9664 View commit details
    Browse the repository at this point in the history
  4. patterns/tiff: add TIFFRational type

    Rationals, uniquely, are primitives with two fields.  Add a struct to
    represent this, rather than inlining them.
    bgilbert committed Sep 10, 2023
    Configuration menu
    Copy the full SHA
    0358a8c View commit details
    Browse the repository at this point in the history
  5. patterns/tiff: use correct types for fields smaller than 4 bytes

    Small fields are always left-aligned in the 4-byte Value Offset.  On
    little-endian TIFFs we currently cheat this by declaring a 32-bit value
    and letting little-endianness handle the semantics.  However, this adds
    some extra conditionals, and misrepresents the resulting field as 32 bits.
    Drop the cheat.
    bgilbert committed Sep 10, 2023
    Configuration menu
    Copy the full SHA
    2f6ea91 View commit details
    Browse the repository at this point in the history
  6. patterns/tiff: add ValueOffset abstraction

    We were using the field type to make assumptions about whether the Value
    Offset is a Value or an Offset, which is incorrect.  If the Count
    multiplied by the field size is larger than 4, the field is an Offset;
    otherwise it's a Value.
    
    Add display sugar for single-element arrays to avoid extra nesting.
    bgilbert committed Sep 10, 2023
    Configuration menu
    Copy the full SHA
    08498fe View commit details
    Browse the repository at this point in the history
  7. patterns/tiff: drop dead code

    get_ifds_offsets() and BIG/LITTLE aren't used at all.  get_total_IFDs()
    is only used for declaring the length of TIFFFile.IFDs, and isn't needed
    because IFDs are structured as a linked list.
    bgilbert committed Sep 10, 2023
    Configuration menu
    Copy the full SHA
    1f7de81 View commit details
    Browse the repository at this point in the history
  8. patterns/tiff: drop set_endian()

    The call in TIFFFile is redundant.  Drop both calls and open-code the
    check at the top level, before executing any code.  The BigTIFF check
    will eventually be added alongside this one.
    
    Fail if we don't recognize the magic number.
    bgilbert committed Sep 10, 2023
    Configuration menu
    Copy the full SHA
    cacbed0 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    447c193 View commit details
    Browse the repository at this point in the history
  10. patterns/tiff: drop strip offset/byte count arrays from struct IFD

    They're redundant with the fields in the DirectoryEntry array.  Also
    they're buggy: they assume the field Value Offsets are always offsets,
    which isn't true for single-strip IFDs, and they ignore a partial last
    strip in multiple-strip IFDs.
    bgilbert committed Sep 10, 2023
    Configuration menu
    Copy the full SHA
    627f107 View commit details
    Browse the repository at this point in the history
  11. patterns/tiff: rewrite strip array generation

    We're making extra work for ourselves by avoiding the type system.  Also,
    by calculating the number of strips we expect rather than the number of
    strips we actually have, we're miscounting and omitting any partial last
    strip.
    
    Instead, read the strip offsets and byte counts directly from the
    IFDEntry array.
    bgilbert committed Sep 10, 2023
    Configuration menu
    Copy the full SHA
    d305386 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    365c24c View commit details
    Browse the repository at this point in the history
  13. patterns/tiff: increase variable widths for BigTIFF

    Use 64-bit temporary variables for values that can be 64 bits in BigTIFF.
    bgilbert committed Sep 10, 2023
    Configuration menu
    Copy the full SHA
    4d1e635 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    f878df8 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    331557f View commit details
    Browse the repository at this point in the history