Color image compression based on spatial and magnitude signal decomposition

Received Dec 21, 2020 Revised Mar 3, 2021 Accepted Mar 15, 2021 In this paper, a simple color image compression system has been proposed using image signal decomposition. Where, the RGB image color band is converted to the less correlated YUV color model and the pixel value (magnitude) in each band is decomposed into 2-values; most and least significant. According to the importance of the most significant value (MSV) that influenced by any simply modification happened, an adaptive lossless image compression system is proposed using bit plane (BP) slicing, delta pulse code modulation (Delta PCM), adaptive quadtree (QT) partitioning followed by an adaptive shift encoder. On the other hand, a lossy compression system is introduced to handle the least significant value (LSV), it is based on an adaptive, error bounded coding system, and it uses the DCT compression scheme. The performance of the developed compression system was analyzed and compared with those attained from the universal standard JPEG, and the results of applying the proposed system indicated its performance is comparable or better than that of the JPEG standards.


INTRODUCTION
Compression is a key mechanism applied in signal processing and has large significance because huge amounts of data are commonly transferred over a communication channel of a network [1]. Image compression (IC) is one of the techniques lay under image processing. It has many applications and plays an important role in the efficient transmission and storage of images. IC is a method used for reducing the size of the digital image in order to minimize the amount of space required to store it [1]. The two fundamental elements of compression are redundancy and irrelevancy reduction. Redundancy reduction aims to remove the duplication from the signal source (image/video). Irrelevancy reduction omits parts of the signal that will not be noticed by the signal receiver namely the human visual system (HVS) [2], [3]. According to the differences between the original image (uncompressed) and the reconstructed (decompressed) image, image compression is classified into lossless, exact retrieval, and lossy, approximate retrieval [4]- [7]. Signal decomposition is the extraction and separation of signal components from composite signals, which should preferably be related to semantic units. One important role of signal decomposition is improving the performance of compression algorithms [8]. IC techniques still experiencing many improvements under the discipline of transform coding. The transform coding schemes achieve higher compression ratios for lossy compression, but it suffers from some artifacts at high-compression ratios [9]. Discrete cosine transform  [10], it had an advantage in potential smaller dimension, better processing time, and compatibility with encoded data [11], its selection as the standard for joint photographic experts group (JPEG) is one of the major reasons for its popularity [12]. DCT helps to separate the image parts with respect to the image visual quality (i.e., high, low & middle-frequency components) [11], [13]. JPEG 2000 is an image coding algorithm; it is a modified variant of JPEG that uses a discrete wavelet transform (DWT) instead of DCT [10].
The main application of wavelet theory lies in the design of filters for sub-band coding. The basic concept behind the wavelet transform is the hierarchical decomposition of input image signal into a series of successively lower resolution reference signals and their associated detail signals [14]. Bit plane (BP) slicing is a simple and fast technique that highlights the contribution made by a specific bit and each biplane is a binary image [15]. It is a separations technique in which the image is sliced into different binary planes or layers according to bit position that efficiently analyzing the relative importance played by each bit of the image [16], [17], Al-Mahmood and Al-Rubaye [16], combined between bit plane slicing and adaptive predictive coding for lossless compression of natural and medical images, they utilized the spatial domain efficiently after discarding the lowest order bits namely, exploiting only the highest order bits in which the most significant bit corresponds to the last layer7 used adaptive predictive coding, while the other layers used run-length coding. Albahadily et al. [18], presented lossless grayscale image compression using the bit plane technique and modified run-length encoding (RLE). Al-Timimi [19] introduced a hybrid technique for lossless image compression of natural and medical images; it is based on integrating the bit plane slicing and Wavelet transform along with a mixed polynomial of the linear and nonlinear base. Many research groups have developed different image-coding schemes and tried to modify these schemes to further reduce bit rate [20].
The main problem is the need for reducing the size of the digital image in order to minimize; i) the amount of space required to store it, ii) the cost and time required to transfer it over the internet. Generally, spatial domain refers to the aggregate of pixels composing an image, so a digital color image consists of 3spatial bands (red, green, and blue), each band pixel is represented using 8-bits (1 byte). Therefore, this paper's target is to improve the image compression system using spatial signal magnitude (value) decomposition and transform coding supported by an efficient entropy encoder. Where each image pixels decomposed into 2-values; most and least significant. According to the importance of the most significant value (MSV) that is influenced by any simple modification happened, an adaptive lossless image compression system has been proposed based on BP slicing, delta pulse code modulation, adaptive quadtree (QT) partitioning followed by an adaptive shift encoder. On another hand, the lossy compression system has been designed to handle the least significant value (LSV) based on an adaptive, error bounded, DCT based compression system. So, that the main contribution of this work is to improve an image compression system that utilizes the signal decomposition, where the proposed system is composed of two subsystems: lossless that compressed the MSV and lossy that compressed the LSV; the rest of the paper is structured as: Section 2 is dedicated to explaining the proposed compression system and method. The established proposed system is tested using some commonly used images, and the test results are discussed in section 3, finally, section 4 concludes the contribution of this paper.

