idct16x16_1_add_neon.c 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Copyright (c) 2014 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 <arm_neon.h>
  11. #include "./vpx_dsp_rtcd.h"
  12. #include "vpx_dsp/arm/idct_neon.h"
  13. #include "vpx_dsp/inv_txfm.h"
  14. static INLINE void idct16x16_1_add_pos_kernel(uint8_t **dest, const int stride,
  15. const uint8x16_t res) {
  16. const uint8x16_t a = vld1q_u8(*dest);
  17. const uint8x16_t b = vqaddq_u8(a, res);
  18. vst1q_u8(*dest, b);
  19. *dest += stride;
  20. }
  21. static INLINE void idct16x16_1_add_neg_kernel(uint8_t **dest, const int stride,
  22. const uint8x16_t res) {
  23. const uint8x16_t a = vld1q_u8(*dest);
  24. const uint8x16_t b = vqsubq_u8(a, res);
  25. vst1q_u8(*dest, b);
  26. *dest += stride;
  27. }
  28. void vpx_idct16x16_1_add_neon(const tran_low_t *input, uint8_t *dest,
  29. int stride) {
  30. const int16_t out0 =
  31. WRAPLOW(dct_const_round_shift((int16_t)input[0] * cospi_16_64));
  32. const int16_t out1 = WRAPLOW(dct_const_round_shift(out0 * cospi_16_64));
  33. const int16_t a1 = ROUND_POWER_OF_TWO(out1, 6);
  34. if (a1 >= 0) {
  35. const uint8x16_t dc = create_dcq(a1);
  36. idct16x16_1_add_pos_kernel(&dest, stride, dc);
  37. idct16x16_1_add_pos_kernel(&dest, stride, dc);
  38. idct16x16_1_add_pos_kernel(&dest, stride, dc);
  39. idct16x16_1_add_pos_kernel(&dest, stride, dc);
  40. idct16x16_1_add_pos_kernel(&dest, stride, dc);
  41. idct16x16_1_add_pos_kernel(&dest, stride, dc);
  42. idct16x16_1_add_pos_kernel(&dest, stride, dc);
  43. idct16x16_1_add_pos_kernel(&dest, stride, dc);
  44. idct16x16_1_add_pos_kernel(&dest, stride, dc);
  45. idct16x16_1_add_pos_kernel(&dest, stride, dc);
  46. idct16x16_1_add_pos_kernel(&dest, stride, dc);
  47. idct16x16_1_add_pos_kernel(&dest, stride, dc);
  48. idct16x16_1_add_pos_kernel(&dest, stride, dc);
  49. idct16x16_1_add_pos_kernel(&dest, stride, dc);
  50. idct16x16_1_add_pos_kernel(&dest, stride, dc);
  51. idct16x16_1_add_pos_kernel(&dest, stride, dc);
  52. } else {
  53. const uint8x16_t dc = create_dcq(-a1);
  54. idct16x16_1_add_neg_kernel(&dest, stride, dc);
  55. idct16x16_1_add_neg_kernel(&dest, stride, dc);
  56. idct16x16_1_add_neg_kernel(&dest, stride, dc);
  57. idct16x16_1_add_neg_kernel(&dest, stride, dc);
  58. idct16x16_1_add_neg_kernel(&dest, stride, dc);
  59. idct16x16_1_add_neg_kernel(&dest, stride, dc);
  60. idct16x16_1_add_neg_kernel(&dest, stride, dc);
  61. idct16x16_1_add_neg_kernel(&dest, stride, dc);
  62. idct16x16_1_add_neg_kernel(&dest, stride, dc);
  63. idct16x16_1_add_neg_kernel(&dest, stride, dc);
  64. idct16x16_1_add_neg_kernel(&dest, stride, dc);
  65. idct16x16_1_add_neg_kernel(&dest, stride, dc);
  66. idct16x16_1_add_neg_kernel(&dest, stride, dc);
  67. idct16x16_1_add_neg_kernel(&dest, stride, dc);
  68. idct16x16_1_add_neg_kernel(&dest, stride, dc);
  69. idct16x16_1_add_neg_kernel(&dest, stride, dc);
  70. }
  71. }