1. yuv fix for unused algorithm :)

2. jose's 16bit speedup patches. quick summary:

speedups:
large dither 409 -> 518
small dither 451 -> 524
no dither    728 -> 757

(reference) 32bit gets: 853



SVN revision: 36369
This commit is contained in:
Carsten Haitzler 2008-10-01 02:27:18 +00:00
parent beaa909d45
commit 4e809cf60d
2 changed files with 109 additions and 63 deletions

View File

@ -19,55 +19,82 @@ extern const DATA8 _evas_dither_128128[128][128];
void
evas_common_convert_rgba2_to_16bpp_rgb_565_dith (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
{
DATA32 *src_ptr;
DATA16 *dst_ptr;
#ifndef BUILD_NO_DITHER_MASK
DATA16 *d = (DATA16 *)dst;
int r1, g1, b1;
int r2, g2, b2;
int dith, dith2;
int x, y;
DATA8 r1, g1, b1;
DATA8 r2, g2, b2;
#ifndef BUILD_NO_DITHER_MASK
DATA8 dith, dith2;
#endif
dst_ptr = (DATA16 *)dst;
for (y = 0; y < h; y++)
{
for (x = 0; x < w; x++)
{
DATA32 p = *src++, q = *src++;
CONVERT_LOOP2_START_ROT_0();
dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK];
dith2 = dith >> DM_SHF(6);
dith >>= DM_SHF(5);
r1 = (p & 0xff0000) >> 19;
g1 = (p & 0xff00) >> 10;
b1 = (p & 0xff) >> 3;
if ((r1 < 0x1f) && ((((p & 0xff0000) >> 16) - (r1 << 3)) >= dith )) r1++;
if ((g1 < 0x3f) && ((((p & 0xff00) >> 8) - (g1 << 2)) >= dith2)) g1++;
if ((b1 < 0x1f) && (((p & 0xff) - (b1 << 3)) >= dith )) b1++;
r1 = (R_VAL(src_ptr)) >> 3;
g1 = (G_VAL(src_ptr)) >> 2;
b1 = (B_VAL(src_ptr)) >> 3;
#ifndef BUILD_NO_DITHER_MASK
dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
if (((R_VAL(src_ptr) - (r1 << 3)) >= dith ) && (r1 < 0x1f)) r1++;
if (((G_VAL(src_ptr) - (g1 << 2)) >= dith2) && (g1 < 0x3f)) g1++;
if (((B_VAL(src_ptr) - (b1 << 3)) >= dith ) && (b1 < 0x1f)) b1++;
#endif
CONVERT_LOOP2_INC_ROT_0();
r2 = (R_VAL(src_ptr)) >> 3;
g2 = (G_VAL(src_ptr)) >> 2;
b2 = (B_VAL(src_ptr)) >> 3;
#ifndef BUILD_NO_DITHER_MASK
dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
if (((R_VAL(src_ptr) - (r2 << 3)) >= dith ) && (r2 < 0x1f)) r2++;
if (((G_VAL(src_ptr) - (g2 << 2)) >= dith2) && (g2 < 0x3f)) g2++;
if (((B_VAL(src_ptr) - (b2 << 3)) >= dith ) && (b2 < 0x1f)) b2++;
#endif
x++;
dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK];
dith2 = dith >> DM_SHF(6);
dith >>= DM_SHF(5);
r2 = (q & 0xff0000) >> 19;
g2 = (q & 0xff00) >> 10;
b2 = (q & 0xff) >> 3;
if ((r2 < 0x1f) && ((((q & 0xff0000) >> 16) - (r2 << 3)) >= dith )) r2++;
if ((g2 < 0x3f) && ((((q & 0xff00) >> 8) - (g2 << 2)) >= dith2)) g2++;
if ((b2 < 0x1f) && (((q & 0xff) - (b2 << 3)) >= dith )) b2++;
#ifndef WORDS_BIGENDIAN
*((DATA32 *)dst_ptr) =
(r2 << 27) | (g2 << 21) | (b2 << 16) |
(r1 << 11) | (g1 << 5 ) | (b1 );
*((DATA32 *)d) = (r2 << 27) | (g2 << 21) | (b2 << 16) |
(r1 << 11) | (g1 << 5) | (b1);
#else
*((DATA32 *)dst_ptr) =
(r1 << 27) | (g1 << 21) | (b1 << 16) |
(r2 << 11) | (g2 << 5 ) | (b2 );
*((DATA32 *)d) = (r1 << 27) | (g1 << 21) | (b1 << 16) |
(r2 << 11) | (g2 << 5) | (b2);
#endif
CONVERT_LOOP2_END_ROT_0();
d += 2;
}
src += src_jump;
d += dst_jump;
}
return;
pal = 0;
#else
DATA16 *d = (DATA16 *)dst;
int w0 = w;
while (h--)
{
while (w > 0)
{
DATA32 p = *src++, q = *src++;
#ifndef WORDS_BIGENDIAN
*((DATA32 *)d) =
(((q & 0xff0000) >> 19) << 27) | (((q & 0xff00) >> 10) << 21) | (((q & 0xff) >> 3) << 16) |
(((p & 0xff0000) >> 19) << 11) | (((p & 0xff00) >> 10) << 5) | ((p & 0xff) >> 3);
#else
*((DATA32 *)d) =
(((p & 0xff0000) >> 19) << 27) | (((p & 0xff00) >> 10) << 21) | (((p & 0xff) >> 3) << 16) |
(((q & 0xff0000) >> 19) << 11) | (((q & 0xff00) >> 10) << 5) | ((q & 0xff) >> 3);
#endif
d += 2; w -= 2;
}
w = w0;
src += src_jump;
d += dst_jump;
}
return;
pal = 0;
#endif
}
#endif
#endif
@ -77,35 +104,53 @@ evas_common_convert_rgba2_to_16bpp_rgb_565_dith (DATA32 *src, DATA8 *dst, int sr
void
evas_common_convert_rgba_to_16bpp_rgb_565_dith (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
{
DATA32 *src_ptr;
DATA16 *dst_ptr;
#ifndef BUILD_NO_DITHER_MASK
DATA16 *d = (DATA16 *)dst;
int r, g, b;
int dith, dith2;
int x, y;
DATA8 r, g, b;
#ifndef BUILD_NO_DITHER_MASK
DATA8 dith, dith2;
#endif
dst_ptr = (DATA16 *)dst;
for (y = 0; y < h; y++)
{
for (x = 0; x < w; x++)
{
DATA32 p = *src++;
CONVERT_LOOP_START_ROT_0();
dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK];
dith2 = dith >> DM_SHF(6);
dith >>= DM_SHF(5);
r = (p & 0xff0000) >> 19;
g = (p & 0xff00) >> 10;
b = (p & 0xff) >> 3;
if ((r < 0x1f) && ((((p & 0xff0000) >> 16) - (r << 3)) >= dith )) r++;
if ((g < 0x3f) && ((((p & 0xff00) >> 8) - (g << 2)) >= dith2)) g++;
if ((b < 0x1f) && (((p & 0xff) - (b << 3)) >= dith )) b++;
r = (R_VAL(src_ptr)) >> 3;
g = (G_VAL(src_ptr)) >> 2;
b = (B_VAL(src_ptr)) >> 3;
#ifndef BUILD_NO_DITHER_MASK
dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
if (((R_VAL(src_ptr) - (r << 3)) >= dith ) && (r < 0x1f)) r++;
if (((G_VAL(src_ptr) - (g << 2)) >= dith2) && (g < 0x3f)) g++;
if (((B_VAL(src_ptr) - (b << 3)) >= dith ) && (b < 0x1f)) b++;
#endif
*dst_ptr = (r << 11) | (g << 5) | (b);
CONVERT_LOOP_END_ROT_0();
*d++ = (r << 11) | (g << 5) | b;
}
src += src_jump;
d += dst_jump;
}
return;
pal = 0;
#else
DATA16 *d = (DATA16 *)dst;
int w0 = w;
while (h--)
{
while (w--)
{
*d++ = (((*src & 0xff0000) >> 19) << 11) | (((*src & 0xff00) >> 10) << 5) | ((*src & 0xff) >> 3);
src++;
}
w = w0;
src += src_jump;
d += dst_jump;
}
return;
pal = 0;
#endif
}
#endif
#endif
@ -1957,3 +2002,4 @@ evas_common_convert_rgba_to_16bpp_rgb_555_dith_rot_90 (DATA32 *src, DATA8 *dst,
}
#endif
#endif

View File

@ -761,7 +761,7 @@ _evas_yv12torgb_diz(unsigned char **yuv, unsigned char *rgb, int w, int h)
crv = CRV; /* 1.596 */
cbu = CBU; /* 2.018 */
cgu = CGU; /* 0.391 */
cgv = CGU; /* 0.813 */
cgv = CGV; /* 0.813 */
for (yy = 0; yy < h; yy += 2)
{