ppinternal.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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 : PP API's internal functions.
  17. --
  18. --------------------------------------------------------------------------------
  19. --
  20. -- Version control information, please leave untouched.
  21. --
  22. -- $RCSfile: ppinternal.h,v $
  23. -- $Date: 2008/11/28 12:34:26 $
  24. -- $Revision: 1.18 $
  25. --
  26. ------------------------------------------------------------------------------*/
  27. #ifndef _PPAPI_INTERNAL_H_
  28. #define _PPAPI_INTERNAL_H_
  29. /*------------------------------------------------------------------------------
  30. 1. Include headers
  31. ------------------------------------------------------------------------------*/
  32. #include "ppapi.h"
  33. #include "basetype.h"
  34. #include "regdrv.h"
  35. /*------------------------------------------------------------------------------
  36. 2. Internal Definitions
  37. ------------------------------------------------------------------------------*/
  38. #define PP_X170_REGISTERS (41)
  39. #define PP_X170_REG_START (240)
  40. /* lint warning disabled: negative subscript of pointer used intentionally,
  41. * regBase points to start of pp regs, setReg uses start of decoder regs */
  42. #define SetPpRegister(regBase,id,value) /*lint -e(428) */ \
  43. SetDecRegister(regBase-(PP_X170_REG_START>>2),(u32)id,value)
  44. #define GetPpRegister(regBase,id) /*lint -e(428) */ \
  45. GetDecRegister(regBase-(PP_X170_REG_START>>2),(u32)id)
  46. #define PP_OUT_MAX_WIDTH_D1 720
  47. #define PP_OUT_MIN_WIDTH 16
  48. #define PP_OUT_MAX_HEIGHT_D1 720
  49. #define PP_OUT_MIN_HEIGHT 16
  50. #define PP_OUT_D1 0
  51. #define PP_OUT_XGA 1
  52. #define PP_OUT_MAX_WIDTH_UPSCALED(d,vc1_p) ((vc1_p) == 0 ? 3*(d) : d)
  53. #define PP_OUT_MAX_HEIGHT_UPSCALED(d,vc1_p ) ((vc1_p) == 0 ? 3*(d) - 2 : d)
  54. /* Max out width height in JPEG in 292*16 */
  55. #define PP_IN_MAX_WIDTH(pipeline) ((pipeline) == 0 ? 2048U : 292U*16U)
  56. #define PP_IN_MIN_WIDTH(pipeline) ((pipeline) == 0 ? 16U : 48U)
  57. #define PP_IN_MAX_HEIGHT(pipeline) ((pipeline) == 0 ? 2048U : 292U*16U)
  58. #define PP_IN_MIN_HEIGHT(pipeline) ((pipeline) == 0 ? 16U : 16U)
  59. /* Max out width height in JPEG in 511*16 */
  60. #define PP_IN_MAX_WIDTH_EXT(pipeline) ((pipeline) == 0 ? 2048U : 511U*16U)
  61. #define PP_IN_MAX_HEIGHT_EXT(pipeline) ((pipeline) == 0 ? 2048U : 511U*16U)
  62. #define PP_IN_DIVISIBILITY(linked) (linked == 0 ? 0xF : 0x7)
  63. #define PP_MAX_FRM_BUFF_WIDTH 1920
  64. #define PP_PIXEL_FORMAT_YUV420_MASK 0x020000U
  65. #define PP_PIXEL_FORMAT_YUV422_MASK 0x010000U
  66. #define PP_PIXEL_FORMAT_RGB_MASK 0x040000U
  67. #define PP_PIXEL_FORMAT_RGB32_MASK 0x001000U
  68. #define PP_ASIC_OUT_FORMAT_RGB 0
  69. #define PP_ASIC_OUT_FORMAT_422 3
  70. #define PP_ASIC_OUT_FORMAT_420 5
  71. #define PP_ASIC_IN_FORMAT_422 0
  72. #define PP_ASIC_IN_FORMAT_420_SEMIPLANAR 1
  73. #define PP_ASIC_IN_FORMAT_420_PLANAR 2
  74. #define PP_ASIC_IN_FORMAT_420_TILED 5
  75. #define PP_ASIC_IN_FORMAT_440_SEMIPLANAR 6
  76. /* extended formats */
  77. #define PP_ASIC_IN_FORMAT_EXTENSION 7
  78. #define PP_ASIC_IN_FORMAT_444_SEMIPLANAR 7
  79. #define PP_ASIC_IN_FORMAT_411_SEMIPLANAR 8
  80. /* inputs supported just in JPEG pipeline */
  81. #define PP_ASIC_IN_FORMAT_400 3
  82. #define PP_ASIC_IN_FORMAT_422_SEMIPLANAR 4
  83. /* Width multiple of: */
  84. #define WIDTH_MULTIPLE 8
  85. #define HEIGHT_MULTIPLE 2
  86. #define TOFIX(d, q) ((u32)( (d) * (u32)(1<<(q)) ))
  87. #define FDIVI(a, b) ((a)/(b))
  88. #define PP_STATUS_IDLE 0
  89. #define PP_STATUS_RUNNING 1
  90. /* it is allowed to allocate full register amount for the shadow regs:
  91. * but they are not used. so here the constant boolean is OK */
  92. /*lint -e(506) */
  93. /* PPBufferData multibuffer: buffer config data
  94. * ID and input source pic addr. With this info we can later rerun pictures */
  95. typedef struct BufferData_
  96. {
  97. u32 inputBusLuma;
  98. u32 inputBusChroma;
  99. u32 setupID;
  100. } PPBufferData;
  101. typedef struct PPContainer_
  102. {
  103. u32 ppRegs[PP_X170_REGISTERS];
  104. PPConfig ppCfg;
  105. PPConfig prevCfg;
  106. PPOutputBuffers combinedModeBuffers;
  107. PPBufferData bufferData[PP_MAX_MULTIBUFFER];
  108. u32 displayIndex;
  109. u32 currentSetupID; /* The setup ID given to the previous decoded pic */
  110. u32 prevOutSetupID; /* The setup ID of previous output picture */
  111. PPResult PPCombinedRet; /* pp stores here combined mode errors */
  112. u32 status;
  113. u32 pipeline;
  114. u32 multiBuffer;
  115. const void *dwl;
  116. const void *decInst;
  117. u32 decType;
  118. i32 frmBufferLumaOrRgbOffset;
  119. i32 frmBufferChromaOffset;
  120. u32 outFormat;
  121. u32 outStartCh;
  122. u32 outCrFirst;
  123. u32 inFormat;
  124. u32 inStartCh;
  125. u32 inCrFirst;
  126. u32 rgbDepth;
  127. u32 inWidth;
  128. u32 inHeight;
  129. u32 altRegs;
  130. u32 maxOutWidth;
  131. u32 maxOutHeight;
  132. u32 blendEna;
  133. u32 deintEna;
  134. u32 ditherEna;
  135. u32 scalingEna;
  136. u32 hwId;
  137. } PPContainer;
  138. /*------------------------------------------------------------------------------
  139. 3. Prototypes of Decoder API internal functions
  140. ------------------------------------------------------------------------------*/
  141. void PPInitDataStructures(PPContainer * ppC);
  142. void PPInitHW(PPContainer * ppC);
  143. void PPSetupHW(PPContainer * ppC);
  144. i32 PPCheckConfig(PPContainer * ppC, PPConfig * ppCfg,
  145. u32 decLinked, u32 decType);
  146. void PPSetupScaling(PPContainer * ppC, const PPOutImage * ppOutImg);
  147. PPResult PPRun(PPContainer * ppC);
  148. void PPRefreshRegs(PPContainer * ppC);
  149. void PPFlushRegs(PPContainer * ppC);
  150. u32 PPGetStatus(const PPContainer * ppC);
  151. void PPSetStatus(PPContainer * ppC, u32 status);
  152. i32 PPSelectOutputSize(PPContainer * ppC);
  153. PPResult WaitForPp(PPContainer * ppC);
  154. u32 PPCheckSetupChanges(PPConfig * prevCfg, PPConfig * newCfg);
  155. void PPSetConfigIdData(PPContainer * ppC);
  156. #endif