Commit Graph

25 Commits (208788de28150f1ceba5fbfa2f3fc5f191ac3258)

Author SHA1 Message Date
Dustin Oprea a69c3987eb type.go: Created `TagTypePrimitive` alias for `uint16`
Added a `Size()` method to it and decommissioned redundant
`TagTypeSize()` and `(TagType).Size()`.

- ifd_enumerate.go: Moved `ValueContext` definition to
  value_context.go .
2019-12-29 00:03:58 -05:00
Dustin Oprea 9068786204 Rewired to use IFD-path strings instead of IfdIdentities.
- These are absolute representations of where an IFD is positioned with
  respect to the other IFDs. There is a more-specific, "fully-qualified"
  form of the IFD-path that allows you to express indices in order to
  refer to specific siblings.

- Eliminates issues with IFDs at different levels potentially having the
  same name (if that's what is required with a certain dataset/
  datasource).

- There is a specific IFD registry that controls the heirarchy of IFDs
  that we recognize and the tags associated with the child IFDs. This
  allows custom hierarchies replacing even the TIFF specification for
  which are expected in an image (so we can read other types of images
  or any potential IFD hierarchy, even non-image ones).

- IFD and IB instances embed the IFD-path and FQ IFD-path that they were
  found or built for.
2018-08-01 08:35:21 -04:00
Dustin Oprea 71dbc9ff87 ifd_builder_encode: Now allow the IB to be empty.
- So we can install EXIF blocks into images that don't have them.
2018-06-13 06:16:09 -04:00
Dustin Oprea 570c4d582c ifd_builder: renamed builderTag to BuilderTag.
- It's probably a generally good idea.
  - These are usually created by other methods, but they're regularly
    interacted with when you want to make tag changes and by making them
    private we can't public official, testable examples.

- Corrected names for new examples.
2018-05-29 14:47:30 -04:00
Dustin Oprea abbf7e0d92 ifd_builder: `builderTag` is now passed by reference. 2018-05-29 01:32:09 -04:00
Dustin Oprea 8ce7625fc9 ifd_builder_encode: Fixed addressing.
- Corrects the resolution issue that we were experiencing in sibling
  IFDs.
2018-05-28 23:47:47 -04:00
Dustin Oprea 080ff7d07d Adjusted some string representations. Fixed some hex-encodings.
- unknown: We no longer truncate UNDEFINED UserComment values.
  - This is one less thing that will be different between what we read
    and how we encode.
2018-05-28 21:14:15 -04:00
Dustin Oprea 75ff008365 thumbnails: Reimplemented to use normal decode flow.
- We added a trick to overcome the fact that the tag is a slice of longs
  rather than bytes (and would usually cause check errors and alignment
  problems), but this allows us to use the normal allocation and
  decoding flows that are used by normal tags.
  - Made things simpler, but we're still mis-encoding the
    thumbnail, somehow/somewhere.
2018-05-25 21:12:24 -04:00
Dustin Oprea 3cee9b956b ifd_builder_encoder: Fixed subtle but detrimental bugs.
- ifd_builder_encode
  - Bugfix: We were assigning the "next" IFD in correctly (so, chaining
    was broken).
  - Bugfix: We weren't using the right value when *writing* the "next"
    IFD offset (so, chaining was, again, broken).
    - The same IFD was showing as both a child and a sibling, so we were
      seeing the EXIF IFD also being chained-to by the first root IFD
      instead of the *actual* sibling, but only after encoding and then
      decoding (so, this had to be tracked down in the encoding
      semantics, which was non-trivial).

  - Added a test for the stuff that we fixed.
  - Implemented journaling, where we can dump a hierarchically-formatted
    list of operations involved in a completed encode.

- ifd_enumerate: Added (Ifd).TagValueBytes() to return the raw tag-
  value's bytes (rather than just having (Ifd).TagValue(), which returns
  the value marshaled into a string). Good for comparing raw encoded
  and decoded values without imposing interpretation (which gets us into
  trouble with unknown-type tags whose values are non-standard and
  undocumentedand, therefore, not actually parseable).

- Rewired a lot of print and dump functions.
  - For naming-specificity as well as functionality.

