[opus] Bug in ARM fixed-point ASM?

Andrew Lentvorski bsder at allcaps.org
Sun Jul 19 03:37:01 PDT 2015


Hi, folks,

I've been hunting down some strange bugs in audio I've been doing.  While hunting my bugs down, I tripped across what appears to be an Opus bug, but it's not clear where it's coming from.

Note that the optimization choices differ between the two in the config.log below.  How can I force them to be the same?  Presumably I need to force the android version toward the Raspberry Pi 2 choices since the processor in the RPi2 is *way* less powerful.

Thanks,
-a
    
    
Which (if any) of these encodes is correct?
    
Raspberry Pi 2 Result:
Packet size: 0x29
d0 7f 29 1a fa 2b 33 81
70 22 58 6a 3b 0f 3f b5
66 ff ce da 93 9b c2 e9
f1 7a d0 61 fc 0e a6 75
9c 2b 8e 14 92 d6 20 09  << That 20 is different
c6 00 00 00 00 00 00 00


Android result:
Packet size: 0x29
d0 7f 29 1a fa 2b 33 81
70 22 58 6a 3b 0f 3f b5
66 ff ce da 93 9b c2 e9
f1 7a d0 61 fc 0e a6 75
9c 2b 8e 14 92 d6 60 09  << That 60 is different
c6 00 00 00 00 00 00 00


    
Latest Opus from the repository.
commit fc0276fad4ca6aa4b83230329f9fe5ad8b60a621
Author: Timothy B. Terriberry <tterribe at xiph.org>
Date:   Tue Jul 7 11:25:42 2015 -0700
    


Configure for Raspberry Pi 2 (compiled on the Pi itself):
./configure --host=arm-linux-androideabi --enable-fixed-point --enable-custom-modes --enable-assertions --enable-fixed-point-debug
    
Configure for Android (cross-compiled on OS X):
./configure --host=arm-linux-androideabi --enable-fixed-point --enable-custom-modes --enable-assertions --enable-fixed-point-debug



config.log results for Raspberry Pi 2:
------------------------------------------------------------------------
  opus 1.1.1-beta-38-gfc0276f:  Automatic configuration OK.

    Compiler support:

      C99 var arrays: ................ yes
      C99 lrintf: .................... yes
      Use alloca: .................... no (using var arrays)

    General configuration:

      Floating point support: ........ no
      Fast float approximations: ..... no
      Fixed point debugging: ......... yes
      Inline Assembly Optimizations: . ARM (EDSP) (Media)
      External Assembly Optimizations: ARM (EDSP) (Media)
      Intrinsics Optimizations.......: no
      Run-time CPU detection: ........ ARM (NEON)
      Custom modes: .................. yes
      Assertion checking: ............ yes
      Fuzzing: ....................... no

      API documentation: ............. yes
      Extra programs: ................ yes
------------------------------------------------------------------------
    

config.log results for Android:
    ------------------------------------------------------------------------
  opus 1.1.1-beta-38-gfc0276f:  Automatic configuration OK.

    Compiler support:

      C99 var arrays: ................ yes
      C99 lrintf: .................... yes
      Use alloca: .................... no (using var arrays)

    General configuration:

      Floating point support: ........ no
      Fast float approximations: ..... no
      Fixed point debugging: ......... yes
      Inline Assembly Optimizations: . ARM (EDSP)
      External Assembly Optimizations: ARM (EDSP)
      Intrinsics Optimizations.......: no
      Run-time CPU detection: ........ ARM (Media) (NEON)
      Custom modes: .................. yes
      Assertion checking: ............ yes
      Fuzzing: ....................... no

      API documentation: ............. yes
      Extra programs: ................ yes
------------------------------------------------------------------------



Test Program:



#include <stdint.h>
#include <string.h>

#include <opus.h>

#include <stdio.h>
#include <assert.h>

