• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #include "modules/audio_processing/agc2/vector_float_frame.h"
12 
13 namespace webrtc {
14 
15 namespace {
16 
ConstructChannelPointers(std::vector<std::vector<float>> * x)17 std::vector<float*> ConstructChannelPointers(
18     std::vector<std::vector<float>>* x) {
19   std::vector<float*> channel_ptrs;
20   for (auto& v : *x) {
21     channel_ptrs.push_back(v.data());
22   }
23   return channel_ptrs;
24 }
25 }  // namespace
26 
VectorFloatFrame(int num_channels,int samples_per_channel,float start_value)27 VectorFloatFrame::VectorFloatFrame(int num_channels,
28                                    int samples_per_channel,
29                                    float start_value)
30     : channels_(num_channels,
31                 std::vector<float>(samples_per_channel, start_value)),
32       channel_ptrs_(ConstructChannelPointers(&channels_)),
33       float_frame_view_(channel_ptrs_.data(),
34                         channels_.size(),
35                         samples_per_channel) {}
36 
37 VectorFloatFrame::~VectorFloatFrame() = default;
38 
39 }  // namespace webrtc
40