- Add benchmarks for median computation.
- Improve median computation algorithm 2.1. Write unit tests to ensure new median computation has the same behavior as the previous implementation 2.2. Ensure benchmarks are improved
The new median algorithm takes its |max_size| as a template parameter and relies on a ring buffer to keep track of the current values the median needs to be computed on. Instead of sorting the values from scratch on every new insertion, the new algorithm finds where the new value needs to be inserted and where the now outdated value needs to be removed. It then rotates the elements of the vector to perform the sorted insertion.
The test |util_MedianFilter_rand| proves that the new behavior is the same as doing the sorting on every iteration.