uint8_t bbKnownBuffer[1920] __attribute__((aligned (8))) = {
        0x85, 0x00, 0x92, 0x00, 0xa0, 0x00, 0xab, 0x00, 0x7e, 0x00, 0x88, 0x00, 0x3c, 0x00, 0x4e, 0x00,
        0xf5, 0xff, 0x00, 0x00, 0xdb, 0xff, 0xe0, 0xff, 0xc8, 0xff, 0xd2, 0xff, 0xae, 0xff, 0xba, 0xff,
        0x89, 0xff, 0x90, 0xff, 0x66, 0xff, 0x81, 0xff, 0x6e, 0xff, 0x7f, 0xff, 0x64, 0xff, 0x87, 0xff,
        0x5b, 0xff, 0x71, 0xff, 0x4c, 0xff, 0x76, 0xff, 0x58, 0xff, 0x90, 0xff, 0x7a, 0xff, 0xa2, 0xff,
        0xa7, 0xff, 0xd3, 0xff, 0xe3, 0xff, 0xf7, 0xff, 0xfb, 0xff, 0x04, 0x00, 0xe2, 0xff, 0xef, 0xff,
        0xc2, 0xff, 0xbc, 0xff, 0xcd, 0xff, 0xc9, 0xff, 0xc8, 0xff, 0xbc, 0xff, 0x8f, 0xff, 0x7d, 0xff,
        0x51, 0xff, 0x42, 0xff, 0x72, 0xff, 0x5a, 0xff, 0xb9, 0xff, 0x9f, 0xff, 0xea, 0xff, 0xc3, 0xff,
        0xea, 0xff, 0xca, 0xff, 0xf9, 0xff, 0xc8, 0xff, 0x20, 0x00, 0xf3, 0xff, 0x26, 0x00, 0xf7, 0xff,
        0xd6, 0xff, 0xa2, 0xff, 0xa3, 0xff, 0x74, 0xff, 0x74, 0xff, 0x4f, 0xff, 0x5a, 0xff, 0x2e, 0xff,
        0x3c, 0xff, 0x14, 0xff, 0x25, 0xff, 0x05, 0xff, 0x2a, 0xff, 0x15, 0xff, 0x4c, 0xff, 0x40, 0xff,
        0x97, 0xff, 0x96, 0xff, 0xda, 0xff, 0xd0, 0xff, 0x17, 0x00, 0x20, 0x00, 0x5a, 0x00, 0x54, 0x00,
        0x55, 0x00, 0x58, 0x00, 0x5f, 0x00, 0x58, 0x00, 0x5d, 0x00, 0x52, 0x00, 0x5f, 0x00, 0x44, 0x00,
        0x2c, 0x00, 0x1c, 0x00, 0xe6, 0xff, 0xe2, 0xff, 0xef, 0xff, 0xe9, 0xff, 0xed, 0xff, 0xf8, 0xff,
        0xda, 0xff, 0xe5, 0xff, 0xb4, 0xff, 0xd4, 0xff, 0xa3, 0xff, 0xca, 0xff, 0xb6, 0xff, 0xde, 0xff,
        0xc9, 0xff, 0xf3, 0xff, 0xc0, 0xff, 0xeb, 0xff, 0xc7, 0xff, 0xec, 0xff, 0xc9, 0xff, 0xe2, 0xff,
        0xa6, 0xff, 0xb4, 0xff, 0x79, 0xff, 0x82, 0xff, 0x37, 0xff, 0x42, 0xff, 0x24, 0xff, 0x2d, 0xff,
        0x13, 0xff, 0x14, 0xff, 0xc3, 0xfe, 0xd5, 0xfe, 0xb9, 0xfe, 0xcf, 0xfe, 0xd4, 0xfe, 0xe9, 0xfe,
        0xfc, 0xfe, 0x2d, 0xff, 0x4c, 0xff, 0x75, 0xff, 0x70, 0xff, 0xab, 0xff, 0xb2, 0xff, 0xe5, 0xff,
        0xfa, 0xff, 0x29, 0x00, 0x25, 0x00, 0x5d, 0x00, 0x53, 0x00, 0x7c, 0x00, 0x5b, 0x00, 0xa0, 0x00,
        0x6c, 0x00, 0xa3, 0x00, 0x65, 0x00, 0xa3, 0x00, 0x68, 0x00, 0xac, 0x00, 0x95, 0x00, 0xd1, 0x00,
        0xa4, 0x00, 0xea, 0x00, 0xa8, 0x00, 0xe5, 0x00, 0x6d, 0x00, 0xbe, 0x00, 0x57, 0x00, 0xad, 0x00,
        0x5e, 0x00, 0xc0, 0x00, 0x62, 0x00, 0xb7, 0x00, 0x44, 0x00, 0xa5, 0x00, 0x04, 0x00, 0x59, 0x00,
        0xcb, 0xff, 0x24, 0x00, 0xe2, 0xff, 0x37, 0x00, 0xff, 0xff, 0x4b, 0x00, 0x2e, 0x00, 0x72, 0x00,
        0x62, 0x00, 0xa6, 0x00, 0x85, 0x00, 0xc4, 0x00, 0x8e, 0x00, 0xcb, 0x00, 0x74, 0x00, 0xbf, 0x00,
        0x75, 0x00, 0xaf, 0x00, 0x5b, 0x00, 0x9b, 0x00, 0x43, 0x00, 0x90, 0x00, 0x09, 0x00, 0x4c, 0x00,
        0xcc, 0xff, 0x1e, 0x00, 0xd3, 0xff, 0x1a, 0x00, 0xc4, 0xff, 0x06, 0x00, 0x9e, 0xff, 0xe6, 0xff,
        0x8d, 0xff, 0xd6, 0xff, 0x82, 0xff, 0xd4, 0xff, 0x6f, 0xff, 0xb9, 0xff, 0x38, 0xff, 0x8f, 0xff,
        0x1f, 0xff, 0x77, 0xff, 0xec, 0xfe, 0x44, 0xff, 0xc7, 0xfe, 0x1d, 0xff, 0xb6, 0xfe, 0x05, 0xff,
        0x80, 0xfe, 0xd0, 0xfe, 0x94, 0xfe, 0xd1, 0xfe, 0xd9, 0xfe, 0x0c, 0xff, 0xf7, 0xfe, 0x23, 0xff,
        0x1f, 0xff, 0x2a, 0xff, 0x46, 0xff, 0x4d, 0xff, 0x67, 0xff, 0x52, 0xff, 0xa2, 0xff, 0x79, 0xff,
        0xc7, 0xff, 0x9a, 0xff, 0xe8, 0xff, 0xb0, 0xff, 0xe5, 0xff, 0xad, 0xff, 0xc4, 0xff, 0x8d, 0xff,
        0xc4, 0xff, 0x93, 0xff, 0xe7, 0xff, 0xb1, 0xff, 0x09, 0x00, 0xd5, 0xff, 0x0d, 0x00, 0xd9, 0xff,
        0x15, 0x00, 0xdc, 0xff, 0x55, 0x00, 0x1a, 0x00, 0x89, 0x00, 0x48, 0x00, 0x9a, 0x00, 0x66, 0x00,
        0x99, 0x00, 0x72, 0x00, 0xb1, 0x00, 0x81, 0x00, 0xb5, 0x00, 0x97, 0x00, 0x76, 0x00, 0x67, 0x00,
        0x3a, 0x00, 0x31, 0x00, 0xf8, 0xff, 0xf2, 0xff, 0xe2, 0xff, 0xeb, 0xff, 0xf5, 0xff, 0x01, 0x00,
        0xe4, 0xff, 0xff, 0xff, 0xe0, 0xff, 0x02, 0x00, 0x11, 0x00, 0x2f, 0x00, 0x5e, 0x00, 0x83, 0x00,
        0x8d, 0x00, 0xa9, 0x00, 0xa3, 0x00, 0xcd, 0x00, 0xbb, 0x00, 0xe7, 0x00, 0x9a, 0x00, 0xd0, 0x00,
        0x66, 0x00, 0xa8, 0x00, 0x44, 0x00, 0x86, 0x00, 0xfe, 0xff, 0x5a, 0x00, 0xca, 0xff, 0x38, 0x00,
        0x9e, 0xff, 0x0c, 0x00, 0x71, 0xff, 0xf7, 0xff, 0x58, 0xff, 0xe3, 0xff, 0x2a, 0xff, 0xc5, 0xff,
        0x50, 0xff, 0x01, 0x00, 0x7c, 0xff, 0x2d, 0x00, 0x39, 0xff, 0xfe, 0xff, 0x15, 0xff, 0xd8, 0xff,
        0x01, 0xff, 0xc9, 0xff, 0xe5, 0xfe, 0xb1, 0xff, 0xc7, 0xfe, 0x82, 0xff, 0x85, 0xfe, 0x52, 0xff,
        0x7a, 0xfe, 0x34, 0xff, 0x69, 0xfe, 0x25, 0xff, 0x66, 0xfe, 0x1d, 0xff, 0x93, 0xfe, 0x3e, 0xff,
        0xd0, 0xfe, 0x7a, 0xff, 0xef, 0xfe, 0x95, 0xff, 0x34, 0xff, 0xd2, 0xff, 0x88, 0xff, 0x19, 0x00,
        0xc0, 0xff, 0x61, 0x00, 0x1e, 0x00, 0xae, 0x00, 0x28, 0x00, 0xca, 0x00, 0x2f, 0x00, 0xcd, 0x00,
        0x3b, 0x00, 0xcf, 0x00, 0x3f, 0x00, 0xc4, 0x00, 0x5a, 0x00, 0xe1, 0x00, 0x39, 0x00, 0xa5, 0x00,
        0xe9, 0xff, 0x49, 0x00, 0xef, 0xff, 0x36, 0x00, 0xf8, 0xff, 0x2d, 0x00, 0xe1, 0xff, 0xff, 0xff,
        0xe5, 0xff, 0xe8, 0xff, 0xd5, 0xff, 0xbf, 0xff, 0xbd, 0xff, 0x99, 0xff, 0xd4, 0xff, 0x8b, 0xff,
        0xdb, 0xff, 0x8d, 0xff, 0xea, 0xff, 0x7b, 0xff, 0xf5, 0xff, 0x75, 0xff, 0x15, 0x00, 0x85, 0xff,
        0x13, 0x00, 0x6c, 0xff, 0xfe, 0xff, 0x50, 0xff, 0x13, 0x00, 0x5e, 0xff, 0x42, 0x00, 0x85, 0xff,
        0x9a, 0x00, 0xbe, 0xff, 0x9d, 0x00, 0xbe, 0xff, 0x65, 0x00, 0x8b, 0xff, 0x6f, 0x00, 0x88, 0xff,
        0x9a, 0x00, 0xb6, 0xff, 0xa5, 0x00, 0xca, 0xff, 0x7c, 0x00, 0xa3, 0xff, 0x31, 0x00, 0x55, 0xff,
        0x1b, 0x00, 0x4a, 0xff, 0x2d, 0x00, 0x61, 0xff, 0x11, 0x00, 0x47, 0xff, 0xea, 0xff, 0x30, 0xff,
        0xf9, 0xff, 0x35, 0xff, 0xf1, 0xff, 0x3c, 0xff, 0xd4, 0xff, 0x24, 0xff, 0xbb, 0xff, 0x1c, 0xff,
        0xbd, 0xff, 0x2f, 0xff, 0xd2, 0xff, 0x53, 0xff, 0xdb, 0xff, 0x5e, 0xff, 0xb2, 0xff, 0x43, 0xff,
        0xb8, 0xff, 0x4a, 0xff, 0xfd, 0xff, 0x8c, 0xff, 0x56, 0x00, 0xe6, 0xff, 0x8d, 0x00, 0x20, 0x00,
        0x9c, 0x00, 0x3c, 0x00, 0xd9, 0x00, 0x79, 0x00, 0x06, 0x01, 0xaf, 0x00, 0x1e, 0x01, 0xd2, 0x00,
        0x1c, 0x01, 0xdc, 0x00, 0xef, 0x00, 0xc6, 0x00, 0xca, 0x00, 0xb1, 0x00, 0xc3, 0x00, 0xaf, 0x00,
        0xb8, 0x00, 0xbe, 0x00, 0xa4, 0x00, 0xba, 0x00, 0x87, 0x00, 0xad, 0x00, 0x7b, 0x00, 0xb5, 0x00,
        0x6b, 0x00, 0xae, 0x00, 0x18, 0x00, 0x78, 0x00, 0xd7, 0xff, 0x38, 0x00, 0x78, 0xff, 0xf8, 0xff,
        0x3b, 0xff, 0xbd, 0xff, 0x07, 0xff, 0x90, 0xff, 0xcf, 0xfe, 0x67, 0xff, 0xc0, 0xfe, 0x5f, 0xff,
        0xa6, 0xfe, 0x58, 0xff, 0xb6, 0xfe, 0x60, 0xff, 0xb7, 0xfe, 0x85, 0xff, 0xb9, 0xfe, 0x83, 0xff,
        0xc0, 0xfe, 0x95, 0xff, 0xc5, 0xfe, 0xae, 0xff, 0xf9, 0xfe, 0xce, 0xff, 0x23, 0xff, 0x00, 0x00,
        0x24, 0xff, 0x01, 0x00, 0x34, 0xff, 0x17, 0x00, 0x56, 0xff, 0x2f, 0x00, 0x7a, 0xff, 0x49, 0x00,
        0xb2, 0xff, 0x82, 0x00, 0xe1, 0xff, 0xa5, 0x00, 0xba, 0xff, 0x8c, 0x00, 0x9d, 0xff, 0x6e, 0x00,
        0x9b, 0xff, 0x6b, 0x00, 0x7b, 0xff, 0x3a, 0x00, 0x5c, 0xff, 0x0a, 0x00, 0x57, 0xff, 0xf3, 0xff,
        0x31, 0xff, 0xb9, 0xff, 0x1b, 0xff, 0x9a, 0xff, 0x1c, 0xff, 0x89, 0xff, 0x07, 0xff, 0x55, 0xff,
        0x0d, 0xff, 0x5f, 0xff, 0x17, 0xff, 0x56, 0xff, 0x0b, 0xff, 0x44, 0xff, 0xfe, 0xfe, 0x41, 0xff,
        0xfd, 0xfe, 0x33, 0xff, 0x3b, 0xff, 0x68, 0xff, 0xa3, 0xff, 0xcc, 0xff, 0xf2, 0xff, 0xfa, 0xff,
        0x1b, 0x00, 0x24, 0x00, 0x4b, 0x00, 0x33, 0x00, 0x69, 0x00, 0x46, 0x00, 0xc0, 0x00, 0x85, 0x00,
        0x20, 0x01, 0xd2, 0x00, 0x17, 0x01, 0xb0, 0x00, 0xfd, 0x00, 0x95, 0x00, 0x23, 0x01, 0xae, 0x00,
        0x4d, 0x01, 0xc4, 0x00, 0x61, 0x01, 0xd4, 0x00, 0x4b, 0x01, 0xa1, 0x00, 0x06, 0x01, 0x68, 0x00,
        0xdb, 0x00, 0x21, 0x00, 0x9c, 0x00, 0xda, 0xff, 0x6c, 0x00, 0x8e, 0xff, 0x4b, 0x00, 0x51, 0xff,
        0x32, 0x00, 0x23, 0xff, 0x13, 0x00, 0xee, 0xfe, 0x01, 0x00, 0xc1, 0xfe, 0x18, 0x00, 0xcc, 0xfe,
        0x44, 0x00, 0xce, 0xfe, 0x58, 0x00, 0xf5, 0xfe, 0x6c, 0x00, 0xeb, 0xfe, 0x42, 0x00, 0xc7, 0xfe,
        0x50, 0x00, 0xca, 0xfe, 0x4a, 0x00, 0xc6, 0xfe, 0x23, 0x00, 0xb2, 0xfe, 0x3a, 0x00, 0xd3, 0xfe,
        0x38, 0x00, 0xd7, 0xfe, 0x35, 0x00, 0xe7, 0xfe, 0x5a, 0x00, 0x1a, 0xff, 0x8b, 0x00, 0x5b, 0xff,
        0xc1, 0x00, 0x9a, 0xff, 0xd1, 0x00, 0xb8, 0xff, 0xd0, 0x00, 0xc1, 0xff, 0xe6, 0x00, 0xd3, 0xff,
        0x00, 0x01, 0x01, 0x00, 0x05, 0x01, 0x08, 0x00, 0x12, 0x01, 0x26, 0x00, 0xf9, 0x00, 0x2b, 0x00,
        0xd3, 0x00, 0x1b, 0x00, 0xd2, 0x00, 0x2a, 0x00, 0xaf, 0x00, 0x2a, 0x00, 0x87, 0x00, 0x12, 0x00,
        0x59, 0x00, 0x09, 0x00, 0x0b, 0x00, 0xe1, 0xff, 0xd6, 0xff, 0xc7, 0xff, 0xbc, 0xff, 0xd4, 0xff,
        0xc8, 0xff, 0x00, 0x00, 0xb9, 0xff, 0x02, 0x00, 0x85, 0xff, 0xf5, 0xff, 0x7f, 0xff, 0x00, 0x00,
        0x92, 0xff, 0x33, 0x00, 0x9c, 0xff, 0x4d, 0x00, 0x9c, 0xff, 0x59, 0x00, 0xa5, 0xff, 0x71, 0x00,
        0x94, 0xff, 0x74, 0x00, 0x8c, 0xff, 0x79, 0x00, 0x97, 0xff, 0x90, 0x00, 0xad, 0xff, 0xbb, 0x00,
        0xc9, 0xff, 0xe4, 0x00, 0x01, 0x00, 0x0e, 0x01, 0x2d, 0x00, 0x46, 0x01, 0x4c, 0x00, 0x66, 0x01,
        0x55, 0x00, 0x6e, 0x01, 0x50, 0x00, 0x84, 0x01, 0x3a, 0x00, 0x6b, 0x01, 0x18, 0x00, 0x4c, 0x01,
        0xd3, 0xff, 0x20, 0x01, 0xa0, 0xff, 0xfe, 0x00, 0x69, 0xff, 0xd0, 0x00, 0x2d, 0xff, 0x9c, 0x00,
        0x14, 0xff, 0x91, 0x00, 0x10, 0xff, 0x7c, 0x00, 0x11, 0xff, 0x7c, 0x00, 0x18, 0xff, 0x7f, 0x00,
        0x26, 0xff, 0x8c, 0x00, 0x22, 0xff, 0x8f, 0x00, 0x46, 0xff, 0xbd, 0x00, 0x90, 0xff, 0xfb, 0x00,
        0x93, 0xff, 0x07, 0x01, 0x6f, 0xff, 0xe6, 0x00, 0x66, 0xff, 0xd1, 0x00, 0x4a, 0xff, 0xb7, 0x00,
        0x56, 0xff, 0xae, 0x00, 0x4b, 0xff, 0x89, 0x00, 0x3c, 0xff, 0x5b, 0x00, 0x57, 0xff, 0x5a, 0x00,
        0x68, 0xff, 0x3f, 0x00, 0x86, 0xff, 0x41, 0x00, 0xc2, 0xff, 0x4e, 0x00, 0xf5, 0xff, 0x56, 0x00,
        0x05, 0x00, 0x58, 0x00, 0x2a, 0x00, 0x58, 0x00, 0x13, 0x00, 0x3e, 0x00, 0x1a, 0x00, 0x23, 0x00,
        0x34, 0x00, 0x19, 0x00, 0x33, 0x00, 0x0b, 0x00, 0x1b, 0x00, 0xdb, 0xff, 0x12, 0x00, 0xbf, 0xff,
        0x16, 0x00, 0xb5, 0xff, 0x09, 0x00, 0x95, 0xff, 0x2c, 0x00, 0x9b, 0xff, 0x43, 0x00, 0x96, 0xff,
        0x44, 0x00, 0x91, 0xff, 0x6f, 0x00, 0x93, 0xff, 0x7e, 0x00, 0x9a, 0xff, 0x83, 0x00, 0x7e, 0xff,
        0x92, 0x00, 0x75, 0xff, 0xa1, 0x00, 0x62, 0xff, 0xc5, 0x00, 0x64, 0xff, 0xe8, 0x00, 0x78, 0xff,
        0xf9, 0x00, 0x67, 0xff, 0xeb, 0x00, 0x4c, 0xff, 0x04, 0x01, 0x46, 0xff, 0x0a, 0x01, 0x3e, 0xff,
        0x45, 0x01, 0x6e, 0xff, 0x85, 0x01, 0xa1, 0xff, 0xa8, 0x01, 0xc3, 0xff, 0xe3, 0x01, 0xf7, 0xff,
        0x0d, 0x02, 0x26, 0x00, 0x39, 0x02, 0x42, 0x00, 0x37, 0x02, 0x54, 0x00, 0x15, 0x02, 0x41, 0x00,
        0xff, 0x01, 0x26, 0x00, 0xbf, 0x01, 0x04, 0x00, 0x8b, 0x01, 0xe5, 0xff, 0x45, 0x01, 0xc6, 0xff,
        0x1a, 0x01, 0xc0, 0xff, 0xf5, 0x00, 0xc9, 0xff, 0xd6, 0x00, 0xc4, 0xff, 0xc7, 0x00, 0xce, 0xff,
        0xbd, 0x00, 0xdf, 0xff, 0xe9, 0x00, 0x1d, 0x00, 0x00, 0x01, 0x3c, 0x00, 0xd4, 0x00, 0x38, 0x00,
        0xbc, 0x00, 0x24, 0x00, 0xae, 0x00, 0x23, 0x00, 0x94, 0x00, 0x2c, 0x00, 0x6b, 0x00, 0x0f, 0x00,
        0x13, 0x00, 0xec, 0xff, 0x05, 0x00, 0xef, 0xff, 0xeb, 0xff, 0xe6, 0xff, 0xd5, 0xff, 0xef, 0xff,
        0xe3, 0xff, 0xfb, 0xff, 0xc6, 0xff, 0x06, 0x00, 0xc8, 0xff, 0x0d, 0x00, 0xe0, 0xff, 0x35, 0x00,
        0xe6, 0xff, 0x49, 0x00, 0xeb, 0xff, 0x55, 0x00, 0xc8, 0xff, 0x53, 0x00, 0xb1, 0xff, 0x4b, 0x00,
        0x9d, 0xff, 0x39, 0x00, 0x81, 0xff, 0x3c, 0x00, 0x51, 0xff, 0x23, 0x00, 0x1d, 0xff, 0x0d, 0x00,
        0x15, 0xff, 0x12, 0x00, 0xfe, 0xfe, 0x05, 0x00, 0xcd, 0xfe, 0xed, 0xff, 0xca, 0xfe, 0xf7, 0xff,
        0xd8, 0xfe, 0x10, 0x00, 0xf2, 0xfe, 0x2e, 0x00, 0xe2, 0xfe, 0x27, 0x00, 0xca, 0xfe, 0x1e, 0x00,
        0xd4, 0xfe, 0x2e, 0x00, 0xd8, 0xfe, 0x3c, 0x00, 0xd5, 0xfe, 0x3a, 0x00, 0xbe, 0xfe, 0x2d, 0x00,
        0xad, 0xfe, 0x1a, 0x00, 0xa0, 0xfe, 0x11, 0x00, 0xa3, 0xfe, 0x10, 0x00, 0x97, 0xfe, 0x0b, 0x00,
        0x8c, 0xfe, 0x01, 0x00, 0xa3, 0xfe, 0x0a, 0x00, 0xd3, 0xfe, 0x34, 0x00, 0xe2, 0xfe, 0x30, 0x00,
        0xd7, 0xfe, 0x22, 0x00, 0xeb, 0xfe, 0x27, 0x00, 0xff, 0xfe, 0x2a, 0x00, 0x19, 0xff, 0x2a, 0x00,
        0x0b, 0xff, 0x14, 0x00, 0x00, 0xff, 0xe9, 0xff, 0xef, 0xfe, 0xbe, 0xff, 0xe1, 0xfe, 0x94, 0xff,
        0x19, 0xff, 0x9c, 0xff, 0x3b, 0xff, 0x98, 0xff, 0x5e, 0xff, 0x91, 0xff, 0x94, 0xff, 0x9b, 0xff,
        0xc3, 0xff, 0xb4, 0xff, 0x04, 0x00, 0xd0, 0xff, 0x2f, 0x00, 0xe4, 0xff, 0x79, 0x00, 0x04, 0x00,
        0xa8, 0x00, 0x26, 0x00, 0xb2, 0x00, 0x11, 0x00, 0xcc, 0x00, 0x18, 0x00, 0xdc, 0x00, 0x10, 0x00,
        0xce, 0x00, 0xfd, 0xff, 0x03, 0x01, 0x08, 0x00, 0x37, 0x01, 0x3a, 0x00, 0x23, 0x01, 0x12, 0x00,
        0x22, 0x01, 0xfe, 0xff, 0x21, 0x01, 0xf6, 0xff, 0x4b, 0x01, 0x04, 0x00, 0x71, 0x01, 0x1a, 0x00,
        0x69, 0x01, 0x01, 0x00, 0x43, 0x01, 0xd7, 0xff, 0x3a, 0x01, 0xb9, 0xff, 0x50, 0x01, 0xb0, 0xff,
};

