BitScale.cpp 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. #include "BitScale.h"
  2. const uint8_t Javelin::Data::BITSCALE_5_TO_8[32] = {
  3. 0, 8, 16, 24, 32, 41, 49, 57, 65, 74,
  4. 82, 90, 98, 106, 115, 123, 131, 139, 148, 156,
  5. 164, 172, 180, 189, 197, 205, 213, 222, 230, 238,
  6. 246, 255};
  7. const uint8_t Javelin::Data::BITSCALE_4_TO_8[16] = {
  8. 0, 17, 34, 51, 68, 85, 102, 119, 136, 153,
  9. 170, 187, 204, 221, 238, 255};
  10. const uint8_t Javelin::Data::BITSCALE_3_TO_8[8] = {
  11. 0, 36, 72, 109, 145, 182, 218, 255};
  12. const uint8_t Javelin::Data::BITSCALE_8_TO_5_FLOOR[256] = {
  13. 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
  14. 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
  15. 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,
  16. 3, 3, 3, 4, 4, 4, 4, 4, 4, 4,
  17. 4, 4, 5, 5, 5, 5, 5, 5, 5, 5,
  18. 6, 6, 6, 6, 6, 6, 6, 6, 7, 7,
  19. 7, 7, 7, 7, 7, 7, 8, 8, 8, 8,
  20. 8, 8, 8, 8, 8, 9, 9, 9, 9, 9,
  21. 9, 9, 9, 10, 10, 10, 10, 10, 10, 10,
  22. 10, 11, 11, 11, 11, 11, 11, 11, 11, 12,
  23. 12, 12, 12, 12, 12, 12, 12, 13, 13, 13,
  24. 13, 13, 13, 13, 13, 13, 14, 14, 14, 14,
  25. 14, 14, 14, 14, 15, 15, 15, 15, 15, 15,
  26. 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
  27. 17, 17, 17, 17, 17, 17, 17, 17, 17, 18,
  28. 18, 18, 18, 18, 18, 18, 18, 19, 19, 19,
  29. 19, 19, 19, 19, 19, 20, 20, 20, 20, 20,
  30. 20, 20, 20, 21, 21, 21, 21, 21, 21, 21,
  31. 21, 22, 22, 22, 22, 22, 22, 22, 22, 22,
  32. 23, 23, 23, 23, 23, 23, 23, 23, 24, 24,
  33. 24, 24, 24, 24, 24, 24, 25, 25, 25, 25,
  34. 25, 25, 25, 25, 26, 26, 26, 26, 26, 26,
  35. 26, 26, 26, 27, 27, 27, 27, 27, 27, 27,
  36. 27, 28, 28, 28, 28, 28, 28, 28, 28, 29,
  37. 29, 29, 29, 29, 29, 29, 29, 30, 30, 30,
  38. 30, 30, 30, 30, 30, 31};
  39. const uint8_t Javelin::Data::BITSCALE_8_TO_4_FLOOR[256] = {
  40. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  41. 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
  42. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  43. 1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
  44. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  45. 2, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  46. 3, 3, 3, 3, 3, 3, 3, 3, 4, 4,
  47. 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
  48. 4, 4, 4, 4, 4, 5, 5, 5, 5, 5,
  49. 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  50. 5, 5, 6, 6, 6, 6, 6, 6, 6, 6,
  51. 6, 6, 6, 6, 6, 6, 6, 6, 6, 7,
  52. 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
  53. 7, 7, 7, 7, 7, 7, 8, 8, 8, 8,
  54. 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
  55. 8, 8, 8, 9, 9, 9, 9, 9, 9, 9,
  56. 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
  57. 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
  58. 10, 10, 10, 10, 10, 10, 10, 11, 11, 11,
  59. 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
  60. 11, 11, 11, 11, 12, 12, 12, 12, 12, 12,
  61. 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
  62. 12, 13, 13, 13, 13, 13, 13, 13, 13, 13,
  63. 13, 13, 13, 13, 13, 13, 13, 13, 14, 14,
  64. 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
  65. 14, 14, 14, 14, 14, 15};
  66. const uint8_t Javelin::Data::BITSCALE_8_TO_3_FLOOR[256] = {
  67. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  68. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  69. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  70. 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
  71. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  72. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  73. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  74. 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
  75. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  76. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  77. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  78. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  79. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  80. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  81. 3, 3, 3, 3, 3, 3, 4, 4, 4, 4,
  82. 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
  83. 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
  84. 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
  85. 4, 4, 4, 5, 5, 5, 5, 5, 5, 5,
  86. 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  87. 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  88. 5, 5, 5, 5, 5, 5, 5, 5, 5, 6,
  89. 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
  90. 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
  91. 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
  92. 6, 6, 6, 6, 6, 7};
  93. const uint8_t Javelin::Data::BITSCALE_8_TO_5_CEIL[256] = {
  94. 0, 1, 1, 1, 1, 1, 1, 1, 1, 2,
  95. 2, 2, 2, 2, 2, 2, 2, 3, 3, 3,
  96. 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
  97. 4, 4, 4, 5, 5, 5, 5, 5, 5, 5,
  98. 5, 5, 6, 6, 6, 6, 6, 6, 6, 6,
  99. 7, 7, 7, 7, 7, 7, 7, 7, 8, 8,
  100. 8, 8, 8, 8, 8, 8, 9, 9, 9, 9,
  101. 9, 9, 9, 9, 9, 10, 10, 10, 10, 10,
  102. 10, 10, 10, 11, 11, 11, 11, 11, 11, 11,
  103. 11, 12, 12, 12, 12, 12, 12, 12, 12, 13,
  104. 13, 13, 13, 13, 13, 13, 13, 14, 14, 14,
  105. 14, 14, 14, 14, 14, 14, 15, 15, 15, 15,
  106. 15, 15, 15, 15, 16, 16, 16, 16, 16, 16,
  107. 16, 16, 17, 17, 17, 17, 17, 17, 17, 17,
  108. 18, 18, 18, 18, 18, 18, 18, 18, 18, 19,
  109. 19, 19, 19, 19, 19, 19, 19, 20, 20, 20,
  110. 20, 20, 20, 20, 20, 21, 21, 21, 21, 21,
  111. 21, 21, 21, 22, 22, 22, 22, 22, 22, 22,
  112. 22, 23, 23, 23, 23, 23, 23, 23, 23, 23,
  113. 24, 24, 24, 24, 24, 24, 24, 24, 25, 25,
  114. 25, 25, 25, 25, 25, 25, 26, 26, 26, 26,
  115. 26, 26, 26, 26, 27, 27, 27, 27, 27, 27,
  116. 27, 27, 27, 28, 28, 28, 28, 28, 28, 28,
  117. 28, 29, 29, 29, 29, 29, 29, 29, 29, 30,
  118. 30, 30, 30, 30, 30, 30, 30, 31, 31, 31,
  119. 31, 31, 31, 31, 31, 31};
  120. const uint8_t Javelin::Data::BITSCALE_8_TO_4_CEIL[256] = {
  121. 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  122. 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
  123. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  124. 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,
  125. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  126. 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
  127. 4, 4, 4, 4, 4, 4, 4, 4, 4, 5,
  128. 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  129. 5, 5, 5, 5, 5, 5, 6, 6, 6, 6,
  130. 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
  131. 6, 6, 6, 7, 7, 7, 7, 7, 7, 7,
  132. 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
  133. 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
  134. 8, 8, 8, 8, 8, 8, 8, 9, 9, 9,
  135. 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
  136. 9, 9, 9, 9, 10, 10, 10, 10, 10, 10,
  137. 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
  138. 10, 11, 11, 11, 11, 11, 11, 11, 11, 11,
  139. 11, 11, 11, 11, 11, 11, 11, 11, 12, 12,
  140. 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
  141. 12, 12, 12, 12, 12, 13, 13, 13, 13, 13,
  142. 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
  143. 13, 13, 14, 14, 14, 14, 14, 14, 14, 14,
  144. 14, 14, 14, 14, 14, 14, 14, 14, 14, 15,
  145. 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
  146. 15, 15, 15, 15, 15, 15};
  147. const uint8_t Javelin::Data::BITSCALE_8_TO_3_CEIL[256] = {
  148. 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  149. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  150. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  151. 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
  152. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  153. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  154. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  155. 2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
  156. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  157. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  158. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  159. 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
  160. 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
  161. 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
  162. 4, 4, 4, 4, 4, 4, 5, 5, 5, 5,
  163. 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  164. 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  165. 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  166. 5, 5, 5, 6, 6, 6, 6, 6, 6, 6,
  167. 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
  168. 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
  169. 6, 6, 6, 6, 6, 6, 6, 6, 6, 7,
  170. 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
  171. 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
  172. 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
  173. 7, 7, 7, 7, 7, 7};