Add overscan cropping.

This commit is contained in:
Themaister 2011-05-05 14:13:12 +02:00
parent bbf5a1ee72
commit b48322222a
5 changed files with 24 additions and 1 deletions

View file

@ -120,6 +120,9 @@ static const bool video_smooth = true;
// On resize and fullscreen, rendering area will stay 4:3
static const bool force_aspect = true;
// Crop overscanned frames (7/8 or 15/15 for interlaced frames).
static const bool crop_overscan = false;
// Font size for on-screen messages.
static const unsigned font_size = 48;

View file

@ -68,6 +68,7 @@ struct settings
bool vsync;
bool smooth;
bool force_aspect;
bool crop_overscan;
float aspect_ratio;
char cg_shader_path[256];
char bsnes_shader_path[256];

View file

@ -112,6 +112,7 @@ static void set_defaults(void)
g_settings.video.vsync = vsync;
g_settings.video.smooth = video_smooth;
g_settings.video.force_aspect = force_aspect;
g_settings.video.crop_overscan = crop_overscan;
g_settings.video.aspect_ratio = SNES_ASPECT_RATIO;
g_settings.video.shader_type = SSNES_SHADER_AUTO;
@ -290,6 +291,7 @@ static void parse_config_file(void)
CONFIG_GET_BOOL(video.vsync, "video_vsync");
CONFIG_GET_BOOL(video.smooth, "video_smooth");
CONFIG_GET_BOOL(video.force_aspect, "video_force_aspect");
CONFIG_GET_BOOL(video.crop_overscan, "video_crop_overscan");
CONFIG_GET_DOUBLE(video.aspect_ratio, "video_aspect_ratio");
CONFIG_GET_STRING(video.cg_shader_path, "video_cg_shader");

16
ssnes.c
View file

@ -82,9 +82,23 @@ static void set_fast_forward_button(bool new_button_state)
// Format received is 16-bit 0RRRRRGGGGGBBBBB
static void video_frame(const uint16_t *data, unsigned width, unsigned height)
{
if ( !g_extern.video_active )
if (!g_extern.video_active)
return;
if (g_settings.video.crop_overscan)
{
if (height == 239)
{
data += 7 * 1024; // Skip 7 top scanlines.
height = 224;
}
else if (height == 478)
{
data += 15 * 512; // Skip 15 top scanlines.
height = 448;
}
}
#ifdef HAVE_FFMPEG
if (g_extern.recording)
{

View file

@ -31,6 +31,9 @@
# A floating point value for video aspect ratio (width / height)
# video_aspect_ratio = 1.333
# Forces cropping of overscanned frames. Crops away top 7 scanlines and 8 bottom scanlines. (15/15 for interlaced frames).
# video_crop_overscan = false
# Path to Cg shader.
# video_cg_shader = "/path/to/cg/shader.cg"