DO NOT MERGE - Merge Android 10 into master

Bug: 139893257
Change-Id: Id59b59f4e91e6f7e140bd74863345a51d7f8feef
This commit is contained in:
Xin Li 2019-09-04 13:33:46 -07:00
commit d4372873b6
115 changed files with 2569 additions and 4754 deletions

View file

@ -133,8 +133,11 @@ cc_library_static {
misc_undefined: [
"unsigned-integer-overflow",
"signed-integer-overflow",
"bounds",
],
cfi: true,
// Enable CFI if this becomes a shared library.
// cfi: true,
blacklist: "libxaac_blacklist.txt",
},
arch: {

View file

@ -1,5 +1,5 @@
This xaac codec (external/xaac) is experimental; it is not yet intended
to be used on production devices.
This codec should not be configured into any production Android Pie
(Android 9) device that will be shipped.
This codec should not be configured into any production Android device
that is intended to be shipped.

View file

@ -25,7 +25,7 @@
ixheaacd_apply_rot_armv7:
STMFD SP!, {R4-R12, R14}
LDR R5, =0x59e
MOVW R5, #0x59e
MOV R4, #22
ADD R11, R0, R5
LOOP1:
@ -70,7 +70,7 @@ LOOP1:
BGT LOOP1
LDR R4, =0x53C
MOVW R4, #0x53C
LDR R12, [R0, #44]
ADD R11, R0, R4
MOV R4, #10
@ -116,8 +116,8 @@ LOOP2:
BGT LOOP2
LDR R11, =0x6c2
LDR R5, =0x564
MOVW R11, #0x6c2
MOVW R5, #0x564
LDRSH R14, [R0, R11]
ADD R11, R0, R5
LDR R5, [SP, #44]

View file

@ -20,8 +20,10 @@ ixheaacd_complex_fft_p2_asm:
MOV r0, #0
FIRST_STAGE_R4:
LDR r4, =0x33333333
LDR r5, =0x0F0F0F0F
MOVW r4, #0x3333
MOVT r4, #0x3333
MOVW r5, #0x0F0F
MOVT r5, #0x0F0F
AND r6, r4, r0
AND r7, r4, r0, LSR #2
ORR r4, r7, r6, LSL #2

View file

@ -20,8 +20,10 @@ ixheaacd_complex_ifft_p2_asm:
MOV r0, #0
FIRST_STAGE_R4:
LDR r4, =0x33333333
LDR r5, =0x0F0F0F0F
MOVW r4, #0x3333
MOVT r4, #0x3333
MOVW r5, #0x0F0F
MOVT r5, #0x0F0F
AND r6, r4, r0
AND r7, r4, r0, LSR #2
ORR r4, r7, r6, LSL #2

View file

@ -28,8 +28,8 @@ ixheaacd_conv_ergtoamplitude_armv7:
LDR R5, [SP, #44]
LDR R4, [SP, #40]
LDR R14, =0x1FF
LDR R10, =0x5A82
MOVW R14, #0x1FF
MOVW R10, #0x5A82
LOOP1:

View file

@ -28,8 +28,8 @@ ixheaacd_conv_ergtoamplitudelp_armv7:
LDR R5, [SP, #44]
LDR R4, [SP, #40]
LDR R11, =0x5A82
LDR R10, =0x1FF
MOVW R11, #0x5A82
MOVW R10, #0x1FF
LOOP1:

View file

@ -742,7 +742,7 @@ DE_COR_NEXT1:
MOV r7, r13
LDR r3, [r0, #0x020]
LDR r4, [r0, #0x028]
LDR r12, =0x620a
MOVW r12, #0x620a
LDR r6, [r0, #0x024]
STR r0, [r13, #-4]!
STR r5, [r13, #-4]!

View file

@ -63,7 +63,7 @@ LOOP1:
LDR R4, [SP, #124]
MOV R0, R1
MOV R1, R3
ldr R5, =0x41FC
MOVW R5, #0x41FC
ADD R2, R4, R5
ADD R3, R4, #0xB8

View file

@ -198,9 +198,12 @@ ixheaacd_fft32x32_ld2_armv7:
@Load twiddle factors
LDR r11, =2310960706 @0x89BE7642
LDR r12, =3473158396 @0xCF0430FC
LDR r14, =2776455811 @0xA57D5A83
MOVW r11, 0X7642
MOVT r11, 0X89BE
MOVW r12, 0X30FC
MOVT r12, 0XCF04
MOVW r14, 0X5A83
MOVT r14, 0XA57D
@Second Butterfly
LDR r2, [r0, #32] @mul_0qr = inp_0qr = x[8]

View file

@ -1,12 +1,5 @@
.equ C53_VAL , -11904
.equ SINMU_VAL , 28378
.equ C51_52VAL , 0x79BC9D84
.equ C54_55VAL , 0x478EB000
.equ FFTOP_OFFSET , -1536
.equ FFTOP_OFFSET1 , 256
.text
.p2align 2
.global ixheaacd_fft_15_ld_armv7
@ -34,7 +27,8 @@ LOOP_FFT5:
ADD r1, r4, r10 @ r1 = buf1a[2] + buf1a[8]
SUB r4, r4, r10 @ r4 = buf1a[2] - buf1a[8]@
LDR r10, = C54_55VAL
MOVW r10, #0xB000
MOVT r10, #0x478E
ADD r12, r6, r8 @ r3 = buf1a[4] + buf1a[6]
SUB r8, r6, r8 @ r2 = buf1a[4] - buf1a[6]
@ -44,7 +38,8 @@ LOOP_FFT5:
ADD r2, r2, r1 @ temp1 = inp[0] + r1@
SMULWB r1, r1, r10 @ mult32_shl(r1, C55)
ADD r1, r2, r1, lsl #2 @ r1 = temp1 + ((mult32_shl(r1, C55)) << 1)@
LDR r10, = C51_52VAL @
MOVW r10, #0x9D84
MOVT r10, #0x79BC
STR r2, [lr], #4 @ *buf2++ = temp1@
SUB r12, r1, r6, LSL #1 @ r3 = r1 - t@
@ -57,7 +52,8 @@ LOOP_FFT5:
MOV r2, r2, LSL #1
SMULWB r4, r4, r10 @ mult32_shl(r4, C52)
LDR r10, = C53_VAL
MOVW r10, #0xD180
MOVT r10, #0xFFFF
ADD r4, r2, r4, LSL #2 @ r4 = t + (mult32_shl(r4, C52) << 1)@
SMULWB r8, r8, r10 @ mult32_shl(r2, C53)
@ -65,7 +61,8 @@ LOOP_FFT5:
ADD r6, r5, r11 @ s1 = buf1a[3] + buf1a[9]
SUB r8, r5, r11 @ s4 = buf1a[3] - buf1a[9]
LDR r10, = C54_55VAL
MOVW r10, #0xB000
MOVT r10, #0x478E
ADD r5, r7, r9 @ s3 = buf1a[5] + buf1a[7]@
SUB r7, r7, r9 @ s2 = buf1a[5] + buf1a[7]@
@ -76,7 +73,8 @@ LOOP_FFT5:
ADD r3, r3, r6 @ temp2 = buf1a[1] + s1
SMULWB r6, r6, r10 @ mult32_shl(s1, C55)
ADD r6, r3, r6, lsl #2 @ s1 = temp1 + ((mult32_shl(s1, C55)) << 1)@
LDR r10, = C51_52VAL @
MOVW r10, #0x9D84
MOVT r10, #0x79BC
STR r3, [lr], #4 @ *buf2++ = temp2@
SUB r5, r6, r9, LSL #1 @ s3 = s1 - t@
@ -90,7 +88,8 @@ LOOP_FFT5:
SMULWB r8, r8, r10 @ mult32_shl(s4, C52)
LDR r10, = C53_VAL
MOVW r10, #0xD180
MOVT r10, #0xFFFF
ADD r8, r11, r8, LSL #2 @ s4 = t + (mult32_shl(s4, C52) << 1)@
SMULWB r7, r7, r10 @ mult32_shl(s2, C53)
@ -108,7 +107,8 @@ LOOP_FFT5:
STMIA lr!, {r3, r9-r12} @
MOV r12, #384 @
LDR r1, = FFTOP_OFFSET @
MOVW r1, #0xFA00
MOVT r1, #0xFFFF
STMIA lr!, {r4-r6} @
@ -126,7 +126,8 @@ LOOP_FFT5:
ADD r1, r4, r10 @ r1 = buf1a[2] + buf1a[8]
SUB r4, r4, r10 @ r4 = buf1a[2] - buf1a[8]@
LDR r10, = C54_55VAL
MOVW r10, #0xB000
MOVT r10, #0x478E
ADD r12, r6, r8 @ r3 = buf1a[4] + buf1a[6]
SUB r8, r6, r8 @ r2 = buf1a[4] - buf1a[6]
@ -136,7 +137,8 @@ LOOP_FFT5:
ADD r2, r2, r1 @ temp1 = inp[0] + r1@
SMULWB r1, r1, r10 @ mult32_shl(r1, C55)
ADD r1, r2, r1, lsl #2 @ r1 = temp1 + ((mult32_shl(r1, C55)) << 1)@
LDR r10, = C51_52VAL @
MOVW r10, #0x9D84
MOVT r10, #0x79BC
STR r2, [lr], #4 @ *buf2++ = temp1@
SUB r12, r1, r6, LSL #1 @ r3 = r1 - t@
@ -149,7 +151,8 @@ LOOP_FFT5:
SMULWB r4, r4, r10 @ mult32_shl(r4, C52)
LDR r10, = C53_VAL
MOVW r10, #0xD180
MOVT r10, #0xFFFF
ADD r4, r2, r4, LSL #2 @ r4 = t + (mult32_shl(r4, C52) << 1)@
SMULWB r8, r8, r10 @ mult32_shl(r2, C53)
@ -157,7 +160,8 @@ LOOP_FFT5:
ADD r6, r5, r11 @ s1 = buf1a[3] + buf1a[9]
SUB r8, r5, r11 @ s4 = buf1a[3] - buf1a[9]
LDR r10, = C54_55VAL
MOVW r10, #0xB000
MOVT r10, #0x478E
ADD r5, r7, r9 @ s3 = buf1a[5] + buf1a[7]@
SUB r7, r7, r9 @ s2 = buf1a[5] + buf1a[7]@
@ -168,7 +172,8 @@ LOOP_FFT5:
ADD r3, r3, r6 @ temp2 = buf1a[1] + s1
SMULWB r6, r6, r10 @ mult32_shl(s1, C55)
ADD r6, r3, r6, lsl #2 @ s1 = temp1 + ((mult32_shl(s1, C55)) << 1)@
LDR r10, = C51_52VAL @
MOVW r10, #0x9D84
MOVT r10, #0x79BC
STR r3, [lr], #4 @ *buf2++ = temp2@
@ -181,7 +186,8 @@ LOOP_FFT5:
MOV r11, r11, LSL #1
SMULWB r8, r8, r10 @mult32_shl(s4, C52)
LDR r10, = C53_VAL
MOVW r10, #0xD180
MOVT r10, #0xFFFF
ADD r8, r11, r8, LSL #2 @s4 = t + (mult32_shl(s4, C52) << 1)@
SMULWB r7, r7, r10 @mult32_shl(s2, C53)
@ -195,7 +201,8 @@ LOOP_FFT5:
SUB r4, r5, r4 @buf2[7] = s3 - r4
SUB r5, r1, r7 @buf2[8] = r1 - s2
ADD r6, r6, r2 @buf2[9] = s1 + r2
LDR r1, = FFTOP_OFFSET @
MOVW r1, #0xFA00
MOVT r1, #0xFFFF
STMIA lr!, {r3, r9-r12}
MOV r12, #384 @
@ -215,7 +222,8 @@ LOOP_FFT5:
ADD r1, r4, r10 @ r1 = buf1a[2] + buf1a[8]
SUB r4, r4, r10 @ r4 = buf1a[2] - buf1a[8]@
LDR r10, = C54_55VAL
MOVW r10, #0xB000
MOVT r10, #0x478E
ADD r12, r6, r8 @ r3 = buf1a[4] + buf1a[6]
SUB r8, r6, r8 @ r2 = buf1a[4] - buf1a[6]
@ -225,7 +233,8 @@ LOOP_FFT5:
ADD r2, r2, r1 @ temp1 = inp[0] + r1@
SMULWB r1, r1, r10 @ mult32_shl(r1, C55)
ADD r1, r2, r1, lsl #2 @ r1 = temp1 + ((mult32_shl(r1, C55)) << 1)@
LDR r10, = C51_52VAL @
MOVW r10, #0x9D84
MOVT r10, #0x79BC
STR r2, [lr], #4 @ *buf2++ = temp1@
SUB r12, r1, r6, LSL #1 @ r3 = r1 - t@
@ -237,7 +246,8 @@ LOOP_FFT5:
MOV r2, r2, LSL #1
SMULWB r4, r4, r10 @ mult32_shl(r4, C52)
LDR r10, = C53_VAL
MOVW r10, #0xD180
MOVT r10, #0xFFFF
ADD r4, r2, r4, LSL #2 @ r4 = t + (mult32_shl(r4, C52) << 1)@
SMULWB r8, r8, r10 @ mult32_shl(r2, C53)
@ -245,7 +255,8 @@ LOOP_FFT5:
ADD r6, r5, r11 @ s1 = buf1a[3] + buf1a[9]
SUB r8, r5, r11 @ s4 = buf1a[3] - buf1a[9]
LDR r10, = C54_55VAL
MOVW r10, #0xB000
MOVT r10, #0x478E
ADD r5, r7, r9 @ s3 = buf1a[5] + buf1a[7]@
SUB r7, r7, r9 @ s2 = buf1a[5] + buf1a[7]@
@ -255,7 +266,8 @@ LOOP_FFT5:
ADD r3, r3, r6 @ temp2 = buf1a[1] + s1
SMULWB r6, r6, r10 @ mult32_shl(s1, C55)
ADD r6, r3, r6, lsl #2 @ s1 = temp1 + ((mult32_shl(s1, C55)) << 1)@
LDR r10, = C51_52VAL @
MOVW r10, #0x9D84
MOVT r10, #0x79BC
STR r3, [lr], #4 @ *buf2++ = temp2@
SUB r5, r6, r9, LSL #1 @ s3 = s1 - t@
@ -267,7 +279,8 @@ LOOP_FFT5:
MOV r11, r11, LSL #1
SMULWB r8, r8, r10 @mult32_shl(s4, C52)
LDR r10, = C53_VAL
MOVW r10, #0xD180
MOVT r10, #0xFFFF
ADD r8, r11, r8, LSL #2 @s4 = t + (mult32_shl(s4, C52) << 1)@
@ -287,7 +300,7 @@ LOOP_FFT5:
STMIA lr!, {r4-r6} @
SUB lr, lr, #120 @
LDR r12, = SINMU_VAL @
MOVW r12, # 28378 @
LDMFD r13!, {r10, r11} @

View file

@ -33,13 +33,13 @@ ixheaacd_imdct_using_fft_armv7:
@ LDR r6, [sp, #0x68+8]
@ LDR r7, [sp, #0x68+12]
LDR r8, =11600
MOVW r8, #11600
ADD r4, r0, r8
LDR r8, =11856
MOVW r8, #11856
ADD r5, r0, r8
LDR r8, =11920
MOVW r8, #11920
ADD r6, r0, r8
LDR r8, =11936
MOVW r8, #11936
ADD r7, r0, r8
@ -278,7 +278,7 @@ RADIX_8_FIRST_LOOP:
VUZP.16 d28, d29
VADD.S32 q4, q8, q7
LDR r14, =0x5a82
MOVW r14, #0x5a82
VSUB.S32 q11, q8, q7
@ -615,7 +615,7 @@ RADIX_4_FIRST_ENDS:
PUSH {r3}
LSR r5, r5, #2
LDR r14, =8528
MOVW r14, #8528
ADD r0, r0, r14
OUTER_LOOP_R4:

View file

@ -114,7 +114,7 @@ ixheaacd_inv_dit_fft_8pt_armv7:
QADD r7, lr, r10
QSUB r10, lr, r10
LDR r11, =0x00005a82
MOVW r11, #0x00005a82
STR r10, [r2, #0x10]
QSUB r10, r8, r0

View file

@ -32,7 +32,7 @@ ixheaacd_post_twiddle_armv7:
ARM_PROLOGUE:
CMP R3, #0x400
LDR R6, =7500
MOVW R6, #7500
ADD R2, R2, R6
BLT NEXT
MOV R4, #50
@ -43,8 +43,8 @@ ARM_PROLOGUE:
B NEXT1
NEXT:
LDR R4, =0x192
LDR R5, =0xfe6e
MOVW R4, #0x192
MOVW R5, #0xfe6e
MOV R6, #32
VDUP.16 D10, R4

View file

@ -37,7 +37,7 @@ ixheaacd_post_twid_overlap_add_armv7:
ADD R6, R6, R9
SUB R6, R6, #4
LDR R8, =7500
MOVW R8, #7500
ADD R2, R2, R8

View file

@ -28,7 +28,7 @@ ixheaacd_pretwiddle_compute_armv7:
STMFD sp!, {R4-R12}
VPUSH {d8 - d15}
LDR R8, =7500
MOVW R8, #7500
ADD R3, R3, R8
LDR R4, [sp, #100]
LDR R5, [sp, #104]

View file

@ -50,7 +50,7 @@
#include "ixheaacd_audioobjtypes.h"
#define mult16x16_16(a, b) ixheaacd_mult16((a), (b))
#define mac16x16(a, b, c) ixheaacd_mac16x16in32((a), (b), (c))
#define mac16x16(a, b, c) ixheaacd_mac16x16in32_sat((a), (b), (c))
#define mpy_32x16(a, b) fixmuldiv2_32x16b((a), (b))
#define mpy_16x16(a, b) ixheaacd_mult16x16in32((a), (b))
#define mpy_32x32(a, b) ixheaacd_mult32((a), (b))
@ -351,4 +351,4 @@ VOID ixheaacd_esbr_cos_sin_mod(WORD32 *subband,
}
p_sin = qmf_bank->esbr_alt_sin_twiddle;
ixheaacd_esbr_cos_sin_mod_loop2(subband, p_sin, M);
}
}

View file

@ -282,7 +282,7 @@ RADIX_8_FIRST_LOOP:
VUZP.16 d28, d29
VADD.S32 q4, q8, q7
LDR r14, =0x5a82
MOVW r14, #0x5a82
VSUB.S32 q11, q8, q7

View file

@ -45,7 +45,7 @@ ixheaacd_cos_sin_mod_loop1:
SUB x5, x5, #8
ASR x6, x1, #2
LDR w19, =0
MOV w19, #0
DUP V0.8h, w19
LOOP1:
//first part
@ -83,7 +83,7 @@ LOOP1:
ADD x3, x3, #8
ADD x7, x3, #248
ST2 {v2.s, v3.s}[2], [x7]
LDR w19, =0
MOV w19, #0
DUP V0.8h, w19
//second part
ld1 {v0.h}[0] , [x2]
@ -120,7 +120,7 @@ LOOP1:
ADD x7, x5, #256
ST2 {v2.s, v3.s}[2], [x7]
SUB x5, x5, #8
LDR w19, =0
MOV w19, #0
DUP V0.8h, w19
//Third part
ld1 {v0.h}[0] , [x2]
@ -156,7 +156,7 @@ LOOP1:
ADD x3, x3, #8
ADD x7, x3, #248
ST2 {v2.s, v3.s}[2], [x7]
LDR w19, =0
MOV w19, #0
DUP V0.8h, w19
//Fourth part
ld1 {v0.h}[0] , [x2]
@ -195,7 +195,7 @@ LOOP1:
SUBS x6, x6, #1
ST2 {v2.s, v3.s}[2], [x7]
SUB x5, x5, #8
LDR w19, =0
MOV w19, #0
DUP V0.8h, w19
BGT LOOP1
//VPOP {D8-D11}

View file

@ -45,7 +45,7 @@ ixheaacd_cos_sin_mod_loop2:
ADD x11, x10, x2, LSL #3
SUB x11, x11, #4
MOV x8, #-4
LDR w19, =0
MOV w19, #0
DUP V0.4s, w19
DUP V1.4s, w19
@ -164,7 +164,7 @@ LOOP1:
ST1 {v12.s}[2], [x11], x8
ST1 {v16.s}[2], [x10], #4
LDR w19, =0
MOV w19, #0
DUP V0.4s, w19
DUP V1.4s, w19
// second part

View file

@ -266,19 +266,19 @@ ixheaacd_fft32x32_ld2_armv8:
//Load twiddle factors
// LDR w11, =2310960706 //0x89BE7642
LDR w11, =0x7642
MOV w11, #0x7642
sxth w11, w11
LDR w21, =0x89BE
MOV w21, #0x89BE
sxth w21, w21
// LDR w12, =3473158396 //0xCF0430FC
LDR w12, =0x30FC
MOV w12, #0x30FC
sxth w12, w12
LDR w22, =0xCF04
MOV w22, #0xCF04
sxth w22, w22
// LDR w14, =2776455811 //0xA57D5A83
LDR w14, =0x5A83
MOV w14, #0x5A83
sxth w14, w14
LDR w24, =0xA57D
MOV w24, #0xA57D
sxth w24, w24
//Second Butterfly

View file

@ -55,13 +55,13 @@
ixheaacd_imdct_using_fft_armv8:
push_v_regs
LDR X29, =11600
MOV X29, #11600
ADD X4, X0, X29
LDR X29, =11856
MOV X29, #11856
ADD X5, X0, X29
LDR X29, =11920
MOV X29, #11920
ADD X6, X0, X29
LDR X29, =11936
MOV X29, #11936
ADD X7, X0, X29
COND_1: CMP X1, #0x400
@ -611,7 +611,7 @@ RADIX_4_FIRST_ENDS:
MOv x30, X3
LSR X5, X5, #2
LDR X14, =8528
MOV X14, #8528
ADD X0, X0, X14
OUTER_LOOP_R4:

View file

@ -20,7 +20,7 @@
.global ixheaacd_inv_dit_fft_8pt_armv8
ixheaacd_inv_dit_fft_8pt_armv8:
push_v_regs
LDR w3, =0x5A820000
MOV w3, #0x5A820000
DUP v0.2s, w3
MOV x5, #8
ADD x6, x0, #4

View file

@ -49,7 +49,7 @@ ixheaacd_post_twiddle_armv8:
ARM_PROLOGUE:
CMP w3, #0x400
LDR x21, =7500
MOV x21, #7500
ADD x2, x2, x21
BLT NEXT
MOV w4, #50

View file

@ -65,7 +65,7 @@ ixheaacd_post_twid_overlap_add_armv8:
ADD x6, x6, x9
SUB x6, x6, #4
LDR w8, =7500
MOV w8, #7500
sxtw x8, w8
ADD x2, x2, x8
@ -185,9 +185,9 @@ ARM_PROLOGUE:
BGE NEXT2
CMN x8, #1
NEXT2:
LDR x20, =0x80000000
MOV x20, #0x80000000
csel x7, x20, x7, LT
LDR x20, =0x7fffffff
MOV x20, #0x7fffffff
csel x7, x20, x7, GT
LSL x20, x7, x11
csel x7, x20, x7, EQ
@ -200,9 +200,9 @@ NEXT2:
BGE NEXT3
CMN x8, #1
NEXT3:
LDR x20, =0x80000000
MOV x20, #0x80000000
csel x12, x20, x12, LT
LDR x20, =0x7fffffff
MOV x20, #0x7fffffff
csel x12, x20, x12, GT
LSL x20, x12, x11
csel x12, x20, x12, EQ

View file

@ -59,7 +59,7 @@ ixheaacd_pretwiddle_compute_armv8:
LSL x7, x4, #4
ADD x7, x2, x7
SUB x7, x7, #4
LDR x22, =7500
MOV x22, #7500
ADD x3, x3, x22
MVN w5, w5
ADD w5, w5, #1

View file

@ -48,7 +48,7 @@
#include "ixheaacd_audioobjtypes.h"
#define mult16x16_16(a, b) ixheaacd_mult16((a), (b))
#define mac16x16(a, b, c) ixheaacd_mac16x16in32((a), (b), (c))
#define mac16x16(a, b, c) ixheaacd_mac16x16in32_sat((a), (b), (c))
#define mpy_32x16(a, b) fixmuldiv2_32x16b((a), (b))
#define mpy_16x16(a, b) ixheaacd_mult16x16in32((a), (b))
#define mpy_32x32(a, b) ixheaacd_mult32((a), (b))
@ -99,9 +99,13 @@ VOID ixheaacd_dct3_32(WORD32 *input, WORD32 *output,
twid_im = *twidle_fwd;
twidle_fwd += 3;
*p_out++ = mac32x16in32_dual(temp1[0], twid_re, temp1[1], twid_im);
*p_out++ = msu32x16in32_dual(temp1[0], twid_im, temp1[1], twid_re);
*p_out++ = ixheaacd_mult32x16in32(temp1[0], twid_re) +
ixheaacd_mult32x16in32(temp1[1], twid_im);
*p_out++ = -ixheaacd_mult32x16in32(temp1[1], twid_re) +
ixheaacd_mult32x16in32(temp1[0], twid_im);
}
twid_re = *twidle_fwd++;
twid_im = *twidle_fwd;
@ -114,11 +118,14 @@ VOID ixheaacd_dct3_32(WORD32 *input, WORD32 *output,
temp1[0] = temp1[1];
temp2[2] = mac32x16in32_dual(temp1[0], twid_re, temp1[1], twid_im);
temp2[3] = msu32x16in32_dual(temp1[0], twid_im, temp1[1], twid_re);
temp2[2] = ixheaacd_mult32x16in32(temp1[0], twid_re) +
ixheaacd_mult32x16in32(temp1[1], twid_im);
temp2[3] = -ixheaacd_mult32x16in32(temp1[1], twid_re) +
ixheaacd_mult32x16in32(temp1[0], twid_im);
ptr_forward = output;
ptr_reverse = &output[DCT3_LEN - 1];
temp2[0] = *ptr_forward++;
temp2[1] = *ptr_forward--;
@ -152,8 +159,11 @@ VOID ixheaacd_dct3_32(WORD32 *input, WORD32 *output,
temp1[2] = temp2[1] + temp2[3];
temp1[3] = (temp2[1] - temp2[3]);
temp1[4] = mac32x16in32_dual(temp1[0], twid_re, temp1[2], twid_im);
temp1[5] = msu32x16in32_dual(temp1[0], twid_im, temp1[2], twid_re);
temp1[4] = ixheaacd_mult32x16in32(temp1[0], twid_re) +
ixheaacd_mult32x16in32(temp1[2], twid_im);
temp1[5] = -ixheaacd_mult32x16in32(temp1[2], twid_re) +
ixheaacd_mult32x16in32(temp1[0], twid_im);
temp1[1] >>= 1;
temp1[3] >>= 1;
@ -169,7 +179,7 @@ VOID ixheaacd_dct3_32(WORD32 *input, WORD32 *output,
temp2[3] = *ptr_reverse--;
temp2[2] = *ptr_reverse++;
twid_re = *twidle_rev;
twid_re = -*twidle_rev;
twidle_rev -= 2;
twid_im = *twidle_fwd;
twidle_fwd += 2;
@ -180,8 +190,10 @@ VOID ixheaacd_dct3_32(WORD32 *input, WORD32 *output,
temp1[2] = temp2[1] + temp2[3];
temp1[3] = (temp2[1] - temp2[3]);
temp1[4] = -mac32x16in32_dual(temp1[0], twid_re, temp1[2], twid_im);
temp1[5] = msu32x16in32_dual(temp1[0], twid_im, temp1[2], twid_re);
temp1[4] = ixheaacd_mult32x16in32(temp1[0], twid_re) -
ixheaacd_mult32x16in32(temp1[2], twid_im);
temp1[5] = ixheaacd_mult32x16in32(temp1[2], twid_re) +
ixheaacd_mult32x16in32(temp1[0], twid_im);
temp1[1] >>= 1;
temp1[3] >>= 1;
@ -1322,4 +1334,4 @@ VOID ixheaacd_radix4bfly(const WORD16 *w, WORD32 *x, WORD32 index1,
x += fft_jmp;
w_ptr = w_ptr - fft_jmp;
}
}
}

View file

@ -64,8 +64,41 @@ IA_ERRORCODE impd_drc_set_default_config(ia_drc_api_struct *p_obj_drc);
IA_ERRORCODE impd_drc_set_struct_pointer(ia_drc_api_struct *p_obj_drc);
IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc);
#define SUBBAND_BUF_SIZE \
NUM_ELE_IN_CPLX_NUM *MAX_CHANNEL_COUNT * sizeof(FLOAT32 *) + \
(MAX_SUBBAND_DELAY + MAX_DRC_FRAME_SIZE) * MAX_CHANNEL_COUNT * \
sizeof(FLOAT32) * NUM_ELE_IN_CPLX_NUM
#define NUM_DRC_TABLES 4
#define SCRATCH_MEM_SIZE 1024 * 256 * 64
#define SCRATCH_MEM_SIZE \
(AUDIO_CODEC_FRAME_SIZE_MAX * MAX_CHANNEL_COUNT * sizeof(FLOAT32) * \
NUM_ELE_IN_CPLX_NUM)
#define PERSIST_MEM_SIZE \
(sizeof(ia_drc_state_struct) + sizeof(ia_drc_bits_dec_struct) + \
sizeof(ia_drc_gain_dec_struct) * 2 + \
sizeof(ia_drc_loudness_info_set_struct) + sizeof(ia_drc_gain_struct) + \
sizeof(ia_drc_interface_struct) + sizeof(ia_drc_config) + \
sizeof(ia_drc_sel_pro_struct) + sizeof(ia_drc_sel_proc_params_struct) + \
sizeof(ia_drc_sel_proc_output_struct) + \
sizeof(ia_drc_peak_limiter_struct) + sizeof(ia_drc_peak_limiter_struct) + \
sizeof(ia_drc_qmf_filt_struct) + ANALY_BUF_SIZE + SYNTH_BUF_SIZE + \
PEAK_LIM_BUF_SIZE + MAX_BS_BUF_SIZE + /*DRC Config Bitstream*/ \
MAX_DRC_CONFG_BUF_SIZE + /*DRC loudness info Bitstream*/ \
MAX_LOUD_INFO_BUF_SIZE + /*DRC interface Bitstream*/ \
MAX_INTERFACE_BUF_SIZE + \
NUM_GAIN_DEC_INSTANCES * \
(SEL_DRC_COUNT * sizeof(ia_interp_buf_struct) * MAX_GAIN_ELE_COUNT + \
sizeof(ia_eq_set_struct) + /*non_interleaved_audio*/ \
MAX_CHANNEL_COUNT * sizeof(FLOAT32 *) + \
MAX_DRC_FRAME_SIZE * sizeof(FLOAT32) * \
MAX_CHANNEL_COUNT + /*audio_in_out_buf ptr*/ \
MAX_CHANNEL_COUNT * sizeof(FLOAT32 *) + /*audio_io_buffer_delayed*/ \
MAX_CHANNEL_COUNT * sizeof(FLOAT32 *) + \
MAX_DRC_FRAME_SIZE * sizeof(FLOAT32) * \
MAX_CHANNEL_COUNT + /*subband band buffer ptr*/ \
NUM_ELE_IN_CPLX_NUM * MAX_CHANNEL_COUNT * sizeof(FLOAT32 *) + \
SUBBAND_BUF_SIZE + (PARAM_DRC_MAX_BUF_SZ * MAX_CHANNEL_COUNT)))
IA_ERRORCODE ia_drc_dec_api(pVOID p_ia_drc_dec_obj, WORD32 i_cmd, WORD32 i_idx,
pVOID pv_value) {
@ -111,8 +144,7 @@ IA_ERRORCODE ia_drc_dec_api(pVOID p_ia_drc_dec_obj, WORD32 i_cmd, WORD32 i_idx,
break;
}
case IA_API_CMD_GET_API_SIZE: {
*pui_value = sizeof(ia_drc_api_struct) +
(sizeof(ia_drc_state_struct) + 8) + 8080 * 1024;
*pui_value = sizeof(ia_drc_api_struct);
break;
}
@ -120,7 +152,8 @@ IA_ERRORCODE ia_drc_dec_api(pVOID p_ia_drc_dec_obj, WORD32 i_cmd, WORD32 i_idx,
switch (i_idx) {
case IA_CMD_TYPE_INIT_SET_BUFF_PTR: {
p_obj_drc->p_state->persistant_ptr =
p_obj_drc->pp_mem[IA_DRC_PERSIST_IDX];
(UWORD8 *)p_obj_drc->pp_mem[IA_DRC_PERSIST_IDX] +
sizeof(ia_drc_state_struct);
impd_drc_set_struct_pointer(p_obj_drc);
break;
@ -130,11 +163,6 @@ IA_ERRORCODE ia_drc_dec_api(pVOID p_ia_drc_dec_obj, WORD32 i_cmd, WORD32 i_idx,
break;
}
case IA_CMD_TYPE_INIT_API_POST_CONFIG_PARAMS: {
p_obj_drc->p_state =
(ia_drc_state_struct *)((SIZE_T)p_obj_drc + 8000 * 1024);
p_obj_drc->p_mem_info =
(ia_mem_info_struct *)((SIZE_T)p_obj_drc + 8002 * 1024);
p_obj_drc->pp_mem = (pVOID)((SIZE_T)p_obj_drc + 8006 * 1024);
impd_drc_fill_mem_tables(p_obj_drc);
break;
}
@ -402,9 +430,18 @@ IA_ERRORCODE ia_drc_dec_api(pVOID p_ia_drc_dec_obj, WORD32 i_cmd, WORD32 i_idx,
break;
}
case IA_API_CMD_GET_MEMTABS_SIZE: {
*pui_value =
(sizeof(ia_mem_info_struct) + sizeof(pVOID *)) * (NUM_DRC_TABLES);
break;
}
case IA_API_CMD_SET_MEMTABS_PTR: {
if (ps_value == NULL) return IA_DRC_DEC_API_FATAL_MEM_ALLOC;
memset(ps_value, 0,
(sizeof(ia_mem_info_struct) + sizeof(pVOID *)) * (NUM_DRC_TABLES));
p_obj_drc->p_mem_info = (ia_mem_info_struct *)(ps_value);
p_obj_drc->pp_mem =
(pVOID)((SIZE_T)p_obj_drc->p_mem_info +
(NUM_DRC_TABLES * sizeof(*(p_obj_drc->p_mem_info))));
break;
}
case IA_API_CMD_GET_N_MEMTABS: {
@ -418,7 +455,9 @@ IA_ERRORCODE ia_drc_dec_api(pVOID p_ia_drc_dec_obj, WORD32 i_cmd, WORD32 i_idx,
case IA_API_CMD_EXECUTE: {
switch (i_idx) {
case IA_CMD_TYPE_DO_EXECUTE: {
if (p_obj_drc->str_config.dec_type == DEC_TYPE_TD) {
if (!p_obj_drc->p_state->ui_init_done) {
error_code = IA_FATAL_ERROR;
} else if (p_obj_drc->str_config.dec_type == DEC_TYPE_TD) {
error_code = impd_process_time_domain(p_obj_drc);
} else if (p_obj_drc->str_config.dec_type == DEC_TYPE_QMF64) {
error_code = impd_init_process_audio_main_qmf(p_obj_drc);
@ -524,8 +563,6 @@ IA_ERRORCODE impd_drc_mem_api(ia_drc_api_struct *p_obj_drc, WORD32 i_cmd,
break;
}
case IA_API_CMD_SET_MEM_PTR: {
pWORD8 pbtemp;
UWORD32 sz;
if (pv_value == 0) {
return (-1);
}
@ -533,10 +570,11 @@ IA_ERRORCODE impd_drc_mem_api(ia_drc_api_struct *p_obj_drc, WORD32 i_cmd,
return (-1);
}
p_obj_drc->pp_mem[i_idx] = pv_value;
pbtemp = p_obj_drc->pp_mem[i_idx];
sz = p_obj_drc->p_mem_info[i_idx].ui_size;
memset(pbtemp, 0, sz);
memset(p_obj_drc->pp_mem[i_idx], 0, p_obj_drc->p_mem_info[i_idx].ui_size);
if (IA_MEMTYPE_PERSIST == i_idx) {
p_obj_drc->p_state = pv_value;
}
break;
}
case IA_API_CMD_SET_MEM_PLACEMENT: {
}
@ -548,7 +586,8 @@ IA_ERRORCODE impd_drc_fill_mem_tables(ia_drc_api_struct *p_obj_drc) {
ia_mem_info_struct *p_mem_info;
{
p_mem_info = &p_obj_drc->p_mem_info[IA_DRC_PERSIST_IDX];
p_mem_info->ui_size = 64 * 1024 * 1024;
memset(p_mem_info, 0, sizeof(*p_mem_info));
p_mem_info->ui_size = PERSIST_MEM_SIZE;
p_mem_info->ui_alignment = 8;
p_mem_info->ui_type = IA_MEMTYPE_PERSIST;
p_mem_info->ui_placement[0] = 0;
@ -559,6 +598,7 @@ IA_ERRORCODE impd_drc_fill_mem_tables(ia_drc_api_struct *p_obj_drc) {
}
{
p_mem_info = &p_obj_drc->p_mem_info[IA_DRC_INPUT_IDX];
memset(p_mem_info, 0, sizeof(*p_mem_info));
p_mem_info->ui_size = p_obj_drc->str_config.frame_size *
(p_obj_drc->str_config.pcm_size >> 3) *
p_obj_drc->str_config.num_ch_in;
@ -572,6 +612,7 @@ IA_ERRORCODE impd_drc_fill_mem_tables(ia_drc_api_struct *p_obj_drc) {
}
{
p_mem_info = &p_obj_drc->p_mem_info[IA_DRC_OUTPUT_IDX];
memset(p_mem_info, 0, sizeof(*p_mem_info));
p_mem_info->ui_size = p_obj_drc->str_config.frame_size *
(p_obj_drc->str_config.pcm_size >> 3) *
p_obj_drc->str_config.num_ch_in;
@ -585,6 +626,7 @@ IA_ERRORCODE impd_drc_fill_mem_tables(ia_drc_api_struct *p_obj_drc) {
}
{
p_mem_info = &p_obj_drc->p_mem_info[IA_DRC_SCRATCH_IDX];
memset(p_mem_info, 0, sizeof(*p_mem_info));
p_mem_info->ui_size = SCRATCH_MEM_SIZE;
p_mem_info->ui_alignment = 8;
p_mem_info->ui_type = IA_MEMTYPE_SCRATCH;

View file

@ -30,9 +30,10 @@ extern "C" {
#define ENABLE_ADDITIONAL_TESTS 1
#define SPEAKER_POS_COUNT_MAX 128
#define SPEAKER_POS_COUNT_MAX (8) // 128
#define DOWNMIX_COEFF_COUNT_MAX 32 * 32
#define MAX_CHANNEL_COUNT 128
#define MAX_CHANNEL_COUNT (8) // 128
#define MAX_SUBBAND_CHANNEL_COUNT (128)
#define BAND_COUNT_MAX 8
#define SEQUENCE_COUNT_MAX 24
#define GAIN_SET_COUNT_MAX SEQUENCE_COUNT_MAX
@ -50,6 +51,42 @@ extern "C" {
#define DOWNMIX_ID_COUNT_MAX 8
#define MAX_SIGNAL_DELAY 4500
#define NUM_ELE_IN_CPLX_NUM 2
#define MAX_BS_BUF_SIZE 768
#define MAX_DRC_CONFG_BUF_SIZE MAX_BS_BUF_SIZE
#define MAX_LOUD_INFO_BUF_SIZE MAX_BS_BUF_SIZE
#define MAX_INTERFACE_BUF_SIZE MAX_BS_BUF_SIZE
#define MAX_GAIN_ELE_COUNT 15 /*MAX 4-bit Value*/
#define NUM_GAIN_DEC_INSTANCES 2
#define MAX_DRC_FRAME_SIZE AUDIO_CODEC_FRAME_SIZE_MAX
#define ANALY_BUF_SIZE \
(AUDIO_CODEC_FRAME_SIZE_MAX * MAX_CHANNEL_COUNT * sizeof(FLOAT32) * \
NUM_ELE_IN_CPLX_NUM)
#define SYNTH_BUF_SIZE \
(AUDIO_CODEC_FRAME_SIZE_MAX * MAX_CHANNEL_COUNT * sizeof(FLOAT32) * \
NUM_ELE_IN_CPLX_NUM)
#define PEAK_LIM_BUF_SIZE \
(AUDIO_CODEC_FRAME_SIZE_MAX * MAX_CHANNEL_COUNT * sizeof(FLOAT32) * \
NUM_ELE_IN_CPLX_NUM)
/*7 bits read from the bitstream*/
#define MAX_PARAM_DRC_LOOK_AHEAD_VAL 127
#define MAX_PARAM_DRC_LIM_ATTACK_VAL MAX_PARAM_DRC_LOOK_AHEAD_VAL
#define MAX_SAMP_FREQ_IN_KHZ 96
#define MAX_ATTACK_VAL (MAX_PARAM_DRC_LOOK_AHEAD_VAL * MAX_SAMP_FREQ_IN_KHZ)
/*int(sqrt(MAX_ATTACK_VAL + 1))*/
#define MAX_SEC_LEN 110
#define MAX_NUMBUF_SEC_VAL (MAX_ATTACK_VAL / MAX_SEC_LEN)
/*(MAX_NUMBUF_SEC_VAL * MAX_SEC_LEN)*/
#define PARAM_DRC_MAX_BUF_SZ 110
#define MAX_SUBBAND_DELAY (MAX_SIGNAL_DELAY / AUDIO_CODEC_SUBBAND_COUNT_QMF64)
#define DRC_BAND_COUNT_MAX BAND_COUNT_MAX
#define SPLIT_CHARACTERISTIC_COUNT_MAX 8
#define GAIN_SET_COUNT_MAX SEQUENCE_COUNT_MAX
@ -150,6 +187,7 @@ extern "C" {
#define PARAM_DRC_TYPE_LIM_THRESHOLD_DEFAULT (-1.f)
#define PARAM_DRC_TYPE_LIM_ATTACK_DEFAULT 5
#define PARAM_DRC_TYPE_LIM_RELEASE_DEFAULT 50
#define MAX_LOUDNESS_INFO_COUNT (16)
#define MAX_LOUDNESS_INFO_COUNT (16)
@ -200,7 +238,7 @@ typedef struct ia_drc_sel_proc_output_struct {
WORD32 target_channel_count;
WORD32 target_layout;
WORD32 downmix_matrix_present;
FLOAT32 downmix_matrix[MAX_CHANNEL_COUNT][MAX_CHANNEL_COUNT];
FLOAT32 downmix_matrix[MAX_SUBBAND_CHANNEL_COUNT][MAX_SUBBAND_CHANNEL_COUNT];
FLOAT32 boost;
FLOAT32 compress;

View file

@ -1082,6 +1082,9 @@ WORD32 impd_parse_eq_instructions(
str_eq_instructions->eq_set_id = (temp >> 5) & 0x3F;
if (str_eq_instructions->eq_set_id >= EQ_INSTRUCTIONS_COUNT_MAX)
return UNEXPECTED_ERROR;
str_eq_instructions->eq_set_complexity_level = (temp >> 1) & 0x0F;
dmix_id_present = temp & 0x01;

View file

@ -1342,30 +1342,28 @@ WORD32 impd_process_eq_set_time_domain(ia_eq_set_struct* pstr_eq_set,
WORD32 channel, FLOAT32* ptr_audio_in,
FLOAT32* ptr_audio_out,
WORD32 frame_size) {
WORD32 g = pstr_eq_set->eq_ch_group_of_channel[channel], i, j;
// FLOAT32 sum = 0.0f;
// FLOAT32 temp1 = 0.0f;
WORD32 i, j, g = 0;
if (pstr_eq_set == NULL || g < 0) return 0;
if (pstr_eq_set == NULL) return 0;
if (pstr_eq_set->domain | EQ_FILTER_DOMAIN_TIME) {
for (i = 0; i < frame_size; i++) {
impd_eq_filt_element_process(
(pstr_eq_set->filt_cascade_td[g].pstr_eq_filt_block), channel,
ptr_audio_in[i], &ptr_audio_out[i],
pstr_eq_set->filt_cascade_td[g].block_count);
g = pstr_eq_set->eq_ch_group_of_channel[channel];
for (j = 0; j < pstr_eq_set->filt_cascade_td[g].num_ph_align_filt; j++) {
impd_phase_align_filt_process(
&pstr_eq_set->filt_cascade_td[g].ph_alignment_filt[j], channel,
&ptr_audio_out[i]);
}
if (g < 0) return 0;
ptr_audio_out[i] = ptr_audio_out[i] *
pstr_eq_set->filt_cascade_td[g].cascade_gain_linear;
for (i = 0; i < frame_size; i++) {
impd_eq_filt_element_process(
(pstr_eq_set->filt_cascade_td[g].pstr_eq_filt_block), channel,
ptr_audio_in[i], &ptr_audio_out[i],
pstr_eq_set->filt_cascade_td[g].block_count);
for (j = 0; j < pstr_eq_set->filt_cascade_td[g].num_ph_align_filt; j++) {
impd_phase_align_filt_process(
&pstr_eq_set->filt_cascade_td[g].ph_alignment_filt[j], channel,
&ptr_audio_out[i]);
}
} else {
return -1;
ptr_audio_out[i] =
ptr_audio_out[i] * pstr_eq_set->filt_cascade_td[g].cascade_gain_linear;
}
return 0;
}

View file

@ -24,7 +24,6 @@
#endif
#define EQ_CHANNEL_COUNT_MAX 8
#define EQ_AUDIO_DELAY_MAX 1024
#define EQ_FIR_FILTER_SIZE_MAX 128
#define EQ_SUBBAND_COUNT_MAX 256
#define EQ_INTERMEDIATE_2ND_ORDER_PARAMS_COUNT_MAX 32
@ -38,6 +37,10 @@
#define EQ_FILTER_DOMAIN_TIME (1 << 0)
#define EQ_FILTER_DOMAIN_SUBBAND (1 << 1)
#define EQ_REAL_ZERO_CNT 63 /*Max Value of a 6 bit number*/
#define EQ_GENERIC_ZERO_CNT 63 /*Max Value of a 6 bit number*/
#define EQ_AUDIO_DELAY_MAX (EQ_REAL_ZERO_CNT + (EQ_GENERIC_ZERO_CNT * 2))
#ifdef __cplusplus
extern "C" {
#endif

View file

@ -187,7 +187,7 @@ IA_ERRORCODE impd_init_drc_decode_post_config(
}
p_drc_gain_dec_structs->eq_set = (ia_eq_set_struct*)*mem_ptr;
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr + sizeof(ia_eq_set_struct) + 32);
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr + sizeof(ia_eq_set_struct));
if (err_code) return (err_code);
@ -217,14 +217,13 @@ IA_ERRORCODE impd_init_drc_decode_post_config(
p_drc_gain_dec_structs->audio_band_buffer.non_interleaved_audio = *mem_ptr;
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
(maxMultibandAudioSignalCount * sizeof(FLOAT32*)) + 32);
(maxMultibandAudioSignalCount * sizeof(FLOAT32*)));
for (i = 0; i < maxMultibandAudioSignalCount; i++) {
p_drc_gain_dec_structs->audio_band_buffer.non_interleaved_audio[i] =
*mem_ptr;
*mem_ptr =
(pVOID)((SIZE_T)*mem_ptr +
(p_drc_params_struct->drc_frame_size * sizeof(FLOAT32)) + 32);
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
(p_drc_params_struct->drc_frame_size * sizeof(FLOAT32)));
}
p_drc_gain_dec_structs->audio_band_buffer.multiband_audio_sig_count =
maxMultibandAudioSignalCount;
@ -235,21 +234,18 @@ IA_ERRORCODE impd_init_drc_decode_post_config(
if (p_drc_params_struct->sub_band_domain_mode == SUBBAND_DOMAIN_MODE_OFF &&
p_audio_in_out_buf->audio_delay_samples) {
p_audio_in_out_buf->audio_io_buffer_delayed = *mem_ptr;
*mem_ptr =
(pVOID)((SIZE_T)*mem_ptr +
(p_audio_in_out_buf->audio_num_chan * sizeof(FLOAT32*)) + 32);
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
(p_audio_in_out_buf->audio_num_chan * sizeof(FLOAT32*)));
p_audio_in_out_buf->audio_in_out_buf = *mem_ptr;
*mem_ptr =
(pVOID)((SIZE_T)*mem_ptr +
(p_audio_in_out_buf->audio_num_chan * sizeof(FLOAT32*)) + 32);
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
(p_audio_in_out_buf->audio_num_chan * sizeof(FLOAT32*)));
for (i = 0; i < p_audio_in_out_buf->audio_num_chan; i++) {
p_audio_in_out_buf->audio_io_buffer_delayed[i] = *mem_ptr;
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
((p_audio_in_out_buf->frame_size +
p_audio_in_out_buf->audio_delay_samples) *
sizeof(FLOAT32*)) +
32);
sizeof(FLOAT32*)));
p_audio_in_out_buf->audio_in_out_buf[i] =
&p_audio_in_out_buf->audio_io_buffer_delayed
[i][p_audio_in_out_buf->audio_delay_samples];
@ -258,35 +254,29 @@ IA_ERRORCODE impd_init_drc_decode_post_config(
if (p_drc_params_struct->sub_band_domain_mode != SUBBAND_DOMAIN_MODE_OFF &&
p_audio_in_out_buf->audio_delay_sub_band_samples) {
p_audio_in_out_buf->audio_buffer_delayed_real = *mem_ptr;
*mem_ptr =
(pVOID)((SIZE_T)*mem_ptr +
(p_audio_in_out_buf->audio_num_chan * sizeof(FLOAT32*)) + 32);
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
(p_audio_in_out_buf->audio_num_chan * sizeof(FLOAT32*)));
p_audio_in_out_buf->audio_buffer_delayed_imag = *mem_ptr;
*mem_ptr =
(pVOID)((SIZE_T)*mem_ptr +
(p_audio_in_out_buf->audio_num_chan * sizeof(FLOAT32*)) + 32);
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
(p_audio_in_out_buf->audio_num_chan * sizeof(FLOAT32*)));
p_audio_in_out_buf->audio_real_buff = *mem_ptr;
*mem_ptr =
(pVOID)((SIZE_T)*mem_ptr +
(p_audio_in_out_buf->audio_num_chan * sizeof(FLOAT32*)) + 32);
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
(p_audio_in_out_buf->audio_num_chan * sizeof(FLOAT32*)));
p_audio_in_out_buf->audio_imag_buff = *mem_ptr;
*mem_ptr =
(pVOID)((SIZE_T)*mem_ptr +
(p_audio_in_out_buf->audio_num_chan * sizeof(FLOAT32*)) + 32);
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
(p_audio_in_out_buf->audio_num_chan * sizeof(FLOAT32*)));
for (i = 0; i < p_audio_in_out_buf->audio_num_chan; i++) {
p_audio_in_out_buf->audio_buffer_delayed_real[i] = *mem_ptr;
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
((p_audio_in_out_buf->audio_sub_band_frame_size +
p_audio_in_out_buf->audio_delay_sub_band_samples) *
sizeof(FLOAT32*)) +
32);
sizeof(FLOAT32*)));
p_audio_in_out_buf->audio_buffer_delayed_imag[i] = *mem_ptr;
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
((p_audio_in_out_buf->audio_sub_band_frame_size +
p_audio_in_out_buf->audio_delay_sub_band_samples) *
sizeof(FLOAT32*)) +
32);
sizeof(FLOAT32*)));
p_audio_in_out_buf->audio_real_buff[i] =
&p_audio_in_out_buf->audio_buffer_delayed_real

View file

@ -22,7 +22,7 @@
#include <string.h>
#include "impd_type_def.h"
#include "impd_error_standards.h"
#include <string.h>
#include "impd_drc_extr_delta_coded_info.h"
#include "impd_drc_common.h"
#include "impd_drc_struct.h"
@ -62,8 +62,6 @@ impd_drc_dec_interface_add_effect_type(
ia_drc_interface_struct *pstr_drc_interface, WORD32 drc_effect_type,
WORD32 target_loudness, WORD32 loud_norm);
#define NUM_GAIN_DEC_INSTANCES 2
#define BITSTREAM_FILE_FORMAT_SPLIT 1
#define LIM_DEFAULT_THRESHOLD (0.89125094f)
@ -91,6 +89,7 @@ static WORD32 impd_match_downmix(WORD32 downmix_id, WORD32 dec_downmix_id) {
}
IA_ERRORCODE impd_drc_set_default_config(ia_drc_api_struct *p_obj_drc) {
memset(p_obj_drc, 0, sizeof(*p_obj_drc));
p_obj_drc->str_config.bitstream_file_format = 0;
p_obj_drc->str_config.dec_type = 0;
p_obj_drc->str_config.sub_band_domain_mode = 0;
@ -279,79 +278,73 @@ IA_ERRORCODE impd_drc_set_struct_pointer(ia_drc_api_struct *p_obj_drc) {
p_obj_drc->str_payload.pstr_bitstream_dec =
(ia_drc_bits_dec_struct *)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_bits_dec_struct) + 32;
persistant_ptr = persistant_ptr + sizeof(ia_drc_bits_dec_struct);
p_obj_drc->str_payload.pstr_gain_dec[0] =
(ia_drc_gain_dec_struct *)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_gain_dec_struct) + 32;
persistant_ptr = persistant_ptr + sizeof(ia_drc_gain_dec_struct);
p_obj_drc->str_payload.pstr_gain_dec[1] =
(ia_drc_gain_dec_struct *)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_gain_dec_struct) + 32;
persistant_ptr = persistant_ptr + sizeof(ia_drc_gain_dec_struct);
p_obj_drc->str_payload.pstr_loudness_info =
(ia_drc_loudness_info_set_struct *)persistant_ptr;
persistant_ptr =
(SIZE_T)persistant_ptr + sizeof(ia_drc_loudness_info_set_struct) + 32;
persistant_ptr = persistant_ptr + sizeof(ia_drc_loudness_info_set_struct);
p_obj_drc->str_payload.pstr_drc_gain = (ia_drc_gain_struct *)persistant_ptr;
;
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_gain_struct) + 32;
persistant_ptr = persistant_ptr + sizeof(ia_drc_gain_struct);
p_obj_drc->str_payload.pstr_drc_interface =
(ia_drc_interface_struct *)persistant_ptr;
persistant_ptr =
(SIZE_T)persistant_ptr + sizeof(ia_drc_interface_struct) + 32;
persistant_ptr = persistant_ptr + sizeof(ia_drc_interface_struct);
p_obj_drc->str_payload.pstr_drc_config = (ia_drc_config *)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_config) + 32;
persistant_ptr = persistant_ptr + sizeof(ia_drc_config);
p_obj_drc->str_payload.pstr_selection_proc =
(ia_drc_sel_pro_struct *)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_sel_pro_struct) + 32;
persistant_ptr = persistant_ptr + sizeof(ia_drc_sel_pro_struct);
p_obj_drc->str_bit_handler.it_bit_buf = (UWORD8 *)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + 32 * 1024; /*varify the sizelater*/
persistant_ptr = persistant_ptr + MAX_BS_BUF_SIZE;
p_obj_drc->str_payload.pstr_drc_sel_proc_params =
(ia_drc_sel_proc_params_struct *)persistant_ptr;
persistant_ptr =
(SIZE_T)persistant_ptr + sizeof(ia_drc_sel_proc_params_struct);
persistant_ptr = persistant_ptr + sizeof(ia_drc_sel_proc_params_struct);
p_obj_drc->str_payload.pstr_drc_sel_proc_output =
(ia_drc_sel_proc_output_struct *)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr +
sizeof(ia_drc_sel_proc_output_struct) + 16 * 1024;
persistant_ptr = persistant_ptr + sizeof(ia_drc_sel_proc_output_struct);
p_obj_drc->str_bit_handler.bitstream_drc_config = (UWORD8 *)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + 8 * 1024;
persistant_ptr = persistant_ptr + MAX_BS_BUF_SIZE;
p_obj_drc->str_bit_handler.bitstream_loudness_info = (UWORD8 *)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + 8 * 1024;
persistant_ptr = persistant_ptr + MAX_BS_BUF_SIZE;
p_obj_drc->str_bit_handler.bitstream_unidrc_interface =
(UWORD8 *)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + 8 * 1024;
persistant_ptr = persistant_ptr + MAX_BS_BUF_SIZE;
p_obj_drc->str_payload.pstr_peak_limiter =
(ia_drc_peak_limiter_struct *)persistant_ptr;
persistant_ptr =
(SIZE_T)persistant_ptr + sizeof(ia_drc_peak_limiter_struct) + 32;
persistant_ptr = persistant_ptr + sizeof(ia_drc_peak_limiter_struct);
p_obj_drc->str_payload.pstr_peak_limiter->buffer =
(FLOAT32 *)((SIZE_T)p_obj_drc->str_payload.pstr_peak_limiter +
sizeof(ia_drc_peak_limiter_struct) + 32);
persistant_ptr = (SIZE_T)persistant_ptr + 16 * 1024;
sizeof(ia_drc_peak_limiter_struct));
persistant_ptr = persistant_ptr + PEAK_LIM_BUF_SIZE;
p_obj_drc->str_payload.pstr_qmf_filter =
(ia_drc_qmf_filt_struct *)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_qmf_filt_struct) + 32;
persistant_ptr = persistant_ptr + sizeof(ia_drc_qmf_filt_struct);
p_obj_drc->str_payload.pstr_qmf_filter->ana_buff = (FLOAT64 *)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + 16 * 1024;
persistant_ptr = persistant_ptr + ANALY_BUF_SIZE;
p_obj_drc->str_payload.pstr_qmf_filter->syn_buff = (FLOAT64 *)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + 16 * 1024;
persistant_ptr = persistant_ptr + SYNTH_BUF_SIZE;
p_obj_drc->p_state->persistant_ptr = (pVOID)persistant_ptr;
return IA_NO_ERROR;
@ -464,6 +457,7 @@ IA_ERRORCODE impd_drc_init(ia_drc_api_struct *p_obj_drc) {
p_obj_drc->str_bit_handler.num_bytes_bs_drc_config);
if (err_code == 1) {
memset(p_obj_drc->str_payload.pstr_drc_config, 0, sizeof(ia_drc_config));
err_code = impd_drc_set_default_bitstream_config(
p_obj_drc->str_payload.pstr_drc_config);
p_obj_drc->str_payload.pstr_drc_config->channel_layout

View file

@ -206,11 +206,11 @@ WORD32 impd_init_parametric_drc_feed_fwd(
return 0;
}
WORD32 impd_init_parametric_drc_lim(
VOID impd_init_parametric_drc_lim(
ia_drc_config* pstr_drc_config, WORD32 instance_idx,
WORD32 ch_count_from_dwnmix_id,
ia_parametric_drc_params_struct* p_parametricdrc_params, pVOID* mem_ptr) {
WORD32 err = 0, i = 0;
WORD32 i = 0;
UWORD32 j;
UWORD32 attack, sec_len;
@ -290,10 +290,6 @@ WORD32 impd_init_parametric_drc_lim(
j++) {
pstr_parametric_lim_type_drc_params->max_buf[j] = 0.f;
}
if (err) return (err);
return 0;
}
WORD32 impd_init_parametric_drcInstance(
@ -332,11 +328,9 @@ WORD32 impd_init_parametric_drcInstance(
p_parametricdrc_params->str_parametric_drc_instance_params[instance_idx]
.str_spline_nodes.num_nodes = p_parametricdrc_params->drc_frame_size;
err = impd_init_parametric_drc_lim(pstr_drc_config, instance_idx,
ch_count_from_dwnmix_id,
p_parametricdrc_params, mem_ptr);
if (err) return (err);
impd_init_parametric_drc_lim(pstr_drc_config, instance_idx,
ch_count_from_dwnmix_id,
p_parametricdrc_params, mem_ptr);
} else {
return (UNEXPECTED_ERROR);

View file

@ -170,27 +170,26 @@ impd_drc_uni_sel_proc_process(
for (i = SUB_DRC_COUNT - 1; i >= 0; i--) {
WORD32 drc_instructions_index =
pstr_drc_uni_sel_proc->drc_instructions_index[i];
ia_drc_instructions_struct str_drc_instruction_str;
if (drc_instructions_index < 0) continue;
str_drc_instruction_str =
pstr_drc_uni_sel_proc->drc_config
.str_drc_instruction_str[drc_instructions_index];
ia_drc_instructions_struct* str_drc_instruction_str =
&(pstr_drc_uni_sel_proc->drc_config
.str_drc_instruction_str[drc_instructions_index]);
if (drc_instructions_index >= 0 &&
str_drc_instruction_str.drc_set_id > 0) {
if (str_drc_instruction_str->drc_set_id > 0) {
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output
.sel_drc_set_ids[activeDrcSetIndex] =
str_drc_instruction_str.drc_set_id;
str_drc_instruction_str->drc_set_id;
if ((i == 3) && (str_drc_instruction_str.drc_set_effect &
if ((i == 3) && (str_drc_instruction_str->drc_set_effect &
(EFFECT_BIT_DUCK_SELF | EFFECT_BIT_DUCK_OTHER))) {
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output
.sel_downmix_ids[activeDrcSetIndex] = 0;
} else {
if (str_drc_instruction_str.drc_apply_to_dwnmix == 1) {
if (str_drc_instruction_str->drc_apply_to_dwnmix == 1) {
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output
.sel_downmix_ids[activeDrcSetIndex] =
str_drc_instruction_str.downmix_id[0];
str_drc_instruction_str->downmix_id[0];
} else {
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output
.sel_downmix_ids[activeDrcSetIndex] = 0;
@ -235,10 +234,12 @@ impd_drc_uni_sel_proc_process(
.loudness_norm_gain_modification_db;
}
for (i = 0; i < 2; i++) {
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.sel_eq_set_ids[i] =
pstr_drc_uni_sel_proc->drc_config.str_drc_config_ext
.str_eq_instructions[pstr_drc_uni_sel_proc->eq_inst_index[i]]
.eq_set_id;
if (pstr_drc_uni_sel_proc->eq_inst_index[i] >= 0) {
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.sel_eq_set_ids[i] =
pstr_drc_uni_sel_proc->drc_config.str_drc_config_ext
.str_eq_instructions[pstr_drc_uni_sel_proc->eq_inst_index[i]]
.eq_set_id;
}
}
if (pstr_drc_uni_sel_proc->loud_eq_inst_index_sel >= 0) {
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.sel_loud_eq_id =
@ -695,7 +696,7 @@ WORD32 impd_manage_drc_complexity(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
&pstr_drc_uni_sel_proc->uni_drc_sel_proc_params;
impd_select_drc_coeff3(pstr_drc_config, &str_p_loc_drc_coefficients_uni_drc);
if (str_p_loc_drc_coefficients_uni_drc == NULL) return UNEXPECTED_ERROR;
for (i = 0; i < pstr_drc_config->drc_instructions_uni_drc_count; i++) {
str_drc_instruction_str = &pstr_drc_config->str_drc_instruction_str[i];
if (str_drc_instruction_str->no_independent_use) continue;
@ -900,6 +901,8 @@ WORD32 impd_manage_complexity(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
impd_select_drc_coeff3(pstr_drc_config, &str_p_loc_drc_coefficients_uni_drc);
if (str_p_loc_drc_coefficients_uni_drc == NULL) return UNEXPECTED_ERROR;
for (p = 0; p < 4; p++) {
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.sel_drc_set_ids[p] <= 0)
continue;

View file

@ -736,7 +736,7 @@ WORD32 impd_drc_set_preselection(
ia_drc_instructions_struct* str_drc_instruction_str = NULL;
impd_select_drc_coeff3(pstr_drc_config, &str_p_loc_drc_coefficients_uni_drc);
if (str_p_loc_drc_coefficients_uni_drc == NULL) return UNEXPECTED_ERROR;
k = 0;
for (d = 0; d < num_downmix_id_requests; d++) {
err = impd_find_eq_set_no_compression(

View file

@ -1377,6 +1377,9 @@ impd_parse_loudness_measure(ia_bit_buf_struct* it_bit_buff,
if (it_bit_buff->error) return it_bit_buff->error;
loudness_measure->measurement_system = (temp >> 2) & 0xf;
if (loudness_measure->measurement_system > MEASUREMENT_SYSTEM_RESERVED_E)
return (UNEXPECTED_ERROR);
/* Parsed but unused */
loudness_measure->reliability = temp & 3;
return (0);
@ -1538,6 +1541,9 @@ impd_parse_gain_set_params(ia_bit_buf_struct* it_bit_buff, WORD32 version,
*gain_seq_idx = (*gain_seq_idx) + 1;
}
}
if (*gain_seq_idx >= SEQUENCE_COUNT_MAX) return UNEXPECTED_ERROR;
gain_set_params->gain_params[i].gain_seq_idx = *gain_seq_idx;
err = impd_parse_gain_set_params_characteristics(
it_bit_buff, version, &(gain_set_params->gain_params[i]));
@ -2013,6 +2019,8 @@ impd_parse_drc_instructions_uni_drc(
str_drc_instruction_str->drc_set_id = impd_read_bits_buf(it_bit_buff, 6);
if (it_bit_buff->error) return it_bit_buff->error;
if (str_drc_instruction_str->drc_set_id >= DRC_INSTRUCTIONS_COUNT_MAX)
return UNEXPECTED_ERROR;
if (version == 0) {
str_drc_instruction_str->drc_set_complexity_level =
DRC_COMPLEXITY_LEVEL_MAX;
@ -2144,6 +2152,8 @@ impd_parse_drc_instructions_uni_drc(
WORD32 bs_gain_set_idx;
bs_gain_set_idx = impd_read_bits_buf(it_bit_buff, 6);
if (it_bit_buff->error) return it_bit_buff->error;
if ((bs_gain_set_idx == 0) || (bs_gain_set_idx > GAIN_SET_COUNT_MAX))
return UNEXPECTED_ERROR;
str_drc_instruction_str->gain_set_index[c] = bs_gain_set_idx - 1;
impd_dec_ducking_scaling(
it_bit_buff,
@ -2295,6 +2305,9 @@ impd_parse_drc_instructions_uni_drc(
bs_gain_set_idx = (temp >> 1) & 0x7f;
repeat_gain_set_idx = temp & 1;
if ((bs_gain_set_idx == 0) || (bs_gain_set_idx > GAIN_SET_COUNT_MAX))
return UNEXPECTED_ERROR;
str_drc_instruction_str->gain_set_index[c] = bs_gain_set_idx - 1;
c++;

View file

@ -430,7 +430,7 @@ typedef struct {
WORD32 method_def;
FLOAT32 method_val;
WORD32 measurement_system;
WORD32 reliability;
WORD32 reliability; /* Parsed but unused */
} ia_loudness_measure_struct;
typedef struct {

View file

@ -82,12 +82,12 @@ VOID ixheaacd_dct3_32(WORD32 *input, WORD32 *output,
for (n = 1; n < DCT3_LEN / 2; n++) {
temp1[0] = *ptr_forward++;
temp1[1] = *ptr_reverse--;
temp1[0] = ixheaacd_add32(ixheaacd_shr32(temp1[0], LP_SHIFT_VAL),
temp1[0] = ixheaacd_add32_sat(ixheaacd_shr32(temp1[0], LP_SHIFT_VAL),
ixheaacd_shr32(temp1[1], LP_SHIFT_VAL));
temp1[2] = *(ptr_forward - 33);
temp1[3] = *(ptr_reverse - 31);
temp1[1] = ixheaacd_sub32(ixheaacd_shr32(temp1[2], LP_SHIFT_VAL),
temp1[1] = ixheaacd_sub32_sat(ixheaacd_shr32(temp1[2], LP_SHIFT_VAL),
ixheaacd_shr32(temp1[3], LP_SHIFT_VAL));
twid_re = *twidle_fwd++;
@ -107,7 +107,7 @@ VOID ixheaacd_dct3_32(WORD32 *input, WORD32 *output,
temp1[1] = *ptr_reverse--;
temp1[0] = *(ptr_reverse - 31);
temp1[1] = ixheaacd_sub32(ixheaacd_shr32(temp1[1], LP_SHIFT_VAL),
temp1[1] = ixheaacd_sub32_sat(ixheaacd_shr32(temp1[1], LP_SHIFT_VAL),
ixheaacd_shr32(temp1[0], LP_SHIFT_VAL));
temp1[0] = temp1[1];
@ -292,7 +292,7 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
wim = *p_sin_cos++;
wre = *p_sin_cos++;
*psubband_t++ = ixheaacd_add32(ixheaacd_mult32x16in32(re, wre),
*psubband_t++ = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wre),
ixheaacd_mult32x16in32(im, wim));
*psubband_t++ = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wre),
ixheaacd_mult32x16in32(re, wim));
@ -302,7 +302,7 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
*psubband_t2++ = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wim),
ixheaacd_mult32x16in32(re, wre));
*psubband_t2++ = ixheaacd_add32(ixheaacd_mult32x16in32(re, wim),
*psubband_t2++ = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wim),
ixheaacd_mult32x16in32(im, wre));
re = *psubband1--;
@ -313,13 +313,13 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
*psubband1_t-- = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wre),
ixheaacd_mult32x16in32(re, wim));
*psubband1_t-- = ixheaacd_add32(ixheaacd_mult32x16in32(re, wre),
*psubband1_t-- = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wre),
ixheaacd_mult32x16in32(im, wim));
re = *psubband12--;
im = *psubband2++;
*psubband1_t2-- = ixheaacd_add32(ixheaacd_mult32x16in32(re, wim),
*psubband1_t2-- = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wim),
ixheaacd_mult32x16in32(im, wre));
*psubband1_t2-- = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wim),
ixheaacd_mult32x16in32(re, wre));
@ -330,7 +330,7 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
wim = *p_sin_cos++;
wre = *p_sin_cos++;
*psubband_t++ = ixheaacd_add32(ixheaacd_mult32x16in32(re, wre),
*psubband_t++ = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wre),
ixheaacd_mult32x16in32(im, wim));
*psubband_t++ = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wre),
ixheaacd_mult32x16in32(re, wim));
@ -340,7 +340,7 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
*psubband_t2++ = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wim),
ixheaacd_mult32x16in32(re, wre));
*psubband_t2++ = ixheaacd_add32(ixheaacd_mult32x16in32(re, wim),
*psubband_t2++ = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wim),
ixheaacd_mult32x16in32(im, wre));
re = *psubband1--;
@ -351,14 +351,14 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
*psubband1_t-- = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wre),
ixheaacd_mult32x16in32(re, wim));
*psubband1_t-- = ixheaacd_add32(ixheaacd_mult32x16in32(re, wre),
*psubband1_t-- = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wre),
ixheaacd_mult32x16in32(im, wim));
re = *psubband12--;
im = *psubband2++;
;
*psubband1_t2-- = ixheaacd_add32(ixheaacd_mult32x16in32(re, wim),
*psubband1_t2-- = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wim),
ixheaacd_mult32x16in32(im, wre));
*psubband1_t2-- = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wim),
ixheaacd_mult32x16in32(re, wre));
@ -399,7 +399,7 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
im = *psubband1;
*psubband1-- = ixheaacd_add32(ixheaacd_mult32x16in32(re, wre),
*psubband1-- = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wre),
ixheaacd_mult32x16in32(im, wim));
*psubband++ = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wre),
ixheaacd_mult32x16in32(re, wim));
@ -417,7 +417,7 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
im = *psubband12;
*psubband2++ = ixheaacd_negate32_sat(ixheaacd_add32(
*psubband2++ = ixheaacd_negate32_sat(ixheaacd_add32_sat(
ixheaacd_mult32x16in32(re, wre), ixheaacd_mult32x16in32(im, wim)));
*psubband12-- = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(re, wim),
ixheaacd_mult32x16in32(im, wre));
@ -429,7 +429,7 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
re2 = *psubband1;
*psubband++ = ixheaacd_add32(ixheaacd_mult32x16in32(re, wim),
*psubband++ = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wim),
ixheaacd_mult32x16in32(im, wre));
*psubband1-- = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wim),
ixheaacd_mult32x16in32(re, wre));
@ -440,7 +440,7 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
re3 = *psubband12;
*psubband12-- = ixheaacd_negate32_sat(ixheaacd_add32(
*psubband12-- = ixheaacd_negate32_sat(ixheaacd_add32_sat(
ixheaacd_mult32x16in32(re, wim), ixheaacd_mult32x16in32(im, wre)));
*psubband2++ = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(re, wre),
ixheaacd_mult32x16in32(im, wim));
@ -449,14 +449,14 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
wre = *p_sin++;
im = psubband1[0];
*psubband1-- = ixheaacd_add32(ixheaacd_mult32x16in32(re2, wre),
*psubband1-- = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re2, wre),
ixheaacd_mult32x16in32(im, wim));
*psubband++ = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wre),
ixheaacd_mult32x16in32(re2, wim));
im = psubband12[0];
*psubband2++ = ixheaacd_negate32_sat(ixheaacd_add32(
*psubband2++ = ixheaacd_negate32_sat(ixheaacd_add32_sat(
ixheaacd_mult32x16in32(re3, wre), ixheaacd_mult32x16in32(im, wim)));
*psubband12-- = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(re3, wim),
ixheaacd_mult32x16in32(im, wre));
@ -480,7 +480,7 @@ VOID ixheaacd_fwd_modulation(const WORD32 *p_time_in1, WORD32 *real_subband,
*t_real_subband++ = ixheaacd_sub32_sat(temp1, temp2);
*t_imag_subband++ = ixheaacd_add32(temp1, temp2);
*t_imag_subband++ = ixheaacd_add32_sat(temp1, temp2);
}
ixheaacd_cos_sin_mod(real_subband, qmf_bank, qmf_dec_tables_ptr->w_16,
@ -496,7 +496,7 @@ VOID ixheaacd_fwd_modulation(const WORD32 *p_time_in1, WORD32 *real_subband,
im = *imag_subband;
cosh = *tcos++;
sinh = *tcos++;
*real_subband++ = ixheaacd_add32(ixheaacd_mult32x16in32_shl(re, cosh),
*real_subband++ = ixheaacd_add32_sat(ixheaacd_mult32x16in32_shl(re, cosh),
ixheaacd_mult32x16in32_shl(im, sinh));
*imag_subband++ = ixheaacd_sub32_sat(ixheaacd_mult32x16in32_shl(im, cosh),
ixheaacd_mult32x16in32_shl(re, sinh));
@ -511,13 +511,13 @@ VOID ixheaacd_sbr_qmfanal32_winadd(WORD16 *inp1, WORD16 *inp2, WORD16 *p_qmf1,
WORD32 accu;
accu = ixheaacd_mult16x16in32(inp1[n + 0], p_qmf1[2 * (n + 0)]);
accu = ixheaacd_add32(
accu = ixheaacd_add32_sat(
accu, ixheaacd_mult16x16in32(inp1[n + 64], p_qmf1[2 * (n + 64)]));
accu = ixheaacd_add32(
accu = ixheaacd_add32_sat(
accu, ixheaacd_mult16x16in32(inp1[n + 128], p_qmf1[2 * (n + 128)]));
accu = ixheaacd_add32(
accu = ixheaacd_add32_sat(
accu, ixheaacd_mult16x16in32(inp1[n + 192], p_qmf1[2 * (n + 192)]));
accu = ixheaacd_add32(
accu = ixheaacd_add32_sat(
accu, ixheaacd_mult16x16in32(inp1[n + 256], p_qmf1[2 * (n + 256)]));
p_out[n] = accu;
@ -537,13 +537,13 @@ VOID ixheaacd_sbr_qmfanal32_winadd(WORD16 *inp1, WORD16 *inp2, WORD16 *p_qmf1,
p_out[n + 1] = accu;
accu = ixheaacd_mult16x16in32(inp2[n + 0], p_qmf2[2 * (n + 0)]);
accu = ixheaacd_add32(
accu = ixheaacd_add32_sat(
accu, ixheaacd_mult16x16in32(inp2[n + 64], p_qmf2[2 * (n + 64)]));
accu = ixheaacd_add32(
accu = ixheaacd_add32_sat(
accu, ixheaacd_mult16x16in32(inp2[n + 128], p_qmf2[2 * (n + 128)]));
accu = ixheaacd_add32(
accu = ixheaacd_add32_sat(
accu, ixheaacd_mult16x16in32(inp2[n + 192], p_qmf2[2 * (n + 192)]));
accu = ixheaacd_add32(
accu = ixheaacd_add32_sat(
accu, ixheaacd_mult16x16in32(inp2[n + 256], p_qmf2[2 * (n + 256)]));
p_out[n + 32] = accu;
@ -776,34 +776,34 @@ VOID ixheaacd_esbr_radix4bfly(const WORD32 *w, WORD32 *x, WORD32 index1,
x_l1_0 = x[l1];
x_l2_0 = x[l2];
xh0_0 = x_0 + x_l1_0;
xl0_0 = x_0 - x_l1_0;
xh0_0 = ixheaacd_add32_sat(x_0, x_l1_0);
xl0_0 = ixheaacd_sub32_sat(x_0, x_l1_0);
xh20_0 = x_h2_0 + x_l2_0;
xl20_0 = x_h2_0 - x_l2_0;
xh20_0 = ixheaacd_add32_sat(x_h2_0, x_l2_0);
xl20_0 = ixheaacd_sub32_sat(x_h2_0, x_l2_0);
x[0] = xh0_0 + xh20_0;
xt0_0 = xh0_0 - xh20_0;
x[0] = ixheaacd_add32_sat(xh0_0, xh20_0);
xt0_0 = ixheaacd_sub32_sat(xh0_0, xh20_0);
x_1 = x[1];
x_h2_1 = x[h2 + 1];
x_l1_1 = x[l1 + 1];
x_l2_1 = x[l2 + 1];
xh1_0 = x_1 + x_l1_1;
xl1_0 = x_1 - x_l1_1;
xh1_0 = ixheaacd_add32_sat(x_1, x_l1_1);
xl1_0 = ixheaacd_sub32_sat(x_1, x_l1_1);
xh21_0 = x_h2_1 + x_l2_1;
xl21_0 = x_h2_1 - x_l2_1;
xh21_0 = ixheaacd_add32_sat(x_h2_1, x_l2_1);
xl21_0 = ixheaacd_sub32_sat(x_h2_1, x_l2_1);
x[1] = xh1_0 + xh21_0;
yt0_0 = xh1_0 - xh21_0;
x[1] = ixheaacd_add32_sat(xh1_0, xh21_0);
yt0_0 = ixheaacd_sub32_sat(xh1_0, xh21_0);
xt1_0 = xl0_0 + xl21_0;
xt2_0 = xl0_0 - xl21_0;
xt1_0 = ixheaacd_add32_sat(xl0_0, xl21_0);
xt2_0 = ixheaacd_sub32_sat(xl0_0, xl21_0);
yt2_0 = xl1_0 + xl20_0;
yt1_0 = xl1_0 - xl20_0;
yt2_0 = ixheaacd_add32_sat(xl1_0, xl20_0);
yt1_0 = ixheaacd_sub32_sat(xl1_0, xl20_0);
mul_11 = ixheaacd_mult64(xt2_0, co30);
mul_3 = ixheaacd_mult64(yt2_0, si30);
@ -873,14 +873,14 @@ VOID ixheaacd_esbr_postradixcompute2(WORD32 *ptr_y, WORD32 *ptr_x,
x_6 = *x0++;
x_7 = *x0++;
n00 = x_0 + x_2;
n01 = x_1 + x_3;
n20 = x_0 - x_2;
n21 = x_1 - x_3;
n10 = x_4 + x_6;
n11 = x_5 + x_7;
n30 = x_4 - x_6;
n31 = x_5 - x_7;
n00 = ixheaacd_add32_sat(x_0, x_2);
n01 = ixheaacd_add32_sat(x_1, x_3);
n20 = ixheaacd_sub32_sat(x_0, x_2);
n21 = ixheaacd_sub32_sat(x_1, x_3);
n10 = ixheaacd_add32_sat(x_4, x_6);
n11 = ixheaacd_add32_sat(x_5, x_7);
n30 = ixheaacd_sub32_sat(x_4, x_6);
n31 = ixheaacd_sub32_sat(x_5, x_7);
y0[h2] = n00;
y0[h2 + 1] = n01;
@ -900,14 +900,14 @@ VOID ixheaacd_esbr_postradixcompute2(WORD32 *ptr_y, WORD32 *ptr_x,
x_e = *x2++;
x_f = *x2++;
n02 = x_8 + x_a;
n03 = x_9 + x_b;
n22 = x_8 - x_a;
n23 = x_9 - x_b;
n12 = x_c + x_e;
n13 = x_d + x_f;
n32 = x_c - x_e;
n33 = x_d - x_f;
n02 = ixheaacd_add32_sat(x_8, x_a);
n03 = ixheaacd_add32_sat(x_9, x_b);
n22 = ixheaacd_sub32_sat(x_8, x_a);
n23 = ixheaacd_sub32_sat(x_9, x_b);
n12 = ixheaacd_add32_sat(x_c, x_e);
n13 = ixheaacd_add32_sat(x_d, x_f);
n32 = ixheaacd_sub32_sat(x_c, x_e);
n33 = ixheaacd_sub32_sat(x_d, x_f);
y0[h2 + 2] = n02;
y0[h2 + 3] = n03;
@ -963,23 +963,23 @@ VOID ixheaacd_esbr_postradixcompute4(WORD32 *ptr_y, WORD32 *ptr_x,
x_6 = *x0++;
x_7 = *x0++;
xh0_0 = x_0 + x_4;
xh1_0 = x_1 + x_5;
xl0_0 = x_0 - x_4;
xl1_0 = x_1 - x_5;
xh0_1 = x_2 + x_6;
xh1_1 = x_3 + x_7;
xl0_1 = x_2 - x_6;
xl1_1 = x_3 - x_7;
xh0_0 = ixheaacd_add32_sat(x_0, x_4);
xh1_0 = ixheaacd_add32_sat(x_1, x_5);
xl0_0 = ixheaacd_sub32_sat(x_0, x_4);
xl1_0 = ixheaacd_sub32_sat(x_1, x_5);
xh0_1 = ixheaacd_add32_sat(x_2, x_6);
xh1_1 = ixheaacd_add32_sat(x_3, x_7);
xl0_1 = ixheaacd_sub32_sat(x_2, x_6);
xl1_1 = ixheaacd_sub32_sat(x_3, x_7);
n00 = xh0_0 + xh0_1;
n01 = xh1_0 + xh1_1;
n10 = xl0_0 + xl1_1;
n11 = xl1_0 - xl0_1;
n20 = xh0_0 - xh0_1;
n21 = xh1_0 - xh1_1;
n30 = xl0_0 - xl1_1;
n31 = xl1_0 + xl0_1;
n00 = ixheaacd_add32_sat(xh0_0, xh0_1);
n01 = ixheaacd_add32_sat(xh1_0, xh1_1);
n10 = ixheaacd_add32_sat(xl0_0, xl1_1);
n11 = ixheaacd_sub32_sat(xl1_0, xl0_1);
n20 = ixheaacd_sub32_sat(xh0_0, xh0_1);
n21 = ixheaacd_sub32_sat(xh1_0, xh1_1);
n30 = ixheaacd_sub32_sat(xl0_0, xl1_1);
n31 = ixheaacd_add32_sat(xl1_0, xl0_1);
y0[h2] = n00;
y0[h2 + 1] = n01;
@ -999,23 +999,23 @@ VOID ixheaacd_esbr_postradixcompute4(WORD32 *ptr_y, WORD32 *ptr_x,
x_e = *x2++;
x_f = *x2++;
xh0_2 = x_8 + x_c;
xh1_2 = x_9 + x_d;
xl0_2 = x_8 - x_c;
xl1_2 = x_9 - x_d;
xh0_3 = x_a + x_e;
xh1_3 = x_b + x_f;
xl0_3 = x_a - x_e;
xl1_3 = x_b - x_f;
xh0_2 = ixheaacd_add32_sat(x_8, x_c);
xh1_2 = ixheaacd_add32_sat(x_9, x_d);
xl0_2 = ixheaacd_sub32_sat(x_8, x_c);
xl1_2 = ixheaacd_sub32_sat(x_9, x_d);
xh0_3 = ixheaacd_add32_sat(x_a, x_e);
xh1_3 = ixheaacd_add32_sat(x_b, x_f);
xl0_3 = ixheaacd_sub32_sat(x_a, x_e);
xl1_3 = ixheaacd_sub32_sat(x_b, x_f);
n02 = xh0_2 + xh0_3;
n03 = xh1_2 + xh1_3;
n12 = xl0_2 + xl1_3;
n13 = xl1_2 - xl0_3;
n22 = xh0_2 - xh0_3;
n23 = xh1_2 - xh1_3;
n32 = xl0_2 - xl1_3;
n33 = xl1_2 + xl0_3;
n02 = ixheaacd_add32_sat(xh0_2, xh0_3);
n03 = ixheaacd_add32_sat(xh1_2, xh1_3);
n12 = ixheaacd_add32_sat(xl0_2, xl1_3);
n13 = ixheaacd_sub32_sat(xl1_2, xl0_3);
n22 = ixheaacd_sub32_sat(xh0_2, xh0_3);
n23 = ixheaacd_sub32_sat(xh1_2, xh1_3);
n32 = ixheaacd_sub32_sat(xl0_2, xl1_3);
n33 = ixheaacd_add32_sat(xl1_2, xl0_3);
y0[h2 + 2] = n02;
y0[h2 + 3] = n03;
@ -1349,7 +1349,7 @@ VOID ixheaacd_esbr_fwd_modulation(
*t_real_subband++ = ixheaacd_sub32_sat(temp1, temp2);
*t_imag_subband++ = ixheaacd_add32(temp1, temp2);
*t_imag_subband++ = ixheaacd_add32_sat(temp1, temp2);
}
ixheaacd_esbr_cos_sin_mod(real_subband, qmf_bank,
@ -1386,26 +1386,26 @@ VOID ixheaacd_sbr_qmfsyn64_winadd(WORD16 *tmp1, WORD16 *tmp2, WORD16 *inp1,
for (k = 0; k < 64; k++) {
WORD32 syn_out = rounding_fac;
syn_out = ixheaacd_add32(syn_out,
syn_out = ixheaacd_add32_sat(syn_out,
ixheaacd_mult16x16in32(tmp1[0 + k], inp1[k + 0]));
syn_out = ixheaacd_add32(
syn_out = ixheaacd_add32_sat(
syn_out, ixheaacd_mult16x16in32(tmp1[256 + k], inp1[k + 128]));
syn_out = ixheaacd_add32(
syn_out = ixheaacd_add32_sat(
syn_out, ixheaacd_mult16x16in32(tmp1[512 + k], inp1[k + 256]));
syn_out = ixheaacd_add32(
syn_out = ixheaacd_add32_sat(
syn_out, ixheaacd_mult16x16in32(tmp1[768 + k], inp1[k + 384]));
syn_out = ixheaacd_add32(
syn_out = ixheaacd_add32_sat(
syn_out, ixheaacd_mult16x16in32(tmp1[1024 + k], inp1[k + 512]));
syn_out = ixheaacd_add32(
syn_out = ixheaacd_add32_sat(
syn_out, ixheaacd_mult16x16in32(tmp2[128 + k], inp1[k + 64]));
syn_out = ixheaacd_add32(
syn_out = ixheaacd_add32_sat(
syn_out, ixheaacd_mult16x16in32(tmp2[384 + k], inp1[k + 192]));
syn_out = ixheaacd_add32(
syn_out = ixheaacd_add32_sat(
syn_out, ixheaacd_mult16x16in32(tmp2[640 + k], inp1[k + 320]));
syn_out = ixheaacd_add32(
syn_out = ixheaacd_add32_sat(
syn_out, ixheaacd_mult16x16in32(tmp2[896 + k], inp1[k + 448]));
syn_out = ixheaacd_add32(
syn_out = ixheaacd_add32_sat(
syn_out, ixheaacd_mult16x16in32(tmp2[1152 + k], inp1[k + 576]));
sample_buffer[ch_fac * k] = (ixheaacd_shl32_sat(syn_out, shift) >> 16);
@ -1488,19 +1488,19 @@ VOID ixheaacd_shiftrountine_with_rnd(WORD32 *qmf_real, WORD32 *qmf_imag,
r1 = *qmf_real++;
i1 = *qmf_imag++;
timag = ixheaacd_add32(i1, r1);
timag = ixheaacd_add32_sat(i1, r1);
timag = (ixheaacd_shl32_sat(timag, shift));
filter_states_rev[j] = ixheaacd_round16(timag);
treal = ixheaacd_sub32(i2, r2);
treal = ixheaacd_sub32_sat(i2, r2);
treal = (ixheaacd_shl32_sat(treal, shift));
filter_states[j] = ixheaacd_round16(treal);
treal = ixheaacd_sub32(i1, r1);
treal = ixheaacd_sub32_sat(i1, r1);
treal = (ixheaacd_shl32_sat(treal, shift));
*filter_states++ = ixheaacd_round16(treal);
timag = ixheaacd_add32(i2, r2);
timag = ixheaacd_add32_sat(i2, r2);
;
timag = (ixheaacd_shl32_sat(timag, shift));
*filter_states_rev++ = ixheaacd_round16(timag);
@ -1521,19 +1521,19 @@ VOID ixheaacd_shiftrountine_with_rnd_eld(WORD32 *qmf_real, WORD32 *qmf_imag,
r1 = *qmf_real++;
i1 = *qmf_imag++;
timag = ixheaacd_negate32(ixheaacd_add32(i1, r1));
timag = ixheaacd_negate32(ixheaacd_add32_sat(i1, r1));
timag = (ixheaacd_shl32_sat(timag, shift));
filter_states_rev[j] = ixheaacd_round16(timag);
treal = ixheaacd_sub32(r2, i2);
treal = ixheaacd_sub32_sat(r2, i2);
treal = (ixheaacd_shl32_sat(treal, shift));
filter_states[j] = ixheaacd_round16(treal);
treal = ixheaacd_sub32(r1, i1);
treal = ixheaacd_sub32_sat(r1, i1);
treal = (ixheaacd_shl32_sat(treal, shift));
*filter_states++ = ixheaacd_round16(treal);
timag = ixheaacd_negate32(ixheaacd_add32(i2, r2));
timag = ixheaacd_negate32(ixheaacd_add32_sat(i2, r2));
timag = (ixheaacd_shl32_sat(timag, shift));
*filter_states_rev++ = ixheaacd_round16(timag);
}
@ -1553,19 +1553,19 @@ VOID ixheaacd_shiftrountine_with_rnd_hq(WORD32 *qmf_real, WORD32 *qmf_imag,
r1 = *qmf_real++;
i1 = *qmf_imag++;
timag = ixheaacd_add32(i1, r1);
timag = ixheaacd_add32_sat(i1, r1);
timag = (ixheaacd_shl32_sat(timag, shift));
filter_states_rev[j] = timag;
treal = ixheaacd_sub32(i2, r2);
treal = ixheaacd_sub32_sat(i2, r2);
treal = (ixheaacd_shl32_sat(treal, shift));
filter_states[j] = treal;
treal = ixheaacd_sub32(i1, r1);
treal = ixheaacd_sub32_sat(i1, r1);
treal = (ixheaacd_shl32_sat(treal, shift));
*filter_states++ = treal;
timag = ixheaacd_add32(i2, r2);
timag = ixheaacd_add32_sat(i2, r2);
timag = (ixheaacd_shl32_sat(timag, shift));
*filter_states_rev++ = timag;
}
@ -1613,34 +1613,34 @@ VOID ixheaacd_radix4bfly(const WORD16 *w, WORD32 *x, WORD32 index1,
x_l1_0 = x[l1];
x_l2_0 = x[l2];
xh0_0 = x_0 + x_l1_0;
xl0_0 = x_0 - x_l1_0;
xh0_0 = ixheaacd_add32_sat(x_0, x_l1_0);
xl0_0 = ixheaacd_sub32_sat(x_0, x_l1_0);
xh20_0 = x_h2_0 + x_l2_0;
xl20_0 = x_h2_0 - x_l2_0;
xh20_0 = ixheaacd_add32_sat(x_h2_0, x_l2_0);
xl20_0 = ixheaacd_sub32_sat(x_h2_0, x_l2_0);
x[0] = xh0_0 + xh20_0;
xt0_0 = xh0_0 - xh20_0;
x[0] = ixheaacd_add32_sat(xh0_0, xh20_0);
xt0_0 = ixheaacd_sub32_sat(xh0_0, xh20_0);
x_1 = x[1];
x_h2_1 = x[h2 + 1];
x_l1_1 = x[l1 + 1];
x_l2_1 = x[l2 + 1];
xh1_0 = x_1 + x_l1_1;
xl1_0 = x_1 - x_l1_1;
xh1_0 = ixheaacd_add32_sat(x_1, x_l1_1);
xl1_0 = ixheaacd_sub32_sat(x_1, x_l1_1);
xh21_0 = x_h2_1 + x_l2_1;
xl21_0 = x_h2_1 - x_l2_1;
xh21_0 = ixheaacd_add32_sat(x_h2_1, x_l2_1);
xl21_0 = ixheaacd_sub32_sat(x_h2_1, x_l2_1);
x[1] = xh1_0 + xh21_0;
yt0_0 = xh1_0 - xh21_0;
x[1] = ixheaacd_add32_sat(xh1_0, xh21_0);
yt0_0 = ixheaacd_sub32_sat(xh1_0, xh21_0);
xt1_0 = xl0_0 + xl21_0;
xt2_0 = xl0_0 - xl21_0;
xt1_0 = ixheaacd_add32_sat(xl0_0, xl21_0);
xt2_0 = ixheaacd_sub32_sat(xl0_0, xl21_0);
yt2_0 = xl1_0 + xl20_0;
yt1_0 = xl1_0 - xl20_0;
yt2_0 = ixheaacd_add32_sat(xl1_0, xl20_0);
yt1_0 = ixheaacd_sub32_sat(xl1_0, xl20_0);
mul_11 = ixheaacd_mult32x16in32(xt2_0, co30);
mul_3 = ixheaacd_mult32x16in32(yt2_0, si30);
@ -1712,23 +1712,23 @@ VOID ixheaacd_postradixcompute4(WORD32 *ptr_y, WORD32 *ptr_x,
x_6 = *x0++;
x_7 = *x0++;
xh0_0 = x_0 + x_4;
xh1_0 = x_1 + x_5;
xl0_0 = x_0 - x_4;
xl1_0 = x_1 - x_5;
xh0_1 = x_2 + x_6;
xh1_1 = x_3 + x_7;
xl0_1 = x_2 - x_6;
xl1_1 = x_3 - x_7;
xh0_0 = ixheaacd_add32_sat(x_0, x_4);
xh1_0 = ixheaacd_add32_sat(x_1, x_5);
xl0_0 = ixheaacd_sub32_sat(x_0, x_4);
xl1_0 = ixheaacd_sub32_sat(x_1, x_5);
xh0_1 = ixheaacd_add32_sat(x_2, x_6);
xh1_1 = ixheaacd_add32_sat(x_3, x_7);
xl0_1 = ixheaacd_sub32_sat(x_2, x_6);
xl1_1 = ixheaacd_sub32_sat(x_3, x_7);
n00 = xh0_0 + xh0_1;
n01 = xh1_0 + xh1_1;
n10 = xl0_0 + xl1_1;
n11 = xl1_0 - xl0_1;
n20 = xh0_0 - xh0_1;
n21 = xh1_0 - xh1_1;
n30 = xl0_0 - xl1_1;
n31 = xl1_0 + xl0_1;
n00 = ixheaacd_add32_sat(xh0_0, xh0_1);
n01 = ixheaacd_add32_sat(xh1_0, xh1_1);
n10 = ixheaacd_add32_sat(xl0_0, xl1_1);
n11 = ixheaacd_sub32_sat(xl1_0, xl0_1);
n20 = ixheaacd_sub32_sat(xh0_0, xh0_1);
n21 = ixheaacd_sub32_sat(xh1_0, xh1_1);
n30 = ixheaacd_sub32_sat(xl0_0, xl1_1);
n31 = ixheaacd_add32_sat(xl1_0, xl0_1);
y0[h2] = n00;
y0[h2 + 1] = n01;
@ -1748,23 +1748,23 @@ VOID ixheaacd_postradixcompute4(WORD32 *ptr_y, WORD32 *ptr_x,
x_e = *x2++;
x_f = *x2++;
xh0_2 = x_8 + x_c;
xh1_2 = x_9 + x_d;
xl0_2 = x_8 - x_c;
xl1_2 = x_9 - x_d;
xh0_3 = x_a + x_e;
xh1_3 = x_b + x_f;
xl0_3 = x_a - x_e;
xl1_3 = x_b - x_f;
xh0_2 = ixheaacd_add32_sat(x_8, x_c);
xh1_2 = ixheaacd_add32_sat(x_9, x_d);
xl0_2 = ixheaacd_sub32_sat(x_8, x_c);
xl1_2 = ixheaacd_sub32_sat(x_9, x_d);
xh0_3 = ixheaacd_add32_sat(x_a, x_e);
xh1_3 = ixheaacd_add32_sat(x_b, x_f);
xl0_3 = ixheaacd_sub32_sat(x_a, x_e);
xl1_3 = ixheaacd_sub32_sat(x_b, x_f);
n02 = xh0_2 + xh0_3;
n03 = xh1_2 + xh1_3;
n12 = xl0_2 + xl1_3;
n13 = xl1_2 - xl0_3;
n22 = xh0_2 - xh0_3;
n23 = xh1_2 - xh1_3;
n32 = xl0_2 - xl1_3;
n33 = xl1_2 + xl0_3;
n02 = ixheaacd_add32_sat(xh0_2, xh0_3);
n03 = ixheaacd_add32_sat(xh1_2, xh1_3);
n12 = ixheaacd_add32_sat(xl0_2, xl1_3);
n13 = ixheaacd_sub32_sat(xl1_2, xl0_3);
n22 = ixheaacd_sub32_sat(xh0_2, xh0_3);
n23 = ixheaacd_sub32_sat(xh1_2, xh1_3);
n32 = ixheaacd_sub32_sat(xl0_2, xl1_3);
n33 = ixheaacd_add32_sat(xl1_2, xl0_3);
y0[h2 + 2] = n02;
y0[h2 + 3] = n03;
@ -1816,14 +1816,14 @@ VOID ixheaacd_postradixcompute2(WORD32 *ptr_y, WORD32 *ptr_x,
x_6 = *x0++;
x_7 = *x0++;
n00 = x_0 + x_2;
n01 = x_1 + x_3;
n20 = x_0 - x_2;
n21 = x_1 - x_3;
n10 = x_4 + x_6;
n11 = x_5 + x_7;
n30 = x_4 - x_6;
n31 = x_5 - x_7;
n00 = ixheaacd_add32_sat(x_0, x_2);
n01 = ixheaacd_add32_sat(x_1, x_3);
n20 = ixheaacd_sub32_sat(x_0, x_2);
n21 = ixheaacd_sub32_sat(x_1, x_3);
n10 = ixheaacd_add32_sat(x_4, x_6);
n11 = ixheaacd_add32_sat(x_5, x_7);
n30 = ixheaacd_sub32_sat(x_4, x_6);
n31 = ixheaacd_sub32_sat(x_5, x_7);
y0[h2] = n00;
y0[h2 + 1] = n01;
@ -1843,14 +1843,14 @@ VOID ixheaacd_postradixcompute2(WORD32 *ptr_y, WORD32 *ptr_x,
x_e = *x2++;
x_f = *x2++;
n02 = x_8 + x_a;
n03 = x_9 + x_b;
n22 = x_8 - x_a;
n23 = x_9 - x_b;
n12 = x_c + x_e;
n13 = x_d + x_f;
n32 = x_c - x_e;
n33 = x_d - x_f;
n02 = ixheaacd_add32_sat(x_8, x_a);
n03 = ixheaacd_add32_sat(x_9, x_b);
n22 = ixheaacd_sub32_sat(x_8, x_a);
n23 = ixheaacd_sub32_sat(x_9, x_b);
n12 = ixheaacd_add32_sat(x_c, x_e);
n13 = ixheaacd_add32_sat(x_d, x_f);
n32 = ixheaacd_sub32_sat(x_c, x_e);
n33 = ixheaacd_sub32_sat(x_d, x_f);
y0[h2 + 2] = n02;
y0[h2 + 3] = n03;

View file

@ -2246,55 +2246,59 @@ VOID ixheaacd_fft_15_ld_dec(WORD32 *inp, WORD32 *op, WORD32 *fft3out,
*buf1++ = inp[384];
*buf1++ = inp[385];
r1 = buf1a[2] + buf1a[8];
r4 = buf1a[2] - buf1a[8];
r3 = buf1a[4] + buf1a[6];
r2 = buf1a[4] - buf1a[6];
r1 = ixheaacd_add32_sat(buf1a[2], buf1a[8]);
r4 = ixheaacd_sub32_sat(buf1a[2], buf1a[8]);
r3 = ixheaacd_add32_sat(buf1a[4], buf1a[6]);
r2 = ixheaacd_sub32_sat(buf1a[4], buf1a[6]);
t = ixheaacd_mult32_shl((r1 - r3), cos_54);
t = ixheaacd_mult32_shl(ixheaacd_sub32_sat(r1, r3), cos_54);
r1 = r1 + r3;
r1 = ixheaacd_add32_sat(r1, r3);
temp1 = buf1a[0] + r1;
temp1 = ixheaacd_add32_sat(buf1a[0], r1);
r1 = temp1 + ((ixheaacd_mult32_shl(r1, cos_55)) << 1);
r1 = ixheaacd_add32_sat(
temp1, ixheaacd_shl32_sat((ixheaacd_mult32_shl(r1, cos_55)), 1));
r3 = r1 - t;
r1 = r1 + t;
r3 = ixheaacd_sub32_sat(r1, t);
r1 = ixheaacd_add32_sat(r1, t);
t = ixheaacd_mult32_shl((r4 + r2), cos_51);
r4 = t + (ixheaacd_mult32_shl(r4, cos_52) << 1);
r2 = t + ixheaacd_mult32_shl(r2, cos_53);
t = ixheaacd_mult32_shl(ixheaacd_add32_sat(r4, r2), cos_51);
r4 = ixheaacd_add32_sat(
t, ixheaacd_shl32_sat(ixheaacd_mult32_shl(r4, cos_52), 1));
r2 = ixheaacd_add32_sat(t, ixheaacd_mult32_shl(r2, cos_53));
s1 = buf1a[3] + buf1a[9];
s4 = buf1a[3] - buf1a[9];
s3 = buf1a[5] + buf1a[7];
s2 = buf1a[5] - buf1a[7];
s1 = ixheaacd_add32_sat(buf1a[3], buf1a[9]);
s4 = ixheaacd_sub32_sat(buf1a[3], buf1a[9]);
s3 = ixheaacd_add32_sat(buf1a[5], buf1a[7]);
s2 = ixheaacd_sub32_sat(buf1a[5], buf1a[7]);
t = ixheaacd_mult32_shl((s1 - s3), cos_54);
s1 = s1 + s3;
t = ixheaacd_mult32_shl(ixheaacd_sub32_sat(s1, s3), cos_54);
s1 = ixheaacd_add32_sat(s1, s3);
temp2 = buf1a[1] + s1;
temp2 = ixheaacd_add32_sat(buf1a[1], s1);
s1 = temp2 + ((ixheaacd_mult32_shl(s1, cos_55)) << 1);
s1 = ixheaacd_add32_sat(
temp2, ixheaacd_shl32_sat((ixheaacd_mult32_shl(s1, cos_55)), 1));
s3 = s1 - t;
s1 = s1 + t;
s3 = ixheaacd_sub32_sat(s1, t);
s1 = ixheaacd_add32_sat(s1, t);
t = ixheaacd_mult32_shl((s4 + s2), cos_51);
s4 = t + ((ixheaacd_mult32_shl(s4, cos_52)) << 1);
s2 = t + (ixheaacd_mult32_shl(s2, cos_53));
t = ixheaacd_mult32_shl(ixheaacd_add32_sat(s4, s2), cos_51);
s4 = ixheaacd_add32_sat(
t, ixheaacd_shl32_sat((ixheaacd_mult32_shl(s4, cos_52)), 1));
s2 = ixheaacd_add32_sat(t, (ixheaacd_mult32_shl(s2, cos_53)));
*buf2++ = temp1;
*buf2++ = temp2;
*buf2++ = r1 + s2;
*buf2++ = s1 - r2;
*buf2++ = r3 - s4;
*buf2++ = s3 + r4;
*buf2++ = r3 + s4;
*buf2++ = s3 - r4;
*buf2++ = r1 - s2;
*buf2++ = s1 + r2;
*buf2++ = ixheaacd_add32_sat(r1, s2);
*buf2++ = ixheaacd_sub32_sat(s1, r2);
*buf2++ = ixheaacd_sub32_sat(r3, s4);
*buf2++ = ixheaacd_add32_sat(s3, r4);
*buf2++ = ixheaacd_add32_sat(r3, s4);
*buf2++ = ixheaacd_sub32_sat(s3, r4);
*buf2++ = ixheaacd_sub32_sat(r1, s2);
*buf2++ = ixheaacd_add32_sat(s1, r2);
buf1a = buf1;
*buf1++ = inp[160];
@ -2312,56 +2316,60 @@ VOID ixheaacd_fft_15_ld_dec(WORD32 *inp, WORD32 *op, WORD32 *fft3out,
*buf1++ = inp[64];
*buf1++ = inp[65];
r1 = buf1a[2] + buf1a[8];
r4 = buf1a[2] - buf1a[8];
r3 = buf1a[4] + buf1a[6];
r2 = buf1a[4] - buf1a[6];
r1 = ixheaacd_add32_sat(buf1a[2], buf1a[8]);
r4 = ixheaacd_sub32_sat(buf1a[2], buf1a[8]);
r3 = ixheaacd_add32_sat(buf1a[4], buf1a[6]);
r2 = ixheaacd_sub32_sat(buf1a[4], buf1a[6]);
t = ixheaacd_mult32_shl((r1 - r3), cos_54);
t = ixheaacd_mult32_shl(ixheaacd_sub32_sat(r1, r3), cos_54);
r1 = r1 + r3;
r1 = ixheaacd_add32_sat(r1, r3);
temp1 = buf1a[0] + r1;
temp1 = ixheaacd_add32_sat(buf1a[0], r1);
r1 = temp1 + ((ixheaacd_mult32_shl(r1, cos_55)) << 1);
r1 = ixheaacd_add32_sat(
temp1, ixheaacd_shl32_sat((ixheaacd_mult32_shl(r1, cos_55)), 1));
r3 = r1 - t;
r1 = r1 + t;
r3 = ixheaacd_sub32_sat(r1, t);
r1 = ixheaacd_add32_sat(r1, t);
t = ixheaacd_mult32_shl((r4 + r2), cos_51);
r4 = t + (ixheaacd_mult32_shl(r4, cos_52) << 1);
r2 = t + ixheaacd_mult32_shl(r2, cos_53);
t = ixheaacd_mult32_shl(ixheaacd_add32_sat(r4, r2), cos_51);
r4 = ixheaacd_add32_sat(
t, ixheaacd_shl32_sat(ixheaacd_mult32_shl(r4, cos_52), 1));
r2 = ixheaacd_add32_sat(t, ixheaacd_mult32_shl(r2, cos_53));
s1 = buf1a[3] + buf1a[9];
s4 = buf1a[3] - buf1a[9];
s3 = buf1a[5] + buf1a[7];
s2 = buf1a[5] - buf1a[7];
s1 = ixheaacd_add32_sat(buf1a[3], buf1a[9]);
s4 = ixheaacd_sub32_sat(buf1a[3], buf1a[9]);
s3 = ixheaacd_add32_sat(buf1a[5], buf1a[7]);
s2 = ixheaacd_sub32_sat(buf1a[5], buf1a[7]);
t = ixheaacd_mult32_shl((s1 - s3), cos_54);
t = ixheaacd_mult32_shl(ixheaacd_sub32_sat(s1, s3), cos_54);
s1 = s1 + s3;
s1 = ixheaacd_add32_sat(s1, s3);
temp2 = buf1a[1] + s1;
temp2 = ixheaacd_add32_sat(buf1a[1], s1);
s1 = temp2 + ((ixheaacd_mult32_shl(s1, cos_55)) << 1);
s1 = ixheaacd_add32_sat(
temp2, ixheaacd_shl32_sat((ixheaacd_mult32_shl(s1, cos_55)), 1));
s3 = s1 - t;
s1 = s1 + t;
s3 = ixheaacd_sub32_sat(s1, t);
s1 = ixheaacd_add32_sat(s1, t);
t = ixheaacd_mult32_shl((s4 + s2), cos_51);
s4 = t + ((ixheaacd_mult32_shl(s4, cos_52)) << 1);
s2 = t + (ixheaacd_mult32_shl(s2, cos_53));
t = ixheaacd_mult32_shl(ixheaacd_add32_sat(s4, s2), cos_51);
s4 = ixheaacd_add32_sat(
t, ixheaacd_shl32_sat((ixheaacd_mult32_shl(s4, cos_52)), 1));
s2 = ixheaacd_add32_sat(t, (ixheaacd_mult32_shl(s2, cos_53)));
*buf2++ = temp1;
*buf2++ = temp2;
*buf2++ = r1 + s2;
*buf2++ = s1 - r2;
*buf2++ = r3 - s4;
*buf2++ = s3 + r4;
*buf2++ = r3 + s4;
*buf2++ = s3 - r4;
*buf2++ = r1 - s2;
*buf2++ = s1 + r2;
*buf2++ = ixheaacd_add32_sat(r1, s2);
*buf2++ = ixheaacd_sub32_sat(s1, r2);
*buf2++ = ixheaacd_sub32_sat(r3, s4);
*buf2++ = ixheaacd_add32_sat(s3, r4);
*buf2++ = ixheaacd_add32_sat(r3, s4);
*buf2++ = ixheaacd_sub32_sat(s3, r4);
*buf2++ = ixheaacd_sub32_sat(r1, s2);
*buf2++ = ixheaacd_add32_sat(s1, r2);
buf1a = buf1;
;
@ -2380,56 +2388,60 @@ VOID ixheaacd_fft_15_ld_dec(WORD32 *inp, WORD32 *op, WORD32 *fft3out,
*buf1++ = inp[224];
*buf1++ = inp[225];
r1 = buf1a[2] + buf1a[8];
r4 = buf1a[2] - buf1a[8];
r3 = buf1a[4] + buf1a[6];
r2 = buf1a[4] - buf1a[6];
r1 = ixheaacd_add32_sat(buf1a[2], buf1a[8]);
r4 = ixheaacd_sub32_sat(buf1a[2], buf1a[8]);
r3 = ixheaacd_add32_sat(buf1a[4], buf1a[6]);
r2 = ixheaacd_sub32_sat(buf1a[4], buf1a[6]);
t = ixheaacd_mult32_shl((r1 - r3), cos_54);
t = ixheaacd_mult32_shl(ixheaacd_sub32_sat(r1, r3), cos_54);
r1 = r1 + r3;
r1 = ixheaacd_add32_sat(r1, r3);
temp1 = buf1a[0] + r1;
temp1 = ixheaacd_add32_sat(buf1a[0], r1);
r1 = temp1 + ((ixheaacd_mult32_shl(r1, cos_55)) << 1);
r1 = ixheaacd_add32_sat(
temp1, ixheaacd_shl32_sat((ixheaacd_mult32_shl(r1, cos_55)), 1));
r3 = r1 - t;
r1 = r1 + t;
r3 = ixheaacd_sub32_sat(r1, t);
r1 = ixheaacd_add32_sat(r1, t);
t = ixheaacd_mult32_shl((r4 + r2), cos_51);
r4 = t + (ixheaacd_mult32_shl(r4, cos_52) << 1);
r2 = t + ixheaacd_mult32_shl(r2, cos_53);
t = ixheaacd_mult32_shl(ixheaacd_add32_sat(r4, r2), cos_51);
r4 = ixheaacd_add32_sat(
t, ixheaacd_shl32_sat(ixheaacd_mult32_shl(r4, cos_52), 1));
r2 = ixheaacd_add32_sat(t, ixheaacd_mult32_shl(r2, cos_53));
s1 = buf1a[3] + buf1a[9];
s4 = buf1a[3] - buf1a[9];
s3 = buf1a[5] + buf1a[7];
s2 = buf1a[5] - buf1a[7];
s1 = ixheaacd_add32_sat(buf1a[3], buf1a[9]);
s4 = ixheaacd_sub32_sat(buf1a[3], buf1a[9]);
s3 = ixheaacd_add32_sat(buf1a[5], buf1a[7]);
s2 = ixheaacd_sub32_sat(buf1a[5], buf1a[7]);
t = ixheaacd_mult32_shl((s1 - s3), cos_54);
t = ixheaacd_mult32_shl(ixheaacd_sub32_sat(s1, s3), cos_54);
s1 = s1 + s3;
s1 = ixheaacd_add32_sat(s1, s3);
temp2 = buf1a[1] + s1;
temp2 = ixheaacd_add32_sat(buf1a[1], s1);
s1 = temp2 + ((ixheaacd_mult32_shl(s1, cos_55)) << 1);
s1 = ixheaacd_add32_sat(
temp2, ixheaacd_shl32_sat((ixheaacd_mult32_shl(s1, cos_55)), 1));
s3 = s1 - t;
s1 = s1 + t;
s3 = ixheaacd_sub32_sat(s1, t);
s1 = ixheaacd_add32_sat(s1, t);
t = ixheaacd_mult32_shl((s4 + s2), cos_51);
s4 = t + ((ixheaacd_mult32_shl(s4, cos_52)) << 1);
s2 = t + (ixheaacd_mult32_shl(s2, cos_53));
t = ixheaacd_mult32_shl(ixheaacd_add32_sat(s4, s2), cos_51);
s4 = ixheaacd_add32_sat(
t, ixheaacd_shl32_sat((ixheaacd_mult32_shl(s4, cos_52)), 1));
s2 = ixheaacd_add32_sat(t, (ixheaacd_mult32_shl(s2, cos_53)));
*buf2++ = temp1;
*buf2++ = temp2;
*buf2++ = r1 + s2;
*buf2++ = s1 - r2;
*buf2++ = r3 - s4;
*buf2++ = s3 + r4;
*buf2++ = r3 + s4;
*buf2++ = s3 - r4;
*buf2++ = r1 - s2;
*buf2++ = s1 + r2;
*buf2++ = ixheaacd_add32_sat(r1, s2);
*buf2++ = ixheaacd_sub32_sat(s1, r2);
*buf2++ = ixheaacd_sub32_sat(r3, s4);
*buf2++ = ixheaacd_add32_sat(s3, r4);
*buf2++ = ixheaacd_add32_sat(r3, s4);
*buf2++ = ixheaacd_sub32_sat(s3, r4);
*buf2++ = ixheaacd_sub32_sat(r1, s2);
*buf2++ = ixheaacd_add32_sat(s1, r2);
buf1a = buf1;
;
}
@ -2445,14 +2457,14 @@ VOID ixheaacd_fft_15_ld_dec(WORD32 *inp, WORD32 *op, WORD32 *fft3out,
xr_2 = fft3outptr[20];
xi_2 = fft3outptr[21];
x01_real = ixheaacd_add32(xr_0, xr_1);
x_01_imag = ixheaacd_add32(xi_0, xi_1);
x01_real = ixheaacd_add32_sat(xr_0, xr_1);
x_01_imag = ixheaacd_add32_sat(xi_0, xi_1);
add_r = ixheaacd_add32(xr_1, xr_2);
add_i = ixheaacd_add32(xi_1, xi_2);
add_r = ixheaacd_add32_sat(xr_1, xr_2);
add_i = ixheaacd_add32_sat(xi_1, xi_2);
sub_r = ixheaacd_sub32(xr_1, xr_2);
sub_i = ixheaacd_sub32(xi_1, xi_2);
sub_r = ixheaacd_sub32_sat(xr_1, xr_2);
sub_i = ixheaacd_sub32_sat(xi_1, xi_2);
p1 = add_r >> 1;
@ -2461,21 +2473,21 @@ VOID ixheaacd_fft_15_ld_dec(WORD32 *inp, WORD32 *op, WORD32 *fft3out,
p4 = add_i >> 1;
temp = ixheaacd_sub32(xr_0, p1);
temp1 = ixheaacd_add32(xi_0, p3);
temp2 = ixheaacd_sub32(xi_0, p3);
temp = ixheaacd_sub32_sat(xr_0, p1);
temp1 = ixheaacd_add32_sat(xi_0, p3);
temp2 = ixheaacd_sub32_sat(xi_0, p3);
idx = re_arr_tab_sml_240_ptr[n++] << 1;
op[idx] = ixheaacd_add32(x01_real, xr_2);
op[idx + 1] = ixheaacd_add32(x_01_imag, xi_2);
op[idx] = ixheaacd_add32_sat(x01_real, xr_2);
op[idx + 1] = ixheaacd_add32_sat(x_01_imag, xi_2);
idx = re_arr_tab_sml_240_ptr[n++] << 1;
op[idx] = ixheaacd_add32(temp, p2);
op[idx + 1] = ixheaacd_sub32(temp2, p4);
op[idx] = ixheaacd_add32_sat(temp, p2);
op[idx + 1] = ixheaacd_sub32_sat(temp2, p4);
idx = re_arr_tab_sml_240_ptr[n++] << 1;
op[idx] = ixheaacd_sub32(temp, p2);
op[idx + 1] = ixheaacd_sub32(temp1, p4);
op[idx] = ixheaacd_sub32_sat(temp, p2);
op[idx + 1] = ixheaacd_sub32_sat(temp1, p4);
fft3outptr += 2;
}
}

View file

@ -21,6 +21,7 @@
#define IXHEAACD_AAC_ROM_H
#define AAC_NF_NO_RANDOM_VAL 512
#define MAX_CB_SIZE 13
typedef struct {
WORD32 ixheaacd_pow_table_Q13[129];
@ -153,8 +154,8 @@ typedef struct {
WORD16 sfb_long_table[52];
WORD16 sfb_short_table[16];
UWORD16 *code_book[13];
UWORD32 *index_table[13];
UWORD16 *code_book[MAX_CB_SIZE];
UWORD32 *index_table[MAX_CB_SIZE];
WORD8 *scale_fac_bands_512[16];
WORD8 *scale_fac_bands_480[16];

View file

@ -52,13 +52,14 @@
#include "ixheaacd_aacdec.h"
static PLATFORM_INLINE WORD32 ixheaacd_mac32_tns(WORD32 a, WORD32 b, WORD32 c) {
static PLATFORM_INLINE WORD32 ixheaacd_mac32_tns_sat(WORD32 a, WORD32 b,
WORD32 c) {
WORD32 result;
WORD64 temp_result;
temp_result = (WORD64)a * (WORD64)b;
result = (WORD32)(temp_result >> 32);
result = ixheaacd_add32(c, result);
result = ixheaacd_add32_sat(c, result);
return (result);
}
@ -225,29 +226,29 @@ VOID ixheaacd_tns_ar_filter_fixed_dec(WORD32 *spectrum, WORD32 size, WORD32 inc,
{
WORD32 temp_lo = 0;
for (i = 0; i < order; i++) {
y = (*spectrum) << scale_spec;
y = ixheaacd_shl32_sat((*spectrum), scale_spec);
acc = 0;
for (j = i; j > 0; j--) {
acc = ixheaacd_mac32_tns(state[j - 1], lpc[j], acc);
acc = ixheaacd_mac32_tns_sat(state[j - 1], lpc[j], acc);
state[j] = state[j - 1];
}
y = ixheaacd_sub32(y, (acc << 1));
state[0] = ixheaacd_shl32(y, shift_value);
y = ixheaacd_sub32_sat(y, ixheaacd_shl32_sat(acc, 1));
state[0] = ixheaacd_shl32_sat(y, shift_value);
*spectrum = y >> scale_spec;
spectrum += inc;
}
temp_lo = 0;
for (i = order; i < size; i++) {
y = (*spectrum) << scale_spec;
y = ixheaacd_shl32_sat((*spectrum), scale_spec);
acc = 0;
for (j = order; j > 0; j--) {
acc = ixheaacd_mac32_tns(state[j - 1], lpc[j], acc);
acc = ixheaacd_mac32_tns_sat(state[j - 1], lpc[j], acc);
state[j] = state[j - 1];
}
y = ixheaacd_sub32(y, (acc << 1));
state[0] = ixheaacd_shl32(y, shift_value);
y = ixheaacd_sub32_sat(y, ixheaacd_shl32_sat(acc, 1));
state[0] = ixheaacd_shl32_sat(y, shift_value);
*spectrum = y >> scale_spec;
spectrum += inc;
@ -274,15 +275,15 @@ VOID ixheaacd_tns_ar_filter_fixed_non_neon_armv7(WORD32 *spectrum, WORD32 size,
{
WORD32 temp_lo = 0;
for (i = 0; i < order; i++) {
y = (*spectrum) << scale_spec;
y = ixheaacd_shl32_sat((*spectrum), scale_spec);
acc = 0;
for (j = i; j > 0; j--) {
acc = ixheaacd_mac32_tns(state[j - 1], lpc[j], acc);
acc = ixheaacd_mac32_tns_sat(state[j - 1], lpc[j], acc);
state[j] = state[j - 1];
}
y = ixheaacd_sub32(y, (acc << 1));
state[0] = ixheaacd_shl32(y, shift_value);
y = ixheaacd_sub32_sat(y, ixheaacd_shl32_sat(acc, 1));
state[0] = ixheaacd_shl32_sat(y, shift_value);
*spectrum = y >> scale_spec;
spectrum += inc;
@ -291,15 +292,15 @@ VOID ixheaacd_tns_ar_filter_fixed_non_neon_armv7(WORD32 *spectrum, WORD32 size,
for (i = order; i < size; i++) {
WORD64 acc = 0;
WORD32 acc1;
y = (*spectrum) << scale_spec;
y = ixheaacd_shl32_sat((*spectrum), scale_spec);
for (j = order; j > 0; j--) {
acc = mac32x32in64_dual(state[j - 1], lpc[j], acc);
state[j] = state[j - 1];
}
acc1 = (WORD32)(acc >> 32);
y = ixheaacd_sub32(y, (acc1 << 1));
state[0] = ixheaacd_shl32(y, shift_value);
y = ixheaacd_sub32_sat(y, ixheaacd_shl32_sat(acc1, 1));
state[0] = ixheaacd_shl32_sat(y, shift_value);
*spectrum = y >> scale_spec;
spectrum += inc;
@ -324,15 +325,15 @@ VOID ixheaacd_tns_ar_filter_fixed_armv8(WORD32 *spectrum, WORD32 size,
{
WORD32 temp_lo = 0;
for (i = 0; i < order; i++) {
y = (*spectrum) << scale_spec;
y = ixheaacd_shl32_sat((*spectrum), scale_spec);
acc = 0;
for (j = i; j > 0; j--) {
acc = ixheaacd_mac32_tns(state[j - 1], lpc[j], acc);
acc = ixheaacd_mac32_tns_sat(state[j - 1], lpc[j], acc);
state[j] = state[j - 1];
}
y = ixheaacd_sub32(y, (acc << 1));
state[0] = ixheaacd_shl32(y, shift_value);
y = ixheaacd_sub32_sat(y, ixheaacd_shl32_sat(acc, 1));
state[0] = ixheaacd_shl32_sat(y, shift_value);
*spectrum = y >> scale_spec;
spectrum += inc;
@ -341,15 +342,15 @@ VOID ixheaacd_tns_ar_filter_fixed_armv8(WORD32 *spectrum, WORD32 size,
for (i = order; i < size; i++) {
WORD64 acc = 0;
WORD32 acc1;
y = (*spectrum) << scale_spec;
y = ixheaacd_shl32_sat((*spectrum), scale_spec);
for (j = order; j > 0; j--) {
acc = ixheaacd_mac32x32in64_dual(state[j - 1], lpc[j], acc);
state[j] = state[j - 1];
}
acc1 = (WORD32)(acc >> 32);
y = ixheaacd_sub32(y, (acc1 << 1));
state[0] = ixheaacd_shl32(y, shift_value);
y = ixheaacd_sub32(y, ixheaacd_shl32_sat(acc1, 1));
state[0] = ixheaacd_shl32_sat(y, shift_value);
*spectrum = y >> scale_spec;
spectrum += inc;
@ -394,32 +395,32 @@ VOID ixheaacd_tns_ar_filter_dec(WORD32 *spectrum, WORD32 size, WORD32 inc,
}
for (i = 0; i < order; i++) {
y = (*spectrum) << scale_spec;
y = ixheaacd_shl32_sat((*spectrum), scale_spec);
acc = 0;
for (j = i; j > 0; j--) {
acc = ixheaacd_add32(
acc = ixheaacd_add32_sat(
acc, ixheaacd_mult32x16in32(ptr_filter_state[j - 1], lpc[j]));
ptr_filter_state[j] = ptr_filter_state[j - 1];
}
y = ixheaacd_sub32(y, (acc << 1));
ptr_filter_state[0] = ixheaacd_shl32(y, shift_value);
y = ixheaacd_sub32_sat(y, ixheaacd_shl32_sat(acc, 1));
ptr_filter_state[0] = ixheaacd_shl32_sat(y, shift_value);
*spectrum = y >> scale_spec;
spectrum += inc;
}
for (i = order; i < size; i++) {
y = (*spectrum) << scale_spec;
y = ixheaacd_shl32_sat((*spectrum), scale_spec);
acc = 0;
for (j = order; j > 0; j--) {
acc = ixheaacd_add32(
acc = ixheaacd_add32_sat(
acc, ixheaacd_mult32x16in32(ptr_filter_state[j - 1], lpc[j]));
ptr_filter_state[j] = ptr_filter_state[j - 1];
}
y = ixheaacd_sub32(y, (acc << 1));
ptr_filter_state[0] = ixheaacd_shl32(y, shift_value);
y = ixheaacd_sub32_sat(y, ixheaacd_shl32_sat(acc, 1));
ptr_filter_state[0] = ixheaacd_shl32_sat(y, shift_value);
*spectrum = y >> scale_spec;
spectrum += inc;
}

View file

@ -23,7 +23,6 @@
#define AAC_DEC_OK IA_ENHAACPLUS_DEC_API_NONFATAL_NO_ERROR
#define IA_ENHAACPDEC_NUM_MEMTABS (4)
#define IA_MPS_DEC_NUM_MEMTABS (4)
#define FRAME_SIZE 1024

View file

@ -510,7 +510,12 @@ WORD32 ixheaacd_aacdec_decodeframe(
goto _ia_handle_error;
}
aac_dec_handle->frame_status = 0;
error_code = IA_ENHAACPLUS_DEC_EXE_NONFATAL_DECODE_FRAME_ERROR;
if (error_code > 0) {
error_code = IA_ENHAACPLUS_DEC_EXE_NONFATAL_DECODE_FRAME_ERROR;
return error_code;
} else {
return error_code;
}
}
}
@ -743,25 +748,15 @@ WORD32 ixheaacd_aacdec_decodeframe(
if (ele_type == ID_END &&
p_state_enhaacplus_dec->bs_format == LOAS_BSFORMAT) {
WORD16 tmp;
tmp = ((WORD16)latm_element->layer_info[0][0].frame_len_bits) -
WORD32 tmp;
tmp = ((WORD32)latm_element->layer_info[0][0].frame_len_bits) -
(it_bit_buff->initial_cnt_bits - it_bit_buff->cnt_bits);
if (tmp > 0) ixheaacd_read_bidirection(it_bit_buff, tmp);
if (latm_element->other_data_present) {
tmp = latm_element->other_data_length;
ixheaacd_read_bidirection(it_bit_buff, tmp);
}
}
if (p_obj_exhaacplus_dec->aac_config.ui_drc_enable) {
for (ch = 0; ch < num_ch; ch++) {
pstr_drc_dec->is_longblock[*ch_idx + ch] =
(aac_dec_handle->pstr_aac_dec_ch_info[ch]
->str_ics_info.window_sequence == EIGHT_SHORT_SEQUENCE)
? 0
: 1;
WORD32 count_bits = (WORD32)latm_element->other_data_length;
ixheaacd_read_bidirection(it_bit_buff, count_bits);
}
}
@ -887,4 +882,4 @@ WORD32 ixheaacd_extension_payload(ia_bit_buf_struct *it_bit_buff, WORD32 cnt) {
}
return err;
}
}

View file

@ -47,6 +47,7 @@
#include "ixheaacd_sbrdecoder.h"
#include "ixheaacd_sbr_payload.h"
#include "ixheaacd_audioobjtypes.h"
#include "ixheaacd_error_codes.h"
#define SBR_EXTENSION_MPEG SBR_EXTENSION
@ -151,12 +152,13 @@ FLAG ixheaacd_check_for_sbr_payload(
} else {
ixheaacd_read_bits_buf(it_bit_buff, 4);
if (it_bit_buff->cnt_bits < ((count - 1) << 3)) {
longjmp(*(it_bit_buff->xaac_jmp_buf),
IA_ENHAACPLUS_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
}
it_bit_buff->ptr_read_next += count - 1;
it_bit_buff->cnt_bits -= ((count - 1) << 3);
if (it_bit_buff->ptr_read_next > it_bit_buff->ptr_bit_buf_end) {
it_bit_buff->ptr_read_next = it_bit_buff->ptr_bit_buf_base;
}
}
}
if (it_bit_buff->cnt_bits < 0) ret = -1;

View file

@ -137,6 +137,8 @@ IA_ERRORCODE ixheaacd_dec_mem_api(
return (IA_ENHAACPLUS_DEC_API_FATAL_MEM_ALIGN);
}
p_obj_exhaacplus_dec->pp_mem_aac[i_idx] = pv_value;
memset(p_obj_exhaacplus_dec->pp_mem_aac[i_idx], 0,
p_obj_exhaacplus_dec->p_mem_info_aac[i_idx].ui_size);
if (i_idx == IA_ENHAACPLUS_DEC_PERSIST_IDX) {
pUWORD8 p_temp = pv_value;
@ -148,9 +150,6 @@ IA_ERRORCODE ixheaacd_dec_mem_api(
sizeof(ia_audio_specific_config_struct) + (8300));
p_obj_exhaacplus_dec->p_state_aac = pv_value;
memset(p_obj_exhaacplus_dec->p_state_aac, 0,
sizeof(ia_aac_dec_state_struct));
p_obj_exhaacplus_dec->p_state_aac->pstr_dec_data = p_temp;
p_obj_exhaacplus_dec->p_state_aac->ia_audio_specific_config =
p_temp + sizeof(ia_dec_data_struct);
@ -380,6 +379,7 @@ IA_ERRORCODE ixheaacd_dec_api(pVOID p_ia_enhaacplus_dec_obj, WORD32 i_cmd,
case IA_API_CMD_INIT: {
switch (i_idx) {
case IA_CMD_TYPE_INIT_API_PRE_CONFIG_PARAMS: {
memset(p_obj_exhaacplus_dec, 0, sizeof(*p_obj_exhaacplus_dec));
p_obj_exhaacplus_dec->aac_config.ui_pcm_wdsz = 16;
p_obj_exhaacplus_dec->aac_config.flag_downmix = 0;
p_obj_exhaacplus_dec->aac_config.flag_08khz_out = 0;
@ -411,6 +411,8 @@ IA_ERRORCODE ixheaacd_dec_api(pVOID p_ia_enhaacplus_dec_obj, WORD32 i_cmd,
p_obj_exhaacplus_dec->aac_config.ui_coupling_channel = 0;
p_obj_exhaacplus_dec->aac_config.downmix = 0;
p_obj_exhaacplus_dec->aac_config.ui_n_channels = 2;
p_obj_exhaacplus_dec->aac_config.i_channel_mask = 3;
{
ia_aac_dec_tables_struct *pstr_aac_tables =
@ -776,10 +778,14 @@ IA_ERRORCODE ixheaacd_dec_api(pVOID p_ia_enhaacplus_dec_obj, WORD32 i_cmd,
case IA_API_CMD_GET_MEMTABS_SIZE: {
*pui_value = (sizeof(ia_mem_info_struct) + sizeof(pVOID *)) *
(IA_ENHAACPDEC_NUM_MEMTABS + IA_MPS_DEC_NUM_MEMTABS);
(IA_ENHAACPDEC_NUM_MEMTABS);
break;
}
case IA_API_CMD_SET_MEMTABS_PTR: {
if (pv_value == NULL) return IA_ENHAACPLUS_DEC_API_FATAL_MEM_ALLOC;
memset(pv_value, 0, (sizeof(ia_mem_info_struct) + sizeof(pVOID *)) *
(IA_ENHAACPDEC_NUM_MEMTABS));
p_obj_exhaacplus_dec->p_mem_info_aac = pv_value;
p_obj_exhaacplus_dec->pp_mem_aac =
(pVOID *)((WORD8 *)pv_value +
@ -800,8 +806,12 @@ IA_ERRORCODE ixheaacd_dec_api(pVOID p_ia_enhaacplus_dec_obj, WORD32 i_cmd,
switch (i_idx) {
case IA_CMD_TYPE_DO_EXECUTE: {
WORD32 err_code = 0;
err_code = ixheaacd_dec_execute(p_obj_exhaacplus_dec);
if (err_code != 0) {
if (!p_obj_exhaacplus_dec->p_state_aac->ui_init_done) {
err_code = IA_FATAL_ERROR;
} else {
err_code = ixheaacd_dec_execute(p_obj_exhaacplus_dec);
}
if (err_code != IA_NO_ERROR) {
p_obj_exhaacplus_dec->p_state_aac->i_bytes_consumed =
p_obj_exhaacplus_dec->p_state_aac->ui_in_bytes;
}
@ -1255,10 +1265,21 @@ IA_ERRORCODE ixheaacd_dec_init(
IA_ERRORCODE err_code = IA_NO_ERROR;
struct ia_aac_persistent_struct *aac_persistent_mem;
struct ia_sbr_pers_struct *sbr_persistent_mem;
WORD32 ret_val;
p_obj_exhaacplus_dec->p_state_aac =
p_obj_exhaacplus_dec->pp_mem_aac[IA_ENHAACPLUS_DEC_PERSIST_IDX];
if (p_obj_exhaacplus_dec->p_state_aac != NULL) {
ret_val = setjmp(p_obj_exhaacplus_dec->p_state_aac->xaac_jmp_buf);
if (ret_val != 0) {
p_obj_exhaacplus_dec->p_state_aac->i_bytes_consumed =
p_obj_exhaacplus_dec->p_state_aac->ui_in_bytes;
p_obj_exhaacplus_dec->p_state_aac->ui_out_bytes = 0;
return IA_NO_ERROR;
}
}
time_data = (WORD16 *)(p_obj_exhaacplus_dec
->pp_mem_aac[IA_ENHAACPLUS_DEC_OUTPUT_IDX]);
@ -1397,17 +1418,22 @@ IA_ERRORCODE ixheaacd_dec_init(
return IA_NO_ERROR;
}
memset(&(p_state_enhaacplus_dec->eld_specific_config), 0,
sizeof(ia_eld_specific_config_struct));
return_val = ixheaacd_aac_headerdecode(
p_obj_exhaacplus_dec, (UWORD8 *)in_buffer, &header_bytes_consumed,
aac_persistent_mem->str_aac_decoder.pstr_aac_tables
->pstr_huffmann_tables);
memcpy(sbr_persistent_mem->str_sbr_dec_inst.pstr_sbr_header[0],
&p_obj_exhaacplus_dec->p_state_aac->str_sbr_config,
sizeof(ia_sbr_header_data_struct));
memcpy(sbr_persistent_mem->str_sbr_dec_inst.pstr_sbr_header[1],
&p_obj_exhaacplus_dec->p_state_aac->str_sbr_config,
sizeof(ia_sbr_header_data_struct));
if (p_state_enhaacplus_dec->audio_object_type == AOT_ER_AAC_LD ||
p_state_enhaacplus_dec->audio_object_type == AOT_ER_AAC_ELD) {
*sbr_persistent_mem->str_sbr_dec_inst.pstr_sbr_header[0] =
p_obj_exhaacplus_dec->p_state_aac->str_sbr_config;
*sbr_persistent_mem->str_sbr_dec_inst.pstr_sbr_header[1] =
p_obj_exhaacplus_dec->p_state_aac->str_sbr_config;
} else {
memset(&(p_state_enhaacplus_dec->eld_specific_config), 0,
sizeof(ia_eld_specific_config_struct));
}
if (return_val < 0) {
if (return_val ==
@ -1444,7 +1470,7 @@ IA_ERRORCODE ixheaacd_dec_init(
p_obj_exhaacplus_dec, inbuffer, outbuffer, &out_bytes,
frames_done, pcm_size,
&p_obj_exhaacplus_dec->p_state_aac->num_of_output_ch);
if (error_code == -1) return error_code;
if (error_code) return error_code;
p_obj_exhaacplus_dec->p_state_aac->frame_counter++;
} else {
out_bytes = 0;
@ -1455,8 +1481,6 @@ IA_ERRORCODE ixheaacd_dec_init(
}
if (return_val == 0)
p_obj_exhaacplus_dec->p_state_aac->ui_init_done = 1;
p_obj_exhaacplus_dec->p_state_aac->header_dec_done = 1;
return return_val;
}
@ -1493,6 +1517,8 @@ IA_ERRORCODE ixheaacd_dec_init(
&p_state_enhaacplus_dec->str_bit_buf, (UWORD8 *)in_buffer,
p_obj_exhaacplus_dec->p_mem_info_aac[IA_ENHAACPLUS_DEC_INPUT_IDX]
.ui_size);
p_state_enhaacplus_dec->pstr_bit_buf->xaac_jmp_buf =
&(p_state_enhaacplus_dec->xaac_jmp_buf);
p_state_enhaacplus_dec->ptr_bit_stream =
p_state_enhaacplus_dec->pstr_bit_buf;
@ -1577,7 +1603,7 @@ IA_ERRORCODE ixheaacd_dec_init(
}
}
} else {
struct ia_bit_buf_struct temp_bit_buff;
struct ia_bit_buf_struct temp_bit_buff = {0};
ia_adts_header_struct adts;
struct ia_bit_buf_struct *it_bit_buff;
@ -1612,6 +1638,8 @@ IA_ERRORCODE ixheaacd_dec_init(
ixheaacd_create_init_bit_buf(it_bit_buff, in_buffer,
p_state_enhaacplus_dec->ui_in_bytes);
p_state_enhaacplus_dec->pstr_bit_buf->xaac_jmp_buf =
&(p_state_enhaacplus_dec->xaac_jmp_buf);
it_bit_buff->adts_header_present =
p_state_enhaacplus_dec->s_adts_hdr_present;
@ -1786,6 +1814,9 @@ IA_ERRORCODE ixheaacd_dec_init(
p_state_enhaacplus_dec->b_n_raw_data_blk--;
}
sample_rate_2 = sample_rate_1;
frame_size_2 = frame_size_1;
if (!p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx] &&
p_state_enhaacplus_dec->pstr_stream_sbr[0][0].no_elements) {
if ((p_obj_exhaacplus_dec->aac_config.flag_16khz_out == 1) &&
@ -1793,9 +1824,6 @@ IA_ERRORCODE ixheaacd_dec_init(
p_obj_exhaacplus_dec->aac_config.flag_16khz_out = 0;
}
sample_rate_2 = sample_rate_1;
frame_size_2 = frame_size_1;
p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx] = ixheaacd_init_sbr(
sample_rate_1, frame_size_1,
(FLAG *)&p_obj_exhaacplus_dec->aac_config.down_sample_flag,
@ -1804,10 +1832,15 @@ IA_ERRORCODE ixheaacd_dec_init(
1, frame_size_1 * 2, NULL, NULL,
p_state_enhaacplus_dec->str_sbr_config,
p_state_enhaacplus_dec->audio_object_type);
if (p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx]) {
p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx]->xaac_jmp_buf =
&(p_state_enhaacplus_dec->xaac_jmp_buf);
}
} else {
}
if (p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx]) {
if (p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx] &&
p_state_enhaacplus_dec->pstr_stream_sbr[0][0].no_elements) {
ia_sbr_scr_struct sbr_scratch_struct;
WORD16 num_channels_1_t = num_channels_1;
ixheaacd_allocate_sbr_scr(
@ -1862,6 +1895,10 @@ IA_ERRORCODE ixheaacd_dec_init(
p_state_enhaacplus_dec->str_sbr_config,
p_state_enhaacplus_dec->audio_object_type);
}
if (p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx]) {
p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx]->xaac_jmp_buf =
&(p_state_enhaacplus_dec->xaac_jmp_buf);
}
}
if (sample_rate < sample_rate_1) sample_rate = sample_rate_1;
@ -1895,6 +1932,7 @@ IA_ERRORCODE ixheaacd_dec_init(
WORD max_ch_num = p_obj_exhaacplus_dec->aac_config.ui_max_channels;
i = 0;
p_obj_exhaacplus_dec->aac_config.ui_n_channels = ch_idx;
while (p_obj_exhaacplus_dec->aac_config.element_type[ch_idx_err] <= 3 &&
p_obj_exhaacplus_dec->aac_config.element_type[ch_idx_err] >= 0) {
ch_idx_err++;
@ -1984,16 +2022,17 @@ IA_ERRORCODE ixheaacd_dec_init(
return IA_ENHAACPLUS_DEC_INIT_FATAL_DEC_INIT_FAIL;
}
p_state_enhaacplus_dec->str_sbr_dec_info[i] = 0;
if (sbr_present_flag) {
p_state_enhaacplus_dec->str_sbr_dec_info[i] = ixheaacd_init_sbr(
sample_rate_2, frame_size_2,
(FLAG *)&p_obj_exhaacplus_dec->aac_config.down_sample_flag,
p_state_enhaacplus_dec->sbr_persistent_mem_v,
p_state_enhaacplus_dec->ptr_overlap_buf, channel, ps_enable, 1,
frame_size_2 * 2, NULL, NULL,
p_state_enhaacplus_dec->str_sbr_config,
p_state_enhaacplus_dec->audio_object_type);
p_state_enhaacplus_dec->str_sbr_dec_info[i] = ixheaacd_init_sbr(
sample_rate_2, frame_size_2,
(FLAG *)&p_obj_exhaacplus_dec->aac_config.down_sample_flag,
p_state_enhaacplus_dec->sbr_persistent_mem_v,
p_state_enhaacplus_dec->ptr_overlap_buf, channel, ps_enable, 1,
frame_size_2 * 2, NULL, NULL,
p_state_enhaacplus_dec->str_sbr_config,
p_state_enhaacplus_dec->audio_object_type);
if (p_state_enhaacplus_dec->str_sbr_dec_info[i]) {
p_state_enhaacplus_dec->str_sbr_dec_info[i]->xaac_jmp_buf =
&(p_state_enhaacplus_dec->xaac_jmp_buf);
}
i++;
@ -2046,6 +2085,10 @@ IA_ERRORCODE ixheaacd_dec_init(
memcpy(it_bit_buff, &temp_bit_buff, sizeof(struct ia_bit_buf_struct));
p_state_enhaacplus_dec->b_n_raw_data_blk = 0;
if (p_obj_exhaacplus_dec->p_state_aac->header_dec_done == 1) {
p_obj_exhaacplus_dec->p_state_aac->header_dec_done = 0;
}
}
return err_code;
}
@ -2099,7 +2142,7 @@ VOID ixheaacd_fill_prog_config_slots(
IA_ERRORCODE ixheaacd_dec_execute(
ia_exhaacplus_dec_api_struct *p_obj_exhaacplus_dec) {
ia_adts_header_struct adts;
ia_adts_header_struct adts = {0};
ia_aac_dec_state_struct *p_state_enhaacplus_dec;
UWORD8 *in_buffer;
@ -2108,7 +2151,7 @@ IA_ERRORCODE ixheaacd_dec_execute(
WORD16 frame_size = 0;
WORD32 sample_rate_dec = 0;
WORD32 sample_rate = 0;
WORD16 num_ch;
WORD16 num_ch = 0;
struct ia_bit_buf_struct *it_bit_buff;
WORD32 error_code = IA_NO_ERROR;
WORD ch_idx1;
@ -2123,9 +2166,20 @@ IA_ERRORCODE ixheaacd_dec_execute(
SIZE_T bytes_for_sync;
WORD32 audio_mux_length_bytes_last = 0;
WORD32 ret_val;
p_obj_exhaacplus_dec->aac_config.ui_sbr_mode = 0;
if (p_obj_exhaacplus_dec->p_state_aac != NULL) {
ret_val = setjmp(p_obj_exhaacplus_dec->p_state_aac->xaac_jmp_buf);
if (ret_val != 0) {
p_obj_exhaacplus_dec->p_state_aac->i_bytes_consumed =
p_obj_exhaacplus_dec->p_state_aac->ui_in_bytes;
p_obj_exhaacplus_dec->p_state_aac->ui_out_bytes = 0;
return IA_NO_ERROR;
}
}
time_data = (WORD16 *)(p_obj_exhaacplus_dec
->pp_mem_aac[IA_ENHAACPLUS_DEC_OUTPUT_IDX]);
in_buffer = p_obj_exhaacplus_dec->pp_mem_aac[IA_ENHAACPLUS_DEC_INPUT_IDX];
@ -2232,6 +2286,7 @@ IA_ERRORCODE ixheaacd_dec_execute(
{
ixheaacd_create_init_bit_buf(it_bit_buff, in_buffer,
p_state_enhaacplus_dec->ui_in_bytes);
it_bit_buff->xaac_jmp_buf = &(p_state_enhaacplus_dec->xaac_jmp_buf);
it_bit_buff->adts_header_present =
p_state_enhaacplus_dec->s_adts_hdr_present;
@ -2420,6 +2475,10 @@ IA_ERRORCODE ixheaacd_dec_execute(
p_state_enhaacplus_dec->frame_length
);
if (!p_state_enhaacplus_dec->pstr_aac_dec_info[ch_idx]) {
p_state_enhaacplus_dec->i_bytes_consumed = 1;
return IA_ENHAACPLUS_DEC_INIT_FATAL_DEC_INIT_FAIL;
}
p_state_enhaacplus_dec->pstr_aac_dec_info[ch_idx]->p_ind_channel_info =
(WORD8 *)p_state_enhaacplus_dec->aac_scratch_mem_v + (8 * 1024) +
pers_used;
@ -2444,6 +2503,9 @@ IA_ERRORCODE ixheaacd_dec_execute(
time_data, channel, p_obj_exhaacplus_dec->aac_config.ui_max_channels,
p_state_enhaacplus_dec->audio_object_type);
if(p_state_enhaacplus_dec->ch_config == 2 && channel == 1)
return IA_ENHAACPLUS_DEC_EXE_NONFATAL_DECODE_FRAME_ERROR;
error_code = ixheaacd_aacdec_decodeframe(
p_obj_exhaacplus_dec, &aac_scratch_struct, actual_out_buffer,
p_obj_exhaacplus_dec->aac_config.frame_status, &type, &ch_idx, 0,
@ -2472,6 +2534,7 @@ IA_ERRORCODE ixheaacd_dec_execute(
}
}
num_ch = p_state_enhaacplus_dec->pstr_aac_dec_info[ch_idx]->channels;
if (skip_full_decode == 0) {
if (p_state_enhaacplus_dec->audio_object_type == AOT_ER_AAC_ELD ||
p_state_enhaacplus_dec->audio_object_type == AOT_ER_AAC_LD)
@ -2481,7 +2544,6 @@ IA_ERRORCODE ixheaacd_dec_execute(
sample_rate_dec =
p_state_enhaacplus_dec->pstr_aac_dec_info[ch_idx]->sampling_rate;
num_ch = p_state_enhaacplus_dec->pstr_aac_dec_info[ch_idx]->channels;
}
}
@ -2524,10 +2586,15 @@ IA_ERRORCODE ixheaacd_dec_execute(
ps_enable, 1, frame_size * 2, NULL, NULL,
p_state_enhaacplus_dec->str_sbr_config,
p_state_enhaacplus_dec->audio_object_type);
if (p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx]) {
p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx]->xaac_jmp_buf =
&(p_state_enhaacplus_dec->xaac_jmp_buf);
}
}
{
if (p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx]) {
if (p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx] &&
p_state_enhaacplus_dec->pstr_stream_sbr[0][0].no_elements) {
ia_sbr_scr_struct sbr_scratch_struct;
ixheaacd_allocate_sbr_scr(&sbr_scratch_struct,
p_state_enhaacplus_dec->aac_scratch_mem_v,

View file

@ -1662,17 +1662,7 @@ static void ixheaacd_arith_map_context(WORD32 pres_n, WORD32 prev_n,
VOID ixheaacd_copy_to_bitbuff(ia_bit_buf_struct *it_bit_buff_src,
ia_bit_buf_struct *it_bit_buff_dst) {
it_bit_buff_dst->ptr_bit_buf_base = it_bit_buff_src->ptr_bit_buf_base;
it_bit_buff_dst->ptr_bit_buf_end = it_bit_buff_src->ptr_bit_buf_end;
it_bit_buff_dst->ptr_read_next = it_bit_buff_src->ptr_read_next;
it_bit_buff_dst->bit_pos = it_bit_buff_src->bit_pos;
it_bit_buff_dst->cnt_bits = it_bit_buff_src->cnt_bits;
it_bit_buff_dst->size = it_bit_buff_src->size;
it_bit_buff_dst->max_size = it_bit_buff_src->max_size;
*it_bit_buff_dst = *it_bit_buff_src;
}
static WORD32 ixheaacd_arith_get_context(WORD8 *c_prev, WORD8 *c_pres,
@ -1699,7 +1689,13 @@ static WORD32 ixheaacd_arith_first_symbol(ia_bit_buf_struct *it_bit_buff,
WORD32 bit_count = 16;
val = 0;
val = ixheaacd_read_bits_buf(it_bit_buff, 16);
if (it_bit_buff->cnt_bits < 16) {
WORD32 shift_value = 16 - it_bit_buff->cnt_bits;
val = ixheaacd_read_bits_buf(it_bit_buff, it_bit_buff->cnt_bits);
val <<= shift_value;
} else {
val = ixheaacd_read_bits_buf(it_bit_buff, 16);
}
s->low = 0;
s->high = 65535;
@ -1738,6 +1734,17 @@ static WORD32 ixheaacd_arith_decode(ia_bit_buf_struct *it_bit_buff,
register UWORD16 const *p;
register UWORD16 const *q;
WORD32 short_value, i = 16;
int shift_value;
if (it_bit_buff->cnt_bits < 16) {
shift_value = 16 - it_bit_buff->cnt_bits;
short_value = ixheaacd_read_bits_buf(it_bit_buff, it_bit_buff->cnt_bits);
short_value <<= shift_value;
} else {
shift_value = 0;
short_value = ixheaacd_read_bits_buf(it_bit_buff, 16);
}
low = s->low;
high = s->high;
value = s->value;
@ -1779,10 +1786,12 @@ static WORD32 ixheaacd_arith_decode(ia_bit_buf_struct *it_bit_buff,
low += low;
high += high + 1;
value = (value << 1) | ixheaacd_read_bits_buf(it_bit_buff, 1);
i--;
value = (value << 1) | ((short_value >> i) & 1);
bit_count++;
}
ixheaacd_read_bidirection(it_bit_buff, -(i - shift_value));
s->low = low;
s->high = high;
s->value = value;
@ -1800,7 +1809,7 @@ WORD32 ixheaacd_arth_decoding_level2(ia_bit_buf_struct *it_bit_buff,
WORD32 i, j, lev, pki, esc_nb;
WORD32 m;
WORD32 c = 0;
struct ia_bit_buf_struct it_bit_buff_temp;
struct ia_bit_buf_struct it_bit_buff_temp = {0};
WORD32 bit_count = 0;
WORD32 s1;
WORD32 temp;

View file

@ -24,12 +24,15 @@
#include <assert.h>
#include <string.h>
#include <ixheaacd_type_def.h>
#include "ixheaacd_constants.h"
#include <ixheaacd_basic_ops32.h>
#include <ixheaacd_basic_ops40.h>
#include "ixheaacd_acelp_com.h"
extern const WORD32 ixheaacd_factorial_7[8];
extern const WORD32 ixheaacd_iso_code_index_table[LEN_ABS_LEADER];
extern const UWORD8 ixheaacd_iso_code_data_table[LEN_ABS_LEADER];
extern const UWORD32 ixheaacd_signed_leader_is[LEN_ABS_LEADER];
extern const UWORD8 ixheaacd_iso_code_data_table[LEN_SIGN_LEADER];
extern const UWORD32 ixheaacd_signed_leader_is[LEN_SIGN_LEADER];
extern const WORD32 ixheaacd_iso_code_num_table[],
ixheaacd_pos_abs_leaders_a3[], ixheaacd_pos_abs_leaders_a4[];
extern const UWORD8 ixheaacd_absolute_leader_tab_da[][8];
@ -55,9 +58,10 @@ static VOID ixheaacd_nearest_neighbor_2d(WORD32 x[], WORD32 y[], WORD32 count,
if (x[i] % 2 != 0) {
if (x[i] < 0) {
rem_temp[i] = -(rem_temp[i] - (1 << count));
rem_temp[i] = ixheaacd_negate32_sat(
ixheaacd_sub32_sat(rem_temp[i], (1 << count)));
} else {
rem_temp[i] = rem_temp[i] - (1 << count);
rem_temp[i] = ixheaacd_sub32_sat(rem_temp[i], (1 << count));
}
}
}
@ -83,10 +87,10 @@ static VOID ixheaacd_nearest_neighbor_2d(WORD32 x[], WORD32 y[], WORD32 count,
if (e[j] < 0) {
y[j] -= 2;
rem_temp[j] = rem_temp[j] + (2 << count);
rem_temp[j] = ixheaacd_add32_sat(rem_temp[j], (2 << count));
} else {
y[j] += 2;
rem_temp[j] = rem_temp[j] - (2 << count);
rem_temp[j] = ixheaacd_sub32_sat(rem_temp[j], (2 << count));
}
}
@ -98,7 +102,7 @@ VOID ixheaacd_voronoi_search(WORD32 x[], WORD32 y[], WORD32 count, WORD32 *rem1,
WORD32 *rem2) {
WORD32 i, y0[8], y1[8];
WORD32 x1[8], tmp;
WORD64 e0, e1;
WORD32 e0, e1;
ixheaacd_nearest_neighbor_2d(x, y0, count, rem1);
for (i = 0; i < 8; i++) {
@ -107,7 +111,7 @@ VOID ixheaacd_voronoi_search(WORD32 x[], WORD32 y[], WORD32 count, WORD32 *rem1,
x1[i] = x[i] - 1;
} else {
x1[i] = 0;
rem2[i] = rem2[i] - (1 << count);
rem2[i] = ixheaacd_sub32_sat(rem2[i], (1 << count));
}
} else {
x1[i] = x[i] - 1;
@ -123,9 +127,9 @@ VOID ixheaacd_voronoi_search(WORD32 x[], WORD32 y[], WORD32 count, WORD32 *rem1,
e0 = e1 = 0;
for (i = 0; i < 8; i++) {
tmp = rem1[i];
e0 += (WORD64)tmp * tmp;
e0 = ixheaacd_add32_sat(ixheaacd_sat64_32((WORD64)tmp * (WORD64)tmp), e0);
tmp = rem2[i];
e1 += (WORD64)tmp * tmp;
e1 = ixheaacd_add32_sat(ixheaacd_sat64_32((WORD64)tmp * (WORD64)tmp), e1);
}
if (e0 < e1) {
@ -151,13 +155,15 @@ VOID ixheaacd_voronoi_idx_dec(WORD32 *kv, WORD32 m, WORD32 *y, WORD32 count) {
rem1[7] = y[7] & (m - 1);
sum = 0;
for (i = 6; i >= 1; i--) {
tmp = 2 * kv[i];
sum += tmp;
y[i] += tmp;
tmp = ixheaacd_shl32_sat(kv[i], 1);
sum = ixheaacd_add32_sat(sum, tmp);
y[i] = ixheaacd_add32_sat(y[i], tmp);
z[i] = y[i] >> count;
rem1[i] = y[i] & (m - 1);
}
y[0] += (4 * kv[0] + sum);
y[0] = ixheaacd_add32_sat(
y[0],
ixheaacd_add32_sat(ixheaacd_sat64_32((WORD64)4 * (WORD64)kv[0]), sum));
z[0] = (y[0] - 2) >> count;
if (m != 0)
rem1[0] = (y[0] - 2) % m;
@ -171,7 +177,7 @@ VOID ixheaacd_voronoi_idx_dec(WORD32 *kv, WORD32 m, WORD32 *y, WORD32 count) {
ptr1 = y;
ptr2 = v;
for (i = 0; i < 8; i++) {
*ptr1++ -= m * *ptr2++;
*ptr1++ -= ixheaacd_sat64_32((WORD64)m * (WORD64)*ptr2++);
}
}
@ -275,24 +281,29 @@ static VOID ixheaacd_gosset_decode_base_index(WORD32 n, UWORD32 code_book_ind,
VOID ixheaacd_rotated_gosset_mtx_dec(WORD32 qn, WORD32 code_book_idx,
WORD32 *kv, WORD32 *b) {
WORD32 i, m, c[8];
WORD32 count = 0;
if (qn <= 4) {
ixheaacd_gosset_decode_base_index(qn, code_book_idx, b);
} else {
m = 1;
WORD32 i, m, c[8];
WORD32 count = 0;
while (qn > 4) {
m *= 2;
count++;
qn -= 2;
}
if (count >= 31)
m = MAX_32;
else
m = 1 << count;
ixheaacd_gosset_decode_base_index(qn, code_book_idx, b);
ixheaacd_voronoi_idx_dec(kv, m, c, count);
for (i = 0; i < 8; i++) b[i] = m * b[i] + c[i];
for (i = 0; i < 8; i++) {
b[i] =
ixheaacd_add32_sat(ixheaacd_sat64_32((WORD64)m * (WORD64)b[i]), c[i]);
}
}
return;
}

View file

@ -65,19 +65,13 @@ static PLATFORM_INLINE WORD32 ixheaacd_shr32(WORD32 a, WORD b) {
}
static PLATFORM_INLINE WORD32 ixheaacd_shl32_sat(WORD32 a, WORD b) {
WORD32 out_val = a;
for (; b > 0; b--) {
if (a > (WORD32)0X3fffffffL) {
out_val = MAX_32;
break;
} else if (a < (WORD32)0xc0000000L) {
out_val = MIN_32;
break;
}
a = ixheaacd_shl32(a, 1);
out_val = a;
}
WORD32 out_val;
if (a > (MAX_32 >> b))
out_val = MAX_32;
else if (a < (MIN_32 >> b))
out_val = MIN_32;
else
out_val = a << b;
return (out_val);
}
@ -380,13 +374,13 @@ static PLATFORM_INLINE WORD32 div32(WORD32 a, WORD32 b, WORD *q_format) {
return quotient;
}
static PLATFORM_INLINE WORD32 ixheaacd_mac16x16in32(WORD32 a, WORD16 b,
WORD16 c) {
static PLATFORM_INLINE WORD32 ixheaacd_mac16x16in32_sat(WORD32 a, WORD16 b,
WORD16 c) {
WORD32 acc;
acc = ixheaacd_mult16x16in32(b, c);
acc = ixheaacd_add32(a, acc);
acc = ixheaacd_add32_sat(a, acc);
return acc;
}
@ -475,4 +469,4 @@ static PLATFORM_INLINE WORD32 sub32_shr(WORD32 a, WORD32 b) {
return diff;
}
#endif
#endif

View file

@ -345,6 +345,18 @@ static PLATFORM_INLINE WORD64 ixheaacd_add64_sat(WORD64 a, WORD64 b) {
return (result);
}
static PLATFORM_INLINE WORD32 ixheaacd_sat64_32(WORD64 a) {
WORD32 result;
if (a >= MAX_32) {
result = MAX_32;
} else if (a <= MIN_32) {
result = MIN_32;
} else
result = (WORD32)a;
return (result);
}
static PLATFORM_INLINE WORD64 ixheaacd_add64(WORD64 a, WORD64 b) {
WORD64 result;
result = a + b;

View file

@ -50,7 +50,7 @@ VOID ixheaacd_read_tns_u(ia_sfb_info_struct *pstr_sfb_info,
ia_bit_buf_struct *it_bit_buff);
WORD32 ixheaacd_core_coder_data(WORD32 id, ia_usac_data_struct *usac_data,
WORD32 elem_idx, WORD32 *chan_offset,
WORD32 elem_idx, WORD32 chan_offset,
ia_bit_buf_struct *it_bit_buff,
WORD32 nr_core_coder_channels);

View file

@ -17,9 +17,10 @@
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <string.h>
#include "ixheaacd_sbr_common.h"
#include <ixheaacd_type_def.h>
#include <assert.h>
#include "ixheaacd_constants.h"
#include <ixheaacd_basic_ops32.h>
#include <ixheaacd_basic_ops16.h>
@ -31,6 +32,7 @@
#include "ixheaacd_bitbuffer.h"
#include "ixheaacd_adts_crc_check.h"
#include "ixheaacd_error_codes.h"
VOID ixheaacd_byte_align(ia_bit_buf_struct *it_bit_buff,
WORD32 *align_bits_cnt) {
@ -44,11 +46,38 @@ VOID ixheaacd_byte_align(ia_bit_buf_struct *it_bit_buff,
*align_bits_cnt = it_bit_buff->cnt_bits;
}
WORD32 ixheaacd_skip_bits_buf(ia_bit_buf_struct *it_bit_buff, WORD no_of_bits) {
UWORD8 *ptr_read_next = it_bit_buff->ptr_read_next;
WORD bit_pos = it_bit_buff->bit_pos;
if (it_bit_buff->cnt_bits < no_of_bits)
longjmp(*(it_bit_buff->xaac_jmp_buf),
IA_ENHAACPLUS_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
it_bit_buff->cnt_bits -= no_of_bits;
ptr_read_next += no_of_bits / 8;
bit_pos -= (no_of_bits % 8);
if (bit_pos < 0) {
bit_pos += 8;
ptr_read_next++;
}
assert(bit_pos >= 0 && bit_pos <= 7);
it_bit_buff->ptr_read_next = ptr_read_next;
it_bit_buff->bit_pos = (WORD16)bit_pos;
return no_of_bits;
}
WORD32 ixheaacd_show_bits_buf(ia_bit_buf_struct *it_bit_buff, WORD no_of_bits) {
UWORD32 ret_val;
UWORD8 *ptr_read_next = it_bit_buff->ptr_read_next;
WORD bit_pos = it_bit_buff->bit_pos;
if (it_bit_buff->cnt_bits < no_of_bits) {
longjmp(*(it_bit_buff->xaac_jmp_buf),
IA_ENHAACPLUS_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
}
ret_val = (UWORD32)*ptr_read_next;
bit_pos -= no_of_bits;
@ -56,10 +85,6 @@ WORD32 ixheaacd_show_bits_buf(ia_bit_buf_struct *it_bit_buff, WORD no_of_bits) {
bit_pos += 8;
ptr_read_next++;
if (ptr_read_next > it_bit_buff->ptr_bit_buf_end) {
ptr_read_next = it_bit_buff->ptr_bit_buf_base;
}
ret_val <<= 8;
ret_val |= (UWORD32)*ptr_read_next;
@ -79,21 +104,34 @@ WORD32 ixheaacd_read_bits_buf(ia_bit_buf_struct *it_bit_buff, WORD no_of_bits) {
return 0;
}
if (it_bit_buff->cnt_bits < no_of_bits) {
longjmp(*(it_bit_buff->xaac_jmp_buf),
IA_ENHAACPLUS_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
}
it_bit_buff->cnt_bits -= no_of_bits;
ret_val = (UWORD32)*ptr_read_next;
bit_pos -= no_of_bits;
while (bit_pos < 0) {
bit_pos += 8;
ptr_read_next++;
if (ptr_read_next > it_bit_buff->ptr_bit_buf_end) {
ptr_read_next = it_bit_buff->ptr_bit_buf_base;
if (0 == it_bit_buff->cnt_bits) {
while (bit_pos < -1) {
bit_pos += 8;
ptr_read_next++;
ret_val <<= 8;
ret_val |= (UWORD32)*ptr_read_next;
}
bit_pos += 8;
ret_val <<= 8;
ptr_read_next++;
} else {
while (bit_pos < 0) {
bit_pos += 8;
ptr_read_next++;
ret_val |= (UWORD32)*ptr_read_next;
ret_val <<= 8;
ret_val |= (UWORD32)*ptr_read_next;
}
}
ret_val = ret_val << ((31 - no_of_bits) - bit_pos) >> (32 - no_of_bits);
@ -118,45 +156,23 @@ UWORD32 ixheaacd_aac_read_byte(UWORD8 **ptr_read_next, WORD32 *bit_pos,
return 1;
}
UWORD32 ixheaacd_aac_read_2bytes(UWORD8 **ptr_read_next, WORD32 *bit_pos,
WORD32 *readword) {
UWORD8 *v = *ptr_read_next;
WORD32 bits_consumed = *bit_pos;
if ((bits_consumed - 16) >= 0) {
*readword = (*readword << 8) | *v;
v++;
*readword = (*readword << 8) | *v;
v++;
bits_consumed -= 16;
} else if ((bits_consumed - 8) >= 0) {
*readword = (*readword << 8) | *v;
v++;
bits_consumed -= 8;
}
*bit_pos = bits_consumed;
*ptr_read_next = v;
return 1;
}
UWORD32 ixheaacd_aac_read_byte_corr1(UWORD8 **ptr_read_next,
WORD16 *ptr_bit_pos, WORD32 *readword) {
WORD32 *ptr_bit_pos, WORD32 *readword,
UWORD8 *p_bit_buf_end) {
UWORD8 *v = *ptr_read_next;
WORD16 bits_consumed = *ptr_bit_pos;
WORD32 bits_consumed = *ptr_bit_pos;
WORD32 temp_bit_count = 0;
while (bits_consumed >= 8) {
if ((bits_consumed -= 8) >= 0) {
{
*readword = (*readword << 8) | *v;
v++;
}
} else {
bits_consumed += 8;
bits_consumed -= 8;
if ((p_bit_buf_end < v) && (p_bit_buf_end != 0))
temp_bit_count += 8;
else {
*readword = (*readword << 8) | *v;
v++;
}
}
*ptr_bit_pos = bits_consumed;
*ptr_bit_pos = bits_consumed + temp_bit_count;
*ptr_read_next = v;
return 1;
}
@ -193,6 +209,11 @@ WORD32 ixheaacd_aac_read_bit(ia_bit_buf_struct *it_bit_buff) {
ptr_read_next--;
}
if (ptr_read_next < it_bit_buff->ptr_bit_buf_base) {
longjmp(*(it_bit_buff->xaac_jmp_buf),
IA_ENHAACPLUS_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
}
it_bit_buff->cnt_bits += no_of_bits;
ret_val = *ptr_read_next;
bit_pos -= no_of_bits;
@ -211,6 +232,11 @@ WORD32 ixheaacd_aac_read_bit_rev(ia_bit_buf_struct *it_bit_buff) {
UWORD32 temp;
WORD no_of_bits = 1;
if (it_bit_buff->cnt_bits < no_of_bits) {
longjmp(*(it_bit_buff->xaac_jmp_buf),
IA_ENHAACPLUS_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
}
if (bit_pos >= 8) {
bit_pos -= 8;
ptr_read_next++;
@ -264,7 +290,8 @@ WORD32 ixheaacd_read_bit(ia_bit_buf_struct *it_bit_buff, WORD32 no_of_bits) {
return 0;
}
ret_val = ixheaacd_aac_showbits_32(ptr_read_next);
ret_val =
ixheaacd_aac_showbits_32(ptr_read_next, it_bit_buff->bit_count, NULL);
it_bit_buff->byte_ptr += (no_of_bits >> 3);
if (it_bit_buff->valid_bits != 8) {

View file

@ -20,6 +20,8 @@
#ifndef IXHEAACD_BITBUFFER_H
#define IXHEAACD_BITBUFFER_H
#include <setjmp.h>
#define CRC_ADTS_HEADER_LEN 56
#define CRC_ADTS_RAW_DATA_BLK_LEN 192
#define CRC_ADTS_RAW_IIND_ICS 128
@ -83,6 +85,7 @@ typedef struct ia_bit_buf_struct {
UWORD8 *ptr_start;
WORD32 write_bit_count;
WORD32 max_size;
jmp_buf *xaac_jmp_buf;
} ia_bit_buf_struct;
@ -103,24 +106,25 @@ ia_bit_buf_struct *ixheaacd_create_init_bit_buf(ia_bit_buf_struct *it_bit_buff,
WORD32 ixheaacd_read_bits_buf(ia_bit_buf_struct *it_bit_buff, WORD no_of_bits);
WORD32 ixheaacd_skip_bits_buf(ia_bit_buf_struct *it_bit_buff, WORD no_of_bits);
WORD32 ixheaacd_show_bits_buf(ia_bit_buf_struct *it_bit_buff, WORD no_of_bits);
VOID ixheaacd_read_bidirection(ia_bit_buf_struct *it_bit_buff,
WORD32 ixheaacd_drc_offset);
UWORD32 ixheaacd_aac_showbits_32(UWORD8 *ptr_read_next);
UWORD32 ixheaacd_aac_showbits_32(UWORD8 *ptr_read_next, WORD32 cnt_bits,
WORD32 *increment);
UWORD32 ixheaacd_aac_read_byte(UWORD8 **ptr_read_next, WORD32 *bit_pos,
WORD32 *readword);
UWORD32 ixheaacd_aac_read_2bytes(UWORD8 **ptr_read_next, WORD32 *bit_pos,
WORD32 *readword);
UWORD32 ixheaacd_aac_read_byte_corr(UWORD8 **ptr_read_next, WORD32 *ptr_bit_pos,
WORD32 *readword, UWORD8 *p_bit_buf_end);
UWORD32 ixheaacd_aac_read_byte_corr1(UWORD8 **ptr_read_next,
WORD16 *ptr_bit_pos, WORD32 *readword);
WORD32 *ptr_bit_pos, WORD32 *readword,
UWORD8 *p_bit_buf_end);
#define get_no_bits_available(it_bit_buff) ((it_bit_buff)->cnt_bits)
#define ixheaacd_no_bits_read(it_bit_buff) \

View file

@ -103,7 +103,7 @@ static PLATFORM_INLINE WORD32 ixheaacd_mac32x16in32_drc(WORD32 a, WORD32 b,
WORD32 ixheaacd_cnt_leading_ones(WORD32 a);
VOID ixheaacd_huff_sfb_table(WORD32 it_bit_buff, WORD16 *huff_index,
WORD16 *len, const UWORD16 *code_book_tbl,
WORD32 *len, const UWORD16 *code_book_tbl,
const UWORD32 *idx_table) {
UWORD32 temp = 0;
UWORD32 temp1 = 0;
@ -169,9 +169,14 @@ static PLATFORM_INLINE WORD ixheaacd_huffman_dec_word1(
WORD len_idx = 0;
UWORD8 *ptr_read_next = it_bit_buff->ptr_read_next;
WORD32 bit_pos = it_bit_buff->bit_pos;
WORD32 read_word = ixheaacd_aac_showbits_32(ptr_read_next);
WORD16 index, length;
ptr_read_next += 4;
WORD16 index;
WORD32 length;
WORD32 read_word;
WORD32 increment;
read_word = ixheaacd_aac_showbits_32(ptr_read_next, it_bit_buff->cnt_bits,
&increment);
ptr_read_next += increment;
do {
len_idx = offsets[1] - offsets[0];
@ -319,8 +324,12 @@ static PLATFORM_INLINE WORD ixheaacd_huffman_dec_word1(
no_bands--;
} while (no_bands >= 0);
ptr_read_next = ptr_read_next - increment;
ixheaacd_aac_read_byte_corr1(&ptr_read_next, &bit_pos, &read_word,
it_bit_buff->ptr_bit_buf_end);
it_bit_buff->bit_pos = bit_pos;
it_bit_buff->ptr_read_next = ptr_read_next - 4;
it_bit_buff->ptr_read_next = ptr_read_next;
return err_code;
}
@ -335,11 +344,16 @@ static PLATFORM_INLINE WORD ixheaacd_huffman_dec_word2_11(
WORD idx;
WORD32 out1, out2;
WORD32 err_code = 0;
WORD16 index, length;
WORD16 index;
WORD32 length;
UWORD8 *ptr_read_next = it_bit_buff->ptr_read_next;
WORD32 bit_pos = it_bit_buff->bit_pos;
WORD32 read_word = ixheaacd_aac_showbits_32(ptr_read_next);
ptr_read_next += 4;
WORD32 read_word;
WORD32 increment;
read_word = ixheaacd_aac_showbits_32(ptr_read_next, it_bit_buff->cnt_bits,
&increment);
ptr_read_next += increment;
for (idx = width; idx != 0; idx -= 2) {
{
@ -471,8 +485,11 @@ static PLATFORM_INLINE WORD ixheaacd_huffman_dec_word2_11(
}
}
}
ptr_read_next = ptr_read_next - increment;
ixheaacd_aac_read_byte_corr1(&ptr_read_next, &bit_pos, &read_word,
it_bit_buff->ptr_bit_buf_end);
it_bit_buff->ptr_read_next = ptr_read_next - 4;
it_bit_buff->ptr_read_next = ptr_read_next;
it_bit_buff->bit_pos = bit_pos;
return err_code;
@ -488,8 +505,12 @@ static PLATFORM_INLINE WORD ixheaacd_huffman_dec_quad(
WORD16 index, length;
UWORD8 *ptr_read_next = it_bit_buff->ptr_read_next;
WORD32 bit_pos = it_bit_buff->bit_pos;
WORD32 read_word = ixheaacd_aac_showbits_32(ptr_read_next);
ptr_read_next += 4;
WORD32 read_word;
WORD32 increment;
read_word = ixheaacd_aac_showbits_32(ptr_read_next, it_bit_buff->cnt_bits,
&increment);
ptr_read_next += increment;
spec_orig = spec_coef;
do {
idx_len = offsets[1] - offsets[0];
@ -608,7 +629,10 @@ static PLATFORM_INLINE WORD ixheaacd_huffman_dec_quad(
no_bands--;
} while (no_bands >= 0);
it_bit_buff->ptr_read_next = ptr_read_next - 4;
ptr_read_next = ptr_read_next - increment;
ixheaacd_aac_read_byte_corr1(&ptr_read_next, &bit_pos, &read_word,
it_bit_buff->ptr_bit_buf_end);
it_bit_buff->ptr_read_next = ptr_read_next;
it_bit_buff->bit_pos = bit_pos;
return 0;
@ -622,8 +646,12 @@ static PLATFORM_INLINE WORD ixheaacd_huffman_dec_word2_quad(
WORD16 index, length;
UWORD8 *ptr_read_next = it_bit_buff->ptr_read_next;
WORD32 bit_pos = it_bit_buff->bit_pos;
WORD32 read_word = ixheaacd_aac_showbits_32(ptr_read_next);
ptr_read_next += 4;
WORD32 read_word;
WORD32 increment;
read_word = ixheaacd_aac_showbits_32(ptr_read_next, it_bit_buff->cnt_bits,
&increment);
ptr_read_next += increment;
for (idx = width; idx != 0; idx -= 4) {
WORD32 ampres, ampres1;
@ -763,7 +791,10 @@ static PLATFORM_INLINE WORD ixheaacd_huffman_dec_word2_quad(
it_bit_buff->ptr_bit_buf_end);
}
it_bit_buff->ptr_read_next = ptr_read_next - 4;
ptr_read_next = ptr_read_next - increment;
ixheaacd_aac_read_byte_corr1(&ptr_read_next, &bit_pos, &read_word,
it_bit_buff->ptr_bit_buf_end);
it_bit_buff->ptr_read_next = ptr_read_next;
it_bit_buff->bit_pos = bit_pos;
return 0;
@ -784,8 +815,12 @@ static PLATFORM_INLINE WORD ixheaacd_huffman_dec_pair(
UWORD8 *ptr_read_next = it_bit_buff->ptr_read_next;
WORD32 bit_pos = it_bit_buff->bit_pos;
WORD32 read_word = ixheaacd_aac_showbits_32(ptr_read_next);
ptr_read_next += 4;
WORD32 read_word;
WORD32 increment;
read_word = ixheaacd_aac_showbits_32(ptr_read_next, it_bit_buff->cnt_bits,
&increment);
ptr_read_next += increment;
do {
len_idx = offsets[1] - offsets[0];
@ -858,7 +893,10 @@ static PLATFORM_INLINE WORD ixheaacd_huffman_dec_pair(
no_bands--;
} while (no_bands >= 0);
it_bit_buff->ptr_read_next = ptr_read_next - 4;
ptr_read_next = ptr_read_next - increment;
ixheaacd_aac_read_byte_corr1(&ptr_read_next, &bit_pos, &read_word,
it_bit_buff->ptr_bit_buf_end);
it_bit_buff->ptr_read_next = ptr_read_next;
it_bit_buff->bit_pos = bit_pos;
return 0;
@ -875,8 +913,12 @@ static PLATFORM_INLINE WORD ixheaacd_huffman_dec_word2_pair(
WORD16 index, length;
UWORD8 *ptr_read_next = it_bit_buff->ptr_read_next;
WORD32 bit_pos = it_bit_buff->bit_pos;
WORD32 read_word = ixheaacd_aac_showbits_32(ptr_read_next);
ptr_read_next += 4;
WORD32 read_word;
WORD32 increment;
read_word = ixheaacd_aac_showbits_32(ptr_read_next, it_bit_buff->cnt_bits,
&increment);
ptr_read_next += increment;
for (idx = width; idx != 0; idx -= 2) {
{
@ -955,7 +997,10 @@ static PLATFORM_INLINE WORD ixheaacd_huffman_dec_word2_pair(
it_bit_buff->ptr_bit_buf_end);
}
it_bit_buff->ptr_read_next = ptr_read_next - 4;
ptr_read_next = ptr_read_next - increment;
ixheaacd_aac_read_byte_corr1(&ptr_read_next, &bit_pos, &read_word,
it_bit_buff->ptr_bit_buf_end);
it_bit_buff->ptr_read_next = ptr_read_next;
it_bit_buff->bit_pos = bit_pos;
return 0;
@ -1028,6 +1073,7 @@ WORD ixheaacd_huffman_dec_word2(ia_bit_buf_struct *it_bit_buff, WORD32 cb_no,
WORD ret_val = 0;
WORD32 huff_mode;
WORD start_bit_pos = it_bit_buff->bit_pos;
WORD32 cnt_bits = it_bit_buff->cnt_bits;
WORD32 *pow_table =
(WORD32 *)ptr_aac_tables->pstr_block_tables->ixheaacd_pow_table_Q13;
UWORD8 *start_read_pos = it_bit_buff->ptr_read_next;
@ -1070,14 +1116,14 @@ WORD ixheaacd_huffman_dec_word2(ia_bit_buf_struct *it_bit_buff, WORD32 cb_no,
if (it_bit_buff->bit_pos <= 7) {
bits_cons = ((it_bit_buff->ptr_read_next - start_read_pos) << 3) +
(it_bit_buff->bit_pos - start_bit_pos);
it_bit_buff->cnt_bits -= bits_cons;
it_bit_buff->cnt_bits = cnt_bits - bits_cons;
} else {
it_bit_buff->ptr_read_next += (it_bit_buff->bit_pos) >> 3;
it_bit_buff->bit_pos = it_bit_buff->bit_pos & 0x7;
bits_cons = ((it_bit_buff->ptr_read_next - start_read_pos) << 3) +
((it_bit_buff->bit_pos - start_bit_pos));
it_bit_buff->cnt_bits -= bits_cons;
it_bit_buff->cnt_bits = cnt_bits - bits_cons;
}
}
return ret_val;

View file

@ -82,15 +82,25 @@
#define SPEC(ptr, w, gl) ((ptr) + ((w) * (gl)))
#define _SWAP(a, b) \
(b = (((WORD32)a[0] << 24) | ((WORD32)a[1] << 16) | ((WORD32)a[2] << 8) | \
((WORD32)a[3])))
UWORD32 ixheaacd_aac_showbits_32(UWORD8 *ptr_read_next) {
UWORD32 ixheaacd_aac_showbits_32(UWORD8 *ptr_read_next, WORD32 cnt_bits,
WORD32 *increment) {
UWORD8 *v = ptr_read_next;
UWORD32 b = 0;
WORD32 i;
WORD32 bumped = 0;
_SWAP(v, b);
for (i = 0; i < 4; i++) {
b = b << 8;
if (cnt_bits > 0) {
b = b | *v;
v++;
bumped++;
}
cnt_bits -= 8;
}
if (increment != NULL) {
*increment = bumped;
}
return b;
}
@ -263,6 +273,7 @@ static WORD16 ixheaacd_read_block_data(
if (ptr_aac_dec_channel_info->str_tns_info.tns_data_present)
error_code =
ixheaacd_read_tns_data(it_bit_buff, ptr_aac_dec_channel_info);
if (error_code) return error_code;
}
if (aac_spect_data_resil_flag &&
@ -271,8 +282,9 @@ static WORD16 ixheaacd_read_block_data(
if (aac_sf_data_resil_flag &&
((object_type == AOT_ER_AAC_ELD) || (object_type == AOT_ER_AAC_LD))) {
ixheaacd_rvlc_dec(ptr_aac_dec_channel_info, ptr_aac_dec_static_channel_info,
it_bit_buff);
error_code = ixheaacd_rvlc_dec(
ptr_aac_dec_channel_info, ptr_aac_dec_static_channel_info, it_bit_buff);
if (error_code) return error_code;
it_bit_buff->bit_pos = 7 - it_bit_buff->bit_pos;
}
@ -281,11 +293,12 @@ static WORD16 ixheaacd_read_block_data(
if (ptr_aac_dec_channel_info->str_tns_info.tns_data_present)
error_code =
ixheaacd_read_tns_data(it_bit_buff, ptr_aac_dec_channel_info);
if (error_code) return error_code;
}
{ it_bit_buff->bit_pos = 7 - it_bit_buff->bit_pos; }
error_code |= ixheaacd_read_spectral_data(
error_code = ixheaacd_read_spectral_data(
it_bit_buff, ptr_aac_dec_channel_info, ptr_aac_tables, total_channels,
frame_size, object_type, aac_spect_data_resil_flag,
aac_sf_data_resil_flag);
@ -575,7 +588,8 @@ VOID ixheaacd_channel_pair_process(
void *self_ptr) {
WORD32 channel;
ia_aac_decoder_struct *self = self_ptr;
if (aac_spect_data_resil_flag) {
if (aac_spect_data_resil_flag &&
((object_type == AOT_ER_AAC_LD) || (object_type == AOT_ER_AAC_ELD))) {
for (channel = 0; channel < num_ch; channel++) {
ixheaacd_cblock_inv_quant_spect_data(ptr_aac_dec_channel_info[channel],
ptr_aac_tables);
@ -784,10 +798,6 @@ WORD16 ixheaacd_read_spectral_data(
ptr_aac_tables->pstr_block_tables->ixheaacd_pow_table_Q13,
ptr_scratch);
}
else {
memset(ptr_spec_coef_out, 0, sizeof(WORD32) * sfb_width);
}
}
ptr_scratch += sfb_width;
ptr_spec_coef_out += sfb_width;
@ -798,7 +808,7 @@ WORD16 ixheaacd_read_spectral_data(
else
index = frame_size - swb_offset[max_sfb];
memset(ptr_spec_coef_out, 0, sizeof(WORD32) * index);
if (index < 0) return -1;
} else {
memset(ptr_spec_coef, 0, sizeof(WORD32) * 1024);
@ -878,6 +888,12 @@ WORD16 ixheaacd_read_spectral_data(
ixheaacd_huff_mute_erroneous_lines(pstr_hcr_info);
}
if (it_bit_buff->cnt_bits <
ptr_aac_dec_channel_info->reorder_spect_data_len) {
longjmp(*(it_bit_buff->xaac_jmp_buf),
IA_ENHAACPLUS_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
}
it_bit_buff->cnt_bits +=
-ptr_aac_dec_channel_info->reorder_spect_data_len;
it_bit_buff->ptr_read_next =
@ -1146,6 +1162,26 @@ WORD32 ixheaacd_ltp_data(WORD32 object_type, ia_ics_info_struct *ics,
ltp->long_used[sfb] = ixheaacd_read_bits_buf(bs, 1);
}
}
if (ics->frame_length == 480) {
if ((ics->sampling_rate_index > 5) &&
(ltp->last_band > MAX_LTP_SFB_SR_FIVE_PLUS_480))
ltp->last_band = MAX_LTP_SFB_SR_FIVE_PLUS_480;
else if ((ics->sampling_rate_index == 5) &&
(ltp->last_band > MAX_LTP_SFB_SR_FIVE_480))
ltp->last_band = MAX_LTP_SFB_SR_FIVE_480;
else if ((ics->sampling_rate_index < 5) &&
(ltp->last_band > MAX_LTP_SFB_SR_FIVE_LESS_480))
ltp->last_band = MAX_LTP_SFB_SR_FIVE_LESS_480;
} else if (ics->frame_length == 512) {
if ((ics->sampling_rate_index > 5) &&
(ltp->last_band > MAX_LTP_SFB_SR_FIVE_PLUS_512))
ltp->last_band = MAX_LTP_SFB_SR_FIVE_PLUS_512;
else if ((ics->sampling_rate_index == 5) &&
(ltp->last_band > MAX_LTP_SFB_SR_FIVE_512))
ltp->last_band = MAX_LTP_SFB_SR_FIVE_512;
else if ((ics->sampling_rate_index < 5) &&
(ltp->last_band > MAX_LTP_SFB_SR_FIVE_LESS_512))
ltp->last_band = MAX_LTP_SFB_SR_FIVE_LESS_512;
}
return 0;
}

View file

@ -85,9 +85,13 @@ ixheaacd_aac_showbits_7(ia_bit_buf_struct *it_bit_buff) {
UWORD8 *v = it_bit_buff->ptr_read_next;
UWORD32 b = 0;
UWORD32 x;
b = (((WORD32)v[0] << 8) | (WORD32)(v[1]));
b = ((WORD32)v[0] << 8);
if (it_bit_buff->bit_pos < 6) {
b |= (WORD32)(v[1]);
}
x = (UWORD32)b << (15 + 8 - it_bit_buff->bit_pos);
x = (UWORD32)x >> (25);
return x;
}
@ -162,7 +166,7 @@ WORD ixheaacd_get_channel_mask(
VOID ixheaacd_read_data_stream_element(ia_bit_buf_struct *it_bit_buff,
WORD32 *byte_align_bits,
ia_drc_dec_struct *drc_handle) {
ia_bit_buf_struct temp_bs;
ia_bit_buf_struct temp_bs = {0};
WORD32 count = ixheaacd_read_bits_buf(it_bit_buff, 13);
WORD32 cnt = (count & 0xff);
WORD32 start_pos = 0;
@ -207,12 +211,13 @@ VOID ixheaacd_read_data_stream_element(ia_bit_buf_struct *it_bit_buff,
}
}
if (it_bit_buff->cnt_bits < (cnt << 3)) {
longjmp(*(it_bit_buff->xaac_jmp_buf),
IA_ENHAACPLUS_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
}
it_bit_buff->ptr_read_next += cnt;
it_bit_buff->cnt_bits -= ((cnt) << 3);
if (it_bit_buff->ptr_read_next > it_bit_buff->ptr_bit_buf_end) {
it_bit_buff->ptr_read_next = it_bit_buff->ptr_bit_buf_base;
}
}
VOID ixheaacd_read_fill_element(ia_bit_buf_struct *it_bit_buff,
@ -239,12 +244,13 @@ VOID ixheaacd_read_fill_element(ia_bit_buf_struct *it_bit_buff,
} else {
ixheaacd_read_bits_buf(it_bit_buff, 4);
if (it_bit_buff->cnt_bits < ((count - 1) << 3)) {
longjmp(*(it_bit_buff->xaac_jmp_buf),
IA_ENHAACPLUS_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
}
it_bit_buff->ptr_read_next += count - 1;
it_bit_buff->cnt_bits -= ((count - 1) << 3);
if (it_bit_buff->ptr_read_next > it_bit_buff->ptr_bit_buf_end) {
it_bit_buff->ptr_read_next = it_bit_buff->ptr_bit_buf_base;
}
}
}
}
@ -312,10 +318,7 @@ WORD32 ixheaacd_get_element_index_tag(
it_bit_buff, &p_obj_enhaacplus_dec->aac_config.ui_pce_found_in_hdr,
&p_obj_enhaacplus_dec->aac_config.str_prog_config);
if (error_code != 0) {
if (it_bit_buff->cnt_bits < 0) {
return (WORD16)(
(WORD32)IA_ENHAACPLUS_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
}
if (error_code < 0) return error_code;
return IA_ENHAACPLUS_DEC_EXE_NONFATAL_DECODE_FRAME_ERROR;
}
}

View file

@ -40,6 +40,8 @@
#define USAC_OUT_FRAMELENGTH_2048 2048
#define USAC_OUT_FRAMELENGTH_4096 4096
#define MAX_CORE_SBR_FRAME_LEN_IDX (4)
#define ID_EXT_ELE_FILL 0
#define ID_EXT_ELE_MPEGS 1
#define ID_EXT_ELE_SAOC 2

View file

@ -39,7 +39,20 @@
#include "ixheaacd_drc_data_struct.h"
#include "ixheaacd_drc_dec.h"
#include "ixheaacd_sbr_scale.h"
#include "ixheaacd_env_extr_part.h"
#include "ixheaacd_sbr_rom.h"
#include "ixheaacd_hybrid.h"
#include "ixheaacd_ps_dec.h"
#include "ixheaacd_common_rom.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_sbr_const.h"
#include "ixheaacd_lpp_tran.h"
#include "ixheaacd_sbrdecoder.h"
#include "ixheaacd_env_extr.h"
#include "ixheaacd_env_calc.h"
#include "ixheaacd_pvc_dec.h"
#include "ixheaacd_sbr_dec.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_sbr_const.h"
@ -50,7 +63,6 @@
#include <ixheaacd_type_def.h>
#include "ixheaacd_memory_standards.h"
#include "ixheaacd_sbrdecsettings.h"
#include "ixheaacd_env_extr_part.h"
#include "ixheaacd_defines.h"
#include <ixheaacd_aac_rom.h>
#include "ixheaacd_common_rom.h"
@ -302,21 +314,26 @@ WORD32 ixheaacd_decode_init(
case ID_USAC_SCE:
case ID_USAC_LFE:
if ((chan + 1) > MAX_NUM_CHANNELS_USAC_LVL2) return -1;
usac_data->seed_value[chan] = 0x3039;
chan++;
break;
case ID_USAC_CPE: {
WORD32 frame_len_tbl[] = {-1, -1, 32, 32, 64};
static const WORD32 frame_len_tbl[MAX_CORE_SBR_FRAME_LEN_IDX + 1] = {
-1, -1, 32, 32, 64};
if ((chan + 2) > MAX_NUM_CHANNELS_USAC_LVL2) return -1;
usac_data->seed_value[chan] = 0x3039;
chan++;
usac_data->seed_value[chan] = 0x10932;
chan++;
if (stereo_config_index > 0) {
WORD32 bs_frame_length =
frame_len_tbl[ptr_usac_config->core_sbr_framelength_index] - 1;
frame_len_tbl[ptr_usac_config->core_sbr_framelength_index];
WORD32 bs_residual_coding = (stereo_config_index > 1) ? 1 : 0;
ia_usac_dec_mps_config_struct *ptr_usac_mps212_config =
@ -523,7 +540,6 @@ WORD32 ixheaacd_decode_create(ia_exhaacplus_dec_api_struct *handle,
WORD32 tracks_for_decoder) {
WORD32 stream;
WORD32 num_delay_samp = 0;
WORD32 err = 0;
ia_frame_data_struct *pstr_frame_data;
WORD32 stream_count;
@ -541,6 +557,8 @@ WORD32 ixheaacd_decode_create(ia_exhaacplus_dec_api_struct *handle,
err = ixheaacd_dec_data_init(handle, pstr_frame_data,
&(pstr_dec_data->str_usac_data));
if (err != 0) return err;
switch (pstr_dec_data->str_usac_data.sbr_ratio_idx) {
case 0:
handle->aac_config.ui_sbr_mode = 0;
@ -559,7 +577,6 @@ WORD32 ixheaacd_decode_create(ia_exhaacplus_dec_api_struct *handle,
handle->aac_config.ui_sbr_mode = 0;
}
if (err != 0) return err;
break;
@ -677,9 +694,12 @@ WORD32 ixheaacd_decode_create(ia_exhaacplus_dec_api_struct *handle,
if (pstr_dec_data->str_usac_data.pstr_esbr_dec == NULL) {
return -1;
} else {
pstr_dec_data->str_usac_data.pstr_esbr_dec->xaac_jmp_buf =
&(aac_dec_handle->xaac_jmp_buf);
}
}
}
return (num_delay_samp);
aac_dec_handle->decode_create_done = 1;
return 0;
}

View file

@ -20,7 +20,7 @@
#include <stdlib.h>
#include <string.h>
#include <ixheaacd_type_def.h>
#include <ixheaacd_type_def.h>
#include "ixheaacd_error_standards.h"
#include "ixheaacd_memory_standards.h"
#include "ixheaacd_sbrdecsettings.h"
#include "ixheaacd_env_extr_part.h"
@ -263,12 +263,14 @@ WORD32 ixheaacd_dec_main(VOID *temp_handle, WORD8 *inbuffer, WORD8 *outbuffer,
if (frames_done == 0) {
WORD32 delay;
delay = ixheaacd_decode_create(
handle, pstr_dec_data,
pstr_dec_data->str_frame_data.scal_out_select + 1);
if (aac_dec_handle->decode_create_done == 0) {
delay = ixheaacd_decode_create(
handle, pstr_dec_data,
pstr_dec_data->str_frame_data.scal_out_select + 1);
if (delay == -1) return -1;
}
pstr_dec_data->dec_bit_buf.max_size =
handle->p_mem_info_aac[IA_MEMTYPE_INPUT].ui_size;
if (delay == -1) return -1;
*num_channel_out = pstr_dec_data->str_frame_data.scal_out_num_channels;
return 0;
}
@ -280,6 +282,7 @@ WORD32 ixheaacd_dec_main(VOID *temp_handle, WORD8 *inbuffer, WORD8 *outbuffer,
pstr_dec_data->dec_bit_buf.ptr_read_next = (UWORD8 *)inbuffer;
pstr_dec_data->dec_bit_buf.bit_pos = 7;
pstr_dec_data->dec_bit_buf.cnt_bits = pstr_dec_data->dec_bit_buf.size;
pstr_dec_data->dec_bit_buf.xaac_jmp_buf = &(aac_dec_handle->xaac_jmp_buf);
pstr_dec_data->str_usac_data.usac_flag = aac_dec_handle->usac_flag;
if (pstr_dec_data->dec_bit_buf.size > pstr_dec_data->dec_bit_buf.max_size)
@ -298,15 +301,15 @@ WORD32 ixheaacd_dec_main(VOID *temp_handle, WORD8 *inbuffer, WORD8 *outbuffer,
if (config_len != 0) {
/* updating the config parameters*/
ia_bit_buf_struct *config_bit_buf =
(ia_bit_buf_struct *)malloc(sizeof(ia_bit_buf_struct));
ia_bit_buf_struct config_bit_buf = {0};
config_bit_buf->ptr_bit_buf_base = config;
config_bit_buf->size = config_len << 3;
config_bit_buf->ptr_read_next = config_bit_buf->ptr_bit_buf_base;
config_bit_buf->ptr_bit_buf_end = (UWORD8 *)config + config_len;
config_bit_buf->bit_pos = 7;
config_bit_buf->cnt_bits = config_bit_buf->size;
config_bit_buf.ptr_bit_buf_base = config;
config_bit_buf.size = config_len << 3;
config_bit_buf.ptr_read_next = config_bit_buf.ptr_bit_buf_base;
config_bit_buf.ptr_bit_buf_end = (UWORD8 *)config + config_len;
config_bit_buf.bit_pos = 7;
config_bit_buf.cnt_bits = config_bit_buf.size;
config_bit_buf.xaac_jmp_buf = &(aac_dec_handle->xaac_jmp_buf);
suitable_tracks =
ixheaacd_frm_data_init(pstr_audio_specific_config, pstr_dec_data);
@ -314,14 +317,18 @@ WORD32 ixheaacd_dec_main(VOID *temp_handle, WORD8 *inbuffer, WORD8 *outbuffer,
if (suitable_tracks <= 0) return -1;
/* call codec re-configure*/
aac_dec_handle->decode_create_done = 0;
err = ixheaacd_config(
config_bit_buf, &(pstr_dec_data->str_frame_data
.str_audio_specific_config.str_usac_config),
&config_bit_buf, &(pstr_dec_data->str_frame_data
.str_audio_specific_config.str_usac_config),
&(pstr_audio_specific_config
->channel_configuration) /*&pstr_audio_specific_config->str_usac_config*/);
free(config_bit_buf);
if (err != 0) return -1;
pstr_dec_data->str_frame_data.str_audio_specific_config
.sampling_frequency =
pstr_dec_data->str_frame_data.str_audio_specific_config
.str_usac_config.usac_sampling_frequency;
delay = ixheaacd_decode_create(
handle, pstr_dec_data,
pstr_dec_data->str_frame_data.scal_out_select + 1);
@ -336,6 +343,7 @@ WORD32 ixheaacd_dec_main(VOID *temp_handle, WORD8 *inbuffer, WORD8 *outbuffer,
pstr_dec_data->dec_bit_buf.ptr_read_next = (UWORD8 *)inbuffer;
pstr_dec_data->dec_bit_buf.bit_pos = 7;
pstr_dec_data->dec_bit_buf.cnt_bits = pstr_dec_data->dec_bit_buf.size;
pstr_dec_data->dec_bit_buf.xaac_jmp_buf = &(aac_dec_handle->xaac_jmp_buf);
pstr_dec_data->str_usac_data.usac_flag = aac_dec_handle->usac_flag;
@ -351,6 +359,7 @@ WORD32 ixheaacd_dec_main(VOID *temp_handle, WORD8 *inbuffer, WORD8 *outbuffer,
}
// temp_read=ixheaacd_show_bits_buf(pstr_dec_data->dec_bit_buf,preroll_frame_offset[access_unit]);
if (!aac_dec_handle->decode_create_done) return IA_FATAL_ERROR;
err =
ixheaacd_usac_process(pstr_dec_data, num_channel_out, aac_dec_handle);

View file

@ -28,6 +28,7 @@
#define MAX_BINS_LONG 1024
#define MAX_BINS_SHORT 128
#define MAX_SCALE_FACTOR_BANDS_SHORT 16
#define MAX_SCALE_FACTOR_BANDS_LONG (52)
#define ZERO_HCB 0
@ -59,4 +60,6 @@
typedef struct { WORD32 sampling_frequency; } ia_sampling_rate_info_struct;
#define USAC_MAX_SAMPLE_RATE (96000)
#endif

View file

@ -76,7 +76,6 @@ typedef struct {
UWORD8 max_audio_channels;
UWORD8 length_history;
UWORD8 num_drc_elements;
WORD32 is_longblock[MAX_BS_ELEMENT];
WORD32 state;
WORD32 target_ref_level;
WORD32 prog_ref_level;

View file

@ -672,11 +672,15 @@ static int ixheaacd_drc_read_compression(ia_handle_bit_buf_struct bs,
int bit_count = 0;
int dmx_lvl_present, ext_present, compression_present;
int coarse_gain_present, fine_grain_present;
ia_bit_buf_struct local_bs;
ia_bit_buf_struct local_bs = {0};
WORD32 bytes = 0, bits = 0;
memcpy(&local_bs, bs, sizeof(ia_bit_buf_struct));
if (local_bs.size < bs_pos) {
longjmp(*(local_bs.xaac_jmp_buf),
IA_ENHAACPLUS_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
}
bytes = (local_bs.size - bs_pos) >> 3;
bits = (local_bs.size - bs_pos) % 8;

View file

@ -1277,7 +1277,7 @@ VOID ixheaacd_enery_calc_persfb(WORD32 **anal_buf_real, WORD32 **anal_buf_imag,
WORD16 temp;
temp = ixheaacd_extract16l(ixheaacd_shr32_dir(*ptr, pre_shift1));
ptr += 64;
accu_line = ixheaacd_mac16x16in32(accu_line, temp, temp);
accu_line = ixheaacd_mac16x16in32_sat(accu_line, temp, temp);
}
}
accumulate =
@ -1518,7 +1518,7 @@ VOID ixheaacd_harm_idx_zerotwolp_dec(WORD32 *ptr_real_buf, WORD16 *ptr_gain_buf,
sine_level = (ptr_sine_level_buf[2 * k] << 16);
if (sine_level == 0) {
*ptr_real_buf++ = ixheaacd_mac16x16in32_shl(
*ptr_real_buf++ = ixheaacd_mac16x16in32_shl_sat(
signal_real, ixheaacd_extract16h(ptr_rand_ph[k]),
noise_level_mant[2 * k]);
} else if (harm_index == 0)
@ -1579,7 +1579,7 @@ VOID ixheaacd_harm_idx_onethreelp(
tone_count++;
} else {
if (!noise_absc_flag) {
signal_real = ixheaacd_mac16x16in32_shl(
signal_real = ixheaacd_mac16x16in32_shl_sat(
signal_real, ixheaacd_extract16h(ptr_rand_ph[k]), *noise_level_mant);
}
}
@ -1625,7 +1625,7 @@ VOID ixheaacd_harm_idx_onethreelp(
sine_level_next = (ptr_sine_level_buf[2 * (k + 1)]);
if ((!noise_absc_flag) && (sine_level == 0)) {
signal_real = ixheaacd_mac16x16in32_shl(
signal_real = ixheaacd_mac16x16in32_shl_sat(
signal_real, ixheaacd_extract16h(ptr_rand_ph[k]), *noise_level_mant);
}
noise_level_mant += 2;
@ -1660,7 +1660,7 @@ VOID ixheaacd_harm_idx_onethreelp(
tone_count++;
} else {
if (!noise_absc_flag) {
signal_real = ixheaacd_mac16x16in32_shl(
signal_real = ixheaacd_mac16x16in32_shl_sat(
signal_real, ixheaacd_extract16h(ptr_rand_ph[k]),
*noise_level_mant);
}
@ -1738,9 +1738,9 @@ VOID ixheaacd_harm_idx_zerotwo(FLAG noise_absc_flag, WORD16 num_sub_bands,
WORD32 random = *ptr_rand_ph;
WORD16 noise = smoothed_noise[0];
*ptr_real_buf = ixheaacd_mac16x16in32_shl(
*ptr_real_buf = ixheaacd_mac16x16in32_shl_sat(
signal_real, ixheaacd_extract16h(random), noise);
*ptr_imag = ixheaacd_mac16x16in32_shl(
*ptr_imag = ixheaacd_mac16x16in32_shl_sat(
sig_imag, ixheaacd_extract16l(random), noise);
} else {
*ptr_real_buf = signal_real;
@ -1811,9 +1811,9 @@ VOID ixheaacd_harm_idx_onethree(FLAG noise_absc_flag, WORD16 num_sub_bands,
WORD32 random = *ptr_rand_ph;
WORD16 noise = smoothed_noise[0];
*ptr_real_buf = ixheaacd_mac16x16in32_shl(
*ptr_real_buf = ixheaacd_mac16x16in32_shl_sat(
signal_real, ixheaacd_extract16h(random), noise);
*ptr_imag = ixheaacd_mac16x16in32_shl(
*ptr_imag = ixheaacd_mac16x16in32_shl_sat(
sig_imag, ixheaacd_extract16l(random), noise);
} else {
*ptr_real_buf = signal_real;
@ -1828,4 +1828,4 @@ VOID ixheaacd_harm_idx_onethree(FLAG noise_absc_flag, WORD16 num_sub_bands,
ptr_real_buf++;
ptr_imag++;
}
}
}

View file

@ -20,6 +20,7 @@
#include <string.h>
#include "ixheaacd_sbr_common.h"
#include <ixheaacd_type_def.h>
#include "ixheaacd_error_standards.h"
#include "ixheaacd_constants.h"
#include <ixheaacd_basic_ops32.h>
@ -377,9 +378,10 @@ VOID ixheaacd_add_arr(WORD16 *ptr1, WORD16 *ptr2, WORD32 num) {
}
}
VOID ixheaacd_calc_noise_floor(ia_sbr_header_data_struct *ptr_header_data,
ia_sbr_frame_info_data_struct *ptr_sbr_data,
ia_sbr_prev_frame_data_struct *ptr_prev_data) {
IA_ERRORCODE ixheaacd_calc_noise_floor(
ia_sbr_header_data_struct *ptr_header_data,
ia_sbr_frame_info_data_struct *ptr_sbr_data,
ia_sbr_prev_frame_data_struct *ptr_prev_data) {
WORD32 i;
WORD32 num_nf_bands;
WORD32 num_noise_env;
@ -424,6 +426,8 @@ VOID ixheaacd_calc_noise_floor(ia_sbr_header_data_struct *ptr_header_data,
ixheaacd_limit_noise_floor_fac(ptr_header_data, ptr_sbr_data);
ixheaacd_drc_offset = num_nf_bands * (num_noise_env - 1);
if (ixheaacd_drc_offset < 0 || ixheaacd_drc_offset >= MAX_NUM_NOISE_VALUES)
return IA_FATAL_ERROR;
ptr1 = &ptr_sbr_data->int_noise_floor[ixheaacd_drc_offset];
ptr2 = ptr_prev_noise_floor;
@ -443,13 +447,16 @@ VOID ixheaacd_calc_noise_floor(ia_sbr_header_data_struct *ptr_header_data,
*ptr_noise_floor++ = (WORD16)(0x4000 + (noise_floor_exp & MASK_FOR_EXP));
}
}
return IA_NO_ERROR;
}
VOID ixheaacd_dec_sbrdata_for_pvc(
IA_ERRORCODE ixheaacd_dec_sbrdata_for_pvc(
ia_sbr_header_data_struct *ptr_header_data,
ia_sbr_frame_info_data_struct *ptr_sbr_data,
ia_sbr_prev_frame_data_struct *ptr_prev_data) {
ixheaacd_calc_noise_floor(ptr_header_data, ptr_sbr_data, ptr_prev_data);
WORD32 err = 0;
err = ixheaacd_calc_noise_floor(ptr_header_data, ptr_sbr_data, ptr_prev_data);
if (err) return err;
if (!ptr_sbr_data->coupling_mode) {
ptr_sbr_data->num_noise_sfac =
@ -458,6 +465,7 @@ VOID ixheaacd_dec_sbrdata_for_pvc(
ixheaacd_dequant_pvc_env_data(ptr_sbr_data->num_noise_sfac,
ptr_sbr_data->flt_noise_floor);
}
return IA_NO_ERROR;
}
VOID ixheaacd_sbr_env_dequant_coup_fix(
@ -589,8 +597,10 @@ WORD32 ixheaacd_dec_sbrdata(ia_sbr_header_data_struct *ptr_header_data_ch_0,
if (err) return err;
ixheaacd_calc_noise_floor(ptr_header_data_ch_0, ptr_sbr_data_ch_0,
ptr_prev_data_ch_0);
err = ixheaacd_calc_noise_floor(ptr_header_data_ch_0, ptr_sbr_data_ch_0,
ptr_prev_data_ch_0);
if (err == (WORD32)IA_FATAL_ERROR) return (WORD32)IA_FATAL_ERROR;
if (!ptr_sbr_data_ch_0->coupling_mode && usac_flag) {
ptr_sbr_data_ch_0->num_noise_sfac =
@ -611,8 +621,10 @@ WORD32 ixheaacd_dec_sbrdata(ia_sbr_header_data_struct *ptr_header_data_ch_0,
if (err) return err;
ixheaacd_calc_noise_floor(ptr_header_data_ch_1, ptr_sbr_data_ch_1,
ptr_prev_data_ch_1);
err = ixheaacd_calc_noise_floor(ptr_header_data_ch_1, ptr_sbr_data_ch_1,
ptr_prev_data_ch_1);
if (err) return err;
if (!ptr_sbr_data_ch_1->coupling_mode && usac_flag) {
ptr_sbr_data_ch_1->num_noise_sfac =
@ -656,6 +668,7 @@ WORD32 ixheaacd_dec_envelope(ia_sbr_header_data_struct *ptr_header_data,
WORD32 usac_flag = ptr_header_data->usac_flag;
WORD32 temp_1 =
ptr_prev_data_ch_0->end_position - ptr_header_data->num_time_slots;
if (temp_1 < 0) return -1;
temp_1 = ptr_sbr_data->str_frame_info_details.border_vec[0] - temp_1;
if ((!ptr_header_data->err_flag_prev) && (!ptr_header_data->err_flag) &&

View file

@ -28,9 +28,10 @@ WORD32 ixheaacd_dec_sbrdata(ia_sbr_header_data_struct *ptr_header_data_ch_0,
ia_sbr_prev_frame_data_struct *ptr_prev_data_ch_1,
ixheaacd_misc_tables *ptr_common_tables);
VOID ixheaacd_dec_sbrdata_for_pvc(ia_sbr_header_data_struct *ptr_header_data,
ia_sbr_frame_info_data_struct *ptr_sbr_data,
ia_sbr_prev_frame_data_struct *ptr_prev_data);
IA_ERRORCODE ixheaacd_dec_sbrdata_for_pvc(
ia_sbr_header_data_struct *ptr_header_data,
ia_sbr_frame_info_data_struct *ptr_sbr_data,
ia_sbr_prev_frame_data_struct *ptr_prev_data);
VOID ixheaacd_harm_idx_onethreelp(WORD32 *ptr_real_buf, WORD16 *ptr_gain_buf,
WORD scale_change, WORD16 *ptr_sine_level_buf,

View file

@ -1138,9 +1138,15 @@ VOID ixheaacd_read_env_data(ia_sbr_frame_info_data_struct *ptr_frame_data,
}
for (i = (1 - dtdf_dir_flag); i < no_band[j]; i++) {
readword = ixheaacd_show_bits_buf(it_bit_buff, 20);
ixheaacd_huffman_decode(readword << 12, &index, &length,
(const UWORD16 *)h, (const UWORD32 *)idx_tab);
if (it_bit_buff->cnt_bits < 20) {
readword = ixheaacd_show_bits_buf(it_bit_buff, it_bit_buff->cnt_bits);
readword = readword << (32 - it_bit_buff->cnt_bits);
} else {
readword = ixheaacd_show_bits_buf(it_bit_buff, 20);
readword = readword << 12;
}
ixheaacd_huffman_decode(readword, &index, &length, (const UWORD16 *)h,
(const UWORD32 *)idx_tab);
delta = index - lav;
ixheaacd_read_bits_buf(it_bit_buff, length);
p_sbr_sf[ixheaacd_drc_offset + i] =
@ -1328,7 +1334,7 @@ int ixheaacd_extract_frame_info_ld(
WORD16 time_border[MAX_ENVELOPES + 1];
WORD16 time_border_noise[2 + 1];
WORD16 f[MAX_ENVELOPES + 1];
int rel_bord_lead[7] ={0};
int rel_bord_lead[7] = {0};
ia_frame_info_struct *v_frame_info = &h_frame_data->str_frame_info_details;
@ -1354,6 +1360,9 @@ int ixheaacd_extract_frame_info_ld(
bs_transient_position =
ixheaacd_read_bits_buf(it_bit_buff, SBR_TRAN_BITS);
v_frame_info->frame_class = 0;
if ((numTimeSlots != 16) && (bs_transient_position >= LD_ENV_TBL_480)) {
return -1;
}
bs_num_env = (numTimeSlots == 16)
? ixheaacd_ld_env_table_512[bs_transient_position]
[SBR_ENVT_NUMENV]

View file

@ -20,8 +20,6 @@
#ifndef IXHEAACD_ERROR_STANDARDS_H
#define IXHEAACD_ERROR_STANDARDS_H
typedef WORD32 IA_ERRORCODE;
#define IA_NO_ERROR 0x00000000
#define IA_FATAL_ERROR 0x80000000

View file

@ -22,7 +22,7 @@
#include <string.h>
#include <ixheaacd_type_def.h>
#include "ixheaacd_error_standards.h"
#include "ixheaacd_sbr_const.h"
#include "ixheaacd_sbrdecsettings.h"
#include "ixheaacd_bitbuffer.h"
@ -569,6 +569,8 @@ WORD32 ixheaacd_sbr_env_calc(ia_sbr_frame_info_data_struct *frame_data,
}
for (i = 0; i < bs_num_env; i++) {
if (kk > MAX_NOISE_ENVELOPES) return IA_FATAL_ERROR;
if (p_frame_info->border_vec[i] == p_frame_info->noise_border_vec[kk])
kk++, next++;

View file

@ -57,5 +57,5 @@ extern const FLOAT32 ixheaacd_analy_cos_sin_table_kl_16[16 * 16 * 2];
extern const FLOAT32 ixheaacd_analy_cos_sin_table_kl_24[24 * 24 * 2];
extern const FLOAT32 ixheaacd_analy_cos_sin_table_kl_32[32 * 32 * 2];
extern const FLOAT32 ixheaacd_analy_cos_sin_table_kl_40[40 * 80 * 2];
extern const FLOAT32 ixheaacd_sel_case[4][8];
extern const FLOAT32 ixheaacd_sel_case[5][8];
#endif

View file

@ -353,38 +353,42 @@ static VOID ixheaacd_filter_and_add(const WORD32 *in, const WORD32 length,
sum = ixheaacd_mac32x32in64(sum, in[1], filter[1]);
sum = ixheaacd_mac32x32in64(sum, in[0], filter[2]);
sum = ixheaacd_mac32x32in64_n(sum, &in[0], &filter[3], 4);
*out += (WORD32)((sum * factor_even) >> 15);
*out = ixheaacd_add32_sat(
*out, ixheaacd_sat64_32((((WORD64)sum * (WORD64)factor_even) >> 15)));
out++;
sum = ixheaacd_mult32x32in64(in[1], filter[0]);
sum = ixheaacd_mac32x32in64(sum, in[0], filter[1]);
sum = ixheaacd_mac32x32in64_n(sum, &in[0], &filter[2], 5);
*out += (WORD32)((sum * factor_odd) >> 15);
*out = ixheaacd_add32_sat(
*out, ixheaacd_sat64_32((((WORD64)sum * (WORD64)factor_odd) >> 15)));
out++;
sum = ixheaacd_mult32x32in64(in[0], filter[0]);
sum = ixheaacd_mac32x32in64_n(sum, &in[0], &filter[1], 6);
*out = ixheaacd_add32_sat(*out, (WORD32)((sum * factor_even) >> 15));
*out = ixheaacd_add32_sat(
*out, ixheaacd_sat64_32((((WORD64)sum * (WORD64)factor_even) >> 15)));
out++;
for (i = 3; i < length - 4; i += 2) {
sum = 0;
sum = ixheaacd_mac32x32in64_7(sum, &in[i - 3], filter);
*out = ixheaacd_add32_sat(*out, (WORD32)((sum * factor_odd) >> 15));
*out = ixheaacd_add32_sat(
*out, ixheaacd_sat64_32((((WORD64)sum * (WORD64)factor_odd) >> 15)));
out++;
sum = 0;
sum = ixheaacd_mac32x32in64_7(sum, &in[i - 2], filter);
*out = ixheaacd_add32_sat(*out, (WORD32)((sum * factor_even) >> 15));
*out = ixheaacd_add32_sat(
*out, ixheaacd_sat64_32((((WORD64)sum * (WORD64)factor_even) >> 15)));
out++;
}
i = length - 3;
sum = 0;
sum = ixheaacd_mac32x32in64_n(sum, &in[i - 3], filter, 6);
sum = ixheaacd_mac32x32in64(sum, in[i + 2], filter[6]);
*out += (WORD32)((sum * factor_odd) >> 15);
*out = ixheaacd_add32_sat(
*out, ixheaacd_sat64_32((((WORD64)sum * (WORD64)factor_odd) >> 15)));
out++;
i = length - 2;
@ -393,7 +397,8 @@ static VOID ixheaacd_filter_and_add(const WORD32 *in, const WORD32 length,
sum = ixheaacd_mac32x32in64(sum, in[i + 1], filter[5]);
sum = ixheaacd_mac32x32in64(sum, in[i], filter[6]);
*out += (WORD32)((sum * factor_even) >> 15);
*out = ixheaacd_add32_sat(
*out, ixheaacd_sat64_32((((WORD64)sum * (WORD64)factor_even) >> 15)));
out++;
i = length - 1;
@ -403,7 +408,8 @@ static VOID ixheaacd_filter_and_add(const WORD32 *in, const WORD32 length,
sum = ixheaacd_mac32x32in64(sum, in[i - 1], filter[5]);
sum = ixheaacd_mac32x32in64(sum, in[i - 2], filter[6]);
*out += (WORD32)((sum * factor_odd) >> 15);
*out = ixheaacd_add32_sat(
*out, ixheaacd_sat64_32((((WORD64)sum * (WORD64)factor_odd) >> 15)));
}
static WORD32 ixheaacd_estimate_dmx_im(const WORD32 *dmx_re,
@ -520,15 +526,17 @@ static WORD32 ixheaacd_cplx_pred_upmixing(
alpha_q_im_temp = alpha_q_im[grp][sfb] * 1677722;
if (cplx_pred_used[grp][sfb]) {
for (k = 0; k < pstr_sfb_info->sfb_width[sfb]; k++, i++) {
WORD32 mid_side = r_spec[i] -
(WORD32)((WORD64)ixheaacd_mult32x32in64(
alpha_q_re_temp, l_spec[i]) >>
24) -
(WORD32)((WORD64)ixheaacd_mult32x32in64(
alpha_q_im_temp, dmx_im[i]) >>
24);
r_spec[i] = (factor)*ixheaacd_sub32_sat(l_spec[i], mid_side);
l_spec[i] = l_spec[i] + mid_side;
WORD32 mid_side = ixheaacd_sub32_sat(
ixheaacd_sub32_sat(r_spec[i],
(WORD32)((WORD64)ixheaacd_mult32x32in64(
alpha_q_re_temp, l_spec[i]) >>
24)),
(WORD32)((WORD64)ixheaacd_mult32x32in64(alpha_q_im_temp,
dmx_im[i]) >>
24));
r_spec[i] = ixheaacd_sat64_32((WORD64)factor) *
(WORD64)(ixheaacd_sub32_sat(l_spec[i], mid_side));
l_spec[i] = ixheaacd_add32_sat(l_spec[i], mid_side);
}
} else {
@ -549,7 +557,8 @@ static WORD32 ixheaacd_cplx_pred_upmixing(
alpha_q_re_temp, l_spec[i]) >>
24));
r_spec[i] = (factor) * (ixheaacd_sub32_sat(l_spec[i], mid_side));
r_spec[i] = ixheaacd_sat64_32((WORD64)factor) *
(WORD64)(ixheaacd_sub32_sat(l_spec[i], mid_side));
l_spec[i] = ixheaacd_add32_sat(l_spec[i], mid_side);
}
@ -633,13 +642,13 @@ WORD32 ixheaacd_ics_info(ia_usac_data_struct *usac_data, WORD32 chn,
}
WORD32 ixheaacd_core_coder_data(WORD32 id, ia_usac_data_struct *usac_data,
WORD32 elem_idx, WORD32 *chan_offset,
WORD32 elem_idx, WORD32 chan_offset,
ia_bit_buf_struct *it_bit_buff,
WORD32 nr_core_coder_channels) {
WORD32 err_code = 0;
WORD32 k = 0, ch = 0, chn, left = 0, right = 0;
ia_usac_tmp_core_coder_struct str_tmp_core_coder;
ia_usac_tmp_core_coder_struct str_tmp_core_coder = {0};
ia_usac_tmp_core_coder_struct *pstr_core_coder = &str_tmp_core_coder;
ia_td_frame_data_struct td_frame;
@ -660,8 +669,8 @@ WORD32 ixheaacd_core_coder_data(WORD32 id, ia_usac_data_struct *usac_data,
pstr_core_coder->common_window = ixheaacd_read_bits_buf(it_bit_buff, 1);
if (pstr_core_coder->common_window) {
left = *chan_offset;
right = *chan_offset + 1;
left = chan_offset;
right = chan_offset + 1;
err_code =
ixheaacd_ics_info(usac_data, left, &pstr_core_coder->max_sfb[left],
@ -698,8 +707,8 @@ WORD32 ixheaacd_core_coder_data(WORD32 id, ia_usac_data_struct *usac_data,
pstr_core_coder->ms_mask_present[0] =
ixheaacd_read_ms_mask(usac_data, pstr_core_coder, it_bit_buff, left);
} else {
left = *chan_offset;
right = *chan_offset + 1;
left = chan_offset;
right = chan_offset + 1;
pstr_core_coder->ms_mask_present[0] = 0;
pstr_core_coder->ms_mask_present[1] = 0;
@ -768,12 +777,12 @@ WORD32 ixheaacd_core_coder_data(WORD32 id, ia_usac_data_struct *usac_data,
} else {
pstr_core_coder->common_window = 0;
pstr_core_coder->common_tw = 0;
left = *chan_offset;
right = *chan_offset;
if (nr_core_coder_channels == 2) right = *chan_offset + 1;
left = chan_offset;
right = chan_offset;
if (nr_core_coder_channels == 2) right = chan_offset + 1;
}
for (ch = 0, chn = *chan_offset; ch < nr_core_coder_channels; ch++, chn++) {
for (ch = 0, chn = chan_offset; ch < nr_core_coder_channels; ch++, chn++) {
if (pstr_core_coder->core_mode[ch] == 1) {
err_code =
ixheaacd_tw_buff_update(usac_data, chn, usac_data->str_tddec[chn]);
@ -847,9 +856,10 @@ WORD32 ixheaacd_core_coder_data(WORD32 id, ia_usac_data_struct *usac_data,
if (pstr_core_coder->tns_on_lr == 0 && (id != ID_USAC_LFE)) {
for (ch = 0, chn = left; chn <= right; ch++, chn++) {
if (pstr_core_coder->core_mode[ch] == CORE_MODE_FD) {
ixheaacd_tns_apply(
err_code = ixheaacd_tns_apply(
usac_data, usac_data->coef_fix[chn], pstr_core_coder->max_sfb[ch],
usac_data->pstr_sfb_info[chn], usac_data->pstr_tns[chn]);
if (err_code) return err_code;
}
}
}
@ -873,9 +883,10 @@ WORD32 ixheaacd_core_coder_data(WORD32 id, ia_usac_data_struct *usac_data,
if (pstr_core_coder->tns_on_lr) {
for (ch = 0, chn = left; chn <= right; ch++, chn++) {
if (pstr_core_coder->core_mode[ch] == CORE_MODE_FD) {
ixheaacd_tns_apply(
err_code = ixheaacd_tns_apply(
usac_data, usac_data->coef_fix[chn], pstr_core_coder->max_sfb[ch],
usac_data->pstr_sfb_info[chn], usac_data->pstr_tns[chn]);
if (err_code) return err_code;
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -56,7 +56,7 @@
#include "ixheaacd_pvc_dec.h"
#include "ixheaacd_sbr_dec.h"
#include "ixheaacd_error_standards.h"
#include "ixheaacd_sbrqmftrans.h"
#include "ixheaacd_qmf_poly.h"
@ -259,8 +259,9 @@ WORD32 ixheaacd_qmf_hbe_apply(ia_esbr_hbe_txposer_struct *ptr_hbe_txposer,
TWICE_QMF_SYNTH_CHANNELS_NUM * sizeof(FLOAT32));
}
ixheaacd_hbe_post_anal_process(ptr_hbe_txposer, pitch_in_bins,
ptr_hbe_txposer->upsamp_4_flag);
err_code = ixheaacd_hbe_post_anal_process(ptr_hbe_txposer, pitch_in_bins,
ptr_hbe_txposer->upsamp_4_flag);
if (err_code) return err_code;
for (i = 0; i < ptr_hbe_txposer->no_bins; i++) {
for (qmf_band_idx = ptr_hbe_txposer->start_band;
@ -1532,9 +1533,9 @@ VOID ixheaacd_hbe_post_anal_xprod4(ia_esbr_hbe_txposer_struct *ptr_hbe_txposer,
}
}
VOID ixheaacd_hbe_post_anal_process(ia_esbr_hbe_txposer_struct *ptr_hbe_txposer,
WORD32 pitch_in_bins,
WORD32 sbr_upsamp_4_flg) {
IA_ERRORCODE ixheaacd_hbe_post_anal_process(
ia_esbr_hbe_txposer_struct *ptr_hbe_txposer, WORD32 pitch_in_bins,
WORD32 sbr_upsamp_4_flg) {
FLOAT32 p;
WORD32 trans_fac;
WORD32 qmf_voc_columns = ptr_hbe_txposer->no_bins / 2;
@ -1555,9 +1556,11 @@ VOID ixheaacd_hbe_post_anal_process(ia_esbr_hbe_txposer_struct *ptr_hbe_txposer,
ptr_hbe_txposer->x_over_qmf[1]);
trans_fac = 4;
if (trans_fac <= ptr_hbe_txposer->max_stretch)
if (trans_fac <= ptr_hbe_txposer->max_stretch) {
if (ptr_hbe_txposer->x_over_qmf[2] <= 1) return IA_FATAL_ERROR;
ixheaacd_hbe_post_anal_prod4(ptr_hbe_txposer, qmf_voc_columns,
ptr_hbe_txposer->x_over_qmf[2]);
}
} else {
trans_fac = 2;
@ -1579,9 +1582,12 @@ VOID ixheaacd_hbe_post_anal_process(ia_esbr_hbe_txposer_struct *ptr_hbe_txposer,
(pitch_in_bins + sbr_upsamp_4_flg * 128));
trans_fac = 4;
if (trans_fac <= ptr_hbe_txposer->max_stretch)
if (trans_fac <= ptr_hbe_txposer->max_stretch) {
if (ptr_hbe_txposer->x_over_qmf[2] <= 1) return IA_FATAL_ERROR;
ixheaacd_hbe_post_anal_xprod4(ptr_hbe_txposer, qmf_voc_columns,
ptr_hbe_txposer->x_over_qmf[2], p,
(pitch_in_bins + sbr_upsamp_4_flg * 128));
}
}
}
return IA_NO_ERROR;
}

View file

@ -19,6 +19,7 @@
*/
#include <stdlib.h>
#include <ixheaacd_type_def.h>
#include "ixheaacd_error_standards.h"
#include "ixheaacd_constants.h"
#include <ixheaacd_basic_ops32.h>
#include <ixheaacd_basic_ops16.h>
@ -153,21 +154,18 @@ WORD32 ixheaacd_read_prog_config_element(
struct ia_bit_buf_struct *it_bit_buff) {
WORD32 i, tmp;
WORD count = 0, num_ch = 0;
WORD32 object_type;
tmp = ixheaacd_read_bits_buf(it_bit_buff, 6);
ptr_config_element->element_instance_tag = (tmp >> 2);
ptr_config_element->object_type = tmp & 0x3;
object_type = 0;
if ((ptr_config_element->object_type + 1) != 2
&& (ptr_config_element->object_type + 1) != 4
) {
object_type = IA_ENHAACPLUS_DEC_INIT_FATAL_DEC_INIT_FAIL;
return IA_ENHAACPLUS_DEC_INIT_FATAL_DEC_INIT_FAIL;
}
ptr_config_element->samp_freq_index = ixheaacd_read_bits_buf(it_bit_buff, 4);
@ -236,7 +234,7 @@ WORD32 ixheaacd_read_prog_config_element(
ixheaacd_skip_bits(it_bit_buff, 8, tmp);
return object_type;
return 0;
}
WORD ixheaacd_decode_pce(struct ia_bit_buf_struct *it_bit_buff,
@ -245,9 +243,10 @@ WORD ixheaacd_decode_pce(struct ia_bit_buf_struct *it_bit_buff,
WORD32 error_code = 0;
if (*ui_pce_found_in_hdr == 1 || *ui_pce_found_in_hdr == 3) {
ia_program_config_struct ptr_config_element;
ia_program_config_struct ptr_config_element = {0};
ptr_config_element.alignment_bits = ptr_prog_config->alignment_bits;
ixheaacd_read_prog_config_element(&ptr_config_element, it_bit_buff);
error_code =
ixheaacd_read_prog_config_element(&ptr_config_element, it_bit_buff);
*ui_pce_found_in_hdr = 3;
} else {
error_code =
@ -494,6 +493,9 @@ WORD32 ixheaacd_ga_hdr_dec(ia_aac_dec_state_struct *aac_state_struct,
memset(aac_state_struct->ia_audio_specific_config, 0,
sizeof(ia_audio_specific_config_struct));
memset(&(aac_state_struct->eld_specific_config), 0,
sizeof(ia_eld_specific_config_struct));
pstr_audio_specific_config = aac_state_struct->ia_audio_specific_config;
aac_state_struct->p_config->str_prog_config.alignment_bits =
@ -539,11 +541,12 @@ WORD32 ixheaacd_ga_hdr_dec(ia_aac_dec_state_struct *aac_state_struct,
ixheaacd_read_bits_buf(it_bit_buff, 5);
}
if ((aac_state_struct->audio_object_type >= AOT_AAC_MAIN ||
aac_state_struct->audio_object_type <= AOT_AAC_LTP ||
if (((aac_state_struct->audio_object_type >= AOT_AAC_MAIN &&
aac_state_struct->audio_object_type <= AOT_AAC_LTP) ||
aac_state_struct->audio_object_type == AOT_AAC_SCAL ||
aac_state_struct->audio_object_type == AOT_TWIN_VQ ||
aac_state_struct->audio_object_type == AOT_ER_AAC_LD ||
aac_state_struct->audio_object_type == AOT_ER_AAC_ELD ||
aac_state_struct->audio_object_type == AOT_ER_AAC_LC) &&
aac_state_struct->audio_object_type != AOT_USAC)
@ -610,6 +613,9 @@ WORD32 ixheaacd_ga_hdr_dec(ia_aac_dec_state_struct *aac_state_struct,
&(pstr_audio_specific_config->channel_configuration));
if (err != 0) return err;
pstr_audio_specific_config->sampling_frequency =
pstr_audio_specific_config->str_usac_config.usac_sampling_frequency;
if (pstr_audio_specific_config->audio_object_type == AOT_USAC) {
pstr_audio_specific_config->sbr_present_flag = 1;
pstr_audio_specific_config->ext_audio_object_type = AOT_SBR;
@ -635,54 +641,7 @@ WORD32 ixheaacd_ga_hdr_dec(ia_aac_dec_state_struct *aac_state_struct,
}
{
WORD32 write_flag = 0;
WORD32 system_flag = 1;
WORD32 len;
if (system_flag) {
if (write_flag == 0) {
if ((SIZE_T)it_bit_buff->ptr_read_next ==
(SIZE_T)it_bit_buff->ptr_bit_buf_base) {
len = ((((SIZE_T)it_bit_buff->ptr_bit_buf_end -
(SIZE_T)it_bit_buff->ptr_bit_buf_base) +
1)
<< 3) -
(SIZE_T)it_bit_buff->size;
} else {
len = ((((SIZE_T)it_bit_buff->ptr_bit_buf_end -
(SIZE_T)it_bit_buff->ptr_bit_buf_base) +
1)
<< 3) -
(((((SIZE_T)it_bit_buff->ptr_read_next -
(SIZE_T)it_bit_buff->ptr_bit_buf_base))
<< 3) +
7 - it_bit_buff->bit_pos);
}
if (len > 0) {
if ((SIZE_T)it_bit_buff->ptr_read_next ==
(SIZE_T)it_bit_buff->ptr_bit_buf_base) {
len = ((((SIZE_T)it_bit_buff->ptr_bit_buf_end -
(SIZE_T)it_bit_buff->ptr_bit_buf_base) +
1)
<< 3) -
(SIZE_T)it_bit_buff->size - 0;
} else {
len = ((((SIZE_T)it_bit_buff->ptr_bit_buf_end -
(SIZE_T)it_bit_buff->ptr_bit_buf_base) +
1)
<< 3) -
((((((SIZE_T)it_bit_buff->ptr_read_next -
(SIZE_T)it_bit_buff->ptr_bit_buf_base))
<< 3) +
7 - it_bit_buff->bit_pos) -
0);
}
if (len > 0) {
dummy = ixheaacd_read_bits_buf(it_bit_buff, len);
}
}
}
}
dummy = ixheaacd_skip_bits_buf(it_bit_buff, it_bit_buff->cnt_bits);
if ((SIZE_T)it_bit_buff->ptr_read_next ==
(SIZE_T)it_bit_buff->ptr_bit_buf_base) {
@ -924,7 +883,7 @@ IA_ERRORCODE ixheaacd_latm_header_decode(
result = ixheaacd_latm_audio_mux_element(
it_bit_buff, &latm_struct_element, aac_state_struct,
pstr_samp_rate_info);
if (result < 0) {
if (result != 0) {
sync_status = 0;
aac_state_struct->sync_status = sync_status;
@ -941,9 +900,9 @@ WORD32 ixheaacd_aac_headerdecode(
ia_exhaacplus_dec_api_struct *p_obj_exhaacplus_dec, UWORD8 *buffer,
WORD32 *bytes_consumed,
const ia_aac_dec_huffman_tables_struct *pstr_huffmann_tables) {
struct ia_bit_buf_struct it_bit_buff, *handle_bit_buff;
ia_adif_header_struct adif;
ia_adts_header_struct adts;
struct ia_bit_buf_struct it_bit_buff = {0}, *handle_bit_buff;
ia_adif_header_struct adif = {0};
ia_adts_header_struct adts = {0};
WORD32 result;
WORD32 header_len;
WORD32 sync = 0;
@ -970,6 +929,7 @@ WORD32 ixheaacd_aac_headerdecode(
handle_bit_buff = ixheaacd_create_bit_buf(&it_bit_buff, (UWORD8 *)buffer,
(WORD16)header_len);
handle_bit_buff->cnt_bits += (header_len << 3);
handle_bit_buff->xaac_jmp_buf = &aac_state_struct->xaac_jmp_buf;
if (is_ga_header == 1) {
return ixheaacd_ga_hdr_dec(aac_state_struct, header_len, bytes_consumed,
@ -1033,7 +993,7 @@ WORD32 ixheaacd_aac_headerdecode(
if ((adts.aac_frame_length + ADTS_HEADER_LENGTH) <
(header_len - bytes_taken)) {
ia_adts_header_struct adts_loc;
ia_adts_header_struct adts_loc = {0};
handle_bit_buff = ixheaacd_create_init_bit_buf(
&it_bit_buff, (UWORD8 *)(buffer + adts.aac_frame_length),
@ -1084,7 +1044,11 @@ WORD32 ixheaacd_aac_headerdecode(
bytes_taken += *bytes_consumed;
*bytes_consumed = bytes_taken;
return result;
} else
} else if (result == -1)
return -1;
else if (result == (WORD32)IA_FATAL_ERROR)
return IA_FATAL_ERROR;
else
bytes_taken += *bytes_consumed - 1;
continue;
}
@ -1107,6 +1071,22 @@ WORD32 ixheaacd_aac_headerdecode(
return err_code;
}
switch (aac_state_struct->audio_object_type) {
case AOT_AAC_MAIN:
case AOT_AAC_LC:
case AOT_AAC_SSR:
case AOT_AAC_LTP:
case AOT_AAC_SCAL:
case AOT_TWIN_VQ:
case AOT_ER_AAC_LD:
case AOT_ER_AAC_ELD:
case AOT_ER_AAC_LC:
case AOT_USAC:
break;
default:
return IA_ENHAACPLUS_DEC_INIT_FATAL_AUDIOOBJECTTYPE_NOT_SUPPORTED;
}
if (aac_state_struct->audio_object_type != AOT_USAC)
aac_state_struct->usac_flag = 0;
*bytes_consumed = bytes_taken;

View file

@ -574,7 +574,7 @@ static VOID ixheaacd_huff_ext_sect_info(ia_hcr_info_struct *ptr_hcr_info) {
ptr_num_ext_sort_cw_sect[x_srt_sc_cnt] = 0;
}
static VOID ixheaacd_hcr_prepare_segmentation_grid(
static UWORD32 ixheaacd_hcr_prepare_segmentation_grid(
ia_hcr_info_struct *ptr_hcr_info) {
UWORD16 i, j;
UWORD16 num_segment = 0;
@ -630,7 +630,12 @@ static VOID ixheaacd_hcr_prepare_segmentation_grid(
break;
}
}
if (num_segment == 0) ptr_hcr_info->str_dec_io.err_log |= (ERROR_POS << 9);
ptr_hcr_info->str_segment_info.num_segment = num_segment;
return (ptr_hcr_info->str_dec_io.err_log);
}
static PLATFORM_INLINE UWORD16 *ixheaacd_huff_dec_pair_hcr_pcw(
@ -734,7 +739,10 @@ static PLATFORM_INLINE WORD16 ixheaacd_huff_dec_pair_hcr_non_pcw(
WORD16 index, length;
WORD32 y, z;
WORD32 read_word1;
WORD32 read_word = ixheaacd_aac_showbits_32(itt_bit_buff->byte_ptr);
WORD32 read_word;
read_word = ixheaacd_aac_showbits_32(itt_bit_buff->byte_ptr,
itt_bit_buff->bit_count, NULL);
ixheaacd_huffman_decode(read_word, &index, &length, code_book_tbl, idx_table);
read_word1 = read_word << length;
@ -907,7 +915,8 @@ static UWORD16 *ixheaacd_huff_dec_word_hcr_pcw(
WORD32 flush_cw;
WORD32 i, value, norm_val, off;
WORD32 out1, out2;
WORD16 index, length;
WORD16 index;
WORD32 length;
UWORD8 *ptr_read_next = it_bit_buff->ptr_read_next;
WORD32 spec_index = ptr_hcr_info->str_dec_io.quant_spec_coeff_idx;
WORD32 *spec_coef =
@ -923,8 +932,8 @@ static UWORD16 *ixheaacd_huff_dec_word_hcr_pcw(
if (read_bit_offset) {
*read_bits -= read_bit_offset;
*bit_pos += read_bit_offset;
ixheaacd_aac_read_byte_corr1(&ptr_read_next, (WORD16 *)bit_pos,
read_word);
ixheaacd_aac_read_byte_corr1(&ptr_read_next, bit_pos, read_word,
it_bit_buff->ptr_bit_buf_end);
}
read_word1 = *read_word << *bit_pos;
@ -1072,6 +1081,7 @@ static VOID ixheaacd_decode_pcw(ia_bit_buf_struct *itt_bit_buff,
UWORD16 cur_ext_sort_cw_sec;
UWORD8 codebook;
UWORD8 dimension;
WORD32 increment;
WORD32 num_ext_sorted_cw_in_sect_idx =
ptr_hcr_info->sect_info.num_ext_sorted_cw_in_sect_idx;
@ -1094,20 +1104,19 @@ static VOID ixheaacd_decode_pcw(ia_bit_buf_struct *itt_bit_buff,
WORD32 num_decoded_bits;
const UWORD8 *ptr_cb_dimension_tbl =
ptr_hcr_info->table_info.ptr_cb_dimension_tbl;
const UWORD16 *cb_table;
const UWORD32 *idx_table;
WORD32 read_word = ixheaacd_aac_showbits_32(itt_bit_buff->ptr_read_next);
WORD32 read_word = ixheaacd_aac_showbits_32(
itt_bit_buff->ptr_read_next, itt_bit_buff->cnt_bits, &increment);
WORD32 read_bits = itt_bit_buff->cnt_bits;
itt_bit_buff->ptr_read_next += 4;
itt_bit_buff->ptr_read_next += increment;
for (ext_sort_sec =
ptr_num_ext_sorted_sect_in_sets[num_ext_sorted_sect_in_sets_idx];
ext_sort_sec != 0; ext_sort_sec--) {
codebook = ptr_ext_sorted_cw[ext_sorted_cw_idx];
cb_table = (UWORD16 *)(ptr_aac_tables->code_book[codebook]);
idx_table = (UWORD32 *)(ptr_aac_tables->index_table[codebook]);
if (codebook <= 0) return;
ext_sorted_cw_idx++;
if (ext_sorted_cw_idx >= (MAX_SFB_HCR + MAX_HCR_SETS)) {
return;
@ -1122,6 +1131,8 @@ static VOID ixheaacd_decode_pcw(ia_bit_buf_struct *itt_bit_buff,
if (codebook <= 4) {
WORD32 tbl_sign = 0;
const UWORD16 *cb_table = (UWORD16 *)(ptr_aac_tables->code_book[codebook]);
const UWORD32 *idx_table = (UWORD32 *)(ptr_aac_tables->index_table[codebook]);
if (codebook > 2) {
tbl_sign = 1;
@ -1157,6 +1168,8 @@ static VOID ixheaacd_decode_pcw(ia_bit_buf_struct *itt_bit_buff,
{
WORD32 tbl_sign = 0;
WORD32 huff_mode = 9;
const UWORD16 *cb_table = (UWORD16 *)(ptr_aac_tables->code_book[codebook]);
const UWORD32 *idx_table = (UWORD32 *)(ptr_aac_tables->index_table[codebook]);
num_decoded_bits = 0;
if (codebook > 6) {
@ -1271,7 +1284,10 @@ static PLATFORM_INLINE UWORD16 ixheaacd_huff_dec_quad_hcr_non_pcw(
const UWORD16 *code_book_tbl, WORD32 tbl_sign, const UWORD32 *idx_table) {
WORD16 index, length;
WORD16 cw_len;
WORD32 read_word = ixheaacd_aac_showbits_32(itt_bit_buff->byte_ptr);
WORD32 read_word;
read_word = ixheaacd_aac_showbits_32(itt_bit_buff->byte_ptr,
itt_bit_buff->bit_count, NULL);
ixheaacd_huffman_decode(read_word, &index, &length, code_book_tbl, idx_table);
cw_len = length;
if (tbl_sign) {
@ -1339,16 +1355,22 @@ static PLATFORM_INLINE UWORD16 ixheaacd_huff_dec_word_hcr_non_pcw(
WORD32 out1, out2;
UWORD16 cw_len;
WORD16 index, length;
WORD16 index;
WORD32 length;
WORD32 read_word;
WORD32 increment;
read_word = ixheaacd_aac_showbits_32(itt_bit_buff->byte_ptr,
itt_bit_buff->bit_count, &increment);
WORD32 read_word = ixheaacd_aac_showbits_32(itt_bit_buff->byte_ptr);
UWORD8 *ptr_read_next = itt_bit_buff->byte_ptr;
ptr_read_next += 4;
ptr_read_next += increment;
ixheaacd_huff_sfb_table(read_word, &index, &length, code_book_tbl, idx_table);
cw_len = length;
ixheaacd_aac_read_byte_corr1(&ptr_read_next, &length, &read_word);
ixheaacd_aac_read_byte_corr1(&ptr_read_next, &length, &read_word, NULL);
out1 = index / 17;
out2 = index - out1 * 17;
@ -1374,7 +1396,7 @@ static PLATFORM_INLINE UWORD16 ixheaacd_huff_dec_word_hcr_non_pcw(
cw_len++;
}
ixheaacd_aac_read_byte_corr1(&ptr_read_next, &length, &read_word);
ixheaacd_aac_read_byte_corr1(&ptr_read_next, &length, &read_word, NULL);
if (sp1 == 16) {
i = 4;
@ -1386,13 +1408,13 @@ static PLATFORM_INLINE UWORD16 ixheaacd_huff_dec_word_hcr_non_pcw(
length += (norm_val - 21);
cw_len += (norm_val - 21);
ixheaacd_aac_read_byte_corr1(&ptr_read_next, &length, &read_word);
ixheaacd_aac_read_byte_corr1(&ptr_read_next, &length, &read_word, NULL);
off = ixheaacd_extu(read_word, length, 32 - i);
length += i;
cw_len += i;
ixheaacd_aac_read_byte_corr1(&ptr_read_next, &length, &read_word);
ixheaacd_aac_read_byte_corr1(&ptr_read_next, &length, &read_word, NULL);
i = off + ((WORD32)1 << i);
@ -1414,13 +1436,13 @@ static PLATFORM_INLINE UWORD16 ixheaacd_huff_dec_word_hcr_non_pcw(
length += (norm_val - 21);
cw_len += (norm_val - 21);
ixheaacd_aac_read_byte_corr1(&ptr_read_next, &length, &read_word);
ixheaacd_aac_read_byte_corr1(&ptr_read_next, &length, &read_word, NULL);
off = ixheaacd_extu(read_word, length, 32 - i);
length += i;
cw_len += i;
ixheaacd_aac_read_byte_corr1(&ptr_read_next, &length, &read_word);
ixheaacd_aac_read_byte_corr1(&ptr_read_next, &length, &read_word, NULL);
i = off + ((WORD32)1 << i);
if (out2 < 0)
@ -1438,8 +1460,6 @@ static VOID ixheaacd_decode_hcr_non_pcw(
ia_bit_buf_struct *itt_bit_buff, ia_hcr_info_struct *ptr_hcr_info,
ia_aac_dec_tables_struct *ptr_aac_tables, WORD32 *cw_offset, WORD32 trial,
WORD32 start) {
UWORD16 *cb_table;
UWORD32 *idx_table;
WORD16 codeword_len = 0;
WORD8 seg_bits_left;
UWORD8 tot_bits_to_save, code_bits_to_save, extra_code_bits;
@ -1452,14 +1472,6 @@ static VOID ixheaacd_decode_hcr_non_pcw(
segment_offset++, *cw_offset += 1) {
if (p_remaining_bits_in_seg[segment_offset] &&
!ptr_hcr_info->str_segment_info.is_decoded[*cw_offset]) {
cb_table =
(UWORD16 *)(ptr_aac_tables
->code_book[ptr_hcr_info->str_non_pcw_side_info
.ptr_cb[*cw_offset % num_segment]]);
idx_table =
(UWORD32 *)(ptr_aac_tables
->index_table[ptr_hcr_info->str_non_pcw_side_info
.ptr_cb[*cw_offset % num_segment]]);
{
UWORD32 i_qsc;
WORD8 current_seg_bits = p_remaining_bits_in_seg[segment_offset];
@ -1546,6 +1558,15 @@ static VOID ixheaacd_decode_hcr_non_pcw(
if (ptr_hcr_info->str_non_pcw_side_info
.ptr_cb[*cw_offset % num_segment] <= 4) {
WORD32 tbl_sign = 0;
const UWORD16 *cb_table =
(UWORD16
*)(ptr_aac_tables
->code_book[ptr_hcr_info->str_non_pcw_side_info
.ptr_cb[*cw_offset % num_segment]]);
const UWORD32 *idx_table =
(UWORD32 *)(ptr_aac_tables->index_table
[ptr_hcr_info->str_non_pcw_side_info
.ptr_cb[*cw_offset % num_segment]]);
if (ptr_hcr_info->str_non_pcw_side_info
.ptr_cb[*cw_offset % num_segment] > 2) {
@ -1567,6 +1588,17 @@ static VOID ixheaacd_decode_hcr_non_pcw(
.ptr_cb[*cw_offset % num_segment] < 11) {
WORD32 tbl_sign = 0;
WORD32 huff_mode = 9;
const UWORD16 *cb_table =
(UWORD16
*)(ptr_aac_tables
->code_book[ptr_hcr_info->str_non_pcw_side_info
.ptr_cb[*cw_offset % num_segment]]);
const UWORD32 *idx_table =
(UWORD32 *)(ptr_aac_tables->index_table
[ptr_hcr_info->str_non_pcw_side_info
.ptr_cb[*cw_offset % num_segment]]);
if (ptr_hcr_info->str_non_pcw_side_info
.ptr_cb[*cw_offset % num_segment] > 6) {
if (ptr_hcr_info->str_non_pcw_side_info
@ -1727,14 +1759,11 @@ static VOID ixheaacd_hcr_reorder_quantized_spec_coeff(
WORD32 *arr_temp_values = ptr_hcr_info->str_segment_info.arr_temp_values;
WORD32 *ptr_bak = ptr_hcr_info->str_segment_info.arr_temp_values;
WORD32 cnt = 0;
for (i = num_sect; i != 0; i--) {
num_spec_val_sect = *ptr_num_sorted_cw_in_sect++
<< ptr_cb_dim_shift_tbl[*ptr_sorted_cb];
ptr_teva = &arr_temp_values[*ptr_reorder_offset++];
for (j = num_spec_val_sect; j != 0; j--) {
cnt++;
qsc = *ptr_quant_spec_coeff++;
abs_qsc = ixheaacd_abs32(qsc);
if (abs_qsc <= ptr_lav_tbl[*ptr_sorted_cb]) {
@ -1811,7 +1840,8 @@ UWORD32 ixheaacd_hcr_decoder(
ixheaacd_huff_sort_sect_cb_cwd(ptr_hcr_info);
ixheaacd_hcr_prepare_segmentation_grid(ptr_hcr_info);
if (ixheaacd_hcr_prepare_segmentation_grid(ptr_hcr_info) != 0)
return (ptr_hcr_info->str_dec_io.err_log);
ixheaacd_huff_ext_sect_info(ptr_hcr_info);

View file

@ -254,7 +254,8 @@ WORD8 ixheaacd_cal_fac_data(ia_usac_data_struct *usac_data, WORD32 i_ch,
i_aq = NULL;
for (k = 0; k < lfac; k++) {
if (ABS(fac_data[k + 1]) > itemp) itemp = ABS(fac_data[k + 1]);
if (ixheaacd_abs32_sat(fac_data[k + 1]) > itemp)
itemp = ixheaacd_abs32_sat(fac_data[k + 1]);
}
qshift1 = ixheaacd_norm32(itemp);

View file

@ -62,6 +62,7 @@
#include "ixheaacd_info.h"
#include "ixheaacd_struct.h"
#include "ixheaacd_constants.h"
#include "ixheaacd_error_standards.h"
#include "ixheaacd_error_codes.h"
@ -499,14 +500,30 @@ WORD32 ixheaacd_config(ia_bit_buf_struct *it_bit_buff,
pstr_usac_conf->usac_sampling_frequency_index =
ixheaacd_read_bits_buf(it_bit_buff, 5);
if (pstr_usac_conf->usac_sampling_frequency_index == 0x1f)
if (pstr_usac_conf->usac_sampling_frequency_index == 0x1f) {
pstr_usac_conf->usac_sampling_frequency =
ixheaacd_read_bits_buf(it_bit_buff, 24);
if (pstr_usac_conf->usac_sampling_frequency > USAC_MAX_SAMPLE_RATE) {
return IA_FATAL_ERROR;
}
} else {
static const WORD32 sampling_rate_tbl[] = {
96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050,
16000, 12000, 11025, 8000, 7350, 0, 0, 57600,
51200, 40000, 38400, 34150, 28800, 25600, 20000, 19200,
17075, 14400, 12800, 9600, 0, 0, 0};
pstr_usac_conf->usac_sampling_frequency =
sampling_rate_tbl[pstr_usac_conf->usac_sampling_frequency_index];
}
pstr_usac_conf->core_sbr_framelength_index =
ixheaacd_read_bits_buf(it_bit_buff, 3);
if (pstr_usac_conf->core_sbr_framelength_index > 4) return -1;
if (pstr_usac_conf->core_sbr_framelength_index > MAX_CORE_SBR_FRAME_LEN_IDX)
return -1;
pstr_usac_conf->channel_configuration_index =
ixheaacd_read_bits_buf(it_bit_buff, 5);

View file

@ -373,9 +373,9 @@ ia_aac_decoder_struct *ixheaacd_aac_decoder_init(
WORD32 sampling_rate = p_state_enhaacplus_dec->sampling_rate;
i = 0;
while (sampling_rate != ((pstr_huffmann_tables->str_sample_rate_info[i]
.sampling_frequency)) &&
(i < num_entries)) {
while ((i < num_entries) &&
sampling_rate != ((pstr_huffmann_tables->str_sample_rate_info[i]
.sampling_frequency))) {
i++;
}
if (i == 12) {

View file

@ -147,7 +147,7 @@ static UWORD32 ixheaacd_latm_get_value(ia_bit_buf_struct *it_bit_buff) {
if (bytes_read <= 3)
return ixheaacd_read_bits_buf(it_bit_buff, 8 * bytes_read);
else
return (ixheaacd_read_bits_buf(it_bit_buff, 24) << 24) +
return (ixheaacd_read_bits_buf(it_bit_buff, 24) << 8) +
ixheaacd_read_bits_buf(it_bit_buff, 8);
}
@ -203,9 +203,9 @@ IA_ERRORCODE ixheaacd_latm_stream_mux_config(
: 0;
pos = it_bit_buff->size - it_bit_buff->cnt_bits;
if (asc_len > it_bit_buff->size - 106 || asc_len > 2592) {
error_code = IA_ENHAACPLUS_DEC_INIT_FATAL_DEC_INIT_FAIL;
return (error_code);
if (asc_len > it_bit_buff->size - 106 || asc_len > 2592 ||
asc_len < 0) {
return IA_ENHAACPLUS_DEC_INIT_FATAL_DEC_INIT_FAIL;
}
if ((error_code = ixheaacd_ga_hdr_dec(
@ -269,6 +269,8 @@ IA_ERRORCODE ixheaacd_latm_stream_mux_config(
latm_element->other_data_length <<= 8;
latm_element->other_data_length +=
ixheaacd_read_bits_buf(it_bit_buff, 8);
if (latm_element->other_data_length > (UWORD32)it_bit_buff->cnt_bits)
return IA_FATAL_ERROR;
} while (other_data_len);
}
}

View file

@ -113,10 +113,11 @@ WORD16 ixheaacd_read_section_data(
sect_len_incr = 1;
sect_len = (sect_len + sect_len_incr);
top = (sfb + sect_len);
if (aac_spect_data_resil_flag) {
if (num_lines_sec_idx >= MAX_SFB_HCR) {
top = (sfb + sect_len);
if ((num_lines_sec_idx >= MAX_SFB_HCR) ||
(top >= MAX_SCALE_FACTOR_BANDS_LONG)) {
return -1;
}
ptr_num_sect_lines[num_lines_sec_idx] =
@ -173,23 +174,10 @@ VOID ixheaacd_read_scale_factor_data(
UWORD8 *ptr_read_next = it_bit_buff->ptr_read_next;
WORD32 bit_pos = 7 - it_bit_buff->bit_pos;
WORD32 read_word;
WORD32 diffbytes;
diffbytes = it_bit_buff->ptr_bit_buf_end - ptr_read_next;
diffbytes++;
if (diffbytes >= 4) {
read_word = ixheaacd_aac_showbits_32(ptr_read_next);
diffbytes = 4;
ptr_read_next = it_bit_buff->ptr_read_next + 4;
} else {
WORD32 ii;
read_word = 0;
for (ii = 0; ii < diffbytes; ii++) {
read_word = (read_word << 8) | (*ptr_read_next);
ptr_read_next++;
}
read_word <<= ((4 - diffbytes) << 3);
}
WORD32 increment;
read_word = ixheaacd_aac_showbits_32(ptr_read_next, it_bit_buff->cnt_bits,
&increment);
ptr_read_next += increment;
ptr_code_book = ptr_aac_dec_channel_info->ptr_code_book;
@ -230,8 +218,9 @@ VOID ixheaacd_read_scale_factor_data(
bit_pos += length;
ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
it_bit_buff->ptr_bit_buf_end);
while (bit_pos > 8)
ixheaacd_aac_read_byte(&ptr_read_next, &bit_pos, &read_word);
ixheaacd_aac_read_byte_corr1(&ptr_read_next, &bit_pos, &read_word,
it_bit_buff->ptr_bit_buf_end);
norm_value = index - 60;
}
@ -245,7 +234,8 @@ VOID ixheaacd_read_scale_factor_data(
noise_start_value = temp;
bit_pos += 9;
ixheaacd_aac_read_2bytes(&ptr_read_next, &bit_pos, &read_word);
ixheaacd_aac_read_byte_corr1(&ptr_read_next, &bit_pos, &read_word,
it_bit_buff->ptr_bit_buf_end);
norm_value = noise_start_value - 256;
ptr_pns_info->pns_active = 1;
@ -302,7 +292,7 @@ VOID ixheaacd_read_scale_factor_data(
}
}
it_bit_buff->ptr_read_next = ptr_read_next - diffbytes;
it_bit_buff->ptr_read_next = ptr_read_next - increment;
it_bit_buff->bit_pos = 7 - bit_pos;
{

View file

@ -436,40 +436,22 @@ WORD32 ixheaacd_lpd_dec(ia_usac_data_struct *usac_data,
0, fac_length * sizeof(WORD32));
}
if (mod[0] == 0 && len_subfrm != LEN_FRAME) {
for (i = 0; i < 3 * len_subfrm; i++)
st->fd_synth[ORDER - len_subfrm + i] = (FLOAT32)(
(FLOAT32)usac_data
->overlap_data_ptr[usac_data->present_chan][i - len_subfrm] /
16384.0);
num_samples = min(3 * len_subfrm, MAX_PITCH + synth_delay);
} else {
for (i = 0; i < 2 * len_subfrm; i++)
st->fd_synth[ORDER + i] = (FLOAT32)(
(FLOAT32)usac_data->overlap_data_ptr[usac_data->present_chan][i] /
16384.0);
num_samples = min(2 * len_subfrm, MAX_PITCH + synth_delay);
}
for (i = 0; i < 2 * len_subfrm; i++)
st->fd_synth[ORDER + i] = (FLOAT32)(
(FLOAT32)usac_data->overlap_data_ptr[usac_data->present_chan][i] /
16384.0);
num_samples = min(2 * len_subfrm, MAX_PITCH + synth_delay);
ixheaacd_mem_cpy(st->fd_synth + ORDER, synth - 2 * len_subfrm,
2 * len_subfrm);
if (mod[0] == 0 && len_subfrm != LEN_FRAME) {
ixheaacd_preemphsis_tool_float(st->fd_synth + ORDER - len_subfrm,
PREEMPH_FILT_FAC, 3 * len_subfrm, mem);
} else {
ixheaacd_preemphsis_tool_float(st->fd_synth + ORDER, PREEMPH_FILT_FAC,
2 * len_subfrm, mem);
}
if (mod[0] == 0 && len_subfrm != LEN_FRAME) {
ixheaacd_memset(tmp - len_subfrm, ORDER);
ixheaacd_mem_cpy(st->fd_synth + ORDER - len_subfrm,
tmp - len_subfrm + ORDER, 3 * len_subfrm);
tmp_start = -len_subfrm;
} else {
ixheaacd_memset(tmp, ORDER);
ixheaacd_mem_cpy(st->fd_synth + ORDER, tmp + ORDER, 2 * len_subfrm);
tmp_start = 0;
}
ixheaacd_preemphsis_tool_float(st->fd_synth + ORDER, PREEMPH_FILT_FAC,
2 * len_subfrm, mem);
ixheaacd_memset(tmp, ORDER);
ixheaacd_mem_cpy(st->fd_synth + ORDER, tmp + ORDER, 2 * len_subfrm);
tmp_start = 0;
ixheaacd_memset(ptr_tmp - len_subfrm, 3 * len_subfrm);
memset(st->fd_synth, 0, ORDER * sizeof(WORD32));
length = (2 * len_subfrm - tmp_start) / LEN_SUBFR;
@ -480,8 +462,6 @@ WORD32 ixheaacd_lpd_dec(ia_usac_data_struct *usac_data,
if (mod[0] != 0 && (len_subfrm == LEN_FRAME || mod[1] != 0)) {
num_samples = min(len_subfrm, MAX_PITCH + INTER_LP_FIL_ORDER + 1);
} else if (mod[0] == 0 && len_subfrm != LEN_FRAME) {
num_samples = min(3 * len_subfrm, MAX_PITCH + INTER_LP_FIL_ORDER + 1);
} else {
num_samples = min(2 * len_subfrm, MAX_PITCH + INTER_LP_FIL_ORDER + 1);
}
@ -592,6 +572,9 @@ WORD32 ixheaacd_lpd_dec(ia_usac_data_struct *usac_data,
gain = pitch_gain[i];
if (gain > 0.0f) {
synth_corr = 0.0f, synth_energy = 1e-6f;
if ((((i * LEN_SUBFR) + LEN_SUBFR) > LEN_SUPERFRAME) ||
((((i * LEN_SUBFR) + LEN_SUBFR) - tp) > LEN_SUPERFRAME))
return -1;
for (k = 0; k < LEN_SUBFR; k++) {
synth_corr +=
synth[i * LEN_SUBFR + k] * synth[(i * LEN_SUBFR) - tp + k];
@ -677,7 +660,6 @@ WORD32 ixheaacd_lpd_bpf_fix(ia_usac_data_struct *usac_data,
fac_length = (usac_data->len_subfrm) / 2;
ixheaacd_memset(synth_buf, MAX_PITCH + synth_delay + len_fr);
synth = synth_buf + MAX_PITCH + synth_delay;
ixheaacd_mem_cpy(st->synth_prev, synth_buf, MAX_PITCH + synth_delay);
ixheaacd_mem_cpy(out_buffer, synth_buf + MAX_PITCH - (LEN_SUBFR),
synth_delay + len_fr + (LEN_SUBFR));
@ -705,9 +687,12 @@ WORD32 ixheaacd_lpd_bpf_fix(ia_usac_data_struct *usac_data,
tp = pitch[i];
if ((i * LEN_SUBFR + MAX_PITCH) < tp) {
return -1;
} else if ((i * LEN_SUBFR + MAX_PITCH - tp) >= 1883) {
} else if (((i * LEN_SUBFR + MAX_PITCH - tp) >= 1883) ||
(((i * LEN_SUBFR) + LEN_SUBFR) > LEN_SUPERFRAME) ||
((((i * LEN_SUBFR) + LEN_SUBFR) - tp) > LEN_SUPERFRAME)) {
return -1;
}
if (pitch_gain[i] > 0.0f) {
synth_corr = 0.0f, synth_energy = 1e-6f;
for (k = 0; k < LEN_SUBFR; k++) {

View file

@ -98,7 +98,7 @@ static PLATFORM_INLINE WORD32 ixheaacd_shr32_drc(WORD32 a, WORD32 b) {
else
out_val = 0;
} else {
a += (1 << (b - 1));
a = ixheaacd_add32_sat(a, (1 << (b - 1)));
out_val = (WORD32)a >> b;
}
@ -163,10 +163,10 @@ VOID ixheaacd_process_win_seq(WORD32 *coef, WORD32 *prev, WORD16 *out,
out[ch_fac * i] = ixheaacd_round16(accu << 2);
accu = (ixheaacd_shl32_dir_sat_limit(-(coef[SIZE15 - 1 - i]),
(q_shift - 1)) -
ixheaacd_mult32x16in32_drc(prev[i + SIZE01],
window_long[2 * SIZE07 - 2 - 2 * i]));
accu = ixheaacd_sub32_sat(
ixheaacd_shl32_dir_sat_limit(-(coef[SIZE15 - 1 - i]), (q_shift - 1)),
ixheaacd_mult32x16in32_drc(prev[i + SIZE01],
window_long[2 * SIZE07 - 2 - 2 * i]));
out[ch_fac * (SIZE09 + i)] = ixheaacd_round16(accu << 2);
}
@ -186,9 +186,10 @@ VOID ixheaacd_process_win_seq(WORD32 *coef, WORD32 *prev, WORD16 *out,
WORD32 prev1 = *temp_prev--;
WORD16 win4 = *temp_win_sh++;
WORD16 win3 = *temp_win_sh++;
accu = ixheaacd_shl32_dir_sat_limit(ixheaacd_mult32x16in32(temp_coef, win1),
q_shift) -
ixheaacd_mult32x16in32_drc(prev1, win3);
accu = ixheaacd_sub32_sat(
ixheaacd_shl32_dir_sat_limit(ixheaacd_mult32x16in32(temp_coef, win1),
q_shift),
ixheaacd_mult32x16in32_drc(prev1, win3));
*out1 = ixheaacd_round16(accu << 2);
out1 += ch_fac;
@ -217,21 +218,21 @@ static PLATFORM_INLINE VOID ixheaacd_long_short_win_process(
WORD32 tmp2_cur = *current_tmp2++;
WORD16 short1 = *short_ptr--;
WORD16 short2 = *short_ptr--;
accu =
(ixheaacd_shl32_dir_sat_limit(
(ixheaacd_mult32x16in32(tmp1_cur, short2) -
ixheaacd_mult32x16in32(tmp2_cur, short1)),
q_shift) -
ixheaacd_mult32x16in32_drc(prev[i], long_window_prev[0 - 2 - 2 * i]));
accu = ixheaacd_sub32_sat(
ixheaacd_shl32_dir_sat_limit((ixheaacd_mult32x16in32(tmp1_cur, short2) -
ixheaacd_mult32x16in32(tmp2_cur, short1)),
q_shift),
ixheaacd_mult32x16in32_drc(prev[i], long_window_prev[0 - 2 - 2 * i]));
out[ch_fac * (0 + i)] = ixheaacd_round16(accu << 2);
if (flag) {
accu = (ixheaacd_shl32_dir_sat_limit(
(ixheaacd_mult32x16in32(-(tmp1_cur), short1) -
ixheaacd_mult32x16in32(tmp2_cur, short2)),
q_shift) -
ixheaacd_mult32x16in32_drc(
prev[SIZE02 - 1 - i], long_window_prev[-2 * SIZE02 + 2 * i]));
accu = ixheaacd_sub32_sat(
ixheaacd_shl32_dir_sat_limit(
(ixheaacd_mult32x16in32(-(tmp1_cur), short1) -
ixheaacd_mult32x16in32(tmp2_cur, short2)),
q_shift),
ixheaacd_mult32x16in32_drc(prev[SIZE02 - 1 - i],
long_window_prev[-2 * SIZE02 + 2 * i]));
out[ch_fac * (SIZE02 - 1 - i)] = ixheaacd_round16(accu << 2);
}
}
@ -251,23 +252,24 @@ VOID ixheaacd_long_short_win_seq(WORD32 *current, WORD32 *prev, WORD16 *out,
}
for (i = 0; i < SIZE01; i++) {
accu =
(ixheaacd_shl32_dir_sat_limit(
ixheaacd_mult32x16in32(current[SIZE01 + i],
short_window_prev[2 * i]),
q_shift) -
ixheaacd_mult32x16in32_drc(prev[SIZE01 - 1 - i],
long_window_prev[2 * SIZE07 + 1 + 2 * i]));
accu = ixheaacd_sub32_sat(
ixheaacd_shl32_dir_sat_limit(
ixheaacd_mult32x16in32(current[SIZE01 + i],
short_window_prev[2 * i]),
q_shift),
ixheaacd_mult32x16in32_drc(prev[SIZE01 - 1 - i],
long_window_prev[2 * SIZE07 + 1 + 2 * i]));
out[ch_fac * (SIZE07 + i)] = ixheaacd_round16(accu << 2);
}
for (i = 0; i < SIZE01; i++) {
accu = (ixheaacd_shl32_dir_sat_limit(
ixheaacd_mult32x16in32(-(current[SIZE02 - 1 - i]),
short_window_prev[SIZE02 - 2 * i - 1]),
q_shift) -
ixheaacd_mult32x16in32_drc(prev[i],
long_window_prev[SIZE16 - 2 - (2 * i)]));
accu = ixheaacd_sub32_sat(
ixheaacd_shl32_dir_sat_limit(
ixheaacd_mult32x16in32(-(current[SIZE02 - 1 - i]),
short_window_prev[SIZE02 - 2 * i - 1]),
q_shift),
ixheaacd_mult32x16in32_drc(prev[i],
long_window_prev[SIZE16 - 2 - (2 * i)]));
out[ch_fac * (SIZE08 + i)] = ixheaacd_round16(accu << 2);
}

View file

@ -74,7 +74,7 @@ VOID ixheaacd_lt_prediction(
for (i = 0; i < num_samples; i++) {
in_data[i] =
ixheaacd_shr32(ixheaacd_mult32x16in32_shl(
ixheaacd_shr32(ixheaacd_mult32x16in32_shl_sat(
ixheaacd_codebook_Q30[ltp->coef],
lt_pred_stat[num_samples + i - ltp->lag]),
SHIFT_VAL);
@ -93,8 +93,8 @@ VOID ixheaacd_lt_prediction(
if (ltp->long_used[sfb]) {
for (bin = sfb_width - 1; bin >= 0; bin--) {
WORD32 temp = *ptr_spec;
temp += ixheaacd_shr32(*ptr_x_est++, SHIFT_VAL1);
temp = ixheaacd_add32_sat(temp,
ixheaacd_shr32(*ptr_x_est++, SHIFT_VAL1));
*ptr_spec++ = temp;
}
} else {

View file

@ -23,6 +23,12 @@
#define MAX_SFB 51
#define MAX_LTP_SFB 40
#define MAX_LTP_SFB_SR_FIVE_PLUS_480 31
#define MAX_LTP_SFB_SR_FIVE_480 38
#define MAX_LTP_SFB_SR_FIVE_LESS_480 36
#define MAX_LTP_SFB_SR_FIVE_PLUS_512 32
#define MAX_LTP_SFB_SR_FIVE_512 38
#define MAX_LTP_SFB_SR_FIVE_LESS_512 37
enum { ltp_buffer_size = (4 * 1024) };

View file

@ -180,9 +180,10 @@ typedef struct ia_usac_data_main_struct {
} ia_usac_data_struct;
VOID ixheaacd_tns_apply(ia_usac_data_struct *usac_data, WORD32 *spec,
WORD32 nbands, ia_sfb_info_struct *pstr_sfb_info,
ia_tns_frame_info_struct *pstr_tns);
IA_ERRORCODE ixheaacd_tns_apply(ia_usac_data_struct *usac_data, WORD32 *spec,
WORD32 nbands,
ia_sfb_info_struct *pstr_sfb_info,
ia_tns_frame_info_struct *pstr_tns);
WORD32 ixheaacd_calc_max_spectral_line_dec(WORD32 *ptr_tmp, WORD32 size);

View file

@ -243,8 +243,7 @@ static int ixheaacd_mps_getstridemap(int freq_res_stride, int band_start,
static VOID ixheaacd_mps_ecdata_decoding(
ia_mps_dec_state_struct *self, ia_handle_bit_buf_struct bitstream,
int data[MAX_PARAMETER_SETS_MPS][MAX_PARAMETER_BANDS], int datatype) {
int i, j, pb, data_set, set_index, bs_data_pair, data_bands,
old_quant_coarse_xxx;
int i, j, pb, set_index, bs_data_pair, data_bands, old_quant_coarse_xxx;
int strides[MAX_PARAMETER_BANDS + 1] = {0};
int band_stop = 0;
@ -272,13 +271,8 @@ static VOID ixheaacd_mps_ecdata_decoding(
band_stop = self->bs_param_bands;
}
data_set = 0;
for (i = 0; i < self->num_parameter_sets; i++) {
frame_xxx_data->bs_xxx_data_mode[i] = ixheaacd_read_bits_buf(bitstream, 2);
if (frame_xxx_data->bs_xxx_data_mode[i] == 3) {
data_set++;
}
}
set_index = 0;
@ -674,7 +668,6 @@ static float ixheaacd_mps_de_quantize(int value, int param_type) {
return ixheaacd_icc_de_quant_table[value];
case IPD:
assert((value % 16) < 16);
return ixheaacd_ipd_de_quant_table[(value & 15)];
default:
@ -689,7 +682,7 @@ static WORD32 ixheaacd_mps_mapindexdata(
int out_idx_data[MAX_PARAMETER_SETS_MPS][MAX_PARAMETER_BANDS],
int cmp_idx_data[MAX_PARAMETER_SETS_MPS][MAX_PARAMETER_BANDS],
int idx_prev[MAX_PARAMETER_BANDS], int param_type) {
int interpolate_local[MAX_PARAMETER_SETS_MPS];
int interpolate_local[MAX_PARAMETER_SETS_MPS] = {0};
int map[MAX_PARAMETER_BANDS + 1];
int set_index, i, band, parm_slot;
@ -990,7 +983,7 @@ WORD32 ixheaacd_mps_frame_decode(ia_mps_dec_state_struct *self) {
}
WORD32 ixheaacd_mps_header_decode(ia_mps_dec_state_struct *self) {
self->time_slots = self->frame_length + 1;
self->time_slots = self->frame_length;
self->frame_len = self->time_slots * self->qmf_band_count;
self->bs_param_bands = ixheaacd_freq_res_table[self->config->bs_freq_res];

View file

@ -55,8 +55,8 @@ extern const WORD32 ixheaacd_re_weight_Q28[16][8][31];
extern const WORD32 ixheaacd_beta_Q28[16][8][31];
extern const WORD32 ixheaacd_weight_Q28[16][8][31];
extern const WORD32 ixheaacd_c_l_table_Q31[31];
extern const WORD32 ixheaacd_sin_table_Q31[16][31];
extern const WORD32 ixheaacd_cos_table_Q31[16][31];
extern const WORD32 ixheaacd_sin_table_Q31[8][31];
extern const WORD32 ixheaacd_cos_table_Q31[8][31];
extern const WORD32 ixheaacd_atan_table_Q28[16][8][31];
extern WORD32 ixheaacd_ipd_de_quant_table_q28[16];
@ -201,6 +201,8 @@ static VOID ixheaacd_mps_par2umx_ps_core(WORD32 cld[MAX_PARAMETER_BANDS],
cld_idx = *cld++ + 15;
icc_idx = *icc++;
icc_idx = icc_idx & 7;
c_l_temp = (ixheaacd_c_l_table_Q31[cld_idx]);
c_r_temp = (ixheaacd_c_l_table_Q31[30 - cld_idx]);

View file

@ -4554,7 +4554,7 @@ const WORD32 ixheaacd_c_l_table_Q31[31] = {
2140740687, 2144096210, 2146410711, 2147144182, 2147376282, 2147449694,
2147483647};
const WORD32 ixheaacd_sin_table_Q31[16][31] = {
const WORD32 ixheaacd_sin_table_Q31[8][31] = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{750179061, 746245580, 743210706, 737870331, 728548620, 712505595,
@ -4598,59 +4598,9 @@ const WORD32 ixheaacd_sin_table_Q31[16][31] = {
595446097, 785304289, 1255861595, 2142108211, 997566324, 495493509,
298429982, 198205829, 139164109, 87059272, 56928133, 38231805,
26115252, 18039235, 9889297, 5483639, 3059686, 1713093,
10},
{329205034, 331044496, 332490231, 335092198, 339819934, 348560631,
357215536, 370188297, 390176357, 422312259, 477650750, 539980675,
644803507, 846880778, 1332052144, 2141128430, 1058086628, 534345646,
323167286, 214970179, 151046430, 94543938, 61838785, 41535810,
28374639, 19601005, 10746050, 5958876, 3324902, 1861600,
10},
{1497748045, 1503796643, 1508521727, 1516961790, 1532087179, 1559339680,
1585420057, 1622844547, 1676673047, 1753885899, 1862379403, 1953397438,
2051811629, 2131459107, 2134283647, 1989548276, 1695321762, 1344859778,
1028341794, 777661527, 588936078, 392646144, 265734770, 182086153,
125934391, 87688114, 48448851, 26975819, 15085217, 8456470,
47},
{1819124703, 1824556610, 1828777565, 1836267987, 1849532387, 1872907535,
1894631673, 1924668687, 1965428606, 2018548171, 2081362225, 2121366279,
2146115448, 2132815850, 2050987089, 1879164766, 1629156954, 1345715825,
1075605664, 844531127, 658184527, 451896646, 311499442, 215951378,
150495943, 105321331, 58487349, 32653976, 18287776, 10260236,
58},
{1923585203, 1928381715, 1932097038, 1938664124, 1950209521, 1970281404,
1988600282, 2013343744, 2045676827, 2085120607, 2125770747, 2144599223,
2143208195, 2102454500, 2000402838, 1825095804, 1588976455, 1326559108,
1074148586, 853780328, 672227734, 466800358, 324217928, 225900884,
157960135, 110797066, 61671040, 34474865, 19320970, 10844087,
61},
{1985155606, 1989395440, 1992670162, 1998437861, 2008511637, 2025809362,
2041332134, 2061836802, 2087645355, 2116966052, 2142166480, 2147133001,
2129677751, 2073262009, 1960755061, 1784738505, 1557483106, 1308139892,
1067367301, 854789044, 677412520, 473929665, 330869491, 231341894,
162148775, 113919632, 63514715, 35537809, 19926702, 11187193,
63},
{2020686784, 2024512419, 2027460265, 2032636996, 2041629534, 2056910757,
2070427091, 2087934395, 2109221115, 2131716042, 2146880706, 2143192060,
2116099812, 2050733580, 1932676750, 1756826697, 1535179711, 1293925414,
1060562211, 853220127, 678903290, 477231777, 334289019, 234270092,
164459870, 115668592, 64561995, 36145965, 20274603, 11384670,
64},
{2039090402, 2042664488, 2045414146, 2050233276, 2058573831, 2072646538,
2084969290, 2100708700, 2119359676, 2137940103, 2147475978, 2139046746,
2106802112, 2036793002, 1916001986, 1740449052, 1521934475, 1285129504,
1055902322, 851569848, 679091531, 478625170, 335895872, 235703393,
165614998, 116553480, 65097820, 36458876, 20454141, 11486747,
64},
{2044775589, 2048265671, 2050949194, 2055649103, 2063772641, 2077444225,
2089372175, 2104529140, 2122316535, 2139624159, 2147348884, 2137411299,
2103545985, 2032097722, 1910481747, 1735055157, 1517549594, 1282166983,
1054270393, 850918765, 679051340, 479002183, 336364503, 236132053,
165964731, 116823274, 65262221, 36555185, 20509492, 11518244,
65}
10}};
};
const WORD32 ixheaacd_cos_table_Q31[16][31] = {
const WORD32 ixheaacd_cos_table_Q31[8][31] = {
{2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647,
2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647,
2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647,
@ -4700,57 +4650,6 @@ const WORD32 ixheaacd_cos_table_Q31[16][31] = {
151850025, 1901722232, 2089538753, 2126646554, 2138317205,
2142969755, 2145718225, 2146728955, 2147143299, 2147324850,
2147407880, 2147460877, 2147476647, 2147481468, 2147482965,
2147483647},
{-2122100390, -2121814214, -2121588147, -2121178738, -2120426474,
-2119007198, -2117565366, -2115336059, -2111740616, -2105549423,
-2093689514, -2078486682, -2048393140, -1973443429, -1684435545,
165091079, 1868726493, 2079942487, 2123028244, 2136696946,
2142165025, 2145401469, 2146593111, 2147081926, 2147296183,
2147394193, 2147456761, 2147475381, 2147481074, 2147482841,
2147483647},
{-1538972648, -1533062841, -1528413627, -1520037153, -1504790648,
-1476531673, -1448492065, -1406435777, -1341809789, -1239181290,
-1069218864, -892145989, -633841507, -261855100, 237737945,
808321517, 1318169239, 1674227642, 1885258383, 2001731392,
2065148981, 2111282791, 2130978895, 2139750138, 2143787897,
2145692618, 2146937057, 2147314212, 2147430664, 2147466998,
2147483647},
{-1141258661, -1132554280, -1125725826, -1113465715, -1091290965,
-1050668066, -1010968269, -952542107, -865318678, -732904701,
-528788529, -333902874, -76645308, 250564500, 636504499,
1039435328, 1399118879, 1673539643, 1858698059, 1974450099,
2044132860, 2099398828, 2124771544, 2136598002, 2142203769,
2144899400, 2146687040, 2147235370, 2147405778, 2147459137,
2147483647},
{-954728226, -945002634, -937383089, -923724761, -899093346, -854211454,
-810650934, -747082986, -653369987, -513768503, -304605894, -111266315,
135442430, 437459820, 781072662, 1131685170, 1444589853, 1688764919,
1859540490, 1970468261, 2039557769, 2096135359, 2122868049, 2135568966,
2141666317, 2144623517, 2146597937, 2147206907, 2147396731, 2147456268,
2147483647},
{-819050205, -808697596, -800594558, -786086595, -759978305, -712588553,
-666820168, -600429030, -503411252, -360750262, -151025800, 38805847,
275968648, 559705870, 875857071, 1194317582, 1478489903, 1703072530,
1863441189, 1970030890, 2037841578, 2094534958, 2121841511, 2134986404,
2141353262, 2144459917, 2146544176, 2147189578, 2147391195, 2147454508,
2147483647},
{-726987579, -716264954, -707877738, -692872903, -665909053, -617093312,
-570103217, -502211092, -403574415, -259755142, -50884692, 135697496,
365797219, 637320800, 936187267, 1235008492, 1501635533, 1713897034,
1867322633, 1970710895, 2037345415, 2093785053, 2121305464, 2134667080,
2141177006, 2144366292, 2146512932, 2147179426, 2147387939, 2147453470,
2147483647},
{-673644084, -662727550, -654191860, -638928424, -611522528, -561980736,
-514382230, -445767850, -346411003, -202232874, 5739490, 190171073,
416017882, 680558805, 969856901, 1257983750, 1515058240, 1720502304,
1869961578, 1971424564, 2037282678, 2093466973, 2121051622, 2134509295,
2141087969, 2144318378, 2146496749, 2147174136, 2147386236, 2147452927,
2147483647},
{-656185042, -645208306, -636626596, -621283175, -593741108, -543977491,
-496195458, -427367659, -327808702, -183560558, 24058044, 207747337,
432180873, 694452925, 980686245, 1265412826, 1519450311, 1722711191,
1870882133, 1971705676, 2037296075, 2093380741, 2120977355, 2134461916,
2141060888, 2144303696, 2146491757, 2147172498, 2147385708, 2147452758,
2147483647}};
const WORD32

View file

@ -129,7 +129,7 @@ WORD cblock_decode_huff_symbol(UWORD8 *ptr_read_next, WORD32 bit_pos,
return tot_bits;
}
WORD16 ixheaacd_dec_coupling_channel_element(
IA_ERRORCODE ixheaacd_dec_coupling_channel_element(
ia_handle_bit_buf_struct bs, ia_aac_decoder_struct *aac_handle,
WORD32 samp_rate_idx, ia_aac_dec_tables_struct *ptr_aac_tables,
ixheaacd_misc_tables *common_tables_ptr, WORD *element_index_order,
@ -152,7 +152,7 @@ WORD16 ixheaacd_dec_coupling_channel_element(
ptr_aac_tables->pstr_huffmann_tables->huffman_code_book_scl_index;
WORD16 index, length;
WORD16 error_status = AAC_DEC_OK;
IA_ERRORCODE error_status = IA_NO_ERROR;
element_instance_tag = ixheaacd_read_bits_buf(bs, 4);
element_index_order[0] = element_instance_tag;
@ -179,7 +179,9 @@ WORD16 ixheaacd_dec_coupling_channel_element(
} else
ind_channel_info->elements_coupled[c] = 0;
}
if ((ind_sw_cce_flag == 0) && (num_gain_element_lists > MAX_BS_ELEMENT)) {
return IA_FATAL_ERROR;
}
cc_domain = ixheaacd_read_bits_buf(bs, 1);
gain_element_sign = ixheaacd_read_bits_buf(bs, 1);
gain_element_scale = ixheaacd_read_bits_buf(bs, 2);
@ -207,13 +209,13 @@ WORD16 ixheaacd_dec_coupling_channel_element(
else {
common_gain_element_present[c] = ixheaacd_read_bits_buf(bs, 1);
cge = common_gain_element_present[c];
error_status =
(WORD)((WORD32)IA_ENHAACPLUS_DEC_EXE_FATAL_UNIMPLEMENTED_CCE);
return IA_ENHAACPLUS_DEC_EXE_FATAL_UNIMPLEMENTED_CCE;
}
if (cge) {
UWORD8 *ptr_read_next = bs->ptr_read_next;
WORD32 bit_pos = 7 - bs->bit_pos;
WORD32 read_word = ixheaacd_aac_showbits_32(ptr_read_next);
WORD32 read_word =
ixheaacd_aac_showbits_32(bs->ptr_read_next, bs->cnt_bits, NULL);
UWORD32 read_word1;
read_word1 = read_word << bit_pos;
@ -238,18 +240,17 @@ WORD16 ixheaacd_dec_coupling_channel_element(
ind_channel_info->cc_gain[c] =
common_tables_ptr->cc_gain_scale[gain_element_scale];
for (i = 0; i < (-norm_value) - 1; i++) {
ind_channel_info->cc_gain[c] *=
common_tables_ptr->cc_gain_scale[gain_element_scale];
ind_channel_info->cc_gain[c] = ixheaacd_mul32_sh(
ind_channel_info->cc_gain[c],
common_tables_ptr->cc_gain_scale[gain_element_scale], 29);
}
}
} else {
error_status =
(WORD)((WORD32)IA_ENHAACPLUS_DEC_EXE_FATAL_UNIMPLEMENTED_CCE);
return IA_ENHAACPLUS_DEC_EXE_FATAL_UNIMPLEMENTED_CCE;
}
}
if (bs->cnt_bits < 0) {
error_status = (WORD16)(
(WORD32)IA_ENHAACPLUS_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
return IA_ENHAACPLUS_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES;
}
return error_status;
}

View file

@ -20,7 +20,7 @@
#ifndef IA_EAACP_DEC_MUTLCHANNEL_H
#define IA_EAACP_DEC_MUTLCHANNEL_H
WORD16 ixheaacd_dec_coupling_channel_element(
IA_ERRORCODE ixheaacd_dec_coupling_channel_element(
ia_handle_bit_buf_struct bs, ia_aac_decoder_struct *aac_handle,
WORD32 sample_rate_idx, ia_aac_dec_tables_struct *ptr_aac_tables,
ixheaacd_misc_tables *common_tables_ptr, WORD *element_index_order,

View file

@ -97,7 +97,7 @@ VOID ixheaacd_allocate_sbr_scr(ia_sbr_scr_struct *sbr_scratch_struct,
WORD total_elements, WORD ch_fac,
WORD32 object_type);
WORD16 ixheaacd_applysbr(
IA_ERRORCODE ixheaacd_applysbr(
ia_handle_sbr_dec_inst_struct self,
ia_aac_dec_sbr_bitstream_struct *p_sbr_bit_stream, WORD16 *core_sample_buf,
WORD16 *codec_num_channels, FLAG frame_status, FLAG down_samp_flag,
@ -105,11 +105,12 @@ WORD16 ixheaacd_applysbr(
WORD32 ch_fac, WORD32 slot_element, ia_bit_buf_struct *it_bit_buff,
ia_drc_dec_struct *pstr_drc_dec, WORD eld_sbr_flag, WORD32 object_type);
WORD16 ixheaacd_esbr_process(ia_usac_data_struct *usac_data,
ia_bit_buf_struct *it_bit_buff,
WORD32 stereo_config_idx, WORD16 num_channels,
WORD32 audio_object_type) {
WORD16 err_code = 0;
IA_ERRORCODE ixheaacd_esbr_process(ia_usac_data_struct *usac_data,
ia_bit_buf_struct *it_bit_buff,
WORD32 stereo_config_idx,
WORD16 num_channels,
WORD32 audio_object_type) {
WORD32 err_code = 0;
ia_aac_dec_sbr_bitstream_struct *esbr_bit_str = &usac_data->esbr_bit_str[0];
ia_handle_sbr_dec_inst_struct self = usac_data->pstr_esbr_dec;
@ -203,10 +204,14 @@ static WORD32 ixheaacd_read_ext_element(
}
pstr_usac_dec_config->usac_ext_gain_payload_len += pay_load_length;
} else {
if (it_bit_buff->cnt_bits < (WORD32)(pay_load_length << 3)) {
longjmp(*(it_bit_buff->xaac_jmp_buf),
IA_ENHAACPLUS_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
}
it_bit_buff->ptr_read_next =
it_bit_buff->ptr_read_next + pay_load_length;
it_bit_buff->cnt_bits =
it_bit_buff->cnt_bits - (WORD32)(pay_load_length * 8);
it_bit_buff->cnt_bits - (WORD32)(pay_load_length << 3);
}
}
}
@ -287,6 +292,7 @@ WORD32 ixheaacd_usac_process(ia_dec_data_struct *pstr_dec_data,
WORD32 ch_offset = 0;
WORD32 elem_idx = 0;
WORD32 num_ch_out = 0;
WORD32 num_elements = pstr_usac_dec_config->num_elements;
pstr_usac_dec_config->usac_ext_gain_payload_len = 0;
@ -304,21 +310,25 @@ WORD32 ixheaacd_usac_process(ia_dec_data_struct *pstr_dec_data,
switch (ele_id = pstr_usac_dec_config->usac_element_type[elem_idx]) {
case ID_USAC_SCE:
nr_core_coder_channels = 1;
num_ch_out += 1;
goto core_data_extracting;
case ID_USAC_CPE:
nr_core_coder_channels = (stereo_config_index == 1) ? 1 : 2;
if ((stereo_config_index > 1) &&
if (((stereo_config_index > 1) || (stereo_config_index == 0)) &&
(p_state_aac_dec->num_of_output_ch < 2))
return -1;
num_ch_out += 2;
goto core_data_extracting;
case ID_USAC_LFE:
nr_core_coder_channels = 1;
num_ch_out += 1;
core_data_extracting:
if (ch_offset >= MAX_NUM_CHANNELS_USAC_LVL2) return -1;
if (num_ch_out > MAX_NUM_CHANNELS_USAC_LVL2) return -1;
err = ixheaacd_core_coder_data(ele_id, pstr_usac_data, elem_idx,
&ch_offset, it_bit_buff,
ch_offset, it_bit_buff,
nr_core_coder_channels);
if (err != 0) return -1;
@ -370,6 +380,13 @@ WORD32 ixheaacd_usac_process(ia_dec_data_struct *pstr_dec_data,
(VOID *)(pstr_usac_data->pstr_esbr_dec->frame_buffer[ch]);
}
if (nr_core_coder_channels == 1) {
if (p_state_aac_dec->mps_dec_handle.res_ch_count != 0) {
ptr_inp[2] = pstr_usac_data->pstr_esbr_dec->pstr_sbr_channel[1]
->str_sbr_dec.pp_qmf_buf_real;
ptr_inp[2 + 1] =
pstr_usac_data->pstr_esbr_dec->pstr_sbr_channel[1]
->str_sbr_dec.pp_qmf_buf_imag;
}
p_state_aac_dec->mps_dec_handle.p_sbr_dec[1] =
(VOID *)(&pstr_usac_data->pstr_esbr_dec->pstr_sbr_channel[1]
->str_sbr_dec);

View file

@ -133,11 +133,11 @@ VOID ixheaacd_fftposttw(WORD32 *out,
temp[3] = *ptr_out_rev--;
temp[2] = *ptr_out_rev++;
in2 = temp[3] - temp[1];
in1 = temp[3] + temp[1];
in2 = ixheaacd_sub32_sat(temp[3], temp[1]);
in1 = ixheaacd_add32_sat(temp[3], temp[1]);
temp[1] = temp[0] - temp[2];
temp[3] = temp[0] + temp[2];
temp[1] = ixheaacd_sub32_sat(temp[0], temp[2]);
temp[3] = ixheaacd_add32_sat(temp[0], temp[2]);
twid_re = *twidle_fwd++;
twid_im = *twidle_rev--;
@ -148,11 +148,11 @@ VOID ixheaacd_fftposttw(WORD32 *out,
val1 = val1 << 1;
val2 = val2 << 1;
*p_out_fwd++ = temp[3] + val1;
*p_out_fwd++ = in2 + val2;
*p_out_fwd++ = ixheaacd_add32_sat(temp[3], val1);
*p_out_fwd++ = ixheaacd_add32_sat(in2, val2);
*ptr_out_rev-- = -in2 + val2;
*ptr_out_rev-- = temp[3] - val1;
*ptr_out_rev-- = ixheaacd_sub32_sat(val2, in2);
*ptr_out_rev-- = ixheaacd_sub32_sat(temp[3], val1);
}
return;
@ -172,12 +172,13 @@ VOID ixheaacd_posttwdct2(WORD32 *inp, WORD16 *out_fwd,
out_fwd2 = out_fwd + 65;
out_re = *inp++;
out_im = *inp++;
out_re1 = (out_re + out_im) >> 1;
out_re1 =
ixheaacd_sat64_32(ixheaacd_add64((WORD64)out_re, (WORD64)out_im) >> 1);
re1 = ixheaacd_round16(ixheaacd_shl32(out_re1, (5 - 1)));
*out_fwd++ = re1;
last_val = (out_re - out_im);
last_val = ixheaacd_sub32_sat(out_re, out_im);
twidle_fwd = qmf_dec_tables_ptr->dct23_tw + 2;
for (k = DCT2_LEN / 2 - 2; k >= 0; k--) {
@ -186,10 +187,10 @@ VOID ixheaacd_posttwdct2(WORD32 *inp, WORD16 *out_fwd,
twid_re = *twidle_fwd++;
twid_im = *twidle_fwd++;
out_re = ixheaacd_sub32(ixheaacd_mult32x16in32(inp_re, twid_re),
ixheaacd_mult32x16in32(inp_im, twid_im));
out_im = ixheaacd_add32(ixheaacd_mult32x16in32(inp_im, twid_re),
ixheaacd_mult32x16in32(inp_re, twid_im));
out_re = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(inp_re, twid_re),
ixheaacd_mult32x16in32(inp_im, twid_im));
out_im = ixheaacd_add32_sat(ixheaacd_mult32x16in32(inp_im, twid_re),
ixheaacd_mult32x16in32(inp_re, twid_im));
re1 = ixheaacd_round16(ixheaacd_shl32(out_re, (5 - 1)));
im1 = ixheaacd_round16(ixheaacd_shl32(out_im, (5 - 1)));
im2 = ixheaacd_negate16(im1);
@ -238,11 +239,11 @@ static PLATFORM_INLINE VOID ixheaacd_fftposttw_32(
temp3 = *ptr_out_rev--;
temp2 = *ptr_out_rev++;
in1 = temp1 + temp3;
in2 = -temp1 + temp3;
in1 = ixheaacd_add32_sat(temp1, temp3);
in2 = ixheaacd_sub32_sat(temp3, temp1);
temp1 = temp0 - temp2;
temp3 = temp0 + temp2;
temp1 = ixheaacd_sub32_sat(temp0, temp2);
temp3 = ixheaacd_add32_sat(temp0, temp2);
twid_re = *twidle_fwd;
twidle_fwd += 2;
@ -258,11 +259,11 @@ static PLATFORM_INLINE VOID ixheaacd_fftposttw_32(
val1 = val1 << 1;
val2 = val2 << 1;
*ptr_out_fwd++ = temp3 + val1;
*ptr_out_fwd++ = in2 + val2;
*ptr_out_fwd++ = ixheaacd_add32_sat(temp3, val1);
*ptr_out_fwd++ = ixheaacd_add32_sat(in2, val2);
*ptr_out_rev-- = -in2 + val2;
*ptr_out_rev-- = temp3 - val1;
*ptr_out_rev-- = ixheaacd_sub32_sat(val2, in2);
*ptr_out_rev-- = ixheaacd_sub32_sat(temp3, val1);
}
return;
@ -287,10 +288,11 @@ ixheaacd_posttwdct2_32(WORD32 *inp, WORD16 *out_fwd,
out_re = *inp++;
out_im = *inp++;
out_re1 = (out_re + out_im) >> 1;
out_re1 =
ixheaacd_sat64_32(ixheaacd_add64((WORD64)out_re, (WORD64)out_im) >> 1);
re1 = ixheaacd_round16(ixheaacd_shl32_sat(out_re1, (5 - 1)));
*out_fwd++ = re1;
last_val = (out_re - out_im);
last_val = ixheaacd_sub32_sat(out_re, out_im);
twidle_fwd = qmf_dec_tables_ptr->dct23_tw + 4;
for (k = 14; k >= 0; k--) {
@ -305,8 +307,8 @@ ixheaacd_posttwdct2_32(WORD32 *inp, WORD16 *out_fwd,
inp_re = *inp++;
out_re = ixheaacd_sub32(temp1, ixheaacd_mult32x16in32(inp_re, twid_im));
out_im = ixheaacd_add32(ixheaacd_mult32x16in32(inp_re, twid_re), temp2);
out_re = ixheaacd_sub32_sat(temp1, ixheaacd_mult32x16in32(inp_re, twid_im));
out_im = ixheaacd_add32_sat(ixheaacd_mult32x16in32(inp_re, twid_re), temp2);
out_re = ixheaacd_add32_sat(out_re, out_re);
out_im = ixheaacd_add32_sat(out_im, out_im);

View file

@ -99,6 +99,11 @@
#define LEFT_OFFSET 12
#define ixheaacd_bitbuf_checkpoint(it_bit_buf, saved_bit_buf) \
(saved_bit_buf) = (it_bit_buf)
#define ixheaacd_bitbuf_restore(it_bit_buf, saved_bit_buf) \
(it_bit_buf) = (saved_bit_buf)
static int ixheaacd_rvlc_decode(short cw, int len, int *found) {
short indx = 0;
*found = 0;
@ -526,7 +531,7 @@ static VOID ixheaacd_rvlc_decode_forward(
WORD16 dpcm;
ia_bit_buf_struct temp_buf;
ia_bit_buf_struct temp_buf = {0};
WORD16 factor = ptr_aac_dec_channel_info->global_gain;
WORD16 position = 0;
@ -950,7 +955,7 @@ VOID ixheaacd_hcr_read(ia_bit_buf_struct *it_bit_buff,
}
}
static VOID ixheaacd_rvlc_init(
static WORD32 ixheaacd_rvlc_init(
ia_rvlc_info_struct *ptr_rvlc,
ia_aac_dec_channel_info_struct *ptr_aac_dec_channel_info,
ia_bit_buf_struct *it_bit_buff) {
@ -1001,6 +1006,10 @@ static VOID ixheaacd_rvlc_init(
((it_bit_buff->size - it_bit_buff->cnt_bits) >> 3);
it_bit_buff->bit_pos = ((it_bit_buff->size - it_bit_buff->cnt_bits) & 7);
}
if (it_bit_buff->cnt_bits < 0) {
return IA_ENHAACPLUS_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES;
} else
return 0;
}
VOID ixheaacd_bi_dir_est_scf_prev_frame_reference(
@ -1276,8 +1285,8 @@ VOID ixheaacd_bi_dir_est_lower_scf_cur_frame(
conceal_group_max = ptr_rvlc->conceal_max / max_scf_bands;
if (ptr_rvlc->conceal_min == ptr_rvlc->conceal_max) {
WORD32 ref_fwd, ref_nrg_fwd, ref_scf_fwd;
WORD32 ref_bwd, ref_nrg_bwd, ref_scf_bwd;
WORD32 ref_fwd = 0, ref_nrg_fwd = 0, ref_scf_fwd = 0;
WORD32 ref_bwd = 0, ref_nrg_bwd = 0, ref_scf_bwd = 0;
bnds = ptr_rvlc->conceal_min;
ixheaacd_calc_ref_val_fwd(ptr_rvlc, ptr_aac_dec_channel_info, &ref_fwd,
@ -1734,17 +1743,18 @@ static VOID ixheaacd_rvlc_final_error_detection(
}
}
VOID ixheaacd_rvlc_dec(ia_aac_dec_channel_info_struct *ptr_aac_dec_channel_info,
ia_aac_dec_overlap_info *ptr_aac_dec_static_channel_info,
ia_bit_buf_struct *it_bit_buff) {
IA_ERRORCODE ixheaacd_rvlc_dec(
ia_aac_dec_channel_info_struct *ptr_aac_dec_channel_info,
ia_aac_dec_overlap_info *ptr_aac_dec_static_channel_info,
ia_bit_buf_struct *it_bit_buff) {
ia_rvlc_info_struct *ptr_rvlc = &ptr_aac_dec_channel_info->ptr_rvlc_info;
WORD32 bit_cnt_offset;
UWORD32 save_bit_cnt;
ixheaacd_rvlc_init(ptr_rvlc, ptr_aac_dec_channel_info, it_bit_buff);
save_bit_cnt = it_bit_buff->cnt_bits;
ia_bit_buf_struct saved_it_bit_buff;
IA_ERRORCODE error_code = 0;
error_code =
ixheaacd_rvlc_init(ptr_rvlc, ptr_aac_dec_channel_info, it_bit_buff);
if (error_code) return error_code;
ixheaacd_bitbuf_checkpoint(*it_bit_buff, saved_it_bit_buff);
if (ptr_rvlc->sf_esc_present)
ixheaacd_rvlc_decode_escape(
ptr_rvlc, ptr_aac_dec_channel_info->rvlc_scf_esc_arr, it_bit_buff);
@ -1758,12 +1768,6 @@ VOID ixheaacd_rvlc_dec(ia_aac_dec_channel_info_struct *ptr_aac_dec_channel_info,
ptr_aac_dec_channel_info->rvlc_intensity_used = ptr_rvlc->intensity_used;
ptr_aac_dec_channel_info->str_pns_info.pns_active = ptr_rvlc->noise_used;
bit_cnt_offset = it_bit_buff->cnt_bits - save_bit_cnt;
if (bit_cnt_offset) {
it_bit_buff->cnt_bits -= bit_cnt_offset;
it_bit_buff->ptr_read_next =
it_bit_buff->ptr_bit_buf_base +
((it_bit_buff->size - it_bit_buff->cnt_bits) >> 3);
it_bit_buff->bit_pos = ((it_bit_buff->size - it_bit_buff->cnt_bits) & 7);
}
}
ixheaacd_bitbuf_restore(*it_bit_buff, saved_it_bit_buff);
return error_code;
}

View file

@ -3,9 +3,10 @@
void ixheaacd_rvlc_read(
ia_bit_buf_struct *itt_bit_buff,
ia_aac_dec_channel_info_struct *ptr_aac_dec_channel_info);
void ixheaacd_rvlc_dec(ia_aac_dec_channel_info_struct *ptr_aac_dec_channel_info,
ia_aac_dec_overlap_info *ptr_aac_dec_static_channel_info,
ia_bit_buf_struct *itt_bit_buff);
IA_ERRORCODE ixheaacd_rvlc_dec(
ia_aac_dec_channel_info_struct *ptr_aac_dec_channel_info,
ia_aac_dec_overlap_info *ptr_aac_dec_static_channel_info,
ia_bit_buf_struct *itt_bit_buff);
void ixheaacd_hcr_read(ia_bit_buf_struct *itt_bit_buff,
ia_aac_dec_channel_info_struct *ptr_aac_dec_channel_info,
WORD32 ele_type);
@ -14,7 +15,7 @@ void ixheaacd_carry_bit_branch_val(UWORD8 carry_bit, UWORD32 tree_node,
UWORD32 *branch_val, UWORD32 *branch_node);
VOID ixheaacd_huff_sfb_table(WORD32 it_bit_buff, WORD16 *huff_index,
WORD16 *len, const UWORD16 *code_book_tbl,
WORD32 *len, const UWORD16 *code_book_tbl,
const UWORD32 *idx_table);
#endif

View file

@ -204,26 +204,31 @@
#define MAX_OV_DELAY 12
#define LD_TRAN 1
#define LD_ENV_TIME_SLOT 7
#define LD_ENV_TBL_512 16
#define LD_ENV_TBL_480 15
#define LD_ENV_TBL_SIZE 4
#define SBR_TRAN_BITS 4
#define SBRLD_CLA_BITS 1
#define SBR_ENVT_NUMENV 0
#define SBR_ENVT_TRANIDX 3
static const int ixheaacd_ld_env_table_512[16][4] = {
static const int ixheaacd_ld_env_table_512[LD_ENV_TBL_512][LD_ENV_TBL_SIZE] = {
{2, 4, -1, 0}, {2, 5, -1, 0}, {3, 2, 6, 1}, {3, 3, 7, 1},
{3, 4, 8, 1}, {3, 5, 9, 1}, {3, 6, 10, 1}, {3, 7, 11, 1},
{3, 8, 12, 1}, {3, 9, 13, 1}, {3, 10, 14, 1}, {2, 11, -1, 1},
{2, 12, -1, 1}, {2, 13, -1, 1}, {2, 14, -1, 1}, {2, 15, -1, 1},
};
static const int ixheaacd_ld_env_table_480[15][4] = {
static const int ixheaacd_ld_env_table_480[LD_ENV_TBL_480][LD_ENV_TBL_SIZE] = {
{2, 4, -1, 0}, {2, 5, -1, 0}, {3, 2, 6, 1}, {3, 3, 7, 1},
{3, 4, 8, 1}, {3, 5, 9, 1}, {3, 6, 10, 1}, {3, 7, 11, 1},
{3, 8, 12, 1}, {3, 9, 13, 1}, {2, 10, -1, 1}, {2, 11, -1, 1},
{2, 12, -1, 1}, {2, 13, -1, 1}, {2, 14, -1, 1},
};
static const int ixheaacd_ld_env_table_time_slot[7] = {8, 5, 0, 0, 0, 0, 0};
static const int ixheaacd_ld_env_table_time_slot[LD_ENV_TIME_SLOT] = {
8, 5, 0, 0, 0, 0, 0};
#define SBR_CLA_BITS 2
#define SBR_ABS_BITS 2

View file

@ -69,7 +69,7 @@ static PLATFORM_INLINE WORD32 ixheaacd_sbr_crc(ia_bit_buf_struct* it_bit_buff,
FLAG ixheaacd_sbr_crccheck(ia_bit_buf_struct* it_bit_buff,
WORD32 crc_bits_len) {
struct ia_bit_buf_struct it_bit_buff_local;
struct ia_bit_buf_struct it_bit_buff_local = {0};
WORD32 num_crc_bits;
WORD32 calc_crc_sum;
WORD32 bits_available;

View file

@ -158,6 +158,7 @@ VOID ixheaacd_hbe_repl_spec(WORD32 x_over_qmf[MAX_NUM_PATCHES],
start_band--;
}
}
if (!ixheaacd_num_bands) break;
for (col = 0; col < no_bins; col++) {
WORD32 i = 0;
band = target + ixheaacd_num_bands - 1;
@ -573,8 +574,8 @@ WORD32 ixheaacd_sbr_dec(ia_sbr_dec_struct *ptr_sbr_dec, WORD16 *ptr_time_data,
WORD save_lb_scale;
WORD op_delay;
WORD32 *p_arr_qmf_buf_real[MAX_ENV_COLS + MAX_ENV_COLS];
WORD32 **p_arr_qmf_buf_imag = &p_arr_qmf_buf_real[MAX_ENV_COLS];
WORD32 *p_arr_qmf_buf_real[MAX_ENV_COLS] = {0};
WORD32 *p_arr_qmf_buf_imag[MAX_ENV_COLS] = {0};
WORD32 *ptr;
WORD hbe_flag = ptr_header_data->hbe_flag;
@ -612,6 +613,10 @@ WORD32 ixheaacd_sbr_dec(ia_sbr_dec_struct *ptr_sbr_dec, WORD16 *ptr_time_data,
WORD32 num = op_delay;
WORD32 *ptr_pers_qmf_real = ptr_sbr_dec->ptr_sbr_overlap_buf;
WORD32 *p_scr_qmf_real = ptr_work_buf_core + (2 << (6 + !low_pow_flag));
if ((no_bins < LPC_ORDER) || ((no_bins + op_delay) > MAX_ENV_COLS))
return -1;
if (!low_pow_flag) {
num = num << 1;
}
@ -636,7 +641,7 @@ WORD32 ixheaacd_sbr_dec(ia_sbr_dec_struct *ptr_sbr_dec, WORD16 *ptr_time_data,
if (apply_processing) {
ixheaacd_rescale_x_overlap(ptr_sbr_dec, ptr_header_data, ptr_frame_data,
ptr_frame_data_prev, p_arr_qmf_buf_real,
low_pow_flag);
p_arr_qmf_buf_imag, low_pow_flag);
}
}

View file

@ -20,6 +20,8 @@
#ifndef IXHEAACD_SBR_DEC_H
#define IXHEAACD_SBR_DEC_H
#include <setjmp.h>
typedef struct {
WORD32 x_over_qmf[MAX_NUM_PATCHES];
WORD32 max_stretch;
@ -121,6 +123,7 @@ struct ia_sbr_dec_inst_struct {
FLAG prev_sbr_mode;
FLAG inter_tes_flag;
FLAG aot_usac_flag;
jmp_buf *xaac_jmp_buf;
};
typedef struct ia_sbr_pers_struct {
@ -205,7 +208,8 @@ VOID ixheaacd_rescale_x_overlap(
ia_sbr_dec_struct *ptr_sbr_dec, ia_sbr_header_data_struct *ptr_header_data,
ia_sbr_frame_info_data_struct *ptr_frame_data,
ia_sbr_prev_frame_data_struct *ptr_frame_data_prev,
WORD32 **pp_overlap_buffer_real, FLAG low_pow_flag);
WORD32 **pp_overlap_buffer_real, WORD32 **pp_overlap_buffer_imag,
FLAG low_pow_flag);
WORD32 ixheaacd_qmf_hbe_data_reinit(
ia_esbr_hbe_txposer_struct *ptr_hbe_transposer_str,

View file

@ -66,7 +66,7 @@
#include "ixheaacd_env_dec.h"
#include "ixheaacd_basic_funcs.h"
#include "ixheaacd_sbr_crc.h"
#include "ixheaacd_error_standards.h"
#include "ixheaacd_sbrqmftrans.h"
#include "ixheaacd_audioobjtypes.h"

View file

@ -349,6 +349,10 @@ WORD32 ixheaacd_reset_hf_generator(ia_sbr_hf_generator_struct *ptr_hf_gen_str,
patch = 0;
if ((goal_sb < sb) && (lsb > src_start_band)) {
return -1;
}
while (((sb - usb) < 0) && (patch < MAX_NUM_PATCHES)) {
ia_patch_param_struct *ptr_loc_patch_param = &p_str_patch_param[patch];
@ -427,12 +431,12 @@ VOID ixheaacd_rescale_x_overlap(
ia_sbr_dec_struct *ptr_sbr_dec, ia_sbr_header_data_struct *ptr_header_data,
ia_sbr_frame_info_data_struct *ptr_frame_data,
ia_sbr_prev_frame_data_struct *ptr_frame_data_prev,
WORD32 **pp_overlap_buffer_real, FLAG low_pow_flag) {
WORD32 **pp_overlap_buffer_real, WORD32 **pp_overlap_buffer_imag,
FLAG low_pow_flag) {
WORD32 k, l;
WORD32 start_band, end_band;
WORD32 target_lsb, target_usb;
WORD32 source_scale, target_scale, delta_scale, reserve;
WORD32 **pp_overlap_buffer_imag = &pp_overlap_buffer_real[MAX_ENV_COLS];
WORD32 old_lsb = ptr_frame_data_prev->max_qmf_subband_aac;
WORD32 start_slot =
@ -954,7 +958,9 @@ WORD32 ixheaacd_generate_hf(FLOAT32 ptr_src_buf_real[][64],
ia_auto_corr_ele_struct str_auto_corr;
WORD16 *ptr_invf_band_tbl =
&ptr_header_data->pstr_freq_band_data->freq_band_tbl_noise[1];
&ptr_header_data->pstr_freq_band_data
->freq_band_tbl_noise[1]; // offest 1 used as base address of
// ptr_invf_band_tbl
WORD32 num_if_bands = ptr_header_data->pstr_freq_band_data->num_nf_bands;
WORD32 sub_band_start = ptr_header_data->pstr_freq_band_data->sub_band_start;
WORD16 *f_master_tbl = ptr_header_data->pstr_freq_band_data->f_master_tbl;
@ -1116,8 +1122,12 @@ WORD32 ixheaacd_generate_hf(FLOAT32 ptr_src_buf_real[][64],
for (k2 = sb; k2 < sb + num_bands_in_patch; k2++) {
k = k2 - patch_stride;
bw_index = 0;
while (k2 >= ptr_invf_band_tbl[bw_index]) bw_index++;
while (k2 >= ptr_invf_band_tbl[bw_index]) {
bw_index++;
if (bw_index >= MAX_NOISE_COEFFS) return -1;
}
if (bw_index >= MAX_NUM_PATCHES) return -1;
bw = bw_array[bw_index];
a0r = bw * alpha_real[k][0];
@ -1161,6 +1171,8 @@ WORD32 ixheaacd_generate_hf(FLOAT32 ptr_src_buf_real[][64],
FLOAT32 alpha_real[2], alpha_imag[2];
bw_index = 0, patch = 1;
if (NULL == ptr_ph_vocod_buf_real || NULL == ptr_ph_vocod_buf_imag)
return -1;
for (k2 = sub_band_start; k2 < f_master_tbl[num_mf_bands]; k2++) {
ixheaacd_esbr_calc_co_variance(&str_auto_corr, &ptr_ph_vocod_buf_real[0],
@ -1206,8 +1218,12 @@ WORD32 ixheaacd_generate_hf(FLOAT32 ptr_src_buf_real[][64],
alpha_imag[1] = 0.0f;
}
while (k2 >= ptr_invf_band_tbl[bw_index]) bw_index++;
while (k2 >= ptr_invf_band_tbl[bw_index]) {
bw_index++;
if (bw_index >= MAX_NOISE_COEFFS) return -1;
}
if (bw_index >= MAX_NUM_PATCHES) return -1;
bw = bw_array[bw_index];
a0r = bw * alpha_real[0];

Some files were not shown because too many files have changed in this diff Show more