![]() |
Last Visit : never :: 2010-8-01 @ 01:45 am : Now | |||
FAQ |
Search |
Memberlist |
Usergroups |
|
Register |
Profile |
Messages |
Log in |
|
| Forum Index :: DOSBox Development :: | |
Help to change UYVY overlay to YUY2
|
|
|---|---|
Help to change UYVY overlay to YUY2 :: 2008-12-16 @ 08:43 pm
|
|
|
jaclfh Newbie Joined: 2008-12-16 Posts: 4 |
I'd like to use output=overlay, but my video card can't do UYVY. Could someone point out the piece of dosbox code I need to change to make the output have YUY2 byte order? |
|
|
Re: Help to change UYVY overlay to YUY2 :: 2008-12-16 @ 09:12 pm
|
|
|
ripsaw8080 Oldbie Joined: 2006-04-25 Posts: 1293 |
src\gui\sdlmain.cpp:
Code: sdl.overlay=SDL_CreateYUVOverlay(width*2,height,SDL_UYVY_OVERLAY,sdl.surface);
Could start with changing that constant to SDL_YUY2_OVERLAY, but I don't know if that's all there is to it. You'll probably have change how the video data is written to the overlay as well. |
|
|
Re: Help to change UYVY overlay to YUY2 :: 2008-12-16 @ 09:38 pm
|
|
|
Harekiet DOSBox Creator Joined: 2002-07-01 Posts: 713 Location: Fryslan |
yeh i specifically chose for that one since you could contain a single pixel in a 32bit value, well your actually writing 2 pixels. But the final picture is compressed to half it's width on output, which also makes overlay look a bit sharper than opengl/ddraw stretching |
|
|
Re: Help to change UYVY overlay to YUY2 :: 2008-12-17 @ 04:36 am
|
|
|
jaclfh Newbie Joined: 2008-12-16 Posts: 4 |
Here's the patch for YUY2 output:
Code: --- dosbox-0.72/src/gui/sdlmain.cpp.orig 2007-08-26 21:03:25.000000000 +0300
+++ dosbox-0.72/src/gui/sdlmain.cpp 2008-12-17 06:30:59.000000000 +0200 @@ -528,7 +528,7 @@ dosurface: } if (!(flags&GFX_CAN_32) || (flags & GFX_RGBONLY)) goto dosurface; if (!GFX_SetupSurfaceScaled(0,0)) goto dosurface; - sdl.overlay=SDL_CreateYUVOverlay(width*2,height,SDL_UYVY_OVERLAY,sdl.surface); + sdl.overlay=SDL_CreateYUVOverlay(width*2,height,SDL_YUY2_OVERLAY,sdl.surface); if (!sdl.overlay) { LOG_MSG("SDL:Failed to create overlay, switching back to surface"); goto dosurface; @@ -850,9 +850,9 @@ Bitu GFX_GetRGB(Bit8u red,Bit8u green,Bi Bit8u u = (18492*((blue)-(y)) >> 15) + 128; Bit8u v = (23372*((red)-(y)) >> 15) + 128; #ifdef WORDS_BIGENDIAN - return (y << 0) | (v << 8) | (y << 16) | (u << 24); + return (v << 0) | (y << 8) | (u << 16) | (y << 24); #else - return (u << 0) | (y << 8) | (v << 16) | (y << 24); + return (y << 0) | (u << 8) | (y << 16) | (v << 24); #endif } case SCREEN_OPENGL: |
|
|
Re: Help to change UYVY overlay to YUY2 :: 2009-2-22 @ 09:35 am
|
|
|
D-- Newbie Joined: 2009-02-22 Posts: 2 |
Apologies if this is a necropost.
I'm currently trying to get Dosbox working on Loongson CPU-based laptops like the Yeeloong and the Gdium. The above patch was helpful in getting scaling working since the video card (SiliconMotion 712) has no OpenGL and no UYVY support. The above patch works fine for games when playing in a 640x400 window or larger, but there is a problem with the terminal. For some reason, Dosbox's overlay rendering seems to be rendering YUYV at a distorted horizontal width. With the inial console, for example, the vertical size will be correct, but the horizontal size is doubled and everything past 640 is sliced off. This mock-up shows what's happening (can't screenshot from Xv): click for ImageShack. It wouldn't be a problem except that the console mode can never be viewed completely, even at fullscreen, since the max resolution is 1024x600. I'd appreciate any suggestion. I already tried to change width*2 to width*1, but honestly the effect is the same. width*4 shows no change either (though width/2 cuts it to 25%). |
|
|
Re: Help to change UYVY overlay to YUY2 :: 2009-2-22 @ 04:45 pm
|
|
|
Harekiet DOSBox Creator Joined: 2002-07-01 Posts: 713 Location: Fryslan |
Dosbox renders at twice the width and then scales the final output to not have problems with the reduced color resolution of yuv |
|
|
Re: Help to change UYVY overlay to YUY2 :: 2009-2-22 @ 08:38 pm
|
|
|
D-- Newbie Joined: 2009-02-22 Posts: 2 |
Is it possible to disable this scaling? I'd have thought it was at width*2 but it seems I'm wrong. A pointer to in which function this happens would be really appreciated if you know offhand.
The hardware is not very powerful and the display resolution is limited. I'd sacrifice the clarity to fit everything on the screen and avoid an initial 2x1 software scale. |
|
|
Re: Help to change UYVY overlay to YUY2 :: 2009-2-22 @ 09:02 pm
|
|
|
Harekiet DOSBox Creator Joined: 2002-07-01 Posts: 713 Location: Fryslan |
dunno the rgb to yuv conversion would have to be done differently then since you'd have to take 2 rgb input pixels from dosbox to create 1 yuv output. The standard routines don't handle this since they just use a simple lookup table for 1 input pixel at a time. Maybe something with taking only the color values from the first pixel and the intensity from the seconds. Would look nasty but better than nothing i guess. |
|
|
|
page 1 of 1
|
|
| All times are GMT |
| Moderate |
|---|
| Quick Reply & Options | |
|---|---|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum |
|
2002-2003 zetafleet.dom.