[vlc-devel] [PATCH] opus: add opus encoder

Rafaël Carré funman at videolan.org
Wed Sep 18 21:28:32 CEST 2013


Hello,

Le 17/09/2013 10:59, Denis Charmet a écrit :
> Hi,
> 
> Le lundi 16 septembre 2013 à 11:52:47, Tristan Matthews a écrit :

>> @@ -213,6 +218,158 @@ int opus_header_parse(const unsigned char *packet, int len, OpusHeader *h)
>>      return 1;
>>  }
>>  
>> +#define readint(buf, base) (((buf[base+3]<<24)&0xff000000)| \
>> +                           ((buf[base+2]<<16)&0xff0000)| \
>> +                           ((buf[base+1]<<8)&0xff00)| \
>> +                           (buf[base]&0xff))
>> +#define writeint(buf, base, val) do{ buf[base+3]=((val)>>24)&0xff; \
>> +                                     buf[base+2]=((val)>>16)&0xff; \
>> +                                     buf[base+1]=((val)>>8)&0xff; \
>> +                                     buf[base]=(val)&0xff; \
>> +                                 }while(0)
>> +#define writeshort(buf, base, val) do{ buf[base+1]=((val)>>8)&0xff; \
>> +                                       buf[base]=(val)&0xff; \
>> +                                 }while(0)
>> +
> You are assuming little endian running host what about a big endian?
> (yes it is rare but still).

The little-endianness is specified by
http://tools.ietf.org/html/draft-ietf-codec-oggopus-01#section-5.2

In any way it's better to use the existing VLC macros GetDWLE SetDWLE
and SetWLE but I think this code is correct anyway.



More information about the vlc-devel mailing list