+static void scaleup(uint8_t *dst, const uint8_t *src, int w)
+{
+ int x;
+ for (x = 0; x < w - 7; x+=8) {
+ dst[x + 0] =
+ dst[x + 1] = src[(x>>1) + 0];
+ dst[x + 2] =
+ dst[x + 3] = src[(x>>1) + 1];
+ dst[x + 4] =
+ dst[x + 5] = src[(x>>1) + 2];
+ dst[x + 6] =
+ dst[x + 7] = src[(x>>1) + 3];
+ }
+ for (; x < w; x++) {
+ dst[x] = src[(x>>1)];
+ }
+}
+
+static void scaleup_rev(uint8_t *dst, const uint8_t *src, int w)
+{
+ int x;
+
+ for (x = w - 1; (x+1) & 7; x--) {
+ dst[x] = src[(x>>1)];
+ }
+ for (x -= 7; x >= 0; x -= 8) {
+ dst[x + 6] =
+ dst[x + 7] = src[(x>>1) + 3];
+ dst[x + 4] =
+ dst[x + 5] = src[(x>>1) + 2];
+ dst[x + 2] =
+ dst[x + 3] = src[(x>>1) + 1];
+ dst[x + 0] =
+ dst[x + 1] = src[(x>>1) + 0];
+ }
+}
+
+static void scaledown(uint8_t *dst, const uint8_t *src, int w)
+{
+ int x;
+ for (x = 0; x < w - 7; x+=8) {
+ dst[x + 0] = src[2*x + 0];
+ dst[x + 1] = src[2*x + 2];
+ dst[x + 2] = src[2*x + 4];
+ dst[x + 3] = src[2*x + 6];
+ dst[x + 4] = src[2*x + 8];
+ dst[x + 5] = src[2*x +10];
+ dst[x + 6] = src[2*x +12];
+ dst[x + 7] = src[2*x +14];
+ }
+ for (; x < w; x++) {
+ dst[x] = src[2*x];
+ }
+}
+