# Modified Joint Source-Channel Trellises for Transmitting JPEG Images over Wireless Networks
## 3 Construction of the Combined Source-Channel Trellis
### Tier 2: Modified Nonlinear Block Code Decoder Trellis  
The next phase of the experiment involved constructing a joint source-channel decoding model based on a bit-level trellis in two parts: the VLC source and the linear block channel code. The procedure for constructing the VLC source trellis comprised the following steps: first, in the encoder, the serial VLC trellis and the trellis of block code were combined and treated as one bit sequence, then merged to create a joint trellis with compound states. Second, the modified BCJR bit-level a posteriori probability decoding algorithm was applied to this trellis to enable a joint iterative decoding approach with bit-level soft outputs. The joint trellis code offers two advantages: first, it provides a maximum a posteriori probability (MAP) algorithm for the bit stream level; second, it performs iteration decoding featuring linear block codes for each trellis section. Each path through the trellis represents a specific watermarked message. Third, we ran a Viterbi decoder to determine the optimal path with the highest correlation with the detected sequence,  
Figure 4: Tree representation of the joint source–channel coding of the trellis. Figure 5: Trellis with combined source–channel coding. represented by the sequence \(y=\{y_{1},\ldots,y_{L}\}\). Finally, the message sequence was identified from this optimal message codeword. Once the combined trellis was complete, we constructed a trellis code to test the ability of the trellis to transmit an image without loss of information, as illustrated in Figures 2 and 3. In these figures, each path through the trellis represents a specific message. Because two arcs exit each node, \(2^{L}\) possible paths exist for a message \(M\) with length \(L\), ensuring the system encodes \(L\) bits. Linear block codes and convolutional codes have a natural trellis structure in which every path represents a codeword. In such a structure, \(S=\{s_{1},\ldots,s_{L}\}\) represents one state sequence in a trellis \(T\) with \(L\) sections. In a \(k\)th trellis section, the system encodes linear block codes at a bandwidth rate of k/\(n\) to prepare the data for transmission. Next, data is packetized as a codeword \(w_{k}\) of \(n\) bits, where \(w_{k}=(c_{k,1},c_{k,2},\ldots,c_{k,n})\) represents a codeword sequence of \(n\) code bits per codeword block at time \(k\) with each bit \(c_{k,i}\in\{-1,1\}\) and with \(y\) as the vector over a wireless fading channel. Once the data has been packetized, a Viterbi algorithm is employed to maximize the probability of correct decoding. When the sequence \(S\) is equally distributed, the Viterbi algorithm is equivalent to a maximum likelihood (ML) criterion. As demonstrated in [21], by generalizing the Viterbi algorithm, we obtain  
\[P(S|y)=\frac{P(y,S)}{P(y)}=P(S)\frac{P(y|S)}{P(y)} \tag{4}\]  
where \(P(y)\) denotes a total probability such that  
\[ \begin{split} argmax_{S}P(S|y)&=argmax_{S}P(y|S)P( S)\\ &=argmax\left(ln\big{(}\prod\limits_{k=1}^{L}P(y_{k}|s_{k-1},s_{ k})P(s_{k-1}|s_{k})\big{)}\right)\\ &=argmax\left(ln\big{\prod\limits_{k=1}^{L}P(y_{k}|s_{k-1},s_{k} )+ln\prod\limits_{k=1}^{L}P(s_{k-1}|s_{k})\right)\\ &=argmax(ln\prod\limits_{k=1}^{L}\prod\limits_{i=1}^{2n-1}P(y_{ k,i}|s_{k-1},s_{k})+ln\prod\limits_{k=1}^{L}P(s_{k-1}|s_{k}))\\ &=argmax\Big{(}\sum_{k=1}^{L}\Big{(}\sum_{i=1}^{2n-1}ln\big{(}P( y_{k,i}|s_{k-1},s_{k})\big{)}+ln\big{(}P(s_{k-1}|s_{k})\big{)}\Big{)}\end{split}  \tag{5}\]  
The Viterbi algorithm is the most efficient method to determine an optimal state sequence \(S^{*}\) or an equivalent optimal path with respect to the maximum likelihood criterion.