[{"id":24123,"web_url":"https://patchwork.libcamera.org/comment/24123/","msgid":"<Yt74mDD8kNcavfE7@pendragon.ideasonboard.com>","date":"2022-07-25T20:10:00","subject":"Re: [libcamera-devel] [PATCH 06/15] DNI: ipa: raspberrypi: Code\n\trefactoring to match style guidelines","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Naush,\n\nThank you for the patch.\n\nOn Mon, Jul 25, 2022 at 02:46:30PM +0100, Naushir Patuck via libcamera-devel wrote:\n> Refactor the remaining files under src/ipa/raspberrypi/controller/* to match the\n> recommended formatting guidelines for the libcamera project. The vast majority\n> of changes in this commit comprise of switching from snake_case to CamelCase,\n> and starting class member functions with a lower case character.\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n\nOne is enough :-)\n\n> ---\n>  src/ipa/raspberrypi/controller/focus_status.h |   2 +-\n>  src/ipa/raspberrypi/controller/histogram.cpp  |  34 ++---\n>  src/ipa/raspberrypi/controller/histogram.hpp  |  10 +-\n>  src/ipa/raspberrypi/controller/metadata.hpp   |  16 +--\n>  src/ipa/raspberrypi/controller/pwl.cpp        | 130 +++++++++---------\n>  src/ipa/raspberrypi/controller/pwl.hpp        |  48 +++----\n>  6 files changed, 121 insertions(+), 119 deletions(-)\n> \n> diff --git a/src/ipa/raspberrypi/controller/focus_status.h b/src/ipa/raspberrypi/controller/focus_status.h\n> index ace2fe2c317a..656455100b45 100644\n> --- a/src/ipa/raspberrypi/controller/focus_status.h\n> +++ b/src/ipa/raspberrypi/controller/focus_status.h\n> @@ -18,7 +18,7 @@ extern \"C\" {\n>  \n>  struct FocusStatus {\n>  \tunsigned int num;\n> -\tuint32_t focus_measures[FOCUS_REGIONS];\n> +\tuint32_t focusMeasures[FOCUS_REGIONS];\n>  };\n>  \n>  #ifdef __cplusplus\n> diff --git a/src/ipa/raspberrypi/controller/histogram.cpp b/src/ipa/raspberrypi/controller/histogram.cpp\n> index 9916b3ed7f71..e865bef0057b 100644\n> --- a/src/ipa/raspberrypi/controller/histogram.cpp\n> +++ b/src/ipa/raspberrypi/controller/histogram.cpp\n> @@ -11,25 +11,25 @@\n>  \n>  using namespace RPiController;\n>  \n> -uint64_t Histogram::CumulativeFreq(double bin) const\n> +uint64_t Histogram::cumulativeFreq(double bin) const\n>  {\n>  \tif (bin <= 0)\n>  \t\treturn 0;\n> -\telse if (bin >= Bins())\n> -\t\treturn Total();\n> +\telse if (bin >= bins())\n> +\t\treturn total();\n>  \tint b = (int)bin;\n>  \treturn cumulative_[b] +\n>  \t       (bin - b) * (cumulative_[b + 1] - cumulative_[b]);\n>  }\n>  \n> -double Histogram::Quantile(double q, int first, int last) const\n> +double Histogram::quantile(double q, int first, int last) const\n>  {\n>  \tif (first == -1)\n>  \t\tfirst = 0;\n>  \tif (last == -1)\n>  \t\tlast = cumulative_.size() - 2;\n>  \tassert(first <= last);\n> -\tuint64_t items = q * Total();\n> +\tuint64_t items = q * total();\n>  \twhile (first < last) // binary search to find the right bin\n>  \t{\n>  \t\tint middle = (first + last) / 2;\n> @@ -45,20 +45,20 @@ double Histogram::Quantile(double q, int first, int last) const\n>  \treturn first + frac;\n>  }\n>  \n> -double Histogram::InterQuantileMean(double q_lo, double q_hi) const\n> +double Histogram::interQuantileMean(double qLo, double qHi) const\n>  {\n> -\tassert(q_hi > q_lo);\n> -\tdouble p_lo = Quantile(q_lo);\n> -\tdouble p_hi = Quantile(q_hi, (int)p_lo);\n> -\tdouble sum_bin_freq = 0, cumul_freq = 0;\n> -\tfor (double p_next = floor(p_lo) + 1.0; p_next <= ceil(p_hi);\n> -\t     p_lo = p_next, p_next += 1.0) {\n> -\t\tint bin = floor(p_lo);\n> +\tassert(qHi > qLo);\n> +\tdouble pLo = quantile(qLo);\n> +\tdouble pHi = quantile(qHi, (int)pLo);\n> +\tdouble sumBinFreq = 0, cumulFreq = 0;\n> +\tfor (double pNext = floor(pLo) + 1.0; pNext <= ceil(pHi);\n> +\t     pLo = pNext, pNext += 1.0) {\n> +\t\tint bin = floor(pLo);\n>  \t\tdouble freq = (cumulative_[bin + 1] - cumulative_[bin]) *\n> -\t\t\t      (std::min(p_next, p_hi) - p_lo);\n> -\t\tsum_bin_freq += bin * freq;\n> -\t\tcumul_freq += freq;\n> +\t\t\t      (std::min(pNext, pHi) - pLo);\n> +\t\tsumBinFreq += bin * freq;\n> +\t\tcumulFreq += freq;\n>  \t}\n>  \t// add 0.5 to give an average for bin mid-points\n> -\treturn sum_bin_freq / cumul_freq + 0.5;\n> +\treturn sumBinFreq / cumulFreq + 0.5;\n>  }\n> diff --git a/src/ipa/raspberrypi/controller/histogram.hpp b/src/ipa/raspberrypi/controller/histogram.hpp\n> index 90f5ac78e8c6..4ff5a56b0243 100644\n> --- a/src/ipa/raspberrypi/controller/histogram.hpp\n> +++ b/src/ipa/raspberrypi/controller/histogram.hpp\n> @@ -27,15 +27,15 @@ public:\n>  \t\t\tcumulative_.push_back(cumulative_.back() +\n>  \t\t\t\t\t      histogram[i]);\n>  \t}\n> -\tuint32_t Bins() const { return cumulative_.size() - 1; }\n> -\tuint64_t Total() const { return cumulative_[cumulative_.size() - 1]; }\n> +\tuint32_t bins() const { return cumulative_.size() - 1; }\n> +\tuint64_t total() const { return cumulative_[cumulative_.size() - 1]; }\n>  \t// Cumulative frequency up to a (fractional) point in a bin.\n> -\tuint64_t CumulativeFreq(double bin) const;\n> +\tuint64_t cumulativeFreq(double bin) const;\n>  \t// Return the (fractional) bin of the point q (0 <= q <= 1) through the\n>  \t// histogram. Optionally provide limits to help.\n> -\tdouble Quantile(double q, int first = -1, int last = -1) const;\n> +\tdouble quantile(double q, int first = -1, int last = -1) const;\n>  \t// Return the average histogram bin value between the two quantiles.\n> -\tdouble InterQuantileMean(double q_lo, double q_hi) const;\n> +\tdouble interQuantileMean(double qLo, double qHi) const;\n>  \n>  private:\n>  \tstd::vector<uint64_t> cumulative_;\n> diff --git a/src/ipa/raspberrypi/controller/metadata.hpp b/src/ipa/raspberrypi/controller/metadata.hpp\n> index 51e576cfab95..a79a67d42cce 100644\n> --- a/src/ipa/raspberrypi/controller/metadata.hpp\n> +++ b/src/ipa/raspberrypi/controller/metadata.hpp\n> @@ -22,26 +22,26 @@ public:\n>  \n>  \tMetadata(Metadata const &other)\n>  \t{\n> -\t\tstd::scoped_lock other_lock(other.mutex_);\n> +\t\tstd::scoped_lock otherLock(other.mutex_);\n>  \t\tdata_ = other.data_;\n>  \t}\n>  \n>  \tMetadata(Metadata &&other)\n>  \t{\n> -\t\tstd::scoped_lock other_lock(other.mutex_);\n> +\t\tstd::scoped_lock otherLock(other.mutex_);\n>  \t\tdata_ = std::move(other.data_);\n>  \t\tother.data_.clear();\n>  \t}\n>  \n>  \ttemplate<typename T>\n> -\tvoid Set(std::string const &tag, T const &value)\n> +\tvoid set(std::string const &tag, T const &value)\n>  \t{\n>  \t\tstd::scoped_lock lock(mutex_);\n>  \t\tdata_[tag] = value;\n>  \t}\n>  \n>  \ttemplate<typename T>\n> -\tint Get(std::string const &tag, T &value) const\n> +\tint get(std::string const &tag, T &value) const\n>  \t{\n>  \t\tstd::scoped_lock lock(mutex_);\n>  \t\tauto it = data_.find(tag);\n> @@ -51,7 +51,7 @@ public:\n>  \t\treturn 0;\n>  \t}\n>  \n> -\tvoid Clear()\n> +\tvoid clear()\n>  \t{\n>  \t\tstd::scoped_lock lock(mutex_);\n>  \t\tdata_.clear();\n> @@ -72,14 +72,14 @@ public:\n>  \t\treturn *this;\n>  \t}\n>  \n> -\tvoid Merge(Metadata &other)\n> +\tvoid merge(Metadata &other)\n>  \t{\n>  \t\tstd::scoped_lock lock(mutex_, other.mutex_);\n>  \t\tdata_.merge(other.data_);\n>  \t}\n>  \n>  \ttemplate<typename T>\n> -\tT *GetLocked(std::string const &tag)\n> +\tT *getLocked(std::string const &tag)\n>  \t{\n>  \t\t// This allows in-place access to the Metadata contents,\n>  \t\t// for which you should be holding the lock.\n> @@ -90,7 +90,7 @@ public:\n>  \t}\n>  \n>  \ttemplate<typename T>\n> -\tvoid SetLocked(std::string const &tag, T const &value)\n> +\tvoid setLocked(std::string const &tag, T const &value)\n>  \t{\n>  \t\t// Use this only if you're holding the lock yourself.\n>  \t\tdata_[tag] = value;\n> diff --git a/src/ipa/raspberrypi/controller/pwl.cpp b/src/ipa/raspberrypi/controller/pwl.cpp\n> index 130c820b559f..24ff3ea34f5f 100644\n> --- a/src/ipa/raspberrypi/controller/pwl.cpp\n> +++ b/src/ipa/raspberrypi/controller/pwl.cpp\n> @@ -12,7 +12,7 @@\n>  \n>  using namespace RPiController;\n>  \n> -void Pwl::Read(boost::property_tree::ptree const &params)\n> +void Pwl::read(boost::property_tree::ptree const &params)\n>  {\n>  \tfor (auto it = params.begin(); it != params.end(); it++) {\n>  \t\tdouble x = it->second.get_value<double>();\n> @@ -24,24 +24,24 @@ void Pwl::Read(boost::property_tree::ptree const &params)\n>  \tassert(points_.size() >= 2);\n>  }\n>  \n> -void Pwl::Append(double x, double y, const double eps)\n> +void Pwl::append(double x, double y, const double eps)\n>  {\n>  \tif (points_.empty() || points_.back().x + eps < x)\n>  \t\tpoints_.push_back(Point(x, y));\n>  }\n>  \n> -void Pwl::Prepend(double x, double y, const double eps)\n> +void Pwl::prepend(double x, double y, const double eps)\n>  {\n>  \tif (points_.empty() || points_.front().x - eps > x)\n>  \t\tpoints_.insert(points_.begin(), Point(x, y));\n>  }\n>  \n> -Pwl::Interval Pwl::Domain() const\n> +Pwl::Interval Pwl::domain() const\n>  {\n>  \treturn Interval(points_[0].x, points_[points_.size() - 1].x);\n>  }\n>  \n> -Pwl::Interval Pwl::Range() const\n> +Pwl::Interval Pwl::range() const\n>  {\n>  \tdouble lo = points_[0].y, hi = lo;\n>  \tfor (auto &p : points_)\n> @@ -49,18 +49,16 @@ Pwl::Interval Pwl::Range() const\n>  \treturn Interval(lo, hi);\n>  }\n>  \n> -bool Pwl::Empty() const\n> +bool Pwl::empty() const\n>  {\n>  \treturn points_.empty();\n>  }\n>  \n> -double Pwl::Eval(double x, int *span_ptr, bool update_span) const\n> +double Pwl::eval(double x, int *spanPtr, bool updateSpan) const\n>  {\n> -\tint span = findSpan(x, span_ptr && *span_ptr != -1\n> -\t\t\t\t       ? *span_ptr\n> -\t\t\t\t       : points_.size() / 2 - 1);\n> -\tif (span_ptr && update_span)\n> -\t\t*span_ptr = span;\n> +\tint span = findSpan(x, spanPtr && *spanPtr != -1 ? *spanPtr : points_.size() / 2 - 1);\n> +\tif (spanPtr && updateSpan)\n> +\t\t*spanPtr = span;\n>  \treturn points_[span].y +\n>  \t       (x - points_[span].x) * (points_[span + 1].y - points_[span].y) /\n>  \t\t       (points_[span + 1].x - points_[span].x);\n> @@ -70,31 +68,31 @@ int Pwl::findSpan(double x, int span) const\n>  {\n>  \t// Pwls are generally small, so linear search may well be faster than\n>  \t// binary, though could review this if large PWls start turning up.\n> -\tint last_span = points_.size() - 2;\n> +\tint lastSpan = points_.size() - 2;\n>  \t// some algorithms may call us with span pointing directly at the last\n>  \t// control point\n> -\tspan = std::max(0, std::min(last_span, span));\n> -\twhile (span < last_span && x >= points_[span + 1].x)\n> +\tspan = std::max(0, std::min(lastSpan, span));\n> +\twhile (span < lastSpan && x >= points_[span + 1].x)\n>  \t\tspan++;\n>  \twhile (span && x < points_[span].x)\n>  \t\tspan--;\n>  \treturn span;\n>  }\n>  \n> -Pwl::PerpType Pwl::Invert(Point const &xy, Point &perp, int &span,\n> +Pwl::PerpType Pwl::invert(Point const &xy, Point &perp, int &span,\n>  \t\t\t  const double eps) const\n>  {\n>  \tassert(span >= -1);\n> -\tbool prev_off_end = false;\n> +\tbool prevOffEnd = false;\n>  \tfor (span = span + 1; span < (int)points_.size() - 1; span++) {\n> -\t\tPoint span_vec = points_[span + 1] - points_[span];\n> -\t\tdouble t = ((xy - points_[span]) % span_vec) / span_vec.Len2();\n> +\t\tPoint spanVec = points_[span + 1] - points_[span];\n> +\t\tdouble t = ((xy - points_[span]) % spanVec) / spanVec.len2();\n>  \t\tif (t < -eps) // off the start of this span\n>  \t\t{\n>  \t\t\tif (span == 0) {\n>  \t\t\t\tperp = points_[span];\n>  \t\t\t\treturn PerpType::Start;\n> -\t\t\t} else if (prev_off_end) {\n> +\t\t\t} else if (prevOffEnd) {\n>  \t\t\t\tperp = points_[span];\n>  \t\t\t\treturn PerpType::Vertex;\n>  \t\t\t}\n> @@ -104,32 +102,32 @@ Pwl::PerpType Pwl::Invert(Point const &xy, Point &perp, int &span,\n>  \t\t\t\tperp = points_[span + 1];\n>  \t\t\t\treturn PerpType::End;\n>  \t\t\t}\n> -\t\t\tprev_off_end = true;\n> +\t\t\tprevOffEnd = true;\n>  \t\t} else // a true perpendicular\n>  \t\t{\n> -\t\t\tperp = points_[span] + span_vec * t;\n> +\t\t\tperp = points_[span] + spanVec * t;\n>  \t\t\treturn PerpType::Perpendicular;\n>  \t\t}\n>  \t}\n>  \treturn PerpType::None;\n>  }\n>  \n> -Pwl Pwl::Inverse(bool *true_inverse, const double eps) const\n> +Pwl Pwl::inverse(bool *trueInverse, const double eps) const\n>  {\n>  \tbool appended = false, prepended = false, neither = false;\n>  \tPwl inverse;\n>  \n>  \tfor (Point const &p : points_) {\n> -\t\tif (inverse.Empty())\n> -\t\t\tinverse.Append(p.y, p.x, eps);\n> +\t\tif (inverse.empty())\n> +\t\t\tinverse.append(p.y, p.x, eps);\n>  \t\telse if (std::abs(inverse.points_.back().x - p.y) <= eps ||\n>  \t\t\t std::abs(inverse.points_.front().x - p.y) <= eps)\n>  \t\t\t/* do nothing */;\n>  \t\telse if (p.y > inverse.points_.back().x) {\n> -\t\t\tinverse.Append(p.y, p.x, eps);\n> +\t\t\tinverse.append(p.y, p.x, eps);\n>  \t\t\tappended = true;\n>  \t\t} else if (p.y < inverse.points_.front().x) {\n> -\t\t\tinverse.Prepend(p.y, p.x, eps);\n> +\t\t\tinverse.prepend(p.y, p.x, eps);\n>  \t\t\tprepended = true;\n>  \t\t} else\n>  \t\t\tneither = true;\n> @@ -138,63 +136,65 @@ Pwl Pwl::Inverse(bool *true_inverse, const double eps) const\n>  \t// This is not a proper inverse if we found ourselves putting points\n>  \t// onto both ends of the inverse, or if there were points that couldn't\n>  \t// go on either.\n> -\tif (true_inverse)\n> -\t\t*true_inverse = !(neither || (appended && prepended));\n> +\tif (trueInverse)\n> +\t\t*trueInverse = !(neither || (appended && prepended));\n>  \n>  \treturn inverse;\n>  }\n>  \n> -Pwl Pwl::Compose(Pwl const &other, const double eps) const\n> +Pwl Pwl::compose(Pwl const &other, const double eps) const\n>  {\n> -\tdouble this_x = points_[0].x, this_y = points_[0].y;\n> -\tint this_span = 0, other_span = other.findSpan(this_y, 0);\n> -\tPwl result({ { this_x, other.Eval(this_y, &other_span, false) } });\n> -\twhile (this_span != (int)points_.size() - 1) {\n> -\t\tdouble dx = points_[this_span + 1].x - points_[this_span].x,\n> -\t\t       dy = points_[this_span + 1].y - points_[this_span].y;\n> +\tdouble thisX = points_[0].x, thisY = points_[0].y;\n> +\tint thisSpan = 0, otherSpan = other.findSpan(thisY, 0);\n> +\tPwl result({ { thisX, other.eval(thisY, &otherSpan, false) } });\n> +\twhile (thisSpan != (int)points_.size() - 1) {\n> +\t\tdouble dx = points_[thisSpan + 1].x - points_[thisSpan].x,\n> +\t\t       dy = points_[thisSpan + 1].y - points_[thisSpan].y;\n>  \t\tif (abs(dy) > eps &&\n> -\t\t    other_span + 1 < (int)other.points_.size() &&\n> -\t\t    points_[this_span + 1].y >=\n> -\t\t\t    other.points_[other_span + 1].x + eps) {\n> +\t\t    otherSpan + 1 < (int)other.points_.size() &&\n> +\t\t    points_[thisSpan + 1].y >=\n> +\t\t\t    other.points_[otherSpan + 1].x + eps) {\n>  \t\t\t// next control point in result will be where this\n>  \t\t\t// function's y reaches the next span in other\n> -\t\t\tthis_x = points_[this_span].x +\n> -\t\t\t\t (other.points_[other_span + 1].x -\n> -\t\t\t\t  points_[this_span].y) * dx / dy;\n> -\t\t\tthis_y = other.points_[++other_span].x;\n> -\t\t} else if (abs(dy) > eps && other_span > 0 &&\n> -\t\t\t   points_[this_span + 1].y <=\n> -\t\t\t\t   other.points_[other_span - 1].x - eps) {\n> +\t\t\tthisX = points_[thisSpan].x +\n> +\t\t\t\t(other.points_[otherSpan + 1].x -\n> +\t\t\t\t points_[thisSpan].y) *\n> +\t\t\t\t\tdx / dy;\n> +\t\t\tthisY = other.points_[++otherSpan].x;\n> +\t\t} else if (abs(dy) > eps && otherSpan > 0 &&\n> +\t\t\t   points_[thisSpan + 1].y <=\n> +\t\t\t\t   other.points_[otherSpan - 1].x - eps) {\n>  \t\t\t// next control point in result will be where this\n>  \t\t\t// function's y reaches the previous span in other\n> -\t\t\tthis_x = points_[this_span].x +\n> -\t\t\t\t (other.points_[other_span + 1].x -\n> -\t\t\t\t  points_[this_span].y) * dx / dy;\n> -\t\t\tthis_y = other.points_[--other_span].x;\n> +\t\t\tthisX = points_[thisSpan].x +\n> +\t\t\t\t(other.points_[otherSpan + 1].x -\n> +\t\t\t\t points_[thisSpan].y) *\n> +\t\t\t\t\tdx / dy;\n> +\t\t\tthisY = other.points_[--otherSpan].x;\n>  \t\t} else {\n>  \t\t\t// we stay in the same span in other\n> -\t\t\tthis_span++;\n> -\t\t\tthis_x = points_[this_span].x,\n> -\t\t\tthis_y = points_[this_span].y;\n> +\t\t\tthisSpan++;\n> +\t\t\tthisX = points_[thisSpan].x,\n> +\t\t\tthisY = points_[thisSpan].y;\n>  \t\t}\n> -\t\tresult.Append(this_x, other.Eval(this_y, &other_span, false),\n> +\t\tresult.append(thisX, other.eval(thisY, &otherSpan, false),\n>  \t\t\t      eps);\n>  \t}\n>  \treturn result;\n>  }\n>  \n> -void Pwl::Map(std::function<void(double x, double y)> f) const\n> +void Pwl::map(std::function<void(double x, double y)> f) const\n>  {\n>  \tfor (auto &pt : points_)\n>  \t\tf(pt.x, pt.y);\n>  }\n>  \n> -void Pwl::Map2(Pwl const &pwl0, Pwl const &pwl1,\n> +void Pwl::map2(Pwl const &pwl0, Pwl const &pwl1,\n>  \t       std::function<void(double x, double y0, double y1)> f)\n>  {\n>  \tint span0 = 0, span1 = 0;\n>  \tdouble x = std::min(pwl0.points_[0].x, pwl1.points_[0].x);\n> -\tf(x, pwl0.Eval(x, &span0, false), pwl1.Eval(x, &span1, false));\n> +\tf(x, pwl0.eval(x, &span0, false), pwl1.eval(x, &span1, false));\n>  \twhile (span0 < (int)pwl0.points_.size() - 1 ||\n>  \t       span1 < (int)pwl1.points_.size() - 1) {\n>  \t\tif (span0 == (int)pwl0.points_.size() - 1)\n> @@ -205,28 +205,28 @@ void Pwl::Map2(Pwl const &pwl0, Pwl const &pwl1,\n>  \t\t\tx = pwl1.points_[++span1].x;\n>  \t\telse\n>  \t\t\tx = pwl0.points_[++span0].x;\n> -\t\tf(x, pwl0.Eval(x, &span0, false), pwl1.Eval(x, &span1, false));\n> +\t\tf(x, pwl0.eval(x, &span0, false), pwl1.eval(x, &span1, false));\n>  \t}\n>  }\n>  \n> -Pwl Pwl::Combine(Pwl const &pwl0, Pwl const &pwl1,\n> +Pwl Pwl::combine(Pwl const &pwl0, Pwl const &pwl1,\n>  \t\t std::function<double(double x, double y0, double y1)> f,\n>  \t\t const double eps)\n>  {\n>  \tPwl result;\n> -\tMap2(pwl0, pwl1, [&](double x, double y0, double y1) {\n> -\t\tresult.Append(x, f(x, y0, y1), eps);\n> +\tmap2(pwl0, pwl1, [&](double x, double y0, double y1) {\n> +\t\tresult.append(x, f(x, y0, y1), eps);\n>  \t});\n>  \treturn result;\n>  }\n>  \n> -void Pwl::MatchDomain(Interval const &domain, bool clip, const double eps)\n> +void Pwl::matchDomain(Interval const &domain, bool clip, const double eps)\n>  {\n>  \tint span = 0;\n> -\tPrepend(domain.start, Eval(clip ? points_[0].x : domain.start, &span),\n> +\tprepend(domain.start, eval(clip ? points_[0].x : domain.start, &span),\n>  \t\teps);\n>  \tspan = points_.size() - 2;\n> -\tAppend(domain.end, Eval(clip ? points_.back().x : domain.end, &span),\n> +\tappend(domain.end, eval(clip ? points_.back().x : domain.end, &span),\n>  \t       eps);\n>  }\n>  \n> @@ -237,7 +237,7 @@ Pwl &Pwl::operator*=(double d)\n>  \treturn *this;\n>  }\n>  \n> -void Pwl::Debug(FILE *fp) const\n> +void Pwl::debug(FILE *fp) const\n\nCandidate for another patch, maybe this should be turned into an\noperator<<(std::ostream &).\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n>  {\n>  \tfprintf(fp, \"Pwl {\\n\");\n>  \tfor (auto &p : points_)\n> diff --git a/src/ipa/raspberrypi/controller/pwl.hpp b/src/ipa/raspberrypi/controller/pwl.hpp\n> index 484672f64095..4a38d1df5a33 100644\n> --- a/src/ipa/raspberrypi/controller/pwl.hpp\n> +++ b/src/ipa/raspberrypi/controller/pwl.hpp\n> @@ -17,24 +17,26 @@ class Pwl\n>  {\n>  public:\n>  \tstruct Interval {\n> -\t\tInterval(double _start, double _end) : start(_start), end(_end)\n> +\t\tInterval(double _start, double _end)\n> +\t\t\t: start(_start), end(_end)\n>  \t\t{\n>  \t\t}\n>  \t\tdouble start, end;\n> -\t\tbool Contains(double value)\n> +\t\tbool contains(double value)\n>  \t\t{\n>  \t\t\treturn value >= start && value <= end;\n>  \t\t}\n> -\t\tdouble Clip(double value)\n> +\t\tdouble clip(double value)\n>  \t\t{\n>  \t\t\treturn value < start ? start\n>  \t\t\t\t\t     : (value > end ? end : value);\n>  \t\t}\n> -\t\tdouble Len() const { return end - start; }\n> +\t\tdouble len() const { return end - start; }\n>  \t};\n>  \tstruct Point {\n>  \t\tPoint() : x(0), y(0) {}\n> -\t\tPoint(double _x, double _y) : x(_x), y(_y) {}\n> +\t\tPoint(double _x, double _y)\n> +\t\t\t: x(_x), y(_y) {}\n>  \t\tdouble x, y;\n>  \t\tPoint operator-(Point const &p) const\n>  \t\t{\n> @@ -50,23 +52,23 @@ public:\n>  \t\t}\n>  \t\tPoint operator*(double f) const { return Point(x * f, y * f); }\n>  \t\tPoint operator/(double f) const { return Point(x / f, y / f); }\n> -\t\tdouble Len2() const { return x * x + y * y; }\n> -\t\tdouble Len() const { return sqrt(Len2()); }\n> +\t\tdouble len2() const { return x * x + y * y; }\n> +\t\tdouble len() const { return sqrt(len2()); }\n>  \t};\n>  \tPwl() {}\n>  \tPwl(std::vector<Point> const &points) : points_(points) {}\n> -\tvoid Read(boost::property_tree::ptree const &params);\n> -\tvoid Append(double x, double y, const double eps = 1e-6);\n> -\tvoid Prepend(double x, double y, const double eps = 1e-6);\n> -\tInterval Domain() const;\n> -\tInterval Range() const;\n> -\tbool Empty() const;\n> +\tvoid read(boost::property_tree::ptree const &params);\n> +\tvoid append(double x, double y, const double eps = 1e-6);\n> +\tvoid prepend(double x, double y, const double eps = 1e-6);\n> +\tInterval domain() const;\n> +\tInterval range() const;\n> +\tbool empty() const;\n>  \t// Evaluate Pwl, optionally supplying an initial guess for the\n>  \t// \"span\". The \"span\" may be optionally be updated.  If you want to know\n>  \t// the \"span\" value but don't have an initial guess you can set it to\n>  \t// -1.\n> -\tdouble Eval(double x, int *span_ptr = nullptr,\n> -\t\t    bool update_span = true) const;\n> +\tdouble eval(double x, int *spanPtr = nullptr,\n> +\t\t    bool updateSpan = true) const;\n>  \t// Find perpendicular closest to xy, starting from span+1 so you can\n>  \t// call it repeatedly to check for multiple closest points (set span to\n>  \t// -1 on the first call). Also returns \"pseudo\" perpendiculars; see\n> @@ -78,31 +80,31 @@ public:\n>  \t\tVertex, // vertex of Pwl is closest point\n>  \t\tPerpendicular // true perpendicular found\n>  \t};\n> -\tPerpType Invert(Point const &xy, Point &perp, int &span,\n> +\tPerpType invert(Point const &xy, Point &perp, int &span,\n>  \t\t\tconst double eps = 1e-6) const;\n>  \t// Compute the inverse function. Indicate if it is a proper (true)\n>  \t// inverse, or only a best effort (e.g. input was non-monotonic).\n> -\tPwl Inverse(bool *true_inverse = nullptr, const double eps = 1e-6) const;\n> +\tPwl inverse(bool *trueInverse = nullptr, const double eps = 1e-6) const;\n>  \t// Compose two Pwls together, doing \"this\" first and \"other\" after.\n> -\tPwl Compose(Pwl const &other, const double eps = 1e-6) const;\n> +\tPwl compose(Pwl const &other, const double eps = 1e-6) const;\n>  \t// Apply function to (x,y) values at every control point.\n> -\tvoid Map(std::function<void(double x, double y)> f) const;\n> +\tvoid map(std::function<void(double x, double y)> f) const;\n>  \t// Apply function to (x, y0, y1) values wherever either Pwl has a\n>  \t// control point.\n> -\tstatic void Map2(Pwl const &pwl0, Pwl const &pwl1,\n> +\tstatic void map2(Pwl const &pwl0, Pwl const &pwl1,\n>  \t\t\t std::function<void(double x, double y0, double y1)> f);\n>  \t// Combine two Pwls, meaning we create a new Pwl where the y values are\n>  \t// given by running f wherever either has a knot.\n>  \tstatic Pwl\n> -\tCombine(Pwl const &pwl0, Pwl const &pwl1,\n> +\tcombine(Pwl const &pwl0, Pwl const &pwl1,\n>  \t\tstd::function<double(double x, double y0, double y1)> f,\n>  \t\tconst double eps = 1e-6);\n>  \t// Make \"this\" match (at least) the given domain. Any extension my be\n>  \t// clipped or linear.\n> -\tvoid MatchDomain(Interval const &domain, bool clip = true,\n> +\tvoid matchDomain(Interval const &domain, bool clip = true,\n>  \t\t\t const double eps = 1e-6);\n>  \tPwl &operator*=(double d);\n> -\tvoid Debug(FILE *fp = stdout) const;\n> +\tvoid debug(FILE *fp = stdout) const;\n>  \n>  private:\n>  \tint findSpan(double x, int span) const;","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id BAE64BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 25 Jul 2022 20:10:07 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2E24563312;\n\tMon, 25 Jul 2022 22:10:07 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5E0756330A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 25 Jul 2022 22:10:05 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BC1DB6D1;\n\tMon, 25 Jul 2022 22:10:04 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658779807;\n\tbh=Z0G/GhJ4HwL9IVZX9IPWu62mOWQ95uPz3LY1UI/MpFA=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=IvPMwVpqVjbm4Olp7K2+j4tyY8mtjcpgO1TVS1pLBt9RWdxrLxAoUccrXEp9DeQYJ\n\tIsXlAezbBDaYRwgD1vYlykXUlFI3MCZ1Wzscq3OQMiS62LusraoiRoF13sjyHexRjH\n\tVZl46T1dm2cU+DPwJYaH1LPjW0ue5Bv2uNz9sz0rKu2v0d40BR/Hr6uA5MvFlW+8yT\n\tPH4k30ihLtlPxkB6Xn66JPqeluvFEB0EFu1KPxO2dV+pGQWzVmxTIwmfw+iEeTHPWR\n\tpnzlpPc5RG/1pSEN8a08yNtc3RUAVfe/4rUoVcLv+yp1qbC2GLhjGCfZMrUU9HEKY3\n\tV4YBODix6qtgQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1658779805;\n\tbh=Z0G/GhJ4HwL9IVZX9IPWu62mOWQ95uPz3LY1UI/MpFA=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=I398K6S2rpAvSrsXBW81poY4PO9P6KWEX9VZMy0qLIBwvX5ogCJjli+Wyp6S3OwIN\n\txpJgbm1HuD7Yf5NT+QAXOnuw5vZqg2B/IhkVq4Ykcg2/RKLRYxxV/HhbhNk4dzy6uR\n\te7Gmrk899uwVr4IygIesTpSlnZ4TdP22EiyBOL/E="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"I398K6S2\"; dkim-atps=neutral","Date":"Mon, 25 Jul 2022 23:10:00 +0300","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<Yt74mDD8kNcavfE7@pendragon.ideasonboard.com>","References":"<20220725134639.4572-1-naush@raspberrypi.com>\n\t<20220725134639.4572-7-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220725134639.4572-7-naush@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH 06/15] DNI: ipa: raspberrypi: Code\n\trefactoring to match style guidelines","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]