A Fast EZW Food Packaging Encoding and Decoding Algorithm Using Linear Indexing Technology Applied in Food Packaging Graphics

In order to find effective coding method, as much as possible eliminate the redundant information of original food packaging image and improve food packaging image compression efficiency, a kind of fast EZW food packaging encoding and decoding algorithm using linear indexing technique is proposed in this study. This kind of algorithm encodes and scans the linear sequence coefficients, which only needs less location information and improves the food packaging encoding and decoding speed to a certain degree, thus realizing a linear indexing technique similar to that in the non-linked list SPIHT. If the creation of linear sequence is placed before the coding of a group of food packaging images, then only the linear sequence is created once, the coding of these food packaging images can be implemented, so as to save a lot of coding time.


INTRODUCTION
Our country is in a critical period of rapid development of market economy and the transformation, how the rich diversity of market economy, promote product sales and circulation, become the focus of attention.The food market will be more and more broad, its packing is important factors to attract customers to buy and the packaging graphic design is the most key factors can directly affect their consumption psychology.
In 1993, the Embedded Zerotree Wavelet (EZW) coding algorithm is an important milestone in the history of a wavelet image compression academic history.But the master coding scanning process needs to be repeated many times on the wavelet coefficient matrix, greatly reduces the food packaging encoding speed.Therefore, Shapiro (1996) proposed the technique of zero tree maps, through the establishment of zero tree map of wavelet coefficient matrix to eliminate the search redundancy existing in the master scanning process.The current popular EZW coding system adopts zero tree map technology, greatly reduces the search redundancy and improves the food packaging encoding speed.But this coding algorithm uses special Morton scanning method to scan 2D wavelet coefficient matrix, so that the coefficient nodes of master-slave code list needs to use more complex location information, to a certain extent, which reduces the coding speed.
Wavelet food packaging image compression technology has made great progress in recent years, there is a famous Embedded Zerotree Wavelet (EZW) coding algorithm (Jin, 2004) proposed by Shapiro (1993), in simplicity and effectiveness this algorithm is superior to other algorithms (Zhuangzhi and Yousai, 2006) which has a far-reaching influence on the study of wavelet food packaging image compression.The algorithm uses "zerotree structure" to express the selfsimilarity of "zero value distribution" between different sub-bands of wavelet decomposition food packaging image (Shapiro, 2013(Shapiro, , 2006)), to realize the effective organization and expression for unimportant wavelet coefficients to improve the coding efficiency.However, this kind of data structure, in order to determine if a wavelet coefficient is zero tree root or isolated zero, must check and scan all its descendants, this kind of repeated scanning will waste a lot of time and greatly affect the food packaging encoding speed (Yankui, 2005).
This study presents a linear index technology, makes the coefficient of wavelet transformation matrix be arranged in a linear sequence, EZW coding can be implemented by scanning of linear sequence coefficient, to make the coefficient nodes of master and slave scanning lists only need two concise information fields to be expressed, so as to further improve the food packaging encoding speed and realize the linear indexing technology used in the non-linked list SPIHT (Jidong et al., 2008).

