idct4x4_add_neon.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 <assert.h>
  12. #include "./vpx_dsp_rtcd.h"
  13. #include "vpx_dsp/arm/idct_neon.h"
  14. #include "vpx_dsp/arm/mem_neon.h"
  15. #include "vpx_dsp/txfm_common.h"
  16. void vpx_idct4x4_16_add_neon(const tran_low_t *input, uint8_t *dest,
  17. int stride) {
  18. const uint8_t *dst = dest;
  19. uint32x2_t s32 = vdup_n_u32(0);
  20. int16x8_t a[2];
  21. uint8x8_t s, d[2];
  22. uint16x8_t sum[2];
  23. assert(!((intptr_t)dest % sizeof(uint32_t)));
  24. assert(!(stride % sizeof(uint32_t)));
  25. // Rows
  26. a[0] = load_tran_low_to_s16q(input);
  27. a[1] = load_tran_low_to_s16q(input + 8);
  28. transpose_idct4x4_16_bd8(a);
  29. // Columns
  30. a[1] = vcombine_s16(vget_high_s16(a[1]), vget_low_s16(a[1]));
  31. transpose_idct4x4_16_bd8(a);
  32. a[0] = vrshrq_n_s16(a[0], 4);
  33. a[1] = vrshrq_n_s16(a[1], 4);
  34. s = load_u8(dst, stride);
  35. dst += 2 * stride;
  36. // The elements are loaded in reverse order.
  37. s32 = vld1_lane_u32((const uint32_t *)dst, s32, 1);
  38. dst += stride;
  39. s32 = vld1_lane_u32((const uint32_t *)dst, s32, 0);
  40. sum[0] = vaddw_u8(vreinterpretq_u16_s16(a[0]), s);
  41. sum[1] = vaddw_u8(vreinterpretq_u16_s16(a[1]), vreinterpret_u8_u32(s32));
  42. d[0] = vqmovun_s16(vreinterpretq_s16_u16(sum[0]));
  43. d[1] = vqmovun_s16(vreinterpretq_s16_u16(sum[1]));
  44. store_u8(dest, stride, d[0]);
  45. dest += 2 * stride;
  46. // The elements are stored in reverse order.
  47. vst1_lane_u32((uint32_t *)dest, vreinterpret_u32_u8(d[1]), 1);
  48. dest += stride;
  49. vst1_lane_u32((uint32_t *)dest, vreinterpret_u32_u8(d[1]), 0);
  50. }