<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Well, Thank you Anthony. 3 questions In summary,</div><div><br></div><div>1) in&nbsp;</div><div><blockquote type="cite">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (x &lt; rlen) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;z += (int32_t) *(fp + x);</blockquote><br></div><div>Any difference if change the "+=" to "=" since z is 0? It just confused me.</div><div><br></div><div>2) &nbsp;If n1 = 32768, n2 = 32766,&nbsp;&nbsp;after use MACRO&nbsp;</div><div>switch_normalize_to_16bit(n1)</div><div>switch_normalize_to_16bit(n2)</div><div><br></div><div>the result will be:</div><div>n1 = 32767/2 = 16383</div><div>n2 = 32766</div><div><br></div><div>is that the expected result?&nbsp;</div><div><div><br></div><div>3) Is there any chance rlen and wlen both > 0?</div><div><br><div><div><div><html>On Apr 6, 2009, at 11:16 PM, Anthony Minessale wrote:</html><br class="Apple-interchange-newline"><blockquote type="cite">what ?<br><br>I don't know what your question is.</blockquote><blockquote type="cite"><br><br><div class="gmail_quote">On Mon, Apr 6, 2009 at 9:35 AM, seven du <span dir="ltr">&lt;<a href="mailto:seven@idapted.com">seven@idapted.com</a>></span> wrote:<br> <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi, can someone explain this &nbsp;to me?<br> <br> In switch_core_media_bug.c, around line 173:<br> <br> <br> <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (x = 0; x &lt; blen; x++) {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int32_t z = 0;<br> <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (x &lt; rlen) {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;z += (int32_t) *(fp + x); &nbsp; &nbsp; //what's difference here with z =<br> (int32_t) *(fp + x) ?</blockquote></div></blockquote><blockquote type="cite"><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (x &lt; wlen) {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;z += (int32_t) *(dp + x);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;switch_normalize_to_16bit(z);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*(fp + x) = (int16_t) z / 2;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br> <br> And for switch_normalize_to_16bit, according to switch_utils.h,<br> <br> #define SWITCH_SMAX 32767<br> #define SWITCH_SMIN -32768<br> #define switch_normalize_to_16bit(n) if (n > SWITCH_SMAX) n =<br> SWITCH_SMAX / 2; else if (n &lt; SWITCH_SMIN) n = SWITCH_SMIN / 2;<br> <br> Then<br> switch_normalize_to_16bit( 32768 ), z = 32767/2, and (int16_t) z / 2 =<br> 32767/4<br> switch_normalize_to_16bit( 32766) , z = 32766, and (int16_t) z / 2 =<br> 32766/2<br> <br> Does that make sense? I guess it should be like this:<br> <br> #define switch_normalize_to_16bit(n) if (n > SWITCH_SMAX) n =<br> SWITCH_SMAX / 2; else if (n &lt; SWITCH_SMIN) n = SWITCH_SMIN / 2; else n<br> = n / 2;<br> <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;switch_normalize_to_16bit(z);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*(fp + x) = (int16_t) z;<br> <br> <br> Thank you.<br> <br> _______________________________________________<br> Freeswitch-dev mailing list<br> <a href="mailto:Freeswitch-dev@lists.freeswitch.org">Freeswitch-dev@lists.freeswitch.org</a><br> <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br> UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br> <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br> </blockquote></div><br><br clear="all"><br>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/">http://www.cluecon.com/</a><br> <br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br> IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a href="http://iax:guest@conference.freeswitch.org/888">iax:guest@conference.freeswitch.org/888</a><br> <a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>pstn:213-799-1400<br> _______________________________________________<br>Freeswitch-dev mailing list<br><a href="mailto:Freeswitch-dev@lists.freeswitch.org">Freeswitch-dev@lists.freeswitch.org</a><br>http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev<br>UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev<br>http://www.freeswitch.org<br></blockquote></div><br></div></div></div></div></body></html>