From: Szymon Janc <szymon.janc@gmail.com>
To: Szymon Janc <szymon.janc@tieto.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 1/5] android/client: Simplify PCM handling function in SCO HAL
Date: Mon, 29 Sep 2014 09:13:06 -0700 (PDT) [thread overview]
Message-ID: <1570207.ebdzAWXeKY@athlon> (raw)
In-Reply-To: <1411738938-29524-1-git-send-email-szymon.janc@tieto.com>
On Friday 26 September 2014 15:42:14 Szymon Janc wrote:
> Those functions operates on aligned buffers so there is no need for
> unaligned memory access helpers.
> ---
> android/client/if-sco.c | 21 +++++++--------------
> 1 file changed, 7 insertions(+), 14 deletions(-)
>
> diff --git a/android/client/if-sco.c b/android/client/if-sco.c
> index 7a89692..e7197b2 100644
> --- a/android/client/if-sco.c
> +++ b/android/client/if-sco.c
> @@ -19,7 +19,6 @@
> #include <unistd.h>
> #include <math.h>
>
> -#include "../src/shared/util.h"
> #include "if-main.h"
> #include "../hal-utils.h"
>
> @@ -176,14 +175,11 @@ static void prepare_sample(void)
>
> static void mono_to_stereo_pcm16(const int16_t *in, int16_t *out, size_t
> samples) {
> - int16_t mono;
> size_t i;
>
> for (i = 0; i < samples; i++) {
> - mono = get_unaligned(&in[i]);
> -
> - put_unaligned(mono, &out[2 * i]);
> - put_unaligned(mono, &out[2 * i + 1]);
> + out[2 * i] = in[i];
> + out[2 * i + 1] = in[i];
> }
> }
>
> @@ -267,17 +263,14 @@ static void *playback_thread(void *data)
> return NULL;
> }
>
> -static void write_stereo_pcm16(char *buffer, size_t len, FILE *out)
> +static void write_stereo_pcm16(const short *input, size_t len, FILE *out)
> {
> - const int16_t *input = (const void *) buffer;
> - int16_t sample[2];
> + short sample[2];
> size_t i;
>
> for (i = 0; i < len / 2; i++) {
> - int16_t mono = get_unaligned(&input[i]);
> -
> - put_unaligned(mono, &sample[0]);
> - put_unaligned(mono, &sample[1]);
> + sample[0] = input[i];
> + sample[1] = input[i];
>
> fwrite(sample, sizeof(sample), 1, out);
> }
> @@ -319,7 +312,7 @@ static void *read_thread(void *data)
> haltest_info("Read %zd bytes\n", len);
>
> if (out) {
> - write_stereo_pcm16((char *) buffer, len, out);
> + write_stereo_pcm16(buffer, len, out);
> haltest_info("Written %zd bytes\n", len * 2);
> }
> } while (len);
Pushed.
--
Szymon K. Janc
szymon.janc@gmail.com
prev parent reply other threads:[~2014-09-29 16:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-26 13:42 [PATCH 1/5] android/client: Simplify PCM handling function in SCO HAL Szymon Janc
2014-09-26 13:42 ` [PATCH 2/5] android/hal-audio: Remove use of shared queue code Szymon Janc
2014-09-26 13:42 ` [PATCH 3/5] android/hal: Add simple helpers for unaligned memory access Szymon Janc
2014-09-26 13:42 ` [PATCH 4/5] android/hal-sco: Use hal-utils helpers for unaligned access Szymon Janc
2014-09-26 13:42 ` [PATCH 5/5] android/hal-audio: " Szymon Janc
2014-09-29 16:13 ` Szymon Janc [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1570207.ebdzAWXeKY@athlon \
--to=szymon.janc@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=szymon.janc@tieto.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox