Main Menu

Help decoding CanonCustom2

Started by mvadu, December 20, 2010, 09:17:04 PM

Previous topic - Next topic

mvadu

I need your help yet again :o. I am trying to migrate your Image::ExifTool::CanonCustom::Functions2 to my program in VC++.
One of my image the Functions2 data structure (taken with -U -v3 option, ByteOrder:Intel) looks like below:
  | | | 20) CustomFunctions2 (SubDirectory) -->
  | | |     - Tag 0x0099 (212 bytes, int32u[53]):
  | | |         12ac: d4 00 00 00 04 00 00 00 01 00 00 00 2c 00 00 00 [............,...]
  | | |         12bc: 03 00 00 00 01 01 00 00 01 00 00 00 00 00 00 00 [................]
  | | |         12cc: 03 01 00 00 01 00 00 00 00 00 00 00 0f 01 00 00 [................]
  | | |         12dc: 01 00 00 00 00 00 00 00 02 00 00 00 38 00 00 00 [............8...]
  | | |         12ec: 04 00 00 00 01 02 00 00 01 00 00 00 00 00 00 00 [................]
  | | |         [snip 132 bytes]
  | | | + [CanonCustom2 directory with 4 entries]
  | | | + [CanonCustom2 group 1 directory with 3 entries]
  | | | | 0)  ExposureLevelIncrements = 0
  | | | |     - Tag 0x0101 (4 bytes, int32u[1])
  | | | | 1)  ISOExpansion = 0
  | | | |     - Tag 0x0103 (4 bytes, int32u[1])
  | | | | 2)  FlashSyncSpeedAv = 0
  | | | |     - Tag 0x010f (4 bytes, int32u[1])
  | | | + [CanonCustom2 group 2 directory with 4 entries]
  | | | | 0)  LongExposureNoiseReduction = 0
  | | | |     - Tag 0x0201 (4 bytes, int32u[1])
  | | | | 1)  HighISONoiseReduction = 3
  | | | |     - Tag 0x0202 (4 bytes, int32u[1])
  | | | | 2)  HighlightTonePriority = 0
  | | | |     - Tag 0x0203 (4 bytes, int32u[1])
  | | | | 3)  AutoLightingOptimizer = 3
  | | | |     - Tag 0x0204 (4 bytes, int32u[1])
  | | | + [CanonCustom2 group 3 directory with 2 entries]
  | | | | 0)  AFAssistBeam = 0
  | | | |     - Tag 0x050e (4 bytes, int32u[1])
  | | | | 1)  MirrorLockup = 0
  | | | |     - Tag 0x060f (4 bytes, int32u[1])
  | | | + [CanonCustom2 group 4 directory with 4 entries]
  | | | | 0)  Shutter-AELock = 0
  | | | |     - Tag 0x0701 (4 bytes, int32u[1])
  | | | | 1)  SetButtonWhenShooting = 0
  | | | |     - Tag 0x0704 (4 bytes, int32u[1])
  | | | | 2)  LCDDisplayAtPowerOn = 1
  | | | |     - Tag 0x0811 (4 bytes, int32u[1])
  | | | | 3)  AddOriginalDecisionData = 1
  | | | |     - Tag 0x080f (4 bytes, int32u[1])


I don't see any tags like 0x0101 or values like 0x00000003. Can you please shed some light on the encoding structure followed for Canon Customs2 tag? as always I can never thank you enough!

Phil Harvey

I'm heading off to bed now so I just have time for a quick response to point you in the right direction:

  | | |         12ac: d4 00 00 00 04 00 00 00 01 00 00 00 2c 00 00 00 [............,...]
  | | |         12bc: 03 00 00 00 01 01 00 00 01 00 00 00 00 00 00 00 [................]
                                  ^^^^^ - tag 0x0101
  | | |         12cc: 03 01 00 00 01 00 00 00 00 00 00 00 0f 01 00 00 [................]
                      ^^^^^ - tag 0x0103
  | | |         12dc: 01 00 00 00 00 00 00 00 02 00 00 00 38 00 00 00 [............8...]
  | | |         12ec: 04 00 00 00 01 02 00 00 01 00 00 00 00 00 00 00 [................]


You can see the tag ID's in the binary data.  See CanonCustom.pm for details on how this data is decoded.  This is a specialized data structure used only by newer Canon cameras to store the custom functions.

- 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 ($).

mvadu

thank you Phil, you just opened my eyes!! I missed ProcessCanonCustom2 function in CanonCustom.pm. Now I know how to port that function and decode the tag. Thanks again "Guru"(one who is regarded as having great knowledge, wisdom and authority in a certain area, and who uses it to guide others)