History log of /external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
6955870806624479723addfae6dcf5d13968796c 13-Jan-2016 Peter Kasting <pkasting@google.com> Convert channel counts to size_t.

IIRC, this was originally requested by ajm during review of the other size_t conversions I did over the past year, and I agreed it made sense, but wanted to do it separately since those changes were already gargantuan.

BUG=chromium:81439
TEST=none
R=henrik.lundin@webrtc.org, henrika@webrtc.org, kjellander@webrtc.org, minyue@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org

Review URL: https://codereview.webrtc.org/1316523002 .

Cr-Commit-Position: refs/heads/master@{#11229}
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
b2328d11dcc86fba1661ee3fa0d51fc126939764 12-Jan-2016 aluebs <aluebs@webrtc.org> Remove additional channel constraints when Beamforming is enabled in AudioProcessing

The general constraints on number of channels for AudioProcessing is:
num_in_channels == num_out_channels || num_out_channels == 1

When Beamforming is enabled and additional constraint was added forcing:
num_out_channels == 1

This artificial constraint was removed by adding upmixing support in CopyTo, since it was already supported for the AudioFrame interface using InterleaveTo.

Review URL: https://codereview.webrtc.org/1571013002

Cr-Commit-Position: refs/heads/master@{#11215}
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
25702cb1628941427fa55e528f53483f239ae011 08-Jan-2016 pkasting <pkasting@chromium.org> Misc. small cleanups.

* Better param names
* Avoid using negative values for (bogus) placeholder channel counts (mostly in tests). Since channels will be changing to size_t, negative values will be illegal; it's sufficient to use 0 in these cases.
* Use arraysize()
* Use size_t for counting frames, samples, blocks, buffers, and bytes -- most of these are already size_t in most places, this just fixes some stragglers
* reinterpret_cast<int64_t>(void*) is not necessarily safe; use uintptr_t instead
* Remove unnecessary code, e.g. dead code, needlessly long/repetitive code, or function overrides that exactly match the base definition
* Fix indenting
* Use uint32_t for timestamps (matching how it's already a uint32_t in most places)
* Spelling
* RTC_CHECK_EQ(expected, actual)
* Rewrap
* Use .empty()
* Be more pedantic about matching int/int32_t/
* Remove pointless consts on input parameters to functions
* Add missing sanity checks

All this was found in the course of constructing https://codereview.webrtc.org/1316523002/ , and is being landed separately first.

BUG=none
TEST=none

Review URL: https://codereview.webrtc.org/1534193008

Cr-Commit-Position: refs/heads/master@{#11191}
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
dce40cf804019a9898b6ab8d8262466b697c56e0 24-Aug-2015 Peter Kasting <pkasting@google.com> Update a ton of audio code to use size_t more correctly and in general reduce
use of int16_t/uint16_t.

This is the upshot of a recommendation by henrik.lundin and kwiberg on an original small change ( https://webrtc-codereview.appspot.com/42569004/#ps1 ) to stop using int16_t just because values could fit in it, and is similar in nature to a previous "mass change to use size_t more" ( https://webrtc-codereview.appspot.com/23129004/ ) which also needed to be split up for review but to land all at once, since, like adding "const", such changes tend to cause a lot of transitive effects.

This was be reviewed and approved in pieces:
https://codereview.webrtc.org/1224093003
https://codereview.webrtc.org/1224123002
https://codereview.webrtc.org/1224163002
https://codereview.webrtc.org/1225133003
https://codereview.webrtc.org/1225173002
https://codereview.webrtc.org/1227163003
https://codereview.webrtc.org/1227203003
https://codereview.webrtc.org/1227213002
https://codereview.webrtc.org/1227893002
https://codereview.webrtc.org/1228793004
https://codereview.webrtc.org/1228803003
https://codereview.webrtc.org/1228823002
https://codereview.webrtc.org/1228823003
https://codereview.webrtc.org/1228843002
https://codereview.webrtc.org/1230693002
https://codereview.webrtc.org/1231713002

The change is being landed as TBR to all the folks who reviewed the above.

BUG=chromium:81439
TEST=none
R=andrew@webrtc.org, pbos@webrtc.org
TBR=aluebs, andrew, asapersson, henrika, hlundin, jan.skoglund, kwiberg, minyue, pbos, pthatcher

Review URL: https://codereview.webrtc.org/1230503003 .

Cr-Commit-Position: refs/heads/master@{#9768}
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
60d9b332a5391045439bfb6a3a5447973e3d5603 14-Aug-2015 ekmeyerson <ekmeyerson@webrtc.org> Integrate Intelligibility with APM

- Integrates intelligibility into audio_processing.
- Allows modification of reverse stream if intelligibility enabled.
- Makes intelligibility available in audioproc_float test.
- Adds reverse stream processing to audioproc_float.
- (removed) Makes intelligibility toggleable in real time in voe_cmd_test.
- Cleans up intelligibility construction, parameters, constants and dead code.

TBR=pbos@webrtc.org

Review URL: https://codereview.webrtc.org/1234463003

Cr-Commit-Position: refs/heads/master@{#9713}
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
86c6d33aec684d08189d498912e47cbc17c4d2db 23-Jul-2015 Michael Graczyk <mgraczyk@chromium.org> Allow more than 2 input channels in AudioProcessing.

The number of output channels is constrained to be equal to either 1 or the
number of input channels.

An earlier version of this commit caused a crash on AEC dump.

TBR=aluebs@webrtc.org,pbos@webrtc.org

Review URL: https://codereview.webrtc.org/1248393003 .

Cr-Commit-Position: refs/heads/master@{#9626}
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
64e753c3998a17429418180b3a947231a9fd98cd 23-Jul-2015 magjed <magjed@webrtc.org> Revert of Allow more than 2 input channels in AudioProcessing. (patchset #13 id:240001 of https://codereview.webrtc.org/1226093007/)

Reason for revert:
Breaks Chromium FYI content_browsertest on all platforms. The testcase that fails is WebRtcAecDumpBrowserTest.CallWithAecDump.

https://build.chromium.org/p/chromium.webrtc.fyi/builders/Linux/builds/19388

Sample output:
[ RUN ] WebRtcAecDumpBrowserTest.CallWithAecDump
Xlib: extension "RANDR" missing on display ":9".
[4:14:0722/211548:1282124453:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: ISAC/48000/1 (105)
[4:14:0722/211548:1282124593:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMU/8000/2 (110)
[4:14:0722/211548:1282124700:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMA/8000/2 (118)
[4:14:0722/211548:1282124815:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: G722/8000/2 (119)
[19745:19745:0722/211548:1282133667:INFO:CONSOLE(64)] "Looking at video in element remote-view-1", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
[19745:19745:0722/211548:1282136892:INFO:CONSOLE(64)] "Looking at video in element remote-view-2", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
../../content/test/webrtc_content_browsertest_base.cc:62: Failure
Value of: ExecuteScriptAndExtractString( shell()->web_contents(), javascript, &result)
Actual: false
Expected: true
Failed to execute javascript call({video: true, audio: true});.
From javascript: (nothing)
When executing 'call({video: true, audio: true});'
../../content/test/webrtc_content_browsertest_base.cc:75: Failure
Failed
../../content/browser/media/webrtc_aecdump_browsertest.cc:26: Failure
Expected: (base::kNullProcessId) != (*id), actual: 0 vs 0
../../content/browser/media/webrtc_aecdump_browsertest.cc:95: Failure
Value of: GetRenderProcessHostId(&render_process_id)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:99: Failure
Value of: base::PathExists(dump_file)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:101: Failure
Value of: base::GetFileSize(dump_file, &file_size)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:102: Failure
Expected: (file_size) > (0), actual: 0 vs 0
[ FAILED ] WebRtcAecDumpBrowserTest.CallWithAecDump, where TypeParam = and GetParam() = (361 ms)

Original issue's description:
> Allow more than 2 input channels in AudioProcessing.
>
> The number of output channels is constrained to be equal to either 1 or the
> number of input channels.
>
> R=aluebs@webrtc.org, andrew@webrtc.org, pbos@webrtc.org
>
> Committed: https://chromium.googlesource.com/external/webrtc/+/c204754b7a0cc801c70e8ce6c689f57f6ce00b3b

TBR=andrew@webrtc.org,aluebs@webrtc.org,ajm@chromium.org,pbos@chromium.org,pbos@webrtc.org,mgraczyk@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.webrtc.org/1253573005

Cr-Commit-Position: refs/heads/master@{#9621}
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
c204754b7a0cc801c70e8ce6c689f57f6ce00b3b 23-Jul-2015 Michael Graczyk <mgraczyk@chromium.org> Allow more than 2 input channels in AudioProcessing.

The number of output channels is constrained to be equal to either 1 or the
number of input channels.

R=aluebs@webrtc.org, andrew@webrtc.org, pbos@webrtc.org

Review URL: https://codereview.webrtc.org/1226093007 .

Cr-Commit-Position: refs/heads/master@{#9619}
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
728d9037c016c01295177fa700fc7927f0bb80bb 11-Jun-2015 Peter Kasting <pkasting@google.com> Reformat existing code. There should be no functional effects.

This includes changes like:
* Attempt to break lines at better positions
* Use "override" in more places, don't use "virtual" with it
* Use {} where the body is more than one line
* Make declaration and definition arg names match
* Eliminate unused code
* EXPECT_EQ(expected, actual) (but use (actual, expected) for e.g. _GT)
* Correct #include order
* Use anonymous namespaces in preference to "static" for file-scoping
* Eliminate unnecessary casts
* Update reference code in comments of ARM assembly sources to match actual current C code
* Fix indenting to be more style-guide compliant
* Use arraysize() in more places
* Use bool instead of int for "boolean" values (0/1)
* Shorten and simplify code
* Spaces around operators
* 80 column limit
* Use const more consistently
* Space goes after '*' in type name, not before
* Remove unnecessary return values
* Use "(var == const)", not "(const == var)"
* Spelling
* Prefer true, typed constants to "enum hack" constants
* Avoid "virtual" on non-overridden functions
* ASSERT(x == y) -> ASSERT_EQ(y, x)

BUG=none
R=andrew@webrtc.org, asapersson@webrtc.org, henrika@webrtc.org, juberti@webrtc.org, kjellander@webrtc.org, kwiberg@webrtc.org

Review URL: https://codereview.webrtc.org/1172163004

Cr-Commit-Position: refs/heads/master@{#9420}
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
05c760533f33cdd4f57fc1c1f15030708f6c185b 20-May-2015 Alejandro Luebs <aluebs@webrtc.org> Add resampling support in AudioBuffer::DeinterleaveFrom

It is necessary for adding 48kHz support to the AudioProcessing::AnalyzeReverseStream int interface (It was not necessary for 32kHz since in that case the splitting filter is more efficient).

BUG=webrtc:3146
R=andrew@webrtc.org, bjornv@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/56389004

Cr-Commit-Position: refs/heads/master@{#9241}
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
5a92aa844096b056e8c46f28fc7c074b3c3c136d 27-Apr-2015 Alejandro Luebs <aluebs@webrtc.org> Add 3-band filter-bank implementation

The implementation is a FIR filter bank with DCT modulation, similar to the proposed in "Multirate Signal Processing for Communication Systems" by Fredric J Harris.
The lowpass filter prototype has these characteristics:
* Passband ripple = 0.3dB
* Passband frequency = 0.147 (7kHz at 48kHz)
* Stopband attenuation = 40dB
* Stopband frequency = 0.192 (9.2kHz at 48kHz)
* Delay = 24 samples (500us at 48kHz)
* Linear phase

This filter bank does not satisfy perfect reconstruction. The SNR after analysis and synthesis (with no processing in between) is approximately 9.5dB depending on the input signal after compensating for the delay.

The performance on my workstation of AudioProcessing (with AGC and NS enabled) on a 413s recording compared to previous versions is as follows:
* Input signal has 32kHz sample rate: 3.01s
* Resampling 48kHz to 32kHz: 3.56s
* Today's temporary filter bank: 5.67s
* This filter-bank: 4.62s

BUG=webrtc:3146
R=andrew@webrtc.org, bjornv@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/48999005

Cr-Commit-Position: refs/heads/master@{#9090}
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
3aca0b0b312a77e9399502a64c27bc3fcb981927 26-Feb-2015 aluebs@webrtc.org <aluebs@webrtc.org> Add 48kHz support to Beamformer

Doing something similar for the band 16-24kHz to what is done for the band 8-16kHz
Tested for 32kHz sample rate and the output is bitexact with how it was before this CL.

BUG=webrtc:3146
R=andrew@webrtc.org, kwiberg@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/35159004

Cr-Commit-Position: refs/heads/master@{#8522}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8522 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
d35a5c350617cc9d60ce45201764a99229b7299a 10-Feb-2015 aluebs@webrtc.org <aluebs@webrtc.org> Make ChannelBuffer aware of frequency bands

Now the ChannelBuffer has 2 separate arrays, one for the full-band data and one for the splitted one. The corresponding accessors are added to the ChannelBuffer.
This is done to avoid having to refresh the bands pointers in AudioBuffer. It will also allow us to have a general accessor like data()[band][channel][sample].
All the files using the ChannelBuffer needed to be re-factored.
Tested with modules_unittests, common_audio_unittests, audioproc, audioproc_f, voe_cmd_test.

R=andrew@webrtc.org, kwiberg@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/36999004

Cr-Commit-Position: refs/heads/master@{#8318}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8318 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
035e9123e9c7de3b09b37bc8e57907e4af7ce219 28-Jan-2015 kjellander@webrtc.org <kjellander@webrtc.org> Move channel_buffer.{h,cc} to common_audio.

In https://code.google.com/p/webrtc/source/detail?r=8166
I added a check preventing GYP files from referencing
sources above their directory level.
This CL fixes the disallowed reference added in
https://code.google.com/p/webrtc/source/detail?r=8157
by moving channel_buffer.{h,cc} to common_audio for real.

BUG=4185
R=andrew@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/35939004

Cr-Commit-Position: refs/heads/master@{#8190}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8190 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
27d106bcf7eaf864e8433f1fc303475b953498b3 11-Dec-2014 aluebs@webrtc.org <aluebs@webrtc.org> Move the downmixing out of AudioBuffer

This provides more flexibility if some component in AudioProcessing wants to operate before downmixing.
Now the AudioProcessing does only track the processing rate, but not the processing number of channels. This is tracked by the AudioBuffer itself and can be changed at any time to one smaller or equal the input number of channels. For each chunk it is reset to input number of channels and the end it should be equal to the output number of channels.

R=andrew@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/28169004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7879 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
c5ebbd98f5996db0defbbfc14f5ca41e620bd7e4 10-Dec-2014 aluebs@webrtc.org <aluebs@webrtc.org> Support 48kHz in Noise Suppression

Doing the same for the 16-24kHz band than was done in the 8-16kHz.
Results look and sound as nice.

BUG=webrtc:3146
R=andrew@webrtc.org, bjornv@webrtc.org, kwiberg@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/29139004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7865 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
a7384a1126cda7ce726f73b023bad997627fc138 03-Dec-2014 aluebs@webrtc.org <aluebs@webrtc.org> Simplify audio_buffer APIs

Now there is only one API to get the data or the channels (one const and one no const) merged or by band.
The band is passed in as a parameter, instead of calling different methods.

BUG=webrtc:3146
R=andrew@webrtc.org, bjornv@webrtc.org, kwiberg@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/27249004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7790 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
8789376cd35e055765a72248a8ad444ea2e9438c 28-Nov-2014 aluebs@webrtc.org <aluebs@webrtc.org> Move ChannelBuffer class to channel_buffer file

No change in functionallity.

BUG=webrtc:3146
R=andrew@webrtc.org, bjornv@webrtc.org, kwiberg@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/28109004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7760 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
79b9eba3abbf02f7a569280d8a735847ce09ec25 26-Nov-2014 aluebs@webrtc.org <aluebs@webrtc.org> Implement 3 band splitting filter bank by upsampling and splitting twice into 2 bands

Implemented the 3 bands splitting filter bank by:
1. Upsample by 4/3.
2. Split twice into 2 bands.
3. Discard upper most band, because it is empty anyway.

A unittest was also implemented:
1. Generate a signal from presence or absence of sine waves of different frequencies.
2. Split into 3 bands and check their presence or absence.
3. Recombine the bands.
4. Calculate delay (as it is an IIR it depends on frequency).
5. Check that the cross correlation of input and output is high enough at that delay.

BUG=webrtc:3146
R=andrew@webrtc.org, bjornv@webrtc.org, kwiberg@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/31029004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7754 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
087da13fe8be20b61b556f60eac937c9d0b19fb8 18-Nov-2014 aluebs@webrtc.org <aluebs@webrtc.org> Add empty 3 band splitting filter API

This is only an empty API that will never be used. For now is 48kHz not supported in AudioProcessing. For that it needs to be added in InitializeLocked. But before the 3 band filter bank needs to be populated.

BUG=webrtc:3146
R=bjornv@webrtc.org, kwiberg@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/30139004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7715 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
be05c74ec8ee975f3451809425756d0f6a51ff2e 14-Nov-2014 aluebs@webrtc.org <aluebs@webrtc.org> Wrap the splitting filter in its own class

This doesn't change the behavior at all.
The logic behind this is having one class which manages all the splitting filters, because in the future we plan to add a 3 band one for 48kHz support.
It also breaks the dependency of the AudioBuffer with the filter states of these filters (which are going to be different for the 3 band one). The AudioBuffer is complicated enough and is going to need changes to support 3 bands in the future, so any simplification is a good idea.
On top of that it eliminates repeated code in the APM (now only iterating over channels, but then also deciding in how many bands to split). This should be managed by the AudioBuffer directly.

BUG=webrtc:3146
R=bjornv@webrtc.org, kwiberg@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/32469004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7705 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
8328e7c44d59bb9fcbc7f8a033beb3d073929518 31-Oct-2014 andrew@webrtc.org <andrew@webrtc.org> Revert "Revert part of r7561, "Refactor audio conversion functions.""

This restores the conversion changes to AudioProcessing originally
added in r7561, with minor alterations to ensure it passes all tests.

TBR=kwiberg

Review URL: https://webrtc-codereview.appspot.com/28899004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7574 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
bcfb4d0403d9e45e37a4d93de919c2a3df57ce50 30-Oct-2014 kwiberg@webrtc.org <kwiberg@webrtc.org> Revert part of r7561, "Refactor audio conversion functions."

Specifically, revert this part:

"Remove hacks in AudioBuffer intended to maintain bit-exactness with
the float path. The conversions etc. are now all natural, and
instead we enforce close but not bit-exact output between the two
paths."

But keep the conversion function rename, since that doesn't seem to be
causing problems.

R=tina.legrand@webrtc.org, bjornv@webrtc.org
TBR=andrew@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/24999004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7569 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
4fc4addc815379c6cc1d04f4853a528390fe09ba 30-Oct-2014 andrew@webrtc.org <andrew@webrtc.org> Refactor audio conversion functions.

Use a consistent naming scheme that can be understood at the callsite
without having to refer to documentation.

Remove hacks in AudioBuffer intended to maintain bit-exactness with the
float path. The conversions etc. are now all natural, and instead we
enforce close but not bit-exact output between the two paths.

Output of ApmTest.Process:
https://paste.googleplex.com/5931055831842816

R=aluebs@webrtc.org, bjornv@webrtc.org, kwiberg@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/13049004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7561 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
bfacaabfce3cee012672d8fcf15326e248261996 25-Sep-2014 claguna@google.com <claguna@google.com> Add accessors for array of channel pointers in AudioBuffer. They are
needed as arguments to any multichannel audio processing unit.

R=andrew@webrtc.org, kwiberg@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/30499004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7303 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
30be827e6a2bfae76c445e62d0853f83d238814a 24-Sep-2014 andrew@webrtc.org <andrew@webrtc.org> Enable render downmixing to mono in AudioProcessing.

In practice, we have been doing this since time immemorial, but have
relied on the user to do the downmixing (first voice engine then
Chromium). It's more logical for this burden to fall on AudioProcessing,
however, who can be expected to know that this is a reasonable approach
for AEC. Permitting two render channels results in running two AECs
serially.

Critically, in my recent change to have Chromium adopt the float
interface:
https://codereview.chromium.org/420603004
I removed the downmixing by Chromium, forgetting that we hadn't yet
enabled this feature in AudioProcessing. This corrects that oversight.

The change in paths hit by production users is very minor. As commented
it required adding downmixing to the int16_t path to satisfy
bit-exactness tests.

For reference, find the ApmTest.Process errors here:
https://paste.googleplex.com/6372007910309888

BUG=webrtc:3853
TESTED=listened to the files output from the Process test, and verified
that they sound as expected: higher echo while the AEC is adapting, but
afterwards very close.

R=aluebs@webrtc.org, bjornv@webrtc.org, kwiberg@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/31459004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7292 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
e364ac902fe7e711de73e2fde22dff3cbe1e3a6f 18-Jul-2014 kwiberg@webrtc.org <kwiberg@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> AudioBuffer: Optimize const accesses to arrays that autoconvert int16<->float

Specifically, when someone asks for a const pointer to the int16
version of the array, there's no need to invalidate the float version
of that array, and vice versa. (But obviously, invalidation still has
to happen when someone asks for a non-const pointer.)

R=aluebs@webrtc.org, andrew@webrtc.org, minyue@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/18809004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6725 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
2b6bc8d84f309c27fb5264145fb2a5c87cb2267a 17-Jul-2014 kwiberg@webrtc.org <kwiberg@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> AudioBuffer: Eliminate the SplitChannelBuffer class

It's just a container for two IFChannelBuffers, and doesn't earn its
keep. The main problem is that the number of methods it needs that
just forward calls to either of its two IFChannelBuffers was already
large, and was about to grow.

R=aluebs@webrtc.org, minyue@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/16919004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6717 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
2561d524600b6bcfd0c4a24621cebdcdf6d027f8 17-Jul-2014 aluebs@webrtc.org <aluebs@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> Simplify AudioBuffer::mixed_low_pass_data API

R=andrew@webrtc.org, kwiberg@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/21869004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6715 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
af93fc08a19e75bc0b3fab393345c29b2094391d 17-Jul-2014 kwiberg@webrtc.org <kwiberg@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> AudioBuffer: Let ChannelBuffer handle bounds checking of channel parameter

R=aluebs@webrtc.org, minyue@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/13019004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6714 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
38214d53db5f19228b38424700db8b90cf8b0234 03-Jul-2014 kwiberg@webrtc.org <kwiberg@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> EchoCancellationImpl::ProcessRenderAudio: Use float samples directly

This patch lets EchoCancellationImpl::ProcessRenderAudio ask the given
AudioBuffer for float sample data directly, instead of asking for
int16 samples and then converting manually.

Since EchoCancellationImpl::ProcessRenderAudio takes a const
AudioBuffer*, it was necessary to add some const accessors for float
data to AudioBuffer.

R=aluebs@webrtc.org, andrew@webrtc.org, bjornv@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/14749004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6590 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
8e4401b5a0cdbb33d7d7fb2547464724411c3ee2 03-Jun-2014 kwiberg@webrtc.org <kwiberg@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> Reformat integer accessors to look like their float counterparts

The new format is at least as easy to read, and takes less space.

BUG=
R=aluebs@webrtc.org, bjornv@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/16539004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6311 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
c0035a67a15943219f9899b703332feb9ffdba90 03-Jun-2014 kwiberg@webrtc.org <kwiberg@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> Remove an optimization that's no longer worth the extra complexity it causes

The data_ optimization was a way to operate on the data directly
instead of copying it, applicable in the mono, non-float case. Since a
few audio_processing steps are already using floats (with more
hopefully to come), we don't end up benefiting from the optimization
anyway, so we might as well remove it.

BUG=
R=aluebs@webrtc.org, bjornv@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/15539004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6307 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
d5da25063c46678f50882da5c1bad21ca3cfe271 15-May-2014 mflodman@webrtc.org <mflodman@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> Revert "Revert "Audio processing: Feed each processing step its choice
of int or float data"

This reverts commit 6142.

R=kwiberg@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/17519004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6172 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
21299d4e00781e199a53ba33ec192cdce920acec 14-May-2014 andrew@webrtc.org <andrew@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> Remove the use of AudioFrame::energy_ from AudioProcessing and VoE.

We want to remove energy_ entirely as we've seen that carrying around
this potentially invalid value is dangerous.

Results in the removal of AudioBuffer::is_muted(). This wasn't used in
practice any longer, after the level calculation moved directly to
channel.cc

Instead, now use ProcessMuted() in channel.cc, to shortcut the level
computation when the signal is muted.

BUG=3315
TESTED=Muting the channel in voe_cmd_test results in rms=127.
R=bjornv@webrtc.org, kwiberg@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/12529004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6159 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
b1a66d166c137aef483b1a24540b00b0d45bdf27 14-May-2014 mflodman@webrtc.org <mflodman@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> Revert "Audio processing: Feed each processing step its choice of int or float data"

This reverts r6138.

tbr=kwiberg@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/13509004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6142 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
934a265a47f71f06fea5878bd50ddcc629ca455a 14-May-2014 kwiberg@webrtc.org <kwiberg@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> Audio processing: Feed each processing step its choice of int or float data

Each audio processing step is given a pointer to an AudioBuffer, where
it can read and write int data. This patch adds corresponding
AudioBuffer methods to read and write float data; the buffer will
automatically convert the stored data between int and float as
necessary.

This patch also modifies the echo cancellation step to make use of the
new methods (it was already using floats internally; now it doesn't
have to convert from and to ints anymore).

(The reference data to the ApmTest.Process test had to be modified
slightly; this is because the echo canceller no longer unnecessarily
converts float data to int and then immediately back to float for each
iteration in the loop in EchoCancellationImpl::ProcessCaptureAudio.)

BUG=
R=aluebs@webrtc.org, andrew@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/18399005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6138 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
4cc763621eeeb29d0bf1d16d69b2f96d711ead2b 08-May-2014 kwiberg@webrtc.org <kwiberg@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> AudioBuffer: Eliminate data_was_mixed_, and document what's left of data_

data_was_mixed_ was always false, so it can be removed. That makes the
role of data_ simpler, but not so simple that it doesn't merit an
explanation.

BUG=
R=aluebs@webrtc.org, andrew@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/17409004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6076 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
65f933899b815b6c09f8ca7beefeace09ee3ae70 30-Apr-2014 andrew@webrtc.org <andrew@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> Fix constness of AudioBuffer accessors.

Don't return non-const pointers from const accessors and deal with the
spillover. Provide overloaded versions as needed.

Inspired by kwiberg:
https://webrtc-codereview.appspot.com/12379005/

R=bjornv@webrtc.org, kwiberg@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/15379004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6030 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
103657b48442dedd1742fca4a73d5131bf4ae624 24-Apr-2014 andrew@webrtc.org <andrew@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> Add keyboard channel support to AudioBuffer.

Also use local aliases for AudioBuffers for brevity.

BUG=2894
R=aluebs@webrtc.org, bjornv@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/13369005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5973 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
ddbb8a2c243f9d54cb0ce0092e341dfc6e126bb3 22-Apr-2014 andrew@webrtc.org <andrew@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> Support arbitrary input/output rates and downmixing in AudioProcessing.

Select "processing" rates based on the input and output sampling rates.
Resample the input streams to those rates, and if necessary to the
output rate.

- Remove deprecated stream format APIs.
- Remove deprecated device sample rate APIs.
- Add a ChannelBuffer class to help manage deinterleaved channels.
- Clean up the splitting filter state.
- Add a unit test which verifies the output against known-working
native format output.

BUG=2894
R=aluebs@webrtc.org, bjornv@webrtc.org, xians@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/9919004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5959 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
d2f366f28ceb738a9f193a5ce1868b50b3697197 17-Apr-2014 kwiberg@webrtc.org <kwiberg@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> StereoToMono: Remove useless call to WebRtcSpl_SatW32ToW16

The max value is ((2**15 - 1) + (2**15 - 1)) >> 1
== (2**16 - 2) >> 1
== 2**15 - 1
which doesn't overflow.

The min value is (-2**15 + -2**15) >> 1
== -2**16 >> 1
== -2**15
which doesn't overflow.

Since those two bracket all possible results, the call to
WebRtcSpl_SatW32ToW16 is redundant.

BUG=
R=andrew@webrtc.org, bjornv@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/12019004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5929 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
17e40641b30559602e26382e500bd9708bad37e3 04-Mar-2014 andrew@webrtc.org <andrew@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> Add a deinterleaved float interface to AudioProcessing.

This is mainly to support the native audio format in Chrome. Although
this implementation just moves the float->int conversion under the hood,
we will transition AudioProcessing towards supporting this format
throughout.

- Add a test which verifies we get identical output with the float and
int interfaces.
- The float and int wrappers are tasked with conversion to the
AudioBuffer format. A new shared Process/Analyze method does most of
the work.
- Add a new field to the debug.proto to hold deinterleaved data.
- Add helpers to audio_utils.cc, and start using numeric_limits.
- Note that there was no performance difference between numeric_limits
and a literal value when measured on Linux using gcc or clang.

BUG=2894
R=aluebs@webrtc.org, bjornv@webrtc.org, henrikg@webrtc.org, tommi@webrtc.org, turaj@webrtc.org, xians@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/9179004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5641 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
7fad4b8c9f1e9a6e3de9962fb74d4953b4f1bb03 28-May-2013 pbos@webrtc.org <pbos@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> Include files from webrtc/.. paths in audio_processing/

BUG=1662
R=andrew@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/1559004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4116 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
b7192b82476d00384fdc153e6a09a6ac53cef67b 10-Apr-2013 pbos@webrtc.org <pbos@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> WebRtc_Word32 -> int32_t in audio_processing/

BUG=314

Review URL: https://webrtc-codereview.appspot.com/1307004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3809 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc
14b43beb7ce4440b30dcea31196de5b4a529cb6b 22-Oct-2012 andrew@webrtc.org <andrew@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> Move src/ -> webrtc/

TBR=niklas.enbom@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/915006

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2963 4adac7df-926f-26a2-2b94-8c16560cd09d
/external/webrtc/webrtc/modules/audio_processing/audio_buffer.cc