MATERIALS AND METHODS
The fast EZW coding algorithm using zero tree map: In order to eliminate the search redundancy in the scan, currently the popular improved EZW algorithm mostly by reverse scanning map once establishes the zero tree wavelet coefficient matrix and in a Zigzag scanning order again does width-first search coding to wavelet coefficient with tree structure (Xudong et al., 2004): scan the low frequency sub-band LLK, take the coefficient of each two lines as a big row, in each big row take the adjacent four coefficients as a group, scan each group and in each group according to the sequence "upper left→lower left→lower right→upper right" scan each coefficient, when a coefficient node is coded as a non-zero tree root, it's child node in LHK is inserted into First In First Out (FIFO) list waiting for subsequent coding, otherwise, when a coefficient node is encoded as zero tree root, it's all descendant nodes will be abandoned, cannot be inserted the FIFO list for coding (Said and Pearlman, 2006).
After the scan of LLK, the relevant child nodes are inserted into FIFO list in LHK, again according to the same sequence insert the relevant child nodes in HLK and HHK; then FIFO list is scanned from the beginning, when a coefficient node is encoded as a nonzero tree root, the four child nodes in the next decomposition layer are inserted into FIFO list, waiting for the subsequent coding, otherwise, when a coefficient node is coded as zero tree root, it's all descendant nodes will be discarded, instead of inserting into FIFO list for coding (Shapiro, 2003) The specific steps of above improved algorithm are as follows:  Do K layer wavelet decomposition to the food packaging image, the wavelet coefficients matrix is obtained, it is a M×N matrix (M and N respectively represent height and width of the food packaging image). Select the initial threshold T0, the threshold is decreased by half for every increase of code scanning. Set up and initialize a FIFO master coding scanning list and a slave code scanning table. Establish a zero tree map matrix.Cycle K times, in the order from high frequency to low frequency, to reverse scan the wavelet decomposition matrix of food packaging image, process the coefficients of each decomposition layer: If a wavelet coefficient Transform (i, j) is located at first layer, then calculate T = log 2 (|T(i, j)|) and when T = 0 ztmap (i, j) = 0 when T > 0, ztmap (i, j) = (1 << T) If Transform (i, j) is located at some layer of No. 2~K, then calculate T = log 2 (|T(i, j)|) and set  Repeatedly cycle on the master code scanning and the slave code scanning until the code output reaches to the expected bytes and ends coding.
In the process of each scanning of master code, the wavelet coefficient matrix is regarded as K layer tree structure, according to Morton scanning sequence and width-first strategy to scan the wavelet coefficients, if a coefficient absolute value is greater than or equal to two times of the threshold, then it has encoded in the process of the previous master coding and skips this coding; if a coefficient's absolute value is less than two times of the current threshold and greater than or equal to the current threshold, it will be encoded as POS and NEG and the coefficient value and its position will be saved into the coding list; if a coefficient's absolute value is less than the current threshold, then encode it reference to the information of the corresponding node in the zero tree map of the coefficient, if the corresponding nodes shows that the coefficient has effective children, then the coefficient is encoded as, otherwise it is encoded as Zero Tree Root (ZTR).Also in the process of master food packaging encoding process the produced symbols are being entropy encoded.If a coefficient is encoded as a zero tree root, then the entire child nodes will be abandoned cannot be added to the master food packaging encoding list for coding.
According to the current threshold, do thining and food packaging encoding to the coefficient values in the coding list.Through careful analysis to the various steps of the algorithm, the algorithm is visible through the establishment of zero tree maps to avoid the search redundancy in the food packaging encoding process.In the food packaging encoding process each coefficient at least needs to conduct a search once, thus the one-time reverse scan to create a zero tree map is a necessary operation and no additional operation, zero tree map for food packaging encoding can eliminate a lot of search redundancy.In addition, in the process of master code scanning FIFO list is used to manage the nodes which must be encoded, to the nodes which food packaging encoding is zero tree root, all the child nodes will be discarded and not to be scanned, to furthest save code search operation.Therefore, Mow-song Ng coding algorithm is indeed a relatively fast and efficient algorithm, its running times are shown in Table 1.

RESULTS AND DISCUSSION
According to the improved algorithm, the new EZW food packaging encoding and decoding system using linear index technology is implemented.Through the analysis of new and old EZW food packaging encoding and decoding system, the master list nodes of original EZW coding system contains as many as five fields, the slave list nodes contains as many as six fields and in the new EZW coding system, the master list and the slave list nodes contains only two fields.Therefore if the food packaging encoding time of the original system is set to N, then the food packaging encoding time of new system is about.In addition, the author uses new food packaging encoding and decoding system to carry on the experiment, the measured data is shown in Table 2. Comparing the food packaging encoding and decoding time between the original algorithm and the new algorithm, it shows the new algorithm is faster than the original algorithm and the compressed food packaging image's reconstruction quality is exactly as same as that in the original algorithm.

CONCLUSION
This study proposes a linear index technology, makes the coefficient in wavelet transformation matrix be arranged in a linear sequence, EZW coding can be implemented by scanning the coefficient in linear sequence, which makes the coefficient nodes of the master and slave scanning lists just use concise coefficient location information, to a certain extent, which improves the coding speed.Experiments show that this algorithm improvement is successful.Because calling the algorithm 1 does not involve the use of specific food packaging image data, only needs to give the length and width data of food packaging image to establish the linear sequence of wavelet coefficient matrix, thus the implementation of algorithm 1 can be placed before a group of food packaging image coding, then according to the established linear sequence, the wavelet transform matrix of each food packaging image can be converted to linear list to encode and this can save a lot of time to further improve the food packaging encoding speed.

Table 1 :
Experimental data of Mow-song Ng coding algorithm