public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] lib/igt_audio: normalize samples when extracting channel
@ 2019-05-13 14:11 Simon Ser
  2019-05-13 15:38 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Simon Ser @ 2019-05-13 14:11 UTC (permalink / raw)
  To: igt-dev

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;

 	return dst_len;
 }
--
2.21.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-05-14 12:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [igt-dev] [PATCH i-g-t] " Ville Syrjälä
2019-05-14  6:32   ` Ser, Simon
2019-05-14 12:29     ` Ville Syrjälä
2019-05-13 18:36 ` [igt-dev] ✓ Fi.CI.IGT: success for " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox