Okay, I actually found out that using top instead of the kde monitor, my cpu is using ~21 % cpu, so I decided to try the XVoverlay out.
When using a standard surface, my test scheme is this:
Code:
SDL_Surface *screen;
SDL_Surface *SDLimage; // I have filled this surface with a static picture before running the while loop.
screen = SDL_SetVideoMode(640,480,24,SDL_HWSURFACE|SDL_NOFRAME)))
while(1)
{
//Draw pixels to screen here
SDL_BlitSurface(SDLimage, NULL, screen, NULL);
SDL_FreeSurface(SDLimage);
SDL_Flip(screen);
SDL_Delay(50); // Delay, so you will get ~ 20 fps
}
And my test scheme for a xv overlay is:
Code:
#define SDL_YV12_OVERLAY 0x32315659 /* Planar mode: Y + V + U */
SDL_Rect where;
where.h = 480;
where.w = 640;
where.x = 0;
where.y = 0;
SDL_Surface *screen;
SDL_Overlay *xvoverlay;
screen = SDL_SetVideoMode(640,480,24,SDL_HWSURFACE|SDL_NOFRAME)));
xvoverlay = SDL_CreateYUVOverlay(640, 480, SDL_YV12_OVERLAY, screen);
while{1}
SDL_LockYUVOverlay(xvoverlay);
SDL_UnlockYUVOverlay(xvoverlay);
SDL_DisplayYUVOverlay(xvoverlay,&hvor);
SDL_Delay(50); // Delay, so you will get ~ 20 fps
}
But the last one with a xvoverlay, is quite more cpu hungry? It eats approx 30 % cpu. Am I doing something wrong? In the xvoverlay code I doesn't even copy any YUV data into the overlay.
Or is it just faster using a sdl surface, and blit it to the screen?