xref: /aosp_15_r20/external/libvpx/vpx_dsp/arm/idct4x4_1_add_neon.asm (revision fb1b10ab9aebc7c7068eedab379b749d7e3900be)
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  |vpx_idct4x4_1_add_neon|
12    ARM
13    REQUIRE8
14    PRESERVE8
15
16    AREA ||.text||, CODE, READONLY, ALIGN=2
17
18;void vpx_idct4x4_1_add_neon(int16_t *input, uint8_t *dest, int stride)
19;
20; r0  int16_t input
21; r1  uint8_t *dest
22; r2  int stride)
23
24|vpx_idct4x4_1_add_neon| PROC
25    ldrsh            r0, [r0]
26
27    ; cospi_16_64 = 11585
28    movw             r12, #0x2d41
29
30    ; out = dct_const_round_shift(input[0] * cospi_16_64)
31    mul              r0, r0, r12               ; input[0] * cospi_16_64
32    add              r0, r0, #0x2000           ; +(1 << ((DCT_CONST_BITS) - 1))
33    asr              r0, r0, #14               ; >> DCT_CONST_BITS
34
35    ; out = dct_const_round_shift(out * cospi_16_64)
36    mul              r0, r0, r12               ; out * cospi_16_64
37    mov              r12, r1                   ; save dest
38    add              r0, r0, #0x2000           ; +(1 << ((DCT_CONST_BITS) - 1))
39    asr              r0, r0, #14               ; >> DCT_CONST_BITS
40
41    ; a1 = ROUND_POWER_OF_TWO(out, 4)
42    add              r0, r0, #8                ; + (1 <<((4) - 1))
43    asr              r0, r0, #4                ; >> 4
44
45    vdup.s16         q0, r0                    ; duplicate a1
46
47    vld1.32          {d2[0]}, [r1], r2
48    vld1.32          {d2[1]}, [r1], r2
49    vld1.32          {d4[0]}, [r1], r2
50    vld1.32          {d4[1]}, [r1]
51
52    vaddw.u8         q8, q0, d2                ; dest[x] + a1
53    vaddw.u8         q9, q0, d4
54
55    vqmovun.s16      d6, q8                    ; clip_pixel
56    vqmovun.s16      d7, q9
57
58    vst1.32          {d6[0]}, [r12], r2
59    vst1.32          {d6[1]}, [r12], r2
60    vst1.32          {d7[0]}, [r12], r2
61    vst1.32          {d7[1]}, [r12]
62
63    bx               lr
64    ENDP             ; |vpx_idct4x4_1_add_neon|
65
66    END
67