<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:14pt"><div><span>Thanks for your appreciated help.</span></div><div><span>i found casting from<span style="font-weight: bold;"> unsigned short</span> to <span style="font-weight: bold;">short</span> gives different value: unsigned short FFFF=65535 where short FFFF= -1.</span></div><div><span>however, can i configure speex codec (specifically speex_encode_int function) to take input of type <span style="font-weight: bold;">unsigned short</span> instead of <span style="font-weight: bold;">short </span>so that i avoid casting errors ?</span></div><div><br></div><div>Regards,</div><div>Mashal<br><span></span></div><div><br></div>  <div style="font-family: times new roman, new york, times, serif; font-size: 14pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial"
 size="2"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> Yanick Bourbeau &lt;ybourbeau@mrgtech.ca&gt;<br> <b><span style="font-weight: bold;">To:</span></b> Mashal al-shboul &lt;shboul8989@yahoo.com&gt; <br> <b><span style="font-weight: bold;">Sent:</span></b> Friday, March 9, 2012 4:29 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [Speex-dev] using unsigned short instead of short for input frame<br> </font> </div> <br>
<div id="yiv1290692263">
  

    
  
  <div>
    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. <br>
    <br>
    On 12-03-09 02:59 AM, Mashal al-shboul wrote:
    <blockquote type="cite">
      <div style="color:#000;background-color:#fff;font-family:times new roman, new york, times, serif;font-size:14pt;">
        <div>Hi Speex Experts,Thanks for this great mailing list.</div>
        <div><br>
        </div>
        <div>&nbsp;&nbsp;&nbsp;&nbsp; i want to compress a frame of<span style="
font-weight:bold;"> (uint16_t</span>) audio samples, i found that speex
          codec assumes input frame of type <span style="
font-weight:bold;">short. </span><span>fortunately,both data types are
            of&nbsp; <span style="font-weight:bold;">2-bytes</span> , so my
            questions :</span></div>
        <div><span>- can i cast data types for input to speex?, if so,<span style="font-weight:bold;"> can i cast uint16_t to
              unsigned short and still be accepted by speex</span> ? ,</span></div>
        <div><span>because i found converting from uint16_t to <span style="font-weight:bold;">short</span> does completely
            change the values of the samples(unsigned to signed !).</span></div>
        <div><br>
          <span></span></div>
        <div><span>Any help or suggestion is appreciated. Thanks in
            advance.</span></div>
        <div><br>
          <span></span></div>
        <div><span>Regards,</span></div>
        <div><span>Mash'al</span></div>
        <div><span><br>
          </span></div>
      </div>
      <br>
      <fieldset class="yiv1290692263mimeAttachmentHeader"></fieldset>
      <br>
      <pre>_______________________________________________
Speex-dev mailing list
<a rel="nofollow" class="yiv1290692263moz-txt-link-abbreviated" ymailto="mailto:Speex-dev@xiph.org" target="_blank" href="mailto:Speex-dev@xiph.org">Speex-dev@xiph.org</a>
http://lists.xiph.org/mailman/listinfo/speex-dev
</pre>
    </blockquote>
    e<br>
  </div>

</div><br><br> </div> </div>  </div></body></html>