Data processing method based on Huffman sheet

A data processing and data technology, applied in the field of data processing, can solve problems such as high error probability, complex code debugging, and complex code implementation, and achieve the effect of clear data structure, simple coding, and fast execution speed.

Active Publication Date: 2015-06-03
SHANGHAI UNITED IMAGING HEALTHCARE
3 Cites 3 Cited by

AI-Extracted Technical Summary

Problems solved by technology

[0019] However, in the prior art, when encoding and decoding Huffman tables using a binary tree, the c...
the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Abstract

The invention provides a data processing method based on a Huffman sheet; the method comprises the steps: establishing a binary tree array based on the Huffman sheet and decoding based on the binary tree array, wherein the binary tree array is a two-dimensional array, the first-dimensional array is the number of the layers of a binary tree and the second-dimensional array is the number of the nodes in each layer. The decoding based on the binary tree array comprises reading picture data, acquiring a node inquire code and correspondingly positioning to the corresponding nodes in the two-dimensional array according to the number of the layers of the two-dimensional array and the node inquire code; if the data at the corresponding position is valid, the node is a leaf node and the present inquire is finished; if no, continuously reading the picture data. By adopting the array manner, the operation of error-prone pointers and trees is avoided, the encoding is relatively simple and the debugging is relatively intuitive and simple compared with the binary tree manner.

Application Domain

Technology Topic

Image

  • Data processing method based on Huffman sheet
  • Data processing method based on Huffman sheet
  • Data processing method based on Huffman sheet

Examples

  • Experimental program(1)

Example Embodiment

