summaryrefslogtreecommitdiff
path: root/src/static_libs/rg_etc
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-04-21 18:42:33 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-04-21 20:11:02 +0900
commit565a4da138d7094a003acdf51325c19d23e36010 (patch)
treef9a5952594304ef0e39eb51dd400b1ffaf26e27b /src/static_libs/rg_etc
parent64ca10bcf6e4ee23f2a65f970b9f6007619b49a6 (diff)
ETC1/2: Fix clang warnings
Unused functions. I keep them around for reference, for whoever wants to work on improving the encoder. There are still some warnings. Clang is just crazy.
Diffstat (limited to 'src/static_libs/rg_etc')
-rw-r--r--src/static_libs/rg_etc/etc2_encoder.c4
-rw-r--r--src/static_libs/rg_etc/rg_etc1.c29
2 files changed, 32 insertions, 1 deletions
diff --git a/src/static_libs/rg_etc/etc2_encoder.c b/src/static_libs/rg_etc/etc2_encoder.c
index 2ed093639f..6f439078ca 100644
--- a/src/static_libs/rg_etc/etc2_encoder.c
+++ b/src/static_libs/rg_etc/etc2_encoder.c
@@ -36,10 +36,12 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36// Enable this flag when working on (quality) optimizations 36// Enable this flag when working on (quality) optimizations
37//#define DEBUG 37//#define DEBUG
38 38
39#ifdef DEBUG
39// Weights for the distance (perceptual mode) - sum is ~1024 40// Weights for the distance (perceptual mode) - sum is ~1024
40static const int R_WEIGHT = 299 * 1024 / 1000; 41static const int R_WEIGHT = 299 * 1024 / 1000;
41static const int G_WEIGHT = 587 * 1024 / 1000; 42static const int G_WEIGHT = 587 * 1024 / 1000;
42static const int B_WEIGHT = 114 * 1024 / 1000; 43static const int B_WEIGHT = 114 * 1024 / 1000;
44#endif
43 45
44static const int kTargetError[3] = { 46static const int kTargetError[3] = {
45 5*5*16, // 34 dB 47 5*5*16, // 34 dB
@@ -446,6 +448,7 @@ _etc2_h_mode_header_pack(uint8_t *etc2, Eina_Bool *swap_colors,
446 return EINA_TRUE; 448 return EINA_TRUE;
447} 449}
448 450
451#ifdef DEBUG
449static inline int 452static inline int
450_rgb_distance_percept(uint32_t color1, uint32_t color2) 453_rgb_distance_percept(uint32_t color1, uint32_t color2)
451{ 454{
@@ -454,6 +457,7 @@ _rgb_distance_percept(uint32_t color1, uint32_t color2)
454 int B = B_VAL(color1) - B_VAL(color2); 457 int B = B_VAL(color1) - B_VAL(color2);
455 return (R * R * R_WEIGHT) + (G * G * G_WEIGHT) + (B * B * B_WEIGHT); 458 return (R * R * R_WEIGHT) + (G * G * G_WEIGHT) + (B * B * B_WEIGHT);
456} 459}
460#endif
457 461
458static inline int 462static inline int
459_rgb_distance_euclid(uint32_t color1, uint32_t color2) 463_rgb_distance_euclid(uint32_t color1, uint32_t color2)
diff --git a/src/static_libs/rg_etc/rg_etc1.c b/src/static_libs/rg_etc/rg_etc1.c
index 172508ebdb..16f0ef06d1 100644
--- a/src/static_libs/rg_etc/rg_etc1.c
+++ b/src/static_libs/rg_etc/rg_etc1.c
@@ -540,6 +540,7 @@ rg_etc1_color_quad_set(unsigned int old_color, unsigned int new_color)
540 return (new_color & ~A_MASK) | (old_color & A_MASK); 540 return (new_color & ~A_MASK) | (old_color & A_MASK);
541} 541}
542 542
543#if 0
543static inline void 544static inline void
544rg_etc1_color_quad_get(unsigned int color, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *alpha) 545rg_etc1_color_quad_get(unsigned int color, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *alpha)
545{ 546{
@@ -549,6 +550,7 @@ rg_etc1_color_quad_get(unsigned int color, unsigned char *r, unsigned char *g, u
549 if (b) *b = B_VAL_GET(&color); 550 if (b) *b = B_VAL_GET(&color);
550 if (alpha) *alpha = A_VAL_GET(&color); 551 if (alpha) *alpha = A_VAL_GET(&color);
551} 552}
553#endif
552 554
553#if RG_ETC1_CONSTRAINED_SUBBLOCK 555#if RG_ETC1_CONSTRAINED_SUBBLOCK
554static inline unsigned char 556static inline unsigned char
@@ -749,6 +751,7 @@ rg_etc1_vec_scale(float r[3], float s)
749 r[i] *= s; 751 r[i] *= s;
750} 752}
751 753
754#if 0
752static inline unsigned char 755static inline unsigned char
753rg_etc1_block_byte_bits_get(const unsigned char bytes[8], unsigned char offset, unsigned char num) 756rg_etc1_block_byte_bits_get(const unsigned char bytes[8], unsigned char offset, unsigned char num)
754{ 757{
@@ -767,6 +770,7 @@ rg_etc1_block_byte_bits_set(unsigned char bytes[8], unsigned char offset, unsign
767 bytes[byte_offset] &= ~(mask << byte_bit_offset); 770 bytes[byte_offset] &= ~(mask << byte_bit_offset);
768 bytes[byte_offset] |= (((!!bits) & 0x1) << byte_bit_offset); 771 bytes[byte_offset] |= (((!!bits) & 0x1) << byte_bit_offset);
769} 772}
773#endif
770 774
771static inline unsigned char 775static inline unsigned char
772rg_etc1_block_flip_bit_get(const unsigned char bytes[8]) 776rg_etc1_block_flip_bit_get(const unsigned char bytes[8])
@@ -774,12 +778,14 @@ rg_etc1_block_flip_bit_get(const unsigned char bytes[8])
774 return (bytes[3] & 1) != 0; 778 return (bytes[3] & 1) != 0;
775} 779}
776 780
781#if 0
777static inline void 782static inline void
778rg_etc1_block_flip_bit_set(unsigned char bytes[8], unsigned char flip) 783rg_etc1_block_flip_bit_set(unsigned char bytes[8], unsigned char flip)
779{ 784{
780 bytes[3] &= ~1; 785 bytes[3] &= ~1;
781 bytes[3] |= (!!flip) & 0x1; 786 bytes[3] |= (!!flip) & 0x1;
782} 787}
788#endif
783 789
784static inline unsigned char 790static inline unsigned char
785rg_etc1_block_diff_bit_get(const unsigned char bytes[8]) 791rg_etc1_block_diff_bit_get(const unsigned char bytes[8])
@@ -787,6 +793,7 @@ rg_etc1_block_diff_bit_get(const unsigned char bytes[8])
787 return (bytes[3] & 2) != 0; 793 return (bytes[3] & 2) != 0;
788} 794}
789 795
796#if 0
790static inline void 797static inline void
791rg_etc1_block_diff_bit_set(unsigned char bytes[8], unsigned char diff) 798rg_etc1_block_diff_bit_set(unsigned char bytes[8], unsigned char diff)
792{ 799{
@@ -862,6 +869,7 @@ rg_etc1_block_selector_set(unsigned char bytes[8], unsigned char x, unsigned cha
862 p[-2] &= ~mask; 869 p[-2] &= ~mask;
863 p[-2] |= (msb << byte_bit_offsets); 870 p[-2] |= (msb << byte_bit_offsets);
864} 871}
872#endif
865 873
866static inline unsigned short 874static inline unsigned short
867rg_etc_block_base4_color_get(const unsigned char bytes[8], unsigned char idx) 875rg_etc_block_base4_color_get(const unsigned char bytes[8], unsigned char idx)
@@ -884,6 +892,7 @@ rg_etc_block_base4_color_get(const unsigned char bytes[8], unsigned char idx)
884 return b | (g << 4) | (r << 8); 892 return b | (g << 4) | (r << 8);
885} 893}
886 894
895#if 0
887static inline void 896static inline void
888rg_etc1_block_base4_color_set(unsigned char bytes[8], unsigned char idx, unsigned short c) 897rg_etc1_block_base4_color_set(unsigned char bytes[8], unsigned char idx, unsigned short c)
889{ 898{
@@ -900,6 +909,7 @@ rg_etc1_block_base4_color_set(unsigned char bytes[8], unsigned char idx, unsigne
900 rg_etc1_block_byte_bits_set(bytes, cETC1AbsColor4B1BitOffset, 4, c & 15); 909 rg_etc1_block_byte_bits_set(bytes, cETC1AbsColor4B1BitOffset, 4, c & 15);
901 } 910 }
902} 911}
912#endif
903 913
904static inline unsigned short 914static inline unsigned short
905rg_etc1_block_base5_color_get(const unsigned char bytes[8]) 915rg_etc1_block_base5_color_get(const unsigned char bytes[8])
@@ -913,6 +923,7 @@ rg_etc1_block_base5_color_get(const unsigned char bytes[8])
913 return b | (g << 5) | (r << 10); 923 return b | (g << 5) | (r << 10);
914} 924}
915 925
926#if 0
916static inline void 927static inline void
917rg_etc1_block_base5_color_set(unsigned char bytes[8], unsigned short c) 928rg_etc1_block_base5_color_set(unsigned char bytes[8], unsigned short c)
918{ 929{
@@ -920,6 +931,7 @@ rg_etc1_block_base5_color_set(unsigned char bytes[8], unsigned short c)
920 rg_etc1_block_byte_bits_set(bytes, cETC1BaseColor5GBitOffset, 5, (c >> 5) & 31); 931 rg_etc1_block_byte_bits_set(bytes, cETC1BaseColor5GBitOffset, 5, (c >> 5) & 31);
921 rg_etc1_block_byte_bits_set(bytes, cETC1BaseColor5BBitOffset, 5, c & 31); 932 rg_etc1_block_byte_bits_set(bytes, cETC1BaseColor5BBitOffset, 5, c & 31);
922} 933}
934#endif
923 935
924static inline unsigned short 936static inline unsigned short
925rg_etc1_block_delta3_color_get(const unsigned char bytes[8]) 937rg_etc1_block_delta3_color_get(const unsigned char bytes[8])
@@ -933,6 +945,7 @@ rg_etc1_block_delta3_color_get(const unsigned char bytes[8])
933 return b | (g << 3) | (r << 6); 945 return b | (g << 3) | (r << 6);
934} 946}
935 947
948#if 0
936static inline void 949static inline void
937rg_etc1_block_delta3_color_set(unsigned char bytes[8], unsigned short c) 950rg_etc1_block_delta3_color_set(unsigned char bytes[8], unsigned short c)
938{ 951{
@@ -967,6 +980,7 @@ rg_etc1_block_color5_pack(unsigned int c, unsigned char scaled, unsigned char bi
967 rg_etc1_color_quad_get(c, &r, &g, &b, NULL); 980 rg_etc1_color_quad_get(c, &r, &g, &b, NULL);
968 return rg_etc1_block_color5_component_pack(r, g, b, scaled, bias); 981 return rg_etc1_block_color5_component_pack(r, g, b, scaled, bias);
969} 982}
983#endif
970 984
971static inline void 985static inline void
972rg_etc1_block_color5_component_unpack(unsigned char *r, unsigned char *g, unsigned char *b, 986rg_etc1_block_color5_component_unpack(unsigned char *r, unsigned char *g, unsigned char *b,
@@ -984,6 +998,7 @@ rg_etc1_block_color5_component_unpack(unsigned char *r, unsigned char *g, unsign
984 } 998 }
985} 999}
986 1000
1001#if 0
987static inline unsigned int 1002static inline unsigned int
988rg_etc1_block_color5_unpack(unsigned short packed_color5, unsigned char scaled, unsigned char alpha) 1003rg_etc1_block_color5_unpack(unsigned short packed_color5, unsigned char scaled, unsigned char alpha)
989{ 1004{
@@ -1009,6 +1024,7 @@ rg_etc1_block_delta3_pack(char r, char g, char b)
1009 1024
1010 return b | (g << 3) | (r << 6); 1025 return b | (g << 3) | (r << 6);
1011} 1026}
1027#endif
1012 1028
1013// Results range from -4 to 3 (cETC1ColorDeltaMin to cETC1ColorDeltaMax) 1029// Results range from -4 to 3 (cETC1ColorDeltaMin to cETC1ColorDeltaMax)
1014static inline void 1030static inline void
@@ -1023,6 +1039,7 @@ rg_etc1_block_delta3_unpack(char *r, char *g, char *b, unsigned short packed_del
1023 if (*b >= 4) *b -= 8; 1039 if (*b >= 4) *b -= 8;
1024} 1040}
1025 1041
1042#if 0
1026static inline unsigned short 1043static inline unsigned short
1027rg_etc1_block_color4_component_pack(unsigned char r, unsigned char g, unsigned char b, 1044rg_etc1_block_color4_component_pack(unsigned char r, unsigned char g, unsigned char b,
1028 unsigned char scaled, unsigned char bias) 1045 unsigned char scaled, unsigned char bias)
@@ -1049,6 +1066,7 @@ rg_etc1_block_color4_pack(unsigned int color, unsigned char scaled, unsigned cha
1049 rg_etc1_color_quad_get(color, &r, &g, &b, NULL); 1066 rg_etc1_color_quad_get(color, &r, &g, &b, NULL);
1050 return rg_etc1_block_color4_component_pack(r, g, b, scaled, bias); 1067 return rg_etc1_block_color4_component_pack(r, g, b, scaled, bias);
1051} 1068}
1069#endif
1052 1070
1053static inline void 1071static inline void
1054rg_etc1_block_color4_component_unpack(unsigned char *r, unsigned char *g, unsigned char *b, 1072rg_etc1_block_color4_component_unpack(unsigned char *r, unsigned char *g, unsigned char *b,
@@ -1066,6 +1084,7 @@ rg_etc1_block_color4_component_unpack(unsigned char *r, unsigned char *g, unsign
1066 } 1084 }
1067} 1085}
1068 1086
1087#if 0
1069static inline unsigned int 1088static inline unsigned int
1070rg_etc1_block_color4_unpack(unsigned short packed_color4, unsigned char scaled, unsigned char alpha) 1089rg_etc1_block_color4_unpack(unsigned short packed_color4, unsigned char scaled, unsigned char alpha)
1071{ 1090{
@@ -1075,6 +1094,7 @@ rg_etc1_block_color4_unpack(unsigned short packed_color4, unsigned char scaled,
1075 1094
1076 return rg_etc1_color_quad_init(r, g, b, alpha); 1095 return rg_etc1_color_quad_init(r, g, b, alpha);
1077} 1096}
1097#endif
1078 1098
1079 1099
1080static inline unsigned char 1100static inline unsigned char
@@ -1108,7 +1128,7 @@ rg_etc1_block_color5_delta3_component_unpack(unsigned char *r, unsigned char *g,
1108 return success; 1128 return success;
1109} 1129}
1110 1130
1111 1131#if 0
1112static inline unsigned char 1132static inline unsigned char
1113rg_etc1_block_color5_delta3_unpack(unsigned int *result, 1133rg_etc1_block_color5_delta3_unpack(unsigned int *result,
1114 unsigned short packed_color5, unsigned short packed_delta3, 1134 unsigned short packed_color5, unsigned short packed_delta3,
@@ -1122,6 +1142,7 @@ rg_etc1_block_color5_delta3_unpack(unsigned int *result,
1122 *result = rg_etc1_color_quad_init(r, g, b, alpha); 1142 *result = rg_etc1_color_quad_init(r, g, b, alpha);
1123 return success; 1143 return success;
1124} 1144}
1145#endif
1125 1146
1126static inline void 1147static inline void
1127rg_etc1_block_sublock_diff(unsigned int dst[4], const int *pInten_modifer_table, 1148rg_etc1_block_sublock_diff(unsigned int dst[4], const int *pInten_modifer_table,
@@ -1523,6 +1544,7 @@ rg_etc1_solution_coordinates_component_set(Etc1_Solution_Coordinates *solution,
1523 solution->m_color4 = color4; 1544 solution->m_color4 = color4;
1524} 1545}
1525 1546
1547#if 0
1526static inline void 1548static inline void
1527rg_etc1_solution_coordinates_set(Etc1_Solution_Coordinates *solution, 1549rg_etc1_solution_coordinates_set(Etc1_Solution_Coordinates *solution,
1528 color_quad_u8 unscaled_color, unsigned int inten_table, unsigned char color4) 1550 color_quad_u8 unscaled_color, unsigned int inten_table, unsigned char color4)
@@ -1531,6 +1553,7 @@ rg_etc1_solution_coordinates_set(Etc1_Solution_Coordinates *solution,
1531 solution->m_inten_table = inten_table; 1553 solution->m_inten_table = inten_table;
1532 solution->m_color4 = color4; 1554 solution->m_color4 = color4;
1533} 1555}
1556#endif
1534 1557
1535static inline void 1558static inline void
1536rg_etc1_solution_coordinates_clear(Etc1_Solution_Coordinates *solution) 1559rg_etc1_solution_coordinates_clear(Etc1_Solution_Coordinates *solution)
@@ -1569,6 +1592,7 @@ rg_etc1_solution_coordinates_get_scaled_color(color_quad_u8 *color, const Etc1_S
1569 rg_etc1_color_quad_u8_init(color, br, bg, bb, 255); 1592 rg_etc1_color_quad_u8_init(color, br, bg, bb, 255);
1570} 1593}
1571 1594
1595#if 0
1572static inline void 1596static inline void
1573rg_etc1_solution_coordinates_block_colors_get(const Etc1_Solution_Coordinates *coords, color_quad_u8 colors[4]) 1597rg_etc1_solution_coordinates_block_colors_get(const Etc1_Solution_Coordinates *coords, color_quad_u8 colors[4])
1574{ 1598{
@@ -1581,6 +1605,7 @@ rg_etc1_solution_coordinates_block_colors_get(const Etc1_Solution_Coordinates *c
1581 for (i = 0; i < 4; i++) 1605 for (i = 0; i < 4; i++)
1582 rg_etc1_color_quad_u8_init(&colors[i], br + pInten_table[i], bg + pInten_table[i], bb + pInten_table[i], 255); 1606 rg_etc1_color_quad_u8_init(&colors[i], br + pInten_table[i], bg + pInten_table[i], bb + pInten_table[i], 255);
1583} 1607}
1608#endif
1584 1609
1585static inline void 1610static inline void
1586rg_etc1_pack_params_clear(rg_etc1_pack_params *params) 1611rg_etc1_pack_params_clear(rg_etc1_pack_params *params)
@@ -1620,12 +1645,14 @@ rg_etc1_optimizer_params_clean(rg_etc1_optimizer_params *params)
1620 params->m_constrain_against_base_color5 = EINA_FALSE; 1645 params->m_constrain_against_base_color5 = EINA_FALSE;
1621} 1646}
1622 1647
1648#if 0
1623static inline void 1649static inline void
1624rg_etc1_optimizer_params_base_clear(rg_etc1_optimizer_params *params) 1650rg_etc1_optimizer_params_base_clear(rg_etc1_optimizer_params *params)
1625{ 1651{
1626 rg_etc1_pack_params_clear(params->base_params); 1652 rg_etc1_pack_params_clear(params->base_params);
1627 rg_etc1_optimizer_params_clean(params); 1653 rg_etc1_optimizer_params_clean(params);
1628} 1654}
1655#endif
1629 1656
1630typedef struct 1657typedef struct
1631{ 1658{