diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 392c81de1..232747439 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -5322,8 +5322,17 @@ void RawImageSource::getrgbloc(int begx, int begy, int yEn, int xEn, int cx, int { // BENCHFUN //used by auto WB local to calculate red, green, blue in local region - const int bfw = W / 9 + ((W % 9) > 0 ? 1 : 0);//10 arbitrary value ; perhaps 4 or 5 or 20 - const int bfh = H / 9 + ((H % 9) > 0 ? 1 : 0); + int precision = 5; + if (settings->itcwb_precis == 5) { + precision = 5; + } else if (settings->itcwb_precis < 5) { + precision = 3; + } else if (settings->itcwb_precis > 5) { + precision = 9; + } + + const int bfw = W / precision + ((W % precision) > 0 ? 1 : 0);// 5 arbitrary value can be change to 3 or 9 ; + const int bfh = H / precision + ((H % precision) > 0 ? 1 : 0); if (! greenloc) { greenloc(bfw, bfh); @@ -5373,9 +5382,9 @@ void RawImageSource::getrgbloc(int begx, int begy, int yEn, int xEn, int cx, int #pragma omp parallel for #endif for (int i = 0; i < bfh; ++i) { - const int ii = i * 9; + const int ii = i * precision; if (ii < H) { - for (int j = 0, jj = 0; j < bfw; ++j, jj += 9) { + for (int j = 0, jj = 0; j < bfw; ++j, jj += precision) { redloc[i][j] = red[ii][jj] * multip; greenloc[i][j] = green[ii][jj] * multip; blueloc[i][j] = blue[ii][jj] * multip; @@ -5575,8 +5584,17 @@ void RawImageSource::getAutoWBMultipliersitc(double & tempref, double & greenref if (wbpar.method == "autitcgreen") { bool twotimes = false; - const int bfw = W / 9 + ((W % 9) > 0 ? 1 : 0);// 10 arbitrary value ; perhaps 4 or 5 or 20 - const int bfh = H / 9 + ((H % 9) > 0 ? 1 : 0); + int precision = 5; + if (settings->itcwb_precis == 5) { + precision = 5; + } else if (settings->itcwb_precis < 5) { + precision = 3; + } else if (settings->itcwb_precis > 5) { + precision = 9; + } + + const int bfw = W / precision + ((W % precision) > 0 ? 1 : 0);// 5 arbitrary value can be change to 3 or 9 ; + const int bfh = H / precision + ((H % precision) > 0 ? 1 : 0); WBauto(tempref, greenref, redloc, greenloc, blueloc, bfw, bfh, avg_rm, avg_gm, avg_bm, tempitc, greenitc, studgood, twotimes, wbpar, begx, begy, yEn, xEn, cx, cy, cmp, raw); } diff --git a/rtengine/settings.h b/rtengine/settings.h index 4d3131695..529336cbc 100644 --- a/rtengine/settings.h +++ b/rtengine/settings.h @@ -89,6 +89,7 @@ public: int itcwb_sizereference; int itcwb_delta; bool itcwb_stdobserver10; + int itcwb_precis; enum class ThumbnailInspectorMode { diff --git a/rtgui/options.cc b/rtgui/options.cc index 4a21fd8c0..7ae6c24aa 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -598,7 +598,8 @@ void Options::setDefaults() rtSettings.itcwb_sizereference = 3;//between 1 and 5 rtSettings.itcwb_delta = 1;//between 0 and 5 rtSettings.itcwb_stdobserver10 = true; - + rtSettings.itcwb_precis = 5;//3 or 5 or 9 + rtSettings.protectred = 60; rtSettings.protectredh = 0.3; rtSettings.CRI_color = 0; @@ -1534,6 +1535,9 @@ void Options::readFromFile(Glib::ustring fname) rtSettings.itcwb_delta = keyFile.get_integer("Color Management", "Itcwb_delta"); } + if (keyFile.has_key("Color Management", "Itcwb_precis")) { + rtSettings.itcwb_precis = keyFile.get_integer("Color Management", "Itcwb_precis"); + } //if (keyFile.has_key ("Color Management", "Colortoningab")) rtSettings.colortoningab = keyFile.get_double("Color Management", "Colortoningab"); //if (keyFile.has_key ("Color Management", "Decaction")) rtSettings.decaction = keyFile.get_double("Color Management", "Decaction"); @@ -2207,6 +2211,7 @@ void Options::saveToFile(Glib::ustring fname) keyFile.set_integer("Color Management", "Itcwb_sizereference", rtSettings.itcwb_sizereference); keyFile.set_integer("Color Management", "Itcwb_delta", rtSettings.itcwb_delta); keyFile.set_boolean("Color Management", "Itcwb_stdobserver10", rtSettings.itcwb_stdobserver10); + keyFile.set_integer("Color Management", "Itcwb_precis", rtSettings.itcwb_precis); //keyFile.set_double ("Color Management", "Colortoningab", rtSettings.colortoningab); //keyFile.set_double ("Color Management", "Decaction", rtSettings.decaction);