Home | History | Annotate | Download | only in beamformer
      1 /*
      2  *  Copyright (c) 2014 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 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_BEAMFORMER_COVARIANCE_MATRIX_GENERATOR_H_
     12 #define WEBRTC_MODULES_AUDIO_PROCESSING_BEAMFORMER_COVARIANCE_MATRIX_GENERATOR_H_
     13 
     14 #include "webrtc/modules/audio_processing/beamformer/complex_matrix.h"
     15 #include "webrtc/modules/audio_processing/beamformer/array_util.h"
     16 
     17 namespace webrtc {
     18 
     19 // Helper class for Beamformer in charge of generating covariance matrices. For
     20 // each function, the passed-in ComplexMatrix is expected to be of size
     21 // |num_input_channels| x |num_input_channels|.
     22 class CovarianceMatrixGenerator {
     23  public:
     24   // A uniform covariance matrix with a gap at the target location. WARNING:
     25   // The target angle is assumed to be 0.
     26   static void UniformCovarianceMatrix(float wave_number,
     27                                       const std::vector<Point>& geometry,
     28                                       ComplexMatrix<float>* mat);
     29 
     30   // The covariance matrix of a source at the given angle.
     31   static void AngledCovarianceMatrix(float sound_speed,
     32                                      float angle,
     33                                      size_t frequency_bin,
     34                                      size_t fft_size,
     35                                      size_t num_freq_bins,
     36                                      int sample_rate,
     37                                      const std::vector<Point>& geometry,
     38                                      ComplexMatrix<float>* mat);
     39 
     40   // Calculates phase shifts that, when applied to a multichannel signal and
     41   // added together, cause constructive interferernce for sources located at
     42   // the given angle.
     43   static void PhaseAlignmentMasks(size_t frequency_bin,
     44                                   size_t fft_size,
     45                                   int sample_rate,
     46                                   float sound_speed,
     47                                   const std::vector<Point>& geometry,
     48                                   float angle,
     49                                   ComplexMatrix<float>* mat);
     50 };
     51 
     52 }  // namespace webrtc
     53 
     54 #endif  // WEBRTC_MODULES_AUDIO_PROCESSING_BEAMFORMER_BF_HELPERS_H_
     55