RetroArch
Classes | Macros | Typedefs | Enumerations | Functions | Variables
snes_ntsc.h File Reference
#include "snes_ntsc_config.h"
Include dependency graph for snes_ntsc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  snes_ntsc_setup_t
 
struct  snes_ntsc_t
 

Macros

#define SNES_NTSC_OUT_WIDTH(in_width)   ((((in_width) - 1) / snes_ntsc_in_chunk + 1) * snes_ntsc_out_chunk)
 
#define SNES_NTSC_IN_WIDTH(out_width)   (((out_width) / snes_ntsc_out_chunk - 1) * snes_ntsc_in_chunk + 1)
 
#define SNES_NTSC_BEGIN_ROW(ntsc, burst, pixel0, pixel1, pixel2)
 
#define SNES_NTSC_COLOR_IN(index, color)   SNES_NTSC_COLOR_IN_( index, color, SNES_NTSC_IN_FORMAT, ktable )
 
#define SNES_NTSC_RGB_OUT(index, rgb_out, bits)   SNES_NTSC_RGB_OUT_14_( index, rgb_out, bits, 1 )
 
#define SNES_NTSC_HIRES_ROW(ntsc, burst, pixel1, pixel2, pixel3, pixel4, pixel5)
 
#define SNES_NTSC_HIRES_OUT(x, rgb_out, bits)
 
#define SNES_NTSC_RGB16(ktable, n)
 
#define SNES_NTSC_BGR15(ktable, n)
 
#define SNES_NTSC_BEGIN_ROW_6_(pixel0, pixel1, pixel2, ENTRY, table)
 
#define SNES_NTSC_RGB_OUT_14_(x, rgb_out, bits, shift)
 
#define snes_ntsc_rgb_builder   ((1L << 21) | (1 << 11) | (1 << 1))
 
#define snes_ntsc_clamp_mask   (snes_ntsc_rgb_builder * 3 / 2)
 
#define snes_ntsc_clamp_add   (snes_ntsc_rgb_builder * 0x101)
 
#define SNES_NTSC_CLAMP_(io, shift)
 
#define SNES_NTSC_COLOR_IN_(index, color, ENTRY, table)
 
#define SNES_NTSC_RGB_OUT_(rgb_out, bits, x)
 

Typedefs

typedef struct snes_ntsc_setup_t snes_ntsc_setup_t
 
typedef struct snes_ntsc_t snes_ntsc_t
 
typedef unsigned long snes_ntsc_rgb_t
 

Enumerations

enum  { snes_ntsc_in_chunk = 3 }
 
enum  { snes_ntsc_out_chunk = 7 }
 
enum  { snes_ntsc_black = 0 }
 
enum  { snes_ntsc_burst_count = 3 }
 
enum  { snes_ntsc_entry_size = 128 }
 
enum  { snes_ntsc_palette_size = 0x2000 }
 
enum  { snes_ntsc_burst_size = snes_ntsc_entry_size / snes_ntsc_burst_count }
 

Functions

void snes_ntsc_init (snes_ntsc_t *ntsc, snes_ntsc_setup_t const *setup)
 
void snes_ntsc_blit (snes_ntsc_t const *ntsc, SNES_NTSC_IN_T const *input, long in_row_width, int burst_phase, int in_width, int in_height, void *rgb_out, long out_pitch, int first, int last)
 
void snes_ntsc_blit_hires (snes_ntsc_t const *ntsc, SNES_NTSC_IN_T const *input, long in_row_width, int burst_phase, int in_width, int in_height, void *rgb_out, long out_pitch, int first, int last)
 

Variables

snes_ntsc_setup_t const snes_ntsc_composite
 
snes_ntsc_setup_t const snes_ntsc_svideo
 
snes_ntsc_setup_t const snes_ntsc_rgb
 
snes_ntsc_setup_t const snes_ntsc_monochrome
 

Macro Definition Documentation

◆ SNES_NTSC_BEGIN_ROW

