@@ -796,38 +796,49 @@ __su_specttuner_feed_channel(
796796 self -> fft + window_size - (channel -> halfw - len ),
797797 (channel -> halfw - len ) * sizeof (SUCOMPLEX ));
798798
799+ if (channel -> params .domain == SU_SPECTTUNER_CHANNEL_TIME_DOMAIN ) {
799800 /*********************** Apply filter and scaling ************************/
800801#ifdef SU_SPECTTUNER_SQUARE_FILTER
801- for (i = 0 ; i < channel -> halfw ; ++ i )
802- channel -> fft [i ] *= channel -> k ;
802+ for (i = 0 ; i < channel -> halfw ; ++ i )
803+ channel -> fft [i ] *= channel -> k ;
803804
804- for (i = channel -> size - channel -> halfw ; i < channel -> size ; ++ i )
805- channel -> fft [i ] *= channel -> k ;
805+ for (i = channel -> size - channel -> halfw ; i < channel -> size ; ++ i )
806+ channel -> fft [i ] *= channel -> k ;
806807#else
807- for (i = 0 ; i < channel -> halfsz ; ++ i ) {
808- channel -> fft [i ] *= channel -> k * channel -> h [i ];
809- channel -> fft [channel -> size - i - 1 ] *=
810- channel -> k * channel -> h [window_size - i - 1 ];
811- }
808+ for (i = 0 ; i < channel -> halfsz ; ++ i ) {
809+ channel -> fft [i ] *= channel -> k * channel -> h [i ];
810+ channel -> fft [channel -> size - i - 1 ] *=
811+ channel -> k * channel -> h [window_size - i - 1 ];
812+ }
812813#endif
813- /************************* Back to time domain******************************/
814- if (channel -> params .domain == SU_SPECTTUNER_CHANNEL_FREQUENCY_DOMAIN ) {
814+ } else {
815815 /* Channel is defined in the frequency domain. This means that we
816816 do not need to perform get back to the time domain (hence we can
817817 go ahead and skip one IFFT completely) */
818818
819819 if (self -> state == SU_SPECTTUNER_STATE_EVEN ) {
820+ memcpy (
821+ channel -> fft + channel -> halfw ,
822+ channel -> fft + channel -> size - channel -> halfw ,
823+ channel -> halfw * sizeof (SUCOMPLEX ));
824+
825+ for (i = 0 ; i < channel -> width ; ++ i )
826+ channel -> fft [i ] *= channel -> k ;
827+
820828 curr = channel -> fft ;
829+
830+ printf ("Done, delivering %d/%d\n" , channel -> width , channel -> size );
821831 return (channel -> params .on_data )(
822832 channel ,
823833 channel -> params .privdata ,
824834 curr ,
825- channel -> size );
835+ channel -> width );
826836 } else {
827837 return SU_TRUE ;
828838 }
829839 }
830840
841+ /************************* Back to time domain******************************/
831842 SU_FFTW (_execute )(channel -> plan [self -> state ]);
832843
833844 curr = channel -> ifft [self -> state ];
0 commit comments