[opus] Encoder off by one

Hermann Weber
Sun, 06 Oct 2013 10:33:02 -0000

Why does opus_encode return 359, and not 360, please?

This is my code:

         int iShortsRead = fread(m_RawBytes, sizeof(short),
(5760/sizeof(short)), fin);
         for(int i=0;i<iShortsRead;i++)
         {
             opus_int32 s;
             s=m_RawBytes[2*i+1]<<8|m_RawBytes[2*i];
             s=((s&0xFFFF)^0x8000)-0x8000;
             m_ShortsInput[i]=s;
         }
         int iByteSizeEncoded = opus_encode(m_enc, m_ShortsInput,
(5760/sizeof(short)), m_EncodedBytes, (960*6));