<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:Webdings;
        panose-1:5 3 1 2 1 5 9 6 7 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;
        mso-fareast-language:EN-US;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor=white lang=EN-GB link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='color:#1F497D'>Yanick &amp; Jean-Marc,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>First of all thank you very much for taking your time to try to help me.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Hi Yanick,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>This is what I am trying to do, but for example the function SpeexPreprocessState *speex_preprocess_state_init has lots of pointers that are initialize with static inline void *speex_alloc (int size). So I am trying to convert all this pointers into arrays but it is getting messy trying to found out how big they need to be, and not sure if it will work. And it is not only the struct SpeexPreprocessState_ that has lots of pointers there are other structures with pointers too. So I am trying to replace this pointers with arrays.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>This is what I am doing but not sure if it is correct:<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal>spx_word16_t *frame; <o:p></o:p></p><p class=MsoNormal>converted to:<o:p></o:p></p><p class=MsoNormal>spx_word16_t frame[2*N];<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>st-&gt; frame = (spx_word16_t *)speex_alloc(2*N*sizeof(spx_word16_t));<o:p></o:p></p><p class=MsoNormal>converted to:<o:p></o:p></p><p class=MsoNormal>for(i=0;i&lt;(2*N);i++)<o:p></o:p></p><p class=MsoNormal>{<o:p></o:p></p><p class=MsoNormal>&nbsp;&nbsp; &nbsp;st-&gt;frame[i] = 0;<o:p></o:p></p><p class=MsoNormal>}<o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> <o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Hi Jean-Marc<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>I saw the os_support.h file, but what are you suggesting to change the malloc() with, maybe I didn&#8217;t explain my self very well, my problem is that I cannot use dynamic memory. So everything needs to be define as static with a specific size arrays.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Again thank you both for your support.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Many thanks,<o:p></o:p></span></p><div><p class=MsoNormal><span style='color:#1F497D'>Best</span><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D;mso-fareast-language:EN-GB'> Regards<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D;mso-fareast-language:EN-GB'>---------------------------------------------</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#1F497D;mso-fareast-language:EN-GB'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D;mso-fareast-language:EN-GB'>Helios Cuevas López</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#1F497D;mso-fareast-language:EN-GB'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D;mso-fareast-language:EN-GB'>Embedded Software Engineer<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#1F497D;mso-fareast-language:EN-GB'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D;mso-fareast-language:EN-GB'>Castle Care-tech Ltd.</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#1F497D;mso-fareast-language:EN-GB'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D;mso-fareast-language:EN-GB'>First Floor, 6 Bracknell Beeches,</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#1F497D;mso-fareast-language:EN-GB'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D;mso-fareast-language:EN-GB'>Old Bracknell Lane West,</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#1F497D;mso-fareast-language:EN-GB'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D;mso-fareast-language:EN-GB'>Bracknell, Berkshire, RG12 7BW</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#1F497D;mso-fareast-language:EN-GB'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D;mso-fareast-language:EN-GB'>Office - 01344 469470</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#1F497D;mso-fareast-language:EN-GB'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D;mso-fareast-language:EN-GB'>Direct Dial - 01344 469485</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#1F497D;mso-fareast-language:EN-GB'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D;mso-fareast-language:EN-GB'>FAX - 01344 469489<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#1F497D;mso-fareast-language:EN-GB'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='color:#1F497D;mso-fareast-language:EN-GB'><a href="http://www.castle-caretech.com/">http://www.castle-caretech.com</a><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D;mso-fareast-language:EN-GB'><a href="http://www.pyronix.com/">http://www.pyronix.com/</a><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D;mso-fareast-language:EN-GB'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='background:white'><span lang=EN-US style='font-size:10.5pt;font-family:"Arial","sans-serif";color:#1F497D;mso-fareast-language:EN-GB'>This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed.</span><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D;mso-fareast-language:EN-GB'><o:p></o:p></span></p><p class=MsoNormal style='background:white'><span lang=EN-US style='font-size:10.5pt;font-family:"Arial","sans-serif";color:#1F497D;mso-fareast-language:EN-GB'>If you have received this e-mail in error, please destroy this message and kindly notify the sender by reply e-mail</span><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D;mso-fareast-language:EN-GB'><o:p></o:p></span></p><p class=MsoNormal style='background:white'><span lang=EN-US style='font-size:10.5pt;font-family:Consolas;color:#1F497D;mso-fareast-language:EN-GB'>&nbsp;</span><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D;mso-fareast-language:EN-GB'><o:p></o:p></span></p><p class=MsoNormal style='background:white'><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D;mso-fareast-language:EN-GB'>&nbsp;&nbsp;</span><span style='font-size:18.0pt;font-family:Webdings;color:green;mso-fareast-language:EN-GB'>P</span><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D;mso-fareast-language:EN-GB'>&nbsp;</span></b><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:green;mso-fareast-language:EN-GB'>please don't print this e-mail unless you really need to.</span></b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222;mso-fareast-language:EN-GB'><o:p></o:p></span></p></div><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:EN-GB'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:EN-GB'> Yanick Bourbeau [mailto:ybourbeau@mrgtech.ca] <br><b>Sent:</b> 21 May 2013 17:52<br><b>To:</b> Helios Lopez<br><b>Subject:</b> Re: [Speex-dev] Library without malloc<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><div><p class=MsoNormal>You don't need malloc at all. Just create a byte array like:<br><br>unsigned char buffer[160];<br><br>And use &amp;buffer[0] as pointer in speex functions?<br><br><br>On 13-05-21 12:17 PM, Helios Lopez wrote:<o:p></o:p></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal>Dear all,<o:p></o:p></p><p class=MsoNormal>&nbsp;<o:p></o:p></p><p class=MsoNormal>I am trying to use the Speex library pre-processor, I only need the VAD and Echo Canceller.<o:p></o:p></p><p class=MsoNormal>I am using a STM32F103 processor, but I am using a tiny OS and it doesn&#8217;t allow to use malloc.<o:p></o:p></p><p class=MsoNormal>&nbsp;<o:p></o:p></p><p class=MsoNormal>Is there a version of the library that will work without the need of using &nbsp;malloc?<o:p></o:p></p><p class=MsoNormal>&nbsp;<o:p></o:p></p><p class=MsoNormal>Obviously I will use all the time the same parameters, like 8kHz sampling rate, 160 frame&#8230;<o:p></o:p></p><p class=MsoNormal>&nbsp;<o:p></o:p></p><p class=MsoNormal>I will appreciate any help or idea that you could give me.<o:p></o:p></p><p class=MsoNormal>&nbsp;<o:p></o:p></p><p class=MsoNormal>Many thanks,<o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";mso-fareast-language:EN-GB'>Best Regards</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";mso-fareast-language:EN-GB'>---------------------------------------------</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";mso-fareast-language:EN-GB'>Helios Cuevas López</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";mso-fareast-language:EN-GB'>Embedded Software Engineer</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt'>&nbsp;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";mso-fareast-language:EN-GB'>Castle Care-tech Ltd.</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";mso-fareast-language:EN-GB'>First Floor, 6 Bracknell Beeches,</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";mso-fareast-language:EN-GB'>Old Bracknell Lane West,</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";mso-fareast-language:EN-GB'>Bracknell, Berkshire, RG12 7BW</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";mso-fareast-language:EN-GB'>Office - 01344 469470</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";mso-fareast-language:EN-GB'>Direct Dial - 01344 469485</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";mso-fareast-language:EN-GB'>FAX - 01344 469489</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt'>&nbsp;</span><o:p></o:p></p><p class=MsoNormal><span style='mso-fareast-language:EN-GB'><a href="http://www.castle-caretech.com/">http://www.castle-caretech.com</a></span><o:p></o:p></p><p class=MsoNormal><span style='mso-fareast-language:EN-GB'><a href="http://www.pyronix.com/">http://www.pyronix.com/</a></span><o:p></o:p></p><p class=MsoNormal><span style='mso-fareast-language:EN-GB'>&nbsp;</span><o:p></o:p></p><p class=MsoNormal style='background:white'><span lang=EN-US style='font-size:10.5pt;font-family:"Arial","sans-serif";mso-fareast-language:EN-GB'>This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed.</span><o:p></o:p></p><p class=MsoNormal style='background:white'><span lang=EN-US style='font-size:10.5pt;font-family:"Arial","sans-serif";mso-fareast-language:EN-GB'>If you have received this e-mail in error, please destroy this message and kindly notify the sender by reply e-mail</span><o:p></o:p></p><p class=MsoNormal style='background:white'><span lang=EN-US style='font-size:10.5pt;font-family:Consolas;mso-fareast-language:EN-GB'>&nbsp;</span><o:p></o:p></p><p class=MsoNormal style='background:white'><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D;mso-fareast-language:EN-GB'>&nbsp;&nbsp;</span><span style='font-size:18.0pt;font-family:Webdings;color:green;mso-fareast-language:EN-GB'>P</span><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D;mso-fareast-language:EN-GB'>&nbsp;</span></b><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:green;mso-fareast-language:EN-GB'>please don't print this e-mail unless you really need to.</span></b><o:p></o:p></p><p class=MsoNormal>&nbsp;<o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:EN-GB'><br clear=all>______________________________________________________________________<br><br><br>Castle Care-Tech, First Floor, 6 Bracknell Beeches, Old Bracknell Lane West, Bracknell, Berkshire, RG12 7BW.<br>Telephone 01344 469479 | Fax 01344 469489 | Web <a href="http://www.castle-caretech.com">www.castle-caretech.com</a><br><br>Disclaimer:<br>This Email contains confidential and proprietary information some or all of which may be legally privileged. It is for the intended recipient only. If you have received this Email in error, please notify the author immediately by telephone or by replying to this Email. If you are not the intended recipient you must not use, disclose, distribute, copy, print or rely on this Email. Castle is part of the Secure Holdings Group and is Registered in England with Company Number 3218507. Castle, Secure House, Braithwell Way, Hellaby, S. Yorkshire, S66 8QY, England.<br>______________________________________________________________________<br><br><br><br><o:p></o:p></span></p><pre>_______________________________________________<o:p></o:p></pre><pre>Speex-dev mailing list<o:p></o:p></pre><pre><a href="mailto:Speex-dev@xiph.org">Speex-dev@xiph.org</a><o:p></o:p></pre><pre><a href="http://lists.xiph.org/mailman/listinfo/speex-dev">http://lists.xiph.org/mailman/listinfo/speex-dev</a><o:p></o:p></pre></blockquote><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:EN-GB'><o:p>&nbsp;</o:p></span></p></div><br clear="both">
______________________________________________________________________<BR>
<BR>
<BR>
Castle Care-Tech, First Floor, 6 Bracknell Beeches, Old Bracknell Lane West, Bracknell, Berkshire, RG12 7BW.<BR>
Telephone 01344 469479 | Fax 01344 469489 | Web www.castle-caretech.com<BR>
<BR>
Disclaimer:<BR>
This Email contains confidential and proprietary information some or all of which may be legally privileged.  It is for the intended recipient only. If you have received this Email in error, please notify the  author immediately by telephone or by replying to this Email. If you are not the intended recipient you must not use, disclose, distribute, copy, print or rely on this Email.  Castle is part of the Secure Holdings Group and is Registered in England with Company Number 3218507. Castle, Secure House, Braithwell Way, Hellaby, S. Yorkshire, S66 8QY, England.<BR>
______________________________________________________________________<BR>
</body></html>