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