highbd_idct4x4_add_sse4.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (c) 2017 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 <smmintrin.h> // SSE4.1
  11. #include "./vpx_dsp_rtcd.h"
  12. #include "vpx_dsp/x86/highbd_inv_txfm_sse2.h"
  13. #include "vpx_dsp/x86/highbd_inv_txfm_sse4.h"
  14. #include "vpx_dsp/x86/inv_txfm_sse2.h"
  15. #include "vpx_dsp/x86/transpose_sse2.h"
  16. void vpx_highbd_idct4x4_16_add_sse4_1(const tran_low_t *input, uint16_t *dest,
  17. int stride, int bd) {
  18. __m128i io[4];
  19. io[0] = _mm_load_si128((const __m128i *)(input + 0));
  20. io[1] = _mm_load_si128((const __m128i *)(input + 4));
  21. io[2] = _mm_load_si128((const __m128i *)(input + 8));
  22. io[3] = _mm_load_si128((const __m128i *)(input + 12));
  23. if (bd == 8) {
  24. __m128i io_short[2];
  25. io_short[0] = _mm_packs_epi32(io[0], io[1]);
  26. io_short[1] = _mm_packs_epi32(io[2], io[3]);
  27. idct4_sse2(io_short);
  28. idct4_sse2(io_short);
  29. io_short[0] = _mm_add_epi16(io_short[0], _mm_set1_epi16(8));
  30. io_short[1] = _mm_add_epi16(io_short[1], _mm_set1_epi16(8));
  31. io[0] = _mm_srai_epi16(io_short[0], 4);
  32. io[1] = _mm_srai_epi16(io_short[1], 4);
  33. } else {
  34. highbd_idct4_sse4_1(io);
  35. highbd_idct4_sse4_1(io);
  36. io[0] = wraplow_16bit_shift4(io[0], io[1], _mm_set1_epi32(8));
  37. io[1] = wraplow_16bit_shift4(io[2], io[3], _mm_set1_epi32(8));
  38. }
  39. recon_and_store_4x4(io, dest, stride, bd);
  40. }