From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Martin Guy Newsgroups: gmane.comp.audio.sox.devel Subject: Re: sox spectrogram patches Date: Sat, 26 Dec 2015 23:14:52 +0100 Message-ID: References: <20151226104316.GA5868@dcvr.yhbt.net> <20151226211813.GA13684@dcvr.yhbt.net> Reply-To: sox-devel@lists.sourceforge.net NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1451168123 22931 80.91.229.3 (26 Dec 2015 22:15:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 26 Dec 2015 22:15:23 +0000 (UTC) To: sox-devel@lists.sourceforge.net Original-X-From: sox-devel-bounces@lists.sourceforge.net Sat Dec 26 23:15:19 2015 Return-path: Envelope-to: gcasd-sox-devel@m.gmane.org Received-SPF: pass (sog-mx-4.v43.ch3.sourceforge.com: domain of gmail.com designates 74.125.82.50 as permitted sender) client-ip=74.125.82.50; envelope-from=martinwguy@gmail.com; helo=mail-wm0-f50.google.com; X-Received: by 10.28.170.66 with SMTP id t63mr50082075wme.40.1451168093607; Sat, 26 Dec 2015 14:14:53 -0800 (PST) In-Reply-To: <20151226211813.GA13684@dcvr.yhbt.net> X-Spam-Score: -1.6 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (martinwguy[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-Headers-End: 1aCx75-0000Vb-LF X-BeenThere: sox-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: sox-devel-bounces@lists.sourceforge.net Xref: news.gmane.org gmane.comp.audio.sox.devel:458 Archived-At: Received: from lists.sourceforge.net ([216.34.181.88]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aCx7O-0002tf-1L for gcasd-sox-devel@m.gmane.org; Sat, 26 Dec 2015 23:15:18 +0100 Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1aCx78-0001D0-L5; Sat, 26 Dec 2015 22:15:02 +0000 Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1aCx76-0001Cu-Ed for sox-devel@lists.sourceforge.net; Sat, 26 Dec 2015 22:15:00 +0000 Received: from mail-wm0-f50.google.com ([74.125.82.50]) by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1aCx75-0000Vb-LF for sox-devel@lists.sourceforge.net; Sat, 26 Dec 2015 22:15:00 +0000 Received: by mail-wm0-f50.google.com with SMTP id l126so233695181wml.1 for ; Sat, 26 Dec 2015 14:14:59 -0800 (PST) Received: by 10.27.144.195 with HTTP; Sat, 26 Dec 2015 14:14:52 -0800 (PST) On 26/12/2015, Eric Wong 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 ------------------------------------------------------------------------------