A method for predicting an image, the method comprising: determining (S601) prediction parameters of a current block in a bitstream; determining (S602) a matrix-based intra prediction, MIP, input sample of the current block based on neighboring samples of the current block and the prediction parameters, setting (S603) a shifting number parameter, sW, as a first fixed value; setting (S604) a shifting offset parameter, fO, as a second fixed value; determining (S605) an MIP weight matrix of the current block based on the prediction parameters; determining (S606) an MIP prediction sample, predMip [x] [y], having coordinates x, y of the current block using equations A and B: oW = 1 ≪ sW − 1 − fO * ∑ i = 0 inSize − 1 p i predMip x y = ∑ i = 0 inSize − 1 mWeight i y ∗ predSize + x ∗ p i + oW ≫ sW + pTemp ⌈ 0 ⌉ where: sW is the shifting number parameter, fO is the shifting offset parameter, p[i] is an i th value in the MIP input sample, inSize is a number of values in the MIP input sample, mWeight is the MIP weight matrix corresponding to a MIP mode and a size of the current block, predSize represents a size of an MIP prediction block, and pTemp is an array representing a buffer area; and performing (S606) an upsampling process to the MIP prediction sample of the current block so as to generate intra predicted samples, predSamples [x] [y], of the current block, wherein the first fixed value and the second fixed value are set as constant values independently of the MIP mode and the size of the current block determining (S601) prediction parameters of a current block in a bitstream; determining (S602) a matrix-based intra prediction, MIP, input sample of the current block based on neighboring samples of the current block and the prediction parameters, setting (S603) a shifting number parameter, sW, as a first fixed value; setting (S604) a shifting offset parameter, fO, as a second fixed value; determining (S605) an MIP weight matrix of the current block based on the prediction parameters; determining (S606) an MIP prediction sample, predMip [x] [y], having coordinates x, y of the current block using equations A and B: oW = 1 ≪ sW − 1 − fO * ∑ i = 0 inSize − 1 p i predMip x y = ∑ i = 0 inSize − 1 mWeight i y ∗ predSize + x ∗ p i + oW ≫ sW + pTemp ⌈ 0 ⌉ where: sW is the shifting number parameter, fO is the shifting offset parameter, p[i] is an i th value in the MIP input sample, inSize is a number of values in the MIP input sample, mWeight is the MIP weight matrix corresponding to a MIP mode and a size of the current block, predSize represents a size of an MIP prediction block, and pTemp is an array representing a buffer area; and sW is the shifting number parameter, fO is the shifting offset parameter, p[i] is an i th value in the MIP input sample, inSize is a number of values in the MIP input sample, mWeight is the MIP weight matrix corresponding to a MIP mode and a size of the current block, predSize represents a size of an MIP prediction block, and pTemp is an array representing a buffer area; and performing (S606) an upsampling process to the MIP prediction sample of the current block so as to generate intra predicted samples, predSamples [x] [y], of the current block, wherein the first fixed value and the second fixed value are set as constant values independently of the MIP mode and the size of the current block <EOS>