-
Notifications
You must be signed in to change notification settings - Fork 280
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
fix646_NikonAF22 #900
fix646_NikonAF22 #900
Conversation
Codecov Report
@@ Coverage Diff @@
## 0.27-maintenance #900 +/- ##
====================================================
+ Coverage 62.86% 62.88% +0.01%
====================================================
Files 156 156
Lines 21598 21606 +8
====================================================
+ Hits 13578 13586 +8
Misses 8020 8020
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution!
Although I could not invest much time following the previous discussions, most of the changes look good to me. I just made a bunch of minor comments and questions.
b09c1f4
to
cc4f765
Compare
@D4N do you want to take a look to the PR before we merge it ? |
Thanks for dealing with this, @piponazo . I've been working very hard yesterday and today on 582 (Andreas Sneider's request to support Sony FocusPosition), then I want to get Exiv2 0.27.2 RC1 done and released by Thursday before going to Normandy on Friday to run in the D-Day Half Marathon this weekend. I'd like to discuss 882 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks good to me. I've added just a few comments
@@ -106,7 +106,8 @@ namespace Exiv2 { | |||
{ nikonWtId, "Makernote", "NikonWt", Nikon3MakerNote::tagListWt }, | |||
{ nikonIiId, "Makernote", "NikonIi", Nikon3MakerNote::tagListIi }, | |||
{ nikonAfId, "Makernote", "NikonAf", Nikon3MakerNote::tagListAf }, | |||
{ nikonAf2Id, "Makernote", "NikonAf2", Nikon3MakerNote::tagListAf2 }, | |||
{ nikonAf21Id, "Makernote", "NikonAf2", Nikon3MakerNote::tagListAf21 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Suggestion] For consistency I'd suggest to call list & enumeration element *Af2
instead of *Af21
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right about this. We have two things which are very similar nikonAf2ID
(AutoFocus version 1.00) and nikonAf22Id
(AutoFocus version 1.01).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dan: As always you are very sharp eyed. When I developed the code, I changed nikonAf2Id to nikonAf21Id and cut'n'pasted/morphed nikonAf21Id into nikonAf22Id. Later I discovered this broke the test suite, because there's a test that uses Exif.NikonAf2.something
. I hacked that table to pass the test suite. I've restored nikonAf2Id.
It's really hard to understand the tiff parsing code. It's very abstract. I've been trying for 2 days to fix #582 and haven't got it work yet. I'll defer #582 until v0.27.3.
ac98ab5
to
db3a260
Compare
As the originator of the request for and a beneficiary of this functionality, I want to offer my (long overdue) and effusive thanks to @clanmills and collaborators on developing and merging this PR. I'm working to test support on my end, building 0.27.2-RC2, but having some problems with the build. I'll open an issue if I can't resolve them myself. |
First of all, I was able to build successfully by updating my version of Cmake from 3.13.2 to 3.14.5. Seems like such a minor update, but it worked. Second, I've verified that the Many thanks again! |
There is a long discussion in #646 about this issue and my investigation into the how the makernotes are decoded. I will summarise here. Fix #646
History
The tag for Nikon's AutoFocus data is 0x00b7
Nikon encode their version of tag in the first 4 bytes. There was a 40 byte version of AutoFocus which decodes as Exif.NikonAf2.XXX. This new version (1.01) is 84 bytes in length and decoded as Exif.NikonAf22.XXX.
The two versions (NikonAF2 and NikonAF22) are now encoded as a set with the selector in tiffimage_int.cpp
The binary layout of the record is defined in tiff image_int.cpp. For example, AF22 is:
The two versions of the data are encoded in tiffimage_int.cpp
Binary Selector
The code to determine which version is decoded is in tiffimage_int.cpp
When the tiffvisitor encounters 0x00b7, he calls nikonAf2Selector() to return the index of the binary array to be used. By default it returns 0 (the existing
nikonAf21Id
). If the tag length is 84, he returns 1 fornikonAf21Id
The decoder
This function understands how to decode byte-by-byte from
const ArrayDef
into the Exiv2 tag/values such as Exif.NikonAF22.AFAreaYPosition which it stores in the ExifData vector.This is ingenious magic. I'll revisit/edit this explanation in the next few days when I have more time to explain this with more clarity.
Test files
_DSC8437.exv and test_issue_646.py Boiler plate. The .exv was extracted from a sample test files on Nikon's web site (location in #636)