sox-devel@lists.sourceforge.net unofficial mirror
 help / color / mirror / code / Atom feed
From: Martin Guy <martinwguy@gmail.com>
To: sox-devel@lists.sourceforge.net
Subject: Re: sox spectrogram patches
Date: Sat, 26 Dec 2015 23:14:52 +0100	[thread overview]
Message-ID: <CAL4-wQqRq+_9M0_Urebazf555N-DcKO=8QcVX5PMA99+c_Nj4A@mail.gmail.com> (raw)
In-Reply-To: <20151226211813.GA13684@dcvr.yhbt.net>

On 26/12/2015, Eric Wong <normalperson@yhbt.net> wrote:
> --- a/src/spectrogram.c
> +++ b/src/spectrogram.c
> @@ -70,7 +70,11 @@ typedef struct {
>    sox_bool   using_stdout; /* output image to stdout */
>
>    /* Shared work area */
> +#if HAVE_FFTW
> +  fftw_plan  fftw_plan;		/* Used if FFT_type == FFT_fftw */
> +#else
>    double     * shared, * * shared_ptr;
> +#endif
>
>    /* Per-channel work area */
>    int        WORK;  /* Start of work area is marked by this dummy variable.
> */
> @@ -84,9 +88,6 @@ typedef struct {
>    double     block_norm, max;
>    double     * magnitudes;	/* [(dft_size / 2) + 1] */
>    float      * dBfs;
> -#if HAVE_FFTW
> -  fftw_plan  fftw_plan;		/* Used if FFT_type == FFT_fftw */
> -#endif
>  } priv_t;
>
>  #define secs(cols) \
> +  /* We have one FFT plan per flow because the input/output arrays differ.
> */
> +  p->fftw_plan = fftw_plan_r2r_1d(p->dft_size, p->dft_buf, p->dft_buf,
> +                      FFTW_R2HC, FFTW_MEASURE);
> +}

This may not be right. FFTW3 plans depend on the memory addresses of
the input and output vectors, so if you have two FFTs that are exactly
the same except for the input and output buffer addresses, they need
separate plans.
In this case, the plan depends on dft_buf, which seems to be specific
to each flow, so I think you should have a separare plan for each
flow.

I don't know what "shared" is used for, so I just left it alone. AFter
all, it's ore important that the code work, than to save four bytes of
RAM and risk breaking it...

By the way, that "/* Used if FFT_type == FFT_fftw */" comment is
stale, dating back to when I had an option to choose the FFT algorithm
at runtime - sorry about that...

Thanks

    M

------------------------------------------------------------------------------

  reply	other threads:[~2015-12-26 22:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-26  1:23 sox spectrogram patches Martin Guy
2015-12-26 10:43 ` Eric Wong
2015-12-26 13:37   ` Martin Guy
2015-12-26 21:18     ` Eric Wong
2015-12-26 22:14       ` Martin Guy [this message]
2015-12-26 23:15         ` Eric Wong
2015-12-28 22:11       ` Måns Rullgård
2015-12-29 22:26         ` Eric Wong

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-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.sourceforge.net/lists/listinfo/sox-devel

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAL4-wQqRq+_9M0_Urebazf555N-DcKO=8QcVX5PMA99+c_Nj4A@mail.gmail.com' \
    --to=sox-devel@lists.sourceforge.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/sox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).