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