Re: mbeq_119700 issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 03 Jan 2007 17:09:03 +0100Sebastian Schäfer <schaefer@xxxxxxx> wrote:
> I could locate the exact position where the plugin segfaults.> > This is the code surrounding it (the segfaulting command is underlined):> > ------------>       // Run the real->complex transform> #ifdef FFTW3>       // PERL_BEGIN>       fprintf(stderr, "*(real_L + input_buffer_pos)=%G\n",> (LADSPA_Data)(*(real_L + input_buffer_pos)));> >       fftwf_execute(plan_rc_L);> ===============================>       fprintf(stderr, "*(real_R + input_buffer_pos)=%G\n",> (LADSPA_Data)(*(real_R + input_buffer_pos)));> >       fftwf_execute(plan_rc_R);>       fprintf(stderr, "*(real_C + input_buffer_pos)=%G\n",> (LADSPA_Data)(*(real_C + input_buffer_pos)));> >       fftwf_execute(plan_rc_C);>       fprintf(stderr, "*(real_LFE + input_buffer_pos)=%G\n",> (LADSPA_Data)(*(real_LFE + input_buffer_pos)));> >       fftwf_execute(plan_rc_LFE);>       fprintf(stderr, "*(real_LS + input_buffer_pos)=%G\n",> (LADSPA_Data)(*(real_LS + input_buffer_pos)));> >       fftwf_execute(plan_rc_LS);>       fprintf(stderr, "*(real_RS + input_buffer_pos)=%G\n",> (LADSPA_Data)(*(real_RS + input_buffer_pos)));> >       fftwf_execute(plan_rc_RS);>       // PERL_END> #else> ----------> > It's located on line 1000 in mbeq_119700.c.before_PerlPreProcessor.> I hope this helps to find the error.> > Best regards,> Sebastian> 
Sebastian, I am not sure we are "on the same page".
Your Email apparently emphasizes the "fftwf_execute(plan_rc_L);"statement/line, you put '=' under it:
      fftwf_execute(plan_rc_L);===============================
- I guess that's what you meant using the "underlined" word.
And you're saying it's line #1000 in mbeq_119700.c.before_PerlPreProcessor,but in the latest version I've sent here is the context:
    962       // Run the real->complex transform    963 #ifdef FFTW3    964       // PERL_BEGIN    965       foreach my $suffix(@{$MBEQ::__config_hash{channel_suffixes}})    966         {    967         print <<EOD    968       //fprintf(stderr, "*(real$suffix + input_buffer_pos)=%G\\n", (LADSPA_Data)(*(real$suffix + input_buffer_pos)));    969    970       fftwf_execute(plan_rc$suffix);    971 EOD    972         ;    973         }    974       // PERL_END    975 #else    976       // PERL_BEGIN    977       foreach my $suffix(@{$MBEQ::__config_hash{channel_suffixes}})    978         {    979         print <<EOD    980       rfftw_one(plan_rc, real$suffix, comp$suffix);    981 EOD    982         ;    983         }    984       // PERL_END    985 #endif
, so I see the "fftwf_execute(plan_rc_L);" as
    970       fftwf_execute(plan_rc$suffix);
line, i.e. as line #970.
Are we talking about
   970       fftwf_execute(plan_rc$suffix);
line ?
Line #1000 is this:
   1000       fftw_real *comp_rp_ptr$suffix = comp$suffix + 1;
- it's just pointer arithmetic with no pointer dereferencing, soIMO line #1000 cannot segfault be definition.
OK, assuming we are talking about
    970       fftwf_execute(plan_rc$suffix);
- this is the moment of direct FFT.
At this time I can think of two things going wrong:
1) 'plan_rc$suffix' loses its value;2) there is misalignment in FFT buffers.
'plan_rc$suffix' is first getting its value here:
    538 #ifdef FFTW3    539   // PERL_BEGIN    540   foreach my $suffix(@{$MBEQ::__config_hash{channel_suffixes}})    541     {    542     print <<EOD    543   (*plugin_data).plan_rc$suffix = fftwf_plan_r2r_1d(fft_length, (*plugin_data).real$suffix, (*plugin_data).comp$suffix, FFTW_R2HC, FFTW_MEASURE);    544   (*plugin_data).plan_cr$suffix = fftwf_plan_r2r_1d(fft_length, (*plugin_data).comp$suffix, (*plugin_data).real$suffix, FFTW_HC2R, FFTW_MEASURE);    545 EOD    546     ;    547     }    548   // PERL_END    549 #else    550   (*plugin_data).plan_rc = rfftw_create_plan(fft_length, FFTW_REAL_TO_COMPLEX, FFTW_ESTIMATE);    551   (*plugin_data).plan_cr = rfftw_create_plan(fft_length, FFTW_COMPLEX_TO_REAL, FFTW_ESTIMATE);    552 #endif
