Search code examples
fileimage-processingfile-formatexif

Decoding an mpf exif block in an MPO stereo image file


I am writing something to get at the information contained in an MPO multi-picture file produced by cameras such as the fuji 3D cameras.

I have the proposed spec, which is obviously written to confuse, and is available from here: CIPA multi picture spec PDF and have navigated the normal exif parts and extracted the MFP information.

Section 5.2.3 which describes the header lists The header lists:

4 byte endian flag
4 byte offset
-- start of MP Index --
2 byte count
12 byte version
12 byte number of images
12 byte MP entry
12 byte Individual unique ID list
12 byte total number of capture frames
4 byte offset to next IFD.

The diagram shows the MP Entry and Unique ID list pointing to a offset (which would make 12 bytes). However, in the description that follows it shows that the MP entry should be 16 bytes for every image (which in my sample image with two images, it is), and the individual unique ID being 33 bytes for every image (my sample doesn't have this).

Up to the number of images, everything is as it should be. I have 2 images, the version is correct, and there appear to be 3 blocks (count). However, the third block (which is the MP Entry) has the right code, the correct number of bytes and the correct type, but contains the following information

32 00 00 00  52 00 00 00  02 00 02 20  40 63  1B 00 
00 00 00 00  00 00 00 00  02 00 02 00  EE 6F  1B 00 

The text says the contents of this should be

offset   length   name
0x00     4        Individual Image attribute
0x04     4        individual Image Size
0x08     4        Individual image offset
0x10     2        dependant image 1 entry number
0x12     2        dependant image 2 entry number

Clearly that makes no sense that if there are two images (they are effectively 10MP jpegs) that they have a size of 52 bytes and 0.

Could anyone take a look at this and check I am not going mad in my interpretation of it, or does anyone know what should be here?

Sorry, I know it is a bit complicated but I really cannot see where this is going wrong.


Solution

  • I believe the base address is 8 bytes into the APP2 header, just after the "MPF\0" and right before "II*\0", assuming little endian. In the hex dump you've provided there's no MPO tag included but I guess "32 00 00 00" points to the offset of the MPEntries and "52 00 00 00" is the offset to the next IFD. What you want to be looking at is "02 00 02 20" which probably is the attribute of the first image.

    Remember if the offset is "00 00 00 00", it's not relative but absolute.