idct32x32_1_add_neon.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 idct32x32_1_add_pos_kernel(uint8_t **dest, const int stride,
  15. const uint8x16_t res) {
  16. const uint8x16_t a0 = vld1q_u8(*dest);
  17. const uint8x16_t a1 = vld1q_u8(*dest + 16);
  18. const uint8x16_t b0 = vqaddq_u8(a0, res);
  19. const uint8x16_t b1 = vqaddq_u8(a1, res);
  20. vst1q_u8(*dest, b0);
  21. vst1q_u8(*dest + 16, b1);
  22. *dest += stride;
  23. }
  24. static INLINE void idct32x32_1_add_neg_kernel(uint8_t **dest, const int stride,
  25. const uint8x16_t res) {
  26. const uint8x16_t a0 = vld1q_u8(*dest);
  27. const uint8x16_t a1 = vld1q_u8(*dest + 16);
  28. const uint8x16_t b0 = vqsubq_u8(a0, res);
  29. const uint8x16_t b1 = vqsubq_u8(a1, res);
  30. vst1q_u8(*dest, b0);
  31. vst1q_u8(*dest + 16, b1);
  32. *dest += stride;
  33. }
  34. void vpx_idct32x32_1_add_neon(const tran_low_t *input, uint8_t *dest,
  35. int stride) {
  36. int i;
  37. const int16_t out0 =
  38. WRAPLOW(dct_const_round_shift((int16_t)input[0] * cospi_16_64));
  39. const int16_t out1 = WRAPLOW(dct_const_round_shift(out0 * cospi_16_64));
  40. const int16_t a1 = ROUND_POWER_OF_TWO(out1, 6);
  41. if (a1 >= 0) {
  42. const uint8x16_t dc = create_dcq(a1);
  43. for (i = 0; i < 32; i++) {
  44. idct32x32_1_add_pos_kernel(&dest, stride, dc);
  45. }
  46. } else {
  47. const uint8x16_t dc = create_dcq(-a1);
  48. for (i = 0; i < 32; i++) {
  49. idct32x32_1_add_neg_kernel(&dest, stride, dc);
  50. }
  51. }
  52. }