#define SNES_NTSC_BEGIN_ROW (   ntsc,
  burst,
  pixel0,
  pixel1,
  pixel2 
)
Value:
char const* ktable = \
(char const*) (ntsc)->table + burst * (snes_ntsc_burst_size * sizeof (snes_ntsc_rgb_t));\
SNES_NTSC_BEGIN_ROW_6_( pixel0, pixel1, pixel2, SNES_NTSC_IN_FORMAT, ktable )
unsigned long snes_ntsc_rgb_t
Definition: snes_ntsc.h:136
#define SNES_NTSC_IN_FORMAT
Definition: snes_ntsc_config.h:8
Definition: snes_ntsc.h:140

◆ SNES_NTSC_BEGIN_ROW_6_

#define SNES_NTSC_BEGIN_ROW_6_ (   pixel0,
  pixel1,
  pixel2,
  ENTRY,
  table 
)
Value:
unsigned const snes_ntsc_pixel0_ = (pixel0);\
snes_ntsc_rgb_t const* kernel0 = ENTRY( table, snes_ntsc_pixel0_ );\
unsigned const snes_ntsc_pixel1_ = (pixel1);\
snes_ntsc_rgb_t const* kernel1 = ENTRY( table, snes_ntsc_pixel1_ );\
unsigned const snes_ntsc_pixel2_ = (pixel2);\
snes_ntsc_rgb_t const* kernel2 = ENTRY( table, snes_ntsc_pixel2_ );\
snes_ntsc_rgb_t const* kernelx0;\
snes_ntsc_rgb_t const* kernelx1 = kernel0;\
snes_ntsc_rgb_t const* kernelx2 = kernel0
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:6296

◆ SNES_NTSC_BGR15

#define SNES_NTSC_BGR15 (   ktable,
  n 
)
Value:
(snes_ntsc_rgb_t const*) (ktable + ((n << 9 & 0x3C00) | (n & 0x03E0) | (n >> 10 & 0x001E)) * \
unsigned long snes_ntsc_rgb_t
Definition: snes_ntsc.h:136
Definition: snes_ntsc.h:134
GLdouble n
Definition: glext.h:8396

◆ SNES_NTSC_CLAMP_

#define SNES_NTSC_CLAMP_ (   io,
  shift 
)
Value:
{\
snes_ntsc_rgb_t sub = (io) >> (9-(shift)) & snes_ntsc_clamp_mask;\
snes_ntsc_rgb_t clamp = snes_ntsc_clamp_add - sub;\
io |= clamp;\
clamp -= sub;\
io &= clamp;\
}
#define snes_ntsc_clamp_add
Definition: snes_ntsc.h:173
GLenum clamp
Definition: glext.h:6856
#define snes_ntsc_clamp_mask
Definition: snes_ntsc.h:172

◆ snes_ntsc_clamp_add

#define snes_ntsc_clamp_add   (snes_ntsc_rgb_builder * 0x101)

◆ snes_ntsc_clamp_mask

#define snes_ntsc_clamp_mask   (snes_ntsc_rgb_builder * 3 / 2)

◆ SNES_NTSC_COLOR_IN

#define SNES_NTSC_COLOR_IN (   index,
  color 
)    SNES_NTSC_COLOR_IN_( index, color, SNES_NTSC_IN_FORMAT, ktable )

◆ SNES_NTSC_COLOR_IN_

#define SNES_NTSC_COLOR_IN_ (   index,
  color,
  ENTRY,
  table 
)
Value:
{\
unsigned color_;\
kernelx##index = kernel##index;\
kernel##index = (color_ = (color), ENTRY( table, color_ ));\
}
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:6296
GLuint index
Definition: glext.h:6671
GLuint color
Definition: glext.h:6883

◆ SNES_NTSC_HIRES_OUT

