Add missing detail to canonCsEasyMode in canonmn.cpp
0 = Full auto
1 = Manual
2 = Landscape
3 = Fast shutter
4 = Slow shutter
5 = Night
6 = Gray Scale
7 = Sepia
8 = Portrait
9 = Sports
10 = Macro
11 = Black & White
12 = Pan focus
13 = Vivid
14 = Neutral
15 = Flash Off
16 = Long Shutter
17 = Super Macro
18 = Foliage
19 = Indoor
20 = Fireworks
21 = Beach
22 = Underwater
23 = Snow 24 = Kids & Pets
25 = Night Snapshot
26 = Digital Macro
27 = My Colors
28 = Movie Snap
29 = Super Macro 2
30 = Color Accent
31 = Color Swap
32 = Aquarium
33 = ISO 3200
34 = ISO 6400
35 = Creative Light Effect
36 = Easy
37 = Quick Shot
38 = Creative Auto
39 = Zoom Blur
40 = Low Light
41 = Nostalgic
42 = Super Vivid
43 = Poster Effect
44 = Face Self-timer
45 = Smile
46 = Wink Self-timer
47 = Fisheye Effect 48 = Miniature Effect
49 = High-speed Burst
50 = Best Image Selection
51 = High Dynamic Range
52 = Handheld Night Scene
53 = Movie Digest
54 = Live View Control
55 = Discreet
56 = Blur Reduction
57 = Monochrome
58 = Toy Camera Effect
59 = Scene Intelligent Auto
60 = High-speed Burst HQ
61 = Smooth Skin
62 = Soft Focus
257 = Spotlight
258 = Night 2
259 = Night+
260 = Super Night
261 = Sunset
263 = Night Scene
264 = Surface
265 = Low Light 2
This is mainly a fix for #1206, but also interprets missing Canon Exif
Tags in exiv2 with the help of Phil Harvey's exiftool (see
Even with these changes (toward #1204 and #1205), exiv2 lags behind
exiftool in some areas of interpretation of Canon tags. Ideally, a
catch-up effort to bring the code in source: canonmn.cpp in line with
lib/Image/ExifTool/Canon.pm. v10.25 of exiftool was used as reference
for this change.
#1206 seeks to address the fact that when Canon does not have data for
certain tags, they use specific default values in those fields. These
default values need to be ignored and not displayed. This change
brings this feature to exiv2, something that already exiftool does.
With regards to implementation, the struct TagInfo in source: tags.hpp
is extended with four new fields.
The first field is a bool that if set to true (default false), denotes
that this field has ignorable default values.
The second field is the default value that needs to be ignored. This
can be of four types (String, Long, Float, Rational). These four types
were chosen as they had conversion functions in the Value class.
The third field is the comparison type (default equal_to). There are
six comparison types possible (equal_to, not_equal_to, less,
less_equal, greater, greater_equal). This is the comparison applied to
the value stored in the tag's field and the default value specified
above. For e.g. if the value in the tag Exif.CanonCs.RecordMode is -1,
then it needs to be ignored.
The fourth field is the data type (default Long). This could have been
guessed from the type of the second field, but that would necessitate
making this structure into a template calling for changes in multitude
Usage: In source: canonmn.cpp, several exif tags now have ignorable
default properties. I will list a few examples.
1. Exif.CanonCs.FocusMode: TagInfo(0x0007, "FocusMode", N_("Focus Mode"), N_("Focus mode setting"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsFocusMode)),
There are no changes - i.e. this is an example of how the TagInfo
structure was being populated.
2. Exif.CanonCs.RecordMode: TagInfo(0x0009, "RecordMode", N_("Record Mode"), N_("Record mode setting"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsRecordMode), true, s_1_),
Take a look at the two new arguments. The first one (true) specifies
that there is a default value that can be ignored. The second one s_1_
specifies the value (-1, in this case) to be ignored.
const UShortValue CanonMakerNote::s_1_(65535, unsignedShort); // Till bug is resolved
Note s_1_ is temporarily having the value 65535 till #1203 that causes
signedShorts to be interpreted as unsignedShorts is resolved.
3. Exif.CanonSi.TargetAperture: TagInfo(0x0004, "TargetAperture", N_("Target Aperture"), N_("Target Aperture"), canonSiId, makerTags, unsignedShort, 1, printSi0x0015, true, us0_, TagInfo::less_equal),
Note the third argument TagInfo::less_equal. This combined with the
second argument us0_ (the number 0) signifies that any values in this
tag that are less than or equal (<=) to 0 should be ignored.
4. TagInfo(0x0028, "ImageUniqueID", N_("Image Unique ID"), N_("Image Unique ID"), canonId, makerTags, asciiString, -1, printValue, true, s0x16_, TagInfo::equal_to, TagInfo::String),
The previous examples have all been of Long type. This shows a case
where the default value is a string.
const AsciiValue CanonMakerNote::s0x16_("0000000000000000");
Once these tag values have been defined, the actual mechanics of
ignoring these default values happens in Image::exifData().
Before the exifData is returned, we loop through the data, ask the
data whether it needs to be ignored (which in turn checks its
underlying tagInfo and compares it with the default value, if
specified) and if so, deletes that element.
A compile-time switch called EXV_DONT_IGNORE_UNDEFINED which when set
to a non-zero value will cause the behavior to revert back to the
original where all values are reported irregardless of the fact that
they need to be ignored.
Updated by Robin Mills over 5 years ago
- Assignee changed from Robin Mills to Sridhar Boovaraghavan
- Estimated time changed from 2.00 h to 6.00 h
This is your chance for Fame and Fortune (not). Have a look at #1202. This is a little more complicated because you'll have to provide a handler for the new data structure you provide for these settings. And you should add something to the test suite for this. I'll update the test suite for #1202 and you'll can see what I did.
Good Luck. I'll help whenever you ask. If you want to talk 1-to-1 on Skype/Hangout/FaceTime let me know. When I have 1-to-1s with Team Members, it's usually Saturday afternoon in England.