A method for selecting a coding mode for a block of a current picture, comprising: receiving the block of a current picture; subtracting a prediction block from the received block to calculate a prediction residual block; performing a forward transform on the prediction residual block to calculate a transformed prediction residual block, performing quantization on the transformed prediction residual block to calculate a quantized transformed prediction residual block; performing dequantization on the quantized transformed prediction residual block; performing an inverse transform on the dequantized transformed prediction residual block to calculate a reconstructed prediction residual block; performing a binarization process on the quantized transformed prediction residual block, resulting in a plurality of bins; computing a coding bits parameter from the plurality of bins; measuring a coding distortion parameter between either: the prediction residual block and the reconstructed prediction residual block; or the transformed prediction residual block and the dequantized transformed prediction residual block; and selecting the coding mode in accordance with a cost function for coding the received block, wherein the cost function comprises the coding distortion parameter and the coding bits parameter; characterized in that said computing a coding bits parameter comprises scaling the number of the plurality of bins by a factor α wherein α is equal to the ratio of the total number of bits to the total number of bins for the previously coded picture of the same I, P or B type as the current picture. receiving the block of a current picture; subtracting a prediction block from the received block to calculate a prediction residual block; performing a forward transform on the prediction residual block to calculate a transformed prediction residual block, performing quantization on the transformed prediction residual block to calculate a quantized transformed prediction residual block; performing dequantization on the quantized transformed prediction residual block; performing an inverse transform on the dequantized transformed prediction residual block to calculate a reconstructed prediction residual block; performing a binarization process on the quantized transformed prediction residual block, resulting in a plurality of bins; computing a coding bits parameter from the plurality of bins; measuring a coding distortion parameter between either: the prediction residual block and the reconstructed prediction residual block; or the transformed prediction residual block and the dequantized transformed prediction residual block; and the prediction residual block and the reconstructed prediction residual block; or the transformed prediction residual block and the dequantized transformed prediction residual block; and selecting the coding mode in accordance with a cost function for coding the received block, wherein the cost function comprises the coding distortion parameter and the coding bits parameter; characterized in that said computing a coding bits parameter comprises scaling the number of the plurality of bins by a factor α wherein α is equal to the ratio of the total number of bits to the total number of bins for the previously coded picture of the same I, P or B type as the current picture.