Upstream version 5.34.98.0
[platform/framework/web/crosswalk.git] / src / third_party / libvpx / source / libvpx / vp9 / common / arm / neon / vp9_idct4x4_1_add_neon.asm
1 ;
2 ;  Copyright (c) 2013 The WebM project authors. All Rights Reserved.
3 ;
4 ;  Use of this source code is governed by a BSD-style license and patent
5 ;  grant that can be found in the LICENSE file in the root of the source
6 ;  tree. All contributing project authors may be found in the AUTHORS
7 ;  file in the root of the source tree.
8 ;
9
10
11     EXPORT  |vp9_idct4x4_1_add_neon|
12     ARM
13     REQUIRE8
14     PRESERVE8
15
16     AREA ||.text||, CODE, READONLY, ALIGN=2
17
18 ;void vp9_idct4x4_1_add_neon(int16_t *input, uint8_t *dest,
19 ;                                  int dest_stride)
20 ;
21 ; r0  int16_t input
22 ; r1  uint8_t *dest
23 ; r2  int dest_stride)
24
25 |vp9_idct4x4_1_add_neon| PROC
26     ldrsh            r0, [r0]
27
28     ; generate cospi_16_64 = 11585
29     mov              r12, #0x2d00
30     add              r12, #0x41
31
32     ; out = dct_const_round_shift(input[0] * cospi_16_64)
33     mul              r0, r0, r12               ; input[0] * cospi_16_64
34     add              r0, r0, #0x2000           ; +(1 << ((DCT_CONST_BITS) - 1))
35     asr              r0, r0, #14               ; >> DCT_CONST_BITS
36
37     ; out = dct_const_round_shift(out * cospi_16_64)
38     mul              r0, r0, r12               ; out * cospi_16_64
39     mov              r12, r1                   ; save dest
40     add              r0, r0, #0x2000           ; +(1 << ((DCT_CONST_BITS) - 1))
41     asr              r0, r0, #14               ; >> DCT_CONST_BITS
42
43     ; a1 = ROUND_POWER_OF_TWO(out, 4)
44     add              r0, r0, #8                ; + (1 <<((4) - 1))
45     asr              r0, r0, #4                ; >> 4
46
47     vdup.s16         q0, r0                    ; duplicate a1
48
49     vld1.32          {d2[0]}, [r1], r2
50     vld1.32          {d2[1]}, [r1], r2
51     vld1.32          {d4[0]}, [r1], r2
52     vld1.32          {d4[1]}, [r1]
53
54     vaddw.u8         q8, q0, d2                ; dest[x] + a1
55     vaddw.u8         q9, q0, d4
56
57     vqmovun.s16      d6, q8                    ; clip_pixel
58     vqmovun.s16      d7, q9
59
60     vst1.32          {d6[0]}, [r12], r2
61     vst1.32          {d6[1]}, [r12], r2
62     vst1.32          {d7[0]}, [r12], r2
63     vst1.32          {d7[1]}, [r12]
64
65     bx               lr
66     ENDP             ; |vp9_idct4x4_1_add_neon|
67
68     END