Use std::unordered_map for TiffTreeStruct lookup.

This commit is contained in:
Kevin Backhouse 2022-08-03 17:42:21 -04:00 committed by Rosen Penev
parent be1c00c916
commit 67270c2b11
2 changed files with 150 additions and 153 deletions

View File

@ -1215,143 +1215,142 @@ constexpr ArrayDef samsungPwDef[] = {
With this table, it is possible, for a given group (and tag) to find a
path, i.e., a list of groups and tags, from the root to that group (tag).
*/
const TiffTreeStruct TiffCreator::tiffTreeStruct_[] = {
const TiffTreeTable TiffCreator::tiffTreeTable_ = {
// root group parent group parent tag
//--------- ----------------- ----------------- ----------
{Tag::root, IfdId::ifdIdNotSet, IfdId::ifdIdNotSet, Tag::root},
{Tag::root, IfdId::ifd0Id, IfdId::ifdIdNotSet, Tag::root},
{Tag::root, IfdId::subImage1Id, IfdId::ifd0Id, 0x014a},
{Tag::root, IfdId::subImage2Id, IfdId::ifd0Id, 0x014a},
{Tag::root, IfdId::subImage3Id, IfdId::ifd0Id, 0x014a},
{Tag::root, IfdId::subImage4Id, IfdId::ifd0Id, 0x014a},
{Tag::root, IfdId::subImage5Id, IfdId::ifd0Id, 0x014a},
{Tag::root, IfdId::subImage6Id, IfdId::ifd0Id, 0x014a},
{Tag::root, IfdId::subImage7Id, IfdId::ifd0Id, 0x014a},
{Tag::root, IfdId::subImage8Id, IfdId::ifd0Id, 0x014a},
{Tag::root, IfdId::subImage9Id, IfdId::ifd0Id, 0x014a},
{Tag::root, IfdId::exifId, IfdId::ifd0Id, 0x8769},
{Tag::root, IfdId::gpsId, IfdId::ifd0Id, 0x8825},
{Tag::root, IfdId::iopId, IfdId::exifId, 0xa005},
{Tag::root, IfdId::ifd1Id, IfdId::ifd0Id, Tag::next},
{Tag::root, IfdId::ifd2Id, IfdId::ifd1Id, Tag::next},
{Tag::root, IfdId::ifd3Id, IfdId::ifd2Id, Tag::next},
{Tag::root, IfdId::olympusId, IfdId::exifId, 0x927c},
{Tag::root, IfdId::olympus2Id, IfdId::exifId, 0x927c},
{Tag::root, IfdId::subThumb1Id, IfdId::ifd1Id, 0x014a},
{Tag::root, IfdId::olympusEqId, IfdId::olympus2Id, 0x2010},
{Tag::root, IfdId::olympusCsId, IfdId::olympus2Id, 0x2020},
{Tag::root, IfdId::olympusRdId, IfdId::olympus2Id, 0x2030},
{Tag::root, IfdId::olympusRd2Id, IfdId::olympus2Id, 0x2031},
{Tag::root, IfdId::olympusIpId, IfdId::olympus2Id, 0x2040},
{Tag::root, IfdId::olympusFiId, IfdId::olympus2Id, 0x2050},
{Tag::root, IfdId::olympusFe1Id, IfdId::olympus2Id, 0x2100},
{Tag::root, IfdId::olympusFe2Id, IfdId::olympus2Id, 0x2200},
{Tag::root, IfdId::olympusFe3Id, IfdId::olympus2Id, 0x2300},
{Tag::root, IfdId::olympusFe4Id, IfdId::olympus2Id, 0x2400},
{Tag::root, IfdId::olympusFe5Id, IfdId::olympus2Id, 0x2500},
{Tag::root, IfdId::olympusFe6Id, IfdId::olympus2Id, 0x2600},
{Tag::root, IfdId::olympusFe7Id, IfdId::olympus2Id, 0x2700},
{Tag::root, IfdId::olympusFe8Id, IfdId::olympus2Id, 0x2800},
{Tag::root, IfdId::olympusFe9Id, IfdId::olympus2Id, 0x2900},
{Tag::root, IfdId::olympusRiId, IfdId::olympus2Id, 0x3000},
{Tag::root, IfdId::fujiId, IfdId::exifId, 0x927c},
{Tag::root, IfdId::canonId, IfdId::exifId, 0x927c},
{Tag::root, IfdId::canonCsId, IfdId::canonId, 0x0001},
{Tag::root, IfdId::canonSiId, IfdId::canonId, 0x0004},
{Tag::root, IfdId::canonPaId, IfdId::canonId, 0x0005},
{Tag::root, IfdId::canonCfId, IfdId::canonId, 0x000f},
{Tag::root, IfdId::canonPiId, IfdId::canonId, 0x0012},
{Tag::root, IfdId::canonTiId, IfdId::canonId, 0x0035},
{Tag::root, IfdId::canonFiId, IfdId::canonId, 0x0093},
{Tag::root, IfdId::canonPrId, IfdId::canonId, 0x00a0},
{Tag::root, IfdId::canonAfMiAdjId, IfdId::canonId, 0x4013},
{Tag::root, IfdId::canonVigCor2Id, IfdId::canonId, 0x4016},
{Tag::root, IfdId::canonLiOpId, IfdId::canonId, 0x4018},
{Tag::root, IfdId::canonLeId, IfdId::canonId, 0x4019},
{Tag::root, IfdId::canonAmId, IfdId::canonId, 0x4020},
{Tag::root, IfdId::canonMeId, IfdId::canonId, 0x4021},
{Tag::root, IfdId::canonFilId, IfdId::canonId, 0x4024},
{Tag::root, IfdId::canonHdrId, IfdId::canonId, 0x4025},
{Tag::root, IfdId::canonAfCId, IfdId::canonId, 0x4028},
{Tag::root, IfdId::canonRawBId, IfdId::canonId, 0x403f},
{Tag::root, IfdId::nikon1Id, IfdId::exifId, 0x927c},
{Tag::root, IfdId::nikon2Id, IfdId::exifId, 0x927c},
{Tag::root, IfdId::nikon3Id, IfdId::exifId, 0x927c},
{Tag::root, IfdId::nikonPvId, IfdId::nikon3Id, 0x0011},
{Tag::root, IfdId::nikonVrId, IfdId::nikon3Id, 0x001f},
{Tag::root, IfdId::nikonPcId, IfdId::nikon3Id, 0x0023},
{Tag::root, IfdId::nikonWtId, IfdId::nikon3Id, 0x0024},
{Tag::root, IfdId::nikonIiId, IfdId::nikon3Id, 0x0025},
{Tag::root, IfdId::nikonAfId, IfdId::nikon3Id, 0x0088},
{Tag::root, IfdId::nikonSi1Id, IfdId::nikon3Id, 0x0091},
{Tag::root, IfdId::nikonSi2Id, IfdId::nikon3Id, 0x0091},
{Tag::root, IfdId::nikonSi3Id, IfdId::nikon3Id, 0x0091},
{Tag::root, IfdId::nikonSi4Id, IfdId::nikon3Id, 0x0091},
{Tag::root, IfdId::nikonSi5Id, IfdId::nikon3Id, 0x0091},
{Tag::root, IfdId::nikonSi6Id, IfdId::nikon3Id, 0x0091},
{Tag::root, IfdId::nikonCb1Id, IfdId::nikon3Id, 0x0097},
{Tag::root, IfdId::nikonCb2Id, IfdId::nikon3Id, 0x0097},
{Tag::root, IfdId::nikonCb2aId, IfdId::nikon3Id, 0x0097},
{Tag::root, IfdId::nikonCb2bId, IfdId::nikon3Id, 0x0097},
{Tag::root, IfdId::nikonCb3Id, IfdId::nikon3Id, 0x0097},
{Tag::root, IfdId::nikonCb4Id, IfdId::nikon3Id, 0x0097},
{Tag::root, IfdId::nikonLd1Id, IfdId::nikon3Id, 0x0098},
{Tag::root, IfdId::nikonLd2Id, IfdId::nikon3Id, 0x0098},
{Tag::root, IfdId::nikonLd3Id, IfdId::nikon3Id, 0x0098},
{Tag::root, IfdId::nikonLd4Id, IfdId::nikon3Id, 0x0098},
{Tag::root, IfdId::nikonMeId, IfdId::nikon3Id, 0x00b0},
{Tag::root, IfdId::nikonAf21Id, IfdId::nikon3Id, 0x00b7},
{Tag::root, IfdId::nikonAf22Id, IfdId::nikon3Id, 0x00b7},
{Tag::root, IfdId::nikonFiId, IfdId::nikon3Id, 0x00b8},
{Tag::root, IfdId::nikonAFTId, IfdId::nikon3Id, 0x00b9},
{Tag::root, IfdId::nikonFl1Id, IfdId::nikon3Id, 0x00a8},
{Tag::root, IfdId::nikonFl2Id, IfdId::nikon3Id, 0x00a8},
{Tag::root, IfdId::nikonFl3Id, IfdId::nikon3Id, 0x00a8},
{Tag::root, IfdId::nikonFl7Id, IfdId::nikon3Id, 0x00a8},
{Tag::root, IfdId::panasonicId, IfdId::exifId, 0x927c},
{Tag::root, IfdId::pentaxId, IfdId::exifId, 0x927c},
{Tag::root, IfdId::pentaxDngId, IfdId::ifd0Id, 0xc634},
{Tag::root, IfdId::samsung2Id, IfdId::exifId, 0x927c},
{Tag::root, IfdId::samsungPwId, IfdId::samsung2Id, 0x0021},
{Tag::root, IfdId::samsungPvId, IfdId::samsung2Id, 0x0035},
{Tag::root, IfdId::sigmaId, IfdId::exifId, 0x927c},
{Tag::root, IfdId::sony1Id, IfdId::exifId, 0x927c},
{Tag::root, IfdId::sony2010eId, IfdId::sony1Id, 0x2010},
{Tag::root, IfdId::sony2FpId, IfdId::sony1Id, 0x9402},
{Tag::root, IfdId::sonyMisc1Id, IfdId::sony1Id, 0x9403},
{Tag::root, IfdId::sonyMisc2bId, IfdId::sony1Id, 0x9404},
{Tag::root, IfdId::sonyMisc3cId, IfdId::sony1Id, 0x9400},
{Tag::root, IfdId::sonySInfo1Id, IfdId::sony1Id, 0x3000},
{Tag::root, IfdId::sony1CsId, IfdId::sony1Id, 0x0114},
{Tag::root, IfdId::sony1Cs2Id, IfdId::sony1Id, 0x0114},
{Tag::root, IfdId::sonyMltId, IfdId::sony1Id, 0xb028},
{Tag::root, IfdId::sony1MltCsOldId, IfdId::sonyMltId, 0x0001},
{Tag::root, IfdId::sony1MltCsNewId, IfdId::sonyMltId, 0x0003},
{Tag::root, IfdId::sony1MltCs7DId, IfdId::sonyMltId, 0x0004},
{Tag::root, IfdId::sony1MltCsA100Id, IfdId::sonyMltId, 0x0114},
{Tag::root, IfdId::sony2Id, IfdId::exifId, 0x927c},
{Tag::root, IfdId::sony2010eId, IfdId::sony2Id, 0x2010},
{Tag::root, IfdId::sony2FpId, IfdId::sony2Id, 0x9402},
{Tag::root, IfdId::sonyMisc1Id, IfdId::sony2Id, 0x9403},
{Tag::root, IfdId::sonyMisc2bId, IfdId::sony2Id, 0x9404},
{Tag::root, IfdId::sonyMisc3cId, IfdId::sony2Id, 0x9400},
{Tag::root, IfdId::sonySInfo1Id, IfdId::sony2Id, 0x3000},
{Tag::root, IfdId::sony2CsId, IfdId::sony2Id, 0x0114},
{Tag::root, IfdId::sony2Cs2Id, IfdId::sony2Id, 0x0114},
{Tag::root, IfdId::minoltaId, IfdId::exifId, 0x927c},
{Tag::root, IfdId::minoltaCsOldId, IfdId::minoltaId, 0x0001},
{Tag::root, IfdId::minoltaCsNewId, IfdId::minoltaId, 0x0003},
{Tag::root, IfdId::minoltaCs7DId, IfdId::minoltaId, 0x0004},
{Tag::root, IfdId::minoltaCs5DId, IfdId::minoltaId, 0x0114},
{Tag::root, IfdId::casioId, IfdId::exifId, 0x927c},
{Tag::root, IfdId::casio2Id, IfdId::exifId, 0x927c},
{{Tag::root, IfdId::ifdIdNotSet}, {IfdId::ifdIdNotSet, Tag::root}},
{{Tag::root, IfdId::ifd0Id}, {IfdId::ifdIdNotSet, Tag::root}},
{{Tag::root, IfdId::subImage1Id}, {IfdId::ifd0Id, 0x014a}},
{{Tag::root, IfdId::subImage2Id}, {IfdId::ifd0Id, 0x014a}},
{{Tag::root, IfdId::subImage3Id}, {IfdId::ifd0Id, 0x014a}},
{{Tag::root, IfdId::subImage4Id}, {IfdId::ifd0Id, 0x014a}},
{{Tag::root, IfdId::subImage5Id}, {IfdId::ifd0Id, 0x014a}},
{{Tag::root, IfdId::subImage6Id}, {IfdId::ifd0Id, 0x014a}},
{{Tag::root, IfdId::subImage7Id}, {IfdId::ifd0Id, 0x014a}},
{{Tag::root, IfdId::subImage8Id}, {IfdId::ifd0Id, 0x014a}},
{{Tag::root, IfdId::subImage9Id}, {IfdId::ifd0Id, 0x014a}},
{{Tag::root, IfdId::exifId}, {IfdId::ifd0Id, 0x8769}},
{{Tag::root, IfdId::gpsId}, {IfdId::ifd0Id, 0x8825}},
{{Tag::root, IfdId::iopId}, {IfdId::exifId, 0xa005}},
{{Tag::root, IfdId::ifd1Id}, {IfdId::ifd0Id, Tag::next}},
{{Tag::root, IfdId::ifd2Id}, {IfdId::ifd1Id, Tag::next}},
{{Tag::root, IfdId::ifd3Id}, {IfdId::ifd2Id, Tag::next}},
{{Tag::root, IfdId::olympusId}, {IfdId::exifId, 0x927c}},
{{Tag::root, IfdId::olympus2Id}, {IfdId::exifId, 0x927c}},
{{Tag::root, IfdId::subThumb1Id}, {IfdId::ifd1Id, 0x014a}},
{{Tag::root, IfdId::olympusEqId}, {IfdId::olympus2Id, 0x2010}},
{{Tag::root, IfdId::olympusCsId}, {IfdId::olympus2Id, 0x2020}},
{{Tag::root, IfdId::olympusRdId}, {IfdId::olympus2Id, 0x2030}},
{{Tag::root, IfdId::olympusRd2Id}, {IfdId::olympus2Id, 0x2031}},
{{Tag::root, IfdId::olympusIpId}, {IfdId::olympus2Id, 0x2040}},
{{Tag::root, IfdId::olympusFiId}, {IfdId::olympus2Id, 0x2050}},
{{Tag::root, IfdId::olympusFe1Id}, {IfdId::olympus2Id, 0x2100}},
{{Tag::root, IfdId::olympusFe2Id}, {IfdId::olympus2Id, 0x2200}},
{{Tag::root, IfdId::olympusFe3Id}, {IfdId::olympus2Id, 0x2300}},
{{Tag::root, IfdId::olympusFe4Id}, {IfdId::olympus2Id, 0x2400}},
{{Tag::root, IfdId::olympusFe5Id}, {IfdId::olympus2Id, 0x2500}},
{{Tag::root, IfdId::olympusFe6Id}, {IfdId::olympus2Id, 0x2600}},
{{Tag::root, IfdId::olympusFe7Id}, {IfdId::olympus2Id, 0x2700}},
{{Tag::root, IfdId::olympusFe8Id}, {IfdId::olympus2Id, 0x2800}},
{{Tag::root, IfdId::olympusFe9Id}, {IfdId::olympus2Id, 0x2900}},
{{Tag::root, IfdId::olympusRiId}, {IfdId::olympus2Id, 0x3000}},
{{Tag::root, IfdId::fujiId}, {IfdId::exifId, 0x927c}},
{{Tag::root, IfdId::canonId}, {IfdId::exifId, 0x927c}},
{{Tag::root, IfdId::canonCsId}, {IfdId::canonId, 0x0001}},
{{Tag::root, IfdId::canonSiId}, {IfdId::canonId, 0x0004}},
{{Tag::root, IfdId::canonPaId}, {IfdId::canonId, 0x0005}},
{{Tag::root, IfdId::canonCfId}, {IfdId::canonId, 0x000f}},
{{Tag::root, IfdId::canonPiId}, {IfdId::canonId, 0x0012}},
{{Tag::root, IfdId::canonTiId}, {IfdId::canonId, 0x0035}},
{{Tag::root, IfdId::canonFiId}, {IfdId::canonId, 0x0093}},
{{Tag::root, IfdId::canonPrId}, {IfdId::canonId, 0x00a0}},
{{Tag::root, IfdId::canonAfMiAdjId}, {IfdId::canonId, 0x4013}},
{{Tag::root, IfdId::canonVigCor2Id}, {IfdId::canonId, 0x4016}},
{{Tag::root, IfdId::canonLiOpId}, {IfdId::canonId, 0x4018}},
{{Tag::root, IfdId::canonLeId}, {IfdId::canonId, 0x4019}},
{{Tag::root, IfdId::canonAmId}, {IfdId::canonId, 0x4020}},
{{Tag::root, IfdId::canonMeId}, {IfdId::canonId, 0x4021}},
{{Tag::root, IfdId::canonFilId}, {IfdId::canonId, 0x4024}},
{{Tag::root, IfdId::canonHdrId}, {IfdId::canonId, 0x4025}},
{{Tag::root, IfdId::canonAfCId}, {IfdId::canonId, 0x4028}},
{{Tag::root, IfdId::canonRawBId}, {IfdId::canonId, 0x403f}},
{{Tag::root, IfdId::nikon1Id}, {IfdId::exifId, 0x927c}},
{{Tag::root, IfdId::nikon2Id}, {IfdId::exifId, 0x927c}},
{{Tag::root, IfdId::nikon3Id}, {IfdId::exifId, 0x927c}},
{{Tag::root, IfdId::nikonPvId}, {IfdId::nikon3Id, 0x0011}},
{{Tag::root, IfdId::nikonVrId}, {IfdId::nikon3Id, 0x001f}},
{{Tag::root, IfdId::nikonPcId}, {IfdId::nikon3Id, 0x0023}},
{{Tag::root, IfdId::nikonWtId}, {IfdId::nikon3Id, 0x0024}},
{{Tag::root, IfdId::nikonIiId}, {IfdId::nikon3Id, 0x0025}},
{{Tag::root, IfdId::nikonAfId}, {IfdId::nikon3Id, 0x0088}},
{{Tag::root, IfdId::nikonSi1Id}, {IfdId::nikon3Id, 0x0091}},
{{Tag::root, IfdId::nikonSi2Id}, {IfdId::nikon3Id, 0x0091}},
{{Tag::root, IfdId::nikonSi3Id}, {IfdId::nikon3Id, 0x0091}},
{{Tag::root, IfdId::nikonSi4Id}, {IfdId::nikon3Id, 0x0091}},
{{Tag::root, IfdId::nikonSi5Id}, {IfdId::nikon3Id, 0x0091}},
{{Tag::root, IfdId::nikonSi6Id}, {IfdId::nikon3Id, 0x0091}},
{{Tag::root, IfdId::nikonCb1Id}, {IfdId::nikon3Id, 0x0097}},
{{Tag::root, IfdId::nikonCb2Id}, {IfdId::nikon3Id, 0x0097}},
{{Tag::root, IfdId::nikonCb2aId}, {IfdId::nikon3Id, 0x0097}},
{{Tag::root, IfdId::nikonCb2bId}, {IfdId::nikon3Id, 0x0097}},
{{Tag::root, IfdId::nikonCb3Id}, {IfdId::nikon3Id, 0x0097}},
{{Tag::root, IfdId::nikonCb4Id}, {IfdId::nikon3Id, 0x0097}},
{{Tag::root, IfdId::nikonLd1Id}, {IfdId::nikon3Id, 0x0098}},
{{Tag::root, IfdId::nikonLd2Id}, {IfdId::nikon3Id, 0x0098}},
{{Tag::root, IfdId::nikonLd3Id}, {IfdId::nikon3Id, 0x0098}},
{{Tag::root, IfdId::nikonLd4Id}, {IfdId::nikon3Id, 0x0098}},
{{Tag::root, IfdId::nikonMeId}, {IfdId::nikon3Id, 0x00b0}},
{{Tag::root, IfdId::nikonAf21Id}, {IfdId::nikon3Id, 0x00b7}},
{{Tag::root, IfdId::nikonAf22Id}, {IfdId::nikon3Id, 0x00b7}},
{{Tag::root, IfdId::nikonFiId}, {IfdId::nikon3Id, 0x00b8}},
{{Tag::root, IfdId::nikonAFTId}, {IfdId::nikon3Id, 0x00b9}},
{{Tag::root, IfdId::nikonFl1Id}, {IfdId::nikon3Id, 0x00a8}},
{{Tag::root, IfdId::nikonFl2Id}, {IfdId::nikon3Id, 0x00a8}},
{{Tag::root, IfdId::nikonFl3Id}, {IfdId::nikon3Id, 0x00a8}},
{{Tag::root, IfdId::nikonFl7Id}, {IfdId::nikon3Id, 0x00a8}},
{{Tag::root, IfdId::panasonicId}, {IfdId::exifId, 0x927c}},
{{Tag::root, IfdId::pentaxId}, {IfdId::exifId, 0x927c}},
{{Tag::root, IfdId::pentaxDngId}, {IfdId::ifd0Id, 0xc634}},
{{Tag::root, IfdId::samsung2Id}, {IfdId::exifId, 0x927c}},
{{Tag::root, IfdId::samsungPwId}, {IfdId::samsung2Id, 0x0021}},
{{Tag::root, IfdId::samsungPvId}, {IfdId::samsung2Id, 0x0035}},
{{Tag::root, IfdId::sigmaId}, {IfdId::exifId, 0x927c}},
{{Tag::root, IfdId::sony1Id}, {IfdId::exifId, 0x927c}},
{{Tag::root, IfdId::sony2010eId}, {IfdId::sony1Id, 0x2010}},
{{Tag::root, IfdId::sony2FpId}, {IfdId::sony1Id, 0x9402}},
{{Tag::root, IfdId::sonyMisc1Id}, {IfdId::sony1Id, 0x9403}},
{{Tag::root, IfdId::sonyMisc2bId}, {IfdId::sony1Id, 0x9404}},
{{Tag::root, IfdId::sonyMisc3cId}, {IfdId::sony1Id, 0x9400}},
{{Tag::root, IfdId::sonySInfo1Id}, {IfdId::sony1Id, 0x3000}},
{{Tag::root, IfdId::sony1CsId}, {IfdId::sony1Id, 0x0114}},
{{Tag::root, IfdId::sony1Cs2Id}, {IfdId::sony1Id, 0x0114}},
{{Tag::root, IfdId::sonyMltId}, {IfdId::sony1Id, 0xb028}},
{{Tag::root, IfdId::sony1MltCsOldId}, {IfdId::sonyMltId, 0x0001}},
{{Tag::root, IfdId::sony1MltCsNewId}, {IfdId::sonyMltId, 0x0003}},
{{Tag::root, IfdId::sony1MltCs7DId}, {IfdId::sonyMltId, 0x0004}},
{{Tag::root, IfdId::sony1MltCsA100Id}, {IfdId::sonyMltId, 0x0114}},
{{Tag::root, IfdId::sony2Id}, {IfdId::exifId, 0x927c}},
{{Tag::root, IfdId::sony2010eId}, {IfdId::sony2Id, 0x2010}},
{{Tag::root, IfdId::sony2FpId}, {IfdId::sony2Id, 0x9402}},
{{Tag::root, IfdId::sonyMisc1Id}, {IfdId::sony2Id, 0x9403}},
{{Tag::root, IfdId::sonyMisc2bId}, {IfdId::sony2Id, 0x9404}},
{{Tag::root, IfdId::sonyMisc3cId}, {IfdId::sony2Id, 0x9400}},
{{Tag::root, IfdId::sonySInfo1Id}, {IfdId::sony2Id, 0x3000}},
{{Tag::root, IfdId::sony2CsId}, {IfdId::sony2Id, 0x0114}},
{{Tag::root, IfdId::sony2Cs2Id}, {IfdId::sony2Id, 0x0114}},
{{Tag::root, IfdId::minoltaId}, {IfdId::exifId, 0x927c}},
{{Tag::root, IfdId::minoltaCsOldId}, {IfdId::minoltaId, 0x0001}},
{{Tag::root, IfdId::minoltaCsNewId}, {IfdId::minoltaId, 0x0003}},
{{Tag::root, IfdId::minoltaCs7DId}, {IfdId::minoltaId, 0x0004}},
{{Tag::root, IfdId::minoltaCs5DId}, {IfdId::minoltaId, 0x0114}},
{{Tag::root, IfdId::casioId}, {IfdId::exifId, 0x927c}},
{{Tag::root, IfdId::casio2Id}, {IfdId::exifId, 0x927c}},
// ---------------------------------------------------------
// Panasonic RW2 raw images
{Tag::pana, IfdId::ifdIdNotSet, IfdId::ifdIdNotSet, Tag::pana},
{Tag::pana, IfdId::panaRawId, IfdId::ifdIdNotSet, Tag::pana},
{Tag::pana, IfdId::exifId, IfdId::panaRawId, 0x8769},
{Tag::pana, IfdId::gpsId, IfdId::panaRawId, 0x8825},
};
{{Tag::pana, IfdId::ifdIdNotSet}, {IfdId::ifdIdNotSet, Tag::pana}},
{{Tag::pana, IfdId::panaRawId}, {IfdId::ifdIdNotSet, Tag::pana}},
{{Tag::pana, IfdId::exifId}, {IfdId::panaRawId, 0x8769}},
{{Tag::pana, IfdId::gpsId}, {IfdId::panaRawId, 0x8825}}};
/*
This table describes the layout of each known TIFF group (including
@ -1941,10 +1940,6 @@ EncoderFct TiffMapping::findEncoder(const std::string& make, uint32_t extendedTa
return encoderFct;
}
bool TiffTreeStruct::operator==(const TiffTreeStruct::Key& key) const {
return key.first == root_ && key.second == group_;
}
TiffComponent::UniquePtr TiffCreator::create(uint32_t extendedTag, IfdId group) {
auto tag = static_cast<uint16_t>(extendedTag & 0xffff);
auto i = tiffGroupTable_.find(TiffGroupKey(extendedTag, group));
@ -1969,13 +1964,16 @@ TiffComponent::UniquePtr TiffCreator::create(uint32_t extendedTag, IfdId group)
} // TiffCreator::create
void TiffCreator::getPath(TiffPath& tiffPath, uint32_t extendedTag, IfdId group, uint32_t root) {
const TiffTreeStruct* ts = nullptr;
do {
while (true) {
tiffPath.push(TiffPathItem(extendedTag, group));
ts = find(tiffTreeStruct_, TiffTreeStruct::Key(root, group));
extendedTag = ts->parentExtTag_;
group = ts->parentGroup_;
} while (!(ts->root_ == root && ts->group_ == IfdId::ifdIdNotSet));
const auto ts = tiffTreeTable_.find(TiffGroupKey(root, group));
assert(ts != tiffTreeTable_.end());
extendedTag = ts->second.parentExtTag_;
group = ts->second.parentGroup_;
if (ts->first == TiffGroupKey(root, IfdId::ifdIdNotSet)) {
break;
}
}
}
ByteOrder TiffParserWorker::decode(ExifData& exifData, IptcData& iptcData, XmpData& xmpData, const byte* pData,

View File

@ -153,17 +153,16 @@ using TiffGroupTable = std::unordered_map<TiffGroupKey, NewTiffCompFct, TiffGrou
use standard TIFF layout.
*/
struct TiffTreeStruct {
using Key = std::pair<uint32_t, IfdId>;
//! Comparison operator to compare a TiffTreeStruct with a TiffTreeStruct::Key
bool operator==(const Key& key) const;
const IfdId parentGroup_; //!< Parent group
const uint32_t parentExtTag_; //!< Parent tag (32 bit so that it can contain special tags)
// DATA
uint32_t root_; //!< Tree root element, identifies a tree
IfdId group_; //!< Each group is a node in the tree
IfdId parentGroup_; //!< Parent group
uint32_t parentExtTag_; //!< Parent tag (32 bit so that it can contain special tags)
public:
TiffTreeStruct(IfdId parentGroup, uint32_t parentExtTag) : parentGroup_(parentGroup), parentExtTag_(parentExtTag) {
}
};
using TiffTreeTable = std::unordered_map<TiffGroupKey, TiffTreeStruct, TiffGroupKey_hash>;
/*!
@brief TIFF component factory.
*/
@ -184,8 +183,8 @@ class TiffCreator {
static void getPath(TiffPath& tiffPath, uint32_t extendedTag, IfdId group, uint32_t root);
private:
static const TiffTreeStruct tiffTreeStruct_[]; //<! TIFF tree structure
static const TiffGroupTable tiffGroupTable_; //<! TIFF group structure
static const TiffTreeTable tiffTreeTable_; //<! TIFF tree structure
static const TiffGroupTable tiffGroupTable_; //<! TIFF group structure
}; // class TiffCreator