コード例 #1
0
ファイル: FFT.cs プロジェクト: dyg540/hexlight-gui
        /*private uint ReverseBits(uint x)
         * {
         *  //uses the SWAR algorithm for bit reversal of 16bits
         *  x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1));
         *  x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2));
         *  x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4));	//8bits
         *
         *  //uncomment for 9 bit reversal
         *  //x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8));	//16bits
         *  //push us back down into 9 bits
         *  //return (x >> (16-9) & 0x000001ff;
         *
         *  return x;
         * }*/

        private void ApplyWindow(ref float[] samples)
        {
            Window window;

            switch (WindowingFunction)
            {
            case WindowingFunction.Hamming:
                window = new Window.Hamming();
                break;

            default:
                window = new Window.Boxcar();
                break;
            }
            window.Apply(ref samples);
        }
コード例 #2
0
ファイル: FFT.cs プロジェクト: jorticus/hexlight-gui
        /*private uint ReverseBits(uint x)
        {
            //uses the SWAR algorithm for bit reversal of 16bits
            x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1));
            x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2));
            x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4));	//8bits

            //uncomment for 9 bit reversal
            //x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8));	//16bits
            //push us back down into 9 bits
            //return (x >> (16-9) & 0x000001ff;

            return x;
        }*/
        private void ApplyWindow(ref float[] samples)
        {
            Window window;
            switch (WindowingFunction)
            {
                case WindowingFunction.Hamming:
                    window = new Window.Hamming();
                    break;
                default:
                    window = new Window.Boxcar();
                    break;
            }
            window.Apply(ref samples);
        }