[opus] [PATCH] Support for Channel Mapping 253.

Timothy B. Terriberry tterribe at xiph.org
Wed Oct 11 21:12:42 UTC 2017


Jean-Marc Valin wrote:
> I think you'll want something like:
> (opus_int16)((unsigned)demixing_matrix[2*i+1] << 8)
> (though you might want to check it too)

FWIW, we use the construct
   int s = buf[2*i + 1] << 8 | buf[2*i];
   s = ((s & 0xFFFF) ^ 0x8000) - 0x8000;

to manually sign-extend the result in opus_compare (and also opus_demo). 
If you ultimately cast s to (opus_int16), then I'm pretty sure most 
compilers will turn the second line into a no-op and optimize it away.


More information about the opus mailing list