# Modified Joint Source-Channel Trellises for Transmitting JPEG Images over Wireless Networks
## 3 Construction of the Combined Source-Channel Trellis
### Tier 1: Combined VLC-FLC Trellis Encoder  
As done in Ref. [20], consider an (\(n\), \(k\)) random code with a parity-check matrix as follows:  
\[H=[h_{0}\quad h_{1}\quad\ldots\quad h_{n-1}] \tag{1}\]  
where \(h_{i},\ i=0,1,\ldots,n-1\) are column vectors of the parity-check matrix \(H\). In the trellis, a valid codeword \(c\) must satisfy the following constraint:  
\[s^{T}=Hc^{T}=c_{0}h_{0}+c_{1}h_{1}+\ldots+c_{n-1}h_{n-1}=0 \tag{2}\]  
To construct a trellis with the desired Hamming code, we employ the following formula:  
\[s=s^{\prime}+c_{i}h_{i} \tag{3}\]  
where \(s\) and \(s^{\prime}\) denote current state and next state, respectively. For example, consider a (7, 4) Hamming code with the parity-check matrix  
\[H=\begin{bmatrix}0&0&0&1&1&1&1\\ 0&1&1&0&0&1&1\\ 1&0&1&0&1&0&1\end{bmatrix}.\]  
The trellis for this code is depicted in Figure 2.  
In our two-tiered JSCC model, the first tier comprises variable-length codes (VLCs). VLCs can represent the same message as fixed-length codes (FLCs) but are highly sensitive to transmission errors. To address this shortcoming, we propose a modified BCJR decoding algorithm that is considerably more robust than hard-decision decoding techniques. We adopt a double trellis construction combining FLCs and VLCs depending on message length. Our VLC-FLC double trellis functions in the following manner: consider a typical trellis of VLCs and FLCs and a sequence of four source symbols represented by the equation \(u\) = (1, 4, 2, 3, 5). The VLC- and FLC sequences are (1) 000,10,001,01,11 with bit length \(n\) = 12, and (2) 000,011,001,010,100 with bit length \(n\) = 15. All sequences for this four-symbol message are illustrated in the block trellis in Figure 3, in which the right line represents bit 1, whereas the left line represents bit 0.  
Figure 1: (**a**) Diagram of the proposed JSCC structure; (**b**) block diagram of the transmission/receiver system.  
Next, consider a source that independently produces outputs selected from a codebook alphabet \(u=(A,B,C,D)\). A source sequence of length seven is mapped to a vector \(c\) of codewords taken from a VLC \(c\) for the symbol alphabet \(u\). For example, the symbol A is a septuple that defines the codewords as 1000110. The other symbols in \(u\) are also encoded as illustrated in Figure 4.  
The total bit length of the codeword \(c\) is denoted by \(n=k+m\). Every sequence consisting of \(k\) symbols and \(m\) parity bits can be graphically represented by the trellis structure depicted in Figure 5 for \(k=4\) and \(m=3\), where the length of the trellis represents time and the width of the trellis represents various states. The alphabet size of the source in Figure 5 is \(k=4\), and the codewords have a length of seven. A merging of the VLC  
Figure 3: Subset trellis of a (7, 4) Hamming code.  
Figure 2: (**a**) Trellis of a (7, 4) Hamming code; (**b**) visual representation of the connections between maximum state numbers.  
trellis and the expurgating block trellis is required in the design of the decoding algorithm. Figures 4 and 5 show the JSCC trellis structure.