sbc_dct.h 4.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /******************************************************************************
  2. *
  3. * Copyright (C) 1999-2012 Broadcom Corporation
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at:
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. *
  17. ******************************************************************************/
  18. /******************************************************************************
  19. *
  20. * Definitions for the fast DCT.
  21. *
  22. ******************************************************************************/
  23. #ifndef SBC_DCT_H
  24. #define SBC_DCT_H
  25. #if (SBC_ARM_ASM_OPT==TRUE)
  26. #define SBC_MULT_32_16_SIMPLIFIED(s16In2, s32In1, s32OutLow) \
  27. { \
  28. __asm \
  29. { \
  30. MUL s32OutLow,(SINT32)s16In2, (s32In1>>15) \
  31. } \
  32. }
  33. #else
  34. #if (SBC_DSP_OPT==TRUE)
  35. #define SBC_MULT_32_16_SIMPLIFIED(s16In2, s32In1 , s32OutLow) s32OutLow = SBC_Multiply_32_16_Simplified((SINT32)s16In2,s32In1);
  36. #else
  37. #if (SBC_IPAQ_OPT==TRUE)
  38. /*#define SBC_MULT_32_16_SIMPLIFIED(s16In2, s32In1 , s32OutLow) s32OutLow=(SINT32)((SINT32)(s16In2)*(SINT32)(s32In1>>15)); */
  39. #define SBC_MULT_32_16_SIMPLIFIED(s16In2, s32In1 , s32OutLow) s32OutLow=(SINT32)(((SINT64)s16In2*(SINT64)s32In1)>>15);
  40. #if (SBC_IS_64_MULT_IN_IDCT == TRUE)
  41. #define SBC_MULT_32_32(s32In2, s32In1, s32OutLow) \
  42. { \
  43. s64Temp = ((SINT64) s32In2) * ((SINT64) s32In1)>>31; \
  44. s32OutLow = (SINT32) s64Temp; \
  45. }
  46. #endif
  47. #else
  48. #define SBC_MULT_32_16_SIMPLIFIED(s16In2, s32In1 , s32OutLow) \
  49. { \
  50. s32In1Temp = s32In1; \
  51. s32In2Temp = (SINT32)s16In2; \
  52. \
  53. /* Multiply one +ve and the other -ve number */ \
  54. if (s32In1Temp < 0) \
  55. { \
  56. s32In1Temp ^= 0xFFFFFFFF; \
  57. s32In1Temp++; \
  58. s32OutLow = (s32In2Temp * (s32In1Temp >> 16)); \
  59. s32OutLow += (( s32In2Temp * (s32In1Temp & 0xFFFF)) >> 16); \
  60. s32OutLow ^= 0xFFFFFFFF; \
  61. s32OutLow++; \
  62. } \
  63. else \
  64. { \
  65. s32OutLow = (s32In2Temp * (s32In1Temp >> 16)); \
  66. s32OutLow += (( s32In2Temp * (s32In1Temp & 0xFFFF)) >> 16); \
  67. } \
  68. s32OutLow <<= 1; \
  69. }
  70. #if (SBC_IS_64_MULT_IN_IDCT == TRUE)
  71. #define SBC_MULT_64(s32In1, s32In2, s32OutLow, s32OutHi) \
  72. {\
  73. s32OutLow=(SINT32)(((SINT64)s32In1*(SINT64)s32In2)& 0x00000000FFFFFFFF);\
  74. s32OutHi=(SINT32)(((SINT64)s32In1*(SINT64)s32In2)>>32);\
  75. }
  76. #define SBC_MULT_32_32(s32In2, s32In1, s32OutLow) \
  77. { \
  78. s32HiTemp = 0; \
  79. SBC_MULT_64(s32In2,s32In1 , s32OutLow, s32HiTemp); \
  80. s32OutLow = (((s32OutLow>>15)&0x1FFFF) | (s32HiTemp << 17)); \
  81. }
  82. #endif
  83. #endif
  84. #endif
  85. #endif
  86. #endif