THE PROPOSED SYSTEM AND METHOD
The proposed compression system consists of three main consecutive steps; where the layout of the proposed compression system illustrated in Figure

Lossless MSV encoder (LMSVE)
In this section, LMSVE has received the MSV 2-dimensional arrays for Y, U, and V bands, as illustrated in Figure 2. LMSVE consists of the following processes:

Value separation
The task of this process is to isolate MSV into two positive and negative matrices, PMSV and NMSV respectively, to facilitate the coding process, in case of negative values occurrences NMSV will be discarded. The constructed matrices will be passed to the next process (BP slicing).

Bit plan slicing (BPS)
The minimum number of bits required to code 2 n distinct quantities is n, each bit represented in a layer so there are n-1 bit layers to represent 2 n positive distinct quantities. While the adopted layered representation of the negative -2 m was m bit layers the m layer represent the sign bit. The first step applied in this process is the number base conversion, so the decimal positive or negative number converted to its binary equivalent. Later each bit is split to its corresponding layer number. When the layer is empty from 1's (all the content is 0's), it is marked as an empty to avoid encoding and gain storage space.

Delta pulse code modulation (Delta PCM)
Delta PCM is a special case from differential pulse code modulation applied to the sequence that consists of 0 or 1 values. It detects a change in the value from zero to one and vice versa (edges). The benefits of this process are to reduce the crowded bit plane and to make the bit plane closer to a sparse matrix. That increases the empty regions and facilitates the quadtree partitioning in the next process. The direction of calculating the delta must be zig-zag (inverted from line-to-line) as shown in Figure 3. Figure 3 (a) illustrates the direction, while Figure 3(b) explains the way of calculating the delta PCM for 3x3 window. So, Delta PCM will be applied to all non-blank plans that go through this process, in addition to counting the number of 1's in each resulted delta bitplane.

Adaptive quad tree
It is well known that the purpose of using a quadtree with compression is to isolate empty areas in digital images and avoid encoding and storing them. To be a useful QT it must start with a block size appropriate to the size of the empty areas in the image, to avoid continuous division in the case of small areas or miss them in the case of large areas. Equations (3) and (4) are used to regulate the initial block size selected for the QT partitioning. The regulation is done using the rate of 1's that occurred in the entered delta bitplane see equations. The inputs to this process are delta bitplanes corresponding with each one the sum of all non-zero values (count the number of 1's) resulted from the previous process. The output from this process is the buffer of non-empty (2x2) blocks (i.e. series of 1 or 0 bits) beside the QT partitioning sequence for each entered delta bitplane.
Where: = Referred to the entered delta bitplane x, y = is the row and column index of the delta bitplane respectively h, w = is the height and width of the delta bitplane respectively B_S = is the Initial block size used in QT = is real increment {0.2,0.3}

