1. A method performed by a transform codec comprising a Vector Quantizer, the method comprising: obtaining a number of input target vectors, wherein the number of input target vectors per time segment is variable and said input target vectors represent segments of an audio signal or a video signal; for each of the number of input target vectors: comparing the input target vector with four centroids C 0 , C 1 , C 0,flip and C 1,flip , 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 , each centroid representing a respective class of codevectors; determining a starting point for a search related to the input target vector in a codebook, based on a result of the comparing the input target vector with the centroids, wherein a search space for the search is dynamically adjusted to the number of input target vectors, and the codevectors in the codebook are defined to be different from each other according to a distortion measure reflecting a distance between each codevector among the codevectors in the codebook and said centroids C 0 and C 1 , and the codevectors are sorted according to the distortion measure reflecting the distance between each codevector among the codevectors in the codebook and said centroids C 0 and C 1 ; and performing the search in the codebook, starting at the determined starting point, and identifying a codevector to represent the input target vector; and transmit, through a communication circuit, an indication of each of the codevectors identified.