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
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
|
///*****************************************************************************
//*
//* 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_inter_pred_filters_luma_vert_w16inp.s
//*
//* //brief
//* contains function definitions for inter prediction interpolation.
//* functions are coded using neon intrinsics and can be compiled using
//* rvct
//*
//* //author
//* yogeswaran rs
//*
//* //par list of functions:
//*
//* - ihevc_inter_pred_luma_vert()
//*
//* //remarks
//* none
//*
//*******************************************************************************
//*/
///* all the functions here are replicated from ihevc_inter_pred_filters.c and modified to */
///* include reconstruction */
//
///**
//*******************************************************************************
//*
//* //brief
//* luma vertical filter for 16bit input.
//*
//* //par description:
//* applies a vertical filter with coefficients pointed to by 'pi1_coeff' to
//* the elements pointed by 'pu1_src' and writes to the location pointed by
//* 'pu1_dst' input is 16 bits the filter output is downshifted by 12 and
//* clipped to lie between 0 and 255 assumptions : the function is
//* optimized considering the fact width is multiple of 4. and height as
//* multiple of 2.
//*
//* //param[in] pi2_src
//* word16 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] pi1_coeff
//* word8 pointer to the filter coefficients
//*
//* //param[in] ht
//* integer height of the array
//*
//* //param[in] wd
//* integer width of the array
//*
//* //returns
//*
//* //remarks
//* none
//*
//*******************************************************************************
//*/
//void ihevc_inter_pred_luma_vert_w16inp(word16 *pi2_src,
// uword8 *pu1_dst,
// word32 src_strd,
// word32 dst_strd,
// word8 *pi1_coeff,
// word32 ht,
// word32 wd )
//**************variables vs registers*****************************************
// r0 => *pu2_src
// r1 => *pu1_dst
// r2 => src_strd
// r3 => dst_strd
// r4 => *pi1_coeff
// r5 => ht
// r6 => wd
.text
.align 4
.include "ihevc_neon_macros.s"
.globl ihevc_inter_pred_luma_vert_w16inp_w16out_av8
.type ihevc_inter_pred_luma_vert_w16inp_w16out_av8, %function
ihevc_inter_pred_luma_vert_w16inp_w16out_av8:
//stmfd sp!, {r4-r12, r14} //stack stores the values of the arguments
push_v_regs
stp x19,x20,[sp, #-16]!
mov x15,x4 // pi1_coeff
mov x16,x5 // ht
mov x17,x6 // wd
mov x12,x15 //load pi1_coeff
lsl x6,x3,#1
mov x5,x17 //load wd
ld1 {v0.8b},[x12] //coeff = ld1_s8(pi1_coeff)
lsl x2, x2,#1
sub x12,x2,x2,lsl #2 //src_ctrd & pi1_coeff
//vabs.s8 d0,d0 //vabs_s8(coeff)
add x0,x0,x12 //r0->pu1_src r12->pi1_coeff
mov x3,x16 //load ht
subs x7,x3,#0 //r3->ht
//ble end_loops //end loop jump
sxtl v0.8h,v0.8b
dup v22.4h,v0.h[0] //coeffabs_0 = vdup_lane_u8(coeffabs, 0)//
dup v23.4h,v0.h[1] //coeffabs_1 = vdup_lane_u8(coeffabs, 1)//
dup v24.4h,v0.h[2] //coeffabs_2 = vdup_lane_u8(coeffabs, 2)//
dup v25.4h,v0.h[3] //coeffabs_3 = vdup_lane_u8(coeffabs, 3)//
dup v26.4h,v0.h[4] //coeffabs_4 = vdup_lane_u8(coeffabs, 4)//
dup v27.4h,v0.h[5] //coeffabs_5 = vdup_lane_u8(coeffabs, 5)//
dup v28.4h,v0.h[6] //coeffabs_6 = vdup_lane_u8(coeffabs, 6)//
dup v29.4h,v0.h[7] //coeffabs_7 = vdup_lane_u8(coeffabs, 7)//
movi v30.4s,#8, lsl #16
sub x9,x5,x6,lsl #2 //r6->dst_strd r5 ->wd
neg x9,x9
sub x8,x5,x2,lsl #2 //r2->src_strd
neg x8,x8
sub x8,x8,x5
sub x9,x9,x5
lsr x3, x5, #2 //divide by 4
mul x7, x7, x3 //multiply height by width
sub x7, x7, #4 //subtract by one for epilog
mov x4,x5 //r5 ->wd
//mov r2, r2, lsl #1
prolog:
add x3,x0,x2 //pu1_src_tmp += src_strd//
ld1 {v1.4h},[x3],x2 //src_tmp2 = ld1_u8(pu1_src_tmp)//
ld1 {v0.4h},[x0], #8 //src_tmp1 = ld1_u8(pu1_src_tmp)//
subs x4,x4,#4
ld1 {v2.4h},[x3],x2 //src_tmp3 = ld1_u8(pu1_src_tmp)//
smull v8.4s,v1.4h,v23.4h //mul_res1 = smull_u8(src_tmp2, coeffabs_1)//
ld1 {v3.4h},[x3],x2 //src_tmp4 = ld1_u8(pu1_src_tmp)//
smlal v8.4s,v0.4h,v22.4h //mul_res1 = smlal_u8(mul_res1, src_tmp1, coeffabs_0)//
ld1 {v4.4h},[x3],x2 //src_tmp1 = ld1_u8(pu1_src_tmp)//
smlal v8.4s,v2.4h,v24.4h //mul_res1 = smlal_u8(mul_res1, src_tmp3, coeffabs_2)//
ld1 {v5.4h},[x3],x2 //src_tmp2 = ld1_u8(pu1_src_tmp)//
smlal v8.4s,v3.4h,v25.4h //mul_res1 = smlal_u8(mul_res1, src_tmp4, coeffabs_3)//
ld1 {v6.4h},[x3],x2 //src_tmp3 = ld1_u8(pu1_src_tmp)//
smlal v8.4s,v4.4h,v26.4h //mul_res1 = smlal_u8(mul_res1, src_tmp1, coeffabs_4)//
ld1 {v7.4h},[x3],x2 //src_tmp4 = ld1_u8(pu1_src_tmp)//
smlal v8.4s,v5.4h,v27.4h //mul_res1 = smlal_u8(mul_res1, src_tmp2, coeffabs_5)//
smlal v8.4s,v6.4h,v28.4h //mul_res1 = smlal_u8(mul_res1, src_tmp3, coeffabs_6)//
smlal v8.4s,v7.4h,v29.4h //mul_res1 = smlal_u8(mul_res1, src_tmp4, coeffabs_7)//
ld1 {v16.4h},[x3],x2 //src_tmp1 = ld1_u8(pu1_src_tmp)//
smull v10.4s,v2.4h,v23.4h //mul_res2 = smull_u8(src_tmp3, coeffabs_1)//
add x20,x0,x8,lsl #0
csel x0,x20,x0,le
smlal v10.4s,v1.4h,v22.4h //mul_res2 = smlal_u8(mul_res2, src_tmp2, coeffabs_0)//
csel x4,x5,x4,le
smlal v10.4s,v3.4h,v24.4h //mul_res2 = smlal_u8(mul_res2, src_tmp4, coeffabs_2)//
ld1 {v17.4h},[x3],x2 //src_tmp2 = ld1_u8(pu1_src_tmp)//
smlal v10.4s,v4.4h,v25.4h //mul_res2 = smlal_u8(mul_res2, src_tmp1, coeffabs_3)//
ld1 {v18.4h},[x3],x2 //src_tmp3 = ld1_u8(pu1_src_tmp)//
smlal v10.4s,v5.4h,v26.4h //mul_res2 = smlal_u8(mul_res2, src_tmp2, coeffabs_4)//
add x3,x0,x2 //pu1_src_tmp += src_strd//
smlal v10.4s,v6.4h,v27.4h //mul_res2 = smlal_u8(mul_res2, src_tmp3, coeffabs_5)//
smlal v10.4s,v7.4h,v28.4h //mul_res2 = smlal_u8(mul_res2, src_tmp4, coeffabs_6)//
smlal v10.4s,v16.4h,v29.4h //mul_res2 = smlal_u8(mul_res2, src_tmp1, coeffabs_7)//
sub v8.4s, v8.4s, v30.4s
ld1 {v1.4h},[x3],x2 //src_tmp3 = ld1_u8(pu1_src_tmp)//
smull v12.4s,v3.4h,v23.4h
ld1 {v0.4h},[x0],#8 //src_tmp1 = ld1_u8(pu1_src_tmp)//
smlal v12.4s,v2.4h,v22.4h
ld1 {v2.4h},[x3],x2 //src_tmp3 = ld1_u8(pu1_src_tmp)//
smlal v12.4s,v4.4h,v24.4h
smlal v12.4s,v5.4h,v25.4h
smlal v12.4s,v6.4h,v26.4h
smlal v12.4s,v7.4h,v27.4h
smlal v12.4s,v16.4h,v28.4h
smlal v12.4s,v17.4h,v29.4h
add x14,x1,x6
sub v10.4s, v10.4s, v30.4s
shrn v8.4h, v8.4s, #6
//vqrshrun d8,q4,#6 //sto_res = vqmovun_s16(sto_res_tmp)//
smull v14.4s,v4.4h,v23.4h
smlal v14.4s,v3.4h,v22.4h
smlal v14.4s,v5.4h,v24.4h
smlal v14.4s,v6.4h,v25.4h
ld1 {v3.4h},[x3],x2 //src_tmp4 = ld1_u8(pu1_src_tmp)//
smlal v14.4s,v7.4h,v26.4h
ld1 {v4.4h},[x3],x2 //src_tmp1 = ld1_u8(pu1_src_tmp)//
smlal v14.4s,v16.4h,v27.4h
ld1 {v5.4h},[x3],x2 //src_tmp2 = ld1_u8(pu1_src_tmp)//
smlal v14.4s,v17.4h,v28.4h
ld1 {v6.4h},[x3],x2 //src_tmp3 = ld1_u8(pu1_src_tmp)//
smlal v14.4s,v18.4h,v29.4h
ld1 {v7.4h},[x3],x2 //src_tmp4 = ld1_u8(pu1_src_tmp)//
st1 {v8.2s},[x1],#8 //st1_u8(pu1_dst,sto_res)//
sub v12.4s, v12.4s, v30.4s
shrn v10.4h, v10.4s, #6
//vqrshrun d10,q5,#6 //sto_res = vqmovun_s16(sto_res_tmp)//
add x20, x1, x9
csel x1, x20, x1, le
subs x7,x7,#4
blt epilog_end //jumps to epilog_end
beq epilog //jumps to epilog
kernel_8:
smull v8.4s,v1.4h,v23.4h //mul_res1 = smull_u8(src_tmp2, coeffabs_1)//
subs x4,x4,#4
smlal v8.4s,v0.4h,v22.4h //mul_res1 = smlal_u8(mul_res1, src_tmp1, coeffabs_0)//
add x20,x0,x8,lsl #0
csel x0,x20,x0,le
smlal v8.4s,v2.4h,v24.4h //mul_res1 = smlal_u8(mul_res1, src_tmp3, coeffabs_2)//
smlal v8.4s,v3.4h,v25.4h //mul_res1 = smlal_u8(mul_res1, src_tmp4, coeffabs_3)//
smlal v8.4s,v4.4h,v26.4h //mul_res1 = smlal_u8(mul_res1, src_tmp1, coeffabs_4)//
smlal v8.4s,v5.4h,v27.4h //mul_res1 = smlal_u8(mul_res1, src_tmp2, coeffabs_5)//
smlal v8.4s,v6.4h,v28.4h //mul_res1 = smlal_u8(mul_res1, src_tmp3, coeffabs_6)//
smlal v8.4s,v7.4h,v29.4h //mul_res1 = smlal_u8(mul_res1, src_tmp4, coeffabs_7)//
st1 {v10.2s},[x14],x6 //st1_u8(pu1_dst_tmp,sto_res)//
sub v14.4S, v14.4s, v30.4s
shrn v12.4h, v12.4s, #6
//vqrshrun d12,q6,#6
ld1 {v16.4h},[x3],x2 //src_tmp1 = ld1_u8(pu1_src_tmp)//
smull v10.4s,v2.4h,v23.4h //mul_res2 = smull_u8(src_tmp3, coeffabs_1)//
smlal v10.4s,v1.4h,v22.4h //mul_res2 = smlal_u8(mul_res2, src_tmp2, coeffabs_0)//
smlal v10.4s,v3.4h,v24.4h //mul_res2 = smlal_u8(mul_res2, src_tmp4, coeffabs_2)//
smlal v10.4s,v4.4h,v25.4h //mul_res2 = smlal_u8(mul_res2, src_tmp1, coeffabs_3)//
smlal v10.4s,v5.4h,v26.4h //mul_res2 = smlal_u8(mul_res2, src_tmp2, coeffabs_4)//
smlal v10.4s,v6.4h,v27.4h //mul_res2 = smlal_u8(mul_res2, src_tmp3, coeffabs_5)//
st1 {v12.2s},[x14],x6
smlal v10.4s,v7.4h,v28.4h //mul_res2 = smlal_u8(mul_res2, src_tmp4, coeffabs_6)//
ld1 {v17.4h},[x3],x2 //src_tmp2 = ld1_u8(pu1_src_tmp)//
smlal v10.4s,v16.4h,v29.4h //mul_res2 = smlal_u8(mul_res2, src_tmp1, coeffabs_7)//
sub v8.4s, v8.4s, v30.4s
shrn v14.4h, v14.4s, #6
//vqrshrun d14,q7,#6
smull v12.4s,v3.4h,v23.4h
csel x4,x5,x4,le
smlal v12.4s,v2.4h,v22.4h
ld1 {v18.4h},[x3],x2 //src_tmp3 = ld1_u8(pu1_src_tmp)//
smlal v12.4s,v4.4h,v24.4h
add x3,x0,x2 //pu1_src_tmp += src_strd//
smlal v12.4s,v5.4h,v25.4h
smlal v12.4s,v6.4h,v26.4h
st1 {v14.2s},[x14],x6
smlal v12.4s,v7.4h,v27.4h
ld1 {v1.4h},[x3],x2 //src_tmp2 = ld1_u8(pu1_src_tmp)//
smlal v12.4s,v16.4h,v28.4h
add x14,x1,x6
smlal v12.4s,v17.4h,v29.4h
ld1 {v0.4h},[x0],#8 //src_tmp1 = ld1_u8(pu1_src_tmp)//
sub v10.4s, v10.4s, v30.4s
shrn v8.4h, v8.4s, #6
//vqrshrun d8,q4,#6 //sto_res = vqmovun_s16(sto_res_tmp)//
ld1 {v2.4h},[x3],x2 //src_tmp3 = ld1_u8(pu1_src_tmp)//
smull v14.4s,v4.4h,v23.4h
smlal v14.4s,v3.4h,v22.4h
smlal v14.4s,v5.4h,v24.4h
ld1 {v3.4h},[x3],x2 //src_tmp4 = ld1_u8(pu1_src_tmp)//
smlal v14.4s,v6.4h,v25.4h
ld1 {v4.4h},[x3],x2 //src_tmp1 = ld1_u8(pu1_src_tmp)//
smlal v14.4s,v7.4h,v26.4h
ld1 {v5.4h},[x3],x2 //src_tmp2 = ld1_u8(pu1_src_tmp)//
smlal v14.4s,v16.4h,v27.4h
ld1 {v6.4h},[x3],x2 //src_tmp3 = ld1_u8(pu1_src_tmp)//
smlal v14.4s,v17.4h,v28.4h
ld1 {v7.4h},[x3],x2 //src_tmp4 = ld1_u8(pu1_src_tmp)//
smlal v14.4s,v18.4h,v29.4h
st1 {v8.2s},[x1],#8 //st1_u8(pu1_dst,sto_res)//
sub v12.4s, v12.4s, v30.4s
shrn v10.4h, v10.4s, #6
add x20, x1, x9
csel x1, x20, x1, le
//vqrshrun d10,q5,#6 //sto_res = vqmovun_s16(sto_res_tmp)//
subs x7,x7,#4
bgt kernel_8 //jumps to kernel_8
epilog:
smull v8.4s,v1.4h,v23.4h //mul_res1 = smull_u8(src_tmp2, coeffabs_1)//
smlal v8.4s,v0.4h,v22.4h //mul_res1 = smlal_u8(mul_res1, src_tmp1, coeffabs_0)//
smlal v8.4s,v2.4h,v24.4h //mul_res1 = smlal_u8(mul_res1, src_tmp3, coeffabs_2)//
smlal v8.4s,v3.4h,v25.4h //mul_res1 = smlal_u8(mul_res1, src_tmp4, coeffabs_3)//
smlal v8.4s,v4.4h,v26.4h //mul_res1 = smlal_u8(mul_res1, src_tmp1, coeffabs_4)//
smlal v8.4s,v5.4h,v27.4h //mul_res1 = smlal_u8(mul_res1, src_tmp2, coeffabs_5)//
smlal v8.4s,v6.4h,v28.4h //mul_res1 = smlal_u8(mul_res1, src_tmp3, coeffabs_6)//
smlal v8.4s,v7.4h,v29.4h //mul_res1 = smlal_u8(mul_res1, src_tmp4, coeffabs_7)//
st1 {v10.2s},[x14],x6
sub v14.4s, v14.4s, v30.4s
shrn v12.4h, v12.4s, #6
//vqrshrun d12,q6,#6
ld1 {v16.4h},[x3],x2 //src_tmp1 = ld1_u8(pu1_src_tmp)//
smull v10.4s,v2.4h,v23.4h //mul_res2 = smull_u8(src_tmp3, coeffabs_1)//
smlal v10.4s,v1.4h,v22.4h //mul_res2 = smlal_u8(mul_res2, src_tmp2, coeffabs_0)//
smlal v10.4s,v3.4h,v24.4h //mul_res2 = smlal_u8(mul_res2, src_tmp4, coeffabs_2)//
smlal v10.4s,v4.4h,v25.4h //mul_res2 = smlal_u8(mul_res2, src_tmp1, coeffabs_3)//
smlal v10.4s,v5.4h,v26.4h //mul_res2 = smlal_u8(mul_res2, src_tmp2, coeffabs_4)//
smlal v10.4s,v6.4h,v27.4h //mul_res2 = smlal_u8(mul_res2, src_tmp3, coeffabs_5)//
smlal v10.4s,v7.4h,v28.4h //mul_res2 = smlal_u8(mul_res2, src_tmp4, coeffabs_6)//
smlal v10.4s,v16.4h,v29.4h //mul_res2 = smlal_u8(mul_res2, src_tmp1, coeffabs_7)//
st1 {v12.2s},[x14],x6
sub v8.4s, v8.4s, v30.4s
shrn v14.4h, v14.4s, #6
//vqrshrun d14,q7,#6
ld1 {v17.4h},[x3],x2 //src_tmp2 = ld1_u8(pu1_src_tmp)//
smull v12.4s,v3.4h,v23.4h
smlal v12.4s,v2.4h,v22.4h
smlal v12.4s,v4.4h,v24.4h
smlal v12.4s,v5.4h,v25.4h
smlal v12.4s,v6.4h,v26.4h
smlal v12.4s,v7.4h,v27.4h
smlal v12.4s,v16.4h,v28.4h
smlal v12.4s,v17.4h,v29.4h
st1 {v14.2s},[x14],x6
sub v10.4s, v10.4s, v30.4s
shrn v8.4h, v8.4s, #6
//vqrshrun d8,q4,#6 //sto_res = vqmovun_s16(sto_res_tmp)//
ld1 {v18.4h},[x3],x2 //src_tmp3 = ld1_u8(pu1_src_tmp)//
smull v14.4s,v4.4h,v23.4h
smlal v14.4s,v3.4h,v22.4h
smlal v14.4s,v5.4h,v24.4h
smlal v14.4s,v6.4h,v25.4h
smlal v14.4s,v7.4h,v26.4h
smlal v14.4s,v16.4h,v27.4h
smlal v14.4s,v17.4h,v28.4h
smlal v14.4s,v18.4h,v29.4h
sub v12.4s, v12.4s, v30.4s
shrn v10.4h, v10.4s, #6
//vqrshrun d10,q5,#6 //sto_res = vqmovun_s16(sto_res_tmp)//
add x14,x1,x6
st1 {v8.2s},[x1],#8 //st1_u8(pu1_dst,sto_res)//
epilog_end:
st1 {v10.2s},[x14],x6 //st1_u8(pu1_dst_tmp,sto_res)//
shrn v12.4h, v12.4s, #6
//vqrshrun d12,q6,#6
st1 {v12.2s},[x14],x6
sub v14.4s, v14.4s, v30.4s
shrn v14.4h, v14.4s, #6
//vqrshrun d14,q7,#6
st1 {v14.2s},[x14],x6
end_loops:
//ldmfd sp!,{r4-r12,r15} //reload the registers from sp
ldp x19, x20,[sp], #16
pop_v_regs
ret
|