VOGONS


First post, by jaclfh

User metadata
Rank Newbie
Rank
Newbie

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?

Reply 1 of 7, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

src\gui\sdlmain.cpp:

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.

Reply 2 of 7, by Harekiet

User metadata
Rank DOSBox Author
Rank
DOSBox Author

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

Reply 3 of 7, by jaclfh

User metadata
Rank Newbie
Rank
Newbie

Here's the patch for YUY2 output:

--- 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:

Reply 4 of 7, by D--

User metadata
Rank Newbie
Rank
Newbie

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%).

Reply 6 of 7, by D--

User metadata
Rank Newbie
Rank
Newbie

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.

Reply 7 of 7, by Harekiet

User metadata
Rank DOSBox Author
Rank
DOSBox Author

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.