txfm_common.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (c) 2015 The WebM project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef VPX_VPX_DSP_TXFM_COMMON_H_
  11. #define VPX_VPX_DSP_TXFM_COMMON_H_
  12. #include "vpx_dsp/vpx_dsp_common.h"
  13. // Constants and Macros used by all idct/dct functions
  14. #define DCT_CONST_BITS 14
  15. #define DCT_CONST_ROUNDING (1 << (DCT_CONST_BITS - 1))
  16. #define UNIT_QUANT_SHIFT 2
  17. #define UNIT_QUANT_FACTOR (1 << UNIT_QUANT_SHIFT)
  18. // Constants:
  19. // for (int i = 1; i< 32; ++i)
  20. // printf("static const int cospi_%d_64 = %.0f;\n", i,
  21. // round(16384 * cos(i*M_PI/64)));
  22. // Note: sin(k*Pi/64) = cos((32-k)*Pi/64)
  23. static const tran_coef_t cospi_1_64 = 16364;
  24. static const tran_coef_t cospi_2_64 = 16305;
  25. static const tran_coef_t cospi_3_64 = 16207;
  26. static const tran_coef_t cospi_4_64 = 16069;
  27. static const tran_coef_t cospi_5_64 = 15893;
  28. static const tran_coef_t cospi_6_64 = 15679;
  29. static const tran_coef_t cospi_7_64 = 15426;
  30. static const tran_coef_t cospi_8_64 = 15137;
  31. static const tran_coef_t cospi_9_64 = 14811;
  32. static const tran_coef_t cospi_10_64 = 14449;
  33. static const tran_coef_t cospi_11_64 = 14053;
  34. static const tran_coef_t cospi_12_64 = 13623;
  35. static const tran_coef_t cospi_13_64 = 13160;
  36. static const tran_coef_t cospi_14_64 = 12665;
  37. static const tran_coef_t cospi_15_64 = 12140;
  38. static const tran_coef_t cospi_16_64 = 11585;
  39. static const tran_coef_t cospi_17_64 = 11003;
  40. static const tran_coef_t cospi_18_64 = 10394;
  41. static const tran_coef_t cospi_19_64 = 9760;
  42. static const tran_coef_t cospi_20_64 = 9102;
  43. static const tran_coef_t cospi_21_64 = 8423;
  44. static const tran_coef_t cospi_22_64 = 7723;
  45. static const tran_coef_t cospi_23_64 = 7005;
  46. static const tran_coef_t cospi_24_64 = 6270;
  47. static const tran_coef_t cospi_25_64 = 5520;
  48. static const tran_coef_t cospi_26_64 = 4756;
  49. static const tran_coef_t cospi_27_64 = 3981;
  50. static const tran_coef_t cospi_28_64 = 3196;
  51. static const tran_coef_t cospi_29_64 = 2404;
  52. static const tran_coef_t cospi_30_64 = 1606;
  53. static const tran_coef_t cospi_31_64 = 804;
  54. // 16384 * sqrt(2) * sin(kPi/9) * 2 / 3
  55. static const tran_coef_t sinpi_1_9 = 5283;
  56. static const tran_coef_t sinpi_2_9 = 9929;
  57. static const tran_coef_t sinpi_3_9 = 13377;
  58. static const tran_coef_t sinpi_4_9 = 15212;
  59. #endif // VPX_VPX_DSP_TXFM_COMMON_H_