public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Martin Peres <martin.peres@linux.intel.com>
To: Simon Ser <simon.ser@intel.com>, igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t] lib/igt_audio: fix amplitude for S24_LE and S32_LE
Date: Mon, 27 May 2019 13:01:26 +0300	[thread overview]
Message-ID: <bef7434a-9e8a-38d8-3407-f13219f8bef6@linux.intel.com> (raw)
In-Reply-To: <20190522102931.12664-1-simon.ser@intel.com>

On 22/05/2019 13:29, Simon Ser wrote:
> We need to use signed integers (hence "S" in the format name).
> 
> The reason this has gone unnoticed is that we were generating signals with half
> of the amplitude they were supposed to have. As a result, using UINT32_MAX
> (which is almost INT32_MAX * 2) resulted in the correct amplitude. In other
> words, these two bugs were cancelling each other's effects.
> 
> Signed-off-by: Simon Ser <simon.ser@intel.com>
> Fixes: 42576d710255 ("lib/igt_audio: add support for S24_LE and S32_LE signal generation")

Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
> ---
>  lib/igt_audio.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/igt_audio.c b/lib/igt_audio.c
> index 9937fd02f750..07935e660c5a 100644
> --- a/lib/igt_audio.c
> +++ b/lib/igt_audio.c
> @@ -328,7 +328,7 @@ void audio_signal_fill_s24_le(struct audio_signal *signal, int32_t *buffer,
>  	audio_signal_fill(signal, tmp, samples);
> 
>  	for (i = 0; i < signal->channels * samples; ++i)
> -		buffer[i] = 0xFFFFFF * tmp[i];
> +		buffer[i] = 0x7FFFFF * tmp[i];
> 
>  	free(tmp);
>  }
> @@ -343,7 +343,7 @@ void audio_signal_fill_s32_le(struct audio_signal *signal, int32_t *buffer,
>  	audio_signal_fill(signal, tmp, samples);
> 
>  	for (i = 0; i < signal->channels * samples; ++i)
> -		buffer[i] = UINT32_MAX * tmp[i];
> +		buffer[i] = INT32_MAX * tmp[i];
> 
>  	free(tmp);
>  }
> --
> 2.21.0
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

      parent reply	other threads:[~2019-05-27 10:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-22 10:29 [igt-dev] [PATCH i-g-t] lib/igt_audio: fix amplitude for S24_LE and S32_LE Simon Ser
2019-05-22 11:09 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-05-23  3:38 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-05-27 10:01 ` Martin Peres [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=bef7434a-9e8a-38d8-3407-f13219f8bef6@linux.intel.com \
    --to=martin.peres@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