1 / 24

291 Izvedba video aplikacija na Microsoft PocketPC platformama

291 Izvedba video aplikacija na Microsoft PocketPC platformama. Mr.sc. Hrvoje Mlinarić Prof. Dr.sc. Mario Kovač FER - Zagreb. 300. Što i Kako ?. Uvod Problematika Dekodiranje Video Datoteka Sinkronizacija ??? Zaslon Game API Zaključak. Što želimo postići ? Kome to treba ?

burian
Download Presentation

291 Izvedba video aplikacija na Microsoft PocketPC platformama

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 291Izvedba video aplikacija na Microsoft PocketPC platformama Mr.sc. Hrvoje Mlinarić Prof. Dr.sc. Mario Kovač FER - Zagreb 300

  2. Što i Kako ? • Uvod • Problematika • Dekodiranje Video Datoteka • Sinkronizacija ??? • Zaslon • Game API • Zaključak

  3. Što želimo postići ? • Kome to treba ? • Kako to realizirati ?

  4. Video Sadržaj • Video kompresija • MPEG-1 • MPEG-2 • MPEG-4 • MJPEG • … • Zapis videa • AVI, QuickTime format, MPEG System file

  5. Dekodiranje Video Sadržaja • Trenutno Microsoft ne nudi rješenje… • Direct Show, Direct Play, Direct Draw ??? • Zašto ??? • Vjerujem da ubrzano rade na tome ! • Video dekodiranje je vrlo zahtjevno • Sinkronizacija audija i videa komplicirana • Snaga PDA uređaja ograničena (400MHz) • Rješenje • Koristiti druga komercijalna rješenja ...

  6. PlayMediaSystems- 4Play • Skup alata za rad s video i audio sadržajem • dekodiranje videa MPEG1,MPEG2, MPEG4, MJPEG, … • dekodiranje audia MP3 • Parsiranje video datoteka AVI, VCD, MPEG4 System datoteka. • Enkodiranje MPEG4 • Skup alata za YUV-RGB konverziju • …

  7. buffer_size = 32768; stream.full_decode = TRUE; stream.postprocess = POST_NONE; stream.output_type = OUTPUT_RGB_16; stream.data_buffer = (unsigned char *) malloc(buffer_size); stream.data_buffer_size = 0; stream.use_external_yuv_buffers = 0; mp4_init_decoder(&stream); • Primjer inicijalizacije MPEG4 dekodera

  8. memcpy(stream.data_buffer,buffer,size); stream.data_buffer_size = size; mp4_reload_decoder(&stream); result=mp4_get_frame(&stream); • Primjer dekodiranja MPEG4 okvira AVI datoteka… AVIStream_Init(c_file,&aFile) // Init AVI parser AVIStream_ReadVideoData(&aFile,&size,&buffer); AVIStream_ReadAudioData(&aFile,&size,&buffer);

  9. Zaslon • Većina video formata zasniva se na YUV formatu zapisa boja • YUV format podržan je na PC grafičkim karticama • Niti jedan PDA uređaj nema zaslon koji podržava YUV format. • Moramo koristiti YUV-RGB konverziju • Veliki problem:: slika 320*244 troši 40% CPU-a

  10. CDC *pDC; pDC=GetDC(); bitmapinfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER); bitmapinfo.bmiHeader.biWidth=100; . . . . . . bitmapinfo.bmiHeader.biClrImportant=256; hTargetBitmap = CreateDIBSection(pDC->m_hDC, &bitmapinfo, DIB_RGB_COLORS, &pBuffer,NULL,0); hDC_C=CreateCompatibleDC(pDC->m_hDC); HBITMAP old=(HBITMAP)SelectObject(hDC_C,hTargetBitmap); t=(int*)pBuffer; for(i=0;i<100*100;i++) t[i]=i; BOOL c= BitBlt(pDC->m_hDC,0, 0, 100, 100, hDC_C,0, 0, SRCCOPY); ReleaseDC(pDC);

  11. Problematika navedenog rješenja • Video dekodiranje vrlo zahtjevno • 45fps (320 x 240) • + YUV-RBG :: 32 – 36 fps • audio dekodiranje MP3 sadržaja 20% • Video + RGB + YUV :: ~26 fps… • Svi podatci navedeni za X-SCALE na 400MHz • Najveći problem memorija • CPU radi na 400 MHz • Sabirnica prema memoriji 50MHz • usko grlo !!!

  12. Problematika navedenog rješenja • U navedenom rješenju imamo tri kopiranja blokova • sliku u blok memorije • iz memorije u DC • iz DC u Video memoriju • Nameće se pitanje kako pisati direktno u Video memoriju • Microsoft nam nudi pomoć • GAME API

  13. Game API • Omogućava direktan pristup Video uređaju • Dozvoljava crtanje po zaslonu zaobilazeći PocketPC system • Preteča budućeg Pocket DirectX-a

  14. Funkcije GAPI-a • GXBeginDraw • GXCloseDisplay • GXCloseInputGXEndDraw • GXGetDefaultKeys • GXGetDisplayProperties • GXIsDisplayDRAMBuffer • GXOpenDisplay • GXOpenInput • GXResume • GXSetViewport • GXSuspend

  15. GXBeginDraw GXDLL_API void * GXBeginDraw (); Parameters • None. Return Values • Pointer to start of display memory, or NULL if the display cannot be locked.

  16. GXEndDraw GXDLL_API int GXEndDraw (); Parameters • None. Return Values • Returns 1 if the call was successful, or 0 if there was an error. Call GetLastError to retrieve extended error information.

  17. GXGetDisplayProperties GXDLL_API GXDisplayProperties GXGetDisplayProperties (); Parameters • None. Return Values • Returns a populated GXDisplayProperties structure.

  18. GXDisplayProperties struct GXDisplayProperties { DWORD cxWidth; DWORD cyHeight; long cbxPitch; long cbyPitch; long cBPP; DWORD ffFormat; };

  19. unsigned short * pusLine; pusLine = (unsigned short *)GXBeginDraw(); pms_yuv2rgb_dev(stream.y_resize, stream.output_width+64, stream.u_resize, stream.v_resize,stream.output_width/2+32, (unsigned short *) pusLine,stream.output_width, stream.output_height, gx_displayprop.cbxPitch,gx_displayprop.cbyPitch,3,0,0,stream.mb_coded); GXEndDraw();

  20. Problem različitih zaslona • Dimenzije zaslona • 320 x 244 • 244 x 320 • Orijentacija • Od lijeva na desno ili od desna na lijevo • Odozgo prema dolje ili obrnuto • Broje boja • 32bpp, 24 bpp, 16 bpp • RGB:: 444, 555, 565

  21. Zaključak • Video dekodiranje • Ispis na zaslon • GAME API • Neriješeni problemi • Zvuk • Sinkronizacija videa i zvuka • GUI

  22. Q & A

More Related