You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
3.0KB

  1. /*
  2. * MPEG1/2 decoder tables
  3. * copyright (c) 2000,2001 Fabrice Bellard
  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. * MPEG1/2 decoder tables.
  25. */
  26. #ifndef AVCODEC_MPEG12DECDATA_H
  27. #define AVCODEC_MPEG12DECDATA_H
  28. #include <stdint.h>
  29. #include "mpegvideo.h"
  30. #define MB_TYPE_ZERO_MV 0x20000000
  31. #define IS_ZERO_MV(a) ((a)&MB_TYPE_ZERO_MV)
  32. static const uint8_t table_mb_ptype[7][2] = {
  33. { 3, 5 }, // 0x01 MB_INTRA
  34. { 1, 2 }, // 0x02 MB_PAT
  35. { 1, 3 }, // 0x08 MB_FOR
  36. { 1, 1 }, // 0x0A MB_FOR|MB_PAT
  37. { 1, 6 }, // 0x11 MB_QUANT|MB_INTRA
  38. { 1, 5 }, // 0x12 MB_QUANT|MB_PAT
  39. { 2, 5 }, // 0x1A MB_QUANT|MB_FOR|MB_PAT
  40. };
  41. static const uint32_t ptype2mb_type[7] = {
  42. MB_TYPE_INTRA,
  43. MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_ZERO_MV | MB_TYPE_16x16,
  44. MB_TYPE_L0,
  45. MB_TYPE_L0 | MB_TYPE_CBP,
  46. MB_TYPE_QUANT | MB_TYPE_INTRA,
  47. MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_ZERO_MV | MB_TYPE_16x16,
  48. MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_CBP,
  49. };
  50. static const uint8_t table_mb_btype[11][2] = {
  51. { 3, 5 }, // 0x01 MB_INTRA
  52. { 2, 3 }, // 0x04 MB_BACK
  53. { 3, 3 }, // 0x06 MB_BACK|MB_PAT
  54. { 2, 4 }, // 0x08 MB_FOR
  55. { 3, 4 }, // 0x0A MB_FOR|MB_PAT
  56. { 2, 2 }, // 0x0C MB_FOR|MB_BACK
  57. { 3, 2 }, // 0x0E MB_FOR|MB_BACK|MB_PAT
  58. { 1, 6 }, // 0x11 MB_QUANT|MB_INTRA
  59. { 2, 6 }, // 0x16 MB_QUANT|MB_BACK|MB_PAT
  60. { 3, 6 }, // 0x1A MB_QUANT|MB_FOR|MB_PAT
  61. { 2, 5 }, // 0x1E MB_QUANT|MB_FOR|MB_BACK|MB_PAT
  62. };
  63. static const uint32_t btype2mb_type[11] = {
  64. MB_TYPE_INTRA,
  65. MB_TYPE_L1,
  66. MB_TYPE_L1 | MB_TYPE_CBP,
  67. MB_TYPE_L0,
  68. MB_TYPE_L0 | MB_TYPE_CBP,
  69. MB_TYPE_L0L1,
  70. MB_TYPE_L0L1 | MB_TYPE_CBP,
  71. MB_TYPE_QUANT | MB_TYPE_INTRA,
  72. MB_TYPE_QUANT | MB_TYPE_L1 | MB_TYPE_CBP,
  73. MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_CBP,
  74. MB_TYPE_QUANT | MB_TYPE_L0L1 | MB_TYPE_CBP,
  75. };
  76. static const uint8_t non_linear_qscale[32] = {
  77. 0, 1, 2, 3, 4, 5, 6, 7,
  78. 8,10,12,14,16,18,20,22,
  79. 24,28,32,36,40,44,48,52,
  80. 56,64,72,80,88,96,104,112,
  81. };
  82. #endif /* AVCODEC_MPEG12DECDATA_H */