Home | History | Annotate | Download | only in asm
      1 @ ------------------------------------------------------------------
      2 @ Copyright (C) 1998-2009 PacketVideo
      3 @
      4 @ Licensed under the Apache License, Version 2.0 (the "License");
      5 @ you may not use this file except in compliance with the License.
      6 @ You may obtain a copy of the License at
      7 @
      8 @      http://www.apache.org/licenses/LICENSE-2.0
      9 @
     10 @ Unless required by applicable law or agreed to in writing, software
     11 @ distributed under the License is distributed on an "AS IS" BASIS,
     12 @ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
     13 @ express or implied.
     14 @ See the License for the specific language governing permissions
     15 @ and limitations under the License.
     16 @ -------------------------------------------------------------------
     17 
     18 @
     19 @
     20 @   Filename: pvmp3_dct_16_gcc.s
     21 @
     22 @
     23 @------------------------------------------------------------------------------
     24 @ REVISION HISTORY
     25 @
     26 @
     27 @ Who:                                   Date: MM/DD/YYYY
     28 @ Description:
     29 @
     30 @------------------------------------------------------------------------------
     31 
     32 .arm
     33 
     34 .align 4
     35 
     36 .text
     37 
     38 .extern  pvmp3_dct_16
     39 .extern  pvmp3_merge_in_place_N32
     40 .extern  pvmp3_split
     41 
     42 
     43 
     44 @------------------------------------------------------------------------------
     45 
     46 .global pvmp3_dct_16
     47 
     48 pvmp3_dct_16:
     49         stmfd    sp!,{r0,r1,r4-r11,lr}
     50         ldr      r1,[r0]
     51         ldr      r3,[r0,#0x3c]
     52         ldr      r12,constant1
     53         sub      r2,r1,r3
     54         smull    lr,r2,r12,r2
     55         sub      sp,sp,#0x1c
     56         str      r2,[sp,#0x14]
     57         ldr      r2,[r0,#0x1c]
     58         ldr      r12,[r0,#0x20]
     59         add      r1,r1,r3
     60         sub      r3,r2,r12
     61         ldr      lr,constant2
     62         mov      r3,r3,lsl #3
     63         smull    r4,r3,lr,r3
     64         ldr      r6,constant5
     65         str      r3,[sp]
     66         add      r3,r2,r12
     67         sub      r2,r1,r3
     68         ldr      r12,constant3
     69         add      r3,r1,r3
     70         smull    lr,r2,r12,r2
     71         ldr      r12,[r0,#0x38]
     72         ldr      r1,[r0,#4]
     73         ldr      lr,constant4
     74         sub      r4,r1,r12
     75         add      r1,r1,r12
     76         ldr      r12,[r0,#0x18]
     77         smull    r4,r5,lr,r4
     78         ldr      lr,[r0,#0x24]
     79         ldr      r10,constant10
     80         sub      r4,r12,lr
     81         mov      r4,r4,lsl #1
     82         smull    r7,r4,r6,r4
     83         add      r12,r12,lr
     84         add      r7,r1,r12
     85         sub      r12,r1,r12
     86         ldr      r1,constant6
     87         str      r4,[sp,#4]
     88         smull    r12,r4,r1,r12
     89         ldr      r1,[r0,#8]
     90         ldr      r12,[r0,#0x34]
     91         ldr      r6,constant7
     92         sub      lr,r1,r12
     93         smull    r8,lr,r6,lr
     94         add      r1,r1,r12
     95         str      lr,[sp,#0x10]
     96         ldr      r12,[r0,#0x14]
     97         ldr      lr,[r0,#0x28]
     98         ldr      r8,constant8
     99         sub      r6,r12,lr
    100         mov      r6,r6,lsl #1
    101         smull    r9,r6,r8,r6
    102         add      r12,r12,lr
    103         ldr      r9,constant9
    104         add      r8,r1,r12
    105         sub      r12,r1,r12
    106         smull    r12,lr,r9,r12
    107         ldr      r12,[r0,#0x30]
    108         ldr      r1,[r0,#0xc]
    109         sub      r9,r1,r12
    110         smull    r11,r9,r10,r9
    111         add      r12,r1,r12
    112         str      r9,[sp,#0xc]
    113         ldr      r9,[r0,#0x10]
    114         ldr      r10,constant11
    115         str      r9,[sp,#0x18]
    116         ldr      r1,[r0,#0x2c]
    117         sub      r9,r9,r1
    118         smull    r11,r9,r10,r9
    119         ldr      r10,constant12
    120         str      r9,[sp,#8]
    121         ldr      r9,[sp,#0x18]
    122         ldr      r11,constant14
    123         add      r9,r9,r1
    124         add      r1,r12,r9
    125         sub      r12,r12,r9
    126         mov      r12,r12,lsl #2
    127         smull    r9,r12,r10,r12
    128         ldr      r10,constant13
    129         add      r9,r3,r1
    130         sub      r1,r3,r1
    131         smull    r1,r3,r10,r1
    132         sub      r1,r7,r8
    133         mov      r1,r1,lsl #1
    134         smull    r1,r10,r11,r1
    135         add      r1,r7,r8
    136         add      r8,r9,r1
    137         sub      r7,r9,r1
    138         mov      r8,r8,asr #1
    139         ldr      r1,constant15
    140         str      r8,[r0]
    141         smull    r7,r8,r1,r7
    142         sub      r7,r3,r10
    143         str      r8,[r0,#0x20]
    144         mov      r7,r7,lsl #1
    145         smull    r8,r7,r1,r7
    146         add      r3,r3,r10
    147         add      r3,r3,r7
    148         str      r3,[r0,#0x10]
    149         sub      r3,r2,r12
    150         str      r7,[r0,#0x30]
    151         add      r2,r2,r12
    152         ldr      r7,constant13
    153         sub      r12,r4,lr
    154         mov      r3,r3,lsl #1
    155         smull    r8,r3,r7,r3
    156         add      lr,r4,lr
    157         sub      r4,r2,lr
    158         mov      r12,r12,lsl #2
    159         smull    r7,r12,r11,r12
    160         add      lr,lr,r2
    161         sub      r2,r3,r12
    162         mov      r2,r2,lsl #1
    163         smull    r7,r2,r1,r2
    164         mov      r4,r4,lsl #1
    165         add      r12,r12,r2
    166         add      r3,r12,r3
    167         smull    r7,r4,r1,r4
    168         add      r12,r3,lr
    169         add      r3,r3,r4
    170         str      r3,[r0,#0x18]
    171         add      r3,r2,r4
    172         str      r2,[r0,#0x38]
    173         str      r3,[r0,#0x28]
    174         str      r12,[r0,#8]
    175         ldr      r2,[sp,#0x14]
    176         ldr      r3,[sp,#0]
    177         ldr      lr,[sp,#4]
    178         sub      r2,r2,r3
    179         ldr      r3,constant3
    180         mov      r2,r2,lsl #1
    181         smull    r12,r2,r3,r2
    182         ldr      r3,[sp,#0x14]
    183         ldr      r12,[sp,#0]
    184         ldr      r4,constant6
    185         add      r12,r3,r12
    186         ldr      r3,[sp,#4]
    187         sub      lr,r5,lr
    188         mov      lr,lr,lsl #1
    189         add      r3,r5,r3
    190         smull    r5,lr,r4,lr
    191         ldr      r4,[sp,#0x10]
    192         ldr      r5,[sp,#0x10]
    193         add      r4,r4,r6
    194         sub      r5,r5,r6
    195         ldr      r6,constant9
    196         mov      r5,r5,lsl #1
    197         smull    r7,r5,r6,r5
    198         ldr      r6,[sp,#8]
    199         ldr      r9,[sp,#0xc]
    200         ldr      r10,constant12
    201         sub      r6,r9,r6
    202         mov      r6,r6,lsl #3
    203         smull    r7,r6,r10,r6
    204         ldr      r8,[sp,#0x20]
    205         ldr      r7,[sp,#8]
    206         cmp      r8,#0
    207         add      r7,r9,r7
    208 
    209         bne      no_flag_proc
    210         rsb      r12,r12,#0
    211         rsb      r2,r2,#0
    212         rsb      r3,r3,#0
    213         rsb      lr,lr,#0
    214         rsb      r4,r4,#0
    215         rsb      r5,r5,#0
    216         rsb      r7,r7,#0
    217         rsb      r6,r6,#0
    218 no_flag_proc:
    219 
    220         sub      r8,r2,r6
    221         add      r2,r6,r2
    222         sub      r6,r12,r7
    223         ldr      r9,constant13
    224         add      r12,r12,r7
    225         sub      r7,r3,r4
    226         mov      r6,r6,lsl #1
    227         mov      r8,r8,lsl #1
    228         smull    r10,r8,r9,r8
    229         add      r3,r3,r4
    230         smull    r10,r6,r9,r6
    231         sub      r4,lr,r5
    232         mov      r7,r7,lsl #2
    233         smull    r9,r7,r11,r7
    234         add      lr,lr,r5
    235         sub      r5,r6,r7
    236         add      r6,r6,r7
    237         sub      r7,r12,r3
    238         add      r3,r12,r3
    239         sub      r12,r2,lr
    240         mov      r4,r4,lsl #2
    241         smull    r9,r4,r11,r4
    242         add      lr,r2,lr
    243         sub      r2,r8,r4
    244         mov      r2,r2,lsl #1
    245         mov      r5,r5,lsl #1
    246         mov      r12,r12,lsl #1
    247         mov      r7,r7,lsl #1
    248         smull    r9,r5,r1,r5
    249         smull    r9,r2,r1,r2
    250         add      r6,r6,r5
    251         smull    r9,r7,r1,r7
    252         smull    r9,r12,r1,r12
    253         add      r1,r4,r2
    254         add      r1,r1,r8
    255         add      lr,lr,r1
    256         add      r3,r3,lr
    257         str      r3,[r0,#4]
    258         add      r3,r6,lr
    259         str      r3,[r0,#0xc]
    260         add      r1,r1,r12
    261         add      r3,r6,r1
    262         add      r1,r7,r1
    263         str      r1,[r0,#0x1c]
    264         str      r3,[r0,#0x14]
    265         add      r1,r12,r2
    266         add      r3,r7,r1
    267         add      r1,r5,r1
    268         str      r1,[r0,#0x2c]
    269         str      r3,[r0,#0x24]!
    270         add      r1,r5,r2
    271         str      r1,[r0,#0x10]
    272         str      r2,[r0,#0x18]
    273         add      sp,sp,#0x24
    274         ldmfd    sp!,{r4-r11,pc}
    275 
    276 
    277 
    278 @------------------------------------------------------------------------------
    279 
    280 .global pvmp3_merge_in_place_N32
    281 
    282 
    283 
    284 pvmp3_merge_in_place_N32:
    285         stmfd    sp!,{r4,lr}
    286         ldr      r1,[r0,#0x1c]
    287         ldr      r2,[r0,#0x38]
    288         str      r1,[r0,#0x38]
    289         ldr      r1,[r0,#0x18]
    290         ldr      r3,[r0,#0x30]
    291         str      r1,[r0,#0x30]
    292         ldr      r12,[r0,#0x14]
    293         ldr      r1,[r0,#0x28]
    294         str      r12,[r0,#0x28]
    295         ldr      r12,[r0,#0x10]
    296         ldr      lr,[r0,#0x20]
    297         str      r12,[r0,#0x20]
    298         ldr      r12,[r0,#0xc]
    299         str      r12,[r0,#0x18]
    300         ldr      r12,[r0,#8]
    301         str      r12,[r0,#0x10]
    302         ldr      r12,[r0,#4]
    303         str      r12,[r0,#8]
    304         ldr      r4,[r0,#0x40]
    305         ldr      r12,[r0,#0x44]
    306         add      r4,r4,r12
    307         str      r4,[r0,#4]
    308         str      lr,[r0,#0x40]
    309         ldr      lr,[r0,#0x48]
    310         add      r12,lr,r12
    311         str      r12,[r0,#0xc]
    312         ldr      r12,[r0,#0x4c]
    313         add      lr,r12,lr
    314         str      lr,[r0,#0x14]
    315         ldr      lr,[r0,#0x24]
    316         str      lr,[r0,#0x48]
    317         ldr      lr,[r0,#0x50]
    318         add      r12,lr,r12
    319         str      r12,[r0,#0x1c]
    320         ldr      r12,[r0,#0x54]
    321         str      r1,[r0,#0x50]
    322         add      lr,r12,lr
    323         str      lr,[r0,#0x24]
    324         ldr      r1,[r0,#0x58]
    325         ldr      r4,[r0,#0x2c]
    326         ldr      lr,[r0,#0x34]
    327         add      r12,r1,r12
    328         str      r12,[r0,#0x2c]
    329         ldr      r12,[r0,#0x5c]
    330         add      r1,r12,r1
    331         str      r1,[r0,#0x34]
    332         str      r4,[r0,#0x58]
    333         ldr      r1,[r0,#0x60]
    334         ldr      r4,[r0,#0x3c]
    335         add      r12,r1,r12
    336         str      r12,[r0,#0x3c]
    337         ldr      r12,[r0,#0x64]
    338         add      r1,r12,r1
    339         str      r1,[r0,#0x44]
    340         ldr      r1,[r0,#0x68]
    341         add      r12,r1,r12
    342         str      r12,[r0,#0x4c]
    343         ldr      r12,[r0,#0x6c]
    344         add      r1,r12,r1
    345         str      r1,[r0,#0x54]
    346         ldr      r1,[r0,#0x70]
    347         str      r3,[r0,#0x60]
    348         add      r12,r1,r12
    349         str      r12,[r0,#0x5c]
    350         ldr      r3,[r0,#0x74]
    351         add      r1,r3,r1
    352         str      r1,[r0,#0x64]
    353         str      lr,[r0,#0x68]
    354         ldr      r1,[r0,#0x78]
    355         str      r2,[r0,#0x70]
    356         add      r3,r1,r3
    357         str      r3,[r0,#0x6c]
    358         ldr      r2,[r0,#0x7c]
    359         add      r1,r1,r2
    360         str      r1,[r0,#0x74]
    361         str      r4,[r0,#0x78]
    362         ldmfd    sp!,{r4,pc}
    363 
    364 
    365 @------------------------------------------------------------------------------
    366 
    367 .global pvmp3_split
    368 
    369 
    370 pvmp3_split:
    371         stmfd    sp!,{r4,r5,lr}
    372         adr      r1,constant16
    373         ldr      r2,[r1]
    374         add      r2,r1
    375         sub      r1,r0,#4
    376         mov      r3,#3
    377 loop1:
    378         ldr      r12,[r0]
    379         ldr      lr,[r1]
    380         ldr      r4,[r2],#-4
    381         add      r5,lr,r12
    382         sub      r12,lr,r12
    383         smull    r12,lr,r4,r12
    384         str      r5,[r1],#-4
    385         mov      r12,r12,lsr #27
    386         add      r12,r12,lr,lsl #5
    387         str      r12,[r0],#4
    388         ldr      r12,[r0]
    389         ldr      lr,[r1]
    390         ldr      r4,[r2],#-4
    391         add      r5,lr,r12
    392         sub      r12,lr,r12
    393         smull    r12,lr,r4,r12
    394         str      r5,[r1],#-4
    395         mov      r12,r12,lsr #27
    396         add      r12,r12,lr,lsl #5
    397         str      r12,[r0],#4
    398         subs     r3,r3,#1
    399         bne      loop1
    400         mov      r3,#5
    401 loop2:
    402         ldr      r12,[r0]
    403         ldr      lr,[r1]
    404         ldr      r4,[r2],#-4
    405         add      r5,lr,r12
    406         sub      r12,lr,r12
    407         mov      r12,r12,lsl #1
    408         smull    lr,r12,r4,r12
    409         str      r5,[r1],#-4
    410         str      r12,[r0],#4
    411         ldr      r12,[r0]
    412         ldr      lr,[r1]
    413         ldr      r4,[r2],#-4
    414         add      r5,lr,r12
    415         sub      r12,lr,r12
    416         mov      r12,r12,lsl #1
    417         smull    lr,r12,r4,r12
    418         str      r5,[r1],#-4
    419         str      r12,[r0],#4
    420         subs     r3,r3,#1
    421         bne      loop2
    422         ldmfd    sp!,{r4,r5,pc}
    423 constant1:
    424         .word      0x404f4680
    425 constant2:
    426         .word      0x519e4e00
    427 constant3:
    428         .word      0x4140fb80
    429 constant4:
    430         .word      0x42e13c00
    431 constant5:
    432         .word      0x6e3c9300
    433 constant6:
    434         .word      0x4cf8de80
    435 constant7:
    436         .word      0x48919f80
    437 constant8:
    438         .word      0x43e22480
    439 constant9:
    440         .word      0x73326b80
    441 constant10:
    442         .word      0x52cb0e80
    443 constant11:
    444         .word      0x64e24000
    445 constant12:
    446         .word      0x52036780
    447 constant13:
    448         .word      0x4545ea00
    449 constant14:
    450         .word      0x539eba80
    451 constant15:
    452         .word      0x5a827980
    453 constant16:
    454         .word      (CosTable_dct32 + 60)-constant16
    455 
    456 
    457 
    458 CosTable_dct32:
    459         .word      0x4013c280
    460         .word      0x40b34580
    461         .word      0x41fa2d80
    462         .word      0x43f93400
    463         .word      0x46cc1c00
    464         .word      0x4a9d9d00
    465         .word      0x4fae3700
    466         .word      0x56601e80
    467         .word      0x5f4cf700
    468         .word      0x6b6fcf00
    469         .word      0x07c7d1d8
    470         .word      0x095b0350
    471         .word      0x0bdf91b0
    472         .word      0x107655e0
    473         .word      0x1b42c840
    474         .word      0x51852300
    475 
    476 
    477