Adaptive shift encoder
This process is responsible for performing the final step of the lossless MSV encoder (LMSVE), by encoding the resulted data from the previous step (buffers and partitioning sequences). An adaptive shift optimizer is the first process that must perform before applying the shift encoding. The following steps summarize the shift coding optimizer and an adaptive shift coding process (steps 1, 2, 3 belongs to the shift coding optimizer): Step 1: convert each adjacent 4-bits from the buffer to its decimal equivalents and this process is applied to all bits in the buffer and store the results in a 1-d integer number entitled NUM(), so the range of the value in the buffer is [1]- [15]. − Step 2: compute the histogram for NUM(), and apply the histogram packing, so the new histogram includes only the non-zero occurrences number entitled Ph(). − Step 3: compute the following equations: = ℎ(12) + ℎ(13) + ℎ(14) (9) 9 = ℎ(9) + ℎ(10) + ℎ(11) + = ℎ(10) + ℎ(11) + Compute the total required bits (Tb) for the following possible shift coding combinations: The number of bits NB (codeword length) required to store each value from NUM() is determined according to the following equations which are all relative to the sequence of shift coding: Where Val is the integer value stored in NUM(). For more illustration about the behaviour of the four shifts coding schemes adopted in this paper, Figure 4 selected (18) to determine how many bits need to encode each Val, where NB is the number of bits required. The steps from 1 to 4 are applied on the buffer but the QT partitioning sequence compressed using traditional shift coding after collecting each adjacent 8-bits.

Lossy LSV encoder (LLSVE)
In this section, LLSVE has received the LSV 2-dimensional arrays for Y, U, and V bands, as illustrated in Figure 5. LLSVE consists of the following processes:

Band partitioning
This process is responsible for dividing the received LSV 2-D array into non overlapped blocks of size n (BLK nxn), to perform the following processes on blocks level.

DCT transform
For all block entry apply the well-known DCT transform [21], to separate the block into parts with respect to the importance i.e., high, low & middle-frequency components.

Quantization
This process is responsible for increase the compression gain by eliminating insignificant data. Due to the distinct importance of the DCT coefficients, ununiformed scaler quantization had been applied according by (21), (22) Where: = is the DCT coefficients of the block indexed i, j = is the quantized DCT coefficients of the block indexed i, j i, j = is the upper left corner index of the block, started at row i, and column j n = is the size of the block = is the quantization matrix relative to each DCT block coefficients q = is the quantization value of the DC coefficient that set to 2n 0 = is the quantization value of the AC coefficient ∈ {2,3} = is the scaling factor ∈{0.1,0.12,...,0.2}

Insulation window
It is known that the large and effective values of the DCT coefficients' are centered in the northern left quarter of the block, so to improve the shift encoder and increase the compression gain, the large value coefficients will be moved to their own buffer. This process is done by opening a window with a size of (m x m), m is an integer ranged [10..16] relative to the block size (n), that started in the upper left corner of the block and checks each quantized DCT coefficient's if they are greater than S (i.e., a predefined value) they will be isolated to buffer. All the quantized DCT coefficient blocks will be passed through the insolation window according to algorithm (1) steps in Figure 6.

Zigzag arrangement
This process is applied to convert the DCT coefficient blocks from 2-d arrays to one dimension buffer, to increase the benefit of spatial correlation as illustrated in Figure 7

Map to positive
The 1-d buffer of all the quantized DCT coefficients' after separating the highest values from it will pass to this process, which responsible for converting all the numbers to positive to avoid coding complexity according by (23) [24,25]: Where, Xi is the i th element value registered in the buffer.

Shift encoder
This process will receive the three buffers: Vbuf ( ) which contains the highest quantized DCT coefficients' with their masks buffer (Vmask ( )) that's need to recombine the values and the lowest quantized DCT coefficients' after converted to positive (buf"()). Due to that separation, the shift encoder will process each buffer separately to increase the compression gain and the output for each buffer will be appended to the compressed data.

Decoding system
This system is responsible to reconstruct the decompressed image. The compressed data from LLSVS appended to that of LMSVS will be passed to a decoding system that consisted of two sub decoding systems: the decoding subsystem of the LMSVS compressed data and the decoding subsystem of the LLSVS compressed data. Each decoding subsystem consists of the same processes proposed in the encoding subsystem but reverse order. So, the resulted data from the two decoding subsystems will be recombined to reconstruct the new Y, U, and V bands that will be transformed back to the RGB color model to extract the decompressed image.

