[opus] int operation

Mike Hooper mihooper at bellsouth.net
Thu Aug 23 08:42:43 PDT 2012

Ralph, JM,

I am currently using Opus V1.0.1-rc and experience the problem stated
earlier. It appears that we may have a similar issue to what we experience
with CELT: much of the code assumes that in int is 32 bits. However, in the
world of TI C55xx, an int is 16 bits. JM and I debugged much of CELT in
March to fix these issues with CELT. Looks like we need to do the same with

Apparently some of the math calculations in SILK assume that frame_size is
32 bits, and hence cause errors. For example:

opus_int32 opus_encode(OpusEncoder *st, const opus_val16 *pcm, int
frame_size, unsigned char *data, opus_int32 out_data_bytes)

The result of some operations on frame_size exceed 16 bits. Should
frame_size be cast as opus_int32?

I would be happy to forge the way for debugging 16-bit architectures. How do
we proceed?



-----Original Message-----
From: Ralph Giles [mailto:giles at thaumas.net] 
Sent: Wednesday, August 22, 2012 6:40 PM
To: Mike Hooper
Cc: opus at xiph.org
Subject: Re: [opus] int operation

On 12-08-22 2:52 PM, Mike Hooper wrote:

> My TI C55xx complier is complaining about (in opus_encoder.c,
> opus_encode()):
>         st->silk_mode.payloadSize_ms = 1000 * frame_size / st->Fs;
> where .payloadSize_ms is opus_int, frame_size is an int, and Fs is a
> long. Should one of these be cast differently?

Fs should be an int instead of a long. It was changed to an opus_int32
in September, so if you update to 0.9.7 or later the problem should go away.

I would suggest working with git master or the 1.0.1 release candidate
source if you're doing a new port.


More information about the opus mailing list