Patent ID: 8891615

Claim:
A method of quantizing coefficients of a video block for a video coding process that supports context-based adaptive binary arithmetic coding (CABAC), the method comprising: generating a plurality of sets of quantized coefficients for the video block and a respective Lagrangian cost for each of the plurality of sets of quantized coefficients, wherein: each set of quantized coefficients from the plurality of sets of quantized coefficients is defined based on a different one of the coefficients of the video block being a last non-zero coefficient of the video block, and generating the plurality of sets of quantized coefficients comprises: for each respective set of quantized coefficients from the plurality of sets of quantized coefficients: the respective set of quantized coefficients is defined based on a particular one of the coefficients of the video block being the last non-zero coefficient of the video block, and for each respective coefficient in the respective set of quantized coefficients preceding the particular one of the coefficients of the video block: calculating one or more Lagrangian costs for the respective coefficient, wherein: each of the one or more Lagrangian costs for the respective coefficient corresponds to a respective quantized value from one or more quantized values of the respective coefficient, and calculating the one or more Lagrangian costs for the respective coefficient comprises, for each respective Lagrangian cost from the one or more Lagrangian costs for the respective coefficient, using CABAC to calculate a number of bits required to code the quantized value corresponding to the respective Lagrangian cost, the respective Lagrangian cost being based on the number of bits required to code the quantized value corresponding to the respective Lagrangian cost; and updating the Lagrangian cost for the respective set of quantized coefficients using the Langrangian cost for a selected quantized value from among the one or more quantized values of the respective coefficient; and including, in the respective set of quantized coefficients, the selected quantized value; and selecting a given one of the sets of quantized coefficients associated with a lowest one of the Lagrangian costs for the plurality of sets of quantized coefficients.