RetroArch
Classes | Macros | Functions | Variables
2xbr.c File Reference
#include "softfilter.h"
#include <stdlib.h>
#include <string.h>
#include <math.h>
Include dependency graph for 2xbr.c:

Classes

struct  softfilter_thread_data
 
struct  filter_data
 

Macros

#define TWOXBR_SCALE   2
 
#define RED_MASK565   0xF800
 
#define GREEN_MASK565   0x07E0
 
#define BLUE_MASK565   0x001F
 
#define PG_LBMASK565   0xF7DE
 
#define RED_MASK8888   0x000000FF
 
#define GREEN_MASK8888   0x0000FF00
 
#define BLUE_MASK8888   0x00FF0000
 
#define PG_LBMASK8888   0xFEFEFEFE
 
#define ALPHA_MASK8888   0xFF000000
 
#define ALPHA_BLEND_128_W(dst, src)   dst = ((src & pg_lbmask) >> 1) + ((dst & pg_lbmask) >> 1)
 
#define ALPHA_BLEND_32_W(dst, src)
 
#define ALPHA_BLEND_8888_32_W(dst, src)
 
#define ALPHA_BLEND_64_W(dst, src)
 
#define ALPHA_BLEND_8888_64_W(dst, src)
 
#define ALPHA_BLEND_192_W(dst, src)
 
#define ALPHA_BLEND_8888_192_W(dst, src)
 
#define ALPHA_BLEND_224_W(dst, src)
 
#define ALPHA_BLEND_8888_224_W(dst, src)
 
#define LEFT_UP_2_2X(N3, N2, N1, PIXEL)
 
#define LEFT_2_2X(N3, N2, PIXEL)
 
#define UP_2_2X(N3, N1, PIXEL)
 
#define DIA_2X(N3, PIXEL)   ALPHA_BLEND_128_W(E[N3], PIXEL); \
 
#define LEFT_UP_2_8888_2X(N3, N2, N1, PIXEL)
 
#define LEFT_2_8888_2X(N3, N2, PIXEL)
 
#define UP_2_8888_2X(N3, N1, PIXEL)
 
#define DIA_8888_2X(N3, PIXEL)   ALPHA_BLEND_128_W(E[N3], PIXEL); \
 
#define df(Z, A, B)   abs(Z->RGBtoYUV[A] - Z->RGBtoYUV[B])\
 
#define eq(Z, A, B)   (df(Z, A, B) < 155)\
 
#define FILTRO_RGB565(Z, PE, _PI, PH, PF, PG, PC, PD, PB, PA, G5, C4, G0, D0, C1, B1, F4, I4, H5, I5, A0, A1, N0, N1, N2, N3, pg_red_mask, pg_green_mask, pg_blue_mask)
 
#define FILTRO_RGB8888(Z, PE, _PI, PH, PF, PG, PC, PD, PB, PA, G5, C4, G0, D0, C1, B1, F4, I4, H5, I5, A0, A1, N0, N1, N2, N3, pg_red_mask, pg_green_mask, pg_blue_mask)
 
#define twoxbr_function(FILTRO, Z)
 

Functions

static unsigned twoxbr_generic_input_fmts (void)
 
static unsigned twoxbr_generic_output_fmts (unsigned input_fmts)
 
static unsigned twoxbr_generic_threads (void *data)
 
static void SetupFormat (void *data)
 
static voidtwoxbr_generic_create (const struct softfilter_config *config, unsigned in_fmt, unsigned out_fmt, unsigned max_width, unsigned max_height, unsigned threads, softfilter_simd_mask_t simd, void *userdata)
 
static void twoxbr_generic_output (void *data, unsigned *out_width, unsigned *out_height, unsigned width, unsigned height)
 
static void twoxbr_generic_destroy (void *data)
 
float df8 (uint32_t A, uint32_t B, uint32_t pg_red_mask, uint32_t pg_green_mask, uint32_t pg_blue_mask)
 
int eq8 (uint32_t A, uint32_t B, uint32_t pg_red_mask, uint32_t pg_green_mask, uint32_t pg_blue_mask)
 
static void twoxbr_generic_xrgb8888 (void *data, unsigned width, unsigned height, int first, int last, uint32_t *src, unsigned src_stride, uint32_t *dst, unsigned dst_stride)
 
