Author: post
Date: 2012-07-15 18:55:22 +0200 (Sun, 15 Jul 2012)
New Revision: 438
Modified:
RawSpeed/Camera.cpp
RawSpeed/Camera.h
RawSpeed/Common.h
data/cameras.xml
data/showcameras.xsl
Log:
Make it possible to add a list of ISO values from which the sensor values will
be taken.
Modified: RawSpeed/Camera.cpp
===================================================================
--- RawSpeed/Camera.cpp 2012-07-12 13:35:45 UTC (rev 437)
+++ RawSpeed/Camera.cpp 2012-07-15 16:55:22 UTC (rev 438)
@@ -232,7 +232,24 @@
return i;
}
+vector<int> Camera::MultipleStringToInt(const xmlChar *in, const xmlChar *tag,
const char* attribute) {
+ int i;
+ vector<int> ret;
+ vector<string> v = split_string(string((const char*)in), ' ');
+ for (uint32 j = 0; j < v.size(); j++) {
+#if defined(__unix__) || defined(__APPLE__) || defined(__MINGW32__)
+ if (EOF == sscanf((v[j].c_str(), "%d", &i))
+#else
+ if (EOF == sscanf_s(v[j].c_str(), "%d", &i))
+#endif
+ ThrowCME("Error parsing attribute %s in tag %s, in camera %s %s.",
attribute, tag, make.c_str(), model.c_str());
+ ret.push_back(i);
+ }
+ return ret;
+}
+
+
int Camera::getAttributeAsInt(xmlNodePtr cur , const xmlChar *tag, const char*
attribute) {
xmlChar *key = xmlGetProp(cur, (const xmlChar *)attribute);
@@ -307,7 +324,19 @@
max_iso = StringToInt(key, cur->name, "iso_max");
xmlFree(key);
}
- sensorInfo.push_back(CameraSensorInfo(black, white, min_iso, max_iso));
+ key = xmlGetProp(cur, (const xmlChar *)"iso_list");
+ if (key) {
+ vector<int> values = MultipleStringToInt(key, cur->name, "iso_list");
+ xmlFree(key);
+ if (!values.empty()) {
+ for (uint32 i = 0; i < values.size(); i++) {
+ sensorInfo.push_back(CameraSensorInfo(black, white, values[i],
values[i]));
+ }
+ }
+ } else {
+ sensorInfo.push_back(CameraSensorInfo(black, white, min_iso, max_iso));
+ }
+
}
const CameraSensorInfo* Camera::getSensorInfo( int iso )
Modified: RawSpeed/Camera.h
===================================================================
--- RawSpeed/Camera.h 2012-07-12 13:35:45 UTC (rev 437)
+++ RawSpeed/Camera.h 2012-07-15 16:55:22 UTC (rev 438)
@@ -59,6 +59,7 @@
void parseHint( xmlDocPtr doc, xmlNodePtr cur );
void parseBlackAreas( xmlDocPtr doc, xmlNodePtr cur );
void parseSensorInfo( xmlDocPtr doc, xmlNodePtr cur );
+ vector<int> MultipleStringToInt(const xmlChar *in, const xmlChar *tag, const
char* attribute);
};
} // namespace RawSpeed
Modified: RawSpeed/Common.h
===================================================================
--- RawSpeed/Common.h 2012-07-12 13:35:45 UTC (rev 437)
+++ RawSpeed/Common.h 2012-07-15 16:55:22 UTC (rev 438)
@@ -138,6 +138,25 @@
str = str.substr(startpos, endpos - startpos + 1);
}
+
+inline vector<string> split_string(string input, char c = ' ') {
+ vector<string> result;
+ const char *str = input.c_str();
+
+ while(1) {
+ const char *begin = str;
+
+ while(*str != c && *str)
+ str++;
+
+ result.push_back(string(begin, str));
+
+ if(0 == *str++)
+ break;
+ }
+
+ return result;
+}
} // namespace RawSpeed
Modified: data/cameras.xml
===================================================================
--- data/cameras.xml 2012-07-12 13:35:45 UTC (rev 437)
+++ data/cameras.xml 2012-07-15 16:55:22 UTC (rev 438)
@@ -44,6 +44,7 @@
<!ELEMENT Sensor EMPTY >
<!ATTLIST Sensor white NMTOKEN #REQUIRED >
<!ATTLIST Sensor black NMTOKEN #REQUIRED >
+<!ATTLIST Sensor iso_list NMTOKENS #IMPLIED >
<!ATTLIST Sensor iso_min NMTOKEN #IMPLIED >
<!ATTLIST Sensor iso_max NMTOKEN #IMPLIED >
@@ -284,19 +285,22 @@
<Color x="1" y="1">GREEN</Color>
</CFA>
<Crop x="158" y="51" width="5634" height="3753"/>
- <Sensor black="1024" white="15600"/>
- <BlackAreas>
- <Vertical x="0" width="156"/>
- <Horizontal y="2" height="48"/>
- </BlackAreas>
+ <Sensor black="1024" white="12995" iso_list="160 320 640 1250"/>
+ <Sensor black="1024" white="15950"/>
+ <BlackAreas>
+ <Vertical x="0" width="156"/>
+ <Horizontal y="2" height="48"/>
+ </BlackAreas>
</Camera>
<Camera make="Canon" model="Canon EOS 5D Mark II" mode="sRaw1">
<Crop x="0" y="0" width="3872" height="2574"/>
- <Sensor black="0" white="65535"/>
+ <Sensor black="0" white="57200" iso_list="160 320 640 1250"/>
+ <Sensor black="0" white="64948"/>
</Camera>
<Camera make="Canon" model="Canon EOS 5D Mark II" mode="sRaw2">
<Crop x="0" y="0" width="2808" height="1872"/>
- <Sensor black="0" white="65535"/>
+ <Sensor black="0" white="57200" iso_list="160 320 640 1250"/>
+ <Sensor black="0" white="64948"/>
</Camera>
<Camera make="Canon" model="Canon EOS 5D Mark III" decoder_version="1">
<CFA width="2" height="2">
Modified: data/showcameras.xsl
===================================================================
--- data/showcameras.xsl 2012-07-12 13:35:45 UTC (rev 437)
+++ data/showcameras.xsl 2012-07-15 16:55:22 UTC (rev 438)
@@ -71,11 +71,14 @@
<xsl:when test
="@iso_max != ''">
ISO 0 -
<xsl:value-of select="@iso_max"/>
</xsl:when>
+ <xsl:when test
="@iso_list != ''">
+ at ISO
<xsl:value-of select="@iso_list"/>
+ </xsl:when>
<xsl:otherwise>
- Default
+ default values
</xsl:otherwise>
</xsl:choose>
- Black: <span
class="param"><xsl:value-of select="@black"/></span>, White:
+ - Black: <span
class="param"><xsl:value-of select="@black"/></span>, White:
<span
class="param"><xsl:value-of select="@white"/>.</span>
<br/>
</xsl:for-each>
_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit