Niels Roest wrote:
>
> Lidj wrote:
>> 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
>>
>>Ok, I assume you put DSFLIP_NONE, and not DSFLIP_WAITFORSYNC as you
>>copied here above.
>>What I actually mean if you have done a theoretical throughput
>>calculation, based on the capabilities of your hardware. In other words:
>>how do you know for sure that 30fps is possible?
> About this, I just simply think: In windows, they can driver graphic
> card to support 30fps
> it should be able to support in arm-system?
>
>
>> 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?
>>
>>
>>DSCAPS_PRIMARY is correct. But, what I see is that you do not show the
>>primarysurface, I mean you are not using it in your 'flip' call. There I
>>see that you are using videosurface.
>
> I saw your point, you are right,I do have misunderstanding,
> I think it need to create primary surface to set output srceen's
> resolution in that time.
> I comment this slice code and run again, it still work well :D
>
>> 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?
>>
>>That is possible.
>>You can simply remove the memcpy and see what happens.
> if I remove memcpy, the process of moving data to videosurface will
> skip.
> Therefore it will do nothing on this test program, also output nothing.
>
> But I don't know use what function to replace memcpy.
> memcpy is the faster way to copy data.
>
> Advanced Programming in the UNIX Environment 2Ed
> chap14.9 mentioned.
> =====
> As far as elapsed time is concerned, the version with mmap and memcpy is
> faster than the version with read and write. This makes sense, because
> we're doing less work with mmap and memcpy. With read and write, we copy
> the data from the kernel's buffer to the application's buffer (read), and
> then copy the data from the application's buffer to the kernel's buffer
> (write). With mmap and memcpy, we copy the data directly from one kernel
> buffer mapped into our address space into another kernel buffer mapped
> into our address space.
> =======
>
> Thanks again~
> Lidj.
>
>> 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
>>> directfb-users@directfb.org
>>> http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users
>>>
>>>
>>>
>>
>>
>
>
> --
>
> .------------------------------------------.
> | DirectFB - Hardware accelerated graphics |
> | http://www.directfb.org/ |
> "------------------------------------------"
>
> _______________________________________________
> directfb-users mailing list
> directfb-users@directfb.org
> 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--tp21156543p21305913.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