RetroArch
Classes | Macros | Typedefs | Enumerations | Functions | Variables
snes_ntsc_impl.h File Reference
#include <retro_assert.h>
#include <math.h>
#include <limits.h>
Include dependency graph for snes_ntsc_impl.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  init_t
 
struct  pixel_info_t
 

Macros

#define DISABLE_CORRECTION   0
 
#define PI   3.14159265358979323846f
 
#define LUMA_CUTOFF   0.20
 
#define gamma_size   1
 
#define rgb_bits   8
 
#define artifacts_max   (artifacts_mid * 1.5f)
 
#define fringing_max   (fringing_mid * 2)
 
#define STD_HUE_CONDITION(setup)   1
 
#define ext_decoder_hue   (std_decoder_hue + 15)
 
#define rgb_unit   (1 << rgb_bits)
 
#define rgb_offset   (rgb_unit * 2 + 0.5f)
 
#define ROTATE_IQ(i, q, sin_b, cos_b)
 
#define RGB_TO_YIQ(r, g, b, y, i)
 
#define YIQ_TO_RGB(y, i, q, to_rgb, type, r, g)
 
#define PACK_RGB(r, g, b)   ((r) << 21 | (g) << 11 | (b) << 1)
 
#define PIXEL_OFFSET(ntsc, scaled)
 
#define CORRECT_ERROR(a)   { out [a] += error; }
 
#define DISTRIBUTE_ERROR(a, b, c)
 
#define RGB_PALETTE_OUT(rgb, out_)
 
#define restrict
 

Typedefs

typedef struct init_t init_t
 
typedef struct pixel_info_t pixel_info_t
 

Enumerations

enum  { burst_size = snes_ntsc_entry_size / burst_count }
 
enum  { kernel_half = 16 }
 
enum  { kernel_size = kernel_half * 2 + 1 }
 
enum  { rgb_kernel_size = burst_size / alignment_count }
 
enum  { rgb_bias = rgb_unit * 2 * snes_ntsc_rgb_builder }
 

Functions

static void init_filters (init_t *impl, snes_ntsc_setup_t const *setup)
 
static void init (init_t *impl, snes_ntsc_setup_t const *setup)
 
static void gen_kernel (init_t *impl, float y, float i, float q, snes_ntsc_rgb_t *out)
 
static void correct_errors (snes_ntsc_rgb_t color, snes_ntsc_rgb_t *out)
 

Variables

static float const default_decoder [6]
 
pixel_info_t const snes_ntsc_pixels [alignment_count]
 

Macro Definition Documentation

◆ artifacts_max

#define artifacts_max   (artifacts_mid * 1.5f)

◆ CORRECT_ERROR

#define CORRECT_ERROR (   a)    { out [a] += error; }

◆ DISABLE_CORRECTION

#define DISABLE_CORRECTION   0

◆ DISTRIBUTE_ERROR

#define DISTRIBUTE_ERROR (   a,
  b,
  c 
)
Value:
{\
snes_ntsc_rgb_t fourth = (error + 2 * snes_ntsc_rgb_builder) >> 2;\
fourth &= (rgb_bias >> 1) - snes_ntsc_rgb_builder;\
fourth -= rgb_bias >> 2;\
out [a] += fourth;\
out [b] += fourth;\
out [c] += fourth;\
out [i] += error - (fourth * 3);\
}
#define snes_ntsc_rgb_builder
Definition: snes_ntsc.h:171
const GLubyte * c
Definition: glext.h:9812
GLboolean GLboolean GLboolean b
Definition: glext.h:6844
static l_noret error(LoadState *S, const char *why)
Definition: lundump.c:39
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6844
Definition: snes_ntsc_impl.h:290

◆ ext_decoder_hue

#define ext_decoder_hue   (std_decoder_hue + 15)

◆ fringing_max

#define fringing_max   (fringing_mid * 2)

◆ gamma_size

#define gamma_size   1

◆ LUMA_CUTOFF

#define LUMA_CUTOFF   0.20

◆ PACK_RGB

#define PACK_RGB (   r,
  g,
  b 
)    ((r) << 21 | (g) << 11 | (b) << 1)

◆ PI

#define PI   3.14159265358979323846f

◆ PIXEL_OFFSET

