enum dtype
{
- UBYTE,
- UBYTE_3_3_2,
- USHORT,
- USHORT_4_4_4_4,
- USHORT_5_6_5,
- USHORT_1_5_5_5_REV,
- UINT,
- FLOAT,
- HALF_FLOAT
+ DTYPE_UBYTE,
+ DTYPE_UBYTE_3_3_2,
+ DTYPE_USHORT,
+ DTYPE_USHORT_4_4_4_4,
+ DTYPE_USHORT_5_6_5,
+ DTYPE_USHORT_1_5_5_5_REV,
+ DTYPE_UINT,
+ DTYPE_FLOAT,
+ DTYPE_HALF_FLOAT
};
assert(srcWidth == dstWidth || srcWidth == 2 * dstWidth);
*/
- if (datatype == UBYTE && comps == 4) {
+ if (datatype == DTYPE_UBYTE && comps == 4) {
uint i, j, k;
const ubyte(*rowA)[4] = (const ubyte(*)[4]) srcRowA;
const ubyte(*rowB)[4] = (const ubyte(*)[4]) srcRowB;
dst[i][3] = (rowA[j][3] + rowA[k][3] + rowB[j][3] + rowB[k][3]) / 4;
}
}
- else if (datatype == UBYTE && comps == 3) {
+ else if (datatype == DTYPE_UBYTE && comps == 3) {
uint i, j, k;
const ubyte(*rowA)[3] = (const ubyte(*)[3]) srcRowA;
const ubyte(*rowB)[3] = (const ubyte(*)[3]) srcRowB;
dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4;
}
}
- else if (datatype == UBYTE && comps == 2) {
+ else if (datatype == DTYPE_UBYTE && comps == 2) {
uint i, j, k;
const ubyte(*rowA)[2] = (const ubyte(*)[2]) srcRowA;
const ubyte(*rowB)[2] = (const ubyte(*)[2]) srcRowB;
dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) >> 2;
}
}
- else if (datatype == UBYTE && comps == 1) {
+ else if (datatype == DTYPE_UBYTE && comps == 1) {
uint i, j, k;
const ubyte *rowA = (const ubyte *) srcRowA;
const ubyte *rowB = (const ubyte *) srcRowB;
}
}
- else if (datatype == USHORT && comps == 4) {
+ else if (datatype == DTYPE_USHORT && comps == 4) {
uint i, j, k;
const ushort(*rowA)[4] = (const ushort(*)[4]) srcRowA;
const ushort(*rowB)[4] = (const ushort(*)[4]) srcRowB;
dst[i][3] = (rowA[j][3] + rowA[k][3] + rowB[j][3] + rowB[k][3]) / 4;
}
}
- else if (datatype == USHORT && comps == 3) {
+ else if (datatype == DTYPE_USHORT && comps == 3) {
uint i, j, k;
const ushort(*rowA)[3] = (const ushort(*)[3]) srcRowA;
const ushort(*rowB)[3] = (const ushort(*)[3]) srcRowB;
dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4;
}
}
- else if (datatype == USHORT && comps == 2) {
+ else if (datatype == DTYPE_USHORT && comps == 2) {
uint i, j, k;
const ushort(*rowA)[2] = (const ushort(*)[2]) srcRowA;
const ushort(*rowB)[2] = (const ushort(*)[2]) srcRowB;
dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
}
}
- else if (datatype == USHORT && comps == 1) {
+ else if (datatype == DTYPE_USHORT && comps == 1) {
uint i, j, k;
const ushort *rowA = (const ushort *) srcRowA;
const ushort *rowB = (const ushort *) srcRowB;
}
}
- else if (datatype == FLOAT && comps == 4) {
+ else if (datatype == DTYPE_FLOAT && comps == 4) {
uint i, j, k;
const float(*rowA)[4] = (const float(*)[4]) srcRowA;
const float(*rowB)[4] = (const float(*)[4]) srcRowB;
rowB[j][3] + rowB[k][3]) * 0.25F;
}
}
- else if (datatype == FLOAT && comps == 3) {
+ else if (datatype == DTYPE_FLOAT && comps == 3) {
uint i, j, k;
const float(*rowA)[3] = (const float(*)[3]) srcRowA;
const float(*rowB)[3] = (const float(*)[3]) srcRowB;
rowB[j][2] + rowB[k][2]) * 0.25F;
}
}
- else if (datatype == FLOAT && comps == 2) {
+ else if (datatype == DTYPE_FLOAT && comps == 2) {
uint i, j, k;
const float(*rowA)[2] = (const float(*)[2]) srcRowA;
const float(*rowB)[2] = (const float(*)[2]) srcRowB;
rowB[j][1] + rowB[k][1]) * 0.25F;
}
}
- else if (datatype == FLOAT && comps == 1) {
+ else if (datatype == DTYPE_FLOAT && comps == 1) {
uint i, j, k;
const float *rowA = (const float *) srcRowA;
const float *rowB = (const float *) srcRowB;
}
#if 0
- else if (datatype == HALF_FLOAT && comps == 4) {
+ else if (datatype == HALF_DTYPE_FLOAT && comps == 4) {
uint i, j, k, comp;
const half_float(*rowA)[4] = (const half_float(*)[4]) srcRowA;
const half_float(*rowB)[4] = (const half_float(*)[4]) srcRowB;
}
}
}
- else if (datatype == HALF_FLOAT && comps == 3) {
+ else if (datatype == DTYPE_HALF_FLOAT && comps == 3) {
uint i, j, k, comp;
const half_float(*rowA)[3] = (const half_float(*)[3]) srcRowA;
const half_float(*rowB)[3] = (const half_float(*)[3]) srcRowB;
}
}
}
- else if (datatype == HALF_FLOAT && comps == 2) {
+ else if (datatype == DTYPE_HALF_FLOAT && comps == 2) {
uint i, j, k, comp;
const half_float(*rowA)[2] = (const half_float(*)[2]) srcRowA;
const half_float(*rowB)[2] = (const half_float(*)[2]) srcRowB;
}
}
}
- else if (datatype == HALF_FLOAT && comps == 1) {
+ else if (datatype == DTYPE_HALF_FLOAT && comps == 1) {
uint i, j, k;
const half_float *rowA = (const half_float *) srcRowA;
const half_float *rowB = (const half_float *) srcRowB;
}
#endif
- else if (datatype == UINT && comps == 1) {
+ else if (datatype == DTYPE_UINT && comps == 1) {
uint i, j, k;
const uint *rowA = (const uint *) srcRowA;
const uint *rowB = (const uint *) srcRowB;
}
}
- else if (datatype == USHORT_5_6_5 && comps == 3) {
+ else if (datatype == DTYPE_USHORT_5_6_5 && comps == 3) {
uint i, j, k;
const ushort *rowA = (const ushort *) srcRowA;
const ushort *rowB = (const ushort *) srcRowB;
dst[i] = (blue << 11) | (green << 5) | red;
}
}
- else if (datatype == USHORT_4_4_4_4 && comps == 4) {
+ else if (datatype == DTYPE_USHORT_4_4_4_4 && comps == 4) {
uint i, j, k;
const ushort *rowA = (const ushort *) srcRowA;
const ushort *rowB = (const ushort *) srcRowB;
dst[i] = (alpha << 12) | (blue << 8) | (green << 4) | red;
}
}
- else if (datatype == USHORT_1_5_5_5_REV && comps == 4) {
+ else if (datatype == DTYPE_USHORT_1_5_5_5_REV && comps == 4) {
uint i, j, k;
const ushort *rowA = (const ushort *) srcRowA;
const ushort *rowB = (const ushort *) srcRowB;
dst[i] = (alpha << 15) | (blue << 10) | (green << 5) | red;
}
}
- else if (datatype == UBYTE_3_3_2 && comps == 3) {
+ else if (datatype == DTYPE_UBYTE_3_3_2 && comps == 3) {
uint i, j, k;
const ubyte *rowA = (const ubyte *) srcRowA;
const ubyte *rowB = (const ubyte *) srcRowB;
assert(comps >= 1);
assert(comps <= 4);
- if ((datatype == UBYTE) && (comps == 4)) {
+ if ((datatype == DTYPE_UBYTE) && (comps == 4)) {
DECLARE_ROW_POINTERS(ubyte, 4);
for (i = j = 0, k = k0; i < (uint) dstWidth;
FILTER_3D(3);
}
}
- else if ((datatype == UBYTE) && (comps == 3)) {
+ else if ((datatype == DTYPE_UBYTE) && (comps == 3)) {
DECLARE_ROW_POINTERS(ubyte, 3);
for (i = j = 0, k = k0; i < (uint) dstWidth;
FILTER_3D(2);
}
}
- else if ((datatype == UBYTE) && (comps == 2)) {
+ else if ((datatype == DTYPE_UBYTE) && (comps == 2)) {
DECLARE_ROW_POINTERS(ubyte, 2);
for (i = j = 0, k = k0; i < (uint) dstWidth;
FILTER_3D(1);
}
}
- else if ((datatype == UBYTE) && (comps == 1)) {
+ else if ((datatype == DTYPE_UBYTE) && (comps == 1)) {
DECLARE_ROW_POINTERS(ubyte, 1);
for (i = j = 0, k = k0; i < (uint) dstWidth;
FILTER_3D(0);
}
}
- else if ((datatype == USHORT) && (comps == 4)) {
+ else if ((datatype == DTYPE_USHORT) && (comps == 4)) {
DECLARE_ROW_POINTERS(ushort, 4);
for (i = j = 0, k = k0; i < (uint) dstWidth;
FILTER_3D(3);
}
}
- else if ((datatype == USHORT) && (comps == 3)) {
+ else if ((datatype == DTYPE_USHORT) && (comps == 3)) {
DECLARE_ROW_POINTERS(ushort, 3);
for (i = j = 0, k = k0; i < (uint) dstWidth;
FILTER_3D(2);
}
}
- else if ((datatype == USHORT) && (comps == 2)) {
+ else if ((datatype == DTYPE_USHORT) && (comps == 2)) {
DECLARE_ROW_POINTERS(ushort, 2);
for (i = j = 0, k = k0; i < (uint) dstWidth;
FILTER_3D(1);
}
}
- else if ((datatype == USHORT) && (comps == 1)) {
+ else if ((datatype == DTYPE_USHORT) && (comps == 1)) {
DECLARE_ROW_POINTERS(ushort, 1);
for (i = j = 0, k = k0; i < (uint) dstWidth;
FILTER_3D(0);
}
}
- else if ((datatype == FLOAT) && (comps == 4)) {
+ else if ((datatype == DTYPE_FLOAT) && (comps == 4)) {
DECLARE_ROW_POINTERS(float, 4);
for (i = j = 0, k = k0; i < (uint) dstWidth;
FILTER_F_3D(3);
}
}
- else if ((datatype == FLOAT) && (comps == 3)) {
+ else if ((datatype == DTYPE_FLOAT) && (comps == 3)) {
DECLARE_ROW_POINTERS(float, 3);
for (i = j = 0, k = k0; i < (uint) dstWidth;
FILTER_F_3D(2);
}
}
- else if ((datatype == FLOAT) && (comps == 2)) {
+ else if ((datatype == DTYPE_FLOAT) && (comps == 2)) {
DECLARE_ROW_POINTERS(float, 2);
for (i = j = 0, k = k0; i < (uint) dstWidth;
FILTER_F_3D(1);
}
}
- else if ((datatype == FLOAT) && (comps == 1)) {
+ else if ((datatype == DTYPE_FLOAT) && (comps == 1)) {
DECLARE_ROW_POINTERS(float, 1);
for (i = j = 0, k = k0; i < (uint) dstWidth;
FILTER_F_3D(0);
}
}
- else if ((datatype == HALF_FLOAT) && (comps == 4)) {
+ else if ((datatype == DTYPE_HALF_FLOAT) && (comps == 4)) {
DECLARE_ROW_POINTERS(half_float, 4);
for (i = j = 0, k = k0; i < (uint) dstWidth;
FILTER_HF_3D(3);
}
}
- else if ((datatype == HALF_FLOAT) && (comps == 3)) {
+ else if ((datatype == DTYPE_HALF_FLOAT) && (comps == 3)) {
DECLARE_ROW_POINTERS(half_float, 4);
for (i = j = 0, k = k0; i < (uint) dstWidth;
FILTER_HF_3D(2);
}
}
- else if ((datatype == HALF_FLOAT) && (comps == 2)) {
+ else if ((datatype == DTYPE_HALF_FLOAT) && (comps == 2)) {
DECLARE_ROW_POINTERS(half_float, 4);
for (i = j = 0, k = k0; i < (uint) dstWidth;
FILTER_HF_3D(1);
}
}
- else if ((datatype == HALF_FLOAT) && (comps == 1)) {
+ else if ((datatype == DTYPE_HALF_FLOAT) && (comps == 1)) {
DECLARE_ROW_POINTERS(half_float, 4);
for (i = j = 0, k = k0; i < (uint) dstWidth;
FILTER_HF_3D(0);
}
}
- else if ((datatype == UINT) && (comps == 1)) {
+ else if ((datatype == DTYPE_UINT) && (comps == 1)) {
const uint *rowA = (const uint *) srcRowA;
const uint *rowB = (const uint *) srcRowB;
const uint *rowC = (const uint *) srcRowC;
dst[i] = (float)((double) tmp * 0.125);
}
}
- else if ((datatype == USHORT_5_6_5) && (comps == 3)) {
+ else if ((datatype == DTYPE_USHORT_5_6_5) && (comps == 3)) {
DECLARE_ROW_POINTERS0(ushort);
for (i = j = 0, k = k0; i < (uint) dstWidth;
dst[i] = (b << 11) | (g << 5) | r;
}
}
- else if ((datatype == USHORT_4_4_4_4) && (comps == 4)) {
+ else if ((datatype == DTYPE_USHORT_4_4_4_4) && (comps == 4)) {
DECLARE_ROW_POINTERS0(ushort);
for (i = j = 0, k = k0; i < (uint) dstWidth;
dst[i] = (a << 12) | (b << 8) | (g << 4) | r;
}
}
- else if ((datatype == USHORT_1_5_5_5_REV) && (comps == 4)) {
+ else if ((datatype == DTYPE_USHORT_1_5_5_5_REV) && (comps == 4)) {
DECLARE_ROW_POINTERS0(ushort);
for (i = j = 0, k = k0; i < (uint) dstWidth;
dst[i] = (a << 15) | (b << 10) | (g << 5) | r;
}
}
- else if ((datatype == UBYTE_3_3_2) && (comps == 3)) {
+ else if ((datatype == DTYPE_UBYTE_3_3_2) && (comps == 3)) {
DECLARE_ROW_POINTERS0(ushort);
for (i = j = 0, k = k0; i < (uint) dstWidth;
case PIPE_FORMAT_X8R8G8B8_UNORM:
case PIPE_FORMAT_B8G8R8A8_UNORM:
case PIPE_FORMAT_B8G8R8X8_UNORM:
- *datatype = UBYTE;
+ *datatype = DTYPE_UBYTE;
*comps = 4;
return;
case PIPE_FORMAT_A1R5G5B5_UNORM:
- *datatype = USHORT_1_5_5_5_REV;
+ *datatype = DTYPE_USHORT_1_5_5_5_REV;
*comps = 4;
return;
case PIPE_FORMAT_A4R4G4B4_UNORM:
- *datatype = USHORT_4_4_4_4;
+ *datatype = DTYPE_USHORT_4_4_4_4;
*comps = 4;
return;
case PIPE_FORMAT_R5G6B5_UNORM:
- *datatype = USHORT_5_6_5;
+ *datatype = DTYPE_USHORT_5_6_5;
*comps = 3;
return;
case PIPE_FORMAT_L8_UNORM:
case PIPE_FORMAT_A8_UNORM:
case PIPE_FORMAT_I8_UNORM:
- *datatype = UBYTE;
+ *datatype = DTYPE_UBYTE;
*comps = 1;
return;
case PIPE_FORMAT_A8L8_UNORM:
- *datatype = UBYTE;
+ *datatype = DTYPE_UBYTE;
*comps = 2;
return;
default:
assert(0);
- *datatype = UBYTE;
+ *datatype = DTYPE_UBYTE;
*comps = 0;
break;
}