<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic FIRInitAlloc and FIRInit in Intel® Integrated Performance Primitives</title>
    <link>https://community.intel.com/t5/Intel-Integrated-Performance/FIRInitAlloc-and-FIRInit/m-p/955489#M19036</link>
    <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Hi:&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;I'm having a problem with IPP. I don't know what's causing it, but I want to&lt;/DIV&gt;
&lt;DIV&gt;try something that might fix it.&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Currently, I use code that looks like this:&lt;/DIV&gt;
&lt;P&gt;&lt;FONT size="1"&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;	_numQuads = numTaps;

	if (_numQuads)
	{
		_tapVals = ippsMalloc_32f(_numQuads);
		_delayVals = ippsMalloc_16s(_numQuads);

		RealVector firCoefs = ds.ImpulseResponse(numTaps);

		for (long i=0; i&amp;lt;_numQuads; ++i)
		{	// fill in the taps
			_tapVals&lt;I&gt; = (float)firCoefs&lt;I&gt;;
			_delayVals&lt;I&gt; = 0;
		}

		ippsFIRInitAlloc32f_16s
		(
			&amp;amp;_statePtr,
			_tapVals,
			_numQuads,
			_delayVals
		);
	}&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;I would like to use the FirInit function and allocate and retain the state myself&lt;/P&gt;
&lt;P&gt;I think that's the idea of this function - not sure.&lt;/P&gt;
&lt;P&gt;I've put in some code that I think works.&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;{
	_numQuads = numTaps;

	if (_numQuads)
	{
		_tapVals = ippsMalloc_32f(_numQuads);
		_delayVals = ippsMalloc_16s(_numQuads);

		int BufferSize = ippFirGetStateSize32f_16s(_numQuads);
		// okay - I have the state size, now what do I do with it?

		// I'm thinking, since it's called buffer size that it is the
		// size of pBuffer that is passed?
		_pBuffer = malloc(BufferSize);

		RealVector firCoefs = ds.ImpulseResponse(numTaps);

		for (long i=0; i&amp;lt;_numQuads; ++i)
		{	// fill in the taps
			_tapVals&lt;I&gt; = (float)firCoefs&lt;I&gt;;
			_delayVals&lt;I&gt; = 0;
		}

		ippsFIRInit32f_16s
		(
			&amp;amp;_statePtr,
			_tapVals,
			_numQuads,
			_delayVals,
			_pBuffer
		);

		// is this right?  What about the intialization of _statePtr?
	}
}&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;BTW the documentation is terrible on this topic and there are no examples.&lt;/P&gt;
&lt;P&gt;could someone please tell me:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Why would I use FirInit instead of FirInitAlloc?&lt;/LI&gt;
&lt;LI&gt;Isthe value returned by FIRGetStateSize the size of the buffer provided in the last argument of FIRInit? Is it the size of the what is pointedto by*pState?&lt;/LI&gt;
&lt;LI&gt;Which one of these do I need to allocate myself?&lt;/LI&gt;
&lt;LI&gt;Which malloc function should I use.&lt;/LI&gt;
&lt;LI&gt;- better yet - fill in the codeabove that works.&lt;/LI&gt;
&lt;LI&gt;Will I need to callFIRInit prior to using the filterevery time? (i.e.if I've initialized the filter using FIRInit once and I holdpState, can I simply call FIR with this state pointer each time I want to filter some data?&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;Answers are greatly appreciated.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;</description>
    <pubDate>Fri, 23 Dec 2005 06:08:57 GMT</pubDate>
    <dc:creator>peterp</dc:creator>
    <dc:date>2005-12-23T06:08:57Z</dc:date>
    <item>
      <title>FIRInitAlloc and FIRInit</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/FIRInitAlloc-and-FIRInit/m-p/955489#M19036</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Hi:&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;I'm having a problem with IPP. I don't know what's causing it, but I want to&lt;/DIV&gt;
&lt;DIV&gt;try something that might fix it.&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Currently, I use code that looks like this:&lt;/DIV&gt;
&lt;P&gt;&lt;FONT size="1"&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;	_numQuads = numTaps;

	if (_numQuads)
	{
		_tapVals = ippsMalloc_32f(_numQuads);
		_delayVals = ippsMalloc_16s(_numQuads);

		RealVector firCoefs = ds.ImpulseResponse(numTaps);

		for (long i=0; i&amp;lt;_numQuads; ++i)
		{	// fill in the taps
			_tapVals&lt;I&gt; = (float)firCoefs&lt;I&gt;;
			_delayVals&lt;I&gt; = 0;
		}

		ippsFIRInitAlloc32f_16s
		(
			&amp;amp;_statePtr,
			_tapVals,
			_numQuads,
			_delayVals
		);
	}&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;I would like to use the FirInit function and allocate and retain the state myself&lt;/P&gt;
&lt;P&gt;I think that's the idea of this function - not sure.&lt;/P&gt;
&lt;P&gt;I've put in some code that I think works.&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;{
	_numQuads = numTaps;

	if (_numQuads)
	{
		_tapVals = ippsMalloc_32f(_numQuads);
		_delayVals = ippsMalloc_16s(_numQuads);

		int BufferSize = ippFirGetStateSize32f_16s(_numQuads);
		// okay - I have the state size, now what do I do with it?

		// I'm thinking, since it's called buffer size that it is the
		// size of pBuffer that is passed?
		_pBuffer = malloc(BufferSize);

		RealVector firCoefs = ds.ImpulseResponse(numTaps);

		for (long i=0; i&amp;lt;_numQuads; ++i)
		{	// fill in the taps
			_tapVals&lt;I&gt; = (float)firCoefs&lt;I&gt;;
			_delayVals&lt;I&gt; = 0;
		}

		ippsFIRInit32f_16s
		(
			&amp;amp;_statePtr,
			_tapVals,
			_numQuads,
			_delayVals,
			_pBuffer
		);

		// is this right?  What about the intialization of _statePtr?
	}
}&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;BTW the documentation is terrible on this topic and there are no examples.&lt;/P&gt;
&lt;P&gt;could someone please tell me:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Why would I use FirInit instead of FirInitAlloc?&lt;/LI&gt;
&lt;LI&gt;Isthe value returned by FIRGetStateSize the size of the buffer provided in the last argument of FIRInit? Is it the size of the what is pointedto by*pState?&lt;/LI&gt;
&lt;LI&gt;Which one of these do I need to allocate myself?&lt;/LI&gt;
&lt;LI&gt;Which malloc function should I use.&lt;/LI&gt;
&lt;LI&gt;- better yet - fill in the codeabove that works.&lt;/LI&gt;
&lt;LI&gt;Will I need to callFIRInit prior to using the filterevery time? (i.e.if I've initialized the filter using FIRInit once and I holdpState, can I simply call FIR with this state pointer each time I want to filter some data?&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;Answers are greatly appreciated.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;</description>
      <pubDate>Fri, 23 Dec 2005 06:08:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/FIRInitAlloc-and-FIRInit/m-p/955489#M19036</guid>
      <dc:creator>peterp</dc:creator>
      <dc:date>2005-12-23T06:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: FIRInitAlloc and FIRInit</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/FIRInitAlloc-and-FIRInit/m-p/955490#M19037</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;there are comments from our expert:&lt;/P&gt;&lt;FONT size="2"&gt;
&lt;P&gt;1) Why would I use FirInit instead of FirInitAlloc? &lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;
&lt;P&gt;To have ability to manipulate with memory buffers yourself. For example itmight bevery critical for using IPP in device drivers or for using external threading.&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;2) Is the value returned by FIRGetStateSize the size of the buffer provided in the last argument of FIRInit? Is it the size of the what is pointed to by *pState? &lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;
&lt;P&gt;Yes, it is size of State structure + several extra bytes for alignment. You should use BufferSize variable for amount of bytes to allocate. Because of the possible alignment procedure pBuffer pointer and pState pointer can differ. Therefore you should use one returned by FIRInit. &lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;3) Which one of these do I need to allocate myself? &lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;
&lt;P&gt;Of course pBuffer.&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;4) Which malloc function should I use. &lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;
&lt;P&gt;BufferSize has the same root as SizeOf()  Size always is provided in bytes. Therefore you should use ippsMalloc_8u().&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;- better yet - fill in the code above that works. &lt;/P&gt;
&lt;P&gt;5) Will I need to call FIRInit prior to using the filter every time? (i.e. if I've initialized the filter using FIRInit once and I hold pState, can I simply call FIR with this state pointer each time I want to filter some data?&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;
&lt;P&gt;You dont need to call FIRInit() each time  once created, filter can be used as many times as you need. If you need to clear filter history you can simply use ippsFIRSetDelayLine(), if you need to change taps (for example in case of taps adaptation through LMS) (but not filter order)  you can use ippsFIRSetTaps() function.&lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;Regards,&lt;BR /&gt; Vladimir&lt;/P&gt;
&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 30 Dec 2005 20:17:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/FIRInitAlloc-and-FIRInit/m-p/955490#M19037</guid>
      <dc:creator>Vladimir_Dudnik</dc:creator>
      <dc:date>2005-12-30T20:17:42Z</dc:date>
    </item>
  </channel>
</rss>

