summaryrefslogtreecommitdiffstats
path: root/common/arm64/ihevc_intra_pred_chroma_horz.s
blob: 8de655c721176e6a63d1e59fe4557aa398e702fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
///*****************************************************************************
//*
//* Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore
//*
//* Licensed under the Apache License, Version 2.0 (the "License");
//* you may not use this file except in compliance with the License.
//* You may obtain a copy of the License at:
//*
//* http://www.apache.org/licenses/LICENSE-2.0
//*
//* Unless required by applicable law or agreed to in writing, software
//* distributed under the License is distributed on an "AS IS" BASIS,
//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//* See the License for the specific language governing permissions and
//* limitations under the License.
//*
//*****************************************************************************/
///**
//*******************************************************************************
//* @file
//*  ihevc_intra_pred_chroma_horz_neon.s
//*
//* @brief
//*  contains function definition for intra prediction  interpolation filters
//*
//*
//* @author
//*  parthiban v
//*
//* @par list of functions:
//*  - ihevc_intra_pred_luma_horz()
//*
//* @remarks
//*  none
//*
//*******************************************************************************
//*/
//
///**
//*******************************************************************************
//*
//* @brief
//*     intra prediction interpolation filter for horizontal luma variable.
//*
//* @par description:
//*      horizontal intraprediction(mode 10) with.extern  samples location
//*      pointed by 'pu1_ref' to the tu block  location pointed by 'pu1_dst'  refer
//*      to section 8.4.4.2.6 in the standard (special case)
//*
//* @param[in] pu1_src
//*  uword8 pointer to the source
//*
//* @param[out] pu1_dst
//*  uword8 pointer to the destination
//*
//* @param[in] src_strd
//*  integer source stride
//*
//* @param[in] dst_strd
//*  integer destination stride
//*
//* @param[in] nt
//*  integer transform block size
//*
//* @param[in] mode
//*  integer intraprediction mode
//*
//* @returns
//*
//* @remarks
//*  none
//*
//*******************************************************************************
//*/
//void ihevc_intra_pred_chroma_horz(uword8 *pu1_ref,
//                                  word32 src_strd,
//                                  uword8 *pu1_dst,
//                                  word32 dst_strd,
//                                  word32 nt,
//                                  word32 mode)
//**************variables vs registers*****************************************
//x0 => *pu1_ref
//x1 =>  src_strd
//x2 => *pu1_dst
//x3 =>  dst_strd

.text
.align 4
.include "ihevc_neon_macros.s"


.globl ihevc_intra_pred_chroma_horz_av8

.type ihevc_intra_pred_chroma_horz_av8, %function

