# Hybrid Encoding Scheme for AMBTC Compressed Images Using Ternary Representation Technique
## 3 Proposed Method  
The traditional AMBTC compression method uses the same number of bits to compress each block. However, coding in this way requires more bits than necessary for flat blocks and neglects too much image detail for complex blocks. [PERSON] et al.'s method improves AMBTC, resulting in better compression effects for both flat and complex blocks. However, in the processing of complex blocks, [PERSON] et al.'s method reconstructs the gray values of the image block by four quantized values. Although the quality of the reconstructed block is improved, it requires quantized values to be recorded and bitmaps with more bits. In addition, [PERSON] et al. adopt the traditional AMBTC method to compress the smooth blocks, which may increase the cost of recording bitmaps and quantized values.  
In this paper, we propose a more effective solution by classifying image blocks into flat, smooth, and complex blocks based on thresholds \(\tau_{0}\) and \(\tau_{1}\) (\(\tau_{0}\leq\tau_{1}\)). Let \(\Phi_{i}=\{a_{i},b_{i},B_{i}\}\) be the AMBTC codes of \(I_{i}\). If \(b_{i}-a_{i}\leq\tau_{0}\), \(I_{i}\) is classified as a flat block. Because pixel variations in a flat block are small, all pixels in a flat block can be simply reconstructed by their mean to a satisfactory visual quality. If \(\tau_{0}<b_{i}-a_{i}<\tau_{1}\), \(I_{i}\) is classified as a smooth block. For the smooth block, we use a clustering algorithm to obtain representative bitmaps, and the original bitmaps are replaced by the indices pointing to the obtained bitmap. The two quantized values are also adjusted to reduce the error caused by the bitmap replacement. If \(b_{i}-a_{i}\geq\tau_{1}\), \(I_{i}\) is classified as a complex block. We use three quantized values and a ternary map to represent the complex block to maintain better texture details. The encoding algorithms of these three types of blocks will be presented in the following sections.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Number of Groups** & **Compressed Code of \(I_{i}\)** & **Number of Bits** \\ \hline
1 & \(\{\langle 00_{2},\langle m\rangle_{2}\rangle\}\) & \(2+8\) \\ \hline
2 & \(\{01_{2},\langle a\rangle_{2},\langle b\rangle_{2},\langle b\rangle_{3}\}\) & \(2+8+R_{i}+n\times n\) \\ \hline
3 & \(\begin{array}{c}\{10_{2},\langle a_{i}^{\prime}\rangle_{2},\langle b_{i}^{ \prime}\rangle_{2},\langle b_{i}-a_{i}^{\prime}\rangle_{2},\langle b_{i}-b_{i}^{ \prime}\rangle_{2},\,B_{i},\,I_{i},\,B_{i}^{\prime}\}\text{ or }\\ \{\{10_{2},\langle a\rangle_{2},\langle a_{i}^{\prime}\rangle_{2},\langle b_{i}^{ \prime}\rangle_{2},\langle b_{i}^{\prime}\rangle_{2},B_{i},\,I_{i},\,B_{i}^{ \prime}\}\}\end{array}\) & \(2+8+2R_{i}+n\times n+1+P_{i}\) \\ \hline
4 & \(\{11_{2},\langle a_{i}^{\prime}\rangle_{2},\langle b_{i}^{\prime}-a_{i}^{ \prime}\rangle_{2},\langle a_{i}-b_{i}^{\prime}\rangle_{2},\langle b_{i}^{ \prime}\rangle_{2},\langle b_{i}^{\prime}\rangle_{2},B_{i}^{\prime},B_{i} \}\}\) & \(2+8+3R_{i}+2\times n\times n\) \\ \hline \hline \end{tabular}
\end{table}
Table 1: Number of bits required to record a compressed block.