dequantize_mmi.c 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * Copyright (c) 2017 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. #include "./vp8_rtcd.h"
  11. #include "vp8/common/blockd.h"
  12. #include "vpx_mem/vpx_mem.h"
  13. #include "vpx_ports/asmdefs_mmi.h"
  14. void vp8_dequantize_b_mmi(BLOCKD *d, int16_t *DQC) {
  15. double ftmp[8];
  16. __asm__ volatile(
  17. "gsldlc1 %[ftmp0], 0x07(%[qcoeff]) \n\t"
  18. "gsldrc1 %[ftmp0], 0x00(%[qcoeff]) \n\t"
  19. "gsldlc1 %[ftmp1], 0x0f(%[qcoeff]) \n\t"
  20. "gsldrc1 %[ftmp1], 0x08(%[qcoeff]) \n\t"
  21. "gsldlc1 %[ftmp2], 0x17(%[qcoeff]) \n\t"
  22. "gsldrc1 %[ftmp2], 0x10(%[qcoeff]) \n\t"
  23. "gsldlc1 %[ftmp3], 0x1f(%[qcoeff]) \n\t"
  24. "gsldrc1 %[ftmp3], 0x18(%[qcoeff]) \n\t"
  25. "gsldlc1 %[ftmp4], 0x07(%[DQC]) \n\t"
  26. "gsldrc1 %[ftmp4], 0x00(%[DQC]) \n\t"
  27. "gsldlc1 %[ftmp5], 0x0f(%[DQC]) \n\t"
  28. "gsldrc1 %[ftmp5], 0x08(%[DQC]) \n\t"
  29. "gsldlc1 %[ftmp6], 0x17(%[DQC]) \n\t"
  30. "gsldrc1 %[ftmp6], 0x10(%[DQC]) \n\t"
  31. "gsldlc1 %[ftmp7], 0x1f(%[DQC]) \n\t"
  32. "gsldrc1 %[ftmp7], 0x18(%[DQC]) \n\t"
  33. "pmullh %[ftmp0], %[ftmp0], %[ftmp4] \n\t"
  34. "pmullh %[ftmp1], %[ftmp1], %[ftmp5] \n\t"
  35. "pmullh %[ftmp2], %[ftmp2], %[ftmp6] \n\t"
  36. "pmullh %[ftmp3], %[ftmp3], %[ftmp7] \n\t"
  37. "gssdlc1 %[ftmp0], 0x07(%[dqcoeff]) \n\t"
  38. "gssdrc1 %[ftmp0], 0x00(%[dqcoeff]) \n\t"
  39. "gssdlc1 %[ftmp1], 0x0f(%[dqcoeff]) \n\t"
  40. "gssdrc1 %[ftmp1], 0x08(%[dqcoeff]) \n\t"
  41. "gssdlc1 %[ftmp2], 0x17(%[dqcoeff]) \n\t"
  42. "gssdrc1 %[ftmp2], 0x10(%[dqcoeff]) \n\t"
  43. "gssdlc1 %[ftmp3], 0x1f(%[dqcoeff]) \n\t"
  44. "gssdrc1 %[ftmp3], 0x18(%[dqcoeff]) \n\t"
  45. : [ftmp0] "=&f"(ftmp[0]), [ftmp1] "=&f"(ftmp[1]), [ftmp2] "=&f"(ftmp[2]),
  46. [ftmp3] "=&f"(ftmp[3]), [ftmp4] "=&f"(ftmp[4]), [ftmp5] "=&f"(ftmp[5]),
  47. [ftmp6] "=&f"(ftmp[6]), [ftmp7] "=&f"(ftmp[7])
  48. : [dqcoeff] "r"(d->dqcoeff), [qcoeff] "r"(d->qcoeff), [DQC] "r"(DQC)
  49. : "memory");
  50. }
  51. void vp8_dequant_idct_add_mmi(int16_t *input, int16_t *dq, unsigned char *dest,
  52. int stride) {
  53. double ftmp[8];
  54. __asm__ volatile(
  55. "gsldlc1 %[ftmp0], 0x07(%[dq]) \n\t"
  56. "gsldrc1 %[ftmp0], 0x00(%[dq]) \n\t"
  57. "gsldlc1 %[ftmp1], 0x0f(%[dq]) \n\t"
  58. "gsldrc1 %[ftmp1], 0x08(%[dq]) \n\t"
  59. "gsldlc1 %[ftmp2], 0x17(%[dq]) \n\t"
  60. "gsldrc1 %[ftmp2], 0x10(%[dq]) \n\t"
  61. "gsldlc1 %[ftmp3], 0x1f(%[dq]) \n\t"
  62. "gsldrc1 %[ftmp3], 0x18(%[dq]) \n\t"
  63. "gsldlc1 %[ftmp4], 0x07(%[input]) \n\t"
  64. "gsldrc1 %[ftmp4], 0x00(%[input]) \n\t"
  65. "gsldlc1 %[ftmp5], 0x0f(%[input]) \n\t"
  66. "gsldrc1 %[ftmp5], 0x08(%[input]) \n\t"
  67. "gsldlc1 %[ftmp6], 0x17(%[input]) \n\t"
  68. "gsldrc1 %[ftmp6], 0x10(%[input]) \n\t"
  69. "gsldlc1 %[ftmp7], 0x1f(%[input]) \n\t"
  70. "gsldrc1 %[ftmp7], 0x18(%[input]) \n\t"
  71. "pmullh %[ftmp0], %[ftmp0], %[ftmp4] \n\t"
  72. "pmullh %[ftmp1], %[ftmp1], %[ftmp5] \n\t"
  73. "pmullh %[ftmp2], %[ftmp2], %[ftmp6] \n\t"
  74. "pmullh %[ftmp3], %[ftmp3], %[ftmp7] \n\t"
  75. "gssdlc1 %[ftmp0], 0x07(%[input]) \n\t"
  76. "gssdrc1 %[ftmp0], 0x00(%[input]) \n\t"
  77. "gssdlc1 %[ftmp1], 0x0f(%[input]) \n\t"
  78. "gssdrc1 %[ftmp1], 0x08(%[input]) \n\t"
  79. "gssdlc1 %[ftmp2], 0x17(%[input]) \n\t"
  80. "gssdrc1 %[ftmp2], 0x10(%[input]) \n\t"
  81. "gssdlc1 %[ftmp3], 0x1f(%[input]) \n\t"
  82. "gssdrc1 %[ftmp3], 0x18(%[input]) \n\t"
  83. : [ftmp0] "=&f"(ftmp[0]), [ftmp1] "=&f"(ftmp[1]), [ftmp2] "=&f"(ftmp[2]),
  84. [ftmp3] "=&f"(ftmp[3]), [ftmp4] "=&f"(ftmp[4]), [ftmp5] "=&f"(ftmp[5]),
  85. [ftmp6] "=&f"(ftmp[6]), [ftmp7] "=&f"(ftmp[7])
  86. : [dq] "r"(dq), [input] "r"(input)
  87. : "memory");
  88. vp8_short_idct4x4llm_mmi(input, dest, stride, dest, stride);
  89. __asm__ volatile(
  90. "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
  91. "gssdlc1 %[ftmp0], 0x07(%[input]) \n\t"
  92. "gssdrc1 %[ftmp0], 0x00(%[input]) \n\t"
  93. "sdl $0, 0x0f(%[input]) \n\t"
  94. "sdr $0, 0x08(%[input]) \n\t"
  95. "gssdlc1 %[ftmp0], 0x17(%[input]) \n\t"
  96. "gssdrc1 %[ftmp0], 0x10(%[input]) \n\t"
  97. "sdl $0, 0x1f(%[input]) \n\t"
  98. "sdr $0, 0x18(%[input]) \n\t"
  99. : [ftmp0] "=&f"(ftmp[0])
  100. : [input] "r"(input)
  101. : "memory");
  102. }