Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想使用音频编解码器(Speex)进行压缩;编解码器将 short 类型的音频样本(2 字节有符号)作为输入,范围:-2^15 到 2^15 -1。
我的问题是我有无符号短(2 字节无符号)类型的样本,范围:0 到 2^16 -1。那么,我应该怎么做才能在我的未签名样本上应用 speex?
有一个建议的解决方案是从每个无符号短中减去 2^15-1 以获得有符号短,我的问题是:这种方法在保持样本对 speex 的处理算法有意义方面是否安全?
To convert an unsigned short to signed, you need to subtract 2^15 or add 2^15-1 and store the result in an int.