mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 19:20:35 +00:00
(SoftFilters) Uniquely name all variables and put header guards around
snes_ntsc.c (this will be needed for later static linking inside Griffin)
This commit is contained in:
parent
b40b9e55d2
commit
3107c9adb5
@ -24,13 +24,9 @@
|
||||
#include "snes_ntsc/snes_ntsc.h"
|
||||
#include "snes_ntsc/snes_ntsc.c"
|
||||
|
||||
void filter_size(unsigned*, unsigned*);
|
||||
void filter_render(uint32_t*, uint32_t*, unsigned, const uint16_t*, unsigned, unsigned, unsigned);
|
||||
|
||||
struct snes_ntsc_t *ntsc;
|
||||
snes_ntsc_setup_t setup;
|
||||
int burst;
|
||||
int burst_toggle;
|
||||
static struct snes_ntsc_t *ntsc_composite;
|
||||
static int burst_composite;
|
||||
static int burst_toggle_composite;
|
||||
|
||||
static unsigned blargg_ntsc_snes_composite_generic_input_fmts(void)
|
||||
{
|
||||
@ -70,24 +66,25 @@ static void *blargg_ntsc_snes_composite_generic_create(unsigned in_fmt, unsigned
|
||||
|
||||
static void blargg_ntsc_snes_composite_initialize(void)
|
||||
{
|
||||
snes_ntsc_setup_t setup;
|
||||
static bool initialized = false;
|
||||
if(initialized == true)
|
||||
return;
|
||||
initialized = true;
|
||||
|
||||
ntsc = (snes_ntsc_t*)malloc(sizeof *ntsc);
|
||||
ntsc_composite = (snes_ntsc_t*)malloc(sizeof(*ntsc_composite));
|
||||
setup = snes_ntsc_composite;
|
||||
setup.merge_fields = 1;
|
||||
snes_ntsc_init(ntsc, &setup);
|
||||
snes_ntsc_init(ntsc_composite, &setup);
|
||||
|
||||
burst = 0;
|
||||
burst_toggle = (setup.merge_fields ? 0 : 1);
|
||||
burst_composite = 0;
|
||||
burst_toggle_composite = (setup.merge_fields ? 0 : 1);
|
||||
}
|
||||
|
||||
void terminate(void)
|
||||
{
|
||||
if(ntsc)
|
||||
free(ntsc);
|
||||
if(ntsc_composite)
|
||||
free(ntsc_composite);
|
||||
}
|
||||
|
||||
static void blargg_ntsc_snes_composite_generic_output(void *data, unsigned *out_width, unsigned *out_height,
|
||||
@ -110,15 +107,15 @@ static void blargg_ntsc_snes_composite_render_rgb565(int width, int height,
|
||||
uint16_t *input, int pitch, uint16_t *output, int outpitch)
|
||||
{
|
||||
blargg_ntsc_snes_composite_initialize();
|
||||
if(!ntsc)
|
||||
if(!ntsc_composite)
|
||||
return;
|
||||
|
||||
if(width <= 256)
|
||||
snes_ntsc_blit(ntsc, input, pitch, burst, width, height, output, outpitch * 2, first, last);
|
||||
snes_ntsc_blit(ntsc_composite, input, pitch, burst_composite, width, height, output, outpitch * 2, first, last);
|
||||
else
|
||||
snes_ntsc_blit_hires(ntsc, input, pitch, burst, width, height, output, outpitch * 2, first, last);
|
||||
snes_ntsc_blit_hires(ntsc_composite, input, pitch, burst_composite, width, height, output, outpitch * 2, first, last);
|
||||
|
||||
burst ^= burst_toggle;
|
||||
burst_composite ^= burst_toggle_composite;
|
||||
}
|
||||
|
||||
static void blargg_ntsc_snes_composite_rgb565(unsigned width, unsigned height,
|
||||
|
@ -24,13 +24,9 @@
|
||||
#include "snes_ntsc/snes_ntsc.h"
|
||||
#include "snes_ntsc/snes_ntsc.c"
|
||||
|
||||
void filter_size(unsigned*, unsigned*);
|
||||
void filter_render(uint32_t*, uint32_t*, unsigned, const uint16_t*, unsigned, unsigned, unsigned);
|
||||
|
||||
struct snes_ntsc_t *ntsc;
|
||||
snes_ntsc_setup_t setup;
|
||||
int burst;
|
||||
int burst_toggle;
|
||||
static struct snes_ntsc_t *ntsc_rf;
|
||||
static int burst_rf;
|
||||
static int burst_toggle_rf;
|
||||
|
||||
static unsigned blargg_ntsc_snes_rf_generic_input_fmts(void)
|
||||
{
|
||||
@ -70,24 +66,25 @@ static void *blargg_ntsc_snes_rf_generic_create(unsigned in_fmt, unsigned out_fm
|
||||
|
||||
static void blargg_ntsc_snes_rf_initialize(void)
|
||||
{
|
||||
snes_ntsc_setup_t setup;
|
||||
static bool initialized = false;
|
||||
if(initialized == true)
|
||||
return;
|
||||
initialized = true;
|
||||
|
||||
ntsc = (snes_ntsc_t*)malloc(sizeof *ntsc);
|
||||
ntsc_rf = (snes_ntsc_t*)malloc(sizeof(*ntsc_rf));
|
||||
setup = snes_ntsc_composite;
|
||||
setup.merge_fields = 0;
|
||||
snes_ntsc_init(ntsc, &setup);
|
||||
snes_ntsc_init(ntsc_rf, &setup);
|
||||
|
||||
burst = 0;
|
||||
burst_toggle = (setup.merge_fields ? 0 : 1);
|
||||
burst_rf = 0;
|
||||
burst_toggle_rf = (setup.merge_fields ? 0 : 1);
|
||||
}
|
||||
|
||||
void terminate(void)
|
||||
{
|
||||
if(ntsc)
|
||||
free(ntsc);
|
||||
if(ntsc_rf)
|
||||
free(ntsc_rf);
|
||||
}
|
||||
|
||||
static void blargg_ntsc_snes_rf_generic_output(void *data, unsigned *out_width, unsigned *out_height,
|
||||
@ -110,15 +107,15 @@ static void blargg_ntsc_snes_rf_render_rgb565(int width, int height,
|
||||
uint16_t *input, int pitch, uint16_t *output, int outpitch)
|
||||
{
|
||||
blargg_ntsc_snes_rf_initialize();
|
||||
if(!ntsc)
|
||||
if(!ntsc_rf)
|
||||
return;
|
||||
|
||||
if(width <= 256)
|
||||
snes_ntsc_blit(ntsc, input, pitch, burst, width, height, output, outpitch * 2, first, last);
|
||||
snes_ntsc_blit(ntsc_rf, input, pitch, burst_rf, width, height, output, outpitch * 2, first, last);
|
||||
else
|
||||
snes_ntsc_blit_hires(ntsc, input, pitch, burst, width, height, output, outpitch * 2, first, last);
|
||||
snes_ntsc_blit_hires(ntsc_rf, input, pitch, burst_rf, width, height, output, outpitch * 2, first, last);
|
||||
|
||||
burst ^= burst_toggle;
|
||||
burst_rf ^= burst_toggle_rf;
|
||||
}
|
||||
|
||||
static void blargg_ntsc_snes_rf_rgb565(unsigned width, unsigned height,
|
||||
|
@ -24,13 +24,9 @@
|
||||
#include "snes_ntsc/snes_ntsc.h"
|
||||
#include "snes_ntsc/snes_ntsc.c"
|
||||
|
||||
void filter_size(unsigned*, unsigned*);
|
||||
void filter_render(uint32_t*, uint32_t*, unsigned, const uint16_t*, unsigned, unsigned, unsigned);
|
||||
|
||||
struct snes_ntsc_t *ntsc;
|
||||
snes_ntsc_setup_t setup;
|
||||
int burst;
|
||||
int burst_toggle;
|
||||
static struct snes_ntsc_t *ntsc_rgb;
|
||||
static int burst_rgb;
|
||||
static int burst_toggle_rgb;
|
||||
|
||||
static unsigned blargg_ntsc_snes_rgb_generic_input_fmts(void)
|
||||
{
|
||||
@ -70,24 +66,25 @@ static void *blargg_ntsc_snes_rgb_generic_create(unsigned in_fmt, unsigned out_f
|
||||
|
||||
static void blargg_ntsc_snes_rgb_initialize(void)
|
||||
{
|
||||
snes_ntsc_setup_t setup;
|
||||
static bool initialized = false;
|
||||
if(initialized == true)
|
||||
return;
|
||||
initialized = true;
|
||||
|
||||
ntsc = (snes_ntsc_t*)malloc(sizeof *ntsc);
|
||||
ntsc_rgb = (snes_ntsc_t*)malloc(sizeof(*ntsc_rgb));
|
||||
setup = snes_ntsc_rgb;
|
||||
setup.merge_fields = 1;
|
||||
snes_ntsc_init(ntsc, &setup);
|
||||
snes_ntsc_init(ntsc_rgb, &setup);
|
||||
|
||||
burst = 0;
|
||||
burst_toggle = (setup.merge_fields ? 0 : 1);
|
||||
burst_rgb = 0;
|
||||
burst_toggle_rgb = (setup.merge_fields ? 0 : 1);
|
||||
}
|
||||
|
||||
void terminate(void)
|
||||
{
|
||||
if(ntsc)
|
||||
free(ntsc);
|
||||
if(ntsc_rgb)
|
||||
free(ntsc_rgb);
|
||||
}
|
||||
|
||||
static void blargg_ntsc_snes_rgb_generic_output(void *data, unsigned *out_width, unsigned *out_height,
|
||||
@ -110,15 +107,15 @@ static void blargg_ntsc_snes_rgb_render_rgb565(int width, int height,
|
||||
uint16_t *input, int pitch, uint16_t *output, int outpitch)
|
||||
{
|
||||
blargg_ntsc_snes_rgb_initialize();
|
||||
if(!ntsc)
|
||||
if(!ntsc_rgb)
|
||||
return;
|
||||
|
||||
if(width <= 256)
|
||||
snes_ntsc_blit(ntsc, input, pitch, burst, width, height, output, outpitch * 2, first, last);
|
||||
snes_ntsc_blit(ntsc_rgb, input, pitch, burst_rgb, width, height, output, outpitch * 2, first, last);
|
||||
else
|
||||
snes_ntsc_blit_hires(ntsc, input, pitch, burst, width, height, output, outpitch * 2, first, last);
|
||||
snes_ntsc_blit_hires(ntsc_rgb, input, pitch, burst_rgb, width, height, output, outpitch * 2, first, last);
|
||||
|
||||
burst ^= burst_toggle;
|
||||
burst_rgb ^= burst_toggle_rgb;
|
||||
}
|
||||
|
||||
static void blargg_ntsc_snes_rgb_rgb565(unsigned width, unsigned height,
|
||||
|
@ -24,13 +24,9 @@
|
||||
#include "snes_ntsc/snes_ntsc.h"
|
||||
#include "snes_ntsc/snes_ntsc.c"
|
||||
|
||||
void filter_size(unsigned*, unsigned*);
|
||||
void filter_render(uint32_t*, uint32_t*, unsigned, const uint16_t*, unsigned, unsigned, unsigned);
|
||||
|
||||
struct snes_ntsc_t *ntsc;
|
||||
snes_ntsc_setup_t setup;
|
||||
int burst;
|
||||
int burst_toggle;
|
||||
static struct snes_ntsc_t *ntsc_svideo;
|
||||
static int burst_svideo;
|
||||
static int burst_toggle_svideo;
|
||||
|
||||
static unsigned blargg_ntsc_snes_svideo_generic_input_fmts(void)
|
||||
{
|
||||
@ -70,24 +66,25 @@ static void *blargg_ntsc_snes_svideo_generic_create(unsigned in_fmt, unsigned ou
|
||||
|
||||
static void blargg_ntsc_snes_svideo_initialize(void)
|
||||
{
|
||||
snes_ntsc_setup_t setup;
|
||||
static bool initialized = false;
|
||||
if(initialized == true)
|
||||
return;
|
||||
initialized = true;
|
||||
|
||||
ntsc = (snes_ntsc_t*)malloc(sizeof *ntsc);
|
||||
ntsc_svideo = (snes_ntsc_t*)malloc(sizeof(*ntsc_svideo));
|
||||
setup = snes_ntsc_svideo;
|
||||
setup.merge_fields = 1;
|
||||
snes_ntsc_init(ntsc, &setup);
|
||||
snes_ntsc_init(ntsc_svideo, &setup);
|
||||
|
||||
burst = 0;
|
||||
burst_toggle = (setup.merge_fields ? 0 : 1);
|
||||
burst_svideo = 0;
|
||||
burst_toggle_svideo = (setup.merge_fields ? 0 : 1);
|
||||
}
|
||||
|
||||
void terminate(void)
|
||||
{
|
||||
if(ntsc)
|
||||
free(ntsc);
|
||||
if(ntsc_svideo)
|
||||
free(ntsc_svideo);
|
||||
}
|
||||
|
||||
static void blargg_ntsc_snes_svideo_generic_output(void *data, unsigned *out_width, unsigned *out_height,
|
||||
@ -110,15 +107,15 @@ static void blargg_ntsc_snes_svideo_render_rgb565(int width, int height,
|
||||
uint16_t *input, int pitch, uint16_t *output, int outpitch)
|
||||
{
|
||||
blargg_ntsc_snes_svideo_initialize();
|
||||
if(!ntsc)
|
||||
if(!ntsc_svideo)
|
||||
return;
|
||||
|
||||
if(width <= 256)
|
||||
snes_ntsc_blit(ntsc, input, pitch, burst, width, height, output, outpitch * 2, first, last);
|
||||
snes_ntsc_blit(ntsc_svideo, input, pitch, burst_svideo, width, height, output, outpitch * 2, first, last);
|
||||
else
|
||||
snes_ntsc_blit_hires(ntsc, input, pitch, burst, width, height, output, outpitch * 2, first, last);
|
||||
snes_ntsc_blit_hires(ntsc_svideo, input, pitch, burst_svideo, width, height, output, outpitch * 2, first, last);
|
||||
|
||||
burst ^= burst_toggle;
|
||||
burst_svideo ^= burst_toggle_svideo;
|
||||
}
|
||||
|
||||
static void blargg_ntsc_snes_svideo_rgb565(unsigned width, unsigned height,
|
||||
|
@ -1,4 +1,6 @@
|
||||
/* snes_ntsc 0.2.2. http://www.slack.net/~ant/ */
|
||||
#ifndef _BLARGG_SNES_NTSC_IMPLEMENTATION_H
|
||||
#define _BLARGG_SNES_NTSC_IMPLEMENTATION_H
|
||||
|
||||
#include "snes_ntsc.h"
|
||||
|
||||
@ -236,3 +238,5 @@ void snes_ntsc_blit_hires( snes_ntsc_t const* ntsc, SNES_NTSC_IN_T const* input,
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -1,4 +1,6 @@
|
||||
/* snes_ntsc 0.2.2. http://www.slack.net/~ant/ */
|
||||
#ifndef __BLARGG_SNES_NTSC_IMPLEMENTATION_H
|
||||
#define __BLARGG_SNES_NTSC_IMPLEMENTATION_H
|
||||
|
||||
/* Common implementation of NTSC filters */
|
||||
|
||||
@ -437,3 +439,5 @@ static void correct_errors( snes_ntsc_rgb_t color, snes_ntsc_rgb_t* out );
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user