#define SNES_NTSC_HIRES_OUT (   x,
  rgb_out,
  bits 
)
Value:
{\
snes_ntsc_rgb_t raw_ =\
kernel0 [ x ] + kernel2 [(x+5)%7+14] + kernel4 [(x+3)%7+28] +\
kernelx0 [(x+7)%7+7] + kernelx2 [(x+5)%7+21] + kernelx4 [(x+3)%7+35] +\
kernel1 [(x+6)%7 ] + kernel3 [(x+4)%7+14] + kernel5 [(x+2)%7+28] +\
kernelx1 [(x+6)%7+7] + kernelx3 [(x+4)%7+21] + kernelx5 [(x+2)%7+35];\
SNES_NTSC_CLAMP_( raw_, 0 );\
SNES_NTSC_RGB_OUT_( rgb_out, (bits), 0 );\
}
GLint GLint GLint GLint GLint x
Definition: glext.h:6295
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:11836

◆ SNES_NTSC_HIRES_ROW

#define SNES_NTSC_HIRES_ROW (   ntsc,
  burst,
  pixel1,
  pixel2,
  pixel3,
  pixel4,
  pixel5 
)
Value:
char const* ktable = \
(char const*) (ntsc)->table + burst * (snes_ntsc_burst_size * sizeof (snes_ntsc_rgb_t));\
unsigned const snes_ntsc_pixel1_ = (pixel1);\
snes_ntsc_rgb_t const* kernel1 = SNES_NTSC_IN_FORMAT( ktable, snes_ntsc_pixel1_ );\
unsigned const snes_ntsc_pixel2_ = (pixel2);\
snes_ntsc_rgb_t const* kernel2 = SNES_NTSC_IN_FORMAT( ktable, snes_ntsc_pixel2_ );\
unsigned const snes_ntsc_pixel3_ = (pixel3);\
snes_ntsc_rgb_t const* kernel3 = SNES_NTSC_IN_FORMAT( ktable, snes_ntsc_pixel3_ );\
unsigned const snes_ntsc_pixel4_ = (pixel4);\
snes_ntsc_rgb_t const* kernel4 = SNES_NTSC_IN_FORMAT( ktable, snes_ntsc_pixel4_ );\
unsigned const snes_ntsc_pixel5_ = (pixel5);\
snes_ntsc_rgb_t const* kernel5 = SNES_NTSC_IN_FORMAT( ktable, snes_ntsc_pixel5_ );\
snes_ntsc_rgb_t const* kernel0 = kernel1;\
snes_ntsc_rgb_t const* kernelx0;\
snes_ntsc_rgb_t const* kernelx1 = kernel1;\
snes_ntsc_rgb_t const* kernelx2 = kernel1;\
snes_ntsc_rgb_t const* kernelx3 = kernel1;\
snes_ntsc_rgb_t const* kernelx4 = kernel1;\
snes_ntsc_rgb_t const* kernelx5 = kernel1
unsigned long snes_ntsc_rgb_t
Definition: snes_ntsc.h:136
#define SNES_NTSC_IN_FORMAT
Definition: snes_ntsc_config.h:8
Definition: snes_ntsc.h:140

◆ SNES_NTSC_IN_WIDTH

#define SNES_NTSC_IN_WIDTH (   out_width)    (((out_width) / snes_ntsc_out_chunk - 1) * snes_ntsc_in_chunk + 1)

◆ SNES_NTSC_OUT_WIDTH

#define SNES_NTSC_OUT_WIDTH (   in_width)    ((((in_width) - 1) / snes_ntsc_in_chunk + 1) * snes_ntsc_out_chunk)

◆ SNES_NTSC_RGB16

#define SNES_NTSC_RGB16 (   ktable,
  n 
)
Value:
(snes_ntsc_rgb_t const*) (ktable + ((n & 0x001E) | (n >> 1 & 0x03E0) | (n >> 2 & 0x3C00)) * \
unsigned long snes_ntsc_rgb_t
Definition: snes_ntsc.h:136
Definition: snes_ntsc.h:134
GLdouble n
Definition: glext.h:8396

◆ snes_ntsc_rgb_builder

#define snes_ntsc_rgb_builder   ((1L << 21) | (1 << 11) | (1 << 1))

◆ SNES_NTSC_RGB_OUT

#define SNES_NTSC_RGB_OUT (   index,
  rgb_out,
  bits 
)    SNES_NTSC_RGB_OUT_14_( index, rgb_out, bits, 1 )

