<?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 Hi Robert, in OpenCL* for CPU</title>
    <link>https://community.intel.com/t5/OpenCL-for-CPU/Decoding-opencl-Encoding-Pipeline-in-Intel-Media-SDK/m-p/1050926#M4018</link>
    <description>&lt;P&gt;Hi Robert,&lt;/P&gt;

&lt;P&gt;Thanks for your reply.&lt;/P&gt;

&lt;P&gt;I am using intel Haswell family processor i7 4770 CPU and intel HD 4600 card.&lt;/P&gt;

&lt;P&gt;Visual Studio: 2010 version.&lt;/P&gt;

&lt;P&gt;I am using the sample code of &lt;STRONG&gt;Decode-OPENCL&lt;/STRONG&gt; pipeline from the link you mentioned:&amp;nbsp;https://software.intel.com/en-us/articles/opencl-and-intel-media-sdk.&lt;/P&gt;

&lt;P&gt;This code works fine. As expected it decodes the stream and applies filter functions as mentioned in .cl file.&lt;/P&gt;

&lt;P&gt;Now I have to integrate the code of Encoder in the same framework so that I can create Decoder-OPENCL-ENCODER pipelile using media SDK. SO in above code I have modified the pipeline and added my changes in &lt;STRONG&gt;#ifdef ENCODER switch.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Now when I add encoder in this pipeline the encoder output is not ok. It seems encoder contains re-oredered frames.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 02 May 2015 12:37:49 GMT</pubDate>
    <dc:creator>Manish_K_</dc:creator>
    <dc:date>2015-05-02T12:37:49Z</dc:date>
    <item>
      <title>Decoding-opencl-Encoding Pipeline in Intel Media SDK</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Decoding-opencl-Encoding-Pipeline-in-Intel-Media-SDK/m-p/1050922#M4014</link>
      <description>&lt;P style="font-size: 12px;"&gt;I am working on Decode-OPENCL-Encode pipeline on intel processor. There is a sample code provide by intel for media interop which is attached.&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;I am integrating the encoder into same.&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;If we look at the DecodeOneFrame() function below:&amp;nbsp;&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;mfxStatus CDecodingPipeline::DecodeOneFrame(int Width, int Height, IDirect3DSurface9 *pDstSurface, IDirect3DDevice9* pd3dDevice)&lt;BR /&gt;
	{&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; mfxU16 nOCLSurfIndex=0;&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; mfxStatus stsOut = MFX_ERR_NONE;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; if(m_Tasks[m_TaskIndex].m_DecodeSync || m_Tasks[m_TaskIndex].m_OCLSync || m_Tasks[m_TaskIndex].m_EncodeSync)&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; {// wait task is finished and copy result texture to back buffer&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mfxStatus &amp;nbsp; sts = MFX_ERR_NONE;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mfxFrameSurface1_OCL* &amp;nbsp; pOutSurface = NULL; // output surface.&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //wait the previous submitted tasks&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(m_Tasks[m_TaskIndex].m_DecodeSync)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sts = m_mfxSession.SyncOperation(m_Tasks[m_TaskIndex].m_DecodeSync, MSDK_DEC_WAIT_INTERVAL);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pOutSurface = m_Tasks[m_TaskIndex].m_pDecodeOutSurface;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(m_Tasks[m_TaskIndex].m_OCLSync)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sts = m_mfxSession.SyncOperation(m_Tasks[m_TaskIndex].m_OCLSync, MSDK_VPP_WAIT_INTERVAL);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pOutSurface = m_Tasks[m_TaskIndex].m_pOCLOutSurface;&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	#ifdef ENCODER&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(m_Tasks[m_TaskIndex].m_EncodeSync)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sts = m_mfxSession.SyncOperation(m_Tasks[m_TaskIndex].m_EncodeSync, MSDK_ENC_WAIT_INTERVAL);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts);&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//pOutSurface = m_Tasks[m_TaskIndex].m_pEncodeOutSurface;&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	#endif&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(pOutSurface)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {/* copy YUV texture to screen */&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; HRESULT hr;&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IDirect3DSurface9* pSrcSurface = (IDirect3DSurface9*)(pOutSurface-&amp;gt;Data.MemId);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; assert(pDstSurface &amp;amp;&amp;amp; pSrcSurface);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(pSrcSurface &amp;amp;&amp;amp; pDstSurface)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; RECT &amp;nbsp; &amp;nbsp;r;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; r.left = 0;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; r.top = 0;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; r.right = min(Width,m_mfxDecodeVideoParams.vpp.In.Width);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; r.bottom = min(Height,m_mfxDecodeVideoParams.vpp.In.Height);&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; r.right -= r.right&amp;amp;1;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; r.bottom -= r.bottom&amp;amp;1;&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; V(pd3dDevice-&amp;gt;StretchRect(pSrcSurface, &amp;amp;r, pDstSurface, &amp;amp;r,D3DTEXF_POINT));&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	#ifdef UNLOCK&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(m_Tasks[m_TaskIndex].m_pDecodeOutSurface &amp;amp;&amp;amp; m_Tasks[m_TaskIndex].m_pDecodeOutSurface-&amp;gt;Data.Locked)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _InterlockedDecrement16((short*)&amp;amp;m_Tasks[m_TaskIndex].m_pDecodeOutSurface-&amp;gt;Data.Locked);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(m_Tasks[m_TaskIndex].m_pOCLOutSurface &amp;amp;&amp;amp; m_Tasks[m_TaskIndex].m_pOCLOutSurface-&amp;gt;Data.Locked)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _InterlockedDecrement16((short*)&amp;amp;m_Tasks[m_TaskIndex].m_pOCLOutSurface-&amp;gt;Data.Locked);&lt;BR /&gt;
	#ifdef ENCODER&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(m_Tasks[m_TaskIndex].m_pEncodeOutSurface &amp;amp;&amp;amp; m_Tasks[m_TaskIndex].m_pEncodeOutSurface-&amp;gt;Data.Locked)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _InterlockedDecrement16((short*)&amp;amp;m_Tasks[m_TaskIndex].m_pEncodeOutSurface-&amp;gt;Data.Locked);&lt;BR /&gt;
	#endif&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;#endif&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	#if 1&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; // clear sync task for further using&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; m_Tasks[m_TaskIndex].m_OCLSync = 0;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; m_Tasks[m_TaskIndex].m_pOCLOutSurface = 0;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; m_Tasks[m_TaskIndex].m_DecodeSync = 0;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; m_Tasks[m_TaskIndex].m_pDecodeOutSurface = 0;&lt;BR /&gt;
	#ifdef ENCODER&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; m_Tasks[m_TaskIndex].m_EncodeSync = 0;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; m_Tasks[m_TaskIndex].m_pEncodeOutSurface = 0;&lt;BR /&gt;
	#endif&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;
	#endif&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; if(m_DECODEFlag)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; {// feed decoder&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mfxSyncPoint &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DecodeSyncPoint = 0;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; static mfxU16 &amp;nbsp; &amp;nbsp; &amp;nbsp;nDecoderSurfIndex = 0; // index of free surface&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mfxStatus &amp;nbsp; sts = MFX_ERR_NONE;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; m_pmfxDecodeSurfaceLast = NULL; // reset curretn decoder surface to get new one from Decoder&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while(MFX_ERR_NONE &amp;lt;= sts || MFX_ERR_MORE_DATA == sts || MFX_ERR_MORE_SURFACE == sts || MFX_WRN_DEVICE_BUSY == sts)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {// loop until decoder report that it get request for new frame&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (MFX_WRN_DEVICE_BUSY == sts)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Sleep(1); // just wait and then repeat the same call to DecodeFrameAsync&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else if (MFX_ERR_MORE_DATA == sts)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; { // read more data to input bit stream&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sts = m_FileReader.ReadNextFrame(&amp;amp;m_mfxBS);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MSDK_BREAK_ON_ERROR(sts);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else if (MFX_ERR_MORE_SURFACE == sts || MFX_ERR_NONE == sts)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {// find new working-output surface in m_pmfxDecodeSurfaces&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //nDecoderSurfIndex = 0;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; nDecoderSurfIndex = GetFreeSurfaceIndex(m_pmfxDecodeSurfaces, m_mfxDecoderResponse.NumFrameActual,nDecoderSurfIndex);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (MSDK_INVALID_SURF_IDX == nDecoderSurfIndex)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return MFX_ERR_MEMORY_ALLOC;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // send request to decoder&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sts = m_pmfxDEC-&amp;gt;DecodeFrameAsync(&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;amp;m_mfxBS,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (mfxFrameSurface1*)&amp;amp;(m_pmfxDecodeSurfaces[nDecoderSurfIndex]),&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (mfxFrameSurface1**)&amp;amp;m_pmfxDecodeSurfaceLast,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;amp;DecodeSyncPoint);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // ignore warnings if output is available,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // if no output and no action required just repeat the same call&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (MFX_ERR_NONE &amp;lt; sts &amp;amp;&amp;amp; DecodeSyncPoint)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sts = MFX_ERR_NONE;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (MFX_ERR_NONE == sts)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {// decoder return sync point then fill the curretn task nad switch to OCL Plugin feeding&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; m_Tasks[m_TaskIndex].m_DecodeSync = DecodeSyncPoint;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; m_Tasks[m_TaskIndex].m_pDecodeOutSurface = m_pmfxDecodeSurfaceLast;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // look for output process&lt;BR /&gt;
	#ifdef UNLOCK&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(m_Tasks[m_TaskIndex].m_pDecodeOutSurface)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _InterlockedIncrement16((short*)&amp;amp;m_Tasks[m_TaskIndex].m_pDecodeOutSurface-&amp;gt;Data.Locked);&lt;BR /&gt;
	#endif&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(MFX_ERR_NONE != sts)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf("ERROR: Decoder returns error %d!\n",sts);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; stsOut = sts;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //decoder sync point&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sts = m_mfxSession.SyncOperation(m_Tasks[m_TaskIndex].m_DecodeSync, MSDK_DEC_WAIT_INTERVAL);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts);&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; }//if(m_DECODEFlag)&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; if(m_pOCLPlugin &amp;amp;&amp;amp; m_pOCLPlugin-&amp;gt;m_OCLFlag)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; {// OPENCL part&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mfxU16 nOCLSurfIndex=0;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mfxSyncPoint &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;OCLSyncPoint = 0;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mfxStatus &amp;nbsp; sts = MFX_ERR_NONE;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // get index for output surface for OCL plugin&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; nOCLSurfIndex = GetFreeSurfaceIndex(m_pmfxOCLSurfaces, m_mfxOCLResponse.NumFrameActual);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MSDK_CHECK_ERROR(nOCLSurfIndex, MSDK_INVALID_SURF_IDX, MFX_ERR_MEMORY_ALLOC);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //mfxHDL pOutSurf = &amp;amp;m_pmfxOCLSurfaces[nOCLSurfIndex];&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //mfxHDL pOutSurf = &amp;amp;m_pmfxEncSurfaces[nEncSurfIdx];&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //m_pmfxOCLSurfaces[nOCLSurfIndex] = m_pmfxEncSurfaces[nEncSurfIdx];&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mfxHDL pOutSurf = &amp;amp;m_pmfxOCLSurfaces[nOCLSurfIndex];&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mfxHDL inp = m_pmfxDecodeSurfaceLast;&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // OCL filter&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for(;;)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sts = MFXVideoUSER_ProcessFrameAsync(m_mfxSession, &amp;amp;inp, 1, &amp;amp;pOutSurf, 1, &amp;amp;OCLSyncPoint);&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (MFX_WRN_DEVICE_BUSY == sts)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Sleep(1); // just wait and then repeat the same call&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // ignore warnings if output is available,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (MFX_ERR_NONE &amp;lt; sts &amp;amp;&amp;amp; OCLSyncPoint)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sts = MFX_ERR_NONE;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(MFX_ERR_NONE!=sts)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf("ERROR: OpenCL filter return error %d!\n",sts);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return sts;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; m_Tasks[m_TaskIndex].m_OCLSync = OCLSyncPoint;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; m_Tasks[m_TaskIndex].m_pOCLOutSurface = &amp;amp;m_pmfxOCLSurfaces[nOCLSurfIndex];&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //m_Tasks[m_TaskIndex].m_pOCLOutSurface = &amp;amp;m_pmfxEncSurfaces[nEncSurfIdx];&lt;BR /&gt;
	#ifdef UNLOCK&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // look for output process&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _InterlockedIncrement16((short*)&amp;amp;m_Tasks[m_TaskIndex].m_pOCLOutSurface-&amp;gt;Data.Locked);&lt;BR /&gt;
	#endif&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;#ifdef ENCODER&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; if(m_ENCODEFlag)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; {// feed encoder&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; static mfxU16 &amp;nbsp; &amp;nbsp; &amp;nbsp;nEncSurfIdx = 0; // index of free surface&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mfxSyncPoint EncSyncP;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mfxStatus sts = MFX_ERR_NONE;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //mfxFrameSurface1* pSurf = NULL; // dispatching pointer&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // find free surface for encoder input&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; nEncSurfIdx = GetFreeSurface(m_pmfxEncSurfaces, m_mfxEncResponse.NumFrameActual);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MSDK_CHECK_ERROR(nEncSurfIdx, MSDK_INVALID_SURF_IDX, MFX_ERR_MEMORY_ALLOC);&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // point pSurf to encoder surface&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //m_pmfxEncSurfaces[nEncSurfIdx] = m_pmfxOCLSurfaces[nOCLSurfIndex];&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (;;)&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // at this point surface for encoder contains either a frame from file or a frame processed by vpp&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sts = m_pmfxENC-&amp;gt;EncodeFrameAsync(NULL, &amp;amp;m_pmfxEncSurfaces[nEncSurfIdx], &amp;amp;m_mfxEncBS, &amp;amp;EncSyncP);&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (MFX_ERR_NONE &amp;lt; sts &amp;amp;&amp;amp; !EncSyncP) // repeat the call if warning and no output&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (MFX_WRN_DEVICE_BUSY == sts)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MSDK_SLEEP(1); // wait if device is busy&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else if (MFX_ERR_NONE &amp;lt; sts &amp;amp;&amp;amp; EncSyncP)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sts = MFX_ERR_NONE; // ignore warnings if output is available&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else if (MFX_ERR_NOT_ENOUGH_BUFFER == sts)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sts = AllocateSufficientBuffer(&amp;amp;m_mfxEncBS);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf("\n BUFFER allocated");&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // get next surface and new task for 2nd bitstream in ViewOutput mode&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MSDK_IGNORE_MFX_STS(sts, MFX_ERR_MORE_BITSTREAM);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (MFX_ERR_MORE_DATA == sts) {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sts = MFX_ERR_NONE;&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; if (MFX_ERR_NONE == sts)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; m_Tasks[m_TaskIndex].m_EncodeSync = EncSyncP;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;#ifdef UNLOCK&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; if (MFX_ERR_NONE == sts)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; {// encoder return sync point then fill the curretn task nad switch to encoder feeding&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; m_Tasks[m_TaskIndex].m_pEncodeOutSurface = &amp;amp;m_pmfxEncSurfaces[nEncSurfIdx];&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _InterlockedIncrement16((short*)&amp;amp;m_Tasks[m_TaskIndex].m_pEncodeOutSurface-&amp;gt;Data.Locked);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	#endif&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	#endif&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp;&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; // increase task index to point to next task.&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; m_TaskIndex = (m_TaskIndex+1)%SYNC_BUF_SIZE;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; return stsOut;&lt;BR /&gt;
	}//CDecodingPipeline::DecodeOneFrame&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;If I use this code the encoder output is corrupted.When I decode the encoder output It seems frames are not displayed in proper order.&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;I think I am not giving the right surface to encoder as the encoder surface index is independently calculated.&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;But when I give the OCL output surface to encoder then my OCL also stops working.&lt;/P&gt;

&lt;P style="font-size: 12px;"&gt;Can anyone guide me here?&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2015 17:54:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Decoding-opencl-Encoding-Pipeline-in-Intel-Media-SDK/m-p/1050922#M4014</guid>
      <dc:creator>Manish_K_</dc:creator>
      <dc:date>2015-05-01T17:54:58Z</dc:date>
    </item>
    <item>
      <title>Mr. Robert Loffe I need your</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Decoding-opencl-Encoding-Pipeline-in-Intel-Media-SDK/m-p/1050923#M4015</link>
      <description>&lt;P&gt;Mr. Robert Loffe I need your help to understand Intel media sdk integrated with opencl&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2015 17:56:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Decoding-opencl-Encoding-Pipeline-in-Intel-Media-SDK/m-p/1050923#M4015</guid>
      <dc:creator>Manish_K_</dc:creator>
      <dc:date>2015-05-01T17:56:19Z</dc:date>
    </item>
    <item>
      <title>Hi Manish,</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Decoding-opencl-Encoding-Pipeline-in-Intel-Media-SDK/m-p/1050924#M4016</link>
      <description>&lt;P&gt;Hi Manish,&lt;/P&gt;

&lt;P&gt;Could you please let me know parameters of your system: processor, Operating system, driver you are using?&lt;/P&gt;

&lt;P&gt;Also, did you get the interoperability sample from here:&amp;nbsp;https://software.intel.com/en-us/articles/opencl-and-intel-media-sdk ?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2015 23:19:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Decoding-opencl-Encoding-Pipeline-in-Intel-Media-SDK/m-p/1050924#M4016</guid>
      <dc:creator>Robert_I_Intel</dc:creator>
      <dc:date>2015-05-01T23:19:34Z</dc:date>
    </item>
    <item>
      <title>One more thing, which Visual</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Decoding-opencl-Encoding-Pipeline-in-Intel-Media-SDK/m-p/1050925#M4017</link>
      <description>&lt;P&gt;One more thing, which Visual Studio version are you using to build the project?&lt;/P&gt;

&lt;P&gt;Also, the code snippet that you provided above: is this original Intel code you something that you created?&lt;/P&gt;

&lt;P&gt;Can you run Original Intel sample out of the box?&lt;/P&gt;</description>
      <pubDate>Sat, 02 May 2015 00:00:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Decoding-opencl-Encoding-Pipeline-in-Intel-Media-SDK/m-p/1050925#M4017</guid>
      <dc:creator>Robert_I_Intel</dc:creator>
      <dc:date>2015-05-02T00:00:22Z</dc:date>
    </item>
    <item>
      <title>Hi Robert,</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Decoding-opencl-Encoding-Pipeline-in-Intel-Media-SDK/m-p/1050926#M4018</link>
      <description>&lt;P&gt;Hi Robert,&lt;/P&gt;

&lt;P&gt;Thanks for your reply.&lt;/P&gt;

&lt;P&gt;I am using intel Haswell family processor i7 4770 CPU and intel HD 4600 card.&lt;/P&gt;

&lt;P&gt;Visual Studio: 2010 version.&lt;/P&gt;

&lt;P&gt;I am using the sample code of &lt;STRONG&gt;Decode-OPENCL&lt;/STRONG&gt; pipeline from the link you mentioned:&amp;nbsp;https://software.intel.com/en-us/articles/opencl-and-intel-media-sdk.&lt;/P&gt;

&lt;P&gt;This code works fine. As expected it decodes the stream and applies filter functions as mentioned in .cl file.&lt;/P&gt;

&lt;P&gt;Now I have to integrate the code of Encoder in the same framework so that I can create Decoder-OPENCL-ENCODER pipelile using media SDK. SO in above code I have modified the pipeline and added my changes in &lt;STRONG&gt;#ifdef ENCODER switch.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Now when I add encoder in this pipeline the encoder output is not ok. It seems encoder contains re-oredered frames.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 May 2015 12:37:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Decoding-opencl-Encoding-Pipeline-in-Intel-Media-SDK/m-p/1050926#M4018</guid>
      <dc:creator>Manish_K_</dc:creator>
      <dc:date>2015-05-02T12:37:49Z</dc:date>
    </item>
    <item>
      <title>Basically I want to undersand</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Decoding-opencl-Encoding-Pipeline-in-Intel-Media-SDK/m-p/1050927#M4019</link>
      <description>&lt;P&gt;Basically I want to undersand how encoder should be added in this code:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://software.intel.com/en-us/articles/opencl-and-intel-media-sdk" target="_blank"&gt;https://software.intel.com/en-us/articles/opencl-and-intel-media-sdk&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 03 May 2015 12:10:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Decoding-opencl-Encoding-Pipeline-in-Intel-Media-SDK/m-p/1050927#M4019</guid>
      <dc:creator>Manish_K_</dc:creator>
      <dc:date>2015-05-03T12:10:39Z</dc:date>
    </item>
    <item>
      <title>Hi Robert,</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Decoding-opencl-Encoding-Pipeline-in-Intel-Media-SDK/m-p/1050928#M4020</link>
      <description>&lt;P&gt;Hi Robert,&lt;/P&gt;

&lt;P&gt;Is there any reason I am not being answered for this question in any of the forum available.&lt;/P&gt;

&lt;P&gt;Is something wrong here? Can you tell me where should I post this to get some help?&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2015 04:30:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Decoding-opencl-Encoding-Pipeline-in-Intel-Media-SDK/m-p/1050928#M4020</guid>
      <dc:creator>Manish_K_</dc:creator>
      <dc:date>2015-05-05T04:30:11Z</dc:date>
    </item>
    <item>
      <title>Hi Manish,</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Decoding-opencl-Encoding-Pipeline-in-Intel-Media-SDK/m-p/1050929#M4021</link>
      <description>&lt;P&gt;Hi Manish,&lt;/P&gt;

&lt;P&gt;Your question is more of an Media SDK question: I contacted Technical Consulting Engineers for Media SDK within our team and they are looking into your question right now. They will update this post once they figure out what is wrong with your code.&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2015 17:01:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Decoding-opencl-Encoding-Pipeline-in-Intel-Media-SDK/m-p/1050929#M4021</guid>
      <dc:creator>Robert_I_Intel</dc:creator>
      <dc:date>2015-05-05T17:01:51Z</dc:date>
    </item>
    <item>
      <title>Thanks Robert.I will wait for</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Decoding-opencl-Encoding-Pipeline-in-Intel-Media-SDK/m-p/1050930#M4022</link>
      <description>&lt;P&gt;Thanks Robert.I will wait for their reply.&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2015 07:02:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Decoding-opencl-Encoding-Pipeline-in-Intel-Media-SDK/m-p/1050930#M4022</guid>
      <dc:creator>Manish_K_</dc:creator>
      <dc:date>2015-05-06T07:02:19Z</dc:date>
    </item>
    <item>
      <title>Hi Manish,</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Decoding-opencl-Encoding-Pipeline-in-Intel-Media-SDK/m-p/1050931#M4023</link>
      <description>Hi Manish, 

Sorry it took time to get back to you. To see how you can incorporate encode in the pipeline, you can look at sample_multi_transcode which has rotate plugin implemented through openCL instead of Media SDK interoperability. This sample is also part of the sample package you have on your system.

Hope that helps. 
Thanks 
Surbhi</description>
      <pubDate>Thu, 07 May 2015 05:31:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Decoding-opencl-Encoding-Pipeline-in-Intel-Media-SDK/m-p/1050931#M4023</guid>
      <dc:creator>Surbhi_M_Intel</dc:creator>
      <dc:date>2015-05-07T05:31:38Z</dc:date>
    </item>
    <item>
      <title>Hi Surbhi,</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Decoding-opencl-Encoding-Pipeline-in-Intel-Media-SDK/m-p/1050932#M4024</link>
      <description>&lt;P&gt;Hi Surbhi,&lt;/P&gt;

&lt;P&gt;I did not find any .cl file in sample_multi_transcode. This framework doesn't use any opencl memory objects created.&lt;/P&gt;

&lt;P&gt;Please let me know if I am wrong.&lt;/P&gt;</description>
      <pubDate>Fri, 08 May 2015 06:31:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Decoding-opencl-Encoding-Pipeline-in-Intel-Media-SDK/m-p/1050932#M4024</guid>
      <dc:creator>Manish_K_</dc:creator>
      <dc:date>2015-05-08T06:31:22Z</dc:date>
    </item>
    <item>
      <title>Hi Surbhi, </title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Decoding-opencl-Encoding-Pipeline-in-Intel-Media-SDK/m-p/1050933#M4025</link>
      <description>&lt;P&gt;Hi Surbhi,&amp;nbsp;&lt;/P&gt;

&lt;P&gt;You were right Multi transcode uses the opencl plugin. However, this framework is using a opencl_plugin.dll file which contains the code of rotation of image through opencl.&lt;/P&gt;

&lt;P&gt;Thanks. I was able to use the framework.&lt;/P&gt;

&lt;P&gt;However, when I give the below parameters to the sample_multi_transcode.exe, I&amp;nbsp;got a speed of 15 fps only.&lt;/P&gt;

&lt;P&gt;Arguments --&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-i::h264 MediaSDKInterop_video.h264 -o::h264 out.264 -hw -u 7 -angle 180 -opencl&lt;/P&gt;

&lt;P&gt;And When I disable opencl and gave below arguments I get speed of apprx. 80 fps.&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 13.0080003738403px; line-height: 17.7381820678711px;"&gt;Arguments --&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-i::h264 MediaSDKInterop_video.h264 -o::h264 out.264 -hw -u 7&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Could you please let me know the reason why enabling opencl plugin slows the speed so much at my end ?&lt;/P&gt;

&lt;P&gt;I am using i7-4770 CPU @3.4GHz on 64 bit Windows 7. My system contains Intel HD 4600 Graphics Card. Windows 7 contains support till Directx9 only.&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;

&lt;P&gt;Manish&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2015 10:17:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Decoding-opencl-Encoding-Pipeline-in-Intel-Media-SDK/m-p/1050933#M4025</guid>
      <dc:creator>Manish_K_</dc:creator>
      <dc:date>2015-05-27T10:17:52Z</dc:date>
    </item>
  </channel>
</rss>

