[igt-dev] [PATCH i-g-t] lib/igt_audio: fix amplitude for S24_LE and S32_LE
Martin Peres
martin.peres at linux.intel.com
Mon May 27 10:01:26 UTC 2019
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 at intel.com>
> Fixes: 42576d710255 ("lib/igt_audio: add support for S24_LE and S32_LE signal generation")
Reviewed-by: Martin Peres <martin.peres at 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
>
More information about the igt-dev
mailing list