RESULTS AND DISCUSSION
The proposed system was implemented using Embarcadero RAD Studio 2010 (Delphi 2010) programming language. The tests were conducted under the environment: Windows-8 operating system, laptop computer Lenovo (processor: Intel (R) Core(TM) i5-3337U, CPU 1.8 GHz and 4 GB RAM). The tests were applied on the well-known Lena and Baboon image samples (whose specifications are: size=256x256 pixel, color depth=24 bit), as shown in Figure 8. In an image compression scheme, the image compression algorithm should attain a trade-off between compression ratio and image quality [26], so to assess the difference between the reconstructed image and the original images, the error measure (i.e. peak signal to noise ratio PSNR measured in dB) was used. Beside this fidelity measure, some complementary measure was used to describe the performance of the system; the compression ratio (CR) was used to describe the compression gain. Table 1 lists the considered control parameters (including their names and default values); these values were selected after making comprehensive tests. Table 2 Illustrates the effect of Stp on the number of bytes required to encode the LMSVE (NBM) for all tested images.   Table 2 shows that the increase of Stp value will relatively decrease NBM in most cases. Table 3 illustrates the effect of Stp, 0 and on the number of bytes required to encode the LLSVE (NBL) for the Baboon image when n=64. The Stp effects on NBM listed in Table 2 are used with NBL listed in Table 3 to compute the CR of the proposed compression system. Table 3 proved that the increase of the quantization's factors ( 0 and a) will case increasing the CR and decreasing the PSNR of the retrieved image. Table 4 illustrates the effect of (n, Stp and ) on CR and PSNR, all tests applied on Lena image when ( 0 = 2).    Figure 9 shows the effect of (n and Stp) on (CR and PSNR) on the test image Baboon, where the test was done with ( 0 =2 and =0.01, ). From Figure 9, we conclude that when n=32 with different Stp values, the compression ratio is close to Lossless and the PSNR of the reconstructed image is higher than the acceptable levels (37.33-37.51), where it is effective (LMSVS) over from the effectiveness of (LLSVS). But when the value of n increases to become 64, Stp begins to become more active, affecting a noticeable increase in the compression ratio, with the slight decrease of the PSNR of the retrieved image remaining within very acceptable levels (33.04-33.49). Finally, when n=128, the influence of (LLSVS) begins to overwhelm the effect of ((LMSVS), causing an inverse relationship, with a clear difference, between the PSNR of the decompressed image and the CR, causing a significant increase in CR with a clear decrease in the PSNR, especially when Stp=(130 and 150).
From Figure 9, we conclude that when n=32 with different Stp values, the compression ratio is close to Lossless and the PSNR of the reconstructed image is higher than the acceptable levels (37.33-37.51), where it is effective (LMSVS) over from the effectiveness of (LLSVS). But when the value of n increases to became 64, Stp begins to became more active, affecting a noticeable increase in the compression ratio, with the slight decrease of the PSNR of the retrieved image remaining within very acceptable levels (33.04-33.49). Finally, when n=128, the influence of (LLSVS) begins to overwhelm the effect of (LMSVS), causing an inverse relationship, with a clear difference, between the PSNR of the decompressed image and the CR, causing a significant increase in CR with a clear decrease in the PSNR, especially when Stp=(130 and 150). The obtained results of the proposed compression system are compared to the universal standard JPEG regarding compression ratio and visual quality measures, Table 5 illustrates this comparison that applied to the Lena test image.

CONCLUSION
From the results of tests conducted on the proposed system, the following remarks were stimulated: The system is progressive as taking into consideration the importance of the most significant pixel values (MSV) (MSV take a small number of bits after encoding, knowing that they are encoded without error while least significant pixel values (LSV) are handled using lossy coding as they require a large number of bits. The increase of the control parameter Stp (that is the cut point bit) will relatively decrease the number of bits required to encoding the MSV in most cases, as shown in Table 2. The control parameter n (that is the size of the block partitioning) was tested in lossless MSV compression sub-system (LLLVS) using non overlapped scheme is plays an important role in the proposed compression system. When (n=32) makes the system biased to the LMSVS, but when (n=128) the system becomes biased to LLSVS. While, when (n=64) represented the balancing mode between the two subsystems (LMSV and LLSVS) that produce very encouraging values in term of CR and PSNR, as shown in Table 4 and Figure 9. For the future, it is possible to develop the Entropy encoder method to increase the compression ratio or using the multi-stage of transform.