macroblock.h
上传用户:sun1608
上传日期:2007-02-02
资源大小:6116k
文件大小:5k
源码类别:

流媒体/Mpeg4/MP4

开发平台:

Visual C++

  1. /*
  2. ***********************************************************************
  3. * COPYRIGHT AND WARRANTY INFORMATION
  4. *
  5. * Copyright 2001, International Telecommunications Union, Geneva
  6. *
  7. * DISCLAIMER OF WARRANTY
  8. *
  9. * These software programs are available to the user without any
  10. * license fee or royalty on an "as is" basis. The ITU disclaims
  11. * any and all warranties, whether express, implied, or
  12. * statutory, including any implied warranties of merchantability
  13. * or of fitness for a particular purpose.  In no event shall the
  14. * contributor or the ITU be liable for any incidental, punitive, or
  15. * consequential damages of any kind whatsoever arising from the
  16. * use of these programs.
  17. *
  18. * This disclaimer of warranty extends to the user of these programs
  19. * and user's customers, employees, agents, transferees, successors,
  20. * and assigns.
  21. *
  22. * The ITU does not represent or warrant that the programs furnished
  23. * hereunder are free of infringement of any third-party patents.
  24. * Commercial implementations of ITU-T Recommendations, including
  25. * shareware, may be subject to royalty fees to patent holders.
  26. * Information regarding the ITU-T patent policy is available from
  27. * the ITU Web site at http://www.itu.int.
  28. *
  29. * THIS IS NOT A GRANT OF PATENT RIGHTS - SEE THE ITU-T PATENT POLICY.
  30. ************************************************************************
  31. */
  32. /*!
  33.  ************************************************************************
  34.  * file
  35.  *    macroblock.h
  36.  *
  37.  * author
  38.  *    Inge Lille-Lang鴜               <inge.lille-langoy@telenor.com>     n
  39.  *    Telenor Satellite Services                                          n
  40.  *    P.O.Box 6914 St.Olavs plass                                         n
  41.  *    N-0130 Oslo, Norway
  42.  *
  43.  ************************************************************************/
  44. #ifndef _MACROBLOCK_H_
  45. #define _MACROBLOCK_H_
  46. //! just to make new temp intra mode table
  47. const int  MODTAB[3][2]=
  48. {
  49.   { 0, 4},
  50.   {16,12},
  51.   { 8,20}
  52. };
  53. //! gives codeword number from CBP value, both for intra and inter
  54. const int NCBP[48][2]=
  55. {
  56.   { 3, 0},{29, 2},{30, 3},{17, 7},{31, 4},{18, 8},{37,17},{ 8,13},{32, 5},{38,18},{19, 9},{ 9,14},
  57.   {20,10},{10,15},{11,16},{ 2,11},{16, 1},{33,32},{34,33},{21,36},{35,34},{22,37},{39,44},{ 4,40},
  58.   {36,35},{40,45},{23,38},{ 5,41},{24,39},{ 6,42},{ 7,43},{ 1,19},{41, 6},{42,24},{43,25},{25,20},
  59.   {44,26},{26,21},{46,46},{12,28},{45,27},{47,47},{27,22},{13,29},{28,23},{14,30},{15,31},{ 0,12},
  60. };
  61. /*!
  62. Return prob.(0-5) for the input intra prediction mode(0-5),
  63. depending on previous (right/above) pred mode(0-6).                                n
  64.                                                                                    n
  65. NA values are set to 0 in the array.                                               n
  66. The modes for the neighbour blocks are signalled:                                  n
  67. 0 = outside                                                                        n
  68. 1 = DC                                                                             n
  69. 2 = diagonal vert 22.5 deg                                                         n
  70. 3 = vertical                                                                       n
  71. 4 = diagonal 45 deg                                                                n
  72. 5 = horizontal                                                                     n
  73. 6 = diagonal horizontal -22.5 deg                                                  n
  74.                                                                                    n
  75. prob order=PRED_IPRED[B(block left)][A(block above)][intra mode] */
  76. const byte PRED_IPRED[7][7][6]=
  77. {
  78.   {
  79.     {0,0,0,0,0,0},
  80.     {0,0,0,0,1,2},
  81.     {0,0,0,0,1,2},
  82.     {0,0,0,0,1,2},
  83.     {0,0,0,0,1,2},
  84.     {1,0,0,0,0,2},
  85.     {1,0,0,0,2,0},
  86.   },
  87.   {
  88.     {0,2,1,0,0,0},
  89.     {0,2,5,3,1,4},
  90.     {0,1,4,3,2,5},
  91.     {0,1,2,3,4,5},
  92.     {1,3,5,0,2,4},
  93.     {1,4,5,2,0,3},
  94.     {2,4,5,3,1,0},
  95.   },
  96.   {
  97.     {1,0,2,0,0,0},
  98.     {1,0,4,3,2,5},
  99.     {1,0,2,4,3,5},
  100.     {1,0,2,3,4,5},
  101.     {2,1,4,0,3,5},
  102.     {1,2,5,4,0,3},
  103.     {0,1,5,4,3,2},
  104.   },
  105.   {
  106.     {1,2,0,0,0,0},
  107.     {2,4,0,1,3,5},
  108.     {1,3,0,2,4,5},
  109.     {2,1,0,3,4,5},
  110.     {3,2,0,1,5,4},
  111.     {2,5,0,3,1,4},
  112.     {1,2,0,5,3,4},
  113.   },
  114.   {
  115.     {0,1,2,0,0,0},
  116.     {1,4,3,0,2,5},
  117.     {0,3,2,1,4,5},
  118.     {1,3,2,0,4,5},
  119.     {1,4,3,0,2,5},
  120.     {2,4,5,1,0,3},
  121.     {2,4,5,1,3,0},
  122.   },
  123.   {
  124.     {0,1,2,0,0,0},
  125.     {0,3,5,2,1,4},
  126.     {0,2,4,3,1,5},
  127.     {0,3,2,4,1,5},
  128.     {1,4,5,2,0,3},
  129.     {1,4,5,2,0,3},
  130.     {2,4,5,3,0,1},
  131.   },
  132.   {
  133.     {0,1,2,0,0,0},
  134.     {0,4,5,2,1,3},
  135.     {0,1,5,3,2,4},
  136.     {0,1,3,2,4,5},
  137.     {1,4,5,0,3,2},
  138.     {1,4,5,3,0,2},
  139.     {1,3,5,4,2,0},
  140.   }
  141. };
  142. /*!
  143.   return codeword number from two combined intra prediction blocks
  144. */
  145. const int IPRED_ORDER[6][6]=
  146. {
  147.   { 0, 2, 3, 9,10,20},
  148.   { 1, 4, 8,11,19,21},
  149.   { 5, 7,12,18,22,29},
  150.   { 6,13,17,23,28,30},
  151.   {14,16,24,27,31,34},
  152.   {15,25,26,32,33,35},
  153. };
  154. extern int JQ[32][2];
  155. extern int QP2QUANT[32];
  156. #endif