2014-04-15 22:55:09 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
|
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
2014-05-02 17:12:56 +00:00
|
|
|
* Copyright (C) 2011-2014 - Daniel De Matteis
|
2014-04-15 22:55:09 +00:00
|
|
|
*
|
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2014-04-18 18:43:34 +00:00
|
|
|
/*
|
2014-05-02 17:12:56 +00:00
|
|
|
* Hyllian's 2xBR v3.3a
|
|
|
|
* Copyright (C) 2011, 2014 Hyllian/Jararaca - sergiogdb@gmail.com
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
2014-04-18 18:43:34 +00:00
|
|
|
*/
|
|
|
|
|
2014-04-15 22:55:09 +00:00
|
|
|
// Compile: gcc -o twoxbr.so -shared twoxbr.c -std=c99 -O3 -Wall -pedantic -fPIC
|
2014-04-18 18:43:34 +00:00
|
|
|
|
2014-04-15 22:55:09 +00:00
|
|
|
#include "softfilter.h"
|
|
|
|
#include <stdlib.h>
|
2014-05-09 14:18:08 +00:00
|
|
|
|
2014-04-15 23:49:02 +00:00
|
|
|
#ifdef RARCH_INTERNAL
|
|
|
|
#define softfilter_get_implementation twoxbr_get_implementation
|
2014-05-09 14:18:08 +00:00
|
|
|
#define softfilter_thread_data twoxbr_softfilter_thread_data
|
|
|
|
#define filter_data twoxbr_filter_data
|
2014-04-15 23:49:02 +00:00
|
|
|
#endif
|
2014-05-02 17:12:56 +00:00
|
|
|
|
2014-04-15 22:55:09 +00:00
|
|
|
#define TWOXBR_SCALE 2
|
2014-05-09 14:18:08 +00:00
|
|
|
|
|
|
|
struct softfilter_thread_data
|
|
|
|
{
|
|
|
|
void *out_data;
|
|
|
|
const void *in_data;
|
|
|
|
size_t out_pitch;
|
|
|
|
size_t in_pitch;
|
|
|
|
unsigned colfmt;
|
|
|
|
unsigned width;
|
|
|
|
unsigned height;
|
|
|
|
int first;
|
|
|
|
int last;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct filter_data
|
|
|
|
{
|
|
|
|
unsigned threads;
|
|
|
|
struct softfilter_thread_data *workers;
|
|
|
|
unsigned in_fmt;
|
|
|
|
uint16_t RGBtoYUV[65536];
|
|
|
|
uint16_t tbl_5_to_8[32];
|
|
|
|
uint16_t tbl_6_to_8[64];
|
|
|
|
};
|
2014-04-18 18:43:34 +00:00
|
|
|
|
|
|
|
static unsigned twoxbr_generic_input_fmts(void)
|
|
|
|
{
|
2014-04-18 20:57:28 +00:00
|
|
|
return SOFTFILTER_FMT_RGB565 | SOFTFILTER_FMT_XRGB8888;
|
2014-04-18 18:43:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static unsigned twoxbr_generic_output_fmts(unsigned input_fmts)
|
|
|
|
{
|
|
|
|
return input_fmts;
|
|
|
|
}
|
|
|
|
|
|
|
|
static unsigned twoxbr_generic_threads(void *data)
|
|
|
|
{
|
|
|
|
struct filter_data *filt = (struct filter_data*)data;
|
|
|
|
return filt->threads;
|
|
|
|
}
|
2014-05-09 14:18:08 +00:00
|
|
|
|
|
|
|
#define RED_MASK565 0xF800
|
|
|
|
#define GREEN_MASK565 0x07E0
|
|
|
|
#define BLUE_MASK565 0x001F
|
|
|
|
#define PG_LBMASK565 0xF7DE
|
|
|
|
|
|
|
|
#ifdef MSB_FIRST
|
|
|
|
#define RED_MASK8888 0xFF000000
|
|
|
|
#define GREEN_MASK8888 0x00FF0000
|
|
|
|
#define BLUE_MASK8888 0x0000FF00
|
|
|
|
#define PG_LBMASK8888 0xFEFEFEFE
|
|
|
|
#define ALPHA_MASK8888 0x000000FF
|
|
|
|
#else
|
|
|
|
#define RED_MASK8888 0x000000FF
|
|
|
|
#define GREEN_MASK8888 0x0000FF00
|
|
|
|
#define BLUE_MASK8888 0x00FF0000
|
|
|
|
#define PG_LBMASK8888 0xFEFEFEFE
|
|
|
|
#define ALPHA_MASK8888 0xFF000000
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static void SetupFormat(void * data)
|
|
|
|
{
|
|
|
|
uint16_t r, g, b, y, u, v;
|
|
|
|
uint32_t c;
|
|
|
|
struct filter_data *filt = (struct filter_data*)data;
|
|
|
|
|
|
|
|
filt->tbl_5_to_8[0] = 0;
|
|
|
|
filt->tbl_5_to_8[1] = 8;
|
|
|
|
filt->tbl_5_to_8[2] = 16;
|
|
|
|
filt->tbl_5_to_8[3] = 25;
|
|
|
|
filt->tbl_5_to_8[4] = 33;
|
|
|
|
filt->tbl_5_to_8[5] = 41;
|
|
|
|
filt->tbl_5_to_8[6] = 49;
|
|
|
|
filt->tbl_5_to_8[7] = 58;
|
|
|
|
filt->tbl_5_to_8[8] = 66;
|
|
|
|
filt->tbl_5_to_8[9] = 74;
|
|
|
|
filt->tbl_5_to_8[10] = 82;
|
|
|
|
filt->tbl_5_to_8[11] = 90;
|
|
|
|
filt->tbl_5_to_8[12] = 99;
|
|
|
|
filt->tbl_5_to_8[13] = 107;
|
|
|
|
filt->tbl_5_to_8[14] = 115;
|
|
|
|
filt->tbl_5_to_8[15] = 123;
|
|
|
|
filt->tbl_5_to_8[16] = 132;
|
|
|
|
filt->tbl_5_to_8[17] = 140;
|
|
|
|
filt->tbl_5_to_8[18] = 148;
|
|
|
|
filt->tbl_5_to_8[19] = 156;
|
|
|
|
filt->tbl_5_to_8[20] = 165;
|
|
|
|
filt->tbl_5_to_8[21] = 173;
|
|
|
|
filt->tbl_5_to_8[22] = 181;
|
|
|
|
filt->tbl_5_to_8[23] = 189;
|
|
|
|
filt->tbl_5_to_8[24] = 197;
|
|
|
|
filt->tbl_5_to_8[25] = 206;
|
|
|
|
filt->tbl_5_to_8[26] = 214;
|
|
|
|
filt->tbl_5_to_8[27] = 222;
|
|
|
|
filt->tbl_5_to_8[28] = 230;
|
|
|
|
filt->tbl_5_to_8[29] = 239;
|
|
|
|
filt->tbl_5_to_8[30] = 247;
|
|
|
|
filt->tbl_5_to_8[31] = 255;
|
|
|
|
|
|
|
|
filt->tbl_6_to_8[0] = 0;
|
|
|
|
filt->tbl_6_to_8[1] = 4;
|
|
|
|
filt->tbl_6_to_8[2] = 8;
|
|
|
|
filt->tbl_6_to_8[3] = 12;
|
|
|
|
filt->tbl_6_to_8[4] = 16;
|
|
|
|
filt->tbl_6_to_8[5] = 20;
|
|
|
|
filt->tbl_6_to_8[6] = 24;
|
|
|
|
filt->tbl_6_to_8[7] = 28;
|
|
|
|
filt->tbl_6_to_8[8] = 32;
|
|
|
|
filt->tbl_6_to_8[9] = 36;
|
|
|
|
filt->tbl_6_to_8[10] = 40;
|
|
|
|
filt->tbl_6_to_8[11] = 45;
|
|
|
|
filt->tbl_6_to_8[12] = 49;
|
|
|
|
filt->tbl_6_to_8[13] = 53;
|
|
|
|
filt->tbl_6_to_8[14] = 57;
|
|
|
|
filt->tbl_6_to_8[15] = 61;
|
|
|
|
filt->tbl_6_to_8[16] = 65;
|
|
|
|
filt->tbl_6_to_8[17] = 69;
|
|
|
|
filt->tbl_6_to_8[18] = 73;
|
|
|
|
filt->tbl_6_to_8[19] = 77;
|
|
|
|
filt->tbl_6_to_8[20] = 81;
|
|
|
|
filt->tbl_6_to_8[21] = 85;
|
|
|
|
filt->tbl_6_to_8[22] = 89;
|
|
|
|
filt->tbl_6_to_8[23] = 93;
|
|
|
|
filt->tbl_6_to_8[24] = 97;
|
|
|
|
filt->tbl_6_to_8[25] = 101;
|
|
|
|
filt->tbl_6_to_8[26] = 105;
|
|
|
|
filt->tbl_6_to_8[27] = 109;
|
|
|
|
filt->tbl_6_to_8[28] = 113;
|
|
|
|
filt->tbl_6_to_8[29] = 117;
|
|
|
|
filt->tbl_6_to_8[30] = 121;
|
|
|
|
filt->tbl_6_to_8[31] = 125;
|
|
|
|
filt->tbl_6_to_8[32] = 130;
|
|
|
|
filt->tbl_6_to_8[33] = 134;
|
|
|
|
filt->tbl_6_to_8[34] = 138;
|
|
|
|
filt->tbl_6_to_8[35] = 142;
|
|
|
|
filt->tbl_6_to_8[36] = 146;
|
|
|
|
filt->tbl_6_to_8[37] = 150;
|
|
|
|
filt->tbl_6_to_8[38] = 154;
|
|
|
|
filt->tbl_6_to_8[39] = 158;
|
|
|
|
filt->tbl_6_to_8[40] = 162;
|
|
|
|
filt->tbl_6_to_8[41] = 166;
|
|
|
|
filt->tbl_6_to_8[42] = 170;
|
|
|
|
filt->tbl_6_to_8[43] = 174;
|
|
|
|
filt->tbl_6_to_8[44] = 178;
|
|
|
|
filt->tbl_6_to_8[45] = 182;
|
|
|
|
filt->tbl_6_to_8[46] = 186;
|
|
|
|
filt->tbl_6_to_8[47] = 190;
|
|
|
|
filt->tbl_6_to_8[48] = 194;
|
|
|
|
filt->tbl_6_to_8[49] = 198;
|
|
|
|
filt->tbl_6_to_8[50] = 202;
|
|
|
|
filt->tbl_6_to_8[51] = 206;
|
|
|
|
filt->tbl_6_to_8[52] = 210;
|
|
|
|
filt->tbl_6_to_8[53] = 215;
|
|
|
|
filt->tbl_6_to_8[54] = 219;
|
|
|
|
filt->tbl_6_to_8[55] = 223;
|
|
|
|
filt->tbl_6_to_8[56] = 227;
|
|
|
|
filt->tbl_6_to_8[57] = 231;
|
|
|
|
filt->tbl_6_to_8[58] = 235;
|
|
|
|
filt->tbl_6_to_8[59] = 239;
|
|
|
|
filt->tbl_6_to_8[60] = 243;
|
|
|
|
filt->tbl_6_to_8[61] = 247;
|
|
|
|
filt->tbl_6_to_8[62] = 251;
|
|
|
|
filt->tbl_6_to_8[63] = 255;
|
|
|
|
|
|
|
|
for (c = 0; c < 65536; c++)
|
|
|
|
{
|
|
|
|
r = filt->tbl_5_to_8[(c & RED_MASK565) >> 11];
|
|
|
|
g = filt->tbl_6_to_8[(c & GREEN_MASK565) >> 5];
|
|
|
|
b = filt->tbl_5_to_8[(c & BLUE_MASK565) ];
|
|
|
|
y = ((r << 4) + (g << 5) + (b << 2));
|
|
|
|
u = ( -r - (g << 1) + (b << 2));
|
|
|
|
v = ((r << 1) - (g << 1) - (b >> 1));
|
|
|
|
filt->RGBtoYUV[c] = y + u + v;
|
|
|
|
}
|
|
|
|
}
|
2014-04-18 18:43:34 +00:00
|
|
|
|
|
|
|
static void *twoxbr_generic_create(unsigned in_fmt, unsigned out_fmt,
|
|
|
|
unsigned max_width, unsigned max_height,
|
|
|
|
unsigned threads, softfilter_simd_mask_t simd)
|
|
|
|
{
|
|
|
|
(void)simd;
|
|
|
|
|
|
|
|
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
|
|
|
if (!filt)
|
|
|
|
return NULL;
|
|
|
|
filt->workers = (struct softfilter_thread_data*)calloc(threads, sizeof(struct softfilter_thread_data));
|
|
|
|
filt->threads = threads;
|
|
|
|
filt->in_fmt = in_fmt;
|
|
|
|
if (!filt->workers)
|
|
|
|
{
|
|
|
|
free(filt);
|
|
|
|
return NULL;
|
|
|
|
}
|
2014-05-09 14:18:08 +00:00
|
|
|
|
|
|
|
SetupFormat(filt);
|
|
|
|
|
2014-04-18 18:43:34 +00:00
|
|
|
return filt;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void twoxbr_generic_output(void *data, unsigned *out_width, unsigned *out_height,
|
|
|
|
unsigned width, unsigned height)
|
|
|
|
{
|
|
|
|
*out_width = width * TWOXBR_SCALE;
|
|
|
|
*out_height = height * TWOXBR_SCALE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void twoxbr_generic_destroy(void *data)
|
|
|
|
{
|
|
|
|
struct filter_data *filt = (struct filter_data*)data;
|
|
|
|
free(filt->workers);
|
|
|
|
free(filt);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
2014-04-18 20:57:28 +00:00
|
|
|
|
2014-04-15 22:55:09 +00:00
|
|
|
|
|
|
|
#define ALPHA_BLEND_128_W(dst, src) dst = ((src & pg_lbmask) >> 1) + ((dst & pg_lbmask) >> 1)
|
|
|
|
|
|
|
|
#define ALPHA_BLEND_32_W(dst, src) \
|
|
|
|
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))) )
|
|
|
|
|
2014-04-18 20:57:28 +00:00
|
|
|
|
|
|
|
#define ALPHA_BLEND_8888_32_W(dst, src) \
|
|
|
|
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
|
|
|
|
|
|
|
|
|
2014-04-15 22:55:09 +00:00
|
|
|
#define ALPHA_BLEND_64_W(dst, src) \
|
|
|
|
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))) )
|
|
|
|
|
2014-04-18 20:57:28 +00:00
|
|
|
#define ALPHA_BLEND_8888_64_W(dst, src) \
|
|
|
|
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
|
|
|
|
|
|
|
|
|
2014-04-15 22:55:09 +00:00
|
|
|
#define ALPHA_BLEND_192_W(dst, src) \
|
|
|
|
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))) )
|
|
|
|
|
2014-04-18 20:57:28 +00:00
|
|
|
|
|
|
|
#define ALPHA_BLEND_8888_192_W(dst, src) \
|
|
|
|
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
|
|
|
|
|
2014-04-15 22:55:09 +00:00
|
|
|
#define ALPHA_BLEND_224_W(dst, src) \
|
|
|
|
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))) );
|
2014-04-18 20:57:28 +00:00
|
|
|
|
|
|
|
#define ALPHA_BLEND_8888_224_W(dst, src) \
|
|
|
|
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
|
|
|
|
|
|
|
|
|
2014-04-15 22:55:09 +00:00
|
|
|
#define LEFT_UP_2_2X(N3, N2, N1, PIXEL)\
|
|
|
|
ALPHA_BLEND_224_W(E[N3], PIXEL); \
|
|
|
|
ALPHA_BLEND_64_W( E[N2], PIXEL); \
|
|
|
|
E[N1] = E[N2]; \
|
|
|
|
|
|
|
|
|
|
|
|
#define LEFT_2_2X(N3, N2, PIXEL)\
|
|
|
|
ALPHA_BLEND_192_W(E[N3], PIXEL); \
|
|
|
|
ALPHA_BLEND_64_W( E[N2], PIXEL); \
|
|
|
|
|
|
|
|
#define UP_2_2X(N3, N1, PIXEL)\
|
|
|
|
ALPHA_BLEND_192_W(E[N3], PIXEL); \
|
|
|
|
ALPHA_BLEND_64_W( E[N1], PIXEL); \
|
|
|
|
|
|
|
|
#define DIA_2X(N3, PIXEL)\
|
|
|
|
ALPHA_BLEND_128_W(E[N3], PIXEL); \
|
|
|
|
|
2014-04-18 20:57:28 +00:00
|
|
|
|
|
|
|
#define LEFT_UP_2_8888_2X(N3, N2, N1, PIXEL)\
|
|
|
|
ALPHA_BLEND_8888_224_W(E[N3], PIXEL); \
|
|
|
|
ALPHA_BLEND_8888_64_W( E[N2], PIXEL); \
|
|
|
|
E[N1] = E[N2]; \
|
|
|
|
|
|
|
|
|
|
|
|
#define LEFT_2_8888_2X(N3, N2, PIXEL)\
|
|
|
|
ALPHA_BLEND_8888_192_W(E[N3], PIXEL); \
|
|
|
|
ALPHA_BLEND_8888_64_W( E[N2], PIXEL); \
|
|
|
|
|
|
|
|
#define UP_2_8888_2X(N3, N1, PIXEL)\
|
|
|
|
ALPHA_BLEND_8888_192_W(E[N3], PIXEL); \
|
|
|
|
ALPHA_BLEND_8888_64_W( E[N1], PIXEL); \
|
|
|
|
|
|
|
|
#define DIA_8888_2X(N3, PIXEL)\
|
|
|
|
ALPHA_BLEND_128_W(E[N3], PIXEL); \
|
|
|
|
|
|
|
|
|
2014-05-09 14:18:08 +00:00
|
|
|
#define df(Z, A, B)\
|
|
|
|
abs(Z->RGBtoYUV[A] - Z->RGBtoYUV[B])\
|
2014-04-15 22:55:09 +00:00
|
|
|
|
2014-05-09 14:18:08 +00:00
|
|
|
#define eq(Z, A, B)\
|
|
|
|
(df(Z, A, B) < 155)\
|
2014-04-15 22:55:09 +00:00
|
|
|
|
2014-04-18 20:57:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
float df8(uint32_t A, uint32_t B, uint32_t pg_red_mask, uint32_t pg_green_mask, uint32_t pg_blue_mask)
|
|
|
|
{
|
|
|
|
uint32_t r, g, b;
|
|
|
|
uint32_t y, u, v;
|
|
|
|
|
2014-04-18 23:56:42 +00:00
|
|
|
#ifdef MSB_FIRST
|
|
|
|
r = abs((int)(((A & pg_red_mask )>>24) - ((B & pg_red_mask )>> 24)));
|
|
|
|
g = abs((int)(((A & pg_green_mask )>>16) - ((B & pg_green_mask )>> 16)));
|
|
|
|
b = abs((int)(((A & pg_blue_mask )>>8 ) - ((B & pg_blue_mask )>> 8 )));
|
|
|
|
#else
|
2014-04-18 21:31:27 +00:00
|
|
|
b = abs((int)(((A & pg_blue_mask )>>16) - ((B & pg_blue_mask )>> 16)));
|
|
|
|
g = abs((int)(((A & pg_green_mask)>>8 ) - ((B & pg_green_mask )>> 8)));
|
|
|
|
r = abs((int)(((A & pg_red_mask ) - (B & pg_red_mask ))));
|
2014-04-18 23:56:42 +00:00
|
|
|
#endif
|
2014-04-18 20:57:28 +00:00
|
|
|
|
|
|
|
y = abs(0.299*r + 0.587*g + 0.114*b);
|
|
|
|
u = abs(-0.169*r - 0.331*g + 0.500*b);
|
|
|
|
v = abs(0.500*r - 0.419*g - 0.081*b);
|
|
|
|
|
|
|
|
return 48*y + 7*u + 6*v;
|
|
|
|
}
|
|
|
|
|
|
|
|
int eq8(uint32_t A, uint32_t B, uint32_t pg_red_mask, uint32_t pg_green_mask, uint32_t pg_blue_mask)
|
|
|
|
{
|
|
|
|
uint32_t r, g, b;
|
|
|
|
uint32_t y, u, v;
|
|
|
|
|
2014-04-18 23:56:42 +00:00
|
|
|
#ifdef MSB_FIRST
|
|
|
|
r = abs((int)(((A & pg_red_mask )>>24) - ((B & pg_red_mask )>> 24)));
|
|
|
|
g = abs((int)(((A & pg_green_mask )>>16) - ((B & pg_green_mask )>> 16)));
|
|
|
|
b = abs((int)(((A & pg_blue_mask )>>8 ) - ((B & pg_blue_mask )>> 8 )));
|
|
|
|
#else
|
|
|
|
b = abs((int)(((A & pg_blue_mask )>>16) - ((B & pg_blue_mask )>> 16)));
|
|
|
|
g = abs((int)(((A & pg_green_mask)>>8 ) - ((B & pg_green_mask )>> 8)));
|
|
|
|
r = abs((int)(((A & pg_red_mask ) - (B & pg_red_mask ))));
|
|
|
|
#endif
|
2014-04-18 20:57:28 +00:00
|
|
|
|
|
|
|
y = abs(0.299*r + 0.587*g + 0.114*b);
|
|
|
|
u = abs(-0.169*r - 0.331*g + 0.500*b);
|
|
|
|
v = abs(0.500*r - 0.419*g - 0.081*b);
|
|
|
|
|
|
|
|
return ((48 >= y) && (7 >= u) && (6 >= v)) ? 1 : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-05-09 14:18:08 +00:00
|
|
|
#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) \
|
2014-04-15 22:55:09 +00:00
|
|
|
ex = (PE!=PH && PE!=PF); \
|
|
|
|
if ( ex )\
|
|
|
|
{\
|
2014-05-09 14:18:08 +00:00
|
|
|
e = (df(Z, PE,PC)+df(Z, PE,PG)+df(Z, PI,H5)+df(Z, PI,F4))+(df(Z, PH,PF)<<2); \
|
|
|
|
i = (df(Z, PH,PD)+df(Z, PH,I5)+df(Z, PF,I4)+df(Z, PF,PB))+(df(Z, PE,PI)<<2); \
|
|
|
|
if ((e<i) && ( (!eq(Z, PF,PB) && !eq(Z, PF,PC)) || (!eq(Z, PH,PD) && !eq(Z, PH,PG)) || (eq(Z, PE,PI) && ((!eq(Z, PF,F4) && !eq(Z, PF,I4)) || (!eq(Z, PH,H5) && !eq(Z, PH,I5)))) || eq(Z, PE,PG) || eq(Z, PE,PC)) )\
|
2014-04-15 22:55:09 +00:00
|
|
|
{\
|
2014-05-09 14:18:08 +00:00
|
|
|
ke=df(Z, PF,PG); \
|
|
|
|
ki=df(Z, PH,PC); \
|
|
|
|
ex2 = (PE!=PC && PB!=PC); ex3 = (PE!=PG && PD!=PG); px = (df(Z, PE,PF) <= df(Z, PE,PH)) ? PF : PH; \
|
2014-04-15 22:55:09 +00:00
|
|
|
if ( ((ke<<1)<=ki) && ex3 && (ke>=(ki<<1)) && ex2 ) \
|
|
|
|
{\
|
|
|
|
LEFT_UP_2_2X(N3, N2, N1, px)\
|
|
|
|
}\
|
|
|
|
else if ( ((ke<<1)<=ki) && ex3 ) \
|
|
|
|
{\
|
|
|
|
LEFT_2_2X(N3, N2, px);\
|
|
|
|
}\
|
|
|
|
else if ( (ke>=(ki<<1)) && ex2 ) \
|
|
|
|
{\
|
|
|
|
UP_2_2X(N3, N1, px);\
|
|
|
|
}\
|
|
|
|
else \
|
|
|
|
{\
|
|
|
|
DIA_2X(N3, px);\
|
|
|
|
}\
|
|
|
|
}\
|
|
|
|
else if (e<=i)\
|
|
|
|
{\
|
2014-05-09 14:18:08 +00:00
|
|
|
ALPHA_BLEND_128_W( E[N3], ((df(Z, PE,PF) <= df(Z, PE,PH)) ? PF : PH)); \
|
2014-04-15 22:55:09 +00:00
|
|
|
}\
|
|
|
|
}\
|
|
|
|
|
2014-05-09 14:18:08 +00:00
|
|
|
#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) \
|
2014-04-18 20:57:28 +00:00
|
|
|
ex = (PE!=PH && PE!=PF); \
|
|
|
|
if ( ex )\
|
|
|
|
{\
|
|
|
|
e = (df8(PE,PC, pg_red_mask, pg_green_mask, pg_blue_mask ) + df8(PE,PG, pg_red_mask, pg_green_mask, pg_blue_mask) + \
|
|
|
|
df8(PI,H5, pg_red_mask, pg_green_mask, pg_blue_mask ) + df8(PI,F4, pg_red_mask, pg_green_mask, pg_blue_mask))+(4 * (df8(PH,PF, pg_red_mask, pg_green_mask, pg_blue_mask))); \
|
|
|
|
i = (df8(PH,PD, pg_red_mask, pg_green_mask, pg_blue_mask) + df8(PH,I5, pg_red_mask, pg_green_mask, pg_blue_mask) + \
|
|
|
|
df8(PF,I4, pg_red_mask, pg_green_mask, pg_blue_mask) + df8(PF,PB, pg_red_mask, pg_green_mask, pg_blue_mask))+(4 * (df8(PE,PI, pg_red_mask, pg_green_mask, pg_blue_mask))); \
|
|
|
|
if ((e<i) && ( (!eq8(PF,PB, pg_red_mask, pg_green_mask, pg_blue_mask) && !eq8(PF,PC, pg_red_mask, pg_green_mask, pg_blue_mask)) || (!eq8(PH,PD, pg_red_mask, pg_green_mask, pg_blue_mask) && !eq8(PH,PG, pg_red_mask, pg_green_mask, pg_blue_mask)) || (eq8(PE,PI, pg_red_mask, pg_green_mask, pg_blue_mask) && ((!eq8(PF,F4, pg_red_mask, pg_green_mask, pg_blue_mask) && !eq8(PF,I4, pg_red_mask, pg_green_mask, pg_blue_mask)) || (!eq8(PH,H5, pg_red_mask, pg_green_mask,pg_blue_mask) && !eq8(PH,I5, pg_red_mask, pg_green_mask, pg_blue_mask)))) || eq8(PE,PG, pg_red_mask, pg_green_mask, pg_blue_mask) || eq8(PE,PC, pg_red_mask, pg_green_mask, pg_blue_mask)) )\
|
|
|
|
{\
|
|
|
|
ke=df8(PF,PG, pg_red_mask, pg_green_mask, pg_blue_mask); ki=df8(PH,PC, pg_red_mask, pg_green_mask, pg_blue_mask); \
|
|
|
|
ex2 = (PE!=PC && PB!=PC); ex3 = (PE!=PG && PD!=PG); px = (df8(PE,PF, pg_red_mask, pg_green_mask, pg_blue_mask) <= df8(PE,PH, pg_red_mask, pg_green_mask, pg_blue_mask)) ? PF : PH; \
|
|
|
|
if ( ((ke<<1)<=ki) && ex3 && (ke>=(ki<<1)) && ex2 ) \
|
|
|
|
{\
|
|
|
|
LEFT_UP_2_8888_2X(N3, N2, N1, px)\
|
|
|
|
}\
|
|
|
|
else if ( ((ke<<1)<=ki) && ex3 ) \
|
|
|
|
{\
|
|
|
|
LEFT_2_8888_2X(N3, N2, px);\
|
|
|
|
}\
|
|
|
|
else if ( (ke>=(ki<<1)) && ex2 ) \
|
|
|
|
{\
|
|
|
|
UP_2_8888_2X(N3, N1, px);\
|
|
|
|
}\
|
|
|
|
else \
|
|
|
|
{\
|
|
|
|
DIA_8888_2X(N3, px);\
|
|
|
|
}\
|
|
|
|
}\
|
|
|
|
else if (e<=i)\
|
|
|
|
{\
|
|
|
|
ALPHA_BLEND_128_W( E[N3], ((df8(PE,PF, pg_red_mask, pg_green_mask, pg_blue_mask) <= df8(PE,PH, pg_red_mask, pg_green_mask, pg_blue_mask)) ? PF : PH)); \
|
|
|
|
}\
|
|
|
|
}\
|
2014-04-18 18:43:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define twoxbr_declare_variables(typename_t, in, nextline) \
|
|
|
|
typename_t E[4]; \
|
|
|
|
typename_t ex, e, i, ke, ki, ex2, ex3, px; \
|
|
|
|
typename_t A1 = *(in - nextline - nextline - 1); \
|
|
|
|
typename_t B1 = *(in - nextline - nextline); \
|
|
|
|
typename_t C1 = *(in - nextline - nextline + 1); \
|
|
|
|
typename_t A0 = *(in - nextline - 2); \
|
|
|
|
typename_t PA = *(in - nextline - 1); \
|
|
|
|
typename_t PB = *(in - nextline); \
|
|
|
|
typename_t PC = *(in - nextline + 1); \
|
|
|
|
typename_t C4 = *(in - nextline + 2); \
|
|
|
|
typename_t D0 = *(in - 2); \
|
|
|
|
typename_t PD = *(in - 1); \
|
|
|
|
typename_t PE = *(in); \
|
|
|
|
typename_t PF = *(in + 1); \
|
|
|
|
typename_t F4 = *(in + 2); \
|
|
|
|
typename_t G0 = *(in + nextline - 2); \
|
|
|
|
typename_t PG = *(in + nextline - 1); \
|
|
|
|
typename_t PH = *(in + nextline); \
|
|
|
|
typename_t PI = *(in + nextline + 1); \
|
|
|
|
typename_t I4 = *(in + nextline + 2); \
|
|
|
|
typename_t G5 = *(in + nextline + nextline - 1); \
|
|
|
|
typename_t H5 = *(in + nextline + nextline); \
|
|
|
|
typename_t I5 = *(in + nextline + nextline + 1); \
|
|
|
|
|
|
|
|
#ifndef twoxbr_function
|
2014-05-09 14:18:08 +00:00
|
|
|
#define twoxbr_function(FILTRO, Z) \
|
2014-04-18 18:43:34 +00:00
|
|
|
E[0] = E[1] = E[2] = E[3] = PE;\
|
2014-05-09 14:18:08 +00:00
|
|
|
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);\
|
2014-04-18 18:43:34 +00:00
|
|
|
out[0] = E[0]; \
|
|
|
|
out[1] = E[1]; \
|
|
|
|
out[dst_stride] = E[2]; \
|
|
|
|
out[dst_stride + 1] = E[3]; \
|
|
|
|
++in; \
|
|
|
|
out += 2
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2014-05-09 14:18:08 +00:00
|
|
|
static void twoxbr_generic_xrgb8888(void *data, unsigned width, unsigned height,
|
2014-04-18 18:43:34 +00:00
|
|
|
int first, int last, uint32_t *src,
|
|
|
|
unsigned src_stride, uint32_t *dst, unsigned dst_stride)
|
2014-04-15 22:55:09 +00:00
|
|
|
{
|
2014-05-09 14:18:08 +00:00
|
|
|
unsigned nextline, finish;
|
|
|
|
struct filter_data *filt = (struct filter_data*)data;
|
2014-04-18 20:57:28 +00:00
|
|
|
uint32_t pg_red_mask = RED_MASK8888;
|
|
|
|
uint32_t pg_green_mask = GREEN_MASK8888;
|
|
|
|
uint32_t pg_blue_mask = BLUE_MASK8888;
|
|
|
|
uint32_t pg_lbmask = PG_LBMASK8888;
|
|
|
|
uint32_t pg_alpha_mask = ALPHA_MASK8888;
|
2014-05-09 14:18:08 +00:00
|
|
|
|
2014-04-18 18:43:34 +00:00
|
|
|
nextline = (last) ? 0 : src_stride;
|
2014-04-18 20:57:28 +00:00
|
|
|
|
2014-04-18 18:43:34 +00:00
|
|
|
for (; height; height--)
|
2014-04-15 22:55:09 +00:00
|
|
|
{
|
2014-04-18 18:43:34 +00:00
|
|
|
uint32_t *in = (uint32_t*)src;
|
|
|
|
uint32_t *out = (uint32_t*)dst;
|
|
|
|
|
|
|
|
for (finish = width; finish; finish -= 1)
|
2014-04-15 22:55:09 +00:00
|
|
|
{
|
2014-04-18 18:43:34 +00:00
|
|
|
twoxbr_declare_variables(uint32_t, in, nextline);
|
|
|
|
|
|
|
|
//---------------------------------------
|
|
|
|
// Map of the pixels: A1 B1 C1
|
|
|
|
// A0 PA PB PC C4
|
|
|
|
// D0 PD PE PF F4
|
|
|
|
// G0 PG PH PI I4
|
|
|
|
// G5 H5 I5
|
|
|
|
|
2014-05-09 14:18:08 +00:00
|
|
|
twoxbr_function(FILTRO_RGB8888, filt);
|
2014-04-15 22:55:09 +00:00
|
|
|
}
|
2014-04-18 18:43:34 +00:00
|
|
|
|
|
|
|
src += src_stride;
|
|
|
|
dst += 2 * dst_stride;
|
2014-04-15 22:55:09 +00:00
|
|
|
}
|
|
|
|
}
|
2014-04-18 18:43:34 +00:00
|
|
|
|
2014-05-09 14:18:08 +00:00
|
|
|
static void twoxbr_generic_rgb565(void *data, unsigned width, unsigned height,
|
2014-04-18 18:43:34 +00:00
|
|
|
int first, int last, uint16_t *src,
|
|
|
|
unsigned src_stride, uint16_t *dst, unsigned dst_stride)
|
2014-04-15 22:55:09 +00:00
|
|
|
{
|
2014-04-18 21:31:27 +00:00
|
|
|
uint16_t pg_red_mask, pg_green_mask, pg_blue_mask, pg_lbmask;
|
2014-04-18 18:43:34 +00:00
|
|
|
unsigned nextline, finish;
|
2014-05-09 14:18:08 +00:00
|
|
|
struct filter_data *filt = (struct filter_data*)data;
|
2014-04-18 21:31:27 +00:00
|
|
|
|
|
|
|
pg_red_mask = RED_MASK565;
|
|
|
|
pg_green_mask = GREEN_MASK565;
|
|
|
|
pg_blue_mask = BLUE_MASK565;
|
|
|
|
pg_lbmask = PG_LBMASK565;
|
2014-04-18 18:43:34 +00:00
|
|
|
nextline = (last) ? 0 : src_stride;
|
|
|
|
|
|
|
|
|
|
|
|
for (; height; height--)
|
2014-04-15 22:55:09 +00:00
|
|
|
{
|
2014-04-18 18:43:34 +00:00
|
|
|
uint16_t *in = (uint16_t*)src;
|
|
|
|
uint16_t *out = (uint16_t*)dst;
|
|
|
|
|
|
|
|
for (finish = width; finish; finish -= 1)
|
|
|
|
{
|
|
|
|
twoxbr_declare_variables(uint16_t, in, nextline);
|
|
|
|
|
|
|
|
//---------------------------------------
|
|
|
|
// Map of the pixels: A1 B1 C1
|
|
|
|
// A0 PA PB PC C4
|
|
|
|
// D0 PD PE PF F4
|
|
|
|
// G0 PG PH PI I4
|
|
|
|
// G5 H5 I5
|
|
|
|
|
2014-05-09 14:18:08 +00:00
|
|
|
twoxbr_function(FILTRO_RGB565, filt);
|
2014-04-18 18:43:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
src += src_stride;
|
|
|
|
dst += 2 * dst_stride;
|
2014-04-15 22:55:09 +00:00
|
|
|
}
|
|
|
|
}
|
2014-04-18 18:43:34 +00:00
|
|
|
|
2014-04-16 00:09:09 +00:00
|
|
|
static void twoxbr_work_cb_rgb565(void *data, void *thread_data)
|
2014-04-15 22:55:09 +00:00
|
|
|
{
|
2014-04-16 00:09:09 +00:00
|
|
|
struct softfilter_thread_data *thr = (struct softfilter_thread_data*)thread_data;
|
2014-04-18 18:43:34 +00:00
|
|
|
uint16_t *input = (uint16_t*)thr->in_data;
|
2014-04-15 22:55:09 +00:00
|
|
|
uint16_t *output = (uint16_t*)thr->out_data;
|
|
|
|
unsigned width = thr->width;
|
|
|
|
unsigned height = thr->height;
|
2014-04-18 18:43:34 +00:00
|
|
|
|
2014-05-09 14:18:08 +00:00
|
|
|
twoxbr_generic_rgb565(data, width, height,
|
2014-04-18 18:43:34 +00:00
|
|
|
thr->first, thr->last, input, thr->in_pitch / SOFTFILTER_BPP_RGB565, output, thr->out_pitch / SOFTFILTER_BPP_RGB565);
|
2014-04-15 22:55:09 +00:00
|
|
|
}
|
2014-04-18 18:43:34 +00:00
|
|
|
|
|
|
|
static void twoxbr_work_cb_xrgb8888(void *data, void *thread_data)
|
|
|
|
{
|
|
|
|
struct softfilter_thread_data *thr = (struct softfilter_thread_data*)thread_data;
|
|
|
|
uint32_t *input = (uint32_t*)thr->in_data;
|
|
|
|
uint32_t *output = (uint32_t*)thr->out_data;
|
|
|
|
unsigned width = thr->width;
|
|
|
|
unsigned height = thr->height;
|
|
|
|
|
2014-05-09 14:18:08 +00:00
|
|
|
twoxbr_generic_xrgb8888(data, width, height,
|
2014-04-18 18:43:34 +00:00
|
|
|
thr->first, thr->last, input, thr->in_pitch / SOFTFILTER_BPP_XRGB8888, output, thr->out_pitch / SOFTFILTER_BPP_XRGB8888);
|
|
|
|
}
|
|
|
|
|
2014-04-15 22:55:09 +00:00
|
|
|
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)
|
|
|
|
{
|
|
|
|
struct filter_data *filt = (struct filter_data*)data;
|
|
|
|
unsigned i;
|
|
|
|
for (i = 0; i < filt->threads; i++)
|
|
|
|
{
|
2014-04-16 00:09:09 +00:00
|
|
|
struct softfilter_thread_data *thr = (struct softfilter_thread_data*)&filt->workers[i];
|
2014-04-18 18:43:34 +00:00
|
|
|
|
2014-04-15 22:55:09 +00:00
|
|
|
unsigned y_start = (height * i) / filt->threads;
|
|
|
|
unsigned y_end = (height * (i + 1)) / filt->threads;
|
|
|
|
thr->out_data = (uint8_t*)output + y_start * TWOXBR_SCALE * output_stride;
|
|
|
|
thr->in_data = (const uint8_t*)input + y_start * input_stride;
|
|
|
|
thr->out_pitch = output_stride;
|
|
|
|
thr->in_pitch = input_stride;
|
|
|
|
thr->width = width;
|
|
|
|
thr->height = y_end - y_start;
|
2014-04-18 18:43:34 +00:00
|
|
|
|
2014-04-15 22:55:09 +00:00
|
|
|
// Workers need to know if they can access pixels outside their given buffer.
|
|
|
|
thr->first = y_start;
|
|
|
|
thr->last = y_end == height;
|
2014-04-18 18:43:34 +00:00
|
|
|
|
2014-04-15 22:55:09 +00:00
|
|
|
if (filt->in_fmt == SOFTFILTER_FMT_RGB565)
|
2014-04-16 00:09:09 +00:00
|
|
|
packets[i].work = twoxbr_work_cb_rgb565;
|
2014-04-18 18:43:34 +00:00
|
|
|
//else if (filt->in_fmt == SOFTFILTER_FMT_RGB4444)
|
|
|
|
//packets[i].work = twoxbr_work_cb_rgb4444;
|
2014-04-18 20:57:28 +00:00
|
|
|
else if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888)
|
|
|
|
packets[i].work = twoxbr_work_cb_xrgb8888;
|
2014-04-15 22:55:09 +00:00
|
|
|
packets[i].thread_data = thr;
|
|
|
|
}
|
|
|
|
}
|
2014-04-18 18:43:34 +00:00
|
|
|
|
2014-04-15 22:55:09 +00:00
|
|
|
static const struct softfilter_implementation twoxbr_generic = {
|
|
|
|
twoxbr_generic_input_fmts,
|
|
|
|
twoxbr_generic_output_fmts,
|
2014-04-18 18:43:34 +00:00
|
|
|
|
2014-04-15 22:55:09 +00:00
|
|
|
twoxbr_generic_create,
|
|
|
|
twoxbr_generic_destroy,
|
2014-04-18 18:43:34 +00:00
|
|
|
|
2014-04-15 22:55:09 +00:00
|
|
|
twoxbr_generic_threads,
|
|
|
|
twoxbr_generic_output,
|
|
|
|
twoxbr_generic_packets,
|
|
|
|
"2xBR",
|
|
|
|
SOFTFILTER_API_VERSION,
|
|
|
|
};
|
2014-04-18 18:43:34 +00:00
|
|
|
|
2014-04-15 22:55:09 +00:00
|
|
|
const struct softfilter_implementation *softfilter_get_implementation(softfilter_simd_mask_t simd)
|
|
|
|
{
|
|
|
|
(void)simd;
|
|
|
|
return &twoxbr_generic;
|
|
|
|
}
|
2014-04-18 18:43:34 +00:00
|
|
|
|
2014-04-16 00:09:09 +00:00
|
|
|
#ifdef RARCH_INTERNAL
|
|
|
|
#undef softfilter_get_implementation
|
2014-05-09 14:18:08 +00:00
|
|
|
#undef softfilter_thread_data
|
|
|
|
#undef filter_data
|
2014-04-16 00:09:09 +00:00
|
|
|
#endif
|