Full support of PAL color blend.
This commit is contained in:
parent
4b9988cec1
commit
1e3781bac1
@ -559,7 +559,7 @@ mc6847_base_device::mc6847_base_device(const machine_config &mconfig, device_typ
|
||||
m_bw_palette[i] = black_and_white(s_palette[i]);
|
||||
}
|
||||
|
||||
m_artifacter.create_luma_table( s_palette );
|
||||
m_artifacter.create_color_blend_table( s_palette );
|
||||
}
|
||||
|
||||
|
||||
@ -905,14 +905,14 @@ uint32_t mc6847_base_device::screen_update(screen_device &screen, bitmap_rgb32 &
|
||||
*bitmap_addr(bitmap, y + base_y, x) = border_value(m_data[y].m_mode[width - 1], palette, is_mc6847t1);
|
||||
|
||||
/* artifacting */
|
||||
if( m_artifacter.get_pal_artifacting() )
|
||||
{
|
||||
if( y % 2)
|
||||
m_artifacter.process_artifacts_pal<1>(bitmap, y - 1, base_x, base_y, m_data[y].m_mode[0], palette);
|
||||
}
|
||||
else
|
||||
m_artifacter.process_artifacts<1>(bitmap_addr(bitmap, y + base_y, base_x), m_data[y].m_mode[0], palette);
|
||||
|
||||
if( m_artifacter.get_pal_artifacting() )
|
||||
{
|
||||
if( y % 2)
|
||||
m_artifacter.process_artifacts_pal<1>(bitmap, y - 1, base_x, base_y, m_data[y].m_mode[0], palette);
|
||||
}
|
||||
else
|
||||
m_artifacter.process_artifacts<1>(bitmap_addr(bitmap, y + base_y, base_x), m_data[y].m_mode[0], palette);
|
||||
|
||||
}
|
||||
|
||||
width = m_data[191].m_sample_count;
|
||||
@ -1802,20 +1802,28 @@ mc6847_base_device::pixel_t mc6847_base_device::artifacter::mix_color(double fac
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// artifacter::create_luma_table
|
||||
// artifacter::create_color_blend_table
|
||||
//-------------------------------------------------
|
||||
|
||||
void mc6847_base_device::artifacter::create_luma_table( const pixel_t *palette )
|
||||
void mc6847_base_device::artifacter::create_color_blend_table( const pixel_t *palette )
|
||||
{
|
||||
// Luminance map for PAL color blend. Colors with same luminance value are blendable on a PAL display.
|
||||
m_luminance_map.insert(std::pair<uint32_t,uint8_t>(palette[0],2)); /* GREEN */
|
||||
m_luminance_map.insert(std::pair<uint32_t,uint8_t>(palette[1],1)); /* YELLOW */
|
||||
m_luminance_map.insert(std::pair<uint32_t,uint8_t>(palette[2],3)); /* BLUE */
|
||||
m_luminance_map.insert(std::pair<uint32_t,uint8_t>(palette[3],3)); /* RED */
|
||||
m_luminance_map.insert(std::pair<uint32_t,uint8_t>(palette[4],1)); /* BUFF */
|
||||
m_luminance_map.insert(std::pair<uint32_t,uint8_t>(palette[5],2)); /* CYAN */
|
||||
m_luminance_map.insert(std::pair<uint32_t,uint8_t>(palette[6],2)); /* MAGENTA */
|
||||
m_luminance_map.insert(std::pair<uint32_t,uint8_t>(palette[7],2)); /* ORANGE */
|
||||
// PAL color blend map
|
||||
m_palcolorblendmap.insert(std::pair<std::pair<pixel_t,pixel_t>,pixel_t>(std::pair<pixel_t,pixel_t>(palette[3],palette[2]),rgb_t(0x7c, 0x2e, 0x81))); /* RED-BLUE */
|
||||
m_palcolorblendmap.insert(std::pair<std::pair<pixel_t,pixel_t>,pixel_t>(std::pair<pixel_t,pixel_t>(palette[2],palette[3]),rgb_t(0x6b, 0x3e, 0x6b))); /* BLUE-RED */
|
||||
m_palcolorblendmap.insert(std::pair<std::pair<pixel_t,pixel_t>,pixel_t>(std::pair<pixel_t,pixel_t>(palette[7],palette[6]),rgb_t(0xbe, 0x73, 0x65))); /* ORANGE-MAGENTA */
|
||||
m_palcolorblendmap.insert(std::pair<std::pair<pixel_t,pixel_t>,pixel_t>(std::pair<pixel_t,pixel_t>(palette[6],palette[7]),rgb_t(0xde, 0x5f, 0x6a))); /* MAGENTA-ORANGE */
|
||||
m_palcolorblendmap.insert(std::pair<std::pair<pixel_t,pixel_t>,pixel_t>(std::pair<pixel_t,pixel_t>(palette[7],palette[5]),rgb_t(0x7e, 0xa2, 0x00))); /* ORANGE-CYAN */
|
||||
m_palcolorblendmap.insert(std::pair<std::pair<pixel_t,pixel_t>,pixel_t>(std::pair<pixel_t,pixel_t>(palette[5],palette[7]),rgb_t(0x99, 0x8d, 0x3c))); /* CYAN-ORANGE */
|
||||
m_palcolorblendmap.insert(std::pair<std::pair<pixel_t,pixel_t>,pixel_t>(std::pair<pixel_t,pixel_t>(palette[5],palette[6]),rgb_t(0x82, 0x80, 0xc5))); /* CYAN-MAGENTA */
|
||||
m_palcolorblendmap.insert(std::pair<std::pair<pixel_t,pixel_t>,pixel_t>(std::pair<pixel_t,pixel_t>(palette[6],palette[5]),rgb_t(0x89, 0x80, 0x9f))); /* MAGENTA-CYAN */
|
||||
m_palcolorblendmap.insert(std::pair<std::pair<pixel_t,pixel_t>,pixel_t>(std::pair<pixel_t,pixel_t>(palette[0],palette[5]),rgb_t(0x44, 0xb7, 0x1b))); /* GREEN-CYAN */
|
||||
m_palcolorblendmap.insert(std::pair<std::pair<pixel_t,pixel_t>,pixel_t>(std::pair<pixel_t,pixel_t>(palette[5],palette[0]),rgb_t(0x4a, 0xf2, 0x70))); /* CYAN-GREEN */
|
||||
m_palcolorblendmap.insert(std::pair<std::pair<pixel_t,pixel_t>,pixel_t>(std::pair<pixel_t,pixel_t>(palette[1],palette[4]),rgb_t(0xdc, 0xd2, 0x57))); /* YELLOW-BUFF */
|
||||
m_palcolorblendmap.insert(std::pair<std::pair<pixel_t,pixel_t>,pixel_t>(std::pair<pixel_t,pixel_t>(palette[4],palette[1]),rgb_t(0xd1, 0xf6, 0x95))); /* BUFF-YELLOW */
|
||||
m_palcolorblendmap.insert(std::pair<std::pair<pixel_t,pixel_t>,pixel_t>(std::pair<pixel_t,pixel_t>(palette[0],palette[6]),rgb_t(0xa6, 0x86, 0x10))); /* GREEN-MAGENTA */
|
||||
m_palcolorblendmap.insert(std::pair<std::pair<pixel_t,pixel_t>,pixel_t>(std::pair<pixel_t,pixel_t>(palette[6],palette[0]),rgb_t(0x6b, 0xbe, 0xb3))); /* MAGENTA-GREEN */
|
||||
m_palcolorblendmap.insert(std::pair<std::pair<pixel_t,pixel_t>,pixel_t>(std::pair<pixel_t,pixel_t>(palette[0],palette[7]),rgb_t(0x91, 0xc5, 0x3b))); /* GREEN-ORANGE */
|
||||
m_palcolorblendmap.insert(std::pair<std::pair<pixel_t,pixel_t>,pixel_t>(std::pair<pixel_t,pixel_t>(palette[7],palette[0]),rgb_t(0xad, 0xbc, 0x22))); /* ORANGE-GREEN */
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
@ -1851,7 +1859,7 @@ mc6847_ntsc_device::mc6847_ntsc_device(const machine_config &mconfig, const char
|
||||
mc6847_pal_device::mc6847_pal_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: mc6847_base_device(mconfig, MC6847_PAL, tag, owner, clock, pal_square_fontdata8x12, 313.0)
|
||||
{
|
||||
m_artifacter.set_pal_artifacting(true);
|
||||
m_artifacter.set_pal_artifacting(true);
|
||||
}
|
||||
|
||||
|
||||
@ -1874,7 +1882,7 @@ mc6847y_ntsc_device::mc6847y_ntsc_device(const machine_config &mconfig, const ch
|
||||
mc6847y_pal_device::mc6847y_pal_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: mc6847_base_device(mconfig, MC6847Y_PAL, tag, owner, clock, pal_square_fontdata8x12, 313.0)
|
||||
{
|
||||
m_artifacter.set_pal_artifacting(true);
|
||||
m_artifacter.set_pal_artifacting(true);
|
||||
}
|
||||
|
||||
|
||||
@ -1897,7 +1905,7 @@ mc6847t1_ntsc_device::mc6847t1_ntsc_device(const machine_config &mconfig, const
|
||||
mc6847t1_pal_device::mc6847t1_pal_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: mc6847_base_device(mconfig, MC6847T1_PAL, tag, owner, clock, pal_round_fontdata8x12, 313.0)
|
||||
{
|
||||
m_artifacter.set_pal_artifacting(true);
|
||||
m_artifacter.set_pal_artifacting(true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -179,52 +179,37 @@ protected:
|
||||
// artifacting config
|
||||
void setup_config(device_t *device);
|
||||
void poll_config() { m_artifacting = (m_config!=nullptr) ? m_config->read() : 0; }
|
||||
void set_pal_artifacting( bool palartifacting ) { m_palartifacting = palartifacting; }
|
||||
bool get_pal_artifacting() { return m_palartifacting; }
|
||||
void create_luma_table( const pixel_t *palette );
|
||||
void set_pal_artifacting( bool palartifacting ) { m_palartifacting = palartifacting; }
|
||||
bool get_pal_artifacting() { return m_palartifacting; }
|
||||
void create_color_blend_table( const pixel_t *palette );
|
||||
|
||||
// artifacting application
|
||||
template<int xscale>
|
||||
void process_artifacts_pal(bitmap_rgb32 &bitmap, int y, int base_x, int base_y, uint8_t mode, const pixel_t *palette)
|
||||
{
|
||||
if( !m_artifacting || !m_palartifacting )
|
||||
return;
|
||||
if( !m_artifacting || !m_palartifacting )
|
||||
return;
|
||||
|
||||
// TODO: Create a map of pairs of colors to resulting colors, and convert spaces to tabs.
|
||||
//if( (mode & (MODE_AS|MODE_GM0)) == MODE_AS )
|
||||
{
|
||||
uint32_t tmpPixel;
|
||||
pixel_t *line1 = &bitmap.pix32(y + base_y, base_x);
|
||||
pixel_t *line2 = &bitmap.pix32(y + base_y + 1, base_x);
|
||||
std::map<uint32_t,uint8_t>::const_iterator luma1;
|
||||
std::map<uint32_t,uint8_t>::const_iterator luma2;
|
||||
if( (mode & MODE_AS) || ((mode & (MODE_AG|MODE_GM0) ) == MODE_AG) )
|
||||
{
|
||||
pixel_t *line1 = &bitmap.pix32(y + base_y, base_x);
|
||||
pixel_t *line2 = &bitmap.pix32(y + base_y + 1, base_x);
|
||||
std::map<std::pair<pixel_t,pixel_t>,pixel_t>::const_iterator newColor;
|
||||
|
||||
for( int pixel = 0; pixel < bitmap.width() - (base_x * 2); ++pixel )
|
||||
{
|
||||
if( line1[pixel] == line2[pixel] )
|
||||
continue;
|
||||
for( int pixel = 0; pixel < bitmap.width() - (base_x * 2); ++pixel )
|
||||
{
|
||||
if( line1[pixel] == line2[pixel] )
|
||||
continue;
|
||||
|
||||
luma1 = m_luminance_map.find( line1[pixel] );
|
||||
luma2 = m_luminance_map.find( line2[pixel] );
|
||||
|
||||
if( luma1 != m_luminance_map.end() && luma2 != m_luminance_map.end() && (luma1->second == luma2->second))
|
||||
{
|
||||
/*tmpPixel = (((line1[pixel] & 0xFF000000) >> 25) + ((line2[pixel] & 0xFF000000) >> 24)) << 24;
|
||||
tmpPixel |= (((line1[pixel] & 0x00FF0000) >> 17) + ((line2[pixel] & 0x00FF0000) >> 16)) << 16;
|
||||
tmpPixel |= (((line1[pixel] & 0x0000FF00) >> 9) + ((line2[pixel] & 0x0000FF00) >> 8)) << 8;
|
||||
tmpPixel |= (((line1[pixel] & 0x000000FF) >> 1) + ((line2[pixel] & 0x000000FF) >> 0)); */
|
||||
|
||||
//tmpPixel = (( ((uint32_t)(line1[pixel] & 0xFF000000) >> 24) + ((uint32_t)(line2[pixel] & 0xFF000000) >> 24) / 2) << 24);
|
||||
tmpPixel = (( ((uint32_t)(line1[pixel] & 0xFF0000 ) >> 16) + ((uint32_t)(line2[pixel] & 0xFF0000 ) >> 16) / 2) << 16);
|
||||
tmpPixel |= (( ((uint32_t)(line1[pixel] & 0xFF00 ) >> 8 ) + ((uint32_t)(line2[pixel] & 0xFF00 ) >> 8 ) / 2) << 8 );
|
||||
tmpPixel |= ( ((uint32_t) line1[pixel] & 0xFF ) + (uint32_t)(line2[pixel] & 0xFF ) ) / 2;
|
||||
|
||||
line1[pixel] = tmpPixel;
|
||||
line2[pixel] = tmpPixel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
newColor = m_palcolorblendmap.find(std::pair<pixel_t,pixel_t>(line1[pixel],line2[pixel]));
|
||||
if( newColor != m_palcolorblendmap.end() )
|
||||
{
|
||||
line1[pixel] = newColor->second;
|
||||
line2[pixel] = newColor->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<int xscale>
|
||||
ATTR_FORCE_INLINE void process_artifacts(pixel_t *pixels, uint8_t mode, const pixel_t *palette)
|
||||
@ -271,7 +256,7 @@ protected:
|
||||
pixel_t m_expanded_colors[128];
|
||||
|
||||
// PAL color blend emulation values.
|
||||
std::map<uint32_t, unsigned char> m_luminance_map;
|
||||
std::map<std::pair<pixel_t,pixel_t>,pixel_t> m_palcolorblendmap;
|
||||
|
||||
void update_colors(pixel_t c0, pixel_t c1);
|
||||
static pixel_t mix_color(double factor, uint8_t c0, uint8_t c1);
|
||||
|
Loading…
Reference in New Issue
Block a user