- Removed from debugging.
2018-05-21 13:14:42 -04:00
Dustin Oprea 6207bd6200 Checkpoint. 2018-05-12 23:12:53 -04:00
Dustin Oprea 6c71ccf651 ifd_builder_encode: Bugfixed next-IFD offsets.
- Affected sibling IFDs.
2018-05-05 02:01:18 -04:00
Dustin Oprea ea8e174374 ifd_builder_encode: Simplified arithmetic on IFD encode. 2018-05-05 01:03:00 -04:00
Dustin Oprea 4e0ba639f9 ifd_builder_encode: Replaced `EntrySize()` with a constant. 2018-05-05 00:15:59 -04:00
Dustin Oprea 75b2c75c5a ifd_builder_encode: Added tests for encoding child IBs to EXIF.
- Big step. This is the most complicated thing we can do.
- ifd_builder_encode: Need to debug encoding linked IFDs to EXIF.
- ifd_builder: Renamed `SetNextIfd()` to `SetNextIb()`.
- ifd_builder: Bugfix to size assertion on return of
  (IfdBuilderEncode).encodeIfdToBytes().
- ifd_enumerate: Rename PrintNode() to PrintTree().
- ifd_enumerate: Added DumpTree() (to return a list of strings).
2018-05-03 12:43:06 -04:00
Dustin Oprea 16586eb8cb ifd_builder: Now embed type in `builderTag`.
- We were automatically looking this up but this will prevent users from
  having a mechanism to use custom tags.
2018-05-02 06:40:36 -04:00
Dustin Oprea b748843a75 tags_unknown: Seeded a first test for encode/decode.
- type_encode: `EncodeWithType` can now encode TypeAsciiNoNul.
- Resolved/removed a bunch of to-do's.
2018-05-02 06:04:14 -04:00
Dustin Oprea 88cb7331cf documentation: Added examples.
- Renamed DefaultEncodeByteOrder to EncodeDefaultByteOrder.
2018-05-01 10:57:55 -04:00
Dustin Oprea 2fca65a8ea ifd_builder_encoder: Added method to package full EXIF.
- Moved the EXIF-parsing being done in the tests to reusable code.
2018-05-01 03:29:42 -04:00
Dustin Oprea 9c721a573d ifd_builder_encode: Added test for recursive IB encoder.
- Constructs full structured EXIF on-disk structure.
- Bugfix: EncodeToBytes() started from an incorrect, initial offset.
2018-05-01 03:07:33 -04:00
Dustin Oprea 3a20f12306 encodeAndAttachIfd: Corrected IFD chain allocation arithmetic. 2018-04-30 03:30:34 -04:00
Dustin Oprea c83ebaf2a7 ifd_builder_encode: Added test to build and parse an EXIF.
- A big milestone. This is the same parsing that already works with
  EXIFs from production JPEGs.
2018-04-30 02:34:24 -04:00
Dustin Oprea 18d527eb72 ifd_builder_encode: Added tests for child-IFD encoding and allocation.
- ifd_enumerate: Added utility functions to parse individual, encoded
  IFDs and tags.
- ifd_builder: Corrected `NewBuilderTagFromConfig()` to automatically
  encode whichever type of value-argument it gets.
2018-04-28 19:22:13 -04:00
Dustin Oprea d06a3c8963 ifd_builder: Implemented NewBuilderTagFromConfig() BT factory for testing.
- Updated IfdByteEncoder tests to use it instead of hacking-together
  their own BT's (makes for more standardized, consistent testing).

- Universally refactored all core IFD knowledge implemented upon a
  single IFD name to instead work with IfdIdentity instances, instead,
  in order to validate that we only recognize the IFDs only in the
  context of the correct parents in the hierarchy.

- Implemented standard testing byte-order (assigned to
  TestDefaultByteOrder).
2018-04-27 03:42:59 -04:00
Dustin Oprea cabbc2fca1 ifd_builder: Added tests for ancillary builder logic. 2018-04-25 04:32:58 -04:00
Dustin Oprea 04631a36c3 ifd_builder: Wrote encoding and allocation logic.
- All of the major design considerations have been covered (unless we
  overlooked something).

- Completely untested.
2018-04-24 05:12:30 -04:00