ihevc_intra_pred_chroma_horz_av8:

    // stmfd sp!, {x4-x12, x14}                //stack stores the values of the arguments

    stp         x19, x20,[sp,#-16]!

    lsl         x6,x4,#2                    //four_nt

    add         x12,x0,x6                   //*pu1_ref[four_nt]
    cmp         x4,#4                       //if nt == 4
    beq         core_loop_4

    cmp         x4,#8                       //if nt == 8
    beq         core_loop_8

    //cmp            x4,#16                            @if nt == 16
    //beq            core_loop_16

    sub         x12,x12,#16                 //move to 16th value pointer
    add         x9,x2,#16

core_loop_16:
    ld1         { v0.8h},[x12]              //load 16 values. d1[7] will have the 1st value.
    sub         x12,x12,#16
    ld1         { v18.8h},[x12]             //load 16 values. d1[7] will have the 1st value.

    dup         v2.8h, v0.4h[7]             //duplicate the i value.

    dup         v4.8h, v0.4h[6]             //duplicate the ii value.
    dup         v6.8h, v0.4h[5]             //duplicate the iii value.
    st1         { v2.8h},[x2],x3            //store in 1st row 0-16 columns
    st1         { v2.8h},[x9],x3            //store in 1st row 16-32 columns

    dup         v1.8h, v0.4h[4]
    st1         { v4.8h},[x2],x3
    st1         { v4.8h},[x9],x3

    dup         v2.8h, v0.4h[3]
    st1         { v6.8h},[x2],x3
    st1         { v6.8h},[x9],x3

    dup         v4.8h, v0.4h[2]
    st1         { v1.8h},[x2],x3
    st1         { v1.8h},[x9],x3

    dup         v6.8h, v0.4h[1]
    st1         { v2.8h},[x2],x3
    st1         { v2.8h},[x9],x3

    dup         v1.8h, v0.4h[0]
    st1         { v4.8h},[x2],x3
    st1         { v4.8h},[x9],x3

    dup         v2.8h, v18.4h[7]
    st1         { v6.8h},[x2],x3
    st1         { v6.8h},[x9],x3

    dup         v4.8h, v18.4h[6]
    st1         { v1.8h},[x2],x3
    st1         { v1.8h},[x9],x3

    dup         v6.8h, v18.4h[5]
    st1         { v2.8h},[x2],x3
    st1         { v2.8h},[x9],x3

    dup         v1.8h, v18.4h[4]
    st1         { v4.8h},[x2],x3
    st1         { v4.8h},[x9],x3

    dup         v2.8h, v18.4h[3]
    st1         { v6.8h},[x2],x3
    st1         { v6.8h},[x9],x3

    dup         v4.8h, v18.4h[2]
    st1         { v1.8h},[x2],x3
    st1         { v1.8h},[x9],x3

    dup         v6.8h, v18.4h[1]
    st1         { v2.8h},[x2],x3
    st1         { v2.8h},[x9],x3
    sub         x12,x12,#16                 //move to 16th value pointer

    dup         v1.8h, v18.4h[0]
    st1         { v4.8h},[x2],x3
    st1         { v4.8h},[x9],x3

    subs        x4,x4,#16                   //decrement the loop count by 16
    st1         { v6.8h},[x2],x3
    st1         { v6.8h},[x9],x3

    st1         { v1.8h},[x2],x3
    st1         { v1.8h},[x9],x3
    bgt         core_loop_16
    // ldmfd sp!,{x4-x12,x15}                  //reload the registers from sp
    ldp         x19, x20,[sp],#16

    ret
    b           endloop

core_loop_8:
    ldrb        w14,[x12],#1                //pu1_ref[two_nt]
    sxtw        x14,w14
    //vld1.8        {q15},[x12]                        @pu1_ref[two_nt + 1 + col]

    dup         v28.8b,w14
    sub         x12,x12,#17
    ld1         { v0.16b},[x12]

    sub         x12,x12,#16
//    ld1 { v30.16b},[x12]
    dup         v18.8h, v0.4h[7]
    //vmovl.u8    q13,d26

    dup         v2.8h, v0.4h[6]
    //vsubl.u8    q12,d30,d28

    dup         v4.8h, v0.4h[5]
    //vshr.s16    q12,q12,#1

    dup         v6.8h, v0.4h[4]
    //vqadd.s16    q11,q13,q12

    dup         v1.8h, v0.4h[3]
    //vqmovun.s16 d22,q11

    st1         { v18.8h},[x2],x3

    dup         v18.8h, v0.4h[2]
    //vsubl.u8    q12,d31,d28

    dup         v19.8h, v0.4h[1]
    //vshr.s16    q12,q12,#1

    dup         v20.8h, v0.4h[0]
    //vqadd.s16    q11,q13,q12

    dup         v16.8h, v0.4h[3]
    //vqmovun.s16 d22,q11

    st1         { v2.8h},[x2],x3
    //sub            x2,x2,#8

    st1         { v4.8h},[x2],x3

    st1         { v6.8h},[x2],x3
    st1         { v1.8h},[x2],x3
    st1         { v18.8h},[x2],x3

    //vdup.8        q1,d0[2]
    st1         { v19.8h},[x2],x3

    //vdup.8        q2,d0[1]
    st1         { v20.8h},[x2],x3

    //vdup.8        q3,d0[0]
    //vst1.8        {q7},[x2],x3

    //vdup.8        q4,d0[3]
    //vst1.8        {q8},[x2],x3

    //vdup.8        q5,d0[2]
    //vst1.8        {q1},[x2],x3

    //vdup.8        q6,d0[1]
    //vst1.8        {q2},[x2],x3

    //vdup.8        q7,d0[0]
    //vst1.8        {q3},[x2],x3

    //vst1.8        {q4},[x2],x3
    //vst1.8        {q5},[x2],x3
    //vst1.8        {q6},[x2],x3
    //vst1.8        {q7},[x2],x3

    // ldmfd sp!,{x4-x12,x15}                  //reload the registers from sp
    ldp         x19, x20,[sp],#16

    ret
    b           endloop


core_loop_4:
    ldrb        w14,[x12]                   //pu1_ref[two_nt]
    sxtw        x14,w14
    add         x12,x12,#1                  //pu1_ref[two_nt + 1]
    //vld1.8        {d30},[x12]                        @pu1_ref[two_nt + 1 + col]

    sub         x12,x12,#9
    ld1         {v0.8b},[x12]
    sub         x12,x12,#8
    ld1         {v30.8b},[x12]
    dup         v26.4h, v0.4h[3]
    dup         v28.8b,w14

    dup         v3.4h, v0.4h[2]
    uxtl        v26.8h, v26.8b

    dup         v4.4h, v0.4h[1]
    usubl       v24.8h, v30.8b, v28.8b

    dup         v5.4h, v0.4h[0]
    sshr        v24.8h, v24.8h,#1

    dup         v6.4h, v0.4h[3]
    sqadd       v22.8h,  v26.8h ,  v24.8h

    dup         v7.4h, v0.4h[2]
    sqxtun      v22.8b, v22.8h

    st1         {v6.8b},[x2],x3
    st1         {v3.8b},[x2],x3

    dup         v1.4h, v0.4h[1]
    st1         {v4.8b},[x2],x3
    st1         {v5.8b},[x2],x3

    dup         v17.4h, v0.4h[0]
    //vst1.8        {d6},[x2],x3
    //vst1.8        {d7},[x2],x3

    //vst1.8        {d8},[x2],x3
    //vst1.8        {d9},[x2],x3
    // ldmfd sp!,{x4-x12,x15}                  //reload the registers from sp
    ldp         x19, x20,[sp],#16

    ret
    b           endloop


//core_loop_4
    ldrb        w14,[x12]                   //pu1_ref[two_nt]
    sxtw        x14,w14
    add         x12,x12,#1                  //pu1_ref[two_nt + 1]
    ld1         {v30.8b},[x12]              //pu1_ref[two_nt + 1 + col]

    sub         x12,x12,#5
    ld1         {v0.8b},[x12]
    dup         v28.8b,w14
    dup         v26.8b, v0.8b[3]
    uxtl        v26.8h, v26.8b

    dup         v3.8b, v0.8b[2]
    usubl       v24.8h, v30.8b, v28.8b

    dup         v4.8b, v0.8b[1]
    sshr        v24.8h, v24.8h,#1

    dup         v5.8b, v0.8b[0]
    sqadd       v22.8h,  v26.8h ,  v24.8h

    sqxtun      v22.8b, v22.8h

    st1         {v22.s}[0],[x2],x3
    st1         {v3.s}[0],[x2],x3
    st1         {v4.s}[0],[x2],x3
    st1         {v5.s}[0],[x2],x3

    // ldmfd sp!,{x4-x12,x15}                  //reload the registers from sp
    ldp         x19, x20,[sp],#16

    ret

endloop: