# Bit reverse order Technique in FFT

Can anyone tell me how does bit reversal order technique works for FFT when you are trying to break down the FFT to small sizes. Like I want to only for the when the index is odd because that involve some reverse carry propagation, but when the index is even you just add N/2 to it to get your reverse index r. An example of N=8 would be perfect if someone can explain me.

• DX, you are asking many, very specific questions. You get good answers, and you NEVER accept any of the answers. Please play nicely with the many good answerers here and start accepting answers to your previous questions before asking any more questions (or expecting any answers!). – Peter K. Apr 23 '13 at 11:40
• I think i should leave this forum because no body answer properly they just copy paste it from google and never understand what i am asking. The things they tell me i already know them 95 % of times. Like for this question i am asking what is reverse carry propagation and matt keeps on telling me what i already know. Anyway thanks for your nice answers :) – D X Apr 23 '13 at 12:36
• Do not expect to get answers to questions you do not ask. Please update the question to ask for the specific information you're after. Please accept answers to questions that you've asked previously if you expect us to keep answering your questions. – Peter K. Apr 23 '13 at 12:56

If I understand your question correctly you want this (index | binary | bit rev. | bit rev. index):

$$0\quad 000\quad 000\quad 0\\ 1\quad 001\quad 100\quad 4\\ 2\quad 010\quad 010\quad 2\\ 3\quad 011\quad 110\quad 6\\ 4\quad 100\quad 001\quad 1\\ 5\quad 101\quad 101\quad 5\\ 6\quad 110\quad 011\quad 3\\ 7\quad 111\quad 111\quad 7\\$$

• Yeah right. Can you explain me for odd numbers how do you do it. For even numbers we just add N/2 and do it like r =r + N/2 where r is the reverse index. How to calculate it when we have odd number because it will involve some reverse carry propagation I don't understand this. – D X Apr 23 '13 at 9:31
• You simply swap the bits around. Bit reversal means mirror imaging your binary numbers. Some signal processors can do this in hardware. You probably need to do it in software. – Matt L. Apr 23 '13 at 9:34
• ok. But kindly give me an example because I am not understanding it. I have to implement it in C, so we don't have a swap function in C thats why. – D X Apr 23 '13 at 9:37
• I'm afraid you have to write this function yourself. You do have bitwise operations in C, so it's no big deal. – Matt L. Apr 23 '13 at 9:41
• Some good solutions here: graphics.stanford.edu/~seander/bithacks.html#BitReverseObvious – Paul R Apr 23 '13 at 9:52

To find the next bit-reversal address, you simply add N/2 to the present address, from left to right (not our usual right-to-left addition).

Consider the case as in the image given by Matt's answer, N = 8. that corresponds to 1000. Therefore, N/2 = 4 = 100.

Take first address, X = 000 | add N/2 => 100, ie bit_reverse address = 4 (100)

Now take new one, X = 100 | add N/2, be careful here.

You need to add from left-to-right, just opposite of what you normally do during addition.

address  1 0 0 +
N/2      1 0 0
------
result   0 1 0  ----> 2
carry    1 0 0


Now you continue this steps, and you will generate address like this, 0-->4-->2-->6-->1-->5-->3-->7.

Let's us do one more example. Suppose you reached bit-reversed address Y = 5. You need to find next address, simply add N/2 to that. (We know answer is 3).

address  1 0 1 +
N/2      1 0 0
------
result   0 1 1  ----> 3
carry    1 0 0


This is how you generate bit-reversed address.

• Thanks abid I understand it. I appreciate your effort in explaining everything to me. – D X Apr 24 '13 at 12:48
• Hey that’s great answer, it’s simplifying everything. But still the question is there any possible way to make that “left to right bit adding” in place, without loop, in C++? – pajczur Sep 19 '18 at 7:22

Assuming random memory access of all previously computed bit-reversal is possible, the following algorithm works, assuming N is power of 2: