From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Simon Ser <simon.ser@intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t] lib/igt_audio: normalize samples when extracting channel
Date: Mon, 13 May 2019 19:25:47 +0300 [thread overview]
Message-ID: <20190513162547.GQ24299@intel.com> (raw)
In-Reply-To: <20190513141125.7902-1-simon.ser@intel.com>
On Mon, May 13, 2019 at 05:11:25PM +0300, Simon Ser wrote:
> audio_extract_channel_s32_le converts S32 samples to double. Prior to this
> patch, the output samples weren't normalized, resulting in values up to
> INT32_MAX.
>
> Future amplitude tests need to be format-agnostic (ie. shouldn't care whether
> the format used is S16 or S32). Thus, it is preferable to always use normalized
> double values.
>
> The current tests don't check the amplitude (or check it relative to the max.
> on the whole buffer), so they still pass without any modification.
>
> Signed-off-by: Simon Ser <simon.ser@intel.com>
> ---
> lib/igt_audio.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/igt_audio.c b/lib/igt_audio.c
> index fd8cf07c0de3..f4b169595f6c 100644
> --- a/lib/igt_audio.c
> +++ b/lib/igt_audio.c
> @@ -389,7 +389,7 @@ size_t audio_extract_channel_s32_le(double *dst, size_t dst_cap,
> dst_len = src_len / n_channels;
> igt_assert(dst_len <= dst_cap);
> for (i = 0; i < dst_len; i++)
> - dst[i] = (double) src[i * n_channels + channel];
> + dst[i] = (double) src[i * n_channels + channel] / INT32_MAX;
Do we care that the most negative value could result
in a normalized value < -1.0?
>
> return dst_len;
> }
> --
> 2.21.0
>
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
--
Ville Syrjälä
Intel
_______________________________________________
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-13 16:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-13 14:11 [igt-dev] [PATCH i-g-t] lib/igt_audio: normalize samples when extracting channel Simon Ser
2019-05-13 15:38 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-05-13 16:25 ` Ville Syrjälä [this message]
2019-05-14 6:32 ` [igt-dev] [PATCH i-g-t] " Ser, Simon
2019-05-14 12:29 ` Ville Syrjälä
2019-05-13 18:36 ` [igt-dev] ✓ Fi.CI.IGT: success for " Patchwork
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=20190513162547.GQ24299@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=simon.ser@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