<?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: How to get bitmap from VideoData or VideoRender in Intel® Integrated Performance Primitives</title>
    <link>https://community.intel.com/t5/Intel-Integrated-Performance/How-to-get-bitmap-from-VideoData-or-VideoRender/m-p/856641#M7221</link>
    <description>Tried ifzero-ing all render related code, but apparently the VideoDecoder::GetFrame that produces the VideoData output is dependent on the renderer to consume or post-process the data. Only one frame is produced when no renderer is called. Tried both GDIVideoRenderer (with m_hWnd specified) and NULLVideoRenderer, but both fail LockInputBuffer with -997 UMC_ERR_NOT_INITIALIZED. Not any examples in umc-manual.pdf for initializing and using GDIVideoRenderer or NULLVideoRenderer. Any suggestions? Or should I use pipeline and AVSync? Thanks.&lt;BR /&gt;</description>
    <pubDate>Sun, 03 Feb 2008 23:38:45 GMT</pubDate>
    <dc:creator>frankjnatoli</dc:creator>
    <dc:date>2008-02-03T23:38:45Z</dc:date>
    <item>
      <title>How to get bitmap from VideoData or VideoRender</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/How-to-get-bitmap-from-VideoData-or-VideoRender/m-p/856640#M7220</link>
      <description>For decoding MPEG-4 or H.264 data, need to obtain RGB24 or RGB32 bitmap from VideoDecoder. If I understand correctly, the VideoData object in fact contains the decoded video frame, and the VideoRender object is used to push the decoded video frame into DirectX or a file writer. Have tried calling SetColorFormat to UMC::RGB32 but that appears to be overriden by the actual processing of the data. Calls to GetColorFormat returns UMC::YV12. PlaneInfo indicates three planes, one that is 320x240 and two that are 160x120. Clearly that is not RGB32.&lt;BR /&gt;&lt;BR /&gt;To simply extract the binary bitmap, can I complete delete all calls to render objects and operations?&lt;BR /&gt;&lt;BR /&gt;And how can the VideoData object be coerced to produce an RGB24 or RGB32 bitmap?&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;</description>
      <pubDate>Fri, 01 Feb 2008 01:35:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/How-to-get-bitmap-from-VideoData-or-VideoRender/m-p/856640#M7220</guid>
      <dc:creator>franknatoli</dc:creator>
      <dc:date>2008-02-01T01:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to get bitmap from VideoData or VideoRender</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/How-to-get-bitmap-from-VideoData-or-VideoRender/m-p/856641#M7221</link>
      <description>Tried ifzero-ing all render related code, but apparently the VideoDecoder::GetFrame that produces the VideoData output is dependent on the renderer to consume or post-process the data. Only one frame is produced when no renderer is called. Tried both GDIVideoRenderer (with m_hWnd specified) and NULLVideoRenderer, but both fail LockInputBuffer with -997 UMC_ERR_NOT_INITIALIZED. Not any examples in umc-manual.pdf for initializing and using GDIVideoRenderer or NULLVideoRenderer. Any suggestions? Or should I use pipeline and AVSync? Thanks.&lt;BR /&gt;</description>
      <pubDate>Sun, 03 Feb 2008 23:38:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/How-to-get-bitmap-from-VideoData-or-VideoRender/m-p/856641#M7221</guid>
      <dc:creator>frankjnatoli</dc:creator>
      <dc:date>2008-02-03T23:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to get bitmap from VideoData or VideoRender</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/How-to-get-bitmap-from-VideoData-or-VideoRender/m-p/856642#M7222</link>
      <description>&lt;P&gt;In order to coerce the decoder to produce your desired output format initialize the VideoData object to the desired format:&lt;/P&gt;
