1. A method for encoding an image, comprising the steps of: (A) generating with a circuit a first quantization matrix as a function of at least four parameters received in a first signal based on a symmetric quadratic model, wherein the at least four parameters are initialized with trial parameters; (B) generating a second signal that conveys a quality metric based on an encoding using said first quantization matrix; (C) adjusting said parameters in said first signal to improve said quality metric; (D) generating a second quantization matrix as said function of said parameters as adjusted; and (E) encoding said image with said second quantization matrix.