A method, performed by an image pipeline, for intra-coding an image frame, wherein the image pipeline comprises a processing part followed by an encoding part supporting a plurality of intra-prediction modes used for intra-coding image frames, and wherein the method comprises: - by means of the processing part performing the steps of: - receiving an image frame; - for at least one block of pixel values in the image frame: - predicting pixel values of the at least one block of pixel values using an intra-prediction mode supported by the encoding part; - reducing a residual between at least one pixel value within the at least one block of pixel values in the image frame and a corresponding predicted pixel value by adjusting the at least one pixel value within the at least one block of pixel values in the image frame by a predefined amount of 1 or 2 steps up or down within a pixel value range, and updating the image frame with the adjusted at least one pixel value within the at least one block of pixel values; and - by means of the encoding part performing the step of: - intra-coding the updated image frame using at least one out of the plurality of intra-prediction modes, wherein the intra-coding comprises: - for each block of pixel values in the updated image frame, predicting pixel values and calculating residuals using one or more of the intra-prediction modes supported, and - selecting, for intra-coding of each respective block of pixel values, the intra-prediction mode giving the lowest residual for the respective block of pixel values. - by means of the processing part performing the steps of: - receiving an image frame; - for at least one block of pixel values in the image frame: - predicting pixel values of the at least one block of pixel values using an intra-prediction mode supported by the encoding part; - reducing a residual between at least one pixel value within the at least one block of pixel values in the image frame and a corresponding predicted pixel value by adjusting the at least one pixel value within the at least one block of pixel values in the image frame by a predefined amount of 1 or 2 steps up or down within a pixel value range, and updating the image frame with the adjusted at least one pixel value within the at least one block of pixel values; and - receiving an image frame; - for at least one block of pixel values in the image frame: - predicting pixel values of the at least one block of pixel values using an intra-prediction mode supported by the encoding part; - reducing a residual between at least one pixel value within the at least one block of pixel values in the image frame and a corresponding predicted pixel value by adjusting the at least one pixel value within the at least one block of pixel values in the image frame by a predefined amount of 1 or 2 steps up or down within a pixel value range, and updating the image frame with the adjusted at least one pixel value within the at least one block of pixel values; and - predicting pixel values of the at least one block of pixel values using an intra-prediction mode supported by the encoding part; - reducing a residual between at least one pixel value within the at least one block of pixel values in the image frame and a corresponding predicted pixel value by adjusting the at least one pixel value within the at least one block of pixel values in the image frame by a predefined amount of 1 or 2 steps up or down within a pixel value range, and updating the image frame with the adjusted at least one pixel value within the at least one block of pixel values; and - by means of the encoding part performing the step of: - intra-coding the updated image frame using at least one out of the plurality of intra-prediction modes, wherein the intra-coding comprises: - for each block of pixel values in the updated image frame, predicting pixel values and calculating residuals using one or more of the intra-prediction modes supported, and - selecting, for intra-coding of each respective block of pixel values, the intra-prediction mode giving the lowest residual for the respective block of pixel values. - intra-coding the updated image frame using at least one out of the plurality of intra-prediction modes, wherein the intra-coding comprises: - for each block of pixel values in the updated image frame, predicting pixel values and calculating residuals using one or more of the intra-prediction modes supported, and - selecting, for intra-coding of each respective block of pixel values, the intra-prediction mode giving the lowest residual for the respective block of pixel values. - for each block of pixel values in the updated image frame, predicting pixel values and calculating residuals using one or more of the intra-prediction modes supported, and - selecting, for intra-coding of each respective block of pixel values, the intra-prediction mode giving the lowest residual for the respective block of pixel values.