The TIA palette is now passed to NTSCFilter, so it can calculate its own

YIQ-format palette.

Removed compile-time option for DISPLAY_TV.  NTSC filtering will always
be compiled into the app, but will only actually be used in OpenGL mode.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2396 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2012-02-26 20:11:59 +00:00
parent 5d4c09da54
commit 216f0ab19e
9 changed files with 30 additions and 50 deletions

View File

@ -95,7 +95,8 @@ MODULES := $(MODULES)
MODULES += \
src/emucore \
src/gui \
src/common
src/common \
src/common/tv_filters
######################################################################
# The build rules follow - normally you should have no need to

19
configure vendored
View File

@ -20,7 +20,6 @@ _zlib=auto
# default option behaviour yes/no
_build_gl=yes
_build_tv=yes
_build_windowed=yes
_build_sound=yes
_build_debugger=yes
@ -245,8 +244,6 @@ for ac_option in $@; do
case "$ac_option" in
--enable-gl) _build_gl=yes ;;
--disable-gl) _build_gl=no ;;
--enable-tv) _build_tv=yes ;;
--disable-tv) _build_tv=no ;;
--enable-windowed) _build_windowed=yes ;;
--disable-windowed) _build_windowed=no ;;
--enable-sound) _build_sound=yes ;;
@ -658,14 +655,6 @@ else
echo
fi
if test "$_build_tv" = "yes" ; then
echo_n " TV filtering enabled"
echo
else
echo_n " TV filtering disabled"
echo
fi
if test "$_build_windowed" = "yes" ; then
echo_n " Windowed rendering modes enabled"
echo
@ -757,7 +746,7 @@ CHEAT="$SRC/cheat"
LIBPNG="$SRC/libpng"
ZLIB="$SRC/zlib"
INCLUDES="-I$CORE -I$COMMON -I$GUI"
INCLUDES="-I$CORE -I$COMMON -I$TV -I$GUI"
INCLUDES="$INCLUDES `$_sdlconfig --cflags`"
if test "$_build_static" = yes ; then
@ -829,12 +818,6 @@ if test "$_build_gl" = yes ; then
DEFINES="$DEFINES -DDISPLAY_OPENGL"
fi
if test "$_build_tv" = yes ; then
DEFINES="$DEFINES -DDISPLAY_TV"
MODULES="$MODULES $TV"
INCLUDES="$INCLUDES -I$TV"
fi
if test "$_build_windowed" = yes ; then
DEFINES="$DEFINES -DWINDOWED_SUPPORT"
fi

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#ifdef DISPLAY_TV
#include "NTSCFilter.hxx"
#include <cstring>
@ -37,10 +35,25 @@ NTSCFilter::~NTSCFilter()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void NTSCFilter::setTIAPalette(const uInt32* palette)
{
// The TIA palette consists of 128 colours, but the palette array actually
// contains 256 entries, where only every second value is a valid colour
uInt8* ptr = myTIAPalette;
for(int i = 0; i < 256; i+=2)
{
*ptr++ = (palette[i] >> 16) & 0xff;
*ptr++ = (palette[i] >> 8) & 0xff;
*ptr++ = palette[i] & 0xff;
}
updateFilter();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void NTSCFilter::updateFilter()
{
double yiq_table[768];
double yiq_table[384];
updateYIQTable(yiq_table, mySetup.burst_phase * M_PI);
@ -231,16 +244,16 @@ int NTSCFilter::FILTER_NTSC_Initialise(int *argc, char *argv[])
#endif
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void NTSCFilter::updateYIQTable(double yiq_table[768], double start_angle)
void NTSCFilter::updateYIQTable(double yiq_table[384], double start_angle)
{
const double start_saturation = 0.0; // calculated internally
const double gamma = 1; // 1 - COLOURS_NTSC_setup.gamma / 2.0;
unsigned char *ext_ptr = NULL; //FIXME COLOURS_NTSC_external.palette;
uInt8* ext_ptr = myTIAPalette;
int n;
start_angle = - ((213.0f) * M_PI / 180.0f) - start_angle;
for (n = 0; n < 256; n ++) {
for (n = 0; n < 128; n ++) {
/* Convert RGB values from external palette to YIQ. */
double r = (double)*ext_ptr++ / 255.0;
double g = (double)*ext_ptr++ / 255.0;
@ -288,5 +301,3 @@ static char const * const preset_cfg_strings[NTSCFilter::PRESET_SIZE] = {
"RGB",
"MONOCHROME"
};
#endif // DISPLAY_TV

View File

@ -20,8 +20,6 @@
#ifndef NTSC_FILTER_HXX
#define NTSC_FILTER_HXX
#ifdef DISPLAY_TV
#include "bspf.hxx"
#include "Array.hxx"
#include "atari_ntsc.h"
@ -67,6 +65,11 @@ class NTSCFilter
};
public:
/* Informs the NTSC filter about the current TIA palette. The filter
uses this as a baseline for calculating its own internal palette
in YIQ format.
*/
void setTIAPalette(const uInt32* palette);
/* Restores default values for NTSC-filter-specific colour controls.
updateFilter should be called afterwards to apply changes. */
@ -95,7 +98,7 @@ class NTSCFilter
are provided as parameters, because NTSC_FILTER needs to set these values
according to its internal setup (burst_phase etc).
*/
static void updateYIQTable(double yiq_table[768], double start_angle);
void updateYIQTable(double yiq_table[768], double start_angle);
private:
// Pointer to the NTSC filter structure
@ -104,6 +107,8 @@ class NTSCFilter
// Contains controls used to adjust the palette in the NTSC filter
atari_ntsc_setup_t mySetup;
uInt8 myTIAPalette[384]; // 128 colours by 3 components per colour
int myCurrentModeNum;
Common::Array<atari_ntsc_setup_t> myModeList;
@ -111,6 +116,4 @@ class NTSCFilter
static char const * const preset_cfg_strings[PRESET_SIZE];
};
#endif // DISPLAY_TV
#endif

View File

@ -19,8 +19,6 @@
/* Based on nes_ntsc 0.2.2. http://www.slack.net/~ant/ */
#ifdef DISPLAY_TV
#include "atari_ntsc.h"
/* Copyright (C) 2006-2007 Shay Green. This module is free software; you
@ -393,5 +391,3 @@ void atari_ntsc_blit_bgra32( atari_ntsc_t const* ntsc, ATARI_NTSC_IN_T const* in
}
#endif
#endif // DISPLAY_TV

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#ifdef DISPLAY_TV
/* Atari TIA, CTIA, GTIA and MARIA NTSC video filter */
/* based on nes_ntsc 0.2.2 */
@ -264,5 +262,3 @@ enum {
#endif
#endif
#endif // DISPLAY_TV

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#ifdef DISPLAY_TV
/* Based on nes_ntsc 0.2.2. http://www.slack.net/~ant/ */
/* Common implementation of NTSC filters */
@ -474,5 +472,3 @@ static void correct_errors( atari_ntsc_rgb_t color, atari_ntsc_rgb_t* out );
#endif
#endif
#endif // DISPLAY_TV

View File

@ -1897,7 +1897,6 @@
HAVE_INTTYPES,
HAVE_GETTIMEOFDAY,
DISPLAY_OPENGL,
DISPLAY_TV,
CHEATCODE_SUPPORT,
DEBUGGER_SUPPORT,
JOYSTICK_SUPPORT,
@ -1960,7 +1959,6 @@
HAVE_INTTYPES,
HAVE_GETTIMEOFDAY,
DISPLAY_OPENGL,
DISPLAY_TV,
CHEATCODE_SUPPORT,
DEBUGGER_SUPPORT,
JOYSTICK_SUPPORT,
@ -2022,7 +2020,6 @@
HAVE_INTTYPES,
HAVE_GETTIMEOFDAY,
DISPLAY_OPENGL,
DISPLAY_TV,
CHEATCODE_SUPPORT,
DEBUGGER_SUPPORT,
JOYSTICK_SUPPORT,

View File

@ -1881,7 +1881,6 @@
HAVE_INTTYPES,
HAVE_GETTIMEOFDAY,
DISPLAY_OPENGL,
DISPLAY_TV,
CHEATCODE_SUPPORT,
DEBUGGER_SUPPORT,
JOYSTICK_SUPPORT,
@ -1937,7 +1936,6 @@
HAVE_INTTYPES,
HAVE_GETTIMEOFDAY,
DISPLAY_OPENGL,
DISPLAY_TV,
CHEATCODE_SUPPORT,
DEBUGGER_SUPPORT,
JOYSTICK_SUPPORT,
@ -1992,7 +1990,6 @@
HAVE_INTTYPES,
HAVE_GETTIMEOFDAY,
DISPLAY_OPENGL,
DISPLAY_TV,
CHEATCODE_SUPPORT,
DEBUGGER_SUPPORT,
JOYSTICK_SUPPORT,