Improve Blargg filters with cutoff on right side of screen (fixes #195).

This commit is contained in:
Stephen Anthony 2017-08-15 17:49:59 -02:30
parent 24e55baa2c
commit 6f60437a9c
3 changed files with 60 additions and 9 deletions

View File

@ -21,11 +21,13 @@
* Added preliminary support for multi-threading in the Blargg TV effects * Added preliminary support for multi-threading in the Blargg TV effects
code. This is still a WIP; more improvements are coming. Related to code. This is still a WIP; more improvements are coming. Related to
this, further optimized the TIA rendering code. Thanks to Thomas this, further optimized the TIA rendering code. Also added 'threads'
Jentzsch for the bulk of the work in this area. commandline argument and associated UI item to enable/disable
multi-threading. Thanks to Thomas Jentzsch for the bulk of the work
in this area.
* Added 'threads' commandline argument and associated UI item to * Blargg TV effects now no longer cut off the right side of the image
enable/disable multi-threading. (by several pixels) in certain cases.
* Updated CDF scheme to latest version from Spiceware. In addition, * Updated CDF scheme to latest version from Spiceware. In addition,
this scheme now supports versioning, so older and newer ROMs will this scheme now supports versioning, so older and newer ROMs will

View File

@ -151,7 +151,7 @@ void AtariNTSC::renderThread(const uInt8* atari_in, const uInt32 in_width,
} }
// finish final pixels // finish final pixels
ATARI_NTSC_COLOR_IN(0, NTSC_black); ATARI_NTSC_COLOR_IN(0, line_in[0]);
ATARI_NTSC_RGB_OUT_8888(0, line_out[0]); ATARI_NTSC_RGB_OUT_8888(0, line_out[0]);
ATARI_NTSC_RGB_OUT_8888(1, line_out[1]); ATARI_NTSC_RGB_OUT_8888(1, line_out[1]);
ATARI_NTSC_RGB_OUT_8888(2, line_out[2]); ATARI_NTSC_RGB_OUT_8888(2, line_out[2]);
@ -162,6 +162,22 @@ void AtariNTSC::renderThread(const uInt8* atari_in, const uInt32 in_width,
ATARI_NTSC_RGB_OUT_8888(5, line_out[5]); ATARI_NTSC_RGB_OUT_8888(5, line_out[5]);
ATARI_NTSC_RGB_OUT_8888(6, line_out[6]); ATARI_NTSC_RGB_OUT_8888(6, line_out[6]);
line_in += 2;
line_out += 7;
ATARI_NTSC_COLOR_IN(0, NTSC_black);
ATARI_NTSC_RGB_OUT_8888(0, line_out[0]);
ATARI_NTSC_RGB_OUT_8888(1, line_out[1]);
ATARI_NTSC_RGB_OUT_8888(2, line_out[2]);
ATARI_NTSC_RGB_OUT_8888(3, line_out[3]);
ATARI_NTSC_COLOR_IN(1, NTSC_black);
ATARI_NTSC_RGB_OUT_8888(4, line_out[4]);
#if 0
ATARI_NTSC_RGB_OUT_8888(5, line_out[5]);
ATARI_NTSC_RGB_OUT_8888(6, line_out[6]);
#endif
atari_in += in_width; atari_in += in_width;
rgb_out = static_cast<char*>(rgb_out) + out_pitch; rgb_out = static_cast<char*>(rgb_out) + out_pitch;
} }
@ -208,7 +224,7 @@ void AtariNTSC::renderWithPhosphorThread(const uInt8* atari_in, const uInt32 in_
} }
// finish final pixels // finish final pixels
ATARI_NTSC_COLOR_IN(0, NTSC_black); ATARI_NTSC_COLOR_IN(0, line_in[0]);
ATARI_NTSC_RGB_OUT_8888(0, line_out[0]); ATARI_NTSC_RGB_OUT_8888(0, line_out[0]);
ATARI_NTSC_RGB_OUT_8888(1, line_out[1]); ATARI_NTSC_RGB_OUT_8888(1, line_out[1]);
ATARI_NTSC_RGB_OUT_8888(2, line_out[2]); ATARI_NTSC_RGB_OUT_8888(2, line_out[2]);
@ -219,8 +235,24 @@ void AtariNTSC::renderWithPhosphorThread(const uInt8* atari_in, const uInt32 in_
ATARI_NTSC_RGB_OUT_8888(5, line_out[5]); ATARI_NTSC_RGB_OUT_8888(5, line_out[5]);
ATARI_NTSC_RGB_OUT_8888(6, line_out[6]); ATARI_NTSC_RGB_OUT_8888(6, line_out[6]);
line_in += 2;
line_out += 7;
ATARI_NTSC_COLOR_IN(0, NTSC_black);
ATARI_NTSC_RGB_OUT_8888(0, line_out[0]);
ATARI_NTSC_RGB_OUT_8888(1, line_out[1]);
ATARI_NTSC_RGB_OUT_8888(2, line_out[2]);
ATARI_NTSC_RGB_OUT_8888(3, line_out[3]);
ATARI_NTSC_COLOR_IN(1, NTSC_black);
ATARI_NTSC_RGB_OUT_8888(4, line_out[4]);
#if 0
ATARI_NTSC_RGB_OUT_8888(5, line_out[5]);
ATARI_NTSC_RGB_OUT_8888(6, line_out[6]);
#endif
// Do phosphor mode (blend the resulting frames) // Do phosphor mode (blend the resulting frames)
// Note: The codes assumes that AtariNTSC::outWidth(kTIAW) == outPitch == 560 // Note: The code assumes that AtariNTSC::outWidth(kTIAW) == outPitch == 565
for (uInt32 x = AtariNTSC::outWidth(in_width) / 8; x; --x) for (uInt32 x = AtariNTSC::outWidth(in_width) / 8; x; --x)
{ {
// Store back into displayed frame buffer (for next frame) // Store back into displayed frame buffer (for next frame)
@ -241,6 +273,23 @@ void AtariNTSC::renderWithPhosphorThread(const uInt8* atari_in, const uInt32 in_
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]); rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++; bufofs++;
} }
// finish final pixels
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++;
#if 0
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++;
#endif
atari_in += in_width; atari_in += in_width;
rgb_out = static_cast<char*>(rgb_out) + out_pitch; rgb_out = static_cast<char*>(rgb_out) + out_pitch;

View File

@ -102,14 +102,14 @@ class AtariNTSC
// Might be rounded down slightly; use outWidth() on result to find // Might be rounded down slightly; use outWidth() on result to find
// rounded value. // rounded value.
static constexpr uInt32 inWidth( uInt32 out_width ) { static constexpr uInt32 inWidth( uInt32 out_width ) {
return (((out_width) / PIXEL_out_chunk - 1) * PIXEL_in_chunk + 1); return (((out_width-5) / PIXEL_out_chunk - 1) * PIXEL_in_chunk + 1);
} }
// Number of output pixels written by blitter for given input width. // Number of output pixels written by blitter for given input width.
// Width might be rounded down slightly; use inWidth() on result to // Width might be rounded down slightly; use inWidth() on result to
// find rounded value. Guaranteed not to round 160 down at all. // find rounded value. Guaranteed not to round 160 down at all.
static constexpr uInt32 outWidth(uInt32 in_width) { static constexpr uInt32 outWidth(uInt32 in_width) {
return ((((in_width) - 1) / PIXEL_in_chunk + 1)* PIXEL_out_chunk); return ((((in_width) - 1) / PIXEL_in_chunk + 1)* PIXEL_out_chunk) + 5;
} }
private: private: