idct4x4_1_add_neon.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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/mem_neon.h"
  14. #include "vpx_dsp/inv_txfm.h"
  15. static INLINE void idct4x4_1_add_kernel(uint8_t **dest, const int stride,
  16. const int16x8_t res,
  17. uint32x2_t *const d) {
  18. uint16x8_t a;
  19. uint8x8_t b;
  20. *d = vld1_lane_u32((const uint32_t *)*dest, *d, 0);
  21. *d = vld1_lane_u32((const uint32_t *)(*dest + stride), *d, 1);
  22. a = vaddw_u8(vreinterpretq_u16_s16(res), vreinterpret_u8_u32(*d));
  23. b = vqmovun_s16(vreinterpretq_s16_u16(a));
  24. vst1_lane_u32((uint32_t *)*dest, vreinterpret_u32_u8(b), 0);
  25. *dest += stride;
  26. vst1_lane_u32((uint32_t *)*dest, vreinterpret_u32_u8(b), 1);
  27. *dest += stride;
  28. }
  29. void vpx_idct4x4_1_add_neon(const tran_low_t *input, uint8_t *dest,
  30. int stride) {
  31. const int16_t out0 =
  32. WRAPLOW(dct_const_round_shift((int16_t)input[0] * cospi_16_64));
  33. const int16_t out1 = WRAPLOW(dct_const_round_shift(out0 * cospi_16_64));
  34. const int16_t a1 = ROUND_POWER_OF_TWO(out1, 4);
  35. const int16x8_t dc = vdupq_n_s16(a1);
  36. uint32x2_t d = vdup_n_u32(0);
  37. assert(!((intptr_t)dest % sizeof(uint32_t)));
  38. assert(!(stride % sizeof(uint32_t)));
  39. idct4x4_1_add_kernel(&dest, stride, dc, &d);
  40. idct4x4_1_add_kernel(&dest, stride, dc, &d);
  41. }