Hi Niels,
Appreciate for your help.
1. I have try DSFLIP_NONE to see the playing rate, it still take 1.9s to
play 30 frame.
2. I use "for" loop to playing 30 frame, and measure how long it take.
like this
<=========
while (!quit) {
lastftick = myclock();
for(i=0;i<FRAME_NUMBER;I++){
CopyYUVData(temp[i], videosurface); //temp[i] is 30 frame
/*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);
}
=========>
output: playing 30 buffer time used: 1941 s
3. My gfx card do support UYVY to RGB, I read 30 UYVY files to memory(above
slice code's temp[i] )
and copy to videosurface, it can display correctly.
4. Actually I regard this surface as "primary surface", is because I use the
DSCAPS_PRIMARY parameter
to create surface,
like this slice code.
<=========
desc.caps = DSCAPS_PRIMARY;
desc.pixelformat = DSPF_RGB16;
desc.width = SCREEN_W;
desc.height = SCREEN_H;
dfb->CreateSurface(dfb, &desc, &primarysurface);
=========>
Am I making some misunderstanding on this?
5. In fact, my example just can play each single frame in loop. :o
And it takes almost 2 seconds to play 30 frames(too slow, my main issue).
Here is my guess, maybe root cause is on memcpy too slow?
The XGA UYVY file size is 1.5mb/frame, memcpy can't move data to
"videosurface" in time.
So it can't meet 30frame/s. Is this guess reasonable?
Thanks for you help!
Best Regards.
Lidj.
Niels Roest wrote:
>
> Hi, had a short look.
> Not quite sure what is your issue so I need to ask a few questions.
>
> You might want to remove DSFLIP_WAITFORSYNC to see how close you are to
> 30.
> Did you do the math to check for the maximum theoretical throughput?
> Also curious if the layer really switched to UYVY, not sure if your gfx
> driver supports this. You can check with dfbdump, best is to run this at
> the same time as your test code (you need to have directfb configured
> multi-app in this case).
> Also, you mention 'primarysurface' but if I understand the code, it
> doesn't take the primary layer.
>
> Is your example displaying the little movie correctly?
>
> Greets
> Niels
>
> Lidj wrote:
>> 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.
>>
>>
>
>
> --
>
> .------------------------------------------.
> | DirectFB - Hardware accelerated graphics |
> | http://www.directfb.org/ |
> "------------------------------------------"
>
> _______________________________________________
> directfb-users mailing list
> [email protected]
> http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users
>
>
--
View this message in context:
http://www.nabble.com/How-to-accelerate-playing-UYVY-data--tp21156543p21289672.html
Sent from the DirectFB Users mailing list archive at Nabble.com.
_______________________________________________
directfb-users mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users