* [igt-dev] [PATCH i-g-t] lib/igt_audio: use double instead of int16_t
@ 2019-05-14 8:15 Simon Ser
2019-05-14 9:04 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Simon Ser @ 2019-05-14 8:15 UTC (permalink / raw)
To: igt-dev; +Cc: martin.peres
In order to be able to generate S32_LE signals, we need a higher precision than
S16_LE. Change the signal generation code to use double instead of int16_t and
introduce a new helper to fill a buffer with S16_LE samples. We already use
arrays of doubles elsewhere (see audio_signal_detect). Similar format-specific
helpers will be added for S32_LE in the future.
Signed-off-by: Simon Ser <simon.ser@intel.com>
---
This patch is necessary for supporting more audio formats, and will be useful
for amplitude checks (no need to convert back-and-forth between normalized
double values and int16_t).
lib/igt_audio.c | 41 ++++++++++++++++++++++++++++-------------
lib/igt_audio.h | 4 +++-
tests/kms_chamelium.c | 2 +-
3 files changed, 32 insertions(+), 15 deletions(-)
diff --git a/lib/igt_audio.c b/lib/igt_audio.c
index fd8cf07c0de3..3d1a38057a92 100644
--- a/lib/igt_audio.c
+++ b/lib/igt_audio.c
@@ -51,7 +51,7 @@ struct audio_signal_freq {
int freq;
int channel;
- int16_t *period;
+ double *period;
size_t period_len;
int offset;
};
@@ -142,7 +142,7 @@ int audio_signal_add_frequency(struct audio_signal *signal, int frequency,
*/
void audio_signal_synthesize(struct audio_signal *signal)
{
- int16_t *period;
+ double *period;
double value;
size_t period_len;
int freq;
@@ -152,13 +152,13 @@ void audio_signal_synthesize(struct audio_signal *signal)
freq = signal->freqs[i].freq;
period_len = signal->sampling_rate / freq;
- period = calloc(1, period_len * sizeof(int16_t));
+ period = calloc(period_len, sizeof(double));
for (j = 0; j < period_len; j++) {
value = 2.0 * M_PI * freq / signal->sampling_rate * j;
- value = sin(value) * INT16_MAX / signal->freqs_count;
+ value = sin(value) / signal->freqs_count;
- period[j] = (int16_t) value;
+ period[j] = value;
}
signal->freqs[i].period = period;
@@ -202,19 +202,19 @@ void audio_signal_reset(struct audio_signal *signal)
* @samples: The number of samples to fill
*
* Fill the requested number of samples to the target buffer with the audio
- * signal data (in interleaved S16_LE format), at the requested sampling rate
+ * signal data (in interleaved double format), at the requested sampling rate
* and number of channels.
*/
-void audio_signal_fill(struct audio_signal *signal, int16_t *buffer,
- size_t buffer_len)
+void audio_signal_fill(struct audio_signal *signal, double *buffer,
+ size_t samples)
{
- int16_t *destination, *source;
+ double *destination, *source;
struct audio_signal_freq *freq;
int total;
int count;
int i, j, k;
- memset(buffer, 0, sizeof(int16_t) * signal->channels * buffer_len);
+ memset(buffer, 0, sizeof(double) * signal->channels * samples);
for (i = 0; i < signal->freqs_count; i++) {
freq = &signal->freqs[i];
@@ -222,13 +222,13 @@ void audio_signal_fill(struct audio_signal *signal, int16_t *buffer,
igt_assert(freq->period);
- while (total < buffer_len) {
+ while (total < samples) {
source = freq->period + freq->offset;
destination = buffer + total * signal->channels;
count = freq->period_len - freq->offset;
- if (count > buffer_len - total)
- count = buffer_len - total;
+ if (count > samples - total)
+ count = samples - total;
freq->offset += count;
freq->offset %= freq->period_len;
@@ -247,6 +247,21 @@ void audio_signal_fill(struct audio_signal *signal, int16_t *buffer,
}
}
+void audio_signal_fill_s16_le(struct audio_signal *signal, int16_t *buffer,
+ size_t samples)
+{
+ double *tmp;
+ size_t i;
+
+ tmp = malloc(sizeof(double) * signal->channels * samples);
+ audio_signal_fill(signal, tmp, samples);
+
+ for (i = 0; i < signal->channels * samples; ++i)
+ buffer[i] = INT16_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 466e772a75a4..56e080c87848 100644
--- a/lib/igt_audio.h
+++ b/lib/igt_audio.h
@@ -40,8 +40,10 @@ int audio_signal_add_frequency(struct audio_signal *signal, int frequency,
int channel);
void audio_signal_synthesize(struct audio_signal *signal);
void audio_signal_reset(struct audio_signal *signal);
-void audio_signal_fill(struct audio_signal *signal, int16_t *buffer,
+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);
bool audio_signal_detect(struct audio_signal *signal, int sampling_rate,
int channel, double *data, size_t data_len);
size_t audio_extract_channel_s32_le(double *dst, size_t dst_cap,
diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
index 502f1efa0727..e1ddc60aca52 100644
--- a/tests/kms_chamelium.c
+++ b/tests/kms_chamelium.c
@@ -790,7 +790,7 @@ audio_output_callback(void *data, short *buffer, int frames)
{
struct audio_state *state = data;
- audio_signal_fill(state->signal, buffer, frames);
+ audio_signal_fill_s16_le(state->signal, buffer, frames);
return state->run ? 0 : -1;
}
--
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] 4+ messages in thread* [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_audio: use double instead of int16_t
2019-05-14 8:15 [igt-dev] [PATCH i-g-t] lib/igt_audio: use double instead of int16_t Simon Ser
@ 2019-05-14 9:04 ` Patchwork
2019-05-15 13:36 ` [igt-dev] [PATCH i-g-t] " Arkadiusz Hiler
2019-05-15 17:41 ` [igt-dev] ✓ Fi.CI.IGT: success for " Patchwork
2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2019-05-14 9:04 UTC (permalink / raw)
To: Ser, Simon; +Cc: igt-dev
== Series Details ==
Series: lib/igt_audio: use double instead of int16_t
URL : https://patchwork.freedesktop.org/series/60616/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_6078 -> IGTPW_2977
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/60616/revisions/1/mbox/
Known issues
------------
Here are the changes found in IGTPW_2977 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_ctx_exec@basic:
- fi-icl-u2: [PASS][1] -> [INCOMPLETE][2] ([fdo#107713])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6078/fi-icl-u2/igt@gem_ctx_exec@basic.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/fi-icl-u2/igt@gem_ctx_exec@basic.html
#### Possible fixes ####
* igt@i915_selftest@live_contexts:
- fi-bdw-gvtdvm: [DMESG-FAIL][3] ([fdo#110235]) -> [PASS][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6078/fi-bdw-gvtdvm/igt@i915_selftest@live_contexts.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/fi-bdw-gvtdvm/igt@i915_selftest@live_contexts.html
* igt@i915_selftest@live_hangcheck:
- fi-skl-iommu: [INCOMPLETE][5] ([fdo#108602] / [fdo#108744]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6078/fi-skl-iommu/igt@i915_selftest@live_hangcheck.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/fi-skl-iommu/igt@i915_selftest@live_hangcheck.html
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#108602]: https://bugs.freedesktop.org/show_bug.cgi?id=108602
[fdo#108744]: https://bugs.freedesktop.org/show_bug.cgi?id=108744
[fdo#109100]: https://bugs.freedesktop.org/show_bug.cgi?id=109100
[fdo#110235]: https://bugs.freedesktop.org/show_bug.cgi?id=110235
Participating hosts (54 -> 41)
------------------------------
Missing (13): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-skl-6770hq fi-byt-squawks fi-bsw-cyan fi-apl-guc fi-ctg-p8600 fi-byt-clapper fi-gdg-551 fi-pnv-d510 fi-icl-dsi fi-bdw-samus
Build changes
-------------
* IGT: IGT_4984 -> IGTPW_2977
CI_DRM_6078: c8c778558fd52abd3303d8ea324df788062adc97 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2977: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/
IGT_4984: 66c887d2f7a92a4a97acd9611d5342afc5d4f815 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [igt-dev] [PATCH i-g-t] lib/igt_audio: use double instead of int16_t
2019-05-14 8:15 [igt-dev] [PATCH i-g-t] lib/igt_audio: use double instead of int16_t Simon Ser
2019-05-14 9:04 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
@ 2019-05-15 13:36 ` Arkadiusz Hiler
2019-05-15 17:41 ` [igt-dev] ✓ Fi.CI.IGT: success for " Patchwork
2 siblings, 0 replies; 4+ messages in thread
From: Arkadiusz Hiler @ 2019-05-15 13:36 UTC (permalink / raw)
To: Simon Ser; +Cc: igt-dev, martin.peres
On Tue, May 14, 2019 at 11:15:48AM +0300, Simon Ser wrote:
> In order to be able to generate S32_LE signals, we need a higher precision than
> S16_LE. Change the signal generation code to use double instead of int16_t and
> introduce a new helper to fill a buffer with S16_LE samples. We already use
> arrays of doubles elsewhere (see audio_signal_detect). Similar format-specific
> helpers will be added for S32_LE in the future.
>
> Signed-off-by: Simon Ser <simon.ser@intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Missing shards due to a Jenkin's hiccup. I'll requeued them.
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 4+ messages in thread
* [igt-dev] ✓ Fi.CI.IGT: success for lib/igt_audio: use double instead of int16_t
2019-05-14 8:15 [igt-dev] [PATCH i-g-t] lib/igt_audio: use double instead of int16_t Simon Ser
2019-05-14 9:04 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-05-15 13:36 ` [igt-dev] [PATCH i-g-t] " Arkadiusz Hiler
@ 2019-05-15 17:41 ` Patchwork
2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2019-05-15 17:41 UTC (permalink / raw)
To: Ser, Simon; +Cc: igt-dev
== Series Details ==
Series: lib/igt_audio: use double instead of int16_t
URL : https://patchwork.freedesktop.org/series/60616/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_6078_full -> IGTPW_2977_full
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/60616/revisions/1/mbox/
Known issues
------------
Here are the changes found in IGTPW_2977_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_eio@in-flight-suspend:
- shard-apl: [PASS][1] -> [DMESG-WARN][2] ([fdo#108566]) +1 similar issue
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6078/shard-apl7/igt@gem_eio@in-flight-suspend.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/shard-apl3/igt@gem_eio@in-flight-suspend.html
- shard-glk: [PASS][3] -> ([FAIL][4], [PASS][5]) ([fdo#110667])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6078/shard-glk2/igt@gem_eio@in-flight-suspend.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/shard-glk8/igt@gem_eio@in-flight-suspend.html
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/shard-glk7/igt@gem_eio@in-flight-suspend.html
* igt@gem_tiled_swapping@non-threaded:
- shard-glk: [PASS][6] -> ([DMESG-WARN][7], [DMESG-WARN][8]) ([fdo#108686])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6078/shard-glk4/igt@gem_tiled_swapping@non-threaded.html
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/shard-glk9/igt@gem_tiled_swapping@non-threaded.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/shard-glk7/igt@gem_tiled_swapping@non-threaded.html
* igt@kms_flip@flip-vs-expired-vblank:
- shard-glk: [PASS][9] -> ([FAIL][10], [PASS][11]) ([fdo#102887])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6078/shard-glk7/igt@kms_flip@flip-vs-expired-vblank.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/shard-glk9/igt@kms_flip@flip-vs-expired-vblank.html
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/shard-glk6/igt@kms_flip@flip-vs-expired-vblank.html
* igt@kms_vblank@pipe-b-ts-continuation-suspend:
- shard-kbl: [PASS][12] -> ([PASS][13], [DMESG-WARN][14]) ([fdo#108566])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6078/shard-kbl6/igt@kms_vblank@pipe-b-ts-continuation-suspend.html
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/shard-kbl6/igt@kms_vblank@pipe-b-ts-continuation-suspend.html
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/shard-kbl7/igt@kms_vblank@pipe-b-ts-continuation-suspend.html
* igt@perf_pmu@rc6:
- shard-kbl: [PASS][15] -> [SKIP][16] ([fdo#109271])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6078/shard-kbl1/igt@perf_pmu@rc6.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/shard-kbl4/igt@perf_pmu@rc6.html
#### Possible fixes ####
* igt@i915_suspend@fence-restore-untiled:
- shard-apl: [DMESG-WARN][17] ([fdo#108566]) -> [PASS][18] +3 similar issues
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6078/shard-apl1/igt@i915_suspend@fence-restore-untiled.html
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/shard-apl6/igt@i915_suspend@fence-restore-untiled.html
* igt@kms_cursor_legacy@2x-long-cursor-vs-flip-atomic:
- shard-hsw: [FAIL][19] ([fdo#105767]) -> ([PASS][20], [PASS][21])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6078/shard-hsw1/igt@kms_cursor_legacy@2x-long-cursor-vs-flip-atomic.html
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/shard-hsw2/igt@kms_cursor_legacy@2x-long-cursor-vs-flip-atomic.html
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/shard-hsw7/igt@kms_cursor_legacy@2x-long-cursor-vs-flip-atomic.html
* igt@kms_cursor_legacy@cursor-vs-flip-atomic:
- shard-hsw: [INCOMPLETE][22] ([fdo#103540]) -> ([PASS][23], [PASS][24])
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6078/shard-hsw8/igt@kms_cursor_legacy@cursor-vs-flip-atomic.html
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/shard-hsw5/igt@kms_cursor_legacy@cursor-vs-flip-atomic.html
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/shard-hsw8/igt@kms_cursor_legacy@cursor-vs-flip-atomic.html
* igt@kms_vblank@pipe-b-ts-continuation-dpms-suspend:
- shard-snb: [DMESG-WARN][25] ([fdo#110684]) -> [PASS][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6078/shard-snb5/igt@kms_vblank@pipe-b-ts-continuation-dpms-suspend.html
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/shard-snb1/igt@kms_vblank@pipe-b-ts-continuation-dpms-suspend.html
* igt@tools_test@tools_test:
- shard-glk: [SKIP][27] ([fdo#109271]) -> ([PASS][28], [PASS][29])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6078/shard-glk4/igt@tools_test@tools_test.html
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/shard-glk7/igt@tools_test@tools_test.html
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/shard-glk8/igt@tools_test@tools_test.html
#### Warnings ####
* igt@kms_setmode@basic:
- shard-kbl: [FAIL][30] ([fdo#99912]) -> ([PASS][31], [FAIL][32]) ([fdo#99912])
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6078/shard-kbl7/igt@kms_setmode@basic.html
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/shard-kbl2/igt@kms_setmode@basic.html
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/shard-kbl7/igt@kms_setmode@basic.html
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#102887]: https://bugs.freedesktop.org/show_bug.cgi?id=102887
[fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
[fdo#105767]: https://bugs.freedesktop.org/show_bug.cgi?id=105767
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[fdo#108686]: https://bugs.freedesktop.org/show_bug.cgi?id=108686
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#110667]: https://bugs.freedesktop.org/show_bug.cgi?id=110667
[fdo#110684]: https://bugs.freedesktop.org/show_bug.cgi?id=110684
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912
Participating hosts (10 -> 6)
------------------------------
Missing (4): pig-skl-6260u shard-skl pig-hsw-4770r pig-glk-j5005
Build changes
-------------
* IGT: IGT_4984 -> IGTPW_2977
* Piglit: piglit_4509 -> None
CI_DRM_6078: c8c778558fd52abd3303d8ea324df788062adc97 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2977: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/
IGT_4984: 66c887d2f7a92a4a97acd9611d5342afc5d4f815 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2977/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-05-15 17:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-14 8:15 [igt-dev] [PATCH i-g-t] lib/igt_audio: use double instead of int16_t Simon Ser
2019-05-14 9:04 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-05-15 13:36 ` [igt-dev] [PATCH i-g-t] " Arkadiusz Hiler
2019-05-15 17:41 ` [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