static void twoxbr_generic_rgb565 (void *data, unsigned width, unsigned height, int first, int last, uint16_t *src, unsigned src_stride, uint16_t *dst, unsigned dst_stride)
 
static void twoxbr_work_cb_rgb565 (void *data, void *thread_data)
 
static void twoxbr_work_cb_xrgb8888 (void *data, void *thread_data)
 
static void twoxbr_generic_packets (void *data, struct softfilter_work_packet *packets, void *output, size_t output_stride, const void *input, unsigned width, unsigned height, size_t input_stride)
 
const struct softfilter_implementationsoftfilter_get_implementation (softfilter_simd_mask_t simd)
 

Variables

static const struct softfilter_implementation twoxbr_generic
 

Macro Definition Documentation

◆ ALPHA_BLEND_128_W

#define ALPHA_BLEND_128_W (   dst,
  src 
)    dst = ((src & pg_lbmask) >> 1) + ((dst & pg_lbmask) >> 1)

◆ ALPHA_BLEND_192_W

#define ALPHA_BLEND_192_W (   dst,
  src 
)
Value:
dst = ( \
(pg_red_mask & ((dst & pg_red_mask) + \
((((src & pg_red_mask) - \
(dst & pg_red_mask)) * 192) >>8))) | \
(pg_green_mask & ((dst & pg_green_mask) + \
((((src & pg_green_mask) - \
(dst & pg_green_mask)) * 192) >>8))) | \
(pg_blue_mask & ((dst & pg_blue_mask) + \
((((src & pg_blue_mask) - \
(dst & pg_blue_mask)) * 192) >>8))) )
GLenum src
Definition: glext.h:6980
GLenum GLenum dst
Definition: glext.h:6980

◆ ALPHA_BLEND_224_W

#define ALPHA_BLEND_224_W (   dst,
  src 
)
Value:
dst = ( \
(pg_red_mask & ((dst & pg_red_mask) + \
((((src & pg_red_mask) - \
(dst & pg_red_mask)) * 224) >>8))) | \
(pg_green_mask & ((dst & pg_green_mask) + \
((((src & pg_green_mask) - \
(dst & pg_green_mask)) * 224) >>8))) | \
(pg_blue_mask & ((dst & pg_blue_mask) + \
((((src & pg_blue_mask) - \
(dst & pg_blue_mask)) * 224) >>8))) );
GLenum src
Definition: glext.h:6980
GLenum GLenum dst
Definition: glext.h:6980

◆ ALPHA_BLEND_32_W

#define ALPHA_BLEND_32_W (   dst,
  src 
)
Value:
dst = ( \
(pg_red_mask & ((dst & pg_red_mask) + \
((((src & pg_red_mask) - \
(dst & pg_red_mask))) >>3))) | \
(pg_green_mask & ((dst & pg_green_mask) + \
((((src & pg_green_mask) - \
(dst & pg_green_mask))) >>3))) | \
(pg_blue_mask & ((dst & pg_blue_mask) + \
((((src & pg_blue_mask) - \
(dst & pg_blue_mask))) >>3))) )
GLenum src
Definition: glext.h:6980
GLenum GLenum dst
Definition: glext.h:6980

◆ ALPHA_BLEND_64_W

#define ALPHA_BLEND_64_W (   dst,
  src 
)
Value:
dst = ( \
(pg_red_mask & ((dst & pg_red_mask) + \
((((src & pg_red_mask) - \
(dst & pg_red_mask))) >>2))) | \
(pg_green_mask & ((dst & pg_green_mask) + \
((((src & pg_green_mask) - \
(dst & pg_green_mask))) >>2))) | \
(pg_blue_mask & ((dst & pg_blue_mask) + \
((((src & pg_blue_mask) - \
(dst & pg_blue_mask))) >>2))) )
GLenum src
Definition: glext.h:6980
GLenum GLenum dst
Definition: glext.h:6980

◆ ALPHA_BLEND_8888_192_W

#define ALPHA_BLEND_8888_192_W (   dst,
  src 
)
Value:
dst = ( \
(pg_red_mask & ((dst & pg_red_mask) + \
((((src & pg_red_mask) - \
(dst & pg_red_mask)) * 192) >>8))) | \
(pg_green_mask & ((dst & pg_green_mask) + \
((((src & pg_green_mask) - \
(dst & pg_green_mask)) * 192) >>8))) | \
(pg_blue_mask & ((dst & pg_blue_mask) + \
((((src & pg_blue_mask) - \
(dst & pg_blue_mask)) * 192) >>8))) ) +\
pg_alpha_mask
GLenum src
Definition: glext.h:6980
GLenum GLenum dst
Definition: glext.h:6980

