#include "lp_tile_soa.h"
-#define PIXEL(_p, _x, _y, _c) ((_p)[(_c)*TILE_SIZE*TILE_SIZE + (_y)*TILE_SIZE + (_x)])
+const unsigned char
+tile_offset[TILE_VECTOR_HEIGHT][TILE_VECTOR_WIDTH] = {
+ { 0, 1, 4, 5, 8, 9, 12, 13},
+ { 2, 3, 6, 7, 10, 11, 14, 15}
+};
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
const unsigned pixel = *src++;
- PIXEL(p, j, i, 0) = (pixel >> 16) & 0xff;
- PIXEL(p, j, i, 1) = (pixel >> 8) & 0xff;
- PIXEL(p, j, i, 2) = (pixel >> 0) & 0xff;
- PIXEL(p, j, i, 3) = (pixel >> 24) & 0xff;
+ TILE_PIXEL(p, j, i, 0) = (pixel >> 16) & 0xff;
+ TILE_PIXEL(p, j, i, 1) = (pixel >> 8) & 0xff;
+ TILE_PIXEL(p, j, i, 2) = (pixel >> 0) & 0xff;
+ TILE_PIXEL(p, j, i, 3) = (pixel >> 24) & 0xff;
}
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
unsigned r, g, b, a;
- r = PIXEL(p, j, i, 0);
- g = PIXEL(p, j, i, 1);
- b = PIXEL(p, j, i, 2);
- a = PIXEL(p, j, i, 3);
+ r = TILE_PIXEL(p, j, i, 0);
+ g = TILE_PIXEL(p, j, i, 1);
+ b = TILE_PIXEL(p, j, i, 2);
+ a = TILE_PIXEL(p, j, i, 3);
*dst++ = (a << 24) | (r << 16) | (g << 8) | b;
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
const unsigned pixel = *src++;
- PIXEL(p, j, i, 0) = (pixel >> 16) & 0xff;
- PIXEL(p, j, i, 1) = (pixel >> 8) & 0xff;
- PIXEL(p, j, i, 2) = (pixel >> 0) & 0xff;
- PIXEL(p, j, i, 3) = 0xff;
+ TILE_PIXEL(p, j, i, 0) = (pixel >> 16) & 0xff;
+ TILE_PIXEL(p, j, i, 1) = (pixel >> 8) & 0xff;
+ TILE_PIXEL(p, j, i, 2) = (pixel >> 0) & 0xff;
+ TILE_PIXEL(p, j, i, 3) = 0xff;
}
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
unsigned r, g, b;
- r = PIXEL(p, j, i, 0);
- g = PIXEL(p, j, i, 1);
- b = PIXEL(p, j, i, 2);
+ r = TILE_PIXEL(p, j, i, 0);
+ g = TILE_PIXEL(p, j, i, 1);
+ b = TILE_PIXEL(p, j, i, 2);
*dst++ = (0xff << 24) | (r << 16) | (g << 8) | b;
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
const unsigned pixel = *src++;
- PIXEL(p, j, i, 0) = (pixel >> 8) & 0xff;
- PIXEL(p, j, i, 1) = (pixel >> 16) & 0xff;
- PIXEL(p, j, i, 2) = (pixel >> 24) & 0xff;
- PIXEL(p, j, i, 3) = (pixel >> 0) & 0xff;
+ TILE_PIXEL(p, j, i, 0) = (pixel >> 8) & 0xff;
+ TILE_PIXEL(p, j, i, 1) = (pixel >> 16) & 0xff;
+ TILE_PIXEL(p, j, i, 2) = (pixel >> 24) & 0xff;
+ TILE_PIXEL(p, j, i, 3) = (pixel >> 0) & 0xff;
}
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
unsigned r, g, b, a;
- r = PIXEL(p, j, i, 0);
- g = PIXEL(p, j, i, 1);
- b = PIXEL(p, j, i, 2);
- a = PIXEL(p, j, i, 3);
+ r = TILE_PIXEL(p, j, i, 0);
+ g = TILE_PIXEL(p, j, i, 1);
+ b = TILE_PIXEL(p, j, i, 2);
+ a = TILE_PIXEL(p, j, i, 3);
*dst++ = (b << 24) | (g << 16) | (r << 8) | a;
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
const ushort pixel = *src++;
- PIXEL(p, j, i, 0) = ((pixel >> 10) & 0x1f) * 255 / 31;
- PIXEL(p, j, i, 1) = ((pixel >> 5) & 0x1f) * 255 / 31;
- PIXEL(p, j, i, 2) = ((pixel ) & 0x1f) * 255 / 31;
- PIXEL(p, j, i, 3) = ((pixel >> 15) ) * 255;
+ TILE_PIXEL(p, j, i, 0) = ((pixel >> 10) & 0x1f) * 255 / 31;
+ TILE_PIXEL(p, j, i, 1) = ((pixel >> 5) & 0x1f) * 255 / 31;
+ TILE_PIXEL(p, j, i, 2) = ((pixel ) & 0x1f) * 255 / 31;
+ TILE_PIXEL(p, j, i, 3) = ((pixel >> 15) ) * 255;
}
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
unsigned r, g, b, a;
- r = PIXEL(p, j, i, 0);
- g = PIXEL(p, j, i, 1);
- b = PIXEL(p, j, i, 2);
- a = PIXEL(p, j, i, 3);
+ r = TILE_PIXEL(p, j, i, 0);
+ g = TILE_PIXEL(p, j, i, 1);
+ b = TILE_PIXEL(p, j, i, 2);
+ a = TILE_PIXEL(p, j, i, 3);
r = r >> 3; /* 5 bits */
g = g >> 3; /* 5 bits */
b = b >> 3; /* 5 bits */
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
const ushort pixel = *src++;
- PIXEL(p, j, i, 0) = ((pixel >> 8) & 0xf) * 255 / 15;
- PIXEL(p, j, i, 1) = ((pixel >> 4) & 0xf) * 255 / 15;
- PIXEL(p, j, i, 2) = ((pixel ) & 0xf) * 255 / 15;
- PIXEL(p, j, i, 3) = ((pixel >> 12) ) * 255 / 15;
+ TILE_PIXEL(p, j, i, 0) = ((pixel >> 8) & 0xf) * 255 / 15;
+ TILE_PIXEL(p, j, i, 1) = ((pixel >> 4) & 0xf) * 255 / 15;
+ TILE_PIXEL(p, j, i, 2) = ((pixel ) & 0xf) * 255 / 15;
+ TILE_PIXEL(p, j, i, 3) = ((pixel >> 12) ) * 255 / 15;
}
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
unsigned r, g, b, a;
- r = PIXEL(p, j, i, 0);
- g = PIXEL(p, j, i, 1);
- b = PIXEL(p, j, i, 2);
- a = PIXEL(p, j, i, 3);
+ r = TILE_PIXEL(p, j, i, 0);
+ g = TILE_PIXEL(p, j, i, 1);
+ b = TILE_PIXEL(p, j, i, 2);
+ a = TILE_PIXEL(p, j, i, 3);
r >>= 4;
g >>= 4;
b >>= 4;
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
const ushort pixel = *src++;
- PIXEL(p, j, i, 0) = ((pixel >> 11) & 0x1f) * 255 / 31;
- PIXEL(p, j, i, 1) = ((pixel >> 5) & 0x3f) * 255 / 63;
- PIXEL(p, j, i, 2) = ((pixel ) & 0x1f) * 255 / 31;
- PIXEL(p, j, i, 3) = 255;
+ TILE_PIXEL(p, j, i, 0) = ((pixel >> 11) & 0x1f) * 255 / 31;
+ TILE_PIXEL(p, j, i, 1) = ((pixel >> 5) & 0x3f) * 255 / 63;
+ TILE_PIXEL(p, j, i, 2) = ((pixel ) & 0x1f) * 255 / 31;
+ TILE_PIXEL(p, j, i, 3) = 255;
}
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
- uint r = (uint) PIXEL(p, j, i, 0) * 31 / 255;
- uint g = (uint) PIXEL(p, j, i, 1) * 63 / 255;
- uint b = (uint) PIXEL(p, j, i, 2) * 31 / 255;
+ uint r = (uint) TILE_PIXEL(p, j, i, 0) * 31 / 255;
+ uint g = (uint) TILE_PIXEL(p, j, i, 1) * 63 / 255;
+ uint b = (uint) TILE_PIXEL(p, j, i, 2) * 31 / 255;
*dst++ = (r << 11) | (g << 5) | (b);
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
- PIXEL(p, j, i, 0) =
- PIXEL(p, j, i, 1) =
- PIXEL(p, j, i, 2) =
- PIXEL(p, j, i, 3) = *src++ * scale;
+ TILE_PIXEL(p, j, i, 0) =
+ TILE_PIXEL(p, j, i, 1) =
+ TILE_PIXEL(p, j, i, 2) =
+ TILE_PIXEL(p, j, i, 3) = *src++ * scale;
}
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++, src++) {
- PIXEL(p, j, i, 0) =
- PIXEL(p, j, i, 1) =
- PIXEL(p, j, i, 2) = *src;
- PIXEL(p, j, i, 3) = 255;
+ TILE_PIXEL(p, j, i, 0) =
+ TILE_PIXEL(p, j, i, 1) =
+ TILE_PIXEL(p, j, i, 2) = *src;
+ TILE_PIXEL(p, j, i, 3) = 255;
}
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
unsigned r;
- r = PIXEL(p, j, i, 0);
+ r = TILE_PIXEL(p, j, i, 0);
*dst++ = (ubyte) r;
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++, src++) {
- PIXEL(p, j, i, 0) =
- PIXEL(p, j, i, 1) =
- PIXEL(p, j, i, 2) = 0;
- PIXEL(p, j, i, 3) = *src;
+ TILE_PIXEL(p, j, i, 0) =
+ TILE_PIXEL(p, j, i, 1) =
+ TILE_PIXEL(p, j, i, 2) = 0;
+ TILE_PIXEL(p, j, i, 3) = *src;
}
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
unsigned a;
- a = PIXEL(p, j, i, 3);
+ a = TILE_PIXEL(p, j, i, 3);
*dst++ = (ubyte) a;
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++, src++) {
- PIXEL(p, j, i, 0) = MAX2(src[0] >> 7, 0);
- PIXEL(p, j, i, 1) =
- PIXEL(p, j, i, 2) = 0;
- PIXEL(p, j, i, 3) = 255;
+ TILE_PIXEL(p, j, i, 0) = MAX2(src[0] >> 7, 0);
+ TILE_PIXEL(p, j, i, 1) =
+ TILE_PIXEL(p, j, i, 2) = 0;
+ TILE_PIXEL(p, j, i, 3) = 255;
}
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++, dst++) {
- dst[0] = PIXEL(p, j, i, 0) << 7;
+ dst[0] = TILE_PIXEL(p, j, i, 0) << 7;
}
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++, src += 4) {
- PIXEL(p, j, i, 0) = src[0] >> 8;
- PIXEL(p, j, i, 1) = src[1] >> 8;
- PIXEL(p, j, i, 2) = src[2] >> 8;
- PIXEL(p, j, i, 3) = src[3] >> 8;
+ TILE_PIXEL(p, j, i, 0) = src[0] >> 8;
+ TILE_PIXEL(p, j, i, 1) = src[1] >> 8;
+ TILE_PIXEL(p, j, i, 2) = src[2] >> 8;
+ TILE_PIXEL(p, j, i, 3) = src[3] >> 8;
}
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++, dst += 4) {
- dst[0] = PIXEL(p, j, i, 0) << 8;
- dst[1] = PIXEL(p, j, i, 1) << 8;
- dst[2] = PIXEL(p, j, i, 2) << 8;
- dst[3] = PIXEL(p, j, i, 3) << 8;
+ dst[0] = TILE_PIXEL(p, j, i, 0) << 8;
+ dst[1] = TILE_PIXEL(p, j, i, 1) << 8;
+ dst[2] = TILE_PIXEL(p, j, i, 2) << 8;
+ dst[3] = TILE_PIXEL(p, j, i, 3) << 8;
}
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++, src++) {
- PIXEL(p, j, i, 0) =
- PIXEL(p, j, i, 1) =
- PIXEL(p, j, i, 2) =
- PIXEL(p, j, i, 3) = *src;
+ TILE_PIXEL(p, j, i, 0) =
+ TILE_PIXEL(p, j, i, 1) =
+ TILE_PIXEL(p, j, i, 2) =
+ TILE_PIXEL(p, j, i, 3) = *src;
}
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
unsigned r;
- r = PIXEL(p, j, i, 0);
+ r = TILE_PIXEL(p, j, i, 0);
*dst++ = (ubyte) r;
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
ushort ra = *src++;
- PIXEL(p, j, i, 0) =
- PIXEL(p, j, i, 1) =
- PIXEL(p, j, i, 2) = ra & 0xff;
- PIXEL(p, j, i, 3) = ra >> 8;
+ TILE_PIXEL(p, j, i, 0) =
+ TILE_PIXEL(p, j, i, 1) =
+ TILE_PIXEL(p, j, i, 2) = ra & 0xff;
+ TILE_PIXEL(p, j, i, 3) = ra >> 8;
}
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
unsigned r, a;
- r = PIXEL(p, j, i, 0);
- a = PIXEL(p, j, i, 3);
+ r = TILE_PIXEL(p, j, i, 0);
+ a = TILE_PIXEL(p, j, i, 3);
*dst++ = (a << 8) | r;
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
- PIXEL(p, j, i, 0) =
- PIXEL(p, j, i, 1) =
- PIXEL(p, j, i, 2) =
- PIXEL(p, j, i, 3) = (float) (*src++ * scale);
+ TILE_PIXEL(p, j, i, 0) =
+ TILE_PIXEL(p, j, i, 1) =
+ TILE_PIXEL(p, j, i, 2) =
+ TILE_PIXEL(p, j, i, 3) = (float) (*src++ * scale);
}
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
- PIXEL(p, j, i, 0) =
- PIXEL(p, j, i, 1) =
- PIXEL(p, j, i, 2) =
- PIXEL(p, j, i, 3) = (float) (scale * (*src++ & 0xffffff));
+ TILE_PIXEL(p, j, i, 0) =
+ TILE_PIXEL(p, j, i, 1) =
+ TILE_PIXEL(p, j, i, 2) =
+ TILE_PIXEL(p, j, i, 3) = (float) (scale * (*src++ & 0xffffff));
}
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
- PIXEL(p, j, i, 0) =
- PIXEL(p, j, i, 1) =
- PIXEL(p, j, i, 2) =
- PIXEL(p, j, i, 3) = (float) (scale * (*src++ >> 8));
+ TILE_PIXEL(p, j, i, 0) =
+ TILE_PIXEL(p, j, i, 1) =
+ TILE_PIXEL(p, j, i, 2) =
+ TILE_PIXEL(p, j, i, 3) = (float) (scale * (*src++ >> 8));
}
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
- PIXEL(p, j, i, 0) =
- PIXEL(p, j, i, 1) =
- PIXEL(p, j, i, 2) =
- PIXEL(p, j, i, 3) = *src++;
+ TILE_PIXEL(p, j, i, 0) =
+ TILE_PIXEL(p, j, i, 1) =
+ TILE_PIXEL(p, j, i, 2) =
+ TILE_PIXEL(p, j, i, 3) = *src++;
}
}
}
r = 1.164f * (y0-16) + 1.596f * (cr-128);
g = 1.164f * (y0-16) - 0.813f * (cr-128) - 0.391f * (cb-128);
b = 1.164f * (y0-16) + 2.018f * (cb-128);
- PIXEL(p, j, i, 0) = r;
- PIXEL(p, j, i, 1) = g;
- PIXEL(p, j, i, 2) = b;
- PIXEL(p, j, i, 3) = 255;
+ TILE_PIXEL(p, j, i, 0) = r;
+ TILE_PIXEL(p, j, i, 1) = g;
+ TILE_PIXEL(p, j, i, 2) = b;
+ TILE_PIXEL(p, j, i, 3) = 255;
/* odd pixel: use y1,cr,cb */
r = 1.164f * (y1-16) + 1.596f * (cr-128);
g = 1.164f * (y1-16) - 0.813f * (cr-128) - 0.391f * (cb-128);
b = 1.164f * (y1-16) + 2.018f * (cb-128);
- PIXEL(p, j + 1, i, 0) = r;
- PIXEL(p, j + 1, i, 1) = g;
- PIXEL(p, j + 1, i, 2) = b;
- PIXEL(p, j + 1, i, 3) = 255;
+ TILE_PIXEL(p, j + 1, i, 0) = r;
+ TILE_PIXEL(p, j + 1, i, 1) = g;
+ TILE_PIXEL(p, j + 1, i, 2) = b;
+ TILE_PIXEL(p, j + 1, i, 3) = 255;
}
/* do the last texel */
if (w & 1) {
r = 1.164f * (y0-16) + 1.596f * (cr-128);
g = 1.164f * (y0-16) - 0.813f * (cr-128) - 0.391f * (cb-128);
b = 1.164f * (y0-16) + 2.018f * (cb-128);
- PIXEL(p, j, i, 0) = r;
- PIXEL(p, j, i, 1) = g;
- PIXEL(p, j, i, 2) = b;
- PIXEL(p, j, i, 3) = 255;
+ TILE_PIXEL(p, j, i, 0) = r;
+ TILE_PIXEL(p, j, i, 1) = g;
+ TILE_PIXEL(p, j, i, 2) = b;
+ TILE_PIXEL(p, j, i, 3) = 255;
}
}
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
- PIXEL(p, j, i, 0) =
- PIXEL(p, j, i, 1) =
- PIXEL(p, j, i, 2) =
- PIXEL(p, j, i, 3) = (i ^ j) & 1 ? 255 : 0;
+ TILE_PIXEL(p, j, i, 0) =
+ TILE_PIXEL(p, j, i, 1) =
+ TILE_PIXEL(p, j, i, 2) =
+ TILE_PIXEL(p, j, i, 3) = (i ^ j) & 1 ? 255 : 0;
}
}
}