(SoftFilters) Cleanup scale2x.c
This commit is contained in:
parent
7d1de6a319
commit
aa3cdb4e05
|
@ -24,10 +24,10 @@
|
|||
|
||||
#define SCALE2X_SCALE 2
|
||||
|
||||
#define SCALE2X_GENERIC(width, height, first, last, src, src_stride, dst, dst_stride) \
|
||||
#define SCALE2X_GENERIC(typename_t, width, height, first, last, src, src_stride, dst, dst_stride) \
|
||||
unsigned x, y; \
|
||||
TYPENAME *out0 = (TYPENAME*)dst; \
|
||||
TYPENAME *out1 = (TYPENAME*)(dst + dst_stride); \
|
||||
typename_t *out0 = (typename_t*)dst; \
|
||||
typename_t *out1 = (typename_t*)(dst + dst_stride); \
|
||||
\
|
||||
for (y = 0; y < height; ++y) \
|
||||
{ \
|
||||
|
@ -36,11 +36,11 @@
|
|||
\
|
||||
for (x = 0; x < width; ++x) \
|
||||
{ \
|
||||
const TYPENAME A = *(src - prevline); \
|
||||
const TYPENAME B = (x > 0) ? *(src - 1) : *src; \
|
||||
const TYPENAME C = *src; \
|
||||
const TYPENAME D = (x < width - 1) ? *(src + 1) : *src; \
|
||||
const TYPENAME E = *(src++ + nextline); \
|
||||
const typename_t A = *(src - prevline); \
|
||||
const typename_t B = (x > 0) ? *(src - 1) : *src; \
|
||||
const typename_t C = *src; \
|
||||
const typename_t D = (x < width - 1) ? *(src + 1) : *src; \
|
||||
const typename_t E = *(src++ + nextline); \
|
||||
\
|
||||
if (A != E && B != D) \
|
||||
{ \
|
||||
|
@ -68,9 +68,7 @@ static void scale2x_generic_rgb565(unsigned width, unsigned height,
|
|||
const uint16_t *src, unsigned src_stride,
|
||||
uint16_t *dst, unsigned dst_stride)
|
||||
{
|
||||
#define TYPENAME uint16_t
|
||||
SCALE2X_GENERIC(width, height, first, last, src, src_stride, dst, dst_stride);
|
||||
#undef TYPENAME
|
||||
SCALE2X_GENERIC(uint16_t, width, height, first, last, src, src_stride, dst, dst_stride);
|
||||
}
|
||||
|
||||
static void scale2x_generic_xrgb8888(unsigned width, unsigned height,
|
||||
|
@ -78,9 +76,7 @@ static void scale2x_generic_xrgb8888(unsigned width, unsigned height,
|
|||
const uint32_t *src, unsigned src_stride,
|
||||
uint32_t *dst, unsigned dst_stride)
|
||||
{
|
||||
#define TYPENAME uint32_t
|
||||
SCALE2X_GENERIC(width, height, first, last, src, src_stride, dst, dst_stride);
|
||||
#undef TYPENAME
|
||||
SCALE2X_GENERIC(uint32_t, width, height, first, last, src, src_stride, dst, dst_stride);
|
||||
}
|
||||
|
||||
static unsigned scale2x_generic_input_fmts(void)
|
||||
|
|
Loading…
Reference in New Issue