1. A method performed by a transform codec comprising a Vector Quantizer, the method comprising: comparing an input target vector with a plurality of centroids, each centroid representing a respective class of codevectors in a codebook; determining a starting point for a search related to the input target vector in the codebook, based on a result of the comparing the input target vector with the plurality of centroids; and performing a search in the codebook, starting at the determined starting point, and identifying a codevector to represent the input target vector, wherein the codevectors in the codebook are sorted according to a distortion measure reflecting a distance between each codevector among the codevectors in the codebook and two of said plurality of centroids, and wherein a number of input target vectors per time segment is variable and a search space is dynamically adjusted to the number of input target vectors.