&lt;P&gt;umcRes = m_FrameOut.Init(352, 240, UMC::YUV420); // VideoData m_FrameOut&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;umcRes = m_Decoder.GetFrame(&amp;amp;m_FrameIn, &amp;amp;m_FrameOut);&lt;/P&gt;
&lt;P&gt;This works for me and in my customized app we convert the data to RGB because the renderer expects YUV420.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2008 19:13:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/How-to-get-bitmap-from-VideoData-or-VideoRender/m-p/856642#M7222</guid>
      <dc:creator>pushkar_p</dc:creator>
      <dc:date>2008-02-04T19:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to get bitmap from VideoData or VideoRender</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/How-to-get-bitmap-from-VideoData-or-VideoRender/m-p/856643#M7223</link>
      <description>Perfect. Works great. Many thanks.&lt;BR /&gt;&lt;BR /&gt;I see there is a NULLVideoRender that presumably does no work other than consume the VideoData frame and condition the VideoData object to accept the next frame from GetFrame. Working with NULLVideoRender, I find it must require some programming that FWVideoRender does not require, because LockInputBuffer fails with -998 UMC_ERR_NOT_INITIALIZED. Am trying to step through simple_player.cpp and see how AVSync generically handles the different video renderers, but haven't figured it out yet.&lt;BR /&gt;</description>
      <pubDate>Mon, 04 Feb 2008 22:39:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/How-to-get-bitmap-from-VideoData-or-VideoRender/m-p/856643#M7223</guid>
      <dc:creator>frankjnatoli</dc:creator>
      <dc:date>2008-02-04T22:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to get bitmap from VideoData or VideoRender</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/How-to-get-bitmap-from-VideoData-or-VideoRender/m-p/856644#M7224</link>
      <description>Below is code that will read an MPEG-4 or MPEG-2 stream and extract an RGB32 bitmap from a VideoData object without the use of a renderer. I recompiled the UMC libraries with /ZI and /Od, built a VS2005 project using simple_player, and followed the actions of the NULLVideoRender to see what manipulation of the VideoData object was necessary to bypass the renderer entirely. I found the renderer calling SetAlignment, Init, SetBufferPointer and SetDataSize. Code below calls those functions when compiled for no renderer.&lt;BR /&gt;&lt;BR /&gt;Note, when not bypassing the renderer, the below code only works correctly for FWRENDERER not GDIRENDERER nor NULLRENDERER. Although simple_player works well with GDIVideoRender and NULLVideoRender, I could never quite get either of them to work in my program. No matter, I only really care about extracting the frame bitmap from the VideoData object and that works fine below.&lt;BR /&gt;&lt;BR /&gt;Thanks again for help from forum members.&lt;BR /&gt;&lt;BR /&gt;// AtsPlaybackIPPProc.cpp&lt;BR /&gt;//&lt;BR /&gt;&lt;BR /&gt;#include "stdafx.h"&lt;BR /&gt;#include "AtsPlaybackIPP.h"&lt;BR /&gt;&lt;BR /&gt;#include "AtsPlaybackIPPDoc.h"&lt;BR /&gt;#include "AtsPlaybackIPPView.h"&lt;BR /&gt;&lt;BR /&gt;#include "ipp.h"&lt;BR /&gt;#include "umc_file_reader.h"&lt;BR /&gt;#include "umc_fio_reader.h"&lt;BR /&gt;#include "umc_h264_dec.h"&lt;BR /&gt;#include "umc_h264_spl.h"&lt;BR /&gt;#include "umc_h264_timing.h"&lt;BR /&gt;#include "umc_mp4_spl.h"&lt;BR /&gt;#include "umc_mpeg2_dec.h"&lt;BR /&gt;#include "umc_mpeg4_video_decoder.h"&lt;BR /&gt;#include "umc_splitter.h"&lt;BR /&gt;#include "umc_structures.h"&lt;BR /&gt;#include "umc_threaded_demuxer.h"&lt;BR /&gt;#include "umc_video_data.h"&lt;BR /&gt;#include "umc_video_render.h"&lt;BR /&gt;#include "gdi_video_render.h"&lt;BR /&gt;#include "fw_video_render.h"&lt;BR /&gt;#include "null_video_renderer.h"&lt;BR /&gt;#include "vm_time.h"&lt;BR /&gt;&lt;BR /&gt;#ifdef _DEBUG&lt;BR /&gt;#define new DEBUG_NEW&lt;BR /&gt;#endif&lt;BR /&gt;&lt;BR /&gt;//#define RWRENDERER&lt;BR /&gt;&lt;BR /&gt;void CAtsPlaybackIPPView::PlaybackThread(void)&lt;BR /&gt;{&lt;BR /&gt; CString str;&lt;BR /&gt; UMC::Status umcResult;&lt;BR /&gt;&lt;BR /&gt; //-------------------------------------------------------------------------&lt;BR /&gt; // init file reader&lt;BR /&gt; //-------------------------------------------------------------------------&lt;BR /&gt; UMC::FIOReader reader;&lt;BR /&gt; UMC::FileReaderParams readerParams;&lt;BR /&gt; readerParams.m_portion_size = 0;&lt;BR /&gt; vm_string_strcpy(readerParams.m_file_name, (LPCTSTR)m_strMpegFile);&lt;BR /&gt; umcResult = reader.Init(&amp;amp;readerParams);&lt;BR /&gt; if (umcResult != UMC::UMC_OK)&lt;BR /&gt; {&lt;BR /&gt;  str.Format("FIOReader.Init failure %d", umcResult);&lt;BR /&gt;  AfxMessageBox(str);&lt;BR /&gt;  return;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; //-------------------------------------------------------------------------&lt;BR /&gt; // init splitter&lt;BR /&gt; //-------------------------------------------------------------------------&lt;BR /&gt; UMC::Splitter *splitter;&lt;BR /&gt; // identify input stream and instantiate appropriate splitter&lt;BR /&gt; switch (UMC::Splitter::GetStreamType(&amp;amp;reader))&lt;BR /&gt; {&lt;BR /&gt; case UMC::MP4_ATOM_STREAM :&lt;BR /&gt;  splitter = (UMC::Splitter*)(new UMC::MP4Splitter());&lt;BR /&gt;  break;&lt;BR /&gt; case UMC::MPEGx_SYSTEM_STREAM :&lt;BR /&gt;&amp;amp;n
