intel2700g_idct422.h
上传用户:wstnjxml
上传日期:2014-04-03
资源大小:7248k
文件大小:4k
源码类别:

Windows CE

开发平台:

C/C++

  1. /*****************************************************************************
  2.  *
  3.  * This program is free software ; you can redistribute it and/or modify
  4.  * it under the terms of the GNU General Public License as published by
  5.  * the Free Software Foundation; either version 2 of the License, or
  6.  * (at your option) any later version.
  7.  *
  8.  * This program is distributed in the hope that it will be useful,
  9.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11.  * GNU General Public License for more details.
  12.  *
  13.  * You should have received a copy of the GNU General Public License
  14.  * along with this program; if not, write to the Free Software
  15.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  16.  *
  17.  * $Id: intel2700g_idct422.h 271 2005-08-09 08:31:35Z picard $
  18.  *
  19.  * The Core Pocket Media Player
  20.  * Copyright (c) 2004-2005 Gabor Kovacs
  21.  *
  22.  ****************************************************************************/
  23. void IDCTProcess_422(void* p,int x,int y)
  24. {
  25. int Pos;
  26. x <<= 4;
  27. y <<= 3; 
  28. Pos = (x << GXVA_IMAGE_WRITE_X_SHIFT) | (y << GXVA_IMAGE_WRITE_Y_SHIFT);
  29. PVR(p)->mx = x;
  30. PVR(p)->my = y;
  31. PVR(p)->SubPos = 0;
  32. PVR(p)->ImageWrite[1] = 
  33. PVR(p)->ImageWrite[2] = (Pos >> 1) |
  34. GXVA_CMD_IMAGE_WRITE |
  35. GXVA_IMAGE_WRITE_WIDTH_8 |
  36. GXVA_IMAGE_WRITE_HGHT_4;
  37. PVR(p)->ImageWrite[0] = Pos |
  38. GXVA_CMD_IMAGE_WRITE |
  39. GXVA_IMAGE_WRITE_WIDTH_16 |
  40. GXVA_IMAGE_WRITE_HGHT_8;
  41. PVR(p)->M24VA_WriteMCCmdData(GXVA_CMD_MC_OPP_TYPE|GXVA_MC_TYPE_COL_PLANE_Y);
  42. }
  43. static INLINE void IDCT8x8_422(pvr* p,idct_block_t *Block,int Length,const uint8_t* Scan)
  44. {
  45. const uint8_t *ScanEnd = Scan + Length;
  46. int16_t* Data = p->IZZ;
  47. int v;
  48. int d;
  49. for (;;Data+=2)
  50. {
  51. do
  52. {
  53. if (Scan == ScanEnd) goto end;
  54. v = *(Scan++);
  55. d = Block[v];
  56. } while (!d);
  57. v <<= 1;
  58. Data[0] = (int16_t)v;
  59. Data[1] = (int16_t)d;
  60. }
  61. end:
  62. if (Data == p->IZZ)
  63. {
  64. *(int32_t*)Data = 0;
  65. Data += 2;
  66. }
  67. Data[-2] |= 1;
  68. p->M24VA_WriteIZZBlock((gx_int32*)p->IZZ,(gx_int32*)Data - (gx_int32*)p->IZZ);
  69. }
  70. static INLINE void IDCT8x4_422(pvr* p,idct_block_t *Block,int Length,const uint8_t* Scan)
  71. {
  72. const uint8_t *ScanEnd = Scan + Length;
  73. int16_t* Data = p->IZZ;
  74. int v,w;
  75. int d;
  76. for (;;Data+=2)
  77. {
  78. do
  79. {
  80. skip:
  81. if (Scan == ScanEnd) goto end;
  82. w = Scan[64];
  83. v = *(Scan++);
  84. if (w>=64) goto skip;
  85. d = Block[v];
  86. } while (!d);
  87. w <<= 1;
  88. Data[0] = (int16_t)w;
  89. Data[1] = (int16_t)d;
  90. }
  91. end:
  92. if (Data == p->IZZ)
  93. {
  94. *(int32_t*)Data = 0;
  95. Data += 2;
  96. }
  97. Data[-2] |= 1;
  98. p->M24VA_WriteIZZBlock((gx_int32*)p->IZZ,(gx_int32*)Data - (gx_int32*)p->IZZ);
  99. }
  100. int Intra422[4] =
  101. {
  102. GXVA_CMD_IDCT_MODE|GXVA_IDCT_MODE_INTRA|GXVA_IDCT_BLK_SIZEX_8|GXVA_IDCT_BLK_SIZEY_8|GXVA_IDCT_MODE_BLK_TOP_LEFT,
  103. GXVA_CMD_IDCT_MODE|GXVA_IDCT_MODE_INTRA|GXVA_IDCT_BLK_SIZEX_8|GXVA_IDCT_BLK_SIZEY_8|GXVA_IDCT_MODE_BLK_TOP_RGHT,
  104. GXVA_CMD_IDCT_MODE|GXVA_IDCT_MODE_INTRA|GXVA_IDCT_BLK_SIZEX_8|GXVA_IDCT_BLK_SIZEY_8|GXVA_IDCT_MODE_BLK_TOP_LEFT,
  105. GXVA_CMD_IDCT_MODE|GXVA_IDCT_MODE_INTRA|GXVA_IDCT_BLK_SIZEX_8|GXVA_IDCT_BLK_SIZEY_8|GXVA_IDCT_MODE_BLK_TOP_LEFT
  106. };
  107. void IDCTIntra8x8_422(void* p,idct_block_t *Block,int Length,int ScanType)
  108. {
  109. int SubPos = PVR(p)->SubPos++;
  110. if (SubPos >= 2)
  111. {
  112. PVR(p)->M24VA_WriteMCCmdData(
  113. (SubPos - 1)| // GXVA_MC_TYPE_COL_PLANE_U, GXVA_MC_TYPE_COL_PLANE_V
  114. GXVA_CMD_MC_OPP_TYPE);
  115. PVR(p)->M24VA_WriteMCCmdData(Intra422[SubPos]);
  116. IDCT8x4_422(PVR(p),Block,Length,ScanTable8x4[ScanType]);
  117. PVR(p)->M24VA_WriteMCCmdData(PVR(p)->ImageWrite[SubPos-1]);
  118. }
  119. else
  120. {
  121. PVR(p)->M24VA_WriteMCCmdData(Intra422[SubPos]);
  122. IDCT8x8_422(PVR(p),Block,Length,ScanTable[ScanType]);
  123. if (SubPos)
  124. PVR(p)->M24VA_WriteMCCmdData(PVR(p)->ImageWrite[0]);
  125. }
  126. }