Enhanced lens info and filter possibilities for Nikon shooters when using manual lenses, Issue 2113

This commit is contained in:
Ingo
2013-12-10 20:54:44 +01:00
parent 57a40295be
commit 5c631343fd
2 changed files with 86 additions and 34 deletions

View File

@@ -232,6 +232,18 @@ void ImageData::extractInfo () {
lens = ldata.substr (pos + 7);
if (lens.compare (0, 7, "Unknown"))
lensOk = true;
else {
int pos = lens.find("$FL$"); // is there a placeholder for focallength?
if(pos != Glib::ustring::npos) { // then fill in focallength
lens = lens.replace(pos,4,exif->getTag ("FocalLength")->valueToString ());
if(mnote->getTag ("LensType")) {
std::string ltype = mnote->getTag ("LensType")->valueToString ();
if(ltype.find("MF = Yes")!=Glib::ustring::npos) // check, whether it's a MF lens, should be always
lens = lens.replace(0,7,"MF");
lensOk = true;
}
}
}
}
}
if (!lensOk && mnote->getTag ("Lens")) {
@@ -255,6 +267,14 @@ void ImageData::extractInfo () {
else
str << "Unknown " << n[0] << "-" << n[1] << "mm F/" << n[2] << "-" << n[3];
lens = str.str();
// Look whether it's MF or AF
if(mnote->getTag ("LensType")) {
std::string ltype = mnote->getTag ("LensType")->valueToString ();
if(ltype.find("MF = Yes")!=Glib::ustring::npos) // check, whether it's a MF lens
lens = lens.replace(0,7,"MF"); // replace 'Unknwon' with 'MF'
else
lens = lens.replace(0,7,"AF"); // replace 'Unknwon' with 'AF'
}
}
}
else if (mnote && !make.compare (0, 5, "Canon")) {

View File

@@ -770,22 +770,50 @@ class NALensDataInterpreter : public Interpreter {
buffer[i] ^= (cj += ci * ck++);
}
std::string EffectiveMaxApertureString = "";
if (!d100) {
int EffectiveMaxApertureValue;
if( ver<204 ){
ld << "ExitPupilPosition = " << (int) buffer[0] << std::endl;
ld << "AFAperture = " << (int) buffer[1] << std::endl;
ld << "FocusPosition = " << (int) buffer[4] << std::endl;
ld << "FocusDistance = " << (int) buffer[5] << std::endl;
ld << "FocalLength = " << (int) buffer[6] << std::endl;
ld << "EffectiveMaxAperture = " << (int) buffer[14] << std::endl;
EffectiveMaxApertureValue = (int) buffer[14];
}else{
ld << "ExitPupilPosition = " << (int) buffer[0] << std::endl;
ld << "AFAperture = " << (int) buffer[1] << std::endl;
ld << "FocusPosition = " << (int) buffer[4] << std::endl;
ld << "FocusDistance = " << (int) buffer[6] << std::endl;
ld << "FocalLength = " << (int) buffer[7] << std::endl;
ld << "EffectiveMaxAperture = " << (int) buffer[15] << std::endl;
EffectiveMaxApertureValue = (int) buffer[15];
}
switch (EffectiveMaxApertureValue) {
case 0x8: EffectiveMaxApertureString = "1.2";break;
case 0xc: EffectiveMaxApertureString = "1.4";break;
case 0x14: EffectiveMaxApertureString = "1.8";break;
case 0x18: EffectiveMaxApertureString = "2.0";break;
case 0x20: EffectiveMaxApertureString = "2.5";break;
case 0x24: EffectiveMaxApertureString = "2.8";break;
case 0x2a: EffectiveMaxApertureString = "3.3";break;
case 0x2c: EffectiveMaxApertureString = "3.5";break;
case 0x30: EffectiveMaxApertureString = "4.0";break;
case 0x34: EffectiveMaxApertureString = "4.5";break;
case 0x38: EffectiveMaxApertureString = "5.0";break;
case 0x3c: EffectiveMaxApertureString = "5.6";break;
case 0x40: EffectiveMaxApertureString = "6.3";break;
case 0x44: EffectiveMaxApertureString = "7.1";break;
case 0x48: EffectiveMaxApertureString = "8.0";break;
case 0x4e: EffectiveMaxApertureString = "9.5";break;
case 0x54: EffectiveMaxApertureString = "11.0";break;
case 0x5a: EffectiveMaxApertureString = "13.0";break;
case 0x5e: EffectiveMaxApertureString = "15.0";break;
case 0x60: EffectiveMaxApertureString = "16.0";break;
case 0x66: EffectiveMaxApertureString = "19.0";break;
case 0x6c: EffectiveMaxApertureString = "22.0";break;
default : EffectiveMaxApertureString = "";
}
ld << "EffectiveMaxAperture = " << EffectiveMaxApertureString << std::endl;
}
for (int i=0; i<7; i++)
@@ -793,8 +821,12 @@ class NALensDataInterpreter : public Interpreter {
lid << std::setw(2) << std::setfill('0') << lenstype;
std::map<std::string,std::string>::iterator r = lenses.find (lid.str());
if (r!=lenses.end())
if (r!=lenses.end()){
if(r==lenses.begin() && EffectiveMaxApertureString != "") // first entry is for unchipped lenses
ld << "Lens = Unknown $FL$mm f/" << EffectiveMaxApertureString;
else
ld << "Lens = " << r->second;
}
else
ld << "Lens = Unknown, ID=" << lid.str();