summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ipa/libipa/awb.cpp5
-rw-r--r--src/ipa/libipa/awb_bayes.cpp8
-rw-r--r--utils/tuning/config-example.yaml12
3 files changed, 15 insertions, 10 deletions
diff --git a/src/ipa/libipa/awb.cpp b/src/ipa/libipa/awb.cpp
index 62b69dd9..6157bd43 100644
--- a/src/ipa/libipa/awb.cpp
+++ b/src/ipa/libipa/awb.cpp
@@ -57,8 +57,9 @@ namespace ipa {
* applied. To keep the actual implementations computationally inexpensive,
* the squared colour error shall be returned.
*
- * If the awb statistics provide multiple zones, the sum over all zones needs to
- * calculated.
+ * If the awb statistics provide multiple zones, the average of the individual
+ * squared errors shall be returned. Averaging/normalizing is necessary so that
+ * the numeric dimensions are the same on all hardware platforms.
*
* \return The computed error value
*/
diff --git a/src/ipa/libipa/awb_bayes.cpp b/src/ipa/libipa/awb_bayes.cpp
index c3e0b69b..e75bfcd6 100644
--- a/src/ipa/libipa/awb_bayes.cpp
+++ b/src/ipa/libipa/awb_bayes.cpp
@@ -234,6 +234,10 @@ int AwbBayes::readPriors(const YamlObject &tuningData)
auto &pwl = priors[lux];
for (const auto &[ct, prob] : ctToProbability) {
+ if (prob < 1e-6) {
+ LOG(Awb, Error) << "Prior probability must be larger than 1e-6";
+ return -EINVAL;
+ }
pwl.append(ct, prob);
}
}
@@ -323,7 +327,7 @@ double AwbBayes::coarseSearch(const ipa::Pwl &prior, const AwbStats &stats) cons
double b = ctB_.eval(t, &spanB);
RGB<double> gains({ 1 / r, 1.0, 1 / b });
double delta2Sum = stats.computeColourError(gains);
- double priorLogLikelihood = prior.eval(prior.domain().clamp(t));
+ double priorLogLikelihood = log(prior.eval(prior.domain().clamp(t)));
double finalLogLikelihood = delta2Sum - priorLogLikelihood;
errorLimits.record(delta2Sum);
@@ -406,7 +410,7 @@ void AwbBayes::fineSearch(double &t, double &r, double &b, ipa::Pwl const &prior
for (int i = -nsteps; i <= nsteps; i++) {
double tTest = t + i * step;
double priorLogLikelihood =
- prior.eval(prior.domain().clamp(tTest));
+ log(prior.eval(prior.domain().clamp(tTest)));
priorLogLikelihoodLimits.record(priorLogLikelihood);
Pwl::Point rbStart{ { ctR_.eval(tTest, &spanR),
ctB_.eval(tTest, &spanB) } };
diff --git a/utils/tuning/config-example.yaml b/utils/tuning/config-example.yaml
index 1bbb2757..5593eaef 100644
--- a/utils/tuning/config-example.yaml
+++ b/utils/tuning/config-example.yaml
@@ -7,21 +7,21 @@ general:
awb:
# Algorithm can either be 'grey' or 'bayes'
algorithm: bayes
- # Priors is only used for the bayes algorithm. They are defined in
- # logarithmic space. A good staring point is:
+ # Priors is only used for the bayes algorithm. They are defined in linear
+ # space. A good staring point is:
# - lux: 0
# ct: [ 2000, 3000, 13000 ]
- # probability: [ 1.0, 0.0, 0.0 ]
+ # probability: [ 1.005, 1.0, 1.0 ]
# - lux: 800
# ct: [ 2000, 6000, 13000 ]
- # probability: [ 0.0, 2.0, 2.0 ]
+ # probability: [ 1.0, 1.01, 1.01 ]
# - lux: 1500
# ct: [ 2000, 4000, 6000, 6500, 7000, 13000 ]
- # probability: [ 0.0, 1.0, 6.0, 7.0, 1.0, 1.0 ]
+ # probability: [ 1.0, 1.005, 1.032, 1.037, 1.01, 1.01 ]
priors:
- lux: 0
ct: [ 2000, 13000 ]
- probability: [ 0.0, 0.0 ]
+ probability: [ 1.0, 1.0 ]
AwbMode:
AwbAuto:
lo: 2500