A value of a selection parameter is sequentially set from among a
plurality of parameters included in a modeling equation to derive a
quantization matrix. A value of each of the parameters is sequentially
derived based on a code amount and an encoding distortion obtained from
an encoding using a quantization matrix generated from an updated
parameter set.