Use exiv2 for metadata handling

This commit is contained in:
Alberto Griggio
2019-05-06 09:27:44 +02:00
parent a2e2ace1c8
commit c360fd7e2c
49 changed files with 1359 additions and 17510 deletions

View File

@@ -312,7 +312,7 @@ Thumbnail* Thumbnail::loadFromImage (const Glib::ustring& fname, int &w, int &h,
namespace {
Image8 *load_inspector_mode(const Glib::ustring &fname, RawMetaDataLocation &rml, eSensorType &sensorType, int &w, int &h)
Image8 *load_inspector_mode(const Glib::ustring &fname, eSensorType &sensorType, int &w, int &h)
{
BENCHFUN
@@ -368,7 +368,7 @@ Image8 *load_inspector_mode(const Glib::ustring &fname, RawMetaDataLocation &rml
} // namespace
Thumbnail* Thumbnail::loadQuickFromRaw (const Glib::ustring& fname, RawMetaDataLocation& rml, eSensorType &sensorType, int &w, int &h, int fixwh, bool rotate, bool inspectorMode, bool forHistogramMatching)
Thumbnail* Thumbnail::loadQuickFromRaw (const Glib::ustring& fname, eSensorType &sensorType, int &w, int &h, int fixwh, bool rotate, bool inspectorMode, bool forHistogramMatching)
{
Thumbnail* tpp = new Thumbnail ();
tpp->isRaw = 1;
@@ -378,7 +378,7 @@ Thumbnail* Thumbnail::loadQuickFromRaw (const Glib::ustring& fname, RawMetaDataL
tpp->colorMatrix[2][2] = 1.0;
if (inspectorMode && !forHistogramMatching && settings->thumbnail_inspector_mode == Settings::ThumbnailInspectorMode::RAW) {
Image8 *img = load_inspector_mode(fname, rml, sensorType, w, h);
Image8 *img = load_inspector_mode(fname, sensorType, w, h);
if (!img) {
delete tpp;
return nullptr;
@@ -403,10 +403,6 @@ Thumbnail* Thumbnail::loadQuickFromRaw (const Glib::ustring& fname, RawMetaDataL
sensorType = ri->getSensorType();
rml.exifBase = ri->get_exifBase();
rml.ciffBase = ri->get_ciffBase();
rml.ciffLength = ri->get_ciffLen();
Image8* img = new Image8 ();
// No sample format detection occurred earlier, so we set them here,
// as they are mandatory for the setScanline method
@@ -447,7 +443,7 @@ Thumbnail* Thumbnail::loadQuickFromRaw (const Glib::ustring& fname, RawMetaDataL
delete img;
delete ri;
img = load_inspector_mode(fname, rml, sensorType, w, h);
img = load_inspector_mode(fname, sensorType, w, h);
if (!img) {
delete tpp;
return nullptr;
@@ -513,28 +509,7 @@ Thumbnail* Thumbnail::loadQuickFromRaw (const Glib::ustring& fname, RawMetaDataL
#define FISBLUE(filter,row,col) \
((filter >> ((((row) << 1 & 14) + ((col) & 1)) << 1) & 3)==2 || !filter)
RawMetaDataLocation Thumbnail::loadMetaDataFromRaw (const Glib::ustring& fname)
{
RawMetaDataLocation rml;
rml.exifBase = -1;
rml.ciffBase = -1;
rml.ciffLength = -1;
RawImage ri (fname);
unsigned int imageNum = 0;
int r = ri.loadRaw (false, imageNum);
if ( !r ) {
rml.exifBase = ri.get_exifBase();
rml.ciffBase = ri.get_ciffBase();
rml.ciffLength = ri.get_ciffLen();
}
return rml;
}
Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, RawMetaDataLocation& rml, eSensorType &sensorType, int &w, int &h, int fixwh, double wbEq, bool rotate, bool forHistogramMatching)
Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, eSensorType &sensorType, int &w, int &h, int fixwh, double wbEq, bool rotate, bool forHistogramMatching)
{
RawImage *ri = new RawImage (fname);
unsigned int tempImageNum = 0;
@@ -572,10 +547,6 @@ Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, RawMetaDataLocati
ri->pre_interpolate();
rml.exifBase = ri->get_exifBase();
rml.ciffBase = ri->get_ciffBase();
rml.ciffLength = ri->get_ciffLen();
tpp->camwbRed = tpp->redMultiplier / pre_mul[0]; //ri->get_pre_mul(0);
tpp->camwbGreen = tpp->greenMultiplier / pre_mul[1]; //ri->get_pre_mul(1);
tpp->camwbBlue = tpp->blueMultiplier / pre_mul[2]; //ri->get_pre_mul(2);
@@ -1084,19 +1055,11 @@ IImage8* Thumbnail::quickProcessImage (const procparams::ProcParams& params, int
// Full thumbnail processing, second stage if complete profile exists
IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorType sensorType, int rheight, TypeInterpolation interp, const FramesMetaData *metadata, double& myscale, bool forMonitor, bool forHistogramMatching)
{
unsigned int imgNum = 0;
if (isRaw) {
if (sensorType == ST_BAYER) {
imgNum = rtengine::LIM<unsigned int>(params.raw.bayersensor.imageNum, 0, metadata->getFrameCount() - 1);
} else if (sensorType == ST_FUJI_XTRANS) {
//imgNum = rtengine::LIM<unsigned int>(params.raw.xtranssensor.imageNum, 0, metadata->getFrameCount() - 1)
}
}
std::string camName = metadata->getCamera(imgNum);
float shutter = metadata->getShutterSpeed(imgNum);
float fnumber = metadata->getFNumber(imgNum);
float iso = metadata->getISOSpeed(imgNum);
float fcomp = metadata->getExpComp(imgNum);
std::string camName = metadata->getCamera();
float shutter = metadata->getShutterSpeed();
float fnumber = metadata->getFNumber();
float iso = metadata->getISOSpeed();
float fcomp = metadata->getExpComp();
// check if the WB's equalizer value has changed
if (wbEqual < (params.wb.equal - 5e-4) || wbEqual > (params.wb.equal + 5e-4) || wbTempBias < (params.wb.tempBias - 5e-4) || wbTempBias > (params.wb.tempBias + 5e-4)) {