1.text 2.p2align 2 3.global ixheaacd_shiftrountine_with_rnd_eld 4.type ixheaacd_shiftrountine_with_rnd_eld, %function 5 6ixheaacd_shiftrountine_with_rnd_eld: 7 STMFD sp!, {r4-r12, r14} 8 MOV r4, #0x1f 9 ADD r12, r2, r3, LSL #1 10 MOV r9, #0x8000 11 SUBS r3, r3, #1 12 BMI S_WITH_R_L6 13 14S_WITH_R_L5: 15 LDR r5, [r1, r3, LSL #2] @i2 = qmfImag[j] 16 LDR r7, [r0, r3, LSL #2] @r2 = qmfReal[j] 17 LDR r14, [r0], #4 @r1 = *qmfReal 18 LDR r10, [r1], #4 @i1 = *qmfImag 19 20 ADD r6, r5, r7 @*qmfImag++ = add32(i2, r2) 21 MVN r6, r6 @negate32(add32(i2, r2)) 22 ADD r6, r6 , #1 23 24 @SUB r5,r5,r7 @qmfReal[j] = sub32(i2, r2) 25 SUB r5, r7, r5 @qmfReal[j] = sub32(r2, i2) 26 27 ADD r7, r10, r14 @qmfImag[j] = add32(i1, r1) 28 MVN r7, r7 @negate32(add32(i1, r1)) 29 ADD r7, r7 , #1 30 31 @SUB r4,r10,r14 @*qmfReal++ = sub32(i1, r1) 32 SUB r4, r14, r10 @*qmfReal++ = sub32(r1, i1) 33 34 @STR r7,[r1,r3,LSL #2] 35 @STR r5,[r0,r3,LSL #2] 36 @STR r6,[r1],#4 37 @STR r4,[r0],#4 38 39 40 41 @LDRD r4,[r0],#8 @DEBUG 42 43 @LDRD r6,[r1],#8 44 MOVS r10, r4, ASR #0x16 @Right shift by 22 to check the overflow ( is not AAC_ELD right shifted by 21) 45 CMNLT r10, #1 @Check r4 is overflow or not 46 47 MOVLT r4, #0x80000000 @saturate value if r4 is overflowed 48 MVNGT r4, #0x80000000 49 MOVEQ r4, r4, LSL #9 @shift by 9(hardcoded value) if not AAC_ELD left shifted by 10 50 51 MOVS r10, r5, ASR #0x16 52 QADD r4, r4, r9 53 CMNLT r10, #1 54 MOV r4, r4, ASR #16 55 MOVLT r5, #0x80000000 56 MVNGT r5, #0x80000000 57 MOVEQ r5, r5, LSL #9 58 MOV r14, r3, lsl #1 59 60 61 MOVS r10, r6, ASR #0x16 62 QADD r5, r5, r9 63 CMNLT r10, #1 64 MOV r5, r5, ASR #16 65 MOVLT r6, #0x80000000 66 @STRH r5,[r2],#2 67 STRH r5, [r2, r14] 68 MVNGT r6, #0x80000000 69 MOVEQ r6, r6, LSL #9 70 71 MOVS r10, r7, ASR #0x16 72 QADD r6, r6, r9 73 CMNLT r10, #1 74 MOV r6, r6, ASR #16 75 MOVLT r7, #0x80000000 76 MVNGT r7, #0x80000000 77 MOVEQ r7, r7, LSL #9 78 79 QADD r7, r7, r9 80 STRH r4, [r2], #2 81 82 MOV r7, r7, ASR #16 83 84 @STRH r7,[r12],#2 85 STRH r7, [r12, r14] 86 SUBS r3, r3, #2 87 STRH r6, [r12], #2 88 BGE S_WITH_R_L5 89S_WITH_R_L6: 90 LDMFD sp!, {r4-r12, r15} 91 92 93 94