The attached code implements PVQ encoding/decoding with separated signs [1]. It's in Python to use the unlimited-precision integers. The concept is to map vectors on some L-dimensional pyramid into integers 0...N, just like the standard PVQ. The only change is the mapping itself. The mapping is altered so that all sign data is in the least significant bits. A vector with Z nonzero components has Z signs associated with it, and they are stored in the last Z bits. The integer encoding specifies Z most-significantly, then the magnitudes of the components, and then the signs. This means that a variable-length coding system could easily be constructed to code everything except the signs, in order to code signs separately, if this is desirable. (JM has suggested to me that it might be.) I do not think this encoding scheme is significantly more computation-intensive than the current scheme. In fact, because of the subdivision by Z and the separate sign bits, it may extend to much larger sizes using only 32-bit multiplies. --Ben P.S. If the data is Gaussian [2], then each vector with large Z is much more likely than each vector with small Z. If test statistics confirm this, it could be worthwhile to attempt variable-length arithmetic coding based on Z. It would also be fairly simple to set a minimum Z-value for a band, though this seems harsh. [1] in the SIGN-SEPARATED PYRAMID CODING section. [2] or at least on the Gaussian side of Laplacian -------------- next part -------------- A non-text attachment was scrubbed... Name: counting.py Type: text/x-python Size: 26225 bytes Desc: not available Url : http://lists.xiph.org/pipermail/opus/attachments/20100417/7d798116/attachment-0002.py -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: OpenPGP digital signature Url : http://lists.xiph.org/pipermail/opus/attachments/20100417/7d798116/attachment-0002.pgp