Patent ID: 11923875
Assignee: INSPUR SUZHOU INTELLIGENT TECHNOLOGY CO., LTD.
Field: Basic communication processes (Electrical engineering)
Classification: CPC H | IPC H

Claim 0:
1. A dynamic Huffman encoding method based on a sorting network, wherein the sorting network comprises n stages of sorting modules, n is a positive integer, and the method comprises:
S1, acquiring elements to be sorted, and initializing i=1, wherein the elements to be sorted comprise Literal elements and Length elements, the Literal elements are used for describing a number of occurrences of each character in a target text, and the Length elements are used for describing numbers of occurrences of character strings of different length intervals in the target text;
S2, in an ith-stage sorting module, generating, by using each of ith-stage sorting units and by means of i times of parallel comparison, a sorting result of 2i elements to be sorted according to the sorting result of a previous-stage sorting module, so as to obtain the sorting result of the ith-stage sorting module, wherein the ith-stage sorting module comprises n/2i parallel ith-stage sorting units;
S3, judging whether i is less than n, when i is less than n, increasing i by 1 and entering S2; when i is equal to n, determining that the sorting result of the ith-stage sorting module is the sorting result of the elements to be sorted; and
S4, constructing a Huffman tree according to the sorting result of the elements to be sorted, and encoding the target text according to the Huffman tree.