1. A non-transitory computer readable medium storing a computer program for selecting an encoding mode from a plurality of encoding modes that includes mode 0 encoding and non-mode 0 encoding, the computer program executable by at least one processor, the computer program comprising sets of instructions for: computing, for each particular encoding mode from the plurality of encoding modes, a Lagrangian value that quantifies a relationship between a distortion and a bit rate for the particular encoding mode; identifying a set of encoding modes from the plurality of encoding modes by comparing (i) a ratio between a smallest Lagrangian value and the computed Lagrangian value of each encoding mode in the plurality of encoding modes with (ii) a threshold value; and selecting, from the set of encoding modes, the mode 0 encoding when the set of encoding modes comprises the mode 0 encoding, even if the Lagrangian value associated with the mode 0 encoding is not the smallest Lagrangian value.