AGC2 RNN VAD size_t -> int

Motivation: read "On Unsigned Integers" section in
https://google.github.io/styleguide/cppguide.html#Integer_Types

Plus, improved readability by getting rid of a bunch of
`static_cast<int>`s.

Bug: webrtc:10480
Change-Id: I911aa8cd08f5ccde4ee6f23534240d1faa84cdea
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/190880
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32524}
This commit is contained in:
Alessio Bazzica
2020-10-29 20:50:13 +01:00
committed by Commit Bot
parent bee5983b8f
commit f622ba725e
30 changed files with 292 additions and 276 deletions

View File

@ -29,7 +29,7 @@ namespace rnn_vad {
// values are written at the end of the buffer.
// The class also provides a view on the most recent M values, where 0 < M <= S
// and by default M = N.
template <typename T, size_t S, size_t N, size_t M = N>
template <typename T, int S, int N, int M = N>
class SequenceBuffer {
static_assert(N <= S,
"The new chunk size cannot be larger than the sequence buffer "
@ -45,8 +45,8 @@ class SequenceBuffer {
SequenceBuffer(const SequenceBuffer&) = delete;
SequenceBuffer& operator=(const SequenceBuffer&) = delete;
~SequenceBuffer() = default;
size_t size() const { return S; }
size_t chunks_size() const { return N; }
int size() const { return S; }
int chunks_size() const { return N; }
// Sets the sequence buffer values to zero.
void Reset() { std::fill(buffer_.begin(), buffer_.end(), 0); }
// Returns a view on the whole buffer.