void evas_common_convert_rgba_to_8bpp_rgb_232_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; DATA8 *dst_ptr; int x, y; DATA8 r, g, b; DATA8 dith, dith2; dst_ptr = (DATA8 *)dst; CONVERT_LOOP_START_ROT_0(); dith = DM_SHR(DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK], 3); dith2 = DM_SHR(DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK], 2); /* r = (R_VAL(src_ptr)) >> (8 - 2);*/ /* g = (G_VAL(src_ptr)) >> (8 - 3);*/ /* b = (B_VAL(src_ptr)) >> (8 - 2);*/ /* if (((R_VAL(src_ptr) - (r << (8 - 2))) >= dith2) && (r < 0x03)) r++;*/ /* if (((G_VAL(src_ptr) - (g << (8 - 3))) >= dith ) && (g < 0x07)) g++;*/ /* if (((B_VAL(src_ptr) - (b << (8 - 2))) >= dith2) && (b < 0x03)) b++;*/ r = (R_VAL(src_ptr)) * 3 / 255; if (((R_VAL(src_ptr) - (r * 255 / 3)) >= dith2) && (r < 0x03)) r++; g = (G_VAL(src_ptr)) * 7 / 255; if (((G_VAL(src_ptr) - (g * 255 / 7)) >= dith ) && (g < 0x07)) g++; b = (B_VAL(src_ptr)) * 3 / 255; if (((B_VAL(src_ptr) - (b * 255 / 3)) >= dith2) && (b < 0x03)) b++; *dst_ptr = pal[(r << 5) | (g << 2) | (b)]; CONVERT_LOOP_END_ROT_0(); }
void evas_common_convert_rgba_to_8bpp_rgb_666_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; DATA8 *dst_ptr; int x, y; DATA8 r, g, b; DATA8 dith; static int tables_calcualted = 0; if (!tables_calcualted) { int i; tables_calcualted = 1; for (i = 0; i < 256; i++) p_to_6[i] = (i * 5) / 255; for (i = 0; i < 256; i++) p_to_6_err[i] = ((i * 5) - (p_to_6[i] * 255)) * DM_DIV / 255; } dst_ptr = (DATA8 *)dst; CONVERT_LOOP_START_ROT_0(); r = p_to_6[(R_VAL(src_ptr))]; g = p_to_6[(G_VAL(src_ptr))]; b = p_to_6[(B_VAL(src_ptr))]; dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK]; if ((p_to_6_err[(R_VAL(src_ptr))] >= dith ) && (r < 5)) r++; if ((p_to_6_err[(G_VAL(src_ptr))] >= dith ) && (g < 5)) g++; if ((p_to_6_err[(B_VAL(src_ptr))] >= dith ) && (b < 5)) b++; *dst_ptr = pal[(r * 36) + (g * 6) + (b)]; CONVERT_LOOP_END_ROT_0(); }
void evas_common_convert_rgba_to_8bpp_pal_gray64(DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x EINA_UNUSED, int dith_y EINA_UNUSED, DATA8 *pal) { DATA32 *src_ptr; DATA8 *dst_ptr; int x, y; DATA8 Y; dst_ptr = dst; CONVERT_LOOP_START_ROT_0(); /* RGB -> YUV conversion */ Y = ((R_VAL(src_ptr) * 76) + (G_VAL(src_ptr) * 151) + (B_VAL(src_ptr) * 29)) >> 10; *dst_ptr = pal[Y]; CONVERT_LOOP_END_ROT_0(); }