1. An encoding method performed by an encoder, the encoding method comprising: determining a flatness of a current coefficient to be encoded of a current subband based on coefficients that have been encoded; selecting at least one dimension vector from at least two dimension vectors to partition the current coefficient to be encoded of the current subband and coefficients right adjacent to the current coefficient to be encoded into vectors, according to the number of the coefficients to be encoded contained in the current subband and the flatness of the current coefficient to be encoded; quantizing the vectors partitioned from the coefficients to be encoded into lattice vectors according to the selected dimension, and then mapping the lattice vectors to lattice index vectors; and performing lossless encoding on the lattice index vectors.