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
Cc: martin.peres@intel.com
Subject: Re: [igt-dev] [PATCH i-g-t v2 3/3] lib/tests/igt_audio: add phaseshift detection test
Date: Tue, 4 Jun 2019 16:01:33 +0300	[thread overview]
Message-ID: <3ed8e628-a7cc-91fd-3715-082260a072de@linux.intel.com> (raw)
In-Reply-To: <20190604114836.2830-4-simon.ser@intel.com>

On 04/06/2019 14:48, Simon Ser wrote:
> Truncate a few samples in the middle of the signal, and make sure the detection
> fails.

This is very nice!

Reviewed-by: Martin Peres <martin.peres@linux.intel.com>

> 
> Signed-off-by: Simon Ser <simon.ser@intel.com>
> ---
>  lib/tests/igt_audio.c | 36 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 36 insertions(+)
> 
> diff --git a/lib/tests/igt_audio.c b/lib/tests/igt_audio.c
> index 821813bae47a..7c5279acc92e 100644
> --- a/lib/tests/igt_audio.c
> +++ b/lib/tests/igt_audio.c
> @@ -33,6 +33,8 @@
>  #define SAMPLING_RATE 44100
>  #define CHANNELS 1
>  #define BUFFER_LEN 2048
> +/** PHASESHIFT_LEN: how many samples will be truncated from the signal */
> +#define PHASESHIFT_LEN 8
>  
>  static const int test_freqs[] = { 300, 700, 5000 };
>  
> @@ -136,6 +138,37 @@ static void test_signal_detect_pop(struct audio_signal *signal)
>  	igt_assert(!ok);
>  }
>  
> +static void test_signal_detect_phaseshift(struct audio_signal *signal)
> +{
> +	double *buf;
> +	bool ok;
> +
> +	buf = malloc((BUFFER_LEN + PHASESHIFT_LEN) * sizeof(double));
> +	audio_signal_fill(signal, buf, (BUFFER_LEN + PHASESHIFT_LEN) / CHANNELS);
> +
> +	/* Perform a phaseshift (this isn't related to sirens).
> +	 *
> +	 * The idea is to remove a part of the signal in the middle of the
> +	 * buffer:
> +	 *
> +	 *   BUFFER_LEN/3   PHASESHIFT_LEN            2*BUFFER_LEN/3
> +	 * [--------------|################|---------------------------------]
> +	 *
> +	 *                           |
> +	 *                           V
> +	 *
> +	 * [--------------|---------------------------------]
> +	 */
> +	memmove(&buf[BUFFER_LEN / 3], &buf[BUFFER_LEN / 3 + PHASESHIFT_LEN],
> +		(2 * BUFFER_LEN / 3) * sizeof(double));
> +
> +	ok = audio_signal_detect(signal, SAMPLING_RATE, 0, buf, BUFFER_LEN);
> +
> +	free(buf);
> +
> +	igt_assert(!ok);
> +}
> +
>  igt_main
>  {
>  	struct audio_signal *signal;
> @@ -174,6 +207,9 @@ igt_main
>  		igt_subtest("signal-detect-pop")
>  			test_signal_detect_pop(signal);
>  
> +		igt_subtest("signal-detect-phaseshift")
> +			test_signal_detect_phaseshift(signal);
> +
>  		igt_fixture {
>  			audio_signal_fini(signal);
>  		}
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-06-04 13:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-04 11:48 [igt-dev] [PATCH i-g-t v2 0/3] Check for audio noise and pops Simon Ser
2019-06-04 11:48 ` [igt-dev] [PATCH i-g-t v2 1/3] lib/igt_audio: detect " Simon Ser
2019-06-04 12:52   ` Martin Peres
2019-06-04 11:48 ` [igt-dev] [PATCH i-g-t v2 2/3] lib/tests/igt_audio: add a pop test Simon Ser
2019-06-04 12:54   ` Martin Peres
2019-06-05  8:03     ` [igt-dev] [PATCH i-g-t v3] lib/tests/igt_audio: add a test holding a sample Simon Ser
2019-06-12 10:56       ` Martin Peres
2019-06-04 11:48 ` [igt-dev] [PATCH i-g-t v2 3/3] lib/tests/igt_audio: add phaseshift detection test Simon Ser
2019-06-04 13:01   ` Martin Peres [this message]
2019-06-04 12:23 ` [igt-dev] ✓ Fi.CI.BAT: success for Check for audio noise and pops Patchwork
2019-06-04 23:39 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-06-05 10:48 ` [igt-dev] ✓ Fi.CI.BAT: success for Check for audio noise and pops (rev2) Patchwork
2019-06-06 14:00 ` [igt-dev] ✓ Fi.CI.IGT: " 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=3ed8e628-a7cc-91fd-3715-082260a072de@linux.intel.com \
    --to=martin.peres@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=martin.peres@intel.com \
    --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