<?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 Get Frame and Bitamp save problem in Intel® Integrated Performance Primitives</title>
    <link>https://community.intel.com/t5/Intel-Integrated-Performance/Get-Frame-and-Bitamp-save-problem/m-p/809216#M3807</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for your reply! It was solved my problem.&lt;/P&gt;&lt;P&gt;Could you tell me, if I find a built-in IPP function for BMP saving?&lt;/P&gt;</description>
    <pubDate>Tue, 12 Oct 2010 22:19:18 GMT</pubDate>
    <dc:creator>ulisses87</dc:creator>
    <dc:date>2010-10-12T22:19:18Z</dc:date>
    <item>
      <title>Get Frame and Bitamp save problem</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Get-Frame-and-Bitamp-save-problem/m-p/809214#M3805</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to save all frames from MP4 video files as BMP files on my hard drive. I have designed working part of code, but unfortunately, saved BMP file is rotated at 180 degrees and flipped. You can see its below:&lt;/P&gt;&lt;P&gt;&lt;IMG src="http://www.ists.pl/~michmajsoftware/Private/bad.jpg" /&gt;&lt;/P&gt;&lt;P&gt;...and this is correct image:&lt;/P&gt;&lt;P&gt;&lt;IMG src="http://www.ists.pl/~michmajsoftware/Private/good.jpg" /&gt;&lt;/P&gt;&lt;P&gt;I see also that colors are not the same...&lt;/P&gt;&lt;P&gt;I suppose that it's connected with little endian byte order of BMP and fact that lines in BMP standard are stored in inverted order BUT I still can't solve my problem.&lt;/P&gt;&lt;P&gt;What I did wrong?&lt;/P&gt;&lt;P&gt;BTW: Is it correct way? Maybe IPP has internal easy to use function for saving BMP files.&lt;/P&gt;&lt;P&gt;Thanks for any help.&lt;/P&gt;&lt;P&gt;It's my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#include &lt;STDLIB.H&gt;&lt;BR /&gt;#include &lt;STDIO.H&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_mp4_spl.h"&lt;BR /&gt;#include "umc_splitter.h"&lt;BR /&gt;#include "umc_video_render.h"&lt;BR /&gt;#include "fw_video_render.h"&lt;BR /&gt;#include "umc_h264_dec.h"&lt;BR /&gt;#include "vm_time.h"&lt;BR /&gt;&lt;BR /&gt;//unsigned char rgbBuff[384 * 288 * 3];&lt;BR /&gt;&lt;BR /&gt;void SaveBitmap(unsigned char *image, IppiSize imgSize, char* name){&lt;BR /&gt; //printf("%d\\n",sizeof(ℑ));&lt;BR /&gt; FILE *outputFp;&lt;BR /&gt; outputFp = fopen(name,"wb");&lt;BR /&gt; if(outputFp != NULL) {&lt;BR /&gt;	BITMAPFILEHEADER bmpFileHdr;&lt;BR /&gt;	BITMAPINFOHEADER bmpInfoHdr;&lt;BR /&gt;	memset(&amp;amp;bmpFileHdr,0,sizeof(BITMAPFILEHEADER));&lt;BR /&gt;	memset(&amp;amp;bmpInfoHdr,0,sizeof(BITMAPINFOHEADER));&lt;BR /&gt;	//bmpFileHdr.bfType = 'B' + ('M'&amp;lt;&amp;lt;8);    // 'BM'&lt;BR /&gt;	bmpFileHdr.bfType = ('M' &amp;lt;&amp;lt; 8) | 'B';&lt;BR /&gt;	bmpFileHdr.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);&lt;BR /&gt;	bmpFileHdr.bfSize = bmpFileHdr.bfOffBits + imgSize.width * imgSize.height * 3;&lt;BR /&gt;	bmpInfoHdr.biSize = sizeof(BITMAPINFOHEADER);&lt;BR /&gt;	bmpInfoHdr.biHeight = imgSize.height;&lt;BR /&gt;	bmpInfoHdr.biWidth = imgSize.width;&lt;BR /&gt;	bmpInfoHdr.biPlanes = 1;&lt;BR /&gt;	bmpInfoHdr.biBitCount = 24;&lt;BR /&gt;	bmpInfoHdr.biCompression = BI_RGB;&lt;BR /&gt;	bmpInfoHdr.biSizeImage = imgSize.width * imgSize.height * 3;&lt;BR /&gt;	fwrite(&amp;amp;bmpFileHdr,sizeof(BITMAPFILEHEADER),1,outputFp);&lt;BR /&gt;	fwrite(&amp;amp;bmpInfoHdr,sizeof(BITMAPINFOHEADER),1,outputFp);&lt;BR /&gt;	fwrite(image,1,sizeof(image),outputFp);&lt;BR /&gt;	fclose(outputFp);&lt;BR /&gt;	//printf("%d\\n",sizeof(image));&lt;BR /&gt; }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;void EncodeStream(vm_char * inputfilename, vm_char * outputfilename)&lt;BR /&gt;{&lt;BR /&gt;   	Ipp32u videoTrack=0; int exit_flag =0;&lt;BR /&gt;	UMC::Status status;  &lt;BR /&gt;	UMC::MediaData in; UMC::VideoData out;	&lt;BR /&gt;	UMC::FIOReader reader; UMC::FileReaderParams readerParams;&lt;BR /&gt;	UMC::SplitterParams splitterParams; UMC::SplitterInfo * streamInfo;&lt;BR /&gt;	UMC::MP4Splitter Splitter;&lt;BR /&gt;		&lt;BR /&gt;	UMC::VideoStreamInfo *videoInfo=NULL;&lt;BR /&gt;	UMC::VideoDecoder *  videoDecoder; UMC::VideoDecoderParams videoDecParams;&lt;BR /&gt;	UMC::FWVideoRender fwRender; UMC::FWVideoRenderParams fwRenderParams;&lt;BR /&gt;	&lt;BR /&gt;	readerParams.m_portion_size = 0;&lt;BR /&gt;	vm_string_strcpy(readerParams.m_file_name, inputfilename);&lt;BR /&gt;	if((status = reader.Init(&amp;amp;readerParams))!= UMC::UMC_OK) &lt;BR /&gt;       return;&lt;BR /&gt;	splitterParams.m_lFlags = UMC::VIDEO_SPLITTER;&lt;BR /&gt;	splitterParams.m_pDataReader = &amp;amp;reader;&lt;BR /&gt;    if((status = Splitter.Init(splitterParams))!= UMC::UMC_OK)&lt;BR /&gt;	   return;&lt;BR /&gt;	Splitter.GetInfo(&amp;amp;streamInfo);&lt;BR /&gt;    for (videoTrack = 0; videoTrack &amp;lt;  streamInfo-&amp;gt;m_nOfTracks; videoTrack++) {&lt;BR /&gt;      if (streamInfo-&amp;gt;m_ppTrackInfo[videoTrack]-&amp;gt;m_Type == UMC::TRACK_H264)&lt;BR /&gt;           break;&lt;BR /&gt;    }&lt;BR /&gt;	videoInfo = (UMC::VideoStreamInfo*)(streamInfo-&amp;gt;m_ppTrackInfo[videoTrack]-&amp;gt;m_pStreamInfo);&lt;BR /&gt;	if(videoInfo-&amp;gt;stream_type!=UMC::H264_VIDEO)&lt;BR /&gt;        return;&lt;BR /&gt;    videoDecParams.info =  (*videoInfo);&lt;BR /&gt;	videoDecParams.m_pData = streamInfo-&amp;gt;m_ppTrackInfo[videoTrack]-&amp;gt;m_pDecSpecInfo;&lt;BR /&gt;	videoDecParams.numThreads = 1;&lt;BR /&gt;    videoDecoder = (UMC::VideoDecoder*)(new UMC::H264VideoDecoder());&lt;BR /&gt;	if((status = videoDecoder-&amp;gt;Init(&amp;amp;videoDecParams))!= UMC::UMC_OK)&lt;BR /&gt;		return;&lt;BR /&gt;	fwRenderParams.out_data_template.Init(videoInfo-&amp;gt;clip_info.width, videoInfo-&amp;gt;clip_info.height, videoInfo-&amp;gt;color_format);&lt;BR /&gt;    fwRenderParams.pOutFile = outputfilename;&lt;BR /&gt;    if(status = fwRender.Init(&amp;amp;fwRenderParams)!= UMC::UMC_OK)&lt;BR /&gt;		return;&lt;BR /&gt;	Splitter.Run();&lt;BR /&gt;&lt;BR /&gt;//for BMP saving&lt;BR /&gt;	 DWORD nWritten;&lt;BR /&gt;	 HANDLE fh;&lt;BR /&gt;FILE *outputFp;&lt;BR /&gt;BITMAPFILEHEADER bmpFileHdr;&lt;BR /&gt;BITMAPINFOHEADER bmpInfoHdr;&lt;BR /&gt;IppiSize imgSize;&lt;BR /&gt;imgSize.height=videoInfo-&amp;gt;clip_info.height;&lt;BR /&gt;imgSize.width=videoInfo-&amp;gt;clip_info.width;&lt;BR /&gt;unsigned char rgbBuff[384 * 288 * 3];&lt;BR /&gt;char name[20]="output ";&lt;BR /&gt;int i=0;&lt;BR /&gt;char number[10];&lt;BR /&gt;const Ipp8u* dst[3];&lt;BR /&gt;dst[0] = (Ipp8u*)malloc(imgSize.width * imgSize.height);&lt;BR /&gt;dst[1] = (Ipp8u*)malloc(imgSize.width * imgSize.height);&lt;BR /&gt;dst[2] = (Ipp8u*)malloc(imgSize.width * imgSize.height);&lt;BR /&gt;&lt;BR /&gt;////&lt;BR /&gt;	do&lt;BR /&gt;	{   do{ &lt;BR /&gt;		     if (in.GetDataSize() &amp;lt; 4) {&lt;BR /&gt;	    	     do{ &lt;BR /&gt;	              status= Splitter.GetNextData(&amp;amp;in,videoTrack);&lt;BR /&gt;			       if(status==UMC::UMC_ERR_NOT_ENOUGH_DATA)&lt;BR /&gt;   			            vm_time_sleep(5);&lt;BR /&gt;			      }while(status==UMC::UMC_ERR_NOT_ENOUGH_DATA);&lt;BR /&gt;			      if(((status != UMC::UMC_OK) &amp;amp;&amp;amp; (status != UMC::UMC_ERR_END_OF_STREAM))||&lt;BR /&gt;				     (status == UMC::UMC_ERR_END_OF_STREAM)&amp;amp;&amp;amp; (in.GetDataSize()&amp;lt;4)) {&lt;BR /&gt;                        exit_flag=1;&lt;BR /&gt;				  }&lt;BR /&gt;             }&lt;BR /&gt;			 fwRender.LockInputBuffer(&amp;amp;out);&lt;BR /&gt;		     videoDecoder-&amp;gt;GetFrame(&amp;amp;in,&amp;amp;out);&lt;BR /&gt;			 //YUV420 to RGB conversion&lt;BR /&gt;			 dst[0] = (Ipp8u*)out.GetPlanePointer(0);&lt;BR /&gt;			 dst[1] = (Ipp8u*)out.GetPlanePointer(1);&lt;BR /&gt;			 dst[2] = (Ipp8u*)out.GetPlanePointer(2);&lt;BR /&gt;			// printf("%d\\n",sizeof(rgbBuff));&lt;BR /&gt;			 /*ippSt =*/ ippiYUV420ToRGB_8u_P3C3(dst,rgbBuff,imgSize);&lt;BR /&gt;			 //printf("%d\\n",sizeof(rgbBuff));&lt;BR /&gt;			 /*if(ippSt != ippStsNoErr) {&lt;BR /&gt;				return -1;&lt;BR /&gt;			 }*/&lt;BR /&gt;			 strcpy(name,"output ");&lt;BR /&gt;			 itoa(i,number,10);&lt;BR /&gt;			 strcat(name,number);&lt;BR /&gt;			 strcat(name,".bmp");&lt;BR /&gt;			 //SaveBitmap(rgbBuff,imgSize,name);/&lt;BR /&gt;			 /////////////&lt;BR /&gt;	&lt;BR /&gt; //outputFp = fopen(name,"wb");&lt;BR /&gt; //if(outputFp != NULL) {&lt;BR /&gt;	memset(&amp;amp;bmpFileHdr,0,sizeof(BITMAPFILEHEADER));&lt;BR /&gt;	memset(&amp;amp;bmpInfoHdr,0,sizeof(BITMAPINFOHEADER));&lt;BR /&gt;	//bmpFileHdr.bfType = 'B' + ('M'&amp;lt;&amp;lt;8);    // 'BM'&lt;BR /&gt;	bmpFileHdr.bfType = ('M' &amp;lt;&amp;lt; 8) | 'B';&lt;BR /&gt;	bmpFileHdr.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);&lt;BR /&gt;	bmpFileHdr.bfSize = bmpFileHdr.bfOffBits + imgSize.width * imgSize.height * 3;&lt;BR /&gt;	bmpInfoHdr.biSize = sizeof(BITMAPINFOHEADER);&lt;BR /&gt;	bmpInfoHdr.biHeight = imgSize.height;&lt;BR /&gt;	bmpInfoHdr.biWidth = imgSize.width;&lt;BR /&gt;	bmpInfoHdr.biPlanes = 1;&lt;BR /&gt;	bmpInfoHdr.biBitCount = 24;&lt;BR /&gt;	bmpInfoHdr.biCompression = BI_RGB;&lt;BR /&gt;	bmpInfoHdr.biSizeImage = imgSize.width * imgSize.height * 3;&lt;BR /&gt;	//fwrite(&amp;amp;bmpFileHdr,sizeof(BITMAPFILEHEADER),1,outputFp);&lt;BR /&gt;	//fwrite(&amp;amp;bmpInfoHdr,sizeof(BITMAPINFOHEADER),1,outputFp);&lt;BR /&gt;	//fwrite(rgbBuff,1,sizeof(rgbBuff),outputFp);&lt;BR /&gt;	//fclose(outputFp);&lt;BR /&gt;	//printf("%d\\n",sizeof(image));&lt;BR /&gt; fh = CreateFile(L"cos.bmp", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);&lt;BR /&gt; WriteFile(fh, &amp;amp;bmpFileHdr,sizeof(BITMAPFILEHEADER), &amp;amp;nWritten, NULL);&lt;BR /&gt; WriteFile(fh, &amp;amp;bmpInfoHdr,sizeof(BITMAPINFOHEADER), &amp;amp;nWritten, NULL);&lt;BR /&gt; WriteFile(fh, rgbBuff, sizeof(rgbBuff), &amp;amp;nWritten, NULL);&lt;BR /&gt; CloseHandle(fh);&lt;BR /&gt; //}&lt;BR /&gt;&lt;BR /&gt;			 //////////&lt;BR /&gt;    	  	 fwRender.UnLockInputBuffer(&amp;amp;out);&lt;BR /&gt;		     fwRender.RenderFrame();&lt;BR /&gt;			 i++;&lt;BR /&gt;	     }while(!exit_flag &amp;amp;&amp;amp; (status == UMC::UMC_ERR_NOT_ENOUGH_DATA || status == UMC::UMC_ERR_SYNC));&lt;BR /&gt;	 }while (exit_flag!=1);&lt;BR /&gt;&lt;BR /&gt;	do{  &lt;BR /&gt;		 fwRender.LockInputBuffer(&amp;amp;out);&lt;BR /&gt;	     status  = videoDecoder-&amp;gt;GetFrame(NULL,&amp;amp;out);		 &lt;BR /&gt;	     fwRender.UnLockInputBuffer(&amp;amp;out);&lt;BR /&gt;         fwRender.RenderFrame();&lt;BR /&gt;	}while(status == UMC::UMC_OK);			&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;void main(int argc, vm_char* argv[])&lt;BR /&gt;{&lt;BR /&gt;   vm_char *  InputVideofileName, *OutputYUVFileName;&lt;BR /&gt;   InputVideofileName = VM_STRING("teststream.mp4"); //use unicode string if project use unicode characters&lt;BR /&gt;   OutputYUVFileName  = VM_STRING("testoutput.yuv"); //use unicode string if project use unicode characters&lt;BR /&gt;&lt;BR /&gt;   EncodeStream(InputVideofileName,OutputYUVFileName);&lt;BR /&gt;}&lt;/STDIO.H&gt;&lt;/STDLIB.H&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Oct 2010 17:36:32 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Get-Frame-and-Bitamp-save-problem/m-p/809214#M3805</guid>
      <dc:creator>ulisses87</dc:creator>
      <dc:date>2010-10-10T17:36:32Z</dc:date>
    </item>
    <item>
      <title>Get Frame and Bitamp save problem</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Get-Frame-and-Bitamp-save-problem/m-p/809215#M3806</link>
      <description>&lt;P&gt;&lt;BR /&gt;Hi, &lt;/P&gt;&lt;P&gt;IPP Mirror function can be used here to flip the image: &lt;/P&gt;&lt;P&gt;Mirrors an image about a horizontal or vertical axis, orboth.&lt;/P&gt;&lt;P&gt;IppStatus ippiMirror_&lt;MOD&gt;(const Ipp&lt;DATATYPE&gt;* pSrc, int srcStep, Ipp&lt;DATATYPE&gt;* pDst,int dstStep, IppiSize roiSize, IppiAxis flip);&lt;/DATATYPE&gt;&lt;/DATATYPE&gt;&lt;/MOD&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Chao&lt;/P&gt;</description>
      <pubDate>Mon, 11 Oct 2010 08:39:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Get-Frame-and-Bitamp-save-problem/m-p/809215#M3806</guid>
      <dc:creator>Chao_Y_Intel</dc:creator>
      <dc:date>2010-10-11T08:39:14Z</dc:date>
    </item>
    <item>
      <title>Get Frame and Bitamp save problem</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Get-Frame-and-Bitamp-save-problem/m-p/809216#M3807</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for your reply! It was solved my problem.&lt;/P&gt;&lt;P&gt;Could you tell me, if I find a built-in IPP function for BMP saving?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Oct 2010 22:19:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Get-Frame-and-Bitamp-save-problem/m-p/809216#M3807</guid>
      <dc:creator>ulisses87</dc:creator>
      <dc:date>2010-10-12T22:19:18Z</dc:date>
    </item>
    <item>
      <title>Get Frame and Bitamp save problem</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Get-Frame-and-Bitamp-save-problem/m-p/809217#M3808</link>
      <description>&lt;BR /&gt;&lt;BR /&gt;IPPlibarary does not include such function. IPP UIC sample code(\ipp-samples\image-codecs\uic) include some code on BMP file handling. &lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Chao&lt;BR /&gt;</description>
      <pubDate>Thu, 14 Oct 2010 08:27:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Get-Frame-and-Bitamp-save-problem/m-p/809217#M3808</guid>
      <dc:creator>Chao_Y_Intel</dc:creator>
      <dc:date>2010-10-14T08:27:44Z</dc:date>
    </item>
  </channel>
</rss>

