| 106 | #define INTERPOLATE INTERPOLATE<bitFormat> |
| 107 | #define Q_INTERPOLATE Q_INTERPOLATE<bitFormat> |
| 108 | |
| 109 | /** |
| 110 | * Trivial nearest-neighbour 1.5x scaler. |
| 111 | */ |
| 112 | template<int bitFormat> |
| 113 | void Normal1o5xTemplate(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, |
| 114 | int width, int height) { |
| 115 | uint8 *r; |
| 116 | const uint32 dstPitch2 = dstPitch * 2; |
| 117 | const uint32 dstPitch3 = dstPitch * 3; |
| 118 | const uint32 srcPitch2 = srcPitch * 2; |
| 119 | |
| 120 | assert(((int)dstPtr & 1) == 0); |
| 121 | while (height) { |
| 122 | r = dstPtr; |
| 123 | for (int i = 0; i < width; i += 2, r += 6) { |
| 124 | uint16 color0 = *(((const uint16 *)srcPtr) + i); |
| 125 | uint16 color1 = *(((const uint16 *)srcPtr) + i + 1); |
| 126 | uint16 color2 = *(((const uint16 *)(srcPtr + srcPitch)) + i); |
| 127 | uint16 color3 = *(((const uint16 *)(srcPtr + srcPitch)) + i + 1); |
| 128 | |
| 129 | *(uint16 *)(r + 0) = color0; |
| 130 | *(uint16 *)(r + 2) = INTERPOLATE(color0, color1); |
| 131 | *(uint16 *)(r + 4) = color1; |
| 132 | *(uint16 *)(r + 0 + dstPitch) = INTERPOLATE(color0, color2); |
| 133 | *(uint16 *)(r + 2 + dstPitch) = Q_INTERPOLATE(color0, color1, color2, color3); |
| 134 | *(uint16 *)(r + 4 + dstPitch) = INTERPOLATE(color1, color1); |
| 135 | *(uint16 *)(r + 0 + dstPitch2) = color2; |
| 136 | *(uint16 *)(r + 2 + dstPitch2) = INTERPOLATE(color2, color3); |
| 137 | *(uint16 *)(r + 4 + dstPitch2) = color3; |
| 138 | } |
| 139 | srcPtr += srcPitch2; |
| 140 | dstPtr += dstPitch3; |
| 141 | height -= 2; |
| 142 | } |
| 143 | } |
| 144 | MAKE_WRAPPER(Normal1o5x) |
| 145 | |