◆ ALPHA_BLEND_8888_224_W

#define ALPHA_BLEND_8888_224_W (   dst,
  src 
)
Value:
dst = ( \
(pg_red_mask & ((dst & pg_red_mask) + \
((((src & pg_red_mask) - \
(dst & pg_red_mask)) * 224) >>8))) | \
(pg_green_mask & ((dst & pg_green_mask) + \
((((src & pg_green_mask) - \
(dst & pg_green_mask)) * 224) >>8))) | \
(pg_blue_mask & ((dst & pg_blue_mask) + \
((((src & pg_blue_mask) - \
(dst & pg_blue_mask)) * 224) >>8))) ) +\
pg_alpha_mask
GLenum src
Definition: glext.h:6980
GLenum GLenum dst
Definition: glext.h:6980

◆ ALPHA_BLEND_8888_32_W

#define ALPHA_BLEND_8888_32_W (   dst,
  src 
)
Value:
dst = ( \
(pg_red_mask & ((dst & pg_red_mask) + \
((((src & pg_red_mask) - \
(dst & pg_red_mask))) >>3))) | \
(pg_green_mask & ((dst & pg_green_mask) + \
((((src & pg_green_mask) - \
(dst & pg_green_mask))) >>3))) | \
(pg_blue_mask & ((dst & pg_blue_mask) + \
((((src & pg_blue_mask) - \
(dst & pg_blue_mask))) >>3))) ) +\
pg_alpha_mask
GLenum src
Definition: glext.h:6980
GLenum GLenum dst
Definition: glext.h:6980

◆ ALPHA_BLEND_8888_64_W

#define ALPHA_BLEND_8888_64_W (   dst,
  src 
)
Value:
dst = ( \
(pg_red_mask & ((dst & pg_red_mask) + \
((((src & pg_red_mask) - \
(dst & pg_red_mask))) >>2))) | \
(pg_green_mask & ((dst & pg_green_mask) + \
((((src & pg_green_mask) - \
(dst & pg_green_mask))) >>2))) | \
(pg_blue_mask & ((dst & pg_blue_mask) + \
((((src & pg_blue_mask) - \
(dst & pg_blue_mask))) >>2))) ) +\
pg_alpha_mask
GLenum src
Definition: glext.h:6980
GLenum GLenum dst
Definition: glext.h:6980

◆ ALPHA_MASK8888

#define ALPHA_MASK8888   0xFF000000

◆ BLUE_MASK565

#define BLUE_MASK565   0x001F

◆ BLUE_MASK8888

#define BLUE_MASK8888   0x00FF0000

◆ df

#define df (   Z,
  A,
  B 
)    abs(Z->RGBtoYUV[A] - Z->RGBtoYUV[B])\

◆ DIA_2X

#define DIA_2X (   N3,
  PIXEL 
)    ALPHA_BLEND_128_W(E[N3], PIXEL); \

◆ DIA_8888_2X

#define DIA_8888_2X (   N3,
  PIXEL 
)    ALPHA_BLEND_128_W(E[N3], PIXEL); \

◆ eq

#define eq (   Z,
  A,
  B 
)    (df(Z, A, B) < 155)\

◆ FILTRO_RGB565

#define FILTRO_RGB565 (   Z,
  PE,
  _PI,
  PH,
  PF,
  PG,
  PC,
  PD,
  PB,
  PA,
  G5,
  C4,
  G0,
  D0,
  C1,
  B1,
  F4,
  I4,
  H5,
  I5,
  A0,
  A1,
  N0,
  N1,
  N2,
  N3,
  pg_red_mask,
  pg_green_mask,
  pg_blue_mask 
)

◆ FILTRO_RGB8888

#define FILTRO_RGB8888 (   Z,
  PE,
  _PI,
  PH,
  PF,
  PG,
  PC,
  PD,
  PB,
  PA,
  G5,
  C4,
  G0,
  D0,
  C1,
  B1,
  F4,
  I4,
  H5,
  I5,
  A0,
  A1,
  N0,
  N1,
  N2,
  N3,
  pg_red_mask,
  pg_green_mask,
  pg_blue_mask 
)

