Dear all, I am new to DFB, here I modify df_layer.c to play UYVY data on XGI graphic card, this graphic card support yuv to rgb. Now I playing XGA(1024x768 16it)picture(about 1.5 mb/frame), the frame rate is just 15 frame/s,I want to achieve 30 frame/s at least.
Here is my flow. 1. Create "dfb" super interface. 2. Enumerate display layers "videolayer" from dfb. 3. "videolayer" get "videosurface" ,"dfb" create "primarysurface" 4. copy yuv data into "videosurface", then flip. yuv data already buffer to memory, just playing yuv date cyclically. Here is slice code. <========= while (!quit) { lastftick = myclock(); for(i=0;i<FRAME_NUMBER;I++){ CopyYUVData(temp[i], videosurface); /*Flip the buffers of videosurface on the video layer*/ videosurface->Flip(videosurface, NULL, DSFLIP_WAITFORSYNC); } lastftick = myclock()-lastftick; printf("playing %d buffer time used: %ld s\n", frame_number,lastftick); } =========> <========= #define YUVSRC_W 1024 #define YUVSRC_H 768 #define YUVFRAME_BYTESPerPixel 2 #define YUVFRAME_SIZE (YUVSRC_W * YUVSRC_H) #define YUVFRAME_Pitch (YUVSRC_W * YUVFRAME_BYTESPerPixel) void CopyYUVData(unsigned char *src, IDirectFBSurface *des) { int y; void *data; unsigned int pitch; DFBResult ret; ret = des->Lock (des, DSLF_WRITE, &data, &pitch); if (ret) { fprintf(stderr,"IDirectFBSurface:ock error code =%d", ret); return; } for(y=0; y<YUVSRC_H; y++) { memcpy(data, src+YUVFRAME_Pitch*y, YUVFRAME_Pitch); data += pitch; } des->Unlock (des); } =========> here is entire code. please go to below link, and simply click dowoload. http://www.box.net/shared/7dafavyvrz Any comment will be very appreciated :D Best regard~ Lidj. -- View this message in context: http://www.nabble.com/How-to-accelerate-playing-UYVY-data--tp21156543p21156543.html Sent from the DirectFB Users mailing list archive at Nabble.com. _______________________________________________ directfb-users mailing list directfb-users@directfb.org http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users