summaryrefslogtreecommitdiff
path: root/source/application/main/include
diff options
context:
space:
mode:
authorIsabella Gottardi <isabella.gottardi@arm.com>2021-05-12 08:27:15 +0100
committerIsabella Gottardi <isabella.gottardi@arm.com>2021-05-18 09:48:12 +0100
commit56ee6207c1524ddc4c444c6e48e05eb34105985a (patch)
treed4fc7823961034e95364f44b34fb098b34b99d0d /source/application/main/include
parentf4e2c4736f19d2e06fede715bb49c475f93d79a9 (diff)
downloadml-embedded-evaluation-kit-56ee6207c1524ddc4c444c6e48e05eb34105985a.tar.gz
MLECO-1858: Documentation update
* Removing `_` in front of private functions and member Signed-off-by: Isabella Gottardi <isabella.gottardi@arm.com> Change-Id: I5a5d652f9647ebb16d2d2bd16ab980e73f7be3cf
Diffstat (limited to 'source/application/main/include')
-rw-r--r--source/application/main/include/AppContext.hpp18
-rw-r--r--source/application/main/include/DataStructures.hpp36
-rw-r--r--source/application/main/include/Mfcc.hpp34
-rw-r--r--source/application/main/include/Profiler.hpp12
-rw-r--r--source/application/main/include/UseCaseCommonUtils.hpp3
5 files changed, 51 insertions, 52 deletions
diff --git a/source/application/main/include/AppContext.hpp b/source/application/main/include/AppContext.hpp
index 588dfaa..10de126 100644
--- a/source/application/main/include/AppContext.hpp
+++ b/source/application/main/include/AppContext.hpp
@@ -35,14 +35,14 @@ namespace app {
public:
~Attribute() override = default;
- explicit Attribute(const T value): _m_value(value){}
+ explicit Attribute(const T value): m_value(value){}
T Get()
{
- return _m_value;
+ return m_value;
}
private:
- T _m_value;
+ T m_value;
};
/* Application context class */
@@ -58,7 +58,7 @@ namespace app {
template<typename T>
void Set(const std::string &name, T object)
{
- this->_m_attributes[name] = new Attribute<T>(object);
+ this->m_attributes[name] = new Attribute<T>(object);
}
/**
@@ -70,7 +70,7 @@ namespace app {
template<typename T>
T Get(const std::string &name)
{
- auto a = (Attribute<T>*)_m_attributes[name];
+ auto a = (Attribute<T>*)m_attributes[name];
return a->Get();
}
@@ -81,19 +81,19 @@ namespace app {
*/
bool Has(const std::string& name)
{
- return _m_attributes.find(name) != _m_attributes.end();
+ return m_attributes.find(name) != m_attributes.end();
}
ApplicationContext() = default;
~ApplicationContext() {
- for (auto& attribute : _m_attributes)
+ for (auto& attribute : m_attributes)
delete attribute.second;
- this->_m_attributes.clear();
+ this->m_attributes.clear();
}
private:
- std::map<std::string, IAttribute*> _m_attributes;
+ std::map<std::string, IAttribute*> m_attributes;
};
} /* namespace app */
diff --git a/source/application/main/include/DataStructures.hpp b/source/application/main/include/DataStructures.hpp
index 2f267c0..d369cb6 100644
--- a/source/application/main/include/DataStructures.hpp
+++ b/source/application/main/include/DataStructures.hpp
@@ -47,39 +47,39 @@ namespace app {
* @param[in] rows Number of rows.
* @param[in] cols Number of columns.
*/
- Array2d(unsigned rows, unsigned cols): _m_rows(rows), _m_cols(cols)
+ Array2d(unsigned rows, unsigned cols): m_rows(rows), m_cols(cols)
{
if (rows == 0 || cols == 0) {
printf_err("Array2d constructor has 0 size.\n");
- _m_data = nullptr;
+ m_data = nullptr;
return;
}
- _m_data = new T[rows * cols];
+ m_data = new T[rows * cols];
}
~Array2d()
{
- delete[] _m_data;
+ delete[] m_data;
}
T& operator() (unsigned int row, unsigned int col)
{
#if defined(DEBUG)
- if (row >= _m_rows || col >= _m_cols || _m_data == nullptr) {
+ if (row >= m_rows || col >= m_cols || m_data == nullptr) {
printf_err("Array2d subscript out of bounds.\n");
}
#endif /* defined(DEBUG) */
- return _m_data[_m_cols * row + col];
+ return m_data[m_cols * row + col];
}
T operator() (unsigned int row, unsigned int col) const
{
#if defined(DEBUG)
- if (row >= _m_rows || col >= _m_cols || _m_data == nullptr) {
+ if (row >= m_rows || col >= m_cols || m_data == nullptr) {
printf_err("const Array2d subscript out of bounds.\n");
}
#endif /* defined(DEBUG) */
- return _m_data[_m_cols * row + col];
+ return m_data[m_cols * row + col];
}
/**
@@ -91,9 +91,9 @@ namespace app {
switch (dim)
{
case 0:
- return _m_rows;
+ return m_rows;
case 1:
- return _m_cols;
+ return m_cols;
default:
return 0;
}
@@ -104,7 +104,7 @@ namespace app {
*/
size_t totalSize()
{
- return _m_rows * _m_cols;
+ return m_rows * m_cols;
}
/**
@@ -113,15 +113,15 @@ namespace app {
using iterator=T*;
using const_iterator=T const*;
- iterator begin() { return _m_data; }
- iterator end() { return _m_data + totalSize(); }
- const_iterator begin() const { return _m_data; }
- const_iterator end() const { return _m_data + totalSize(); };
+ iterator begin() { return m_data; }
+ iterator end() { return m_data + totalSize(); }
+ const_iterator begin() const { return m_data; }
+ const_iterator end() const { return m_data + totalSize(); };
private:
- size_t _m_rows;
- size_t _m_cols;
- T* _m_data;
+ size_t m_rows;
+ size_t m_cols;
+ T* m_data;
};
} /* namespace app */
diff --git a/source/application/main/include/Mfcc.hpp b/source/application/main/include/Mfcc.hpp
index dcafe62..6b11ebb 100644
--- a/source/application/main/include/Mfcc.hpp
+++ b/source/application/main/include/Mfcc.hpp
@@ -104,14 +104,14 @@ namespace audio {
float minVal = std::numeric_limits<T>::min();
float maxVal = std::numeric_limits<T>::max();
- std::vector<T> mfccOut(this->_m_params.m_numMfccFeatures);
- const size_t numFbankBins = this->_m_params.m_numFbankBins;
+ std::vector<T> mfccOut(this->m_params.m_numMfccFeatures);
+ const size_t numFbankBins = this->m_params.m_numFbankBins;
/* Take DCT. Uses matrix mul. */
for (size_t i = 0, j = 0; i < mfccOut.size(); ++i, j += numFbankBins) {
float sum = 0;
for (size_t k = 0; k < numFbankBins; ++k) {
- sum += this->_m_dctMatrix[j + k] * this->_m_melEnergies[k];
+ sum += this->m_dctMatrix[j + k] * this->m_melEnergies[k];
}
/* Quantize to T. */
sum = std::round((sum / quantScale) + quantOffset);
@@ -131,7 +131,7 @@ namespace audio {
/**
* @brief Project input frequency to Mel Scale.
* @param[in] freq Input frequency in floating point.
- * @param[in] useHTKmethod bool to signal if HTK method is to be
+ * @param[in] useHTKMethod bool to signal if HTK method is to be
* used for calculation.
* @return Mel transformed frequency in floating point.
**/
@@ -141,8 +141,8 @@ namespace audio {
/**
* @brief Inverse Mel transform - convert MEL warped frequency
* back to normal frequency.
- * @param[in] freq Mel frequency in floating point.
- * @param[in] useHTKmethod bool to signal if HTK method is to be
+ * @param[in] melFreq Mel frequency in floating point.
+ * @param[in] useHTKMethod bool to signal if HTK method is to be
* used for calculation.
* @return Real world frequency in floating point.
**/
@@ -207,17 +207,17 @@ namespace audio {
bool useHTKMethod);
private:
- MfccParams _m_params;
- std::vector<float> _m_frame;
- std::vector<float> _m_buffer;
- std::vector<float> _m_melEnergies;
- std::vector<float> _m_windowFunc;
- std::vector<std::vector<float>> _m_melFilterBank;
- std::vector<float> _m_dctMatrix;
- std::vector<uint32_t> _m_filterBankFilterFirst;
- std::vector<uint32_t> _m_filterBankFilterLast;
- bool _m_filterBankInitialised;
- arm::app::math::FftInstance _m_fftInstance;
+ MfccParams m_params;
+ std::vector<float> m_frame;
+ std::vector<float> m_buffer;
+ std::vector<float> m_melEnergies;
+ std::vector<float> m_windowFunc;
+ std::vector<std::vector<float>> m_melFilterBank;
+ std::vector<float> m_dctMatrix;
+ std::vector<uint32_t> m_filterBankFilterFirst;
+ std::vector<uint32_t> m_filterBankFilterLast;
+ bool m_filterBankInitialised;
+ arm::app::math::FftInstance m_fftInstance;
/**
* @brief Initialises the filter banks and the DCT matrix. **/
diff --git a/source/application/main/include/Profiler.hpp b/source/application/main/include/Profiler.hpp
index c5f77e7..d1b6d91 100644
--- a/source/application/main/include/Profiler.hpp
+++ b/source/application/main/include/Profiler.hpp
@@ -107,14 +107,14 @@ namespace app {
void SetName(const char* str);
private:
- ProfilingMap _m_series; /* Profiling series map. */
- time_counter _m_tstampSt{}; /* Container for a current starting timestamp. */
- time_counter _m_tstampEnd{}; /* Container for a current ending timestamp. */
- hal_platform * _m_pPlatform = nullptr; /* Platform pointer - to get the timer. */
+ ProfilingMap m_series; /* Profiling series map. */
+ time_counter m_tstampSt{}; /* Container for a current starting timestamp. */
+ time_counter m_tstampEnd{}; /* Container for a current ending timestamp. */
+ hal_platform * m_pPlatform = nullptr; /* Platform pointer - to get the timer. */
- bool _m_started = false; /* Indicates profiler has been started. */
+ bool m_started = false; /* Indicates profiler has been started. */
- std::string _m_name; /* Name given to this profiler. */
+ std::string m_name; /* Name given to this profiler. */
/**
* @brief Appends the profiling unit computed by the "start" and
diff --git a/source/application/main/include/UseCaseCommonUtils.hpp b/source/application/main/include/UseCaseCommonUtils.hpp
index 7887aea..d328392 100644
--- a/source/application/main/include/UseCaseCommonUtils.hpp
+++ b/source/application/main/include/UseCaseCommonUtils.hpp
@@ -42,12 +42,11 @@ namespace app {
* @param[in] profiler Reference to the initialised profiler.
* @return true if inference succeeds, false otherwise.
**/
- bool RunInference(arm::app::Model& mode, Profiler& profiler);
+ bool RunInference(arm::app::Model& model, Profiler& profiler);
/**
* @brief Read input and return as an integer.
* @param[in] platform Reference to the hal platform object.
- * @param[in] model Reference to the initialised model.
* @return Integer value corresponding to the user input.
**/
int ReadUserInputAsInt(hal_platform& platform);