[0039] In the following description, many specific details are explained in order to fully understand the present invention. However, the present invention can be implemented in many other ways different from those described here, and those skilled in the art can make similar popularizations without violating the connotation of the present invention. Therefore, the present invention is not limited by the specific implementation disclosed below.
[0040] Secondly, the present invention is described in detail by using schematic diagrams. When describing the embodiments of the present invention in detail, the schematic diagrams are merely examples, which should not limit the scope of protection of the present invention.
[0041] In the prior art, when encoding and decoding a Huffman table using a binary tree in JPEG encoding and decoding, the code implementation is complicated, the error probability is high, and the code debugging is complicated.
[0042] The present invention provides a data processing method based on a Huffman table, including: constructing a binary tree array based on the Huffman table, and decoding based on the binary tree array. Wherein, the binary tree array is a two-dimensional array, the first dimension is the number of layers of the binary tree, and the second dimension is the number of nodes in each layer. The number of layers of the binary tree is 16.
[0043] In the initial state, the initial state of the node is invalid, a node includes one byte or two bytes, the one byte is used to store data or the state; the two bytes are used to store data And save state. That is, each node includes at most two bytes, one for saving data and one for saving state.
[0044] Before constructing the binary tree array, it includes providing a number area and a data area, and the bytes in the number area correspond to the number of corresponding layer data in the data area. Read the bytes in the number area in turn to obtain the number of data in the corresponding layer of the byte: if the byte in the number area currently read is 0, continue to read the next byte in the number area; if currently read If the byte of is non-zero, calculate the initial query code of the current layer and read the data in the data area.
[0045] After reading the current data in the data area, it is correspondingly saved to the node corresponding to the current layer in the two-dimensional array. And after saving the current data to the current layer of the two-dimensional array, the corresponding query code is increased by 1.
[0046] Wherein, the calculation of the initial query code of the current layer includes: shifting the global query code to the left by the corresponding layer number difference according to the layer number difference between the current layer and the first layer, and save it as the initial query code of the current layer.
[0047] Correspondingly, the decoding based on the binary tree array includes: reading picture data, obtaining a node query code, and correspondingly locating to the corresponding one in the two-dimensional array according to the number of layers of the two-dimensional array and the node query code Node: If the corresponding location data is valid, it is a leaf node, and the current query ends; if not, continue to read the image data. Wherein, the position serial number of the corresponding node is the query code-the initial query code of the current layer. The total number of the query code is 16 bits.
[0048] Read the current bit in the image data as the node query code. If the current position data is invalid, then read the next bit in the image data, and the previous bit will form a 2-bit query code, and locate the position; if the node corresponding to the 2-bit query code is valid, the query ends; if If it is invalid, continue to read the next bit in the image data, combine with the previous query code to form a query code with one more bit, and locate again until the query code is processed.
[0049] The construction and decoding based on the Huffman table of the present invention will be described in detail below in conjunction with specific embodiments.
[0050] Such as image 3 As shown, as an embodiment, the method for generating the binary tree array can be divided into the following 6 steps, which are specifically as follows:
[0051] 1. Compare the value of each byte in the Number Bytes area to obtain the value with the largest number of bytes in the number area.
[0052] 2. Generate a two-dimensional array. One dimension of the two-dimensional array is the number of layers of the binary tree, and the other dimension is the number of nodes at each layer, which is the value of each byte in the Number Bytes area obtained in the first step . As an embodiment, the number of layers of the binary tree, that is, the one-dimensional size is determined to be 16.
[0053] Further, when generating the two-dimensional array, the status of each node is set to be invalid at the same time. Set the initial global query code to 0. A node only occupies 2 bytes at most, one to save data and one to save state.
[0054] 3. Read the first byte in the Number Bytes area to obtain the data number of the layer. If the value is 0, continue to read the next byte of Number Bytes; if the value is not 0, then enter 4.
[0055] 4. According to the number of data obtained in 3, the layer number difference is obtained, and the initial query code of this layer is calculated. Specifically, the global query code is shifted to the left by the corresponding digits and saved as the initial query code of the layer.
[0056] 5. Read the first byte in the Data Bytes data area, save it into the first node of the corresponding layer in the two-dimensional array, and add 1 to the global query code.
[0057] 6. Read the next byte in sequence, the processing method is the same as that of 5, until all the data of this layer is read. Then go to 3.
[0058] After the above steps, the binary tree corresponding array is established.
[0059] Next, the method of using the binary tree array during decoding includes: when decoding, first read a bit in the image data and use it as a node query code, and locate the two-dimensional array according to the number of bits (ie, the number of layers) and the value of the query code Corresponding node in, the position number is "query code-initial query code of this layer", if the corresponding position is valid, it is a leaf node, and the query ends; if the corresponding position data is invalid, read the next one in the image data bit, which forms a 2-bit query code with the previous bit. Positioning is performed. If the node is valid, the query ends. If it is invalid, then read the next bit in the image data, which is combined with the previous query code to make up more One bit query code, locate again. In this way, until the 16-bit query code is processed, if no valid node is found at this time, it proves that the decoding error or the file data error is wrong, and the decoding is ended.
[0060] The space consumption of this method is closely related to the structure of the binary tree. If the data of the tree is evenly distributed in levels, then this scheme will save more space than the implementation of the binary tree. If the data of the tree is concentrated at a certain level, its space consumption will increase. .
[0061] Assuming that the number of data is N and the maximum number of data in each layer is M, then according to the time 10*N=2*16*M, N:M=32:10 is obtained, so when the total number and the maximum number of layers are greater than 4, The array method will save space. When it is between 3-4, the two methods are equivalent, when it is less than 3, the binary tree method is more space-saving. Therefore, overall, this method saves space than the binary tree method.
[0062] And to understand this method requires an in-depth understanding of JPEG encoding and the corresponding encoding and decoding process. The advantage is simple coding and fast execution speed. Moreover, this method has regular data and clear data structure, which also has great benefits for improving the efficiency of debugging.
[0063] Although the present invention has been disclosed as above in preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can use the methods and technical content disclosed above to improve the present invention without departing from the spirit and scope of the present invention. The technical solution makes possible changes and modifications. Therefore, all simple modifications, equivalent changes and modifications made to the above embodiments according to the technical essence of the present invention without departing from the content of the technical solution of the present invention belong to the technical solution of the present invention. protected range.
the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

no PUM

Description & Claims & Application Information

We can also present the details of the Description, Claims and Application information to help users get a comprehensive understanding of the technical details of the patent, such as background art, summary of invention, brief description of drawings, description of embodiments, and other original content. On the other hand, users can also determine the specific scope of protection of the technology through the list of claims; as well as understand the changes in the life cycle of the technology with the presentation of the patent timeline. Login to view more.
the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Similar technology patents

Novel password

PendingCN110941815AUnable to decipherSimple codingDigital data protectionDigital data authenticationCode bookAdvantage
Owner:李君池

Classification and recommendation of technical efficacy words

  • Fast execution
  • Simple coding

Practical, redundant, failure-tolerant, self-reconfiguring embedded system architecture

InactiveUS7117390B1High robustness/redundancyFast executionError detection/correctionEmbedded systemSoftware modules
Owner:NAT TECH & ENG SOLUTIONS OF SANDIA LLC

Novel password

PendingCN110941815AUnable to decipherSimple codingDigital data protectionDigital data authenticationCode bookAdvantage
Owner:李君池
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products