An Efficient Encryption-Then-Compression System using Asymmetric Numeral Method

---Image compression is an important task in the field of image processing and it is an essential process in digital world to reduce the memory for storage and processing of the images. Many practical applications need compression and security. Encryption is a security control and widely used in many computer applications to provide protection for data. The images are encrypted before compression to give high level security and drawn much attention in several applications like data transferring, medical, navy and military operations. This paper has proposed an efficient image Encryption and Then Compression system (ETC) using Asymmetric Numeral Method (ANM) for compressing the images. The proposed ANM coder is compared with the existing Huffman and Arithmetic coder. The comparative analysis will be carried out for different size of images and results are illustrated that the proposed system is efficient in terms of compression ratio (Bits per Pixel) and computation time.

The rest of this paper is organized as follows. Section II explains the related researches briefly. Section III provides the details of proposed ETC system, where Asymmetric Numerical Method [ANM] is considered for image compression. Section IV presents the performance analysis of ANM. Section V provides the experimental results and their discussions. Section VI concludes the research work.
II. RELATED WORK Johnson et. al [6] proposed a scheme to compress an encrypted image by using performance of theoretical results and showed that the stream cipher encrypted data is compressible through the use of coding with information principles, without compromising either the compression efficiency or the information-theoretic security. In addition to theoretical findings, the author proposed practical algorithms for lossless compression on encrypted binary images by using Low-Density Parity-Check (LDPC) channel code.
Lazzeretti and Barni [8] presented several methods for lossless compression of encrypted grayscale or color images. The author discussed about bitplanes, prediction error, spatial and cross-plane correlation among pixels and obtained best results by transforming color images in an approximated YCbCr domain.
Zhang et.al [11] discusssed a scalable coding framework of encrypted images via multi-resolution construction. The author implemented an encryption of modulo-256 addition with series of pseudorandom numbers derived from a secret key, designed an image encryption scheme via pixel-domain permutation and demonstrated that the encrypted file can be efficiently compressed by discarding the excessively rough and fine information of coefficients in the transform domain.
The encoded bitstreams are made up of a quantized encrypted subimage with multiple-resolution construction and suggested compressive sensing (CS) mechanism to compress an encrypted image.
Jiantao Zhou et.al [5] presented a design of an efficient encryption then-compression system. In this approach a permutation based image encryption method was conducted over the prediction error domain. The arithmetic coding approach efficiently compress the encrypted image and it provides reasonably high level of security, but the compression approach applied to encrypted images is not good in terms of compression efficiency.
Xinpeng Zhang et.al [9] proposed a novel scheme of lossy compression for encrypted gray images. In the encryption phase, the original image is decomposed as set of coefficients by a secret orthogonal transform and then compressed by a linear operation. The method achieved good result in reconstruction of images.
Jarek Duda [1] proposed Asymmetric Numeral System (ANS) approach to entropy coding and combined the compression ratio of arithmetic coding with the speed of huffman coding. In this paper single natural number is used as the state, instead of two to represent a range. The author discussed about many other variants like uniform asymmetric binary system, encoding finite state automaton and probability distribution of states.
III. PROPOSED SYSTEM The three key components for proposed ETC system are image encryption, image compression and the sequential decryption and decompression. ETC is the method for securing the data, which is very important for online transactions, data transfer through network, navy operations and medical image processing. The existing work addressed encryption and compression of image using Arithmetic Coder and Huffman Coder [5]. Arithmetic Coder results in good compression ratio with larger computation time. Huffman Coder is fast but it gives low compression rate. Asymmetric Numerical Method [ANM] is used to overcome the above issues. ANM is very efficient and faster decoding method because of its simple design.

A. Image Encryption
Design of encryption process operated over the prediction error domain in existing system, for each pixel I (i, j) of the image I is to be encrypted, a prediction Ip ( i, j) is first made by using an image predictor . The prediction error can take any values in the range [-255, 255] for eight bit images and prediction error associated with image I can be calculated by  Step 1: Calculate all the mapped prediction errors E(mp), of the image I .
Step 2: Split all the prediction errors into L no of clusters (C k for 0 ≤ k ≤ L-1). k is the cluster index.
Step 3: Resize the predicition errors in every C k into a two dimensional block which have four columns and C k /4 rows. | C k | denotes the number of prediction errors in C k Step 4: Apply cyclic shift operations to each output of prediction error block and read the data in raster scan manner to obtain the permuted cluster C k .
Step 5: The assembler concatenates all the permuted clusters C k for 0 ≤ k ≤ L − 1, and generate encrypted image. … … --------- (2) in which each prediction error is represented by 8 bits. As the number of prediction errors equals that of the pixels, the file size before and after the encryption preserves.
Step 6: Pass encrypted image along with the length of each cluster | C k | for 0 ≤ k ≤ L − 2. The values of | C k | helps to divide encrypted image into L clusters.

