Removing all external access to the integer sample data in AudioBuffer
This CL removes all external access to the integer sample data in the
AudioBuffer class. It also removes the API in AudioBuffer that provides this.
The purpose of this is to pave the way for removing the sample
duplicating and implicit conversions between integer and floating point
sample formats which is done inside the AudioBuffer.
Bug: webrtc:10882
Change-Id: I1438b691bcef98278aef8e3c63624c367c2d12e9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/149162
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28912}
diff --git a/modules/audio_processing/audio_buffer.h b/modules/audio_processing/audio_buffer.h
index c1bfb63..16d5616 100644
--- a/modules/audio_processing/audio_buffer.h
+++ b/modules/audio_processing/audio_buffer.h
@@ -52,8 +52,6 @@
// Where:
// 0 <= channel < |num_proc_channels_|
// 0 <= sample < |proc_num_frames_|
- int16_t* const* channels();
- const int16_t* const* channels_const() const;
float* const* channels_f();
const float* const* channels_const_f() const;
@@ -64,8 +62,6 @@
// 0 <= channel < |num_proc_channels_|
// 0 <= band < |num_bands_|
// 0 <= sample < |num_split_frames_|
- int16_t* const* split_bands(size_t channel);
- const int16_t* const* split_bands_const(size_t channel) const;
float* const* split_bands_f(size_t channel);
const float* const* split_bands_const_f(size_t channel) const;
@@ -76,7 +72,7 @@
// 0 <= band < |num_bands_|
// 0 <= channel < |num_proc_channels_|
// 0 <= sample < |num_split_frames_|
- const int16_t* const* split_channels_const(Band band) const;
+ const float* const* split_channels_const_f(Band band) const;
// Use for int16 interleaved data.
void DeinterleaveFrom(const AudioFrame* audioFrame);
@@ -93,6 +89,17 @@
// Recombine the different bands into one signal.
void MergeFrequencyBands();
+ // Copies the split bands data into the integer two-dimensional array.
+ void CopySplitChannelDataTo(size_t channel, int16_t* const* split_band_data);
+
+ // Copies the data in the integer two-dimensional array into the split_bands
+ // data.
+ void CopySplitChannelDataFrom(size_t channel,
+ const int16_t* const* split_band_data);
+
+ static const size_t kMaxSplitFrameLength = 160;
+ static const size_t kMaxNumBands = 3;
+
private:
FRIEND_TEST_ALL_PREFIXES(AudioBufferTest,
SetNumChannelsSetsChannelBuffersNumChannels);