Video encoder for encoding pictures of a video into a data stream, the picture being partitioned into an array of coding blocks, wherein the video encoder is configured to: by a first thread, process coding blocks in a first line of the array of coding blocks; by a second thread, process coding blocks in a second line of the array while processing the coding blocks of the first line of the array is still in progress, wherein processing a coding block in the second line of the array requires that reference coding blocks in the first line have been processed; characterized in that the video encoder is configured to upon a specific event, interrupt processing coding blocks in the second line of the array by the second thread and process coding blocks of a third line of the array by the second thread, wherein a) the specific event is that the first thread did not yet finish processing the reference coding blocks in the first line required for the second thread to process a next coding block in the second line, or b) the specific event is that processing the second line reaches a specific coding block in the second line, the specific coding block representing a line switch barrier, and that the second line is the last line currently processed by one of the threads of the video encoder, wherein upon reaching the line switch barrier, the second thread jumps to the first coding block of the third line, which is the next line following the second line, to process the first coding block of the third line. by a first thread, process coding blocks in a first line of the array of coding blocks; by a second thread, process coding blocks in a second line of the array while processing the coding blocks of the first line of the array is still in progress, wherein processing a coding block in the second line of the array requires that reference coding blocks in the first line have been processed; characterized in that the video encoder is configured to upon a specific event, interrupt processing coding blocks in the second line of the array by the second thread and process coding blocks of a third line of the array by the second thread, wherein a) the specific event is that the first thread did not yet finish processing the reference coding blocks in the first line required for the second thread to process a next coding block in the second line, or b) the specific event is that processing the second line reaches a specific coding block in the second line, the specific coding block representing a line switch barrier, and that the second line is the last line currently processed by one of the threads of the video encoder, wherein upon reaching the line switch barrier, the second thread jumps to the first coding block of the third line, which is the next line following the second line, to process the first coding block of the third line. a) the specific event is that the first thread did not yet finish processing the reference coding blocks in the first line required for the second thread to process a next coding block in the second line, or b) the specific event is that processing the second line reaches a specific coding block in the second line, the specific coding block representing a line switch barrier, and that the second line is the last line currently processed by one of the threads of the video encoder, wherein upon reaching the line switch barrier, the second thread jumps to the first coding block of the third line, which is the next line following the second line, to process the first coding block of the third line.