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

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: block_mx1.c 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.  
  24. #include "../common.h"
  25. #include "softidct.h"
  26. #ifdef FREESCALE_MX1
  27. void MX1PopNone(struct softidct* p)
  28. {
  29. }
  30. static void MX1Pop(struct softidct* p)
  31. {
  32. int x0,x1,x2,x3,x4,x5,x6,x7;
  33. uint8_t *DstEnd;
  34. uint8_t *Dst = p->MX1Dst;
  35. int Pitch = p->MX1Pitch;
  36. volatile int* MX1 = p->MX1;
  37. while (!(MX1[-61] & 0x20));
  38. DstEnd = Dst + Pitch*8;
  39. do
  40. {
  41. x0 = *MX1; x1 = x0 >> (16+7); x0 <<= 16; x0 >>= (16+7);
  42. x2 = *MX1; x3 = x2 >> (16+7); x2 <<= 16; x2 >>= (16+7);
  43. x4 = *MX1; x5 = x4 >> (16+7); x4 <<= 16; x4 >>= (16+7);
  44. x6 = *MX1; x7 = x6 >> (16+7); x6 <<= 16; x6 >>= (16+7);
  45. if ((x0|x1|x2|x3|x4|x5|x6|x7)>>8)
  46. {
  47. SAT(x0)
  48. SAT(x1)
  49. SAT(x2)
  50. SAT(x3)
  51. SAT(x4)
  52. SAT(x5)
  53. SAT(x6)
  54. SAT(x7)
  55. }
  56. Dst[0] = (uint8_t)x0;
  57. Dst[1] = (uint8_t)x1;
  58. Dst[2] = (uint8_t)x2;
  59. Dst[3] = (uint8_t)x3;
  60. Dst[4] = (uint8_t)x4;
  61. Dst[5] = (uint8_t)x5;
  62. Dst[6] = (uint8_t)x6;
  63. Dst[7] = (uint8_t)x7;
  64. Dst += Pitch;
  65. } while (Dst != DstEnd);
  66. }
  67. static void MX1PopAdd(struct softidct* p)
  68. {
  69. int x0,x1,x2,x3,x4,x5,x6,x7;
  70. uint8_t *DstEnd;
  71. uint8_t *Dst = p->MX1Dst;
  72. uint8_t *Src = p->Tmp;
  73. int Pitch = p->MX1Pitch;
  74. volatile int* MX1 = p->MX1;
  75. while (!(MX1[-61] & 0x20));
  76. DstEnd = Dst + Pitch*8;
  77. do
  78. {
  79. x0 = *MX1; x1 = x0 >> (16+7); x0 <<= 16; x0 >>= (16+7);
  80. x2 = *MX1; x3 = x2 >> (16+7); x2 <<= 16; x2 >>= (16+7);
  81. x4 = *MX1; x5 = x4 >> (16+7); x4 <<= 16; x4 >>= (16+7);
  82. x6 = *MX1; x7 = x6 >> (16+7); x6 <<= 16; x6 >>= (16+7);
  83. x0 += Src[0];
  84. x1 += Src[1];
  85. x2 += Src[2];
  86. x3 += Src[3];
  87. x4 += Src[4];
  88. x5 += Src[5];
  89. x6 += Src[6];
  90. x7 += Src[7];
  91. Src += 8;
  92. if ((x0|x1|x2|x3|x4|x5|x6|x7)>>8)
  93. {
  94. SAT(x0)
  95. SAT(x1)
  96. SAT(x2)
  97. SAT(x3)
  98. SAT(x4)
  99. SAT(x5)
  100. SAT(x6)
  101. SAT(x7)
  102. }
  103. Dst[0] = (uint8_t)x0;
  104. Dst[1] = (uint8_t)x1;
  105. Dst[2] = (uint8_t)x2;
  106. Dst[3] = (uint8_t)x3;
  107. Dst[4] = (uint8_t)x4;
  108. Dst[5] = (uint8_t)x5;
  109. Dst[6] = (uint8_t)x6;
  110. Dst[7] = (uint8_t)x7;
  111. Dst += Pitch;
  112. } while (Dst != DstEnd);
  113. }
  114. #define Intra8x8 MX1Intra8x8
  115. #define Inter8x8Back MX1Inter8x8Back
  116. #define Inter8x8BackFwd MX1Inter8x8BackFwd
  117. #include "block_mx1.h"
  118. #undef Intra8x8
  119. #undef Inter8x8Back
  120. #undef Inter8x8BackFwd
  121. #ifdef CONFIG_IDCT_SWAP
  122. #define SWAPXY
  123. #define SWAP8X4
  124. #define Intra8x8 MX1Intra8x8Swap
  125. #define Inter8x8Back MX1Inter8x8BackSwap
  126. #define Inter8x8BackFwd MX1Inter8x8BackFwdSwap
  127. #include "block_mx1.h"
  128. #endif
  129. #endif