## 4 System Architecture and Performance Analysis
### Reference High-rate Modulation Scheme
#### 4.1.2 DS8-PSK Decoder  
At a given sampling time, the Rx camera simultaneously captures two groups of light sources in an image. Each LED group in an image will form a discrete waveform, comprising eight \"1\" or \"0\" states. Each set of states is called S_Phase. On the basis of the dimming levels enabled by DS8-PSK, seven tables can be formed for decoding at seven corresponding dimming levels. In the first step of the process of decoding a DS8-PSK waveform, the S_Phase value should be selected from the proper S_Phase decoding table, as presented in Table 2. In the next step, the spatial phase value (S_Phase_Shift) can be calculated based on the S_Phase value of the reference LED group and the S_Phase value of the data LED group. Equation (8) shows how to calculate the S_Phase_Shift value, and Figure 4 shows an example of how to determine S_Phase_Shift. When the S_Phase_Shift value is detected, the data bits can be decoded inversely using the mapping table, which is presented in Table 1.  
\[S\_Phase\_Shift=S\_Phase_{data}-S\_Phase_{reference}. \tag{8}\]  
However, there is still a probability that the Rx camera may capture an unclear state of an LED waveform, which is called bad sampling. Figure 5 illustrates the bad sampling issue which occurs when the Rx camera captures at a transition time of an LED. In [27], we denote these unclear states as \"x\" states, which will take a value between zero and one. From that, we can also re-define the S_Phase value for all bad-sampling cases corresponding to each dimming level, as described in Table 3.  
\begin{table}
\begin{tabular}{c c} \hline
**3 bits Input** & **S\_Phase\_Shift(T/8) Output** \\ \hline
000 & 0 \\
001 & 1 \\
010 & 2 \\
011 & 3 \\
100 & 4 \\
101 & 5 \\
110 & 6 \\
111 & 7 \\ \hline \end{tabular}
\end{table}
Table 1: Mapping table from bits to S_Phase_Shift value (Adapted from [30]).  
\begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline \multicolumn{8}{c}{**8 States Input**} \\ \hline
**Dimming** & **Dimming** & **Dimming** & **Dimming** & **Dimming** & **Dimming** & **Dimming** & **Dimming** & **S\_Phase** **Output** \\
**1/8** & **2/8** & **3/8** & **4/8** & **5/8** & **6/8** & **7/8** & **8** & **S\_Phase** **Output** \\ \hline
10000000 & 10000001 & 10000011 & 10000111 & 10001111 & 1001111 & 1011111 & 1011111 & 1 \\
01000000 & 110000001 & 110000001 & 11000011 & 11000111 & 11001111 & 11011111 & 2 \\
00100000 & 01100000 & 11100000 & 11100001 & 11100011 & 1110011 & 11100111 & 3 \\
00010000 & 00110000 & 01110000 & 11110000 & 11110001 & 1110011 & 1110111 & 4 \\
00001000 & 0011000 & 00111000 & 01111000 & 11111000 & 1111001 & 1111011 & 5 \\
00000100 & 00001100 & 00011100 & 00111100 & 01111100 & 1111100 & 1111101 & 6 \\
0000010 & 00000110 & 00001110 & 00011110 & 0011110 & 0111110 & 1111110 & 7 \\
0000001 & 00000011 & 00000111 & 00001111 & 00011111 & 00111111 & 0111111 & 8 \\ \hline \hline \end{tabular}
\end{table}
Table 2: S_Phase value definition for the captured set of binary LED group states under dimming condition (Adapted from [30]).  
Figure 4: An illustration of sampling DS8-PSK waveform and calculate S_Phase_Shift with dimming level = 4/8 (50%).  
Figure 5: An illustration of bad-sampling issues on the receiver (Rx) camera and the set of LED group states including unclear LED states (dimming level = 4/8).