rv30data.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /*
  2. * RealVideo 3 decoder
  3. * copyright (c) 2007 Konstantin Shishkov
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * FFmpeg is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. /**
  22. * @file libavcodec/rv30data.h
  23. * miscellaneous RV30 tables
  24. */
  25. #ifndef AVCODEC_RV30DATA_H
  26. #define AVCODEC_RV30DATA_H
  27. #include <stdint.h>
  28. /** DC quantizer mapping for RV30 */
  29. static const uint8_t rv30_luma_dc_quant[32] = {
  30. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
  31. 16, 17, 18, 19, 20, 21, 22, 22, 22, 23, 23, 23, 24, 24, 25, 25
  32. };
  33. /**
  34. * This table is used for storing the differences
  35. * between the predicted and the real intra type.
  36. */
  37. static const uint8_t rv30_itype_code[9*9*2] = {
  38. 0, 0, 0, 1, 1, 0, 1, 1, 0, 2, 2, 0, 0, 3, 3, 0, 1, 2,
  39. 2, 1, 0, 4, 4, 0, 3, 1, 1, 3, 0, 5, 5, 0, 2, 2, 1, 4,
  40. 4, 1, 0, 6, 3, 2, 1, 5, 2, 3, 5, 1, 6, 0, 0, 7, 4, 2,
  41. 2, 4, 3, 3, 6, 1, 1, 6, 7, 0, 0, 8, 5, 2, 4, 3, 2, 5,
  42. 3, 4, 1, 7, 4, 4, 7, 1, 8, 0, 6, 2, 3, 5, 5, 3, 2, 6,
  43. 1, 8, 2, 7, 7, 2, 8, 1, 5, 4, 4, 5, 3, 6, 6, 3, 8, 2,
  44. 4, 6, 5, 5, 6, 4, 2, 8, 7, 3, 3, 7, 6, 5, 5, 6, 7, 4,
  45. 4, 7, 8, 3, 3, 8, 7, 5, 8, 4, 5, 7, 4, 8, 6, 6, 7, 6,
  46. 5, 8, 8, 5, 6, 7, 8, 6, 7, 7, 6, 8, 8, 7, 7, 8, 8, 8,
  47. };
  48. /**
  49. * This table is used for retrieving the current intra type
  50. * based on its neighbors and adjustment provided by
  51. * code read and decoded before.
  52. *
  53. * This is really a three-dimensional matrix with dimensions
  54. * [-1..9][-1..9][0..9]. The first and second coordinates are
  55. * detemined by the top and left neighbors (-1 if unavailable).
  56. */
  57. static const uint8_t rv30_itype_from_context[900] = {
  58. 0, 9, 9, 9, 9, 9, 9, 9, 9,
  59. 0, 2, 9, 9, 9, 9, 9, 9, 9,
  60. 9, 9, 9, 9, 9, 9, 9, 9, 9,
  61. 2, 0, 9, 9, 9, 9, 9, 9, 9,
  62. 9, 9, 9, 9, 9, 9, 9, 9, 9,
  63. 9, 9, 9, 9, 9, 9, 9, 9, 9,
  64. 9, 9, 9, 9, 9, 9, 9, 9, 9,
  65. 9, 9, 9, 9, 9, 9, 9, 9, 9,
  66. 9, 9, 9, 9, 9, 9, 9, 9, 9,
  67. 9, 9, 9, 9, 9, 9, 9, 9, 9,
  68. 0, 1, 9, 9, 9, 9, 9, 9, 9,
  69. 0, 2, 1, 6, 4, 8, 5, 7, 3,
  70. 1, 0, 2, 6, 5, 4, 3, 8, 7,
  71. 2, 8, 0, 1, 7, 4, 3, 6, 5,
  72. 2, 0, 1, 3, 8, 5, 4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9, 9,
  139. 2, 0, 4, 7, 6, 1, 8, 5, 3,
  140. 6, 1, 2, 0, 4, 7, 5, 8, 3,
  141. 2, 7, 8, 0, 1, 6, 4, 3, 5,
  142. 2, 4, 0, 8, 3, 1, 7, 6, 5,
  143. 4, 2, 7, 0, 6, 1, 8, 5, 3,
  144. 2, 1, 0, 8, 5, 6, 7, 4, 3,
  145. 2, 6, 4, 1, 7, 0, 5, 8, 3,
  146. 2, 7, 4, 0, 8, 6, 1, 5, 3,
  147. 2, 8, 7, 4, 1, 0, 3, 6, 5,
  148. 9, 9, 9, 9, 9, 9, 9, 9, 9,
  149. 2, 0, 8, 1, 3, 4, 6, 5, 7,
  150. 1, 2, 0, 6, 8, 5, 7, 3, 4,
  151. 2, 8, 7, 1, 0, 3, 6, 5, 4,
  152. 8, 3, 2, 5, 1, 0, 4, 7, 6,
  153. 2, 0, 4, 8, 5, 1, 7, 6, 3,
  154. 2, 1, 0, 8, 5, 3, 6, 4, 7,
  155. 2, 1, 6, 0, 8, 4, 5, 7, 3,
  156. 2, 7, 8, 4, 0, 6, 1, 5, 3,
  157. 2, 8, 3, 0, 7, 4, 1, 6, 5,
  158. };
  159. /**
  160. * Loop filter limits are taken from this table.
  161. */
  162. static const uint8_t rv30_loop_filt_lim[32] = {
  163. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5
  164. };
  165. #endif /* AVCODEC_RV30DATA_H */