mirror of https://github.com/stella-emu/stella.git
Add RGBA_8888 mode to TV effects.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2483 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
3ae0359c73
commit
2724beeaa9
|
@ -42,13 +42,12 @@ FBSurfaceGL::FBSurfaceGL(FrameBufferGL& buffer, uInt32 width, uInt32 height)
|
|||
myTexCoordW = (GLfloat) myImageW / myTexWidth;
|
||||
myTexCoordH = (GLfloat) myImageH / myTexHeight;
|
||||
|
||||
// Based on experimentation, the following are the fastest 16-bit
|
||||
// formats for OpenGL (on all platforms)
|
||||
myTexture = SDL_CreateRGBSurface(SDL_SWSURFACE, myTexWidth, myTexHeight, 16,
|
||||
myFB.myPixelFormat.Rmask, myFB.myPixelFormat.Gmask,
|
||||
myFB.myPixelFormat.Bmask, 0x00000000);
|
||||
// Create a surface in the same format as the parent GL class
|
||||
const SDL_PixelFormat& pf = myFB.myPixelFormat;
|
||||
myTexture = SDL_CreateRGBSurface(SDL_SWSURFACE, myTexWidth, myTexHeight,
|
||||
pf.BitsPerPixel, pf.Rmask, pf.Gmask, pf.Bmask, pf.Amask);
|
||||
|
||||
myPitch = myTexture->pitch >> 1;
|
||||
myPitch = myTexture->pitch / pf.BytesPerPixel;
|
||||
|
||||
// Associate the SDL surface with a GL texture object
|
||||
updateCoords();
|
||||
|
|
|
@ -45,13 +45,12 @@ FBSurfaceTIA::FBSurfaceTIA(FrameBufferGL& buffer)
|
|||
myTexWidth = FrameBufferGL::power_of_two(ATARI_NTSC_OUT_WIDTH(160));
|
||||
myTexHeight = FrameBufferGL::power_of_two(320);
|
||||
|
||||
// Based on experimentation, the following are the fastest 16-bit
|
||||
// formats for OpenGL (on all platforms)
|
||||
myTexture = SDL_CreateRGBSurface(SDL_SWSURFACE, myTexWidth, myTexHeight, 16,
|
||||
myFB.myPixelFormat.Rmask, myFB.myPixelFormat.Gmask,
|
||||
myFB.myPixelFormat.Bmask, 0x00000000);
|
||||
// Create a surface in the same format as the parent GL class
|
||||
const SDL_PixelFormat& pf = myFB.myPixelFormat;
|
||||
myTexture = SDL_CreateRGBSurface(SDL_SWSURFACE, myTexWidth, myTexHeight,
|
||||
pf.BitsPerPixel, pf.Rmask, pf.Gmask, pf.Bmask, pf.Amask);
|
||||
|
||||
myPitch = myTexture->pitch >> 1;
|
||||
myPitch = myTexture->pitch / pf.BytesPerPixel;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -104,13 +104,6 @@ class NTSCFilter
|
|||
// output buffer
|
||||
// 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_width,
|
||||
src_width, src_height,
|
||||
dest_buf, dest_pitch);
|
||||
}
|
||||
void blit_1555(uInt8* src_buf, int src_width, int src_height,
|
||||
uInt16* dest_buf, long dest_pitch)
|
||||
{
|
||||
|
@ -118,6 +111,13 @@ class NTSCFilter
|
|||
src_width, src_height,
|
||||
dest_buf, dest_pitch);
|
||||
}
|
||||
void blit_8888(uInt8* src_buf, int src_width, int src_height,
|
||||
uInt32* dest_buf, long dest_pitch)
|
||||
{
|
||||
atari_ntsc_blit_8888(&myFilter, src_buf, src_width,
|
||||
src_width, src_height,
|
||||
dest_buf, dest_pitch);
|
||||
}
|
||||
|
||||
private:
|
||||
// Convert from atari_ntsc_setup_t values to equivalent adjustables
|
||||
|
|
|
@ -99,58 +99,11 @@ void atari_ntsc_init( atari_ntsc_t* ntsc, atari_ntsc_setup_t const* setup,
|
|||
}
|
||||
}
|
||||
|
||||
void atari_ntsc_blit_5551( atari_ntsc_t const* ntsc, atari_ntsc_in_t const* atari_in,
|
||||
long in_row_width, int in_width, int in_height,
|
||||
void* rgb_out, long out_pitch )
|
||||
{
|
||||
int const chunk_count = (in_width - 1) / atari_ntsc_in_chunk;
|
||||
while ( in_height-- )
|
||||
{
|
||||
atari_ntsc_in_t const* line_in = atari_in;
|
||||
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;
|
||||
|
||||
for ( n = chunk_count; n; --n )
|
||||
{
|
||||
/* order of input and output pixels must not be altered */
|
||||
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, 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;
|
||||
}
|
||||
|
||||
/* 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_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_in += in_row_width;
|
||||
rgb_out = (char*) rgb_out + out_pitch;
|
||||
}
|
||||
}
|
||||
|
||||
void atari_ntsc_blit_1555( atari_ntsc_t const* ntsc, atari_ntsc_in_t const* atari_in,
|
||||
long in_row_width, int in_width, int in_height,
|
||||
void* rgb_out, long out_pitch )
|
||||
{
|
||||
typedef unsigned short atari_ntsc_out_t;
|
||||
int const chunk_count = (in_width - 1) / atari_ntsc_in_chunk;
|
||||
while ( in_height-- )
|
||||
{
|
||||
|
@ -194,3 +147,52 @@ void atari_ntsc_blit_1555( atari_ntsc_t const* ntsc, atari_ntsc_in_t const* atar
|
|||
rgb_out = (char*) rgb_out + out_pitch;
|
||||
}
|
||||
}
|
||||
|
||||
void atari_ntsc_blit_8888( atari_ntsc_t const* ntsc, atari_ntsc_in_t const* atari_in,
|
||||
long in_row_width, int in_width, int in_height,
|
||||
void* rgb_out, long out_pitch )
|
||||
{
|
||||
typedef unsigned int atari_ntsc_out_t;
|
||||
int const chunk_count = (in_width - 1) / atari_ntsc_in_chunk;
|
||||
while ( in_height-- )
|
||||
{
|
||||
atari_ntsc_in_t const* line_in = atari_in;
|
||||
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;
|
||||
|
||||
for ( n = chunk_count; n; --n )
|
||||
{
|
||||
/* order of input and output pixels must not be altered */
|
||||
ATARI_NTSC_COLOR_IN( 0, ntsc, line_in[0] );
|
||||
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, line_in[1] );
|
||||
ATARI_NTSC_RGB_OUT_8888( 4, line_out[4] );
|
||||
ATARI_NTSC_RGB_OUT_8888( 5, line_out[5] );
|
||||
ATARI_NTSC_RGB_OUT_8888( 6, line_out[6] );
|
||||
|
||||
line_in += 2;
|
||||
line_out += 7;
|
||||
}
|
||||
|
||||
/* finish final pixels */
|
||||
ATARI_NTSC_COLOR_IN( 0, ntsc, atari_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, atari_ntsc_black );
|
||||
ATARI_NTSC_RGB_OUT_8888( 4, line_out[4] );
|
||||
ATARI_NTSC_RGB_OUT_8888( 5, line_out[5] );
|
||||
ATARI_NTSC_RGB_OUT_8888( 6, line_out[6] );
|
||||
|
||||
atari_in += in_row_width;
|
||||
rgb_out = (char*) rgb_out + out_pitch;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,9 +22,7 @@
|
|||
#ifndef ATARI_NTSC_H
|
||||
#define ATARI_NTSC_H
|
||||
|
||||
/* Type of input and output pixel values. */
|
||||
typedef unsigned char atari_ntsc_in_t;
|
||||
typedef unsigned short atari_ntsc_out_t;
|
||||
typedef unsigned char atari_ntsc_in_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -67,10 +65,10 @@ void atari_ntsc_init( atari_ntsc_t* ntsc, atari_ntsc_setup_t const* setup,
|
|||
/* Filters one or more rows of pixels. Input pixels are 8-bit Atari palette colors.
|
||||
In_row_width is the number of pixels to get to the next input row. Out_pitch
|
||||
is the number of *bytes* to get to the next output row. */
|
||||
void atari_ntsc_blit_5551( atari_ntsc_t const* ntsc, atari_ntsc_in_t const* atari_in,
|
||||
void atari_ntsc_blit_1555( atari_ntsc_t const* ntsc, atari_ntsc_in_t const* atari_in,
|
||||
long in_row_width, int in_width, int in_height,
|
||||
void* rgb_out, long out_pitch );
|
||||
void atari_ntsc_blit_1555( atari_ntsc_t const* ntsc, atari_ntsc_in_t const* atari_in,
|
||||
void atari_ntsc_blit_8888( atari_ntsc_t const* ntsc, atari_ntsc_in_t const* atari_in,
|
||||
long in_row_width, int in_width, int in_height,
|
||||
void* rgb_out, long out_pitch );
|
||||
|
||||
|
@ -104,17 +102,10 @@ enum { atari_ntsc_black = 0 }; /* palette index for black */
|
|||
ATARI_NTSC_COLOR_IN_( in_index, color_in, ATARI_NTSC_ENTRY_, ntsc )
|
||||
|
||||
/* Generates output in the specified 16-bit format (x = junk bits).
|
||||
5551: RRRRRGGG GGBBBBBx (5-5-5-1 16-bit RGB)
|
||||
1555: xRRRRRGG GGGBBBBB (1-5-5-5 16-bit RGB)
|
||||
8888: RRRRRRRR GGGGGGGG BBBBBBBB (8-8-8-8 32-bit RGB)
|
||||
native: xxxRRRRR RRRxxGGG GGGGGxxB BBBBBBBx (native internal format)
|
||||
*/
|
||||
#define ATARI_NTSC_RGB_OUT_5551( index, rgb_out ) {\
|
||||
atari_ntsc_rgb_t raw_ =\
|
||||
kernel0 [index ] + kernel1 [(index+10)%7+14] +\
|
||||
kernelx0 [(index+7)%14] + kernelx1 [(index+ 3)%7+14+7];\
|
||||
ATARI_NTSC_CLAMP_( raw_, 0 );\
|
||||
rgb_out = (raw_>>(13)& 0xF800)|(raw_>>(8)&0x07C0)|(raw_>>(3)&0x003E);\
|
||||
}
|
||||
#define ATARI_NTSC_RGB_OUT_1555( index, rgb_out ) {\
|
||||
atari_ntsc_rgb_t raw_ =\
|
||||
kernel0 [index ] + kernel1 [(index+10)%7+14] +\
|
||||
|
@ -122,6 +113,13 @@ enum { atari_ntsc_black = 0 }; /* palette index for black */
|
|||
ATARI_NTSC_CLAMP_( raw_, 0 );\
|
||||
rgb_out = (raw_>>(14)& 0x7C00)|(raw_>>(9)&0x03E0)|(raw_>>(4)&0x001F);\
|
||||
}
|
||||
#define ATARI_NTSC_RGB_OUT_8888( index, rgb_out ) {\
|
||||
atari_ntsc_rgb_t raw_ =\
|
||||
kernel0 [index ] + kernel1 [(index+10)%7+14] +\
|
||||
kernelx0 [(index+7)%14] + kernelx1 [(index+ 3)%7+14+7];\
|
||||
ATARI_NTSC_CLAMP_( raw_, 0 );\
|
||||
rgb_out = (raw_>>(5)& 0x00FF0000)|(raw_>>(3)&0x0000FF00)|(raw_>>(1)&0x000000FF);\
|
||||
}
|
||||
|
||||
/* private */
|
||||
enum { atari_ntsc_entry_size = 2 * 14 };
|
||||
|
|
Loading…
Reference in New Issue