From cca17c642fc708567d87fb8c6bc3191dded7d9fc Mon Sep 17 00:00:00 2001 From: ekeeke31 Date: Wed, 1 Feb 2012 22:55:42 +0000 Subject: [PATCH] fixed pixels input & output for NTSC filters --- source/ntsc/md_ntsc.h | 4 ++-- source/ntsc/md_ntsc_config.h | 12 ++++++++---- source/ntsc/sms_ntsc.h | 4 ++-- source/ntsc/sms_ntsc_config.h | 8 +++++--- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/source/ntsc/md_ntsc.h b/source/ntsc/md_ntsc.h index e987d58..648fe74 100644 --- a/source/ntsc/md_ntsc.h +++ b/source/ntsc/md_ntsc.h @@ -137,11 +137,11 @@ struct md_ntsc_t { } /* x is always zero except in snes_ntsc library */ -#ifdef USE_15BPP_RENDERING +#if MD_NTSC_OUT_DEPTH == 15 #define MD_NTSC_RGB_OUT_( rgb_out, x ) {\ rgb_out = (raw_>>(14-x)& 0x7C00)|(raw_>>(9-x)&0x03E0)|(raw_>>(4-x)&0x001F);\ } -#else +#elif MD_NTSC_OUT_DEPTH == 16 #define MD_NTSC_RGB_OUT_( rgb_out, x ) {\ rgb_out = (raw_>>(13-x)& 0xF800)|(raw_>>(8-x)&0x07E0)|(raw_>>(4-x)&0x001F);\ } diff --git a/source/ntsc/md_ntsc_config.h b/source/ntsc/md_ntsc_config.h index 0cd00f5..8864dde 100644 --- a/source/ntsc/md_ntsc_config.h +++ b/source/ntsc/md_ntsc_config.h @@ -3,18 +3,22 @@ #ifndef MD_NTSC_CONFIG_H #define MD_NTSC_CONFIG_H -/* Format of source pixels */ +/* Format of source & output pixels (RGB555 or RGB565 only)*/ #ifdef USE_15BPP_RENDERING #define MD_NTSC_IN_FORMAT MD_NTSC_RGB15 +#define MD_NTSC_OUT_DEPTH 15 #else #define MD_NTSC_IN_FORMAT MD_NTSC_RGB16 +#define MD_NTSC_OUT_DEPTH 16 #endif -#define MD_NTSC_IN_FORMAT MD_NTSC_RGB16 -/* Original CRAM format */ +/* Original CRAM format (not used) */ /* #define MD_NTSC_IN_FORMAT MD_NTSC_BGR9 */ -/* Type of input pixel values */ +/* The following affect the built-in blitter only; a custom blitter can +handle things however it wants. */ + +/* Type of input pixel values (fixed to 16-bit) */ #define MD_NTSC_IN_T unsigned short /* Each raw pixel input value is passed through this. You might want to mask diff --git a/source/ntsc/sms_ntsc.h b/source/ntsc/sms_ntsc.h index 9471d94..eba6228 100644 --- a/source/ntsc/sms_ntsc.h +++ b/source/ntsc/sms_ntsc.h @@ -137,11 +137,11 @@ struct sms_ntsc_t { } /* x is always zero except in snes_ntsc library */ -#ifdef USE_15BPP_RENDERING +#if SMS_NTSC_OUT_DEPTH == 15 #define SMS_NTSC_RGB_OUT_( rgb_out, x ) {\ rgb_out = (raw_>>(14-x)& 0x7C00)|(raw_>>(9-x)&0x03E0)|(raw_>>(4-x)&0x001F);\ } -#else +#elif SMS_NTSC_OUT_DEPTH == 16 #define SMS_NTSC_RGB_OUT_( rgb_out, x) {\ rgb_out = (raw_>>(13-x)& 0xF800)|(raw_>>(8-x)&0x07E0)|(raw_>>(4-x)&0x001F);\ } diff --git a/source/ntsc/sms_ntsc_config.h b/source/ntsc/sms_ntsc_config.h index 7022448..6b9e0bf 100644 --- a/source/ntsc/sms_ntsc_config.h +++ b/source/ntsc/sms_ntsc_config.h @@ -3,20 +3,22 @@ #ifndef SMS_NTSC_CONFIG_H #define SMS_NTSC_CONFIG_H -/* Format of source pixels */ +/* Format of source & output pixels (RGB555 or RGB565 only) */ #ifdef USE_15BPP_RENDERING #define SMS_NTSC_IN_FORMAT SMS_NTSC_RGB15 +#define SMS_NTSC_OUT_DEPTH 15 #else #define SMS_NTSC_IN_FORMAT SMS_NTSC_RGB16 +#define SMS_NTSC_OUT_DEPTH 16 #endif -/* Original CRAM format */ +/* Original CRAM format (not used) */ /* #define SMS_NTSC_IN_FORMAT SMS_NTSC_BGR12 */ /* The following affect the built-in blitter only; a custom blitter can handle things however it wants. */ -/* Type of input pixel values */ +/* Type of input pixel values (fixed to 16-bit)*/ #define SMS_NTSC_IN_T unsigned short /* Each raw pixel input value is passed through this. You might want to mask