Re: using unsigned short instead of short for input frame
Mashal al-shboul <[email protected]> Fri, 9 Mar 2012 08:36:05 -0800 (PST)
| Newsgroups | gmane.comp.audio.compression.speex.devel |
|---|---|
| Message-ID | <[email protected]> |
Thanks for your appreciated help. i found casting fromunsigned short to short gives different value: unsigned short FFFF=65535 where short FFFF= -1. however, can i configure speex codec (specifically speex_encode_int function) to take input of type unsigned short instead of short so that i avoid casting errors ? Regards, Mashal ________________________________ From: Yanick Bourbeau <[email protected]> To: Mashal al-shboul <[email protected]> Sent: Friday, March 9, 2012 4:29 PM Subject: Re: [Speex-dev] using unsigned short instead of short for input frame uint16_t is usually a typedef of an unsigned short or int depending of the platform. It is supposed to work. About unsigned short to short conversion it is normal since unsigned short starts at 0 and short starts at -((2^16)/2)-1 [-32767]. If you really want to keep the same numeric value you could cast the short to unsigned int (32bytes) and add 32767 to the value. On 12-03-09 02:59 AM, Mashal al-shboul wrote: Hi Speex Experts,Thanks for this great mailing list. > > > i want to compress a frame of(uint16_t) audio samples, i found that speex codec assumes input frame of type short. fortunately,both data types are of 2-bytes , so my questions : >- can i cast data types for input to speex?, if so,can i cast uint16_t to unsigned short and still be accepted by speex ? , >because i found converting from uint16_t to short does completely change the values of the samples(unsigned to signed !). > > >Any help or suggestion is appreciated. Thanks in advance. > > >Regards, >Mash'al > > > > >_______________________________________________ Speex-dev mailing list [email protected] http://lists.xiph.org/mailman/listinfo/speex-dev e _______________________________________________ Speex-dev mailing list [email protected] http://lists.xiph.org/mailman/listinfo/speex-dev