diff options
Diffstat (limited to 'graphics/scaler/scale3x.cpp')
-rw-r--r-- | graphics/scaler/scale3x.cpp | 71 |
1 files changed, 30 insertions, 41 deletions
diff --git a/graphics/scaler/scale3x.cpp b/graphics/scaler/scale3x.cpp index 8aa33dd170..4e78796ee7 100644 --- a/graphics/scaler/scale3x.cpp +++ b/graphics/scaler/scale3x.cpp @@ -37,13 +37,10 @@ #include "graphics/scaler/intern.h" #include "graphics/scaler/scale3x.h" -#include <assert.h> - /***************************************************************************/ /* Scale3x C implementation */ -static inline void scale3x_8_def_border(scale3x_uint8* __restrict__ dst, const scale3x_uint8* __restrict__ src0, const scale3x_uint8* __restrict__ src1, const scale3x_uint8* __restrict__ src2, unsigned count) -{ +static inline void scale3x_8_def_border(scale3x_uint8* __restrict__ dst, const scale3x_uint8* __restrict__ src0, const scale3x_uint8* __restrict__ src1, const scale3x_uint8* __restrict__ src2, unsigned count) { /* central pixels */ while (count) { if (src0[0] != src2[0] && src1[-1] != src1[1]) { @@ -64,8 +61,7 @@ static inline void scale3x_8_def_border(scale3x_uint8* __restrict__ dst, const s } } -static inline void scale3x_8_def_center(scale3x_uint8* __restrict__ dst, const scale3x_uint8* __restrict__ src0, const scale3x_uint8* __restrict__ src1, const scale3x_uint8* __restrict__ src2, unsigned count) -{ +static inline void scale3x_8_def_center(scale3x_uint8* __restrict__ dst, const scale3x_uint8* __restrict__ src0, const scale3x_uint8* __restrict__ src1, const scale3x_uint8* __restrict__ src2, unsigned count) { /* central pixels */ while (count) { if (src0[0] != src2[0] && src1[-1] != src1[1]) { @@ -86,8 +82,7 @@ static inline void scale3x_8_def_center(scale3x_uint8* __restrict__ dst, const s } } -static inline void scale3x_16_def_border(scale3x_uint16* __restrict__ dst, const scale3x_uint16* __restrict__ src0, const scale3x_uint16* __restrict__ src1, const scale3x_uint16* __restrict__ src2, unsigned count) -{ +static inline void scale3x_16_def_border(scale3x_uint16* __restrict__ dst, const scale3x_uint16* __restrict__ src0, const scale3x_uint16* __restrict__ src1, const scale3x_uint16* __restrict__ src2, unsigned count) { /* central pixels */ while (count) { if (src0[0] != src2[0] && src1[-1] != src1[1]) { @@ -108,8 +103,7 @@ static inline void scale3x_16_def_border(scale3x_uint16* __restrict__ dst, const } } -static inline void scale3x_16_def_center(scale3x_uint16* __restrict__ dst, const scale3x_uint16* __restrict__ src0, const scale3x_uint16* __restrict__ src1, const scale3x_uint16* __restrict__ src2, unsigned count) -{ +static inline void scale3x_16_def_center(scale3x_uint16* __restrict__ dst, const scale3x_uint16* __restrict__ src0, const scale3x_uint16* __restrict__ src1, const scale3x_uint16* __restrict__ src2, unsigned count) { /* central pixels */ while (count) { if (src0[0] != src2[0] && src1[-1] != src1[1]) { @@ -130,8 +124,7 @@ static inline void scale3x_16_def_center(scale3x_uint16* __restrict__ dst, const } } -static inline void scale3x_32_def_border(scale3x_uint32* __restrict__ dst, const scale3x_uint32* __restrict__ src0, const scale3x_uint32* __restrict__ src1, const scale3x_uint32* __restrict__ src2, unsigned count) -{ +static inline void scale3x_32_def_border(scale3x_uint32* __restrict__ dst, const scale3x_uint32* __restrict__ src0, const scale3x_uint32* __restrict__ src1, const scale3x_uint32* __restrict__ src2, unsigned count) { /* central pixels */ while (count) { if (src0[0] != src2[0] && src1[-1] != src1[1]) { @@ -152,8 +145,7 @@ static inline void scale3x_32_def_border(scale3x_uint32* __restrict__ dst, const } } -static inline void scale3x_32_def_center(scale3x_uint32* __restrict__ dst, const scale3x_uint32* __restrict__ src0, const scale3x_uint32* __restrict__ src1, const scale3x_uint32* __restrict__ src2, unsigned count) -{ +static inline void scale3x_32_def_center(scale3x_uint32* __restrict__ dst, const scale3x_uint32* __restrict__ src0, const scale3x_uint32* __restrict__ src1, const scale3x_uint32* __restrict__ src2, unsigned count) { /* central pixels */ while (count) { if (src0[0] != src2[0] && src1[-1] != src1[1]) { @@ -179,17 +171,16 @@ static inline void scale3x_32_def_center(scale3x_uint32* __restrict__ dst, const * The function is implemented in C. * The pixels over the left and right borders are assumed of the same color of * the pixels on the border. - * \param src0 Pointer at the first pixel of the previous row. - * \param src1 Pointer at the first pixel of the current row. - * \param src2 Pointer at the first pixel of the next row. - * \param count Length in pixels of the src0, src1 and src2 rows. + * @param src0 Pointer at the first pixel of the previous row. + * @param src1 Pointer at the first pixel of the current row. + * @param src2 Pointer at the first pixel of the next row. + * @param count Length in pixels of the src0, src1 and src2 rows. * It must be at least 2. - * \param dst0 First destination row, triple length in pixels. - * \param dst1 Second destination row, triple length in pixels. - * \param dst2 Third destination row, triple length in pixels. + * @param dst0 First destination row, triple length in pixels. + * @param dst1 Second destination row, triple length in pixels. + * @param dst2 Third destination row, triple length in pixels. */ -void scale3x_8_def(scale3x_uint8* dst0, scale3x_uint8* dst1, scale3x_uint8* dst2, const scale3x_uint8* src0, const scale3x_uint8* src1, const scale3x_uint8* src2, unsigned count) -{ +void scale3x_8_def(scale3x_uint8* dst0, scale3x_uint8* dst1, scale3x_uint8* dst2, const scale3x_uint8* src0, const scale3x_uint8* src1, const scale3x_uint8* src2, unsigned count) { scale3x_8_def_border(dst0, src0, src1, src2, count); scale3x_8_def_center(dst1, src0, src1, src2, count); scale3x_8_def_border(dst2, src2, src1, src0, count); @@ -198,17 +189,16 @@ void scale3x_8_def(scale3x_uint8* dst0, scale3x_uint8* dst1, scale3x_uint8* dst2 /** * Scale by a factor of 3 a row of pixels of 16 bits. * This function operates like scale3x_8_def() but for 16 bits pixels. - * \param src0 Pointer at the first pixel of the previous row. - * \param src1 Pointer at the first pixel of the current row. - * \param src2 Pointer at the first pixel of the next row. - * \param count Length in pixels of the src0, src1 and src2 rows. + * @param src0 Pointer at the first pixel of the previous row. + * @param src1 Pointer at the first pixel of the current row. + * @param src2 Pointer at the first pixel of the next row. + * @param count Length in pixels of the src0, src1 and src2 rows. * It must be at least 2. - * \param dst0 First destination row, triple length in pixels. - * \param dst1 Second destination row, triple length in pixels. - * \param dst2 Third destination row, triple length in pixels. + * @param dst0 First destination row, triple length in pixels. + * @param dst1 Second destination row, triple length in pixels. + * @param dst2 Third destination row, triple length in pixels. */ -void scale3x_16_def(scale3x_uint16* dst0, scale3x_uint16* dst1, scale3x_uint16* dst2, const scale3x_uint16* src0, const scale3x_uint16* src1, const scale3x_uint16* src2, unsigned count) -{ +void scale3x_16_def(scale3x_uint16* dst0, scale3x_uint16* dst1, scale3x_uint16* dst2, const scale3x_uint16* src0, const scale3x_uint16* src1, const scale3x_uint16* src2, unsigned count) { scale3x_16_def_border(dst0, src0, src1, src2, count); scale3x_16_def_center(dst1, src0, src1, src2, count); scale3x_16_def_border(dst2, src2, src1, src0, count); @@ -217,17 +207,16 @@ void scale3x_16_def(scale3x_uint16* dst0, scale3x_uint16* dst1, scale3x_uint16* /** * Scale by a factor of 3 a row of pixels of 32 bits. * This function operates like scale3x_8_def() but for 32 bits pixels. - * \param src0 Pointer at the first pixel of the previous row. - * \param src1 Pointer at the first pixel of the current row. - * \param src2 Pointer at the first pixel of the next row. - * \param count Length in pixels of the src0, src1 and src2 rows. + * @param src0 Pointer at the first pixel of the previous row. + * @param src1 Pointer at the first pixel of the current row. + * @param src2 Pointer at the first pixel of the next row. + * @param count Length in pixels of the src0, src1 and src2 rows. * It must be at least 2. - * \param dst0 First destination row, triple length in pixels. - * \param dst1 Second destination row, triple length in pixels. - * \param dst2 Third destination row, triple length in pixels. + * @param dst0 First destination row, triple length in pixels. + * @param dst1 Second destination row, triple length in pixels. + * @param dst2 Third destination row, triple length in pixels. */ -void scale3x_32_def(scale3x_uint32* dst0, scale3x_uint32* dst1, scale3x_uint32* dst2, const scale3x_uint32* src0, const scale3x_uint32* src1, const scale3x_uint32* src2, unsigned count) -{ +void scale3x_32_def(scale3x_uint32* dst0, scale3x_uint32* dst1, scale3x_uint32* dst2, const scale3x_uint32* src0, const scale3x_uint32* src1, const scale3x_uint32* src2, unsigned count) { scale3x_32_def_border(dst0, src0, src1, src2, count); scale3x_32_def_center(dst1, src0, src1, src2, count); scale3x_32_def_border(dst2, src2, src1, src0, count); |