idct8x8_1_add_neon.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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/inv_txfm.h"
  12. #include "vpx_ports/mem.h"
  13. void vpx_idct8x8_1_add_neon(
  14. int16_t *input,
  15. uint8_t *dest,
  16. int dest_stride) {
  17. uint8x8_t d2u8, d3u8, d30u8, d31u8;
  18. uint64x1_t d2u64, d3u64, d4u64, d5u64;
  19. uint16x8_t q0u16, q9u16, q10u16, q11u16, q12u16;
  20. int16x8_t q0s16;
  21. uint8_t *d1, *d2;
  22. int16_t i, a1, cospi_16_64 = 11585;
  23. int16_t out = dct_const_round_shift(input[0] * cospi_16_64);
  24. out = dct_const_round_shift(out * cospi_16_64);
  25. a1 = ROUND_POWER_OF_TWO(out, 5);
  26. q0s16 = vdupq_n_s16(a1);
  27. q0u16 = vreinterpretq_u16_s16(q0s16);
  28. d1 = d2 = dest;
  29. for (i = 0; i < 2; i++) {
  30. d2u64 = vld1_u64((const uint64_t *)d1);
  31. d1 += dest_stride;
  32. d3u64 = vld1_u64((const uint64_t *)d1);
  33. d1 += dest_stride;
  34. d4u64 = vld1_u64((const uint64_t *)d1);
  35. d1 += dest_stride;
  36. d5u64 = vld1_u64((const uint64_t *)d1);
  37. d1 += dest_stride;
  38. q9u16 = vaddw_u8(q0u16, vreinterpret_u8_u64(d2u64));
  39. q10u16 = vaddw_u8(q0u16, vreinterpret_u8_u64(d3u64));
  40. q11u16 = vaddw_u8(q0u16, vreinterpret_u8_u64(d4u64));
  41. q12u16 = vaddw_u8(q0u16, vreinterpret_u8_u64(d5u64));
  42. d2u8 = vqmovun_s16(vreinterpretq_s16_u16(q9u16));
  43. d3u8 = vqmovun_s16(vreinterpretq_s16_u16(q10u16));
  44. d30u8 = vqmovun_s16(vreinterpretq_s16_u16(q11u16));
  45. d31u8 = vqmovun_s16(vreinterpretq_s16_u16(q12u16));
  46. vst1_u64((uint64_t *)d2, vreinterpret_u64_u8(d2u8));
  47. d2 += dest_stride;
  48. vst1_u64((uint64_t *)d2, vreinterpret_u64_u8(d3u8));
  49. d2 += dest_stride;
  50. vst1_u64((uint64_t *)d2, vreinterpret_u64_u8(d30u8));
  51. d2 += dest_stride;
  52. vst1_u64((uint64_t *)d2, vreinterpret_u64_u8(d31u8));
  53. d2 += dest_stride;
  54. }
  55. return;
  56. }