Patent ID: 8731947

Claim:
A coding method performed by a hardware-based encoder apparatus including a non-transitory storage medium, wherein the coding method is applied to codebook index coding in a lattice vector quantizer, the coding method comprising: obtaining, by the encoder apparatus, a vector to be coded according to an audio/voice signal; obtaining, by the encoder apparatus, an amplitude vector and a length vector corresponding to the vector to be coded, wherein the amplitude vector indicates elements of different values in a leader vector, and the length vector indicates how many times each element in the amplitude vector appears in the leader vector; sorting, by the encoder apparatus, elements of the amplitude vector and elements of the length vector; obtaining, by the encoder apparatus, a position index value according to the sorted amplitude vector and the sorted length vector; searching, by the encoder apparatus, a preset codebook index value offset table to obtain a codebook index value offset corresponding to the vector to be coded; obtaining, by the encoder apparatus, a lattice codebook index value corresponding to the vector to be coded according to the codebook index value offset and the position index value; writing, by the encoder apparatus, the lattice codebook index value into a bitstream; and sending, by the encoder apparatus, the bitstream to a decoder.