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 
13 #include "./vp8_rtcd.h"
14 
vp8_dc_only_idct_add_neon(int16_t input_dc,unsigned char * pred_ptr,int pred_stride,unsigned char * dst_ptr,int dst_stride)15 void vp8_dc_only_idct_add_neon(int16_t input_dc, unsigned char *pred_ptr,
16                                int pred_stride, unsigned char *dst_ptr,
17                                int dst_stride) {
18   int i;
19   uint16_t a1 = ((input_dc + 4) >> 3);
20   uint32x2_t d2u32 = vdup_n_u32(0);
21   uint8x8_t d2u8;
22   uint16x8_t q1u16;
23   uint16x8_t qAdd;
24 
25   qAdd = vdupq_n_u16(a1);
26 
27   for (i = 0; i < 2; ++i) {
28     d2u32 = vld1_lane_u32((const uint32_t *)pred_ptr, d2u32, 0);
29     pred_ptr += pred_stride;
30     d2u32 = vld1_lane_u32((const uint32_t *)pred_ptr, d2u32, 1);
31     pred_ptr += pred_stride;
32 
33     q1u16 = vaddw_u8(qAdd, vreinterpret_u8_u32(d2u32));
34     d2u8 = vqmovun_s16(vreinterpretq_s16_u16(q1u16));
35 
36     vst1_lane_u32((uint32_t *)dst_ptr, vreinterpret_u32_u8(d2u8), 0);
37     dst_ptr += dst_stride;
38     vst1_lane_u32((uint32_t *)dst_ptr, vreinterpret_u32_u8(d2u8), 1);
39     dst_ptr += dst_stride;
40   }
41 }
42