PixelShift detection for PEF files was broken (see #4008)
This commit is contained in:
parent
8cef3c5e2f
commit
17c7ec684d
@ -23,6 +23,8 @@
|
||||
#include "imagedata.h"
|
||||
#include "iptcpairs.h"
|
||||
|
||||
#define PRINT_HDR_PS_DETECTION 0
|
||||
|
||||
using namespace rtengine;
|
||||
|
||||
extern "C" IptcData *iptc_data_new_from_jpeg_file (FILE* infile);
|
||||
@ -477,6 +479,9 @@ void FrameData::extractInfo ()
|
||||
if (hdr) {
|
||||
if (hdr->toInt() > 0 && hdr->toInt(2) > 0) {
|
||||
isHDR = true;
|
||||
#if PRINT_HDR_PS_DETECTION
|
||||
printf("HDR detected ! -> \"HDR\" tag found\n");
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
rtexif::Tag* dm = mnote->findTag("DriveMode");
|
||||
@ -486,6 +491,9 @@ void FrameData::extractInfo ()
|
||||
buffer[3] = 0;
|
||||
if (!strcmp(buffer, "HDR")) {
|
||||
isHDR = true;
|
||||
#if PRINT_HDR_PS_DETECTION
|
||||
printf("HDR detected ! -> DriveMode = \"HDR\"\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -494,6 +502,9 @@ void FrameData::extractInfo ()
|
||||
rtexif::Tag* q = mnote->findTag("Quality");
|
||||
if (q && q->toInt() == 7) {
|
||||
isPixelShift = true;
|
||||
#if PRINT_HDR_PS_DETECTION
|
||||
printf("PixelShift detected ! -> \"Quality\" = 7\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -546,12 +557,18 @@ void FrameData::extractInfo ()
|
||||
if (bitspersample == 32) {
|
||||
sampleFormat = IIOSF_FLOAT;
|
||||
isHDR = true;
|
||||
#if PRINT_HDR_PS_DETECTION
|
||||
printf("HDR detected ! -> sampleFormat = %d\n", sampleFormat);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
} else if (photometric == PHOTOMETRIC_CFA) {
|
||||
if (sampleformat == SAMPLEFORMAT_IEEEFP) {
|
||||
sampleFormat = IIOSF_FLOAT;
|
||||
isHDR = true;
|
||||
#if PRINT_HDR_PS_DETECTION
|
||||
printf("HDR detected ! -> sampleFormat = %d\n", sampleFormat);
|
||||
#endif
|
||||
} else if (sampleformat == SAMPLEFORMAT_INT || sampleformat == SAMPLEFORMAT_UINT) {
|
||||
if (bitspersample == 8) { // shouldn't occur...
|
||||
sampleFormat = IIOSF_UNSIGNED_CHAR;
|
||||
@ -563,9 +580,15 @@ void FrameData::extractInfo ()
|
||||
if (compression == COMPRESSION_SGILOG24) {
|
||||
sampleFormat = IIOSF_LOGLUV24;
|
||||
isHDR = true;
|
||||
#if PRINT_HDR_PS_DETECTION
|
||||
printf("HDR detected ! -> sampleFormat = %d\n", sampleFormat);
|
||||
#endif
|
||||
} else if (compression == COMPRESSION_SGILOG) {
|
||||
sampleFormat = IIOSF_LOGLUV32;
|
||||
isHDR = true;
|
||||
#if PRINT_HDR_PS_DETECTION
|
||||
printf("HDR detected ! -> sampleFormat = %d\n", sampleFormat);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,17 +20,12 @@
|
||||
#define __IMAGEDATA_H__
|
||||
|
||||
#include <cstdio>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include <glibmm.h>
|
||||
|
||||
#include <libiptcdata/iptc-data.h>
|
||||
|
||||
#include "../rtexif/rtexif.h"
|
||||
|
||||
#include "procparams.h"
|
||||
#include "rawimage.h"
|
||||
#include <string>
|
||||
#include <glibmm.h>
|
||||
#include "../rtexif/rtexif.h"
|
||||
#include "procparams.h"
|
||||
#include <libiptcdata/iptc-data.h>
|
||||
#include "rtengine.h"
|
||||
|
||||
namespace rtengine
|
||||
|
@ -35,6 +35,9 @@
|
||||
#include "../rtgui/version.h"
|
||||
#include "../rtgui/ppversion.h"
|
||||
|
||||
// see end of ExifManager::parse(bool, bool)
|
||||
#define PRINT_METADATA_TREE 0
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace rtexif
|
||||
@ -288,12 +291,14 @@ bool TagDirectory::CPBDump (const Glib::ustring &commFName, const Glib::ustring
|
||||
kf->set_string ("RT General", "DefaultProcParams", defaultPParams);
|
||||
kf->set_boolean ("RT General", "FlaggingMode", flagMode);
|
||||
|
||||
kf->set_integer ("Common Data", "FrameCount", cfs->frameCount);
|
||||
kf->set_integer ("Common Data", "SampleFormat", cfs->sampleFormat);
|
||||
kf->set_boolean ("Common Data", "IsHDR", cfs->isHDR);
|
||||
kf->set_boolean ("Common Data", "IsPixelShift", cfs->isPixelShift);
|
||||
kf->set_double ("Common Data", "FNumber", cfs->fnumber);
|
||||
kf->set_double ("Common Data", "Shutter", cfs->shutter);
|
||||
kf->set_double ("Common Data", "FocalLength", cfs->focalLen);
|
||||
kf->set_integer ("Common Data", "ISO", cfs->iso);
|
||||
kf->set_boolean ("Common Data", "IsHDR", cfs->isHDR);
|
||||
kf->set_boolean ("Common Data", "IsPixelShift", cfs->isPixelShift);
|
||||
kf->set_string ("Common Data", "Lens", cfs->lens);
|
||||
kf->set_string ("Common Data", "Make", cfs->camMake);
|
||||
kf->set_string ("Common Data", "Model", cfs->camModel);
|
||||
@ -457,13 +462,18 @@ Tag* TagDirectory::findTag (const char* name, bool lookUpward) const
|
||||
return t;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < tags.size(); i++) {
|
||||
if (tags[i]->isDirectory()) {
|
||||
TagDirectory *dir = tags[i]->getDirectory();
|
||||
Tag* t = dir->findTag (name);
|
||||
for (auto tag : tags) {
|
||||
if (tag->isDirectory()) {
|
||||
TagDirectory *dir;
|
||||
int i = 0;
|
||||
while ((dir = tag->getDirectory(i)) != nullptr) {
|
||||
TagDirectory *dir = tag->getDirectory();
|
||||
Tag* t = dir->findTag (name);
|
||||
|
||||
if (t) {
|
||||
return t;
|
||||
if (t) {
|
||||
return t;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -492,15 +502,19 @@ std::vector<const Tag*> TagDirectory::findTags (int ID)
|
||||
|
||||
for (auto tag : tags) {
|
||||
if (tag->isDirectory()) {
|
||||
TagDirectory *dir = tag->getDirectory();
|
||||
std::vector<const Tag*> subTagList = dir->findTags (ID);
|
||||
TagDirectory *dir;
|
||||
int i = 0;
|
||||
while ((dir = tag->getDirectory(i)) != nullptr) {
|
||||
std::vector<const Tag*> subTagList = dir->findTags (ID);
|
||||
|
||||
if (!subTagList.empty()) {
|
||||
// concatenating the 2 vectors
|
||||
// not really optimal in a memory efficiency pov
|
||||
for (auto tag2 : subTagList) {
|
||||
tagList.push_back(tag2);
|
||||
if (!subTagList.empty()) {
|
||||
// concatenating the 2 vectors
|
||||
// not really optimal in a memory efficiency pov
|
||||
for (auto tag2 : subTagList) {
|
||||
tagList.push_back(tag2);
|
||||
}
|
||||
}
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -521,15 +535,19 @@ std::vector<const Tag*> TagDirectory::findTags (const char* name)
|
||||
|
||||
for (auto tag : tags) {
|
||||
if (tag->isDirectory()) {
|
||||
TagDirectory *dir = tag->getDirectory();
|
||||
std::vector<const Tag*> subTagList = dir->findTags (name);
|
||||
TagDirectory *dir;
|
||||
int i = 0;
|
||||
while ((dir = tag->getDirectory(i)) != nullptr) {
|
||||
std::vector<const Tag*> subTagList = dir->findTags (name);
|
||||
|
||||
if (!subTagList.empty()) {
|
||||
// concatenating the 2 vectors
|
||||
// not really optimal in a memory efficiency pov
|
||||
for (auto tag2 : subTagList) {
|
||||
tagList.push_back(tag2);
|
||||
if (!subTagList.empty()) {
|
||||
// concatenating the 2 vectors
|
||||
// not really optimal in a memory efficiency pov, but adding 10 items should be a maximum
|
||||
for (auto tag2 : subTagList) {
|
||||
tagList.push_back(tag2);
|
||||
}
|
||||
}
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -540,7 +558,7 @@ std::vector<const Tag*> TagDirectory::findTags (const char* name)
|
||||
|
||||
Tag* TagDirectory::findTagUpward (const char* name) const
|
||||
{
|
||||
Tag* t = getTag(name);
|
||||
Tag* t = findTag(name);
|
||||
if (t) {
|
||||
return t;
|
||||
}
|
||||
@ -2650,7 +2668,6 @@ void ExifManager::parseStd (bool skipIgnored) {
|
||||
parse(false, skipIgnored);
|
||||
}
|
||||
|
||||
// return a root TagDirectory
|
||||
void ExifManager::parse (bool isRaw, bool skipIgnored)
|
||||
{
|
||||
int ifdOffset = IFDOffset;
|
||||
@ -2924,8 +2941,10 @@ void ExifManager::parse (bool isRaw, bool skipIgnored)
|
||||
frames.push_back(sft->getParent());
|
||||
frameRootDetected = true;
|
||||
|
||||
//printf("\n--------------- FRAME -----------------------------\n\n");
|
||||
//sft->getParent()->printAll ();
|
||||
#if PRINT_METADATA_TREE
|
||||
printf("\n--------------- FRAME (SUBFILETYPE) ---------------\n\n");
|
||||
sft->getParent()->printAll ();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2939,8 +2958,10 @@ void ExifManager::parse (bool isRaw, bool skipIgnored)
|
||||
frames.push_back(sft->getParent());
|
||||
frameRootDetected = true;
|
||||
|
||||
//printf("\n--------------- FRAME -----------------------------\n\n");
|
||||
//sft->getParent()->printAll ();
|
||||
#if PRINT_METADATA_TREE
|
||||
printf("\n--------------- FRAME (OSUBFILETYPE) ---------------\n\n");
|
||||
sft->getParent()->printAll ();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2955,8 +2976,10 @@ void ExifManager::parse (bool isRaw, bool skipIgnored)
|
||||
frames.push_back(pi->getParent());
|
||||
//frameRootDetected = true; not used afterward
|
||||
|
||||
//printf("\n--------------- FRAME -----------------------------\n\n");
|
||||
//pi->getParent()->printAll ();
|
||||
#if PRINT_METADATA_TREE
|
||||
printf("\n--------------- FRAME (PHOTOMETRIC) ---------------\n\n");
|
||||
pi->getParent()->printAll ();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2968,8 +2991,10 @@ void ExifManager::parse (bool isRaw, bool skipIgnored)
|
||||
|
||||
roots.push_back(root);
|
||||
|
||||
//printf("\n~~~~~~~~~ ROOT ~~~~~~~~~~~~~~~~~~~~~~~~\n\n");
|
||||
//root->printAll ();
|
||||
#if PRINT_METADATA_TREE
|
||||
printf("\n~~~~~~~~~ ROOT ~~~~~~~~~~~~~~~~~~~~~~~~\n\n");
|
||||
root->printAll ();
|
||||
#endif
|
||||
|
||||
} while (ifdOffset && !onlyFirst);
|
||||
|
||||
|
@ -19,15 +19,15 @@
|
||||
#ifndef _MEXIF3_
|
||||
#define _MEXIF3_
|
||||
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <iomanip>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <cstdlib>
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
|
||||
#include <glibmm.h>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user