Author: post
Date: 2010-12-28 19:12:45 +0100 (Tue, 28 Dec 2010)
New Revision: 318
Modified:
RawSpeed/RawDecoder.cpp
RawSpeed/RawDecoder.h
RawSpeed/Rw2Decoder.cpp
Log:
When cropping cannot be determined in RW2, or there is no data on the current
cropping mode, fall back to using overall data.
Modified: RawSpeed/RawDecoder.cpp
===================================================================
--- RawSpeed/RawDecoder.cpp 2010-12-28 18:10:34 UTC (rev 317)
+++ RawSpeed/RawDecoder.cpp 2010-12-28 18:12:45 UTC (rev 318)
@@ -179,7 +179,7 @@
}
}
-void RawDecoder::checkCameraSupported(CameraMetaData *meta, string make,
string model, string mode) {
+bool RawDecoder::checkCameraSupported(CameraMetaData *meta, string make,
string model, string mode) {
TrimSpaces(make);
TrimSpaces(model);
Camera* cam = meta->getCamera(make, model, mode);
@@ -187,7 +187,8 @@
if (mode.length() == 0)
printf("Unable to find camera in database: %s %s %s\n", make.c_str(),
model.c_str(), mode.c_str());
- return; // Assume true.
+ // Assume the camera can be decoded, but return false, so decoders can see
that we are unsure.
+ return false;
}
if (!cam->supported)
@@ -197,6 +198,7 @@
ThrowRDE("Camera not supported in this version. Update RawSpeed for
support.");
hints = cam->hints;
+ return true;
}
void RawDecoder::setMetaData(CameraMetaData *meta, string make, string model,
string mode) {
Modified: RawSpeed/RawDecoder.h
===================================================================
--- RawSpeed/RawDecoder.h 2010-12-28 18:10:34 UTC (rev 317)
+++ RawSpeed/RawDecoder.h 2010-12-28 18:12:45 UTC (rev 318)
@@ -98,8 +98,8 @@
/* Check the camera and mode against the camera database. */
/* A RawDecoderException will be thrown if the camera isn't supported */
- /* Unknown cameras does NOT generate any errors */
- void checkCameraSupported(CameraMetaData *meta, string make, string model,
string mode);
+ /* Unknown cameras does NOT generate any errors, but returns false */
+ bool checkCameraSupported(CameraMetaData *meta, string make, string model,
string mode);
/* Helper function for decodeMetaData(), that find the camera in the
CameraMetaData DB */
/* and sets common settings such as crop, black- white level, and sets CFA
information */
Modified: RawSpeed/Rw2Decoder.cpp
===================================================================
--- RawSpeed/Rw2Decoder.cpp 2010-12-28 18:10:34 UTC (rev 317)
+++ RawSpeed/Rw2Decoder.cpp 2010-12-28 18:12:45 UTC (rev 318)
@@ -170,7 +170,8 @@
string make = data[0]->getEntry(MAKE)->getString();
string model = data[0]->getEntry(MODEL)->getString();
- this->checkCameraSupported(meta, make, model, getMode(model));
+ if (!this->checkCameraSupported(meta, make, model, getMode(model)))
+ this->checkCameraSupported(meta, make, model, "");
}
void Rw2Decoder::decodeMetaData(CameraMetaData *meta) {
@@ -183,8 +184,10 @@
string make = data[0]->getEntry(MAKE)->getString();
string model = data[0]->getEntry(MODEL)->getString();
string mode = getMode(model);
-
- setMetaData(meta, make, model, mode);
+ if (this->checkCameraSupported(meta, make, model, getMode(model)))
+ setMetaData(meta, make, model, mode);
+ else
+ setMetaData(meta, make, model, "");
}
bool Rw2Decoder::almostEqualRelative(float A, float B, float maxRelativeError)
{
_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit