<?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 Using UMC decoders in Intel® Integrated Performance Primitives</title>
    <link>https://community.intel.com/t5/Intel-Integrated-Performance/Using-UMC-decoders/m-p/803096#M3397</link>
    <description>I'm trying to decode video stream but I do not have success in doing that. I'm working according to this example:&lt;A href="http://software.intel.com/en-us/articles/getting-started-with-intel-ipp-unified-media-classes-sample/"&gt;http://software.intel.com/en-us/articles/getting-started-with-intel-ipp-unified-media-classes-sample/&lt;/A&gt;, but with one big difference. I do not have a full buffer of input stream but it arrives in chunks. Here is the algorithm:&lt;DIV&gt;&lt;SPAN style="font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;PRE&gt;[bash]bool MyDecoder::read(Buffer &amp;amp;buffer, unsigned int length)
{
	semaphore.lock();
	
	// Append new arrived data to currentBuffer
	currentBuffer-&amp;gt;write(buffer, length);
	semaphore.unlock();

	return true;
}

bool MyDecoder::decode(Image ℑ)
{
	semaphore.lock();

	// We have bufferLength unread bytes to the end of buffer
	int bufferLength = currentBuffer-&amp;gt;getUnreadLength();
	
	// 
	if(bufferLength &amp;gt; 1000000)
	{
		UMC::VideoData  DataOut;
		UMC::MediaData  DataIn; 
	
		...
		
		// Read all bytes into DataIn (I hope that DataIn will know how many bytes are actually used, after I call GetFrame)
		UMC_CHK(DataIn.SetBufferPointer(currentBuffer-&amp;gt;getPointer(), bufferLength));
		UMC_CHK(DataIn.SetDataSize(bufferLength));
		
		// ... Initialize DataOut

		// Call decode. Decoder is initialized earlier (and it is not instantiated in this method, but somewhere in MyDecoder constructor, 
		// for example. It is initialized in a proper way, since I have get it working for some videos.
		UMC::Status status = decoder.GetFrame(&amp;amp;DataIn, &amp;amp;DataOut);
		
		// If we do not have decoded image, "read" will be called again
		if(status != UMC::UMC_OK) return false;
		
		...
		
		// Move read position of the buffer to the actual bytes that decoder has used in this decoding cycle
		currentBuffer-&amp;gt;seek(DataIn.GetDataSize());
		
		// Return true, so decode will be called again
		return true;
	}
	else
	{
		// "read" will be called again until we fill buffer with at least 1000000 
		return false;
	}
	
	semaphore.unlock();
}[/bash]&lt;/PRE&gt; &lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;DIV&gt;What am I doing wrong? Many thanks!&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Aleksandar&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 20 Oct 2010 09:53:00 GMT</pubDate>
    <dc:creator>vucetica</dc:creator>
    <dc:date>2010-10-20T09:53:00Z</dc:date>
    <item>
      <title>Using UMC decoders</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Using-UMC-decoders/m-p/803096#M3397</link>
      <description>I'm trying to decode video stream but I do not have success in doing that. I'm working according to this example:&lt;A href="http://software.intel.com/en-us/articles/getting-started-with-intel-ipp-unified-media-classes-sample/"&gt;http://software.intel.com/en-us/articles/getting-started-with-intel-ipp-unified-media-classes-sample/&lt;/A&gt;, but with one big difference. I do not have a full buffer of input stream but it arrives in chunks. Here is the algorithm:&lt;DIV&gt;&lt;SPAN style="font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;PRE&gt;[bash]bool MyDecoder::read(Buffer &amp;amp;buffer, unsigned int length)
{
	semaphore.lock();
	
	// Append new arrived data to currentBuffer
	currentBuffer-&amp;gt;write(buffer, length);
	semaphore.unlock();

	return true;
}

