Added some debug info (with Verbose=true)

Load/Save Verbose in General section
This commit is contained in:
ffsup2 2010-09-21 21:25:24 +02:00
parent e681354973
commit 18d6799cbe
4 changed files with 40 additions and 20 deletions

View File

@ -189,9 +189,7 @@ void dfInfo::updateBadPixelList( RawImage *df )
}
}
if( settings->verbose ){
for (std::list<badPix>::iterator iter = badPixels.begin(); iter !=badPixels.end(); iter ++)
printf( "(%d,%d) ",iter->x, iter->y);
printf( "Tot: %d\n", badPixels.size() );
printf( "Extracted %u pixels from darkframe %s\n", badPixels.size(),df->fname.c_str() );
}
}
@ -211,8 +209,9 @@ void DFManager::init( Glib::ustring pathname )
for (int i=0; i<names.size(); i++) {
int lastdot = names[i].find_last_of ('.');
if (lastdot != Glib::ustring::npos && names[i].substr(lastdot) == ".badpixels" ){
if( scanBadPixelsFile( names[i] ) && settings->verbose)
printf("Loaded badpixels file %s\n",names[i].c_str());
int n = scanBadPixelsFile( names[i] );
if( n>0 && settings->verbose)
printf("Loaded %s: %d pixels\n",names[i].c_str(),n);
continue;
}
try{
@ -359,13 +358,18 @@ std::list<badPix> *DFManager::getHotPixels ( const Glib::ustring filename )
std::list<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 );
if( df )
if( df ){
if( settings->verbose )
if( df->pathname.size() >0 )
printf( "Searched hotpixels from %s\n",df->pathname.c_str());
else if( df->pathNames.size() >0 )
printf( "Searched hotpixels from template (first %s)\n",df->pathNames.begin()->c_str());
return &df->getHotPixels();
else
}else
return 0;
}
bool DFManager::scanBadPixelsFile( Glib::ustring filename )
int DFManager::scanBadPixelsFile( Glib::ustring filename )
{
FILE *file = fopen( filename.c_str(),"r" );
if( !file ) return false;
@ -384,11 +388,10 @@ bool DFManager::scanBadPixelsFile( Glib::ustring filename )
if( sscanf(line,"%d %d",&x,&y) == 2 )
bp.push_back( badPix(x,y) );
}
if( bp.size()>0 ){
int numPixels = bp.size();
if( numPixels >0 )
bpList[ makmodel ] = bp;
return true;
}
return false;
return numPixels;
}
std::list<badPix> *DFManager::getBadPixels ( const std::string &mak, const std::string &mod, const std::string &serial)
@ -398,8 +401,13 @@ std::list<badPix> *DFManager::getBadPixels ( const std::string &mak, const std::
if( serial.size()>0)
s << " " << serial;
bpList_t::iterator iter = bpList.find( s.str() );
if( iter != bpList.end() )
if( iter != bpList.end() ){
if( settings->verbose )
printf("Found:%s.badpixels in list\n",s.str().c_str());
return &(iter->second);
}
if( settings->verbose )
printf("%s.badpixels not found\n",s.str().c_str());
return 0;
}

View File

@ -86,7 +86,7 @@ protected:
Glib::ustring currentPath;
dfInfo *addFileInfo(const Glib::ustring &filename );
dfInfo *find( const std::string &mak, const std::string &mod, int isospeed, double shut, time_t t );
bool scanBadPixelsFile( Glib::ustring filename );
int scanBadPixelsFile( Glib::ustring filename );
};
extern DFManager dfm;

View File

@ -777,6 +777,9 @@ void RawImageSource::preprocess (const RAWParams &raw)
}else{
rid = dfm.searchDarkFrame( ri->make, ri->model, ri->iso_speed, ri->shutter, ri->timestamp);
}
if( rid && settings->verbose){
printf( "Subtracting Darkframe:%s\n",rid->fname.c_str());
}
copyOriginalPixels(ri, rid);
size_t widthBitmap = (ri->width/8+ (ri->width%8?1:0));
size_t dimBitmap = widthBitmap*ri->height;
@ -786,17 +789,22 @@ void RawImageSource::preprocess (const RAWParams &raw)
if( bp ){
for(std::list<badPix>::iterator iter = bp->begin(); iter != bp->end(); iter++)
bitmapBads[ widthBitmap * (iter->y) + (iter->x)/8] |= 1<<(iter->x%8);
if( settings->verbose ){
printf( "Correcting %u pixels from .badpixels\n",bp->size());
}
}
bp = 0;
if( raw.df_autoselect )
if( raw.df_autoselect ){
bp = dfm.getHotPixels( ri->make, ri->model, ri->iso_speed, ri->shutter, ri->timestamp);
else if( raw.dark_frame.size()>0 )
}else if( raw.dark_frame.size()>0 )
bp = dfm.getHotPixels( raw.dark_frame );
if(bp)
if(bp){
for(std::list<badPix>::iterator iter = bp->begin(); iter != bp->end(); iter++)
bitmapBads[ widthBitmap *iter->y + iter->x/8] |= 1<<(iter->x%8);
if( settings->verbose && bp->size()>0){
printf( "Correcting %u hotpixels from darkframe\n",bp->size());
}
}
preInterpolate(false);
scaleColors( false,true);
@ -850,7 +858,10 @@ void RawImageSource::preprocess (const RAWParams &raw)
plistener->setProgressStr ("Hot/Dead Pixel Filter...");
plistener->setProgress (0.0);
}
findHotDeadPixel( bitmapBads,0.1 );
int nFound =findHotDeadPixel( bitmapBads,0.1 );
if( settings->verbose && nFound>0){
printf( "Correcting %d hot/dead pixels found inside image\n",nFound );
}
}
cfaCleanFromMap( bitmapBads );
delete [] bitmapBads;

View File

@ -297,6 +297,7 @@ int Options::saveToFile (Glib::ustring fname) {
keyFile.set_integer ("General", "Version", 290);
keyFile.set_boolean ("General", "FirstRun", firstRun);
keyFile.set_string ("General", "DarkFramesPath", rtSettings.darkFramesPath);
keyFile.set_boolean ("General", "Verbose", rtSettings.verbose);
keyFile.set_integer ("External Editor", "EditorKind", editorToSendTo);
keyFile.set_string ("External Editor", "GimpDir", gimpDir);