<?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 Re: mpeg2 decoder - Input buffer question in Intel® Integrated Performance Primitives</title>
    <link>https://community.intel.com/t5/Intel-Integrated-Performance/mpeg2-decoder-Input-buffer-question/m-p/866347#M8372</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Thanks, ofcourse you were rightbut still, I amfacing the same problem.&lt;/P&gt;
&lt;P&gt;Does this code run for you?&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Moshe&lt;/P&gt;</description>
    <pubDate>Mon, 30 Jun 2008 15:39:16 GMT</pubDate>
    <dc:creator>moshe1</dc:creator>
    <dc:date>2008-06-30T15:39:16Z</dc:date>
    <item>
      <title>mpeg2 decoder - Input buffer question</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/mpeg2-decoder-Input-buffer-question/m-p/866345#M8370</link>
      <description>&lt;P&gt;Hi, I want to reopen an issue regarding buffer handling for DataIn object in the GetFrame function.&lt;/P&gt;
&lt;P&gt;This is the old thread about it (&lt;A href="https://community.intel.com/en-us/forums//topic/51651"&gt;http://software.intel.com/en-us/forums//topic/51651&lt;/A&gt;) unfortunately, there was no working solution for it.&lt;/P&gt;
&lt;P&gt;The main problem: How do I handle the input buffers. I see that decoder needs at least 1 frame, and that's fine. But when I try to call the 2nd time with less than a frame, I don't get a fully decoded picture.&lt;/P&gt;
&lt;P&gt;Below is the code I am using (the sample code from the above thread). I can decode only the first BSIZE bytes from the bitstream. No more...&lt;/P&gt;
&lt;P&gt;Any ideas?&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Moshe&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;#define vidW 480&lt;BR /&gt;#define vidH 576&lt;BR /&gt;#define BSIZE 150000&lt;BR /&gt;#define MIN_SIZE 10000 &lt;BR /&gt; UMC::VideoDecoderParams VDecParams; &lt;BR /&gt; UMC::MediaData dataIn; &lt;BR /&gt; UMC::VideoData dataOut; &lt;BR /&gt; UMC::Status umcRes = UMC::UMC_OK; &lt;BR /&gt; FILE* fp=fopen("input.m2v","rb"); &lt;BR /&gt; unsigned char * memBuf=(unsigned char*)malloc(5*1024*1024); &lt;BR /&gt; int br; //Read file to memory &lt;BR /&gt; br = fread(memBuf,5000000,1,fp); &lt;BR /&gt; &lt;BR /&gt; dataIn.SetBufferPointer(memBuf,BSIZE); &lt;BR /&gt; dataIn.SetDataSize(BSIZE); &lt;BR /&gt; MPEG2VideoDecoder* mpg2d=new UMC::MPEG2VideoDecoder(); &lt;BR /&gt; VDecParams.m_pData = &amp;amp;dataIn; &lt;BR /&gt; VDecParams.lFlags = 0;//UMC::FLAG_VDEC_REORDER; &lt;BR /&gt; umcRes = mpg2d-&amp;gt;Init(&amp;amp;VDecParams); &lt;BR /&gt; UMC::VideoDecoderParams vParams; &lt;BR /&gt; umcRes = mpg2d-&amp;gt;GetInfo(&amp;amp;vParams); &lt;BR /&gt; &lt;BR /&gt; umcRes = dataOut.Init(vParams.info.clip_info.width,&lt;BR /&gt; vParams.info.clip_info.height,&lt;BR /&gt; YUV420,&lt;BR /&gt; 8);&lt;BR /&gt; dataOut.Alloc();&lt;BR /&gt; int cc=0; &lt;BR /&gt; while (cc&amp;lt;150) &lt;BR /&gt; { &lt;BR /&gt; umcRes = mpg2d-&amp;gt;GetFrame(&amp;amp;dataIn, &amp;amp;dataOut); &lt;BR /&gt; if (umcRes!=UMC::UMC_OK &amp;amp;&amp;amp; umcRes!=UMC::UMC_ERR_NOT_ENOUGH_DATA) &lt;BR /&gt; break; &lt;BR /&gt; if (umcRes==0) &lt;BR /&gt; {&lt;BR /&gt;&amp;amp;nbs
p; static int ctr = 0;&lt;BR /&gt; printf("got frame: %d
",ctr);&lt;BR /&gt; char fname[256];&lt;BR /&gt; sprintf(fname,"out%04d.yuv",ctr++);&lt;BR /&gt; FILE* fp_out = fopen(fname,"wb");&lt;BR /&gt; if(! fp_out)&lt;BR /&gt; {&lt;BR /&gt; printf("Can't open file: %s
",fname);&lt;BR /&gt; return; &lt;BR /&gt; }&lt;BR /&gt; Ipp8u* y = (Ipp8u*)dataOut.GetPlanePointer(0);&lt;BR /&gt; Ipp8u* u = (Ipp8u*)dataOut.GetPlanePointer(1);&lt;BR /&gt; Ipp8u* v = (Ipp8u*)dataOut.GetPlanePointer(2);&lt;BR /&gt; if(y&amp;amp;&amp;amp;u&amp;amp;&amp;amp;v)&lt;BR /&gt; { &lt;BR /&gt; fwrite(y,1,vParams.info.clip_info.width*vParams.info.clip_info.height,fp_out);&lt;BR /&gt; fwrite(u,1,vParams.info.clip_info.width/2*vParams.info.clip_info.height/2,fp_out);&lt;BR /&gt; fwrite(v,1,vParams.info.clip_info.width/2*vParams.info.clip_info.height/2,fp_out);&lt;BR /&gt; }&lt;BR /&gt; fclose(fp_out); &lt;BR /&gt; }&lt;BR /&gt; cc++; //set to next data in buffer, just for testing&lt;BR /&gt; int datasize = dataIn.GetDataSize();&lt;BR /&gt; if(datasize&lt;MIN_SIZE&gt; {&lt;BR /&gt; Ipp8u* dataptr = (Ipp8u*)dataIn.GetDataPointer();&lt;BR /&gt; ippsCopy_8u(dataptr, memBuf, datasize); // copy tail to the head of buffer &lt;BR /&gt; br=fread(memBuf+datasize, BUF_SIZE-datasize, 1, fp); // read to remained space&lt;BR /&gt; if(br==0 &amp;amp;&amp;amp; datasize &amp;lt; 16) break; // need more accurate EOF detection &lt;BR /&gt; dataIn.MoveDataPointer(memBuf - dataptr); // back to the start of the buffer&lt;BR /&gt; dataIn.SetDataSize(datasize + br); // remained + new read &lt;BR /&gt; }&lt;BR /&gt;&amp;amp;n
bsp; } // end of while&lt;BR /&gt; free(pOut); &lt;BR /&gt; mpg2d-&amp;gt;Close(); &lt;BR /&gt; delete mpg2d; &lt;BR /&gt; free(memBuf);&lt;/MIN_SIZE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jun 2008 09:15:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/mpeg2-decoder-Input-buffer-question/m-p/866345#M8370</guid>
      <dc:creator>moshe1</dc:creator>
      <dc:date>2008-06-30T09:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: mpeg2 decoder - Input buffer question</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/mpeg2-decoder-Input-buffer-question/m-p/866346#M8371</link>
      <description>&lt;P&gt;Chgange first file-reading line from&lt;/P&gt;
&lt;P&gt;br = fread(memBuf,&lt;FONT color="#a52a2a"&gt;5000000&lt;/FONT&gt;,1,fp); &lt;/P&gt;
&lt;P&gt;to&lt;/P&gt;
&lt;P&gt;br = fread(memBuf, &lt;FONT color="#a52a2a"&gt;BUF_SIZE&lt;/FONT&gt;,1,fp);&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jun 2008 15:23:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/mpeg2-decoder-Input-buffer-question/m-p/866346#M8371</guid>
      <dc:creator>Leonid_K_Intel</dc:creator>
      <dc:date>2008-06-30T15:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: mpeg2 decoder - Input buffer question</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/mpeg2-decoder-Input-buffer-question/m-p/866347#M8372</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Thanks, ofcourse you were rightbut still, I amfacing the same problem.&lt;/P&gt;
&lt;P&gt;Does this code run for you?&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Moshe&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jun 2008 15:39:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/mpeg2-decoder-Input-buffer-question/m-p/866347#M8372</guid>
      <dc:creator>moshe1</dc:creator>
      <dc:date>2008-06-30T15:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: mpeg2 decoder - Input buffer question</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/mpeg2-decoder-Input-buffer-question/m-p/866348#M8373</link>
      <description>&lt;P&gt;1. Make BSIZE and &lt;FONT color="#020002" size="2"&gt;MIN_SIZE bigger. MIN_SIZE in your code in fact is maximum size of the encoded frame which can be in the stream. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#020002" size="2"&gt;2. While you don't guarantee that complete encoded frame is provided to decoder it makes sense to add 3-4 zero bytes in the end of the valid data. This will stop VLC decoding from out of the buffer. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;If decoder decoded only part of the frame it returns UMC_OK.You can'tknow easily if it was complete frame. But you can check if next bytes are start codes higher than slice level.&lt;/P&gt;
&lt;P&gt;Anyway, most safe and correct way is to scan for the next picture level start code.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jun 2008 17:04:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/mpeg2-decoder-Input-buffer-question/m-p/866348#M8373</guid>
      <dc:creator>Leonid_K_Intel</dc:creator>
      <dc:date>2008-06-30T17:04:30Z</dc:date>
    </item>
  </channel>
</rss>

