@@ -6,15 +6,8 @@
*/
#include "interpolator.h"
-#include <algorithm>
-#include <string>
-
#include <libcamera/base/log.h>
-#include "libcamera/internal/yaml_parser.h"
-
-#include "interpolator.h"
-
/**
* \file interpolator.h
* \brief Helper class for linear interpolating a set of objects
@@ -104,20 +97,6 @@ namespace ipa {
* \return Zero on success, negative error code otherwise
*/
-/**
- * \fn void Interpolator<T>::setQuantization(const unsigned int q)
- * \brief Set the quantization value
- * \param[in] q The quantization value
- *
- * Sets the quantization value. When this is set, 'key' gets quantized to this
- * size, before doing the interpolation. This can help in reducing the number of
- * updates pushed to the hardware.
- *
- * Note that normally a threshold needs to be combined with quantization.
- * Otherwise a value that swings around the edge of the quantization step will
- * lead to constant updates.
- */
-
/**
* \fn void Interpolator<T>::setData(std::map<unsigned int, T> &&data)
* \brief Set the internal map
@@ -136,10 +115,8 @@ namespace ipa {
* \fn const T& Interpolator<T>::getInterpolated()
* \brief Retrieve an interpolated value for the given key
* \param[in] key The unsigned integer key of the object to retrieve
- * \param[out] quantizedKey If provided, the key value after quantization
* \return The object corresponding to the key. The object is cached internally,
- * so on successive calls with the same key (after quantization) interpolation
- * is not recalculated.
+ * so on successive calls with the same key interpolation is not recalculated.
*/
/**
@@ -70,11 +70,6 @@ public:
return 0;
}
- void setQuantization(const unsigned int q)
- {
- quantization_ = q;
- }
-
void setData(std::map<unsigned int, T> &&data)
{
data_ = std::move(data);
@@ -86,16 +81,10 @@ public:
return data_;
}
- const T &getInterpolated(unsigned int key, unsigned int *quantizedKey = nullptr)
+ const T &getInterpolated(unsigned int key)
{
ASSERT(data_.size() > 0);
- if (quantization_ > 0)
- key = std::lround(key / static_cast<double>(quantization_)) * quantization_;
-
- if (quantizedKey)
- *quantizedKey = key;
-
if (lastInterpolatedKey_.has_value() &&
*lastInterpolatedKey_ == key)
return lastInterpolatedValue_;
@@ -128,7 +117,6 @@ private:
std::map<unsigned int, T> data_;
T lastInterpolatedValue_;
std::optional<unsigned int> lastInterpolatedKey_;
- unsigned int quantization_ = 0;
};
} /* namespace ipa */
@@ -40,13 +40,6 @@ protected:
ASSERT_EQ(interpolator.getInterpolated(30), 300);
ASSERT_EQ(interpolator.getInterpolated(40), 300);
- interpolator.setQuantization(10);
- unsigned int q = 0;
- ASSERT_EQ(interpolator.getInterpolated(25, &q), 300);
- ASSERT_EQ(q, 30);
- ASSERT_EQ(interpolator.getInterpolated(24, &q), 200);
- ASSERT_EQ(q, 20);
-
return TestPass;
}
};