A method for video decoding, comprising: determining, according to an intra prediction mode, a predicted value P(x,y) of a sample at position (x,y) of a rectangular block having width W and height H of an image in a video, wherein for a vertical prediction mode, predicting a reference sample R(-1,y), 0≤y< H, on the left of the block, from a predictor (R_y), on the top of the block, by the vertical prediction mode, determining the gradient at (-1, y), 0≤y< H, as Δ(y) = R(-1,y) - R_y, modifying the predicted sample values of the block on row y as P'(x,y) = Clip(P(x,y) + (Δ(y)* L(x)), 0 ≤ x < W, wherein L(x) is a decay function having value in the closed interval [0,1], and the clipping function has the range equal to the dynamic range of the sample value, and assigning larger weights L(x) to the samples closer to the left boundary of the block; wherein for a horizontal prediction mode, predicting a reference sample R(x,-1), 0≤x< W, on the top of the block, from a predictor (R_x), on the left of the block, by the horizontal prediction mode, determining the gradient at (x,-1), 0≤x< W, as Δ(x) = R(x,-1) - R_x; modifying the predicted sample values of the block on row y as P'(x,y) = Clip(P(x,y) + Δ(x)* L(y)), 0 ≤ y<H, wherein L(y) is a decay function having values in the closed interval [0,1], and the clipping function has the range equal to the dynamic range of the sample value, and assigning larger weights L(y) to the samples closer to the top boundary of the block; determining a prediction residual of said sample; and decoding said sample at position (x,y) using said adjusted predicted value P'(x,y) and said prediction residual. determining, according to an intra prediction mode, a predicted value P(x,y) of a sample at position (x,y) of a rectangular block having width W and height H of an image in a video, wherein for a vertical prediction mode, predicting a reference sample R(-1,y), 0≤y< H, on the left of the block, from a predictor (R_y), on the top of the block, by the vertical prediction mode, determining the gradient at (-1, y), 0≤y< H, as Δ(y) = R(-1,y) - R_y, modifying the predicted sample values of the block on row y as P'(x,y) = Clip(P(x,y) + (Δ(y)* L(x)), 0 ≤ x < W, wherein L(x) is a decay function having value in the closed interval [0,1], and the clipping function has the range equal to the dynamic range of the sample value, and assigning larger weights L(x) to the samples closer to the left boundary of the block; predicting a reference sample R(-1,y), 0≤y< H, on the left of the block, from a predictor (R_y), on the top of the block, by the vertical prediction mode, determining the gradient at (-1, y), 0≤y< H, as Δ(y) = R(-1,y) - R_y, modifying the predicted sample values of the block on row y as P'(x,y) = Clip(P(x,y) + (Δ(y)* L(x)), 0 ≤ x < W, wherein L(x) is a decay function having value in the closed interval [0,1], and the clipping function has the range equal to the dynamic range of the sample value, and assigning larger weights L(x) to the samples closer to the left boundary of the block; wherein for a horizontal prediction mode, predicting a reference sample R(x,-1), 0≤x< W, on the top of the block, from a predictor (R_x), on the left of the block, by the horizontal prediction mode, determining the gradient at (x,-1), 0≤x< W, as Δ(x) = R(x,-1) - R_x; modifying the predicted sample values of the block on row y as P'(x,y) = Clip(P(x,y) + Δ(x)* L(y)), 0 ≤ y<H, wherein L(y) is a decay function having values in the closed interval [0,1], and the clipping function has the range equal to the dynamic range of the sample value, and assigning larger weights L(y) to the samples closer to the top boundary of the block; predicting a reference sample R(x,-1), 0≤x< W, on the top of the block, from a predictor (R_x), on the left of the block, by the horizontal prediction mode, determining the gradient at (x,-1), 0≤x< W, as Δ(x) = R(x,-1) - R_x; modifying the predicted sample values of the block on row y as P'(x,y) = Clip(P(x,y) + Δ(x)* L(y)), 0 ≤ y<H, wherein L(y) is a decay function having values in the closed interval [0,1], and the clipping function has the range equal to the dynamic range of the sample value, and assigning larger weights L(y) to the samples closer to the top boundary of the block; determining a prediction residual of said sample; and decoding said sample at position (x,y) using said adjusted predicted value P'(x,y) and said prediction residual.