From: "Ser, Simon" <simon.ser@intel.com>
To: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
"martin.peres@linux.intel.com" <martin.peres@linux.intel.com>
Cc: "Peres, Martin" <martin.peres@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t 3/5] lib/igt_audio: add support for S24_LE and S32_LE signal generation
Date: Mon, 20 May 2019 13:08:27 +0000 [thread overview]
Message-ID: <7d7f1ba470b7c51b027956afbbdcbc0f1fd76f87.camel@intel.com> (raw)
In-Reply-To: <db3a2612-c14b-3744-be87-3908f080aba5@linux.intel.com>
On Mon, 2019-05-20 at 15:14 +0300, Martin Peres wrote:
> On 17/05/2019 19:02, Simon Ser wrote:
> > This adds two new helpers to generate S24_LE and S32_LE signals.
>
> I got a little taken aback by the multiplication... until I remembered
> that the doubles were between [0, 1].
That's fair. I added the note to audio_signal_fill instead of
duplicating it in call sites.
> I think this patch could add a small note (see below), but regardless of
> what you chose to do:
>
> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
>
> > Signed-off-by: Simon Ser <simon.ser@intel.com>
> > ---
> > lib/igt_audio.c | 30 ++++++++++++++++++++++++++++++
> > lib/igt_audio.h | 4 ++++
> > 2 files changed, 34 insertions(+)
> >
> > diff --git a/lib/igt_audio.c b/lib/igt_audio.c
> > index 90d16fe4bd11..876084a994c3 100644
> > --- a/lib/igt_audio.c
> > +++ b/lib/igt_audio.c
> > @@ -262,6 +262,36 @@ void audio_signal_fill_s16_le(struct audio_signal *signal, int16_t *buffer,
> > free(tmp);
> > }
> >
> > +void audio_signal_fill_s24_le(struct audio_signal *signal, int32_t *buffer,
> > + size_t samples)
> > +{
> > + double *tmp;
> > + size_t i;
> > +
> > + tmp = malloc(sizeof(double) * signal->channels * samples);
> > + audio_signal_fill(signal, tmp, samples);
> > +
>
> /* NOTE: audio_signal_fill() returns samples between [0, 1] */
> > + for (i = 0; i < signal->channels * samples; ++i)
> > + buffer[i] = 0xFFFFFF * tmp[i];
> > +
> > + free(tmp);
> > +}
> > +
> > +void audio_signal_fill_s32_le(struct audio_signal *signal, int32_t *buffer,
> > + size_t samples)
> > +{
> > + double *tmp;
> > + size_t i;
> > +
> > + tmp = malloc(sizeof(double) * signal->channels * samples);
> > + audio_signal_fill(signal, tmp, samples);
> > +
>
> /* NOTE: audio_signal_fill() returns samples between [0, 1] */
> > + for (i = 0; i < signal->channels * samples; ++i)
> > + buffer[i] = UINT32_MAX * tmp[i];
> > +
> > + free(tmp);
> > +}
> > +
> > /**
> > * Checks that frequencies specified in signal, and only those, are included
> > * in the input data.
> > diff --git a/lib/igt_audio.h b/lib/igt_audio.h
> > index f915d55d63fc..c8de70871faa 100644
> > --- a/lib/igt_audio.h
> > +++ b/lib/igt_audio.h
> > @@ -44,6 +44,10 @@ void audio_signal_fill(struct audio_signal *signal, double *buffer,
> > size_t buffer_len);
> > void audio_signal_fill_s16_le(struct audio_signal *signal, int16_t *buffer,
> > size_t buffer_len);
> > +void audio_signal_fill_s24_le(struct audio_signal *signal, int32_t *buffer,
> > + size_t buffer_len);
> > +void audio_signal_fill_s32_le(struct audio_signal *signal, int32_t *buffer,
> > + size_t buffer_len);
> > bool audio_signal_detect(struct audio_signal *signal, int sampling_rate,
> > int channel, const double *samples, size_t samples_len);
> > size_t audio_extract_channel_s32_le(double *dst, size_t dst_cap,
> >
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-05-20 13:08 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-17 16:02 [igt-dev] [PATCH i-g-t 1/5] lib/igt_alsa: support all alsa formats Simon Ser
2019-05-17 16:02 ` [igt-dev] [PATCH i-g-t 2/5] lib/igt_alsa: add format argument to alsa_test_output_configuration Simon Ser
2019-05-20 12:08 ` Martin Peres
2019-05-17 16:02 ` [igt-dev] [PATCH i-g-t 3/5] lib/igt_audio: add support for S24_LE and S32_LE signal generation Simon Ser
2019-05-20 12:14 ` Martin Peres
2019-05-20 13:08 ` Ser, Simon [this message]
2019-05-17 16:02 ` [igt-dev] [PATCH i-g-t 4/5] tests/kms_chamelium: add S24_LE and S32_LE audio tests Simon Ser
2019-05-20 12:20 ` Peres, Martin
2019-05-20 13:10 ` Ser, Simon
2019-05-20 13:43 ` Martin Peres
2019-05-17 16:02 ` [igt-dev] [PATCH i-g-t 5/5] tests/kms_chamelium: skip audio tests Chamelium doesn't support Simon Ser
2019-05-20 12:21 ` Peres, Martin
2019-05-20 13:12 ` Ser, Simon
2019-05-17 16:44 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/5] lib/igt_alsa: support all alsa formats Patchwork
2019-05-18 4:26 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-05-20 10:11 ` [igt-dev] [PATCH i-g-t 1/5] " Martin Peres
2019-05-20 10:38 ` Ser, Simon
2019-05-20 10:46 ` Martin Peres
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=7d7f1ba470b7c51b027956afbbdcbc0f1fd76f87.camel@intel.com \
--to=simon.ser@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=martin.peres@intel.com \
--cc=martin.peres@linux.intel.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