GRAPHICS: Add 32bpp color support for HQ scalers

This implementation uses 16bpp rgb conversion to lookup Yuv values. A
different implementation will need to edit ConvertYUV and InitLUT
accordingly.
This commit is contained in:
Eric Culp 2012-06-19 18:03:17 -04:00 committed by Filippos Karapetis
parent b08da82253
commit 4432c5a4d1

View File

@ -130,75 +130,104 @@ void HQ2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
#else
#define interpolate_1_1(a,b) (ColorMask::kBytesPerPixel == 2 ? interpolate16_1_1<ColorMask>(a,b) : interpolate32_1_1<ColorMask>(a,b))
#define interpolate_3_1(a,b) (ColorMask::kBytesPerPixel == 2 ? interpolate16_3_1<ColorMask>(a,b) : interpolate32_3_1<ColorMask>(a,b))
#define interpolate_7_1(a,b) (ColorMask::kBytesPerPixel == 2 ? interpolate16_7_1<ColorMask>(a,b) : interpolate32_7_1<ColorMask>(a,b))
#define interpolate_2_1_1(a,b,c) (ColorMask::kBytesPerPixel == 2 ? interpolate16_2_1_1<ColorMask>(a,b,c) : interpolate32_2_1_1<ColorMask>(a,b,c))
#define interpolate_2_3_3(a,b,c) (ColorMask::kBytesPerPixel == 2 ? interpolate16_2_3_3<ColorMask>(a,b,c) : interpolate32_2_3_3<ColorMask>(a,b,c))
#define interpolate_2_7_7(a,b,c) (ColorMask::kBytesPerPixel == 2 ? interpolate16_2_7_7<ColorMask>(a,b,c) : interpolate32_2_7_7<ColorMask>(a,b,c))
#define interpolate_5_2_1(a,b,c) (ColorMask::kBytesPerPixel == 2 ? interpolate16_5_2_1<ColorMask>(a,b,c) : interpolate32_5_2_1<ColorMask>(a,b,c))
#define interpolate_6_1_1(a,b,c) (ColorMask::kBytesPerPixel == 2 ? interpolate16_6_1_1<ColorMask>(a,b,c) : interpolate32_6_1_1<ColorMask>(a,b,c))
#define interpolate_14_1_1(a,b,c) (ColorMask::kBytesPerPixel == 2 ? interpolate16_14_1_1<ColorMask>(a,b,c) : interpolate32_14_1_1<ColorMask>(a,b,c))
#define interpolate_1_1_1_1(a,b,c,d) (ColorMask::kBytesPerPixel == 2 ? interpolate16_1_1_1_1<ColorMask>(a,b,c,d) : interpolate32_1_1_1_1<ColorMask>(a,b,c,d))
#define PIXEL00_0 *(q) = w5;
#define PIXEL00_10 *(q) = interpolate16_3_1<ColorMask >(w5, w1);
#define PIXEL00_11 *(q) = interpolate16_3_1<ColorMask >(w5, w4);
#define PIXEL00_12 *(q) = interpolate16_3_1<ColorMask >(w5, w2);
#define PIXEL00_20 *(q) = interpolate16_2_1_1<ColorMask >(w5, w4, w2);
#define PIXEL00_21 *(q) = interpolate16_2_1_1<ColorMask >(w5, w1, w2);
#define PIXEL00_22 *(q) = interpolate16_2_1_1<ColorMask >(w5, w1, w4);
#define PIXEL00_60 *(q) = interpolate16_5_2_1<ColorMask >(w5, w2, w4);
#define PIXEL00_61 *(q) = interpolate16_5_2_1<ColorMask >(w5, w4, w2);
#define PIXEL00_70 *(q) = interpolate16_6_1_1<ColorMask >(w5, w4, w2);
#define PIXEL00_90 *(q) = interpolate16_2_3_3<ColorMask >(w5, w4, w2);
#define PIXEL00_100 *(q) = interpolate16_14_1_1<ColorMask >(w5, w4, w2);
#define PIXEL00_10 *(q) = interpolate_3_1(w5, w1);
#define PIXEL00_11 *(q) = interpolate_3_1(w5, w4);
#define PIXEL00_12 *(q) = interpolate_3_1(w5, w2);
#define PIXEL00_20 *(q) = interpolate_2_1_1(w5, w4, w2);
#define PIXEL00_21 *(q) = interpolate_2_1_1(w5, w1, w2);
#define PIXEL00_22 *(q) = interpolate_2_1_1(w5, w1, w4);
#define PIXEL00_60 *(q) = interpolate_5_2_1(w5, w2, w4);
#define PIXEL00_61 *(q) = interpolate_5_2_1(w5, w4, w2);
#define PIXEL00_70 *(q) = interpolate_6_1_1(w5, w4, w2);
#define PIXEL00_90 *(q) = interpolate_2_3_3(w5, w4, w2);
#define PIXEL00_100 *(q) = interpolate_14_1_1(w5, w4, w2);
#define PIXEL01_0 *(q+1) = w5;
#define PIXEL01_10 *(q+1) = interpolate16_3_1<ColorMask >(w5, w3);
#define PIXEL01_11 *(q+1) = interpolate16_3_1<ColorMask >(w5, w2);
#define PIXEL01_12 *(q+1) = interpolate16_3_1<ColorMask >(w5, w6);
#define PIXEL01_20 *(q+1) = interpolate16_2_1_1<ColorMask >(w5, w2, w6);
#define PIXEL01_21 *(q+1) = interpolate16_2_1_1<ColorMask >(w5, w3, w6);
#define PIXEL01_22 *(q+1) = interpolate16_2_1_1<ColorMask >(w5, w3, w2);
#define PIXEL01_60 *(q+1) = interpolate16_5_2_1<ColorMask >(w5, w6, w2);
#define PIXEL01_61 *(q+1) = interpolate16_5_2_1<ColorMask >(w5, w2, w6);
#define PIXEL01_70 *(q+1) = interpolate16_6_1_1<ColorMask >(w5, w2, w6);
#define PIXEL01_90 *(q+1) = interpolate16_2_3_3<ColorMask >(w5, w2, w6);
#define PIXEL01_100 *(q+1) = interpolate16_14_1_1<ColorMask >(w5, w2, w6);
#define PIXEL01_10 *(q+1) = interpolate_3_1(w5, w3);
#define PIXEL01_11 *(q+1) = interpolate_3_1(w5, w2);
#define PIXEL01_12 *(q+1) = interpolate_3_1(w5, w6);
#define PIXEL01_20 *(q+1) = interpolate_2_1_1(w5, w2, w6);
#define PIXEL01_21 *(q+1) = interpolate_2_1_1(w5, w3, w6);
#define PIXEL01_22 *(q+1) = interpolate_2_1_1(w5, w3, w2);
#define PIXEL01_60 *(q+1) = interpolate_5_2_1(w5, w6, w2);
#define PIXEL01_61 *(q+1) = interpolate_5_2_1(w5, w2, w6);
#define PIXEL01_70 *(q+1) = interpolate_6_1_1(w5, w2, w6);
#define PIXEL01_90 *(q+1) = interpolate_2_3_3(w5, w2, w6);
#define PIXEL01_100 *(q+1) = interpolate_14_1_1(w5, w2, w6);
#define PIXEL10_0 *(q+nextlineDst) = w5;
#define PIXEL10_10 *(q+nextlineDst) = interpolate16_3_1<ColorMask >(w5, w7);
#define PIXEL10_11 *(q+nextlineDst) = interpolate16_3_1<ColorMask >(w5, w8);
#define PIXEL10_12 *(q+nextlineDst) = interpolate16_3_1<ColorMask >(w5, w4);
#define PIXEL10_20 *(q+nextlineDst) = interpolate16_2_1_1<ColorMask >(w5, w8, w4);
#define PIXEL10_21 *(q+nextlineDst) = interpolate16_2_1_1<ColorMask >(w5, w7, w4);
#define PIXEL10_22 *(q+nextlineDst) = interpolate16_2_1_1<ColorMask >(w5, w7, w8);
#define PIXEL10_60 *(q+nextlineDst) = interpolate16_5_2_1<ColorMask >(w5, w4, w8);
#define PIXEL10_61 *(q+nextlineDst) = interpolate16_5_2_1<ColorMask >(w5, w8, w4);
#define PIXEL10_70 *(q+nextlineDst) = interpolate16_6_1_1<ColorMask >(w5, w8, w4);
#define PIXEL10_90 *(q+nextlineDst) = interpolate16_2_3_3<ColorMask >(w5, w8, w4);
#define PIXEL10_100 *(q+nextlineDst) = interpolate16_14_1_1<ColorMask >(w5, w8, w4);
#define PIXEL10_10 *(q+nextlineDst) = interpolate_3_1(w5, w7);
#define PIXEL10_11 *(q+nextlineDst) = interpolate_3_1(w5, w8);
#define PIXEL10_12 *(q+nextlineDst) = interpolate_3_1(w5, w4);
#define PIXEL10_20 *(q+nextlineDst) = interpolate_2_1_1(w5, w8, w4);
#define PIXEL10_21 *(q+nextlineDst) = interpolate_2_1_1(w5, w7, w4);
#define PIXEL10_22 *(q+nextlineDst) = interpolate_2_1_1(w5, w7, w8);
#define PIXEL10_60 *(q+nextlineDst) = interpolate_5_2_1(w5, w4, w8);
#define PIXEL10_61 *(q+nextlineDst) = interpolate_5_2_1(w5, w8, w4);
#define PIXEL10_70 *(q+nextlineDst) = interpolate_6_1_1(w5, w8, w4);
#define PIXEL10_90 *(q+nextlineDst) = interpolate_2_3_3(w5, w8, w4);
#define PIXEL10_100 *(q+nextlineDst) = interpolate_14_1_1(w5, w8, w4);
#define PIXEL11_0 *(q+1+nextlineDst) = w5;
#define PIXEL11_10 *(q+1+nextlineDst) = interpolate16_3_1<ColorMask >(w5, w9);
#define PIXEL11_11 *(q+1+nextlineDst) = interpolate16_3_1<ColorMask >(w5, w6);
#define PIXEL11_12 *(q+1+nextlineDst) = interpolate16_3_1<ColorMask >(w5, w8);
#define PIXEL11_20 *(q+1+nextlineDst) = interpolate16_2_1_1<ColorMask >(w5, w6, w8);
#define PIXEL11_21 *(q+1+nextlineDst) = interpolate16_2_1_1<ColorMask >(w5, w9, w8);
#define PIXEL11_22 *(q+1+nextlineDst) = interpolate16_2_1_1<ColorMask >(w5, w9, w6);
#define PIXEL11_60 *(q+1+nextlineDst) = interpolate16_5_2_1<ColorMask >(w5, w8, w6);
#define PIXEL11_61 *(q+1+nextlineDst) = interpolate16_5_2_1<ColorMask >(w5, w6, w8);
#define PIXEL11_70 *(q+1+nextlineDst) = interpolate16_6_1_1<ColorMask >(w5, w6, w8);
#define PIXEL11_90 *(q+1+nextlineDst) = interpolate16_2_3_3<ColorMask >(w5, w6, w8);
#define PIXEL11_100 *(q+1+nextlineDst) = interpolate16_14_1_1<ColorMask >(w5, w6, w8);
#define PIXEL11_10 *(q+1+nextlineDst) = interpolate_3_1(w5, w9);
#define PIXEL11_11 *(q+1+nextlineDst) = interpolate_3_1(w5, w6);
#define PIXEL11_12 *(q+1+nextlineDst) = interpolate_3_1(w5, w8);
#define PIXEL11_20 *(q+1+nextlineDst) = interpolate_2_1_1(w5, w6, w8);
#define PIXEL11_21 *(q+1+nextlineDst) = interpolate_2_1_1(w5, w9, w8);
#define PIXEL11_22 *(q+1+nextlineDst) = interpolate_2_1_1(w5, w9, w6);
#define PIXEL11_60 *(q+1+nextlineDst) = interpolate_5_2_1(w5, w8, w6);
#define PIXEL11_61 *(q+1+nextlineDst) = interpolate_5_2_1(w5, w6, w8);
#define PIXEL11_70 *(q+1+nextlineDst) = interpolate_6_1_1(w5, w6, w8);
#define PIXEL11_90 *(q+1+nextlineDst) = interpolate_2_3_3(w5, w6, w8);
#define PIXEL11_100 *(q+1+nextlineDst) = interpolate_14_1_1(w5, w6, w8);
extern "C" uint32 *RGBtoYUV;
#define YUV(x) RGBtoYUV[w ## x]
#define YUV(x) (sizeof(pixel) == 2 ? RGBtoYUV[w ## x] : ConvertYUV<ColorMask>(w ## x))
/**
* Convert 32 bit RGB values to Yuv
*/
template<typename ColorMask>
static inline uint32 ConvertYUV(uint32 x) {
int r, g, b;
r = (ColorMask::kRedMask & (ColorMask::kRedMask << (8 - Graphics::ColorMasks<565>::kRedBits)) & x)
>> (ColorMask::kRedShift + (8 - Graphics::ColorMasks<565>::kRedBits) - Graphics::ColorMasks<565>::kRedShift);
g = (ColorMask::kGreenMask & (ColorMask::kGreenMask << (8 - Graphics::ColorMasks<565>::kGreenBits)) & x)
>> (ColorMask::kGreenShift + (8 - Graphics::ColorMasks<565>::kGreenBits) - Graphics::ColorMasks<565>::kGreenShift);
b = (ColorMask::kBlueMask & (ColorMask::kBlueMask << (8 - Graphics::ColorMasks<565>::kBlueBits)) & x)
>> (ColorMask::kBlueShift + (8 - Graphics::ColorMasks<565>::kBlueBits) - Graphics::ColorMasks<565>::kBlueShift);
// lookup in 16 bit table
return RGBtoYUV[r | g | b];
}
/*
* The HQ2x high quality 2x graphics filter.
* Original author Maxim Stepin (see http://www.hiend3d.com/hq2x.html).
* Adapted for ScummVM to 16 bit output and optimized by Max Horn.
*/
template<typename ColorMask>
template<typename ColorMask, typename pixel>
static void HQ2x_implementation(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
register int w1, w2, w3, w4, w5, w6, w7, w8, w9;
const uint32 nextlineSrc = srcPitch / sizeof(uint16);
const uint16 *p = (const uint16 *)srcPtr;
const uint32 nextlineSrc = srcPitch / sizeof(pixel);
const pixel *p = (const pixel *)srcPtr;
const uint32 nextlineDst = dstPitch / sizeof(uint16);
uint16 *q = (uint16 *)dstPtr;
const uint32 nextlineDst = dstPitch / sizeof(pixel);
pixel *q = (pixel *)dstPtr;
// +----+----+----+
// | | | |
@ -2068,78 +2097,75 @@ void HQ3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
#else
#define PIXEL00_1M *(q) = interpolate16_3_1<ColorMask >(w5, w1);
#define PIXEL00_1U *(q) = interpolate16_3_1<ColorMask >(w5, w2);
#define PIXEL00_1L *(q) = interpolate16_3_1<ColorMask >(w5, w4);
#define PIXEL00_2 *(q) = interpolate16_2_1_1<ColorMask >(w5, w4, w2);
#define PIXEL00_4 *(q) = interpolate16_2_7_7<ColorMask >(w5, w4, w2);
#define PIXEL00_5 *(q) = interpolate16_1_1<ColorMask >(w4, w2);
#define PIXEL00_1M *(q) = interpolate_3_1(w5, w1);
#define PIXEL00_1U *(q) = interpolate_3_1(w5, w2);
#define PIXEL00_1L *(q) = interpolate_3_1(w5, w4);
#define PIXEL00_2 *(q) = interpolate_2_1_1(w5, w4, w2);
#define PIXEL00_4 *(q) = interpolate_2_7_7(w5, w4, w2);
#define PIXEL00_5 *(q) = interpolate_1_1(w4, w2);
#define PIXEL00_C *(q) = w5;
#define PIXEL01_1 *(q+1) = interpolate16_3_1<ColorMask >(w5, w2);
#define PIXEL01_3 *(q+1) = interpolate16_7_1<ColorMask >(w5, w2);
#define PIXEL01_6 *(q+1) = interpolate16_3_1<ColorMask >(w2, w5);
#define PIXEL01_1 *(q+1) = interpolate_3_1(w5, w2);
#define PIXEL01_3 *(q+1) = interpolate_7_1(w5, w2);
#define PIXEL01_6 *(q+1) = interpolate_3_1(w2, w5);
#define PIXEL01_C *(q+1) = w5;
#define PIXEL02_1M *(q+2) = interpolate16_3_1<ColorMask >(w5, w3);
#define PIXEL02_1U *(q+2) = interpolate16_3_1<ColorMask >(w5, w2);
#define PIXEL02_1R *(q+2) = interpolate16_3_1<ColorMask >(w5, w6);
#define PIXEL02_2 *(q+2) = interpolate16_2_1_1<ColorMask >(w5, w2, w6);
#define PIXEL02_4 *(q+2) = interpolate16_2_7_7<ColorMask >(w5, w2, w6);
#define PIXEL02_5 *(q+2) = interpolate16_1_1<ColorMask >(w2, w6);
#define PIXEL02_1M *(q+2) = interpolate_3_1(w5, w3);
#define PIXEL02_1U *(q+2) = interpolate_3_1(w5, w2);
#define PIXEL02_1R *(q+2) = interpolate_3_1(w5, w6);
#define PIXEL02_2 *(q+2) = interpolate_2_1_1(w5, w2, w6);
#define PIXEL02_4 *(q+2) = interpolate_2_7_7(w5, w2, w6);
#define PIXEL02_5 *(q+2) = interpolate_1_1(w2, w6);
#define PIXEL02_C *(q+2) = w5;
#define PIXEL10_1 *(q+nextlineDst) = interpolate16_3_1<ColorMask >(w5, w4);
#define PIXEL10_3 *(q+nextlineDst) = interpolate16_7_1<ColorMask >(w5, w4);
#define PIXEL10_6 *(q+nextlineDst) = interpolate16_3_1<ColorMask >(w4, w5);
#define PIXEL10_1 *(q+nextlineDst) = interpolate_3_1(w5, w4);
#define PIXEL10_3 *(q+nextlineDst) = interpolate_7_1(w5, w4);
#define PIXEL10_6 *(q+nextlineDst) = interpolate_3_1(w4, w5);
#define PIXEL10_C *(q+nextlineDst) = w5;
#define PIXEL11 *(q+1+nextlineDst) = w5;
#define PIXEL12_1 *(q+2+nextlineDst) = interpolate16_3_1<ColorMask >(w5, w6);
#define PIXEL12_3 *(q+2+nextlineDst) = interpolate16_7_1<ColorMask >(w5, w6);
#define PIXEL12_6 *(q+2+nextlineDst) = interpolate16_3_1<ColorMask >(w6, w5);
#define PIXEL12_1 *(q+2+nextlineDst) = interpolate_3_1(w5, w6);
#define PIXEL12_3 *(q+2+nextlineDst) = interpolate_7_1(w5, w6);
#define PIXEL12_6 *(q+2+nextlineDst) = interpolate_3_1(w6, w5);
#define PIXEL12_C *(q+2+nextlineDst) = w5;
#define PIXEL20_1M *(q+nextlineDst2) = interpolate16_3_1<ColorMask >(w5, w7);
#define PIXEL20_1D *(q+nextlineDst2) = interpolate16_3_1<ColorMask >(w5, w8);
#define PIXEL20_1L *(q+nextlineDst2) = interpolate16_3_1<ColorMask >(w5, w4);
#define PIXEL20_2 *(q+nextlineDst2) = interpolate16_2_1_1<ColorMask >(w5, w8, w4);
#define PIXEL20_4 *(q+nextlineDst2) = interpolate16_2_7_7<ColorMask >(w5, w8, w4);
#define PIXEL20_5 *(q+nextlineDst2) = interpolate16_1_1<ColorMask >(w8, w4);
#define PIXEL20_1M *(q+nextlineDst2) = interpolate_3_1(w5, w7);
#define PIXEL20_1D *(q+nextlineDst2) = interpolate_3_1(w5, w8);
#define PIXEL20_1L *(q+nextlineDst2) = interpolate_3_1(w5, w4);
#define PIXEL20_2 *(q+nextlineDst2) = interpolate_2_1_1(w5, w8, w4);
#define PIXEL20_4 *(q+nextlineDst2) = interpolate_2_7_7(w5, w8, w4);
#define PIXEL20_5 *(q+nextlineDst2) = interpolate_1_1(w8, w4);
#define PIXEL20_C *(q+nextlineDst2) = w5;
#define PIXEL21_1 *(q+1+nextlineDst2) = interpolate16_3_1<ColorMask >(w5, w8);
#define PIXEL21_3 *(q+1+nextlineDst2) = interpolate16_7_1<ColorMask >(w5, w8);
#define PIXEL21_6 *(q+1+nextlineDst2) = interpolate16_3_1<ColorMask >(w8, w5);
#define PIXEL21_1 *(q+1+nextlineDst2) = interpolate_3_1(w5, w8);
#define PIXEL21_3 *(q+1+nextlineDst2) = interpolate_7_1(w5, w8);
#define PIXEL21_6 *(q+1+nextlineDst2) = interpolate_3_1(w8, w5);
#define PIXEL21_C *(q+1+nextlineDst2) = w5;
#define PIXEL22_1M *(q+2+nextlineDst2) = interpolate16_3_1<ColorMask >(w5, w9);
#define PIXEL22_1D *(q+2+nextlineDst2) = interpolate16_3_1<ColorMask >(w5, w8);
#define PIXEL22_1R *(q+2+nextlineDst2) = interpolate16_3_1<ColorMask >(w5, w6);
#define PIXEL22_2 *(q+2+nextlineDst2) = interpolate16_2_1_1<ColorMask >(w5, w6, w8);
#define PIXEL22_4 *(q+2+nextlineDst2) = interpolate16_2_7_7<ColorMask >(w5, w6, w8);
#define PIXEL22_5 *(q+2+nextlineDst2) = interpolate16_1_1<ColorMask >(w6, w8);
#define PIXEL22_1M *(q+2+nextlineDst2) = interpolate_3_1(w5, w9);
#define PIXEL22_1D *(q+2+nextlineDst2) = interpolate_3_1(w5, w8);
#define PIXEL22_1R *(q+2+nextlineDst2) = interpolate_3_1(w5, w6);
#define PIXEL22_2 *(q+2+nextlineDst2) = interpolate_2_1_1(w5, w6, w8);
#define PIXEL22_4 *(q+2+nextlineDst2) = interpolate_2_7_7(w5, w6, w8);
#define PIXEL22_5 *(q+2+nextlineDst2) = interpolate_1_1(w6, w8);
#define PIXEL22_C *(q+2+nextlineDst2) = w5;
extern "C" uint32 *RGBtoYUV;
#define YUV(x) RGBtoYUV[w ## x]
/*
* The HQ3x high quality 3x graphics filter.
* Original author Maxim Stepin (see http://www.hiend3d.com/hq3x.html).
* Adapted for ScummVM to 16 bit output and optimized by Max Horn.
*/
template<typename ColorMask>
template<typename ColorMask, typename pixel>
static void HQ3x_implementation(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
register int w1, w2, w3, w4, w5, w6, w7, w8, w9;
const uint32 nextlineSrc = srcPitch / sizeof(uint16);
const uint16 *p = (const uint16 *)srcPtr;
const uint32 nextlineSrc = srcPitch / sizeof(pixel);
const pixel *p = (const pixel *)srcPtr;
const uint32 nextlineDst = dstPitch / sizeof(uint16);
const uint32 nextlineDst = dstPitch / sizeof(pixel);
const uint32 nextlineDst2 = 2 * nextlineDst;
uint16 *q = (uint16 *)dstPtr;
pixel *q = (pixel *)dstPtr;
// +----+----+----+
// | | | |
@ -4969,7 +4995,15 @@ HQPlugin::HQPlugin() {
}
void HQPlugin::initialize(Graphics::PixelFormat format) {
InitLUT(format);
if (format.bytesPerPixel == 2) {
InitLUT(format);
} else {
// Pass a 16 bit 565 format to InitLut
Graphics::PixelFormat format16(2,
5, 6, 5, 0,
11, 5, 0, 0);
InitLUT(format16);
}
_format = format;
}
@ -4980,32 +5014,51 @@ void HQPlugin::deinitialize() {
void HQPlugin::scale(const uint8 *srcPtr, uint32 srcPitch,
uint8 *dstPtr, uint32 dstPitch, int width, int height, int x, int y) {
#ifdef USE_NASM
switch (_factor) {
case 2:
#ifdef USE_NASM
HQ2x(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
case 3:
HQ3x(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
}
#else
if (_format.gLoss == 2)
HQ2x_implementation<Graphics::ColorMasks<565> >(srcPtr, srcPitch, dstPtr,
dstPitch, width, height);
else
HQ2x_implementation<Graphics::ColorMasks<555> >(srcPtr, srcPitch, dstPtr,
dstPitch, width, height);
#endif
switch (_factor) {
case 2:
if (_format.bytesPerPixel == 2) {
if (_format.gLoss == 2)
HQ2x_implementation<Graphics::ColorMasks<565>, uint16>(srcPtr, srcPitch, dstPtr,
dstPitch, width, height);
else
HQ2x_implementation<Graphics::ColorMasks<555>, uint16>(srcPtr, srcPitch, dstPtr,
dstPitch, width, height);
} else {
if (_format.gLoss == 0)
HQ2x_implementation<Graphics::ColorMasks<8888>, uint32>(srcPtr, srcPitch, dstPtr,
dstPitch, width, height);
else
HQ2x_implementation<Graphics::ColorMasks<888>, uint32>(srcPtr, srcPitch, dstPtr,
dstPitch, width, height);
}
break;
case 3:
#ifdef USE_NASM
HQ3x(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
#else
if (_format.gLoss == 2)
HQ3x_implementation<Graphics::ColorMasks<565> >(srcPtr, srcPitch, dstPtr,
dstPitch, width, height);
else
HQ3x_implementation<Graphics::ColorMasks<555> >(srcPtr, srcPitch, dstPtr,
dstPitch, width, height);
#endif
if (_format.bytesPerPixel == 2) {
if (_format.gLoss == 2)
HQ3x_implementation<Graphics::ColorMasks<565>, uint16>(srcPtr, srcPitch, dstPtr,
dstPitch, width, height);
else
HQ3x_implementation<Graphics::ColorMasks<555>, uint16>(srcPtr, srcPitch, dstPtr,
dstPitch, width, height);
} else {
if (_format.gLoss == 0)
HQ3x_implementation<Graphics::ColorMasks<8888>, uint32>(srcPtr, srcPitch, dstPtr,
dstPitch, width, height);
else
HQ3x_implementation<Graphics::ColorMasks<888>, uint32>(srcPtr, srcPitch, dstPtr,
dstPitch, width, height);
}
break;
}
#endif
}
uint HQPlugin::increaseFactor() {