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_dc_only_idct_add_neon|
12    ARM
13    REQUIRE8
14    PRESERVE8
15
16    AREA ||.text||, CODE, READONLY, ALIGN=2
17
18;void vp9_dc_only_idct_add_neon(int input_dc, uint8_t *pred_ptr,
19;                            uint8_t *dst_ptr, int pitch, int stride)
20;
21; r0  int input_dc
22; r1  uint8_t *pred_ptr
23; r2  uint8_t *dst_ptr
24; r3  int pitch
25; sp  int stride
26
27|vp9_dc_only_idct_add_neon| PROC
28
29    ; generate cospi_16_64 = 11585
30    mov              r12, #0x2d00
31    add              r12, #0x41
32
33    ; dct_const_round_shift(input_dc * cospi_16_64)
34    mul              r0, r0, r12               ; input_dc * cospi_16_64
35    add              r0, r0, #0x2000           ; +(1 << ((DCT_CONST_BITS) - 1))
36    asr              r0, r0, #14               ; >> DCT_CONST_BITS
37
38    ; dct_const_round_shift(out * cospi_16_64)
39    mul              r0, r0, r12               ; out * cospi_16_64
40    add              r0, r0, #0x2000           ; +(1 << ((DCT_CONST_BITS) - 1))
41    asr              r0, r0, #14               ; >> DCT_CONST_BITS
42
43    ; ROUND_POWER_OF_TWO(out, 4)
44    add              r0, r0, #8                ; + (1 <<((4) - 1))
45    asr              r0, r0, #4                ; >> 4
46
47    vdup.16         q0, r0;                   ; duplicate a1
48    ldr              r12, [sp]                 ; load stride
49
50    vld1.32         {d2[0]}, [r1], r3
51    vld1.32         {d2[1]}, [r1], r3
52    vld1.32         {d4[0]}, [r1], r3
53    vld1.32         {d4[1]}, [r1]
54
55    vaddw.u8        q1, q0, d2                ; a1 + pred_ptr[c]
56    vaddw.u8        q2, q0, d4
57
58    vqmovun.s16     d2, q1                    ; clip_pixel
59    vqmovun.s16     d4, q2
60
61    vst1.32         {d2[0]}, [r2], r12
62    vst1.32         {d2[1]}, [r2], r12
63    vst1.32         {d4[0]}, [r2], r12
64    vst1.32         {d4[1]}, [r2]
65
66    bx               lr
67    ENDP             ; |vp9_dc_only_idct_add_neon|
68
69    END
70