摘要 |
The invention relates to a method for coding a data stream (DS), wherein the data stream (DS) comprises a multiplicity of characters which are symbols (S) from an alphabet, wherein the characters of the data stream (DS) are combined to form a plurality of blocks (B), and the blocks (B) are entropy-coded on the basis of a code table (CT) valid for the respective block (B). The method according to the invention is characterized by the fact that the blocks (B), by means of iteration (IT), are associated with a plurality of clusters (CL) on the basis of a clearance (d) which is defined such that the clearance (d) between a block (B) and a cluster (CL) is smaller the less pronounced the change in the entropy (ET) of the cluster (CL) when adding the block (B) to the cluster (CL). In a respective iteration step, of the iteration (IT), reassignment of the blocks (B) to the clusters (CL) takes place by virtue of the blocks (B) being assigned in each case to the cluster (CL) with the smallest clearance (d) between the block (B) and the cluster (CL). Then, in each case one code table (CT) is assigned to the clusters (CL) determined by the iteration (IT), which code table is determined on the basis of the frequency distribution of the symbols (S) in at least some of the blocks (B) contained in the respective cluster (CL) and is valid for all blocks (B) of the respective cluster (CL). |