highbd_idct_neon.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. /*
  2. * Copyright (c) 2018 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_ARM_HIGHBD_IDCT_NEON_H_
  11. #define VPX_VPX_DSP_ARM_HIGHBD_IDCT_NEON_H_
  12. #include <arm_neon.h>
  13. #include "./vpx_dsp_rtcd.h"
  14. #include "vpx_dsp/arm/idct_neon.h"
  15. #include "vpx_dsp/inv_txfm.h"
  16. static INLINE void highbd_idct4x4_1_add_kernel1(uint16_t **dest,
  17. const int stride,
  18. const int16x8_t res,
  19. const int16x8_t max) {
  20. const uint16x4_t a0 = vld1_u16(*dest);
  21. const uint16x4_t a1 = vld1_u16(*dest + stride);
  22. const int16x8_t a = vreinterpretq_s16_u16(vcombine_u16(a0, a1));
  23. // Note: In some profile tests, res is quite close to +/-32767.
  24. // We use saturating addition.
  25. const int16x8_t b = vqaddq_s16(res, a);
  26. const int16x8_t c = vminq_s16(b, max);
  27. const uint16x8_t d = vqshluq_n_s16(c, 0);
  28. vst1_u16(*dest, vget_low_u16(d));
  29. *dest += stride;
  30. vst1_u16(*dest, vget_high_u16(d));
  31. *dest += stride;
  32. }
  33. static INLINE void idct4x4_16_kernel_bd10(const int32x4_t cospis,
  34. int32x4_t *const a) {
  35. int32x4_t b0, b1, b2, b3;
  36. transpose_s32_4x4(&a[0], &a[1], &a[2], &a[3]);
  37. b0 = vaddq_s32(a[0], a[2]);
  38. b1 = vsubq_s32(a[0], a[2]);
  39. b0 = vmulq_lane_s32(b0, vget_high_s32(cospis), 0);
  40. b1 = vmulq_lane_s32(b1, vget_high_s32(cospis), 0);
  41. b2 = vmulq_lane_s32(a[1], vget_high_s32(cospis), 1);
  42. b3 = vmulq_lane_s32(a[1], vget_low_s32(cospis), 1);
  43. b2 = vmlsq_lane_s32(b2, a[3], vget_low_s32(cospis), 1);
  44. b3 = vmlaq_lane_s32(b3, a[3], vget_high_s32(cospis), 1);
  45. b0 = vrshrq_n_s32(b0, DCT_CONST_BITS);
  46. b1 = vrshrq_n_s32(b1, DCT_CONST_BITS);
  47. b2 = vrshrq_n_s32(b2, DCT_CONST_BITS);
  48. b3 = vrshrq_n_s32(b3, DCT_CONST_BITS);
  49. a[0] = vaddq_s32(b0, b3);
  50. a[1] = vaddq_s32(b1, b2);
  51. a[2] = vsubq_s32(b1, b2);
  52. a[3] = vsubq_s32(b0, b3);
  53. }
  54. static INLINE void idct4x4_16_kernel_bd12(const int32x4_t cospis,
  55. int32x4_t *const a) {
  56. int32x4_t b0, b1, b2, b3;
  57. int64x2_t c[12];
  58. transpose_s32_4x4(&a[0], &a[1], &a[2], &a[3]);
  59. b0 = vaddq_s32(a[0], a[2]);
  60. b1 = vsubq_s32(a[0], a[2]);
  61. c[0] = vmull_lane_s32(vget_low_s32(b0), vget_high_s32(cospis), 0);
  62. c[1] = vmull_lane_s32(vget_high_s32(b0), vget_high_s32(cospis), 0);
  63. c[2] = vmull_lane_s32(vget_low_s32(b1), vget_high_s32(cospis), 0);
  64. c[3] = vmull_lane_s32(vget_high_s32(b1), vget_high_s32(cospis), 0);
  65. c[4] = vmull_lane_s32(vget_low_s32(a[1]), vget_high_s32(cospis), 1);
  66. c[5] = vmull_lane_s32(vget_high_s32(a[1]), vget_high_s32(cospis), 1);
  67. c[6] = vmull_lane_s32(vget_low_s32(a[1]), vget_low_s32(cospis), 1);
  68. c[7] = vmull_lane_s32(vget_high_s32(a[1]), vget_low_s32(cospis), 1);
  69. c[8] = vmull_lane_s32(vget_low_s32(a[3]), vget_low_s32(cospis), 1);
  70. c[9] = vmull_lane_s32(vget_high_s32(a[3]), vget_low_s32(cospis), 1);
  71. c[10] = vmull_lane_s32(vget_low_s32(a[3]), vget_high_s32(cospis), 1);
  72. c[11] = vmull_lane_s32(vget_high_s32(a[3]), vget_high_s32(cospis), 1);
  73. c[4] = vsubq_s64(c[4], c[8]);
  74. c[5] = vsubq_s64(c[5], c[9]);
  75. c[6] = vaddq_s64(c[6], c[10]);
  76. c[7] = vaddq_s64(c[7], c[11]);
  77. b0 = vcombine_s32(vrshrn_n_s64(c[0], DCT_CONST_BITS),
  78. vrshrn_n_s64(c[1], DCT_CONST_BITS));
  79. b1 = vcombine_s32(vrshrn_n_s64(c[2], DCT_CONST_BITS),
  80. vrshrn_n_s64(c[3], DCT_CONST_BITS));
  81. b2 = vcombine_s32(vrshrn_n_s64(c[4], DCT_CONST_BITS),
  82. vrshrn_n_s64(c[5], DCT_CONST_BITS));
  83. b3 = vcombine_s32(vrshrn_n_s64(c[6], DCT_CONST_BITS),
  84. vrshrn_n_s64(c[7], DCT_CONST_BITS));
  85. a[0] = vaddq_s32(b0, b3);
  86. a[1] = vaddq_s32(b1, b2);
  87. a[2] = vsubq_s32(b1, b2);
  88. a[3] = vsubq_s32(b0, b3);
  89. }
  90. static INLINE void highbd_add8x8(int16x8_t *const a, uint16_t *dest,
  91. const int stride, const int bd) {
  92. const int16x8_t max = vdupq_n_s16((1 << bd) - 1);
  93. const uint16_t *dst = dest;
  94. uint16x8_t d0, d1, d2, d3, d4, d5, d6, d7;
  95. uint16x8_t d0_u16, d1_u16, d2_u16, d3_u16, d4_u16, d5_u16, d6_u16, d7_u16;
  96. int16x8_t d0_s16, d1_s16, d2_s16, d3_s16, d4_s16, d5_s16, d6_s16, d7_s16;
  97. d0 = vld1q_u16(dst);
  98. dst += stride;
  99. d1 = vld1q_u16(dst);
  100. dst += stride;
  101. d2 = vld1q_u16(dst);
  102. dst += stride;
  103. d3 = vld1q_u16(dst);
  104. dst += stride;
  105. d4 = vld1q_u16(dst);
  106. dst += stride;
  107. d5 = vld1q_u16(dst);
  108. dst += stride;
  109. d6 = vld1q_u16(dst);
  110. dst += stride;
  111. d7 = vld1q_u16(dst);
  112. d0_s16 = vqaddq_s16(a[0], vreinterpretq_s16_u16(d0));
  113. d1_s16 = vqaddq_s16(a[1], vreinterpretq_s16_u16(d1));
  114. d2_s16 = vqaddq_s16(a[2], vreinterpretq_s16_u16(d2));
  115. d3_s16 = vqaddq_s16(a[3], vreinterpretq_s16_u16(d3));
  116. d4_s16 = vqaddq_s16(a[4], vreinterpretq_s16_u16(d4));
  117. d5_s16 = vqaddq_s16(a[5], vreinterpretq_s16_u16(d5));
  118. d6_s16 = vqaddq_s16(a[6], vreinterpretq_s16_u16(d6));
  119. d7_s16 = vqaddq_s16(a[7], vreinterpretq_s16_u16(d7));
  120. d0_s16 = vminq_s16(d0_s16, max);
  121. d1_s16 = vminq_s16(d1_s16, max);
  122. d2_s16 = vminq_s16(d2_s16, max);
  123. d3_s16 = vminq_s16(d3_s16, max);
  124. d4_s16 = vminq_s16(d4_s16, max);
  125. d5_s16 = vminq_s16(d5_s16, max);
  126. d6_s16 = vminq_s16(d6_s16, max);
  127. d7_s16 = vminq_s16(d7_s16, max);
  128. d0_u16 = vqshluq_n_s16(d0_s16, 0);
  129. d1_u16 = vqshluq_n_s16(d1_s16, 0);
  130. d2_u16 = vqshluq_n_s16(d2_s16, 0);
  131. d3_u16 = vqshluq_n_s16(d3_s16, 0);
  132. d4_u16 = vqshluq_n_s16(d4_s16, 0);
  133. d5_u16 = vqshluq_n_s16(d5_s16, 0);
  134. d6_u16 = vqshluq_n_s16(d6_s16, 0);
  135. d7_u16 = vqshluq_n_s16(d7_s16, 0);
  136. vst1q_u16(dest, d0_u16);
  137. dest += stride;
  138. vst1q_u16(dest, d1_u16);
  139. dest += stride;
  140. vst1q_u16(dest, d2_u16);
  141. dest += stride;
  142. vst1q_u16(dest, d3_u16);
  143. dest += stride;
  144. vst1q_u16(dest, d4_u16);
  145. dest += stride;
  146. vst1q_u16(dest, d5_u16);
  147. dest += stride;
  148. vst1q_u16(dest, d6_u16);
  149. dest += stride;
  150. vst1q_u16(dest, d7_u16);
  151. }
  152. static INLINE void idct8x8_64_half1d_bd10(
  153. const int32x4_t cospis0, const int32x4_t cospis1, int32x4_t *const io0,
  154. int32x4_t *const io1, int32x4_t *const io2, int32x4_t *const io3,
  155. int32x4_t *const io4, int32x4_t *const io5, int32x4_t *const io6,
  156. int32x4_t *const io7) {
  157. int32x4_t step1[8], step2[8];
  158. transpose_s32_8x4(io0, io1, io2, io3, io4, io5, io6, io7);
  159. // stage 1
  160. step1[4] = vmulq_lane_s32(*io1, vget_high_s32(cospis1), 1);
  161. step1[5] = vmulq_lane_s32(*io3, vget_high_s32(cospis1), 0);
  162. step1[6] = vmulq_lane_s32(*io3, vget_low_s32(cospis1), 1);
  163. step1[7] = vmulq_lane_s32(*io1, vget_low_s32(cospis1), 0);
  164. step1[4] = vmlsq_lane_s32(step1[4], *io7, vget_low_s32(cospis1), 0);
  165. step1[5] = vmlaq_lane_s32(step1[5], *io5, vget_low_s32(cospis1), 1);
  166. step1[6] = vmlsq_lane_s32(step1[6], *io5, vget_high_s32(cospis1), 0);
  167. step1[7] = vmlaq_lane_s32(step1[7], *io7, vget_high_s32(cospis1), 1);
  168. step1[4] = vrshrq_n_s32(step1[4], DCT_CONST_BITS);
  169. step1[5] = vrshrq_n_s32(step1[5], DCT_CONST_BITS);
  170. step1[6] = vrshrq_n_s32(step1[6], DCT_CONST_BITS);
  171. step1[7] = vrshrq_n_s32(step1[7], DCT_CONST_BITS);
  172. // stage 2
  173. step2[1] = vmulq_lane_s32(*io0, vget_high_s32(cospis0), 0);
  174. step2[2] = vmulq_lane_s32(*io2, vget_high_s32(cospis0), 1);
  175. step2[3] = vmulq_lane_s32(*io2, vget_low_s32(cospis0), 1);
  176. step2[0] = vmlaq_lane_s32(step2[1], *io4, vget_high_s32(cospis0), 0);
  177. step2[1] = vmlsq_lane_s32(step2[1], *io4, vget_high_s32(cospis0), 0);
  178. step2[2] = vmlsq_lane_s32(step2[2], *io6, vget_low_s32(cospis0), 1);
  179. step2[3] = vmlaq_lane_s32(step2[3], *io6, vget_high_s32(cospis0), 1);
  180. step2[0] = vrshrq_n_s32(step2[0], DCT_CONST_BITS);
  181. step2[1] = vrshrq_n_s32(step2[1], DCT_CONST_BITS);
  182. step2[2] = vrshrq_n_s32(step2[2], DCT_CONST_BITS);
  183. step2[3] = vrshrq_n_s32(step2[3], DCT_CONST_BITS);
  184. step2[4] = vaddq_s32(step1[4], step1[5]);
  185. step2[5] = vsubq_s32(step1[4], step1[5]);
  186. step2[6] = vsubq_s32(step1[7], step1[6]);
  187. step2[7] = vaddq_s32(step1[7], step1[6]);
  188. // stage 3
  189. step1[0] = vaddq_s32(step2[0], step2[3]);
  190. step1[1] = vaddq_s32(step2[1], step2[2]);
  191. step1[2] = vsubq_s32(step2[1], step2[2]);
  192. step1[3] = vsubq_s32(step2[0], step2[3]);
  193. step1[6] = vmulq_lane_s32(step2[6], vget_high_s32(cospis0), 0);
  194. step1[5] = vmlsq_lane_s32(step1[6], step2[5], vget_high_s32(cospis0), 0);
  195. step1[6] = vmlaq_lane_s32(step1[6], step2[5], vget_high_s32(cospis0), 0);
  196. step1[5] = vrshrq_n_s32(step1[5], DCT_CONST_BITS);
  197. step1[6] = vrshrq_n_s32(step1[6], DCT_CONST_BITS);
  198. // stage 4
  199. *io0 = vaddq_s32(step1[0], step2[7]);
  200. *io1 = vaddq_s32(step1[1], step1[6]);
  201. *io2 = vaddq_s32(step1[2], step1[5]);
  202. *io3 = vaddq_s32(step1[3], step2[4]);
  203. *io4 = vsubq_s32(step1[3], step2[4]);
  204. *io5 = vsubq_s32(step1[2], step1[5]);
  205. *io6 = vsubq_s32(step1[1], step1[6]);
  206. *io7 = vsubq_s32(step1[0], step2[7]);
  207. }
  208. static INLINE void idct8x8_64_half1d_bd12(
  209. const int32x4_t cospis0, const int32x4_t cospis1, int32x4_t *const io0,
  210. int32x4_t *const io1, int32x4_t *const io2, int32x4_t *const io3,
  211. int32x4_t *const io4, int32x4_t *const io5, int32x4_t *const io6,
  212. int32x4_t *const io7) {
  213. int32x2_t input1l, input1h, input3l, input3h, input5l, input5h, input7l,
  214. input7h;
  215. int32x2_t step1l[4], step1h[4];
  216. int32x4_t step1[8], step2[8];
  217. int64x2_t t64[8];
  218. int32x2_t t32[8];
  219. transpose_s32_8x4(io0, io1, io2, io3, io4, io5, io6, io7);
  220. // stage 1
  221. input1l = vget_low_s32(*io1);
  222. input1h = vget_high_s32(*io1);
  223. input3l = vget_low_s32(*io3);
  224. input3h = vget_high_s32(*io3);
  225. input5l = vget_low_s32(*io5);
  226. input5h = vget_high_s32(*io5);
  227. input7l = vget_low_s32(*io7);
  228. input7h = vget_high_s32(*io7);
  229. step1l[0] = vget_low_s32(*io0);
  230. step1h[0] = vget_high_s32(*io0);
  231. step1l[1] = vget_low_s32(*io2);
  232. step1h[1] = vget_high_s32(*io2);
  233. step1l[2] = vget_low_s32(*io4);
  234. step1h[2] = vget_high_s32(*io4);
  235. step1l[3] = vget_low_s32(*io6);
  236. step1h[3] = vget_high_s32(*io6);
  237. t64[0] = vmull_lane_s32(input1l, vget_high_s32(cospis1), 1);
  238. t64[1] = vmull_lane_s32(input1h, vget_high_s32(cospis1), 1);
  239. t64[2] = vmull_lane_s32(input3l, vget_high_s32(cospis1), 0);
  240. t64[3] = vmull_lane_s32(input3h, vget_high_s32(cospis1), 0);
  241. t64[4] = vmull_lane_s32(input3l, vget_low_s32(cospis1), 1);
  242. t64[5] = vmull_lane_s32(input3h, vget_low_s32(cospis1), 1);
  243. t64[6] = vmull_lane_s32(input1l, vget_low_s32(cospis1), 0);
  244. t64[7] = vmull_lane_s32(input1h, vget_low_s32(cospis1), 0);
  245. t64[0] = vmlsl_lane_s32(t64[0], input7l, vget_low_s32(cospis1), 0);
  246. t64[1] = vmlsl_lane_s32(t64[1], input7h, vget_low_s32(cospis1), 0);
  247. t64[2] = vmlal_lane_s32(t64[2], input5l, vget_low_s32(cospis1), 1);
  248. t64[3] = vmlal_lane_s32(t64[3], input5h, vget_low_s32(cospis1), 1);
  249. t64[4] = vmlsl_lane_s32(t64[4], input5l, vget_high_s32(cospis1), 0);
  250. t64[5] = vmlsl_lane_s32(t64[5], input5h, vget_high_s32(cospis1), 0);
  251. t64[6] = vmlal_lane_s32(t64[6], input7l, vget_high_s32(cospis1), 1);
  252. t64[7] = vmlal_lane_s32(t64[7], input7h, vget_high_s32(cospis1), 1);
  253. t32[0] = vrshrn_n_s64(t64[0], DCT_CONST_BITS);
  254. t32[1] = vrshrn_n_s64(t64[1], DCT_CONST_BITS);
  255. t32[2] = vrshrn_n_s64(t64[2], DCT_CONST_BITS);
  256. t32[3] = vrshrn_n_s64(t64[3], DCT_CONST_BITS);
  257. t32[4] = vrshrn_n_s64(t64[4], DCT_CONST_BITS);
  258. t32[5] = vrshrn_n_s64(t64[5], DCT_CONST_BITS);
  259. t32[6] = vrshrn_n_s64(t64[6], DCT_CONST_BITS);
  260. t32[7] = vrshrn_n_s64(t64[7], DCT_CONST_BITS);
  261. step1[4] = vcombine_s32(t32[0], t32[1]);
  262. step1[5] = vcombine_s32(t32[2], t32[3]);
  263. step1[6] = vcombine_s32(t32[4], t32[5]);
  264. step1[7] = vcombine_s32(t32[6], t32[7]);
  265. // stage 2
  266. t64[2] = vmull_lane_s32(step1l[0], vget_high_s32(cospis0), 0);
  267. t64[3] = vmull_lane_s32(step1h[0], vget_high_s32(cospis0), 0);
  268. t64[4] = vmull_lane_s32(step1l[1], vget_high_s32(cospis0), 1);
  269. t64[5] = vmull_lane_s32(step1h[1], vget_high_s32(cospis0), 1);
  270. t64[6] = vmull_lane_s32(step1l[1], vget_low_s32(cospis0), 1);
  271. t64[7] = vmull_lane_s32(step1h[1], vget_low_s32(cospis0), 1);
  272. t64[0] = vmlal_lane_s32(t64[2], step1l[2], vget_high_s32(cospis0), 0);
  273. t64[1] = vmlal_lane_s32(t64[3], step1h[2], vget_high_s32(cospis0), 0);
  274. t64[2] = vmlsl_lane_s32(t64[2], step1l[2], vget_high_s32(cospis0), 0);
  275. t64[3] = vmlsl_lane_s32(t64[3], step1h[2], vget_high_s32(cospis0), 0);
  276. t64[4] = vmlsl_lane_s32(t64[4], step1l[3], vget_low_s32(cospis0), 1);
  277. t64[5] = vmlsl_lane_s32(t64[5], step1h[3], vget_low_s32(cospis0), 1);
  278. t64[6] = vmlal_lane_s32(t64[6], step1l[3], vget_high_s32(cospis0), 1);
  279. t64[7] = vmlal_lane_s32(t64[7], step1h[3], vget_high_s32(cospis0), 1);
  280. t32[0] = vrshrn_n_s64(t64[0], DCT_CONST_BITS);
  281. t32[1] = vrshrn_n_s64(t64[1], DCT_CONST_BITS);
  282. t32[2] = vrshrn_n_s64(t64[2], DCT_CONST_BITS);
  283. t32[3] = vrshrn_n_s64(t64[3], DCT_CONST_BITS);
  284. t32[4] = vrshrn_n_s64(t64[4], DCT_CONST_BITS);
  285. t32[5] = vrshrn_n_s64(t64[5], DCT_CONST_BITS);
  286. t32[6] = vrshrn_n_s64(t64[6], DCT_CONST_BITS);
  287. t32[7] = vrshrn_n_s64(t64[7], DCT_CONST_BITS);
  288. step2[0] = vcombine_s32(t32[0], t32[1]);
  289. step2[1] = vcombine_s32(t32[2], t32[3]);
  290. step2[2] = vcombine_s32(t32[4], t32[5]);
  291. step2[3] = vcombine_s32(t32[6], t32[7]);
  292. step2[4] = vaddq_s32(step1[4], step1[5]);
  293. step2[5] = vsubq_s32(step1[4], step1[5]);
  294. step2[6] = vsubq_s32(step1[7], step1[6]);
  295. step2[7] = vaddq_s32(step1[7], step1[6]);
  296. // stage 3
  297. step1[0] = vaddq_s32(step2[0], step2[3]);
  298. step1[1] = vaddq_s32(step2[1], step2[2]);
  299. step1[2] = vsubq_s32(step2[1], step2[2]);
  300. step1[3] = vsubq_s32(step2[0], step2[3]);
  301. t64[2] = vmull_lane_s32(vget_low_s32(step2[6]), vget_high_s32(cospis0), 0);
  302. t64[3] = vmull_lane_s32(vget_high_s32(step2[6]), vget_high_s32(cospis0), 0);
  303. t64[0] =
  304. vmlsl_lane_s32(t64[2], vget_low_s32(step2[5]), vget_high_s32(cospis0), 0);
  305. t64[1] = vmlsl_lane_s32(t64[3], vget_high_s32(step2[5]),
  306. vget_high_s32(cospis0), 0);
  307. t64[2] =
  308. vmlal_lane_s32(t64[2], vget_low_s32(step2[5]), vget_high_s32(cospis0), 0);
  309. t64[3] = vmlal_lane_s32(t64[3], vget_high_s32(step2[5]),
  310. vget_high_s32(cospis0), 0);
  311. t32[0] = vrshrn_n_s64(t64[0], DCT_CONST_BITS);
  312. t32[1] = vrshrn_n_s64(t64[1], DCT_CONST_BITS);
  313. t32[2] = vrshrn_n_s64(t64[2], DCT_CONST_BITS);
  314. t32[3] = vrshrn_n_s64(t64[3], DCT_CONST_BITS);
  315. step1[5] = vcombine_s32(t32[0], t32[1]);
  316. step1[6] = vcombine_s32(t32[2], t32[3]);
  317. // stage 4
  318. *io0 = vaddq_s32(step1[0], step2[7]);
  319. *io1 = vaddq_s32(step1[1], step1[6]);
  320. *io2 = vaddq_s32(step1[2], step1[5]);
  321. *io3 = vaddq_s32(step1[3], step2[4]);
  322. *io4 = vsubq_s32(step1[3], step2[4]);
  323. *io5 = vsubq_s32(step1[2], step1[5]);
  324. *io6 = vsubq_s32(step1[1], step1[6]);
  325. *io7 = vsubq_s32(step1[0], step2[7]);
  326. }
  327. static INLINE void highbd_idct16x16_store_pass1(const int32x4x2_t *const out,
  328. int32_t *output) {
  329. // Save the result into output
  330. vst1q_s32(output + 0, out[0].val[0]);
  331. vst1q_s32(output + 4, out[0].val[1]);
  332. output += 16;
  333. vst1q_s32(output + 0, out[1].val[0]);
  334. vst1q_s32(output + 4, out[1].val[1]);
  335. output += 16;
  336. vst1q_s32(output + 0, out[2].val[0]);
  337. vst1q_s32(output + 4, out[2].val[1]);
  338. output += 16;
  339. vst1q_s32(output + 0, out[3].val[0]);
  340. vst1q_s32(output + 4, out[3].val[1]);
  341. output += 16;
  342. vst1q_s32(output + 0, out[4].val[0]);
  343. vst1q_s32(output + 4, out[4].val[1]);
  344. output += 16;
  345. vst1q_s32(output + 0, out[5].val[0]);
  346. vst1q_s32(output + 4, out[5].val[1]);
  347. output += 16;
  348. vst1q_s32(output + 0, out[6].val[0]);
  349. vst1q_s32(output + 4, out[6].val[1]);
  350. output += 16;
  351. vst1q_s32(output + 0, out[7].val[0]);
  352. vst1q_s32(output + 4, out[7].val[1]);
  353. output += 16;
  354. vst1q_s32(output + 0, out[8].val[0]);
  355. vst1q_s32(output + 4, out[8].val[1]);
  356. output += 16;
  357. vst1q_s32(output + 0, out[9].val[0]);
  358. vst1q_s32(output + 4, out[9].val[1]);
  359. output += 16;
  360. vst1q_s32(output + 0, out[10].val[0]);
  361. vst1q_s32(output + 4, out[10].val[1]);
  362. output += 16;
  363. vst1q_s32(output + 0, out[11].val[0]);
  364. vst1q_s32(output + 4, out[11].val[1]);
  365. output += 16;
  366. vst1q_s32(output + 0, out[12].val[0]);
  367. vst1q_s32(output + 4, out[12].val[1]);
  368. output += 16;
  369. vst1q_s32(output + 0, out[13].val[0]);
  370. vst1q_s32(output + 4, out[13].val[1]);
  371. output += 16;
  372. vst1q_s32(output + 0, out[14].val[0]);
  373. vst1q_s32(output + 4, out[14].val[1]);
  374. output += 16;
  375. vst1q_s32(output + 0, out[15].val[0]);
  376. vst1q_s32(output + 4, out[15].val[1]);
  377. }
  378. static INLINE void highbd_idct16x16_add_store(const int32x4x2_t *const out,
  379. uint16_t *dest, const int stride,
  380. const int bd) {
  381. // Add the result to dest
  382. const int16x8_t max = vdupq_n_s16((1 << bd) - 1);
  383. int16x8_t o[16];
  384. o[0] = vcombine_s16(vrshrn_n_s32(out[0].val[0], 6),
  385. vrshrn_n_s32(out[0].val[1], 6));
  386. o[1] = vcombine_s16(vrshrn_n_s32(out[1].val[0], 6),
  387. vrshrn_n_s32(out[1].val[1], 6));
  388. o[2] = vcombine_s16(vrshrn_n_s32(out[2].val[0], 6),
  389. vrshrn_n_s32(out[2].val[1], 6));
  390. o[3] = vcombine_s16(vrshrn_n_s32(out[3].val[0], 6),
  391. vrshrn_n_s32(out[3].val[1], 6));
  392. o[4] = vcombine_s16(vrshrn_n_s32(out[4].val[0], 6),
  393. vrshrn_n_s32(out[4].val[1], 6));
  394. o[5] = vcombine_s16(vrshrn_n_s32(out[5].val[0], 6),
  395. vrshrn_n_s32(out[5].val[1], 6));
  396. o[6] = vcombine_s16(vrshrn_n_s32(out[6].val[0], 6),
  397. vrshrn_n_s32(out[6].val[1], 6));
  398. o[7] = vcombine_s16(vrshrn_n_s32(out[7].val[0], 6),
  399. vrshrn_n_s32(out[7].val[1], 6));
  400. o[8] = vcombine_s16(vrshrn_n_s32(out[8].val[0], 6),
  401. vrshrn_n_s32(out[8].val[1], 6));
  402. o[9] = vcombine_s16(vrshrn_n_s32(out[9].val[0], 6),
  403. vrshrn_n_s32(out[9].val[1], 6));
  404. o[10] = vcombine_s16(vrshrn_n_s32(out[10].val[0], 6),
  405. vrshrn_n_s32(out[10].val[1], 6));
  406. o[11] = vcombine_s16(vrshrn_n_s32(out[11].val[0], 6),
  407. vrshrn_n_s32(out[11].val[1], 6));
  408. o[12] = vcombine_s16(vrshrn_n_s32(out[12].val[0], 6),
  409. vrshrn_n_s32(out[12].val[1], 6));
  410. o[13] = vcombine_s16(vrshrn_n_s32(out[13].val[0], 6),
  411. vrshrn_n_s32(out[13].val[1], 6));
  412. o[14] = vcombine_s16(vrshrn_n_s32(out[14].val[0], 6),
  413. vrshrn_n_s32(out[14].val[1], 6));
  414. o[15] = vcombine_s16(vrshrn_n_s32(out[15].val[0], 6),
  415. vrshrn_n_s32(out[15].val[1], 6));
  416. highbd_idct16x16_add8x1(o[0], max, &dest, stride);
  417. highbd_idct16x16_add8x1(o[1], max, &dest, stride);
  418. highbd_idct16x16_add8x1(o[2], max, &dest, stride);
  419. highbd_idct16x16_add8x1(o[3], max, &dest, stride);
  420. highbd_idct16x16_add8x1(o[4], max, &dest, stride);
  421. highbd_idct16x16_add8x1(o[5], max, &dest, stride);
  422. highbd_idct16x16_add8x1(o[6], max, &dest, stride);
  423. highbd_idct16x16_add8x1(o[7], max, &dest, stride);
  424. highbd_idct16x16_add8x1(o[8], max, &dest, stride);
  425. highbd_idct16x16_add8x1(o[9], max, &dest, stride);
  426. highbd_idct16x16_add8x1(o[10], max, &dest, stride);
  427. highbd_idct16x16_add8x1(o[11], max, &dest, stride);
  428. highbd_idct16x16_add8x1(o[12], max, &dest, stride);
  429. highbd_idct16x16_add8x1(o[13], max, &dest, stride);
  430. highbd_idct16x16_add8x1(o[14], max, &dest, stride);
  431. highbd_idct16x16_add8x1(o[15], max, &dest, stride);
  432. }
  433. void vpx_highbd_idct16x16_256_add_half1d(const int32_t *input, int32_t *output,
  434. uint16_t *dest, const int stride,
  435. const int bd);
  436. #endif // VPX_VPX_DSP_ARM_HIGHBD_IDCT_NEON_H_