History log of /external/adhd/cras/src/tests/fmt_conv_unittest.cc
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
82bbc68832fccb257d83a56e35a4d50b5f82a173 14-Mar-2016 Hsin-Yu Chao <hychao@chromium.org> CRAS: fmt_conv - Add channel remix support

For accessibility use we need to mix all channels of output
stream and then write to all output channels.
Reuse cras_fmt_conv to remix channels of PCM data according to
given conversion matrix. This new remix converter will be added
to the end of output format conversion chain.

fmt_conv1
stream1 ----------\
\ mix
O ----------> O --------> device
fmt_conv2 / channel remix
stream2 ----------/

...
fmt_convN
streamN ----------/

BUG=chromium:593218
TEST=unittest

Change-Id: I79e66fa890c1b9736ba8c1b16a6261b97e50adb6
Reviewed-on: https://chromium-review.googlesource.com/333250
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
/external/adhd/cras/src/tests/fmt_conv_unittest.cc
4a50229ba5bc929822bfa4ca1fef6057e336aeba 22-Nov-2014 Dylan Reid <dgreid@chromium.org> CRAS: fmt_conv - don't restrict in and out to s16le

Allow both the input and output to be non-s16le. This will be useful
when playing to hardware that only support 24 or 32 bit samples such
as many USB DACS.

BUG=none
TEST=added unit test

Change-Id: Ia6858345958ec2febc716beea56b47868b5706e3
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/232080
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/tests/fmt_conv_unittest.cc
b19777d062ee96cd6817fc534388914fed872a83 14-Nov-2014 Dylan Reid <dgreid@chromium.org> CRAS: fmt_conv - Add a default channel copy function

Adds a default channel conversion that copies a little of each
channel to all of the output channels. It divides the input signal by
the number of channels and adds each input channel. All output
channels play the same thing. This is slow, and attenuates the signal
heavily, but it is better than dropping it. It will only be used when
no better converter is found.

BUG=chromium:432425
TEST=play 8 channel test file from iis.fraunhofer.de

Change-Id: I6ada1281ae8b957f3a7d66d4c827d4eae9542e99
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/229730
/external/adhd/cras/src/tests/fmt_conv_unittest.cc
fbd2d15de5e0df9ba2d1144170f7b35cab4249f4 01-Oct-2014 Hsin-Yu Chao <hychao@chromium.org> CRAS: audio_thread - Integrate rate_estimator and linear resampler

Actually use the data report from rate estimator and apply to the
linear resampler in fmt_conv for non-master active devices.
The stream's sleep interval is updated to base on the master dev's
estimated rate.

BUG=chromium:420589
TEST=Play youtube on internal speaker and USB headset. Test
record by cras_test_client.

Change-Id: Ie4265f793bb972d9880cbad244c796a9b03db2b4
Reviewed-on: https://chromium-review.googlesource.com/220157
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/tests/fmt_conv_unittest.cc
4da40ffba6ec3485b8e0a341c12dc2ee1d9cdeb6 20-Oct-2014 Hsin-Yu Chao <hychao@chromium.org> CRAS: fmt_conv - Always create a format converter

When config_fmt_converter() is called, always create a format
converter even the in/out format are identical. This allows the
linear_resampler check to determine if the format conversion is
needed depend on the estimated device rate.

BUG=chromium:420589
TEST=unittest. Play youtube and vocaroo.com

Change-Id: Ib3d1c7863917fb9fb583a9f283d729ac9ad2edb9
Reviewed-on: https://chromium-review.googlesource.com/224629
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/tests/fmt_conv_unittest.cc
b3ebd1d69038925d04ba743aebfdbb8b9cf71d9b 17-Oct-2014 Hsin-Yu Chao <hychao@chromium.org> CRAS: fmt_conv - Add linear resampler to fmt_conv

Add a linear resampler to fmt_conv to adjust device rate skew.
The linear resampler will be used before or after the main
format conversion depend on stream's direction.

BUG=chromium:420589
TEST=unittest

Change-Id: Ib1c17a70e6327bfa5a3263af82e96cb52783f151
Reviewed-on: https://chromium-review.googlesource.com/224628
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/tests/fmt_conv_unittest.cc
09635e9afff9e95e0287e775b2a7e5e9132f351a 14-Sep-2014 Hsin-Yu Chao <hychao@chromium.org> CRAS: dev_stream - don't convert channel/layout for input stream

For capture CRAS can copy the samples from device to stream
for each channel base on the channel layout specified. So when
creating a dev_stream, no need to create format converter if
the format difference is on channel count or layout.

BUG=None
TEST=cras_test_client --capture_file /tmp/1 --num_channels=3
--channel_layout=0,1,-1,-1,2,-1,-1,-1,-1,-1,-1

Change-Id: Id09a8647729f9f7cd9b6887b887a2a28f73436e8
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/218096
/external/adhd/cras/src/tests/fmt_conv_unittest.cc
af1e308a5c904fc2ec74f23dd9fd54fa03e81565 28-Aug-2014 Dylan Reid <dgreid@chromium.org> CRAS: fmt_conv - pass input frames as a pointer.

