There are provided mechanisms for encoding a picture of a video sequence into a video bitstream. The picture comprises at least a first color component and a second color component. The first color component comprises a first block of samples and the second color component comprises a second block of samples. A method comprises segmenting the first block of samples and the second block of samples into at least a first segment and a second segment so that samples with the same positions in the first block and the second block belong to the same segment. The method comprises predicting sample values in the second block of samples based on the sample values in the first block of samples that belong to the same segment.