◆ SNES_NTSC_RGB_OUT_

#define SNES_NTSC_RGB_OUT_ (   rgb_out,
  bits,
  x 
)
Value:
{\
if ( bits == 16 )\
rgb_out = (raw_>>(13-x)& 0xF800)|(raw_>>(8-x)&0x07E0)|(raw_>>(4-x)&0x001F);\
if ( bits == 24 || bits == 32 )\
rgb_out = (raw_>>(5-x)&0xFF0000)|(raw_>>(3-x)&0xFF00)|(raw_>>(1-x)&0xFF);\
if ( bits == 15 )\
rgb_out = (raw_>>(14-x)& 0x7C00)|(raw_>>(9-x)&0x03E0)|(raw_>>(4-x)&0x001F);\
if ( bits == 14 )\
rgb_out = (raw_>>(24-x)& 0x001F)|(raw_>>(9-x)&0x03E0)|(raw_<<(6+x)&0x7C00);\
if ( bits == 0 )\
rgb_out = raw_ << x;\
}
GLint GLint GLint GLint GLint x
Definition: glext.h:6295
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:11836

◆ SNES_NTSC_RGB_OUT_14_

#define SNES_NTSC_RGB_OUT_14_ (   x,
  rgb_out,
  bits,
  shift 
)
Value:
{\
snes_ntsc_rgb_t raw_ =\
kernel0 [x ] + kernel1 [(x+12)%7+14] + kernel2 [(x+10)%7+28] +\
kernelx0 [(x+7)%14] + kernelx1 [(x+ 5)%7+21] + kernelx2 [(x+ 3)%7+35];\
SNES_NTSC_CLAMP_( raw_, shift );\
SNES_NTSC_RGB_OUT_( rgb_out, bits, shift );\
}
GLint GLint GLint GLint GLint x
Definition: glext.h:6295
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:11836

Typedef Documentation

◆ snes_ntsc_rgb_t

typedef unsigned long snes_ntsc_rgb_t

◆ snes_ntsc_setup_t

◆ snes_ntsc_t

typedef struct snes_ntsc_t snes_ntsc_t

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
snes_ntsc_in_chunk 

◆ anonymous enum

anonymous enum
Enumerator
snes_ntsc_out_chunk 

◆ anonymous enum

anonymous enum
Enumerator
snes_ntsc_black 

◆ anonymous enum

anonymous enum
Enumerator
snes_ntsc_burst_count 

◆ anonymous enum

anonymous enum
Enumerator
snes_ntsc_entry_size 

◆ anonymous enum

anonymous enum
Enumerator
snes_ntsc_palette_size 

◆ anonymous enum

anonymous enum
Enumerator
snes_ntsc_burst_size 

Function Documentation

◆ snes_ntsc_blit()

void snes_ntsc_blit ( snes_ntsc_t const ntsc,
SNES_NTSC_IN_T const input,
long  in_row_width,
int  burst_phase,
int  in_width,
int  in_height,
void rgb_out,
long  out_pitch,
int  first,
int  last 
)
Here is the caller graph for this function:

◆ snes_ntsc_blit_hires()

void snes_ntsc_blit_hires ( snes_ntsc_t const ntsc,
SNES_NTSC_IN_T const input,
long  in_row_width,
int  burst_phase,
int  in_width,
int  in_height,
void rgb_out,
long  out_pitch,
int  first,
int  last 
)
Here is the caller graph for this function:

◆ snes_ntsc_init()

void snes_ntsc_init ( snes_ntsc_t ntsc,
snes_ntsc_setup_t const setup 
)
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ snes_ntsc_composite

snes_ntsc_setup_t const snes_ntsc_composite

◆ snes_ntsc_monochrome

snes_ntsc_setup_t const snes_ntsc_monochrome

◆ snes_ntsc_rgb

snes_ntsc_setup_t const snes_ntsc_rgb

◆ snes_ntsc_svideo

snes_ntsc_setup_t const snes_ntsc_svideo