bool MyDecoder::decode(Image ℑ)
{
	semaphore.lock();

	// We have bufferLength unread bytes to the end of buffer
	int bufferLength = currentBuffer-&amp;gt;getUnreadLength();
	
	// 
	if(bufferLength &amp;gt; 1000000)
	{
		UMC::VideoData  DataOut;
		UMC::MediaData  DataIn; 
	
		...
		
		// Read all bytes into DataIn (I hope that DataIn will know how many bytes are actually used, after I call GetFrame)
		UMC_CHK(DataIn.SetBufferPointer(currentBuffer-&amp;gt;getPointer(), bufferLength));
		UMC_CHK(DataIn.SetDataSize(bufferLength));
		
		// ... Initialize DataOut

		// Call decode. Decoder is initialized earlier (and it is not instantiated in this method, but somewhere in MyDecoder constructor, 
		// for example. It is initialized in a proper way, since I have get it working for some videos.
		UMC::Status status = decoder.GetFrame(&amp;amp;DataIn, &amp;amp;DataOut);
		
		// If we do not have decoded image, "read" will be called again
		if(status != UMC::UMC_OK) return false;
		
		...
		
		// Move read position of the buffer to the actual bytes that decoder has used in this decoding cycle
		currentBuffer-&amp;gt;seek(DataIn.GetDataSize());
		
		// Return true, so decode will be called again
		return true;
	}
	else
	{
		// "read" will be called again until we fill buffer with at least 1000000 
		return false;
	}
	
	semaphore.unlock();
}[/bash]&lt;/PRE&gt; &lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;DIV&gt;What am I doing wrong? Many thanks!&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Aleksandar&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 20 Oct 2010 09:53:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Using-UMC-decoders/m-p/803096#M3397</guid>
      <dc:creator>vucetica</dc:creator>
      <dc:date>2010-10-20T09:53:00Z</dc:date>
    </item>
    <item>
      <title>Using UMC decoders</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Using-UMC-decoders/m-p/803097#M3398</link>
      <description>&lt;P&gt;Hello Aleksander, &lt;BR /&gt;&lt;BR /&gt;There are some discussion about the stream data decoder in the forum.Most ofproblems should be in the decoder loops and the Datain Buffer.some ofsmall problem may be the Data in/ ut initialization.I can't check your code further as norunable test case. Could you check currentBuffer-gt;seek(DataIn.GetDataSize()); and intbufferLength=currentBuffer-gt;getUnreadLength(); make sure if the dataIn is right. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;In addition, I noticed, you create a new Datainif(bufferLengthgt;1000000)ineach call, is it possible to create it in high level as it may keep some buffer data during decoding. and how do you handleUMC_ERR_NOT_ENOUGH_DATA andNULL as input? Justa quick thoughts,&lt;BR /&gt;the main.cpp in UMC sample should be like a chunk data reader model as it use splitter to get Datain ( a piece of chunk data) ( or you may replace the splitter-&amp;gt;GetNextData() with your read the buffer and see if the whole decode work?)&lt;BR /&gt;&lt;BR /&gt;The loop is like&lt;/P&gt;&lt;P&gt; for (Ipp32s i = 0; ; i++)&lt;BR /&gt; {&lt;BR /&gt; if ((3 &amp;gt; in-&amp;gt;GetDataSize()) &amp;amp;&amp;amp;&lt;BR /&gt; (false == bEndOfStream))&lt;BR /&gt; {&lt;BR /&gt; Status statusHelper = splitter-&amp;gt;GetNextData(in.get(), 0);&lt;BR /&gt; if(UMC_OK != statusHelper){&lt;BR /&gt; bEndOfStream = true;&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt; if(!bInitialize)&lt;BR /&gt; {&lt;BR /&gt;.....&lt;BR /&gt; out-&amp;gt;SetAlignment(16);&lt;BR /&gt; out-&amp;gt;Init(params.info.clip_info.width, params.info.clip_info.height, cmd.m_cf);&lt;BR /&gt; out-&amp;gt;Alloc();&lt;BR /&gt; continue;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt; vm_tick t_start = GET_TICKS;&lt;BR /&gt; Status ret = h264Decoder-&amp;gt;GetFrame((bEndOfStream) ? (NULL) : (in.get()), out.get());&lt;BR /&gt; vm_tick t_end = GET_TICKS;&lt;BR /&gt; encode_time += (Ipp64f)(Ipp64s)(t_end-t_start);&lt;/P&gt;&lt;P&gt; if (UMC_ERR_NOT_ENOUGH_DATA == ret)&lt;BR /&gt; {&lt;BR /&gt; if (bEndOfStream)&lt;BR /&gt; break;&lt;BR /&gt; else&lt;BR /&gt; continue;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt; if (UMC_OK != ret)&lt;BR /&gt; continue;&lt;/P&gt;&lt;P&gt; // it is actually UMC_OK=OK&lt;BR /&gt; savedata(f_dst, out.get());&lt;BR /&gt; numDecodedFrames++;&lt;BR /&gt; if (numDecodedFrames &amp;gt;= cmd.m_num_frames &amp;amp;&amp;amp; cmd.m_num_frames != 0)&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Ying &lt;/P&gt;</description>
      <pubDate>Thu, 21 Oct 2010 07:16:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Using-UMC-decoders/m-p/803097#M3398</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2010-10-21T07:16:54Z</dc:date>
    </item>
  </channel>
</rss>