◆ GREEN_MASK565

#define GREEN_MASK565   0x07E0

◆ GREEN_MASK8888

#define GREEN_MASK8888   0x0000FF00

◆ LEFT_2_2X

#define LEFT_2_2X (   N3,
  N2,
  PIXEL 
)
Value:
ALPHA_BLEND_192_W(E[N3], PIXEL); \
ALPHA_BLEND_64_W( E[N2], PIXEL); \
#define ALPHA_BLEND_192_W(dst, src)
Definition: 2xbr.c:322

◆ LEFT_2_8888_2X

#define LEFT_2_8888_2X (   N3,
  N2,
  PIXEL 
)
Value:
ALPHA_BLEND_8888_192_W(E[N3], PIXEL); \
ALPHA_BLEND_8888_64_W( E[N2], PIXEL); \
#define ALPHA_BLEND_8888_192_W(dst, src)
Definition: 2xbr.c:335

◆ LEFT_UP_2_2X

#define LEFT_UP_2_2X (   N3,
  N2,
  N1,
  PIXEL 
)
Value:
ALPHA_BLEND_224_W(E[N3], PIXEL); \
ALPHA_BLEND_64_W( E[N2], PIXEL); \
E[N1] = E[N2]; \
#define ALPHA_BLEND_224_W(dst, src)
Definition: 2xbr.c:348

◆ LEFT_UP_2_8888_2X

#define LEFT_UP_2_8888_2X (   N3,
  N2,
  N1,
  PIXEL 
)
Value:
ALPHA_BLEND_8888_224_W(E[N3], PIXEL); \
ALPHA_BLEND_8888_64_W( E[N2], PIXEL); \
E[N1] = E[N2]; \
#define ALPHA_BLEND_8888_224_W(dst, src)
Definition: 2xbr.c:360

◆ PG_LBMASK565

#define PG_LBMASK565   0xF7DE

◆ PG_LBMASK8888

#define PG_LBMASK8888   0xFEFEFEFE

◆ RED_MASK565

#define RED_MASK565   0xF800

◆ RED_MASK8888

#define RED_MASK8888   0x000000FF

◆ twoxbr_function

#define twoxbr_function (   FILTRO,
 
)
Value:
E[0] = E[1] = E[2] = E[3] = PE;\
FILTRO(Z, PE, _PI, PH, PF, PG, PC, PD, PB, PA, G5, C4, G0, D0, C1, B1, F4, I4, H5, I5, A0, A1, 0, 1, 2, 3, pg_red_mask, pg_green_mask, pg_blue_mask);\
FILTRO(Z, PE, PC, PF, PB, _PI, PA, PH, PD, PG, I4, A1, I5, H5, A0, D0, B1, C1, F4, C4, G5, G0, 2, 0, 3, 1, pg_red_mask, pg_green_mask, pg_blue_mask);\
FILTRO(Z, PE, PA, PB, PD, PC, PG, PF, PH, _PI, C1, G0, C4, F4, G5, H5, D0, A0, B1, A1, I4, I5, 3, 2, 1, 0, pg_red_mask, pg_green_mask, pg_blue_mask);\
FILTRO(Z, PE, PG, PD, PH, PA, _PI, PB, PF, PC, A0, I5, A1, B1, I4, F4, H5, G5, D0, G0, C1, C4, 1, 3, 0, 2, pg_red_mask, pg_green_mask, pg_blue_mask);\
out[0] = E[0]; \
out[1] = E[1]; \
out[dst_stride] = E[2]; \
out[dst_stride + 1] = E[3]; \
++in; \
out += 2
GLuint in
Definition: glext.h:10523
#define F4(x, y, z)
Definition: md5.c:43

◆ TWOXBR_SCALE

#define TWOXBR_SCALE   2

◆ UP_2_2X

#define UP_2_2X (   N3,
  N1,
  PIXEL 
)
Value:
ALPHA_BLEND_192_W(E[N3], PIXEL); \
ALPHA_BLEND_64_W( E[N1], PIXEL); \
#define ALPHA_BLEND_192_W(dst, src)
Definition: 2xbr.c:322

◆ UP_2_8888_2X