Pass in a pointer to the number of input frames instead of the number.
This allows the number to be updated with the actual amount of frames
that were read.

BUG=none
TEST=make check

Change-Id: Ife3af9262c22e46ca740d40ea229d50c93948864
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/217000
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Chinyue Chen <chinyue@chromium.org>
/external/adhd/cras/src/tests/fmt_conv_unittest.cc
51b38808ffe2a26fa58e969c801fbc6c90e1edc7 06-Dec-2013 Hsin-Yu Chao <hychao@chromium.org> CRAS: fmt_conv - Convert mono & stereo to 5.1 surroud

The output channel count and layout is fixed when a
6-channel audio is playing, which makes new streams in
mono or stereo unable to be added.
Add the logic to convert mono and stereo to 5.1 surround
output, so that a 6-channel wav file and youtube can be
played at the same time.

BUG=chromium:214597
TEST=Play a 6-channel wav file, and open YouTube at the
same time.

Change-Id: I3c06f242928eae8e1ca1c647a337e7986df44d15
Reviewed-on: https://chromium-review.googlesource.com/179297
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/tests/fmt_conv_unittest.cc
dfe5aced427755b13eeedcd46be065e4d148ced8 21-Nov-2013 Hsin-Yu Chao <hychao@chromium.org> CRAS: alsa_helper - improves channel map matching

In addition to the exact matched channel map. Now allow
channel positions be swapped before matched. For example,
{FL, FR, FC, RR, RL} now matches {FR, FL, FC, RL, RR}.

This new matching log is placed in function
cras_channel_conv_matrx_create(), which along with a few
other functions are moved to common/cras_audio_format.c
so it can be shared by both client and server code.

The new function is used for:
1) server side - to examine supported channel map.
2) client side to create conversion matrix.

BUG=chromium:214597
TEST=Unittest. Manual modify code to enable '6' in test
channel counts, test a 6-channel .ogg file with layout
"0,1,-1,-1,2,3,4,5,-1,-1,-1" and verify each channel is
placed at correct speaker.

Change-Id: I468851ccd887aea3e01287928b0b45e5dafafecc
Reviewed-on: https://chromium-review.googlesource.com/177575
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/tests/fmt_conv_unittest.cc
ea396776bc8f89b2dc665e1f89649f0168707369 18-Oct-2013 Hsin-Yu Chao <hychao@chromium.org> CRAS fmt_conv: use a coefficient matrix for channel conversion

Add channel_conv_mtx, an N * M matrix to store the coefficient
to convert N channel input to M channel output.
<m> = <n> * C is apllied for the conversion, where <m> is a
vector represent one output sample, <n> for one input sample,
and C is the conversion matrix.

BUG=chromium:214597, chrome-os-partner:22343
TEST=Unittest

Change-Id: I3a9be125a11a2c413fe339b464116da7e3df834f
Reviewed-on: https://chromium-review.googlesource.com/173803
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/tests/fmt_conv_unittest.cc
3390915103edddf0576018402d81ad09c0bacdb1 14-Mar-2013 Chih-Chung Chang <chihchung@chromium.org> CRAS: Fix issues found by running valgrind on unit tests.

The issues are memory leak and uninitialized memory access.

After this change, all unit tests other than audio_thread_unittest and
rclient_unittest (they have issues only in unit tests and harder to fix)
run cleanly under valgrind.

BUG=none
TEST=make check and run each unit test under valgrind

Change-Id: I72829f1e88b5927eee58f438cd580563a73d95bb
Reviewed-on: https://gerrit.chromium.org/gerrit/45415
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
/external/adhd/cras/src/tests/fmt_conv_unittest.cc
f135a704ad57a5b4d268ce1c4abdd3963e40d5a4 08-Jan-2013 Dylan Reid <dgreid@chromium.org> CRAS: Add format conversion _from_ s16le

The format converter only supported conversion to s16le. Add the
ability to convert from s16le. With the addition of unified audio,
input streams can be created with any valid output format.

BUG=chromium-os:35272
TEST=updated format converter unittest.

Change-Id: I7f868159fbc1d7b70d63cf86b61fd562f2912275
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41053
/external/adhd/cras/src/tests/fmt_conv_unittest.cc
02d27f65577f493fd2cd4034a9a6e633bf731573 30-May-2012 Dylan Reid <dgreid@chromium.org> CRAS: Bounds check in fmt_converter.

Don't rely on the passed buffer being big enough. By adding the
out_frames arg, make the size of the output buffer explicit so there
isn't accidental overflow.

BUG=chromium-os:31174
TEST=updated UT, build and run on stumpy, test talk plugin, my_webcam
and youtube playback.

Change-Id: Ic267ca04528e77a08cbdaee8f7b96b1ff72c8361
Signed-off-by: Dylan Reid <dgreid@chromium.org>
/external/adhd/cras/src/tests/fmt_conv_unittest.cc
e837a43b5392c78ade7df3b21b61609bbf5eb7c1 30-May-2012 Dylan Reid <dgreid@chromium.org> CRAS: Use internal temp buffer for format conversion.

