diff --git a/CMakeLists.txt b/CMakeLists.txt index cbf53dec3..2716df9b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,6 +62,7 @@ if (APPLE) SET (CMAKE_OSX_DEPLOYMENT_TARGET "10.5") endif (APPLE) +option(USE_CLANG "Build rawtherapee with clang" OFF) option (AUTOMATED_BUILD_SYSTEM "TRUE if built by an automate" OFF) option (BUILD_SHARED "Build rawtherapee with shared libraries" OFF) @@ -306,6 +307,40 @@ if (OPTION_OMP) endif (OPENMP_FOUND) endif (OPTION_OMP) +if(USE_CLANG) + find_file(CLANG_CMD clang) + find_file(CLANGPP_CMD clang++) + + if ((CLANG_CMD STREQUAL CLANG_CMD-NOTFOUND) OR (CLANGPP_CMD STREQUAL CLANGPP_CMD-NOTFOUND)) + message(FATAL_ERROR "clang not found! auto-disabling option USE_CLANG") + else ((CLANG_CMD STREQUAL CLANG_CMD-NOTFOUND) OR (CLANGPP_CMD STREQUAL CLANGPP_CMD-NOTFOUND)) + message(STATUS "clang found: ${CLANG_CMD}") + message(STATUS "clang++ found: ${CLANGPP_CMD}") + + SET (CMAKE_C_COMPILER ${CLANG_CMD}) + SET (CMAKE_C_FLAGS "") #-Wall + SET (CMAKE_C_FLAGS_DEBUG "-g") + SET (CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG") + SET (CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG") + SET (CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g") + + SET (CMAKE_CXX_COMPILER ${CLANGPP_CMD}) + SET (CMAKE_CXX_FLAGS "") #-Wall + SET (CMAKE_CXX_FLAGS_DEBUG "-g") + SET (CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g") + endif ((CLANG_CMD STREQUAL CLANG_CMD-NOTFOUND) OR (CLANGPP_CMD STREQUAL CLANGPP_CMD-NOTFOUND)) + + find_file(LDGOLD_CMD ld.gold) + if (LDGOLD_CMD STREQUAL LDGOLD_CMD-NOTFOUND) + message(FATAL_ERROR "ld.gold not found! using standard linker") + else (LDGOLD_CMD STREQUAL LDGOLD_CMD-NOTFOUND) + message(STATUS "ld.gold found: ${LDGOLD_CMD}") + SET (CMAKE_LINKER LDGOLD_CMD) + endif (LDGOLD_CMD STREQUAL LDGOLD_CMD-NOTFOUND) +endif(USE_CLANG) + install (FILES AUTHORS.txt DESTINATION ${CREDITSDIR}) install (FILES LICENSE.txt DESTINATION ${LICENCEDIR}) install (FILES AboutThisBuild.txt DESTINATION ${CREDITSDIR}) diff --git a/clean.sh b/clean.sh index 8d4a7577f..0f8160443 100755 --- a/clean.sh +++ b/clean.sh @@ -1,5 +1,5 @@ #!/bin/sh -rm -v CMakeCache.txt +find -name CMakeCache.txt -delete rm -v install_manifest.txt rm -vr ./CMakeFiles diff --git a/rtengine/CMakeLists.txt b/rtengine/CMakeLists.txt index f7d00db54..ea2685e8c 100644 --- a/rtengine/CMakeLists.txt +++ b/rtengine/CMakeLists.txt @@ -1,8 +1,6 @@ - -include_directories (${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../rtexif - ${EXTRA_INCDIR} ${GTHREAD_INCLUDE_DIRS} ${GOBJECT_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS} +include_directories (${EXTRA_INCDIR} ${GTHREAD_INCLUDE_DIRS} ${GOBJECT_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS} ${GLIBMM_INCLUDE_DIRS} ${IPTCDATA_INCLUDE_DIRS} ${LCMS_INCLUDE_DIRS} - ${CMAKE_CURRENT_SOURCE_DIR}/../rtgui ${GTKMM_INCLUDE_DIRS} ${GTK_INCLUDE_DIRS}) + ${GTKMM_INCLUDE_DIRS} ${GTK_INCLUDE_DIRS}) link_directories (${CMAKE_CURRENT_SOURCE_DIR}/../rtexif ${EXTRA_LIBDIR} ${GTHREAD_LIBRARY_DIRS} ${GOBJECT_LIBRARY_DIRS} ${GLIB2_LIBRARY_DIRS} ${GLIBMM_LIBRARY_DIRS} ${IPTCDATA_LIBRARY_DIRS} ${LCMS_LIBRARY_DIRS}) @@ -10,15 +8,15 @@ link_directories (${CMAKE_CURRENT_SOURCE_DIR}/../rtexif ${EXTRA_LIBDIR} ${GTHREA set (RTENGINESOURCEFILES safegtk.cc colortemp.cc curves.cc flatcurves.cc diagonalcurves.cc dcraw.cc iccstore.cc dfmanager.cc ffmanager.cc rawimage.cc image8.cc image16.cc imagefloat.cc imagedata.cc imageio.cc improcfun.cc init.cc dcrop.cc loadinitial.cc procparams.cc rawimagesource.cc demosaic_algos.cc shmap.cc simpleprocess.cc refreshmap.cc - stdimagesource.cc myfile.cc iccjpeg.c hlmultipliers.cc improccoordinator.cc + stdimagesource.cc myfile.cc iccjpeg.cc hlmultipliers.cc improccoordinator.cc processingjob.cc rtthumbnail.cc utils.cc labimage.cc slicer.cc iplab2rgb.cc ipsharpen.cc iptransform.cc ipresize.cc ipvibrance.cc - jpeg_memsrc.c jdatasrc.c + jpeg_memsrc.cc jdatasrc.cc PF_correct_RT.cc dirpyrLab_denoise.cc dirpyrLab_equalizer.cc dirpyr_equalizer.cc - calc_distort.c - klt/convolve.c klt/error.c klt/klt.c klt/klt_util.c klt/pnmio.c klt/pyramid.c klt/selectGoodFeatures.c - klt/storeFeatures.c klt/trackFeatures.c klt/writeFeatures.c + calc_distort.cc + klt/convolve.cc klt/error.cc klt/klt.cc klt/klt_util.cc klt/pnmio.cc klt/pyramid.cc klt/selectGoodFeatures.cc + klt/storeFeatures.cc klt/trackFeatures.cc klt/writeFeatures.cc ) add_library (rtengine ${RTENGINESOURCEFILES}) diff --git a/rtengine/EdgePreservingDecomposition.h b/rtengine/EdgePreservingDecomposition.h index 490783990..ca1e68ab6 100644 --- a/rtengine/EdgePreservingDecomposition.h +++ b/rtengine/EdgePreservingDecomposition.h @@ -35,11 +35,11 @@ It's likely that I'll take apart and rerelease contents of this file (in the dis and rather supporting material. SparseConjugateGradient alone is a workhorse I and a few others have been exploiting for a few years. EdgePreservingDecomposition.h and EdgePreservingDecomposition.cpp are released under the following licence: - • It's free. - • You may not incorporate this code as part of proprietary or commercial software, but via freeware you may use its output for profit. - • You may modify and redistribute, but keep this big comment block intact and not for profit in any way unless I give specific permission. - • If you're unsure about anything else, treat as public domain. - • Don't be a dick. + � It's free. + � You may not incorporate this code as part of proprietary or commercial software, but via freeware you may use its output for profit. + � You may modify and redistribute, but keep this big comment block intact and not for profit in any way unless I give specific permission. + � If you're unsure about anything else, treat as public domain. + � Don't be a dick. My email address is my screen name followed by @yahoo.com. I'm also known as ben_s or nonbasketless. Enjoy! */ @@ -47,8 +47,8 @@ My email address is my screen name followed by @yahoo.com. I'm also known as ben #include -#include -#include +#include +#include //This is for solving big symmetric positive definite linear problems. diff --git a/rtengine/LUT.h b/rtengine/LUT.h index c63b99112..ca4ef64ea 100644 --- a/rtengine/LUT.h +++ b/rtengine/LUT.h @@ -65,6 +65,8 @@ #define LUTi LUT #define LUTu LUT +#include + template class LUT { private: diff --git a/rtengine/PF_correct_RT.cc b/rtengine/PF_correct_RT.cc index a084a9578..5f7438269 100644 --- a/rtengine/PF_correct_RT.cc +++ b/rtengine/PF_correct_RT.cc @@ -25,11 +25,11 @@ //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -//#include -//#include -#include -//#include -#include +//#include "rtengine.h" +//#include +#include "gauss.h" +//#include "bilateral2.h" +#include "improcfun.h" #ifdef _OPENMP #include diff --git a/rtengine/array2D.h b/rtengine/array2D.h index eae9caf03..5a6e78367 100644 --- a/rtengine/array2D.h +++ b/rtengine/array2D.h @@ -55,7 +55,7 @@ #ifndef ARRAY2D_H_ #define ARRAY2D_H_ #include // for raise() -#include +#include // flags for use #define ARRAY2D_LOCK_DATA 1 diff --git a/rtengine/bilateral2.h b/rtengine/bilateral2.h index c649b8eec..24854baa5 100644 --- a/rtengine/bilateral2.h +++ b/rtengine/bilateral2.h @@ -19,12 +19,12 @@ #ifndef _BILATERAL2_ #define _BILATERAL2_ -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include "alignedbuffer.h" +#include "mytime.h" +#include "gauss.h" #include #ifdef _OPENMP #include diff --git a/rtengine/bilateral3.h b/rtengine/bilateral3.h index 01d718054..f407f10e6 100644 --- a/rtengine/bilateral3.h +++ b/rtengine/bilateral3.h @@ -16,9 +16,9 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include +#include +#include +#include #define MAXVAL 65535.0 #define CLIP(a) ((a)>0.0?((a)=0 && r0<1 && r10 >=0.8 && r10 <1.2) - drawDotXY (img, ncols, nrows, (int)(r0*ncols), (int)((r10-0.8)*2.5*nrows), color); -} -#endif - -double calcDistortion(unsigned char* img1, unsigned char* img2, int ncols, int nrows) -{ - KLT_TrackingContext tc; - KLT_FeatureList fl; - KLT_FeatureTable ft; - int nFeatures = N_FEATURES; - int i,n; - double radius, wc, hc; - - double r0[N_FEATURES] = {0.0}; - double r10[N_FEATURES] = {0.0}; - - tc = KLTCreateTrackingContext(); - //tc->mindist = 20; - tc->lighting_insensitive = TRUE; - tc->nSkippedPixels = 5; - tc->step_factor = 2.0; - tc->max_iterations = 20; - //KLTPrintTrackingContext(tc); - fl = KLTCreateFeatureList(N_FEATURES); - ft = KLTCreateFeatureTable(2, N_FEATURES); - - radius = sqrt(ncols*ncols+nrows*nrows)/2.0; - wc=((double)ncols)/2.0-0.5; - hc=((double)nrows)/2.0-0.5; - - KLTSelectGoodFeatures(tc, img1, ncols, nrows, fl); - KLTStoreFeatureList(fl, ft, 0); - - KLTTrackFeatures(tc, img1, img2, ncols, nrows, fl); - KLTStoreFeatureList(fl, ft, 1); - - // add a shade to img2, we want to draw something on top of it. - for (i=0;ifeature[i][1]->val>=0) { - double x0,y0,x1,y1; - x0=ft->feature[i][0]->x; - y0=ft->feature[i][0]->y; - x1=ft->feature[i][1]->x; - y1=ft->feature[i][1]->y; - - r0[n]=sqrt((x0-wc)*(x0-wc)+(y0-hc)*(y0-hc))/radius; - // dots too close to the center tends to have big diviation and create noise, extract them - if (r0[n]feature[i][0]->x=-1.0; - ft->feature[i][0]->y=-1.0; - } - } - - if (n < 5) { - printf ("Not sufficient features.\n"); - return 0.0; - } - - double avg_r10 = total_r10 / n; - double avg_r0 = total_r0 / n; - double Sxx = 0.0; - double Sxy = 0.0; - double Syy = 0.0; - - for (i=0;i= 0 ? delta : -delta; - -#ifdef DEBUG_IMG - drawDot(img2, ncols, nrows, r0[i], r10[i], 255); -#endif - - if (delta >= DELTA_1) { - total_r10 -= r10[i]; - total_r0 -= r0[i]; - r0[i] = -1.0; - new_n--; - } - - total_delta += delta; - } - - printf ("distortion amount=%lf scale=%lf deviation=%lf, rxy=%lf\n", a, b, total_delta/n, rxy); - - if (new_n < 5) { - printf ("Not sufficient features.\n"); - return 0.0; - } - - printf ("Removed %d outstading data points\n", n-new_n); - avg_r10 = total_r10 / new_n; - avg_r0 = total_r0 / new_n; - Sxx = 0.0; - Sxy = 0.0; - Syy = 0.0; - - for (i=0;i=0.8 && val <1.2) { - if (img2[i+((int)((val-0.8)*2.5*nrows))*ncols] != 255) - img2[i+((int)((val-0.8)*2.5*nrows))*ncols] = 0; - } - val += DELTA_1; - if (val >=0.8 && val <1.2) { - if (img2[i+((int)((val-0.8)*2.5*nrows))*ncols] != 255) - img2[i+((int)((val-0.8)*2.5*nrows))*ncols] = 8; - } - val -= DELTA_1*2; - if (val >=0.8 && val <1.2) { - if (img2[i+((int)((val-0.8)*2.5*nrows))*ncols] != 255) - img2[i+((int)((val-0.8)*2.5*nrows))*ncols] = 8; - } - val += DELTA_1+DELTA_2; - if (val >=0.8 && val <1.2) { - if (img2[i+((int)((val-0.8)*2.5*nrows))*ncols] != 255) - img2[i+((int)((val-0.8)*2.5*nrows))*ncols] = 16; - } - val -= DELTA_2*2; - if (val >=0.8 && val <1.2) { - if (img2[i+((int)((val-0.8)*2.5*nrows))*ncols] != 255) - img2[i+((int)((val-0.8)*2.5*nrows))*ncols] = 16; - } - } - - KLTExtractFeatureList(fl, ft, 0); - KLTWriteFeatureListToPPM(fl,img1,ncols,nrows,"/tmp/feat0.ppm"); - KLTExtractFeatureList(fl, ft, 1); - KLTWriteFeatureListToPPM(fl,img2,ncols,nrows,"/tmp/feat1.ppm"); -#endif - - // calculate deviation - for (i=0;i= 0 ? delta : -delta; - total_delta += delta; - } - - printf ("distortion amount=%lf scale=%lf deviation=%lf, rxy=%lf\n", a, b, total_delta/n, rxy); - - if (total_delta / new_n > DELTA_2) { - printf ("Deviation is too big.\n"); - return 0.0; - } - - if (rxy < RXY_LIMIT) { - printf ("Not linear enough\n"); - return 0.0; - } - - printf ("distortion amount=%lf scale=%lf deviation=%lf, rxy=%lf\n", a, b, total_delta/n, rxy); - return a; -} - diff --git a/rtengine/calc_distort.h b/rtengine/calc_distort.h index 0e869d65e..580c8915b 100644 --- a/rtengine/calc_distort.h +++ b/rtengine/calc_distort.h @@ -1,6 +1,4 @@ #ifndef CALC_DISTORTION__H #define CALC_DISTORTION__H -extern "C" { double calcDistortion (unsigned char* img1, unsigned char* img2, int ncols, int nrows); -} #endif diff --git a/rtengine/cfa_linedn_RT.cc b/rtengine/cfa_linedn_RT.cc index d49b53f74..37ad193f0 100644 --- a/rtengine/cfa_linedn_RT.cc +++ b/rtengine/cfa_linedn_RT.cc @@ -28,16 +28,16 @@ #define CLASS /* -#include -#include +#include +#include #include -#include -#include -#include -#include -#include -#include */ -#include +#include +#include +#include +#include +#include +#include */ +#include //#include "shrtdct_float.c" diff --git a/rtengine/colorclip.h b/rtengine/colorclip.h index e939a606c..b81c35bc3 100644 --- a/rtengine/colorclip.h +++ b/rtengine/colorclip.h @@ -21,7 +21,7 @@ inline double tightestroot (double L, double a, double b, double r1, double r2, #ifndef __COLORCLIP__ #define __COLORCLIP__ -#include +#include #include "median.h" // gives back the tightest >0 amplification by which color clipping occures diff --git a/rtengine/colortemp.cc b/rtengine/colortemp.cc index 4bb27d709..ab3efa371 100644 --- a/rtengine/colortemp.cc +++ b/rtengine/colortemp.cc @@ -16,11 +16,11 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include -#include +#include "colortemp.h" +#include "iccmatrices.h" +#include "rtengine.h" +#include "improcfun.h" +#include "curves.h" namespace rtengine { diff --git a/rtengine/colortemp.h b/rtengine/colortemp.h index 412e725d9..9a5a6c4c5 100644 --- a/rtengine/colortemp.h +++ b/rtengine/colortemp.h @@ -20,7 +20,7 @@ #define _COLORTEMP_ #include -#include +#include namespace rtengine { diff --git a/rtengine/cubic.cc b/rtengine/cubic.cc index 0f7eae483..3354f3c9d 100644 --- a/rtengine/cubic.cc +++ b/rtengine/cubic.cc @@ -20,7 +20,7 @@ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include +#include #define FLOAT float diff --git a/rtengine/curves.cc b/rtengine/curves.cc index 27fec7a69..71fe779e9 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -18,11 +18,11 @@ */ #include #include -#include -#include +#include "curves.h" +#include #include -#include -#include +#include "mytime.h" +#include #include "array2D.h" #include "LUT.h" diff --git a/rtengine/curves.h b/rtengine/curves.h index 10e849d92..eedac21f8 100644 --- a/rtengine/curves.h +++ b/rtengine/curves.h @@ -22,10 +22,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include "../rtgui/mycurve.h" +#include "../rtgui/myflatcurve.h" +#include "../rtgui/mydiagonalcurve.h" #include "LUT.h" diff --git a/rtengine/dcraw.c b/rtengine/dcraw.c index d28ff5b21..79b64e481 100644 --- a/rtengine/dcraw.c +++ b/rtengine/dcraw.c @@ -29,17 +29,17 @@ #define _GNU_SOURCE #endif #define _USE_MATH_DEFINES -#include -#include +#include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #ifdef NODEPS diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index 683249b31..649830aff 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -40,17 +40,17 @@ #define _GNU_SOURCE #endif #define _USE_MATH_DEFINES -#include -#include +#include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #ifdef NODEPS diff --git a/rtengine/dcraw.h b/rtengine/dcraw.h index 1262bbd95..fc8de6f86 100644 --- a/rtengine/dcraw.h +++ b/rtengine/dcraw.h @@ -20,8 +20,8 @@ #ifndef DCRAW_H #define DCRAW_H -#include -#include +#include "myfile.h" +#include class DCraw diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 845f0214e..a44b40d93 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -16,10 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include +#include "dcrop.h" +#include "curves.h" +#include "mytime.h" +#include "refreshmap.h" #define CLIPTO(a,b,c) ((a)>b?((a) 0)) diff --git a/rtengine/dcrop.h b/rtengine/dcrop.h index be53bdfee..f11179dc3 100644 --- a/rtengine/dcrop.h +++ b/rtengine/dcrop.h @@ -19,13 +19,13 @@ #ifndef _CROP_H_ #define _CROP_H_ -#include -#include -#include -#include -#include -#include -#include +#include "improccoordinator.h" +#include "rtengine.h" +#include "improcfun.h" +#include "image8.h" +#include "image16.h" +#include "imagesource.h" +#include "procevents.h" namespace rtengine { diff --git a/rtengine/demosaic_algos.cc b/rtengine/demosaic_algos.cc index dc027a8b2..b44f7724b 100644 --- a/rtengine/demosaic_algos.cc +++ b/rtengine/demosaic_algos.cc @@ -16,19 +16,19 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "rawimagesource.h" +#include "rawimagesource_i.h" +#include "median.h" +#include "rawimage.h" +#include +#include "mytime.h" +#include "iccmatrices.h" +#include "iccstore.h" +#include "image8.h" +#include "curves.h" +#include "dfmanager.h" +#include "slicer.h" +#include #ifdef _OPENMP #include diff --git a/rtengine/dfmanager.cc b/rtengine/dfmanager.cc index 3b9882f4f..f49668e0d 100644 --- a/rtengine/dfmanager.cc +++ b/rtengine/dfmanager.cc @@ -16,16 +16,16 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include +#include "dfmanager.h" +#include "../rtgui/options.h" #include -#include -#include -#include +#include "../rtgui/guiutils.h" +#include "safegtk.h" +#include "rawimage.h" #include #include -#include -#include +#include +#include "imagedata.h" namespace rtengine{ diff --git a/rtengine/dfmanager.h b/rtengine/dfmanager.h index 9d2b2a53f..3a171b714 100644 --- a/rtengine/dfmanager.h +++ b/rtengine/dfmanager.h @@ -19,8 +19,8 @@ #include #include #include -#include -#include +#include +#include "rawimage.h" namespace rtengine{ diff --git a/rtengine/diagonalcurves.cc b/rtengine/diagonalcurves.cc index 5f1632c84..1cedcb794 100644 --- a/rtengine/diagonalcurves.cc +++ b/rtengine/diagonalcurves.cc @@ -18,11 +18,11 @@ */ #include #include -#include -#include +#include "curves.h" +#include #include -#include -#include +#include "mytime.h" +#include #define CLIPD(a) ((a)>0.0?((a)<1.0?(a):1.0):0.0) diff --git a/rtengine/dirpyrLab_denoise.cc b/rtengine/dirpyrLab_denoise.cc index 5aec19fc1..805df38dc 100644 --- a/rtengine/dirpyrLab_denoise.cc +++ b/rtengine/dirpyrLab_denoise.cc @@ -14,17 +14,17 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . * - * © 2010 Emil Martinec + * � 2010 Emil Martinec * */ -//#include +//#include "rtengine.h" #include -#include -#include -#include -#include -#include +#include +#include "curves.h" +#include "labimage.h" +#include "improcfun.h" +#include "array2D.h" #ifdef _OPENMP #include diff --git a/rtengine/dirpyrLab_equalizer.cc b/rtengine/dirpyrLab_equalizer.cc index 307ac341c..8462f5d7b 100644 --- a/rtengine/dirpyrLab_equalizer.cc +++ b/rtengine/dirpyrLab_equalizer.cc @@ -18,13 +18,13 @@ * */ -//#include +//#include "rtengine.h" #include -#include -#include -#include -#include -#include +#include +#include "curves.h" +#include "labimage.h" +#include "improcfun.h" +#include "rawimagesource.h" #ifdef _OPENMP #include diff --git a/rtengine/dirpyr_equalizer.cc b/rtengine/dirpyr_equalizer.cc index 69c69a362..684cefdcf 100644 --- a/rtengine/dirpyr_equalizer.cc +++ b/rtengine/dirpyr_equalizer.cc @@ -18,14 +18,14 @@ * */ -//#include +//#include "rtengine.h" #include -#include -#include -#include -#include -#include -#include +#include +#include "curves.h" +#include "labimage.h" +#include "improcfun.h" +#include "rawimagesource.h" +#include "array2D.h" #ifdef _OPENMP #include diff --git a/rtengine/ex1simple.cc b/rtengine/ex1simple.cc index 22cb16487..97aecb2cd 100644 --- a/rtengine/ex1simple.cc +++ b/rtengine/ex1simple.cc @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "rtengine.h" #include //#include #include diff --git a/rtengine/ex2simple.cc b/rtengine/ex2simple.cc index 032993151..ed6b68f76 100644 --- a/rtengine/ex2simple.cc +++ b/rtengine/ex2simple.cc @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "rtengine.h" #include //#include #include diff --git a/rtengine/ffmanager.cc b/rtengine/ffmanager.cc index d59f6117f..a07a3c9a9 100644 --- a/rtengine/ffmanager.cc +++ b/rtengine/ffmanager.cc @@ -16,15 +16,15 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include +#include "ffmanager.h" +#include "../rtgui/options.h" #include -#include -#include -#include +#include "../rtgui/guiutils.h" +#include "safegtk.h" +#include "rawimage.h" #include -#include -#include +#include +#include "imagedata.h" namespace rtengine{ diff --git a/rtengine/ffmanager.h b/rtengine/ffmanager.h index 9be96c3e4..25581a061 100644 --- a/rtengine/ffmanager.h +++ b/rtengine/ffmanager.h @@ -19,8 +19,8 @@ #include #include #include -#include -#include +#include +#include "rawimage.h" namespace rtengine{ diff --git a/rtengine/flatcurves.cc b/rtengine/flatcurves.cc index e0fd5da9b..d02b9ca17 100644 --- a/rtengine/flatcurves.cc +++ b/rtengine/flatcurves.cc @@ -18,11 +18,11 @@ */ #include #include -#include -#include +#include "curves.h" +#include #include -#include -#include +#include "mytime.h" +#include #include #include diff --git a/rtengine/gauss.h b/rtengine/gauss.h index f09613c7d..725455463 100644 --- a/rtengine/gauss.h +++ b/rtengine/gauss.h @@ -19,10 +19,10 @@ #ifndef _GAUSS_H_ #define _GAUSS_H_ -#include -#include -#include -#include +#include +#include +#include +#include "alignedbuffer.h" #ifdef _OPENMP #include #endif diff --git a/rtengine/green_equil_RT.cc b/rtengine/green_equil_RT.cc index 5a6c44340..aaf476a6e 100644 --- a/rtengine/green_equil_RT.cc +++ b/rtengine/green_equil_RT.cc @@ -23,9 +23,9 @@ //////////////////////////////////////////////////////////////// #define TS 256 // Tile size -#include -#include -#include +#include +#include +#include #define SQR(x) ((x)*(x)) diff --git a/rtengine/hilite_recon.cc b/rtengine/hilite_recon.cc index 5d7019443..72a78c091 100644 --- a/rtengine/hilite_recon.cc +++ b/rtengine/hilite_recon.cc @@ -22,13 +22,13 @@ // //////////////////////////////////////////////////////////////// -//#include +//#include "rtengine.h" #include -#include -#include -#include -#include -#include +#include +#include "curves.h" +#include "array2D.h" +#include "improcfun.h" +#include "rawimagesource.h" //#include "stack1.h" diff --git a/rtengine/hlmultipliers.cc b/rtengine/hlmultipliers.cc index 99b329798..70ff34b92 100644 --- a/rtengine/hlmultipliers.cc +++ b/rtengine/hlmultipliers.cc @@ -16,11 +16,11 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include -#include +#include +#include +#include "rawimagesource.h" +#include "rawimagesource_i.h" +#include "../rtgui/options.h" #define MAXVAL 0xffff #define CLIP(a) ((a)>0?((a) /* define malloc() */ - - -/* - * Since an ICC profile can be larger than the maximum size of a JPEG marker - * (64K), we need provisions to split it into multiple markers. The format - * defined by the ICC specifies one or more APP2 markers containing the - * following data: - * Identifying string ASCII "ICC_PROFILE\0" (12 bytes) - * Marker sequence number 1 for first APP2, 2 for next, etc (1 byte) - * Number of markers Total number of APP2's used (1 byte) - * Profile data (remainder of APP2 data) - * Decoders should use the marker sequence numbers to reassemble the profile, - * rather than assuming that the APP2 markers appear in the correct sequence. - */ - -#define ICC_MARKER (JPEG_APP0 + 2) /* JPEG marker code for ICC */ -#define ICC_OVERHEAD_LEN 14 /* size of non-profile data in APP2 */ -#define MAX_BYTES_IN_MARKER 65533 /* maximum data len of a JPEG marker */ -#define MAX_DATA_BYTES_IN_MARKER (MAX_BYTES_IN_MARKER - ICC_OVERHEAD_LEN) - - -/* - * This routine writes the given ICC profile data into a JPEG file. - * It *must* be called AFTER calling jpeg_start_compress() and BEFORE - * the first call to jpeg_write_scanlines(). - * (This ordering ensures that the APP2 marker(s) will appear after the - * SOI and JFIF or Adobe markers, but before all else.) - */ - -void -write_icc_profile (j_compress_ptr cinfo, - const JOCTET *icc_data_ptr, - unsigned int icc_data_len) -{ - unsigned int num_markers; /* total number of markers we'll write */ - int cur_marker = 1; /* per spec, counting starts at 1 */ - unsigned int length; /* number of bytes to write in this marker */ - - /* Calculate the number of markers we'll need, rounding up of course */ - num_markers = icc_data_len / MAX_DATA_BYTES_IN_MARKER; - if (num_markers * MAX_DATA_BYTES_IN_MARKER != icc_data_len) - num_markers++; - - while (icc_data_len > 0) { - /* length of profile to put in this marker */ - length = icc_data_len; - if (length > MAX_DATA_BYTES_IN_MARKER) - length = MAX_DATA_BYTES_IN_MARKER; - icc_data_len -= length; - - /* Write the JPEG marker header (APP2 code and marker length) */ - jpeg_write_m_header(cinfo, ICC_MARKER, - (unsigned int) (length + ICC_OVERHEAD_LEN)); - - /* Write the marker identifying string "ICC_PROFILE" (null-terminated). - * We code it in this less-than-transparent way so that the code works - * even if the local character set is not ASCII. - */ - jpeg_write_m_byte(cinfo, 0x49); - jpeg_write_m_byte(cinfo, 0x43); - jpeg_write_m_byte(cinfo, 0x43); - jpeg_write_m_byte(cinfo, 0x5F); - jpeg_write_m_byte(cinfo, 0x50); - jpeg_write_m_byte(cinfo, 0x52); - jpeg_write_m_byte(cinfo, 0x4F); - jpeg_write_m_byte(cinfo, 0x46); - jpeg_write_m_byte(cinfo, 0x49); - jpeg_write_m_byte(cinfo, 0x4C); - jpeg_write_m_byte(cinfo, 0x45); - jpeg_write_m_byte(cinfo, 0x0); - - /* Add the sequencing info */ - jpeg_write_m_byte(cinfo, cur_marker); - jpeg_write_m_byte(cinfo, (int) num_markers); - - /* Add the profile data */ - while (length--) { - jpeg_write_m_byte(cinfo, *icc_data_ptr); - icc_data_ptr++; - } - cur_marker++; - } -} - - -/* - * Prepare for reading an ICC profile - */ - -void -setup_read_icc_profile (j_decompress_ptr cinfo) -{ - /* Tell the library to keep any APP2 data it may find */ - jpeg_save_markers(cinfo, ICC_MARKER, 0xFFFF); -} - - -/* - * Handy subroutine to test whether a saved marker is an ICC profile marker. - */ -static boolean -marker_is_icc (jpeg_saved_marker_ptr marker) -{ - return - marker->marker == ICC_MARKER && - marker->data_length >= ICC_OVERHEAD_LEN && - /* verify the identifying string */ - GETJOCTET(marker->data[0]) == 0x49 && - GETJOCTET(marker->data[1]) == 0x43 && - GETJOCTET(marker->data[2]) == 0x43 && - GETJOCTET(marker->data[3]) == 0x5F && - GETJOCTET(marker->data[4]) == 0x50 && - GETJOCTET(marker->data[5]) == 0x52 && - GETJOCTET(marker->data[6]) == 0x4F && - GETJOCTET(marker->data[7]) == 0x46 && - GETJOCTET(marker->data[8]) == 0x49 && - GETJOCTET(marker->data[9]) == 0x4C && - GETJOCTET(marker->data[10]) == 0x45 && - GETJOCTET(marker->data[11]) == 0x0; -} - - -/* - * See if there was an ICC profile in the JPEG file being read; - * if so, reassemble and return the profile data. - * - * TRUE is returned if an ICC profile was found, FALSE if not. - * If TRUE is returned, *icc_data_ptr is set to point to the - * returned data, and *icc_data_len is set to its length. - * - * IMPORTANT: the data at **icc_data_ptr has been allocated with malloc() - * and must be freed by the caller with free() when the caller no longer - * needs it. (Alternatively, we could write this routine to use the - * IJG library's memory allocator, so that the data would be freed implicitly - * at jpeg_finish_decompress() time. But it seems likely that many apps - * will prefer to have the data stick around after decompression finishes.) - * - * NOTE: if the file contains invalid ICC APP2 markers, we just silently - * return FALSE. You might want to issue an error message instead. - */ - -boolean -read_icc_profile (j_decompress_ptr cinfo, - JOCTET **icc_data_ptr, - unsigned int *icc_data_len) -{ - jpeg_saved_marker_ptr marker; - int num_markers = 0; - int seq_no; - JOCTET *icc_data; - unsigned int total_length; -#define MAX_SEQ_NO 255 /* sufficient since marker numbers are bytes */ - char marker_present[MAX_SEQ_NO+1]; /* 1 if marker found */ - unsigned int data_length[MAX_SEQ_NO+1]; /* size of profile data in marker */ - unsigned int data_offset[MAX_SEQ_NO+1]; /* offset for data in marker */ - - *icc_data_ptr = NULL; /* avoid confusion if FALSE return */ - *icc_data_len = 0; - - /* This first pass over the saved markers discovers whether there are - * any ICC markers and verifies the consistency of the marker numbering. - */ - - for (seq_no = 1; seq_no <= MAX_SEQ_NO; seq_no++) - marker_present[seq_no] = 0; - - for (marker = cinfo->marker_list; marker != NULL; marker = marker->next) { - if (marker_is_icc(marker)) { - if (num_markers == 0) - num_markers = GETJOCTET(marker->data[13]); - else if (num_markers != GETJOCTET(marker->data[13])) - return FALSE; /* inconsistent num_markers fields */ - seq_no = GETJOCTET(marker->data[12]); - if (seq_no <= 0 || seq_no > num_markers) - return FALSE; /* bogus sequence number */ - if (marker_present[seq_no]) - return FALSE; /* duplicate sequence numbers */ - marker_present[seq_no] = 1; - data_length[seq_no] = marker->data_length - ICC_OVERHEAD_LEN; - } - } - - if (num_markers == 0) - return FALSE; - - /* Check for missing markers, count total space needed, - * compute offset of each marker's part of the data. - */ - - total_length = 0; - for (seq_no = 1; seq_no <= num_markers; seq_no++) { - if (marker_present[seq_no] == 0) - return FALSE; /* missing sequence number */ - data_offset[seq_no] = total_length; - total_length += data_length[seq_no]; - } - - if (total_length <= 0) - return FALSE; /* found only empty markers? */ - - /* Allocate space for assembled data */ - icc_data = (JOCTET *) malloc(total_length * sizeof(JOCTET)); - if (icc_data == NULL) - return FALSE; /* oops, out of memory */ - - /* and fill it in */ - for (marker = cinfo->marker_list; marker != NULL; marker = marker->next) { - if (marker_is_icc(marker)) { - JOCTET FAR *src_ptr; - JOCTET *dst_ptr; - unsigned int length; - seq_no = GETJOCTET(marker->data[12]); - dst_ptr = icc_data + data_offset[seq_no]; - src_ptr = marker->data + ICC_OVERHEAD_LEN; - length = data_length[seq_no]; - while (length--) { - *dst_ptr++ = *src_ptr++; - } - } - } - - *icc_data_ptr = icc_data; - *icc_data_len = total_length; - - return TRUE; -} - diff --git a/rtengine/iccjpeg.h b/rtengine/iccjpeg.h index c5bbda6f3..d7cae7b5d 100644 --- a/rtengine/iccjpeg.h +++ b/rtengine/iccjpeg.h @@ -16,7 +16,7 @@ * for details. */ -#include /* needed to define "FILE", "NULL" */ +#include /* needed to define "FILE", "NULL" */ #include "jpeglib.h" diff --git a/rtengine/iccstore.cc b/rtengine/iccstore.cc index 8217fa03b..56af58223 100644 --- a/rtengine/iccstore.cc +++ b/rtengine/iccstore.cc @@ -16,16 +16,16 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "iccstore.h" #ifdef WIN32 #include #else #include #endif -#include +#include "iccmatrices.h" #include -#include -#include +#include "safegtk.h" +#include "../rtgui/options.h" #include @@ -67,10 +67,10 @@ std::vector ICCStore::getOutputProfiles () { std::vector res; for (std::map::iterator i=fileProfiles.begin(); i!=fileProfiles.end(); i++){ std::string name(i->first); - std::string::size_type i = name.find_last_of('/'); - if( i == std::string::npos ) - i = name.find_last_of('\\'); - if( i == std::string::npos ) + std::string::size_type i2 = name.find_last_of('/'); + if( i2 == std::string::npos ) + i2 = name.find_last_of('\\'); + if( i2 == std::string::npos ) res.push_back ( name ); // list only profiles inside selected profiles directory } return res; diff --git a/rtengine/image16.cc b/rtengine/image16.cc index 3b3fadc44..dbcc08612 100644 --- a/rtengine/image16.cc +++ b/rtengine/image16.cc @@ -16,12 +16,12 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include -#include -#include +#include "image16.h" +#include "imagefloat.h" +#include "image8.h" +#include +#include +#include "rtengine.h" using namespace rtengine; diff --git a/rtengine/image16.h b/rtengine/image16.h index 3f22b1ed6..624410de9 100644 --- a/rtengine/image16.h +++ b/rtengine/image16.h @@ -22,9 +22,9 @@ #ifndef _IMAGE16_ #define _IMAGE16_ -#include -#include -#include +#include "imageio.h" +#include "rtengine.h" +#include "imagefloat.h" namespace rtengine { diff --git a/rtengine/image8.cc b/rtengine/image8.cc index 1600c0b1c..87bfd42df 100644 --- a/rtengine/image8.cc +++ b/rtengine/image8.cc @@ -16,10 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include +#include +#include +#include "image8.h" +#include "rtengine.h" using namespace rtengine; diff --git a/rtengine/image8.h b/rtengine/image8.h index 629cc8f0b..195846dc3 100644 --- a/rtengine/image8.h +++ b/rtengine/image8.h @@ -22,8 +22,8 @@ #ifndef _IMAGE8_ #define _IMAGE8_ -#include -#include +#include "imageio.h" +#include "rtengine.h" namespace rtengine { diff --git a/rtengine/imagedata.cc b/rtengine/imagedata.cc index ca326d926..03822ddfc 100644 --- a/rtengine/imagedata.cc +++ b/rtengine/imagedata.cc @@ -16,10 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include +#include "imagedata.h" +#include "iptcpairs.h" #include -#include +#include "safegtk.h" #ifndef GLIBMM_EXCEPTIONS_ENABLED #include diff --git a/rtengine/imagedata.h b/rtengine/imagedata.h index 59b63b198..cf58a9890 100644 --- a/rtengine/imagedata.h +++ b/rtengine/imagedata.h @@ -19,14 +19,14 @@ #ifndef __IMAGEDATA_H__ #define __IMAGEDATA_H__ -#include -#include +#include +#include "rawimage.h" #include #include -#include -#include +#include "../rtexif/rtexif.h" +#include "procparams.h" #include -#include +#include "rtengine.h" namespace rtengine { diff --git a/rtengine/imagefloat.cc b/rtengine/imagefloat.cc index 5fb02d6f4..0fc44dbfe 100644 --- a/rtengine/imagefloat.cc +++ b/rtengine/imagefloat.cc @@ -16,13 +16,13 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include -#include -#include -#include +#include "imagefloat.h" +#include "image16.h" +#include "image8.h" +#include +#include "rtengine.h" +#include "mytime.h" +#include "iccstore.h" using namespace rtengine; diff --git a/rtengine/imagefloat.h b/rtengine/imagefloat.h index 011378ed0..e51e865e0 100644 --- a/rtengine/imagefloat.h +++ b/rtengine/imagefloat.h @@ -22,8 +22,8 @@ #ifndef _IMAGEFLOAT_ #define _IMAGEFLOAT_ -#include -#include +#include "imageio.h" +#include "rtengine.h" namespace rtengine { using namespace procparams; diff --git a/rtengine/imageio.cc b/rtengine/imageio.cc index 172bcbe61..33a2fe475 100644 --- a/rtengine/imageio.cc +++ b/rtengine/imageio.cc @@ -19,24 +19,23 @@ */ #include #include -#include -#include +#include "imageio.h" +#include "safegtk.h" #include #include -#include -#include +#include +#include #include #ifdef WIN32 #include #else #include #endif -#include +#include "iptcpairs.h" #include -extern "C" { -#include -} +#include "iccjpeg.h" + #include "jpeg.h" Glib::ustring safe_locale_to_utf8 (const std::string& src); @@ -365,12 +364,12 @@ int ImageIO::loadJPEG (Glib::ustring fname) { //jpeg_stdio_src(&cinfo,file); jpeg_read_header(&cinfo, TRUE); - - //if JPEG is CMYK, then abort reading - if (cinfo.jpeg_color_space == JCS_CMYK || cinfo.jpeg_color_space == JCS_YCCK) { + + //if JPEG is CMYK, then abort reading + if (cinfo.jpeg_color_space == JCS_CMYK || cinfo.jpeg_color_space == JCS_YCCK) { jpeg_destroy_decompress(&cinfo); - return IMIO_READERROR; - } + return IMIO_READERROR; + } unsigned int proflen; delete loadedProfileData; diff --git a/rtengine/imageio.h b/rtengine/imageio.h index 9d2a509ec..8c01354af 100644 --- a/rtengine/imageio.h +++ b/rtengine/imageio.h @@ -27,11 +27,11 @@ #define IMIO_VARIANTNOTSUPPORTED 5 #define IMIO_FILETYPENOTSUPPORTED 6 -#include +#include "rtengine.h" #include -#include +#include "procparams.h" #include -#include +#include "../rtexif/rtexif.h" namespace rtengine { diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index 757c6f1ca..6a1ade221 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -19,15 +19,15 @@ #ifndef _IMAGESOURCE_ #define _IMAGESOURCE_ -#include -#include +#include "rtengine.h" +#include "colortemp.h" #include -#include -#include -#include -#include +#include "image16.h" +#include "imagefloat.h" +#include "procparams.h" +#include "coord2d.h" #include -#include +#include "imagedata.h" #include "LUT.h" namespace rtengine { diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 8eeece861..fd376550b 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -16,12 +16,12 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include -#include -#include "ppversion.h" +#include "improccoordinator.h" +#include "curves.h" +#include "mytime.h" +#include "refreshmap.h" +#include "simpleprocess.h" +#include "../rtgui/ppversion.h" #define CLIPTO(a,b,c) ((a)>b?((a)0?((a)<65535?(a):65535):0) diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index e77807b52..089517d6b 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -19,13 +19,13 @@ #ifndef _IMPROCCOORDINATOR_H_ #define _IMPROCCOORDINATOR_H_ -#include -#include -#include -#include -#include -#include -#include +#include "rtengine.h" +#include "improcfun.h" +#include "image8.h" +#include "image16.h" +#include "imagesource.h" +#include "procevents.h" +#include "dcrop.h" #include "LUT.h" namespace rtengine { diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 77f00b8ae..6d9576d16 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -16,24 +16,24 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "rtengine.h" +#include "improcfun.h" +#include "curves.h" +#include +#include "colorclip.h" +#include "gauss.h" +#include "bilateral2.h" +#include "minmax.h" +#include "mytime.h" #include #include -#include -#include -#include -#include -#include -#include - +#include "iccstore.h" +#include "impulse_denoise.h" +#include "imagesource.h" +#include "rtthumbnail.h" +#include "../rtengine/utils.h" +#include "iccmatrices.h" +#include "calc_distort.h" #ifdef _OPENMP #include @@ -859,8 +859,6 @@ fclose(f);*/ //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - #include "calc_distort.h" - double ImProcFunctions::getAutoDistor (const Glib::ustring &fname, int thumb_size) { if (fname != "") { rtengine::RawMetaDataLocation ri; diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 641c6f495..c96ab3f13 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -19,13 +19,13 @@ #ifndef _IMPROCFUN_H_ #define _IMPROCFUN_H_ -#include -#include -#include -#include -#include -#include -#include +#include "imagefloat.h" +#include "image16.h" +#include "image8.h" +#include "procparams.h" +#include "shmap.h" +#include "coord2d.h" +#include "labimage.h" #include "LUT.h" namespace rtengine { diff --git a/rtengine/impulse_denoise.h b/rtengine/impulse_denoise.h index 01b9d7106..0d3c8fe7c 100644 --- a/rtengine/impulse_denoise.h +++ b/rtengine/impulse_denoise.h @@ -22,8 +22,8 @@ #include #include -#include -#include +#include "labimage.h" +#include "improcfun.h" namespace rtengine { diff --git a/rtengine/init.cc b/rtengine/init.cc index 977c7b7f1..597acb075 100644 --- a/rtengine/init.cc +++ b/rtengine/init.cc @@ -16,14 +16,14 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include -#include -#include -#include -#include +#include "rtengine.h" +#include "iccstore.h" +#include "improcfun.h" +#include "improccoordinator.h" +#include "curves.h" +#include "dfmanager.h" +#include "ffmanager.h" +#include "rtthumbnail.h" namespace rtengine { diff --git a/rtengine/iplab2rgb.cc b/rtengine/iplab2rgb.cc index 6f67bd6bf..e3e2e5950 100644 --- a/rtengine/iplab2rgb.cc +++ b/rtengine/iplab2rgb.cc @@ -16,16 +16,16 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include +#include "rtengine.h" +#include "improcfun.h" #include -#include -#include -#include -#include -#include -#include -#include +#include "iccstore.h" +#include "iccmatrices.h" +#include "mytime.h" +#include "../rtgui/icmpanel.h" +#include "../rtgui/options.h" +#include "settings.h" +#include "curves.h" #ifdef _OPENMP diff --git a/rtengine/ipsharpen.cc b/rtengine/ipsharpen.cc index 706dab598..3c1fca5cc 100644 --- a/rtengine/ipsharpen.cc +++ b/rtengine/ipsharpen.cc @@ -16,14 +16,14 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include +#include "rtengine.h" +#include "improcfun.h" #ifdef _OPENMP #include #endif -#include -#include -#include +#include "minmax.h" +#include "gauss.h" +#include "bilateral2.h" namespace rtengine { diff --git a/rtengine/iptransform.cc b/rtengine/iptransform.cc index 2656a8390..e2d12e039 100644 --- a/rtengine/iptransform.cc +++ b/rtengine/iptransform.cc @@ -16,12 +16,12 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include +#include "rtengine.h" +#include "improcfun.h" #ifdef _OPENMP #include #endif -#include +#include "mytime.h" namespace rtengine { diff --git a/rtengine/ipvibrance.cc b/rtengine/ipvibrance.cc index 04441dd50..22aa82de9 100644 --- a/rtengine/ipvibrance.cc +++ b/rtengine/ipvibrance.cc @@ -17,10 +17,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include +#include "rtengine.h" +#include "improcfun.h" +#include "iccstore.h" +#include "mytime.h" #ifdef _OPENMP #include diff --git a/rtengine/jdatasrc.c b/rtengine/jdatasrc.c deleted file mode 100644 index c30c4c37a..000000000 --- a/rtengine/jdatasrc.c +++ /dev/null @@ -1,411 +0,0 @@ -#include -#include -#include -#include "jpeg.h" - -/* - * jdatasrc.c - * - * Copyright (C) 1994-1996, Thomas G. Lane. - * Modified 2009-2010 by Guido Vollbeding. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains decompression data source routines for the case of - * reading JPEG data from a file (or any stdio stream). While these routines - * are sufficient for most applications, some will want to use a different - * source manager. - * IMPORTANT: we assume that fread() will correctly transcribe an array of - * JOCTETs from 8-bit-wide elements on external storage. If char is wider - * than 8 bits on your machine, you may need to do some tweaking. - */ - -/* this is not a core library module, so it doesn't define JPEG_INTERNALS */ -//#include "jinclude.h" - -#define JFREAD(file,buf,sizeofbuf) \ - ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) -#define JFWRITE(file,buf,sizeofbuf) \ - ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) - - - - -/* Expanded data source object for stdio input */ - -typedef struct { - struct jpeg_source_mgr pub; /* public fields */ - jmp_buf error_jmp_buf; /* error handler for this instance */ - - FILE * infile; /* source stream */ - JOCTET * buffer; /* start of buffer */ - boolean start_of_file; /* have we gotten any data yet? */ -} my_source_mgr; - -typedef my_source_mgr * my_src_ptr; - -#define INPUT_BUF_SIZE 4096 /* choose an efficiently fread'able size */ - - -/* - * Initialize source --- called by jpeg_read_header - * before any data is actually read. - */ - -METHODDEF(void) -my_init_source (j_decompress_ptr cinfo) -{ - my_src_ptr src = (my_src_ptr) cinfo->src; - - /* We reset the empty-input-file flag for each image, - * but we don't clear the input buffer. - * This is correct behavior for reading a series of images from one source. - */ - src->start_of_file = TRUE; -} - - -/* - * Fill the input buffer --- called whenever buffer is emptied. - * - * In typical applications, this should read fresh data into the buffer - * (ignoring the current state of next_input_byte & bytes_in_buffer), - * reset the pointer & count to the start of the buffer, and return TRUE - * indicating that the buffer has been reloaded. It is not necessary to - * fill the buffer entirely, only to obtain at least one more byte. - * - * There is no such thing as an EOF return. If the end of the file has been - * reached, the routine has a choice of ERREXIT() or inserting fake data into - * the buffer. In most cases, generating a warning message and inserting a - * fake EOI marker is the best course of action --- this will allow the - * decompressor to output however much of the image is there. However, - * the resulting error message is misleading if the real problem is an empty - * input file, so we handle that case specially. - * - * In applications that need to be able to suspend compression due to input - * not being available yet, a FALSE return indicates that no more data can be - * obtained right now, but more may be forthcoming later. In this situation, - * the decompressor will return to its caller (with an indication of the - * number of scanlines it has read, if any). The application should resume - * decompression after it has loaded more data into the input buffer. Note - * that there are substantial restrictions on the use of suspension --- see - * the documentation. - * - * When suspending, the decompressor will back up to a convenient restart point - * (typically the start of the current MCU). next_input_byte & bytes_in_buffer - * indicate where the restart point will be if the current call returns FALSE. - * Data beyond this point must be rescanned after resumption, so move it to - * the front of the buffer rather than discarding it. - */ - -METHODDEF(boolean) -my_fill_input_buffer (j_decompress_ptr cinfo) -{ - my_src_ptr src = (my_src_ptr) cinfo->src; - size_t nbytes; - - nbytes = JFREAD(src->infile, src->buffer, INPUT_BUF_SIZE); - - if (nbytes <= 0) { - if (src->start_of_file) /* Treat empty input file as fatal error */ - ERREXIT(cinfo, JERR_INPUT_EMPTY); - WARNMS(cinfo, JWRN_JPEG_EOF); - /* Insert a fake EOI marker */ - src->buffer[0] = (JOCTET) 0xFF; - src->buffer[1] = (JOCTET) JPEG_EOI; - nbytes = 2; - } - - if (src->start_of_file) - src->buffer[0] = (JOCTET) 0xFF; - - src->pub.next_input_byte = src->buffer; - src->pub.bytes_in_buffer = nbytes; - src->start_of_file = FALSE; - - return TRUE; -} - - -/* - * Skip data --- used to skip over a potentially large amount of - * uninteresting data (such as an APPn marker). - * - * Writers of suspendable-input applications must note that skip_input_data - * is not granted the right to give a suspension return. If the skip extends - * beyond the data currently in the buffer, the buffer can be marked empty so - * that the next read will cause a fill_input_buffer call that can suspend. - * Arranging for additional bytes to be discarded before reloading the input - * buffer is the application writer's problem. - */ - -METHODDEF(void) -my_skip_input_data (j_decompress_ptr cinfo, long num_bytes) -{ - my_src_ptr src = (my_src_ptr) cinfo->src; - - /* Just a dumb implementation for now. Could use fseek() except - * it doesn't work on pipes. Not clear that being smart is worth - * any trouble anyway --- large skips are infrequent. - */ - if (num_bytes > 0) { - while (num_bytes > (long) src->pub.bytes_in_buffer) { - num_bytes -= (long) src->pub.bytes_in_buffer; - (void) my_fill_input_buffer(cinfo); - /* note we assume that fill_input_buffer will never return FALSE, - * so suspension need not be handled. - */ - } - src->pub.next_input_byte += (size_t) num_bytes; - src->pub.bytes_in_buffer -= (size_t) num_bytes; - } -} - - -/* - * An additional method that can be provided by data source modules is the - * resync_to_restart method for error recovery in the presence of RST markers. - * For the moment, this source module just uses the default resync method - * provided by the JPEG library. That method assumes that no backtracking - * is possible. - */ - - -/* - * Terminate source --- called by jpeg_finish_decompress - * after all data has been read. Often a no-op. - * - * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding - * application must deal with any cleanup that should happen even - * for error exit. - */ - -METHODDEF(void) -my_term_source (j_decompress_ptr cinfo) -{ - /* no work necessary here */ -} - - -/* - * Prepare for input from a stdio stream. - * The caller must have already opened the stream, and is responsible - * for closing it after finishing decompression. - */ - -GLOBAL(void) -my_jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile) -{ - my_src_ptr src; - - /* The source object and input buffer are made permanent so that a series - * of JPEG images can be read from the same file by calling jpeg_stdio_src - * only before the first one. (If we discarded the buffer at the end of - * one image, we'd likely lose the start of the next one.) - * This makes it unsafe to use this manager and a different source - * manager serially with the same JPEG object. Caveat programmer. - */ - if (cinfo->src == NULL) { /* first time for this JPEG object? */ - cinfo->src = (struct jpeg_source_mgr *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - sizeof(my_source_mgr)); - src = (my_src_ptr) cinfo->src; - src->buffer = (JOCTET *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - INPUT_BUF_SIZE * sizeof(JOCTET)); - } - - src = (my_src_ptr) cinfo->src; - src->pub.init_source = my_init_source; - src->pub.fill_input_buffer = my_fill_input_buffer; - src->pub.skip_input_data = my_skip_input_data; - src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */ - src->pub.term_source = my_term_source; - src->infile = infile; - src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */ - src->pub.next_input_byte = NULL; /* until buffer loaded */ -} - -METHODDEF(void) -my_error_exit (j_common_ptr cinfo) -{ - /* Always display the message */ - (*cinfo->err->output_message) (cinfo); - - /* Let the memory manager delete any temp files before we die */ - //jpeg_destroy(cinfo); - - j_decompress_ptr dinfo = (j_decompress_ptr)cinfo; - longjmp (((rt_jpeg_error_mgr*)(dinfo->src))->error_jmp_buf, 1); -} - - -//const char * const jpeg_std_message_table[] = { -//#include "jerror.h" -// NULL -//}; -extern const char * const jpeg_std_message_table[]; - - -/* - * Actual output of an error or trace message. - * Applications may override this method to send JPEG messages somewhere - * other than stderr. - * - * On Windows, printing to stderr is generally completely useless, - * so we provide optional code to produce an error-dialog popup. - * Most Windows applications will still prefer to override this routine, - * but if they don't, it'll do something at least marginally useful. - * - * NOTE: to use the library in an environment that doesn't support the - * C stdio library, you may have to delete the call to fprintf() entirely, - * not just not use this routine. - */ - -METHODDEF(void) -output_message (j_common_ptr cinfo) -{ - char buffer[JMSG_LENGTH_MAX]; - - /* Create the message */ - (*cinfo->err->format_message) (cinfo, buffer); - -#ifdef USE_WINDOWS_MESSAGEBOX - /* Display it in a message dialog box */ - MessageBox(GetActiveWindow(), buffer, "JPEG Library Error", - MB_OK | MB_ICONERROR); -#else - /* Send it to stderr, adding a newline */ - fprintf(stderr, "%s\n", buffer); -#endif -} - - -/* - * Decide whether to emit a trace or warning message. - * msg_level is one of: - * -1: recoverable corrupt-data warning, may want to abort. - * 0: important advisory messages (always display to user). - * 1: first level of tracing detail. - * 2,3,...: successively more detailed tracing messages. - * An application might override this method if it wanted to abort on warnings - * or change the policy about which messages to display. - */ - -METHODDEF(void) -emit_message (j_common_ptr cinfo, int msg_level) -{ - struct jpeg_error_mgr * err = cinfo->err; - - if (msg_level < 0) { - /* It's a warning message. Since corrupt files may generate many warnings, - * the policy implemented here is to show only the first warning, - * unless trace_level >= 3. - */ - if (err->num_warnings == 0 || err->trace_level >= 3) - (*err->output_message) (cinfo); - /* Always count warnings in num_warnings. */ - err->num_warnings++; - } else { - /* It's a trace message. Show it if trace_level >= msg_level. */ - if (err->trace_level >= msg_level) - (*err->output_message) (cinfo); - } -} - - -/* - * Format a message string for the most recent JPEG error or message. - * The message is stored into buffer, which should be at least JMSG_LENGTH_MAX - * characters. Note that no '\n' character is added to the string. - * Few applications should need to override this method. - */ - -METHODDEF(void) -format_message (j_common_ptr cinfo, char * buffer) -{ - struct jpeg_error_mgr * err = cinfo->err; - int msg_code = err->msg_code; - const char * msgtext = NULL; - const char * msgptr; - char ch; - boolean isstring; - - /* Look up message string in proper table */ - if (msg_code > 0 && msg_code <= err->last_jpeg_message) { - msgtext = err->jpeg_message_table[msg_code]; - } else if (err->addon_message_table != NULL && - msg_code >= err->first_addon_message && - msg_code <= err->last_addon_message) { - msgtext = err->addon_message_table[msg_code - err->first_addon_message]; - } - - /* Defend against bogus message number */ - if (msgtext == NULL) { - err->msg_parm.i[0] = msg_code; - msgtext = err->jpeg_message_table[0]; - } - - /* Check for string parameter, as indicated by %s in the message text */ - isstring = FALSE; - msgptr = msgtext; - while ((ch = *msgptr++) != '\0') { - if (ch == '%') { - if (*msgptr == 's') isstring = TRUE; - break; - } - } - - /* Format the message into the passed buffer */ - if (isstring) - sprintf(buffer, msgtext, err->msg_parm.s); - else - sprintf(buffer, msgtext, - err->msg_parm.i[0], err->msg_parm.i[1], - err->msg_parm.i[2], err->msg_parm.i[3], - err->msg_parm.i[4], err->msg_parm.i[5], - err->msg_parm.i[6], err->msg_parm.i[7]); -} - - -/* - * Reset error state variables at start of a new image. - * This is called during compression startup to reset trace/error - * processing to default state, without losing any application-specific - * method pointers. An application might possibly want to override - * this method if it has additional error processing state. - */ - -METHODDEF(void) -reset_error_mgr (j_common_ptr cinfo) -{ - cinfo->err->num_warnings = 0; - /* trace_level is not reset since it is an application-supplied parameter */ - cinfo->err->msg_code = 0; /* may be useful as a flag for "no error" */ -} - - -GLOBAL(struct jpeg_error_mgr *) -my_jpeg_std_error (struct jpeg_error_mgr * err) -{ - - err->error_exit = my_error_exit; - err->emit_message = emit_message; - err->output_message = output_message; - err->format_message = format_message; - err->reset_error_mgr = reset_error_mgr; - - err->trace_level = 0; /* default = no tracing */ - err->num_warnings = 0; /* no warnings emitted yet */ - err->msg_code = 0; /* may be useful as a flag for "no error" */ - - /* Initialize message table pointers */ - err->jpeg_message_table = jpeg_std_message_table; - err->last_jpeg_message = (int) JMSG_LASTMSGCODE - 1; - - err->addon_message_table = NULL; - err->first_addon_message = 0; /* for safety */ - err->last_addon_message = 0; - - return err; -} diff --git a/rtengine/jpeg.h b/rtengine/jpeg.h index f709bb0d5..7e3dded10 100644 --- a/rtengine/jpeg.h +++ b/rtengine/jpeg.h @@ -1,7 +1,7 @@ #ifndef _RT_JPEG_H #define _RT_JPEG_H -#include +#include #ifdef __cplusplus extern "C" { diff --git a/rtengine/jpeg_memsrc.c b/rtengine/jpeg_memsrc.c deleted file mode 100644 index 4932b2f89..000000000 --- a/rtengine/jpeg_memsrc.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - * memsrc.c - * - * Copyright (C) 1994-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains decompression data source routines for the case of - * reading JPEG data from a memory buffer that is preloaded with the entire - * JPEG file. This would not seem especially useful at first sight, but - * a number of people have asked for it. - * This is really just a stripped-down version of jdatasrc.c. Comparison - * of this code with jdatasrc.c may be helpful in seeing how to make - * custom source managers for other purposes. - */ - -/* this is not a core library module, so it doesn't define JPEG_INTERNALS */ -//#include "jinclude.h" -//#include "jmorecfg.h" -//#include "jpeglib.h" -//#include "jerror.h" -#include -#include -#include -#include "jpeg.h" - - -/* Expanded data source object for memory input */ - -typedef struct { - struct jpeg_source_mgr pub; /* public fields */ - jmp_buf error_jmp_buf; /* error handler for this instance */ - - JOCTET eoi_buffer[2]; /* a place to put a dummy EOI */ -} my_source_mgr; - -typedef my_source_mgr * my_src_ptr; - - -/* - * Initialize source --- called by jpeg_read_header - * before any data is actually read. - */ - -static void -init_source (j_decompress_ptr cinfo) -{ - /* No work, since jpeg_memory_src set up the buffer pointer and count. - * Indeed, if we want to read multiple JPEG images from one buffer, - * this *must* not do anything to the pointer. - */ -} - - -/* - * Fill the input buffer --- called whenever buffer is emptied. - * - * In this application, this routine should never be called; if it is called, - * the decompressor has overrun the end of the input buffer, implying we - * supplied an incomplete or corrupt JPEG datastream. A simple error exit - * might be the most appropriate response. - * - * But what we choose to do in this code is to supply dummy EOI markers - * in order to force the decompressor to finish processing and supply - * some sort of output image, no matter how corrupted. - */ - -static int -fill_input_buffer(j_decompress_ptr cinfo) -{ - my_src_ptr src = (my_src_ptr) cinfo->src; - - WARNMS(cinfo, JWRN_JPEG_EOF); - - /* Create a fake EOI marker */ - src->eoi_buffer[0] = (JOCTET) 0xFF; - src->eoi_buffer[1] = (JOCTET) JPEG_EOI; - src->pub.next_input_byte = src->eoi_buffer; - src->pub.bytes_in_buffer = 2; - - return TRUE; -} - - -/* - * Skip data --- used to skip over a potentially large amount of - * uninteresting data (such as an APPn marker). - * - * If we overrun the end of the buffer, we let fill_input_buffer deal with - * it. An extremely large skip could cause some time-wasting here, but - * it really isn't supposed to happen ... and the decompressor will never - * skip more than 64K anyway. - */ - -static void -skip_input_data (j_decompress_ptr cinfo, long num_bytes) -{ - my_src_ptr src = (my_src_ptr) cinfo->src; - - if (num_bytes > 0) { - while (num_bytes > (long) src->pub.bytes_in_buffer) { - num_bytes -= (long) src->pub.bytes_in_buffer; - (void) fill_input_buffer(cinfo); - /* note we assume that fill_input_buffer will never return FALSE, - * so suspension need not be handled. - */ - } - src->pub.next_input_byte += (size_t) num_bytes; - src->pub.bytes_in_buffer -= (size_t) num_bytes; - } -} - - -/* - * An additional method that can be provided by data source modules is the - * resync_to_restart method for error recovery in the presence of RST markers. - * For the moment, this source module just uses the default resync method - * provided by the JPEG library. That method assumes that no backtracking - * is possible. - */ - - -/* - * Terminate source --- called by jpeg_finish_decompress - * after all data has been read. Often a no-op. - * - * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding - * application must deal with any cleanup that should happen even - * for error exit. - */ - -static void -term_source (j_decompress_ptr cinfo) -{ - /* no work necessary here */ -} - - -/* - * Prepare for input from a memory buffer. - */ - -GLOBAL(void) -jpeg_memory_src (j_decompress_ptr cinfo, const JOCTET * buffer, size_t bufsize) -{ - my_src_ptr src; - - /* The source object is made permanent so that a series of JPEG images - * can be read from a single buffer by calling jpeg_memory_src - * only before the first one. - * This makes it unsafe to use this manager and a different source - * manager serially with the same JPEG object. Caveat programmer. - */ - if (cinfo->src == NULL) { /* first time for this JPEG object? */ - cinfo->src = (struct jpeg_source_mgr *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - sizeof(my_source_mgr)); - } - - src = (my_src_ptr) cinfo->src; - src->pub.init_source = init_source; - src->pub.fill_input_buffer = fill_input_buffer; - src->pub.skip_input_data = skip_input_data; - src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */ - src->pub.term_source = term_source; - - src->pub.next_input_byte = buffer; - src->pub.bytes_in_buffer = bufsize; -} diff --git a/rtengine/klt/convolve.c b/rtengine/klt/convolve.c deleted file mode 100644 index 05b35a455..000000000 --- a/rtengine/klt/convolve.c +++ /dev/null @@ -1,317 +0,0 @@ -/********************************************************************* - * convolve.c - *********************************************************************/ - -/* Standard includes */ -#include -#include -#include /* malloc(), realloc() */ - -/* Our includes */ -#include "base.h" -#include "error.h" -#include "convolve.h" -#include "klt_util.h" /* printing */ - -#define MAX_KERNEL_WIDTH 71 - - -typedef struct { - int width; - float data[MAX_KERNEL_WIDTH]; -} ConvolutionKernel; - -/* Kernels */ -static ConvolutionKernel gauss_kernel; -static ConvolutionKernel gaussderiv_kernel; -static float sigma_last = -10.0; - - -/********************************************************************* - * _KLTToFloatImage - * - * Given a pointer to image data (probably unsigned chars), copy - * data to a float image. - */ - -void _KLTToFloatImage( - KLT_PixelType *img, - int ncols, int nrows, - _KLT_FloatImage floatimg) -{ - KLT_PixelType *ptrend = img + ncols*nrows; - float *ptrout = floatimg->data; - - /* Output image must be large enough to hold result */ - assert(floatimg->ncols >= ncols); - assert(floatimg->nrows >= nrows); - - floatimg->ncols = ncols; - floatimg->nrows = nrows; - - while (img < ptrend) *ptrout++ = (float) *img++; -} - - -/********************************************************************* - * _computeKernels - */ - -static void _computeKernels( - float sigma, - ConvolutionKernel *gauss, - ConvolutionKernel *gaussderiv) -{ - const float factor = 0.01f; /* for truncating tail */ - int i; - - assert(MAX_KERNEL_WIDTH % 2 == 1); - assert(sigma >= 0.0); - - /* Compute kernels, and automatically determine widths */ - { - const int hw = MAX_KERNEL_WIDTH / 2; - float max_gauss = 1.0f, max_gaussderiv = (float) (sigma*exp(-0.5f)); - - /* Compute gauss and deriv */ - for (i = -hw ; i <= hw ; i++) { - gauss->data[i+hw] = (float) exp(-i*i / (2*sigma*sigma)); - gaussderiv->data[i+hw] = -i * gauss->data[i+hw]; - } - - /* Compute widths */ - gauss->width = MAX_KERNEL_WIDTH; - for (i = -hw ; fabs(gauss->data[i+hw] / max_gauss) < factor ; - i++, gauss->width -= 2); - gaussderiv->width = MAX_KERNEL_WIDTH; - for (i = -hw ; fabs(gaussderiv->data[i+hw] / max_gaussderiv) < factor ; - i++, gaussderiv->width -= 2); - if (gauss->width == MAX_KERNEL_WIDTH || - gaussderiv->width == MAX_KERNEL_WIDTH) - KLTError("(_computeKernels) MAX_KERNEL_WIDTH %d is too small for " - "a sigma of %f", MAX_KERNEL_WIDTH, sigma); - } - - /* Shift if width less than MAX_KERNEL_WIDTH */ - for (i = 0 ; i < gauss->width ; i++) - gauss->data[i] = gauss->data[i+(MAX_KERNEL_WIDTH-gauss->width)/2]; - for (i = 0 ; i < gaussderiv->width ; i++) - gaussderiv->data[i] = gaussderiv->data[i+(MAX_KERNEL_WIDTH-gaussderiv->width)/2]; - /* Normalize gauss and deriv */ - { - const int hw = gaussderiv->width / 2; - float den; - - den = 0.0; - for (i = 0 ; i < gauss->width ; i++) den += gauss->data[i]; - for (i = 0 ; i < gauss->width ; i++) gauss->data[i] /= den; - den = 0.0; - for (i = -hw ; i <= hw ; i++) den -= i*gaussderiv->data[i+hw]; - for (i = -hw ; i <= hw ; i++) gaussderiv->data[i+hw] /= den; - } - - sigma_last = sigma; -} - - -/********************************************************************* - * _KLTGetKernelWidths - * - */ - -void _KLTGetKernelWidths( - float sigma, - int *gauss_width, - int *gaussderiv_width) -{ - _computeKernels(sigma, &gauss_kernel, &gaussderiv_kernel); - *gauss_width = gauss_kernel.width; - *gaussderiv_width = gaussderiv_kernel.width; -} - - -/********************************************************************* - * _convolveImageHoriz - */ - -static void _convolveImageHoriz( - _KLT_FloatImage imgin, - ConvolutionKernel kernel, - _KLT_FloatImage imgout) -{ - float *ptrrow = imgin->data; /* Points to row's first pixel */ - float *ptrout = imgout->data, /* Points to next output pixel */ - *ppp; - float sum; - int radius = kernel.width / 2; - int ncols = imgin->ncols, nrows = imgin->nrows; - int i, j, k; - - /* Kernel width must be odd */ - assert(kernel.width % 2 == 1); - - /* Must read from and write to different images */ - assert(imgin != imgout); - - /* Output image must be large enough to hold result */ - assert(imgout->ncols >= imgin->ncols); - assert(imgout->nrows >= imgin->nrows); - - /* For each row, do ... */ - for (j = 0 ; j < nrows ; j++) { - - /* Zero leftmost columns */ - for (i = 0 ; i < radius ; i++) - *ptrout++ = 0.0; - - /* Convolve middle columns with kernel */ - for ( ; i < ncols - radius ; i++) { - ppp = ptrrow + i - radius; - sum = 0.0; - for (k = kernel.width-1 ; k >= 0 ; k--) - sum += *ppp++ * kernel.data[k]; - *ptrout++ = sum; - } - - /* Zero rightmost columns */ - for ( ; i < ncols ; i++) - *ptrout++ = 0.0; - - ptrrow += ncols; - } -} - - -/********************************************************************* - * _convolveImageVert - */ - -static void _convolveImageVert( - _KLT_FloatImage imgin, - ConvolutionKernel kernel, - _KLT_FloatImage imgout) -{ - float *ptrcol = imgin->data; /* Points to row's first pixel */ - float *ptrout = imgout->data, /* Points to next output pixel */ - *ppp; - float sum; - int radius = kernel.width / 2; - int ncols = imgin->ncols, nrows = imgin->nrows; - int i, j, k; - - /* Kernel width must be odd */ - assert(kernel.width % 2 == 1); - - /* Must read from and write to different images */ - assert(imgin != imgout); - - /* Output image must be large enough to hold result */ - assert(imgout->ncols >= imgin->ncols); - assert(imgout->nrows >= imgin->nrows); - - /* For each column, do ... */ - for (i = 0 ; i < ncols ; i++) { - - /* Zero topmost rows */ - for (j = 0 ; j < radius ; j++) { - *ptrout = 0.0; - ptrout += ncols; - } - - /* Convolve middle rows with kernel */ - for ( ; j < nrows - radius ; j++) { - ppp = ptrcol + ncols * (j - radius); - sum = 0.0; - for (k = kernel.width-1 ; k >= 0 ; k--) { - sum += *ppp * kernel.data[k]; - ppp += ncols; - } - *ptrout = sum; - ptrout += ncols; - } - - /* Zero bottommost rows */ - for ( ; j < nrows ; j++) { - *ptrout = 0.0; - ptrout += ncols; - } - - ptrcol++; - ptrout -= nrows * ncols - 1; - } -} - - -/********************************************************************* - * _convolveSeparate - */ - -static void _convolveSeparate( - _KLT_FloatImage imgin, - ConvolutionKernel horiz_kernel, - ConvolutionKernel vert_kernel, - _KLT_FloatImage imgout) -{ - /* Create temporary image */ - _KLT_FloatImage tmpimg; - tmpimg = _KLTCreateFloatImage(imgin->ncols, imgin->nrows); - - /* Do convolution */ - _convolveImageHoriz(imgin, horiz_kernel, tmpimg); - - _convolveImageVert(tmpimg, vert_kernel, imgout); - - /* Free memory */ - _KLTFreeFloatImage(tmpimg); -} - - -/********************************************************************* - * _KLTComputeGradients - */ - -void _KLTComputeGradients( - _KLT_FloatImage img, - float sigma, - _KLT_FloatImage gradx, - _KLT_FloatImage grady) -{ - - /* Output images must be large enough to hold result */ - assert(gradx->ncols >= img->ncols); - assert(gradx->nrows >= img->nrows); - assert(grady->ncols >= img->ncols); - assert(grady->nrows >= img->nrows); - - /* Compute kernels, if necessary */ - if (fabs(sigma - sigma_last) > 0.05) - _computeKernels(sigma, &gauss_kernel, &gaussderiv_kernel); - - _convolveSeparate(img, gaussderiv_kernel, gauss_kernel, gradx); - _convolveSeparate(img, gauss_kernel, gaussderiv_kernel, grady); - -} - - -/********************************************************************* - * _KLTComputeSmoothedImage - */ - -void _KLTComputeSmoothedImage( - _KLT_FloatImage img, - float sigma, - _KLT_FloatImage smooth) -{ - /* Output image must be large enough to hold result */ - assert(smooth->ncols >= img->ncols); - assert(smooth->nrows >= img->nrows); - - /* Compute kernel, if necessary; gauss_deriv is not used */ - if (fabs(sigma - sigma_last) > 0.05) - _computeKernels(sigma, &gauss_kernel, &gaussderiv_kernel); - - _convolveSeparate(img, gauss_kernel, gauss_kernel, smooth); -} - - - diff --git a/rtengine/klt/error.c b/rtengine/klt/error.c deleted file mode 100644 index 0731cf2cb..000000000 --- a/rtengine/klt/error.c +++ /dev/null @@ -1,56 +0,0 @@ -/********************************************************************* - * error.c - * - * Error and warning messages, and system commands. - *********************************************************************/ - - -/* Standard includes */ -#include -#include -#include - - -/********************************************************************* - * KLTError - * - * Prints an error message and dies. - * - * INPUTS - * exactly like printf - */ - -void KLTError(char *fmt, ...) -{ - va_list args; - - va_start(args, fmt); - fprintf(stderr, "KLT Error: "); - vfprintf(stderr, fmt, args); - fprintf(stderr, "\n"); - va_end(args); - exit(1); -} - - -/********************************************************************* - * KLTWarning - * - * Prints a warning message. - * - * INPUTS - * exactly like printf - */ - -void KLTWarning(char *fmt, ...) -{ - va_list args; - - va_start(args, fmt); - fprintf(stderr, "KLT Warning: "); - vfprintf(stderr, fmt, args); - fprintf(stderr, "\n"); - fflush(stderr); - va_end(args); -} - diff --git a/rtengine/klt/error.h b/rtengine/klt/error.h index 4dac13651..95c2af736 100644 --- a/rtengine/klt/error.h +++ b/rtengine/klt/error.h @@ -5,8 +5,8 @@ #ifndef _ERROR_H_ #define _ERROR_H_ -#include -#include +#include +#include void KLTError(char *fmt, ...); void KLTWarning(char *fmt, ...); diff --git a/rtengine/klt/klt.c b/rtengine/klt/klt.c deleted file mode 100644 index 66b69070f..000000000 --- a/rtengine/klt/klt.c +++ /dev/null @@ -1,531 +0,0 @@ -/********************************************************************* - * klt.c - * - * Kanade-Lucas-Tomasi tracker - *********************************************************************/ - -/* Standard includes */ -#include -#include /* logf() */ -#include /* malloc() */ - -/* Our includes */ -#include "base.h" -#include "convolve.h" -#include "error.h" -#include "klt.h" -#include "pyramid.h" - - -static const int mindist = 10; -static const int window_size = 7; -static const int min_eigenvalue = 1; -static const float min_determinant = 0.01f; -static const float min_displacement = 0.1f; -static const int max_iterations = 10; -static const float max_residue = 10.0f; -static const float grad_sigma = 1.0f; -static const float smooth_sigma_fact = 0.1f; -static const float pyramid_sigma_fact = 0.9f; -static const float step_factor = 1.0f; -static const KLT_BOOL sequentialMode = FALSE; -static const KLT_BOOL lighting_insensitive = FALSE; -/* for affine mapping*/ -static const int affineConsistencyCheck = -1; -static const int affine_window_size = 15; -static const int affine_max_iterations = 10; -static const float affine_max_residue = 10.0; -static const float affine_min_displacement = 0.02f; -static const float affine_max_displacement_differ = 1.5f; - -static const KLT_BOOL smoothBeforeSelecting = TRUE; -static const KLT_BOOL writeInternalImages = FALSE; -static const int search_range = 15; -static const int nSkippedPixels = 0; - -extern int KLT_verbose; - - -/********************************************************************* - * _createArray2D - * - * Creates a two-dimensional array. - * - * INPUTS - * ncols: no. of columns - * nrows: no. of rows - * nbytes: no. of bytes per entry - * - * RETURNS - * Pointer to an array. Must be coerced. - * - * EXAMPLE - * char **ar; - * ar = (char **) createArray2D(8, 5, sizeof(char)); - */ - -static void** _createArray2D(int ncols, int nrows, int nbytes) -{ - char **tt; - int i; - - tt = (char **) malloc(nrows * sizeof(void *) + - ncols * nrows * nbytes); - if (tt == NULL) - KLTError("(createArray2D) Out of memory"); - - for (i = 0 ; i < nrows ; i++) - tt[i] = ((char *) tt) + (nrows * sizeof(void *) + - i * ncols * nbytes); - - return((void **) tt); -} - - -/********************************************************************* - * KLTCreateTrackingContext - * - */ - -KLT_TrackingContext KLTCreateTrackingContext() -{ - KLT_TrackingContext tc; - - /* Allocate memory */ - tc = (KLT_TrackingContext) malloc(sizeof(KLT_TrackingContextRec)); - - /* Set values to default values */ - tc->mindist = mindist; - tc->window_width = window_size; - tc->window_height = window_size; - tc->sequentialMode = sequentialMode; - tc->smoothBeforeSelecting = smoothBeforeSelecting; - tc->writeInternalImages = writeInternalImages; - tc->lighting_insensitive = lighting_insensitive; - tc->min_eigenvalue = min_eigenvalue; - tc->min_determinant = min_determinant; - tc->max_iterations = max_iterations; - tc->min_displacement = min_displacement; - tc->max_residue = max_residue; - tc->grad_sigma = grad_sigma; - tc->smooth_sigma_fact = smooth_sigma_fact; - tc->pyramid_sigma_fact = pyramid_sigma_fact; - tc->step_factor = step_factor; - tc->nSkippedPixels = nSkippedPixels; - tc->pyramid_last = NULL; - tc->pyramid_last_gradx = NULL; - tc->pyramid_last_grady = NULL; - /* for affine mapping */ - tc->affineConsistencyCheck = affineConsistencyCheck; - tc->affine_window_width = affine_window_size; - tc->affine_window_height = affine_window_size; - tc->affine_max_iterations = affine_max_iterations; - tc->affine_max_residue = affine_max_residue; - tc->affine_min_displacement = affine_min_displacement; - tc->affine_max_displacement_differ = affine_max_displacement_differ; - - /* Change nPyramidLevels and subsampling */ - KLTChangeTCPyramid(tc, search_range); - - /* Update border, which is dependent upon */ - /* smooth_sigma_fact, pyramid_sigma_fact, window_size, and subsampling */ - KLTUpdateTCBorder(tc); - - return(tc); -} - - -/********************************************************************* - * KLTCreateFeatureList - * - */ - -KLT_FeatureList KLTCreateFeatureList( - int nFeatures) -{ - KLT_FeatureList fl; - KLT_Feature first; - int nbytes = sizeof(KLT_FeatureListRec) + - nFeatures * sizeof(KLT_Feature) + - nFeatures * sizeof(KLT_FeatureRec); - int i; - - /* Allocate memory for feature list */ - fl = (KLT_FeatureList) malloc(nbytes); - - /* Set parameters */ - fl->nFeatures = nFeatures; - - /* Set pointers */ - fl->feature = (KLT_Feature *) (fl + 1); - first = (KLT_Feature) (fl->feature + nFeatures); - for (i = 0 ; i < nFeatures ; i++) { - fl->feature[i] = first + i; - fl->feature[i]->aff_img = NULL; /* initialization fixed by Sinisa Segvic */ - fl->feature[i]->aff_img_gradx = NULL; - fl->feature[i]->aff_img_grady = NULL; - } - /* Return feature list */ - return(fl); -} - - -/********************************************************************* - * KLTCreateFeatureHistory - * - */ - -KLT_FeatureHistory KLTCreateFeatureHistory( - int nFrames) -{ - KLT_FeatureHistory fh; - KLT_Feature first; - int nbytes = sizeof(KLT_FeatureHistoryRec) + - nFrames * sizeof(KLT_Feature) + - nFrames * sizeof(KLT_FeatureRec); - int i; - - /* Allocate memory for feature history */ - fh = (KLT_FeatureHistory) malloc(nbytes); - - /* Set parameters */ - fh->nFrames = nFrames; - - /* Set pointers */ - fh->feature = (KLT_Feature *) (fh + 1); - first = (KLT_Feature) (fh->feature + nFrames); - for (i = 0 ; i < nFrames ; i++) - fh->feature[i] = first + i; - - /* Return feature history */ - return(fh); -} - - -/********************************************************************* - * KLTCreateFeatureTable - * - */ - -KLT_FeatureTable KLTCreateFeatureTable( - int nFrames, - int nFeatures) -{ - KLT_FeatureTable ft; - KLT_Feature first; - int nbytes = sizeof(KLT_FeatureTableRec); - int i, j; - - /* Allocate memory for feature history */ - ft = (KLT_FeatureTable) malloc(nbytes); - - /* Set parameters */ - ft->nFrames = nFrames; - ft->nFeatures = nFeatures; - - /* Set pointers */ - ft->feature = (KLT_Feature **) - _createArray2D(nFrames, nFeatures, sizeof(KLT_Feature)); - first = (KLT_Feature) malloc(nFrames * nFeatures * sizeof(KLT_FeatureRec)); - for (j = 0 ; j < nFeatures ; j++) - for (i = 0 ; i < nFrames ; i++) - ft->feature[j][i] = first + j*nFrames + i; - - /* Return feature table */ - return(ft); -} - - -/********************************************************************* - * KLTPrintTrackingContext - */ - -void KLTPrintTrackingContext( - KLT_TrackingContext tc) -{ - fprintf(stderr, "\n\nTracking context:\n\n"); - fprintf(stderr, "\tmindist = %d\n", tc->mindist); - fprintf(stderr, "\twindow_width = %d\n", tc->window_width); - fprintf(stderr, "\twindow_height = %d\n", tc->window_height); - fprintf(stderr, "\tsequentialMode = %s\n", - tc->sequentialMode ? "TRUE" : "FALSE"); - fprintf(stderr, "\tsmoothBeforeSelecting = %s\n", - tc->smoothBeforeSelecting ? "TRUE" : "FALSE"); - fprintf(stderr, "\twriteInternalImages = %s\n", - tc->writeInternalImages ? "TRUE" : "FALSE"); - - fprintf(stderr, "\tmin_eigenvalue = %d\n", tc->min_eigenvalue); - fprintf(stderr, "\tmin_determinant = %f\n", tc->min_determinant); - fprintf(stderr, "\tmin_displacement = %f\n", tc->min_displacement); - fprintf(stderr, "\tmax_iterations = %d\n", tc->max_iterations); - fprintf(stderr, "\tmax_residue = %f\n", tc->max_residue); - fprintf(stderr, "\tgrad_sigma = %f\n", tc->grad_sigma); - fprintf(stderr, "\tsmooth_sigma_fact = %f\n", tc->smooth_sigma_fact); - fprintf(stderr, "\tpyramid_sigma_fact = %f\n", tc->pyramid_sigma_fact); - fprintf(stderr, "\tnSkippedPixels = %d\n", tc->nSkippedPixels); - fprintf(stderr, "\tborderx = %d\n", tc->borderx); - fprintf(stderr, "\tbordery = %d\n", tc->bordery); - fprintf(stderr, "\tnPyramidLevels = %d\n", tc->nPyramidLevels); - fprintf(stderr, "\tsubsampling = %d\n", tc->subsampling); - - fprintf(stderr, "\n\tpyramid_last = %s\n", (tc->pyramid_last!=NULL) ? - "points to old image" : "NULL"); - fprintf(stderr, "\tpyramid_last_gradx = %s\n", - (tc->pyramid_last_gradx!=NULL) ? - "points to old image" : "NULL"); - fprintf(stderr, "\tpyramid_last_grady = %s\n", - (tc->pyramid_last_grady!=NULL) ? - "points to old image" : "NULL"); - fprintf(stderr, "\n\n"); -} - - -/********************************************************************* - * KLTChangeTCPyramid - * - */ - -void KLTChangeTCPyramid( - KLT_TrackingContext tc, - int search_range) -{ - float window_halfwidth; - float subsampling; - - /* Check window size (and correct if necessary) */ - if (tc->window_width % 2 != 1) { - tc->window_width = tc->window_width+1; - KLTWarning("(KLTChangeTCPyramid) Window width must be odd. " - "Changing to %d.\n", tc->window_width); - } - if (tc->window_height % 2 != 1) { - tc->window_height = tc->window_height+1; - KLTWarning("(KLTChangeTCPyramid) Window height must be odd. " - "Changing to %d.\n", tc->window_height); - } - if (tc->window_width < 3) { - tc->window_width = 3; - KLTWarning("(KLTChangeTCPyramid) Window width must be at least three. \n" - "Changing to %d.\n", tc->window_width); - } - if (tc->window_height < 3) { - tc->window_height = 3; - KLTWarning("(KLTChangeTCPyramid) Window height must be at least three. \n" - "Changing to %d.\n", tc->window_height); - } - window_halfwidth = min(tc->window_width,tc->window_height)/2.0f; - - subsampling = ((float) search_range) / window_halfwidth; - - if (subsampling < 1.0) { /* 1.0 = 0+1 */ - tc->nPyramidLevels = 1; - } else if (subsampling <= 3.0) { /* 3.0 = 2+1 */ - tc->nPyramidLevels = 2; - tc->subsampling = 2; - } else if (subsampling <= 5.0) { /* 5.0 = 4+1 */ - tc->nPyramidLevels = 2; - tc->subsampling = 4; - } else if (subsampling <= 9.0) { /* 9.0 = 8+1 */ - tc->nPyramidLevels = 2; - tc->subsampling = 8; - } else { - /* The following lines are derived from the formula: - search_range = - window_halfwidth * \sum_{i=0}^{nPyramidLevels-1} 8^i, - which is the same as: - search_range = - window_halfwidth * (8^nPyramidLevels - 1)/(8 - 1). - Then, the value is rounded up to the nearest integer. */ - float val = (float) (log(7.0*subsampling+1.0)/log(8.0)); - tc->nPyramidLevels = (int) (val + 0.99); - tc->subsampling = 8; - } -} - - -/********************************************************************* - * NOTE: Manually must ensure consistency with _KLTComputePyramid() - */ - -static float _pyramidSigma( - KLT_TrackingContext tc) -{ - return (tc->pyramid_sigma_fact * tc->subsampling); -} - - -/********************************************************************* - * Updates border, which is dependent upon - * smooth_sigma_fact, pyramid_sigma_fact, window_size, and subsampling - */ - -void KLTUpdateTCBorder( - KLT_TrackingContext tc) -{ - float val; - int pyramid_gauss_hw; - int smooth_gauss_hw; - int gauss_width, gaussderiv_width; - int num_levels = tc->nPyramidLevels; - int n_invalid_pixels; - int window_hw; - int ss = tc->subsampling; - int ss_power; - int border; - int i; - - /* Check window size (and correct if necessary) */ - if (tc->window_width % 2 != 1) { - tc->window_width = tc->window_width+1; - KLTWarning("(KLTUpdateTCBorder) Window width must be odd. " - "Changing to %d.\n", tc->window_width); - } - if (tc->window_height % 2 != 1) { - tc->window_height = tc->window_height+1; - KLTWarning("(KLTUpdateTCBorder) Window height must be odd. " - "Changing to %d.\n", tc->window_height); - } - if (tc->window_width < 3) { - tc->window_width = 3; - KLTWarning("(KLTUpdateTCBorder) Window width must be at least three. \n" - "Changing to %d.\n", tc->window_width); - } - if (tc->window_height < 3) { - tc->window_height = 3; - KLTWarning("(KLTUpdateTCBorder) Window height must be at least three. \n" - "Changing to %d.\n", tc->window_height); - } - window_hw = max(tc->window_width, tc->window_height)/2; - - /* Find widths of convolution windows */ - _KLTGetKernelWidths(_KLTComputeSmoothSigma(tc), - &gauss_width, &gaussderiv_width); - smooth_gauss_hw = gauss_width/2; - _KLTGetKernelWidths(_pyramidSigma(tc), - &gauss_width, &gaussderiv_width); - pyramid_gauss_hw = gauss_width/2; - - /* Compute the # of invalid pixels at each level of the pyramid. - n_invalid_pixels is computed with respect to the ith level - of the pyramid. So, e.g., if n_invalid_pixels = 5 after - the first iteration, then there are 5 invalid pixels in - level 1, which translated means 5*subsampling invalid pixels - in the original level 0. */ - n_invalid_pixels = smooth_gauss_hw; - for (i = 1 ; i < num_levels ; i++) { - val = ((float) n_invalid_pixels + pyramid_gauss_hw) / ss; - n_invalid_pixels = (int) (val + 0.99); /* Round up */ - } - - /* ss_power = ss^(num_levels-1) */ - ss_power = 1; - for (i = 1 ; i < num_levels ; i++) - ss_power *= ss; - - /* Compute border by translating invalid pixels back into */ - /* original image */ - border = (n_invalid_pixels + window_hw) * ss_power; - - tc->borderx = border; - tc->bordery = border; -} - - -/********************************************************************* - * KLTFreeTrackingContext - * KLTFreeFeatureList - * KLTFreeFeatureHistory - * KLTFreeFeatureTable - */ - -void KLTFreeTrackingContext( - KLT_TrackingContext tc) -{ - if (tc->pyramid_last) - _KLTFreePyramid((_KLT_Pyramid) tc->pyramid_last); - if (tc->pyramid_last_gradx) - _KLTFreePyramid((_KLT_Pyramid) tc->pyramid_last_gradx); - if (tc->pyramid_last_grady) - _KLTFreePyramid((_KLT_Pyramid) tc->pyramid_last_grady); - free(tc); -} - -void KLTFreeFeatureList( - KLT_FeatureList fl) -{ - /* for affine mapping */ - int indx; - for (indx = 0 ; indx < fl->nFeatures ; indx++) { - /* free image and gradient */ - _KLTFreeFloatImage(fl->feature[indx]->aff_img); - _KLTFreeFloatImage(fl->feature[indx]->aff_img_gradx); - _KLTFreeFloatImage(fl->feature[indx]->aff_img_grady); - fl->feature[indx]->aff_img = NULL; - fl->feature[indx]->aff_img_gradx = NULL; - fl->feature[indx]->aff_img_grady = NULL; - } - - free(fl); -} - -void KLTFreeFeatureHistory( - KLT_FeatureHistory fh) -{ - free(fh); -} - -void KLTFreeFeatureTable( - KLT_FeatureTable ft) -{ - free(ft->feature[0][0]); /* this plugs a memory leak found by Stefan Wachter */ - free(ft->feature); - free(ft); -} - - -/********************************************************************* - * KLTStopSequentialMode - */ - -void KLTStopSequentialMode( - KLT_TrackingContext tc) -{ - tc->sequentialMode = FALSE; - _KLTFreePyramid((_KLT_Pyramid) tc->pyramid_last); - _KLTFreePyramid((_KLT_Pyramid) tc->pyramid_last_gradx); - _KLTFreePyramid((_KLT_Pyramid) tc->pyramid_last_grady); - tc->pyramid_last = NULL; - tc->pyramid_last_gradx = NULL; - tc->pyramid_last_grady = NULL; -} - - -/********************************************************************* - * KLTCountRemainingFeatures - */ - -int KLTCountRemainingFeatures( - KLT_FeatureList fl) -{ - int count = 0; - int i; - - for (i = 0 ; i < fl->nFeatures ; i++) - if (fl->feature[i]->val >= 0) - count++; - - return count; -} - -/********************************************************************* - * KLTSetVerbosity - */ - -void KLTSetVerbosity( - int verbosity) -{ - KLT_verbose = verbosity; -} - - - diff --git a/rtengine/klt/klt_util.c b/rtengine/klt/klt_util.c deleted file mode 100644 index 300941bb9..000000000 --- a/rtengine/klt/klt_util.c +++ /dev/null @@ -1,165 +0,0 @@ -/********************************************************************* - * klt_util.c - *********************************************************************/ - -/* Standard includes */ -#include -#include /* malloc() */ -#include /* fabs() */ - -/* Our includes */ -#include "base.h" -#include "error.h" -#include "pnmio.h" -#include "klt.h" -#include "klt_util.h" - - -/*********************************************************************/ - -float _KLTComputeSmoothSigma( - KLT_TrackingContext tc) -{ - return (tc->smooth_sigma_fact * max(tc->window_width, tc->window_height)); -} - - -/********************************************************************* - * _KLTCreateFloatImage - */ - -_KLT_FloatImage _KLTCreateFloatImage( - int ncols, - int nrows) -{ - _KLT_FloatImage floatimg; - int nbytes = sizeof(_KLT_FloatImageRec) + - ncols * nrows * sizeof(float); - - floatimg = (_KLT_FloatImage) malloc(nbytes); - if (floatimg == NULL) - KLTError("(_KLTCreateFloatImage) Out of memory"); - floatimg->ncols = ncols; - floatimg->nrows = nrows; - floatimg->data = (float *) (floatimg + 1); - - return(floatimg); -} - - -/********************************************************************* - * _KLTFreeFloatImage - */ - -void _KLTFreeFloatImage( - _KLT_FloatImage floatimg) -{ - free(floatimg); -} - - -/********************************************************************* - * _KLTPrintSubFloatImage - */ - -void _KLTPrintSubFloatImage( - _KLT_FloatImage floatimg, - int x0, int y0, - int width, int height) -{ - int ncols = floatimg->ncols; - int offset; - int i, j; - - assert(x0 >= 0); - assert(y0 >= 0); - assert(x0 + width <= ncols); - assert(y0 + height <= floatimg->nrows); - - fprintf(stderr, "\n"); - for (j = 0 ; j < height ; j++) { - for (i = 0 ; i < width ; i++) { - offset = (j+y0)*ncols + (i+x0); - fprintf(stderr, "%6.2f ", *(floatimg->data + offset)); - } - fprintf(stderr, "\n"); - } - fprintf(stderr, "\n"); -} - - -/********************************************************************* - * _KLTWriteFloatImageToPGM - */ - -void _KLTWriteFloatImageToPGM( - _KLT_FloatImage img, - char *filename) -{ - int npixs = img->ncols * img->nrows; - float mmax = -999999.9f, mmin = 999999.9f; - float fact; - float *ptr; - uchar *byteimg, *ptrout; - int i; - - /* Calculate minimum and maximum values of float image */ - ptr = img->data; - for (i = 0 ; i < npixs ; i++) { - mmax = max(mmax, *ptr); - mmin = min(mmin, *ptr); - ptr++; - } - - /* Allocate memory to hold converted image */ - byteimg = (uchar *) malloc(npixs * sizeof(uchar)); - - /* Convert image from float to uchar */ - fact = 255.0f / (mmax-mmin); - ptr = img->data; - ptrout = byteimg; - for (i = 0 ; i < npixs ; i++) { - *ptrout++ = (uchar) ((*ptr++ - mmin) * fact); - } - - /* Write uchar image to PGM */ - pgmWriteFile(filename, byteimg, img->ncols, img->nrows); - - /* Free memory */ - free(byteimg); -} - -/********************************************************************* - * _KLTWriteFloatImageToPGM - */ - -void _KLTWriteAbsFloatImageToPGM( - _KLT_FloatImage img, - char *filename,float scale) -{ - int npixs = img->ncols * img->nrows; - float fact; - float *ptr; - uchar *byteimg, *ptrout; - int i; - float tmp; - - /* Allocate memory to hold converted image */ - byteimg = (uchar *) malloc(npixs * sizeof(uchar)); - - /* Convert image from float to uchar */ - fact = 255.0f / scale; - ptr = img->data; - ptrout = byteimg; - for (i = 0 ; i < npixs ; i++) { - tmp = (float) (fabs(*ptr++) * fact); - if(tmp > 255.0) tmp = 255.0; - *ptrout++ = (uchar) tmp; - } - - /* Write uchar image to PGM */ - pgmWriteFile(filename, byteimg, img->ncols, img->nrows); - - /* Free memory */ - free(byteimg); -} diff --git a/rtengine/klt/main.cpp b/rtengine/klt/main.cpp index 8270c9730..7ce9b378d 100644 --- a/rtengine/klt/main.cpp +++ b/rtengine/klt/main.cpp @@ -1,7 +1,7 @@ // main.cpp : Defines the entry point for the console application. // -#include // printf +#include // printf extern "C" { void RunExample1(); diff --git a/rtengine/klt/pnmio.c b/rtengine/klt/pnmio.c deleted file mode 100644 index f813039b2..000000000 --- a/rtengine/klt/pnmio.c +++ /dev/null @@ -1,333 +0,0 @@ -/********************************************************************* - * pnmio.c - * - * Various routines to manipulate PNM files. - *********************************************************************/ - - -/* Standard includes */ -#include /* FILE */ -#include /* malloc(), atoi() */ - -/* Our includes */ -#include "error.h" - -#define LENGTH 80 - - -/*********************************************************************/ - -static void _getNextString( - FILE *fp, - char *line) -{ - int i; - - line[0] = '\0'; - - while (line[0] == '\0') { - fscanf(fp, "%s", line); - i = -1; - do { - i++; - if (line[i] == '#') { - line[i] = '\0'; - while (fgetc(fp) != '\n') ; - } - } while (line[i] != '\0'); - } -} - - -/********************************************************************* - * pnmReadHeader - */ - -void pnmReadHeader( - FILE *fp, - int *magic, - int *ncols, int *nrows, - int *maxval) -{ - char line[LENGTH]; - - /* Read magic number */ - _getNextString(fp, line); - if (line[0] != 'P') - KLTError("(pnmReadHeader) Magic number does not begin with 'P', " - "but with a '%c'", line[0]); - sscanf(line, "P%d", magic); - - /* Read size, skipping comments */ - _getNextString(fp, line); - *ncols = atoi(line); - _getNextString(fp, line); - *nrows = atoi(line); - if (*ncols < 0 || *nrows < 0 || *ncols > 10000 || *nrows > 10000) - KLTError("(pnmReadHeader) The dimensions %d x %d are unacceptable", - *ncols, *nrows); - - /* Read maxval, skipping comments */ - _getNextString(fp, line); - *maxval = atoi(line); - fread(line, 1, 1, fp); /* Read newline which follows maxval */ - - if (*maxval != 255) - KLTWarning("(pnmReadHeader) Maxval is not 255, but %d", *maxval); -} - - -/********************************************************************* - * pgmReadHeader - */ - -void pgmReadHeader( - FILE *fp, - int *magic, - int *ncols, int *nrows, - int *maxval) -{ - pnmReadHeader(fp, magic, ncols, nrows, maxval); - if (*magic != 5) - KLTError("(pgmReadHeader) Magic number is not 'P5', but 'P%d'", *magic); -} - - -/********************************************************************* - * ppmReadHeader - */ - -void ppmReadHeader( - FILE *fp, - int *magic, - int *ncols, int *nrows, - int *maxval) -{ - pnmReadHeader(fp, magic, ncols, nrows, maxval); - if (*magic != 6) - KLTError("(ppmReadHeader) Magic number is not 'P6', but 'P%d'", *magic); -} - - -/********************************************************************* - * pgmReadHeaderFile - */ - -void pgmReadHeaderFile( - char *fname, - int *magic, - int *ncols, int *nrows, - int *maxval) -{ - FILE *fp; - - /* Open file */ - if ( (fp = fopen(fname, "rb")) == NULL) - KLTError("(pgmReadHeaderFile) Can't open file named '%s' for reading\n", fname); - - /* Read header */ - pgmReadHeader(fp, magic, ncols, nrows, maxval); - - /* Close file */ - fclose(fp); -} - - -/********************************************************************* - * ppmReadHeaderFile - */ - -void ppmReadHeaderFile( - char *fname, - int *magic, - int *ncols, int *nrows, - int *maxval) -{ - FILE *fp; - - /* Open file */ - if ( (fp = fopen(fname, "rb")) == NULL) - KLTError("(ppmReadHeaderFile) Can't open file named '%s' for reading\n", fname); - - /* Read header */ - ppmReadHeader(fp, magic, ncols, nrows, maxval); - - /* Close file */ - fclose(fp); -} - - -/********************************************************************* - * pgmRead - * - * NOTE: If img is NULL, memory is allocated. - */ - -unsigned char* pgmRead( - FILE *fp, - unsigned char *img, - int *ncols, int *nrows) -{ - unsigned char *ptr; - int magic, maxval; - int i; - - /* Read header */ - pgmReadHeader(fp, &magic, ncols, nrows, &maxval); - - /* Allocate memory, if necessary, and set pointer */ - if (img == NULL) { - ptr = (unsigned char *) malloc(*ncols * *nrows * sizeof(char)); - if (ptr == NULL) - KLTError("(pgmRead) Memory not allocated"); - } - else - ptr = img; - - /* Read binary image data */ - { - unsigned char *tmpptr = ptr; - for (i = 0 ; i < *nrows ; i++) { - fread(tmpptr, *ncols, 1, fp); - tmpptr += *ncols; - } - } - - return ptr; -} - - -/********************************************************************* - * pgmReadFile - * - * NOTE: If img is NULL, memory is allocated. - */ - -unsigned char* pgmReadFile( - char *fname, - unsigned char *img, - int *ncols, int *nrows) -{ - unsigned char *ptr; - FILE *fp; - - /* Open file */ - if ( (fp = fopen(fname, "rb")) == NULL) - KLTError("(pgmReadFile) Can't open file named '%s' for reading\n", fname); - - /* Read file */ - ptr = pgmRead(fp, img, ncols, nrows); - - /* Close file */ - fclose(fp); - - return ptr; -} - - -/********************************************************************* - * pgmWrite - */ - -void pgmWrite( - FILE *fp, - unsigned char *img, - int ncols, - int nrows) -{ - int i; - - /* Write header */ - fprintf(fp, "P5\n"); - fprintf(fp, "%d %d\n", ncols, nrows); - fprintf(fp, "255\n"); - - /* Write binary data */ - for (i = 0 ; i < nrows ; i++) { - fwrite(img, ncols, 1, fp); - img += ncols; - } -} - - -/********************************************************************* - * pgmWriteFile - */ - -void pgmWriteFile( - char *fname, - unsigned char *img, - int ncols, - int nrows) -{ - FILE *fp; - - /* Open file */ - if ( (fp = fopen(fname, "wb")) == NULL) - KLTError("(pgmWriteFile) Can't open file named '%s' for writing\n", fname); - - /* Write to file */ - pgmWrite(fp, img, ncols, nrows); - - /* Close file */ - fclose(fp); -} - - -/********************************************************************* - * ppmWrite - */ - -void ppmWrite( - FILE *fp, - unsigned char *redimg, - unsigned char *greenimg, - unsigned char *blueimg, - int ncols, - int nrows) -{ - int i, j; - - /* Write header */ - fprintf(fp, "P6\n"); - fprintf(fp, "%d %d\n", ncols, nrows); - fprintf(fp, "255\n"); - - /* Write binary data */ - for (j = 0 ; j < nrows ; j++) { - for (i = 0 ; i < ncols ; i++) { - fwrite(redimg, 1, 1, fp); - fwrite(greenimg, 1, 1, fp); - fwrite(blueimg, 1, 1, fp); - redimg++; greenimg++; blueimg++; - } - } -} - - -/********************************************************************* - * ppmWriteFileRGB - */ - -void ppmWriteFileRGB( - char *fname, - unsigned char *redimg, - unsigned char *greenimg, - unsigned char *blueimg, - int ncols, - int nrows) -{ - FILE *fp; - - /* Open file */ - if ( (fp = fopen(fname, "wb")) == NULL) - KLTError("(ppmWriteFileRGB) Can't open file named '%s' for writing\n", fname); - - /* Write to file */ - ppmWrite(fp, redimg, greenimg, blueimg, ncols, nrows); - - /* Close file */ - fclose(fp); -} - - diff --git a/rtengine/klt/pnmio.h b/rtengine/klt/pnmio.h index af490431a..611439e57 100644 --- a/rtengine/klt/pnmio.h +++ b/rtengine/klt/pnmio.h @@ -5,7 +5,7 @@ #ifndef _PNMIO_H_ #define _PNMIO_H_ -#include +#include /********** * With pgmReadFile and pgmRead, setting img to NULL causes memory diff --git a/rtengine/klt/pyramid.c b/rtengine/klt/pyramid.c deleted file mode 100644 index fbce17497..000000000 --- a/rtengine/klt/pyramid.c +++ /dev/null @@ -1,143 +0,0 @@ -/********************************************************************* - * pyramid.c - * - *********************************************************************/ - -/* Standard includes */ -#include -#include /* malloc() ? */ -#include /* memset() ? */ -#include /* */ - -/* Our includes */ -#include "base.h" -#include "error.h" -#include "convolve.h" /* for computing pyramid */ -#include "pyramid.h" - - -/********************************************************************* - * - */ - -_KLT_Pyramid _KLTCreatePyramid( - int ncols, - int nrows, - int subsampling, - int nlevels) -{ - _KLT_Pyramid pyramid; - int nbytes = sizeof(_KLT_PyramidRec) + - nlevels * sizeof(_KLT_FloatImage *) + - nlevels * sizeof(int) + - nlevels * sizeof(int); - int i; - - if (subsampling != 2 && subsampling != 4 && - subsampling != 8 && subsampling != 16 && subsampling != 32) - KLTError("(_KLTCreatePyramid) Pyramid's subsampling must " - "be either 2, 4, 8, 16, or 32"); - - - /* Allocate memory for structure and set parameters */ - pyramid = (_KLT_Pyramid) malloc(nbytes); - if (pyramid == NULL) - KLTError("(_KLTCreatePyramid) Out of memory"); - - /* Set parameters */ - pyramid->subsampling = subsampling; - pyramid->nLevels = nlevels; - pyramid->img = (_KLT_FloatImage *) (pyramid + 1); - pyramid->ncols = (int *) (pyramid->img + nlevels); - pyramid->nrows = (int *) (pyramid->ncols + nlevels); - - /* Allocate memory for each level of pyramid and assign pointers */ - for (i = 0 ; i < nlevels ; i++) { - pyramid->img[i] = _KLTCreateFloatImage(ncols, nrows); - pyramid->ncols[i] = ncols; pyramid->nrows[i] = nrows; - ncols /= subsampling; nrows /= subsampling; - } - - return pyramid; -} - - -/********************************************************************* - * - */ - -void _KLTFreePyramid( - _KLT_Pyramid pyramid) -{ - int i; - - /* Free images */ - for (i = 0 ; i < pyramid->nLevels ; i++) - _KLTFreeFloatImage(pyramid->img[i]); - - /* Free structure */ - free(pyramid); -} - - -/********************************************************************* - * - */ - -void _KLTComputePyramid( - _KLT_FloatImage img, - _KLT_Pyramid pyramid, - float sigma_fact) -{ - _KLT_FloatImage currimg, tmpimg; - int ncols = img->ncols, nrows = img->nrows; - int subsampling = pyramid->subsampling; - int subhalf = subsampling / 2; - float sigma = subsampling * sigma_fact; /* empirically determined */ - int oldncols; - int i, x, y; - - if (subsampling != 2 && subsampling != 4 && - subsampling != 8 && subsampling != 16 && subsampling != 32) - KLTError("(_KLTComputePyramid) Pyramid's subsampling must " - "be either 2, 4, 8, 16, or 32"); - - assert(pyramid->ncols[0] == img->ncols); - assert(pyramid->nrows[0] == img->nrows); - - /* Copy original image to level 0 of pyramid */ - memcpy(pyramid->img[0]->data, img->data, ncols*nrows*sizeof(float)); - - currimg = img; - for (i = 1 ; i < pyramid->nLevels ; i++) { - tmpimg = _KLTCreateFloatImage(ncols, nrows); - _KLTComputeSmoothedImage(currimg, sigma, tmpimg); - - - /* Subsample */ - oldncols = ncols; - ncols /= subsampling; nrows /= subsampling; - for (y = 0 ; y < nrows ; y++) - for (x = 0 ; x < ncols ; x++) - pyramid->img[i]->data[y*ncols+x] = - tmpimg->data[(subsampling*y+subhalf)*oldncols + - (subsampling*x+subhalf)]; - - /* Reassign current image */ - currimg = pyramid->img[i]; - - _KLTFreeFloatImage(tmpimg); - } -} - - - - - - - - - - - - diff --git a/rtengine/klt/selectGoodFeatures.c b/rtengine/klt/selectGoodFeatures.c deleted file mode 100644 index c50cc8ba2..000000000 --- a/rtengine/klt/selectGoodFeatures.c +++ /dev/null @@ -1,543 +0,0 @@ -/********************************************************************* - * selectGoodFeatures.c - * - *********************************************************************/ - -/* Standard includes */ -#include -#include /* malloc(), qsort() */ -#include /* fflush() */ -#include /* memset() */ -#include /* fsqrt() */ -#define fsqrt(X) sqrt(X) - -/* Our includes */ -#include "base.h" -#include "error.h" -#include "convolve.h" -#include "klt.h" -#include "klt_util.h" -#include "pyramid.h" - -int KLT_verbose = 1; - -typedef enum {SELECTING_ALL, REPLACING_SOME} selectionMode; - - -/********************************************************************* - * _quicksort - * Replacement for qsort(). Computing time is decreased by taking - * advantage of specific knowledge of our array (that there are - * three ints associated with each point). - * - * This routine generously provided by - * Manolis Lourakis - * - * NOTE: The results of this function may be slightly different from - * those of qsort(). This is due to the fact that different sort - * algorithms have different behaviours when sorting numbers with the - * same value: Some leave them in the same relative positions in the - * array, while others change their relative positions. For example, - * if you have the array [c d b1 a b2] with b1=b2, it may be sorted as - * [a b1 b2 c d] or [a b2 b1 c d]. - */ - -#define SWAP3(list, i, j) \ -{ int *pi, *pj, tmp; \ - pi=list+3*(i); pj=list+3*(j); \ - \ - tmp=*pi; \ - *pi++=*pj; \ - *pj++=tmp; \ - \ - tmp=*pi; \ - *pi++=*pj; \ - *pj++=tmp; \ - \ - tmp=*pi; \ - *pi=*pj; \ - *pj=tmp; \ -} - -void _quicksort(int *pointlist, int n) -{ - unsigned int i, j, ln, rn; - - while (n > 1) - { - SWAP3(pointlist, 0, n/2); - for (i = 0, j = n; ; ) - { - do - --j; - while (pointlist[3*j+2] < pointlist[2]); - do - ++i; - while (i < j && pointlist[3*i+2] > pointlist[2]); - if (i >= j) - break; - SWAP3(pointlist, i, j); - } - SWAP3(pointlist, j, 0); - ln = j; - rn = n - ++j; - if (ln < rn) - { - _quicksort(pointlist, ln); - pointlist += 3*j; - n = rn; - } - else - { - _quicksort(pointlist + 3*j, rn); - n = ln; - } - } -} -#undef SWAP3 - - -/*********************************************************************/ - -static void _fillFeaturemap( - int x, int y, - uchar *featuremap, - int mindist, - int ncols, - int nrows) -{ - int ix, iy; - - for (iy = y - mindist ; iy <= y + mindist ; iy++) - for (ix = x - mindist ; ix <= x + mindist ; ix++) - if (ix >= 0 && ix < ncols && iy >= 0 && iy < nrows) - featuremap[iy*ncols+ix] = 1; -} - - -/********************************************************************* - * _enforceMinimumDistance - * - * Removes features that are within close proximity to better features. - * - * INPUTS - * featurelist: A list of features. The nFeatures property - * is used. - * - * OUTPUTS - * featurelist: Is overwritten. Nearby "redundant" features are removed. - * Writes -1's into the remaining elements. - * - * RETURNS - * The number of remaining features. - */ - -static void _enforceMinimumDistance( - int *pointlist, /* featurepoints */ - int npoints, /* number of featurepoints */ - KLT_FeatureList featurelist, /* features */ - int ncols, int nrows, /* size of images */ - int mindist, /* min. dist b/w features */ - int min_eigenvalue, /* min. eigenvalue */ - KLT_BOOL overwriteAllFeatures) -{ - int indx; /* Index into features */ - int x, y, val; /* Location and trackability of pixel under consideration */ - uchar *featuremap; /* Boolean array recording proximity of features */ - int *ptr; - - /* Cannot add features with an eigenvalue less than one */ - if (min_eigenvalue < 1) min_eigenvalue = 1; - - /* Allocate memory for feature map and clear it */ - featuremap = (uchar *) malloc(ncols * nrows * sizeof(uchar)); - memset(featuremap, 0, ncols*nrows); - - /* Necessary because code below works with (mindist-1) */ - mindist--; - - /* If we are keeping all old good features, then add them to the featuremap */ - if (!overwriteAllFeatures) - for (indx = 0 ; indx < featurelist->nFeatures ; indx++) - if (featurelist->feature[indx]->val >= 0) { - x = (int) featurelist->feature[indx]->x; - y = (int) featurelist->feature[indx]->y; - _fillFeaturemap(x, y, featuremap, mindist, ncols, nrows); - } - - /* For each feature point, in descending order of importance, do ... */ - ptr = pointlist; - indx = 0; - while (1) { - - /* If we can't add all the points, then fill in the rest - of the featurelist with -1's */ - if (ptr >= pointlist + 3*npoints) { - while (indx < featurelist->nFeatures) { - if (overwriteAllFeatures || - featurelist->feature[indx]->val < 0) { - featurelist->feature[indx]->x = -1; - featurelist->feature[indx]->y = -1; - featurelist->feature[indx]->val = KLT_NOT_FOUND; - featurelist->feature[indx]->aff_img = NULL; - featurelist->feature[indx]->aff_img_gradx = NULL; - featurelist->feature[indx]->aff_img_grady = NULL; - featurelist->feature[indx]->aff_x = -1.0; - featurelist->feature[indx]->aff_y = -1.0; - featurelist->feature[indx]->aff_Axx = 1.0; - featurelist->feature[indx]->aff_Ayx = 0.0; - featurelist->feature[indx]->aff_Axy = 0.0; - featurelist->feature[indx]->aff_Ayy = 1.0; - } - indx++; - } - break; - } - - x = *ptr++; - y = *ptr++; - val = *ptr++; - - /* Ensure that feature is in-bounds */ - assert(x >= 0); - assert(x < ncols); - assert(y >= 0); - assert(y < nrows); - - while (!overwriteAllFeatures && - indx < featurelist->nFeatures && - featurelist->feature[indx]->val >= 0) - indx++; - - if (indx >= featurelist->nFeatures) break; - - /* If no neighbor has been selected, and if the minimum - eigenvalue is large enough, then add feature to the current list */ - if (!featuremap[y*ncols+x] && val >= min_eigenvalue) { - featurelist->feature[indx]->x = (KLT_locType) x; - featurelist->feature[indx]->y = (KLT_locType) y; - featurelist->feature[indx]->val = (int) val; - featurelist->feature[indx]->aff_img = NULL; - featurelist->feature[indx]->aff_img_gradx = NULL; - featurelist->feature[indx]->aff_img_grady = NULL; - featurelist->feature[indx]->aff_x = -1.0; - featurelist->feature[indx]->aff_y = -1.0; - featurelist->feature[indx]->aff_Axx = 1.0; - featurelist->feature[indx]->aff_Ayx = 0.0; - featurelist->feature[indx]->aff_Axy = 0.0; - featurelist->feature[indx]->aff_Ayy = 1.0; - indx++; - - /* Fill in surrounding region of feature map, but - make sure that pixels are in-bounds */ - _fillFeaturemap(x, y, featuremap, mindist, ncols, nrows); - } - } - - /* Free feature map */ - free(featuremap); -} - - -/********************************************************************* - * _comparePoints - * - * Used by qsort (in _KLTSelectGoodFeatures) to determine - * which feature is better. - * By switching the '>' with the '<', qsort is fooled into sorting - * in descending order. - */ - -#ifdef KLT_USE_QSORT -static int _comparePoints(const void *a, const void *b) -{ - int v1 = *(((int *) a) + 2); - int v2 = *(((int *) b) + 2); - - if (v1 > v2) return(-1); - else if (v1 < v2) return(1); - else return(0); -} -#endif - - -/********************************************************************* - * _sortPointList - */ - -static void _sortPointList( - int *pointlist, - int npoints) -{ -#ifdef KLT_USE_QSORT - qsort(pointlist, npoints, 3*sizeof(int), _comparePoints); -#else - _quicksort(pointlist, npoints); -#endif -} - - -/********************************************************************* - * _minEigenvalue - * - * Given the three distinct elements of the symmetric 2x2 matrix - * [gxx gxy] - * [gxy gyy], - * Returns the minimum eigenvalue of the matrix. - */ - -static float _minEigenvalue(float gxx, float gxy, float gyy) -{ - return (float) ((gxx + gyy - sqrt((gxx - gyy)*(gxx - gyy) + 4*gxy*gxy))/2.0f); -} - - -/*********************************************************************/ - -void _KLTSelectGoodFeatures( - KLT_TrackingContext tc, - KLT_PixelType *img, - int ncols, - int nrows, - KLT_FeatureList featurelist, - selectionMode mode) -{ - _KLT_FloatImage floatimg, gradx, grady; - int window_hw, window_hh; - int *pointlist; - int npoints = 0; - KLT_BOOL overwriteAllFeatures = (mode == SELECTING_ALL) ? - TRUE : FALSE; - KLT_BOOL floatimages_created = FALSE; - - /* Check window size (and correct if necessary) */ - if (tc->window_width % 2 != 1) { - tc->window_width = tc->window_width+1; - KLTWarning("Tracking context's window width must be odd. " - "Changing to %d.\n", tc->window_width); - } - if (tc->window_height % 2 != 1) { - tc->window_height = tc->window_height+1; - KLTWarning("Tracking context's window height must be odd. " - "Changing to %d.\n", tc->window_height); - } - if (tc->window_width < 3) { - tc->window_width = 3; - KLTWarning("Tracking context's window width must be at least three. \n" - "Changing to %d.\n", tc->window_width); - } - if (tc->window_height < 3) { - tc->window_height = 3; - KLTWarning("Tracking context's window height must be at least three. \n" - "Changing to %d.\n", tc->window_height); - } - window_hw = tc->window_width/2; - window_hh = tc->window_height/2; - - /* Create pointlist, which is a simplified version of a featurelist, */ - /* for speed. Contains only integer locations and values. */ - pointlist = (int *) malloc(ncols * nrows * 3 * sizeof(int)); - - /* Create temporary images, etc. */ - if (mode == REPLACING_SOME && - tc->sequentialMode && tc->pyramid_last != NULL) { - floatimg = ((_KLT_Pyramid) tc->pyramid_last)->img[0]; - gradx = ((_KLT_Pyramid) tc->pyramid_last_gradx)->img[0]; - grady = ((_KLT_Pyramid) tc->pyramid_last_grady)->img[0]; - assert(gradx != NULL); - assert(grady != NULL); - } else { - floatimages_created = TRUE; - floatimg = _KLTCreateFloatImage(ncols, nrows); - gradx = _KLTCreateFloatImage(ncols, nrows); - grady = _KLTCreateFloatImage(ncols, nrows); - if (tc->smoothBeforeSelecting) { - _KLT_FloatImage tmpimg; - tmpimg = _KLTCreateFloatImage(ncols, nrows); - _KLTToFloatImage(img, ncols, nrows, tmpimg); - _KLTComputeSmoothedImage(tmpimg, _KLTComputeSmoothSigma(tc), floatimg); - _KLTFreeFloatImage(tmpimg); - } else _KLTToFloatImage(img, ncols, nrows, floatimg); - - /* Compute gradient of image in x and y direction */ - _KLTComputeGradients(floatimg, tc->grad_sigma, gradx, grady); - } - - /* Write internal images */ - if (tc->writeInternalImages) { - _KLTWriteFloatImageToPGM(floatimg, "kltimg_sgfrlf.pgm"); - _KLTWriteFloatImageToPGM(gradx, "kltimg_sgfrlf_gx.pgm"); - _KLTWriteFloatImageToPGM(grady, "kltimg_sgfrlf_gy.pgm"); - } - - /* Compute trackability of each image pixel as the minimum - of the two eigenvalues of the Z matrix */ - { - float gx, gy; - float gxx, gxy, gyy; - int xx, yy; - int *ptr; - float val; - unsigned int limit = 1; - int borderx = tc->borderx; /* Must not touch cols */ - int bordery = tc->bordery; /* lost by convolution */ - int x, y; - int i; - - if (borderx < window_hw) borderx = window_hw; - if (bordery < window_hh) bordery = window_hh; - - /* Find largest value of an int */ - for (i = 0 ; i < sizeof(int) ; i++) limit *= 256; - limit = limit/2 - 1; - - /* For most of the pixels in the image, do ... */ - ptr = pointlist; - for (y = bordery ; y < nrows - bordery ; y += tc->nSkippedPixels + 1) - for (x = borderx ; x < ncols - borderx ; x += tc->nSkippedPixels + 1) { - - /* Sum the gradients in the surrounding window */ - gxx = 0; gxy = 0; gyy = 0; - for (yy = y-window_hh ; yy <= y+window_hh ; yy++) - for (xx = x-window_hw ; xx <= x+window_hw ; xx++) { - gx = *(gradx->data + ncols*yy+xx); - gy = *(grady->data + ncols*yy+xx); - gxx += gx * gx; - gxy += gx * gy; - gyy += gy * gy; - } - - /* Store the trackability of the pixel as the minimum - of the two eigenvalues */ - *ptr++ = x; - *ptr++ = y; - val = _minEigenvalue(gxx, gxy, gyy); - if (val > limit) { - KLTWarning("(_KLTSelectGoodFeatures) minimum eigenvalue %f is " - "greater than the capacity of an int; setting " - "to maximum value", val); - val = (float) limit; - } - *ptr++ = (int) val; - npoints++; - } - } - - /* Sort the features */ - _sortPointList(pointlist, npoints); - - /* Check tc->mindist */ - if (tc->mindist < 0) { - KLTWarning("(_KLTSelectGoodFeatures) Tracking context field tc->mindist " - "is negative (%d); setting to zero", tc->mindist); - tc->mindist = 0; - } - - /* Enforce minimum distance between features */ - _enforceMinimumDistance( - pointlist, - npoints, - featurelist, - ncols, nrows, - tc->mindist, - tc->min_eigenvalue, - overwriteAllFeatures); - - /* Free memory */ - free(pointlist); - if (floatimages_created) { - _KLTFreeFloatImage(floatimg); - _KLTFreeFloatImage(gradx); - _KLTFreeFloatImage(grady); - } -} - - -/********************************************************************* - * KLTSelectGoodFeatures - * - * Main routine, visible to the outside. Finds the good features in - * an image. - * - * INPUTS - * tc: Contains parameters used in computation (size of image, - * size of window, min distance b/w features, sigma to compute - * image gradients, # of features desired). - * img: Pointer to the data of an image (probably unsigned chars). - * - * OUTPUTS - * features: List of features. The member nFeatures is computed. - */ - -void KLTSelectGoodFeatures( - KLT_TrackingContext tc, - KLT_PixelType *img, - int ncols, - int nrows, - KLT_FeatureList fl) -{ - if (KLT_verbose >= 1) { - fprintf(stderr, "(KLT) Selecting the %d best features " - "from a %d by %d image... ", fl->nFeatures, ncols, nrows); - fflush(stderr); - } - - _KLTSelectGoodFeatures(tc, img, ncols, nrows, - fl, SELECTING_ALL); - - if (KLT_verbose >= 1) { - fprintf(stderr, "\n\t%d features found.\n", - KLTCountRemainingFeatures(fl)); - if (tc->writeInternalImages) - fprintf(stderr, "\tWrote images to 'kltimg_sgfrlf*.pgm'.\n"); - fflush(stderr); - } -} - - -/********************************************************************* - * KLTReplaceLostFeatures - * - * Main routine, visible to the outside. Replaces the lost features - * in an image. - * - * INPUTS - * tc: Contains parameters used in computation (size of image, - * size of window, min distance b/w features, sigma to compute - * image gradients, # of features desired). - * img: Pointer to the data of an image (probably unsigned chars). - * - * OUTPUTS - * features: List of features. The member nFeatures is computed. - */ - -void KLTReplaceLostFeatures( - KLT_TrackingContext tc, - KLT_PixelType *img, - int ncols, - int nrows, - KLT_FeatureList fl) -{ - int nLostFeatures = fl->nFeatures - KLTCountRemainingFeatures(fl); - - if (KLT_verbose >= 1) { - fprintf(stderr, "(KLT) Attempting to replace %d features " - "in a %d by %d image... ", nLostFeatures, ncols, nrows); - fflush(stderr); - } - - /* If there are any lost features, replace them */ - if (nLostFeatures > 0) - _KLTSelectGoodFeatures(tc, img, ncols, nrows, - fl, REPLACING_SOME); - - if (KLT_verbose >= 1) { - fprintf(stderr, "\n\t%d features replaced.\n", - nLostFeatures - fl->nFeatures + KLTCountRemainingFeatures(fl)); - if (tc->writeInternalImages) - fprintf(stderr, "\tWrote images to 'kltimg_sgfrlf*.pgm'.\n"); - fflush(stderr); - } -} - - diff --git a/rtengine/klt/storeFeatures.c b/rtengine/klt/storeFeatures.c deleted file mode 100644 index 467905b50..000000000 --- a/rtengine/klt/storeFeatures.c +++ /dev/null @@ -1,117 +0,0 @@ -/********************************************************************* - * storeFeatures.c - * - *********************************************************************/ - -/* Our includes */ -#include "error.h" -#include "klt.h" - - -/********************************************************************* - * - */ - -void KLTStoreFeatureList( - KLT_FeatureList fl, - KLT_FeatureTable ft, - int frame) -{ - int feat; - - if (frame < 0 || frame >= ft->nFrames) - KLTError("(KLTStoreFeatures) Frame number %d is not between 0 and %d", - frame, ft->nFrames - 1); - - if (fl->nFeatures != ft->nFeatures) - KLTError("(KLTStoreFeatures) FeatureList and FeatureTable must " - "have the same number of features"); - - for (feat = 0 ; feat < fl->nFeatures ; feat++) { - ft->feature[feat][frame]->x = fl->feature[feat]->x; - ft->feature[feat][frame]->y = fl->feature[feat]->y; - ft->feature[feat][frame]->val = fl->feature[feat]->val; - } -} - - -/********************************************************************* - * - */ - -void KLTExtractFeatureList( - KLT_FeatureList fl, - KLT_FeatureTable ft, - int frame) -{ - int feat; - - if (frame < 0 || frame >= ft->nFrames) - KLTError("(KLTExtractFeatures) Frame number %d is not between 0 and %d", - frame, ft->nFrames - 1); - - if (fl->nFeatures != ft->nFeatures) - KLTError("(KLTExtractFeatures) FeatureList and FeatureTable must " - "have the same number of features"); - - for (feat = 0 ; feat < fl->nFeatures ; feat++) { - fl->feature[feat]->x = ft->feature[feat][frame]->x; - fl->feature[feat]->y = ft->feature[feat][frame]->y; - fl->feature[feat]->val = ft->feature[feat][frame]->val; - } -} - - -/********************************************************************* - * - */ - -void KLTStoreFeatureHistory( - KLT_FeatureHistory fh, - KLT_FeatureTable ft, - int feat) -{ - int frame; - - if (feat < 0 || feat >= ft->nFeatures) - KLTError("(KLTStoreFeatureHistory) Feature number %d is not between 0 and %d", - feat, ft->nFeatures - 1); - - if (fh->nFrames != ft->nFrames) - KLTError("(KLTStoreFeatureHistory) FeatureHistory and FeatureTable must " - "have the same number of frames"); - - for (frame = 0 ; frame < fh->nFrames ; frame++) { - ft->feature[feat][frame]->x = fh->feature[frame]->x; - ft->feature[feat][frame]->y = fh->feature[frame]->y; - ft->feature[feat][frame]->val = fh->feature[frame]->val; - } -} - - -/********************************************************************* - * - */ - -void KLTExtractFeatureHistory( - KLT_FeatureHistory fh, - KLT_FeatureTable ft, - int feat) -{ - int frame; - - if (feat < 0 || feat >= ft->nFeatures) - KLTError("(KLTExtractFeatureHistory) Feature number %d is not between 0 and %d", - feat, ft->nFeatures - 1); - - if (fh->nFrames != ft->nFrames) - KLTError("(KLTExtractFeatureHistory) FeatureHistory and FeatureTable must " - "have the same number of frames"); - - for (frame = 0 ; frame < fh->nFrames ; frame++) { - fh->feature[frame]->x = ft->feature[feat][frame]->x; - fh->feature[frame]->y = ft->feature[feat][frame]->y; - fh->feature[frame]->val = ft->feature[feat][frame]->val; - } -} - diff --git a/rtengine/klt/trackFeatures.c b/rtengine/klt/trackFeatures.c deleted file mode 100644 index ebb177639..000000000 --- a/rtengine/klt/trackFeatures.c +++ /dev/null @@ -1,1533 +0,0 @@ -/********************************************************************* - * trackFeatures.c - * - *********************************************************************/ - -/* Standard includes */ -#include -#include /* fabs() */ -#include /* malloc() */ -#include /* fflush() */ - -/* Our includes */ -#include "base.h" -#include "error.h" -#include "convolve.h" /* for computing pyramid */ -#include "klt.h" -#include "klt_util.h" /* _KLT_FloatImage */ -#include "pyramid.h" /* _KLT_Pyramid */ - -extern int KLT_verbose; - -typedef float *_FloatWindow; - -/********************************************************************* - * _interpolate - * - * Given a point (x,y) in an image, computes the bilinear interpolated - * gray-level value of the point in the image. - */ - -static float _interpolate( - float x, - float y, - _KLT_FloatImage img) -{ - int xt = (int) x; /* coordinates of top-left corner */ - int yt = (int) y; - float ax = x - xt; - float ay = y - yt; - float *ptr = img->data + (img->ncols*yt) + xt; - -#ifndef _DNDEBUG - if (xt<0 || yt<0 || xt>=img->ncols-1 || yt>=img->nrows-1) { - fprintf(stderr, "(xt,yt)=(%d,%d) imgsize=(%d,%d)\n" - "(x,y)=(%f,%f) (ax,ay)=(%f,%f)\n", - xt, yt, img->ncols, img->nrows, x, y, ax, ay); - fflush(stderr); - } -#endif - - assert (xt >= 0 && yt >= 0 && xt <= img->ncols - 2 && yt <= img->nrows - 2); - - return ( (1-ax) * (1-ay) * *ptr + - ax * (1-ay) * *(ptr+1) + - (1-ax) * ay * *(ptr+(img->ncols)) + - ax * ay * *(ptr+(img->ncols)+1) ); -} - - -/********************************************************************* - * _computeIntensityDifference - * - * Given two images and the window center in both images, - * aligns the images wrt the window and computes the difference - * between the two overlaid images. - */ - -static void _computeIntensityDifference( - _KLT_FloatImage img1, /* images */ - _KLT_FloatImage img2, - float x1, float y1, /* center of window in 1st img */ - float x2, float y2, /* center of window in 2nd img */ - int width, int height, /* size of window */ - _FloatWindow imgdiff) /* output */ -{ - int hw = width/2, hh = height/2; - float g1, g2; - int i, j; - - /* Compute values */ - for (j = -hh ; j <= hh ; j++) - for (i = -hw ; i <= hw ; i++) { - g1 = _interpolate(x1+i, y1+j, img1); - g2 = _interpolate(x2+i, y2+j, img2); - *imgdiff++ = g1 - g2; - } -} - - -/********************************************************************* - * _computeGradientSum - * - * Given two gradients and the window center in both images, - * aligns the gradients wrt the window and computes the sum of the two - * overlaid gradients. - */ - -static void _computeGradientSum( - _KLT_FloatImage gradx1, /* gradient images */ - _KLT_FloatImage grady1, - _KLT_FloatImage gradx2, - _KLT_FloatImage grady2, - float x1, float y1, /* center of window in 1st img */ - float x2, float y2, /* center of window in 2nd img */ - int width, int height, /* size of window */ - _FloatWindow gradx, /* output */ - _FloatWindow grady) /* " */ -{ - int hw = width/2, hh = height/2; - float g1, g2; - int i, j; - - /* Compute values */ - for (j = -hh ; j <= hh ; j++) - for (i = -hw ; i <= hw ; i++) { - g1 = _interpolate(x1+i, y1+j, gradx1); - g2 = _interpolate(x2+i, y2+j, gradx2); - *gradx++ = g1 + g2; - g1 = _interpolate(x1+i, y1+j, grady1); - g2 = _interpolate(x2+i, y2+j, grady2); - *grady++ = g1 + g2; - } -} - -/********************************************************************* - * _computeIntensityDifferenceLightingInsensitive - * - * Given two images and the window center in both images, - * aligns the images wrt the window and computes the difference - * between the two overlaid images; normalizes for overall gain and bias. - */ - -static void _computeIntensityDifferenceLightingInsensitive( - _KLT_FloatImage img1, /* images */ - _KLT_FloatImage img2, - float x1, float y1, /* center of window in 1st img */ - float x2, float y2, /* center of window in 2nd img */ - int width, int height, /* size of window */ - _FloatWindow imgdiff) /* output */ -{ - int hw = width/2, hh = height/2; - float g1, g2, sum1_squared = 0, sum2_squared = 0; - int i, j; - - float sum1 = 0, sum2 = 0; - float mean1, mean2,alpha,belta; - /* Compute values */ - for (j = -hh ; j <= hh ; j++) - for (i = -hw ; i <= hw ; i++) { - g1 = _interpolate(x1+i, y1+j, img1); - g2 = _interpolate(x2+i, y2+j, img2); - sum1 += g1; sum2 += g2; - sum1_squared += g1*g1; - sum2_squared += g2*g2; - } - mean1=sum1_squared/(width*height); - mean2=sum2_squared/(width*height); - alpha = (float) sqrt(mean1/mean2); - mean1=sum1/(width*height); - mean2=sum2/(width*height); - belta = mean1-alpha*mean2; - - for (j = -hh ; j <= hh ; j++) - for (i = -hw ; i <= hw ; i++) { - g1 = _interpolate(x1+i, y1+j, img1); - g2 = _interpolate(x2+i, y2+j, img2); - *imgdiff++ = g1- g2*alpha-belta; - } -} - - -/********************************************************************* - * _computeGradientSumLightingInsensitive - * - * Given two gradients and the window center in both images, - * aligns the gradients wrt the window and computes the sum of the two - * overlaid gradients; normalizes for overall gain and bias. - */ - -static void _computeGradientSumLightingInsensitive( - _KLT_FloatImage gradx1, /* gradient images */ - _KLT_FloatImage grady1, - _KLT_FloatImage gradx2, - _KLT_FloatImage grady2, - _KLT_FloatImage img1, /* images */ - _KLT_FloatImage img2, - - float x1, float y1, /* center of window in 1st img */ - float x2, float y2, /* center of window in 2nd img */ - int width, int height, /* size of window */ - _FloatWindow gradx, /* output */ - _FloatWindow grady) /* " */ -{ - int hw = width/2, hh = height/2; - float g1, g2, sum1_squared = 0, sum2_squared = 0; - int i, j; - - float sum1 = 0, sum2 = 0; - float mean1, mean2, alpha; - for (j = -hh ; j <= hh ; j++) - for (i = -hw ; i <= hw ; i++) { - g1 = _interpolate(x1+i, y1+j, img1); - g2 = _interpolate(x2+i, y2+j, img2); - sum1_squared += g1; sum2_squared += g2; - } - mean1 = sum1_squared/(width*height); - mean2 = sum2_squared/(width*height); - alpha = (float) sqrt(mean1/mean2); - - /* Compute values */ - for (j = -hh ; j <= hh ; j++) - for (i = -hw ; i <= hw ; i++) { - g1 = _interpolate(x1+i, y1+j, gradx1); - g2 = _interpolate(x2+i, y2+j, gradx2); - *gradx++ = g1 + g2*alpha; - g1 = _interpolate(x1+i, y1+j, grady1); - g2 = _interpolate(x2+i, y2+j, grady2); - *grady++ = g1+ g2*alpha; - } -} - -/********************************************************************* - * _compute2by2GradientMatrix - * - */ - -static void _compute2by2GradientMatrix( - _FloatWindow gradx, - _FloatWindow grady, - int width, /* size of window */ - int height, - float *gxx, /* return values */ - float *gxy, - float *gyy) - -{ - float gx, gy; - int i; - - /* Compute values */ - *gxx = 0.0; *gxy = 0.0; *gyy = 0.0; - for (i = 0 ; i < width * height ; i++) { - gx = *gradx++; - gy = *grady++; - *gxx += gx*gx; - *gxy += gx*gy; - *gyy += gy*gy; - } -} - - -/********************************************************************* - * _compute2by1ErrorVector - * - */ - -static void _compute2by1ErrorVector( - _FloatWindow imgdiff, - _FloatWindow gradx, - _FloatWindow grady, - int width, /* size of window */ - int height, - float step_factor, /* 2.0 comes from equations, 1.0 seems to avoid overshooting */ - float *ex, /* return values */ - float *ey) -{ - float diff; - int i; - - /* Compute values */ - *ex = 0; *ey = 0; - for (i = 0 ; i < width * height ; i++) { - diff = *imgdiff++; - *ex += diff * (*gradx++); - *ey += diff * (*grady++); - } - *ex *= step_factor; - *ey *= step_factor; -} - - -/********************************************************************* - * _solveEquation - * - * Solves the 2x2 matrix equation - * [gxx gxy] [dx] = [ex] - * [gxy gyy] [dy] = [ey] - * for dx and dy. - * - * Returns KLT_TRACKED on success and KLT_SMALL_DET on failure - */ - -static int _solveEquation( - float gxx, float gxy, float gyy, - float ex, float ey, - float small, - float *dx, float *dy) -{ - float det = gxx*gyy - gxy*gxy; - - - if (det < small) return KLT_SMALL_DET; - - *dx = (gyy*ex - gxy*ey)/det; - *dy = (gxx*ey - gxy*ex)/det; - return KLT_TRACKED; -} - - -/********************************************************************* - * _allocateFloatWindow - */ - -static _FloatWindow _allocateFloatWindow( - int width, - int height) -{ - _FloatWindow fw; - - fw = (_FloatWindow) malloc(width*height*sizeof(float)); - if (fw == NULL) KLTError("(_allocateFloatWindow) Out of memory."); - return fw; -} - - -/********************************************************************* - * _printFloatWindow - * (for debugging purposes) - */ - -/* -static void _printFloatWindow( - _FloatWindow fw, - int width, - int height) -{ - int i, j; - - fprintf(stderr, "\n"); - for (i = 0 ; i < width ; i++) { - for (j = 0 ; j < height ; j++) { - fprintf(stderr, "%6.1f ", *fw++); - } - fprintf(stderr, "\n"); - } -} -*/ - - -/********************************************************************* - * _sumAbsFloatWindow - */ - -static float _sumAbsFloatWindow( - _FloatWindow fw, - int width, - int height) -{ - float sum = 0.0; - int w; - - for ( ; height > 0 ; height--) - for (w=0 ; w < width ; w++) - sum += (float) fabs(*fw++); - - return sum; -} - - -/********************************************************************* - * _trackFeature - * - * Tracks a feature point from one image to the next. - * - * RETURNS - * KLT_SMALL_DET if feature is lost, - * KLT_MAX_ITERATIONS if tracking stopped because iterations timed out, - * KLT_TRACKED otherwise. - */ - -static int _trackFeature( - float x1, /* location of window in first image */ - float y1, - float *x2, /* starting location of search in second image */ - float *y2, - _KLT_FloatImage img1, - _KLT_FloatImage gradx1, - _KLT_FloatImage grady1, - _KLT_FloatImage img2, - _KLT_FloatImage gradx2, - _KLT_FloatImage grady2, - int width, /* size of window */ - int height, - float step_factor, /* 2.0 comes from equations, 1.0 seems to avoid overshooting */ - int max_iterations, - float small, /* determinant threshold for declaring KLT_SMALL_DET */ - float th, /* displacement threshold for stopping */ - float max_residue, /* residue threshold for declaring KLT_LARGE_RESIDUE */ - int lighting_insensitive) /* whether to normalize for gain and bias */ -{ - _FloatWindow imgdiff, gradx, grady; - float gxx, gxy, gyy, ex, ey, dx, dy; - int iteration = 0; - int status; - int hw = width/2; - int hh = height/2; - int nc = img1->ncols; - int nr = img1->nrows; - float one_plus_eps = 1.001f; /* To prevent rounding errors */ - - - /* Allocate memory for windows */ - imgdiff = _allocateFloatWindow(width, height); - gradx = _allocateFloatWindow(width, height); - grady = _allocateFloatWindow(width, height); - - /* Iteratively update the window position */ - do { - - /* If out of bounds, exit loop */ - if ( x1-hw < 0.0f || nc-( x1+hw) < one_plus_eps || - *x2-hw < 0.0f || nc-(*x2+hw) < one_plus_eps || - y1-hh < 0.0f || nr-( y1+hh) < one_plus_eps || - *y2-hh < 0.0f || nr-(*y2+hh) < one_plus_eps) { - status = KLT_OOB; - break; - } - - /* Compute gradient and difference windows */ - if (lighting_insensitive) { - _computeIntensityDifferenceLightingInsensitive(img1, img2, x1, y1, *x2, *y2, - width, height, imgdiff); - _computeGradientSumLightingInsensitive(gradx1, grady1, gradx2, grady2, - img1, img2, x1, y1, *x2, *y2, width, height, gradx, grady); - } else { - _computeIntensityDifference(img1, img2, x1, y1, *x2, *y2, - width, height, imgdiff); - _computeGradientSum(gradx1, grady1, gradx2, grady2, - x1, y1, *x2, *y2, width, height, gradx, grady); - } - - - /* Use these windows to construct matrices */ - _compute2by2GradientMatrix(gradx, grady, width, height, - &gxx, &gxy, &gyy); - _compute2by1ErrorVector(imgdiff, gradx, grady, width, height, step_factor, - &ex, &ey); - - /* Using matrices, solve equation for new displacement */ - status = _solveEquation(gxx, gxy, gyy, ex, ey, small, &dx, &dy); - if (status == KLT_SMALL_DET) break; - - *x2 += dx; - *y2 += dy; - iteration++; - - } while ((fabs(dx)>=th || fabs(dy)>=th) && iteration < max_iterations); - - /* Check whether window is out of bounds */ - if (*x2-hw < 0.0f || nc-(*x2+hw) < one_plus_eps || - *y2-hh < 0.0f || nr-(*y2+hh) < one_plus_eps) - status = KLT_OOB; - - /* Check whether residue is too large */ - if (status == KLT_TRACKED) { - if (lighting_insensitive) - _computeIntensityDifferenceLightingInsensitive(img1, img2, x1, y1, *x2, *y2, - width, height, imgdiff); - else - _computeIntensityDifference(img1, img2, x1, y1, *x2, *y2, - width, height, imgdiff); - if (_sumAbsFloatWindow(imgdiff, width, height)/(width*height) > max_residue) - status = KLT_LARGE_RESIDUE; - } - - /* Free memory */ - free(imgdiff); free(gradx); free(grady); - - /* Return appropriate value */ - if (status == KLT_SMALL_DET) return KLT_SMALL_DET; - else if (status == KLT_OOB) return KLT_OOB; - else if (status == KLT_LARGE_RESIDUE) return KLT_LARGE_RESIDUE; - else if (iteration >= max_iterations) return KLT_MAX_ITERATIONS; - else return KLT_TRACKED; - -} - - -/*********************************************************************/ - -static KLT_BOOL _outOfBounds( - float x, - float y, - int ncols, - int nrows, - int borderx, - int bordery) -{ - return (x < borderx || x > ncols-1-borderx || - y < bordery || y > nrows-1-bordery ); -} - - - - -/********************************************************************** -* CONSISTENCY CHECK OF FEATURES BY AFFINE MAPPING (BEGIN) -* -* Created by: Thorsten Thormaehlen (University of Hannover) June 2004 -* thormae@tnt.uni-hannover.de -* -* Permission is granted to any individual or institution to use, copy, modify, -* and distribute this part of the software, provided that this complete authorship -* and permission notice is maintained, intact, in all copies. -* -* This software is provided "as is" without express or implied warranty. -* -* -* The following static functions are helpers for the affine mapping. -* They all start with "_am". -* There are also small changes in other files for the -* affine mapping these are all marked by "for affine mapping" -* -* Thanks to Kevin Koeser (koeser@mip.informatik.uni-kiel.de) for fixing a bug -*/ - -#define SWAP_ME(X,Y) {temp=(X);(X)=(Y);(Y)=temp;} - -static float **_am_matrix(long nr, long nc) -{ - float **m; - int a; - m = (float **) malloc((size_t)(nr*sizeof(float*))); - m[0] = (float *) malloc((size_t)((nr*nc)*sizeof(float))); - for(a = 1; a < nr; a++) m[a] = m[a-1]+nc; - return m; -} - -static void _am_free_matrix(float **m) -{ - free(m[0]); - free(m); -} - - -static int _am_gauss_jordan_elimination(float **a, int n, float **b, int m) -{ - /* re-implemented from Numerical Recipes in C */ - int *indxc,*indxr,*ipiv; - int i,j,k,l,ll; - float big,dum,pivinv,temp; - int col = 0; - int row = 0; - - indxc=(int *)malloc((size_t) (n*sizeof(int))); - indxr=(int *)malloc((size_t) (n*sizeof(int))); - ipiv=(int *)malloc((size_t) (n*sizeof(int))); - for (j=0;j= big) { - big= (float) fabs(a[j][k]); - row=j; - col=k; - } - } else if (ipiv[k] > 1) { - free(ipiv); free(indxr); free(indxc); return KLT_SMALL_DET; - } - } - ++(ipiv[col]); - if (row != col) { - for (l=0;l=0;l--) { - if (indxr[l] != indxc[l]) - for (k=0;kncols/2, hh = window->nrows/2; - int x0 = (int) x; - int y0 = (int) y; - float * windata = window->data; - int offset; - int i, j; - - assert(x0 - hw >= 0); - assert(y0 - hh >= 0); - assert(x0 + hw <= img->ncols); - assert(y0 + hh <= img->nrows); - - /* copy values */ - for (j = -hh ; j <= hh ; j++) - for (i = -hw ; i <= hw ; i++) { - offset = (j+y0)*img->ncols + (i+x0); - *windata++ = *(img->data+offset); - } -} - -/********************************************************************* - * _am_computeIntensityDifferenceAffine - * - * Given two images and the window center in both images, - * aligns the images with the window and computes the difference - * between the two overlaid images using the affine mapping. - * A = [ Axx Axy] - * [ Ayx Ayy] -*/ - -static void _am_computeIntensityDifferenceAffine( - _KLT_FloatImage img1, /* images */ - _KLT_FloatImage img2, - float x1, float y1, /* center of window in 1st img */ - float x2, float y2, /* center of window in 2nd img */ - float Axx, float Ayx , float Axy, float Ayy, /* affine mapping */ - int width, int height, /* size of window */ - _FloatWindow imgdiff) /* output */ -{ - int hw = width/2, hh = height/2; - float g1, g2; - int i, j; - float mi, mj; - - /* Compute values */ - for (j = -hh ; j <= hh ; j++) - for (i = -hw ; i <= hw ; i++) { - g1 = _interpolate(x1+i, y1+j, img1); - mi = Axx * i + Axy * j; - mj = Ayx * i + Ayy * j; - g2 = _interpolate(x2+mi, y2+mj, img2); - *imgdiff++ = g1 - g2; - } -} - -/********************************************************************* - * _am_compute6by6GradientMatrix - * - */ - -static void _am_compute6by6GradientMatrix( - _FloatWindow gradx, - _FloatWindow grady, - int width, /* size of window */ - int height, - float **T) /* return values */ -{ - int hw = width/2, hh = height/2; - int i, j; - float gx, gy, gxx, gxy, gyy, x, y, xx, xy, yy; - - - /* Set values to zero */ - for (j = 0 ; j < 6 ; j++) { - for (i = j ; i < 6 ; i++) { - T[j][i] = 0.0; - } - } - - for (j = -hh ; j <= hh ; j++) { - for (i = -hw ; i <= hw ; i++) { - gx = *gradx++; - gy = *grady++; - gxx = gx * gx; - gxy = gx * gy; - gyy = gy * gy; - x = (float) i; - y = (float) j; - xx = x * x; - xy = x * y; - yy = y * y; - - T[0][0] += xx * gxx; - T[0][1] += xx * gxy; - T[0][2] += xy * gxx; - T[0][3] += xy * gxy; - T[0][4] += x * gxx; - T[0][5] += x * gxy; - - T[1][1] += xx * gyy; - T[1][2] += xy * gxy; - T[1][3] += xy * gyy; - T[1][4] += x * gxy; - T[1][5] += x * gyy; - - T[2][2] += yy * gxx; - T[2][3] += yy * gxy; - T[2][4] += y * gxx; - T[2][5] += y * gxy; - - T[3][3] += yy * gyy; - T[3][4] += y * gxy; - T[3][5] += y * gyy; - - T[4][4] += gxx; - T[4][5] += gxy; - - T[5][5] += gyy; - } - } - - for (j = 0 ; j < 5 ; j++) { - for (i = j+1 ; i < 6 ; i++) { - T[i][j] = T[j][i]; - } - } - -} - - - -/********************************************************************* - * _am_compute6by1ErrorVector - * - */ - -static void _am_compute6by1ErrorVector( - _FloatWindow imgdiff, - _FloatWindow gradx, - _FloatWindow grady, - int width, /* size of window */ - int height, - float **e) /* return values */ -{ - int hw = width/2, hh = height/2; - int i, j; - float diff, diffgradx, diffgrady; - - /* Set values to zero */ - for(i = 0; i < 6; i++) e[i][0] = 0.0; - - /* Compute values */ - for (j = -hh ; j <= hh ; j++) { - for (i = -hw ; i <= hw ; i++) { - diff = *imgdiff++; - diffgradx = diff * (*gradx++); - diffgrady = diff * (*grady++); - e[0][0] += diffgradx * i; - e[1][0] += diffgrady * i; - e[2][0] += diffgradx * j; - e[3][0] += diffgrady * j; - e[4][0] += diffgradx; - e[5][0] += diffgrady; - } - } - - for(i = 0; i < 6; i++) e[i][0] *= 0.5; - -} - - -/********************************************************************* - * _am_compute4by4GradientMatrix - * - */ - -static void _am_compute4by4GradientMatrix( - _FloatWindow gradx, - _FloatWindow grady, - int width, /* size of window */ - int height, - float **T) /* return values */ -{ - int hw = width/2, hh = height/2; - int i, j; - float gx, gy, x, y; - - - /* Set values to zero */ - for (j = 0 ; j < 4 ; j++) { - for (i = 0 ; i < 4 ; i++) { - T[j][i] = 0.0; - } - } - - for (j = -hh ; j <= hh ; j++) { - for (i = -hw ; i <= hw ; i++) { - gx = *gradx++; - gy = *grady++; - x = (float) i; - y = (float) j; - T[0][0] += (x*gx+y*gy) * (x*gx+y*gy); - T[0][1] += (x*gx+y*gy)*(x*gy-y*gx); - T[0][2] += (x*gx+y*gy)*gx; - T[0][3] += (x*gx+y*gy)*gy; - - T[1][1] += (x*gy-y*gx) * (x*gy-y*gx); - T[1][2] += (x*gy-y*gx)*gx; - T[1][3] += (x*gy-y*gx)*gy; - - T[2][2] += gx*gx; - T[2][3] += gx*gy; - - T[3][3] += gy*gy; - } - } - - for (j = 0 ; j < 3 ; j++) { - for (i = j+1 ; i < 4 ; i++) { - T[i][j] = T[j][i]; - } - } - -} - -/********************************************************************* - * _am_compute4by1ErrorVector - * - */ - -static void _am_compute4by1ErrorVector( - _FloatWindow imgdiff, - _FloatWindow gradx, - _FloatWindow grady, - int width, /* size of window */ - int height, - float **e) /* return values */ -{ - int hw = width/2, hh = height/2; - int i, j; - float diff, diffgradx, diffgrady; - - /* Set values to zero */ - for(i = 0; i < 4; i++) e[i][0] = 0.0; - - /* Compute values */ - for (j = -hh ; j <= hh ; j++) { - for (i = -hw ; i <= hw ; i++) { - diff = *imgdiff++; - diffgradx = diff * (*gradx++); - diffgrady = diff * (*grady++); - e[0][0] += diffgradx * i + diffgrady * j; - e[1][0] += diffgrady * i - diffgradx * j; - e[2][0] += diffgradx; - e[3][0] += diffgrady; - } - } - - for(i = 0; i < 4; i++) e[i][0] *= 0.5; - -} - - - -/********************************************************************* - * _am_trackFeatureAffine - * - * Tracks a feature point from the image of first occurrence to the actual image. - * - * RETURNS - * KLT_SMALL_DET or KLT_LARGE_RESIDUE or KLT_OOB if feature is lost, - * KLT_TRACKED otherwise. - */ - -/* if you enalbe the DEBUG_AFFINE_MAPPING make sure you have created a directory "./debug" */ -/* #define DEBUG_AFFINE_MAPPING */ - -#ifdef DEBUG_AFFINE_MAPPING -static int counter = 0; -static int glob_index = 0; -#endif - -static int _am_trackFeatureAffine( - float x1, /* location of window in first image */ - float y1, - float *x2, /* starting location of search in second image */ - float *y2, - _KLT_FloatImage img1, - _KLT_FloatImage gradx1, - _KLT_FloatImage grady1, - _KLT_FloatImage img2, - _KLT_FloatImage gradx2, - _KLT_FloatImage grady2, - int width, /* size of window */ - int height, - float step_factor, /* 2.0 comes from equations, 1.0 seems to avoid overshooting */ - int max_iterations, - float small, /* determinant threshold for declaring KLT_SMALL_DET */ - float th, /* displacement threshold for stopping */ - float th_aff, - float max_residue, /* residue threshold for declaring KLT_LARGE_RESIDUE */ - int lighting_insensitive, /* whether to normalize for gain and bias */ - int affine_map, /* whether to evaluates the consistency of features with affine mapping */ - float mdd, /* difference between the displacements */ - float *Axx, float *Ayx, - float *Axy, float *Ayy) /* used affine mapping */ -{ - - - _FloatWindow imgdiff, gradx, grady; - float gxx, gxy, gyy, ex, ey, dx, dy; - int iteration = 0; - int status = 0; - int hw = width/2; - int hh = height/2; - int nc1 = img1->ncols; - int nr1 = img1->nrows; - int nc2 = img2->ncols; - int nr2 = img2->nrows; - float **a; - float **T; - float one_plus_eps = 1.001f; /* To prevent rounding errors */ - float old_x2 = *x2; - float old_y2 = *y2; - KLT_BOOL convergence = FALSE; - -#ifdef DEBUG_AFFINE_MAPPING - char fname[80]; - _KLT_FloatImage aff_diff_win = _KLTCreateFloatImage(width,height); - printf("starting location x2=%f y2=%f\n", *x2, *y2); -#endif - - /* Allocate memory for windows */ - imgdiff = _allocateFloatWindow(width, height); - gradx = _allocateFloatWindow(width, height); - grady = _allocateFloatWindow(width, height); - T = _am_matrix(6,6); - a = _am_matrix(6,1); - - /* Iteratively update the window position */ - do { - if(!affine_map) { - /* pure translation tracker */ - - /* If out of bounds, exit loop */ - if ( x1-hw < 0.0f || nc1-( x1+hw) < one_plus_eps || - *x2-hw < 0.0f || nc2-(*x2+hw) < one_plus_eps || - y1-hh < 0.0f || nr1-( y1+hh) < one_plus_eps || - *y2-hh < 0.0f || nr2-(*y2+hh) < one_plus_eps) { - status = KLT_OOB; - break; - } - - /* Compute gradient and difference windows */ - if (lighting_insensitive) { - _computeIntensityDifferenceLightingInsensitive(img1, img2, x1, y1, *x2, *y2, - width, height, imgdiff); - _computeGradientSumLightingInsensitive(gradx1, grady1, gradx2, grady2, - img1, img2, x1, y1, *x2, *y2, width, height, gradx, grady); - } else { - _computeIntensityDifference(img1, img2, x1, y1, *x2, *y2, - width, height, imgdiff); - _computeGradientSum(gradx1, grady1, gradx2, grady2, - x1, y1, *x2, *y2, width, height, gradx, grady); - } - -#ifdef DEBUG_AFFINE_MAPPING - aff_diff_win->data = imgdiff; - sprintf(fname, "./debug/kltimg_trans_diff_win%03d.%03d.pgm", glob_index, counter); - printf("%s\n", fname); - _KLTWriteAbsFloatImageToPGM(aff_diff_win, fname,256.0); - printf("iter = %d translation tracker res: %f\n", iteration, _sumAbsFloatWindow(imgdiff, width, height)/(width*height)); -#endif - - /* Use these windows to construct matrices */ - _compute2by2GradientMatrix(gradx, grady, width, height, - &gxx, &gxy, &gyy); - _compute2by1ErrorVector(imgdiff, gradx, grady, width, height, step_factor, - &ex, &ey); - - /* Using matrices, solve equation for new displacement */ - status = _solveEquation(gxx, gxy, gyy, ex, ey, small, &dx, &dy); - - convergence = (fabs(dx) < th && fabs(dy) < th); - - *x2 += dx; - *y2 += dy; - - }else{ - /* affine tracker */ - - float ul_x = *Axx * (-hw) + *Axy * hh + *x2; /* upper left corner */ - float ul_y = *Ayx * (-hw) + *Ayy * hh + *y2; - float ll_x = *Axx * (-hw) + *Axy * (-hh) + *x2; /* lower left corner */ - float ll_y = *Ayx * (-hw) + *Ayy * (-hh) + *y2; - float ur_x = *Axx * hw + *Axy * hh + *x2; /* upper right corner */ - float ur_y = *Ayx * hw + *Ayy * hh + *y2; - float lr_x = *Axx * hw + *Axy * (-hh) + *x2; /* lower right corner */ - float lr_y = *Ayx * hw + *Ayy * (-hh) + *y2; - - /* If out of bounds, exit loop */ - if ( x1-hw < 0.0f || nc1-(x1+hw) < one_plus_eps || - y1-hh < 0.0f || nr1-(y1+hh) < one_plus_eps || - ul_x < 0.0f || nc2-(ul_x ) < one_plus_eps || - ll_x < 0.0f || nc2-(ll_x ) < one_plus_eps || - ur_x < 0.0f || nc2-(ur_x ) < one_plus_eps || - lr_x < 0.0f || nc2-(lr_x ) < one_plus_eps || - ul_y < 0.0f || nr2-(ul_y ) < one_plus_eps || - ll_y < 0.0f || nr2-(ll_y ) < one_plus_eps || - ur_y < 0.0f || nr2-(ur_y ) < one_plus_eps || - lr_y < 0.0f || nr2-(lr_y ) < one_plus_eps) { - status = KLT_OOB; - break; - } - -#ifdef DEBUG_AFFINE_MAPPING - counter++; - _am_computeAffineMappedImage(img1, x1, y1, 1.0, 0.0 , 0.0, 1.0, width, height, imgdiff); - aff_diff_win->data = imgdiff; - sprintf(fname, "./debug/kltimg_aff_diff_win%03d.%03d_1.pgm", glob_index, counter); - printf("%s\n", fname); - _KLTWriteAbsFloatImageToPGM(aff_diff_win, fname,256.0); - - _am_computeAffineMappedImage(img2, *x2, *y2, *Axx, *Ayx , *Axy, *Ayy, width, height, imgdiff); - aff_diff_win->data = imgdiff; - sprintf(fname, "./debug/kltimg_aff_diff_win%03d.%03d_2.pgm", glob_index, counter); - printf("%s\n", fname); - _KLTWriteAbsFloatImageToPGM(aff_diff_win, fname,256.0); -#endif - - _am_computeIntensityDifferenceAffine(img1, img2, x1, y1, *x2, *y2, *Axx, *Ayx , *Axy, *Ayy, - width, height, imgdiff); -#ifdef DEBUG_AFFINE_MAPPING - aff_diff_win->data = imgdiff; - sprintf(fname, "./debug/kltimg_aff_diff_win%03d.%03d_3.pgm", glob_index,counter); - printf("%s\n", fname); - _KLTWriteAbsFloatImageToPGM(aff_diff_win, fname,256.0); - - printf("iter = %d affine tracker res: %f\n", iteration, _sumAbsFloatWindow(imgdiff, width, height)/(width*height)); -#endif - - _am_getGradientWinAffine(gradx2, grady2, *x2, *y2, *Axx, *Ayx , *Axy, *Ayy, - width, height, gradx, grady); - - switch(affine_map){ - case 1: - _am_compute4by1ErrorVector(imgdiff, gradx, grady, width, height, a); - _am_compute4by4GradientMatrix(gradx, grady, width, height, T); - - status = _am_gauss_jordan_elimination(T,4,a,1); - - *Axx += a[0][0]; - *Ayx += a[1][0]; - *Ayy = *Axx; - *Axy = -(*Ayx); - - dx = a[2][0]; - dy = a[3][0]; - - break; - case 2: - _am_compute6by1ErrorVector(imgdiff, gradx, grady, width, height, a); - _am_compute6by6GradientMatrix(gradx, grady, width, height, T); - - status = _am_gauss_jordan_elimination(T,6,a,1); - - *Axx += a[0][0]; - *Ayx += a[1][0]; - *Axy += a[2][0]; - *Ayy += a[3][0]; - - dx = a[4][0]; - dy = a[5][0]; - - break; - } - - *x2 += dx; - *y2 += dy; - - /* old upper left corner - new upper left corner */ - ul_x -= *Axx * (-hw) + *Axy * hh + *x2; - ul_y -= *Ayx * (-hw) + *Ayy * hh + *y2; - /* old lower left corner - new lower left corner */ - ll_x -= *Axx * (-hw) + *Axy * (-hh) + *x2; - ll_y -= *Ayx * (-hw) + *Ayy * (-hh) + *y2; - /* old upper right corner - new upper right corner */ - ur_x -= *Axx * hw + *Axy * hh + *x2; - ur_y -= *Ayx * hw + *Ayy * hh + *y2; - /* old lower right corner - new lower right corner */ - lr_x -= *Axx * hw + *Axy * (-hh) + *x2; - lr_y -= *Ayx * hw + *Ayy * (-hh) + *y2; - -#ifdef DEBUG_AFFINE_MAPPING - printf ("iter = %d, ul_x=%f ul_y=%f ll_x=%f ll_y=%f ur_x=%f ur_y=%f lr_x=%f lr_y=%f \n", - iteration, ul_x, ul_y, ll_x, ll_y, ur_x, ur_y, lr_x, lr_y); -#endif - - convergence = (fabs(dx) < th && fabs(dy) < th && - fabs(ul_x) < th_aff && fabs(ul_y) < th_aff && - fabs(ll_x) < th_aff && fabs(ll_y) < th_aff && - fabs(ur_x) < th_aff && fabs(ur_y) < th_aff && - fabs(lr_x) < th_aff && fabs(lr_y) < th_aff); - } - - if (status == KLT_SMALL_DET) break; - iteration++; -#ifdef DEBUG_AFFINE_MAPPING - printf ("iter = %d, x1=%f, y1=%f, x2=%f, y2=%f, Axx=%f, Ayx=%f , Axy=%f, Ayy=%f \n",iteration, x1, y1, *x2, *y2, *Axx, *Ayx , *Axy, *Ayy); -#endif - } while ( !convergence && iteration < max_iterations); - /*} while ( (fabs(dx)>=th || fabs(dy)>=th || (affine_map && iteration < 8) ) && iteration < max_iterations); */ - _am_free_matrix(T); - _am_free_matrix(a); - - /* Check whether window is out of bounds */ - if (*x2-hw < 0.0f || nc2-(*x2+hw) < one_plus_eps || - *y2-hh < 0.0f || nr2-(*y2+hh) < one_plus_eps) - status = KLT_OOB; - - /* Check whether feature point has moved to much during iteration*/ - if ( (*x2-old_x2) > mdd || (*y2-old_y2) > mdd ) - status = KLT_OOB; - - /* Check whether residue is too large */ - if (status == KLT_TRACKED) { - if(!affine_map){ - _computeIntensityDifference(img1, img2, x1, y1, *x2, *y2, - width, height, imgdiff); - }else{ - _am_computeIntensityDifferenceAffine(img1, img2, x1, y1, *x2, *y2, *Axx, *Ayx , *Axy, *Ayy, - width, height, imgdiff); - } -#ifdef DEBUG_AFFINE_MAPPING - printf("iter = %d final_res = %f\n", iteration, _sumAbsFloatWindow(imgdiff, width, height)/(width*height)); -#endif - if (_sumAbsFloatWindow(imgdiff, width, height)/(width*height) > max_residue) - status = KLT_LARGE_RESIDUE; - } - - /* Free memory */ - free(imgdiff); free(gradx); free(grady); - -#ifdef DEBUG_AFFINE_MAPPING - printf("iter = %d status=%d\n", iteration, status); - _KLTFreeFloatImage( aff_diff_win ); -#endif - - /* Return appropriate value */ - return status; -} - -/* - * CONSISTENCY CHECK OF FEATURES BY AFFINE MAPPING (END) - **********************************************************************/ - - - -/********************************************************************* - * KLTTrackFeatures - * - * Tracks feature points from one image to the next. - */ - -void KLTTrackFeatures( - KLT_TrackingContext tc, - KLT_PixelType *img1, - KLT_PixelType *img2, - int ncols, - int nrows, - KLT_FeatureList featurelist) -{ - _KLT_FloatImage tmpimg, floatimg1, floatimg2; - _KLT_Pyramid pyramid1, pyramid1_gradx, pyramid1_grady, - pyramid2, pyramid2_gradx, pyramid2_grady; - float subsampling = (float) tc->subsampling; - float xloc, yloc, xlocout, ylocout; - int val; - int indx, r; - KLT_BOOL floatimg1_created = FALSE; - int i; - - if (KLT_verbose >= 1) { - fprintf(stderr, "(KLT) Tracking %d features in a %d by %d image... ", - KLTCountRemainingFeatures(featurelist), ncols, nrows); - fflush(stderr); - } - - /* Check window size (and correct if necessary) */ - if (tc->window_width % 2 != 1) { - tc->window_width = tc->window_width+1; - KLTWarning("Tracking context's window width must be odd. " - "Changing to %d.\n", tc->window_width); - } - if (tc->window_height % 2 != 1) { - tc->window_height = tc->window_height+1; - KLTWarning("Tracking context's window height must be odd. " - "Changing to %d.\n", tc->window_height); - } - if (tc->window_width < 3) { - tc->window_width = 3; - KLTWarning("Tracking context's window width must be at least three. \n" - "Changing to %d.\n", tc->window_width); - } - if (tc->window_height < 3) { - tc->window_height = 3; - KLTWarning("Tracking context's window height must be at least three. \n" - "Changing to %d.\n", tc->window_height); - } - - /* Create temporary image */ - tmpimg = _KLTCreateFloatImage(ncols, nrows); - - /* Process first image by converting to float, smoothing, computing */ - /* pyramid, and computing gradient pyramids */ - if (tc->sequentialMode && tc->pyramid_last != NULL) { - pyramid1 = (_KLT_Pyramid) tc->pyramid_last; - pyramid1_gradx = (_KLT_Pyramid) tc->pyramid_last_gradx; - pyramid1_grady = (_KLT_Pyramid) tc->pyramid_last_grady; - if (pyramid1->ncols[0] != ncols || pyramid1->nrows[0] != nrows) - KLTError("(KLTTrackFeatures) Size of incoming image (%d by %d) " - "is different from size of previous image (%d by %d)\n", - ncols, nrows, pyramid1->ncols[0], pyramid1->nrows[0]); - assert(pyramid1_gradx != NULL); - assert(pyramid1_grady != NULL); - } else { - floatimg1_created = TRUE; - floatimg1 = _KLTCreateFloatImage(ncols, nrows); - _KLTToFloatImage(img1, ncols, nrows, tmpimg); - _KLTComputeSmoothedImage(tmpimg, _KLTComputeSmoothSigma(tc), floatimg1); - pyramid1 = _KLTCreatePyramid(ncols, nrows, (int) subsampling, tc->nPyramidLevels); - _KLTComputePyramid(floatimg1, pyramid1, tc->pyramid_sigma_fact); - pyramid1_gradx = _KLTCreatePyramid(ncols, nrows, (int) subsampling, tc->nPyramidLevels); - pyramid1_grady = _KLTCreatePyramid(ncols, nrows, (int) subsampling, tc->nPyramidLevels); - for (i = 0 ; i < tc->nPyramidLevels ; i++) - _KLTComputeGradients(pyramid1->img[i], tc->grad_sigma, - pyramid1_gradx->img[i], - pyramid1_grady->img[i]); - } - - /* Do the same thing with second image */ - floatimg2 = _KLTCreateFloatImage(ncols, nrows); - _KLTToFloatImage(img2, ncols, nrows, tmpimg); - _KLTComputeSmoothedImage(tmpimg, _KLTComputeSmoothSigma(tc), floatimg2); - pyramid2 = _KLTCreatePyramid(ncols, nrows, (int) subsampling, tc->nPyramidLevels); - _KLTComputePyramid(floatimg2, pyramid2, tc->pyramid_sigma_fact); - pyramid2_gradx = _KLTCreatePyramid(ncols, nrows, (int) subsampling, tc->nPyramidLevels); - pyramid2_grady = _KLTCreatePyramid(ncols, nrows, (int) subsampling, tc->nPyramidLevels); - for (i = 0 ; i < tc->nPyramidLevels ; i++) - _KLTComputeGradients(pyramid2->img[i], tc->grad_sigma, - pyramid2_gradx->img[i], - pyramid2_grady->img[i]); - - /* Write internal images */ - if (tc->writeInternalImages) { - char fname[80]; - for (i = 0 ; i < tc->nPyramidLevels ; i++) { - sprintf(fname, "kltimg_tf_i%d.pgm", i); - _KLTWriteFloatImageToPGM(pyramid1->img[i], fname); - sprintf(fname, "kltimg_tf_i%d_gx.pgm", i); - _KLTWriteFloatImageToPGM(pyramid1_gradx->img[i], fname); - sprintf(fname, "kltimg_tf_i%d_gy.pgm", i); - _KLTWriteFloatImageToPGM(pyramid1_grady->img[i], fname); - sprintf(fname, "kltimg_tf_j%d.pgm", i); - _KLTWriteFloatImageToPGM(pyramid2->img[i], fname); - sprintf(fname, "kltimg_tf_j%d_gx.pgm", i); - _KLTWriteFloatImageToPGM(pyramid2_gradx->img[i], fname); - sprintf(fname, "kltimg_tf_j%d_gy.pgm", i); - _KLTWriteFloatImageToPGM(pyramid2_grady->img[i], fname); - } - } - - /* For each feature, do ... */ - for (indx = 0 ; indx < featurelist->nFeatures ; indx++) { - - /* Only track features that are not lost */ - if (featurelist->feature[indx]->val >= 0) { - - xloc = featurelist->feature[indx]->x; - yloc = featurelist->feature[indx]->y; - - /* Transform location to coarsest resolution */ - for (r = tc->nPyramidLevels - 1 ; r >= 0 ; r--) { - xloc /= subsampling; yloc /= subsampling; - } - xlocout = xloc; ylocout = yloc; - - /* Beginning with coarsest resolution, do ... */ - for (r = tc->nPyramidLevels - 1 ; r >= 0 ; r--) { - - /* Track feature at current resolution */ - xloc *= subsampling; yloc *= subsampling; - xlocout *= subsampling; ylocout *= subsampling; - - val = _trackFeature(xloc, yloc, - &xlocout, &ylocout, - pyramid1->img[r], - pyramid1_gradx->img[r], pyramid1_grady->img[r], - pyramid2->img[r], - pyramid2_gradx->img[r], pyramid2_grady->img[r], - tc->window_width, tc->window_height, - tc->step_factor, - tc->max_iterations, - tc->min_determinant, - tc->min_displacement, - tc->max_residue, - tc->lighting_insensitive); - - if (val==KLT_SMALL_DET || val==KLT_OOB) - break; - } - - /* Record feature */ - if (val == KLT_OOB) { - featurelist->feature[indx]->x = -1.0; - featurelist->feature[indx]->y = -1.0; - featurelist->feature[indx]->val = KLT_OOB; - if( featurelist->feature[indx]->aff_img ) _KLTFreeFloatImage(featurelist->feature[indx]->aff_img); - if( featurelist->feature[indx]->aff_img_gradx ) _KLTFreeFloatImage(featurelist->feature[indx]->aff_img_gradx); - if( featurelist->feature[indx]->aff_img_grady ) _KLTFreeFloatImage(featurelist->feature[indx]->aff_img_grady); - featurelist->feature[indx]->aff_img = NULL; - featurelist->feature[indx]->aff_img_gradx = NULL; - featurelist->feature[indx]->aff_img_grady = NULL; - - } else if (_outOfBounds(xlocout, ylocout, ncols, nrows, tc->borderx, tc->bordery)) { - featurelist->feature[indx]->x = -1.0; - featurelist->feature[indx]->y = -1.0; - featurelist->feature[indx]->val = KLT_OOB; - if( featurelist->feature[indx]->aff_img ) _KLTFreeFloatImage(featurelist->feature[indx]->aff_img); - if( featurelist->feature[indx]->aff_img_gradx ) _KLTFreeFloatImage(featurelist->feature[indx]->aff_img_gradx); - if( featurelist->feature[indx]->aff_img_grady ) _KLTFreeFloatImage(featurelist->feature[indx]->aff_img_grady); - featurelist->feature[indx]->aff_img = NULL; - featurelist->feature[indx]->aff_img_gradx = NULL; - featurelist->feature[indx]->aff_img_grady = NULL; - } else if (val == KLT_SMALL_DET) { - featurelist->feature[indx]->x = -1.0; - featurelist->feature[indx]->y = -1.0; - featurelist->feature[indx]->val = KLT_SMALL_DET; - if( featurelist->feature[indx]->aff_img ) _KLTFreeFloatImage(featurelist->feature[indx]->aff_img); - if( featurelist->feature[indx]->aff_img_gradx ) _KLTFreeFloatImage(featurelist->feature[indx]->aff_img_gradx); - if( featurelist->feature[indx]->aff_img_grady ) _KLTFreeFloatImage(featurelist->feature[indx]->aff_img_grady); - featurelist->feature[indx]->aff_img = NULL; - featurelist->feature[indx]->aff_img_gradx = NULL; - featurelist->feature[indx]->aff_img_grady = NULL; - } else if (val == KLT_LARGE_RESIDUE) { - featurelist->feature[indx]->x = -1.0; - featurelist->feature[indx]->y = -1.0; - featurelist->feature[indx]->val = KLT_LARGE_RESIDUE; - if( featurelist->feature[indx]->aff_img ) _KLTFreeFloatImage(featurelist->feature[indx]->aff_img); - if( featurelist->feature[indx]->aff_img_gradx ) _KLTFreeFloatImage(featurelist->feature[indx]->aff_img_gradx); - if( featurelist->feature[indx]->aff_img_grady ) _KLTFreeFloatImage(featurelist->feature[indx]->aff_img_grady); - featurelist->feature[indx]->aff_img = NULL; - featurelist->feature[indx]->aff_img_gradx = NULL; - featurelist->feature[indx]->aff_img_grady = NULL; - } else if (val == KLT_MAX_ITERATIONS) { - featurelist->feature[indx]->x = -1.0; - featurelist->feature[indx]->y = -1.0; - featurelist->feature[indx]->val = KLT_MAX_ITERATIONS; - if( featurelist->feature[indx]->aff_img ) _KLTFreeFloatImage(featurelist->feature[indx]->aff_img); - if( featurelist->feature[indx]->aff_img_gradx ) _KLTFreeFloatImage(featurelist->feature[indx]->aff_img_gradx); - if( featurelist->feature[indx]->aff_img_grady ) _KLTFreeFloatImage(featurelist->feature[indx]->aff_img_grady); - featurelist->feature[indx]->aff_img = NULL; - featurelist->feature[indx]->aff_img_gradx = NULL; - featurelist->feature[indx]->aff_img_grady = NULL; - } else { - featurelist->feature[indx]->x = xlocout; - featurelist->feature[indx]->y = ylocout; - featurelist->feature[indx]->val = KLT_TRACKED; - if (tc->affineConsistencyCheck >= 0 && val == KLT_TRACKED) { /*for affine mapping*/ - int border = 2; /* add border for interpolation */ - -#ifdef DEBUG_AFFINE_MAPPING - glob_index = indx; -#endif - - if(!featurelist->feature[indx]->aff_img){ - /* save image and gradient for each feature at finest resolution after first successful track */ - featurelist->feature[indx]->aff_img = _KLTCreateFloatImage((tc->affine_window_width+border), (tc->affine_window_height+border)); - featurelist->feature[indx]->aff_img_gradx = _KLTCreateFloatImage((tc->affine_window_width+border), (tc->affine_window_height+border)); - featurelist->feature[indx]->aff_img_grady = _KLTCreateFloatImage((tc->affine_window_width+border), (tc->affine_window_height+border)); - _am_getSubFloatImage(pyramid1->img[0],xloc,yloc,featurelist->feature[indx]->aff_img); - _am_getSubFloatImage(pyramid1_gradx->img[0],xloc,yloc,featurelist->feature[indx]->aff_img_gradx); - _am_getSubFloatImage(pyramid1_grady->img[0],xloc,yloc,featurelist->feature[indx]->aff_img_grady); - featurelist->feature[indx]->aff_x = xloc - (int) xloc + (tc->affine_window_width+border)/2; - featurelist->feature[indx]->aff_y = yloc - (int) yloc + (tc->affine_window_height+border)/2;; - }else{ - /* affine tracking */ - val = _am_trackFeatureAffine(featurelist->feature[indx]->aff_x, featurelist->feature[indx]->aff_y, - &xlocout, &ylocout, - featurelist->feature[indx]->aff_img, - featurelist->feature[indx]->aff_img_gradx, - featurelist->feature[indx]->aff_img_grady, - pyramid2->img[0], - pyramid2_gradx->img[0], pyramid2_grady->img[0], - tc->affine_window_width, tc->affine_window_height, - tc->step_factor, - tc->affine_max_iterations, - tc->min_determinant, - tc->min_displacement, - tc->affine_min_displacement, - tc->affine_max_residue, - tc->lighting_insensitive, - tc->affineConsistencyCheck, - tc->affine_max_displacement_differ, - &featurelist->feature[indx]->aff_Axx, - &featurelist->feature[indx]->aff_Ayx, - &featurelist->feature[indx]->aff_Axy, - &featurelist->feature[indx]->aff_Ayy - ); - featurelist->feature[indx]->val = val; - if(val != KLT_TRACKED){ - featurelist->feature[indx]->x = -1.0; - featurelist->feature[indx]->y = -1.0; - featurelist->feature[indx]->aff_x = -1.0; - featurelist->feature[indx]->aff_y = -1.0; - /* free image and gradient for lost feature */ - _KLTFreeFloatImage(featurelist->feature[indx]->aff_img); - _KLTFreeFloatImage(featurelist->feature[indx]->aff_img_gradx); - _KLTFreeFloatImage(featurelist->feature[indx]->aff_img_grady); - featurelist->feature[indx]->aff_img = NULL; - featurelist->feature[indx]->aff_img_gradx = NULL; - featurelist->feature[indx]->aff_img_grady = NULL; - }else{ - /*featurelist->feature[indx]->x = xlocout;*/ - /*featurelist->feature[indx]->y = ylocout;*/ - } - } - } - - } - } - } - - if (tc->sequentialMode) { - tc->pyramid_last = pyramid2; - tc->pyramid_last_gradx = pyramid2_gradx; - tc->pyramid_last_grady = pyramid2_grady; - } else { - _KLTFreePyramid(pyramid2); - _KLTFreePyramid(pyramid2_gradx); - _KLTFreePyramid(pyramid2_grady); - } - - /* Free memory */ - _KLTFreeFloatImage(tmpimg); - if (floatimg1_created) _KLTFreeFloatImage(floatimg1); - _KLTFreeFloatImage(floatimg2); - _KLTFreePyramid(pyramid1); - _KLTFreePyramid(pyramid1_gradx); - _KLTFreePyramid(pyramid1_grady); - - if (KLT_verbose >= 1) { - fprintf(stderr, "\n\t%d features successfully tracked.\n", - KLTCountRemainingFeatures(featurelist)); - if (tc->writeInternalImages) - fprintf(stderr, "\tWrote images to 'kltimg_tf*.pgm'.\n"); - fflush(stderr); - } - -} - - diff --git a/rtengine/klt/writeFeatures.c b/rtengine/klt/writeFeatures.c deleted file mode 100644 index a97ac8b8f..000000000 --- a/rtengine/klt/writeFeatures.c +++ /dev/null @@ -1,743 +0,0 @@ -/********************************************************************* - * writeFeatures.c - * - ********************************************************************* - */ - -/* Standard includes */ -#include -#include /* isdigit() */ -#include /* sprintf(), fprintf(), sscanf(), fscanf() */ -#include /* malloc() */ -#include /* memcpy(), strcmp() */ - -/* Our includes */ -#include "base.h" -#include "error.h" -#include "pnmio.h" /* ppmWriteFileRGB() */ -#include "klt.h" - -#define BINHEADERLENGTH 6 - -extern int KLT_verbose; - -typedef enum {FEATURE_LIST, FEATURE_HISTORY, FEATURE_TABLE} structureType; - -static char warning_line[] = "!!! Warning: This is a KLT data file. " - "Do not modify below this line !!!\n"; -static char binheader_fl[BINHEADERLENGTH+1] = "KLTFL1"; -static char binheader_fh[BINHEADERLENGTH+1] = "KLTFH1"; -static char binheader_ft[BINHEADERLENGTH+1] = "KLTFT1"; - -/********************************************************************* - * KLTWriteFeatureListToPPM - */ - -void KLTWriteFeatureListToPPM( - KLT_FeatureList featurelist, - KLT_PixelType *greyimg, - int ncols, - int nrows, - char *filename) -{ - int nbytes = ncols * nrows * sizeof(char); - uchar *redimg, *grnimg, *bluimg; - int offset; - int x, y, xx, yy; - int i; - - if (KLT_verbose >= 1) - fprintf(stderr, "(KLT) Writing %d features to PPM file: '%s'\n", - KLTCountRemainingFeatures(featurelist), filename); - - /* Allocate memory for component images */ - redimg = (uchar *) malloc(nbytes); - grnimg = (uchar *) malloc(nbytes); - bluimg = (uchar *) malloc(nbytes); - if (redimg == NULL || grnimg == NULL || bluimg == NULL) - KLTError("(KLTWriteFeaturesToPPM) Out of memory\n"); - - /* Copy grey image to component images */ - if (sizeof(KLT_PixelType) != 1) - KLTWarning("(KLTWriteFeaturesToPPM) KLT_PixelType is not uchar"); - memcpy(redimg, greyimg, nbytes); - memcpy(grnimg, greyimg, nbytes); - memcpy(bluimg, greyimg, nbytes); - - /* Overlay features in red */ - for (i = 0 ; i < featurelist->nFeatures ; i++) - if (featurelist->feature[i]->val >= 0) { - x = (int) (featurelist->feature[i]->x + 0.5); - y = (int) (featurelist->feature[i]->y + 0.5); - for (yy = y - 1 ; yy <= y + 1 ; yy++) - for (xx = x - 1 ; xx <= x + 1 ; xx++) - if (xx >= 0 && yy >= 0 && xx < ncols && yy < nrows) { - offset = yy * ncols + xx; - *(redimg + offset) = 255; - *(grnimg + offset) = 0; - *(bluimg + offset) = 0; - } - } - - /* Write to PPM file */ - ppmWriteFileRGB(filename, redimg, grnimg, bluimg, ncols, nrows); - - /* Free memory */ - free(redimg); - free(grnimg); - free(bluimg); -} - - -static FILE* _printSetupTxt( - char *fname, /* Input: filename, or NULL for stderr */ - char *fmt, /* Input: format (e.g., %5.1f or %3d) */ - char *format, /* Output: format (e.g., (%5.1f,%5.1f)=%3d) */ - char *type) /* Output: either 'f' or 'd', based on input format */ -{ - FILE *fp; - const int val_width = 5; - int i; - - /* Either open file or use stderr */ - if (fname == NULL) fp = stderr; - else fp = fopen(fname, "wb"); - if (fp == NULL) - KLTError("(KLTWriteFeatures) " - "Can't open file '%s' for writing\n", fname); - - /* Parse format */ - if (fmt[0] != '%') - KLTError("(KLTWriteFeatures) Bad Format: %s\n", fmt); - i = 0; while (fmt[i] != '\0') i++; *type = fmt[i-1]; - if (*type != 'f' && *type != 'd') - KLTError("(KLTWriteFeatures) Format must end in 'f' or 'd'."); - - /* Construct feature format */ - sprintf(format, "(%s,%s)=%%%dd ", fmt, fmt, val_width); - - return fp; -} - - -static FILE* _printSetupBin( - char *fname) /* Input: filename */ -{ - FILE *fp; - if (fname == NULL) - KLTError("(KLTWriteFeatures) Can't write binary data to stderr"); - fp = fopen(fname, "wb"); - if (fp == NULL) - KLTError("(KLTWriteFeatures) " - "Can't open file '%s' for writing", fname); - return fp; -} - - -static void _printNhyphens( - FILE *fp, - int n) -{ - int i; - for (i = 0 ; i < n ; i++) - fprintf(fp, "-"); -} - -static void _printInteger( - FILE *fp, - int integer, - int width) -{ - char fmt[80]; - sprintf(fmt, "%%%dd", width); - fprintf(fp, fmt, integer); -} - - -static KLT_BOOL _isCharInString( - char c, - char *str) -{ - int width = strlen(str); - int i; - - for (i = 0 ; i < width ; i++) - if (c == str[i]) return TRUE; - - return FALSE; -} - - -/********************************************************************* - * _findStringWidth - * - * Calculates the length of a string after expansion. E.g., the - * length of "(%6.1f)" is eight -- six for the floating-point number, - * and two for the parentheses. - */ - -static int _findStringWidth( - char *str) -{ - int width = 0; - int add; - int maxi = strlen(str) - 1; - int i = 0; - - - while (str[i] != '\0') { - if (str[i] == '%') { - if (isdigit(str[i+1])) { - sscanf(str+i+1, "%d", &add); - width += add; - i += 2; - while (!_isCharInString(str[i], "diouxefgn")) { - i++; - if (i > maxi) - KLTError("(_findStringWidth) Can't determine length " - "of string '%s'", str); - } - i++; - } else if (str[i+1] == 'c') { - width++; - i += 2; - } else - KLTError("(_findStringWidth) Can't determine length " - "of string '%s'", str); - } else { - i++; - width++; - } - } - - return width; -} - - -static void _printHeader( - FILE *fp, - char *format, - structureType id, - int nFrames, - int nFeatures) -{ - int width = _findStringWidth(format); - int i; - - assert(id == FEATURE_LIST || id == FEATURE_HISTORY || id == FEATURE_TABLE); - - if (fp != stderr) { - fprintf(fp, "Feel free to place comments here.\n\n\n"); - fprintf(fp, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); - fprintf(fp, "%s", warning_line); - fprintf(fp, "\n"); - } - fprintf(fp, "------------------------------\n"); - switch (id) { - case FEATURE_LIST: fprintf(fp, "KLT Feature List\n"); break; - case FEATURE_HISTORY: fprintf(fp, "KLT Feature History\n"); break; - case FEATURE_TABLE: fprintf(fp, "KLT Feature Table\n"); break; - } - - fprintf(fp, "------------------------------\n\n"); - switch (id) { - case FEATURE_LIST: fprintf(fp, "nFeatures = %d\n\n", nFeatures); break; - case FEATURE_HISTORY: fprintf(fp, "nFrames = %d\n\n", nFrames); break; - case FEATURE_TABLE: fprintf(fp, "nFrames = %d, nFeatures = %d\n\n", - nFrames, nFeatures); break; - } - - switch (id) { - case FEATURE_LIST: fprintf(fp, "feature | (x,y)=val\n"); - fprintf(fp, "--------+-"); - _printNhyphens(fp, width); - fprintf(fp, "\n"); - break; - case FEATURE_HISTORY: fprintf(fp, "frame | (x,y)=val\n"); - fprintf(fp, "------+-"); - _printNhyphens(fp, width); - fprintf(fp, "\n"); - break; - case FEATURE_TABLE: fprintf(fp, "feature | frame\n"); - fprintf(fp, " |"); - for (i = 0 ; i < nFrames ; i++) _printInteger(fp, i, width); - fprintf(fp, "\n--------+-"); - for (i = 0 ; i < nFrames ; i++) _printNhyphens(fp, width); - fprintf(fp, "\n"); - break; - } -} - - -static void _printFeatureTxt( - FILE *fp, - KLT_Feature feat, - char *format, - char type) -{ - assert(type == 'f' || type == 'd'); - - if (type == 'f') - fprintf(fp, format, (float) feat->x, (float) feat->y, feat->val); - else if (type == 'd') { - /* Round x & y to nearest integer, unless negative */ - float x = feat->x; - float y = feat->y; - if (x >= 0.0) x += 0.5; - if (y >= 0.0) y += 0.5; - fprintf(fp, format, - (int) x, (int) y, feat->val); - } -} - - -static void _printFeatureBin( - FILE *fp, - KLT_Feature feat) -{ - fwrite(&(feat->x), sizeof(KLT_locType), 1, fp); - fwrite(&(feat->y), sizeof(KLT_locType), 1, fp); - fwrite(&(feat->val), sizeof(int), 1, fp); -} - - -static void _printShutdown( - FILE *fp) -{ - /* Close file, if necessary */ - if (fp != stderr) - fclose(fp); -} - - -/********************************************************************* - * KLTWriteFeatureList() - * KLTWriteFeatureHistory() - * KLTWriteFeatureTable() - * - * Writes features to file or to screen. - * - * INPUTS - * fname: name of file to write data; if NULL, then print to stderr - * fmt: format for printing (e.g., "%5.1f" or "%3d"); - * if NULL, and if fname is not NULL, then write to binary file. - */ - -void KLTWriteFeatureList( - KLT_FeatureList fl, - char *fname, - char *fmt) -{ - FILE *fp; - char format[100]; - char type; - int i; - - if (KLT_verbose >= 1 && fname != NULL) { - fprintf(stderr, - "(KLT) Writing feature list to %s file: '%s'\n", - (fmt == NULL ? "binary" : "text"), fname); - } - - if (fmt != NULL) { /* text file or stderr */ - fp = _printSetupTxt(fname, fmt, format, &type); - _printHeader(fp, format, FEATURE_LIST, 0, fl->nFeatures); - - for (i = 0 ; i < fl->nFeatures ; i++) { - fprintf(fp, "%7d | ", i); - _printFeatureTxt(fp, fl->feature[i], format, type); - fprintf(fp, "\n"); - } - _printShutdown(fp); - } else { /* binary file */ - fp = _printSetupBin(fname); - fwrite(binheader_fl, sizeof(char), BINHEADERLENGTH, fp); - fwrite(&(fl->nFeatures), sizeof(int), 1, fp); - for (i = 0 ; i < fl->nFeatures ; i++) { - _printFeatureBin(fp, fl->feature[i]); - } - fclose(fp); - } -} - - -void KLTWriteFeatureHistory( - KLT_FeatureHistory fh, - char *fname, - char *fmt) -{ - FILE *fp; - char format[100]; - char type; - int i; - - if (KLT_verbose >= 1 && fname != NULL) { - fprintf(stderr, - "(KLT) Writing feature history to %s file: '%s'\n", - (fmt == NULL ? "binary" : "text"), fname); - } - - if (fmt != NULL) { /* text file or stderr */ - fp = _printSetupTxt(fname, fmt, format, &type); - _printHeader(fp, format, FEATURE_HISTORY, fh->nFrames, 0); - - for (i = 0 ; i < fh->nFrames ; i++) { - fprintf(fp, "%5d | ", i); - _printFeatureTxt(fp, fh->feature[i], format, type); - fprintf(fp, "\n"); - } - _printShutdown(fp); - } else { /* binary file */ - fp = _printSetupBin(fname); - fwrite(binheader_fh, sizeof(char), BINHEADERLENGTH, fp); - fwrite(&(fh->nFrames), sizeof(int), 1, fp); - for (i = 0 ; i < fh->nFrames ; i++) { - _printFeatureBin(fp, fh->feature[i]); - } - fclose(fp); - } -} - - - -void KLTWriteFeatureTable( - KLT_FeatureTable ft, - char *fname, - char *fmt) -{ - FILE *fp; - char format[100]; - char type; - int i, j; - - if (KLT_verbose >= 1 && fname != NULL) { - fprintf(stderr, - "(KLT) Writing feature table to %s file: '%s'\n", - (fmt == NULL ? "binary" : "text"), fname); - } - - if (fmt != NULL) { /* text file or stderr */ - fp = _printSetupTxt(fname, fmt, format, &type); - _printHeader(fp, format, FEATURE_TABLE, ft->nFrames, ft->nFeatures); - - for (j = 0 ; j < ft->nFeatures ; j++) { - fprintf(fp, "%7d | ", j); - for (i = 0 ; i < ft->nFrames ; i++) - _printFeatureTxt(fp, ft->feature[j][i], format, type); - fprintf(fp, "\n"); - } - _printShutdown(fp); - } else { /* binary file */ - fp = _printSetupBin(fname); - fwrite(binheader_ft, sizeof(char), BINHEADERLENGTH, fp); - fwrite(&(ft->nFrames), sizeof(int), 1, fp); - fwrite(&(ft->nFeatures), sizeof(int), 1, fp); - for (j = 0 ; j < ft->nFeatures ; j++) { - for (i = 0 ; i < ft->nFrames ; i++) { - _printFeatureBin(fp, ft->feature[j][i]); - } - } - fclose(fp); - } -} - - - -static structureType _readHeader( - FILE *fp, - int *nFrames, - int *nFeatures, - KLT_BOOL *binary) -{ -#define LINELENGTH 100 - char line[LINELENGTH]; - structureType id; - - /* If file is binary, then read data and return */ - fread(line, sizeof(char), BINHEADERLENGTH, fp); - line[BINHEADERLENGTH] = 0; - if (strcmp(line, binheader_fl) == 0) { - assert(nFeatures != NULL); - fread(nFeatures, sizeof(int), 1, fp); - *binary = TRUE; - return FEATURE_LIST; - } else if (strcmp(line, binheader_fh) == 0) { - assert(nFrames != NULL); - fread(nFrames, sizeof(int), 1, fp); - *binary = TRUE; - return FEATURE_HISTORY; - } else if (strcmp(line, binheader_ft) == 0) { - assert(nFrames != NULL); - assert(nFeatures != NULL); - fread(nFrames, sizeof(int), 1, fp); - fread(nFeatures, sizeof(int), 1, fp); - *binary = TRUE; - return FEATURE_TABLE; - - /* If file is NOT binary, then continue.*/ - } else { - rewind(fp); - *binary = FALSE; - } - - /* Skip comments until warning line */ - while (strcmp(line, warning_line) != 0) { - fgets(line, LINELENGTH, fp); - if (feof(fp)) - KLTError("(_readFeatures) File is corrupted -- Couldn't find line:\n" - "\t%s\n", warning_line); - } - - /* Read 'Feature List', 'Feature History', or 'Feature Table' */ - while (fgetc(fp) != '-'); - while (fgetc(fp) != '\n'); - fgets(line, LINELENGTH, fp); - if (strcmp(line, "KLT Feature List\n") == 0) id = FEATURE_LIST; - else if (strcmp(line, "KLT Feature History\n") == 0) id = FEATURE_HISTORY; - else if (strcmp(line, "KLT Feature Table\n") == 0) id = FEATURE_TABLE; - else - KLTError("(_readFeatures) File is corrupted -- (Not 'KLT Feature List', " - "'KLT Feature History', or 'KLT Feature Table')"); - - /* If there's an incompatibility between the type of file */ - /* and the parameters passed, exit now before we attempt */ - /* to write to non-allocated memory. Higher routine should */ - /* detect and handle this error. */ - if ((id == FEATURE_LIST && nFeatures == NULL) || - (id == FEATURE_HISTORY && nFrames == NULL) || - (id == FEATURE_TABLE && (nFeatures == NULL || nFrames == NULL))) - return id; - - /* Read nFeatures and nFrames */ - while (fgetc(fp) != '-'); - while (fgetc(fp) != '\n'); - fscanf(fp, "%s", line); - if (id == FEATURE_LIST) { - if (strcmp(line, "nFeatures") != 0) - KLTError("(_readFeatures) File is corrupted -- " - "(Expected 'nFeatures', found '%s' instead)", line); - } else if (strcmp(line, "nFrames") != 0) - KLTError("(_readFeatures) File is corrupted -- " - "(Expected 'nFrames', found '%s' instead)", line); - fscanf(fp, "%s", line); - if (strcmp(line, "=") != 0) - KLTError("(_readFeatures) File is corrupted -- " - "(Expected '=', found '%s' instead)", line); - if (id == FEATURE_LIST) fscanf(fp, "%d", nFeatures); - else fscanf(fp, "%d", nFrames); - - /* If 'Feature Table', then also get nFeatures */ - if (id == FEATURE_TABLE) { - fscanf(fp, "%s", line); - if (strcmp(line, ",") != 0) - KLTError("(_readFeatures) File '%s' is corrupted -- " - "(Expected 'comma', found '%s' instead)", line); - fscanf(fp, "%s", line); - if (strcmp(line, "nFeatures") != 0) - KLTError("(_readFeatures) File '%s' is corrupted -- " - "(2 Expected 'nFeatures ', found '%s' instead)", line); - fscanf(fp, "%s", line); - if (strcmp(line, "=") != 0) - KLTError("(_readFeatures) File '%s' is corrupted -- " - "(2 Expected '= ', found '%s' instead)", line); - fscanf(fp, "%d", nFeatures); - } - - /* Skip junk before data */ - while (fgetc(fp) != '-'); - while (fgetc(fp) != '\n'); - - return id; -#undef LINELENGTH -} - - -static void _readFeatureTxt( - FILE *fp, - KLT_Feature feat) -{ - while (fgetc(fp) != '('); - fscanf(fp, "%f,%f)=%d", &(feat->x), &(feat->y), &(feat->val)); -} - - -static void _readFeatureBin( - FILE *fp, - KLT_Feature feat) -{ - fread(&(feat->x), sizeof(KLT_locType), 1, fp); - fread(&(feat->y), sizeof(KLT_locType), 1, fp); - fread(&(feat->val), sizeof(int), 1, fp); -} - - -/********************************************************************* - * KLTReadFeatureList - * KLTReadFeatureHistory - * KLTReadFeatureTable - * - * If the first parameter (fl, fh, or ft) is NULL, then the - * corresponding structure is created. - */ - -KLT_FeatureList KLTReadFeatureList( - KLT_FeatureList fl_in, - char *fname) -{ - FILE *fp; - KLT_FeatureList fl; - int nFeatures; - structureType id; - int indx; - KLT_BOOL binary; /* whether file is binary or text */ - int i; - - fp = fopen(fname, "rb"); - if (fp == NULL) KLTError("(KLTReadFeatureList) Can't open file '%s' " - "for reading", fname); - if (KLT_verbose >= 1) - fprintf(stderr, "(KLT) Reading feature list from '%s'\n", fname); - id = _readHeader(fp, NULL, &nFeatures, &binary); - if (id != FEATURE_LIST) - KLTError("(KLTReadFeatureList) File '%s' does not contain " - "a FeatureList", fname); - - if (fl_in == NULL) { - fl = KLTCreateFeatureList(nFeatures); - fl->nFeatures = nFeatures; - } - else { - fl = fl_in; - if (fl->nFeatures != nFeatures) - KLTError("(KLTReadFeatureList) The feature list passed " - "does not contain the same number of features as " - "the feature list in file '%s' ", fname); - } - - if (!binary) { /* text file */ - for (i = 0 ; i < fl->nFeatures ; i++) { - fscanf(fp, "%d |", &indx); - if (indx != i) KLTError("(KLTReadFeatureList) Bad index at i = %d" - "-- %d", i, indx); - _readFeatureTxt(fp, fl->feature[i]); - } - } else { /* binary file */ - for (i = 0 ; i < fl->nFeatures ; i++) { - _readFeatureBin(fp, fl->feature[i]); - } - } - - fclose(fp); - - return fl; -} - - -KLT_FeatureHistory KLTReadFeatureHistory( - KLT_FeatureHistory fh_in, - char *fname) -{ - FILE *fp; - KLT_FeatureHistory fh; - int nFrames; - structureType id; - int indx; - KLT_BOOL binary; /* whether file is binary or text */ - int i; - - fp = fopen(fname, "rb"); - if (fp == NULL) KLTError("(KLTReadFeatureHistory) Can't open file '%s' " - "for reading", fname); - if (KLT_verbose >= 1) fprintf(stderr, "(KLT) Reading feature history from '%s'\n", fname); - id = _readHeader(fp, &nFrames, NULL, &binary); - if (id != FEATURE_HISTORY) KLTError("(KLTReadFeatureHistory) File '%s' does not contain " - "a FeatureHistory", fname); - - if (fh_in == NULL) { - fh = KLTCreateFeatureHistory(nFrames); - fh->nFrames = nFrames; - } - else { - fh = fh_in; - if (fh->nFrames != nFrames) - KLTError("(KLTReadFeatureHistory) The feature history passed " - "does not contain the same number of frames as " - "the feature history in file '%s' ", fname); - } - - if (!binary) { /* text file */ - for (i = 0 ; i < fh->nFrames ; i++) { - fscanf(fp, "%d |", &indx); - if (indx != i) - KLTError("(KLTReadFeatureHistory) Bad index at i = %d" - "-- %d", i, indx); - _readFeatureTxt(fp, fh->feature[i]); - } - } else { /* binary file */ - for (i = 0 ; i < fh->nFrames ; i++) { - _readFeatureBin(fp, fh->feature[i]); - } - } - - fclose(fp); - - return fh; -} - - -KLT_FeatureTable KLTReadFeatureTable( - KLT_FeatureTable ft_in, - char *fname) -{ - FILE *fp; - KLT_FeatureTable ft; - int nFrames; - int nFeatures; - structureType id; - int indx; - KLT_BOOL binary; /* whether file is binary or text */ - int i, j; - - fp = fopen(fname, "rb"); - if (fp == NULL) KLTError("(KLTReadFeatureTable) Can't open file '%s' " - "for reading", fname); - if (KLT_verbose >= 1) fprintf(stderr, "(KLT) Reading feature table from '%s'\n", fname); - id = _readHeader(fp, &nFrames, &nFeatures, &binary); - if (id != FEATURE_TABLE) KLTError("(KLTReadFeatureTable) File '%s' does not contain " - "a FeatureTable", fname); - - if (ft_in == NULL) { - ft = KLTCreateFeatureTable(nFrames, nFeatures); - ft->nFrames = nFrames; - ft->nFeatures = nFeatures; - } - else { - ft = ft_in; - - if (ft->nFrames != nFrames || ft->nFeatures != nFeatures) - KLTError("(KLTReadFeatureTable) The feature table passed " - "does not contain the same number of frames and " - "features as the feature table in file '%s' ", fname); - } - - if (!binary) { /* text file */ - for (j = 0 ; j < ft->nFeatures ; j++) { - fscanf(fp, "%d |", &indx); - if (indx != j) - KLTError("(KLTReadFeatureTable) Bad index at j = %d" - "-- %d", j, indx); - for (i = 0 ; i < ft->nFrames ; i++) - _readFeatureTxt(fp, ft->feature[j][i]); - } - } else { /* binary file */ - for (j = 0 ; j < ft->nFeatures ; j++) { - for (i = 0 ; i < ft->nFrames ; i++) - _readFeatureBin(fp, ft->feature[j][i]); - } - } - - fclose(fp); - - return ft; -} - diff --git a/rtengine/labimage.cc b/rtengine/labimage.cc index 94f46c432..743582984 100644 --- a/rtengine/labimage.cc +++ b/rtengine/labimage.cc @@ -1,4 +1,4 @@ -#include +#include "labimage.h" #include namespace rtengine { diff --git a/rtengine/labimage.h b/rtengine/labimage.h index 4fc5e5b50..cc600a22a 100644 --- a/rtengine/labimage.h +++ b/rtengine/labimage.h @@ -19,7 +19,7 @@ #ifndef _LABIMAGE_H_ #define _LABIMAGE_H_ -#include +#include "image16.h" namespace rtengine { diff --git a/rtengine/loadinitial.cc b/rtengine/loadinitial.cc index 0bd524351..382ff4e09 100644 --- a/rtengine/loadinitial.cc +++ b/rtengine/loadinitial.cc @@ -16,9 +16,9 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include +#include "rtengine.h" +#include "stdimagesource.h" +#include "rawimagesource.h" namespace rtengine { diff --git a/rtengine/myfile.cc b/rtengine/myfile.cc index ef2e80a41..bc3f93d37 100644 --- a/rtengine/myfile.cc +++ b/rtengine/myfile.cc @@ -16,10 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "myfile.h" #include #include -#include +#include "safegtk.h" #ifdef BZIP_SUPPORT #include #endif diff --git a/rtengine/myfile.h b/rtengine/myfile.h index 2222eab37..473e440a2 100644 --- a/rtengine/myfile.h +++ b/rtengine/myfile.h @@ -20,8 +20,8 @@ #define _MYFILE_ #include -#include -#include +#include +#include struct IMFILE { int fd; int pos; diff --git a/rtengine/mytime.h b/rtengine/mytime.h index 858c78169..19b963ca8 100644 --- a/rtengine/mytime.h +++ b/rtengine/mytime.h @@ -24,7 +24,7 @@ #elif defined __APPLE__ #include #else -#include +#include #endif class MyTime { diff --git a/rtengine/processingjob.cc b/rtengine/processingjob.cc index a55ad4bc6..bbf7e46f8 100644 --- a/rtengine/processingjob.cc +++ b/rtengine/processingjob.cc @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "processingjob.h" namespace rtengine { diff --git a/rtengine/processingjob.h b/rtengine/processingjob.h index 5b7c13ab1..11be16e36 100644 --- a/rtengine/processingjob.h +++ b/rtengine/processingjob.h @@ -19,7 +19,7 @@ #ifndef _PROCESSINGJOB_ #define _PROCESSINGJOB_ -#include +#include "rtengine.h" namespace rtengine { diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 9d3c71696..4971324d6 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -17,20 +17,20 @@ * along with RawTherapee. If not, see . */ #include -#include -#include -#include +#include "safegtk.h" +#include "../rtgui/multilangmgr.h" +#include "procparams.h" #include #include -#include -#include "version.h" -#include -#include -#include +#include +#include "../rtgui/version.h" +#include "../rtgui/ppversion.h" +#include "../rtgui/mydiagonalcurve.h" +#include "../rtgui/myflatcurve.h" +#include "safekeyfile.h" +#include "rawimage.h" +#include "../rtgui/ppversion.h" -#include -#include -#include "ppversion.h" #define APPVERSION VERSION namespace rtengine { diff --git a/rtengine/rawimage.cc b/rtengine/rawimage.cc index 125cd9817..3352da938 100644 --- a/rtengine/rawimage.cc +++ b/rtengine/rawimage.cc @@ -4,16 +4,16 @@ * Created on: 20/nov/2010 */ -#include -#include -#include -#include +#include "rawimage.h" +#include "settings.h" +#include "colortemp.h" +#include "../rtengine/utils.h" #ifdef WIN32 #include #else #include #endif -#include +#include "safegtk.h" namespace rtengine{ diff --git a/rtengine/rawimage.h b/rtengine/rawimage.h index 167ee2f46..7225342a9 100644 --- a/rtengine/rawimage.h +++ b/rtengine/rawimage.h @@ -19,9 +19,9 @@ #ifndef __RAWIMAGE_H #define __RAWIMAGE_H -#include +#include #include -#include +#include "dcraw.h" namespace rtengine { diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 196713fae..9b96306b4 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -16,25 +16,25 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "rawimagesource.h" +#include "rawimagesource_i.h" +#include "median.h" +#include "rawimage.h" +#include +#include "mytime.h" +#include "iccmatrices.h" +#include "iccstore.h" +#include "image8.h" +#include "curves.h" +#include "dfmanager.h" +#include "ffmanager.h" +#include "slicer.h" #include -#include +#include "../rtgui/options.h" -#include +#include "improcfun.h" #ifdef _OPENMP #include #endif diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index 7636a8767..10787bce4 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -19,11 +19,11 @@ #ifndef _RAWIMAGESOURCE_ #define _RAWIMAGESOURCE_ -#include +#include "imagesource.h" #include -#include -#include -#include +#include "array2D.h" +#include "curves.h" +#include "../rtgui/cacheimagedata.h" #define HR_SCALE 2 diff --git a/rtengine/rawimagesource_i.h b/rtengine/rawimagesource_i.h index 0910ed96f..5032b1cbb 100644 --- a/rtengine/rawimagesource_i.h +++ b/rtengine/rawimagesource_i.h @@ -20,9 +20,9 @@ #ifndef RAWIMAGESOURCE_I_H_INCLUDED #define RAWIMAGESOURCE_I_H_INCLUDED -#include +#include "rawimagesource.h" -#include +#include "curves.h" #undef MAXVAL #undef CLIP diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index c1eb15775..9a747daf9 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -16,8 +16,8 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include +#include "refreshmap.h" +#include "procevents.h" int refreshmap[rtengine::NUMOFEVENTS] = { ALL, // EvPhotoLoaded, diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index 3ed12d967..832d09420 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -19,17 +19,17 @@ #ifndef _RTENGINE_ #define _RTENGINE_ -#include -#include +#include "procparams.h" +#include "procevents.h" #include #include #include -#include -#include -#include -#include -#include -#include +#include +#include "../rtexif/rtexif.h" +#include "rawmetadatalocation.h" +#include "iimage.h" +#include "../rtengine/utils.h" +#include "settings.h" #include "LUT.h" /** * @file diff --git a/rtengine/rtetest.cc b/rtengine/rtetest.cc index 0b507d560..4c3046685 100644 --- a/rtengine/rtetest.cc +++ b/rtengine/rtetest.cc @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "rtengine.h" #include //#include #include diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc index 9f896a21f..4a1554a19 100644 --- a/rtengine/rtthumbnail.cc +++ b/rtengine/rtthumbnail.cc @@ -16,27 +16,27 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include +#include "rtengine.h" +#include "rtthumbnail.h" +#include "image8.h" #include -#include +#include "curves.h" #include -#include -#include -#include -#include -#include -#include -#include -#include +#include "improcfun.h" +#include "colortemp.h" +#include "mytime.h" +#include "../rtengine/utils.h" +#include "iccstore.h" +#include "iccmatrices.h" +#include "rawimagesource.h" +#include "stdimagesource.h" #include -#include -#include -#include -#include +#include +#include "safekeyfile.h" +#include "safegtk.h" +#include "rawimage.h" #include "jpeg.h" -#include "ppversion.h" +#include "../rtgui/ppversion.h" #define MAXVAL 0xffff #define CLIP(a) ((a)>0?((a) -#include +#include "rawmetadatalocation.h" +#include "procparams.h" #include #include -#include +#include "image16.h" namespace rtengine { diff --git a/rtengine/safegtk.cc b/rtengine/safegtk.cc index ac6672596..3b3f499d7 100644 --- a/rtengine/safegtk.cc +++ b/rtengine/safegtk.cc @@ -19,17 +19,17 @@ * along with RawTherapee. If not, see . */ -#include -#include +#include "safegtk.h" +#include "../rtgui/guiutils.h" #include #include #ifdef WIN32 #include #include #else -#include +#include #endif -#include +#include "../rtgui/rtimage.h" #include diff --git a/rtengine/shmap.cc b/rtengine/shmap.cc index 9f8d72713..186cc889c 100644 --- a/rtengine/shmap.cc +++ b/rtengine/shmap.cc @@ -16,12 +16,12 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include +#include "shmap.h" +#include "gauss.h" +#include "bilateral2.h" +#include "rtengine.h" -#include //for dirpyr +#include "rawimagesource.h"//for dirpyr #undef MAXVAL diff --git a/rtengine/shmap.h b/rtengine/shmap.h index 7ddf23b04..1b4dba975 100644 --- a/rtengine/shmap.h +++ b/rtengine/shmap.h @@ -19,8 +19,8 @@ #ifndef __SHMAP__ #define __SHMAP__ -#include -#include +#include "imagefloat.h" +#include "image16.h" namespace rtengine { diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 0ac8c4b96..a05da33a7 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -16,18 +16,18 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include -#include -#include -#include +#include "rtengine.h" +#include "colortemp.h" +#include "imagesource.h" +#include "improcfun.h" +#include "curves.h" +#include "iccstore.h" +#include "processingjob.h" #include -#include +#include "../rtgui/options.h" #include -#include -#include "ppversion.h" +#include "rawimagesource.h" +#include "../rtgui/ppversion.h" #undef THREAD_PRIORITY_NORMAL #define CLIP(a) ((a)>0?((a)<65535?(a):65535):0) diff --git a/rtengine/slicer.cc b/rtengine/slicer.cc index b44aca75c..60e8c454f 100644 --- a/rtengine/slicer.cc +++ b/rtengine/slicer.cc @@ -17,11 +17,11 @@ * along with RawTherapee. If not, see . */ -#include +#include #ifdef _OPENMP #include #endif -#include +#include "slicer.h" #include // If no parameter set, everything = 0 -> process all the image diff --git a/rtengine/stdimagesource.cc b/rtengine/stdimagesource.cc index 1f979ea16..e44c438b6 100644 --- a/rtengine/stdimagesource.cc +++ b/rtengine/stdimagesource.cc @@ -16,12 +16,12 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include +#include "stdimagesource.h" +#include "mytime.h" +#include "iccstore.h" #define MAXVAL 0xffff #define CLIP(a) ((a)>0?((a) +#include "curves.h" #undef THREAD_PRIORITY_NORMAL diff --git a/rtengine/stdimagesource.h b/rtengine/stdimagesource.h index 8751cb5c2..5828bdfa2 100644 --- a/rtengine/stdimagesource.h +++ b/rtengine/stdimagesource.h @@ -19,7 +19,7 @@ #ifndef _STDIMAGESOURCE_ #define _STDIMAGESOURCE_ -#include +#include "imagesource.h" namespace rtengine { diff --git a/rtengine/utils.cc b/rtengine/utils.cc index 62de51a89..6f6bd15ab 100644 --- a/rtengine/utils.cc +++ b/rtengine/utils.cc @@ -16,10 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include +#include "../rtengine/utils.h" +#include +#include +#include #undef MAX #undef MIN diff --git a/rtexif/CMakeLists.txt b/rtexif/CMakeLists.txt index 59d14e0f6..90d39c836 100644 --- a/rtexif/CMakeLists.txt +++ b/rtexif/CMakeLists.txt @@ -1,4 +1,3 @@ -include_directories (.) add_library (rtexif rtexif.cc stdattribs.cc nikonattribs.cc canonattribs.cc pentaxattribs.cc fujiattribs.cc sonyminoltaattribs.cc olympusattribs.cc) diff --git a/rtexif/canonattribs.cc b/rtexif/canonattribs.cc index a1568d85f..a070a950b 100644 --- a/rtexif/canonattribs.cc +++ b/rtexif/canonattribs.cc @@ -19,12 +19,12 @@ #ifndef _CANONATTRIBS_ #define _CANONATTRIBS_ -#include -#include -#include -#include -#include -#include +#include +#include + +#include "rtexif.h" + +using namespace std; namespace rtexif { diff --git a/rtexif/fujiattribs.cc b/rtexif/fujiattribs.cc index 224f1adf2..1f17c988c 100644 --- a/rtexif/fujiattribs.cc +++ b/rtexif/fujiattribs.cc @@ -19,12 +19,7 @@ #ifndef _FUJIATTRIBS_ #define _FUJIATTRIBS_ -#include -#include -#include -#include -#include -#include +#include "rtexif.h" namespace rtexif { diff --git a/rtexif/nikonattribs.cc b/rtexif/nikonattribs.cc index 8f909ba9c..fe21299c0 100644 --- a/rtexif/nikonattribs.cc +++ b/rtexif/nikonattribs.cc @@ -19,13 +19,12 @@ #ifndef _NIKONATTRIBS_ #define _NIKONATTRIBS_ -#include -#include -#include -#include +#include +#include #include #include -#include + +#include "rtexif.h" namespace rtexif { diff --git a/rtexif/olympusattribs.cc b/rtexif/olympusattribs.cc index 1ab047eb6..441a872a5 100644 --- a/rtexif/olympusattribs.cc +++ b/rtexif/olympusattribs.cc @@ -19,12 +19,12 @@ #ifndef _OLYMPUSATTRIBS_ #define _OLYMPUSATTRIBS_ -#include #include -#include -#include -#include +#include #include +#include + +#include "rtexif.h" namespace rtexif { diff --git a/rtexif/pentaxattribs.cc b/rtexif/pentaxattribs.cc index 52d381dc9..22f03db4c 100644 --- a/rtexif/pentaxattribs.cc +++ b/rtexif/pentaxattribs.cc @@ -19,12 +19,12 @@ #ifndef _PENTAXATTRIBS_ #define _PENTAXATTRIBS_ -#include +#include +#include #include -#include -#include #include -#include + +#include "rtexif.h" namespace rtexif { diff --git a/rtexif/rtexif.cc b/rtexif/rtexif.cc index e296bf7f9..a2a571a64 100644 --- a/rtexif/rtexif.cc +++ b/rtexif/rtexif.cc @@ -18,14 +18,15 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include -#include +#include +#include +#include +#include #include #include +#include "rtexif.h" + namespace rtexif { StdInterpreter stdInterpreter; diff --git a/rtexif/rtexif.h b/rtexif/rtexif.h index 5d5633683..95a1723bc 100644 --- a/rtexif/rtexif.h +++ b/rtexif/rtexif.h @@ -19,13 +19,13 @@ #ifndef _MEXIF3_ #define _MEXIF3_ -#include +#include #include #include #include #include -#include -#include +#include +#include namespace rtexif { @@ -34,6 +34,8 @@ enum ActionCode {DONTWRITE=0, WRITE=1, SYSTEM=2}; enum ByteOrder {INTEL=0x4949, MOTOROLA=0x4D4D}; enum MNKind {NOMK, IFD, HEADERIFD, NIKON3, OLYMPUS2, FUJI,TABLESUBDIR}; +bool extractLensInfo(std::string &fullname,double &minFocal, double &maxFocal, double &maxApertureAtMinFocal, double &maxApertureAtMaxFocal); + struct TIFFHeader { unsigned short byteOrder; @@ -339,7 +341,6 @@ inline void sset2 (unsigned short v, unsigned char *s, ByteOrder order); inline void sset4 (int v, unsigned char *s, ByteOrder order); inline float int_to_float (int i); inline short int int2_to_signed (short unsigned int i); -bool extractLensInfo(std::string &fullname,double &minFocal, double &maxFocal, double &maxApertureAtMinFocal, double &maxApertureAtMaxFocal); extern const TagAttrib exifAttribs[]; extern const TagAttrib gpsAttribs[]; diff --git a/rtexif/sonyminoltaattribs.cc b/rtexif/sonyminoltaattribs.cc index b6fefc4c5..2ad827fa6 100644 --- a/rtexif/sonyminoltaattribs.cc +++ b/rtexif/sonyminoltaattribs.cc @@ -19,11 +19,9 @@ #ifndef _SONYMINOLTAATTRIBS_ #define _SONYMINOLTAATTRIBS_ -#include -#include -#include -#include +#include +#include "rtexif.h" namespace rtexif { diff --git a/rtexif/stdattribs.cc b/rtexif/stdattribs.cc index 580f8ce27..c3330750f 100644 --- a/rtexif/stdattribs.cc +++ b/rtexif/stdattribs.cc @@ -20,11 +20,10 @@ #ifndef _STDATTRIBS_ #define _STDATTRIBS_ -#include -#include -#include -#include -#include +#include +#include + +#include "rtexif.h" namespace rtexif { @@ -559,11 +558,4 @@ const TagAttrib iopAttribs[] = { }; -/*#include -#include -#include -#include -#include -#include */ - #endif diff --git a/rtgui/CMakeLists.txt b/rtgui/CMakeLists.txt index 2f81dec82..ad9dd0a06 100644 --- a/rtgui/CMakeLists.txt +++ b/rtgui/CMakeLists.txt @@ -33,13 +33,13 @@ set (BASESOURCEFILES if (WIN32) set (EXTRA_SRC windirmonitor.cc myicon.rc) set (EXTRA_LIB_RTGUI winmm) - include_directories ( ../rtengine ${CMAKE_CURRENT_BINARY_DIR} . ../rtexif ${EXTRA_INCDIR} ${GLIB2_INCLUDE_DIRS} ${GLIBMM_INCLUDE_DIRS} + include_directories (${EXTRA_INCDIR} ${GLIB2_INCLUDE_DIRS} ${GLIBMM_INCLUDE_DIRS} ${GTK_INCLUDE_DIRS} ${GTKMM_INCLUDE_DIRS} ${GIO_INCLUDE_DIRS} ${GIOMM_INCLUDE_DIRS}) link_directories (. ../rtexif ${EXTRA_LIBDIR} ${GLIB2_LIBRARY_DIRS} ${GLIBMM_LIBRARY_DIRS} ${GTK_LIBRARY_DIRS} ${GTKMM_LIBRARY_DIRS} ${GIO_LIBRARY_DIRS} ${GIOMM_LIBRARY_DIRS}) #set_target_properties (rth PROPERTIES LINK_FLAGS "-mwindows") else (WIN32) - include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../rtengine ${CMAKE_CURRENT_BINARY_DIR} . ${CMAKE_CURRENT_SOURCE_DIR}/../rtexif ${EXTRA_INCDIR} ${GLIB2_INCLUDE_DIRS} ${GLIBMM_INCLUDE_DIRS} + include_directories (${EXTRA_INCDIR} ${GLIB2_INCLUDE_DIRS} ${GLIBMM_INCLUDE_DIRS} ${GTK_INCLUDE_DIRS} ${GTKMM_INCLUDE_DIRS} ${GIO_INCLUDE_DIRS} ${GIOMM_INCLUDE_DIRS} ${IPTCDATA_INCLUDE_DIRS} ${LCMS_INCLUDE_DIRS} ${GTHREAD_INCLUDE_DIRS} ${GOBJECT_INCLUDE_DIRS} ) link_directories (${EXTRA_LIBDIR} ${GLIB2_LIBRARY_DIRS} ${GLIBMM_LIBRARY_DIRS} ${GTK_LIBRARY_DIRS} ${GTKMM_LIBRARY_DIRS} ${GIO_LIBRARY_DIRS} ${GIOMM_LIBRARY_DIRS} ${IPTCDATA_LIBRARY_DIRS} ${LCMS_LIBRARY_DIRS} ${GTHREAD_LIBRARY_DIRS} ${GOBJECT_LIBRARY_DIRS}) @@ -47,7 +47,7 @@ endif (WIN32) # create config.h which defines where data are stored message (STATUS --- CMAKE_CURRENT_SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DIR}) message (STATUS --- CMAKE_CURRENT_BINARY_DIR = ${CMAKE_CURRENT_BINARY_DIR}) -configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) +configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/config.h) add_executable (rth ${EXTRA_SRC} ${BASESOURCEFILES}) diff --git a/rtgui/adjuster.cc b/rtgui/adjuster.cc index 4a90bd72b..36bcb1405 100644 --- a/rtgui/adjuster.cc +++ b/rtgui/adjuster.cc @@ -16,14 +16,14 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "adjuster.h" #include -#include -#include -#include -#include -#include -#include +#include +#include "multilangmgr.h" +#include "../rtengine/rtengine.h" +#include "options.h" +#include "guiutils.h" +#include "rtimage.h" #define MIN_RESET_BUTTON_HEIGHT 17 diff --git a/rtgui/adjuster.h b/rtgui/adjuster.h index abd444c47..292c58b6d 100644 --- a/rtgui/adjuster.h +++ b/rtgui/adjuster.h @@ -20,8 +20,8 @@ #define _ADJUSTER_H_ #include -#include -#include +#include "editedstate.h" +#include "guiutils.h" class Adjuster; class AdjusterListener { diff --git a/rtgui/batchqueue.cc b/rtgui/batchqueue.cc index 15e3aedbf..fd97a2431 100644 --- a/rtgui/batchqueue.cc +++ b/rtgui/batchqueue.cc @@ -16,15 +16,15 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "batchqueue.h" #include #include -#include -#include -#include -#include -#include -#include +#include "multilangmgr.h" +#include "filecatalog.h" +#include "batchqueuebuttonset.h" +#include "guiutils.h" +#include "../rtengine/safegtk.h" +#include "rtimage.h" #include diff --git a/rtgui/batchqueue.h b/rtgui/batchqueue.h index 33e0d27e4..c0191118b 100644 --- a/rtgui/batchqueue.h +++ b/rtgui/batchqueue.h @@ -19,11 +19,11 @@ #define _BATCHQUEUE_ #include -#include -#include -#include -#include -#include +#include "batchqueueentry.h" +#include "../rtengine/rtengine.h" +#include "options.h" +#include "lwbuttonset.h" +#include "thumbbrowserbase.h" class BatchQueueListener { diff --git a/rtgui/batchqueuebuttonset.cc b/rtgui/batchqueuebuttonset.cc index a88538b32..f3079a62b 100644 --- a/rtgui/batchqueuebuttonset.cc +++ b/rtgui/batchqueuebuttonset.cc @@ -16,9 +16,9 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include +#include "batchqueuebuttonset.h" +#include "multilangmgr.h" +#include "../rtengine/safegtk.h" extern Glib::ustring argv0; diff --git a/rtgui/batchqueuebuttonset.h b/rtgui/batchqueuebuttonset.h index fec768dfd..bd43b5657 100644 --- a/rtgui/batchqueuebuttonset.h +++ b/rtgui/batchqueuebuttonset.h @@ -19,7 +19,7 @@ #ifndef _BATCHQUEUEBUTTONSET_ #define _BATCHQUEUEBUTTONSET_ -#include +#include "lwbuttonset.h" #include class BatchQueueEntry; diff --git a/rtgui/batchqueueentry.h b/rtgui/batchqueueentry.h index 37ef74822..a17d4cb57 100644 --- a/rtgui/batchqueueentry.h +++ b/rtgui/batchqueueentry.h @@ -20,10 +20,10 @@ #define _BATCHQUEUEENTRY_ #include -#include -#include -#include -#include +#include "../rtengine/rtengine.h" +#include "thumbbrowserentrybase.h" +#include "thumbnail.h" +#include "bqentryupdater.h" class BatchQueueEntry; struct BatchQueueEntryIdleHelper { diff --git a/rtgui/batchqueuepanel.cc b/rtgui/batchqueuepanel.cc index a17347916..04c8720fb 100644 --- a/rtgui/batchqueuepanel.cc +++ b/rtgui/batchqueuepanel.cc @@ -16,14 +16,14 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include -#include -#include -#include -#include +#include "batchqueuepanel.h" +#include "options.h" +#include "preferences.h" +#include "multilangmgr.h" +#include "rtwindow.h" +#include "soundman.h" +#include "../rtengine/safegtk.h" +#include "rtimage.h" BatchQueuePanel::BatchQueuePanel () { diff --git a/rtgui/batchqueuepanel.h b/rtgui/batchqueuepanel.h index 8413f1251..2f37a3ed2 100644 --- a/rtgui/batchqueuepanel.h +++ b/rtgui/batchqueuepanel.h @@ -20,9 +20,9 @@ #define _BATCHQUEUEPANEL_ #include -#include -#include -#include +#include "batchqueue.h" +#include "saveformatpanel.h" +#include "guiutils.h" class RTWindow; class BatchQueuePanel : public Gtk::VBox, diff --git a/rtgui/batchtoolpanelcoord.cc b/rtgui/batchtoolpanelcoord.cc index f82e52e1c..3101f2e03 100644 --- a/rtgui/batchtoolpanelcoord.cc +++ b/rtgui/batchtoolpanelcoord.cc @@ -16,12 +16,12 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include -#include -#include +#include "multilangmgr.h" +#include "batchtoolpanelcoord.h" +#include "options.h" +#include "filepanel.h" +#include "procparamchangers.h" +#include "addsetids.h" using namespace rtengine::procparams; diff --git a/rtgui/batchtoolpanelcoord.h b/rtgui/batchtoolpanelcoord.h index 5f41c3958..a0382283f 100644 --- a/rtgui/batchtoolpanelcoord.h +++ b/rtgui/batchtoolpanelcoord.h @@ -19,12 +19,12 @@ #ifndef __BATCHTOOLPANELCCORD__ #define __BATCHTOOLPANELCCORD__ -#include -#include -#include -#include -#include -#include +#include "thumbnail.h" +#include "toolpanelcoord.h" +#include "fileselectionchangelistener.h" +#include "../rtengine/rtengine.h" +#include "paramsedited.h" +#include "thumbnaillistener.h" class FilePanel; class BatchToolPanelCoordinator : diff --git a/rtgui/bqentryupdater.cc b/rtgui/bqentryupdater.cc index 43a9a6ab0..f5463bda3 100644 --- a/rtgui/bqentryupdater.cc +++ b/rtgui/bqentryupdater.cc @@ -16,9 +16,9 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "bqentryupdater.h" #include -#include +#include "guiutils.h" BatchQueueEntryUpdater batchQueueEntryUpdater; diff --git a/rtgui/bqentryupdater.h b/rtgui/bqentryupdater.h index d1f5bd2a3..affc088ce 100644 --- a/rtgui/bqentryupdater.h +++ b/rtgui/bqentryupdater.h @@ -20,8 +20,8 @@ #define _BQENTRYUPDATER_ #include -#include -#include +#include "../rtengine/rtengine.h" +#include "thumbnail.h" class BQEntryUpdateListener { diff --git a/rtgui/browserfilter.cc b/rtgui/browserfilter.cc index fda8aff9e..4118fcf48 100644 --- a/rtgui/browserfilter.cc +++ b/rtgui/browserfilter.cc @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "browserfilter.h" BrowserFilter::BrowserFilter () : exifFilterEnabled (false) { diff --git a/rtgui/browserfilter.h b/rtgui/browserfilter.h index ecfc17262..acde5c387 100644 --- a/rtgui/browserfilter.h +++ b/rtgui/browserfilter.h @@ -19,7 +19,7 @@ #ifndef _BROWSERFILTER_ #define _BROWSERFILTER_ -#include +#include "exiffiltersettings.h" #include class BrowserFilter { diff --git a/rtgui/cacheimagedata.cc b/rtgui/cacheimagedata.cc index 07540dcdc..d8118785b 100644 --- a/rtgui/cacheimagedata.cc +++ b/rtgui/cacheimagedata.cc @@ -16,11 +16,11 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "cacheimagedata.h" #include #include -#include -#include +#include "../rtengine/safekeyfile.h" +#include "../rtengine/safegtk.h" #include "version.h" CacheImageData::CacheImageData () diff --git a/rtgui/cacheimagedata.h b/rtgui/cacheimagedata.h index c89462f65..b282c72da 100644 --- a/rtgui/cacheimagedata.h +++ b/rtgui/cacheimagedata.h @@ -20,7 +20,7 @@ #define _CACHEIMAGEDATA_ #include -#include +#include "options.h" class CacheImageData { diff --git a/rtgui/cachemanager.cc b/rtgui/cachemanager.cc index 0b993567f..05cc52d11 100644 --- a/rtgui/cachemanager.cc +++ b/rtgui/cachemanager.cc @@ -16,13 +16,13 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include +#include "cachemanager.h" +#include "options.h" #include #include -#include -#include -#include +#include "guiutils.h" +#include "procparamchangers.h" +#include "../rtengine/safegtk.h" #ifdef WIN32 #include #endif diff --git a/rtgui/cachemanager.h b/rtgui/cachemanager.h index d0571401a..aa441706c 100644 --- a/rtgui/cachemanager.h +++ b/rtgui/cachemanager.h @@ -22,8 +22,8 @@ #include #include #include -#include -#include +#include "thumbnail.h" +#include class Thumbnail; diff --git a/rtgui/cacorrection.cc b/rtgui/cacorrection.cc index 32e32195f..a2483873e 100644 --- a/rtgui/cacorrection.cc +++ b/rtgui/cacorrection.cc @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "cacorrection.h" #include using namespace rtengine; diff --git a/rtgui/cacorrection.h b/rtgui/cacorrection.h index a4bee4ea4..a93e582de 100644 --- a/rtgui/cacorrection.h +++ b/rtgui/cacorrection.h @@ -20,8 +20,8 @@ #define _CACORRECTION_H_ #include -#include -#include +#include "adjuster.h" +#include "toolpanel.h" class CACorrection : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel { diff --git a/rtgui/chmixer.cc b/rtgui/chmixer.cc index e3d1a5db3..8575a7be1 100644 --- a/rtgui/chmixer.cc +++ b/rtgui/chmixer.cc @@ -16,8 +16,8 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include +#include "chmixer.h" +#include "rtimage.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/chmixer.h b/rtgui/chmixer.h index f5dbc259b..2490344f6 100644 --- a/rtgui/chmixer.h +++ b/rtgui/chmixer.h @@ -20,8 +20,8 @@ #define _CHMIXER_H_ #include -#include -#include +#include "adjuster.h" +#include "toolpanel.h" class ChMixer : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel { diff --git a/rtgui/clipboard.cc b/rtgui/clipboard.cc index 38c2e75aa..32ecfcdd6 100644 --- a/rtgui/clipboard.cc +++ b/rtgui/clipboard.cc @@ -16,6 +16,6 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "clipboard.h" Clipboard clipboard; diff --git a/rtgui/clipboard.h b/rtgui/clipboard.h index 704bd03f2..50d38a45a 100644 --- a/rtgui/clipboard.h +++ b/rtgui/clipboard.h @@ -20,8 +20,8 @@ #define _CLIPBOARD_ #include -#include -#include +#include "../rtengine/rtengine.h" +#include "mydiagonalcurve.h" class Clipboard { diff --git a/rtgui/coarsepanel.cc b/rtgui/coarsepanel.cc index 61e90c1a2..91ebc60d9 100644 --- a/rtgui/coarsepanel.cc +++ b/rtgui/coarsepanel.cc @@ -16,8 +16,8 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include +#include "coarsepanel.h" +#include "rtimage.h" extern Glib::ustring argv0; diff --git a/rtgui/coarsepanel.h b/rtgui/coarsepanel.h index 5355c67fc..cfdf74252 100644 --- a/rtgui/coarsepanel.h +++ b/rtgui/coarsepanel.h @@ -20,7 +20,7 @@ #define __COARSEPANEL__ #include -#include +#include "toolpanel.h" class CoarsePanel : public Gtk::HBox, public ToolPanel { diff --git a/rtgui/crop.cc b/rtgui/crop.cc index b75597230..ee9f926a2 100644 --- a/rtgui/crop.cc +++ b/rtgui/crop.cc @@ -16,9 +16,9 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include +#include "crop.h" +#include "options.h" +#include "rtimage.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/crop.h b/rtgui/crop.h index b11b46a01..49a4909bd 100644 --- a/rtgui/crop.h +++ b/rtgui/crop.h @@ -20,9 +20,9 @@ #define _CROP_H_ #include -#include -#include -#include +#include "cropguilistener.h" +#include "toolpanel.h" +#include "guiutils.h" #include class CropPanelListener { diff --git a/rtgui/crophandler.cc b/rtgui/crophandler.cc index 8a5bb97e3..5603a51cb 100644 --- a/rtgui/crophandler.cc +++ b/rtgui/crophandler.cc @@ -16,12 +16,12 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "crophandler.h" #undef THREAD_PRIORITY_NORMAL #include -#include -#include +#include "guiutils.h" +#include "../rtengine/refreshmap.h" using namespace rtengine; diff --git a/rtgui/crophandler.h b/rtgui/crophandler.h index 4336c70a2..50faa6f28 100644 --- a/rtgui/crophandler.h +++ b/rtgui/crophandler.h @@ -19,7 +19,7 @@ #ifndef __CROPHANDLER__ #define __CROPHANDLER__ -#include +#include "../rtengine/rtengine.h" #include class CropHandlerListener { diff --git a/rtgui/cropwindow.cc b/rtgui/cropwindow.cc index dd9ffd4d2..af45eb3ae 100644 --- a/rtgui/cropwindow.cc +++ b/rtgui/cropwindow.cc @@ -16,14 +16,14 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include +#include "cropwindow.h" +#include "options.h" #include -#include -#include -#include -#include -#include +#include "guiutils.h" +#include "../rtengine/mytime.h" +#include "imagearea.h" +#include "cursormanager.h" +#include "../rtengine/safegtk.h" struct ZoomStep { Glib::ustring label; diff --git a/rtgui/cropwindow.h b/rtgui/cropwindow.h index 11bef73d3..19eb44380 100644 --- a/rtgui/cropwindow.h +++ b/rtgui/cropwindow.h @@ -19,15 +19,15 @@ #ifndef _CROPWINDOW_ #define _CROPWINDOW_ -#include +#include "../rtengine/rtengine.h" #include -#include -#include -#include -#include +#include "lwbutton.h" +#include "lwbuttonset.h" +#include "editenums.h" +#include "crophandler.h" #include -#include -#include +#include "cropguilistener.h" +#include "pointermotionlistener.h" class CropWindow; class CropWindowListener { diff --git a/rtgui/cursormanager.cc b/rtgui/cursormanager.cc index 435b0b6e8..6315bc84c 100644 --- a/rtgui/cursormanager.cc +++ b/rtgui/cursormanager.cc @@ -16,10 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include +#include "cursormanager.h" +#include "options.h" +#include "../rtengine/safegtk.h" +#include "rtimage.h" CursorManager cursorManager; diff --git a/rtgui/curveeditor.cc b/rtgui/curveeditor.cc index 219ddb13d..c2468b877 100644 --- a/rtgui/curveeditor.cc +++ b/rtgui/curveeditor.cc @@ -16,13 +16,13 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include +#include "curveeditor.h" +#include "curveeditorgroup.h" #include #include -#include -#include -#include +#include "guiutils.h" +#include "multilangmgr.h" +#include "../rtengine/LUT.h" #include diff --git a/rtgui/curveeditor.h b/rtgui/curveeditor.h index 5c6732389..668b20436 100644 --- a/rtgui/curveeditor.h +++ b/rtgui/curveeditor.h @@ -19,8 +19,8 @@ #ifndef _CURVEEDITOR_ #define _CURVEEDITOR_ -#include -#include +#include "popuptogglebutton.h" +#include "../rtengine/LUT.h" class CurveEditorGroup; class CurveEditorSubGroup; diff --git a/rtgui/curveeditorgroup.cc b/rtgui/curveeditorgroup.cc index 89aca03a9..d47e6653a 100644 --- a/rtgui/curveeditorgroup.cc +++ b/rtgui/curveeditorgroup.cc @@ -19,13 +19,13 @@ * Class created by Jean-Christophe FRISCH, aka 'Hombre' */ -#include -#include -#include -#include -#include -#include -#include +#include "curveeditor.h" +#include "curveeditorgroup.h" +#include "diagonalcurveeditorsubgroup.h" +#include "flatcurveeditorsubgroup.h" +#include "multilangmgr.h" +#include "../rtengine/safegtk.h" +#include "rtimage.h" extern Glib::ustring argv0; diff --git a/rtgui/curveeditorgroup.h b/rtgui/curveeditorgroup.h index 1a6235522..b2f24cf5a 100644 --- a/rtgui/curveeditorgroup.h +++ b/rtgui/curveeditorgroup.h @@ -22,12 +22,12 @@ #include #include #include -#include -#include -#include -#include -#include -#include +#include "guiutils.h" +#include "mycurve.h" +#include "myflatcurve.h" +#include "mydiagonalcurve.h" +#include "shcselector.h" +#include "adjuster.h" class CurveEditor; class DiagonalCurveEditorSubGroup; @@ -37,7 +37,7 @@ class FlatCurveEditorSubGroup; * This class handle the curve widgets, shared between any number curve * - to add a curve to the list, use the 'addCurve' method * - to start a new line of curve button, use the 'newLine' method - * - if you add more than one curve, you must add a "CurveEditor* ce" parameter to your listener + * - if you add more than one curve, you must add a "CurveEditor* ce" parameter to your listener */ class CurveEditorGroup : public Gtk::VBox, public CurveListener { diff --git a/rtgui/darkframe.cc b/rtgui/darkframe.cc index d1dce0779..3e3c85096 100644 --- a/rtgui/darkframe.cc +++ b/rtgui/darkframe.cc @@ -16,12 +16,12 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include +#include "darkframe.h" +#include "options.h" +#include "guiutils.h" +#include "../rtengine/safegtk.h" #include -#include +#include "rtimage.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/darkframe.h b/rtgui/darkframe.h index 717c64b58..755f15e7c 100644 --- a/rtgui/darkframe.h +++ b/rtgui/darkframe.h @@ -20,9 +20,9 @@ #define _DARKFRAME_H_ #include -#include -#include -#include +#include "toolpanel.h" +#include "../rtengine/rawimage.h" +#include "guiutils.h" class DFProvider { public: diff --git a/rtgui/defringe.cc b/rtgui/defringe.cc index af6305bcb..ba09b7dd3 100644 --- a/rtgui/defringe.cc +++ b/rtgui/defringe.cc @@ -16,9 +16,9 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "defringe.h" #include -#include +#include using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/defringe.h b/rtgui/defringe.h index d03b76851..0030cc064 100644 --- a/rtgui/defringe.h +++ b/rtgui/defringe.h @@ -20,8 +20,8 @@ #define _DEFRINGE_H_ #include -#include -#include +#include "adjuster.h" +#include "toolpanel.h" class Defringe : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel { diff --git a/rtgui/diagonalcurveeditorsubgroup.cc b/rtgui/diagonalcurveeditorsubgroup.cc index 251dc8d84..a018ae40f 100644 --- a/rtgui/diagonalcurveeditorsubgroup.cc +++ b/rtgui/diagonalcurveeditorsubgroup.cc @@ -17,19 +17,19 @@ * along with RawTherapee. If not, see . */ -#include +#include "clipboard.h" #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "guiutils.h" +#include "multilangmgr.h" +#include "guiutils.h" +#include "mycurve.h" +#include "shcselector.h" +#include "adjuster.h" +#include "mycurve.h" +#include "curveeditor.h" +#include "diagonalcurveeditorsubgroup.h" DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt) { diff --git a/rtgui/diagonalcurveeditorsubgroup.h b/rtgui/diagonalcurveeditorsubgroup.h index 49d8d8fc0..d6b227f85 100644 --- a/rtgui/diagonalcurveeditorsubgroup.h +++ b/rtgui/diagonalcurveeditorsubgroup.h @@ -20,7 +20,7 @@ #define _DIAGONALCURVEEDITORSUBGROUP_ #include -#include +#include "curveeditorgroup.h" class DiagonalCurveEditor; diff --git a/rtgui/dirbrowser.cc b/rtgui/dirbrowser.cc index fbbe64d2e..196c74cc6 100644 --- a/rtgui/dirbrowser.cc +++ b/rtgui/dirbrowser.cc @@ -16,17 +16,17 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "dirbrowser.h" #ifdef WIN32 #define _WIN32_WINNT 0x0600 #include #endif -#include -#include +#include "options.h" +#include "../rtengine/safegtk.h" #include -#include -#include +#include "guiutils.h" +#include "rtimage.h" #define CHECKTIME 5000 extern Glib::ustring argv0; diff --git a/rtgui/dirbrowser.h b/rtgui/dirbrowser.h index 2ecf5dbc3..c1a3a9a68 100644 --- a/rtgui/dirbrowser.h +++ b/rtgui/dirbrowser.h @@ -22,10 +22,10 @@ #include #include #ifdef WIN32 -#include +#include "windirmonitor.h" #endif -#include -#include +#include "dirselectionlistener.h" +#include "dirbrowserremoteinterface.h" class DirBrowser : public Gtk::VBox, public DirBrowserRemoteInterface #ifdef WIN32 diff --git a/rtgui/dirpyrdenoise.cc b/rtgui/dirpyrdenoise.cc index 934fa4dda..420f12796 100644 --- a/rtgui/dirpyrdenoise.cc +++ b/rtgui/dirpyrdenoise.cc @@ -16,9 +16,9 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "dirpyrdenoise.h" #include -#include +#include using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/dirpyrdenoise.h b/rtgui/dirpyrdenoise.h index 8fdff51c4..8ffbf294f 100644 --- a/rtgui/dirpyrdenoise.h +++ b/rtgui/dirpyrdenoise.h @@ -20,8 +20,8 @@ #define _DIRPYRDENOISE_H_ #include -#include -#include +#include "adjuster.h" +#include "toolpanel.h" class DirPyrDenoise : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel { diff --git a/rtgui/dirpyrequalizer.cc b/rtgui/dirpyrequalizer.cc index 063224d80..0e28e0045 100644 --- a/rtgui/dirpyrequalizer.cc +++ b/rtgui/dirpyrequalizer.cc @@ -17,7 +17,7 @@ * © 2010 Emil Martinec */ -#include +#include "dirpyrequalizer.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/dirpyrequalizer.h b/rtgui/dirpyrequalizer.h index 874937636..78a0e660c 100644 --- a/rtgui/dirpyrequalizer.h +++ b/rtgui/dirpyrequalizer.h @@ -21,8 +21,8 @@ #define DIRPYREQUALIZER_H_INCLUDED #include -#include -#include +#include "adjuster.h" +#include "toolpanel.h" class DirPyrEqualizer : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel { diff --git a/rtgui/distortion.cc b/rtgui/distortion.cc index c0827cdd9..a4e87cd07 100644 --- a/rtgui/distortion.cc +++ b/rtgui/distortion.cc @@ -16,9 +16,9 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "distortion.h" #include -#include +#include "rtimage.h" extern Glib::ustring argv0; diff --git a/rtgui/distortion.h b/rtgui/distortion.h index 7d30d0648..1d7c9b92a 100644 --- a/rtgui/distortion.h +++ b/rtgui/distortion.h @@ -20,9 +20,9 @@ #define _DISTORTION_H_ #include -#include -#include -#include +#include "adjuster.h" +#include "toolpanel.h" +#include "lensgeomlistener.h" class Distortion : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel { diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 26cdace77..af7f4390b 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -17,16 +17,16 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "editorpanel.h" +#include "options.h" +#include "progressconnector.h" +#include "rtwindow.h" +#include "guiutils.h" +#include "procparamchangers.h" +#include "../rtengine/safegtk.h" +#include "../rtengine/imagesource.h" +#include "soundman.h" +#include "rtimage.h" using namespace rtengine::procparams; diff --git a/rtgui/editorpanel.h b/rtgui/editorpanel.h index 4a811a215..2bc445021 100644 --- a/rtgui/editorpanel.h +++ b/rtgui/editorpanel.h @@ -21,19 +21,19 @@ #define _EDITORPANEL_ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "imageareapanel.h" +#include "toolpanelcoord.h" +#include "profilepanel.h" +#include "../rtengine/rtengine.h" +#include "history.h" +#include "histogrampanel.h" +#include "thumbnail.h" +#include "saveasdlg.h" +#include "batchqueueentry.h" +#include "thumbnaillistener.h" +#include "navigator.h" +#include "progressconnector.h" +#include "filepanel.h" class EditorPanel; struct EditorPanelIdleHelper { diff --git a/rtgui/editwindow.cc b/rtgui/editwindow.cc index 9355b2a12..fe9b0f60b 100644 --- a/rtgui/editwindow.cc +++ b/rtgui/editwindow.cc @@ -15,13 +15,13 @@ * along with RawTherapee. If not, see . */ -#include -#include -#include -#include -#include +#include "editwindow.h" +#include "options.h" +#include "preferences.h" +#include "cursormanager.h" +#include "rtwindow.h" #include -#include +#include "rtimage.h" static EditWindow* editWnd = NULL; @@ -161,11 +161,11 @@ void EditWindow::remEditorPanel (EditorPanel* ep) { } bool EditWindow::selectEditorPanel(const std::string &name) { - std::map::iterator iep = epanels.find(name); - - if (iep!=epanels.end()) { - mainNB->set_current_page (mainNB->page_num (*iep->second)); - return true; + std::map::iterator iep = epanels.find(name); + + if (iep!=epanels.end()) { + mainNB->set_current_page (mainNB->page_num (*iep->second)); + return true; } return false; } diff --git a/rtgui/editwindow.h b/rtgui/editwindow.h index b1fbc2087..6f57f5506 100644 --- a/rtgui/editwindow.h +++ b/rtgui/editwindow.h @@ -18,8 +18,8 @@ #define _EDITWINDOW_ #include -#include -#include +#include "filepanel.h" +#include "editorpanel.h" #include class EditWindow : public Gtk::Window { diff --git a/rtgui/epd.cc b/rtgui/epd.cc index 1c9586667..20c9c510a 100644 --- a/rtgui/epd.cc +++ b/rtgui/epd.cc @@ -16,9 +16,9 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "epd.h" #include -#include +#include using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/epd.h b/rtgui/epd.h index 439cbff46..6ae32f4bf 100644 --- a/rtgui/epd.h +++ b/rtgui/epd.h @@ -20,8 +20,8 @@ #define _EPD_H_ #include -#include -#include +#include "adjuster.h" +#include "toolpanel.h" class EdgePreservingDecompositionUI : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel { protected: diff --git a/rtgui/exiffiltersettings.cc b/rtgui/exiffiltersettings.cc index 5033b5c86..6c47e6b1f 100644 --- a/rtgui/exiffiltersettings.cc +++ b/rtgui/exiffiltersettings.cc @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "exiffiltersettings.h" ExifFilterSettings::ExifFilterSettings () { diff --git a/rtgui/exifpanel.cc b/rtgui/exifpanel.cc index be0f2aa77..7ea5f4b46 100644 --- a/rtgui/exifpanel.cc +++ b/rtgui/exifpanel.cc @@ -16,10 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include +#include "exifpanel.h" +#include "../rtengine/safegtk.h" +#include "guiutils.h" +#include "rtimage.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/exifpanel.h b/rtgui/exifpanel.h index c558e02cf..eb9e10a49 100644 --- a/rtgui/exifpanel.h +++ b/rtgui/exifpanel.h @@ -20,7 +20,7 @@ #define _EXIFPANEL_ #include -#include +#include "toolpanel.h" class ExifPanel : public Gtk::VBox, public ToolPanel { diff --git a/rtgui/favoritbrowser.cc b/rtgui/favoritbrowser.cc index fce6b4555..9b66aad8b 100644 --- a/rtgui/favoritbrowser.cc +++ b/rtgui/favoritbrowser.cc @@ -17,8 +17,8 @@ * along with RawTherapee. If not, see . */ #include -#include -#include +#include "multilangmgr.h" +#include "rtimage.h" FavoritBrowser::FavoritBrowser () : listener (NULL), lastSelectedDir ("") { diff --git a/rtgui/favoritbrowser.h b/rtgui/favoritbrowser.h index 344f332c3..36f964bb8 100644 --- a/rtgui/favoritbrowser.h +++ b/rtgui/favoritbrowser.h @@ -20,8 +20,8 @@ #define _FAVORITBROWSER_ #include -#include -#include +#include "dirbrowserremoteinterface.h" +#include "dirselectionlistener.h" class FavoritBrowser : public Gtk::VBox, public DirSelectionListener { diff --git a/rtgui/filebrowser.cc b/rtgui/filebrowser.cc index 2f204d5af..b15e9e4f3 100644 --- a/rtgui/filebrowser.cc +++ b/rtgui/filebrowser.cc @@ -18,16 +18,16 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "filebrowser.h" #include -#include -#include -#include -#include -#include -#include -#include -#include +#include "options.h" +#include "multilangmgr.h" +#include "clipboard.h" +#include "profilestore.h" +#include "procparamchangers.h" +#include "../rtengine/dfmanager.h" +#include "../rtengine/ffmanager.h" +#include "rtimage.h" extern Options options; diff --git a/rtgui/filebrowser.h b/rtgui/filebrowser.h index bdaa8c1ed..7746949ef 100644 --- a/rtgui/filebrowser.h +++ b/rtgui/filebrowser.h @@ -20,11 +20,11 @@ #define _FILEBROWSER_ #include -#include -#include -#include -#include -#include +#include "thumbbrowserbase.h" +#include "exiffiltersettings.h" +#include "filebrowserentry.h" +#include "browserfilter.h" +#include "partialpastedlg.h" class FileBrowser; class FileBrowserEntry; diff --git a/rtgui/filebrowserentry.cc b/rtgui/filebrowserentry.cc index f32b3f4d8..48888b766 100644 --- a/rtgui/filebrowserentry.cc +++ b/rtgui/filebrowserentry.cc @@ -16,12 +16,12 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include +#include "filebrowserentry.h" +#include "thumbbrowserbase.h" +#include "cursormanager.h" #include -#include -#include +#include "guiutils.h" +#include "../rtengine/safegtk.h" #include diff --git a/rtgui/filebrowserentry.h b/rtgui/filebrowserentry.h index 3c79f9072..224ddc5c4 100644 --- a/rtgui/filebrowserentry.h +++ b/rtgui/filebrowserentry.h @@ -20,15 +20,15 @@ #define _FILEBROWSERENTRY_ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "thumbbrowserentrybase.h" +#include "thumbnail.h" +#include "filethumbnailbuttonset.h" +#include "thumbnaillistener.h" +#include "thumbimageupdater.h" +#include "imageareatoollistener.h" +#include "editenums.h" +#include "../rtengine/rtengine.h" +#include "crophandler.h" class FileBrowserEntry; diff --git a/rtgui/filecatalog.cc b/rtgui/filecatalog.cc index 7ee06aee7..a92d54e85 100644 --- a/rtgui/filecatalog.cc +++ b/rtgui/filecatalog.cc @@ -17,20 +17,20 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include -#include -#include +#include "filecatalog.h" +#include "filepanel.h" +#include "options.h" +#include "cachemanager.h" +#include "multilangmgr.h" +#include "guiutils.h" #include #include #include -#include -#include -#include -#include -#include +#include "renamedlg.h" +#include "thumbimageupdater.h" +#include "../rtengine/safegtk.h" +#include "batchqueue.h" +#include "rtimage.h" #define CHECKTIME 2000 diff --git a/rtgui/filecatalog.h b/rtgui/filecatalog.h index c2519495f..95b14f7fd 100644 --- a/rtgui/filecatalog.h +++ b/rtgui/filecatalog.h @@ -20,21 +20,21 @@ #define _FILECATALOG_ #ifdef WIN32 -#include +#include "windirmonitor.h" #endif -#include -#include -#include -#include +#include "dirbrowserremoteinterface.h" +#include "dirselectionlistener.h" +#include "filebrowser.h" +#include "exiffiltersettings.h" #include -#include +#include "fileselectionlistener.h" #include -#include -#include -#include -#include -#include -#include +#include "fileselectionchangelistener.h" +#include "coarsepanel.h" +#include "toolbar.h" +#include "filterpanel.h" +#include "previewloader.h" +#include "multilangmgr.h" class DirEntry { diff --git a/rtgui/filepanel.cc b/rtgui/filepanel.cc index e939b95b8..405f8ee1e 100644 --- a/rtgui/filepanel.cc +++ b/rtgui/filepanel.cc @@ -17,9 +17,9 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include +#include "filepanel.h" +#include "rtwindow.h" +#include "../rtengine/safegtk.h" int FilePanelInitUI (void* data) { ((FilePanel*)data)->init (); diff --git a/rtgui/filepanel.h b/rtgui/filepanel.h index bc57cbf8c..041faa7ba 100644 --- a/rtgui/filepanel.h +++ b/rtgui/filepanel.h @@ -20,16 +20,16 @@ #define _FILEPANEL_ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "batchtoolpanelcoord.h" +#include "filecatalog.h" +#include "dirbrowser.h" +#include "fileselectionlistener.h" +#include "placesbrowser.h" +#include "recentbrowser.h" +#include "pparamschangelistener.h" +#include "history.h" +#include "filterpanel.h" +#include "progressconnector.h" class RTWindow; class FilePanel : public Gtk::HPaned, diff --git a/rtgui/fileselectionchangelistener.h b/rtgui/fileselectionchangelistener.h index c22f2f174..c8e0a9a8c 100644 --- a/rtgui/fileselectionchangelistener.h +++ b/rtgui/fileselectionchangelistener.h @@ -19,7 +19,7 @@ #ifndef _FILESELECTIONCHANGELISTENER_ #define _FILESELECTIONCHANGELISTENER_ -#include +#include "thumbnail.h" class FileSelectionChangeListener { diff --git a/rtgui/fileselectionlistener.h b/rtgui/fileselectionlistener.h index 1558a943d..0da740f31 100644 --- a/rtgui/fileselectionlistener.h +++ b/rtgui/fileselectionlistener.h @@ -19,8 +19,8 @@ #ifndef _FILESELECTIONLISTENER_ #define _FILESELECTIONLISTENER_ -#include -#include +#include "thumbnail.h" +#include "batchqueueentry.h" class FileSelectionListener { diff --git a/rtgui/filethumbnailbuttonset.cc b/rtgui/filethumbnailbuttonset.cc index 0f7af63e3..269bdd836 100644 --- a/rtgui/filethumbnailbuttonset.cc +++ b/rtgui/filethumbnailbuttonset.cc @@ -16,9 +16,9 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include +#include "filethumbnailbuttonset.h" +#include "multilangmgr.h" +#include "../rtengine/safegtk.h" extern Glib::ustring argv0; diff --git a/rtgui/filethumbnailbuttonset.h b/rtgui/filethumbnailbuttonset.h index 7bd5ef817..3ba6408f3 100644 --- a/rtgui/filethumbnailbuttonset.h +++ b/rtgui/filethumbnailbuttonset.h @@ -19,9 +19,9 @@ #ifndef _FILETHUMBNAILBUTTONSET_ #define _FILETHUMBNAILBUTTONSET_ -#include +#include "lwbuttonset.h" #include -#include +#include "filebrowserentry.h" class FileBrowserEntry; class FileThumbnailButtonSet : public LWButtonSet { diff --git a/rtgui/filterpanel.cc b/rtgui/filterpanel.cc index 1f9e46fd0..5483d08f5 100644 --- a/rtgui/filterpanel.cc +++ b/rtgui/filterpanel.cc @@ -16,9 +16,9 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include +#include "filterpanel.h" +#include "multilangmgr.h" +#include "../rtengine/rtengine.h" using namespace rtengine; diff --git a/rtgui/filterpanel.h b/rtgui/filterpanel.h index c511be332..4f3c86a78 100644 --- a/rtgui/filterpanel.h +++ b/rtgui/filterpanel.h @@ -20,7 +20,7 @@ #define _FILTERPANEL_ #include -#include +#include "exiffiltersettings.h" class FilterPanelListener { diff --git a/rtgui/flatcurveeditorsubgroup.cc b/rtgui/flatcurveeditorsubgroup.cc index c491f584a..3260a6f1c 100644 --- a/rtgui/flatcurveeditorsubgroup.cc +++ b/rtgui/flatcurveeditorsubgroup.cc @@ -20,15 +20,15 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "guiutils.h" +#include "multilangmgr.h" +#include "guiutils.h" +#include "mycurve.h" +#include "shcselector.h" +#include "adjuster.h" +#include "mycurve.h" +#include "curveeditor.h" +#include "flatcurveeditorsubgroup.h" FlatCurveEditorSubGroup::FlatCurveEditorSubGroup (CurveEditorGroup* prt) { diff --git a/rtgui/flatcurveeditorsubgroup.h b/rtgui/flatcurveeditorsubgroup.h index 05c9841d1..542e32956 100644 --- a/rtgui/flatcurveeditorsubgroup.h +++ b/rtgui/flatcurveeditorsubgroup.h @@ -20,7 +20,7 @@ #define _FLATCURVEEDITORSUBGROUP_ #include -#include +#include "curveeditorgroup.h" class FlatCurveEditor; diff --git a/rtgui/flatfield.cc b/rtgui/flatfield.cc index 32a6b43aa..e0cf41758 100644 --- a/rtgui/flatfield.cc +++ b/rtgui/flatfield.cc @@ -16,12 +16,12 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include +#include "flatfield.h" +#include "options.h" +#include "guiutils.h" +#include "../rtengine/safegtk.h" #include -#include +#include "rtimage.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/flatfield.h b/rtgui/flatfield.h index ada9040bc..148b6cad8 100644 --- a/rtgui/flatfield.h +++ b/rtgui/flatfield.h @@ -20,10 +20,10 @@ #define _FLATFIELD_H_ #include -#include -#include -#include -#include +#include "adjuster.h" +#include "toolpanel.h" +#include "../rtengine/rawimage.h" +#include "guiutils.h" class FFProvider { public: diff --git a/rtgui/guiutils.cc b/rtgui/guiutils.cc index 9dffd7d9d..241b0853b 100644 --- a/rtgui/guiutils.cc +++ b/rtgui/guiutils.cc @@ -15,10 +15,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include +#include "guiutils.h" +#include "options.h" +#include "../rtengine/utils.h" +#include "rtimage.h" bool removeIfThere (Gtk::Container* cont, Gtk::Widget* w, bool increference) { diff --git a/rtgui/guiutils.h b/rtgui/guiutils.h index 9256d5c09..d531822dc 100644 --- a/rtgui/guiutils.h +++ b/rtgui/guiutils.h @@ -20,7 +20,7 @@ #define __GUI_UTILS_ #include -#include +#include "../rtengine/rtengine.h" bool removeIfThere (Gtk::Container* cont, Gtk::Widget* w, bool increference=true); void thumbInterp (const unsigned char* src, int sw, int sh, unsigned char* dst, int dw, int dh); diff --git a/rtgui/histogrampanel.cc b/rtgui/histogrampanel.cc index 51aa13a7b..828f9ea3f 100644 --- a/rtgui/histogrampanel.cc +++ b/rtgui/histogrampanel.cc @@ -16,13 +16,13 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include -#include -#include -#include +#include "histogrampanel.h" +#include "multilangmgr.h" +#include "guiutils.h" +#include "options.h" +#include +#include "../rtengine/LUT.h" +#include "rtimage.h" extern Glib::ustring argv0; extern Options options; diff --git a/rtgui/histogrampanel.h b/rtgui/histogrampanel.h index d63239586..d4ba1d2d6 100644 --- a/rtgui/histogrampanel.h +++ b/rtgui/histogrampanel.h @@ -22,9 +22,9 @@ #include #include -#include +#include "../rtengine/LUT.h" -#include +#include "pointermotionlistener.h" class HistogramArea; struct HistogramAreaIdleHelper { diff --git a/rtgui/history.cc b/rtgui/history.cc index 204d105c8..920d5dd7a 100644 --- a/rtgui/history.cc +++ b/rtgui/history.cc @@ -16,9 +16,9 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include +#include "history.h" +#include "multilangmgr.h" +#include "rtimage.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/history.h b/rtgui/history.h index 67e4b1e1d..1eda0fadd 100644 --- a/rtgui/history.h +++ b/rtgui/history.h @@ -20,10 +20,10 @@ #define _HISTORY_ #include -#include -#include -#include -#include +#include "../rtengine/rtengine.h" +#include "pparamschangelistener.h" +#include "profilechangelistener.h" +#include "paramsedited.h" class HistoryBeforeLineListener { diff --git a/rtgui/hlrec.cc b/rtgui/hlrec.cc index 5885c517c..998d98de8 100644 --- a/rtgui/hlrec.cc +++ b/rtgui/hlrec.cc @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "hlrec.h" #include using namespace rtengine; diff --git a/rtgui/hlrec.h b/rtgui/hlrec.h index f5e42b454..b4e2ead06 100644 --- a/rtgui/hlrec.h +++ b/rtgui/hlrec.h @@ -20,8 +20,8 @@ #define _HLREC_H_ #include -#include -#include +#include "toolpanel.h" +#include "guiutils.h" class HLRecovery : public Gtk::VBox, public FoldableToolPanel { diff --git a/rtgui/hsvequalizer.cc b/rtgui/hsvequalizer.cc index 0b0a1cdff..959424483 100644 --- a/rtgui/hsvequalizer.cc +++ b/rtgui/hsvequalizer.cc @@ -17,8 +17,8 @@ * 2010 Ilya Popov */ -#include -#include +#include "hsvequalizer.h" +#include "../rtengine/utils.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/hsvequalizer.h b/rtgui/hsvequalizer.h index 0877f2920..b60c3338b 100644 --- a/rtgui/hsvequalizer.h +++ b/rtgui/hsvequalizer.h @@ -21,12 +21,12 @@ #define HSVEQUALIZER_H_INCLUDED #include -#include -#include -#include -#include -#include -#include +#include "adjuster.h" +#include "toolpanel.h" +#include "guiutils.h" +#include "curveeditor.h" +#include "curveeditorgroup.h" +#include "colorprovider.h" class HSVEqualizer : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel, public CurveListener, public ColorProvider diff --git a/rtgui/icmpanel.cc b/rtgui/icmpanel.cc index ef3bfdd7b..053d98acc 100644 --- a/rtgui/icmpanel.cc +++ b/rtgui/icmpanel.cc @@ -16,12 +16,12 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include -#include -#include +#include "icmpanel.h" +#include "options.h" +#include "guiutils.h" +#include "../rtengine/safegtk.h" +#include "../rtengine/iccstore.h" +#include "rtimage.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/icmpanel.h b/rtgui/icmpanel.h index 49fecea8d..9db6e83b3 100644 --- a/rtgui/icmpanel.h +++ b/rtgui/icmpanel.h @@ -20,11 +20,11 @@ #define _ICMPANEL_ #include -#include -#include +#include "adjuster.h" +#include "guiutils.h" -#include -#include +#include "toolpanel.h" +#include "../rtengine/imagedata.h" class ICMPanelListener { diff --git a/rtgui/ilabel.cc b/rtgui/ilabel.cc index 1b734bfdb..b393e22b6 100644 --- a/rtgui/ilabel.cc +++ b/rtgui/ilabel.cc @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "ilabel.h" ILabel::ILabel (Glib::ustring lab) : label(lab) {} diff --git a/rtgui/imagearea.cc b/rtgui/imagearea.cc index 294d41ef5..498a84136 100644 --- a/rtgui/imagearea.cc +++ b/rtgui/imagearea.cc @@ -16,15 +16,15 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include -#include +#include "imagearea.h" +#include +#include +#include "options.h" +#include "multilangmgr.h" #include -#include -#include -#include +#include "cropwindow.h" +#include "../rtengine/refreshmap.h" +#include "options.h" ImageArea::ImageArea (ImageAreaPanel* p) : parent(p) { diff --git a/rtgui/imagearea.h b/rtgui/imagearea.h index b03fb0f99..4f6447228 100644 --- a/rtgui/imagearea.h +++ b/rtgui/imagearea.h @@ -20,15 +20,15 @@ #define __IMAGEAREA_H__ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "cropguilistener.h" +#include "imageareapanel.h" +#include "editenums.h" +#include "toolbar.h" +#include "previewhandler.h" +#include "imageareatoollistener.h" +#include "cropwindow.h" +#include "zoompanel.h" +#include "indclippedpanel.h" class ImageAreaPanel; class ImageArea : public Gtk::DrawingArea, public CropWindowListener { diff --git a/rtgui/imageareapanel.cc b/rtgui/imageareapanel.cc index 2cff78e6b..c82625f62 100644 --- a/rtgui/imageareapanel.cc +++ b/rtgui/imageareapanel.cc @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "imageareapanel.h" ImageAreaPanel::ImageAreaPanel () : before(NULL), after(NULL) { diff --git a/rtgui/imageareapanel.h b/rtgui/imageareapanel.h index 77a6e3129..afadfe267 100644 --- a/rtgui/imageareapanel.h +++ b/rtgui/imageareapanel.h @@ -19,7 +19,7 @@ #ifndef _IMAGEAREAPANEL_ #define _IMAGEAREAPANEL_ -#include +#include "imagearea.h" class ImageArea; class ImageAreaPanel : public Gtk::VBox { diff --git a/rtgui/imageareatoollistener.h b/rtgui/imageareatoollistener.h index 56230a020..7e7900b43 100644 --- a/rtgui/imageareatoollistener.h +++ b/rtgui/imageareatoollistener.h @@ -19,9 +19,9 @@ #ifndef _IMAGEAREATOOLLISTENER_ #define _IMAGEAREATOOLLISTENER_ -#include -#include -#include +#include "toolbar.h" +#include "thumbnail.h" +#include "cropguilistener.h" class ImageAreaToolListener { diff --git a/rtgui/impulsedenoise.cc b/rtgui/impulsedenoise.cc index 0fd9c4c25..6f24b4dc5 100644 --- a/rtgui/impulsedenoise.cc +++ b/rtgui/impulsedenoise.cc @@ -16,10 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include +#include "impulsedenoise.h" +#include #include -#include +#include "guiutils.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/impulsedenoise.h b/rtgui/impulsedenoise.h index 2a8aa6229..350c759d0 100644 --- a/rtgui/impulsedenoise.h +++ b/rtgui/impulsedenoise.h @@ -20,8 +20,8 @@ #define _IMPULSEDENOISE_H_ #include -#include -#include +#include "adjuster.h" +#include "toolpanel.h" class ImpulseDenoise : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel { diff --git a/rtgui/indclippedpanel.cc b/rtgui/indclippedpanel.cc index b5f700b86..8fed6a8f4 100644 --- a/rtgui/indclippedpanel.cc +++ b/rtgui/indclippedpanel.cc @@ -15,11 +15,11 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include -#include +#include "indclippedpanel.h" +#include "options.h" +#include "multilangmgr.h" +#include "imagearea.h" +#include "rtimage.h" IndicateClippedPanel::IndicateClippedPanel (ImageArea* ia) : imageArea(ia) { diff --git a/rtgui/iptcpanel.cc b/rtgui/iptcpanel.cc index 1b1eff098..282d24d48 100644 --- a/rtgui/iptcpanel.cc +++ b/rtgui/iptcpanel.cc @@ -16,9 +16,9 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include +#include "iptcpanel.h" +#include "clipboard.h" +#include "rtimage.h" extern Glib::ustring argv0; diff --git a/rtgui/iptcpanel.h b/rtgui/iptcpanel.h index 3fdfbe8e0..3c97b91d1 100644 --- a/rtgui/iptcpanel.h +++ b/rtgui/iptcpanel.h @@ -20,8 +20,8 @@ #define _IPTCPANEL_ #include -#include -#include +#include "toolpanel.h" +#include "guiutils.h" class IPTCPanel : public Gtk::VBox, public ToolPanel { diff --git a/rtgui/labcurve.cc b/rtgui/labcurve.cc index 61f5ed783..ae62dca78 100644 --- a/rtgui/labcurve.cc +++ b/rtgui/labcurve.cc @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "labcurve.h" #include using namespace rtengine; diff --git a/rtgui/labcurve.h b/rtgui/labcurve.h index b0f6f116d..bab721f31 100644 --- a/rtgui/labcurve.h +++ b/rtgui/labcurve.h @@ -20,11 +20,11 @@ #define _LABCURVE_H_ #include -#include -#include -#include -#include -#include +#include "adjuster.h" +#include "toolpanel.h" +#include "curveeditor.h" +#include "curveeditorgroup.h" +#include "colorprovider.h" class LCurve : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel, public CurveListener, public ColorProvider { diff --git a/rtgui/lensgeom.cc b/rtgui/lensgeom.cc index 69b12353a..7e7e6c4dc 100644 --- a/rtgui/lensgeom.cc +++ b/rtgui/lensgeom.cc @@ -16,9 +16,9 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include +#include "lensgeom.h" +#include "guiutils.h" +#include "rtimage.h" extern Glib::ustring argv0; diff --git a/rtgui/lensgeom.h b/rtgui/lensgeom.h index 355b066ee..0be5a8968 100644 --- a/rtgui/lensgeom.h +++ b/rtgui/lensgeom.h @@ -20,8 +20,8 @@ #define _LENSGEOM_H_ #include -#include -#include +#include "toolpanel.h" +#include "lensgeomlistener.h" class LensGeometry : public Gtk::VBox, public FoldableToolPanel { diff --git a/rtgui/lwbutton.cc b/rtgui/lwbutton.cc index 2b4baf195..628c7fa6e 100644 --- a/rtgui/lwbutton.cc +++ b/rtgui/lwbutton.cc @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "lwbutton.h" LWButton::LWButton (Cairo::RefPtr i, int aCode, void* aData, Alignment ha, Alignment va, Glib::ustring tooltip) : halign(ha), valign(va), icon(i), state(Normal), listener(NULL), actionCode(aCode), actionData(aData), toolTip(tooltip) { diff --git a/rtgui/lwbuttonset.cc b/rtgui/lwbuttonset.cc index 4e3a89eb5..9c391dc94 100644 --- a/rtgui/lwbuttonset.cc +++ b/rtgui/lwbuttonset.cc @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "lwbuttonset.h" LWButtonSet::LWButtonSet () : aw(0), ah(0) { } diff --git a/rtgui/lwbuttonset.h b/rtgui/lwbuttonset.h index 0b17b10c3..651304c83 100644 --- a/rtgui/lwbuttonset.h +++ b/rtgui/lwbuttonset.h @@ -20,7 +20,7 @@ #define _LWBUTTONSET_ #include -#include +#include "lwbutton.h" #include class LWButtonSet { diff --git a/rtgui/main.cc b/rtgui/main.cc index c0699fdcf..a5ebd0028 100644 --- a/rtgui/main.cc +++ b/rtgui/main.cc @@ -23,16 +23,16 @@ // This file is for your program, I won't touch it again! -#include +#include "config.h" #include #include #include -#include -#include -#include -#include -#include -#include +#include "rtwindow.h" +#include +#include +#include "options.h" +#include "soundman.h" +#include "rtimage.h" #include "version.h" #ifndef WIN32 @@ -41,7 +41,7 @@ #include #endif -#include +#include "../rtengine/safegtk.h" extern Options options; diff --git a/rtgui/multilangmgr.cc b/rtgui/multilangmgr.cc index f6d96b62a..0b44abe39 100644 --- a/rtgui/multilangmgr.cc +++ b/rtgui/multilangmgr.cc @@ -17,9 +17,9 @@ * along with RawTherapee. If not, see . */ #include -#include -#include -#include +#include "multilangmgr.h" +#include +#include "../rtengine/safegtk.h" #ifdef WIN32 // Desired auto detect function is Vista+ #define _WIN32_WINNT 0x0600 diff --git a/rtgui/mycurve.cc b/rtgui/mycurve.cc index e9f9e6ccd..22b176e36 100644 --- a/rtgui/mycurve.cc +++ b/rtgui/mycurve.cc @@ -16,9 +16,9 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include +#include "mycurve.h" +#include "../rtengine/curves.h" +#include #include MyCurve::MyCurve () : listener(NULL) { diff --git a/rtgui/mycurve.h b/rtgui/mycurve.h index 5649b46a9..26f1108e2 100644 --- a/rtgui/mycurve.h +++ b/rtgui/mycurve.h @@ -21,10 +21,10 @@ #include #include -#include -#include -#include -#include +#include "curvelistener.h" +#include "cursormanager.h" +#include "colorprovider.h" +#include "../rtengine/LUT.h" #define RADIUS 3 /* radius of the control points */ #define SQUARE 2 /* half length of the square shape of the tangent handles */ diff --git a/rtgui/mydiagonalcurve.cc b/rtgui/mydiagonalcurve.cc index 6face4c8d..951bd58ec 100644 --- a/rtgui/mydiagonalcurve.cc +++ b/rtgui/mydiagonalcurve.cc @@ -16,9 +16,9 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include +#include "mydiagonalcurve.h" +#include "../rtengine/curves.h" +#include #include MyDiagonalCurve::MyDiagonalCurve () : activeParam(-1), bghistvalid(false) { diff --git a/rtgui/mydiagonalcurve.h b/rtgui/mydiagonalcurve.h index 34d739277..5ab2ed35a 100644 --- a/rtgui/mydiagonalcurve.h +++ b/rtgui/mydiagonalcurve.h @@ -21,10 +21,10 @@ #include #include -#include -#include -#include -#include +#include "curvelistener.h" +#include "cursormanager.h" +#include "mycurve.h" +#include "../rtengine/LUT.h" // For compatibility and simplicity reason, order shouldn't change, and must be identical to the order specified in the curveType widget diff --git a/rtgui/myflatcurve.cc b/rtgui/myflatcurve.cc index d2cd21547..cbc0953de 100644 --- a/rtgui/myflatcurve.cc +++ b/rtgui/myflatcurve.cc @@ -16,9 +16,9 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include +#include "myflatcurve.h" +#include "../rtengine/curves.h" +#include #include MyFlatCurve::MyFlatCurve () { diff --git a/rtgui/myflatcurve.h b/rtgui/myflatcurve.h index 7951609b4..dc6a2c8b8 100644 --- a/rtgui/myflatcurve.h +++ b/rtgui/myflatcurve.h @@ -21,9 +21,9 @@ #include #include -#include -#include -#include +#include "curvelistener.h" +#include "cursormanager.h" +#include "mycurve.h" // For compatibility and simplicity reason, order shouldn't change, and must be identical to the order specified in the curveType widget enum FlatCurveType { diff --git a/rtgui/navigator.cc b/rtgui/navigator.cc index 4802a58cd..3ef3da1fe 100644 --- a/rtgui/navigator.cc +++ b/rtgui/navigator.cc @@ -16,11 +16,11 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include // from rtengine -#include -#include +#include "navigator.h" +#include "toolpanel.h" +#include "../rtengine/iccmatrices.h" +#include "../rtengine/iccstore.h" +#include "../rtengine/curves.h" #define D50x 0.96422 #define D50z 0.82521 diff --git a/rtgui/navigator.h b/rtgui/navigator.h index cfe7321b4..1e95085db 100644 --- a/rtgui/navigator.h +++ b/rtgui/navigator.h @@ -20,9 +20,9 @@ #define _NAVIGATOR_ #include -#include -#include -#include +#include "previewwindow.h" +#include "pointermotionlistener.h" +#include "../rtengine/iccstore.h" class Navigator : public Gtk::Frame, public PointerMotionListener { diff --git a/rtgui/options.cc b/rtgui/options.cc index c1a3b8694..a0fb040af 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -16,15 +16,15 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include +#include "options.h" +#include #include #include -#include -#include -#include -#include -#include +#include "multilangmgr.h" +#include "../rtengine/safekeyfile.h" +#include "addsetids.h" +#include "guiutils.h" +#include "../rtengine/safegtk.h" #include "version.h" #ifdef WIN32 diff --git a/rtgui/options.h b/rtgui/options.h index eb188413b..52efd4c55 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -20,7 +20,7 @@ #define _OPTIONS_ #include -#include +#include "../rtengine/rtengine.h" #define STARTUPDIR_CURRENT 0 #define STARTUPDIR_HOME 1 diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index ad3f3fdf1..66eb60cba 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -16,10 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include +#include "paramsedited.h" +#include +#include "options.h" +#include "addsetids.h" ParamsEdited::ParamsEdited () { diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 93d157ecc..0de19d54b 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -21,8 +21,8 @@ #include #include -#include -#include +#include "../rtengine/rtengine.h" +#include "../rtengine/procparams.h" class ToneCurveParamsEdited { diff --git a/rtgui/partialpastedlg.cc b/rtgui/partialpastedlg.cc index 2f0666120..b28cbb1b6 100644 --- a/rtgui/partialpastedlg.cc +++ b/rtgui/partialpastedlg.cc @@ -16,8 +16,8 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include +#include "partialpastedlg.h" +#include "multilangmgr.h" PartialPasteDlg::PartialPasteDlg () { diff --git a/rtgui/partialpastedlg.h b/rtgui/partialpastedlg.h index fff6c54ad..83841dcaf 100644 --- a/rtgui/partialpastedlg.h +++ b/rtgui/partialpastedlg.h @@ -20,7 +20,7 @@ #define _PARTIALPASTEDLG_ #include -#include +#include "../rtengine/rtengine.h" class PartialPasteDlg : public Gtk::Dialog { diff --git a/rtgui/perspective.cc b/rtgui/perspective.cc index 8d1d8cd4e..7882d69fa 100644 --- a/rtgui/perspective.cc +++ b/rtgui/perspective.cc @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "perspective.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/perspective.h b/rtgui/perspective.h index 07a3ff38a..48f33c882 100644 --- a/rtgui/perspective.h +++ b/rtgui/perspective.h @@ -20,8 +20,8 @@ #define _PERSPECTIVE_PANEL_H_ #include -#include -#include +#include "adjuster.h" +#include "toolpanel.h" class PerspCorrection : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel { diff --git a/rtgui/placesbrowser.cc b/rtgui/placesbrowser.cc index 9610bba47..103330752 100644 --- a/rtgui/placesbrowser.cc +++ b/rtgui/placesbrowser.cc @@ -16,12 +16,12 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include -#include -#include +#include "placesbrowser.h" +#include "options.h" +#include "toolpanel.h" +#include "../rtengine/safegtk.h" +#include "guiutils.h" +#include "rtimage.h" PlacesBrowser::PlacesBrowser () : listener (NULL) { diff --git a/rtgui/placesbrowser.h b/rtgui/placesbrowser.h index ee015a863..95a2f9ca5 100644 --- a/rtgui/placesbrowser.h +++ b/rtgui/placesbrowser.h @@ -21,9 +21,9 @@ #include #include -#include -#include -#include +#include "dirbrowserremoteinterface.h" +#include "dirselectionlistener.h" +#include "multilangmgr.h" class PlacesBrowser : public Gtk::VBox, public DirSelectionListener { diff --git a/rtgui/popupbutton.cc b/rtgui/popupbutton.cc index 0ef2bfc95..6db2879fd 100644 --- a/rtgui/popupbutton.cc +++ b/rtgui/popupbutton.cc @@ -19,7 +19,7 @@ * Class created by Jean-Christophe FRISCH, aka 'Hombre' */ -#include +#include "popupbutton.h" /* * PopUpButton::PopUpButton (const Glib::ustring& label, bool imgRight) diff --git a/rtgui/popupbutton.h b/rtgui/popupbutton.h index fbb1ef67a..6239c4a40 100644 --- a/rtgui/popupbutton.h +++ b/rtgui/popupbutton.h @@ -22,7 +22,7 @@ #define _POPUPBUTTON_ #include -#include +#include "popupcommon.h" class PopUpButton : public Gtk::Button, public PopUpCommon { diff --git a/rtgui/popupcommon.cc b/rtgui/popupcommon.cc index c85b9a813..5efbdcbfb 100644 --- a/rtgui/popupcommon.cc +++ b/rtgui/popupcommon.cc @@ -19,10 +19,10 @@ * Class created by Jean-Christophe FRISCH, aka 'Hombre' */ -#include -#include -#include -#include +#include "multilangmgr.h" +#include "popupcommon.h" +#include "../rtengine/safegtk.h" +#include "rtimage.h" extern Glib::ustring argv0; diff --git a/rtgui/popupcommon.h b/rtgui/popupcommon.h index f6711d5b3..eba9e1ea3 100644 --- a/rtgui/popupcommon.h +++ b/rtgui/popupcommon.h @@ -24,7 +24,7 @@ #include #include -#include +#include "rtimage.h" class PopUpCommon { diff --git a/rtgui/popuptogglebutton.cc b/rtgui/popuptogglebutton.cc index 7a9051d26..7bdf9ef51 100644 --- a/rtgui/popuptogglebutton.cc +++ b/rtgui/popuptogglebutton.cc @@ -19,7 +19,7 @@ * Class created by Jean-Christophe FRISCH, aka 'Hombre' */ -#include +#include "popuptogglebutton.h" /* * PopUpToggleButton::PopUpToggleButton (const Glib::ustring& label, bool imgRight) diff --git a/rtgui/popuptogglebutton.h b/rtgui/popuptogglebutton.h index 86f94e6c8..762c88926 100644 --- a/rtgui/popuptogglebutton.h +++ b/rtgui/popuptogglebutton.h @@ -21,8 +21,8 @@ #ifndef _POPUPTOGGLEBUTTON_ #define _POPUPTOGGLEBUTTON_ -#include -#include +#include "popupbutton.h" +#include "popupcommon.h" class PopUpToggleButton : public Gtk::ToggleButton, public PopUpCommon { diff --git a/rtgui/pparamschangelistener.h b/rtgui/pparamschangelistener.h index 47cb8a085..14cc865a7 100644 --- a/rtgui/pparamschangelistener.h +++ b/rtgui/pparamschangelistener.h @@ -19,9 +19,9 @@ #ifndef _PPARAMSCHANGELISTENER_ #define _PPARAMSCHANGELISTENER_ -#include +#include "../rtengine/rtengine.h" #include -#include +#include "paramsedited.h" class PParamsChangeListener { diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index b3b7ee827..6c45ea82f 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -18,15 +18,15 @@ */ #include #include "preferences.h" -#include -#include -#include -#include -#include -#include +#include "multilangmgr.h" +#include "splash.h" +#include "cachemanager.h" +#include "addsetids.h" +#include "../rtengine/dfmanager.h" +#include "../rtengine/ffmanager.h" #include -#include -#include +#include "../rtengine/safegtk.h" +#include "rtimage.h" extern Options options; extern Glib::ustring argv0; diff --git a/rtgui/rotate.h b/rtgui/rotate.h index a0831e0a1..938710ed0 100644 --- a/rtgui/rotate.h +++ b/rtgui/rotate.h @@ -20,9 +20,9 @@ #define _ROTATE_H_ #include -#include -#include -#include +#include "adjuster.h" +#include "toolpanel.h" +#include "lensgeomlistener.h" class Rotate : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel { diff --git a/rtgui/rtimage.cc b/rtgui/rtimage.cc index eb377c01a..80bd00cb1 100644 --- a/rtgui/rtimage.cc +++ b/rtgui/rtimage.cc @@ -18,9 +18,9 @@ * along with RawTherapee. If not, see . */ -#include -#include -#include +#include "rtimage.h" +#include "../rtengine/safegtk.h" +#include "../rtengine/safekeyfile.h" extern Glib::ustring argv0; extern Options options; diff --git a/rtgui/rtimage.h b/rtgui/rtimage.h index c9f21c2e0..1ff075b11 100644 --- a/rtgui/rtimage.h +++ b/rtgui/rtimage.h @@ -20,7 +20,7 @@ #define _RTIMAGE_ #include -#include +#include "options.h" class RTImage : public Gtk::Image { public: diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index efc70d0fc..6cb011981 100644 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -16,11 +16,11 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include -#include +#include "rtwindow.h" +#include "options.h" +#include "preferences.h" +#include "cursormanager.h" +#include "rtimage.h" #include "whitebalance.h" RTWindow::RTWindow () diff --git a/rtgui/rtwindow.h b/rtgui/rtwindow.h index 3fac27d1f..fcce1a7ee 100644 --- a/rtgui/rtwindow.h +++ b/rtgui/rtwindow.h @@ -19,12 +19,12 @@ #define _RTWINDOW_ #include -#include -#include -#include +#include "filepanel.h" +#include "editorpanel.h" +#include "batchqueuepanel.h" #include -#include -#include +#include "progressconnector.h" +#include "editwindow.h" class RTWindow : public Gtk::Window, public rtengine::ProgressListener{ diff --git a/rtgui/saveasdlg.cc b/rtgui/saveasdlg.cc index 2c438f7ca..df3bdaa89 100644 --- a/rtgui/saveasdlg.cc +++ b/rtgui/saveasdlg.cc @@ -17,10 +17,10 @@ * along with RawTherapee. If not, see . */ #include "saveasdlg.h" -#include -#include -#include -#include +#include "multilangmgr.h" +#include "guiutils.h" +#include "../rtengine/safegtk.h" +#include "rtimage.h" extern Options options; SaveAsDialog::SaveAsDialog (Glib::ustring initialDir) { diff --git a/rtgui/saveasdlg.h b/rtgui/saveasdlg.h index d98fae100..38508d5ba 100644 --- a/rtgui/saveasdlg.h +++ b/rtgui/saveasdlg.h @@ -20,9 +20,9 @@ #define _SAVEASDLG_ #include -#include -#include -#include +#include "adjuster.h" +#include "saveformatpanel.h" +#include "options.h" class SaveAsDialog : public Gtk::Dialog, public FormatChangeListener { diff --git a/rtgui/saveformatpanel.cc b/rtgui/saveformatpanel.cc index 108b0f30e..0826f3c5c 100644 --- a/rtgui/saveformatpanel.cc +++ b/rtgui/saveformatpanel.cc @@ -16,9 +16,9 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include +#include "saveformatpanel.h" +#include "multilangmgr.h" +#include "guiutils.h" SaveFormatPanel::SaveFormatPanel () : listener (NULL) { diff --git a/rtgui/saveformatpanel.h b/rtgui/saveformatpanel.h index 90f95c409..cf6b148af 100644 --- a/rtgui/saveformatpanel.h +++ b/rtgui/saveformatpanel.h @@ -20,9 +20,9 @@ #define __SAVEFORMATPANEL_H__ #include -#include -#include -#include +#include "adjuster.h" +#include "guiutils.h" +#include "options.h" class FormatChangeListener { diff --git a/rtgui/shadowshighlights.cc b/rtgui/shadowshighlights.cc index 55dd8645f..c0464d8c6 100644 --- a/rtgui/shadowshighlights.cc +++ b/rtgui/shadowshighlights.cc @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "shadowshighlights.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/shadowshighlights.h b/rtgui/shadowshighlights.h index 98e993d2e..12acae2b6 100644 --- a/rtgui/shadowshighlights.h +++ b/rtgui/shadowshighlights.h @@ -20,8 +20,8 @@ #define _SHADOWSHIGHLIGHTS_H_ #include -#include -#include +#include "adjuster.h" +#include "toolpanel.h" class ShadowsHighlights : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel { diff --git a/rtgui/sharpenedge.cc b/rtgui/sharpenedge.cc index dcf16aa42..99066a199 100644 --- a/rtgui/sharpenedge.cc +++ b/rtgui/sharpenedge.cc @@ -16,12 +16,12 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include +#include "sharpenedge.h" +#include "guiutils.h" +#include "../rtengine/safegtk.h" #include #include -#include +#include using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/sharpenedge.h b/rtgui/sharpenedge.h index 508cccfcd..83b63e288 100644 --- a/rtgui/sharpenedge.h +++ b/rtgui/sharpenedge.h @@ -25,8 +25,8 @@ #define _SHARPENEDGE_H_ #include -#include -#include +#include "adjuster.h" +#include "toolpanel.h" class SharpenEdge : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel { diff --git a/rtgui/sharpening.cc b/rtgui/sharpening.cc index 9bfa4ebe9..72f2a58e1 100644 --- a/rtgui/sharpening.cc +++ b/rtgui/sharpening.cc @@ -16,10 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "sharpening.h" #include -#include -#include +#include +#include "guiutils.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/sharpening.h b/rtgui/sharpening.h index 352c83e78..335004214 100644 --- a/rtgui/sharpening.h +++ b/rtgui/sharpening.h @@ -20,9 +20,9 @@ #define _SHARPENING_H_ #include -#include -#include -#include +#include "adjuster.h" +#include "guiutils.h" +#include "toolpanel.h" class Sharpening : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel { diff --git a/rtgui/sharpenmicro.cc b/rtgui/sharpenmicro.cc index a45d2b6fd..a2af6867e 100644 --- a/rtgui/sharpenmicro.cc +++ b/rtgui/sharpenmicro.cc @@ -16,12 +16,12 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include +#include "sharpenmicro.h" +#include "guiutils.h" +#include "../rtengine/safegtk.h" #include #include -#include +#include using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/sharpenmicro.h b/rtgui/sharpenmicro.h index 0fa2b1fef..e0e3a43e0 100644 --- a/rtgui/sharpenmicro.h +++ b/rtgui/sharpenmicro.h @@ -25,8 +25,8 @@ #define _SHARPENMICRO_H_ #include -#include -#include +#include "adjuster.h" +#include "toolpanel.h" class SharpenMicro : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel { diff --git a/rtgui/shcselector.cc b/rtgui/shcselector.cc index 7dec130d6..12ce92157 100644 --- a/rtgui/shcselector.cc +++ b/rtgui/shcselector.cc @@ -17,9 +17,9 @@ * along with RawTherapee. If not, see . */ -#include +#include "shcselector.h" #include -#include +#include "mycurve.h" SHCSelector::SHCSelector() : movingPosition(-1), cl(NULL) { diff --git a/rtgui/soundman.cc b/rtgui/soundman.cc index 5a7bb4d07..67be7a5e9 100644 --- a/rtgui/soundman.cc +++ b/rtgui/soundman.cc @@ -18,8 +18,8 @@ * */ -#include -#include +#include "soundman.h" +#include "options.h" #ifdef WIN32 #include diff --git a/rtgui/soundman.h b/rtgui/soundman.h index 14a922179..d4cb48b33 100644 --- a/rtgui/soundman.h +++ b/rtgui/soundman.h @@ -21,7 +21,7 @@ #ifndef _SOUNDMAN_ #define _SOUNDMAN_ -#include +#include "../rtengine/safegtk.h" class SoundManager { public: diff --git a/rtgui/splash.cc b/rtgui/splash.cc index 6d22d16e4..12336b46f 100644 --- a/rtgui/splash.cc +++ b/rtgui/splash.cc @@ -16,10 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include +#include "splash.h" +#include "multilangmgr.h" #include -#include +#include "../rtengine/safegtk.h" extern Glib::ustring argv0; extern Glib::ustring creditsPath; diff --git a/rtgui/thumbbrowserbase.cc b/rtgui/thumbbrowserbase.cc index af7506d7d..21050c878 100644 --- a/rtgui/thumbbrowserbase.cc +++ b/rtgui/thumbbrowserbase.cc @@ -14,11 +14,11 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "thumbbrowserbase.h" #include -#include -#include -#include +#include "multilangmgr.h" +#include "options.h" +#include "../rtengine/mytime.h" ThumbBrowserBase::ThumbBrowserBase () : lastClicked(NULL), previewHeight(options.thumbSize) { diff --git a/rtgui/thumbbrowserbase.h b/rtgui/thumbbrowserbase.h index 92fa20237..90164596a 100644 --- a/rtgui/thumbbrowserbase.h +++ b/rtgui/thumbbrowserbase.h @@ -20,9 +20,9 @@ #define _THUMBNAILBROWSERBASE_ #include -#include +#include "thumbbrowserentrybase.h" #include -#include +#include "options.h" /* * Class handling the list of ThumbBrowserEntry objects and their position in it's allocated space diff --git a/rtgui/thumbbrowserentrybase.cc b/rtgui/thumbbrowserentrybase.cc index 24aa96025..720a6765c 100644 --- a/rtgui/thumbbrowserentrybase.cc +++ b/rtgui/thumbbrowserentrybase.cc @@ -16,10 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include +#include "thumbbrowserentrybase.h" +#include "thumbbrowserbase.h" +#include "options.h" +#include "../rtengine/mytime.h" ThumbBrowserEntryBase::ThumbBrowserEntryBase (const Glib::ustring& fname) : preh(0), preview(NULL), buttonSet(NULL), exp_width(0), exp_height(0), redrawRequests(0), diff --git a/rtgui/thumbbrowserentrybase.h b/rtgui/thumbbrowserentrybase.h index a9eaf2737..27971475a 100644 --- a/rtgui/thumbbrowserentrybase.h +++ b/rtgui/thumbbrowserentrybase.h @@ -20,8 +20,8 @@ #define _THUMBNAILBROWSERENTRYBASE_ #include -#include -#include +#include "lwbuttonset.h" +#include "thumbnail.h" class ThumbBrowserBase; class ThumbBrowserEntryBase { diff --git a/rtgui/thumbimageupdater.cc b/rtgui/thumbimageupdater.cc index 806baef94..096cc8044 100644 --- a/rtgui/thumbimageupdater.cc +++ b/rtgui/thumbimageupdater.cc @@ -18,9 +18,9 @@ */ #include -#include +#include "thumbimageupdater.h" #include -#include +#include "guiutils.h" #ifdef _OPENMP #include diff --git a/rtgui/thumbimageupdater.h b/rtgui/thumbimageupdater.h index 28eee88d5..fa459b1ad 100644 --- a/rtgui/thumbimageupdater.h +++ b/rtgui/thumbimageupdater.h @@ -20,8 +20,8 @@ #define _THUMBIMAGEUPDATER_ #include -#include -#include +#include "../rtengine/rtengine.h" +#include "thumbbrowserentrybase.h" #include class ThumbImageUpdateListener { diff --git a/rtgui/thumbnail.cc b/rtgui/thumbnail.cc index c122857a3..6aff26dfb 100644 --- a/rtgui/thumbnail.cc +++ b/rtgui/thumbnail.cc @@ -15,21 +15,21 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include +#include "multilangmgr.h" +#include "thumbnail.h" #include #include -#include -#include -#include -#include +#include "options.h" +#include "../rtengine/mytime.h" +#include +#include #include -#include +#include "../rtengine/imagedata.h" #include -#include -#include -#include -#include +#include "guiutils.h" +#include "profilestore.h" +#include "batchqueue.h" +#include "../rtengine/safegtk.h" using namespace rtengine::procparams; diff --git a/rtgui/thumbnail.h b/rtgui/thumbnail.h index 088d017c7..e0d182211 100644 --- a/rtgui/thumbnail.h +++ b/rtgui/thumbnail.h @@ -21,12 +21,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include "cachemanager.h" +#include "options.h" +#include "../rtengine/rtengine.h" +#include "../rtengine/rtthumbnail.h" +#include "cacheimagedata.h" +#include "thumbnaillistener.h" class CacheManager; class Thumbnail { diff --git a/rtgui/thumbnailbrowser.h b/rtgui/thumbnailbrowser.h index 00863169c..4b3c27078 100644 --- a/rtgui/thumbnailbrowser.h +++ b/rtgui/thumbnailbrowser.h @@ -20,8 +20,8 @@ #define _THUMBNAILBROWSER_ #include -#include -#include +#include "thumbnail.h" +#include "filecatalog.h" class ThumbBrowserEntry { diff --git a/rtgui/thumbnaillistener.h b/rtgui/thumbnaillistener.h index 313f97b16..1a2bae1aa 100644 --- a/rtgui/thumbnaillistener.h +++ b/rtgui/thumbnaillistener.h @@ -19,7 +19,7 @@ #ifndef _THUMBNAILLISTENER_ #define _THUMBNAILLISTENER_ -#include +#include "thumbnail.h" class Thumbnail; class ThumbnailListener { diff --git a/rtgui/tonecurve.cc b/rtgui/tonecurve.cc index 1cf81a1cd..86e0d4234 100644 --- a/rtgui/tonecurve.cc +++ b/rtgui/tonecurve.cc @@ -16,8 +16,8 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include +#include "tonecurve.h" +#include "adjuster.h" #include #include #include "ppversion.h" diff --git a/rtgui/tonecurve.h b/rtgui/tonecurve.h index 3c0da969d..768cbbf64 100644 --- a/rtgui/tonecurve.h +++ b/rtgui/tonecurve.h @@ -20,12 +20,12 @@ #define _TONECURVE_H_ #include -#include -#include -#include -#include -#include -#include +#include "adjuster.h" +#include "toolpanel.h" +#include "curveeditor.h" +#include "curveeditorgroup.h" +#include "mycurve.h" +#include "guiutils.h" class ToneCurve : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel, public rtengine::AutoExpListener, public CurveListener { diff --git a/rtgui/toolbar.cc b/rtgui/toolbar.cc index 81f123842..99835e2ef 100644 --- a/rtgui/toolbar.cc +++ b/rtgui/toolbar.cc @@ -17,8 +17,8 @@ * along with RawTherapee. If not, see . */ #include "toolbar.h" -#include -#include +#include "multilangmgr.h" +#include "rtimage.h" extern Glib::ustring argv0; diff --git a/rtgui/toolbar.h b/rtgui/toolbar.h index def99f3d1..e6c845552 100644 --- a/rtgui/toolbar.h +++ b/rtgui/toolbar.h @@ -20,7 +20,7 @@ #define __TOOLBAR_H__ #include -#include +#include "toolenum.h" class ToolBarListener { diff --git a/rtgui/toolpanel.cc b/rtgui/toolpanel.cc index fa2e75ad9..c98d39357 100644 --- a/rtgui/toolpanel.cc +++ b/rtgui/toolpanel.cc @@ -16,8 +16,8 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include +#include "toolpanel.h" +#include "toolpanelcoord.h" using namespace rtengine::procparams; diff --git a/rtgui/toolpanel.h b/rtgui/toolpanel.h index 4ed872431..152c56835 100644 --- a/rtgui/toolpanel.h +++ b/rtgui/toolpanel.h @@ -21,10 +21,10 @@ #include #include -#include -#include -#include -#include +#include "../rtengine/rtengine.h" +#include "../rtengine/procparams.h" +#include "multilangmgr.h" +#include "paramsedited.h" class ToolPanel; class FoldableToolPanel; diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index ecbec5853..5e19e240b 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -16,18 +16,18 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "multilangmgr.h" +#include "toolpanelcoord.h" +#include "ilabel.h" +#include "options.h" +#include "../rtengine/imagesource.h" +#include "../rtengine/dfmanager.h" +#include "../rtengine/ffmanager.h" +#include "../rtengine/improcfun.h" +#include "../rtengine/procevents.h" +#include "../rtengine/refreshmap.h" +#include "guiutils.h" +#include "rtimage.h" using namespace rtengine::procparams; diff --git a/rtgui/toolpanelcoord.h b/rtgui/toolpanelcoord.h index e77cfbae7..b1f1502fb 100644 --- a/rtgui/toolpanelcoord.h +++ b/rtgui/toolpanelcoord.h @@ -19,49 +19,49 @@ #ifndef __TOOLPANELCCORD__ #define __TOOLPANELCCORD__ -#include -#include +#include "../rtengine/rtengine.h" +#include "toolpanel.h" #include -#include -#include -#include +#include "pparamschangelistener.h" +#include "profilechangelistener.h" +#include "imageareatoollistener.h" #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "whitebalance.h" +#include "coarsepanel.h" +#include "tonecurve.h" +#include "vibrance.h" +#include "shadowshighlights.h" +#include "impulsedenoise.h" +#include "defringe.h" +#include "dirpyrdenoise.h" +#include "epd.h" +#include "sharpening.h" +#include "labcurve.h" +#include "exifpanel.h" +#include "iptcpanel.h" +#include "crop.h" +#include "icmpanel.h" +#include "resize.h" +#include "chmixer.h" +#include "hlrec.h" +#include "cacorrection.h" +#include "distortion.h" +#include "perspective.h" +#include "rotate.h" +#include "vignetting.h" +#include "toolbar.h" +#include "lensgeom.h" +#include "lensgeomlistener.h" +#include "dirpyrequalizer.h" +#include "hsvequalizer.h" +#include "rawprocess.h" +#include "preprocess.h" +#include "darkframe.h" +#include "flatfield.h" +#include "rawcacorrection.h" +#include "rawexposure.h" +#include "sharpenmicro.h" +#include "sharpenedge.h" #include "rgbcurves.h" class ImageEditorCoordinator; diff --git a/rtgui/vibrance.cc b/rtgui/vibrance.cc index 0df764413..e176f4776 100644 --- a/rtgui/vibrance.cc +++ b/rtgui/vibrance.cc @@ -17,7 +17,7 @@ * along with RawTherapee. If not, see . */ -#include +#include "vibrance.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/vibrance.h b/rtgui/vibrance.h index c0fcfa74a..40fefa1f5 100644 --- a/rtgui/vibrance.h +++ b/rtgui/vibrance.h @@ -20,9 +20,9 @@ #define _VIBRANCE_ #include -#include -//#include -#include +#include "adjuster.h" +//#include "guiutils.h" +#include "toolpanel.h" class Vibrance : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel { diff --git a/rtgui/vignetting.cc b/rtgui/vignetting.cc index ea2a418e5..adb2587db 100644 --- a/rtgui/vignetting.cc +++ b/rtgui/vignetting.cc @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "vignetting.h" #include using namespace rtengine; diff --git a/rtgui/vignetting.h b/rtgui/vignetting.h index 0c2997d02..ab0af4067 100644 --- a/rtgui/vignetting.h +++ b/rtgui/vignetting.h @@ -20,8 +20,8 @@ #define _VIGNETTING_H_ #include -#include -#include +#include "adjuster.h" +#include "toolpanel.h" class Vignetting : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel { diff --git a/rtgui/whitebalance.cc b/rtgui/whitebalance.cc index 91d16cff0..da144bc17 100644 --- a/rtgui/whitebalance.cc +++ b/rtgui/whitebalance.cc @@ -16,11 +16,11 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "whitebalance.h" #include -#include -#include -#include +#include "rtimage.h" +#include "options.h" +#include "../rtengine/safegtk.h" #define MINTEMP 2000 //1200 #define MAXTEMP 25000 //12000 diff --git a/rtgui/whitebalance.h b/rtgui/whitebalance.h index c57d1d8c5..1da7012f3 100644 --- a/rtgui/whitebalance.h +++ b/rtgui/whitebalance.h @@ -20,11 +20,11 @@ #define _WB_H_ #include -#include -#include -#include -#include -#include "procparams.h" +#include "toolpanel.h" +#include "adjuster.h" +#include "guiutils.h" +#include "wbprovider.h" +#include "../rtengine/procparams.h" class SpotWBListener { diff --git a/rtgui/windirmonitor.cc b/rtgui/windirmonitor.cc index d91b49156..66dbefd3b 100644 --- a/rtgui/windirmonitor.cc +++ b/rtgui/windirmonitor.cc @@ -16,8 +16,8 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include +#include "windirmonitor.h" +#include "options.h" static void CALLBACK current_directory_monitor_callback (DWORD error, DWORD nBytes, LPOVERLAPPED lpOverlapped) { DWORD dwOffset = 0; diff --git a/rtgui/zoompanel.cc b/rtgui/zoompanel.cc index 8fe79089b..e869e9729 100644 --- a/rtgui/zoompanel.cc +++ b/rtgui/zoompanel.cc @@ -16,10 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include -#include -#include +#include "zoompanel.h" +#include "multilangmgr.h" +#include "imagearea.h" +#include "rtimage.h" ZoomPanel::ZoomPanel (ImageArea* iarea) : iarea(iarea) {