1. allocate a 2nd buffer if you don't have it.

2. You can calculate the size of the 2nd buffer by multiplying the orig size by 3/4 (round up as you may have partial bits)

3. Do you have 4 of A, 4 bits of G, 4 bits of B, etc. or it is 4 bits per pixel total ?

In either case use shifts (<<) and & to rearrange the layout byte by byte.

If you explain what you mean (Item 3) then I or others can give you the exact shifts etc. required