Don't rely on the externally provided buffer to hold a partial
conversion. The next change will add the ability for the output buffer
size to vary so it can't be relied on.

BUG=chromium-os:31174
TEST=fmt_conv_unittest, plus play multiple youtube videos(HTML5) with
different formats.

Change-Id: Ia2de365ad4f565cfa6168df20d64fdd026599469
Signed-off-by: Dylan Reid <dgreid@chromium.org>
/external/adhd/cras/src/tests/fmt_conv_unittest.cc
894f8c1ccb9936091a94ebcb0b6625e4e9840ff6 15-May-2012 Dylan Reid <dgreid@chromium.org> CRAS: client - Allow format conversion on input streams.

Format conversion was not being used on input streams. The converter
was being created backwards (The input format was set as the output).
Also the converter wasn't used in the samples captured callback.

BUG=chromium-os:30911
TEST=updated test_client. Run as follows:
cras_test_client --capture_file /tmp/asdf.wav --rate 44100 --num_channels 1
Then play back the file with:
cras_test_client --playback_file /tmp/asdf.wav --rate 44100 --num_channels 1
And listen to make sure it sounds OK.

Change-Id: I206c41bd4599c87db5e57ba5127f8f37cd3c57cc
Signed-off-by: Dylan Reid <dgreid@chromium.org>
/external/adhd/cras/src/tests/fmt_conv_unittest.cc
cca7a6baceac0b7655127f85790982bda34676a1 15-May-2012 Dylan Reid <dgreid@chromium.org> CRAS: fmt_conv - remove temporary buffer from fmt_conv.

Remove the temporary buffer from cras_fmt_conv. Make this buffer the
responsibility of the user of fmt_conv(cras_client). This will allow
for the temporary buffer to be used for input or output. The current
model makes input stream format conversion impossible.

BUG=chromium-os:30911
TEST=updated cras_fmt_conv unittest, plus play 6 channel and mono
streams using test_client and listen to format conversion working.

Change-Id: Ie4fbc0de27eecc4239bd63bc23ac18a6d3535ee5
Signed-off-by: Dylan Reid <dgreid@chromium.org>
/external/adhd/cras/src/tests/fmt_conv_unittest.cc
8f59e6ea66dc661a587feb17f0024a0b2b81f8d7 07-May-2012 Dylan Reid <dgreid@chromium.org> CRAS: fmt_conv - Convert Stereo to Mono.

Useful for recording mono from a stereo-only input.

BUG=chromium-os:30627
TEST=updated unit test.

Change-Id: I9615a66697d2fcac9700756b3af0a0b034e3344b
Signed-off-by: Dylan Reid <dgreid@chromium.org>
/external/adhd/cras/src/tests/fmt_conv_unittest.cc
8189d421aeedc10af98d7c293e425141940dcf79 02-May-2012 Dylan Reid <dgreid@chromium.org> CRAS: fmt_conv - allow sample format conversion.

Convert S32, S24, and U8 samples to be converted to S16.
The ChromeOS media player allows these formats to be passed to CRAS.

BUG=chromium-os:30347
TEST=updated fmt_conv_unittest

Change-Id: I5dae4d6e2d4d23671206376b5f7d563a452e9276
Signed-off-by: Dylan Reid <dgreid@chromium.org>
/external/adhd/cras/src/tests/fmt_conv_unittest.cc
b0ae3bc1e9ee3f237762eb538a5083efe2321df6 27-Apr-2012 Dylan Reid <dgreid@chromium.org> CRAS: fmt_conv - Allow converstion from 5.1 to stereo.

Do a simple downmix from 5.1 to stereo. It drops the LFE and surround
channels, which needs to be fixed later. However this behavior
matches that of the alsa downmix that Chrome was using before CRAS.

BUG=chromium-os:30059
TEST=updated UT + play 5.1 video on stumpy.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
/external/adhd/cras/src/tests/fmt_conv_unittest.cc
7547b53fcdb95a1e6830b752573705a44b01873c 26-Jan-2012 Dylan Reid <dgreid@chromium.org> CRAS: Enable mono to stereo conversion.

Add support to the format converted to conver from a mono stream to
a stereo stream.

BUG=none
TEST=updates fmt_conv_unittest

Change-Id: Ib5b1341b0be7d8b05361ce52e4459070e60c9f96
Signed-off-by: Dylan Reid <dgreid@chromium.org>
/external/adhd/cras/src/tests/fmt_conv_unittest.cc
8294753c891e14d5310ef18e5bed6e7488d285ac 18-Jan-2012 Dylan Reid <dgreid@chromium.org> CRAS: Add format converter wrapper and unit test.

The format converter is used when the client's audio stream doesn't
match the format used on the server. It currently only handles sample
rate conversion, not chagnes to the number of channels. More support
for converting will be added when and if it is needed.

BUG=chrome-os-partner:6382
TEST=included fmt_conv_unittest

Change-Id: I93eebb37a79991546aca2cf597d52313a14a4a64
Signed-off-by: Dylan Reid <dgreid@chromium.org>
/external/adhd/cras/src/tests/fmt_conv_unittest.cc