mpeg4data.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. /*
  2. * copyright (c) 2000,2001 Fabrice Bellard
  3. * H.263+ support
  4. * copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
  5. *
  6. * This file is part of FFmpeg.
  7. *
  8. * FFmpeg is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * FFmpeg is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with FFmpeg; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. */
  22. /**
  23. * @file
  24. * MPEG-4 tables.
  25. */
  26. #ifndef AVCODEC_MPEG4DATA_H
  27. #define AVCODEC_MPEG4DATA_H
  28. #include <stdint.h>
  29. #include "mpegvideo.h"
  30. /* dc encoding for MPEG-4 */
  31. const uint8_t ff_mpeg4_DCtab_lum[13][2] =
  32. {
  33. {3,3}, {3,2}, {2,2}, {2,3}, {1,3}, {1,4}, {1,5}, {1,6}, {1,7},
  34. {1,8}, {1,9}, {1,10}, {1,11},
  35. };
  36. const uint8_t ff_mpeg4_DCtab_chrom[13][2] =
  37. {
  38. {3,2}, {2,2}, {1,2}, {1,3}, {1,4}, {1,5}, {1,6}, {1,7}, {1,8},
  39. {1,9}, {1,10}, {1,11}, {1,12},
  40. };
  41. const uint16_t ff_mpeg4_intra_vlc[103][2] = {
  42. { 0x2, 2 },
  43. { 0x6, 3 },{ 0xf, 4 },{ 0xd, 5 },{ 0xc, 5 },
  44. { 0x15, 6 },{ 0x13, 6 },{ 0x12, 6 },{ 0x17, 7 },
  45. { 0x1f, 8 },{ 0x1e, 8 },{ 0x1d, 8 },{ 0x25, 9 },
  46. { 0x24, 9 },{ 0x23, 9 },{ 0x21, 9 },{ 0x21, 10 },
  47. { 0x20, 10 },{ 0xf, 10 },{ 0xe, 10 },{ 0x7, 11 },
  48. { 0x6, 11 },{ 0x20, 11 },{ 0x21, 11 },{ 0x50, 12 },
  49. { 0x51, 12 },{ 0x52, 12 },{ 0xe, 4 },{ 0x14, 6 },
  50. { 0x16, 7 },{ 0x1c, 8 },{ 0x20, 9 },{ 0x1f, 9 },
  51. { 0xd, 10 },{ 0x22, 11 },{ 0x53, 12 },{ 0x55, 12 },
  52. { 0xb, 5 },{ 0x15, 7 },{ 0x1e, 9 },{ 0xc, 10 },
  53. { 0x56, 12 },{ 0x11, 6 },{ 0x1b, 8 },{ 0x1d, 9 },
  54. { 0xb, 10 },{ 0x10, 6 },{ 0x22, 9 },{ 0xa, 10 },
  55. { 0xd, 6 },{ 0x1c, 9 },{ 0x8, 10 },{ 0x12, 7 },
  56. { 0x1b, 9 },{ 0x54, 12 },{ 0x14, 7 },{ 0x1a, 9 },
  57. { 0x57, 12 },{ 0x19, 8 },{ 0x9, 10 },{ 0x18, 8 },
  58. { 0x23, 11 },{ 0x17, 8 },{ 0x19, 9 },{ 0x18, 9 },
  59. { 0x7, 10 },{ 0x58, 12 },{ 0x7, 4 },{ 0xc, 6 },
  60. { 0x16, 8 },{ 0x17, 9 },{ 0x6, 10 },{ 0x5, 11 },
  61. { 0x4, 11 },{ 0x59, 12 },{ 0xf, 6 },{ 0x16, 9 },
  62. { 0x5, 10 },{ 0xe, 6 },{ 0x4, 10 },{ 0x11, 7 },
  63. { 0x24, 11 },{ 0x10, 7 },{ 0x25, 11 },{ 0x13, 7 },
  64. { 0x5a, 12 },{ 0x15, 8 },{ 0x5b, 12 },{ 0x14, 8 },
  65. { 0x13, 8 },{ 0x1a, 8 },{ 0x15, 9 },{ 0x14, 9 },
  66. { 0x13, 9 },{ 0x12, 9 },{ 0x11, 9 },{ 0x26, 11 },
  67. { 0x27, 11 },{ 0x5c, 12 },{ 0x5d, 12 },{ 0x5e, 12 },
  68. { 0x5f, 12 },{ 0x3, 7 },
  69. };
  70. const int8_t ff_mpeg4_intra_level[102] = {
  71. 1, 2, 3, 4, 5, 6, 7, 8,
  72. 9, 10, 11, 12, 13, 14, 15, 16,
  73. 17, 18, 19, 20, 21, 22, 23, 24,
  74. 25, 26, 27, 1, 2, 3, 4, 5,
  75. 6, 7, 8, 9, 10, 1, 2, 3,
  76. 4, 5, 1, 2, 3, 4, 1, 2,
  77. 3, 1, 2, 3, 1, 2, 3, 1,
  78. 2, 3, 1, 2, 1, 2, 1, 1,
  79. 1, 1, 1, 1, 2, 3, 4, 5,
  80. 6, 7, 8, 1, 2, 3, 1, 2,
  81. 1, 2, 1, 2, 1, 2, 1, 2,
  82. 1, 1, 1, 1, 1, 1, 1, 1,
  83. 1, 1, 1, 1, 1, 1,
  84. };
  85. const int8_t ff_mpeg4_intra_run[102] = {
  86. 0, 0, 0, 0, 0, 0, 0, 0,
  87. 0, 0, 0, 0, 0, 0, 0, 0,
  88. 0, 0, 0, 0, 0, 0, 0, 0,
  89. 0, 0, 0, 1, 1, 1, 1, 1,
  90. 1, 1, 1, 1, 1, 2, 2, 2,
  91. 2, 2, 3, 3, 3, 3, 4, 4,
  92. 4, 5, 5, 5, 6, 6, 6, 7,
  93. 7, 7, 8, 8, 9, 9, 10, 11,
  94. 12, 13, 14, 0, 0, 0, 0, 0,
  95. 0, 0, 0, 1, 1, 1, 2, 2,
  96. 3, 3, 4, 4, 5, 5, 6, 6,
  97. 7, 8, 9, 10, 11, 12, 13, 14,
  98. 15, 16, 17, 18, 19, 20,
  99. };
  100. RLTable ff_mpeg4_rl_intra = {
  101. 102,
  102. 67,
  103. ff_mpeg4_intra_vlc,
  104. ff_mpeg4_intra_run,
  105. ff_mpeg4_intra_level,
  106. };
  107. /* Note this is identical to the intra rvlc except that it is reordered. */
  108. static const uint16_t inter_rvlc[170][2]={
  109. {0x0006, 3},{0x0001, 4},{0x0004, 5},{0x001C, 7},
  110. {0x003C, 8},{0x003D, 8},{0x007C, 9},{0x00FC, 10},
  111. {0x00FD, 10},{0x01FC, 11},{0x01FD, 11},{0x03FC, 12},
  112. {0x07FC, 13},{0x07FD, 13},{0x0BFC, 13},{0x0BFD, 13},
  113. {0x0FFC, 14},{0x0FFD, 14},{0x1FFC, 15},{0x0007, 3},
  114. {0x000C, 6},{0x005C, 8},{0x007D, 9},{0x017C, 10},
  115. {0x02FC, 11},{0x03FD, 12},{0x0DFC, 13},{0x17FC, 14},
  116. {0x17FD, 14},{0x000A, 4},{0x001D, 7},{0x00BC, 9},
  117. {0x02FD, 11},{0x05FC, 12},{0x1BFC, 14},{0x1BFD, 14},
  118. {0x0005, 5},{0x005D, 8},{0x017D, 10},{0x05FD, 12},
  119. {0x0DFD, 13},{0x1DFC, 14},{0x1FFD, 15},{0x0008, 5},
  120. {0x006C, 8},{0x037C, 11},{0x0EFC, 13},{0x2FFC, 15},
  121. {0x0009, 5},{0x00BD, 9},{0x037D, 11},{0x0EFD, 13},
  122. {0x000D, 6},{0x01BC, 10},{0x06FC, 12},{0x1DFD, 14},
  123. {0x0014, 6},{0x01BD, 10},{0x06FD, 12},{0x2FFD, 15},
  124. {0x0015, 6},{0x01DC, 10},{0x0F7C, 13},{0x002C, 7},
  125. {0x01DD, 10},{0x1EFC, 14},{0x002D, 7},{0x03BC, 11},
  126. {0x0034, 7},{0x077C, 12},{0x006D, 8},{0x0F7D, 13},
  127. {0x0074, 8},{0x1EFD, 14},{0x0075, 8},{0x1F7C, 14},
  128. {0x00DC, 9},{0x1F7D, 14},{0x00DD, 9},{0x1FBC, 14},
  129. {0x00EC, 9},{0x37FC, 15},{0x01EC, 10},{0x01ED, 10},
  130. {0x01F4, 10},{0x03BD, 11},{0x03DC, 11},{0x03DD, 11},
  131. {0x03EC, 11},{0x03ED, 11},{0x03F4, 11},{0x077D, 12},
  132. {0x07BC, 12},{0x07BD, 12},{0x0FBC, 13},{0x0FBD, 13},
  133. {0x0FDC, 13},{0x0FDD, 13},{0x1FBD, 14},{0x1FDC, 14},
  134. {0x1FDD, 14},{0x37FD, 15},{0x3BFC, 15},
  135. {0x000B, 4},{0x0078, 8},{0x03F5, 11},{0x0FEC, 13},
  136. {0x1FEC, 14},{0x0012, 5},{0x00ED, 9},{0x07DC, 12},
  137. {0x1FED, 14},{0x3BFD, 15},{0x0013, 5},{0x03F8, 11},
  138. {0x3DFC, 15},{0x0018, 6},{0x07DD, 12},{0x0019, 6},
  139. {0x07EC, 12},{0x0022, 6},{0x0FED, 13},{0x0023, 6},
  140. {0x0FF4, 13},{0x0035, 7},{0x0FF5, 13},{0x0038, 7},
  141. {0x0FF8, 13},{0x0039, 7},{0x0FF9, 13},{0x0042, 7},
  142. {0x1FF4, 14},{0x0043, 7},{0x1FF5, 14},{0x0079, 8},
  143. {0x1FF8, 14},{0x0082, 8},{0x3DFD, 15},{0x0083, 8},
  144. {0x00F4, 9},{0x00F5, 9},{0x00F8, 9},{0x00F9, 9},
  145. {0x0102, 9},{0x0103, 9},{0x01F5, 10},{0x01F8, 10},
  146. {0x01F9, 10},{0x0202, 10},{0x0203, 10},{0x03F9, 11},
  147. {0x0402, 11},{0x0403, 11},{0x07ED, 12},{0x07F4, 12},
  148. {0x07F5, 12},{0x07F8, 12},{0x07F9, 12},{0x0802, 12},
  149. {0x0803, 12},{0x1002, 13},{0x1003, 13},{0x1FF9, 14},
  150. {0x2002, 14},{0x2003, 14},{0x3EFC, 15},{0x3EFD, 15},
  151. {0x3F7C, 15},{0x3F7D, 15},{0x0000, 4}
  152. };
  153. static const int8_t inter_rvlc_run[169]={
  154. 0, 0, 0, 0, 0, 0, 0, 0,
  155. 0, 0, 0, 0, 0, 0, 0, 0,
  156. 0, 0, 0, 1, 1, 1, 1, 1,
  157. 1, 1, 1, 1, 1, 2, 2, 2,
  158. 2, 2, 2, 2, 3, 3, 3, 3,
  159. 3, 3, 3, 4, 4, 4, 4, 4,
  160. 5, 5, 5, 5, 6, 6, 6, 6,
  161. 7, 7, 7, 7, 8, 8, 8, 9,
  162. 9, 9, 10, 10, 11, 11, 12, 12,
  163. 13, 13, 14, 14, 15, 15, 16, 16,
  164. 17, 17, 18, 19, 20, 21, 22, 23,
  165. 24, 25, 26, 27, 28, 29, 30, 31,
  166. 32, 33, 34, 35, 36, 37, 38,
  167. 0, 0, 0, 0, 0, 1, 1, 1,
  168. 1, 1, 2, 2, 2, 3, 3, 4,
  169. 4, 5, 5, 6, 6, 7, 7, 8,
  170. 8, 9, 9, 10, 10, 11, 11, 12,
  171. 12, 13, 13, 14, 15, 16, 17, 18,
  172. 19, 20, 21, 22, 23, 24, 25, 26,
  173. 27, 28, 29, 30, 31, 32, 33, 34,
  174. 35, 36, 37, 38, 39, 40, 41, 42,
  175. 43, 44,
  176. };
  177. static const int8_t inter_rvlc_level[169]={
  178. 1, 2, 3, 4, 5, 6, 7, 8,
  179. 9, 10, 11, 12, 13, 14, 15, 16,
  180. 17, 18, 19, 1, 2, 3, 4, 5,
  181. 6, 7, 8, 9, 10, 1, 2, 3,
  182. 4, 5, 6, 7, 1, 2, 3, 4,
  183. 5, 6, 7, 1, 2, 3, 4, 5,
  184. 1, 2, 3, 4, 1, 2, 3, 4,
  185. 1, 2, 3, 4, 1, 2, 3, 1,
  186. 2, 3, 1, 2, 1, 2, 1, 2,
  187. 1, 2, 1, 2, 1, 2, 1, 2,
  188. 1, 2, 1, 1, 1, 1, 1, 1,
  189. 1, 1, 1, 1, 1, 1, 1, 1,
  190. 1, 1, 1, 1, 1, 1, 1,
  191. 1, 2, 3, 4, 5, 1, 2, 3,
  192. 4, 5, 1, 2, 3, 1, 2, 1,
  193. 2, 1, 2, 1, 2, 1, 2, 1,
  194. 2, 1, 2, 1, 2, 1, 2, 1,
  195. 2, 1, 2, 1, 1, 1, 1, 1,
  196. 1, 1, 1, 1, 1, 1, 1, 1,
  197. 1, 1, 1, 1, 1, 1, 1, 1,
  198. 1, 1, 1, 1, 1, 1, 1, 1,
  199. 1, 1,
  200. };
  201. RLTable ff_rvlc_rl_inter = {
  202. 169,
  203. 103,
  204. inter_rvlc,
  205. inter_rvlc_run,
  206. inter_rvlc_level,
  207. };
  208. static const uint16_t intra_rvlc[170][2]={
  209. {0x0006, 3},{0x0007, 3},{0x000A, 4},{0x0009, 5},
  210. {0x0014, 6},{0x0015, 6},{0x0034, 7},{0x0074, 8},
  211. {0x0075, 8},{0x00DD, 9},{0x00EC, 9},{0x01EC, 10},
  212. {0x01ED, 10},{0x01F4, 10},{0x03EC, 11},{0x03ED, 11},
  213. {0x03F4, 11},{0x077D, 12},{0x07BC, 12},{0x0FBD, 13},
  214. {0x0FDC, 13},{0x07BD, 12},{0x0FDD, 13},{0x1FBD, 14},
  215. {0x1FDC, 14},{0x1FDD, 14},{0x1FFC, 15},{0x0001, 4},
  216. {0x0008, 5},{0x002D, 7},{0x006C, 8},{0x006D, 8},
  217. {0x00DC, 9},{0x01DD, 10},{0x03DC, 11},{0x03DD, 11},
  218. {0x077C, 12},{0x0FBC, 13},{0x1F7D, 14},{0x1FBC, 14},
  219. {0x0004, 5},{0x002C, 7},{0x00BC, 9},{0x01DC, 10},
  220. {0x03BC, 11},{0x03BD, 11},{0x0EFD, 13},{0x0F7C, 13},
  221. {0x0F7D, 13},{0x1EFD, 14},{0x1F7C, 14},{0x0005, 5},
  222. {0x005C, 8},{0x00BD, 9},{0x037D, 11},{0x06FC, 12},
  223. {0x0EFC, 13},{0x1DFD, 14},{0x1EFC, 14},{0x1FFD, 15},
  224. {0x000C, 6},{0x005D, 8},{0x01BD, 10},{0x03FD, 12},
  225. {0x06FD, 12},{0x1BFD, 14},{0x000D, 6},{0x007D, 9},
  226. {0x02FC, 11},{0x05FC, 12},{0x1BFC, 14},{0x1DFC, 14},
  227. {0x001C, 7},{0x017C, 10},{0x02FD, 11},{0x05FD, 12},
  228. {0x2FFC, 15},{0x001D, 7},{0x017D, 10},{0x037C, 11},
  229. {0x0DFD, 13},{0x2FFD, 15},{0x003C, 8},{0x01BC, 10},
  230. {0x0BFD, 13},{0x17FD, 14},{0x003D, 8},{0x01FD, 11},
  231. {0x0DFC, 13},{0x37FC, 15},{0x007C, 9},{0x03FC, 12},
  232. {0x00FC, 10},{0x0BFC, 13},{0x00FD, 10},{0x37FD, 15},
  233. {0x01FC, 11},{0x07FC, 13},{0x07FD, 13},{0x0FFC, 14},
  234. {0x0FFD, 14},{0x17FC, 14},{0x3BFC, 15},
  235. {0x000B, 4},{0x0078, 8},{0x03F5, 11},{0x0FEC, 13},
  236. {0x1FEC, 14},{0x0012, 5},{0x00ED, 9},{0x07DC, 12},
  237. {0x1FED, 14},{0x3BFD, 15},{0x0013, 5},{0x03F8, 11},
  238. {0x3DFC, 15},{0x0018, 6},{0x07DD, 12},{0x0019, 6},
  239. {0x07EC, 12},{0x0022, 6},{0x0FED, 13},{0x0023, 6},
  240. {0x0FF4, 13},{0x0035, 7},{0x0FF5, 13},{0x0038, 7},
  241. {0x0FF8, 13},{0x0039, 7},{0x0FF9, 13},{0x0042, 7},
  242. {0x1FF4, 14},{0x0043, 7},{0x1FF5, 14},{0x0079, 8},
  243. {0x1FF8, 14},{0x0082, 8},{0x3DFD, 15},{0x0083, 8},
  244. {0x00F4, 9},{0x00F5, 9},{0x00F8, 9},{0x00F9, 9},
  245. {0x0102, 9},{0x0103, 9},{0x01F5, 10},{0x01F8, 10},
  246. {0x01F9, 10},{0x0202, 10},{0x0203, 10},{0x03F9, 11},
  247. {0x0402, 11},{0x0403, 11},{0x07ED, 12},{0x07F4, 12},
  248. {0x07F5, 12},{0x07F8, 12},{0x07F9, 12},{0x0802, 12},
  249. {0x0803, 12},{0x1002, 13},{0x1003, 13},{0x1FF9, 14},
  250. {0x2002, 14},{0x2003, 14},{0x3EFC, 15},{0x3EFD, 15},
  251. {0x3F7C, 15},{0x3F7D, 15},{0x0000, 4}
  252. };
  253. static const int8_t intra_rvlc_run[169]={
  254. 0, 0, 0, 0, 0, 0, 0, 0,
  255. 0, 0, 0, 0, 0, 0, 0, 0,
  256. 0, 0, 0, 0, 0, 0, 0, 0,
  257. 0, 0, 0, 1, 1, 1, 1, 1,
  258. 1, 1, 1, 1, 1, 1, 1, 1,
  259. 2, 2, 2, 2, 2, 2, 2, 2,
  260. 2, 2, 2, 3, 3, 3, 3, 3,
  261. 3, 3, 3, 3, 4, 4, 4, 4,
  262. 4, 4, 5, 5, 5, 5, 5, 5,
  263. 6, 6, 6, 6, 6, 7, 7, 7,
  264. 7, 7, 8, 8, 8, 8, 9, 9,
  265. 9, 9, 10, 10, 11, 11, 12, 12,
  266. 13, 14, 15, 16, 17, 18, 19,
  267. 0, 0, 0, 0, 0, 1, 1, 1,
  268. 1, 1, 2, 2, 2, 3, 3, 4,
  269. 4, 5, 5, 6, 6, 7, 7, 8,
  270. 8, 9, 9, 10, 10, 11, 11, 12,
  271. 12, 13, 13, 14, 15, 16, 17, 18,
  272. 19, 20, 21, 22, 23, 24, 25, 26,
  273. 27, 28, 29, 30, 31, 32, 33, 34,
  274. 35, 36, 37, 38, 39, 40, 41, 42,
  275. 43, 44,
  276. };
  277. static const int8_t intra_rvlc_level[169]={
  278. 1, 2, 3, 4, 5, 6, 7, 8,
  279. 9, 10, 11, 12, 13, 14, 15, 16,
  280. 17, 18, 19, 20, 21, 22, 23, 24,
  281. 25, 26, 27, 1, 2, 3, 4, 5,
  282. 6, 7, 8, 9, 10, 11, 12, 13,
  283. 1, 2, 3, 4, 5, 6, 7, 8,
  284. 9, 10, 11, 1, 2, 3, 4, 5,
  285. 6, 7, 8, 9, 1, 2, 3, 4,
  286. 5, 6, 1, 2, 3, 4, 5, 6,
  287. 1, 2, 3, 4, 5, 1, 2, 3,
  288. 4, 5, 1, 2, 3, 4, 1, 2,
  289. 3, 4, 1, 2, 1, 2, 1, 2,
  290. 1, 1, 1, 1, 1, 1, 1,
  291. 1, 2, 3, 4, 5, 1, 2, 3,
  292. 4, 5, 1, 2, 3, 1, 2, 1,
  293. 2, 1, 2, 1, 2, 1, 2, 1,
  294. 2, 1, 2, 1, 2, 1, 2, 1,
  295. 2, 1, 2, 1, 1, 1, 1, 1,
  296. 1, 1, 1, 1, 1, 1, 1, 1,
  297. 1, 1, 1, 1, 1, 1, 1, 1,
  298. 1, 1, 1, 1, 1, 1, 1, 1,
  299. 1, 1,
  300. };
  301. RLTable ff_rvlc_rl_intra = {
  302. 169,
  303. 103,
  304. intra_rvlc,
  305. intra_rvlc_run,
  306. intra_rvlc_level,
  307. };
  308. const uint16_t ff_sprite_trajectory_tab[15][2] = {
  309. {0x00, 2}, {0x02, 3}, {0x03, 3}, {0x04, 3}, {0x05, 3}, {0x06, 3},
  310. {0x0E, 4}, {0x1E, 5}, {0x3E, 6}, {0x7E, 7}, {0xFE, 8},
  311. {0x1FE, 9},{0x3FE, 10},{0x7FE, 11},{0xFFE, 12},
  312. };
  313. const uint8_t ff_mb_type_b_tab[4][2] = {
  314. {1, 1}, {1, 2}, {1, 3}, {1, 4},
  315. };
  316. /* these matrixes will be permuted for the idct */
  317. const int16_t ff_mpeg4_default_intra_matrix[64] = {
  318. 8, 17, 18, 19, 21, 23, 25, 27,
  319. 17, 18, 19, 21, 23, 25, 27, 28,
  320. 20, 21, 22, 23, 24, 26, 28, 30,
  321. 21, 22, 23, 24, 26, 28, 30, 32,
  322. 22, 23, 24, 26, 28, 30, 32, 35,
  323. 23, 24, 26, 28, 30, 32, 35, 38,
  324. 25, 26, 28, 30, 32, 35, 38, 41,
  325. 27, 28, 30, 32, 35, 38, 41, 45,
  326. };
  327. const int16_t ff_mpeg4_default_non_intra_matrix[64] = {
  328. 16, 17, 18, 19, 20, 21, 22, 23,
  329. 17, 18, 19, 20, 21, 22, 23, 24,
  330. 18, 19, 20, 21, 22, 23, 24, 25,
  331. 19, 20, 21, 22, 23, 24, 26, 27,
  332. 20, 21, 22, 23, 25, 26, 27, 28,
  333. 21, 22, 23, 24, 26, 27, 28, 30,
  334. 22, 23, 24, 26, 27, 28, 30, 31,
  335. 23, 24, 25, 27, 28, 30, 31, 33,
  336. };
  337. const uint8_t ff_mpeg4_y_dc_scale_table[32]={
  338. // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
  339. 0, 8, 8, 8, 8,10,12,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,34,36,38,40,42,44,46
  340. };
  341. const uint8_t ff_mpeg4_c_dc_scale_table[32]={
  342. // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
  343. 0, 8, 8, 8, 8, 9, 9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,20,21,22,23,24,25
  344. };
  345. const uint16_t ff_mpeg4_resync_prefix[8]={
  346. 0x7F00, 0x7E00, 0x7C00, 0x7800, 0x7000, 0x6000, 0x4000, 0x0000
  347. };
  348. const uint8_t ff_mpeg4_dc_threshold[8]={
  349. 99, 13, 15, 17, 19, 21, 23, 0
  350. };
  351. /* Note these are different in studio mode */
  352. const uint16_t ff_mpeg4_studio_dc_luma[19][2]={
  353. {0x0e, 6}, {0x06, 5}, {0x00, 4}, {0x02, 4},
  354. {0x07, 3}, {0x05, 3}, {0x03, 3}, {0x02, 3},
  355. {0x04, 3}, {0x06, 3}, {0x01, 4}, {0x1e, 7},
  356. {0x3e, 8}, {0x7e, 9}, {0xfe, 10}, {0x1fe, 11},
  357. {0x3fe, 12}, {0x7fe, 13}, {0x7ff, 13}
  358. };
  359. const uint16_t ff_mpeg4_studio_dc_chroma[19][2]={
  360. {0x00, 4}, {0x02, 4}, {0x07, 3}, {0x05, 3},
  361. {0x03, 3}, {0x02, 3}, {0x04, 3}, {0x06, 3},
  362. {0x01, 4}, {0x06, 5}, {0x0e, 6}, {0x1e, 7},
  363. {0x3e, 8}, {0x7e, 9}, {0xfe, 10}, {0x1fe, 11},
  364. {0x3fe, 12}, {0x7fe, 13}, {0x7ff, 13}
  365. };
  366. const uint16_t ff_mpeg4_studio_intra[12][22][2]={
  367. {
  368. {0x05, 4}, {0x04, 4}, {0x05, 7}, {0x09, 9},
  369. {0x21, 11}, {0x41, 12}, {0x81, 13}, {0x03, 4},
  370. {0x03, 5}, {0x05, 6}, {0x04, 7}, {0x03, 7},
  371. {0x05, 8}, {0x03, 2}, {0x05, 3}, {0x04, 3},
  372. {0x03, 3}, {0x02, 4}, {0x04, 6}, {0x03, 6},
  373. {0x11, 10}, {0x80, 13}
  374. },
  375. {
  376. {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0},
  377. {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0},
  378. {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0},
  379. {0x00, 0}, {0x00, 0}, {0x01, 1}, {0x01, 2},
  380. {0x01, 3}, {0x01, 4}, {0x01, 5}, {0x03, 7},
  381. {0x05, 8}, {0x04, 8}
  382. },
  383. {
  384. {0x05, 3}, {0x03, 5}, {0x02, 5}, {0x03, 7},
  385. {0x09, 9}, {0x103, 14}, {0x102, 14}, {0x04, 3},
  386. {0x03, 3}, {0x03, 4}, {0x02, 4}, {0x03, 6},
  387. {0x11, 10}, {0x03, 2}, {0x02, 3}, {0x02, 6},
  388. {0x05, 8}, {0x21, 11}, {0x83, 13}, {0x101, 14},
  389. {0x201, 15}, {0x82, 13}
  390. },
  391. {
  392. {0x05, 5}, {0x05, 4}, {0x04, 5}, {0x03, 6},
  393. {0x09, 9}, {0x83, 13}, {0x82, 13}, {0x03, 3},
  394. {0x04, 4}, {0x03, 4}, {0x03, 5}, {0x05, 8},
  395. {0x81, 13}, {0x03, 2}, {0x02, 2}, {0x02, 5},
  396. {0x02, 6}, {0x03, 7}, {0x11, 10}, {0x43, 12},
  397. {0x80, 13}, {0x42, 12}
  398. },
  399. {
  400. {0x05, 7}, {0x03, 4}, {0x03, 5}, {0x04, 7},
  401. {0x09, 9}, {0x83, 13}, {0x101, 14}, {0x03, 3},
  402. {0x02, 4}, {0x05, 6}, {0x03, 7}, {0x11, 10},
  403. {0x201, 15}, {0x03, 2}, {0x02, 2}, {0x02, 3},
  404. {0x04, 6}, {0x03, 6}, {0x05, 8}, {0x21, 11},
  405. {0x82, 13}, {0x81, 13}
  406. },
  407. {
  408. {0x13, 10}, {0x03, 5}, {0x05, 7}, {0x12, 10},
  409. {0x43, 12}, {0x83, 13}, {0x82, 13}, {0x02, 5},
  410. {0x04, 7}, {0x05, 8}, {0x23, 11}, {0x81, 13},
  411. {0x101, 14}, {0x03, 2}, {0x02, 2}, {0x01, 2},
  412. {0x01, 3}, {0x03, 6}, {0x03, 7}, {0x22, 11},
  413. {0x201, 15}, {0x42, 12}
  414. },
  415. {
  416. {0x23, 11}, {0x01, 4}, {0x07, 8}, {0x13, 10},
  417. {0x22, 11}, {0x103, 14}, {0x102, 14}, {0x03, 6},
  418. {0x06, 8}, {0x12, 10}, {0x43, 12}, {0x101, 14},
  419. {0x201, 15}, {0x03, 3}, {0x02, 3}, {0x03, 2},
  420. {0x02, 2}, {0x01, 3}, {0x02, 6}, {0x05, 8},
  421. {0x42, 12}, {0x41, 12}
  422. },
  423. {
  424. {0x0b, 9}, {0x03, 5}, {0x07, 8}, {0x07, 7},
  425. {0x06, 7}, {0x23, 11}, {0x41, 12}, {0x05, 7},
  426. {0x06, 8}, {0x0a, 9}, {0x13, 10}, {0x22, 11},
  427. {0x40, 12}, {0x03, 4}, {0x02, 4}, {0x03, 2},
  428. {0x02, 2}, {0x01, 2}, {0x02, 5}, {0x04, 7},
  429. {0x12, 10}, {0x21, 11}
  430. },
  431. {
  432. {0x15, 10}, {0x03, 6}, {0x14, 10}, {0x23, 11},
  433. {0x07, 8}, {0x43, 12}, {0x81, 13}, {0x06, 8},
  434. {0x0b, 9}, {0x13, 10}, {0x12, 10}, {0x42, 12},
  435. {0x80, 13}, {0x01, 4}, {0x03, 3}, {0x02, 3},
  436. {0x03, 2}, {0x02, 2}, {0x01, 3}, {0x02, 6},
  437. {0x22, 11}, {0x41, 12}
  438. },
  439. {
  440. {0x43, 12}, {0x05, 6}, {0x07, 8}, {0x04, 6},
  441. {0x03, 6}, {0x13, 10}, {0x42, 12}, {0x05, 7},
  442. {0x04, 7}, {0x06, 8}, {0x12, 10}, {0x41, 12},
  443. {0x40, 12}, {0x03, 5}, {0x03, 4}, {0x03, 3},
  444. {0x02, 3}, {0x03, 2}, {0x02, 2}, {0x02, 4},
  445. {0x05, 8}, {0x11, 10}
  446. },
  447. {
  448. {0x83, 13}, {0x05, 7}, {0x07, 8}, {0x03, 4},
  449. {0x21, 11}, {0x82, 13}, {0x81, 13}, {0x04, 7},
  450. {0x06, 8}, {0x0b, 9}, {0x0a, 9}, {0x11, 10},
  451. {0x80, 13}, {0x03, 5}, {0x02, 5}, {0x02, 4},
  452. {0x03, 3}, {0x02, 3}, {0x03, 2}, {0x02, 2},
  453. {0x03, 6}, {0x09, 9}
  454. },
  455. {
  456. {0x13, 10}, {0x03, 5}, {0x03, 6}, {0x0d, 9},
  457. {0x0c, 9}, {0x21, 11}, {0x20, 11}, {0x02, 5},
  458. {0x02, 6}, {0x07, 8}, {0x0b, 9}, {0x12, 10},
  459. {0x11, 10}, {0x05, 3}, {0x04, 3}, {0x05, 4},
  460. {0x04, 4}, {0x03, 4}, {0x02, 4}, {0x03, 3},
  461. {0x03, 2}, {0x0a, 9}
  462. }
  463. };
  464. #endif /* AVCODEC_MPEG4DATA_H */