#define PIXEL_OFFSET (   ntsc,
  scaled 
)
Value:
(kernel_size / 2 + (ntsc) - (scaled)),\
(1.0f - (((ntsc) + 100) & 2))
Definition: snes_ntsc_impl.h:51
GLfloat f
Definition: glext.h:8207

◆ restrict

#define restrict

◆ rgb_bits

#define rgb_bits   8

◆ rgb_offset

#define rgb_offset   (rgb_unit * 2 + 0.5f)

◆ RGB_PALETTE_OUT

#define RGB_PALETTE_OUT (   rgb,
  out_ 
)
Value:
{\
unsigned char* out = (out_);\
snes_ntsc_rgb_t clamped = (rgb);\
SNES_NTSC_CLAMP_( clamped, (8 - rgb_bits) );\
out [0] = (unsigned char) (clamped >> 21);\
out [1] = (unsigned char) (clamped >> 11);\
out [2] = (unsigned char) (clamped >> 1);\
}
struct passwd out
Definition: missing_libc_functions.c:51
#define rgb_bits
Definition: snes_ntsc_impl.h:33

◆ RGB_TO_YIQ

#define RGB_TO_YIQ (   r,
  g,
  b,
  y,
 
)
Value:
(\
(y = (r) * 0.299f + (g) * 0.587f + (b) * 0.114f),\
(i = (r) * 0.596f - (g) * 0.275f - (b) * 0.321f),\
((r) * 0.212f - (g) * 0.523f + (b) * 0.311f)\
)
GLdouble GLdouble GLdouble r
Definition: glext.h:6406
GLfloat f
Definition: glext.h:8207
GLboolean GLboolean GLboolean b
Definition: glext.h:6844
GLint GLint GLint GLint GLint GLint y
Definition: glext.h:6295
GLboolean GLboolean g
Definition: glext.h:6844

◆ rgb_unit

#define rgb_unit   (1 << rgb_bits)

◆ ROTATE_IQ

#define ROTATE_IQ (   i,
  q,
  sin_b,
  cos_b 
)
Value:
{\
float t;\
t = i * cos_b - q * sin_b;\
q = i * sin_b + q * cos_b;\
i = t;\
}
GLdouble GLdouble t
Definition: glext.h:6398
GLdouble GLdouble GLdouble GLdouble q
Definition: glext.h:6414

◆ STD_HUE_CONDITION

#define STD_HUE_CONDITION (   setup)    1

◆ YIQ_TO_RGB

#define YIQ_TO_RGB (   y,
  i,
  q,
  to_rgb,
  type,
  r,
  g 
)
Value:
(\
r = (type) (y + to_rgb [0] * i + to_rgb [1] * q),\
g = (type) (y + to_rgb [2] * i + to_rgb [3] * q),\
(type) (y + to_rgb [4] * i + to_rgb [5] * q)\
)
GLenum type
Definition: glext.h:6233
GLint GLint GLint GLint GLint GLint y
Definition: glext.h:6295
GLdouble GLdouble GLdouble GLdouble q
Definition: glext.h:6414

Typedef Documentation

◆ init_t

typedef struct init_t init_t

◆ pixel_info_t

typedef struct pixel_info_t pixel_info_t

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
burst_size 

◆ anonymous enum

anonymous enum
Enumerator
kernel_half 

◆ anonymous enum

anonymous enum
Enumerator
kernel_size 

◆ anonymous enum

anonymous enum
Enumerator
rgb_kernel_size 

◆ anonymous enum

anonymous enum
Enumerator
rgb_bias 

Function Documentation

◆ correct_errors()

static void correct_errors ( snes_ntsc_rgb_t  color,
snes_ntsc_rgb_t out 
)
static

◆ gen_kernel()

static void gen_kernel ( init_t impl,
float  y,
float  i,
float  q,
snes_ntsc_rgb_t out 
)
static
Here is the caller graph for this function:

◆ init()

static void init ( init_t impl,
snes_ntsc_setup_t const setup 
)
static
Here is the call graph for this function:

◆ init_filters()

static void init_filters ( init_t impl,
snes_ntsc_setup_t const setup 
)
static
Here is the caller graph for this function:

Variable Documentation

◆ default_decoder

float const default_decoder[6]
static
Initial value:
=
{ 0.956f, 0.621f, -0.272f, -0.647f, -1.105f, 1.702f }

◆ snes_ntsc_pixels

pixel_info_t const snes_ntsc_pixels[alignment_count]