A vector quantization method comprising: obtaining a number of input vectors, wherein the number of input vectors varies over time and each input vector comprises coefficients derived from an audio signal or a video signal; for each input vector: - performing classification of the input vector into one of four classes by comparing the input vector with four centroids C 0 , C 1 , C 0, flip and C 1, flip , each centroid representing a respective class of codevectors in a codebook, wherein centroid C 0, flip is a flipped version of centroid C 0 and centroid C 1, flip is a flipped version of centroid C 1 , and wherein elements of centroid C 0, flip and elements of centroid C 1, flip are created by reading elements of said centroid C 0 , and said centroid C 1 in reverse order when reading the elements of centroid C 0, flip and the elements of centroid C 1, flip, - determining a starting point for a search based on the result of the classification; and - performing a search in the codebook, starting at the determined starting point, wherein a search space is dynamically adjusted such that the size of the search space depends on the number of input vectors, and wherein the codebook has been created such that the codevectors in the codebook are sorted according to a distortion measure reflecting the distance between each codevector and said centroids C 0 and C 1 . obtaining a number of input vectors, wherein the number of input vectors varies over time and each input vector comprises coefficients derived from an audio signal or a video signal; for each input vector: - performing classification of the input vector into one of four classes by comparing the input vector with four centroids C 0 , C 1 , C 0, flip and C 1, flip , each centroid representing a respective class of codevectors in a codebook, wherein centroid C 0, flip is a flipped version of centroid C 0 and centroid C 1, flip is a flipped version of centroid C 1 , and wherein elements of centroid C 0, flip and elements of centroid C 1, flip are created by reading elements of said centroid C 0 , and said centroid C 1 in reverse order when reading the elements of centroid C 0, flip and the elements of centroid C 1, flip, - determining a starting point for a search based on the result of the classification; and - performing a search in the codebook, starting at the determined starting point, wherein a search space is dynamically adjusted such that the size of the search space depends on the number of input vectors, and wherein the codebook has been created such that the codevectors in the codebook are sorted according to a distortion measure reflecting the distance between each codevector and said centroids C 0 and C 1 . - performing classification of the input vector into one of four classes by comparing the input vector with four centroids C 0 , C 1 , C 0, flip and C 1, flip , each centroid representing a respective class of codevectors in a codebook, wherein centroid C 0, flip is a flipped version of centroid C 0 and centroid C 1, flip is a flipped version of centroid C 1 , and wherein elements of centroid C 0, flip and elements of centroid C 1, flip are created by reading elements of said centroid C 0 , and said centroid C 1 in reverse order when reading the elements of centroid C 0, flip and the elements of centroid C 1, flip, - determining a starting point for a search based on the result of the classification; and - performing a search in the codebook, starting at the determined starting point, wherein a search space is dynamically adjusted such that the size of the search space depends on the number of input vectors, and wherein the codebook has been created such that the codevectors in the codebook are sorted according to a distortion measure reflecting the distance between each codevector and said centroids C 0 and C 1 . <EOS>