Author: post
Date: 2012-10-03 20:49:33 +0200 (Wed, 03 Oct 2012)
New Revision: 467
Modified:
RawSpeed/CameraMetaData.cpp
RawSpeed/CameraMetaData.h
RawSpeed/NefDecoder.cpp
RawSpeed/NefDecoder.h
RawSpeed/StdAfx.h
Log:
Add possibility for separate modes for Nikon images.
Modified: RawSpeed/CameraMetaData.cpp
===================================================================
--- RawSpeed/CameraMetaData.cpp 2012-10-02 10:58:47 UTC (rev 466)
+++ RawSpeed/CameraMetaData.cpp 2012-10-03 18:49:33 UTC (rev 467)
@@ -96,6 +96,13 @@
return cameras[id];
}
+bool CameraMetaData::hasCamera(string make, string model, string mode) {
+ string id = string(make).append(model).append(mode);
+ if (cameras.end() == cameras.find(id))
+ return FALSE;
+ return TRUE;
+}
+
void CameraMetaData::addCamera( Camera* cam )
{
string id = string(cam->make).append(cam->model).append(cam->mode);
Modified: RawSpeed/CameraMetaData.h
===================================================================
--- RawSpeed/CameraMetaData.h 2012-10-02 10:58:47 UTC (rev 466)
+++ RawSpeed/CameraMetaData.h 2012-10-03 18:49:33 UTC (rev 467)
@@ -39,8 +39,10 @@
xmlParserCtxtPtr ctxt; /* the parser context */
map<string,Camera*> cameras;
Camera* getCamera(string make, string model, string mode);
+ bool hasCamera(string make, string model, string mode);
protected:
void addCamera(Camera* cam);
+
};
} // namespace RawSpeed
Modified: RawSpeed/NefDecoder.cpp
===================================================================
--- RawSpeed/NefDecoder.cpp 2012-10-02 10:58:47 UTC (rev 466)
+++ RawSpeed/NefDecoder.cpp 2012-10-03 18:49:33 UTC (rev 467)
@@ -334,9 +334,26 @@
ThrowRDE("NEF Support check: Model name found");
string make = data[0]->getEntry(MAKE)->getString();
string model = data[0]->getEntry(MODEL)->getString();
- this->checkCameraSupported(meta, make, model, "");
+ string mode = getMode();
+ if (meta->hasCamera(make, model, mode))
+ this->checkCameraSupported(meta, make, model, mode);
+ else
+ this->checkCameraSupported(meta, make, model, "");
}
+string NefDecoder::getMode() {
+ ostringstream mode;
+ vector<TiffIFD*> data = mRootIFD->getIFDsWithTag(CFAPATTERN);
+ TiffIFD* raw = FindBestImage(&data);
+ int compression = raw->getEntry(COMPRESSION)->getInt();
+ uint32 bitPerPixel = raw->getEntry(BITSPERSAMPLE)->getInt();
+ if (1 == compression)
+ mode << bitPerPixel << "bit-uncompressed";
+ else
+ mode << bitPerPixel << "bit-uncompressed";
+ return mode.str();
+}
+
void NefDecoder::decodeMetaDataInternal(CameraMetaData *meta) {
int iso = 0;
mRaw->cfa.setCFA(CFA_RED, CFA_GREEN, CFA_GREEN2, CFA_BLUE);
@@ -357,7 +374,12 @@
if (mRootIFD->hasEntryRecursive(ISOSPEEDRATINGS))
iso = mRootIFD->getEntryRecursive(ISOSPEEDRATINGS)->getInt();
- setMetaData(meta, make, model, "", iso);
+ string mode = getMode();
+ if (meta->hasCamera(make, model, mode)) {
+ setMetaData(meta, make, model, mode, iso);
+ } else {
+ setMetaData(meta, make, model, "", iso);
+ }
if (white != 65536)
mRaw->whitePoint = white;
Modified: RawSpeed/NefDecoder.h
===================================================================
--- RawSpeed/NefDecoder.h 2012-10-02 10:58:47 UTC (rev 466)
+++ RawSpeed/NefDecoder.h 2012-10-03 18:49:33 UTC (rev 467)
@@ -48,6 +48,7 @@
void readCoolpixMangledRaw(ByteStream &input, iPoint2D& size, iPoint2D&
offset, int inputPitch);
void readCoolpixSplitRaw(ByteStream &input, iPoint2D& size, iPoint2D&
offset, int inputPitch);
TiffIFD* FindBestImage(vector<TiffIFD*>* data);
+ string getMode();
};
class NefSlice {
Modified: RawSpeed/StdAfx.h
===================================================================
--- RawSpeed/StdAfx.h 2012-10-02 10:58:47 UTC (rev 466)
+++ RawSpeed/StdAfx.h 2012-10-03 18:49:33 UTC (rev 467)
@@ -70,6 +70,7 @@
// STL
#include <iostream>
#include <string>
+#include <sstream>
#include <vector>
#include <map>
#include <list>
_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit