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
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
|
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2008 by Andree Buschmann
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include "config.h"
#if defined(CPU_S5L87XX)
/* Moving this asm routine to iram is (little) faster on S5L87xx. */
.section .icode, "ax", %progbits
#else
.section .text, "ax", %progbits
#endif
/****************************************************************************
* void mpc_decoder_windowing_D(...)
*
* 2nd step within synthesis filter. Does the dewindowing.
* 64=32x32 multiplies
* Uses un-shifted D[]-values. D[] will always be the second operand of
* smull/smlal to achieve higher speed as D[] has lower amplitude than V[].
****************************************************************************/
.align 2
.global mpc_decoder_windowing_D
.type mpc_decoder_windowing_D, %function
#if 0
mpc_decoder_windowing_D:
/* r0 = Data[] */
/* r1 = V[] */
/* r2 = D[] */
/* lr = counter */
/************************************************************************
* Reference implementation.
***********************************************************************/
stmfd sp!, {r4-r8, lr}
mov lr, #32
.loop32:
ldmia r2!, { r3-r6 } /* load D[00..03] */
ldr r7, [r1] /* 0 */
smull r8, r12, r7, r3
ldr r7, [r1, #96*4] /* 1 */
smlal r8, r12, r7, r4
ldr r7, [r1, #128*4] /* 2 */
smlal r8, r12, r7, r5
ldr r7, [r1, #224*4] /* 3 */
smlal r8, r12, r7, r6
ldmia r2!, { r3-r6 } /* load D[04..07] */
ldr r7, [r1, #256*4] /* 4 */
smlal r8, r12, r7, r3
ldr r7, [r1, #352*4] /* 5 */
smlal r8, r12, r7, r4
ldr r7, [r1, #384*4] /* 6 */
smlal r8, r12, r7, r5
ldr r7, [r1, #480*4] /* 7 */
smlal r8, r12, r7, r6
ldmia r2!, { r3-r6 } /* load D[08..11] */
ldr r7, [r1, #512*4] /* 8 */
smlal r8, r12, r7, r3
ldr r7, [r1, #608*4] /* 9 */
smlal r8, r12, r7, r4
ldr r7, [r1, #640*4] /* 10 */
smlal r8, r12, r7, r5
ldr r7, [r1, #736*4] /* 11 */
smlal r8, r12, r7, r6
ldmia r2!, { r3-r6 } /* load D[12..15] */
ldr r7, [r1, #768*4] /* 12 */
smlal r8, r12, r7, r3
ldr r7, [r1, #864*4] /* 13 */
smlal r8, r12, r7, r4
ldr r7, [r1, #896*4] /* 14 */
smlal r8, r12, r7, r5
ldr r7, [r1, #992*4] /* 15 */
smlal r8, r12, r7, r6
mov r8, r8, lsr #16
orr r8, r8, r12, lsl #16 /* (lo>>16) || (hi<<16) */
str r8, [r0], #4 /* store Data */
add r1, r1, #4 /* V++ */
subs lr, lr, #1
bgt .loop32
ldmpc regs=r4-r8
#elif defined(CPU_ARM7TDMI) /* arm7 only */
mpc_decoder_windowing_D:
/* r0 = Data[] */
/* r1 = V[] */
/* r2 = D[] */
/* lr = counter */
/************************************************************************
* Further speed up through making use of symmetries within D[]-window.
* The row V[00] can be extracted as it has symmetries within this single
* row. 8 smull/mlal and 8 ldr's can be saved at the cost of 2 add's.
* The rows V[01..15] are symmetric to V[31..17]. 15 x 16 ldr's can be
* saved at the cost of 15 x 4 + 1 add's.
* The row V[16] can be extracted as it has symmetries within this single
* row. 8 smull/mlal and 8 ldr's can be saved.
* Used for arm7 only. For arm9 and above see implementation below.
***********************************************************************/
stmfd sp!, {r4-r11, lr}
/******************************************
* row 0 with internal symmetry
*****************************************/
add r2, r2, #4 /* D+=1, r2 = D[01] as D[00] = 0 */
ldmia r2!, { r3-r6 } /* load D[01..04] */
ldr r7 , [r1, #96*4] /* 1 */
ldr r10, [r1, #992*4] /* 15 */
rsb r10, r10, r7 /* V[01] - V[15] */
smull r8, r9, r10, r3
ldr r7 , [r1, #128*4] /* 2 */
ldr r10, [r1, #896*4] /* 14 */
add r10, r10, r7 /* V[02] + V[14] */
smlal r8, r9, r10, r4
ldr r7 , [r1, #224*4] /* 3 */
ldr r10, [r1, #864*4] /* 13 */
rsb r10, r10, r7 /* V[03] - V[13] */
smlal r8, r9, r10, r5
ldr r7 , [r1, #256*4] /* 4 */
ldr r10, [r1, #768*4] /* 12 */
add r10, r10, r7 /* V[04] + V[12] */
smlal r8, r9, r10, r6
ldmia r2!, { r3-r6 } /* load D[05..08] */
ldr r7 , [r1, #352*4] /* 5 */
ldr r10, [r1, #736*4] /* 11 */
rsb r10, r10, r7 /* V[05] - V[11] */
smlal r8, r9, r10, r3
ldr r7 , [r1, #384*4] /* 6 */
ldr r10, [r1, #640*4] /* 10 */
add r10, r10, r7 /* V[06] + V[10] */
smlal r8, r9, r10, r4
ldr r7 , [r1, #480*4] /* 7 */
ldr r10, [r1, #608*4] /* 9 */
rsb r10, r10, r7 /* V[07] - V[09] */
smlal r8, r9, r10, r5
ldr r10, [r1, #512*4] /* 8 */
smlal r8, r9, r10, r6
mov r8, r8, lsr #16
orr r8, r8, r9, lsl #16 /* (lo>>16) || (hi<<16) */
str r8, [r0], #4 /* store Data */
add r1, r1, #4 /* V+=1, r1 = V[01] */
add r2, r2, #7*4 /* D+=7, r2 = D[16] */
/******************************************
* rows 01..15 are symmetric to rows 31..17
* r8 = lo, r9 = hi of 01..15
* r1 = V[01..15]
* r10 = lo, r11 = hi of 31..17
* r12 = V[31..16]
*****************************************/
mov lr, #15*8
add r12, r1, #30*4 /* r12 = V[31] */
.loop15:
ldmia r2!, { r3-r6 } /* load D[00..03] */
ldr r7, [r12, #768*4] /* 12 */
smull r10, r11, r7, r6
ldr r7, [r12, #864*4] /* 13 */
smlal r10, r11, r7, r5
ldr r7, [r12, #896*4] /* 14 */
smlal r10, r11, r7, r4
ldr r7, [r12, #992*4] /* 15 */
smlal r10, r11, r7, r3
ldr r7, [r1] /* 0 */
smull r8, r9, r7, r3
ldr r7, [r1, #96*4] /* 1 */
smlal r8, r9, r7, r4
ldr r7, [r1, #128*4] /* 2 */
smlal r8, r9, r7, r5
ldr r7, [r1, #224*4] /* 3 */
smlal r8, r9, r7, r6
ldmia r2!, { r3-r6 } /* load D[04..07] */
ldr r7, [r1, #256*4] /* 4 */
smlal r8, r9, r7, r3
ldr r7, [r1, #352*4] /* 5 */
smlal r8, r9, r7, r4
ldr r7, [r1, #384*4] /* 6 */
smlal r8, r9, r7, r5
ldr r7, [r1, #480*4] /* 7 */
smlal r8, r9, r7, r6
ldr r7, [r12, #512*4] /* 8 */
smlal r10, r11, r7, r6
ldr r7, [r12, #608*4] /* 9 */
smlal r10, r11, r7, r5
ldr r7, [r12, #640*4] /* 10 */
smlal r10, r11, r7, r4
ldr r7, [r12, #736*4] /* 11 */
smlal r10, r11, r7, r3
ldmia r2!, { r3-r6 } /* load D[08..11] */
ldr r7, [r12, #256*4] /* 4 */
smlal r10, r11, r7, r6
ldr r7, [r12, #352*4] /* 5 */
smlal r10, r11, r7, r5
ldr r7, [r12, #384*4] /* 6 */
smlal r10, r11, r7, r4
ldr r7, [r12, #480*4] /* 7 */
smlal r10, r11, r7, r3
ldr r7, [r1, #512*4] /* 8 */
smlal r8, r9, r7, r3
ldr r7, [r1, #608*4] /* 9 */
smlal r8, r9, r7, r4
ldr r7, [r1, #640*4] /* 10 */
smlal r8, r9, r7, r5
ldr r7, [r1, #736*4] /* 11 */
smlal r8, r9, r7, r6
ldmia r2!, { r3-r6 } /* load D[12..15] */
ldr r7, [r1, #768*4] /* 12 */
smlal r8, r9, r7, r3
ldr r7, [r1, #864*4] /* 13 */
smlal r8, r9, r7, r4
ldr r7, [r1, #896*4] /* 14 */
smlal r8, r9, r7, r5
ldr r7, [r1, #992*4] /* 15 */
smlal r8, r9, r7, r6
ldr r7, [r12] /* 0 */
smlal r10, r11, r7, r6
ldr r7, [r12, #96*4] /* 1 */
smlal r10, r11, r7, r5
ldr r7, [r12, #128*4] /* 2 */
smlal r10, r11, r7, r4
ldr r7, [r12, #224*4] /* 3 */
smlal r10, r11, r7, r3
/* store Data[01..15] */
mov r8, r8, lsr #16
orr r8, r8, r9, lsl #16 /* (lo>>16) || (hi<<16) */
/* store Data[31..17] */
mov r10, r10, lsr #16
orr r10, r10, r11, lsl #16 /* (lo>>16) || (hi<<16) */
rsb r10, r10, #0 /* r10 = -r10 */
str r10, [r0, lr] /* store Data */
str r8, [r0], #4 /* store Data */
/* correct adresses for next loop */
sub r12, r12, #4 /* r12 = V-- */
add r1, r1, #4 /* r1 = V++ */
/* next loop */
subs lr, lr, #8
bgt .loop15
/******************************************
* V[16] with internal symmetry
*****************************************/
ldmia r2!, { r3-r6 } /* load D[00..03] */
ldr r7 , [r1] /* 0 */
ldr r10, [r1, #992*4] /* 15 */
rsb r10, r10, r7 /* V[00] - V[15] */
smull r8, r9, r10, r3
ldr r7 , [r1, #96*4] /* 1 */
ldr r10, [r1, #896*4] /* 14 */
rsb r10, r10, r7 /* V[01] - V[14] */
smlal r8, r9, r10, r4
ldr r7 , [r1, #128*4] /* 2 */
ldr r10, [r1, #864*4] /* 13 */
rsb r10, r10, r7 /* V[02] - V[13] */
smlal r8, r9, r10, r5
ldr r7 , [r1, #224*4] /* 3 */
ldr r10, [r1, #768*4] /* 12 */
rsb r10, r10, r7 /* V[03] - V[12] */
smlal r8, r9, r10, r6
ldmia r2!, { r3-r6 } /* load D[04..07] */
ldr r7 , [r1, #256*4] /* 4 */
ldr r10, [r1, #736*4] /* 11 */
rsb r10, r10, r7 /* V[04] - V[11] */
smlal r8, r9, r10, r3
ldr r7 , [r1, #352*4] /* 5 */
ldr r10, [r1, #640*4] /* 10 */
rsb r10, r10, r7 /* V[05] - V[10] */
smlal r8, r9, r10, r4
ldr r7 , [r1, #384*4] /* 6 */
ldr r10, [r1, #608*4] /* 9 */
rsb r10, r10, r7 /* V[06] - V[09] */
smlal r8, r9, r10, r5
ldr r7 , [r1, #480*4] /* 7 */
ldr r10, [r1, #512*4] /* 8 */
rsb r10, r10, r7 /* V[07] - V[08] */
smlal r8, r9, r10, r6
mov r8, r8, lsr #16
orr r8, r8, r9, lsl #16 /* (lo>>16) || (hi<<16) */
str r8, [r0], #4 /* store Data */
ldmpc regs=r4-r11
#elif ARM_ARCH < 6 /* arm9 and above */
mpc_decoder_windowing_D:
/* r0 = Data[] */
/* r1 = V[] */
/* r2 = D[] */
/* lr = counter */
/************************************************************************
* Further speed up through making use of symmetries within D[]-window.
* The row V[00] can be extracted as it has symmetries within this single
* row. 8 smull/mlal and 8 ldr's can be saved at the cost of 2 add's.
* The rows V[01..15] are symmetric to V[31..17]. 15 x 16 ldr's can be
* saved at the cost of 15 x 4 + 1 add's.
* The row V[16] can be extracted as it has symmetries within this single
* row. 8 smull/mlal and 8 ldr's can be saved.
* On arm9 (still armv4 architecture) reducing stalls after ldr/ldm speeds
* up decoding even though several ldm-calls are replaced with ldr to free
* 2 registers.
***********************************************************************/
stmfd sp!, {r4-r11, lr}
/******************************************
* row 0 with internal symmetry
*****************************************/
add r2, r2, #4 /* D+=1, r2 = D[01] as D[00] = 0 */
ldmia r2!, { r3-r6 } /* load D[01..04] */
ldr r7 , [r1, #96*4] /* 1 */
ldr r10, [r1, #992*4] /* 15 */
ldr r11, [r1, #128*4] /* 2 */
ldr r12, [r1, #896*4] /* 14 */
rsb r10, r10, r7 /* V[01] - V[15] */
smull r8, r9, r10, r3
ldr r7 , [r1, #224*4] /* 3 */
ldr r10, [r1, #864*4] /* 13 */
add r12, r12, r11 /* V[02] + V[14] */
smlal r8, r9, r12, r4
ldr r11, [r1, #256*4] /* 4 */
ldr r12, [r1, #768*4] /* 12 */
rsb r10, r10, r7 /* V[03] - V[13] */
smlal r8, r9, r10, r5
ldr r7 , [r1, #352*4] /* 5 */
ldr r10, [r1, #736*4] /* 11 */
add r12, r12, r11 /* V[04] + V[12] */
smlal r8, r9, r12, r6
ldmia r2!, { r3-r6 } /* load D[05..08] */
ldr r11, [r1, #384*4] /* 6 */
ldr r12, [r1, #640*4] /* 10 */
rsb r10, r10, r7 /* V[05] - V[11] */
smlal r8, r9, r10, r3
ldr r7 , [r1, #480*4] /* 7 */
ldr r10, [r1, #608*4] /* 9 */
add r12, r12, r11 /* V[06] + V[10] */
smlal r8, r9, r12, r4
ldr r11, [r1, #512*4] /* 8 */
rsb r10, r10, r7 /* V[07] - V[09] */
smlal r8, r9, r10, r5
smlal r8, r9, r11, r6
mov r8, r8, lsr #16
orr r8, r8, r9, lsl #16 /* (lo>>16) || (hi<<16) */
str r8, [r0], #4 /* store Data */
add r1, r1, #4 /* V+=1, r1 = V[01] */
add r2, r2, #7*4 /* D+=7, r2 = D[16] */
/******************************************
* rows 01..15 are symmetric to rows 31..17
* r8 = lo, r9 = hi of 01..15
* r1 = V[01..15]
* r10 = lo, r11 = hi of 31..17
* r12 = V[31..16]
*****************************************/
mov lr, #15*8
add r12, r1, #30*4 /* r12 = V[31] */
.loop15:
ldmia r2!, { r3-r4 } /* load D[00..01] */
ldr r7, [r12, #896*4] /* 14 */
ldr r5, [r12, #992*4] /* 15 */
smull r10, r11, r7, r4
ldr r7, [r1] /* 0 */
smlal r10, r11, r5, r3
ldr r5, [r1, #96*4] /* 1 */
smull r8, r9, r7, r3
ldr r7, [r12, #768*4] /* 12 */
smlal r8, r9, r5, r4
ldmia r2!, { r3-r4 } /* load D[02..03] */
ldr r5, [r12, #864*4] /* 13 */
smlal r10, r11, r7, r4
ldr r7, [r1, #128*4] /* 2 */
smlal r10, r11, r5, r3
ldr r5, [r1, #224*4] /* 3 */
smlal r8, r9, r7, r3
ldr r7, [r1, #256*4] /* 4 */
smlal r8, r9, r5, r4
ldmia r2!, { r3-r4 } /* load D[04..04] */
ldr r5, [r1, #352*4] /* 5 */
smlal r8, r9, r7, r3
ldr r7, [r12, #640*4] /* 10 */
smlal r8, r9, r5, r4
ldr r5, [r12, #736*4] /* 11 */
smlal r10, r11, r7, r4
ldr r7, [r1, #384*4] /* 6 */
smlal r10, r11, r5, r3
ldmia r2!, { r3-r4 } /* load D[06..07] */
ldr r5, [r1, #480*4] /* 7 */
smlal r8, r9, r7, r3
ldr r7, [r12, #512*4] /* 8 */
smlal r8, r9, r5, r4
ldr r5, [r12, #608*4] /* 9 */
smlal r10, r11, r7, r4
ldr r7, [r12, #384*4] /* 6 */
smlal r10, r11, r5, r3
ldmia r2!, { r3-r4 } /* load D[08..09] */
ldr r5, [r12, #480*4] /* 7 */
smlal r10, r11, r7, r4
ldr r7, [r1, #512*4] /* 8 */
smlal r10, r11, r5, r3
ldr r5, [r1, #608*4] /* 9 */
smlal r8, r9, r7, r3
ldr r7, [r1, #640*4] /* 10 */
smlal r8, r9, r5, r4
ldmia r2!, { r3-r4 } /* load D[10..11] */
ldr r5, [r1, #736*4] /* 11 */
smlal r8, r9, r7, r3
ldr r7, [r12, #256*4] /* 4 */
smlal r8, r9, r5, r4
ldr r5, [r12, #352*4] /* 5 */
smlal r10, r11, r7, r4
ldr r7, [r1, #768*4] /* 12 */
smlal r10, r11, r5, r3
ldmia r2!, { r3-r4 } /* load D[12..13] */
ldr r5, [r1, #864*4] /* 13 */
smlal r8, r9, r7, r3
ldr r7, [r12, #128*4] /* 2 */
smlal r8, r9, r5, r4
ldr r5, [r12, #224*4] /* 3 */
smlal r10, r11, r7, r4
ldr r7, [r12] /* 0 */
smlal r10, r11, r5, r3
ldmia r2!, { r3-r4 } /* load D[14..15] */
ldr r5, [r12, #96*4] /* 1 */
smlal r10, r11, r7, r4
ldr r7, [r1, #896*4] /* 14 */
smlal r10, r11, r5, r3
ldr r5, [r1, #992*4] /* 15 */
smlal r8, r9, r7, r3
smlal r8, r9, r5, r4
/* store Data[01..15] */
mov r8, r8, lsr #16
orr r8, r8, r9, lsl #16 /* (lo>>16) || (hi<<16) */
/* store Data[31..17] */
mov r10, r10, lsr #16
orr r10, r10, r11, lsl #16 /* (lo>>16) || (hi<<16) */
rsb r10, r10, #0 /* r10 = -r10 */
str r10, [r0, lr] /* store Data */
str r8, [r0], #4 /* store Data */
/* correct adresses for next loop */
sub r12, r12, #4 /* r12 = V-- */
add r1, r1, #4 /* r1 = V++ */
/* next loop */
subs lr, lr, #8
bgt .loop15
/******************************************
* V[16] with internal symmetry
*****************************************/
ldmia r2!, { r3-r6 } /* load D[00..03] */
ldr r7 , [r1] /* 0 */
ldr r10, [r1, #992*4] /* 15 */
ldr r11, [r1, #96*4] /* 1 */
ldr r12, [r1, #896*4] /* 14 */
rsb r10, r10, r7 /* V[00] - V[15] */
smull r8, r9, r10, r3
ldr r7 , [r1, #128*4] /* 2 */
ldr r10, [r1, #864*4] /* 13 */
rsb r12, r12, r11 /* V[01] - V[14] */
smlal r8, r9, r12, r4
ldr r11, [r1, #224*4] /* 3 */
ldr r12, [r1, #768*4] /* 12 */
rsb r10, r10, r7 /* V[02] - V[13] */
smlal r8, r9, r10, r5
ldr r7 , [r1, #256*4] /* 4 */
ldr r10, [r1, #736*4] /* 11 */
rsb r12, r12, r11 /* V[03] - V[12] */
smlal r8, r9, r12, r6
ldmia r2!, { r3-r6 } /* load D[04..07] */
ldr r11, [r1, #352*4] /* 5 */
ldr r12, [r1, #640*4] /* 10 */
rsb r10, r10, r7 /* V[04] - V[11] */
smlal r8, r9, r10, r3
ldr r7 , [r1, #384*4] /* 6 */
ldr r10, [r1, #608*4] /* 9 */
rsb r12, r12, r11 /* V[05] - V[10] */
smlal r8, r9, r12, r4
ldr r11, [r1, #480*4] /* 7 */
ldr r12, [r1, #512*4] /* 8 */
rsb r10, r10, r7 /* V[06] - V[09] */
smlal r8, r9, r10, r5
rsb r12, r12, r11 /* V[07] - V[08] */
smlal r8, r9, r12, r6
mov r8, r8, lsr #16
orr r8, r8, r9, lsl #16 /* (lo>>16) || (hi<<16) */
str r8, [r0], #4 /* store Data */
ldmpc regs=r4-r11
#else
mpc_decoder_windowing_D:
/* r0 = Data[] */
/* r1 = V[] */
/* r2 = D[] */
/* lr = counter */
/************************************************************************
* Further speed up through making use of symmetries within D[]-window.
* The row V[00] can be extracted as it has symmetries within this single
* row. 8 smull/mlal and 8 ldr's can be saved at the cost of 2 add's.
* The rows V[01..15] are symmetric to V[31..17]. 15 x 16 ldr's can be
* saved at the cost of 15 x 4 + 1 add's.
* The row V[16] can be extracted as it has symmetries within this single
* row. 8 smull/mlal and 8 ldr's can be saved.
* On armv6 use smmulr/smlalr which are faster than smull/smlal and only
* accumulate the top 32 bits of the result so that frees up 2
* registers so we can ldm larger blocks.
***********************************************************************/
stmfd sp!, {r4-r11, lr}
/******************************************
* row 0 with internal symmetry
*****************************************/
add r2, r2, #4 /* D+=1, r2 = D[01] as D[00] = 0 */
ldmia r2!, { r3-r6 } /* load D[01..04] */
ldr r7 , [r1, #96*4] /* 1 */
ldr r10, [r1, #992*4] /* 15 */
ldr r11, [r1, #128*4] /* 2 */
rsb r10, r10, r7 /* V[01] - V[15] */
ldr r12, [r1, #896*4] /* 14 */
smmulr r9, r10, r3
ldr r7 , [r1, #224*4] /* 3 */
add r12, r12, r11 /* V[02] + V[14] */
ldr r10, [r1, #864*4] /* 13 */
smmlar r9, r12, r4, r9
ldr r11, [r1, #256*4] /* 4 */
rsb r10, r10, r7 /* V[03] - V[13] */
ldr r12, [r1, #768*4] /* 12 */
smmlar r9, r10, r5, r9
ldr r7 , [r1, #352*4] /* 5 */
add r12, r12, r11 /* V[04] + V[12] */
ldr r10, [r1, #736*4] /* 11 */
smmlar r9, r12, r6, r9
ldmia r2!, { r3-r6 } /* load D[05..08] */
ldr r11, [r1, #384*4] /* 6 */
rsb r10, r10, r7 /* V[05] - V[11] */
ldr r12, [r1, #640*4] /* 10 */
smmlar r9, r10, r3, r9
ldr r7 , [r1, #480*4] /* 7 */
add r12, r12, r11 /* V[06] + V[10] */
ldr r10, [r1, #608*4] /* 9 */
smmlar r9, r12, r4, r9
rsb r10, r10, r7 /* V[07] - V[09] */
ldr r11, [r1, #512*4] /* 8 */
smmlar r9, r10, r5, r9
add r1, r1, #4 /* V+=1, r1 = V[01] */
smmlar r9, r11, r6, r9
add r2, r2, #7*4 /* D+=7, r2 = D[16] */
mov r9, r9, lsl #2
str r9, [r0], #4 /* store Data */
/******************************************
* rows 01..15 are symmetric to rows 31..17
* r9 = acc of 01..15
* r1 = V[01..15]
* r11 = acc of 31..17
* r12 = V[31..16]
*****************************************/
mov lr, #15*8
add r12, r1, #30*4 /* r12 = V[31] */
.loop15:
ldmia r2!, { r3-r6 } /* load D[00..03] */
ldr r7, [r12, #896*4] /* 14 */
ldr r8, [r12, #992*4] /* 15 */
smmulr r11, r7, r4
ldr r7, [r1] /* 0 */
smmlar r11, r8, r3, r11
ldr r8, [r1, #96*4] /* 1 */
smmulr r9, r7, r3
ldr r7, [r12, #768*4] /* 12 */
smmlar r9, r8, r4, r9
ldr r8, [r12, #864*4] /* 13 */
smmlar r11, r7, r6, r11
ldr r7, [r1, #128*4] /* 2 */
smmlar r11, r8, r5, r11
ldr r8, [r1, #224*4] /* 3 */
smmlar r9, r7, r5, r9
ldr r7, [r1, #256*4] /* 4 */
smmlar r9, r8, r6, r9
ldmia r2!, { r3-r6 } /* load D[04..07] */
ldr r8, [r1, #352*4] /* 5 */
smmlar r9, r7, r3, r9
ldr r7, [r12, #640*4] /* 10 */
smmlar r9, r8, r4, r9
ldr r8, [r12, #736*4] /* 11 */
smmlar r11, r7, r4, r11
ldr r7, [r1, #384*4] /* 6 */
smmlar r11, r8, r3, r11
ldr r8, [r1, #480*4] /* 7 */
smmlar r9, r7, r5, r9
ldr r7, [r12, #512*4] /* 8 */
smmlar r9, r8, r6, r9
ldr r8, [r12, #608*4] /* 9 */
smmlar r11, r7, r6, r11
ldr r7, [r12, #384*4] /* 6 */
smmlar r11, r8, r5, r11
ldmia r2!, { r3-r6 } /* load D[08..11] */
ldr r8, [r12, #480*4] /* 7 */
smmlar r11, r7, r4, r11
ldr r7, [r1, #512*4] /* 8 */
smmlar r11, r8, r3, r11
ldr r8, [r1, #608*4] /* 9 */
smmlar r9, r7, r3, r9
ldr r7, [r1, #640*4] /* 10 */
smmlar r9, r8, r4, r9
ldr r8, [r1, #736*4] /* 11 */
smmlar r9, r7, r5, r9
ldr r7, [r12, #256*4] /* 4 */
smmlar r9, r8, r6, r9
ldr r8, [r12, #352*4] /* 5 */
smmlar r11, r7, r6, r11
ldr r7, [r1, #768*4] /* 12 */
smmlar r11, r8, r5, r11
ldmia r2!, { r3-r6 } /* load D[12..15] */
ldr r8, [r1, #864*4] /* 13 */
smmlar r9, r7, r3, r9
ldr r7, [r12, #128*4] /* 2 */
smmlar r9, r8, r4, r9
ldr r8, [r12, #224*4] /* 3 */
smmlar r11, r7, r4, r11
ldr r7, [r12] /* 0 */
smmlar r11, r8, r3, r11
ldr r8, [r12, #96*4] /* 1 */
smmlar r11, r7, r6, r11
ldr r7, [r1, #896*4] /* 14 */
smmlar r11, r8, r5, r11
ldr r8, [r1, #992*4] /* 15 */
smmlar r9, r7, r5, r9
sub r12, r12, #4 /* r12 = V-- correct adresses for next loop */
smmlar r9, r8, r6, r9
add r1, r1, #4 /* r1 = V++ correct adresses for next loop */
rsb r11, r11, #0 /* r11 = -r11 */
/* store Data[01..15] */
mov r9, r9, lsl #2
/* store Data[31..17] */
mov r11, r11, lsl #2
str r11, [r0, lr] /* store Data */
str r9, [r0], #4 /* store Data */
/* next loop */
subs lr, lr, #8
bgt .loop15
/******************************************
* V[16] with internal symmetry
*****************************************/
ldmia r2!, { r3-r6 } /* load D[00..03] */
ldr r7 , [r1] /* 0 */
ldr r10, [r1, #992*4] /* 15 */
ldr r11, [r1, #96*4] /* 1 */
rsb r10, r10, r7 /* V[00] - V[15] */
ldr r12, [r1, #896*4] /* 14 */
smmulr r9, r10, r3
ldr r7 , [r1, #128*4] /* 2 */
rsb r12, r12, r11 /* V[01] - V[14] */
ldr r10, [r1, #864*4] /* 13 */
smmlar r9, r12, r4, r9
ldr r11, [r1, #224*4] /* 3 */
rsb r10, r10, r7 /* V[02] - V[13] */
ldr r12, [r1, #768*4] /* 12 */
smmlar r9, r10, r5, r9
ldr r7 , [r1, #256*4] /* 4 */
rsb r12, r12, r11 /* V[03] - V[12] */
ldr r10, [r1, #736*4] /* 11 */
smmlar r9, r12, r6, r9
ldmia r2!, { r3-r6 } /* load D[04..07] */
ldr r11, [r1, #352*4] /* 5 */
rsb r10, r10, r7 /* V[04] - V[11] */
ldr r12, [r1, #640*4] /* 10 */
smmlar r9, r10, r3, r9
ldr r7 , [r1, #384*4] /* 6 */
rsb r12, r12, r11 /* V[05] - V[10] */
ldr r10, [r1, #608*4] /* 9 */
smmlar r9, r12, r4, r9
ldr r11, [r1, #480*4] /* 7 */
rsb r10, r10, r7 /* V[06] - V[09] */
ldr r12, [r1, #512*4] /* 8 */
smmlar r9, r10, r5, r9
rsb r12, r12, r11 /* V[07] - V[08] */
smmlar r9, r12, r6, r9
mov r9, r9, lsl #2
str r9, [r0], #4 /* store Data */
ldmpc regs=r4-r11
#endif
.mpc_dewindowing_end:
.size mpc_decoder_windowing_D,.mpc_dewindowing_end-mpc_decoder_windowing_D
|