|
Test
Your EQ #145 Answer
|
Answer
8
One
clever trick is to repeat the bits you have as many times
as necessary to fill the output field width. For example,
if the 3-bit input value is ABC, the output value would
be ABCABCAB. This produces the following mapping, which
interpolates nicely between full black and full white.
|
Input |
Output |
|
000 |
00000000 |
|
001 |
00100100 |
|
010 |
01001001 |
|
011 |
01101101 |
|
100 |
10010010 |
|
101 |
10110110 |
|
110 |
11011011 |
|
111 |
11111111 |
Note that this mapping preserves the original bits; if
you want to go back to the 3-bit representation, just
take the MSBs and you have the original data.
Contributor:
Olli Niemitalo in the newsgroup comp.dsp
Published: August-2002