fix #504 (please test with video effects and phosphor on and off)

This commit is contained in:
Thomas Jentzsch 2019-08-03 10:24:25 +02:00
parent 5dcc687f35
commit cac9c634e8
2 changed files with 9 additions and 8 deletions

View File

@ -129,7 +129,7 @@ void AtariNTSC::renderThread(const uInt8* atari_in, const uInt32 in_width,
{
const uInt8* line_in = atari_in;
ATARI_NTSC_BEGIN_ROW(NTSC_black, line_in[0]);
uInt32* restrict line_out = static_cast<uInt32*>(rgb_out);
uInt32* restrict line_out = static_cast<uInt32*>(rgb_out) + 2; // shift right by 2 pixel
++line_in;
for(uInt32 n = chunk_count; n; --n)
@ -202,7 +202,7 @@ void AtariNTSC::renderWithPhosphorThread(const uInt8* atari_in, const uInt32 in_
{
const uInt8* line_in = atari_in;
ATARI_NTSC_BEGIN_ROW(NTSC_black, line_in[0]);
uInt32* restrict line_out = static_cast<uInt32*>(rgb_out);
uInt32* restrict line_out = static_cast<uInt32*>(rgb_out) + 2; // shift right by 2 pixel
++line_in;
for(uInt32 n = chunk_count; n; --n)
@ -252,8 +252,9 @@ void AtariNTSC::renderWithPhosphorThread(const uInt8* atari_in, const uInt32 in_
#endif
// Do phosphor mode (blend the resulting frames)
// Note: The code assumes that AtariNTSC::outWidth(kTIAW) == outPitch == 565
for (uInt32 x = AtariNTSC::outWidth(in_width) / 8; x; --x)
// Note: The code assumed that AtariNTSC::outWidth(kTIAW) == outPitch == 565
// Now this got changed to 568 which affects unrolling (thus "- 8")
for (uInt32 x = AtariNTSC::outWidth(in_width - 8) / 8; x; --x)
{
// Store back into displayed frame buffer (for next frame)
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);

View File

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