Case insensitive search for maker and model of dark frame shots, Issue 2472

This commit is contained in:
Ingo
2014-12-28 21:26:37 +01:00
parent 3939ce675e
commit b9161db835
2 changed files with 10 additions and 10 deletions

View File

@@ -25,7 +25,8 @@
#include <sstream>
#include <iostream>
#include <cstdio>
#include "imagedata.h"
#include "imagedata.h"
#include <glibmm/ustring.h>
namespace rtengine{
@@ -283,10 +284,10 @@ dfInfo *DFManager::addFileInfo(const Glib::ustring &filename ,bool pool )
rml.ciffLength = ri.get_ciffLen();
ImageData idata(filename, &rml);
/* Files are added in the map, divided by same maker/model,ISO and shutter*/
std::string key( dfInfo::key(idata.getMake(), idata.getModel(),idata.getISOSpeed(),idata.getShutterSpeed()) );
std::string key( dfInfo::key(((Glib::ustring)idata.getMake()).uppercase(), ((Glib::ustring)idata.getModel()).uppercase(),idata.getISOSpeed(),idata.getShutterSpeed()) );
iter = dfList.find( key );
if( iter == dfList.end() ){
dfInfo n(filename, idata.getMake(), idata.getModel(),idata.getISOSpeed(),idata.getShutterSpeed(), idata.getDateTimeAsTS() );
dfInfo n(filename, ((Glib::ustring)idata.getMake()).uppercase(), ((Glib::ustring)idata.getModel()).uppercase(),idata.getISOSpeed(),idata.getShutterSpeed(), idata.getDateTimeAsTS() );
iter = dfList.insert(std::pair< std::string,dfInfo>( key,n ) );
}else{
while( iter != dfList.end() && iter->second.key() == key && ABS(iter->second.timestamp - idata.getDateTimeAsTS()) >60*60*6 ) // 6 hour difference
@@ -295,7 +296,7 @@ dfInfo *DFManager::addFileInfo(const Glib::ustring &filename ,bool pool )
if( iter != dfList.end() )
iter->second.pathNames.push_back( filename );
else{
dfInfo n(filename, idata.getMake(), idata.getModel(),idata.getISOSpeed(),idata.getShutterSpeed(),idata.getDateTimeAsTS());
dfInfo n(filename, ((Glib::ustring)idata.getMake()).uppercase(), ((Glib::ustring)idata.getModel()).uppercase(),idata.getISOSpeed(),idata.getShutterSpeed(),idata.getDateTimeAsTS());
iter = dfList.insert(std::pair< std::string,dfInfo>( key,n ) );
}
}
@@ -359,7 +360,7 @@ dfInfo* DFManager::find( const std::string &mak, const std::string &mod, int iso
RawImage* DFManager::searchDarkFrame( const std::string &mak, const std::string &mod, int iso, double shut, time_t t )
{
dfInfo *df = find( mak, mod, iso, shut, t );
dfInfo *df = find( ((Glib::ustring)mak).uppercase(), ((Glib::ustring)mod).uppercase(), iso, shut, t );
if( df )
return df->getRawImage();
else
@@ -387,7 +388,7 @@ std::vector<badPix> *DFManager::getHotPixels ( const Glib::ustring filename )
}
std::vector<badPix> *DFManager::getHotPixels ( const std::string &mak, const std::string &mod, int iso, double shut, time_t t )
{
dfInfo *df = find( mak, mod, iso, shut, t );
dfInfo *df = find( ((Glib::ustring)mak).uppercase(), ((Glib::ustring)mod).uppercase(), iso, shut, t );
if( df ){
if( settings->verbose ) {
if( !df->pathname.empty() ) {

View File

@@ -1223,15 +1223,14 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le
{
MyTime t1,t2;
t1.set();
Glib::ustring newDF = raw.dark_frame;
Glib::ustring makerstring = ((Glib::ustring)ri->get_maker()).uppercase();
Glib::ustring modelstring = ((Glib::ustring)ri->get_model()).uppercase();
RawImage *rid=NULL;
if (!raw.df_autoselect) {
if( !raw.dark_frame.empty())
rid = dfm.searchDarkFrame( raw.dark_frame );
} else {
rid = dfm.searchDarkFrame( makerstring, modelstring, ri->get_ISOspeed(), ri->get_shutter(), ri->get_timestamp());
rid = dfm.searchDarkFrame( ri->get_maker(), ri->get_model(), ri->get_ISOspeed(), ri->get_shutter(), ri->get_timestamp());
}
if( rid && settings->verbose){
printf( "Subtracting Darkframe:%s\n",rid->get_filename().c_str());
@@ -1286,7 +1285,7 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le
// If darkframe selected, correct hotpixels found on darkframe
bp = 0;
if( raw.df_autoselect ){
bp = dfm.getHotPixels( makerstring, modelstring, ri->get_ISOspeed(), ri->get_shutter(), ri->get_timestamp());
bp = dfm.getHotPixels( ri->get_maker(), ri->get_model(), ri->get_ISOspeed(), ri->get_shutter(), ri->get_timestamp());
}else if( !raw.dark_frame.empty() )
bp = dfm.getHotPixels( raw.dark_frame );
if(bp){