void
dump_opus_packet(uint8_t const * const bb, unsigned int const uiLen) {
    unsigned int ui = 0;

    printf("Packet size: 0x%2x\n", uiLen);

    do {
        printf("%02x %02x %02x %02x %02x %02x %02x %02x\n",
                bb[ui+0], bb[ui+1], bb[ui+2], bb[ui+3], bb[ui+4], bb[ui+5], bb[ui+6], bb[ui+7]);

        ui += 8;
    } while (ui < uiLen);
}


void opus_encode_known_packet() {
    int rv = 0;

    OpusEncoder *oeEncoder;
    int iiBytesEncoded;

    uint8_t bbOpusBits[128] __attribute__((aligned (8)));

    memset(bbOpusBits, 0x00, 128);

    oeEncoder = opus_encoder_create(48000, 2, OPUS_APPLICATION_RESTRICTED_LOWDELAY, &rv);
    assert(rv == 0);

    rv = opus_encoder_ctl(oeEncoder, OPUS_SET_BITRATE(32000));
    assert(rv == 0);

    rv = opus_encoder_ctl(oeEncoder, OPUS_SET_COMPLEXITY(5));
    assert(rv == 0);

    iiBytesEncoded = opus_encode(oeEncoder, bbKnownBuffer, 480, bbOpusBits, 128);

    printf("Encoded to bytes: %2x\n", iiBytesEncoded);
    dump_opus_packet(bbOpusBits, iiBytesEncoded);


    opus_encoder_destroy(oeEncoder);
}



int main(void) {
    opus_encode_known_packet();

    return 0;
}



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
Url : http://lists.xiph.org/pipermail/opus/attachments/20150719/54861190/attachment.pgp 


More information about the opus mailing list