Bugs item #3594822, was opened at 2012-12-11 08:50
Message generated for change (Settings changed) made by uklauer
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=110706&aid=3594822&group_id=10706

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: MrMod (tschmula)
Assigned to: Nobody/Anonymous (nobody)
Summary: Same bug as 3592482 also found in dft_filter and tempo

Initial Comment:
Today I tried a different upconversion method and found the same hang condition 
when using the sinc filter. To reproduce:
SoX -V -S -r 192000 -b 24 -n -n synth 3:15:00 pinknoise sinc -a 40 -t 8k -24k

So, I searched through all the SoX code and found the same bug as 3592482 in 
the dft_filter.c and tempo.c files.  Here is the patch file I used to fix my 
version:
*** sox-14.4.0/src/dft_filter.c Wed Mar  2 19:47:52 2011
--- sox-14.4.0-update/src/dft_filter.c  Tue Dec 11 11:25:29 2012
***************
*** 108,114 ****
    size_t remaining = samples_out - p->samples_out;
    double * buff = lsx_calloc(1024, sizeof(*buff));
  
!   if ((int)remaining > 0) {
      while ((size_t)fifo_occupancy(&p->output_fifo) < remaining) {
        fifo_write(&p->input_fifo, 1024, buff);
        p->samples_in += 1024;
--- 108,114 ----
    size_t remaining = samples_out - p->samples_out;
    double * buff = lsx_calloc(1024, sizeof(*buff));
  
!   if (samples_out > p->samples_out) {
      while ((size_t)fifo_occupancy(&p->output_fifo) < remaining) {
        fifo_write(&p->input_fifo, 1024, buff);
        p->samples_in += 1024;
*** sox-14.4.0/src/tempo.c      Sat Jan 21 16:33:13 2012
--- sox-14.4.0-update/src/tempo.c       Tue Dec 11 11:34:31 2012
***************
*** 151,162 ****
    size_t remaining = samples_out - t->samples_out;
    float * buff = lsx_calloc(128 * t->channels, sizeof(*buff));
  
!   if ((int)remaining > 0) {
      while (fifo_occupancy(&t->output_fifo) < remaining) {
        tempo_input(t, buff, (size_t) 128);
        tempo_process(t);
      }
!     fifo_trim_to(&t->output_fifo, remaining);
      t->samples_in = 0;
    }
    free(buff);
--- 151,162 ----
    size_t remaining = samples_out - t->samples_out;
    float * buff = lsx_calloc(128 * t->channels, sizeof(*buff));
  
!   if (samples_out > t->samples_out) {
      while (fifo_occupancy(&t->output_fifo) < remaining) {
        tempo_input(t, buff, (size_t) 128);
        tempo_process(t);
      }
!     fifo_trim_to(&t->output_fifo, (int)remaining);
      t->samples_in = 0;
    }
    free(buff);

The tempo.c patch also includes the (int)remaining cast for the fifo_trim_to 
function.

Sincerely,
MrMod

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

Comment By: Ulrich Klauer (uklauer)
Date: 2013-01-12 22:24

Message:
The dft_filter/sinc issue was actually already fixed in master. :) I've
just backported the fix to dot.
Going to fix tempo, too.

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

Comment By: MrMod (tschmula)
Date: 2012-12-11 09:02

Message:
This line should also be updated to remain consistent:
while (fifo_occupancy(&t->output_fifo) < remaining) {
to:
while ((size_t)fifo_occupancy(&t->output_fifo) < remaining) {

Sorry I missed that for my initial post.

-MrMod

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=110706&aid=3594822&group_id=10706

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
_______________________________________________
SoX-devel mailing list
SoX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-devel

Reply via email to