, at line #543:
    543   (*plugin_data).plan_rc$suffix = fftwf_plan_r2r_1d(fft_length, (*plugin_data).real$suffix, (*plugin_data).comp$suffix, FFTW_R2HC, FFTW_MEASURE);.
So, could you please rewrite the piece more or less top look like this (untested):
#ifdef FFTW3  // PERL_BEGIN  foreach my $suffix(@{$MBEQ::__config_hash{channel_suffixes}})    {    print <<EOD  (*plugin_data).plan_rc$suffix = fftwf_plan_r2r_1d(fft_length, (*plugin_data).real$suffix, (*plugin_data).comp$suffix, FFTW_R2HC, FFTW_MEASURE);  fprintf(stderr, "just after plan calculation: (*plugin_data).plan_rc$suffix=%08lx at line number %d\\n", (unsigned)(*plugin_data).plan_rc$suffix, __LINE__);  (*plugin_data).plan_cr$suffix = fftwf_plan_r2r_1d(fft_length, (*plugin_data).comp$suffix, (*plugin_data).real$suffix, FFTW_HC2R, FFTW_MEASURE);EOD    ;    }  // PERL_END#else  (*plugin_data).plan_rc = rfftw_create_plan(fft_length, FFTW_REAL_TO_COMPLEX, FFTW_ESTIMATE);  (*plugin_data).plan_cr = rfftw_create_plan(fft_length, FFTW_COMPLEX_TO_REAL, FFTW_ESTIMATE);#endif
- please pay attention to the newly added
  fprint(stderr, "just after plan calculation: (*plugin_data).plan_rc$suffix=%08lx at line number %d\\n", (unsigned)(*plugin_data).plan_rc$suffix, __LINE__);
line which is supposed to print in hex the address pointed toby'(*plugin_data).plan_rc$suffix' just after FFTW plan generation.


Likewise, could you please modify the vicinity of line #970 to look like this (untested):
#ifdef FFTW3      // PERL_BEGIN      foreach my $suffix(@{$MBEQ::__config_hash{channel_suffixes}})        {        print <<EOD      //fprintf(stderr, "*(real$suffix + input_buffer_pos)=%G\\n", (LADSPA_Data)(*(real$suffix + input_buffer_pos)));      fprintf(stderr, "just before using the plan: plan_rc$suffix=%08lx at line number %d\\n", (unsigned)plan_rc$suffix, __LINE__);      fftwf_execute(plan_rc$suffix);EOD        ;        }      // PERL_END#else      // PERL_BEGIN      foreach my $suffix(@{$MBEQ::__config_hash{channel_suffixes}})        {        print <<EOD      rfftw_one(plan_rc, real$suffix, comp$suffix);EOD        ;        }      // PERL_END#endif
- please pay attention to the newly added
      fprintf(stderr, "just before using the plan: plan_rc$suffix=%08lx at line number %d\\n", (unsigned)plan_rc$suffix, __LINE__);
line - the same intent, the addresses pointed to by 'plan_rc$suffix' and byearlier mentioned '(*plugin_data).plan_rc$suffix' should be the same.

Let's also check the alignment issue.
The buffer in question is '(*plugin_data).comp$suffix', it is allocated here:
    527   CALLOC_AND_CHECK(fftw_real *, (*plugin_data).comp$suffix, fft_length, sizeof(fftw_real), __LINE__).Could you please add just after line #527 this (untested):
  fprintf(stderr, "just after allocation (*plugin_data).comp$suffix=%08lx at line number %d\\n", (unsigned)(*plugin_data).comp$suffix, __LINE__);
The intent is to see the address pointed to by '(*plugin_data).comp$suffix'in hex, and if the last digit is 0, i.e. if the address is a multiple of16 decimal == 10 hexadecimal, then we are OK.
If not, I'll use a different allocation routine which guarantees properalignment.
Interestingly enough, FFTW3 documentation does not insist on this alignmentit just says that for better performance one needs this alignment and withoutit there will be no performance gain.
But I've noticed strange things with SSE in case of misaligned data, andsometimes there were crashes.
...
Anyway, could you please post the output of 'gcc -v' command ?
Regards,  Sergei.

-- Visit my http://appsfromscratch.berlios.de/ open source project.
-------------------------------------------------------------------------Take Surveys. Earn Cash. Influence the Future of ITJoin SourceForge.net's Techsay panel and you'll get the chance to share youropinions on IT & business topics through brief surveys - and earn cashhttp://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________Alsa-user mailing listAlsa-user@xxxxxxxxxxxxxxxxxxxxxxxxxx://lists.sourceforge.net/lists/listinfo/alsa-user

[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux