vp6dec.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /*------------------------------------------------------------------------------
  2. -- --
  3. -- This software is confidential and proprietary and may be used --
  4. -- only as expressly authorized by a licensing agreement from --
  5. -- --
  6. -- Hantro Products Oy. --
  7. -- --
  8. -- (C) COPYRIGHT 2006 HANTRO PRODUCTS OY --
  9. -- ALL RIGHTS RESERVED --
  10. -- --
  11. -- The entire notice above must be reproduced --
  12. -- on all copies and should not be removed. --
  13. -- --
  14. --------------------------------------------------------------------------------
  15. -
  16. - Description : ...
  17. -
  18. --------------------------------------------------------------------------------
  19. -
  20. - Version control information, please leave untouched.
  21. -
  22. - $RCSfile: vp6dec.h,v $
  23. - $Revision: 1.3 $
  24. - $Date: 2008/04/24 12:08:29 $
  25. -
  26. ------------------------------------------------------------------------------*/
  27. #ifndef __VP6DEC_H__
  28. #define __VP6DEC_H__
  29. #include "basetype.h"
  30. #include "vp6strmbuffer.h"
  31. #include "vp6booldec.h"
  32. #include "vp6huffdec.h"
  33. // Enumeration of how block is coded
  34. // VP6.2 version is >= 8
  35. #define CURRENT_DECODE_VERSION 8U
  36. #define SIMPLE_PROFILE 0U
  37. #define PROFILE_1 1U
  38. #define PROFILE_2 2U
  39. #define ADVANCED_PROFILE 3U
  40. #define BASE_FRAME 0U
  41. #define NORMAL_FRAME 1
  42. #define Q_TABLE_SIZE 64
  43. #define BLOCK_HEIGHT_WIDTH 8
  44. #define BLOCK_SIZE (BLOCK_HEIGHT_WIDTH * BLOCK_HEIGHT_WIDTH)
  45. // Loop filter options
  46. #define NO_LOOP_FILTER 0U
  47. #define LOOP_FILTER_BASIC 2U
  48. #define LOOP_FILTER_DERING 3U
  49. #define BILINEAR_ONLY_PM 0U
  50. #define BICUBIC_ONLY_PM 1U
  51. #define AUTO_SELECT_PM 2U
  52. #define LONG_MV_BITS 8
  53. #define MAX_MODES 10
  54. #define MV_NODES 17
  55. #define DCProbOffset(A,B) \
  56. ((A) * (MAX_ENTROPY_TOKENS - 1) + (B))
  57. #define ACProbOffset(A,B,C,D) \
  58. ((A) * PREC_CASES * VP6HWAC_BANDS * (MAX_ENTROPY_TOKENS - 1) \
  59. + (B) * VP6HWAC_BANDS * (MAX_ENTROPY_TOKENS - 1) \
  60. + (C) * (MAX_ENTROPY_TOKENS - 1) \
  61. + (D))
  62. #define DcNodeOffset(A,B,C) \
  63. ((A) * DC_TOKEN_CONTEXTS * CONTEXT_NODES \
  64. + (B) * CONTEXT_NODES + (C))
  65. // Playback Instance Definition
  66. typedef struct PB_INSTANCE
  67. {
  68. Vp6StrmBuffer strm;
  69. BOOL_CODER br;
  70. BOOL_CODER br2;
  71. HUFF_INSTANCE *huff;
  72. // Decoder and Frame Type Information
  73. u8 Vp3VersionNo;
  74. u8 VpProfile;
  75. u8 FrameType;
  76. u32 VFragments;
  77. u32 HFragments;
  78. u32 OutputWidth;
  79. u32 OutputHeight;
  80. u32 ScalingMode;
  81. u8 PredictionFilterMode;
  82. u8 PredictionFilterMvSizeThresh;
  83. u32 PredictionFilterVarThresh;
  84. u8 PredictionFilterAlpha;
  85. u32 RefreshGoldenFrame;
  86. // Does this frame use multiple data streams
  87. // Multistream is implicit for SIMPLE_PROFILE
  88. u32 MultiStream;
  89. // Second partition buffer details
  90. u32 Buff2Offset;
  91. u32 UseHuffman;
  92. // Should we do loop filtering.
  93. // In simple profile this is ignored and there is no loop filtering
  94. u8 UseLoopFilter;
  95. u32 DctQMask;
  96. u8 MvSignProbs[2];
  97. u8 IsMvShortProb[2];
  98. u8 MvShortProbs[2][7];
  99. u8 MvSizeProbs[2][LONG_MV_BITS];
  100. u8 probXmitted[4][2][MAX_MODES];
  101. u8 probModeSame[4][MAX_MODES];
  102. u8 probMode[4][MAX_MODES][MAX_MODES - 1]; // nearest+near,nearest only, nonearest+nonear, 10 preceding modes, 9 nodes
  103. u8 DcProbs[2 * (MAX_ENTROPY_TOKENS - 1)];
  104. u8 AcProbs[2 * PREC_CASES * VP6HWAC_BANDS * (MAX_ENTROPY_TOKENS - 1)];
  105. u8 DcNodeContexts[2 * DC_TOKEN_CONTEXTS * CONTEXT_NODES]; // Plane, Contexts, Node
  106. u8 ZeroRunProbs[ZRL_BANDS][ZERO_RUN_PROB_CASES];
  107. u8 ModifiedScanOrder[BLOCK_SIZE];
  108. u8 MergedScanOrder[BLOCK_SIZE + 65];
  109. u8 EobOffsetTable[BLOCK_SIZE];
  110. u8 ScanBands[BLOCK_SIZE];
  111. u8 probModeUpdate;
  112. u8 probMvUpdate;
  113. u8 scanUpdate;
  114. u8 probDcUpdate;
  115. u8 probAcUpdate;
  116. u8 probZrlUpdate;
  117. } PB_INSTANCE;
  118. extern const i32 VP6HW_BicubicFilterSet[17][8][4];
  119. extern const u8 VP6HWDeblockLimitValues[Q_TABLE_SIZE];
  120. i32 VP6HWLoadFrameHeader(PB_INSTANCE * pbi);
  121. i32 VP6HWDecodeProbUpdates(PB_INSTANCE * pbi);
  122. void VP6HWDeleteHuffman(PB_INSTANCE * pbi);
  123. #endif /* __VP6DEC_H__ */