Patent ID: 8780973

Claim:
A method for encoding a picture in a video sequence, the method comprising: determining a current encoded size B enc of the picture after coding a plurality of macroblocks in the picture; determining that encoding remaining macroblocks in the picture may cause an encoded size of the picture to exceed a maximum encoded picture size B max ; computing a quantization scale QS new responsive to the determining, wherein the quantization scale QS new is computed such that an estimated encoded size of the remaining macroblocks if the remaining macroblocks are quantized with the quantization scale QS new does not exceed a difference between the maximum encoded picture size B max and the current encoded picture size B enc , wherein computing a quantization scale QS new comprises computing the quantization scale as Qs new = Qs avg * B enc MB enc * ( MB tot - MB enc ) ( B max - B enc ) wherein MB enc is a total number of encoded macroblocks in the picture and MB tot is a total number of macroblocks in the picture; and quantizing at least one of the remaining macroblocks with the new quantization scale QS new .