summaryrefslogtreecommitdiff
path: root/cras/src/server/cras_fmt_conv_ops.h
diff options
context:
space:
mode:
authorJudy Hsiao <judyhsiao@chromium.org>2021-03-18 11:13:39 +0800
committerCommit Bot <commit-bot@chromium.org>2021-03-23 12:54:25 +0000
commit3b124e06ef9a563cc7c9eb6a9888aa9b68654c7e (patch)
treeadac41a2050ccf206a8819150d97b585443d3eb2 /cras/src/server/cras_fmt_conv_ops.h
parent2763f392df683537d71ba7f258009e592647f6d8 (diff)
downloadadhd-3b124e06ef9a563cc7c9eb6a9888aa9b68654c7e.tar.gz
CRAS: fmt_conv: Support quad to 5.1 channel conversion
Add the logic to convert quad output to 5.1 surround by copying the {front,rear} {left,right} of input to the {front,rear} {left,right} of output respectively and fill others with zero. BUG=b:183070810 TEST=1. `sox -n -c6 -b 16 -r 48000 /tmp/zero.raw synth 300 sine 0` 2. `sox -n -c4 -b 16 -r 48000 /tmp/sine.raw synth 30 sine 300\ sin 400 sin 500 sin 600` 3. `cras_test_client -c6 -P /tmp/zero.raw` 4. `cras_test_client -c4 -P /tmp/sine.raw` at the same time. 5. Verified that each of the 4 chanel are are output with the correct tone with a 6 channel audio device. TEST=`FEATURES=test USE=asan emerge-${BOARD} adhd` Change-Id: I12784c3ff38da1d30994d0711ce0630e009775a9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/2771463 Commit-Queue: Judy Hsiao <judyhsiao@chromium.org> Commit-Queue: Yu-Hsuan Hsu <yuhsuan@chromium.org> Tested-by: Judy Hsiao <judyhsiao@chromium.org> Auto-Submit: Judy Hsiao <judyhsiao@chromium.org> Reviewed-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
Diffstat (limited to 'cras/src/server/cras_fmt_conv_ops.h')
-rw-r--r--cras/src/server/cras_fmt_conv_ops.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/cras/src/server/cras_fmt_conv_ops.h b/cras/src/server/cras_fmt_conv_ops.h
index a1a57487..0af7564b 100644
--- a/cras/src/server/cras_fmt_conv_ops.h
+++ b/cras/src/server/cras_fmt_conv_ops.h
@@ -46,6 +46,13 @@ size_t s16_stereo_to_51(size_t left, size_t right, size_t center,
const uint8_t *in, size_t in_frames, uint8_t *out);
/*
+ * Channel converter: quad to 5.1 surround.
+ */
+size_t s16_quad_to_51(size_t font_left, size_t front_right, size_t rear_left,
+ size_t rear_right, const uint8_t *in, size_t in_frames,
+ uint8_t *out);
+
+/*
* Channel converter: 5.1 surround to stereo.
*/
size_t s16_51_to_stereo(const uint8_t *in, size_t in_frames, uint8_t *out);