• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
11 #include <arm_neon.h>
12 #include <assert.h>
13 
14 #include "./vpx_dsp_rtcd.h"
15 #include "vpx_dsp/arm/idct_neon.h"
16 #include "vpx_dsp/arm/mem_neon.h"
17 #include "vpx_dsp/txfm_common.h"
18 
vpx_idct4x4_16_add_neon(const tran_low_t * input,uint8_t * dest,int stride)19 void vpx_idct4x4_16_add_neon(const tran_low_t *input, uint8_t *dest,
20                              int stride) {
21   const uint8_t *dst = dest;
22   const int16x4_t cospis = vld1_s16(kCospi);
23   uint8x8_t dest01_u8;
24   uint32x2_t dest32_u32 = vdup_n_u32(0);
25   int16x8_t a0, a1;
26   uint8x8_t d01, d32;
27   uint16x8_t d01_u16, d32_u16;
28 
29   assert(!((intptr_t)dest % sizeof(uint32_t)));
30   assert(!(stride % sizeof(uint32_t)));
31 
32   // Rows
33   a0 = load_tran_low_to_s16q(input);
34   a1 = load_tran_low_to_s16q(input + 8);
35   idct4x4_16_kernel_bd8(cospis, &a0, &a1);
36 
37   // Columns
38   a1 = vcombine_s16(vget_high_s16(a1), vget_low_s16(a1));
39   idct4x4_16_kernel_bd8(cospis, &a0, &a1);
40   a0 = vrshrq_n_s16(a0, 4);
41   a1 = vrshrq_n_s16(a1, 4);
42 
43   dest01_u8 = load_u8(dst, stride);
44   dst += 2 * stride;
45   // The elements are loaded in reverse order.
46   dest32_u32 = vld1_lane_u32((const uint32_t *)dst, dest32_u32, 1);
47   dst += stride;
48   dest32_u32 = vld1_lane_u32((const uint32_t *)dst, dest32_u32, 0);
49 
50   d01_u16 = vaddw_u8(vreinterpretq_u16_s16(a0), dest01_u8);
51   d32_u16 =
52       vaddw_u8(vreinterpretq_u16_s16(a1), vreinterpret_u8_u32(dest32_u32));
53   d01 = vqmovun_s16(vreinterpretq_s16_u16(d01_u16));
54   d32 = vqmovun_s16(vreinterpretq_s16_u16(d32_u16));
55 
56   store_u8(dest, stride, d01);
57   dest += 2 * stride;
58   // The elements are stored in reverse order.
59   vst1_lane_u32((uint32_t *)dest, vreinterpret_u32_u8(d32), 1);
60   dest += stride;
61   vst1_lane_u32((uint32_t *)dest, vreinterpret_u32_u8(d32), 0);
62 }
63