Method for producing a data stream, which comprises a multitude of raster points as reference points, the raster points specifying a raster, two adjacent raster points defining a segment, of code words of variable lengths, which are divided up into a plurality of sets of code words, the method comprising the following steps:
- writing at least a part of each code word of a first set of code words into the data stream in a first direction of writing, starting from a first raster point of a segment, respectively;
- writing at least a part of a code word of a second set of code words into the data stream in a second direction of writing which is opposite to the first direction of writing, starting from a second raster point of a segment, respectively, the code words of the second set being assigned to segments in accordance with the predetermined assignment rule, such that each code word of the second set is assigned to a different segment, wherein, in case a code word of the second set does not or not completely fit into the assigned segment, at least a part of this code word or at least a part of the remainder of this code word which does not fit into the assigned segment is written into a different, not fully occupied segment in the first or second direction of writing, in accordance with a predetermined regulation, after all remaining segments have been processed with the other code words of the second set,
- wherein the method for producing a data stream comprises a hardware implementation.