diff --git a/src/common/FBSurfaceTIA.cxx b/src/common/FBSurfaceTIA.cxx index 97e156900..204e46509 100644 --- a/src/common/FBSurfaceTIA.cxx +++ b/src/common/FBSurfaceTIA.cxx @@ -133,13 +133,11 @@ void FBSurfaceTIA::update() case FrameBufferGL::kBlarggNTSC: { #ifdef HAVE_GL_BGRA - #define BLIT16 blit_1555 + myFB.myNTSCFilter.blit_1555 #else - #define BLIT16 blit_5551 + myFB.myNTSCFilter.blit_5551 #endif - myFB.myNTSCFilter.BLIT16(currentFrame, width, - myTexture->w, height, - buffer, myTexture->pitch); + (currentFrame, width, height, buffer, myTexture->pitch); break; } } diff --git a/src/common/FrameBufferGL.cxx b/src/common/FrameBufferGL.cxx index 81eabc1b0..d77ec308c 100644 --- a/src/common/FrameBufferGL.cxx +++ b/src/common/FrameBufferGL.cxx @@ -369,11 +369,13 @@ void FrameBufferGL::postFrameUpdate() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void FrameBufferGL::enablePhosphor(bool enable, int blend) { - myUsePhosphor = enable; - myPhosphorBlend = blend; - myFilterType = enable ? kPhosphor : kNone; - - myRedrawEntireFrame = true; + if(myTiaSurface) + { + myUsePhosphor = enable; + myPhosphorBlend = blend; + myFilterType = enable ? kPhosphor : kNone; + myRedrawEntireFrame = true; + } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/common/tv_filters/NTSCFilter.hxx b/src/common/tv_filters/NTSCFilter.hxx index dbaf7c9ab..c7553bd10 100644 --- a/src/common/tv_filters/NTSCFilter.hxx +++ b/src/common/tv_filters/NTSCFilter.hxx @@ -83,19 +83,19 @@ class NTSCFilter // Perform Blargg filtering on input buffer, place results in // output buffer - void blit_5551(uInt8* src_buf, long src_row_width, - int src_width, int src_height, + // In the current implementation, the source pitch is always the + // same as the actual width + void blit_5551(uInt8* src_buf, int src_width, int src_height, uInt16* dest_buf, long dest_pitch) { - atari_ntsc_blit_5551(&myFilter, src_buf, src_row_width, + atari_ntsc_blit_5551(&myFilter, src_buf, src_width, src_width, src_height, dest_buf, dest_pitch); } - void blit_1555(uInt8* src_buf, long src_row_width, - int src_width, int src_height, + void blit_1555(uInt8* src_buf, int src_width, int src_height, uInt16* dest_buf, long dest_pitch) { - atari_ntsc_blit_1555(&myFilter, src_buf, src_row_width, + atari_ntsc_blit_1555(&myFilter, src_buf, src_width, src_width, src_height, dest_buf, dest_pitch); } diff --git a/src/common/tv_filters/atari_ntsc.c b/src/common/tv_filters/atari_ntsc.c index 24ef22db8..70a81ef07 100644 --- a/src/common/tv_filters/atari_ntsc.c +++ b/src/common/tv_filters/atari_ntsc.c @@ -92,7 +92,7 @@ void atari_ntsc_init( atari_ntsc_t* ntsc, atari_ntsc_setup_t const* setup ) float b = impl.to_float [*palette++]; float y, i, q = RGB_TO_YIQ( r, g, b, y, i ); - + // Generate kernel int ir, ig, ib = YIQ_TO_RGB( y, i, q, impl.to_rgb, int, ir, ig ); atari_ntsc_rgb_t rgb = PACK_RGB( ir, ig, ib ); //(ib < 0x3E0 ? ib: 0x3E0) @@ -114,7 +114,7 @@ void atari_ntsc_blit_5551( atari_ntsc_t const* ntsc, atari_ntsc_in_t const* atar while ( in_height-- ) { atari_ntsc_in_t const* line_in = atari_in; - ATARI_NTSC_BEGIN_ROW( ntsc, atari_ntsc_black, ATARI_NTSC_ADJ_IN( line_in[0] ) ); + ATARI_NTSC_BEGIN_ROW( ntsc, atari_ntsc_black, line_in[0] ); atari_ntsc_out_t* restrict line_out = (atari_ntsc_out_t*) rgb_out; int n; ++line_in; @@ -122,16 +122,16 @@ void atari_ntsc_blit_5551( atari_ntsc_t const* ntsc, atari_ntsc_in_t const* atar for ( n = chunk_count; n; --n ) { /* order of input and output pixels must not be altered */ - ATARI_NTSC_COLOR_IN( 0, ntsc, ATARI_NTSC_ADJ_IN( line_in[0] ) ); - ATARI_NTSC_RGB_OUT_5551( 0, line_out [0] ); - ATARI_NTSC_RGB_OUT_5551( 1, line_out [1] ); - ATARI_NTSC_RGB_OUT_5551( 2, line_out [2] ); - ATARI_NTSC_RGB_OUT_5551( 3, line_out [3] ); + ATARI_NTSC_COLOR_IN( 0, ntsc, line_in[0] ); + ATARI_NTSC_RGB_OUT_5551( 0, line_out[0] ); + ATARI_NTSC_RGB_OUT_5551( 1, line_out[1] ); + ATARI_NTSC_RGB_OUT_5551( 2, line_out[2] ); + ATARI_NTSC_RGB_OUT_5551( 3, line_out[3] ); - ATARI_NTSC_COLOR_IN( 1, ntsc, ATARI_NTSC_ADJ_IN( line_in[1] ) ); - ATARI_NTSC_RGB_OUT_5551( 4, line_out [4] ); - ATARI_NTSC_RGB_OUT_5551( 5, line_out [5] ); - ATARI_NTSC_RGB_OUT_5551( 6, line_out [6] ); + ATARI_NTSC_COLOR_IN( 1, ntsc, line_in[1] ); + ATARI_NTSC_RGB_OUT_5551( 4, line_out[4] ); + ATARI_NTSC_RGB_OUT_5551( 5, line_out[5] ); + ATARI_NTSC_RGB_OUT_5551( 6, line_out[6] ); line_in += 2; line_out += 7; @@ -139,15 +139,15 @@ void atari_ntsc_blit_5551( atari_ntsc_t const* ntsc, atari_ntsc_in_t const* atar /* finish final pixels */ ATARI_NTSC_COLOR_IN( 0, ntsc, atari_ntsc_black ); - ATARI_NTSC_RGB_OUT_5551( 0, line_out [0] ); - ATARI_NTSC_RGB_OUT_5551( 1, line_out [1] ); - ATARI_NTSC_RGB_OUT_5551( 2, line_out [2] ); - ATARI_NTSC_RGB_OUT_5551( 3, line_out [3] ); + ATARI_NTSC_RGB_OUT_5551( 0, line_out[0] ); + ATARI_NTSC_RGB_OUT_5551( 1, line_out[1] ); + ATARI_NTSC_RGB_OUT_5551( 2, line_out[2] ); + ATARI_NTSC_RGB_OUT_5551( 3, line_out[3] ); ATARI_NTSC_COLOR_IN( 1, ntsc, atari_ntsc_black ); - ATARI_NTSC_RGB_OUT_5551( 4, line_out [4] ); - ATARI_NTSC_RGB_OUT_5551( 5, line_out [5] ); - ATARI_NTSC_RGB_OUT_5551( 6, line_out [6] ); + ATARI_NTSC_RGB_OUT_5551( 4, line_out[4] ); + ATARI_NTSC_RGB_OUT_5551( 5, line_out[5] ); + ATARI_NTSC_RGB_OUT_5551( 6, line_out[6] ); atari_in += in_row_width; rgb_out = (char*) rgb_out + out_pitch; @@ -162,7 +162,7 @@ void atari_ntsc_blit_1555( atari_ntsc_t const* ntsc, atari_ntsc_in_t const* atar while ( in_height-- ) { atari_ntsc_in_t const* line_in = atari_in; - ATARI_NTSC_BEGIN_ROW( ntsc, atari_ntsc_black, ATARI_NTSC_ADJ_IN( line_in[0] ) ); + ATARI_NTSC_BEGIN_ROW( ntsc, atari_ntsc_black, line_in[0] ); atari_ntsc_out_t* restrict line_out = (atari_ntsc_out_t*) rgb_out; int n; ++line_in; @@ -170,16 +170,16 @@ void atari_ntsc_blit_1555( atari_ntsc_t const* ntsc, atari_ntsc_in_t const* atar for ( n = chunk_count; n; --n ) { /* order of input and output pixels must not be altered */ - ATARI_NTSC_COLOR_IN( 0, ntsc, ATARI_NTSC_ADJ_IN( line_in[0] ) ); - ATARI_NTSC_RGB_OUT_1555( 0, line_out [0] ); - ATARI_NTSC_RGB_OUT_1555( 1, line_out [1] ); - ATARI_NTSC_RGB_OUT_1555( 2, line_out [2] ); - ATARI_NTSC_RGB_OUT_1555( 3, line_out [3] ); + ATARI_NTSC_COLOR_IN( 0, ntsc, line_in[0] ); + ATARI_NTSC_RGB_OUT_1555( 0, line_out[0] ); + ATARI_NTSC_RGB_OUT_1555( 1, line_out[1] ); + ATARI_NTSC_RGB_OUT_1555( 2, line_out[2] ); + ATARI_NTSC_RGB_OUT_1555( 3, line_out[3] ); - ATARI_NTSC_COLOR_IN( 1, ntsc, ATARI_NTSC_ADJ_IN( line_in[1] ) ); - ATARI_NTSC_RGB_OUT_1555( 4, line_out [4] ); - ATARI_NTSC_RGB_OUT_1555( 5, line_out [5] ); - ATARI_NTSC_RGB_OUT_1555( 6, line_out [6] ); + ATARI_NTSC_COLOR_IN( 1, ntsc, line_in[1] ); + ATARI_NTSC_RGB_OUT_1555( 4, line_out[4] ); + ATARI_NTSC_RGB_OUT_1555( 5, line_out[5] ); + ATARI_NTSC_RGB_OUT_1555( 6, line_out[6] ); line_in += 2; line_out += 7; @@ -187,15 +187,15 @@ void atari_ntsc_blit_1555( atari_ntsc_t const* ntsc, atari_ntsc_in_t const* atar /* finish final pixels */ ATARI_NTSC_COLOR_IN( 0, ntsc, atari_ntsc_black ); - ATARI_NTSC_RGB_OUT_1555( 0, line_out [0] ); - ATARI_NTSC_RGB_OUT_1555( 1, line_out [1] ); - ATARI_NTSC_RGB_OUT_1555( 2, line_out [2] ); - ATARI_NTSC_RGB_OUT_1555( 3, line_out [3] ); + ATARI_NTSC_RGB_OUT_1555( 0, line_out[0] ); + ATARI_NTSC_RGB_OUT_1555( 1, line_out[1] ); + ATARI_NTSC_RGB_OUT_1555( 2, line_out[2] ); + ATARI_NTSC_RGB_OUT_1555( 3, line_out[3] ); ATARI_NTSC_COLOR_IN( 1, ntsc, atari_ntsc_black ); - ATARI_NTSC_RGB_OUT_1555( 4, line_out [4] ); - ATARI_NTSC_RGB_OUT_1555( 5, line_out [5] ); - ATARI_NTSC_RGB_OUT_1555( 6, line_out [6] ); + ATARI_NTSC_RGB_OUT_1555( 4, line_out[4] ); + ATARI_NTSC_RGB_OUT_1555( 5, line_out[5] ); + ATARI_NTSC_RGB_OUT_1555( 6, line_out[6] ); atari_in += in_row_width; rgb_out = (char*) rgb_out + out_pitch; diff --git a/src/common/tv_filters/atari_ntsc.h b/src/common/tv_filters/atari_ntsc.h index 11aa15cbd..a3e919863 100644 --- a/src/common/tv_filters/atari_ntsc.h +++ b/src/common/tv_filters/atari_ntsc.h @@ -30,10 +30,6 @@ typedef unsigned short atari_ntsc_out_t; extern "C" { #endif -/* Each raw pixel input value is passed through this. You might want to mask - the pixel index if you use the high bits as flags, etc. */ -#define ATARI_NTSC_ADJ_IN( in ) in - /* Image parameters, ranging from -1.0 to 1.0. Actual internal values shown in parenthesis and should remain fairly stable in future versions. */ typedef struct atari_ntsc_setup_t