Why does this section of makernotes have an offset base?

Started by mattburns, March 15, 2012, 10:26:48 AM

Previous topic - Next topic

mattburns

Hi,

I have a jpeg file from a Pentax K-x in which the final 30 makernote entries have an offset base of -0x0062. They are highlighted pink in the htmldump I created. The documentation I found calls the pink entries "double-referenced" but I'm unclear what this means.

Basically, I'm trying to work out how the 0x0062 value was calculated so that I can do something similar in my crazy javascript.

I've read through the comments of Image/ExifTool/MakerNotes.fixBase() and have gleaned a little understanding, but not a great deal. Is it simply saying that the first makernotes IFD pointer should point to a value immediately after the last IFD pointer and if it doesn't, use the difference as the offset base?

Many thanks in advance,
Matt

Phil Harvey

Hi Matt,

Quote from: mattburns on March 15, 2012, 10:26:48 AM
Is it simply saying that the first makernotes IFD pointer should point to a value immediately after the last IFD pointer and if it doesn't, use the difference as the offset base?

Basically, yes, this is the idea.  For a well-behaved IFD, one expects the value with the lowest offset to correspond to the first byte after the "next IFD" pointer.  But there are of course many exceptions, so the logic is trickier than this.  If you are really into punishment, you could take a look the FixBase() routine in lib/Image/ExifTool/MakerNotes.pm.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).