bsp;  splitter = (UMC::Splitter*)(new UMC::ThreadedDemuxer());&lt;BR /&gt;  break;&lt;BR /&gt; default :&lt;BR /&gt;  AfxMessageBox("Splitter::GetStreamType unknown");&lt;BR /&gt;  return;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; // initialize splitter&lt;BR /&gt; UMC::SplitterParams splitterParams;&lt;BR /&gt; splitterParams.m_lFlags = UMC::VIDEO_SPLITTER;&lt;BR /&gt; splitterParams.m_pDataReader = &amp;amp;reader;&lt;BR /&gt; umcResult = splitter-&amp;gt;Init(splitterParams);&lt;BR /&gt; if (umcResult != UMC::UMC_OK)&lt;BR /&gt; {&lt;BR /&gt;  str.Format("Splitter::Init failure %d", umcResult);&lt;BR /&gt;  AfxMessageBox(str);&lt;BR /&gt;  return;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; // run splitter&lt;BR /&gt; umcResult = splitter-&amp;gt;Run();&lt;BR /&gt; if (umcResult != UMC::UMC_OK)&lt;BR /&gt; {&lt;BR /&gt;  str.Format("Splitter::Run failure %d", umcResult);&lt;BR /&gt;  AfxMessageBox(str);&lt;BR /&gt;  return;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; // get splitter info&lt;BR /&gt; UMC::SplitterInfo *streamInfo;&lt;BR /&gt; umcResult = splitter-&amp;gt;GetInfo(&amp;amp;streamInfo);&lt;BR /&gt; if (umcResult != UMC::UMC_OK)&lt;BR /&gt; {&lt;BR /&gt;  str.Format("Splitter::GetInfo failure %d", umcResult);&lt;BR /&gt;  AfxMessageBox(str);&lt;BR /&gt;  return;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; // search tracks for supported video data&lt;BR /&gt; Ipp32u videoTrack;&lt;BR /&gt; for (videoTrack = 0; videoTrack &amp;lt; streamInfo-&amp;gt;m_nOfTracks; videoTrack++)&lt;BR /&gt; {&lt;BR /&gt;  TRACE("videoTrack %d m_type 0x%X
", videoTrack, streamInfo-&amp;gt;m_ppTrackInfo[videoTrack]-&amp;gt;m_Type);&lt;BR /&gt;  if (streamInfo-&amp;gt;m_ppTrackInfo[videoTrack]-&amp;gt;m_Type == UMC::TRACK_MPEG4V ||&lt;BR /&gt;   streamInfo-&amp;gt;m_ppTrackInfo[videoTrack]-&amp;gt;m_Type == UMC::TRACK_H264 ||&lt;BR /&gt;   streamInfo-&amp;gt;m_ppTrackInfo[videoTrack]-&amp;gt;m_Type == UMC::TRACK_MPEG2V)&lt;BR /&gt;   break;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; // if no track with support video data found&lt;BR /&gt; if (videoTrack &amp;gt;= streamInfo-&amp;gt;m_nOfTracks)&lt;BR /&gt; {&lt;BR /&gt;  AfxMessageBox("File does not contain TRACK_MPEG4V or TRACK_H264 or TRACK_MPEG2V");&lt;BR /&gt;  return;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; // point to video data&lt;BR /&gt; UMC::VideoStreamInfo *videoTrackInfo = (UMC::VideoStreamInfo *)streamInfo-&amp;gt;m_ppTrackInfo[videoTrack]-&amp;gt;m_pStreamInfo;&lt;BR /&gt;&lt;BR /&gt; // log video data&lt;BR /&gt; TRACE("m_nOfTracks %d videoTrack %d stream_type 0x%X framerate %.1f clip_info.width %d clip_info.height %d color_format %d
",&lt;BR /&gt;  streamInfo-&amp;gt;m_nOfTracks,&lt;BR /&gt;&amp;amp;nbs
p;  videoTrack,&lt;BR /&gt;  videoTrackInfo-&amp;gt;stream_type,&lt;BR /&gt;  videoTrackInfo-&amp;gt;framerate,&lt;BR /&gt;  videoTrackInfo-&amp;gt;clip_info.width,&lt;BR /&gt;  videoTrackInfo-&amp;gt;clip_info.height,&lt;BR /&gt;  videoTrackInfo-&amp;gt;color_format);&lt;BR /&gt;&lt;BR /&gt; //-------------------------------------------------------------------------&lt;BR /&gt; // init video decoder&lt;BR /&gt; //-------------------------------------------------------------------------&lt;BR /&gt; UMC::VideoDecoder *decoder;&lt;BR /&gt; switch (videoTrackInfo-&amp;gt;stream_type)&lt;BR /&gt; {&lt;BR /&gt; case UMC::MPEG4_VIDEO :&lt;BR /&gt;  decoder = (UMC::VideoDecoder*)(new UMC::MPEG4VideoDecoder());&lt;BR /&gt;  break;&lt;BR /&gt; case UMC::H264_VIDEO :&lt;BR /&gt;  decoder = (UMC::VideoDecoder*)(new UMC::H264VideoDecoder());&lt;BR /&gt;  break;&lt;BR /&gt; case UMC::MPEG2_VIDEO :&lt;BR /&gt;  decoder = (UMC::VideoDecoder*)(new UMC::MPEG2VideoDecoder());&lt;BR /&gt;  break;&lt;BR /&gt; default :&lt;BR /&gt;  str.Format("stream_type %d neither MPEG4_VIDEO nor H264_VIDEO nor MPEG2_VIDEO", videoTrackInfo-&amp;gt;stream_type);&lt;BR /&gt;  AfxMessageBox(str);&lt;BR /&gt;  return;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; UMC::VideoDecoderParams decoderParams;&lt;BR /&gt; decoderParams.info = *videoTrackInfo;&lt;BR /&gt; decoderParams.numThreads = 1;&lt;BR /&gt; decoderParams.lFlags = UMC::FLAG_VDEC_REORDER;&lt;BR /&gt; decoderParams.m_pData = streamInfo-&amp;gt;m_ppTrackInfo[videoTrack]-&amp;gt;m_pDecSpecInfo;&lt;BR /&gt; umcResult = decoder-&amp;gt;Init(&amp;amp;decoderParams);&lt;BR /&gt; if (umcResult != UMC::UMC_OK)&lt;BR /&gt; {&lt;BR /&gt;  str.Format("MPEG4VideoDecoder.Init failure %d", umcResult);&lt;BR /&gt;  AfxMessageBox(str);&lt;BR /&gt;  return;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; //-------------------------------------------------------------------------&lt;BR /&gt; // init video renderer&lt;BR /&gt; //-------------------------------------------------------------------------&lt;BR /&gt;#ifdef FWRENDERER&lt;BR /&gt; UMC::VideoRenderParams renderParams;&lt;BR /&gt; umcResult = renderParams.out_data_template.Init(&lt;BR /&gt;     videoTrackInfo-&amp;gt;clip_info.width,&lt;BR /&gt;     videoTrackInfo-&amp;gt;clip_info.height,&lt;BR /&gt;     UMC::RGB32); // formerly videoTrackInfo-&amp;gt;color_format&lt;BR /&gt; if (umcResult != UMC::UMC_OK)&lt;BR /&gt; {&lt;BR /&gt;  str.Format("VideoRenderParams.Init failure %d", umcResult);&lt;BR /&gt;  AfxMessageBox(str
);&lt;BR /&gt;  return;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; UMC::FWVideoRender render;&lt;BR /&gt; umcResult = render.Init(&amp;amp;renderParams);&lt;BR /&gt; if (umcResult != UMC::UMC_OK)&lt;BR /&gt; {&lt;BR /&gt;  str.Format("FWVideoRender.Init failure %d", umcResult);&lt;BR /&gt;  AfxMessageBox(str);&lt;BR /&gt;  return;&lt;BR /&gt; }&lt;BR /&gt;#endif&lt;BR /&gt;#ifdef GDIRENDERER&lt;BR /&gt; UMC::GDIVideoRenderParams renderParams;&lt;BR /&gt; umcResult = renderParams.out_data_template.Init(&lt;BR /&gt;     videoTrackInfo-&amp;gt;clip_info.width,&lt;BR /&gt;     videoTrackInfo-&amp;gt;clip_info.height,&lt;BR /&gt;     videoTrackInfo-&amp;gt;color_format);&lt;BR /&gt; if (umcResult != UMC::UMC_OK)&lt;BR /&gt; {&lt;BR /&gt;  str.Format("GDIVideoRenderParams.Init failure %d", umcResult);&lt;BR /&gt;  AfxMessageBox(str);&lt;BR /&gt;  return;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; renderParams.m_hWnd = this-&amp;gt;m_hWnd;&lt;BR /&gt; RECT rect;&lt;BR /&gt; GetClientRect(&amp;amp;rect);&lt;BR /&gt; renderParams.info.width = rect.right - rect.left;&lt;BR /&gt; renderParams.info.height = rect.top - rect.bottom;&lt;BR /&gt; renderParams.disp.left = rect.left;&lt;BR /&gt; renderParams.disp.right = rect.right;&lt;BR /&gt; renderParams.disp.top = rect.top;&lt;BR /&gt; renderParams.disp.bottom = rect.bottom;&lt;BR /&gt; renderParams.range.left = rect.left;&lt;BR /&gt; renderParams.range.right = rect.right;&lt;BR /&gt; renderParams.range.top = rect.top;&lt;BR /&gt; renderParams.range.bottom = rect.bottom;&lt;BR /&gt; renderParams.info = videoTrackInfo-&amp;gt;clip_info;&lt;BR /&gt;&lt;BR /&gt; UMC::GDIVideoRender render;&lt;BR /&gt; umcResult = render.Init(&amp;amp;renderParams);&lt;BR /&gt; if (umcResult != UMC::UMC_OK)&lt;BR /&gt; {&lt;BR /&gt;  str.Format("GDIVideoRender.Init failure %d", umcResult);&lt;BR /&gt;  AfxMessageBox(str);&lt;BR /&gt;  return;&lt;BR /&gt; }&lt;BR /&gt;#endif&lt;BR /&gt;#ifdef NULLRENDERER&lt;BR /&gt; UMC::VideoRenderParams renderParams;&lt;BR /&gt; umcResult = renderParams.out_data_template.Init(&lt;BR /&gt;     videoTrackInfo-&amp;gt;clip_info.width,&lt;BR /&gt;     videoTrackInfo-&amp;gt;clip_info.height,&lt;BR /&gt;     UMC::RGB32); // formerly videoTrackInfo-&amp;gt;color_format&lt;BR /&gt; if (umcResult != UMC::UMC_OK)&lt;BR /&gt; {&lt;BR /&gt;  str.Format("VideoRenderParams.out_data_template.Init failure %d", umcResult);&lt;BR /&gt;  AfxMessageBox(str);&lt;BR /&gt;&amp;nbsp;
;  return;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; RECT rect;&lt;BR /&gt; GetClientRect(&amp;amp;rect);&lt;BR /&gt; UMC::RECT disp;&lt;BR /&gt; disp.left = (Ipp16s)rect.left;&lt;BR /&gt; disp.right = (Ipp16s)rect.right;&lt;BR /&gt; disp.top = (Ipp16s)rect.top;&lt;BR /&gt; disp.bottom = (Ipp16s)rect.bottom;&lt;BR /&gt; UMC::RECT range;&lt;BR /&gt; range.left = (Ipp16s)rect.left;&lt;BR /&gt; range.right = (Ipp16s)rect.right;&lt;BR /&gt; range.top = (Ipp16s)rect.top;&lt;BR /&gt; range.bottom = (Ipp16s)rect.bottom;&lt;BR /&gt;&lt;BR /&gt; renderParams.disp = disp;&lt;BR /&gt; renderParams.range = range;&lt;BR /&gt; renderParams.lFlags = 0;&lt;BR /&gt;&lt;BR /&gt; UMC::NULLVideoRender render;&lt;BR /&gt; umcResult = render.Init(&amp;amp;renderParams);&lt;BR /&gt; if (umcResult != UMC::UMC_OK)&lt;BR /&gt; {&lt;BR /&gt;  str.Format("NULLVideoRender.Init failure %d", umcResult);&lt;BR /&gt;  AfxMessageBox(str);&lt;BR /&gt;  return;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; umcResult = renderParams.out_data_template.Close();&lt;BR /&gt; if (umcResult != UMC::UMC_OK)&lt;BR /&gt; {&lt;BR /&gt;  str.Format("VideoRenderParams.out_data_template.Close failure %d", umcResult);&lt;BR /&gt;  AfxMessageBox(str);&lt;BR /&gt;  return;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; render.ShowSurface();&lt;BR /&gt;&lt;BR /&gt; umcResult = render.ResizeDisplay(disp, range);&lt;BR /&gt; if (umcResult != UMC::UMC_OK)&lt;BR /&gt; {&lt;BR /&gt;  str.Format("NULLVideoRender.ResizeDisplay failure %d", umcResult);&lt;BR /&gt;  AfxMessageBox(str);&lt;BR /&gt;  return;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; render.ShowSurface();&lt;BR /&gt;#endif&lt;BR /&gt; //-------------------------------------------------------------------------&lt;BR /&gt; // process frames&lt;BR /&gt; //-------------------------------------------------------------------------&lt;BR /&gt; UMC::MediaData dataIn;&lt;BR /&gt; UMC::VideoData dataOut;&lt;BR /&gt;#if !defined(FWRENDERER) &amp;amp;&amp;amp; !defined(GDIRENDERER) &amp;amp;&amp;amp; !defined(NULLRENDERER)&lt;BR /&gt; umcResult = dataOut.SetAlignment(1);&lt;BR /&gt; if (umcResult != UMC::UMC_OK)&lt;BR /&gt; {&lt;BR /&gt;  str.Format("VideoData.SetAlignment failure %d", umcResult);&lt;BR /&gt;  AfxMessageBox(str);&lt;BR /&gt;  return;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; umcResult = dataOut.Init(&lt;BR /&gt;  videoTrackInfo-&amp;gt;clip_info.width,&lt;BR /&gt;  videoTrackInfo-&amp;gt;clip_info.height,&lt;BR /&gt;  UMC::RGB32); // formerly videoTrackInfo-&amp;gt;color_format&lt;BR /&gt; if (umcResult != UMC::UMC_OK)&lt;BR /&gt; {&lt;BR /&gt;  str.Format("VideoData.Init failure %d", umcResult);&lt;BR /&gt;  AfxMessageBox(str);&lt;BR /&gt; &amp;amp;nbs
p; return;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; size_t frameSize = videoTrackInfo-&amp;gt;clip_info.width * videoTrackInfo-&amp;gt;clip_info.height * 4;&lt;BR /&gt; Ipp8u *lpFrame = (Ipp8u*)new BYTE[frameSize];&lt;BR /&gt; if (!lpFrame)&lt;BR /&gt; {&lt;BR /&gt;  AfxMessageBox("Memory allocation failure");&lt;BR /&gt;  return;&lt;BR /&gt; }&lt;BR /&gt; umcResult = dataOut.SetBufferPointer(lpFrame, frameSize);&lt;BR /&gt; if (umcResult != UMC::UMC_OK)&lt;BR /&gt; {&lt;BR /&gt;  str.Format("VideoData.SetBufferPointer failure %d", umcResult);&lt;BR /&gt;  AfxMessageBox(str);&lt;BR /&gt;  return;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; dataOut.SetDataSize(0);&lt;BR /&gt;#endif&lt;BR /&gt; vm_tick total = 0;&lt;BR /&gt; vm_tick freq = vm_time_get_frequency();&lt;BR /&gt; int nframes = 0;&lt;BR /&gt; int decoderWait = 0;&lt;BR /&gt; while (1)&lt;BR /&gt; {&lt;BR /&gt;  while (1)&lt;BR /&gt;  {&lt;BR /&gt;   umcResult = splitter-&amp;gt;GetNextData(&amp;amp;dataIn, videoTrack);&lt;BR /&gt;   if (umcResult != UMC::UMC_ERR_NOT_ENOUGH_DATA)&lt;BR /&gt;    break;&lt;BR /&gt;   vm_time_sleep(5);&lt;BR /&gt;  }&lt;BR /&gt;&lt;BR /&gt;  if (umcResult != UMC::UMC_OK &amp;amp;&amp;amp;&lt;BR /&gt;   umcResult != UMC::UMC_ERR_END_OF_STREAM)&lt;BR /&gt;  {&lt;BR /&gt;   str.Format("splitter-&amp;gt;GetNextData failure %d", umcResult);&lt;BR /&gt;   AfxMessageBox(str);&lt;BR /&gt;   break;&lt;BR /&gt;  }&lt;BR /&gt;#if defined(FWRENDERER) || defined(GDIRENDERER) || defined(NULLRENDERER)&lt;BR /&gt;  UMC::Status umcResult2 = render.LockInputBuffer(&amp;amp;dataOut);&lt;BR /&gt;  if (umcResult2 != UMC::UMC_OK)&lt;BR /&gt;  {&lt;BR /&gt;   str.Format("render.LockInputBuffer failure %d", umcResult2);&lt;BR /&gt;   AfxMessageBox(str);&lt;BR /&gt;   break;&lt;BR /&gt;  }&lt;BR /&gt;#endif&lt;BR /&gt;  vm_tick t0 = vm_time_get_tick();&lt;BR /&gt;&lt;BR /&gt;  // if call to GetNextVideoData was entirely successful then pass MediaData input to GetFrame&lt;BR /&gt;  if (umcResult == UMC::UMC_OK)&lt;BR /&gt;   umcResult = decoder-&amp;gt;GetFrame(&amp;amp;dataIn, &amp;amp;dataOut);&lt;BR /&gt;  // if call to GetNextVideoData was not entirely successful then pass NULL input to GetFrame&lt;BR /&gt;  else&lt;BR /&gt;   umcResult = decod
er-&amp;gt;GetFrame(NULL, &amp;amp;dataOut);&lt;BR /&gt;&lt;BR /&gt;  vm_tick t1 = vm_time_get_tick();&lt;BR /&gt;  total += t1 - t0;&lt;BR /&gt;&lt;BR /&gt;  // if call to GetFrame resulted in end of stream&lt;BR /&gt;  if (umcResult == UMC::UMC_ERR_END_OF_STREAM)&lt;BR /&gt;  {&lt;BR /&gt;   AfxMessageBox("decoder.GetFrame returned UMC_ERR_END_OF_STREAM");&lt;BR /&gt;   break;&lt;BR /&gt;  }&lt;BR /&gt;&lt;BR /&gt;  // if call to GetFrame resulted in fatal error&lt;BR /&gt;  if (umcResult != UMC::UMC_OK &amp;amp;&amp;amp;&lt;BR /&gt;   umcResult != UMC::UMC_ERR_NOT_ENOUGH_DATA)&lt;BR /&gt;  {&lt;BR /&gt;   str.Format("decoder.GetFrame failure %d", umcResult);&lt;BR /&gt;   AfxMessageBox(str);&lt;BR /&gt;   break;&lt;BR /&gt;  }&lt;BR /&gt;#if defined(FWRENDERER) || defined(GDIRENDERER) || defined(NULLRENDERER)&lt;BR /&gt;  umcResult2 = render.UnLockInputBuffer(&amp;amp;dataOut);&lt;BR /&gt;  if (umcResult2 != UMC::UMC_OK)&lt;BR /&gt;  {&lt;BR /&gt;   str.Format("render.UnlockInputBuffer failure %d", umcResult2);&lt;BR /&gt;   AfxMessageBox(str);&lt;BR /&gt;   break;&lt;BR /&gt;  }&lt;BR /&gt;#endif&lt;BR /&gt;  // if call to GetFrame was entirely successful then render output frame&lt;BR /&gt;  if (umcResult == UMC::UMC_OK)&lt;BR /&gt;  {&lt;BR /&gt;   TRACE("dataOut width %d height %d planes %d color_format %d
",&lt;BR /&gt;    dataOut.GetWidth(), dataOut.GetHeight(), dataOut.GetNumPlanes(), dataOut.GetColorFormat());&lt;BR /&gt;&lt;BR /&gt;   struct UMC::VideoData::PlaneInfo planeInfo;&lt;BR /&gt;   for (int plane = 0; plane &amp;lt; dataOut.GetNumPlanes(); plane++)&lt;BR /&gt;   {&lt;BR /&gt;    dataOut.GetPlaneInfo(&amp;amp;planeInfo, plane);&lt;BR /&gt;    TRACE("plane %d m_pPlane 0x%08X width %d height %d iSampleSize %d iSamples %d iBitDepth %d nPitch %d nOffset 0x%X nMemSize %u
",&lt;BR /&gt;     plane,&lt;BR /&gt;     planeInfo.m_pPlane,&lt;BR /&gt;     planeInfo.m_ippSize.width,&lt;BR /&gt;     planeInfo.m_ippSize.height,&lt;BR /&gt;&amp;amp;nbs
p;     planeInfo.m_iSampleSize,&lt;BR /&gt;     planeInfo.m_iSamples,&lt;BR /&gt;     planeInfo.m_iBitDepth,&lt;BR /&gt;     planeInfo.m_nPitch,&lt;BR /&gt;     planeInfo.m_nOffset,&lt;BR /&gt;     planeInfo.m_nMemSize);&lt;BR /&gt;&lt;BR /&gt;    // if first plane then pass planar data to view&lt;BR /&gt;    if (plane == 0)&lt;BR /&gt;    {&lt;BR /&gt;     // if size of video frame has changed&lt;BR /&gt;     if (m_lpFrameData &amp;amp;&amp;amp;&lt;BR /&gt;      (planeInfo.m_ippSize.width != m_nFrameWidth || planeInfo.m_ippSize.height != m_nFrameHeight))&lt;BR /&gt;     {&lt;BR /&gt;      delete m_lpFrameData;&lt;BR /&gt;      m_lpFrameData = NULL;&lt;BR /&gt;     }&lt;BR /&gt;&lt;BR /&gt;     // if video frame not allocated&lt;BR /&gt;     if (!m_lpFrameData)&lt;BR /&gt;     {&lt;BR /&gt;      if (planeInfo.m_nMemSize != planeInfo.m_ippSize.width * planeInfo.m_ippSize.height * 4)&lt;BR /&gt;      {&lt;BR /&gt;       str.Format("Actual m_nMemsize %u expected %u",&lt;BR /&gt;        planeInfo.m_nMemSize, planeInfo.m_ippSize.width * planeInfo.m_ippSize.height);&lt;BR /&gt;       AfxMessageBox(str);&lt;BR /&gt;       return;&lt;BR /&gt;      }&lt;BR /&gt;&amp;nbsp;
;      m_nFrameWidth = planeInfo.m_ippSize.width;&lt;BR /&gt;      m_nFrameHeight = planeInfo.m_ippSize.height;&lt;BR /&gt;      m_lpFrameData = new BYTE[planeInfo.m_ippSize.width * planeInfo.m_ippSize.height * 4];&lt;BR /&gt;      if (!m_lpFrameData)&lt;BR /&gt;      {&lt;BR /&gt;       AfxMessageBox("Memory allocation failure");&lt;BR /&gt;       return;&lt;BR /&gt;      }&lt;BR /&gt;     }&lt;BR /&gt;&lt;BR /&gt;     // copy video frame data&lt;BR /&gt;     memcpy(m_lpFrameData, planeInfo.m_pPlane, planeInfo.m_nMemSize);&lt;BR /&gt;&lt;BR /&gt;     // repaint view&lt;BR /&gt;     Invalidate(FALSE);&lt;BR /&gt;    }&lt;BR /&gt;   }&lt;BR /&gt;#if defined(FWRENDERER) || defined(GDIRENDERER) || defined(NULLRENDERER)&lt;BR /&gt;   TRACE("frame %d delta %d FPS %.1f
",&lt;BR /&gt;    nframes, t1 - t0, 1.0 / ((t1 - t0) / (double)freq));&lt;BR /&gt;&lt;BR /&gt;   Ipp64f time = -1;&lt;BR /&gt;   while (render.GetRenderFrame(&amp;amp;time) == UMC::UMC_ERR_TIMEOUT)&lt;BR /&gt;    AfxMessageBox("render.GetRenderFrame UMC_ERR_TIMEOUT");&lt;BR /&gt;&lt;BR /&gt;   umcResult = render.RenderFrame();&lt;BR /&gt;   if (umcResult != UMC::UMC_OK)&lt;BR /&gt;   {&lt;BR /&gt;    str.Format("render.RenderFrame failure %d", umcResult);&lt;BR /&gt;    AfxMessageBox(str);&lt;BR /&gt;    break;&lt;BR /&gt;   }&lt;BR /&gt;#else&lt;BR /&gt;   TRACE("frame %d not rendered
", nframes);&lt;BR /&gt;#endif&lt;BR /&gt;   nframes++;&lt;BR /&gt;  &amp;amp;n
bsp; decoderWait = 0;&lt;BR /&gt;  }&lt;BR /&gt;  // check for stuck at UMC_ERR_NOT_ENOUGH_DATA&lt;BR /&gt;  else if (++decoderWait &amp;gt;= 100)&lt;BR /&gt;  {&lt;BR /&gt;   AfxMessageBox("decoder stuck at UMC_ERR_NOT_ENOUGH_DATA");&lt;BR /&gt;   return;&lt;BR /&gt;  }&lt;BR /&gt; }&lt;BR /&gt; TRACE("exiting
");&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;DWORD WINAPI CAtsPlaybackIPPView::StartPlaybackThread(LPVOID arg)&lt;BR /&gt;{&lt;BR /&gt; CAtsPlaybackIPPView *lpView = (CAtsPlaybackIPPView*)arg;&lt;BR /&gt; lpView-&amp;gt;PlaybackThread();&lt;BR /&gt; return(0);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 05 Feb 2008 17:20:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/How-to-get-bitmap-from-VideoData-or-VideoRender/m-p/856644#M7224</guid>
      <dc:creator>franknatoli</dc:creator>
      <dc:date>2008-02-05T17:20:06Z</dc:date>
    </item>
  </channel>
</rss>