B. Asymmetric Numerical Method
Asymmetric Numerical Method (ANM) is an entropy coding method used in compression to improve the compression performance. Entropy encoding is a lossless data compression scheme that is independent of the specific characteristics of the medium and also used to measure the amount of similarity between streams of data [8]. The Entropy coder are Huffman Coder (HC) and Arithmetic Coder (AC). Huffman coder is faster but uses approximate probabilities with powers of 2 which leads to relatively low compression rates. The arithmetic coder uses nearly exact probabilities with larger computational time [1]. ANM has the advantage to combine the compression ratio of arithmetic coder with speed of Huffman coder and it is used in image compression because of high performance and efficiency [2]. In standard binary numeral system, one can add bit of information from a digit S € (0, 1) to an existing number X either to the most significant position (x' → x+s2^m) or to the least significant position (x' → 2x+s). In most significant position, new digit S can choose between ranges and two numbers [position of digit and range at given moment] are required to represent the current state. In least significant position, the current state is single natural number, this is the advantage of ANM. While in standard binary system , X becomes X-th appearance of even (s = 0) or odd (s = 1) number, so it redefines the splitting of N into even and odd number and uniformly distributed with different densities corresponding to symbol probability distribution [1]. From both approaches, half of the range is enough to represent 1 bit of information, so the current content is lg (size of range/size of sub range) bits of information. While encoding symbol of probability p, the size of sub range is multiplied by p, it increases informational content by lg (1/p) bits. According to ANM, X contains lg (X) bits of information, informational content should increase to ANM add information in the least significant position. Its coding rule considered X as X-th appearance of S-th subset of natural numbers corresponding to currently encoded symbol. When uniform (symmetric) probability distribution of symbols are considered, In figure 3, X value 5 represent 10 (if s=0) and 5 represent 11(if s=1). ANM makes it optimal for asymmetric probability distribution of symbols. In ANM, even/odd division of natural numbers are replaced with division into subsets having densities corresponding to the assumed probability distribution. Here, X value 5 represent 8 (if s=0) and 5 represent 16(if s=1) is explained in figure 3. The algorithm for proposed method is described below.

ANM Algorithm
Step 1: Pass Encrypted image to the channel provider.
Step 2: Asymmetric Numerical Method coding is applied.
Step 3: Compressed form of encrypted image is Send to the receiver where sequential decompression and decryption is done.
IV PERFORMANCE ANALYSIS Performance analysis plays an important role in the design of encryption and compression algorithms. The performance of the proposed ANM compression algorithm is compared with that of the two existing algorithms namely Arithmetic coder and Huffman coder. Arithmetic coder is a lossless coding technique and it has a better compression ratio than Huffman coder. Arithmetic coder is based on the frequency of symbols and the whole data is represented by a fractional number between 0 and 1. Optimality and flexibility is the main advantage of arithmetic coder. Arithmetic coder allows the transfer of large volume of data with limited resources with less reliability. The arithmetic coder uses nearly exact probabilities with larger computational time. A main disadvantage of arithmetic coder is its poor error resistance. If there is a single bit error in the codeword, the entire data become corrupted and may cause the retransmission of the entire data. Huffman coder is optimal and it is based on the frequency of occurrence of a data item (pixel in images). The principle is to use a lower number of bits to encode the data that occurs more frequently and directly translate a symbol into a bit sequence. Huffman coder is faster but uses approximate probabilities with powers of 2 which leads to relatively low compression rates. Huffman coder requires sorting of symbols to build prefix tree which is costly.
The proposed ANM is cheap and provide effective compression. ANM has the advantage to combine the compression ratio of arithmetic coder with the speed of Huffman coder and it is used in image compression because of high performance and efficiency [1] & [3]. ANM performs faster decoding than Huffman coder. ANM coder can be implemented with less computational complexity. ANM is the best precise coder and more resistant to brute force attacks. ANM has a lower MSE and a higher PSNR. A lower value for MSE means lesser error and higher value of PSNR is good because it means that the ratio of signal to noise is higher. Here, the 'signal' is the original image, and the 'noise' is the error in reconstruction. The results proved that ANM is the best compression algorithm in terms of compression ratio, MSE, PSNR and computation time.
V. EXPERIMENTAL RESULTS In this section the performance of the proposed Asymmetric Numerical Method (ANM) is evaluated and compared with the performance of Huffman coder and Arithmetic coder. Bits per pixel (BPP), Compression Ratio and computation time are the performance metrics considered for evaluation. The Experimental evaluation of proposed ETC is simulated by using MATLAB. The test set is composed of 100 images with various characteristics, 10 of which are used to display the result. Table 1 shows the comparison of proposed ANM with the existing Huffman and Arithmetic coder in terms of compression performance [B represents bytes]. ANM shows better performance for all the images and compression performance is increased from 8% to 12% for medical and satellite images.

Bits Per Pixel [BPP]
BPP is defined as the number of bits of information stored per pixel of a given image. The more number of bits per pixel in an image ensures more number of colors can be represented but it increases the memory required to store and display the image. Table 2 shows comparison of compression ratio in Bits per Pixel (bpp) of proposed ANM with Huffman and Arithmetic coder. The Compression ratio for all the images is high when using ANM.  Table 3 shows comparison of computation time of ANM. It is found that, ANM takes less computation time than Huffman coder and Arithmetic coder. From figure.6, It is observed that the ANM coder is faster than existing coders for image size 512*512 and when the image size is increased there will be more efficiency. From table 4, it is found that the MSE value is high when using the Arithmetic and Huffman coder while it is significantly reduced when using ANM coder.

Peak Signal To Noise Ratio (PSNR)
Peak Signal to Noise Ratio defines the ratio between the maximum possible power of a signal and the power of corrupting noise that affects the fidelity of its representation. The PSNR (in dB) is defined as:

10.
From table 5, it is clear that the ANM coder yields better PSNR values when compared to the Arithmetic and Huffman coder. encryption method. In future, the encryption which is a vital process in the image processing can be considered to enhance the security of images.