refbuffer.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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 : Hardware interface read/write
  17. --
  18. ------------------------------------------------------------------------------
  19. --
  20. -- Version control information, please leave untouched.
  21. --
  22. -- $RCSfile: refbuffer.h,v $
  23. -- $Revision: 1.19 $
  24. -- $Date: 2010/06/23 12:38:11 $
  25. --
  26. ------------------------------------------------------------------------------*/
  27. #ifndef __REFBUFFER_H__
  28. #define __REFBUFFER_H__
  29. #include "basetype.h"
  30. typedef enum {
  31. REFBU_FRAME,
  32. REFBU_FIELD,
  33. REFBU_MBAFF
  34. } refbuMode_e;
  35. /* Feature support flags */
  36. #define REFBU_SUPPORT_GENERIC (1)
  37. #define REFBU_SUPPORT_INTERLACED (2)
  38. #define REFBU_SUPPORT_DOUBLE (4)
  39. #define REFBU_SUPPORT_OFFSET (8)
  40. /* Buffering info */
  41. #define REFBU_BUFFER_SINGLE_FIELD (1)
  42. #define REFBU_MULTIPLE_REF_FRAMES (2)
  43. #define REFBU_DISABLE_CHECKPOINT (4)
  44. #define REFBU_FORCE_ADAPTIVE_SINGLE (8)
  45. #ifndef HANTRO_TRUE
  46. #define HANTRO_TRUE (1)
  47. #endif /* HANTRO_TRUE */
  48. #ifndef HANTRO_FALSE
  49. #define HANTRO_FALSE (0)
  50. #endif /* HANTRO_FALSE*/
  51. /* macro to get smaller of two values */
  52. #define MIN(a, b) (((a) < (b)) ? (a) : (b))
  53. /* macro to get greater of two values */
  54. #define MAX(a, b) (((a) > (b)) ? (a) : (b))
  55. typedef struct memAccess {
  56. u32 latency;
  57. u32 nonseq;
  58. u32 seq;
  59. } memAccess_t;
  60. struct refBuffer;
  61. typedef struct refBuffer {
  62. #if 0
  63. i32 ox[3];
  64. #endif
  65. i32 decModeMbWeights[2];
  66. i32 mbWeight;
  67. i32 oy[3];
  68. i32 picWidthInMbs;
  69. i32 picHeightInMbs;
  70. i32 frmSizeInMbs;
  71. i32 fldSizeInMbs;
  72. i32 numIntraBlk[3];
  73. i32 coverage[3];
  74. i32 fldHitsP[3][2];
  75. i32 fldHitsB[3][2];
  76. i32 fldCnt;
  77. i32 mvsPerMb;
  78. i32 filterSize;
  79. /* Thresholds */
  80. i32 predIntraBlk;
  81. i32 predCoverage;
  82. i32 checkpoint;
  83. u32 decMode;
  84. u32 dataExcessMaxPct;
  85. i32 busWidthInBits;
  86. i32 prevLatency;
  87. i32 numCyclesForBuffering;
  88. i32 totalDataForBuffering;
  89. i32 bufferPenalty;
  90. i32 avgCyclesPerMb;
  91. u32 prevWasField;
  92. u32 prevUsedDouble;
  93. i32 thrAdj;
  94. u32 prevFrameHitSum;
  95. memAccess_t currMemModel; /* Clocks per operation, modifiable from
  96. * testbench. */
  97. memAccess_t memAccessStats; /* Approximate counts for operations, set
  98. * based on format */
  99. u32 memAccessStatsFlag;
  100. /* Support flags */
  101. u32 interlacedSupport;
  102. u32 doubleSupport;
  103. u32 offsetSupport;
  104. /* Internal test mode */
  105. void (*testFunction)(struct refBuffer*,u32*regBase,u32 isIntra,u32 mode);
  106. } refBuffer_t;
  107. void RefbuInit( refBuffer_t *pRefbu, u32 decMode, u32 picWidthInMbs, u32
  108. picHeightInMbs, u32 supportFlags );
  109. void RefbuMvStatistics( refBuffer_t *pRefbu, u32 *regBase,
  110. u32 *pMv, u32 directMvsAvailable,
  111. u32 isIntraPicture );
  112. void RefbuMvStatisticsB( refBuffer_t *pRefbu, u32 *regBase );
  113. void RefbuSetup( refBuffer_t *pRefbu, u32 *regBase,
  114. refbuMode_e mode,
  115. u32 isIntraFrame, u32 isBframe,
  116. u32 refPicId0, u32 refpicId1,
  117. u32 flags );
  118. i32 RefbuGetHitThreshold( refBuffer_t *pRefbu );
  119. u32 RefbuVpxGetPrevFrameStats( refBuffer_t *pRefbu );
  120. #endif /* __REFBUFFER_H__ */