#define UP_2_8888_2X (   N3,
  N1,
  PIXEL 
)
Value:
ALPHA_BLEND_8888_192_W(E[N3], PIXEL); \
ALPHA_BLEND_8888_64_W( E[N1], PIXEL); \
#define ALPHA_BLEND_8888_192_W(dst, src)
Definition: 2xbr.c:335

Function Documentation

◆ df8()

float df8 ( uint32_t  A,
uint32_t  B,
uint32_t  pg_red_mask,
uint32_t  pg_green_mask,
uint32_t  pg_blue_mask 
)
Here is the call graph for this function:

◆ eq8()

int eq8 ( uint32_t  A,
uint32_t  B,
uint32_t  pg_red_mask,
uint32_t  pg_green_mask,
uint32_t  pg_blue_mask 
)
Here is the call graph for this function:

◆ SetupFormat()

static void SetupFormat ( void data)
static
Here is the caller graph for this function:

◆ softfilter_get_implementation()

const struct softfilter_implementation* softfilter_get_implementation ( softfilter_simd_mask_t  simd)

◆ twoxbr_generic_create()

static void* twoxbr_generic_create ( const struct softfilter_config config,
unsigned  in_fmt,
unsigned  out_fmt,
unsigned  max_width,
unsigned  max_height,
unsigned  threads,
softfilter_simd_mask_t  simd,
void userdata 
)
static
Here is the call graph for this function:

◆ twoxbr_generic_destroy()

static void twoxbr_generic_destroy ( void data)
static
Here is the call graph for this function:

◆ twoxbr_generic_input_fmts()

static unsigned twoxbr_generic_input_fmts ( void  )
static

◆ twoxbr_generic_output()

static void twoxbr_generic_output ( void data,
unsigned *  out_width,
unsigned *  out_height,
unsigned  width,
unsigned  height 
)
static

◆ twoxbr_generic_output_fmts()

static unsigned twoxbr_generic_output_fmts ( unsigned  input_fmts)
static

◆ twoxbr_generic_packets()

static void twoxbr_generic_packets ( void data,
struct softfilter_work_packet packets,
void output,
size_t  output_stride,
const void input,
unsigned  width,
unsigned  height,
size_t  input_stride 
)
static
Here is the call graph for this function:

◆ twoxbr_generic_rgb565()

static void twoxbr_generic_rgb565 ( void data,
unsigned  width,
unsigned  height,
int  first,
int  last,
uint16_t src,
unsigned  src_stride,
uint16_t dst,
unsigned  dst_stride 
)
static
Here is the caller graph for this function:

◆ twoxbr_generic_threads()

static unsigned twoxbr_generic_threads ( void data)
static

◆ twoxbr_generic_xrgb8888()

static void twoxbr_generic_xrgb8888 ( void data,
unsigned  width,
unsigned  height,
int  first,
int  last,
uint32_t src,
unsigned  src_stride,
uint32_t dst,
unsigned  dst_stride 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ twoxbr_work_cb_rgb565()

static void twoxbr_work_cb_rgb565 ( void data,
void thread_data 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ twoxbr_work_cb_xrgb8888()

static void twoxbr_work_cb_xrgb8888 ( void data,
void thread_data 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ twoxbr_generic

const struct softfilter_implementation twoxbr_generic
static
Initial value:
= {
"2xBR",
"2xbr",
}
static void twoxbr_generic_destroy(void *data)
Definition: 2xbr.c:256
static unsigned twoxbr_generic_output_fmts(unsigned input_fmts)
Definition: 2xbr.c:77
static unsigned twoxbr_generic_threads(void *data)
Definition: 2xbr.c:82
#define SOFTFILTER_API_VERSION
Definition: softfilter.h:96
static void * twoxbr_generic_create(const struct softfilter_config *config, unsigned in_fmt, unsigned out_fmt, unsigned max_width, unsigned max_height, unsigned threads, softfilter_simd_mask_t simd, void *userdata)
Definition: 2xbr.c:222
static unsigned twoxbr_generic_input_fmts(void)
Definition: 2xbr.c:72
static void twoxbr_generic_output(void *data, unsigned *out_width, unsigned *out_height, unsigned width, unsigned height)
Definition: 2xbr.c:248
static void twoxbr_generic_packets(void *data, struct softfilter_work_packet *packets, void *output, size_t output_stride, const void *input, unsigned width, unsigned height, size_t input_stride)
Definition: 2xbr.c:705