Formatting changes
Formatting .c and .h files using clang-format Formatting .s files Bug: 80493357 Test: compare object sizes Change-Id: I38296083c9d2d566a6a2564db2e391e4b2bd43a9
This commit is contained in:
parent
8eb646f89b
commit
b3226ce6f8
152 changed files with 20984 additions and 21999 deletions
|
|
@ -50,21 +50,21 @@ FIRST_STAGE_R4:
|
|||
ADD r0, r0, #4
|
||||
CMP r0, lr, ASR #1
|
||||
|
||||
ADD r4, r4, r6 @x0r = x0r + x2r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x2i@
|
||||
ADD r4, r4, r6 @x0r = x0r + x2r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x2i@
|
||||
SUB r6, r4, r6, lsl#1 @x2r = x0r - (x2r << 1)@
|
||||
SUB r7, r5, r7, lsl#1 @x2i = x0i - (x2i << 1)@
|
||||
ADD r8, r8, r10 @x1r = x1r + x3r@
|
||||
ADD r9, r9, r11 @x1i = x1i + x3i@
|
||||
ADD r8, r8, r10 @x1r = x1r + x3r@
|
||||
ADD r9, r9, r11 @x1i = x1i + x3i@
|
||||
SUB r1, r8, r10, lsl#1 @x3r = x1r - (x3r << 1)@
|
||||
SUB r11, r9, r11, lsl#1 @x3i = x1i - (x3i << 1)@
|
||||
|
||||
ADD r4, r4, r8 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r9 @x0i = x0i + x1i@
|
||||
ADD r4, r4, r8 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r9 @x0i = x0i + x1i@
|
||||
SUB r8, r4, r8, lsl#1 @x1r = x0r - (x1r << 1)@
|
||||
SUB r9, r5, r9, lsl#1 @x1i = x0i - (x1i << 1)
|
||||
ADD r6, r6, r11 @x2r = x2r + x3i@
|
||||
SUB r7, r7, r1 @x2i = x2i - x3r@
|
||||
ADD r6, r6, r11 @x2r = x2r + x3i@
|
||||
SUB r7, r7, r1 @x2i = x2i - x3r@
|
||||
SUB r10, r6, r11, lsl#1 @x3i = x2r - (x3i << 1)@
|
||||
ADD r11, r7, r1, lsl#1 @x3r = x2i + (x3r << 1)@
|
||||
|
||||
|
|
@ -108,23 +108,23 @@ LOOP_TRIVIAL_TWIDDLE:
|
|||
@MOV r10,r10,ASR #1
|
||||
@MOV r11,r11,ASR #1
|
||||
|
||||
ADD r4, r4, r8 @x0r = x0r + x2r@
|
||||
ADD r5, r5, r9 @x0i = x0i + x2i@
|
||||
ADD r4, r4, r8 @x0r = x0r + x2r@
|
||||
ADD r5, r5, r9 @x0i = x0i + x2i@
|
||||
SUB r8, r4, r8, lsl #1 @x2r = x0r - (x2r << 1)@
|
||||
SUB r9, r5, r9, lsl #1 @x2i = x0i - (x2i << 1)@
|
||||
ADD r6, r6, r10 @x1r = x1r + x3r@
|
||||
ADD r7, r7, r11 @x1i = x1i + x3i@
|
||||
ADD r6, r6, r10 @x1r = x1r + x3r@
|
||||
ADD r7, r7, r11 @x1i = x1i + x3i@
|
||||
SUB r2, r6, r10, lsl #1 @x3r = x1r - (x3r << 1)@
|
||||
SUB r11, r7, r11, lsl #1 @x3i = x1i - (x3i << 1)@
|
||||
|
||||
ADD r4, r4, r6 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x1i@
|
||||
ADD r4, r4, r6 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x1i@
|
||||
@MOV r4,r4,ASR #1
|
||||
@MOV r5,r5,ASR #1
|
||||
SUB r6, r4, r6, lsl #1 @x1r = x0r - (x1r << 1)@
|
||||
SUB r7, r5, r7, lsl #1 @x1i = x0i - (x1i << 1)
|
||||
ADD r8, r8, r11 @x2r = x2r + x3i@
|
||||
SUB r9, r9, r2 @x2i = x2i - x3r@
|
||||
ADD r8, r8, r11 @x2r = x2r + x3i@
|
||||
SUB r9, r9, r2 @x2i = x2i - x3r@
|
||||
SUB r10, r8, r11, lsl#1 @x3i = x2r - (x3i << 1)@
|
||||
ADD r11, r9, r2, lsl#1 @x3r = x2i + (x3r << 1)
|
||||
|
||||
|
|
@ -241,23 +241,23 @@ RADIX4_BFLY:
|
|||
|
||||
|
||||
ADD r4, r8, r4 @x0r = x0r + x2r@
|
||||
ADD r5, r9, r5 @x0i = x0i + x2i@
|
||||
ADD r5, r9, r5 @x0i = x0i + x2i@
|
||||
SUB r8, r4, r8, lsl#1 @x2r = x0r - (x2r << 1)@
|
||||
SUB r9, r5, r9, lsl#1 @x2i = x0i - (x2i << 1)@
|
||||
ADD r6, r6, r10 @x1r = x1r + x3r@
|
||||
ADD r7, r7, r11 @x1i = x1i + x3i@
|
||||
ADD r6, r6, r10 @x1r = x1r + x3r@
|
||||
ADD r7, r7, r11 @x1i = x1i + x3i@
|
||||
SUB r10, r6, r10, lsl#1 @x3r = x1r - (x3r << 1)@
|
||||
SUB r11, r7, r11, lsl#1 @x3i = x1i - (x3i << 1)@
|
||||
|
||||
ADD r4, r4, r6 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x1i@
|
||||
ADD r4, r4, r6 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x1i@
|
||||
SUB r6, r4, r6, lsl#1 @x1r = x0r - (x1r << 1)@
|
||||
SUB r7, r5, r7, lsl#1 @x1i = x0i - (x1i << 1)
|
||||
STRD r4, [r12] @r4=x0r, r5=x0i
|
||||
ADD r12, r12, r0
|
||||
|
||||
ADD r8, r8, r11 @x2r = x2r + x3i@
|
||||
SUB r9, r9, r10 @x2i = x2i - x3r@
|
||||
ADD r8, r8, r11 @x2r = x2r + x3i@
|
||||
SUB r9, r9, r10 @x2i = x2i - x3r@
|
||||
SUB r4, r8, r11, lsl#1 @x3i = x2r - (x3i << 1)@
|
||||
ADD r5, r9, r10, lsl#1 @x3r = x2i + (x3r << 1)
|
||||
|
||||
|
|
@ -504,20 +504,20 @@ RADIX4_BFLY_3:
|
|||
ADD r5, r9, r5 @x0i = x0i + x2i@
|
||||
SUB r8, r4, r8, lsl#1 @x2r = x0r - (x2r << 1)@
|
||||
SUB r9, r5, r9, lsl#1 @x2i = x0i - (x2i << 1)@
|
||||
ADD r6, r6, r10 @x1r = x1r + x3r@
|
||||
ADD r7, r7, r11 @x1i = x1i + x3i@
|
||||
ADD r6, r6, r10 @x1r = x1r + x3r@
|
||||
ADD r7, r7, r11 @x1i = x1i + x3i@
|
||||
SUB r10, r6, r10, lsl#1 @x3r = x1r - (x3r << 1)@
|
||||
SUB r11, r7, r11, lsl#1 @x3i = x1i - (x3i << 1)@
|
||||
|
||||
ADD r4, r4, r6 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x1i@
|
||||
ADD r4, r4, r6 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x1i@
|
||||
SUB r6, r4, r6, lsl#1 @x1r = x0r - (x1r << 1)@
|
||||
SUB r7, r5, r7, lsl#1 @x1i = x0i - (x1i << 1)
|
||||
STRD r4, [r12] @r4=x0r, r5=x0i
|
||||
ADD r12, r12, r0
|
||||
|
||||
ADD r8, r8, r11 @x2r = x2r + x3i@
|
||||
SUB r9, r9, r10 @x2i = x2i - x3r@
|
||||
ADD r8, r8, r11 @x2r = x2r + x3i@
|
||||
SUB r9, r9, r10 @x2i = x2i - x3r@
|
||||
SUB r4, r8, r11, lsl#1 @x3i = x2r - (x3i << 1)@
|
||||
ADD r5, r9, r10, lsl#1 @x3r = x2i + (x3r << 1)
|
||||
|
||||
|
|
@ -634,20 +634,20 @@ RADIX4_BFLY_4:
|
|||
ADD r5, r9, r5 @x0i = x0i + x2i@
|
||||
SUB r8, r4, r8, lsl#1 @x2r = x0r - (x2r << 1)@
|
||||
SUB r9, r5, r9, lsl#1 @x2i = x0i - (x2i << 1)@
|
||||
ADD r6, r6, r10 @x1r = x1r + x3r@
|
||||
SUB r7, r7, r11 @x1i = x1i - x3i@
|
||||
ADD r6, r6, r10 @x1r = x1r + x3r@
|
||||
SUB r7, r7, r11 @x1i = x1i - x3i@
|
||||
SUB r10, r6, r10, lsl#1 @x3r = x1r - (x3r << 1)@
|
||||
ADD r11, r7, r11, lsl#1 @x3i = x1i + (x3i << 1)@
|
||||
|
||||
ADD r4, r4, r6 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x1i@
|
||||
ADD r4, r4, r6 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x1i@
|
||||
SUB r6, r4, r6, lsl#1 @x1r = x0r - (x1r << 1)@
|
||||
SUB r7, r5, r7, lsl#1 @x1i = x0i - (x1i << 1)
|
||||
STRD r4, [r12] @r4=x0r, r5=x0i
|
||||
ADD r12, r12, r0
|
||||
|
||||
ADD r8, r8, r11 @x2r = x2r + x3i@
|
||||
SUB r9, r9, r10 @x2i = x2i - x3r@
|
||||
ADD r8, r8, r11 @x2r = x2r + x3i@
|
||||
SUB r9, r9, r10 @x2i = x2i - x3r@
|
||||
SUB r4, r8, r11, lsl#1 @x3i = x2r - (x3i << 1)@
|
||||
ADD r5, r9, r10, lsl#1 @x3r = x2i + (x3r << 1)
|
||||
|
||||
|
|
|
|||
|
|
@ -50,21 +50,21 @@ FIRST_STAGE_R4:
|
|||
ADD r0, r0, #4
|
||||
CMP r0, lr, ASR #1
|
||||
|
||||
ADD r4, r4, r6 @x0r = x0r + x2r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x2i@
|
||||
ADD r4, r4, r6 @x0r = x0r + x2r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x2i@
|
||||
SUB r6, r4, r6, lsl#1 @x2r = x0r - (x2r << 1)@
|
||||
SUB r7, r5, r7, lsl#1 @x2i = x0i - (x2i << 1)@
|
||||
ADD r8, r8, r10 @x1r = x1r + x3r@
|
||||
ADD r9, r9, r11 @x1i = x1i + x3i@
|
||||
ADD r8, r8, r10 @x1r = x1r + x3r@
|
||||
ADD r9, r9, r11 @x1i = x1i + x3i@
|
||||
SUB r1, r8, r10, lsl#1 @x3r = x1r - (x3r << 1)@
|
||||
SUB r11, r9, r11, lsl#1 @x3i = x1i - (x3i << 1)@
|
||||
|
||||
ADD r4, r4, r8 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r9 @x0i = x0i + x1i@
|
||||
ADD r4, r4, r8 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r9 @x0i = x0i + x1i@
|
||||
SUB r8, r4, r8, lsl#1 @x1r = x0r - (x1r << 1)@
|
||||
SUB r9, r5, r9, lsl#1 @x1i = x0i - (x1i << 1)
|
||||
SUB r6, r6, r11 @x2r = x2r - x3i@
|
||||
ADD r7, r7, r1 @x2i = x2i + x3r@
|
||||
SUB r6, r6, r11 @x2r = x2r - x3i@
|
||||
ADD r7, r7, r1 @x2i = x2i + x3r@
|
||||
ADD r10, r6, r11, lsl#1 @x3i = x2r + (x3i << 1)@
|
||||
SUB r11, r7, r1, lsl#1 @x3r = x2i - (x3r << 1)@
|
||||
|
||||
|
|
@ -108,23 +108,23 @@ LOOP_TRIVIAL_TWIDDLE:
|
|||
@MOV r10,r10,ASR #1
|
||||
@MOV r11,r11,ASR #1
|
||||
|
||||
ADD r4, r4, r8 @x0r = x0r + x2r@
|
||||
ADD r5, r5, r9 @x0i = x0i + x2i@
|
||||
ADD r4, r4, r8 @x0r = x0r + x2r@
|
||||
ADD r5, r5, r9 @x0i = x0i + x2i@
|
||||
SUB r8, r4, r8, lsl #1 @x2r = x0r - (x2r << 1)@
|
||||
SUB r9, r5, r9, lsl #1 @x2i = x0i - (x2i << 1)@
|
||||
ADD r6, r6, r10 @x1r = x1r + x3r@
|
||||
ADD r7, r7, r11 @x1i = x1i + x3i@
|
||||
ADD r6, r6, r10 @x1r = x1r + x3r@
|
||||
ADD r7, r7, r11 @x1i = x1i + x3i@
|
||||
SUB r2, r6, r10, lsl #1 @x3r = x1r - (x3r << 1)@
|
||||
SUB r11, r7, r11, lsl #1 @x3i = x1i - (x3i << 1)@
|
||||
|
||||
ADD r4, r4, r6 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x1i@
|
||||
ADD r4, r4, r6 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x1i@
|
||||
@MOV r4,r4,ASR #1
|
||||
@MOV r5,r5,ASR #1
|
||||
SUB r6, r4, r6, lsl #1 @x1r = x0r - (x1r << 1)@
|
||||
SUB r7, r5, r7, lsl #1 @x1i = x0i - (x1i << 1)
|
||||
SUB r8, r8, r11 @x2r = x2r - x3i@
|
||||
ADD r9, r9, r2 @x2i = x2i + x3r@
|
||||
SUB r8, r8, r11 @x2r = x2r - x3i@
|
||||
ADD r9, r9, r2 @x2i = x2i + x3r@
|
||||
ADD r10, r8, r11, lsl#1 @x3i = x2r + (x3i << 1)@
|
||||
SUB r11, r9, r2, lsl#1 @x3r = x2i - (x3r << 1)
|
||||
|
||||
|
|
@ -241,23 +241,23 @@ RADIX4_BFLY:
|
|||
|
||||
|
||||
ADD r4, r8, r4 @x0r = x0r + x2r@
|
||||
ADD r5, r9, r5 @x0i = x0i + x2i@
|
||||
ADD r5, r9, r5 @x0i = x0i + x2i@
|
||||
SUB r8, r4, r8, lsl#1 @x2r = x0r - (x2r << 1)@
|
||||
SUB r9, r5, r9, lsl#1 @x2i = x0i - (x2i << 1)@
|
||||
ADD r6, r6, r10 @x1r = x1r + x3r@
|
||||
ADD r7, r7, r11 @x1i = x1i + x3i@
|
||||
ADD r6, r6, r10 @x1r = x1r + x3r@
|
||||
ADD r7, r7, r11 @x1i = x1i + x3i@
|
||||
SUB r10, r6, r10, lsl#1 @x3r = x1r - (x3r << 1)@
|
||||
SUB r11, r7, r11, lsl#1 @x3i = x1i - (x3i << 1)@
|
||||
|
||||
ADD r4, r4, r6 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x1i@
|
||||
ADD r4, r4, r6 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x1i@
|
||||
SUB r6, r4, r6, lsl#1 @x1r = x0r - (x1r << 1)@
|
||||
SUB r7, r5, r7, lsl#1 @x1i = x0i - (x1i << 1)
|
||||
STRD r4, [r12] @r4=x0r, r5=x0i
|
||||
ADD r12, r12, r0
|
||||
|
||||
SUB r8, r8, r11 @x2r = x2r - x3i@
|
||||
ADD r9, r9, r10 @x2i = x2i + x3r@
|
||||
SUB r8, r8, r11 @x2r = x2r - x3i@
|
||||
ADD r9, r9, r10 @x2i = x2i + x3r@
|
||||
ADD r4, r8, r11, lsl#1 @x3i = x2r + (x3i << 1)@
|
||||
SUB r5, r9, r10, lsl#1 @x3r = x2i - (x3r << 1)
|
||||
|
||||
|
|
@ -504,20 +504,20 @@ RADIX4_BFLY_3:
|
|||
ADD r5, r9, r5 @x0i = x0i + x2i@
|
||||
SUB r8, r4, r8, lsl#1 @x2r = x0r - (x2r << 1)@
|
||||
SUB r9, r5, r9, lsl#1 @x2i = x0i - (x2i << 1)@
|
||||
ADD r6, r6, r10 @x1r = x1r + x3r@
|
||||
ADD r7, r7, r11 @x1i = x1i + x3i@
|
||||
ADD r6, r6, r10 @x1r = x1r + x3r@
|
||||
ADD r7, r7, r11 @x1i = x1i + x3i@
|
||||
SUB r10, r6, r10, lsl#1 @x3r = x1r - (x3r << 1)@
|
||||
SUB r11, r7, r11, lsl#1 @x3i = x1i - (x3i << 1)@
|
||||
|
||||
ADD r4, r4, r6 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x1i@
|
||||
ADD r4, r4, r6 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x1i@
|
||||
SUB r6, r4, r6, lsl#1 @x1r = x0r - (x1r << 1)@
|
||||
SUB r7, r5, r7, lsl#1 @x1i = x0i - (x1i << 1)
|
||||
STRD r4, [r12] @r4=x0r, r5=x0i
|
||||
ADD r12, r12, r0
|
||||
|
||||
SUB r8, r8, r11 @x2r = x2r - x3i@
|
||||
ADD r9, r9, r10 @x2i = x2i + x3r@
|
||||
SUB r8, r8, r11 @x2r = x2r - x3i@
|
||||
ADD r9, r9, r10 @x2i = x2i + x3r@
|
||||
ADD r4, r8, r11, lsl#1 @x3i = x2r + (x3i << 1)@
|
||||
SUB r5, r9, r10, lsl#1 @x3r = x2i - (x3r << 1)
|
||||
|
||||
|
|
@ -635,20 +635,20 @@ RADIX4_BFLY_4:
|
|||
ADD r5, r9, r5 @x0i = x0i + x2i@
|
||||
SUB r8, r4, r8, lsl#1 @x2r = x0r - (x2r << 1)@
|
||||
SUB r9, r5, r9, lsl#1 @x2i = x0i - (x2i << 1)@
|
||||
ADD r6, r6, r10 @x1r = x1r + x3r@
|
||||
SUB r7, r7, r11 @x1i = x1i - x3i@
|
||||
ADD r6, r6, r10 @x1r = x1r + x3r@
|
||||
SUB r7, r7, r11 @x1i = x1i - x3i@
|
||||
SUB r10, r6, r10, lsl#1 @x3r = x1r - (x3r << 1)@
|
||||
ADD r11, r7, r11, lsl#1 @x3i = x1i + (x3i << 1)@
|
||||
|
||||
ADD r4, r4, r6 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x1i@
|
||||
ADD r4, r4, r6 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x1i@
|
||||
SUB r6, r4, r6, lsl#1 @x1r = x0r - (x1r << 1)@
|
||||
SUB r7, r5, r7, lsl#1 @x1i = x0i - (x1i << 1)
|
||||
STRD r4, [r12] @r4=x0r, r5=x0i
|
||||
ADD r12, r12, r0
|
||||
|
||||
SUB r8, r8, r11 @x2r = x2r - x3i@
|
||||
ADD r9, r9, r10 @x2i = x2i + x3r@
|
||||
SUB r8, r8, r11 @x2r = x2r - x3i@
|
||||
ADD r9, r9, r10 @x2i = x2i + x3r@
|
||||
ADD r4, r8, r11, lsl#1 @x3i = x2r + (x3i << 1)@
|
||||
SUB r5, r9, r10, lsl#1 @x3r = x2i - (x3r << 1)
|
||||
|
||||
|
|
|
|||
|
|
@ -94,8 +94,8 @@ ixheaacd_esbr_cos_sin_mod_loop2:
|
|||
LOOP1:
|
||||
VLD1.32 {D2}, [R0]
|
||||
VLD1.32 {D3}, [R10]
|
||||
LDR R5, [R3] @RE2
|
||||
LDR R6, [R11] @RE3
|
||||
LDR R5, [R3] @RE2
|
||||
LDR R6, [R11] @RE3
|
||||
VTRN.32 D2, D3
|
||||
|
||||
VMULL.S32 q2, d0, d2 @qsub 2nd
|
||||
|
|
|
|||
|
|
@ -134,7 +134,8 @@ VOID(*ixheaacd_harm_idx_zerotwolp)
|
|||
|
||||
VOID(*ixheaacd_tns_ar_filter_fixed)
|
||||
(WORD32 *spectrum, WORD32 size, WORD32 inc, WORD32 *lpc, WORD32 order,
|
||||
WORD32 shift_value, WORD scale_spec) = &ixheaacd_tns_ar_filter_fixed_non_neon_armv7;
|
||||
WORD32 shift_value,
|
||||
WORD scale_spec) = &ixheaacd_tns_ar_filter_fixed_non_neon_armv7;
|
||||
|
||||
VOID(*ixheaacd_tns_ar_filter)
|
||||
(WORD32 *spectrum, WORD32 size, WORD32 inc, WORD16 *lpc, WORD32 order,
|
||||
|
|
|
|||
|
|
@ -230,20 +230,20 @@ VOID(*ixheaacd_aac_ld_dec_rearrange)
|
|||
(WORD32 *ip, WORD32 *op, WORD32 mdct_len_2,
|
||||
UWORD8 *re_arr_tab) = &ia_aac_ld_dec_rearrange_armv7;
|
||||
|
||||
VOID (*ixheaacd_fft32x32_ld)
|
||||
VOID(*ixheaacd_fft32x32_ld)
|
||||
(ia_aac_dec_imdct_tables_struct *imdct_tables_ptr, WORD32 npoints,
|
||||
WORD32 *ptr_x, WORD32 *ptr_y) = &ixheaacd_imdct_using_fft_armv7;
|
||||
|
||||
VOID (*ixheaacd_fft32x32_ld2)
|
||||
VOID(*ixheaacd_fft32x32_ld2)
|
||||
(ia_aac_dec_imdct_tables_struct *imdct_tables_ptr, WORD32 npoints,
|
||||
WORD32 *ptr_x, WORD32 *ptr_y) = &ixheaacd_fft32x32_ld2_armv7;
|
||||
|
||||
WORD16 (*ixheaacd_neg_expo_inc)(WORD16 neg_expo) = &ixheaacd_neg_expo_inc_arm;
|
||||
|
||||
VOID (*ixheaacd_inv_dit_fft_8pt)
|
||||
VOID(*ixheaacd_inv_dit_fft_8pt)
|
||||
(WORD32 *x, WORD32 *real, WORD32 *imag) = &ixheaacd_inv_dit_fft_8pt_armv7;
|
||||
|
||||
VOID (*ixheaacd_scale_factor_process)
|
||||
VOID(*ixheaacd_scale_factor_process)
|
||||
(WORD32 *x_invquant, WORD16 *scale_fact, WORD no_band, WORD8 *width,
|
||||
WORD32 *scale_tables_ptr, WORD32 total_channels, WORD32 object_type,
|
||||
WORD32 aac_sf_data_resil_flag) = &ixheaacd_scale_factor_process_armv7;
|
||||
|
|
|
|||
|
|
@ -38,21 +38,21 @@ FIRST_STAGE_R4:
|
|||
ADD r0, r0, #4
|
||||
CMP r0, lr, ASR #1
|
||||
|
||||
ADD r4, r4, r6 @x0r = x0r + x2r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x2i@
|
||||
ADD r4, r4, r6 @x0r = x0r + x2r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x2i@
|
||||
SUB r6, r4, r6, lsl#1 @x2r = x0r - (x2r << 1)@
|
||||
SUB r7, r5, r7, lsl#1 @x2i = x0i - (x2i << 1)@
|
||||
ADD r8, r8, r10 @x1r = x1r + x3r@
|
||||
ADD r9, r9, r11 @x1i = x1i + x3i@
|
||||
ADD r8, r8, r10 @x1r = x1r + x3r@
|
||||
ADD r9, r9, r11 @x1i = x1i + x3i@
|
||||
SUB r1, r8, r10, lsl#1 @x3r = x1r - (x3r << 1)@
|
||||
SUB r11, r9, r11, lsl#1 @x3i = x1i - (x3i << 1)@
|
||||
|
||||
ADD r4, r4, r8 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r9 @x0i = x0i + x1i@
|
||||
ADD r4, r4, r8 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r9 @x0i = x0i + x1i@
|
||||
SUB r8, r4, r8, lsl#1 @x1r = x0r - (x1r << 1)@
|
||||
SUB r9, r5, r9, lsl#1 @x1i = x0i - (x1i << 1)
|
||||
ADD r6, r6, r11 @x2r = x2r + x3i@
|
||||
SUB r7, r7, r1 @x2i = x2i - x3r@
|
||||
ADD r6, r6, r11 @x2r = x2r + x3i@
|
||||
SUB r7, r7, r1 @x2i = x2i - x3r@
|
||||
SUB r10, r6, r11, lsl#1 @x3i = x2r - (x3i << 1)@
|
||||
ADD r11, r7, r1, lsl#1 @x3r = x2i + (x3r << 1)@
|
||||
|
||||
|
|
@ -96,23 +96,23 @@ LOOP_TRIVIAL_TWIDDLE:
|
|||
@MOV r10,r10,ASR #1
|
||||
@MOV r11,r11,ASR #1
|
||||
|
||||
ADD r4, r4, r8 @x0r = x0r + x2r@
|
||||
ADD r5, r5, r9 @x0i = x0i + x2i@
|
||||
ADD r4, r4, r8 @x0r = x0r + x2r@
|
||||
ADD r5, r5, r9 @x0i = x0i + x2i@
|
||||
SUB r8, r4, r8, lsl #1 @x2r = x0r - (x2r << 1)@
|
||||
SUB r9, r5, r9, lsl #1 @x2i = x0i - (x2i << 1)@
|
||||
ADD r6, r6, r10 @x1r = x1r + x3r@
|
||||
ADD r7, r7, r11 @x1i = x1i + x3i@
|
||||
ADD r6, r6, r10 @x1r = x1r + x3r@
|
||||
ADD r7, r7, r11 @x1i = x1i + x3i@
|
||||
SUB r2, r6, r10, lsl #1 @x3r = x1r - (x3r << 1)@
|
||||
SUB r11, r7, r11, lsl #1 @x3i = x1i - (x3i << 1)@
|
||||
|
||||
ADD r4, r4, r6 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x1i@
|
||||
ADD r4, r4, r6 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x1i@
|
||||
@MOV r4,r4,ASR #1
|
||||
@MOV r5,r5,ASR #1
|
||||
SUB r6, r4, r6, lsl #1 @x1r = x0r - (x1r << 1)@
|
||||
SUB r7, r5, r7, lsl #1 @x1i = x0i - (x1i << 1)
|
||||
ADD r8, r8, r11 @x2r = x2r + x3i@
|
||||
SUB r9, r9, r2 @x2i = x2i - x3r@
|
||||
ADD r8, r8, r11 @x2r = x2r + x3i@
|
||||
SUB r9, r9, r2 @x2i = x2i - x3r@
|
||||
SUB r10, r8, r11, lsl#1 @x3i = x2r - (x3i << 1)@
|
||||
ADD r11, r9, r2, lsl#1 @x3r = x2i + (x3r << 1)
|
||||
|
||||
|
|
@ -229,23 +229,23 @@ RADIX4_BFLY:
|
|||
|
||||
|
||||
ADD r4, r8, r4 @x0r = x0r + x2r@
|
||||
ADD r5, r9, r5 @x0i = x0i + x2i@
|
||||
ADD r5, r9, r5 @x0i = x0i + x2i@
|
||||
SUB r8, r4, r8, lsl#1 @x2r = x0r - (x2r << 1)@
|
||||
SUB r9, r5, r9, lsl#1 @x2i = x0i - (x2i << 1)@
|
||||
ADD r6, r6, r10 @x1r = x1r + x3r@
|
||||
ADD r7, r7, r11 @x1i = x1i + x3i@
|
||||
ADD r6, r6, r10 @x1r = x1r + x3r@
|
||||
ADD r7, r7, r11 @x1i = x1i + x3i@
|
||||
SUB r10, r6, r10, lsl#1 @x3r = x1r - (x3r << 1)@
|
||||
SUB r11, r7, r11, lsl#1 @x3i = x1i - (x3i << 1)@
|
||||
|
||||
ADD r4, r4, r6 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x1i@
|
||||
ADD r4, r4, r6 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x1i@
|
||||
SUB r6, r4, r6, lsl#1 @x1r = x0r - (x1r << 1)@
|
||||
SUB r7, r5, r7, lsl#1 @x1i = x0i - (x1i << 1)
|
||||
STRD r4, [r12] @r4=x0r, r5=x0i
|
||||
ADD r12, r12, r0
|
||||
|
||||
ADD r8, r8, r11 @x2r = x2r + x3i@
|
||||
SUB r9, r9, r10 @x2i = x2i - x3r@
|
||||
ADD r8, r8, r11 @x2r = x2r + x3i@
|
||||
SUB r9, r9, r10 @x2i = x2i - x3r@
|
||||
SUB r4, r8, r11, lsl#1 @x3i = x2r - (x3i << 1)@
|
||||
ADD r5, r9, r10, lsl#1 @x3r = x2i + (x3r << 1)
|
||||
|
||||
|
|
@ -492,20 +492,20 @@ RADIX4_BFLY_3:
|
|||
ADD r5, r9, r5 @x0i = x0i + x2i@
|
||||
SUB r8, r4, r8, lsl#1 @x2r = x0r - (x2r << 1)@
|
||||
SUB r9, r5, r9, lsl#1 @x2i = x0i - (x2i << 1)@
|
||||
ADD r6, r6, r10 @x1r = x1r + x3r@
|
||||
ADD r7, r7, r11 @x1i = x1i + x3i@
|
||||
ADD r6, r6, r10 @x1r = x1r + x3r@
|
||||
ADD r7, r7, r11 @x1i = x1i + x3i@
|
||||
SUB r10, r6, r10, lsl#1 @x3r = x1r - (x3r << 1)@
|
||||
SUB r11, r7, r11, lsl#1 @x3i = x1i - (x3i << 1)@
|
||||
|
||||
ADD r4, r4, r6 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x1i@
|
||||
ADD r4, r4, r6 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x1i@
|
||||
SUB r6, r4, r6, lsl#1 @x1r = x0r - (x1r << 1)@
|
||||
SUB r7, r5, r7, lsl#1 @x1i = x0i - (x1i << 1)
|
||||
STRD r4, [r12] @r4=x0r, r5=x0i
|
||||
ADD r12, r12, r0
|
||||
|
||||
ADD r8, r8, r11 @x2r = x2r + x3i@
|
||||
SUB r9, r9, r10 @x2i = x2i - x3r@
|
||||
ADD r8, r8, r11 @x2r = x2r + x3i@
|
||||
SUB r9, r9, r10 @x2i = x2i - x3r@
|
||||
SUB r4, r8, r11, lsl#1 @x3i = x2r - (x3i << 1)@
|
||||
ADD r5, r9, r10, lsl#1 @x3r = x2i + (x3r << 1)
|
||||
|
||||
|
|
@ -622,19 +622,19 @@ RADIX4_BFLY_4:
|
|||
ADD r5, r9, r5 @x0i = x0i + x2i@
|
||||
SUB r8, r4, r8, lsl#1 @x2r = x0r - (x2r << 1)@
|
||||
SUB r9, r5, r9, lsl#1 @x2i = x0i - (x2i << 1)@
|
||||
ADD r6, r6, r10 @x1r = x1r + x3r@
|
||||
SUB r7, r7, r11 @x1i = x1i - x3i@
|
||||
ADD r6, r6, r10 @x1r = x1r + x3r@
|
||||
SUB r7, r7, r11 @x1i = x1i - x3i@
|
||||
SUB r10, r6, r10, lsl#1 @x3r = x1r - (x3r << 1)@
|
||||
ADD r11, r7, r11, lsl#1 @x3i = x1i + (x3i << 1)@
|
||||
|
||||
ADD r4, r4, r6 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x1i@
|
||||
ADD r4, r4, r6 @x0r = x0r + x1r@
|
||||
ADD r5, r5, r7 @x0i = x0i + x1i@
|
||||
SUB r6, r4, r6, lsl#1 @x1r = x0r - (x1r << 1)@
|
||||
SUB r7, r5, r7, lsl#1 @x1i = x0i - (x1i << 1)
|
||||
STRD r4, [r12] @r4=x0r, r5=x0i
|
||||
ADD r12, r12, r0
|
||||
ADD r8, r8, r11 @x2r = x2r + x3i@
|
||||
SUB r9, r9, r10 @x2i = x2i - x3r@
|
||||
ADD r8, r8, r11 @x2r = x2r + x3i@
|
||||
SUB r9, r9, r10 @x2i = x2i - x3r@
|
||||
SUB r4, r8, r11, lsl#1 @x3i = x2r - (x3i << 1)@
|
||||
ADD r5, r9, r10, lsl#1 @x3r = x2i + (x3r << 1)
|
||||
|
||||
|
|
|
|||
|
|
@ -228,8 +228,8 @@ VOID ixheaacd_cplx_anal_qmffilt(const WORD16 *time_sample_buf,
|
|||
}
|
||||
|
||||
VOID ixheaacd_inv_modulation_lp(WORD32 *qmf_real, WORD16 *filter_states,
|
||||
ia_sbr_qmf_filter_bank_struct *syn_qmf,
|
||||
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
|
||||
ia_sbr_qmf_filter_bank_struct *syn_qmf,
|
||||
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
|
||||
WORD32 L = syn_qmf->no_channels;
|
||||
const WORD32 M = (L >> 1);
|
||||
WORD32 *dct_in = qmf_real;
|
||||
|
|
@ -249,9 +249,9 @@ VOID ixheaacd_inv_modulation_lp(WORD32 *qmf_real, WORD16 *filter_states,
|
|||
filter_states[3 * M] = 0;
|
||||
}
|
||||
|
||||
VOID ixheaacd_inv_emodulation(
|
||||
WORD32 *qmf_real, ia_sbr_qmf_filter_bank_struct *syn_qmf,
|
||||
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
|
||||
VOID ixheaacd_inv_emodulation(WORD32 *qmf_real,
|
||||
ia_sbr_qmf_filter_bank_struct *syn_qmf,
|
||||
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
|
||||
ixheaacd_cos_sin_mod(qmf_real, syn_qmf, (WORD16 *)qmf_dec_tables_ptr->w1024,
|
||||
(WORD32 *)qmf_dec_tables_ptr->dig_rev_table2_128);
|
||||
}
|
||||
|
|
@ -352,4 +352,3 @@ 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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,17 +51,17 @@ LOOP:
|
|||
MOV R6, R6, LSL #1 @
|
||||
VLD1.16 {D1, D2}, [R2]! @ tmpQmf_c1[2*(n + 0)] load and incremented
|
||||
|
||||
MOV R7, #244 @ NOT USED further
|
||||
MOV R7, #244 @ NOT USED further
|
||||
|
||||
MOV R9, R0
|
||||
ADD R0, R0, #120 @ incrementing R0 by 120 + 8 = 128
|
||||
|
||||
MOV R11, R4 @ Mov winAdd to R11
|
||||
MOV R11, R4 @ Mov winAdd to R11
|
||||
VLD1.16 D2, [R0], R6 @ tmpQ1[n + 64] load and incremented by R6
|
||||
ADD R11, R11, #128 @ increment winAdd by 128
|
||||
|
||||
|
||||
MOV R10, R2 @
|
||||
MOV R10, R2 @
|
||||
ADD R2, R2, #112 @ This should be 240 --> 112
|
||||
|
||||
VMULL.S16 Q15, D0, D1
|
||||
|
|
|
|||
|
|
@ -28,68 +28,68 @@
|
|||
.global ixheaacd_tns_ar_filter_fixed_armv7
|
||||
|
||||
ixheaacd_tns_ar_filter_fixed_armv7:
|
||||
STMFD r13! , {r4 - r12, r14}
|
||||
vpush {d8-d15}
|
||||
SUB sp, sp, #128 @ state[MaximumOrder] + one more
|
||||
LDR r4, [sp,#232] @order
|
||||
LDR r6, [sp,#236] @shift_value
|
||||
STR r1, [sp]
|
||||
ADD r12, sp, #4 @ r12 = state
|
||||
ANDS r5, r4, #3
|
||||
BEQ FILTER_LOOP
|
||||
MOV r8, #0
|
||||
ADD r14, r3, r4,LSL #2
|
||||
RSBS r7, r5, #3
|
||||
BEQ ORDER_LOOPEND
|
||||
STMFD r13! , {r4 - r12, r14}
|
||||
vpush {d8-d15}
|
||||
SUB sp, sp, #128 @ state[MaximumOrder] + one more
|
||||
LDR r4, [sp, #232] @order
|
||||
LDR r6, [sp, #236] @shift_value
|
||||
STR r1, [sp]
|
||||
ADD r12, sp, #4 @ r12 = state
|
||||
ANDS r5, r4, #3
|
||||
BEQ FILTER_LOOP
|
||||
MOV r8, #0
|
||||
ADD r14, r3, r4, LSL #2
|
||||
RSBS r7, r5, #3
|
||||
BEQ ORDER_LOOPEND
|
||||
ORDER_LOOP:
|
||||
STR r8, [r14,#4]! @lpc[i] = 0
|
||||
SUBS r7, r7, #1
|
||||
BGT ORDER_LOOP
|
||||
STR r8, [r14, #4]! @lpc[i] = 0
|
||||
SUBS r7, r7, #1
|
||||
BGT ORDER_LOOP
|
||||
ORDER_LOOPEND:
|
||||
STR r8, [r14,#4] @lpc[i] = 0
|
||||
BIC r4, r4, #3
|
||||
ADD r4, r4, #4 @order = ( (order & 0xfffffffc) +4 )
|
||||
STR r8, [r14, #4] @lpc[i] = 0
|
||||
BIC r4, r4, #3
|
||||
ADD r4, r4, #4 @order = ( (order & 0xfffffffc) +4 )
|
||||
|
||||
|
||||
FILTER_LOOP:
|
||||
LDR r1, [sp,#240] @scaleSpec
|
||||
LDR r1, [sp, #240] @scaleSpec
|
||||
@filtering loop here
|
||||
CMP r2, #1 @ inc =1 or -1
|
||||
MOV r7, r4 @loop_count
|
||||
BNE NEG_INC
|
||||
CMP r2, #1 @ inc =1 or -1
|
||||
MOV r7, r4 @loop_count
|
||||
BNE NEG_INC
|
||||
|
||||
LDR r8 , [r0] @r8 =*spectrum
|
||||
SUBS r7 , r7 , #1
|
||||
MOV r8, r8, lsl r1
|
||||
MOV r9, r8, asr r1
|
||||
MOV r8 , r8 ,lsl r6
|
||||
STR r8 , [r12] @state[0] = sp[top]
|
||||
STR r9, [r0], #4
|
||||
BEQ FILTER_LOOP2
|
||||
FILTER_LOOP1: @siva 16 times loop run
|
||||
LDR r8 , [r0] @r8 =*spectrum
|
||||
SUB r5 , r4 , r7 @
|
||||
MOV r5 , r5 ,lsl #2
|
||||
MOV r11 , #0 @accu = 0
|
||||
ADD r14, r12, r5 @state[j]
|
||||
LDR r8 , [r0] @r8 =*spectrum
|
||||
SUBS r7 , r7 , #1
|
||||
MOV r8, r8, lsl r1
|
||||
MOV r9, r8, asr r1
|
||||
MOV r8 , r8 , lsl r6
|
||||
STR r8 , [r12] @state[0] = sp[top]
|
||||
STR r9, [r0], #4
|
||||
BEQ FILTER_LOOP2
|
||||
FILTER_LOOP1: @siva 16 times loop run
|
||||
LDR r8 , [r0] @r8 =*spectrum
|
||||
SUB r5 , r4 , r7 @
|
||||
MOV r5 , r5 , lsl #2
|
||||
MOV r11 , #0 @accu = 0
|
||||
ADD r14, r12, r5 @state[j]
|
||||
INNER_LOOP1:
|
||||
LDR r10 , [r14,#-4] @state[j-1]
|
||||
LDR r9 , [r3 , r5] @lpc[j]
|
||||
SUBS r5 , r5 , #4
|
||||
LDR r10 , [r14, #-4] @state[j-1]
|
||||
LDR r9 , [r3 , r5] @lpc[j]
|
||||
SUBS r5 , r5 , #4
|
||||
|
||||
MOV r2, #0
|
||||
SMLAL r2 , r11, r10, r9
|
||||
STR r10 , [r14], #-4 @state[j] = state[j - 1]
|
||||
BGT INNER_LOOP1
|
||||
MOV r2, #0
|
||||
SMLAL r2 , r11, r10, r9
|
||||
STR r10 , [r14], #-4 @state[j] = state[j - 1]
|
||||
BGT INNER_LOOP1
|
||||
|
||||
MOV r8, r8, lsl r1
|
||||
SUB r8 , r8 , r11,lsl #1
|
||||
MOV r9, r8, asr r1
|
||||
STR r9 , [r0], #4 @*spectrum = y@
|
||||
SUBS r7 , r7 , #1 @i--
|
||||
MOV r8 , r8 ,lsl r6
|
||||
STR r8 , [r12] @state[0]
|
||||
BGT FILTER_LOOP1
|
||||
MOV r8, r8, lsl r1
|
||||
SUB r8 , r8 , r11, lsl #1
|
||||
MOV r9, r8, asr r1
|
||||
STR r9 , [r0], #4 @*spectrum = y@
|
||||
SUBS r7 , r7 , #1 @i--
|
||||
MOV r8 , r8 , lsl r6
|
||||
STR r8 , [r12] @state[0]
|
||||
BGT FILTER_LOOP1
|
||||
|
||||
|
||||
|
||||
|
|
@ -98,456 +98,456 @@ INNER_LOOP1:
|
|||
|
||||
|
||||
FILTER_LOOP2:
|
||||
LDR R1, [sp] @size
|
||||
ADD R8, R3, #4
|
||||
LDR R1, [sp] @size
|
||||
ADD R8, R3, #4
|
||||
|
||||
SUBS R7 , R1 , r4 @size-order
|
||||
BEQ EXIT
|
||||
SUBS R7 , R1 , r4 @size-order
|
||||
BEQ EXIT
|
||||
|
||||
LDR R1, [sp,#240] @scaleSpec
|
||||
LDR R1, [sp, #240] @scaleSpec
|
||||
|
||||
MOV R5 , R4 ,LSL #2 @count for inner loop = order
|
||||
VLD1.32 {D10, D11}, [R8]! @lpc[j]
|
||||
MOV R14,#0
|
||||
VLD1.32 {D12, D13}, [R12]! @state[j - 1]
|
||||
MOV R5 , R4 , LSL #2 @count for inner loop = order
|
||||
VLD1.32 {D10, D11}, [R8]! @lpc[j]
|
||||
MOV R14, #0
|
||||
VLD1.32 {D12, D13}, [R12]! @state[j - 1]
|
||||
|
||||
CMP R4,#4
|
||||
VLD1.32 {D18, D19}, [R8]!
|
||||
BEQ ORDER4
|
||||
VLD1.32 {D22, D23}, [R12]!
|
||||
CMP R4, #4
|
||||
VLD1.32 {D18, D19}, [R8]!
|
||||
BEQ ORDER4
|
||||
VLD1.32 {D22, D23}, [R12]!
|
||||
|
||||
CMP R4,#8
|
||||
VLD1.32 {D20, D21}, [R8]!
|
||||
BEQ ORDER8
|
||||
CMP R4,#12
|
||||
VLD1.32 {D24, D25}, [R12]!
|
||||
BEQ ORDER12
|
||||
CMP R4, #8
|
||||
VLD1.32 {D20, D21}, [R8]!
|
||||
BEQ ORDER8
|
||||
CMP R4, #12
|
||||
VLD1.32 {D24, D25}, [R12]!
|
||||
BEQ ORDER12
|
||||
|
||||
VLD1.32 {D26, D27},[R8]!
|
||||
CMP R4,#16
|
||||
VLD1.32 {D28, D29},[R12]!
|
||||
BEQ ORDER16 @order16 added
|
||||
VLD1.32 {D26, D27}, [R8]!
|
||||
CMP R4, #16
|
||||
VLD1.32 {D28, D29}, [R12]!
|
||||
BEQ ORDER16 @order16 added
|
||||
|
||||
VLD1.32 {D4, D5},[R8]!
|
||||
CMP R4,#20
|
||||
VLD1.32 {D8, D9},[R12]!
|
||||
BEQ ORDER20 @order20 added
|
||||
VLD1.32 {D4, D5}, [R8]!
|
||||
CMP R4, #20
|
||||
VLD1.32 {D8, D9}, [R12]!
|
||||
BEQ ORDER20 @order20 added
|
||||
|
||||
ORDER4:
|
||||
LDR r8 , [r0] @r8 = y = *spectrum
|
||||
LDR r8 , [r0] @r8 = y = *spectrum
|
||||
OUTER_LOOP2_4:
|
||||
|
||||
VDUP.32 Q1,R14 @Q1= accu = 0
|
||||
VDUP.32 Q1, R14 @Q1= accu = 0
|
||||
|
||||
VMLAL.S32 Q1, D10, D12
|
||||
VMLAL.S32 Q1, D10, D12
|
||||
|
||||
VMLAL.S32 Q1, D11, D13
|
||||
VMLAL.S32 Q1, D11, D13
|
||||
|
||||
MOV r8, r8, lsl r1 @y = (*spectrum) << scaleSpec
|
||||
SUBS r7 , r7 , #1
|
||||
MOV r8, r8, lsl r1 @y = (*spectrum) << scaleSpec
|
||||
SUBS r7 , r7 , #1
|
||||
|
||||
VADD.I64 D6,D2,D3
|
||||
VADD.I64 D6, D2, D3
|
||||
|
||||
VSHR.S64 D6,#32 @acc1=acc>>32 @acc = mac32_tns_neon(state[j - 1],lpc[j],acc, temp_lo)@
|
||||
@VMOV R11,D6[0]
|
||||
VST1.32 D6[0],[SP]
|
||||
LDR R11,[SP]
|
||||
VSHR.S64 D6, #32 @acc1=acc>>32 @acc = mac32_tns_neon(state[j - 1],lpc[j],acc, temp_lo)@
|
||||
@VMOV R11,D6[0]
|
||||
VST1.32 D6[0], [SP]
|
||||
LDR R11, [SP]
|
||||
|
||||
SUB r8 , r8 , r11,lsl #1 @y=sub32(y,(acc<<1))
|
||||
MOV r2 , r8 ,lsl r6 @ shl32(y, shift_value)
|
||||
SUB r8 , r8 , r11, lsl #1 @y=sub32(y,(acc<<1))
|
||||
MOV r2 , r8 , lsl r6 @ shl32(y, shift_value)
|
||||
|
||||
MOV r9, r8, asr r1
|
||||
VMOV.32 D15[1], R2 @state[0]
|
||||
MOV r9, r8, asr r1
|
||||
VMOV.32 D15[1], R2 @state[0]
|
||||
|
||||
|
||||
STR r9 , [r0],#4 @*spectrum = y@
|
||||
VEXT.32 Q6,Q7,Q6,#3
|
||||
LDRGT r8 , [r0] @r8 = y = *spectrum
|
||||
STR r9 , [r0], #4 @*spectrum = y@
|
||||
VEXT.32 Q6, Q7, Q6, #3
|
||||
LDRGT r8 , [r0] @r8 = y = *spectrum
|
||||
|
||||
BGT OUTER_LOOP2_4
|
||||
BGT OUTER_LOOP2_4
|
||||
|
||||
B EXIT
|
||||
B EXIT
|
||||
ORDER8:
|
||||
|
||||
LDR r8 , [r0] @r8 = y = *spectrum
|
||||
LDR r8 , [r0] @r8 = y = *spectrum
|
||||
|
||||
OUTER_LOOP2_8:
|
||||
|
||||
VDUP.32 Q1,R14 @Q1= accu = 0
|
||||
VDUP.32 Q1, R14 @Q1= accu = 0
|
||||
|
||||
|
||||
|
||||
VMLAL.S32 Q1, D10, D12
|
||||
VMLAL.S32 Q1, D11, D13
|
||||
VMLAL.S32 Q1, D22, D18
|
||||
VMLAL.S32 Q1, D23, D19
|
||||
VMLAL.S32 Q1, D10, D12
|
||||
VMLAL.S32 Q1, D11, D13
|
||||
VMLAL.S32 Q1, D22, D18
|
||||
VMLAL.S32 Q1, D23, D19
|
||||
|
||||
MOV r8, r8, lsl r1 @y = (*spectrum) << scaleSpec
|
||||
VEXT.32 Q11,Q6,Q11,#3
|
||||
SUBS r7 , r7 , #1
|
||||
MOV r8, r8, lsl r1 @y = (*spectrum) << scaleSpec
|
||||
VEXT.32 Q11, Q6, Q11, #3
|
||||
SUBS r7 , r7 , #1
|
||||
|
||||
VADD.I64 D6,D2,D3
|
||||
VSHR.S64 D6,#32 @acc = mac32_tns_neon(state[j - 1],lpc[j],acc, temp_lo)@
|
||||
VADD.I64 D6, D2, D3
|
||||
VSHR.S64 D6, #32 @acc = mac32_tns_neon(state[j - 1],lpc[j],acc, temp_lo)@
|
||||
|
||||
@VMOV R11,D6[0]
|
||||
VST1.32 D6[0],[SP]
|
||||
LDR R11,[SP]
|
||||
SUB r8 , r8 , r11,lsl #1 @y=sub32(y,(acc<<1))
|
||||
@VMOV R11,D6[0]
|
||||
VST1.32 D6[0], [SP]
|
||||
LDR R11, [SP]
|
||||
SUB r8 , r8 , r11, lsl #1 @y=sub32(y,(acc<<1))
|
||||
|
||||
MOV r2 , r8 ,lsl r6 @ shl32(y, shift_value)
|
||||
MOV r2 , r8 , lsl r6 @ shl32(y, shift_value)
|
||||
|
||||
MOV r9, r8, asr r1
|
||||
VMOV.32 D15[1], R2 @state[0]
|
||||
MOV r9, r8, asr r1
|
||||
VMOV.32 D15[1], R2 @state[0]
|
||||
|
||||
STR r9 , [r0],#4 @*spectrum = y@
|
||||
VEXT.32 Q6,Q7,Q6,#3
|
||||
LDRGT r8 , [r0] @r8 = y = *spectrum
|
||||
STR r9 , [r0], #4 @*spectrum = y@
|
||||
VEXT.32 Q6, Q7, Q6, #3
|
||||
LDRGT r8 , [r0] @r8 = y = *spectrum
|
||||
|
||||
|
||||
BGT OUTER_LOOP2_8
|
||||
BGT OUTER_LOOP2_8
|
||||
|
||||
B EXIT
|
||||
B EXIT
|
||||
|
||||
|
||||
|
||||
|
||||
ORDER12:
|
||||
LDR r8 , [r0] @r8 = y = *spectrum
|
||||
LDR r8 , [r0] @r8 = y = *spectrum
|
||||
OUTER_LOOP2_12:
|
||||
|
||||
|
||||
VDUP.32 Q1,R14 @Q1= accu = 0
|
||||
VDUP.32 Q1, R14 @Q1= accu = 0
|
||||
|
||||
|
||||
VMLAL.S32 Q1, D10, D12
|
||||
VMLAL.S32 Q1, D11, D13
|
||||
VMLAL.S32 Q1, D22, D18
|
||||
VMLAL.S32 Q1, D23, D19
|
||||
VMLAL.S32 Q1, D24, D20
|
||||
VMLAL.S32 Q1, D25, D21
|
||||
VMLAL.S32 Q1, D10, D12
|
||||
VMLAL.S32 Q1, D11, D13
|
||||
VMLAL.S32 Q1, D22, D18
|
||||
VMLAL.S32 Q1, D23, D19
|
||||
VMLAL.S32 Q1, D24, D20
|
||||
VMLAL.S32 Q1, D25, D21
|
||||
|
||||
MOV r8, r8, lsl r1 @y = (*spectrum) << scaleSpec
|
||||
VEXT.32 Q12,Q11,Q12,#3
|
||||
SUBS r7 , r7 , #1
|
||||
MOV r8, r8, lsl r1 @y = (*spectrum) << scaleSpec
|
||||
VEXT.32 Q12, Q11, Q12, #3
|
||||
SUBS r7 , r7 , #1
|
||||
|
||||
VADD.I64 D6,D2,D3
|
||||
VEXT.32 Q11,Q6,Q11,#3
|
||||
VSHR.S64 D6,#32
|
||||
VADD.I64 D6, D2, D3
|
||||
VEXT.32 Q11, Q6, Q11, #3
|
||||
VSHR.S64 D6, #32
|
||||
|
||||
@VMOV R11,D6[0]
|
||||
VST1.32 D6[0],[SP]
|
||||
LDR R11,[SP]
|
||||
SUB r8 , r8 , r11,lsl #1 @y=sub32(y,(acc<<1))
|
||||
@VMOV R11,D6[0]
|
||||
VST1.32 D6[0], [SP]
|
||||
LDR R11, [SP]
|
||||
SUB r8 , r8 , r11, lsl #1 @y=sub32(y,(acc<<1))
|
||||
|
||||
MOV r2 , r8 ,lsl r6 @ shl32(y, shift_value)
|
||||
MOV r2 , r8 , lsl r6 @ shl32(y, shift_value)
|
||||
|
||||
|
||||
MOV r9, r8, asr r1
|
||||
VMOV.32 D15[1], R2 @state[0]
|
||||
MOV r9, r8, asr r1
|
||||
VMOV.32 D15[1], R2 @state[0]
|
||||
|
||||
|
||||
STR r9 , [r0],#4 @*spectrum = y@
|
||||
VEXT.32 Q6,Q7,Q6,#3
|
||||
LDRGT r8 , [r0] @r8 = y = *spectrum
|
||||
STR r9 , [r0], #4 @*spectrum = y@
|
||||
VEXT.32 Q6, Q7, Q6, #3
|
||||
LDRGT r8 , [r0] @r8 = y = *spectrum
|
||||
|
||||
BGT OUTER_LOOP2_12
|
||||
BGT OUTER_LOOP2_12
|
||||
|
||||
B EXIT
|
||||
B EXIT
|
||||
|
||||
|
||||
ORDER16:
|
||||
LDR r8 , [r0] @r8 = y = *spectrum
|
||||
LDR r8 , [r0] @r8 = y = *spectrum
|
||||
OUTER_LOOP2_16:
|
||||
|
||||
|
||||
VDUP.32 Q1,R14 @Q1= accu = 0
|
||||
VDUP.32 Q1, R14 @Q1= accu = 0
|
||||
|
||||
|
||||
VMLAL.S32 Q1, D10, D12
|
||||
VMLAL.S32 Q1, D11, D13
|
||||
VMLAL.S32 Q1, D22, D18
|
||||
VMLAL.S32 Q1, D23, D19
|
||||
VMLAL.S32 Q1, D24, D20
|
||||
VMLAL.S32 Q1, D25, D21
|
||||
VMLAL.S32 Q1, D28, D26 @
|
||||
VMLAL.S32 Q1, D29, D27 @ @order16
|
||||
VMLAL.S32 Q1, D10, D12
|
||||
VMLAL.S32 Q1, D11, D13
|
||||
VMLAL.S32 Q1, D22, D18
|
||||
VMLAL.S32 Q1, D23, D19
|
||||
VMLAL.S32 Q1, D24, D20
|
||||
VMLAL.S32 Q1, D25, D21
|
||||
VMLAL.S32 Q1, D28, D26 @
|
||||
VMLAL.S32 Q1, D29, D27 @ @order16
|
||||
|
||||
VEXT.32 Q14,Q12,Q14,#3
|
||||
MOV r8, r8, lsl r1 @y = (*spectrum) << scaleSpec
|
||||
VEXT.32 Q12,Q11,Q12,#3
|
||||
SUBS r7 , r7 , #1
|
||||
VEXT.32 Q14, Q12, Q14, #3
|
||||
MOV r8, r8, lsl r1 @y = (*spectrum) << scaleSpec
|
||||
VEXT.32 Q12, Q11, Q12, #3
|
||||
SUBS r7 , r7 , #1
|
||||
|
||||
VADD.I64 D6,D2,D3
|
||||
VEXT.32 Q11,Q6,Q11,#3
|
||||
VSHR.S64 D6,#32
|
||||
VADD.I64 D6, D2, D3
|
||||
VEXT.32 Q11, Q6, Q11, #3
|
||||
VSHR.S64 D6, #32
|
||||
|
||||
@VMOV R11,D6[0]
|
||||
VST1.32 D6[0],[SP]
|
||||
LDR R11,[SP]
|
||||
SUB r8 , r8 , r11,lsl #1 @y=sub32(y,(acc<<1))
|
||||
@VMOV R11,D6[0]
|
||||
VST1.32 D6[0], [SP]
|
||||
LDR R11, [SP]
|
||||
SUB r8 , r8 , r11, lsl #1 @y=sub32(y,(acc<<1))
|
||||
|
||||
MOV r2 , r8 ,lsl r6 @ shl32(y, shift_value)
|
||||
MOV r2 , r8 , lsl r6 @ shl32(y, shift_value)
|
||||
|
||||
|
||||
MOV r9, r8, asr r1
|
||||
VMOV.32 D15[1], R2 @state[0]
|
||||
MOV r9, r8, asr r1
|
||||
VMOV.32 D15[1], R2 @state[0]
|
||||
|
||||
|
||||
STR r9 , [r0],#4 @*spectrum = y@
|
||||
VEXT.32 Q6,Q7,Q6,#3
|
||||
LDRGT r8 , [r0] @r8 = y = *spectrum
|
||||
STR r9 , [r0], #4 @*spectrum = y@
|
||||
VEXT.32 Q6, Q7, Q6, #3
|
||||
LDRGT r8 , [r0] @r8 = y = *spectrum
|
||||
|
||||
BGT OUTER_LOOP2_16
|
||||
BGT OUTER_LOOP2_16
|
||||
|
||||
B EXIT
|
||||
B EXIT
|
||||
|
||||
ORDER20:
|
||||
LDR r8 , [r0] @r8 = y = *spectrum
|
||||
LDR r8 , [r0] @r8 = y = *spectrum
|
||||
OUTER_LOOP2_20:
|
||||
|
||||
|
||||
VDUP.32 Q1,R14 @Q1= accu = 0
|
||||
VDUP.32 Q1, R14 @Q1= accu = 0
|
||||
|
||||
|
||||
VMLAL.S32 Q1, D10, D12
|
||||
VMLAL.S32 Q1, D11, D13
|
||||
VMLAL.S32 Q1, D22, D18
|
||||
VMLAL.S32 Q1, D23, D19
|
||||
VMLAL.S32 Q1, D24, D20
|
||||
VMLAL.S32 Q1, D25, D21
|
||||
VMLAL.S32 Q1, D28, D26 @
|
||||
VMLAL.S32 Q1, D29, D27 @ @order16
|
||||
VMLAL.S32 Q1, D8, D4 @order20
|
||||
VMLAL.S32 Q1, D9, D5 @order20
|
||||
VMLAL.S32 Q1, D10, D12
|
||||
VMLAL.S32 Q1, D11, D13
|
||||
VMLAL.S32 Q1, D22, D18
|
||||
VMLAL.S32 Q1, D23, D19
|
||||
VMLAL.S32 Q1, D24, D20
|
||||
VMLAL.S32 Q1, D25, D21
|
||||
VMLAL.S32 Q1, D28, D26 @
|
||||
VMLAL.S32 Q1, D29, D27 @ @order16
|
||||
VMLAL.S32 Q1, D8, D4 @order20
|
||||
VMLAL.S32 Q1, D9, D5 @order20
|
||||
|
||||
|
||||
VEXT.32 Q4,Q14,Q4,#3 @ @for order20
|
||||
VEXT.32 Q14,Q12,Q14,#3 @ @for order16
|
||||
MOV r8, r8, lsl r1 @y = (*spectrum) << scaleSpec
|
||||
VEXT.32 Q12,Q11,Q12,#3 @order12
|
||||
SUBS r7 , r7 , #1
|
||||
VEXT.32 Q4, Q14, Q4, #3 @ @for order20
|
||||
VEXT.32 Q14, Q12, Q14, #3 @ @for order16
|
||||
MOV r8, r8, lsl r1 @y = (*spectrum) << scaleSpec
|
||||
VEXT.32 Q12, Q11, Q12, #3 @order12
|
||||
SUBS r7 , r7 , #1
|
||||
|
||||
VADD.I64 D6,D2,D3
|
||||
VEXT.32 Q11,Q6,Q11,#3 @order8
|
||||
VSHR.S64 D6,#32
|
||||
VADD.I64 D6, D2, D3
|
||||
VEXT.32 Q11, Q6, Q11, #3 @order8
|
||||
VSHR.S64 D6, #32
|
||||
|
||||
@VMOV R11,D6[0]
|
||||
VST1.32 D6[0],[SP]
|
||||
LDR R11,[SP]
|
||||
SUB r8 , r8 , r11,lsl #1 @y=sub32(y,(acc<<1))
|
||||
@VMOV R11,D6[0]
|
||||
VST1.32 D6[0], [SP]
|
||||
LDR R11, [SP]
|
||||
SUB r8 , r8 , r11, lsl #1 @y=sub32(y,(acc<<1))
|
||||
|
||||
MOV r2 , r8 ,lsl r6 @ shl32(y, shift_value)
|
||||
MOV r2 , r8 , lsl r6 @ shl32(y, shift_value)
|
||||
|
||||
|
||||
MOV r9, r8, asr r1
|
||||
VMOV.32 D15[1], R2 @state[0]
|
||||
MOV r9, r8, asr r1
|
||||
VMOV.32 D15[1], R2 @state[0]
|
||||
|
||||
|
||||
STR r9 , [r0],#4 @*spectrum = y@
|
||||
VEXT.32 Q6,Q7,Q6,#3
|
||||
LDRGT r8 , [r0] @r8 = y = *spectrum
|
||||
STR r9 , [r0], #4 @*spectrum = y@
|
||||
VEXT.32 Q6, Q7, Q6, #3
|
||||
LDRGT r8 , [r0] @r8 = y = *spectrum
|
||||
|
||||
BGT OUTER_LOOP2_20
|
||||
BGT OUTER_LOOP2_20
|
||||
|
||||
B EXIT
|
||||
B EXIT
|
||||
|
||||
NEG_INC:
|
||||
@ filtering loop for inc = -1
|
||||
|
||||
LDR r8 , [r0] @r8 =*spectrum
|
||||
SUBS r7 , r7 , #1
|
||||
MOV r8, r8, lsl r1
|
||||
MOV r9, r8, asr r1
|
||||
MOV r8 , r8 ,lsl r6
|
||||
STR r8 , [r12] @state[0] = sp[top]
|
||||
STR r9, [r0], #-4
|
||||
BEQ NEGFILTER_LOOP2
|
||||
LDR r8 , [r0] @r8 =*spectrum
|
||||
SUBS r7 , r7 , #1
|
||||
MOV r8, r8, lsl r1
|
||||
MOV r9, r8, asr r1
|
||||
MOV r8 , r8 , lsl r6
|
||||
STR r8 , [r12] @state[0] = sp[top]
|
||||
STR r9, [r0], #-4
|
||||
BEQ NEGFILTER_LOOP2
|
||||
NEGFILTER_LOOP1:
|
||||
LDR r8 , [r0] @r8 =*spectrum
|
||||
SUB r5 , r4 , r7 @
|
||||
MOV r5 , r5 ,lsl #2
|
||||
MOV r11 , #0 @accu = 0
|
||||
ADD r14, r12, r5 @state[j]
|
||||
LDR r8 , [r0] @r8 =*spectrum
|
||||
SUB r5 , r4 , r7 @
|
||||
MOV r5 , r5 , lsl #2
|
||||
MOV r11 , #0 @accu = 0
|
||||
ADD r14, r12, r5 @state[j]
|
||||
NEGINNER_LOOP1:
|
||||
LDR r10 , [r14,#-4] @state[j-1]
|
||||
LDR r9 , [r3 , r5] @lpc[j]
|
||||
SUBS r5 , r5 , #4
|
||||
LDR r10 , [r14, #-4] @state[j-1]
|
||||
LDR r9 , [r3 , r5] @lpc[j]
|
||||
SUBS r5 , r5 , #4
|
||||
|
||||
MOV r2, #0
|
||||
SMLAL r2 , r11, r10, r9
|
||||
STR r10 , [r14], #-4 @state[j] = state[j - 1]
|
||||
BGT NEGINNER_LOOP1
|
||||
MOV r2, #0
|
||||
SMLAL r2 , r11, r10, r9
|
||||
STR r10 , [r14], #-4 @state[j] = state[j - 1]
|
||||
BGT NEGINNER_LOOP1
|
||||
|
||||
MOV r8, r8, lsl r1
|
||||
SUB r8 , r8 , r11,lsl #1
|
||||
MOV r9, r8, asr r1
|
||||
STR r9 , [r0], #-4 @*spectrum = y@
|
||||
SUBS r7 , r7 , #1 @i--
|
||||
MOV r8 , r8 ,lsl r6
|
||||
STR r8 , [r12] @state[0]
|
||||
BGT NEGFILTER_LOOP1
|
||||
MOV r8, r8, lsl r1
|
||||
SUB r8 , r8 , r11, lsl #1
|
||||
MOV r9, r8, asr r1
|
||||
STR r9 , [r0], #-4 @*spectrum = y@
|
||||
SUBS r7 , r7 , #1 @i--
|
||||
MOV r8 , r8 , lsl r6
|
||||
STR r8 , [r12] @state[0]
|
||||
BGT NEGFILTER_LOOP1
|
||||
|
||||
NEGFILTER_LOOP2:
|
||||
LDR R1, [sp] @size
|
||||
SUBS R7 , R1 , r4 @size-order
|
||||
BEQ EXIT
|
||||
LDR R1, [sp] @size
|
||||
SUBS R7 , R1 , r4 @size-order
|
||||
BEQ EXIT
|
||||
|
||||
ADD R8, R3, #4
|
||||
ADD R8, R3, #4
|
||||
|
||||
MOV R14,#0
|
||||
VLD1.32 {D10, D11}, [R8]! @lpc[j]
|
||||
MOV R5 , R4 ,LSL #2 @count for inner loop = order
|
||||
MOV R14, #0
|
||||
VLD1.32 {D10, D11}, [R8]! @lpc[j]
|
||||
MOV R5 , R4 , LSL #2 @count for inner loop = order
|
||||
|
||||
LDR R1, [sp,#240] @scaleSpec
|
||||
LDR R1, [sp, #240] @scaleSpec
|
||||
|
||||
CMP R4,#4
|
||||
VLD1.32 {D12, D13}, [R12]! @state[j - 1]
|
||||
BEQ NEGORDER4
|
||||
CMP R4, #4
|
||||
VLD1.32 {D12, D13}, [R12]! @state[j - 1]
|
||||
BEQ NEGORDER4
|
||||
|
||||
VLD1.32 {D18, D19}, [R8]!
|
||||
CMP R4,#8
|
||||
VLD1.32 {D18, D19}, [R8]!
|
||||
CMP R4, #8
|
||||
|
||||
VLD1.32 {D22, D23}, [R12]!
|
||||
BEQ NEGORDER8
|
||||
VLD1.32 {D22, D23}, [R12]!
|
||||
BEQ NEGORDER8
|
||||
|
||||
VLD1.32 {D20, D21}, [R8]!
|
||||
CMP R4,#12
|
||||
VLD1.32 {D20, D21}, [R8]!
|
||||
CMP R4, #12
|
||||
|
||||
VLD1.32 {D24, D25}, [R12]!
|
||||
BEQ NEGORDER12
|
||||
VLD1.32 {D24, D25}, [R12]!
|
||||
BEQ NEGORDER12
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
NEGORDER4:
|
||||
LDR r8 , [r0] @r8 = y = *spectrum
|
||||
LDR r8 , [r0] @r8 = y = *spectrum
|
||||
|
||||
NEGOUTER_LOOP2_4:
|
||||
|
||||
VDUP.32 Q1,R14 @Q1= accu = 0
|
||||
VDUP.32 Q1, R14 @Q1= accu = 0
|
||||
|
||||
|
||||
VMLAL.S32 Q1, D10, D12
|
||||
VMLAL.S32 Q1, D11, D13
|
||||
MOV r8, r8, lsl r1 @y = (*spectrum) << scaleSpec
|
||||
SUBS r7 , r7 , #1
|
||||
VMLAL.S32 Q1, D10, D12
|
||||
VMLAL.S32 Q1, D11, D13
|
||||
MOV r8, r8, lsl r1 @y = (*spectrum) << scaleSpec
|
||||
SUBS r7 , r7 , #1
|
||||
|
||||
VADD.I64 D6,D2,D3
|
||||
VSHR.S64 D6,#32
|
||||
VADD.I64 D6, D2, D3
|
||||
VSHR.S64 D6, #32
|
||||
|
||||
|
||||
|
||||
@VMOV R11,D6[0]
|
||||
VST1.32 D6[0],[SP]
|
||||
LDR R11,[SP]
|
||||
SUB r8 , r8 , r11,lsl #1 @y=sub32(y,(acc<<1))
|
||||
@VMOV R11,D6[0]
|
||||
VST1.32 D6[0], [SP]
|
||||
LDR R11, [SP]
|
||||
SUB r8 , r8 , r11, lsl #1 @y=sub32(y,(acc<<1))
|
||||
|
||||
MOV r2 , r8 ,lsl r6
|
||||
MOV r2 , r8 , lsl r6
|
||||
|
||||
VMOV.32 D15[1], R2
|
||||
MOV r9, r8, asr r1
|
||||
VMOV.32 D15[1], R2
|
||||
MOV r9, r8, asr r1
|
||||
|
||||
|
||||
STR r9 , [r0],#-4 @*spectrum = y@
|
||||
VEXT.32 Q6,Q7,Q6,#3
|
||||
LDRGT r8 , [r0] @r8 = y = *spectrum
|
||||
STR r9 , [r0], #-4 @*spectrum = y@
|
||||
VEXT.32 Q6, Q7, Q6, #3
|
||||
LDRGT r8 , [r0] @r8 = y = *spectrum
|
||||
|
||||
BGT NEGOUTER_LOOP2_4
|
||||
BGT NEGOUTER_LOOP2_4
|
||||
|
||||
B EXIT
|
||||
B EXIT
|
||||
NEGORDER8:
|
||||
|
||||
LDR r8 , [r0] @r8 = y = *spectrum
|
||||
LDR r8 , [r0] @r8 = y = *spectrum
|
||||
|
||||
NEGOUTER_LOOP2_8:
|
||||
|
||||
VDUP.32 Q1,R14 @Q1= accu = 0
|
||||
VDUP.32 Q1, R14 @Q1= accu = 0
|
||||
|
||||
|
||||
|
||||
VMLAL.S32 Q1, D10, D12
|
||||
VMLAL.S32 Q1, D11, D13
|
||||
VMLAL.S32 Q1, D22, D18
|
||||
VMLAL.S32 Q1, D23, D19
|
||||
VMLAL.S32 Q1, D10, D12
|
||||
VMLAL.S32 Q1, D11, D13
|
||||
VMLAL.S32 Q1, D22, D18
|
||||
VMLAL.S32 Q1, D23, D19
|
||||
|
||||
MOV r8, r8, lsl r1 @y = (*spectrum) << scaleSpec
|
||||
VEXT.32 Q11,Q6,Q11,#3
|
||||
SUBS r7 , r7 , #1
|
||||
MOV r8, r8, lsl r1 @y = (*spectrum) << scaleSpec
|
||||
VEXT.32 Q11, Q6, Q11, #3
|
||||
SUBS r7 , r7 , #1
|
||||
|
||||
VADD.I64 D6,D2,D3
|
||||
VADD.I64 D6, D2, D3
|
||||
|
||||
VSHR.S64 D6,#32
|
||||
VSHR.S64 D6, #32
|
||||
|
||||
|
||||
@VMOV R11,D6[0]
|
||||
VST1.32 D6[0],[SP]
|
||||
LDR R11,[SP]
|
||||
SUB r8 , r8 , r11,lsl #1 @y=sub32(y,(acc<<1))
|
||||
MOV r2 , r8 ,lsl r6 @ shl32(y, shift_value)
|
||||
@VMOV R11,D6[0]
|
||||
VST1.32 D6[0], [SP]
|
||||
LDR R11, [SP]
|
||||
SUB r8 , r8 , r11, lsl #1 @y=sub32(y,(acc<<1))
|
||||
MOV r2 , r8 , lsl r6 @ shl32(y, shift_value)
|
||||
|
||||
VMOV.32 D15[1], R2 @state[0]
|
||||
MOV r9, r8, asr r1
|
||||
VMOV.32 D15[1], R2 @state[0]
|
||||
MOV r9, r8, asr r1
|
||||
|
||||
|
||||
STR r9 , [r0],#-4 @*spectrum = y@
|
||||
VEXT.32 Q6,Q7,Q6,#3
|
||||
LDRGT r8 , [r0] @r8 = y = *spectrum
|
||||
STR r9 , [r0], #-4 @*spectrum = y@
|
||||
VEXT.32 Q6, Q7, Q6, #3
|
||||
LDRGT r8 , [r0] @r8 = y = *spectrum
|
||||
|
||||
|
||||
BGT NEGOUTER_LOOP2_8
|
||||
BGT NEGOUTER_LOOP2_8
|
||||
|
||||
B EXIT
|
||||
B EXIT
|
||||
|
||||
|
||||
|
||||
|
||||
NEGORDER12:
|
||||
LDR r8 , [r0] @r8 = y = *spectrum
|
||||
LDR r8 , [r0] @r8 = y = *spectrum
|
||||
|
||||
NEGOUTER_LOOP2_12:
|
||||
|
||||
VDUP.32 Q1,R14 @Q1= accu = 0
|
||||
VDUP.32 Q1, R14 @Q1= accu = 0
|
||||
|
||||
|
||||
|
||||
VMLAL.S32 Q1, D10, D12
|
||||
VMLAL.S32 Q1, D11, D13
|
||||
VMLAL.S32 Q1, D22, D18
|
||||
VMLAL.S32 Q1, D23, D19
|
||||
VMLAL.S32 Q1, D24, D20
|
||||
VMLAL.S32 Q1, D25, D21
|
||||
VMLAL.S32 Q1, D10, D12
|
||||
VMLAL.S32 Q1, D11, D13
|
||||
VMLAL.S32 Q1, D22, D18
|
||||
VMLAL.S32 Q1, D23, D19
|
||||
VMLAL.S32 Q1, D24, D20
|
||||
VMLAL.S32 Q1, D25, D21
|
||||
|
||||
MOV r8, r8, lsl r1 @y = (*spectrum) << scaleSpec
|
||||
VEXT.32 Q12,Q11,Q12,#3
|
||||
SUBS r7 , r7 , #1
|
||||
MOV r8, r8, lsl r1 @y = (*spectrum) << scaleSpec
|
||||
VEXT.32 Q12, Q11, Q12, #3
|
||||
SUBS r7 , r7 , #1
|
||||
|
||||
VADD.I64 D6,D2,D3
|
||||
VEXT.32 Q11,Q6,Q11,#3
|
||||
VSHR.S64 D6,#32
|
||||
VADD.I64 D6, D2, D3
|
||||
VEXT.32 Q11, Q6, Q11, #3
|
||||
VSHR.S64 D6, #32
|
||||
|
||||
|
||||
@VMOV R11,D6[0]
|
||||
VST1.32 D6[0],[SP]
|
||||
LDR R11,[SP]
|
||||
SUB r8 , r8 , r11,lsl #1 @y=sub32(y,(acc<<1))
|
||||
@VMOV R11,D6[0]
|
||||
VST1.32 D6[0], [SP]
|
||||
LDR R11, [SP]
|
||||
SUB r8 , r8 , r11, lsl #1 @y=sub32(y,(acc<<1))
|
||||
|
||||
MOV r2 , r8 ,lsl r6 @ shl32(y, shift_value)
|
||||
MOV r2 , r8 , lsl r6 @ shl32(y, shift_value)
|
||||
|
||||
VMOV.32 D15[1], R2 @state[0]
|
||||
MOV r9, r8, asr r1
|
||||
VMOV.32 D15[1], R2 @state[0]
|
||||
MOV r9, r8, asr r1
|
||||
|
||||
|
||||
|
||||
STR r9 , [r0],#-4 @*spectrum = y@
|
||||
VEXT.32 Q6,Q7,Q6,#3
|
||||
LDRGT r8 , [r0] @r8 = y = *spectrum
|
||||
STR r9 , [r0], #-4 @*spectrum = y@
|
||||
VEXT.32 Q6, Q7, Q6, #3
|
||||
LDRGT r8 , [r0] @r8 = y = *spectrum
|
||||
|
||||
|
||||
BGT NEGOUTER_LOOP2_12
|
||||
BGT NEGOUTER_LOOP2_12
|
||||
|
||||
|
||||
EXIT:
|
||||
ADD sp, sp ,#128
|
||||
vpop {d8-d15}
|
||||
LDMFD r13!, {r4 - r12, r15}
|
||||
ADD sp, sp , #128
|
||||
vpop {d8-d15}
|
||||
LDMFD r13!, {r4 - r12, r15}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ ixheaacd_scale_factor_process_armv8:
|
|||
|
||||
MOV x21, x6
|
||||
MOV x22, x7
|
||||
CMP x2, #0 // Tbands
|
||||
CMP x2, #0 // Tbands
|
||||
|
||||
BGT lbl17
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ ADD_34:
|
|||
|
||||
TBANDS_LOOP:
|
||||
LDRSH x5, [x1], #2 // scale_factor = *Scfactor++;
|
||||
LDRB w4, [x3], #1 //Offset [1]
|
||||
LDRB w4, [x3], #1 //Offset [1]
|
||||
sxtw x4, w4
|
||||
|
||||
|
||||
|
|
@ -149,8 +149,8 @@ SHIFT_NEGTIVE: //;loop over sfbWidth a multiple of 4
|
|||
ASR x6, x6, #16
|
||||
ASR x7, x7, #16
|
||||
|
||||
LSL x6, x6, #2 // shl for fixmul_32x16b and shl32(buffer,1)
|
||||
LSL x7, x7, #2 // shl for fixmul_32x16b and shl32(buffer,1)
|
||||
LSL x6, x6, #2 // shl for fixmul_32x16b and shl32(buffer,1)
|
||||
LSL x7, x7, #2 // shl for fixmul_32x16b and shl32(buffer,1)
|
||||
|
||||
STP w6, w7, [x0], #8 // *x_invquant++ = buffex1;
|
||||
|
||||
|
|
|
|||
|
|
@ -131,9 +131,9 @@ ixheaacd_cos_sin_mod_loop2:
|
|||
LOOP1:
|
||||
LD1 {v2.2s}, [x0]
|
||||
LD1 {v3.2s}, [x10]
|
||||
LDR w5, [x3] //RE2
|
||||
LDR w5, [x3] //RE2
|
||||
sxtw x5, w5
|
||||
LDR w6, [x11] //RE3
|
||||
LDR w6, [x11] //RE3
|
||||
sxtw x6, w6
|
||||
//VTRN.32 D2, D3
|
||||
TRN1 v4.2s, v2.2s, v3.2s
|
||||
|
|
|
|||
|
|
@ -229,20 +229,20 @@ VOID(*ixheaacd_aac_ld_dec_rearrange)
|
|||
(WORD32 *ip, WORD32 *op, WORD32 mdct_len_2,
|
||||
UWORD8 *re_arr_tab) = &ixheaacd_rearrange_dec;
|
||||
|
||||
VOID (*ixheaacd_fft32x32_ld)
|
||||
VOID(*ixheaacd_fft32x32_ld)
|
||||
(ia_aac_dec_imdct_tables_struct *imdct_tables_ptr, WORD32 npoints,
|
||||
WORD32 *ptr_x, WORD32 *ptr_y) = &ixheaacd_imdct_using_fft_armv8;
|
||||
|
||||
VOID (*ixheaacd_fft32x32_ld2)
|
||||
VOID(*ixheaacd_fft32x32_ld2)
|
||||
(ia_aac_dec_imdct_tables_struct *imdct_tables_ptr, WORD32 npoints,
|
||||
WORD32 *ptr_x, WORD32 *ptr_y) = &ixheaacd_fft32x32_ld2_armv8;
|
||||
|
||||
WORD16 (*ixheaacd_neg_expo_inc)(WORD16 neg_expo) = &ixheaacd_neg_expo_inc_arm;
|
||||
|
||||
VOID (*ixheaacd_inv_dit_fft_8pt)
|
||||
VOID(*ixheaacd_inv_dit_fft_8pt)
|
||||
(WORD32 *x, WORD32 *real, WORD32 *imag) = &ixheaacd_inv_dit_fft_8pt_armv8;
|
||||
|
||||
VOID (*ixheaacd_scale_factor_process)
|
||||
VOID(*ixheaacd_scale_factor_process)
|
||||
(WORD32 *x_invquant, WORD16 *scale_fact, WORD no_band, WORD8 *width,
|
||||
WORD32 *scale_tables_ptr, WORD32 total_channels, WORD32 object_type,
|
||||
WORD32 aac_sf_data_resil_flag) = &ixheaacd_scale_factor_process_armv8;
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -472,8 +472,8 @@ VOID ixheaacd_cplx_anal_qmffilt(const WORD16 *time_sample_buf,
|
|||
}
|
||||
|
||||
VOID ixheaacd_inv_modulation_lp(WORD32 *qmf_real, WORD16 *filter_states,
|
||||
ia_sbr_qmf_filter_bank_struct *syn_qmf,
|
||||
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
|
||||
ia_sbr_qmf_filter_bank_struct *syn_qmf,
|
||||
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
|
||||
WORD32 L = syn_qmf->no_channels;
|
||||
const WORD32 M = (L >> 1);
|
||||
WORD32 *dct_in = qmf_real;
|
||||
|
|
@ -490,9 +490,9 @@ VOID ixheaacd_inv_modulation_lp(WORD32 *qmf_real, WORD16 *filter_states,
|
|||
filter_states[3 * M] = 0;
|
||||
}
|
||||
|
||||
VOID ixheaacd_inv_emodulation(
|
||||
WORD32 *qmf_real, ia_sbr_qmf_filter_bank_struct *syn_qmf,
|
||||
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
|
||||
VOID ixheaacd_inv_emodulation(WORD32 *qmf_real,
|
||||
ia_sbr_qmf_filter_bank_struct *syn_qmf,
|
||||
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
|
||||
ixheaacd_cos_sin_mod(qmf_real, syn_qmf, (WORD16 *)qmf_dec_tables_ptr->w1024,
|
||||
(WORD32 *)qmf_dec_tables_ptr->dig_rev_table2_128);
|
||||
}
|
||||
|
|
@ -1103,7 +1103,6 @@ VOID ixheaacd_esbr_cos_sin_mod(WORD32 *subband,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
VOID ixheaacd_esbr_fwd_modulation(
|
||||
const WORD32 *time_sample_buf, WORD32 *real_subband, WORD32 *imag_subband,
|
||||
ia_sbr_qmf_filter_bank_struct *qmf_bank,
|
||||
|
|
@ -1344,6 +1343,3 @@ VOID ixheaacd_radix4bfly(const WORD16 *w, WORD32 *x, WORD32 index1,
|
|||
w_ptr = w_ptr - fft_jmp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -48,10 +48,10 @@ S_WITH_R_L5:
|
|||
ADD w7, w10, w14 //qmfImag[j] = add32(i1, x1)
|
||||
SUB w4, w10, w14 //*qmfReal++ = sub32(i1, x1)
|
||||
|
||||
MOV v1.s[0], W4 //QADD x4, x4, x9
|
||||
MOV v1.s[1], W5 //QADD x4, x4, x9
|
||||
MOV v1.s[2], W6 //QADD x4, x4, x9
|
||||
MOV v1.s[3], W7 //QADD x4, x4, x9
|
||||
MOV v1.s[0], W4 //QADD x4, x4, x9
|
||||
MOV v1.s[1], W5 //QADD x4, x4, x9
|
||||
MOV v1.s[2], W6 //QADD x4, x4, x9
|
||||
MOV v1.s[3], W7 //QADD x4, x4, x9
|
||||
lsl w14, w3, #1
|
||||
|
||||
SQSHL v1.4s, v1.4s, v3.4s
|
||||
|
|
|
|||
|
|
@ -54,10 +54,10 @@ S_WITH_R_L5:
|
|||
|
||||
|
||||
|
||||
MOV v1.s[0], W4 //QADD x4, x4, x9
|
||||
MOV v1.s[1], W5 //QADD x4, x4, x9
|
||||
MOV v1.s[2], W6 //QADD x4, x4, x9
|
||||
MOV v1.s[3], W7 //QADD x4, x4, x9
|
||||
MOV v1.s[0], W4 //QADD x4, x4, x9
|
||||
MOV v1.s[1], W5 //QADD x4, x4, x9
|
||||
MOV v1.s[2], W6 //QADD x4, x4, x9
|
||||
MOV v1.s[3], W7 //QADD x4, x4, x9
|
||||
lsl w14, w3, #1
|
||||
|
||||
SQSHL v1.4s, v1.4s, v3.4s
|
||||
|
|
|
|||
|
|
@ -24,86 +24,84 @@
|
|||
/*****************************************************************************/
|
||||
/* Ittiam standard API commands */
|
||||
/*****************************************************************************/
|
||||
#define IA_API_CMD_GET_LIB_ID_STRINGS 0x0001
|
||||
#define IA_API_CMD_GET_LIB_ID_STRINGS 0x0001
|
||||
|
||||
#define IA_API_CMD_GET_API_SIZE 0x0002
|
||||
#define IA_API_CMD_INIT 0x0003
|
||||
#define IA_API_CMD_GET_API_SIZE 0x0002
|
||||
#define IA_API_CMD_INIT 0x0003
|
||||
|
||||
#define IA_API_CMD_SET_CONFIG_PARAM 0x0004
|
||||
#define IA_API_CMD_GET_CONFIG_PARAM 0x0005
|
||||
#define IA_API_CMD_SET_CONFIG_PARAM 0x0004
|
||||
#define IA_API_CMD_GET_CONFIG_PARAM 0x0005
|
||||
|
||||
#define IA_API_CMD_GET_MEMTABS_SIZE 0x0006
|
||||
#define IA_API_CMD_SET_MEMTABS_PTR 0x0007
|
||||
#define IA_API_CMD_GET_N_MEMTABS 0x0008
|
||||
#define IA_API_CMD_GET_MEMTABS_SIZE 0x0006
|
||||
#define IA_API_CMD_SET_MEMTABS_PTR 0x0007
|
||||
#define IA_API_CMD_GET_N_MEMTABS 0x0008
|
||||
|
||||
#define IA_API_CMD_EXECUTE 0x0009
|
||||
#define IA_API_CMD_EXECUTE 0x0009
|
||||
|
||||
#define IA_API_CMD_PUT_INPUT_QUERY 0x000A
|
||||
#define IA_API_CMD_GET_CURIDX_INPUT_BUF 0x000B
|
||||
#define IA_API_CMD_SET_INPUT_BYTES 0x000C
|
||||
#define IA_API_CMD_GET_OUTPUT_BYTES 0x000D
|
||||
#define IA_API_CMD_INPUT_OVER 0x000E
|
||||
#define IA_API_CMD_PUT_INPUT_QUERY 0x000A
|
||||
#define IA_API_CMD_GET_CURIDX_INPUT_BUF 0x000B
|
||||
#define IA_API_CMD_SET_INPUT_BYTES 0x000C
|
||||
#define IA_API_CMD_GET_OUTPUT_BYTES 0x000D
|
||||
#define IA_API_CMD_INPUT_OVER 0x000E
|
||||
|
||||
#define IA_API_CMD_RESET 0x0010
|
||||
|
||||
#define IA_API_CMD_RESET 0x0010
|
||||
#define IA_API_CMD_GET_MEM_INFO_SIZE 0x0011
|
||||
#define IA_API_CMD_GET_MEM_INFO_ALIGNMENT 0x0012
|
||||
#define IA_API_CMD_GET_MEM_INFO_TYPE 0x0013
|
||||
#define IA_API_CMD_GET_MEM_INFO_PLACEMENT 0x0014
|
||||
#define IA_API_CMD_GET_MEM_INFO_PRIORITY 0x0015
|
||||
#define IA_API_CMD_SET_MEM_PTR 0x0016
|
||||
#define IA_API_CMD_SET_MEM_INFO_SIZE 0x0017
|
||||
#define IA_API_CMD_SET_MEM_PLACEMENT 0x0018
|
||||
|
||||
#define IA_API_CMD_GET_MEM_INFO_SIZE 0x0011
|
||||
#define IA_API_CMD_GET_MEM_INFO_ALIGNMENT 0x0012
|
||||
#define IA_API_CMD_GET_MEM_INFO_TYPE 0x0013
|
||||
#define IA_API_CMD_GET_MEM_INFO_PLACEMENT 0x0014
|
||||
#define IA_API_CMD_GET_MEM_INFO_PRIORITY 0x0015
|
||||
#define IA_API_CMD_SET_MEM_PTR 0x0016
|
||||
#define IA_API_CMD_SET_MEM_INFO_SIZE 0x0017
|
||||
#define IA_API_CMD_SET_MEM_PLACEMENT 0x0018
|
||||
#define IA_API_CMD_GET_N_TABLES 0x0019
|
||||
#define IA_API_CMD_GET_TABLE_INFO_SIZE 0x001A
|
||||
#define IA_API_CMD_GET_TABLE_INFO_ALIGNMENT 0x001B
|
||||
#define IA_API_CMD_GET_TABLE_INFO_PRIORITY 0x001C
|
||||
#define IA_API_CMD_SET_TABLE_PTR 0x001D
|
||||
#define IA_API_CMD_GET_TABLE_PTR 0x001E
|
||||
|
||||
#define IA_API_CMD_GET_N_TABLES 0x0019
|
||||
#define IA_API_CMD_GET_TABLE_INFO_SIZE 0x001A
|
||||
#define IA_API_CMD_GET_TABLE_INFO_ALIGNMENT 0x001B
|
||||
#define IA_API_CMD_GET_TABLE_INFO_PRIORITY 0x001C
|
||||
#define IA_API_CMD_SET_TABLE_PTR 0x001D
|
||||
#define IA_API_CMD_GET_TABLE_PTR 0x001E
|
||||
#define IA_API_CMD_INPUT_OVER_BS 0x0021
|
||||
#define IA_API_CMD_INPUT_OVER_IC_BS 0x0022
|
||||
#define IA_API_CMD_INPUT_OVER_IG_BS 0x0023
|
||||
#define IA_API_CMD_INPUT_OVER_IL_BS 0x0024
|
||||
#define IA_API_CMD_INPUT_OVER_IN_BS 0x0025
|
||||
|
||||
|
||||
#define IA_API_CMD_INPUT_OVER_BS 0x0021
|
||||
#define IA_API_CMD_INPUT_OVER_IC_BS 0x0022
|
||||
#define IA_API_CMD_INPUT_OVER_IG_BS 0x0023
|
||||
#define IA_API_CMD_INPUT_OVER_IL_BS 0x0024
|
||||
#define IA_API_CMD_INPUT_OVER_IN_BS 0x0025
|
||||
|
||||
#define IA_API_CMD_SET_INPUT_BYTES_BS 0x0026
|
||||
#define IA_API_CMD_SET_INPUT_BYTES_IC_BS 0x0027
|
||||
#define IA_API_CMD_SET_INPUT_BYTES_IG_BS 0x0028
|
||||
#define IA_API_CMD_SET_INPUT_BYTES_IL_BS 0x0029
|
||||
#define IA_API_CMD_SET_INPUT_BYTES_IN_BS 0x002A
|
||||
#define IA_API_CMD_SET_INPUT_BYTES_BS 0x0026
|
||||
#define IA_API_CMD_SET_INPUT_BYTES_IC_BS 0x0027
|
||||
#define IA_API_CMD_SET_INPUT_BYTES_IG_BS 0x0028
|
||||
#define IA_API_CMD_SET_INPUT_BYTES_IL_BS 0x0029
|
||||
#define IA_API_CMD_SET_INPUT_BYTES_IN_BS 0x002A
|
||||
/*****************************************************************************/
|
||||
/* Ittiam standard API command indices */
|
||||
/*****************************************************************************/
|
||||
/* IA_API_CMD_GET_LIB_ID_STRINGS indices */
|
||||
#define IA_CMD_TYPE_LIB_NAME 0x0100
|
||||
#define IA_CMD_TYPE_LIB_VERSION 0x0200
|
||||
#define IA_CMD_TYPE_API_VERSION 0x0300
|
||||
#define IA_CMD_TYPE_LIB_NAME 0x0100
|
||||
#define IA_CMD_TYPE_LIB_VERSION 0x0200
|
||||
#define IA_CMD_TYPE_API_VERSION 0x0300
|
||||
|
||||
/* IA_API_CMD_INIT indices */
|
||||
#define IA_CMD_TYPE_INIT_API_PRE_CONFIG_PARAMS 0x0100
|
||||
#define IA_CMD_TYPE_INIT_API_PRE_CONFIG_PARAMS 0x0100
|
||||
#define IA_CMD_TYPE_INIT_API_POST_CONFIG_PARAMS 0x0200
|
||||
#define IA_CMD_TYPE_INIT_PROCESS 0x0300
|
||||
#define IA_CMD_TYPE_INIT_DONE_QUERY 0x0400
|
||||
#define IA_CMD_TYPE_INIT_PROCESS 0x0300
|
||||
#define IA_CMD_TYPE_INIT_DONE_QUERY 0x0400
|
||||
|
||||
#define IA_CMD_TYPE_INIT_CPY_BSF_BUFF 0x0201
|
||||
#define IA_CMD_TYPE_INIT_CPY_IC_BSF_BUFF 0x0202
|
||||
#define IA_CMD_TYPE_INIT_CPY_IL_BSF_BUFF 0x0203
|
||||
#define IA_CMD_TYPE_INIT_CPY_IG_BSF_BUFF 0x0204
|
||||
#define IA_CMD_TYPE_INIT_CPY_IN_BSF_BUFF 0x0205
|
||||
#define IA_CMD_TYPE_INIT_CPY_BSF_BUFF 0x0201
|
||||
#define IA_CMD_TYPE_INIT_CPY_IC_BSF_BUFF 0x0202
|
||||
#define IA_CMD_TYPE_INIT_CPY_IL_BSF_BUFF 0x0203
|
||||
#define IA_CMD_TYPE_INIT_CPY_IG_BSF_BUFF 0x0204
|
||||
#define IA_CMD_TYPE_INIT_CPY_IN_BSF_BUFF 0x0205
|
||||
|
||||
#define IA_CMD_TYPE_INIT_CPY_BSF_BUFF_OVER_QUERY 0x0206
|
||||
#define IA_CMD_TYPE_INIT_CPY_IC_BSF_BUFF_OVER_QUERY 0x0207
|
||||
#define IA_CMD_TYPE_INIT_CPY_IL_BSF_BUFF_OVER_QUERY 0x0208
|
||||
#define IA_CMD_TYPE_INIT_CPY_IG_BSF_BUFF_OVER_QUERY 0x0209
|
||||
#define IA_CMD_TYPE_INIT_CPY_IN_BSF_BUFF_OVER_QUERY 0x020A
|
||||
#define IA_CMD_TYPE_INIT_SET_BUFF_PTR 0x020B
|
||||
#define IA_CMD_TYPE_INIT_CPY_BSF_BUFF_OVER_QUERY 0x0206
|
||||
#define IA_CMD_TYPE_INIT_CPY_IC_BSF_BUFF_OVER_QUERY 0x0207
|
||||
#define IA_CMD_TYPE_INIT_CPY_IL_BSF_BUFF_OVER_QUERY 0x0208
|
||||
#define IA_CMD_TYPE_INIT_CPY_IG_BSF_BUFF_OVER_QUERY 0x0209
|
||||
#define IA_CMD_TYPE_INIT_CPY_IN_BSF_BUFF_OVER_QUERY 0x020A
|
||||
#define IA_CMD_TYPE_INIT_SET_BUFF_PTR 0x020B
|
||||
|
||||
/* IA_API_CMD_EXECUTE indices */
|
||||
#define IA_CMD_TYPE_DO_EXECUTE 0x0100
|
||||
#define IA_CMD_TYPE_DONE_QUERY 0x0200
|
||||
#define IA_CMD_TYPE_DO_EXECUTE 0x0100
|
||||
#define IA_CMD_TYPE_DONE_QUERY 0x0200
|
||||
|
||||
#endif
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -18,7 +18,6 @@
|
|||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
|
||||
|
||||
#ifndef IMPD_API_DEFS_H
|
||||
#define IMPD_API_DEFS_H
|
||||
|
||||
|
|
@ -26,26 +25,25 @@
|
|||
/* Constant hash defines */
|
||||
/*****************************************************************************/
|
||||
/* A constant to let API copy small strings to buffers outside */
|
||||
#define IA_API_STR_LEN 30
|
||||
#define IA_APIVERSION_MAJOR 1
|
||||
#define IA_APIVERSION_MINOR 10
|
||||
#define IA_API_STR_LEN 30
|
||||
#define IA_APIVERSION_MAJOR 1
|
||||
#define IA_APIVERSION_MINOR 10
|
||||
|
||||
/* last compatible version */
|
||||
/* sometimes a new API version is just for a bugfix, or a added feature in */
|
||||
/* this case it is better to use a newer version even though a library was */
|
||||
/* made for an older version, library API can then be upgraded to newer API */
|
||||
/* version after checking for compatibility or by adding features */
|
||||
#define IA_LASTCOMP_APIVERSION_MAJOR 1
|
||||
#define IA_LASTCOMP_APIVERSION_MINOR 10
|
||||
#define IA_LASTCOMP_APIVERSION_MAJOR 1
|
||||
#define IA_LASTCOMP_APIVERSION_MINOR 10
|
||||
|
||||
#define IA_STR(str) #str
|
||||
#define IA_MAKE_VERSION_STR(maj, min) IA_STR(maj) "." IA_STR(min)
|
||||
#define IA_APIVERSION IA_MAKE_VERSION_STR(\
|
||||
IA_APIVERSION_MAJOR, \
|
||||
IA_APIVERSION_MINOR)
|
||||
#define IA_STR(str) #str
|
||||
#define IA_MAKE_VERSION_STR(maj, min) IA_STR(maj) "." IA_STR(min)
|
||||
#define IA_APIVERSION \
|
||||
IA_MAKE_VERSION_STR(IA_APIVERSION_MAJOR, IA_APIVERSION_MINOR)
|
||||
|
||||
#define IA_LAST_COMP_APIVERSION IA_MAKE_VERSION_STR(\
|
||||
IA_LASTCOMP_APIVERSION_MAJOR, \
|
||||
IA_LASTCOMP_APIVERSION_MINOR)
|
||||
#define IA_LAST_COMP_APIVERSION \
|
||||
IA_MAKE_VERSION_STR(IA_LASTCOMP_APIVERSION_MAJOR, \
|
||||
IA_LASTCOMP_APIVERSION_MINOR)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -24,110 +24,105 @@
|
|||
/* structure definitions */
|
||||
/****************************************************************************/
|
||||
/* DRC Configuration */
|
||||
typedef struct ia_drc_config_struct
|
||||
{
|
||||
WORD32 bitstream_file_format;
|
||||
WORD32 dec_type;
|
||||
WORD32 sub_band_domain_mode;
|
||||
WORD32 num_ch_in;
|
||||
WORD32 num_ch_out;
|
||||
WORD32 sampling_rate;
|
||||
WORD32 control_parameter_index;
|
||||
WORD32 delay_mode;
|
||||
WORD32 absorb_delay_on;
|
||||
WORD32 gain_delay_samples;
|
||||
WORD32 subband_domain_io_flag;
|
||||
WORD32 frame_size;
|
||||
WORD32 sub_band_down_sampling_factor;
|
||||
WORD32 sub_band_count;
|
||||
WORD32 peak_limiter;
|
||||
WORD32 interface_bitstream_present;
|
||||
WORD32 pcm_size;
|
||||
WORD32 parametric_drc_delay_gain_dec_instance ;
|
||||
WORD32 parametric_drc_delay;
|
||||
WORD32 parametric_drc_delay_max;
|
||||
WORD32 eq_delay_gain_dec_instance;
|
||||
WORD32 eq_delay;
|
||||
WORD32 eq_delay_max;
|
||||
WORD32 delay_line_samples;
|
||||
WORD32 constant_delay_on;
|
||||
WORD32 audio_delay_samples;
|
||||
typedef struct ia_drc_config_struct {
|
||||
WORD32 bitstream_file_format;
|
||||
WORD32 dec_type;
|
||||
WORD32 sub_band_domain_mode;
|
||||
WORD32 num_ch_in;
|
||||
WORD32 num_ch_out;
|
||||
WORD32 sampling_rate;
|
||||
WORD32 control_parameter_index;
|
||||
WORD32 delay_mode;
|
||||
WORD32 absorb_delay_on;
|
||||
WORD32 gain_delay_samples;
|
||||
WORD32 subband_domain_io_flag;
|
||||
WORD32 frame_size;
|
||||
WORD32 sub_band_down_sampling_factor;
|
||||
WORD32 sub_band_count;
|
||||
WORD32 peak_limiter;
|
||||
WORD32 interface_bitstream_present;
|
||||
WORD32 pcm_size;
|
||||
WORD32 parametric_drc_delay_gain_dec_instance;
|
||||
WORD32 parametric_drc_delay;
|
||||
WORD32 parametric_drc_delay_max;
|
||||
WORD32 eq_delay_gain_dec_instance;
|
||||
WORD32 eq_delay;
|
||||
WORD32 eq_delay_max;
|
||||
WORD32 delay_line_samples;
|
||||
WORD32 constant_delay_on;
|
||||
WORD32 audio_delay_samples;
|
||||
|
||||
WORD32 effect_type;
|
||||
WORD32 target_loudness;
|
||||
WORD32 loud_norm_flag;
|
||||
WORD32 effect_type;
|
||||
WORD32 target_loudness;
|
||||
WORD32 loud_norm_flag;
|
||||
|
||||
}ia_drc_config_struct;
|
||||
} ia_drc_config_struct;
|
||||
|
||||
/* DRC bitsteam handler */
|
||||
typedef struct bits_handler
|
||||
{
|
||||
UWORD8* bitstream_drc_config;
|
||||
UWORD8* bitstream_loudness_info ;
|
||||
UWORD8* bitstream_unidrc_interface ;
|
||||
UWORD8* it_bit_buf;
|
||||
WORD32 num_bytes_bs_drc_config;
|
||||
WORD32 num_bytes_bs_loudness_info;
|
||||
WORD32 num_bits_read_bs_unidrc_interface;
|
||||
WORD32 num_bytes_bs_unidrc_interface;
|
||||
WORD32 num_bits_read_bs;
|
||||
WORD32 num_bytes_read_bs;
|
||||
WORD32 num_bytes_bs;
|
||||
WORD32 num_bits_offset_bs;
|
||||
WORD32 byte_index_bs;
|
||||
WORD32 num_byts_cur;
|
||||
WORD32 num_byts_cur_ic;
|
||||
WORD32 num_byts_cur_il;
|
||||
WORD32 num_byts_cur_in;
|
||||
WORD32 cpy_over;
|
||||
WORD32 cpy_over_ic;
|
||||
WORD32 cpy_over_il;
|
||||
WORD32 cpy_over_in;
|
||||
WORD32 gain_stream_flag;
|
||||
}ia_drc_bits_handler_struct;
|
||||
typedef struct bits_handler {
|
||||
UWORD8 *bitstream_drc_config;
|
||||
UWORD8 *bitstream_loudness_info;
|
||||
UWORD8 *bitstream_unidrc_interface;
|
||||
UWORD8 *it_bit_buf;
|
||||
WORD32 num_bytes_bs_drc_config;
|
||||
WORD32 num_bytes_bs_loudness_info;
|
||||
WORD32 num_bits_read_bs_unidrc_interface;
|
||||
WORD32 num_bytes_bs_unidrc_interface;
|
||||
WORD32 num_bits_read_bs;
|
||||
WORD32 num_bytes_read_bs;
|
||||
WORD32 num_bytes_bs;
|
||||
WORD32 num_bits_offset_bs;
|
||||
WORD32 byte_index_bs;
|
||||
WORD32 num_byts_cur;
|
||||
WORD32 num_byts_cur_ic;
|
||||
WORD32 num_byts_cur_il;
|
||||
WORD32 num_byts_cur_in;
|
||||
WORD32 cpy_over;
|
||||
WORD32 cpy_over_ic;
|
||||
WORD32 cpy_over_il;
|
||||
WORD32 cpy_over_in;
|
||||
WORD32 gain_stream_flag;
|
||||
} ia_drc_bits_handler_struct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ia_drc_bits_dec_struct *pstr_bitstream_dec;
|
||||
ia_drc_gain_dec_struct *pstr_gain_dec[2];
|
||||
ia_drc_sel_pro_struct *pstr_selection_proc;
|
||||
ia_drc_config *pstr_drc_config;
|
||||
ia_drc_loudness_info_set_struct *pstr_loudness_info;
|
||||
ia_drc_gain_struct *pstr_drc_gain;
|
||||
ia_drc_interface_struct *pstr_drc_interface;
|
||||
typedef struct {
|
||||
ia_drc_bits_dec_struct *pstr_bitstream_dec;
|
||||
ia_drc_gain_dec_struct *pstr_gain_dec[2];
|
||||
ia_drc_sel_pro_struct *pstr_selection_proc;
|
||||
ia_drc_config *pstr_drc_config;
|
||||
ia_drc_loudness_info_set_struct *pstr_loudness_info;
|
||||
ia_drc_gain_struct *pstr_drc_gain;
|
||||
ia_drc_interface_struct *pstr_drc_interface;
|
||||
|
||||
ia_drc_peak_limiter_struct *pstr_peak_limiter;
|
||||
ia_drc_qmf_filt_struct *pstr_qmf_filter;
|
||||
ia_drc_sel_proc_params_struct *pstr_drc_sel_proc_params;
|
||||
ia_drc_sel_proc_output_struct *pstr_drc_sel_proc_output;
|
||||
ia_drc_peak_limiter_struct *pstr_peak_limiter;
|
||||
ia_drc_qmf_filt_struct *pstr_qmf_filter;
|
||||
ia_drc_sel_proc_params_struct *pstr_drc_sel_proc_params;
|
||||
ia_drc_sel_proc_output_struct *pstr_drc_sel_proc_output;
|
||||
|
||||
}ia_drc_payload_struct;
|
||||
} ia_drc_payload_struct;
|
||||
|
||||
typedef struct ia_drc_state_struct
|
||||
{
|
||||
UWORD32 ui_out_bytes;
|
||||
UWORD32 ui_in_bytes;
|
||||
UWORD32 ui_ir_bytes;
|
||||
UWORD32 total_num_out_samples;
|
||||
UWORD32 frame_no;
|
||||
UWORD32 out_size;
|
||||
UWORD32 ui_init_done;
|
||||
UWORD32 ui_exe_done;
|
||||
UWORD32 ui_ir_used;
|
||||
WORD32 delay_in_output;
|
||||
WORD32 delay_adjust_samples;
|
||||
pVOID persistant_ptr;
|
||||
}ia_drc_state_struct;
|
||||
typedef struct ia_drc_state_struct {
|
||||
UWORD32 ui_out_bytes;
|
||||
UWORD32 ui_in_bytes;
|
||||
UWORD32 ui_ir_bytes;
|
||||
UWORD32 total_num_out_samples;
|
||||
UWORD32 frame_no;
|
||||
UWORD32 out_size;
|
||||
UWORD32 ui_init_done;
|
||||
UWORD32 ui_exe_done;
|
||||
UWORD32 ui_ir_used;
|
||||
WORD32 delay_in_output;
|
||||
WORD32 delay_adjust_samples;
|
||||
pVOID persistant_ptr;
|
||||
} ia_drc_state_struct;
|
||||
|
||||
typedef struct IA_PSM_API_Struct
|
||||
{
|
||||
ia_drc_state_struct *p_state;
|
||||
ia_drc_config_struct str_config;
|
||||
ia_drc_payload_struct str_payload;
|
||||
ia_drc_bits_handler_struct str_bit_handler;
|
||||
ia_mem_info_struct *p_mem_info;
|
||||
pVOID *pp_mem;
|
||||
struct ia_bit_buf_struct str_bit_buf, *pstr_bit_buf;
|
||||
typedef struct IA_PSM_API_Struct {
|
||||
ia_drc_state_struct *p_state;
|
||||
ia_drc_config_struct str_config;
|
||||
ia_drc_payload_struct str_payload;
|
||||
ia_drc_bits_handler_struct str_bit_handler;
|
||||
ia_mem_info_struct *p_mem_info;
|
||||
pVOID *pp_mem;
|
||||
struct ia_bit_buf_struct str_bit_buf, *pstr_bit_buf;
|
||||
|
||||
} ia_drc_api_struct;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,262 +30,222 @@
|
|||
#include "impd_drc_struct.h"
|
||||
#include "impd_drc_parser.h"
|
||||
|
||||
WORD32 impd_read_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;
|
||||
it_bit_buff->error = 0;
|
||||
|
||||
WORD32 impd_read_bits_buf(ia_bit_buf_struct* it_bit_buff,
|
||||
WORD no_of_bits)
|
||||
{
|
||||
if (it_bit_buff->cnt_bits <= 0) {
|
||||
it_bit_buff->error = 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
UWORD32 ret_val;
|
||||
UWORD8 *ptr_read_next = it_bit_buff->ptr_read_next;
|
||||
WORD bit_pos = it_bit_buff->bit_pos;
|
||||
it_bit_buff->error = 0;
|
||||
if (no_of_bits == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(it_bit_buff->cnt_bits <= 0)
|
||||
{
|
||||
it_bit_buff->error = 1;
|
||||
return -1;
|
||||
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 (no_of_bits==0){
|
||||
return 0;
|
||||
}
|
||||
ret_val <<= 8;
|
||||
|
||||
it_bit_buff->cnt_bits -= no_of_bits;
|
||||
ret_val = (UWORD32)*ptr_read_next;
|
||||
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;
|
||||
}
|
||||
|
||||
ret_val <<= 8;
|
||||
|
||||
ret_val |= (UWORD32)*ptr_read_next;
|
||||
}
|
||||
|
||||
ret_val = ret_val << ((31 - no_of_bits) - bit_pos) >> (32 - no_of_bits);
|
||||
it_bit_buff->ptr_read_next = ptr_read_next;
|
||||
it_bit_buff->bit_pos = (WORD16)bit_pos;
|
||||
return ret_val;
|
||||
ret_val = ret_val << ((31 - no_of_bits) - bit_pos) >> (32 - no_of_bits);
|
||||
it_bit_buff->ptr_read_next = ptr_read_next;
|
||||
it_bit_buff->bit_pos = (WORD16)bit_pos;
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
ia_bit_buf_struct* impd_create_bit_buf(ia_bit_buf_struct* it_bit_buff,
|
||||
UWORD8 *ptr_bit_buf_base,
|
||||
WORD32 bit_buf_size)
|
||||
{
|
||||
UWORD8* ptr_bit_buf_base,
|
||||
WORD32 bit_buf_size) {
|
||||
it_bit_buff->ptr_bit_buf_base = ptr_bit_buf_base;
|
||||
it_bit_buff->ptr_bit_buf_end = ptr_bit_buf_base + bit_buf_size - 1;
|
||||
|
||||
it_bit_buff->ptr_bit_buf_base = ptr_bit_buf_base;
|
||||
it_bit_buff->ptr_bit_buf_end = ptr_bit_buf_base + bit_buf_size - 1;
|
||||
it_bit_buff->ptr_read_next = ptr_bit_buf_base;
|
||||
it_bit_buff->bit_pos = 7;
|
||||
|
||||
it_bit_buff->ptr_read_next = ptr_bit_buf_base;
|
||||
it_bit_buff->bit_pos = 7;
|
||||
it_bit_buff->cnt_bits = 0;
|
||||
it_bit_buff->size = bit_buf_size << 3;
|
||||
|
||||
it_bit_buff->cnt_bits = 0;
|
||||
it_bit_buff->size = bit_buf_size << 3;
|
||||
|
||||
return it_bit_buff;
|
||||
return it_bit_buff;
|
||||
}
|
||||
|
||||
ia_bit_buf_struct* impd_create_init_bit_buf(ia_bit_buf_struct* it_bit_buff,
|
||||
UWORD8 *ptr_bit_buf_base,
|
||||
WORD32 bit_buf_size)
|
||||
{
|
||||
impd_create_bit_buf(it_bit_buff,ptr_bit_buf_base,bit_buf_size);
|
||||
it_bit_buff->cnt_bits = (bit_buf_size << 3);
|
||||
return (it_bit_buff);
|
||||
UWORD8* ptr_bit_buf_base,
|
||||
WORD32 bit_buf_size) {
|
||||
impd_create_bit_buf(it_bit_buff, ptr_bit_buf_base, bit_buf_size);
|
||||
it_bit_buff->cnt_bits = (bit_buf_size << 3);
|
||||
return (it_bit_buff);
|
||||
}
|
||||
|
||||
WORD32 impd_init_drc_bitstream_dec(ia_drc_bits_dec_struct* p_drc_bs_dec_struct,
|
||||
WORD32 sample_rate,
|
||||
WORD32 frame_size,
|
||||
WORD32 delay_mode,
|
||||
WORD32 lfe_channel_map_count,
|
||||
WORD32* lfe_channel_map)
|
||||
{
|
||||
WORD32 i, err_code = 0;
|
||||
WORD32 sample_rate, WORD32 frame_size,
|
||||
WORD32 delay_mode,
|
||||
WORD32 lfe_channel_map_count,
|
||||
WORD32* lfe_channel_map) {
|
||||
WORD32 i, err_code = 0;
|
||||
|
||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct = &p_drc_bs_dec_struct->ia_drc_params_struct;
|
||||
ia_drc_params_struct->drc_frame_size = frame_size;
|
||||
ia_drc_params_struct->delta_tmin_default = impd_get_delta_tmin(sample_rate);
|
||||
ia_drc_params_struct->num_gain_values_max_default = ia_drc_params_struct->drc_frame_size / ia_drc_params_struct->delta_tmin_default;
|
||||
ia_drc_params_struct->delay_mode = delay_mode;
|
||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct =
|
||||
&p_drc_bs_dec_struct->ia_drc_params_struct;
|
||||
ia_drc_params_struct->drc_frame_size = frame_size;
|
||||
ia_drc_params_struct->delta_tmin_default = impd_get_delta_tmin(sample_rate);
|
||||
ia_drc_params_struct->num_gain_values_max_default =
|
||||
ia_drc_params_struct->drc_frame_size /
|
||||
ia_drc_params_struct->delta_tmin_default;
|
||||
ia_drc_params_struct->delay_mode = delay_mode;
|
||||
|
||||
if ((frame_size < 1)||(frame_size > AUDIO_CODEC_FRAME_SIZE_MAX)||(ia_drc_params_struct->drc_frame_size < 0.001f * sample_rate))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (sample_rate < 1000)
|
||||
{
|
||||
return -1;
|
||||
if ((frame_size < 1) || (frame_size > AUDIO_CODEC_FRAME_SIZE_MAX) ||
|
||||
(ia_drc_params_struct->drc_frame_size < 0.001f * sample_rate)) {
|
||||
return -1;
|
||||
}
|
||||
if (sample_rate < 1000) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ia_drc_params_struct->delta_tmin_default >
|
||||
ia_drc_params_struct->drc_frame_size) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (lfe_channel_map_count >= 0) {
|
||||
if ((lfe_channel_map == NULL) ||
|
||||
(lfe_channel_map_count > MAX_CHANNEL_COUNT)) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (ia_drc_params_struct->delta_tmin_default > ia_drc_params_struct->drc_frame_size)
|
||||
{
|
||||
return -1;
|
||||
ia_drc_params_struct->lfe_channel_map_count = lfe_channel_map_count;
|
||||
|
||||
for (i = 0; i < lfe_channel_map_count; i++) {
|
||||
ia_drc_params_struct->lfe_channel_map[i] = lfe_channel_map[i];
|
||||
}
|
||||
} else {
|
||||
ia_drc_params_struct->lfe_channel_map_count = -1;
|
||||
|
||||
if (lfe_channel_map_count >= 0)
|
||||
{
|
||||
if ((lfe_channel_map == NULL) || (lfe_channel_map_count > MAX_CHANNEL_COUNT))
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
|
||||
ia_drc_params_struct->lfe_channel_map_count = lfe_channel_map_count;
|
||||
|
||||
for (i=0; i<lfe_channel_map_count; i++)
|
||||
{
|
||||
ia_drc_params_struct->lfe_channel_map[i] = lfe_channel_map[i];
|
||||
}
|
||||
for (i = 0; i < MAX_CHANNEL_COUNT; i++) {
|
||||
ia_drc_params_struct->lfe_channel_map[i] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ia_drc_params_struct->lfe_channel_map_count = -1;
|
||||
}
|
||||
|
||||
for (i=0; i<MAX_CHANNEL_COUNT; i++)
|
||||
{
|
||||
ia_drc_params_struct->lfe_channel_map[i] = 0;
|
||||
}
|
||||
}
|
||||
err_code = impd_init_tbls(ia_drc_params_struct->num_gain_values_max_default,
|
||||
&p_drc_bs_dec_struct->tables_default);
|
||||
|
||||
err_code = impd_init_tbls(ia_drc_params_struct->num_gain_values_max_default, &p_drc_bs_dec_struct->tables_default);
|
||||
|
||||
return err_code;
|
||||
return err_code;
|
||||
}
|
||||
|
||||
WORD32 impd_process_drc_bitstream_dec(
|
||||
ia_drc_bits_dec_struct* p_drc_bs_dec_struct, ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
UWORD8* bitstream_config, WORD32 num_bytes, WORD32 num_bits_offset,
|
||||
WORD32* num_bits_read) {
|
||||
WORD32 err_code = 0;
|
||||
|
||||
WORD32 impd_process_drc_bitstream_dec(ia_drc_bits_dec_struct* p_drc_bs_dec_struct,
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_config *pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct *pstr_loudness_info,
|
||||
UWORD8* bitstream_config,
|
||||
WORD32 num_bytes,
|
||||
WORD32 num_bits_offset,
|
||||
WORD32* num_bits_read)
|
||||
{
|
||||
WORD32 err_code = 0;
|
||||
WORD32 loudness_info_set_present, drc_config_present, dummy;
|
||||
|
||||
WORD32 loudness_info_set_present, drc_config_present, dummy;
|
||||
|
||||
|
||||
if (bitstream_config == NULL)
|
||||
{
|
||||
*num_bits_read = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
it_bit_buff = impd_create_init_bit_buf(it_bit_buff, bitstream_config, num_bytes);
|
||||
|
||||
dummy = impd_read_bits_buf(it_bit_buff, num_bits_offset);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
|
||||
loudness_info_set_present = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
|
||||
if (loudness_info_set_present)
|
||||
{
|
||||
drc_config_present = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
|
||||
if (drc_config_present)
|
||||
{
|
||||
err_code = impd_parse_drc_config(it_bit_buff, &p_drc_bs_dec_struct->ia_drc_params_struct, pstr_drc_config);
|
||||
|
||||
if (err_code)
|
||||
return (err_code);
|
||||
|
||||
}
|
||||
|
||||
err_code = impd_parse_loudness_info_set(it_bit_buff, pstr_loudness_info);
|
||||
|
||||
if (err_code)
|
||||
return (err_code);
|
||||
}
|
||||
|
||||
*num_bits_read = it_bit_buff->size - it_bit_buff->cnt_bits;
|
||||
}
|
||||
|
||||
return err_code;
|
||||
}
|
||||
|
||||
|
||||
WORD32 impd_process_drc_bitstream_dec_config(ia_drc_bits_dec_struct* p_drc_bs_dec_struct,
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_config *pstr_drc_config,
|
||||
UWORD8* bitstream_config,
|
||||
WORD32 num_bytes)
|
||||
{
|
||||
WORD32 err_code = 0;
|
||||
|
||||
it_bit_buff = impd_create_init_bit_buf(it_bit_buff, bitstream_config, num_bytes);
|
||||
|
||||
err_code = impd_parse_drc_config( it_bit_buff, &p_drc_bs_dec_struct->ia_drc_params_struct, pstr_drc_config);
|
||||
if (err_code) return (err_code);
|
||||
|
||||
return err_code;
|
||||
}
|
||||
|
||||
|
||||
WORD32 impd_process_drc_bitstream_dec_gain(ia_drc_bits_dec_struct* p_drc_bs_dec_struct,
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_config *pstr_drc_config,
|
||||
ia_drc_gain_struct *pstr_drc_gain,
|
||||
UWORD8* bitstream_gain,
|
||||
WORD32 num_bytes,
|
||||
WORD32 num_bits_offset,
|
||||
WORD32* num_bits_read)
|
||||
{
|
||||
WORD32 err_code = 0;
|
||||
|
||||
WORD32 dummy;
|
||||
|
||||
it_bit_buff = impd_create_init_bit_buf(it_bit_buff, bitstream_gain, num_bytes);
|
||||
if (bitstream_config == NULL) {
|
||||
*num_bits_read = 0;
|
||||
} else {
|
||||
it_bit_buff =
|
||||
impd_create_init_bit_buf(it_bit_buff, bitstream_config, num_bytes);
|
||||
|
||||
dummy = impd_read_bits_buf(it_bit_buff, num_bits_offset);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
err_code = impd_drc_uni_gain_read(
|
||||
it_bit_buff,
|
||||
p_drc_bs_dec_struct,
|
||||
pstr_drc_config,
|
||||
pstr_drc_gain);
|
||||
loudness_info_set_present = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
if (err_code > PROC_COMPLETE)
|
||||
return (err_code);
|
||||
if (loudness_info_set_present) {
|
||||
drc_config_present = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
*num_bits_read = (it_bit_buff->size) - it_bit_buff->cnt_bits;
|
||||
if (drc_config_present) {
|
||||
err_code = impd_parse_drc_config(
|
||||
it_bit_buff, &p_drc_bs_dec_struct->ia_drc_params_struct,
|
||||
pstr_drc_config);
|
||||
|
||||
if (err_code == PROC_COMPLETE)
|
||||
{
|
||||
return err_code;
|
||||
if (err_code) return (err_code);
|
||||
}
|
||||
|
||||
err_code = impd_parse_loudness_info_set(it_bit_buff, pstr_loudness_info);
|
||||
|
||||
if (err_code) return (err_code);
|
||||
}
|
||||
|
||||
return 0;
|
||||
*num_bits_read = it_bit_buff->size - it_bit_buff->cnt_bits;
|
||||
}
|
||||
|
||||
return err_code;
|
||||
}
|
||||
|
||||
WORD32 impd_process_drc_bitstream_dec_config(
|
||||
ia_drc_bits_dec_struct* p_drc_bs_dec_struct, ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_config* pstr_drc_config, UWORD8* bitstream_config,
|
||||
WORD32 num_bytes) {
|
||||
WORD32 err_code = 0;
|
||||
|
||||
WORD32 impd_process_drc_bitstream_dec_loudness_info_set(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_loudness_info_set_struct *pstr_loudness_info,
|
||||
UWORD8* bit_stream_loudness,
|
||||
WORD32 num_bytes_loudness)
|
||||
{
|
||||
WORD32 err_code = 0;
|
||||
it_bit_buff =
|
||||
impd_create_init_bit_buf(it_bit_buff, bitstream_config, num_bytes);
|
||||
|
||||
it_bit_buff = impd_create_init_bit_buf(it_bit_buff, bit_stream_loudness, num_bytes_loudness);
|
||||
err_code = impd_parse_drc_config(
|
||||
it_bit_buff, &p_drc_bs_dec_struct->ia_drc_params_struct, pstr_drc_config);
|
||||
if (err_code) return (err_code);
|
||||
|
||||
err_code = impd_parse_loudness_info_set(it_bit_buff, pstr_loudness_info);
|
||||
if (err_code)
|
||||
return(err_code);
|
||||
|
||||
|
||||
return 0;
|
||||
return err_code;
|
||||
}
|
||||
|
||||
WORD32 impd_process_drc_bitstream_dec_gain(
|
||||
ia_drc_bits_dec_struct* p_drc_bs_dec_struct, ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_config* pstr_drc_config, ia_drc_gain_struct* pstr_drc_gain,
|
||||
UWORD8* bitstream_gain, WORD32 num_bytes, WORD32 num_bits_offset,
|
||||
WORD32* num_bits_read) {
|
||||
WORD32 err_code = 0;
|
||||
|
||||
WORD32 dummy;
|
||||
|
||||
it_bit_buff =
|
||||
impd_create_init_bit_buf(it_bit_buff, bitstream_gain, num_bytes);
|
||||
|
||||
dummy = impd_read_bits_buf(it_bit_buff, num_bits_offset);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
err_code = impd_drc_uni_gain_read(it_bit_buff, p_drc_bs_dec_struct,
|
||||
pstr_drc_config, pstr_drc_gain);
|
||||
|
||||
if (err_code > PROC_COMPLETE) return (err_code);
|
||||
|
||||
*num_bits_read = (it_bit_buff->size) - it_bit_buff->cnt_bits;
|
||||
|
||||
if (err_code == PROC_COMPLETE) {
|
||||
return err_code;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
WORD32 impd_process_drc_bitstream_dec_loudness_info_set(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
UWORD8* bit_stream_loudness, WORD32 num_bytes_loudness) {
|
||||
WORD32 err_code = 0;
|
||||
|
||||
it_bit_buff = impd_create_init_bit_buf(it_bit_buff, bit_stream_loudness,
|
||||
num_bytes_loudness);
|
||||
|
||||
err_code = impd_parse_loudness_info_set(it_bit_buff, pstr_loudness_info);
|
||||
if (err_code) return (err_code);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,34 +20,28 @@
|
|||
#ifndef IMPD_DRC_BITBUFFER_H
|
||||
#define IMPD_DRC_BITBUFFER_H
|
||||
|
||||
typedef struct ia_bit_buf_struct {
|
||||
UWORD8 *ptr_bit_buf_base;
|
||||
UWORD8 *ptr_bit_buf_end;
|
||||
|
||||
typedef struct ia_bit_buf_struct
|
||||
{
|
||||
UWORD8 *ptr_bit_buf_base;
|
||||
UWORD8 *ptr_bit_buf_end;
|
||||
UWORD8 *ptr_read_next;
|
||||
|
||||
UWORD8 *ptr_read_next;
|
||||
WORD32 bit_pos;
|
||||
WORD32 cnt_bits;
|
||||
|
||||
WORD32 bit_pos;
|
||||
WORD32 cnt_bits;
|
||||
WORD32 size;
|
||||
WORD32 error;
|
||||
|
||||
WORD32 size;
|
||||
WORD32 error;
|
||||
} ia_bit_buf_struct;
|
||||
|
||||
ia_bit_buf_struct *impd_create_bit_buf(ia_bit_buf_struct *it_bit_buff,
|
||||
UWORD8 *ptr_bit_buf_base,
|
||||
WORD32 bit_buf_size);
|
||||
|
||||
}ia_bit_buf_struct;
|
||||
|
||||
|
||||
ia_bit_buf_struct * impd_create_bit_buf(ia_bit_buf_struct* it_bit_buff,
|
||||
UWORD8 *ptr_bit_buf_base,
|
||||
WORD32 bit_buf_size);
|
||||
|
||||
ia_bit_buf_struct * impd_create_init_bit_buf(ia_bit_buf_struct* it_bit_buff,
|
||||
UWORD8 *ptr_bit_buf_base,
|
||||
WORD32 bit_buf_size);
|
||||
|
||||
WORD32 impd_read_bits_buf(ia_bit_buf_struct* it_bit_buff,
|
||||
WORD no_of_bits);
|
||||
ia_bit_buf_struct *impd_create_init_bit_buf(ia_bit_buf_struct *it_bit_buff,
|
||||
UWORD8 *ptr_bit_buf_base,
|
||||
WORD32 bit_buf_size);
|
||||
|
||||
WORD32 impd_read_bits_buf(ia_bit_buf_struct *it_bit_buff, WORD no_of_bits);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,44 +20,31 @@
|
|||
#ifndef IMPD_DRC_BITSTREAM_DEC_API_H
|
||||
#define IMPD_DRC_BITSTREAM_DEC_API_H
|
||||
|
||||
WORD32 impd_init_drc_bitstream_dec(
|
||||
ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct, WORD32 sample_rate,
|
||||
WORD32 frame_size, WORD32 delay_mode, WORD32 lfe_channel_map_count,
|
||||
WORD32* lfe_channel_map);
|
||||
|
||||
WORD32 impd_init_drc_bitstream_dec(ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
||||
WORD32 sample_rate,
|
||||
WORD32 frame_size,
|
||||
WORD32 delay_mode,
|
||||
WORD32 lfe_channel_map_count,
|
||||
WORD32* lfe_channel_map);
|
||||
WORD32 impd_process_drc_bitstream_dec(
|
||||
ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
||||
ia_bit_buf_struct* it_bit_buff, ia_drc_config* pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
UWORD8* bitstream_config, WORD32 num_bytes, WORD32 num_bits_offset,
|
||||
WORD32* num_bits_read);
|
||||
|
||||
WORD32 impd_process_drc_bitstream_dec(ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
UWORD8* bitstream_config,
|
||||
WORD32 num_bytes,
|
||||
WORD32 num_bits_offset,
|
||||
WORD32* num_bits_read);
|
||||
WORD32 impd_process_drc_bitstream_dec_config(
|
||||
ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
||||
ia_bit_buf_struct* it_bit_buff, ia_drc_config* pstr_drc_config,
|
||||
UWORD8* bitstream_config, WORD32 num_bytes);
|
||||
|
||||
WORD32 impd_process_drc_bitstream_dec_config(ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
UWORD8* bitstream_config,
|
||||
WORD32 num_bytes);
|
||||
WORD32 impd_process_drc_bitstream_dec_gain(
|
||||
ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
||||
ia_bit_buf_struct* it_bit_buff, ia_drc_config* pstr_drc_config,
|
||||
ia_drc_gain_struct* pstr_drc_gain, UWORD8* bitstream_gain, WORD32 num_bytes,
|
||||
WORD32 num_bits_offset, WORD32* num_bits_read);
|
||||
|
||||
WORD32 impd_process_drc_bitstream_dec_gain(ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_gain_struct* pstr_drc_gain,
|
||||
UWORD8* bitstream_gain,
|
||||
WORD32 num_bytes,
|
||||
WORD32 num_bits_offset,
|
||||
WORD32* num_bits_read);
|
||||
|
||||
WORD32 impd_process_drc_bitstream_dec_loudness_info_set(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
UWORD8* bitstream_loudness,
|
||||
WORD32 num_bytes_loudness
|
||||
);
|
||||
WORD32 impd_process_drc_bitstream_dec_loudness_info_set(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
UWORD8* bitstream_loudness, WORD32 num_bytes_loudness);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -21,161 +21,155 @@
|
|||
#define IMPD_DRC_COMMON_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define EQ_IS_SUPPORTED 1
|
||||
|
||||
#define EQ_IS_SUPPORTED 1
|
||||
#define MEASURE_AVERAGE_BITRATE 0
|
||||
|
||||
#define MEASURE_AVERAGE_BITRATE 0
|
||||
#define ENABLE_ADDITIONAL_TESTS 1
|
||||
|
||||
#define ENABLE_ADDITIONAL_TESTS 1
|
||||
#define SPEAKER_POS_COUNT_MAX 128
|
||||
#define DOWNMIX_COEFF_COUNT_MAX 32 * 32
|
||||
#define MAX_CHANNEL_COUNT 128
|
||||
#define BAND_COUNT_MAX 8
|
||||
#define SEQUENCE_COUNT_MAX 24
|
||||
#define GAIN_SET_COUNT_MAX SEQUENCE_COUNT_MAX
|
||||
#define MEASUREMENT_COUNT_MAX 16
|
||||
#define DOWNMIX_INSTRUCTION_COUNT_MAX 16
|
||||
#define DRC_COEFF_COUNT_MAX 8
|
||||
#define DRC_INSTRUCTIONS_COUNT_MAX (DOWNMIX_INSTRUCTION_COUNT_MAX + 20)
|
||||
#define LOUDNESS_INFO_COUNT_MAX (DOWNMIX_INSTRUCTION_COUNT_MAX + 20)
|
||||
#define AUDIO_CODEC_FRAME_SIZE_MAX 4096
|
||||
#define DRC_CODEC_FRAME_SIZE_MAX (AUDIO_CODEC_FRAME_SIZE_MAX / 8)
|
||||
#define NODE_COUNT_MAX DRC_CODEC_FRAME_SIZE_MAX
|
||||
#define CHANNEL_GROUP_COUNT_MAX SEQUENCE_COUNT_MAX
|
||||
#define SUB_DRC_COUNT 4
|
||||
#define SEL_DRC_COUNT 3
|
||||
#define DOWNMIX_ID_COUNT_MAX 8
|
||||
#define MAX_SIGNAL_DELAY 4500
|
||||
|
||||
#define SPEAKER_POS_COUNT_MAX 128
|
||||
#define DOWNMIX_COEFF_COUNT_MAX 32*32
|
||||
#define MAX_CHANNEL_COUNT 128
|
||||
#define BAND_COUNT_MAX 8
|
||||
#define SEQUENCE_COUNT_MAX 24
|
||||
#define GAIN_SET_COUNT_MAX SEQUENCE_COUNT_MAX
|
||||
#define MEASUREMENT_COUNT_MAX 16
|
||||
#define DOWNMIX_INSTRUCTION_COUNT_MAX 16
|
||||
#define DRC_COEFF_COUNT_MAX 8
|
||||
#define DRC_INSTRUCTIONS_COUNT_MAX (DOWNMIX_INSTRUCTION_COUNT_MAX + 20)
|
||||
#define LOUDNESS_INFO_COUNT_MAX (DOWNMIX_INSTRUCTION_COUNT_MAX + 20)
|
||||
#define AUDIO_CODEC_FRAME_SIZE_MAX 4096
|
||||
#define DRC_CODEC_FRAME_SIZE_MAX (AUDIO_CODEC_FRAME_SIZE_MAX/8)
|
||||
#define NODE_COUNT_MAX DRC_CODEC_FRAME_SIZE_MAX
|
||||
#define CHANNEL_GROUP_COUNT_MAX SEQUENCE_COUNT_MAX
|
||||
#define SUB_DRC_COUNT 4
|
||||
#define SEL_DRC_COUNT 3
|
||||
#define DOWNMIX_ID_COUNT_MAX 8
|
||||
#define MAX_SIGNAL_DELAY 4500
|
||||
|
||||
#define DRC_BAND_COUNT_MAX BAND_COUNT_MAX
|
||||
#define SPLIT_CHARACTERISTIC_COUNT_MAX 8
|
||||
#define GAIN_SET_COUNT_MAX SEQUENCE_COUNT_MAX
|
||||
#define SHAPE_FILTER_COUNT_MAX 8
|
||||
#define DRC_SET_ID_COUNT_MAX 16
|
||||
#define EQ_SET_ID_COUNT_MAX 8
|
||||
#define DRC_BAND_COUNT_MAX BAND_COUNT_MAX
|
||||
#define SPLIT_CHARACTERISTIC_COUNT_MAX 8
|
||||
#define GAIN_SET_COUNT_MAX SEQUENCE_COUNT_MAX
|
||||
#define SHAPE_FILTER_COUNT_MAX 8
|
||||
#define DRC_SET_ID_COUNT_MAX 16
|
||||
#define EQ_SET_ID_COUNT_MAX 8
|
||||
#define LOUD_EQ_GAIN_SEQUENCE_COUNT_MAX 4
|
||||
#define FILTER_ELEMENT_COUNT_MAX 16
|
||||
#define REAL_ZERO_RADIUS_ONE_COUNT_MAX 14
|
||||
#define REAL_ZERO_COUNT_MAX 64
|
||||
#define COMPLEX_ZERO_COUNT_MAX 64
|
||||
#define REAL_POLE_COUNT_MAX 16
|
||||
#define COMPLEX_POLE_COUNT_MAX 16
|
||||
#define FIR_ORDER_MAX 128
|
||||
#define EQ_NODE_COUNT_MAX 33
|
||||
#define EQ_SUBBAND_GAIN_COUNT_MAX 135
|
||||
#define UNIQUE_SUBBAND_GAIN_COUNT_MAX 16
|
||||
#define FILTER_BLOCK_COUNT_MAX 16
|
||||
#define FILTER_ELEMENT_COUNT_MAX 16
|
||||
#define UNIQUE_SUBBAND_GAINS_COUNT_MAX 8
|
||||
#define EQ_CHANNEL_GROUP_COUNT_MAX 4
|
||||
#define EQ_FILTER_BLOCK_COUNT_MAX 4
|
||||
#define LOUD_EQ_INSTRUCTIONS_COUNT_MAX 8
|
||||
#define EQ_INSTRUCTIONS_COUNT_MAX 8
|
||||
#define SELECTED_EQ_SET_COUNT_MAX 2
|
||||
#define SUB_EQ_COUNT 2
|
||||
#define FILTER_ELEMENT_COUNT_MAX 16
|
||||
#define REAL_ZERO_RADIUS_ONE_COUNT_MAX 14
|
||||
#define REAL_ZERO_COUNT_MAX 64
|
||||
#define COMPLEX_ZERO_COUNT_MAX 64
|
||||
#define REAL_POLE_COUNT_MAX 16
|
||||
#define COMPLEX_POLE_COUNT_MAX 16
|
||||
#define FIR_ORDER_MAX 128
|
||||
#define EQ_NODE_COUNT_MAX 33
|
||||
#define EQ_SUBBAND_GAIN_COUNT_MAX 135
|
||||
#define UNIQUE_SUBBAND_GAIN_COUNT_MAX 16
|
||||
#define FILTER_BLOCK_COUNT_MAX 16
|
||||
#define FILTER_ELEMENT_COUNT_MAX 16
|
||||
#define UNIQUE_SUBBAND_GAINS_COUNT_MAX 8
|
||||
#define EQ_CHANNEL_GROUP_COUNT_MAX 4
|
||||
#define EQ_FILTER_BLOCK_COUNT_MAX 4
|
||||
#define LOUD_EQ_INSTRUCTIONS_COUNT_MAX 8
|
||||
#define EQ_INSTRUCTIONS_COUNT_MAX 8
|
||||
#define SELECTED_EQ_SET_COUNT_MAX 2
|
||||
#define SUB_EQ_COUNT 2
|
||||
|
||||
#define DELAY_MODE_REGULAR_DELAY 0
|
||||
#define DELAY_MODE_LOW_DELAY 1
|
||||
#define DELAY_MODE_DEFAULT DELAY_MODE_REGULAR_DELAY
|
||||
#define DELAY_MODE_REGULAR_DELAY 0
|
||||
#define DELAY_MODE_LOW_DELAY 1
|
||||
#define DELAY_MODE_DEFAULT DELAY_MODE_REGULAR_DELAY
|
||||
|
||||
#define FEATURE_REQUEST_COUNT_MAX 10
|
||||
#define EFFECT_TYPE_REQUEST_COUNT_MAX 10
|
||||
#define FEATURE_REQUEST_COUNT_MAX 10
|
||||
#define EFFECT_TYPE_REQUEST_COUNT_MAX 10
|
||||
|
||||
#define SELECTION_CANDIDATE_COUNT_MAX 32
|
||||
#define SELECTION_CANDIDATE_COUNT_MAX 32
|
||||
|
||||
#define PROC_COMPLETE 1
|
||||
#define UNEXPECTED_ERROR 2
|
||||
#define PARAM_ERROR 3
|
||||
#define EXTERNAL_ERROR 4
|
||||
#define ERRORHANDLING 5
|
||||
#define BITSTREAM_ERROR 6
|
||||
#define PROC_COMPLETE 1
|
||||
#define UNEXPECTED_ERROR 2
|
||||
#define PARAM_ERROR 3
|
||||
#define EXTERNAL_ERROR 4
|
||||
#define ERRORHANDLING 5
|
||||
#define BITSTREAM_ERROR 6
|
||||
|
||||
#define UNDEFINED_LOUDNESS_VALUE 1000.0f
|
||||
#define ID_FOR_BASE_LAYOUT 0x0
|
||||
#define ID_FOR_ANY_DOWNMIX 0x7F
|
||||
#define ID_FOR_NO_DRC 0x0
|
||||
#define ID_FOR_ANY_DRC 0x3F
|
||||
#define ID_FOR_ANY_EQ 0x3F
|
||||
#define UNDEFINED_LOUDNESS_VALUE 1000.0f
|
||||
#define ID_FOR_BASE_LAYOUT 0x0
|
||||
#define ID_FOR_ANY_DOWNMIX 0x7F
|
||||
#define ID_FOR_NO_DRC 0x0
|
||||
#define ID_FOR_ANY_DRC 0x3F
|
||||
#define ID_FOR_ANY_EQ 0x3F
|
||||
|
||||
#define LOCATION_MP4_INSTREAM_UNIDRC 0x1
|
||||
#define LOCATION_MP4_DYN_RANGE_INFO 0x2
|
||||
#define LOCATION_MP4_COMPRESSION_VALUE 0x3
|
||||
#define LOCATION_SELECTED LOCATION_MP4_INSTREAM_UNIDRC
|
||||
#define LOCATION_MP4_INSTREAM_UNIDRC 0x1
|
||||
#define LOCATION_MP4_DYN_RANGE_INFO 0x2
|
||||
#define LOCATION_MP4_COMPRESSION_VALUE 0x3
|
||||
#define LOCATION_SELECTED LOCATION_MP4_INSTREAM_UNIDRC
|
||||
|
||||
#define AUDIO_CODEC_SUBBAND_COUNT_MAX 256
|
||||
#define AUDIO_CODEC_SUBBAND_COUNT_MAX 256
|
||||
|
||||
#define SUBBAND_DOMAIN_MODE_OFF 0
|
||||
#define SUBBAND_DOMAIN_MODE_QMF64 1
|
||||
#define SUBBAND_DOMAIN_MODE_QMF71 2
|
||||
#define SUBBAND_DOMAIN_MODE_STFT256 3
|
||||
#define SUBBAND_DOMAIN_MODE_OFF 0
|
||||
#define SUBBAND_DOMAIN_MODE_QMF64 1
|
||||
#define SUBBAND_DOMAIN_MODE_QMF71 2
|
||||
#define SUBBAND_DOMAIN_MODE_STFT256 3
|
||||
|
||||
#define AUDIO_CODEC_SUBBAND_COUNT_QMF64 64
|
||||
#define AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF64 64
|
||||
#define AUDIO_CODEC_SUBBAND_ANALYSE_DELAY_QMF64 320
|
||||
#define AUDIO_CODEC_SUBBAND_COUNT_QMF64 64
|
||||
#define AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF64 64
|
||||
#define AUDIO_CODEC_SUBBAND_ANALYSE_DELAY_QMF64 320
|
||||
|
||||
#define AUDIO_CODEC_SUBBAND_COUNT_QMF71 71
|
||||
#define AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF71 64
|
||||
#define AUDIO_CODEC_SUBBAND_ANALYSE_DELAY_QMF71 320+384
|
||||
#define AUDIO_CODEC_SUBBAND_COUNT_QMF71 71
|
||||
#define AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF71 64
|
||||
#define AUDIO_CODEC_SUBBAND_ANALYSE_DELAY_QMF71 320 + 384
|
||||
|
||||
#define AUDIO_CODEC_SUBBAND_COUNT_STFT256 256
|
||||
#define AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_STFT256 256
|
||||
#define AUDIO_CODEC_SUBBAND_ANALYSE_DELAY_STFT256 256
|
||||
#define AUDIO_CODEC_SUBBAND_COUNT_STFT256 256
|
||||
#define AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_STFT256 256
|
||||
#define AUDIO_CODEC_SUBBAND_ANALYSE_DELAY_STFT256 256
|
||||
|
||||
#define MAX_NUM_DOWNMIX_ID_REQUESTS 15
|
||||
#define MAX_NUM_DRC_FEATURE_REQUESTS 7
|
||||
#define MAX_NUM_DRC_EFFECT_TYPE_REQUESTS 15
|
||||
#define MAX_NUM_DOWNMIX_ID_REQUESTS 15
|
||||
#define MAX_NUM_DRC_FEATURE_REQUESTS 7
|
||||
#define MAX_NUM_DRC_EFFECT_TYPE_REQUESTS 15
|
||||
#define MAX_SIGNATURE_DATA_LENGTH_PLUS_ONE 256
|
||||
|
||||
#define EXT_COUNT_MAX 2
|
||||
#define UNIDRCGAINEXT_TERM 0x0
|
||||
#define UNIDRCLOUDEXT_TERM 0x0
|
||||
#define UNIDRCCONFEXT_TERM 0x0
|
||||
#define UNIDRCINTERFACEEXT_TERM 0x0
|
||||
#define EXT_COUNT_MAX 2
|
||||
#define UNIDRCGAINEXT_TERM 0x0
|
||||
#define UNIDRCLOUDEXT_TERM 0x0
|
||||
#define UNIDRCCONFEXT_TERM 0x0
|
||||
#define UNIDRCINTERFACEEXT_TERM 0x0
|
||||
|
||||
|
||||
#define UNIDRCCONFEXT_PARAM_DRC 0x1
|
||||
#define UNIDRCCONFEXT_PARAM_DRC 0x1
|
||||
|
||||
#define PARAM_DRC_INSTRUCTIONS_COUNT_MAX 8
|
||||
#define PARAM_DRC_INSTANCE_COUNT_MAX 8
|
||||
#define PARAM_DRC_INSTANCE_COUNT_MAX 8
|
||||
|
||||
#define PARAM_DRC_TYPE_FF 0x0
|
||||
#define PARAM_DRC_TYPE_FF 0x0
|
||||
#define PARAM_DRC_TYPE_FF_NODE_COUNT_MAX 9
|
||||
#define PARAM_DRC_TYPE_FF_LEVEL_ESTIM_FRAME_COUNT_MAX 64
|
||||
|
||||
#define PARAM_DRC_TYPE_LIM 0x1
|
||||
#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 PARAM_DRC_TYPE_LIM 0x1
|
||||
#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 UNIDRCCONFEXT_V1 0x2
|
||||
#define UNIDRCLOUDEXT_EQ 0x1
|
||||
#define UNIDRCINTERFACEEXT_EQ 0x1
|
||||
|
||||
#define UNIDRCCONFEXT_V1 0x2
|
||||
#define UNIDRCLOUDEXT_EQ 0x1
|
||||
#define UNIDRCINTERFACEEXT_EQ 0x1
|
||||
#define LOUD_EQ_REQUEST_OFF 0x0
|
||||
#define LOUD_EQ_REQUEST_LIGHT 0x1
|
||||
#define LOUD_EQ_REQUEST_REGULAR 0x2
|
||||
#define LOUD_EQ_REQUEST_HEAVY 0x3
|
||||
|
||||
#define LOUD_EQ_REQUEST_OFF 0x0
|
||||
#define LOUD_EQ_REQUEST_LIGHT 0x1
|
||||
#define LOUD_EQ_REQUEST_REGULAR 0x2
|
||||
#define LOUD_EQ_REQUEST_HEAVY 0x3
|
||||
#define EQ_PURPOSE_EQ_OFF 0
|
||||
#define EQ_PURPOSE_DEFAULT (1 << 0)
|
||||
#define EQ_PURPOSE_LARGE_ROOM (1 << 1)
|
||||
#define EQ_PURPOSE_SMALL_SPACE (1 << 2)
|
||||
#define EQ_PURPOSE_AVERAGE_ROOM (1 << 3)
|
||||
#define EQ_PURPOSE_CAR_CABIN (1 << 4)
|
||||
#define EQ_PURPOSE_HEADPHONES (1 << 5)
|
||||
#define EQ_PURPOSE_LATE_NIGHT (1 << 6)
|
||||
|
||||
#define EQ_PURPOSE_EQ_OFF 0
|
||||
#define EQ_PURPOSE_DEFAULT (1<<0)
|
||||
#define EQ_PURPOSE_LARGE_ROOM (1<<1)
|
||||
#define EQ_PURPOSE_SMALL_SPACE (1<<2)
|
||||
#define EQ_PURPOSE_AVERAGE_ROOM (1<<3)
|
||||
#define EQ_PURPOSE_CAR_CABIN (1<<4)
|
||||
#define EQ_PURPOSE_HEADPHONES (1<<5)
|
||||
#define EQ_PURPOSE_LATE_NIGHT (1<<6)
|
||||
#define MAXPACKETLOSSTIME 2.5f
|
||||
|
||||
|
||||
|
||||
#define MAXPACKETLOSSTIME 2.5f
|
||||
|
||||
#define SLOPE_FACTOR_DB_TO_LINEAR 0.1151f
|
||||
#define SLOPE_FACTOR_DB_TO_LINEAR 0.1151f
|
||||
|
||||
#ifndef min
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
|
|
@ -188,31 +182,29 @@ extern "C"
|
|||
#define bool WORD32
|
||||
#endif
|
||||
|
||||
typedef struct ia_drc_sel_proc_output_struct
|
||||
{
|
||||
FLOAT32 output_peak_level_db;
|
||||
FLOAT32 loudness_normalization_gain_db;
|
||||
FLOAT32 output_loudness;
|
||||
typedef struct ia_drc_sel_proc_output_struct {
|
||||
FLOAT32 output_peak_level_db;
|
||||
FLOAT32 loudness_normalization_gain_db;
|
||||
FLOAT32 output_loudness;
|
||||
|
||||
WORD32 sel_drc_set_ids[SUB_DRC_COUNT];
|
||||
WORD32 sel_downmix_ids[SUB_DRC_COUNT];
|
||||
WORD32 num_sel_drc_sets;
|
||||
WORD32 sel_drc_set_ids[SUB_DRC_COUNT];
|
||||
WORD32 sel_downmix_ids[SUB_DRC_COUNT];
|
||||
WORD32 num_sel_drc_sets;
|
||||
|
||||
WORD32 active_downmix_id;
|
||||
WORD32 base_channel_count;
|
||||
WORD32 target_channel_count;
|
||||
WORD32 target_layout;
|
||||
WORD32 downmix_matrix_present;
|
||||
FLOAT32 downmix_matrix[MAX_CHANNEL_COUNT][MAX_CHANNEL_COUNT];
|
||||
WORD32 active_downmix_id;
|
||||
WORD32 base_channel_count;
|
||||
WORD32 target_channel_count;
|
||||
WORD32 target_layout;
|
||||
WORD32 downmix_matrix_present;
|
||||
FLOAT32 downmix_matrix[MAX_CHANNEL_COUNT][MAX_CHANNEL_COUNT];
|
||||
|
||||
FLOAT32 boost;
|
||||
FLOAT32 compress;
|
||||
WORD32 drc_characteristic_target;
|
||||
FLOAT32 boost;
|
||||
FLOAT32 compress;
|
||||
WORD32 drc_characteristic_target;
|
||||
|
||||
|
||||
FLOAT32 mixing_level;
|
||||
WORD32 sel_eq_set_ids[SELECTED_EQ_SET_COUNT_MAX];
|
||||
WORD32 sel_loud_eq_id;
|
||||
FLOAT32 mixing_level;
|
||||
WORD32 sel_eq_set_ids[SELECTED_EQ_SET_COUNT_MAX];
|
||||
WORD32 sel_loud_eq_id;
|
||||
} ia_drc_sel_proc_output_struct;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -21,25 +21,24 @@
|
|||
#ifndef IMPD_DRC_CONFIG_PARAMS_H
|
||||
#define IMPD_DRC_CONFIG_PARAMS_H
|
||||
|
||||
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_PCM_WDSZ 0x0000
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_SAMP_FREQ 0x0001
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_NUM_CHANNELS 0x0002
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_DEC_TYPE 0x0003
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_PEAK_LIMITER 0x0004
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_CTRL_PARAM 0x0005
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_VER_MODE 0x0006
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_BITS_FORMAT 0x0007
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_INT_PRESENT 0x0008
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_DELAY_MODE 0x0009
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_GAIN_DELAY 0x000A
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_AUDIO_DELAY 0x000B
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_CON_DELAY_MODE 0x000C
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_ABSO_DELAY_OFF 0x000D
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_FRAME_SIZE 0x000E
|
||||
#define IA_DRC_DEC_CONFIG_PROC_OUT_PTR 0x000F
|
||||
#define IA_DRC_DEC_CONFIG_GAIN_STREAM_FLAG 0x0010
|
||||
#define IA_DRC_DEC_CONFIG_DRC_EFFECT_TYPE 0x0011
|
||||
#define IA_DRC_DEC_CONFIG_DRC_TARGET_LOUDNESS 0x0012
|
||||
#define IA_DRC_DEC_CONFIG_DRC_LOUD_NORM 0x0013
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_PCM_WDSZ 0x0000
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_SAMP_FREQ 0x0001
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_NUM_CHANNELS 0x0002
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_DEC_TYPE 0x0003
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_PEAK_LIMITER 0x0004
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_CTRL_PARAM 0x0005
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_VER_MODE 0x0006
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_BITS_FORMAT 0x0007
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_INT_PRESENT 0x0008
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_DELAY_MODE 0x0009
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_GAIN_DELAY 0x000A
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_AUDIO_DELAY 0x000B
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_CON_DELAY_MODE 0x000C
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_ABSO_DELAY_OFF 0x000D
|
||||
#define IA_DRC_DEC_CONFIG_PARAM_FRAME_SIZE 0x000E
|
||||
#define IA_DRC_DEC_CONFIG_PROC_OUT_PTR 0x000F
|
||||
#define IA_DRC_DEC_CONFIG_GAIN_STREAM_FLAG 0x0010
|
||||
#define IA_DRC_DEC_CONFIG_DRC_EFFECT_TYPE 0x0011
|
||||
#define IA_DRC_DEC_CONFIG_DRC_TARGET_LOUDNESS 0x0012
|
||||
#define IA_DRC_DEC_CONFIG_DRC_LOUD_NORM 0x0013
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -27,352 +27,341 @@
|
|||
#include "impd_drc_filter_bank.h"
|
||||
#include "impd_drc_multi_band.h"
|
||||
|
||||
WORD32 impd_init_drc_params(WORD32 frame_size, WORD32 sample_rate,
|
||||
WORD32 gain_delay_samples, WORD32 delay_mode,
|
||||
WORD32 sub_band_domain_mode,
|
||||
ia_drc_params_struct* ia_drc_params_struct) {
|
||||
WORD32 k;
|
||||
if (frame_size < 1 || frame_size > AUDIO_CODEC_FRAME_SIZE_MAX) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
WORD32 impd_init_drc_params(WORD32 frame_size,
|
||||
WORD32 sample_rate,
|
||||
WORD32 gain_delay_samples,
|
||||
WORD32 delay_mode,
|
||||
WORD32 sub_band_domain_mode,
|
||||
ia_drc_params_struct* ia_drc_params_struct)
|
||||
{
|
||||
WORD32 k;
|
||||
if (frame_size < 1|| frame_size > AUDIO_CODEC_FRAME_SIZE_MAX)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (sample_rate < 1000) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (sample_rate < 1000)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
ia_drc_params_struct->drc_frame_size = frame_size;
|
||||
|
||||
ia_drc_params_struct->drc_frame_size = frame_size;
|
||||
if (ia_drc_params_struct->drc_frame_size < 0.001f * sample_rate) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ia_drc_params_struct->drc_frame_size < 0.001f * sample_rate)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
ia_drc_params_struct->sample_rate = sample_rate;
|
||||
|
||||
ia_drc_params_struct->sample_rate = sample_rate;
|
||||
ia_drc_params_struct->delta_tmin_default = impd_get_delta_tmin(sample_rate);
|
||||
|
||||
ia_drc_params_struct->delta_tmin_default = impd_get_delta_tmin(sample_rate);
|
||||
if (ia_drc_params_struct->delta_tmin_default >
|
||||
ia_drc_params_struct->drc_frame_size) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ia_drc_params_struct->delta_tmin_default > ia_drc_params_struct->drc_frame_size)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if ((delay_mode != DELAY_MODE_REGULAR_DELAY) &&
|
||||
(delay_mode != DELAY_MODE_LOW_DELAY)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((delay_mode != DELAY_MODE_REGULAR_DELAY) && (delay_mode != DELAY_MODE_LOW_DELAY))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
ia_drc_params_struct->delay_mode = delay_mode;
|
||||
|
||||
ia_drc_params_struct->delay_mode = delay_mode;
|
||||
ia_drc_params_struct->drc_set_counter = 0;
|
||||
ia_drc_params_struct->multiband_sel_drc_idx = -1;
|
||||
|
||||
ia_drc_params_struct->drc_set_counter = 0;
|
||||
ia_drc_params_struct->multiband_sel_drc_idx = -1;
|
||||
for (k = 0; k < SEL_DRC_COUNT; k++) {
|
||||
ia_drc_params_struct->sel_drc_array[k].drc_instructions_index = -1;
|
||||
ia_drc_params_struct->sel_drc_array[k].dwnmix_instructions_index = -1;
|
||||
ia_drc_params_struct->sel_drc_array[k].drc_coeff_idx = -1;
|
||||
}
|
||||
|
||||
for (k = 0; k < SEL_DRC_COUNT; k++)
|
||||
{
|
||||
ia_drc_params_struct->sel_drc_array[k].drc_instructions_index = -1;
|
||||
ia_drc_params_struct->sel_drc_array[k].dwnmix_instructions_index = -1;
|
||||
ia_drc_params_struct->sel_drc_array[k].drc_coeff_idx = -1;
|
||||
}
|
||||
if ((gain_delay_samples > MAX_SIGNAL_DELAY) || (gain_delay_samples < 0)) {
|
||||
return -1;
|
||||
} else {
|
||||
ia_drc_params_struct->gain_delay_samples = gain_delay_samples;
|
||||
}
|
||||
|
||||
if ((gain_delay_samples > MAX_SIGNAL_DELAY) || (gain_delay_samples < 0))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ia_drc_params_struct->gain_delay_samples = gain_delay_samples;
|
||||
}
|
||||
|
||||
switch (sub_band_domain_mode)
|
||||
{
|
||||
switch (sub_band_domain_mode) {
|
||||
case SUBBAND_DOMAIN_MODE_OFF:
|
||||
case SUBBAND_DOMAIN_MODE_QMF64:
|
||||
case SUBBAND_DOMAIN_MODE_QMF71:
|
||||
case SUBBAND_DOMAIN_MODE_STFT256:
|
||||
ia_drc_params_struct->sub_band_domain_mode = sub_band_domain_mode;
|
||||
break;
|
||||
ia_drc_params_struct->sub_band_domain_mode = sub_band_domain_mode;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
|
||||
ia_drc_params_struct->parametric_drc_delay = 0;
|
||||
ia_drc_params_struct->eq_delay = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
WORD32 impd_select_drc_coefficients(
|
||||
ia_drc_config* drc_config, ia_uni_drc_coeffs_struct** drc_coefficients_drc,
|
||||
WORD32* drc_coefficients_selected) {
|
||||
WORD32 i;
|
||||
WORD32 cof1 = -1;
|
||||
WORD32 cof0 = -1;
|
||||
for (i = 0; i < drc_config->drc_coefficients_drc_count; i++) {
|
||||
if (drc_config->str_p_loc_drc_coefficients_uni_drc[i].drc_location == 1) {
|
||||
if (drc_config->str_p_loc_drc_coefficients_uni_drc[i].version == 0) {
|
||||
cof0 = i;
|
||||
*drc_coefficients_selected = cof0;
|
||||
} else {
|
||||
cof1 = i;
|
||||
*drc_coefficients_selected = cof1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cof1 >= 0) {
|
||||
*drc_coefficients_drc =
|
||||
&(drc_config->str_p_loc_drc_coefficients_uni_drc[cof1]);
|
||||
} else if (cof0 >= 0) {
|
||||
*drc_coefficients_drc =
|
||||
&(drc_config->str_p_loc_drc_coefficients_uni_drc[cof0]);
|
||||
} else {
|
||||
*drc_coefficients_drc = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
WORD32 impd_init_selected_drc_set(
|
||||
ia_drc_config* drc_config, ia_drc_params_struct* ia_drc_params_struct,
|
||||
ia_parametric_drc_params_struct* p_parametric_drc_params,
|
||||
WORD32 audio_num_chan, WORD32 drc_set_id_selected,
|
||||
WORD32 downmix_id_selected, ia_filter_banks_struct* ia_filter_banks_struct,
|
||||
ia_overlap_params_struct* pstr_overlap_params
|
||||
|
||||
,
|
||||
shape_filter_block* shape_filter_block) {
|
||||
WORD32 g, n, c, err = 0;
|
||||
WORD32 channel_count = 0;
|
||||
WORD32 i;
|
||||
|
||||
ia_drc_instructions_struct* drc_instructions_uni_drc = NULL;
|
||||
ia_uni_drc_coeffs_struct* drc_coefficients_uni_drc = NULL;
|
||||
WORD32 selected_drc_is_multiband = 0;
|
||||
WORD32 drc_instructions_selected = -1;
|
||||
WORD32 downmix_instructions_selected = -1;
|
||||
WORD32 drc_coefficients_selected = -1;
|
||||
p_parametric_drc_params->parametric_drc_instance_count = 0;
|
||||
|
||||
if (drc_config->drc_coefficients_drc_count &&
|
||||
drc_config->str_p_loc_drc_coefficients_uni_drc->drc_frame_size_present) {
|
||||
if (drc_config->str_p_loc_drc_coefficients_uni_drc->drc_frame_size !=
|
||||
ia_drc_params_struct->drc_frame_size) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
for (n = 0; n < drc_config->drc_instructions_count_plus; n++) {
|
||||
if (drc_config->str_drc_instruction_str[n].drc_set_id ==
|
||||
drc_set_id_selected)
|
||||
break;
|
||||
}
|
||||
if (n == drc_config->drc_instructions_count_plus) {
|
||||
return -1;
|
||||
}
|
||||
drc_instructions_selected = n;
|
||||
drc_instructions_uni_drc =
|
||||
&(drc_config->str_drc_instruction_str[drc_instructions_selected]);
|
||||
|
||||
if (downmix_id_selected == ID_FOR_BASE_LAYOUT) {
|
||||
channel_count = drc_config->channel_layout.base_channel_count;
|
||||
} else if (downmix_id_selected == ID_FOR_ANY_DOWNMIX) {
|
||||
channel_count = audio_num_chan;
|
||||
} else {
|
||||
for (n = 0; n < drc_config->dwnmix_instructions_count; n++) {
|
||||
if (drc_config->dwnmix_instructions[n].downmix_id == downmix_id_selected)
|
||||
break;
|
||||
}
|
||||
if (n == drc_config->dwnmix_instructions_count) {
|
||||
return (UNEXPECTED_ERROR);
|
||||
}
|
||||
channel_count = drc_config->dwnmix_instructions[n].target_channel_count;
|
||||
|
||||
ia_drc_params_struct->parametric_drc_delay = 0;
|
||||
ia_drc_params_struct->eq_delay = 0;
|
||||
downmix_instructions_selected = n;
|
||||
}
|
||||
drc_instructions_uni_drc->audio_num_chan = channel_count;
|
||||
|
||||
return 0;
|
||||
}
|
||||
if (drc_instructions_uni_drc->drc_set_id <= 0) {
|
||||
drc_coefficients_selected = 0;
|
||||
} else {
|
||||
err = impd_select_drc_coefficients(drc_config, &drc_coefficients_uni_drc,
|
||||
&drc_coefficients_selected);
|
||||
}
|
||||
|
||||
ia_drc_params_struct->sel_drc_array[ia_drc_params_struct->drc_set_counter]
|
||||
.drc_instructions_index = drc_instructions_selected;
|
||||
ia_drc_params_struct->sel_drc_array[ia_drc_params_struct->drc_set_counter]
|
||||
.dwnmix_instructions_index = downmix_instructions_selected;
|
||||
ia_drc_params_struct->sel_drc_array[ia_drc_params_struct->drc_set_counter]
|
||||
.drc_coeff_idx = drc_coefficients_selected;
|
||||
|
||||
WORD32 impd_select_drc_coefficients(ia_drc_config* drc_config,
|
||||
ia_uni_drc_coeffs_struct** drc_coefficients_drc,
|
||||
WORD32* drc_coefficients_selected)
|
||||
{
|
||||
WORD32 i;
|
||||
WORD32 cof1 = -1;
|
||||
WORD32 cof0 = -1;
|
||||
for(i=0; i<drc_config->drc_coefficients_drc_count; i++)
|
||||
{
|
||||
if (drc_config->str_p_loc_drc_coefficients_uni_drc[i].drc_location == 1)
|
||||
{
|
||||
if (drc_config->str_p_loc_drc_coefficients_uni_drc[i].version == 0)
|
||||
{
|
||||
cof0 = i;
|
||||
*drc_coefficients_selected = cof0;
|
||||
}
|
||||
else
|
||||
{
|
||||
cof1 = i;
|
||||
*drc_coefficients_selected = cof1;
|
||||
}
|
||||
if ((drc_instructions_uni_drc->downmix_id[0] == ID_FOR_ANY_DOWNMIX) ||
|
||||
(drc_instructions_uni_drc->dwnmix_id_count > 1)) {
|
||||
WORD32 idx = drc_instructions_uni_drc->gain_set_index[0];
|
||||
for (c = 0; c < drc_instructions_uni_drc->audio_num_chan; c++) {
|
||||
drc_instructions_uni_drc->channel_group_of_ch[c] = (idx >= 0) ? 0 : -1;
|
||||
}
|
||||
}
|
||||
|
||||
for (g = 0; g < drc_instructions_uni_drc->num_drc_ch_groups; g++) {
|
||||
drc_instructions_uni_drc->num_chan_per_ch_group[g] = 0;
|
||||
for (c = 0; c < drc_instructions_uni_drc->audio_num_chan; c++) {
|
||||
if (drc_instructions_uni_drc->channel_group_of_ch[c] == g) {
|
||||
drc_instructions_uni_drc->num_chan_per_ch_group[g]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (drc_instructions_uni_drc->drc_set_effect &
|
||||
(EFFECT_BIT_DUCK_OTHER | EFFECT_BIT_DUCK_SELF)) {
|
||||
drc_instructions_uni_drc->multiband_audio_sig_count =
|
||||
drc_instructions_uni_drc->audio_num_chan;
|
||||
} else {
|
||||
drc_instructions_uni_drc->multiband_audio_sig_count = 0;
|
||||
for (c = 0; c < drc_instructions_uni_drc->audio_num_chan; c++) {
|
||||
g = drc_instructions_uni_drc->channel_group_of_ch[c];
|
||||
if (g < 0) {
|
||||
drc_instructions_uni_drc->multiband_audio_sig_count++;
|
||||
} else {
|
||||
drc_instructions_uni_drc->multiband_audio_sig_count +=
|
||||
drc_instructions_uni_drc->band_count_of_ch_group[g];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (g = 0; g < drc_instructions_uni_drc->num_drc_ch_groups; g++) {
|
||||
if (g == 0) {
|
||||
drc_instructions_uni_drc->parametric_drc_look_ahead_samples_max = 0;
|
||||
}
|
||||
if (drc_instructions_uni_drc->ch_group_parametric_drc_flag[g] == 0) {
|
||||
if (drc_instructions_uni_drc->band_count_of_ch_group[g] > 1) {
|
||||
if (ia_drc_params_struct->multiband_sel_drc_idx != -1) {
|
||||
return (UNEXPECTED_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (cof1 >= 0) {
|
||||
*drc_coefficients_drc = &(drc_config->str_p_loc_drc_coefficients_uni_drc[cof1]);
|
||||
}
|
||||
else if (cof0 >= 0) {
|
||||
*drc_coefficients_drc = &(drc_config->str_p_loc_drc_coefficients_uni_drc[cof0]);
|
||||
}
|
||||
else {
|
||||
*drc_coefficients_drc = NULL;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
WORD32 impd_init_selected_drc_set(ia_drc_config* drc_config,
|
||||
ia_drc_params_struct* ia_drc_params_struct,
|
||||
ia_parametric_drc_params_struct* p_parametric_drc_params,
|
||||
WORD32 audio_num_chan,
|
||||
WORD32 drc_set_id_selected,
|
||||
WORD32 downmix_id_selected,
|
||||
ia_filter_banks_struct* ia_filter_banks_struct,
|
||||
ia_overlap_params_struct* pstr_overlap_params
|
||||
|
||||
, shape_filter_block* shape_filter_block
|
||||
)
|
||||
{
|
||||
WORD32 g, n, c, err = 0;
|
||||
WORD32 channel_count = 0;
|
||||
WORD32 i;
|
||||
|
||||
ia_drc_instructions_struct* drc_instructions_uni_drc = NULL;
|
||||
ia_uni_drc_coeffs_struct* drc_coefficients_uni_drc = NULL;
|
||||
WORD32 selected_drc_is_multiband = 0;
|
||||
WORD32 drc_instructions_selected = -1;
|
||||
WORD32 downmix_instructions_selected = -1;
|
||||
WORD32 drc_coefficients_selected = -1;
|
||||
p_parametric_drc_params->parametric_drc_instance_count = 0;
|
||||
|
||||
if (drc_config->drc_coefficients_drc_count && drc_config->str_p_loc_drc_coefficients_uni_drc->drc_frame_size_present)
|
||||
{
|
||||
if (drc_config->str_p_loc_drc_coefficients_uni_drc->drc_frame_size != ia_drc_params_struct->drc_frame_size)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(n=0; n<drc_config->drc_instructions_count_plus; n++)
|
||||
{
|
||||
if (drc_config->str_drc_instruction_str[n].drc_set_id == drc_set_id_selected)
|
||||
break;
|
||||
}
|
||||
if (n == drc_config->drc_instructions_count_plus)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
drc_instructions_selected = n;
|
||||
drc_instructions_uni_drc = &(drc_config->str_drc_instruction_str[drc_instructions_selected]);
|
||||
|
||||
if (downmix_id_selected == ID_FOR_BASE_LAYOUT)
|
||||
{
|
||||
channel_count = drc_config->channel_layout.base_channel_count;
|
||||
}
|
||||
else if (downmix_id_selected == ID_FOR_ANY_DOWNMIX)
|
||||
{
|
||||
channel_count = audio_num_chan;
|
||||
}
|
||||
else
|
||||
{
|
||||
for(n=0; n<drc_config->dwnmix_instructions_count; n++)
|
||||
{
|
||||
if (drc_config->dwnmix_instructions[n].downmix_id == downmix_id_selected)
|
||||
break;
|
||||
}
|
||||
if (n == drc_config->dwnmix_instructions_count)
|
||||
{
|
||||
return (UNEXPECTED_ERROR);
|
||||
}
|
||||
channel_count = drc_config->dwnmix_instructions[n].target_channel_count;
|
||||
|
||||
downmix_instructions_selected = n;
|
||||
}
|
||||
drc_instructions_uni_drc->audio_num_chan = channel_count;
|
||||
|
||||
if (drc_instructions_uni_drc->drc_set_id <= 0)
|
||||
{
|
||||
drc_coefficients_selected = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
err = impd_select_drc_coefficients(drc_config, &drc_coefficients_uni_drc, &drc_coefficients_selected);
|
||||
}
|
||||
|
||||
ia_drc_params_struct->sel_drc_array[ia_drc_params_struct->drc_set_counter].drc_instructions_index = drc_instructions_selected;
|
||||
ia_drc_params_struct->sel_drc_array[ia_drc_params_struct->drc_set_counter].dwnmix_instructions_index = downmix_instructions_selected;
|
||||
ia_drc_params_struct->sel_drc_array[ia_drc_params_struct->drc_set_counter].drc_coeff_idx = drc_coefficients_selected;
|
||||
|
||||
if ((drc_instructions_uni_drc->downmix_id[0] == ID_FOR_ANY_DOWNMIX) || (drc_instructions_uni_drc->dwnmix_id_count > 1))
|
||||
{
|
||||
WORD32 idx = drc_instructions_uni_drc->gain_set_index[0];
|
||||
for (c=0; c<drc_instructions_uni_drc->audio_num_chan; c++)
|
||||
{
|
||||
drc_instructions_uni_drc->channel_group_of_ch[c] = (idx >= 0) ? 0 : -1;
|
||||
}
|
||||
}
|
||||
|
||||
for (g=0; g<drc_instructions_uni_drc->num_drc_ch_groups; g++) {
|
||||
drc_instructions_uni_drc->num_chan_per_ch_group[g] = 0;
|
||||
for (c=0; c<drc_instructions_uni_drc->audio_num_chan; c++) {
|
||||
if (drc_instructions_uni_drc->channel_group_of_ch[c] == g) {
|
||||
drc_instructions_uni_drc->num_chan_per_ch_group[g]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (drc_instructions_uni_drc->drc_set_effect & (EFFECT_BIT_DUCK_OTHER | EFFECT_BIT_DUCK_SELF)) {
|
||||
drc_instructions_uni_drc->multiband_audio_sig_count = drc_instructions_uni_drc->audio_num_chan;
|
||||
selected_drc_is_multiband = 1;
|
||||
}
|
||||
} else {
|
||||
drc_instructions_uni_drc->multiband_audio_sig_count = 0;
|
||||
for (c=0; c<drc_instructions_uni_drc->audio_num_chan; c++) {
|
||||
g = drc_instructions_uni_drc->channel_group_of_ch[c];
|
||||
if (g < 0) {
|
||||
drc_instructions_uni_drc->multiband_audio_sig_count++;
|
||||
} else {
|
||||
drc_instructions_uni_drc->multiband_audio_sig_count += drc_instructions_uni_drc->band_count_of_ch_group[g];
|
||||
}
|
||||
}
|
||||
}
|
||||
WORD32 gain_set_index =
|
||||
drc_instructions_uni_drc->gain_set_idx_of_ch_group_parametric_drc[g];
|
||||
WORD32 parametric_drc_id =
|
||||
drc_config->str_drc_config_ext.str_drc_coeff_param_drc
|
||||
.str_parametric_drc_gain_set_params[gain_set_index]
|
||||
.parametric_drc_id;
|
||||
WORD32 parametric_drc_look_ahead_samples = 0;
|
||||
ia_parametric_drc_instructions_struct* str_parametric_drc_instructions;
|
||||
|
||||
for (g=0; g<drc_instructions_uni_drc->num_drc_ch_groups; g++)
|
||||
{
|
||||
if (g==0) {
|
||||
drc_instructions_uni_drc->parametric_drc_look_ahead_samples_max = 0;
|
||||
}
|
||||
if (drc_instructions_uni_drc->ch_group_parametric_drc_flag[g] == 0) {
|
||||
if (drc_instructions_uni_drc->band_count_of_ch_group[g] > 1)
|
||||
{
|
||||
if (ia_drc_params_struct->multiband_sel_drc_idx != -1)
|
||||
{
|
||||
return (UNEXPECTED_ERROR);
|
||||
}
|
||||
selected_drc_is_multiband = 1;
|
||||
}
|
||||
for (i = 0;
|
||||
i < drc_config->str_drc_config_ext.parametric_drc_instructions_count;
|
||||
i++) {
|
||||
if (parametric_drc_id ==
|
||||
drc_config->str_drc_config_ext.str_parametric_drc_instructions[i]
|
||||
.parametric_drc_id)
|
||||
break;
|
||||
}
|
||||
if (i ==
|
||||
drc_config->str_drc_config_ext.parametric_drc_instructions_count) {
|
||||
return (UNEXPECTED_ERROR);
|
||||
}
|
||||
str_parametric_drc_instructions =
|
||||
&drc_config->str_drc_config_ext.str_parametric_drc_instructions[i];
|
||||
|
||||
p_parametric_drc_params->parametric_drc_idx
|
||||
[p_parametric_drc_params->parametric_drc_instance_count] = i;
|
||||
p_parametric_drc_params->gain_set_index
|
||||
[p_parametric_drc_params->parametric_drc_instance_count] =
|
||||
gain_set_index;
|
||||
if (drc_instructions_uni_drc->drc_apply_to_dwnmix == 0) {
|
||||
p_parametric_drc_params->dwnmix_id_from_drc_instructions
|
||||
[p_parametric_drc_params->parametric_drc_instance_count] =
|
||||
ID_FOR_BASE_LAYOUT;
|
||||
} else {
|
||||
if (drc_instructions_uni_drc->dwnmix_id_count > 1) {
|
||||
p_parametric_drc_params->dwnmix_id_from_drc_instructions
|
||||
[p_parametric_drc_params->parametric_drc_instance_count] =
|
||||
ID_FOR_ANY_DOWNMIX;
|
||||
} else {
|
||||
WORD32 gain_set_index = drc_instructions_uni_drc->gain_set_idx_of_ch_group_parametric_drc[g];
|
||||
WORD32 parametric_drc_id = drc_config->str_drc_config_ext.str_drc_coeff_param_drc.str_parametric_drc_gain_set_params[gain_set_index].parametric_drc_id;
|
||||
WORD32 parametric_drc_look_ahead_samples = 0;
|
||||
ia_parametric_drc_instructions_struct* str_parametric_drc_instructions;
|
||||
|
||||
for(i=0; i<drc_config->str_drc_config_ext.parametric_drc_instructions_count; i++)
|
||||
{
|
||||
if (parametric_drc_id == drc_config->str_drc_config_ext.str_parametric_drc_instructions[i].parametric_drc_id) break;
|
||||
}
|
||||
if (i == drc_config->str_drc_config_ext.parametric_drc_instructions_count)
|
||||
{
|
||||
return (UNEXPECTED_ERROR);
|
||||
}
|
||||
str_parametric_drc_instructions = &drc_config->str_drc_config_ext.str_parametric_drc_instructions[i];
|
||||
|
||||
p_parametric_drc_params->parametric_drc_idx[p_parametric_drc_params->parametric_drc_instance_count] = i;
|
||||
p_parametric_drc_params->gain_set_index[p_parametric_drc_params->parametric_drc_instance_count] = gain_set_index;
|
||||
if (drc_instructions_uni_drc->drc_apply_to_dwnmix == 0) {
|
||||
p_parametric_drc_params->dwnmix_id_from_drc_instructions[p_parametric_drc_params->parametric_drc_instance_count] = ID_FOR_BASE_LAYOUT;
|
||||
} else {
|
||||
if (drc_instructions_uni_drc->dwnmix_id_count > 1) {
|
||||
p_parametric_drc_params->dwnmix_id_from_drc_instructions[p_parametric_drc_params->parametric_drc_instance_count] = ID_FOR_ANY_DOWNMIX;
|
||||
} else {
|
||||
p_parametric_drc_params->dwnmix_id_from_drc_instructions[p_parametric_drc_params->parametric_drc_instance_count] = drc_instructions_uni_drc->downmix_id[0];
|
||||
}
|
||||
}
|
||||
p_parametric_drc_params->audio_num_chan = channel_count;
|
||||
for (i=0; i<p_parametric_drc_params->audio_num_chan;i++) {
|
||||
if (drc_instructions_uni_drc->channel_group_of_ch[i] == g) {
|
||||
p_parametric_drc_params->channel_map[p_parametric_drc_params->parametric_drc_instance_count][i] = 1;
|
||||
} else {
|
||||
p_parametric_drc_params->channel_map[p_parametric_drc_params->parametric_drc_instance_count][i] = 0;
|
||||
}
|
||||
}
|
||||
drc_instructions_uni_drc->parametric_drc_look_ahead_samples[g] = 0;
|
||||
if (str_parametric_drc_instructions->parametric_drc_look_ahead_flag) {
|
||||
parametric_drc_look_ahead_samples = (WORD32)((FLOAT32)str_parametric_drc_instructions->parametric_drc_look_ahead*(FLOAT32)p_parametric_drc_params->sampling_rate*0.001f);
|
||||
} else {
|
||||
if (str_parametric_drc_instructions->parametric_drc_type == PARAM_DRC_TYPE_FF)
|
||||
{
|
||||
parametric_drc_look_ahead_samples = (WORD32)(10.0f*(FLOAT32)p_parametric_drc_params->sampling_rate*0.001f);
|
||||
}
|
||||
else if (str_parametric_drc_instructions->parametric_drc_type == PARAM_DRC_TYPE_LIM)
|
||||
{
|
||||
parametric_drc_look_ahead_samples = (WORD32)(5.0f*(FLOAT32)p_parametric_drc_params->sampling_rate*0.001f);
|
||||
} else
|
||||
{
|
||||
return (UNEXPECTED_ERROR);
|
||||
}
|
||||
}
|
||||
drc_instructions_uni_drc->parametric_drc_look_ahead_samples[g] = parametric_drc_look_ahead_samples;
|
||||
if (drc_instructions_uni_drc->parametric_drc_look_ahead_samples_max < drc_instructions_uni_drc->parametric_drc_look_ahead_samples[g])
|
||||
{
|
||||
drc_instructions_uni_drc->parametric_drc_look_ahead_samples_max = drc_instructions_uni_drc->parametric_drc_look_ahead_samples[g];
|
||||
}
|
||||
p_parametric_drc_params->parametric_drc_instance_count += 1;
|
||||
selected_drc_is_multiband = 0;
|
||||
p_parametric_drc_params->dwnmix_id_from_drc_instructions
|
||||
[p_parametric_drc_params->parametric_drc_instance_count] =
|
||||
drc_instructions_uni_drc->downmix_id[0];
|
||||
}
|
||||
}
|
||||
ia_drc_params_struct->parametric_drc_delay += drc_instructions_uni_drc->parametric_drc_look_ahead_samples_max;
|
||||
|
||||
if (selected_drc_is_multiband == 1)
|
||||
{
|
||||
ia_drc_params_struct->multiband_sel_drc_idx = ia_drc_params_struct->drc_set_counter;
|
||||
err = impd_init_all_filter_banks(drc_coefficients_uni_drc,
|
||||
&(drc_config->str_drc_instruction_str[drc_instructions_selected]),
|
||||
ia_filter_banks_struct);
|
||||
if (err)
|
||||
return (err);
|
||||
|
||||
err = impd_init_overlap_weight (drc_coefficients_uni_drc,
|
||||
&(drc_config->str_drc_instruction_str[drc_instructions_selected]),
|
||||
ia_drc_params_struct->sub_band_domain_mode,
|
||||
pstr_overlap_params);
|
||||
if (err)
|
||||
return (err);
|
||||
}
|
||||
else
|
||||
{
|
||||
ia_gain_modifiers_struct* gain_modifiers = drc_config->str_drc_instruction_str->str_gain_modifiers_of_ch_group;
|
||||
for (g=0; g<drc_instructions_uni_drc->num_drc_ch_groups; g++)
|
||||
{
|
||||
if (gain_modifiers[g].shape_filter_flag == 1)
|
||||
{
|
||||
impd_shape_filt_block_init(&drc_coefficients_uni_drc->str_shape_filter_block_params[gain_modifiers[g].shape_filter_idx],
|
||||
&shape_filter_block[g]);
|
||||
}
|
||||
else
|
||||
{
|
||||
shape_filter_block[g].shape_flter_block_flag = 0;
|
||||
}
|
||||
}
|
||||
p_parametric_drc_params->audio_num_chan = channel_count;
|
||||
for (i = 0; i < p_parametric_drc_params->audio_num_chan; i++) {
|
||||
if (drc_instructions_uni_drc->channel_group_of_ch[i] == g) {
|
||||
p_parametric_drc_params->channel_map
|
||||
[p_parametric_drc_params->parametric_drc_instance_count][i] = 1;
|
||||
} else {
|
||||
p_parametric_drc_params->channel_map
|
||||
[p_parametric_drc_params->parametric_drc_instance_count][i] = 0;
|
||||
}
|
||||
}
|
||||
drc_instructions_uni_drc->parametric_drc_look_ahead_samples[g] = 0;
|
||||
if (str_parametric_drc_instructions->parametric_drc_look_ahead_flag) {
|
||||
parametric_drc_look_ahead_samples = (WORD32)(
|
||||
(FLOAT32)
|
||||
str_parametric_drc_instructions->parametric_drc_look_ahead *
|
||||
(FLOAT32)p_parametric_drc_params->sampling_rate * 0.001f);
|
||||
} else {
|
||||
if (str_parametric_drc_instructions->parametric_drc_type ==
|
||||
PARAM_DRC_TYPE_FF) {
|
||||
parametric_drc_look_ahead_samples = (WORD32)(
|
||||
10.0f * (FLOAT32)p_parametric_drc_params->sampling_rate * 0.001f);
|
||||
} else if (str_parametric_drc_instructions->parametric_drc_type ==
|
||||
PARAM_DRC_TYPE_LIM) {
|
||||
parametric_drc_look_ahead_samples = (WORD32)(
|
||||
5.0f * (FLOAT32)p_parametric_drc_params->sampling_rate * 0.001f);
|
||||
} else {
|
||||
return (UNEXPECTED_ERROR);
|
||||
}
|
||||
}
|
||||
drc_instructions_uni_drc->parametric_drc_look_ahead_samples[g] =
|
||||
parametric_drc_look_ahead_samples;
|
||||
if (drc_instructions_uni_drc->parametric_drc_look_ahead_samples_max <
|
||||
drc_instructions_uni_drc->parametric_drc_look_ahead_samples[g]) {
|
||||
drc_instructions_uni_drc->parametric_drc_look_ahead_samples_max =
|
||||
drc_instructions_uni_drc->parametric_drc_look_ahead_samples[g];
|
||||
}
|
||||
p_parametric_drc_params->parametric_drc_instance_count += 1;
|
||||
selected_drc_is_multiband = 0;
|
||||
}
|
||||
}
|
||||
ia_drc_params_struct->parametric_drc_delay +=
|
||||
drc_instructions_uni_drc->parametric_drc_look_ahead_samples_max;
|
||||
|
||||
ia_drc_params_struct->drc_set_counter++;
|
||||
if (selected_drc_is_multiband == 1) {
|
||||
ia_drc_params_struct->multiband_sel_drc_idx =
|
||||
ia_drc_params_struct->drc_set_counter;
|
||||
err = impd_init_all_filter_banks(
|
||||
drc_coefficients_uni_drc,
|
||||
&(drc_config->str_drc_instruction_str[drc_instructions_selected]),
|
||||
ia_filter_banks_struct);
|
||||
if (err) return (err);
|
||||
|
||||
return (0);
|
||||
err = impd_init_overlap_weight(
|
||||
drc_coefficients_uni_drc,
|
||||
&(drc_config->str_drc_instruction_str[drc_instructions_selected]),
|
||||
ia_drc_params_struct->sub_band_domain_mode, pstr_overlap_params);
|
||||
if (err) return (err);
|
||||
} else {
|
||||
ia_gain_modifiers_struct* gain_modifiers =
|
||||
drc_config->str_drc_instruction_str->str_gain_modifiers_of_ch_group;
|
||||
for (g = 0; g < drc_instructions_uni_drc->num_drc_ch_groups; g++) {
|
||||
if (gain_modifiers[g].shape_filter_flag == 1) {
|
||||
impd_shape_filt_block_init(
|
||||
&drc_coefficients_uni_drc->str_shape_filter_block_params
|
||||
[gain_modifiers[g].shape_filter_idx],
|
||||
&shape_filter_block[g]);
|
||||
} else {
|
||||
shape_filter_block[g].shape_flter_block_flag = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ia_drc_params_struct->drc_set_counter++;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,35 +20,28 @@
|
|||
#ifndef IMPD_DRC_DEC_H
|
||||
#define IMPD_DRC_DEC_H
|
||||
|
||||
WORD32 impd_init_drc_params(WORD32 frame_size,
|
||||
WORD32 sample_rate,
|
||||
WORD32 gain_delay_samples,
|
||||
WORD32 delay_mode,
|
||||
WORD32 sub_band_domain_mode,
|
||||
ia_drc_params_struct* ia_drc_params_struct);
|
||||
WORD32 impd_init_drc_params(WORD32 frame_size, WORD32 sample_rate,
|
||||
WORD32 gain_delay_samples, WORD32 delay_mode,
|
||||
WORD32 sub_band_domain_mode,
|
||||
ia_drc_params_struct* ia_drc_params_struct);
|
||||
|
||||
WORD32 impd_init_selected_drc_set(
|
||||
ia_drc_config* drc_config, ia_drc_params_struct* ia_drc_params_struct,
|
||||
ia_parametric_drc_params_struct* p_parametricdrc_params,
|
||||
WORD32 audio_num_chan, WORD32 drc_set_id_selected,
|
||||
WORD32 downmix_id_selected, ia_filter_banks_struct* ia_filter_banks_struct,
|
||||
ia_overlap_params_struct* pstr_overlap_params
|
||||
|
||||
WORD32 impd_init_selected_drc_set(ia_drc_config* drc_config,
|
||||
ia_drc_params_struct* ia_drc_params_struct,
|
||||
ia_parametric_drc_params_struct* p_parametricdrc_params,
|
||||
WORD32 audio_num_chan,
|
||||
WORD32 drc_set_id_selected,
|
||||
WORD32 downmix_id_selected,
|
||||
ia_filter_banks_struct* ia_filter_banks_struct,
|
||||
ia_overlap_params_struct* pstr_overlap_params
|
||||
,
|
||||
shape_filter_block* shape_filter_block);
|
||||
|
||||
, shape_filter_block* shape_filter_block
|
||||
);
|
||||
|
||||
WORD32 impd_apply_gains_and_add(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||
const WORD32 drc_instructions_index,
|
||||
ia_drc_params_struct* ia_drc_params_struct,
|
||||
ia_gain_buffer_struct* pstr_gain_buf,
|
||||
shape_filter_block shape_filter_block[],
|
||||
FLOAT32* deinterleaved_audio[],
|
||||
|
||||
FLOAT32* channel_audio[],
|
||||
WORD32 impd_apply_gains);
|
||||
WORD32 impd_apply_gains_and_add(
|
||||
ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||
const WORD32 drc_instructions_index,
|
||||
ia_drc_params_struct* ia_drc_params_struct,
|
||||
ia_gain_buffer_struct* pstr_gain_buf,
|
||||
shape_filter_block shape_filter_block[], FLOAT32* deinterleaved_audio[],
|
||||
|
||||
FLOAT32* channel_audio[], WORD32 impd_apply_gains);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -18,21 +18,17 @@
|
|||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
|
||||
|
||||
#ifndef IMPD_DRC_DEFINITIONS_H
|
||||
#define IMPD_DRC_DEFINITIONS_H
|
||||
|
||||
#define LIBNAME "IA_DRC"
|
||||
#define LIB_APIVERSION 1
|
||||
|
||||
#define IA_DRC_PERSIST_IDX (0)
|
||||
#define IA_DRC_SCRATCH_IDX (1)
|
||||
#define IA_DRC_INPUT_IDX (2)
|
||||
#define IA_DRC_OUTPUT_IDX (3)
|
||||
|
||||
#define LIBNAME "IA_DRC"
|
||||
#define LIB_APIVERSION 1
|
||||
|
||||
|
||||
#define IA_DRC_PERSIST_IDX (0)
|
||||
#define IA_DRC_SCRATCH_IDX (1)
|
||||
#define IA_DRC_INPUT_IDX (2)
|
||||
#define IA_DRC_OUTPUT_IDX (3)
|
||||
|
||||
#define FRAME_SIZE 512
|
||||
#define FRAME_SIZE 512
|
||||
|
||||
#endif
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -23,173 +23,163 @@
|
|||
#ifndef COMPILE_FOR_DRC_ENCODER
|
||||
#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
|
||||
#define EQ_INTERMEDIATE_PARAMETER_COUNT_MAX 32
|
||||
#define EQ_FILTER_SECTION_COUNT_MAX 8
|
||||
#define EQ_FILTER_ELEMENT_COUNT_MAX 4
|
||||
#define EQ_FILTER_COUNT_MAX 4
|
||||
#define MATCHING_PHASE_FILTER_COUNT_MAX 32
|
||||
#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
|
||||
#define EQ_INTERMEDIATE_PARAMETER_COUNT_MAX 32
|
||||
#define EQ_FILTER_SECTION_COUNT_MAX 8
|
||||
#define EQ_FILTER_ELEMENT_COUNT_MAX 4
|
||||
#define EQ_FILTER_COUNT_MAX 4
|
||||
#define MATCHING_PHASE_FILTER_COUNT_MAX 32
|
||||
|
||||
#define EQ_FILTER_DOMAIN_NONE 0
|
||||
#define EQ_FILTER_DOMAIN_TIME (1<<0)
|
||||
#define EQ_FILTER_DOMAIN_SUBBAND (1<<1)
|
||||
#define EQ_FILTER_DOMAIN_NONE 0
|
||||
#define EQ_FILTER_DOMAIN_TIME (1 << 0)
|
||||
#define EQ_FILTER_DOMAIN_SUBBAND (1 << 1)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
WORD32 delay;
|
||||
FLOAT32 state[EQ_CHANNEL_COUNT_MAX][EQ_AUDIO_DELAY_MAX];
|
||||
WORD32 delay;
|
||||
FLOAT32 state[EQ_CHANNEL_COUNT_MAX][EQ_AUDIO_DELAY_MAX];
|
||||
} ia_audio_delay_struct;
|
||||
|
||||
typedef struct {
|
||||
FLOAT32 radius;
|
||||
FLOAT32 coeff[2];
|
||||
FLOAT32 radius;
|
||||
FLOAT32 coeff[2];
|
||||
} ia_2nd_order_filt_params_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 coeff_count;
|
||||
FLOAT32 coeff[EQ_FIR_FILTER_SIZE_MAX];
|
||||
FLOAT32 state[EQ_CHANNEL_COUNT_MAX][EQ_FIR_FILTER_SIZE_MAX];
|
||||
WORD32 coeff_count;
|
||||
FLOAT32 coeff[EQ_FIR_FILTER_SIZE_MAX];
|
||||
FLOAT32 state[EQ_CHANNEL_COUNT_MAX][EQ_FIR_FILTER_SIZE_MAX];
|
||||
} ia_fir_filter_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 eq_frame_size_subband;
|
||||
WORD32 coeff_count;
|
||||
FLOAT32 subband_coeff[EQ_SUBBAND_COUNT_MAX];
|
||||
WORD32 eq_frame_size_subband;
|
||||
WORD32 coeff_count;
|
||||
FLOAT32 subband_coeff[EQ_SUBBAND_COUNT_MAX];
|
||||
} ia_subband_filt_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 filter_format;
|
||||
WORD32 filter_param_count_of_zeros;
|
||||
ia_2nd_order_filt_params_struct ord_2_filt_params_of_zeros[EQ_INTERMEDIATE_2ND_ORDER_PARAMS_COUNT_MAX];
|
||||
WORD32 filter_param_count_of_poles;
|
||||
ia_2nd_order_filt_params_struct ord_2_filt_params_of_poles[EQ_INTERMEDIATE_2ND_ORDER_PARAMS_COUNT_MAX];
|
||||
WORD32 filter_param_count_of_fir;
|
||||
ia_fir_filter_struct fir_filter;
|
||||
WORD32 filter_format;
|
||||
WORD32 filter_param_count_of_zeros;
|
||||
ia_2nd_order_filt_params_struct
|
||||
ord_2_filt_params_of_zeros[EQ_INTERMEDIATE_2ND_ORDER_PARAMS_COUNT_MAX];
|
||||
WORD32 filter_param_count_of_poles;
|
||||
ia_2nd_order_filt_params_struct
|
||||
ord_2_filt_params_of_poles[EQ_INTERMEDIATE_2ND_ORDER_PARAMS_COUNT_MAX];
|
||||
WORD32 filter_param_count_of_fir;
|
||||
ia_fir_filter_struct fir_filter;
|
||||
} ia_interm_filt_params_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 interm_filt_param_count;
|
||||
ia_interm_filt_params_struct interm_filt_params[EQ_INTERMEDIATE_PARAMETER_COUNT_MAX];
|
||||
WORD32 interm_filt_param_count;
|
||||
ia_interm_filt_params_struct
|
||||
interm_filt_params[EQ_INTERMEDIATE_PARAMETER_COUNT_MAX];
|
||||
} IntermediateParams;
|
||||
|
||||
typedef struct {
|
||||
FLOAT32 in_state_1;
|
||||
FLOAT32 in_state_2;
|
||||
FLOAT32 out_state_1;
|
||||
FLOAT32 out_state_2;
|
||||
FLOAT32 in_state_1;
|
||||
FLOAT32 in_state_2;
|
||||
FLOAT32 out_state_1;
|
||||
FLOAT32 out_state_2;
|
||||
} ia_filt_sect_state_struct;
|
||||
|
||||
typedef struct {
|
||||
FLOAT32 a1;
|
||||
FLOAT32 a2;
|
||||
FLOAT32 b1;
|
||||
FLOAT32 b2;
|
||||
ia_filt_sect_state_struct filt_sect_state[EQ_CHANNEL_COUNT_MAX];
|
||||
FLOAT32 a1;
|
||||
FLOAT32 a2;
|
||||
FLOAT32 b1;
|
||||
FLOAT32 b2;
|
||||
ia_filt_sect_state_struct filt_sect_state[EQ_CHANNEL_COUNT_MAX];
|
||||
} ia_filt_sect_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 member_count;
|
||||
WORD32 member_idx[EQ_CHANNEL_GROUP_COUNT_MAX];
|
||||
WORD32 member_count;
|
||||
WORD32 member_idx[EQ_CHANNEL_GROUP_COUNT_MAX];
|
||||
} ia_cascade_align_group_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 validity_flag;
|
||||
WORD32 num_matches_filter;
|
||||
WORD32 matches_filter[EQ_FILTER_SECTION_COUNT_MAX];
|
||||
FLOAT32 gain;
|
||||
WORD32 section_count;
|
||||
ia_filt_sect_struct filt_section[EQ_FILTER_SECTION_COUNT_MAX];
|
||||
ia_audio_delay_struct audio_delay;
|
||||
WORD32 validity_flag;
|
||||
WORD32 num_matches_filter;
|
||||
WORD32 matches_filter[EQ_FILTER_SECTION_COUNT_MAX];
|
||||
FLOAT32 gain;
|
||||
WORD32 section_count;
|
||||
ia_filt_sect_struct filt_section[EQ_FILTER_SECTION_COUNT_MAX];
|
||||
ia_audio_delay_struct audio_delay;
|
||||
} ia_ph_alignment_filt_struct;
|
||||
|
||||
typedef ia_ph_alignment_filt_struct ia_matching_ph_filt_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 matches_cascade_idx;
|
||||
WORD32 all_pass_count;
|
||||
ia_matching_ph_filt_struct matching_ph_filt[MATCHING_PHASE_FILTER_COUNT_MAX];
|
||||
WORD32 matches_cascade_idx;
|
||||
WORD32 all_pass_count;
|
||||
ia_matching_ph_filt_struct matching_ph_filt[MATCHING_PHASE_FILTER_COUNT_MAX];
|
||||
} ia_all_pass_chain_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 section_count;
|
||||
ia_filt_sect_struct filt_section[EQ_FILTER_SECTION_COUNT_MAX];
|
||||
WORD32 filt_coeffs_flag;
|
||||
ia_fir_filter_struct fir_filter;
|
||||
ia_audio_delay_struct audio_delay;
|
||||
WORD32 section_count;
|
||||
ia_filt_sect_struct filt_section[EQ_FILTER_SECTION_COUNT_MAX];
|
||||
WORD32 filt_coeffs_flag;
|
||||
ia_fir_filter_struct fir_filter;
|
||||
ia_audio_delay_struct audio_delay;
|
||||
} ia_pole_zero_filt_struct;
|
||||
|
||||
typedef struct {
|
||||
FLOAT32 elementGainLinear;
|
||||
WORD32 format;
|
||||
ia_pole_zero_filt_struct pstr_pole_zero_filt;
|
||||
ia_fir_filter_struct fir_filter;
|
||||
WORD32 num_ph_align_filt;
|
||||
ia_ph_alignment_filt_struct ph_alignment_filt[EQ_FILTER_ELEMENT_COUNT_MAX];
|
||||
FLOAT32 elementGainLinear;
|
||||
WORD32 format;
|
||||
ia_pole_zero_filt_struct pstr_pole_zero_filt;
|
||||
ia_fir_filter_struct fir_filter;
|
||||
WORD32 num_ph_align_filt;
|
||||
ia_ph_alignment_filt_struct ph_alignment_filt[EQ_FILTER_ELEMENT_COUNT_MAX];
|
||||
} ia_eq_filt_ele_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 element_count;
|
||||
ia_eq_filt_ele_struct eq_filt_element[EQ_FILTER_ELEMENT_COUNT_MAX];
|
||||
ia_matching_ph_filt_struct matching_ph_filt_ele_0;
|
||||
WORD32 element_count;
|
||||
ia_eq_filt_ele_struct eq_filt_element[EQ_FILTER_ELEMENT_COUNT_MAX];
|
||||
ia_matching_ph_filt_struct matching_ph_filt_ele_0;
|
||||
} ia_eq_filt_block_struct;
|
||||
|
||||
typedef struct {
|
||||
FLOAT32 cascade_gain_linear;
|
||||
WORD32 block_count;
|
||||
ia_eq_filt_block_struct pstr_eq_filt_block[EQ_FILTER_BLOCK_COUNT_MAX];
|
||||
WORD32 num_ph_align_filt;
|
||||
ia_ph_alignment_filt_struct ph_alignment_filt[EQ_FILTER_BLOCK_COUNT_MAX * EQ_FILTER_BLOCK_COUNT_MAX];
|
||||
FLOAT32 cascade_gain_linear;
|
||||
WORD32 block_count;
|
||||
ia_eq_filt_block_struct pstr_eq_filt_block[EQ_FILTER_BLOCK_COUNT_MAX];
|
||||
WORD32 num_ph_align_filt;
|
||||
ia_ph_alignment_filt_struct
|
||||
ph_alignment_filt[EQ_FILTER_BLOCK_COUNT_MAX * EQ_FILTER_BLOCK_COUNT_MAX];
|
||||
} ia_filt_cascade_td_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 domain;
|
||||
WORD32 audio_num_chan;
|
||||
WORD32 eq_ch_group_count;
|
||||
WORD32 eq_ch_group_of_channel[EQ_CHANNEL_COUNT_MAX];
|
||||
ia_filt_cascade_td_struct filt_cascade_td[EQ_CHANNEL_GROUP_COUNT_MAX];
|
||||
ia_subband_filt_struct subband_filt[EQ_CHANNEL_GROUP_COUNT_MAX];
|
||||
WORD32 domain;
|
||||
WORD32 audio_num_chan;
|
||||
WORD32 eq_ch_group_count;
|
||||
WORD32 eq_ch_group_of_channel[EQ_CHANNEL_COUNT_MAX];
|
||||
ia_filt_cascade_td_struct filt_cascade_td[EQ_CHANNEL_GROUP_COUNT_MAX];
|
||||
ia_subband_filt_struct subband_filt[EQ_CHANNEL_GROUP_COUNT_MAX];
|
||||
} ia_eq_set_struct;
|
||||
|
||||
|
||||
|
||||
WORD32
|
||||
impd_derive_eq_set (ia_eq_coeff_struct* str_eq_coeff,
|
||||
ia_eq_instructions_struct* str_eq_instructions,
|
||||
FLOAT32 sample_rate,
|
||||
WORD32 drc_frame_size,
|
||||
WORD32 sub_band_domain_mode,
|
||||
ia_eq_set_struct* eq_set);
|
||||
impd_derive_eq_set(ia_eq_coeff_struct* str_eq_coeff,
|
||||
ia_eq_instructions_struct* str_eq_instructions,
|
||||
FLOAT32 sample_rate, WORD32 drc_frame_size,
|
||||
WORD32 sub_band_domain_mode, ia_eq_set_struct* eq_set);
|
||||
|
||||
VOID impd_get_eq_set_delay (ia_eq_set_struct* eq_set,
|
||||
WORD32* cascade_delay);
|
||||
VOID impd_get_eq_set_delay(ia_eq_set_struct* eq_set, WORD32* cascade_delay);
|
||||
WORD32
|
||||
impd_process_eq_set_td(ia_eq_set_struct* eq_set,
|
||||
WORD32 channel,
|
||||
FLOAT32 audio_in,
|
||||
FLOAT32* audio_out);
|
||||
impd_process_eq_set_td(ia_eq_set_struct* eq_set, WORD32 channel,
|
||||
FLOAT32 audio_in, FLOAT32* audio_out);
|
||||
|
||||
WORD32 impd_process_eq_set_time_domain(ia_eq_set_struct* eq_set,
|
||||
WORD32 channel,
|
||||
FLOAT32 *audio_in,
|
||||
FLOAT32 *audio_out,
|
||||
WORD32 impd_process_eq_set_time_domain(ia_eq_set_struct* eq_set, WORD32 channel,
|
||||
FLOAT32* audio_in, FLOAT32* audio_out,
|
||||
WORD32 frame_size);
|
||||
WORD32
|
||||
impd_process_eq_set_subband_domain(ia_eq_set_struct* eq_set,
|
||||
WORD32 channel,
|
||||
impd_process_eq_set_subband_domain(ia_eq_set_struct* eq_set, WORD32 channel,
|
||||
FLOAT32* subbandSampleIn,
|
||||
FLOAT32* subbandSampleOut);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -18,42 +18,39 @@
|
|||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
|
||||
|
||||
#ifndef IMPD_DRC_ERROR_CODES_H
|
||||
#define IMPD_DRC_ERROR_CODES_H
|
||||
|
||||
#define IA_ERROR_CODE WORD32
|
||||
#define IA_NO_ERROR 0x00000000
|
||||
#define IA_ERROR_CODE WORD32
|
||||
#define IA_NO_ERROR 0x00000000
|
||||
|
||||
/*API Non-Fatal Errors */
|
||||
#define IA_DRC_DEC_API_NONFATAL_NO_ERROR 0x00000000
|
||||
#define IA_DRC_DEC_API_NONFATAL_CMD_NOT_SUPPORTED 0x00000001
|
||||
#define IA_DRC_DEC_API_NONFATAL_CMD_TYPE_NOT_SUPPORTED 0x00000002
|
||||
|
||||
#define IA_DRC_DEC_API_NONFATAL_NO_ERROR 0x00000000
|
||||
#define IA_DRC_DEC_API_NONFATAL_CMD_NOT_SUPPORTED 0x00000001
|
||||
#define IA_DRC_DEC_API_NONFATAL_CMD_TYPE_NOT_SUPPORTED 0x00000002
|
||||
|
||||
/*API Fatal Errors */
|
||||
#define IA_DRC_DEC_API_FATAL_INVALID_MEMTAB_INDEX 0xFFFF8000
|
||||
#define IA_DRC_DEC_API_FATAL_INVALID_LIB_ID_STRINGS_IDX 0xFFFF8001
|
||||
#define IA_DRC_DEC_API_FATAL_MEM_ALLOC 0xFFFF8002
|
||||
#define IA_DRC_DEC_API_FATAL_INVALID_CONFIG_PARAM 0xFFFF8003
|
||||
#define IA_DRC_DEC_API_FATAL_INVALID_EXECUTE_TYPE 0xFFFF8004
|
||||
#define IA_DRC_DEC_API_FATAL_INVALID_CMD 0xFFFF8005
|
||||
#define IA_DRC_DEC_API_FATAL_MEM_ALIGN 0xFFFF8006
|
||||
#define IA_DRC_DEC_API_FATAL_INVALID_MEMTAB_INDEX 0xFFFF8000
|
||||
#define IA_DRC_DEC_API_FATAL_INVALID_LIB_ID_STRINGS_IDX 0xFFFF8001
|
||||
#define IA_DRC_DEC_API_FATAL_MEM_ALLOC 0xFFFF8002
|
||||
#define IA_DRC_DEC_API_FATAL_INVALID_CONFIG_PARAM 0xFFFF8003
|
||||
#define IA_DRC_DEC_API_FATAL_INVALID_EXECUTE_TYPE 0xFFFF8004
|
||||
#define IA_DRC_DEC_API_FATAL_INVALID_CMD 0xFFFF8005
|
||||
#define IA_DRC_DEC_API_FATAL_MEM_ALIGN 0xFFFF8006
|
||||
/*****************************************************************************/
|
||||
/* Class 1: Configuration Errors */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
/* Non Fatal Errors */
|
||||
#define IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_NUM_OF_CHANNELS 0x00000800
|
||||
#define IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_SAMP_FREQ 0x00000801
|
||||
#define IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_PCM_SIZE 0x00000802
|
||||
#define IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_FRAME_SIZE 0x00000803
|
||||
#define IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_DELAY_MODE 0x00000804
|
||||
#define IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_DECODE_TYPE 0x00000805
|
||||
#define IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_PEAK_LIM_FLAG 0x00000806
|
||||
#define IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_CTRL_PARAM_IDX 0x00000807
|
||||
#define IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_GAIN_DELAY 0x00000808
|
||||
#define IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_CONST_DELAY_MODE 0x00000809
|
||||
#define IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_NUM_OF_CHANNELS 0x00000800
|
||||
#define IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_SAMP_FREQ 0x00000801
|
||||
#define IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_PCM_SIZE 0x00000802
|
||||
#define IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_FRAME_SIZE 0x00000803
|
||||
#define IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_DELAY_MODE 0x00000804
|
||||
#define IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_DECODE_TYPE 0x00000805
|
||||
#define IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_PEAK_LIM_FLAG 0x00000806
|
||||
#define IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_CTRL_PARAM_IDX 0x00000807
|
||||
#define IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_GAIN_DELAY 0x00000808
|
||||
#define IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_CONST_DELAY_MODE 0x00000809
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -28,86 +28,68 @@
|
|||
#include "impd_drc_rom.h"
|
||||
|
||||
WORD32 impd_init_tbls(const WORD32 num_gain_max_values,
|
||||
ia_tables_struct* str_tables)
|
||||
{
|
||||
impd_gen_delta_time_code_tbl (num_gain_max_values,
|
||||
str_tables->delta_time_code_table);
|
||||
return(0);
|
||||
ia_tables_struct* str_tables) {
|
||||
impd_gen_delta_time_code_tbl(num_gain_max_values,
|
||||
str_tables->delta_time_code_table);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
impd_get_delta_gain_code_tbl(const WORD32 gain_coding_profile,
|
||||
ia_delta_gain_code_table_struct const** delta_time_code_tbl,
|
||||
WORD32 *num_entries)
|
||||
{
|
||||
if (gain_coding_profile==GAIN_CODING_PROFILE_CLIPPING)
|
||||
{
|
||||
*delta_time_code_tbl = ia_drc_gain_tbls_prof_2;
|
||||
*num_entries = NUM_GAIN_TBL_PROF_2_ENTRIES;
|
||||
}
|
||||
else
|
||||
{
|
||||
*delta_time_code_tbl = ia_drc_gain_tbls_prof_0_1;
|
||||
*num_entries = NUM_GAIN_TBL_PROF_0_1_ENTRIES;
|
||||
}
|
||||
void impd_get_delta_gain_code_tbl(
|
||||
const WORD32 gain_coding_profile,
|
||||
ia_delta_gain_code_table_struct const** delta_time_code_tbl,
|
||||
WORD32* num_entries) {
|
||||
if (gain_coding_profile == GAIN_CODING_PROFILE_CLIPPING) {
|
||||
*delta_time_code_tbl = ia_drc_gain_tbls_prof_2;
|
||||
*num_entries = NUM_GAIN_TBL_PROF_2_ENTRIES;
|
||||
} else {
|
||||
*delta_time_code_tbl = ia_drc_gain_tbls_prof_0_1;
|
||||
*num_entries = NUM_GAIN_TBL_PROF_0_1_ENTRIES;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
impd_gen_delta_time_code_tbl (const WORD32 num_gain_max_values,
|
||||
ia_delta_time_code_table_entry_struct* delta_time_code_tbl_item)
|
||||
{
|
||||
WORD32 n, k;
|
||||
void impd_gen_delta_time_code_tbl(
|
||||
const WORD32 num_gain_max_values,
|
||||
ia_delta_time_code_table_entry_struct* delta_time_code_tbl_item) {
|
||||
WORD32 n, k;
|
||||
|
||||
WORD32 Z = 1;
|
||||
while((1<<Z)<2*num_gain_max_values)
|
||||
{
|
||||
Z++;
|
||||
}
|
||||
WORD32 Z = 1;
|
||||
while ((1 << Z) < 2 * num_gain_max_values) {
|
||||
Z++;
|
||||
}
|
||||
|
||||
delta_time_code_tbl_item[0].size = -1;
|
||||
delta_time_code_tbl_item[0].code = -1;
|
||||
delta_time_code_tbl_item[0].value = -1;
|
||||
delta_time_code_tbl_item[0].size = -1;
|
||||
delta_time_code_tbl_item[0].code = -1;
|
||||
delta_time_code_tbl_item[0].value = -1;
|
||||
|
||||
delta_time_code_tbl_item[1].size = 2;
|
||||
delta_time_code_tbl_item[1].code = 0x0;
|
||||
delta_time_code_tbl_item[1].value = 1;
|
||||
for (n=0; n<4; n++)
|
||||
{
|
||||
delta_time_code_tbl_item[n+2].size = 4;
|
||||
delta_time_code_tbl_item[n+2].code = 0x4 + n;
|
||||
delta_time_code_tbl_item[n+2].value = n+2;
|
||||
}
|
||||
for (n=0; n<8; n++)
|
||||
{
|
||||
delta_time_code_tbl_item[n+6].size = 5;
|
||||
delta_time_code_tbl_item[n+6].code = 0x10 + n;
|
||||
delta_time_code_tbl_item[n+6].value = n+6;
|
||||
}
|
||||
|
||||
k = 2*num_gain_max_values-14+1;
|
||||
for (n=0; n<k; n++)
|
||||
{
|
||||
delta_time_code_tbl_item[n+14].size = 2+Z;
|
||||
delta_time_code_tbl_item[n+14].code = (0x3<<Z) + n;
|
||||
delta_time_code_tbl_item[n+14].value = n+14;
|
||||
}
|
||||
delta_time_code_tbl_item[1].size = 2;
|
||||
delta_time_code_tbl_item[1].code = 0x0;
|
||||
delta_time_code_tbl_item[1].value = 1;
|
||||
for (n = 0; n < 4; n++) {
|
||||
delta_time_code_tbl_item[n + 2].size = 4;
|
||||
delta_time_code_tbl_item[n + 2].code = 0x4 + n;
|
||||
delta_time_code_tbl_item[n + 2].value = n + 2;
|
||||
}
|
||||
for (n = 0; n < 8; n++) {
|
||||
delta_time_code_tbl_item[n + 6].size = 5;
|
||||
delta_time_code_tbl_item[n + 6].code = 0x10 + n;
|
||||
delta_time_code_tbl_item[n + 6].value = n + 6;
|
||||
}
|
||||
|
||||
k = 2 * num_gain_max_values - 14 + 1;
|
||||
for (n = 0; n < k; n++) {
|
||||
delta_time_code_tbl_item[n + 14].size = 2 + Z;
|
||||
delta_time_code_tbl_item[n + 14].code = (0x3 << Z) + n;
|
||||
delta_time_code_tbl_item[n + 14].value = n + 14;
|
||||
}
|
||||
}
|
||||
|
||||
WORD32
|
||||
impd_get_delta_tmin (const WORD32 sampling_rate)
|
||||
{
|
||||
WORD32 lowerBound = (WORD32) (0.5f + 0.0005f * sampling_rate);
|
||||
WORD32 result = 1;
|
||||
if (sampling_rate < 1000)
|
||||
{
|
||||
return(UNEXPECTED_ERROR);
|
||||
}
|
||||
while (result <= lowerBound) result = result << 1;
|
||||
return result;
|
||||
impd_get_delta_tmin(const WORD32 sampling_rate) {
|
||||
WORD32 lowerBound = (WORD32)(0.5f + 0.0005f * sampling_rate);
|
||||
WORD32 result = 1;
|
||||
if (sampling_rate < 1000) {
|
||||
return (UNEXPECTED_ERROR);
|
||||
}
|
||||
while (result <= lowerBound) result = result << 1;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -21,66 +21,65 @@
|
|||
#define IMPD_DRC_TABLES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define N_DELTA_TIME_CODE_TABLE_ENTRIES_MAX (512+14)
|
||||
#define N_DELTA_TIME_CODE_TABLE_ENTRIES_MAX (512 + 14)
|
||||
|
||||
typedef struct {
|
||||
WORD32 size;
|
||||
WORD32 code;
|
||||
WORD32 value;
|
||||
WORD32 size;
|
||||
WORD32 code;
|
||||
WORD32 value;
|
||||
} ia_delta_time_code_table_entry_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 size;
|
||||
WORD32 code;
|
||||
FLOAT32 value;
|
||||
WORD32 index;
|
||||
WORD32 size;
|
||||
WORD32 code;
|
||||
FLOAT32 value;
|
||||
WORD32 index;
|
||||
} ia_slope_code_table_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 size;
|
||||
WORD32 code;
|
||||
FLOAT32 value;
|
||||
WORD32 size;
|
||||
WORD32 code;
|
||||
FLOAT32 value;
|
||||
} ia_delta_gain_code_table_struct;
|
||||
|
||||
typedef struct {
|
||||
ia_delta_time_code_table_entry_struct delta_time_code_table[N_DELTA_TIME_CODE_TABLE_ENTRIES_MAX];
|
||||
ia_delta_time_code_table_entry_struct
|
||||
delta_time_code_table[N_DELTA_TIME_CODE_TABLE_ENTRIES_MAX];
|
||||
} ia_tables_struct;
|
||||
|
||||
typedef struct {
|
||||
FLOAT32 in_out_ratio;
|
||||
FLOAT32 exp_lo;
|
||||
FLOAT32 exp_hi;
|
||||
FLOAT32 in_out_ratio;
|
||||
FLOAT32 exp_lo;
|
||||
FLOAT32 exp_hi;
|
||||
} ia_cicp_sigmoid_characteristic_param_struct;
|
||||
|
||||
typedef struct {
|
||||
FLOAT32 inLevel;
|
||||
FLOAT32 gain;
|
||||
FLOAT32 inLevel;
|
||||
FLOAT32 gain;
|
||||
} ia_characteristic_node_coordinate_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 coordinateCount;
|
||||
ia_characteristic_node_coordinate_struct characteristicNodeCoordinate[5];
|
||||
WORD32 coordinateCount;
|
||||
ia_characteristic_node_coordinate_struct characteristicNodeCoordinate[5];
|
||||
} ia_cicp_node_characteristic_param;
|
||||
|
||||
WORD32
|
||||
impd_init_tbls(const WORD32 num_gain_max_values,
|
||||
ia_tables_struct* str_tables);
|
||||
impd_init_tbls(const WORD32 num_gain_max_values, ia_tables_struct* str_tables);
|
||||
|
||||
void
|
||||
impd_gen_delta_time_code_tbl (const WORD32 num_gain_max_values,
|
||||
ia_delta_time_code_table_entry_struct* delta_time_code_tbl_item);
|
||||
void impd_gen_delta_time_code_tbl(
|
||||
const WORD32 num_gain_max_values,
|
||||
ia_delta_time_code_table_entry_struct* delta_time_code_tbl_item);
|
||||
|
||||
void
|
||||
impd_get_delta_gain_code_tbl(const WORD32 gain_coding_profile,
|
||||
ia_delta_gain_code_table_struct const** delta_time_code_tbl,
|
||||
WORD32 *num_entries);
|
||||
void impd_get_delta_gain_code_tbl(
|
||||
const WORD32 gain_coding_profile,
|
||||
ia_delta_gain_code_table_struct const** delta_time_code_tbl,
|
||||
WORD32* num_entries);
|
||||
|
||||
WORD32
|
||||
impd_get_delta_tmin (const WORD32 sampling_rate);
|
||||
impd_get_delta_tmin(const WORD32 sampling_rate);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,477 +29,403 @@
|
|||
#include "impd_drc_rom.h"
|
||||
|
||||
VOID impd_compute_filt_coeff(WORD32 crossover_freq_idx,
|
||||
ia_iir_filter_struct* pstr_lp_filt_coeff,
|
||||
ia_iir_filter_struct* pstr_hp_filt_coeff,
|
||||
ia_iir_filter_struct* pstr_ap_filt_coeff,
|
||||
WORD32 filter_type)
|
||||
{
|
||||
FLOAT32 gamma = normal_cross_freq[crossover_freq_idx].gamma;
|
||||
FLOAT32 delta = normal_cross_freq[crossover_freq_idx].delta;
|
||||
ia_iir_filter_struct* pstr_lp_filt_coeff,
|
||||
ia_iir_filter_struct* pstr_hp_filt_coeff,
|
||||
ia_iir_filter_struct* pstr_ap_filt_coeff,
|
||||
WORD32 filter_type) {
|
||||
FLOAT32 gamma = normal_cross_freq[crossover_freq_idx].gamma;
|
||||
FLOAT32 delta = normal_cross_freq[crossover_freq_idx].delta;
|
||||
|
||||
if(filter_type==0||filter_type==2){
|
||||
pstr_lp_filt_coeff->a0 = 1.0f;
|
||||
pstr_lp_filt_coeff->a1 = 2.0f * (gamma - delta);
|
||||
pstr_lp_filt_coeff->a2 = 2.0f * (gamma + delta) - 1.0f;
|
||||
pstr_lp_filt_coeff->b0 = gamma;
|
||||
pstr_lp_filt_coeff->b1 = 2.0f * gamma;
|
||||
pstr_lp_filt_coeff->b2 = gamma;
|
||||
if (filter_type == 0 || filter_type == 2) {
|
||||
pstr_lp_filt_coeff->a0 = 1.0f;
|
||||
pstr_lp_filt_coeff->a1 = 2.0f * (gamma - delta);
|
||||
pstr_lp_filt_coeff->a2 = 2.0f * (gamma + delta) - 1.0f;
|
||||
pstr_lp_filt_coeff->b0 = gamma;
|
||||
pstr_lp_filt_coeff->b1 = 2.0f * gamma;
|
||||
pstr_lp_filt_coeff->b2 = gamma;
|
||||
|
||||
pstr_hp_filt_coeff->a0 = 1.0f;
|
||||
pstr_hp_filt_coeff->a1 = pstr_lp_filt_coeff->a1;
|
||||
pstr_hp_filt_coeff->a2 = pstr_lp_filt_coeff->a2;
|
||||
pstr_hp_filt_coeff->b0 = delta;
|
||||
pstr_hp_filt_coeff->b1 = - 2.0f * delta;
|
||||
pstr_hp_filt_coeff->b2 = delta;
|
||||
}
|
||||
pstr_hp_filt_coeff->a0 = 1.0f;
|
||||
pstr_hp_filt_coeff->a1 = pstr_lp_filt_coeff->a1;
|
||||
pstr_hp_filt_coeff->a2 = pstr_lp_filt_coeff->a2;
|
||||
pstr_hp_filt_coeff->b0 = delta;
|
||||
pstr_hp_filt_coeff->b1 = -2.0f * delta;
|
||||
pstr_hp_filt_coeff->b2 = delta;
|
||||
}
|
||||
|
||||
if(filter_type==1||filter_type==2){
|
||||
pstr_ap_filt_coeff->a0 = 1.0f;
|
||||
pstr_ap_filt_coeff->a1 = 2.0f * (gamma - delta);;
|
||||
pstr_ap_filt_coeff->a2 = 2.0f * (gamma + delta) - 1.0f;;
|
||||
pstr_ap_filt_coeff->b0 = pstr_ap_filt_coeff->a2;
|
||||
pstr_ap_filt_coeff->b1 = pstr_ap_filt_coeff->a1;
|
||||
pstr_ap_filt_coeff->b2 = pstr_ap_filt_coeff->a0;
|
||||
}
|
||||
if (filter_type == 1 || filter_type == 2) {
|
||||
pstr_ap_filt_coeff->a0 = 1.0f;
|
||||
pstr_ap_filt_coeff->a1 = 2.0f * (gamma - delta);
|
||||
;
|
||||
pstr_ap_filt_coeff->a2 = 2.0f * (gamma + delta) - 1.0f;
|
||||
;
|
||||
pstr_ap_filt_coeff->b0 = pstr_ap_filt_coeff->a2;
|
||||
pstr_ap_filt_coeff->b1 = pstr_ap_filt_coeff->a1;
|
||||
pstr_ap_filt_coeff->b2 = pstr_ap_filt_coeff->a0;
|
||||
}
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
WORD32 impd_initialize_filt_bank(WORD32 num_sub_bands,
|
||||
ia_gain_params_struct* gain_params,
|
||||
ia_drc_filter_bank_struct* drc_filter_bank)
|
||||
{
|
||||
ia_two_band_filt_struct* str_two_band_bank;
|
||||
ia_three_band_filt_struct* str_three_band_bank;
|
||||
ia_four_band_filt_struct* str_four_band_bank;
|
||||
drc_filter_bank->complexity = 0;
|
||||
drc_filter_bank->num_bands = num_sub_bands;
|
||||
|
||||
|
||||
if(num_sub_bands==1){
|
||||
return 0;
|
||||
}
|
||||
else if(num_sub_bands==2){
|
||||
str_two_band_bank = &drc_filter_bank->str_two_band_bank;
|
||||
impd_compute_filt_coeff(gain_params[1].crossover_freq_idx,
|
||||
&(str_two_band_bank->low_pass),
|
||||
&(str_two_band_bank->high_pass),
|
||||
NULL,
|
||||
0);
|
||||
}
|
||||
else if(num_sub_bands==3){
|
||||
str_three_band_bank = &drc_filter_bank->str_three_band_bank;
|
||||
|
||||
impd_compute_filt_coeff(gain_params[1].crossover_freq_idx,
|
||||
&(str_three_band_bank->str_low_pass_stage_2),
|
||||
&(str_three_band_bank->str_high_pass_stage_2),
|
||||
&(str_three_band_bank->str_all_pass_stage_2),
|
||||
2);
|
||||
impd_compute_filt_coeff(gain_params[2].crossover_freq_idx,
|
||||
&(str_three_band_bank->str_low_pass_stage_1),
|
||||
&(str_three_band_bank->str_high_pass_stage_1),
|
||||
NULL,
|
||||
0);
|
||||
}
|
||||
|
||||
else if(num_sub_bands==4){
|
||||
str_four_band_bank = &drc_filter_bank->str_four_band_bank;
|
||||
|
||||
impd_compute_filt_coeff(gain_params[1].crossover_freq_idx,
|
||||
&(str_four_band_bank->str_low_pass_stage_3_low),
|
||||
&(str_four_band_bank->str_high_pass_stage_3_low),
|
||||
&(str_four_band_bank->str_all_pass_stage_2_high),
|
||||
2);
|
||||
impd_compute_filt_coeff(gain_params[2].crossover_freq_idx,
|
||||
&(str_four_band_bank->str_low_pass_stage_1),
|
||||
&(str_four_band_bank->str_high_pass_stage_1),
|
||||
NULL,
|
||||
0);
|
||||
impd_compute_filt_coeff(gain_params[3].crossover_freq_idx,
|
||||
&(str_four_band_bank->str_low_pass_stage_3_high),
|
||||
&(str_four_band_bank->str_high_pass_stage_3_high),
|
||||
&(str_four_band_bank->str_all_pass_stage_2_low),
|
||||
2);
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
ia_gain_params_struct* gain_params,
|
||||
ia_drc_filter_bank_struct* drc_filter_bank) {
|
||||
ia_two_band_filt_struct* str_two_band_bank;
|
||||
ia_three_band_filt_struct* str_three_band_bank;
|
||||
ia_four_band_filt_struct* str_four_band_bank;
|
||||
drc_filter_bank->complexity = 0;
|
||||
drc_filter_bank->num_bands = num_sub_bands;
|
||||
|
||||
if (num_sub_bands == 1) {
|
||||
return 0;
|
||||
} else if (num_sub_bands == 2) {
|
||||
str_two_band_bank = &drc_filter_bank->str_two_band_bank;
|
||||
impd_compute_filt_coeff(gain_params[1].crossover_freq_idx,
|
||||
&(str_two_band_bank->low_pass),
|
||||
&(str_two_band_bank->high_pass), NULL, 0);
|
||||
} else if (num_sub_bands == 3) {
|
||||
str_three_band_bank = &drc_filter_bank->str_three_band_bank;
|
||||
|
||||
impd_compute_filt_coeff(gain_params[1].crossover_freq_idx,
|
||||
&(str_three_band_bank->str_low_pass_stage_2),
|
||||
&(str_three_band_bank->str_high_pass_stage_2),
|
||||
&(str_three_band_bank->str_all_pass_stage_2), 2);
|
||||
impd_compute_filt_coeff(gain_params[2].crossover_freq_idx,
|
||||
&(str_three_band_bank->str_low_pass_stage_1),
|
||||
&(str_three_band_bank->str_high_pass_stage_1), NULL,
|
||||
0);
|
||||
}
|
||||
|
||||
else if (num_sub_bands == 4) {
|
||||
str_four_band_bank = &drc_filter_bank->str_four_band_bank;
|
||||
|
||||
impd_compute_filt_coeff(gain_params[1].crossover_freq_idx,
|
||||
&(str_four_band_bank->str_low_pass_stage_3_low),
|
||||
&(str_four_band_bank->str_high_pass_stage_3_low),
|
||||
&(str_four_band_bank->str_all_pass_stage_2_high),
|
||||
2);
|
||||
impd_compute_filt_coeff(gain_params[2].crossover_freq_idx,
|
||||
&(str_four_band_bank->str_low_pass_stage_1),
|
||||
&(str_four_band_bank->str_high_pass_stage_1), NULL,
|
||||
0);
|
||||
impd_compute_filt_coeff(gain_params[3].crossover_freq_idx,
|
||||
&(str_four_band_bank->str_low_pass_stage_3_high),
|
||||
&(str_four_band_bank->str_high_pass_stage_3_high),
|
||||
&(str_four_band_bank->str_all_pass_stage_2_low), 2);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
WORD32 impd_init_all_filter_banks( ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc,
|
||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||
ia_filter_banks_struct* ia_filter_banks_struct)
|
||||
{
|
||||
WORD32 err_code=0;
|
||||
WORD32 b, g, i, k, m, s , crossover_freq_idx, num_ch_in_groups, num_ph_align_ch_groups;
|
||||
WORD32 match_found = 0, num_filter;
|
||||
WORD32 cascade_cross_idx[CHANNEL_GROUP_COUNT_MAX+1][CHANNEL_GROUP_COUNT_MAX * 3];
|
||||
WORD32 count[CHANNEL_GROUP_COUNT_MAX + 1];
|
||||
WORD32 impd_init_all_filter_banks(
|
||||
ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc,
|
||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||
ia_filter_banks_struct* ia_filter_banks_struct) {
|
||||
WORD32 err_code = 0;
|
||||
WORD32 b, g, i, k, m, s, crossover_freq_idx, num_ch_in_groups,
|
||||
num_ph_align_ch_groups;
|
||||
WORD32 match_found = 0, num_filter;
|
||||
WORD32 cascade_cross_idx[CHANNEL_GROUP_COUNT_MAX + 1]
|
||||
[CHANNEL_GROUP_COUNT_MAX * 3];
|
||||
WORD32 count[CHANNEL_GROUP_COUNT_MAX + 1];
|
||||
|
||||
num_ch_in_groups = 0;
|
||||
num_ph_align_ch_groups = str_drc_instruction_str->num_drc_ch_groups;
|
||||
num_ch_in_groups = 0;
|
||||
num_ph_align_ch_groups = str_drc_instruction_str->num_drc_ch_groups;
|
||||
|
||||
for (g = 0; g < str_drc_instruction_str->num_drc_ch_groups; g++) {
|
||||
num_ch_in_groups += str_drc_instruction_str->num_chan_per_ch_group[g];
|
||||
}
|
||||
|
||||
for (g=0; g<str_drc_instruction_str->num_drc_ch_groups; g++)
|
||||
{
|
||||
num_ch_in_groups += str_drc_instruction_str->num_chan_per_ch_group[g];
|
||||
if (num_ch_in_groups < str_drc_instruction_str->audio_num_chan) {
|
||||
num_ph_align_ch_groups++;
|
||||
}
|
||||
|
||||
ia_filter_banks_struct->nfilter_banks =
|
||||
str_drc_instruction_str->num_drc_ch_groups;
|
||||
ia_filter_banks_struct->num_ph_align_ch_groups = num_ph_align_ch_groups;
|
||||
|
||||
if (str_p_loc_drc_coefficients_uni_drc == NULL) {
|
||||
ia_filter_banks_struct->str_drc_filter_bank->num_bands = 1;
|
||||
} else {
|
||||
for (g = 0; g < str_drc_instruction_str->num_drc_ch_groups; g++) {
|
||||
err_code = impd_initialize_filt_bank(
|
||||
str_p_loc_drc_coefficients_uni_drc
|
||||
->gain_set_params[str_drc_instruction_str
|
||||
->gain_set_index_for_channel_group[g]]
|
||||
.band_count,
|
||||
str_p_loc_drc_coefficients_uni_drc
|
||||
->gain_set_params[str_drc_instruction_str
|
||||
->gain_set_index_for_channel_group[g]]
|
||||
.gain_params,
|
||||
&(ia_filter_banks_struct->str_drc_filter_bank[g]));
|
||||
if (err_code != 0) return (err_code);
|
||||
}
|
||||
}
|
||||
|
||||
if (num_ch_in_groups < str_drc_instruction_str->audio_num_chan)
|
||||
{
|
||||
num_ph_align_ch_groups++;
|
||||
}
|
||||
|
||||
ia_filter_banks_struct->nfilter_banks = str_drc_instruction_str->num_drc_ch_groups;
|
||||
ia_filter_banks_struct->num_ph_align_ch_groups = num_ph_align_ch_groups;
|
||||
|
||||
if (str_p_loc_drc_coefficients_uni_drc == NULL)
|
||||
{
|
||||
ia_filter_banks_struct->str_drc_filter_bank->num_bands = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (g=0; g<str_drc_instruction_str->num_drc_ch_groups; g++)
|
||||
{
|
||||
err_code = impd_initialize_filt_bank(str_p_loc_drc_coefficients_uni_drc->gain_set_params[str_drc_instruction_str->gain_set_index_for_channel_group[g]].band_count,
|
||||
str_p_loc_drc_coefficients_uni_drc->gain_set_params[str_drc_instruction_str->gain_set_index_for_channel_group[g]].gain_params,
|
||||
&(ia_filter_banks_struct->str_drc_filter_bank[g]));
|
||||
if (err_code!=0)
|
||||
return (err_code);
|
||||
for (g = 0; g < CHANNEL_GROUP_COUNT_MAX + 1; g++) {
|
||||
count[g] = 0;
|
||||
}
|
||||
for (g = 0; g < str_drc_instruction_str->num_drc_ch_groups; g++) {
|
||||
for (b = 1;
|
||||
b < str_p_loc_drc_coefficients_uni_drc
|
||||
->gain_set_params[str_drc_instruction_str
|
||||
->gain_set_index_for_channel_group[g]]
|
||||
.band_count;
|
||||
b++) {
|
||||
crossover_freq_idx =
|
||||
str_p_loc_drc_coefficients_uni_drc
|
||||
->gain_set_params[str_drc_instruction_str
|
||||
->gain_set_index_for_channel_group[g]]
|
||||
.gain_params[b]
|
||||
.crossover_freq_idx;
|
||||
for (k = 0; k < num_ph_align_ch_groups; k++) {
|
||||
if (k != g) {
|
||||
cascade_cross_idx[k][count[k]] = crossover_freq_idx;
|
||||
count[k]++;
|
||||
if (count[k] > CHANNEL_GROUP_COUNT_MAX * 3) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (g=0; g<CHANNEL_GROUP_COUNT_MAX + 1; g++)
|
||||
{
|
||||
count[g] = 0;
|
||||
}
|
||||
for (g=0; g<str_drc_instruction_str->num_drc_ch_groups; g++)
|
||||
{
|
||||
for (b=1; b<str_p_loc_drc_coefficients_uni_drc->gain_set_params[str_drc_instruction_str->gain_set_index_for_channel_group[g]].band_count; b++)
|
||||
{
|
||||
crossover_freq_idx = str_p_loc_drc_coefficients_uni_drc->gain_set_params[str_drc_instruction_str->gain_set_index_for_channel_group[g]].gain_params[b].crossover_freq_idx;
|
||||
for (k=0; k<num_ph_align_ch_groups; k++)
|
||||
{
|
||||
if (k!=g)
|
||||
{
|
||||
cascade_cross_idx[k][count[k]] = crossover_freq_idx;
|
||||
count[k]++;
|
||||
if (count[k] > CHANNEL_GROUP_COUNT_MAX * 3)
|
||||
{
|
||||
return -1 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
while (i < count[0]) {
|
||||
crossover_freq_idx = cascade_cross_idx[0][i];
|
||||
match_found = 0;
|
||||
for (g = 1; g < num_ph_align_ch_groups; g++) {
|
||||
match_found = 0;
|
||||
for (k = 0; k < count[g]; k++) {
|
||||
if (cascade_cross_idx[g][k] == crossover_freq_idx) {
|
||||
match_found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (match_found == 0) break;
|
||||
}
|
||||
|
||||
i=0;
|
||||
while (i<count[0])
|
||||
{
|
||||
crossover_freq_idx = cascade_cross_idx[0][i];
|
||||
match_found = 0;
|
||||
for (g=1; g<num_ph_align_ch_groups; g++)
|
||||
{
|
||||
match_found = 0;
|
||||
for (k=0; k<count[g]; k++)
|
||||
{
|
||||
if (cascade_cross_idx[g][k] == crossover_freq_idx)
|
||||
{
|
||||
match_found = 1;
|
||||
break;
|
||||
}
|
||||
if (match_found == 1) {
|
||||
for (g = 0; g < num_ph_align_ch_groups; g++) {
|
||||
for (m = 0; m < count[g]; m++) {
|
||||
if (cascade_cross_idx[g][m] == crossover_freq_idx) {
|
||||
for (s = m + 1; s < count[g]; s++) {
|
||||
cascade_cross_idx[g][s - 1] = cascade_cross_idx[g][s];
|
||||
}
|
||||
if (match_found == 0)
|
||||
count[g]--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (match_found == 1)
|
||||
{
|
||||
for (g=0; g<num_ph_align_ch_groups; g++)
|
||||
{
|
||||
for (m=0; m<count[g]; m++)
|
||||
{
|
||||
if (cascade_cross_idx[g][m] == crossover_freq_idx)
|
||||
{
|
||||
for (s=m+1; s<count[g]; s++)
|
||||
{
|
||||
cascade_cross_idx[g][s-1] = cascade_cross_idx[g][s];
|
||||
}
|
||||
count[g]--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
for (g = 0; g < num_ph_align_ch_groups; g++) {
|
||||
num_filter = count[g];
|
||||
if (num_filter > 0) {
|
||||
for (i = 0; i < num_filter; i++) {
|
||||
impd_compute_filt_coeff(
|
||||
cascade_cross_idx[g][i], NULL, NULL,
|
||||
&(ia_filter_banks_struct->str_drc_filter_bank[g]
|
||||
.str_all_pass_cascade.str_all_pass_cascade_filter[i]
|
||||
.str_all_pass_stage),
|
||||
1);
|
||||
}
|
||||
ia_filter_banks_struct->str_drc_filter_bank[g]
|
||||
.str_all_pass_cascade.num_filter = num_filter;
|
||||
}
|
||||
|
||||
for (g=0; g<num_ph_align_ch_groups; g++)
|
||||
{
|
||||
num_filter = count[g];
|
||||
if(num_filter>0){
|
||||
for(i=0;i<num_filter;i++){
|
||||
impd_compute_filt_coeff(cascade_cross_idx[g][i],
|
||||
NULL,
|
||||
NULL,
|
||||
&(ia_filter_banks_struct->str_drc_filter_bank[g].str_all_pass_cascade.str_all_pass_cascade_filter[i].str_all_pass_stage),
|
||||
1);
|
||||
}
|
||||
ia_filter_banks_struct->str_drc_filter_bank[g].str_all_pass_cascade.num_filter = num_filter;
|
||||
}
|
||||
if (err_code != 0) return (err_code);
|
||||
}
|
||||
|
||||
if (err_code!=0)
|
||||
return (err_code);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
VOID impd_iir_second_order_filter_all_pass(ia_iir_filter_struct* filter,
|
||||
WORD32 chan_idx,
|
||||
WORD32 frame_len,
|
||||
FLOAT32* input,
|
||||
FLOAT32* output)
|
||||
{
|
||||
WORD32 i;
|
||||
FLOAT32 tmp;
|
||||
FLOAT32 a1 = filter->a1;
|
||||
FLOAT32 a2 = filter->a2;
|
||||
FLOAT32 b0 = filter->b0;
|
||||
FLOAT32 b1 = filter->b1;
|
||||
FLOAT32 b2 = filter->b2;
|
||||
WORD32 chan_idx, WORD32 frame_len,
|
||||
FLOAT32* input, FLOAT32* output) {
|
||||
WORD32 i;
|
||||
FLOAT32 tmp;
|
||||
FLOAT32 a1 = filter->a1;
|
||||
FLOAT32 a2 = filter->a2;
|
||||
FLOAT32 b0 = filter->b0;
|
||||
FLOAT32 b1 = filter->b1;
|
||||
FLOAT32 b2 = filter->b2;
|
||||
|
||||
FLOAT32 st1 = filter->x_p[chan_idx*2];
|
||||
FLOAT32 st2 = filter->y_p[chan_idx*2];
|
||||
FLOAT32 st1 = filter->x_p[chan_idx * 2];
|
||||
FLOAT32 st2 = filter->y_p[chan_idx * 2];
|
||||
|
||||
for (i=0; i<frame_len; i++)
|
||||
{
|
||||
tmp = input[i];
|
||||
output[i] = b0 * tmp + st1;
|
||||
st1 = b1 * tmp - a1 * output[i] + st2;
|
||||
st2 = b2 * tmp - a2 * output[i];
|
||||
}
|
||||
filter->x_p[chan_idx*2] = st1;
|
||||
filter->y_p[chan_idx*2] = st2;
|
||||
for (i = 0; i < frame_len; i++) {
|
||||
tmp = input[i];
|
||||
output[i] = b0 * tmp + st1;
|
||||
st1 = b1 * tmp - a1 * output[i] + st2;
|
||||
st2 = b2 * tmp - a2 * output[i];
|
||||
}
|
||||
filter->x_p[chan_idx * 2] = st1;
|
||||
filter->y_p[chan_idx * 2] = st2;
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
VOID impd_apply_low_high_filter(ia_iir_filter_struct* pstr_lp_filt_coeff,
|
||||
ia_iir_filter_struct* pstr_hp_filt_coeff,
|
||||
WORD32 chan_idx,
|
||||
WORD32 frame_len,
|
||||
FLOAT32* input,
|
||||
FLOAT32* output[])
|
||||
{
|
||||
WORD32 i;
|
||||
FLOAT32 tmp, tmp1;
|
||||
FLOAT32 a1_l = pstr_lp_filt_coeff->a1;
|
||||
FLOAT32 a2_l = pstr_lp_filt_coeff->a2;
|
||||
FLOAT32 b0_l = pstr_lp_filt_coeff->b0;
|
||||
FLOAT32 b1_l = pstr_lp_filt_coeff->b1;
|
||||
FLOAT32 b2_l = pstr_lp_filt_coeff->b2;
|
||||
ia_iir_filter_struct* pstr_hp_filt_coeff,
|
||||
WORD32 chan_idx, WORD32 frame_len,
|
||||
FLOAT32* input, FLOAT32* output[]) {
|
||||
WORD32 i;
|
||||
FLOAT32 tmp, tmp1;
|
||||
FLOAT32 a1_l = pstr_lp_filt_coeff->a1;
|
||||
FLOAT32 a2_l = pstr_lp_filt_coeff->a2;
|
||||
FLOAT32 b0_l = pstr_lp_filt_coeff->b0;
|
||||
FLOAT32 b1_l = pstr_lp_filt_coeff->b1;
|
||||
FLOAT32 b2_l = pstr_lp_filt_coeff->b2;
|
||||
|
||||
FLOAT32 st1_l = pstr_lp_filt_coeff->x_p[chan_idx*2+0];
|
||||
FLOAT32 st2_l = pstr_lp_filt_coeff->x_p[chan_idx*2+1];
|
||||
FLOAT32 st3_l = pstr_lp_filt_coeff->y_p[chan_idx*2+0];
|
||||
FLOAT32 st4_l = pstr_lp_filt_coeff->y_p[chan_idx*2+1];
|
||||
FLOAT32 st1_l = pstr_lp_filt_coeff->x_p[chan_idx * 2 + 0];
|
||||
FLOAT32 st2_l = pstr_lp_filt_coeff->x_p[chan_idx * 2 + 1];
|
||||
FLOAT32 st3_l = pstr_lp_filt_coeff->y_p[chan_idx * 2 + 0];
|
||||
FLOAT32 st4_l = pstr_lp_filt_coeff->y_p[chan_idx * 2 + 1];
|
||||
|
||||
FLOAT32 a1_h = pstr_hp_filt_coeff->a1;
|
||||
FLOAT32 a2_h = pstr_hp_filt_coeff->a2;
|
||||
FLOAT32 b0_h = pstr_hp_filt_coeff->b0;
|
||||
FLOAT32 b1_h = pstr_hp_filt_coeff->b1;
|
||||
FLOAT32 b2_h = pstr_hp_filt_coeff->b2;
|
||||
FLOAT32 a1_h = pstr_hp_filt_coeff->a1;
|
||||
FLOAT32 a2_h = pstr_hp_filt_coeff->a2;
|
||||
FLOAT32 b0_h = pstr_hp_filt_coeff->b0;
|
||||
FLOAT32 b1_h = pstr_hp_filt_coeff->b1;
|
||||
FLOAT32 b2_h = pstr_hp_filt_coeff->b2;
|
||||
|
||||
FLOAT32 st1_h = pstr_hp_filt_coeff->x_p[chan_idx*2+0];
|
||||
FLOAT32 st2_h = pstr_hp_filt_coeff->x_p[chan_idx*2+1];
|
||||
FLOAT32 st3_h = pstr_hp_filt_coeff->y_p[chan_idx*2+0];
|
||||
FLOAT32 st4_h = pstr_hp_filt_coeff->y_p[chan_idx*2+1];
|
||||
FLOAT32 st1_h = pstr_hp_filt_coeff->x_p[chan_idx * 2 + 0];
|
||||
FLOAT32 st2_h = pstr_hp_filt_coeff->x_p[chan_idx * 2 + 1];
|
||||
FLOAT32 st3_h = pstr_hp_filt_coeff->y_p[chan_idx * 2 + 0];
|
||||
FLOAT32 st4_h = pstr_hp_filt_coeff->y_p[chan_idx * 2 + 1];
|
||||
|
||||
FLOAT32* output_low = output[0];
|
||||
FLOAT32* output_high = output[1];
|
||||
FLOAT32* output_low = output[0];
|
||||
FLOAT32* output_high = output[1];
|
||||
|
||||
for (i=0; i<frame_len; i++)
|
||||
{
|
||||
tmp1 = input[i];
|
||||
tmp = b0_l * tmp1 + st1_l;
|
||||
st1_l = b1_l * tmp1 - a1_l * tmp + st2_l;
|
||||
st2_l = b2_l * tmp1 - a2_l * tmp;
|
||||
for (i = 0; i < frame_len; i++) {
|
||||
tmp1 = input[i];
|
||||
tmp = b0_l * tmp1 + st1_l;
|
||||
st1_l = b1_l * tmp1 - a1_l * tmp + st2_l;
|
||||
st2_l = b2_l * tmp1 - a2_l * tmp;
|
||||
|
||||
output_low[i] = b0_l * tmp + st3_l;
|
||||
st3_l = b1_l * tmp - a1_l * output_low[i] + st4_l;
|
||||
st4_l = b2_l * tmp - a2_l * output_low[i];
|
||||
output_low[i] = b0_l * tmp + st3_l;
|
||||
st3_l = b1_l * tmp - a1_l * output_low[i] + st4_l;
|
||||
st4_l = b2_l * tmp - a2_l * output_low[i];
|
||||
|
||||
tmp = b0_h * tmp1 + st1_h;
|
||||
st1_h = b1_h * tmp1 - a1_h * tmp + st2_h;
|
||||
st2_h = b2_h * tmp1 - a2_h * tmp;
|
||||
tmp = b0_h * tmp1 + st1_h;
|
||||
st1_h = b1_h * tmp1 - a1_h * tmp + st2_h;
|
||||
st2_h = b2_h * tmp1 - a2_h * tmp;
|
||||
|
||||
output_high[i] = b0_h * tmp + st3_h;
|
||||
st3_h = b1_h * tmp - a1_h * output_high[i] + st4_h;
|
||||
st4_h = b2_h * tmp - a2_h * output_high[i];
|
||||
}
|
||||
pstr_lp_filt_coeff->x_p[chan_idx*2+0] = st1_l;
|
||||
pstr_lp_filt_coeff->x_p[chan_idx*2+1] = st2_l;
|
||||
pstr_lp_filt_coeff->y_p[chan_idx*2+0] = st3_l;
|
||||
pstr_lp_filt_coeff->y_p[chan_idx*2+1] = st4_l;
|
||||
output_high[i] = b0_h * tmp + st3_h;
|
||||
st3_h = b1_h * tmp - a1_h * output_high[i] + st4_h;
|
||||
st4_h = b2_h * tmp - a2_h * output_high[i];
|
||||
}
|
||||
pstr_lp_filt_coeff->x_p[chan_idx * 2 + 0] = st1_l;
|
||||
pstr_lp_filt_coeff->x_p[chan_idx * 2 + 1] = st2_l;
|
||||
pstr_lp_filt_coeff->y_p[chan_idx * 2 + 0] = st3_l;
|
||||
pstr_lp_filt_coeff->y_p[chan_idx * 2 + 1] = st4_l;
|
||||
|
||||
pstr_hp_filt_coeff->x_p[chan_idx*2+0] = st1_h;
|
||||
pstr_hp_filt_coeff->x_p[chan_idx*2+1] = st2_h;
|
||||
pstr_hp_filt_coeff->y_p[chan_idx*2+0] = st3_h;
|
||||
pstr_hp_filt_coeff->y_p[chan_idx*2+1] = st4_h;
|
||||
pstr_hp_filt_coeff->x_p[chan_idx * 2 + 0] = st1_h;
|
||||
pstr_hp_filt_coeff->x_p[chan_idx * 2 + 1] = st2_h;
|
||||
pstr_hp_filt_coeff->y_p[chan_idx * 2 + 0] = st3_h;
|
||||
pstr_hp_filt_coeff->y_p[chan_idx * 2 + 1] = st4_h;
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
VOID impd_two_band_filter_process(ia_two_band_filt_struct* str_two_band_bank,
|
||||
WORD32 chan_idx,
|
||||
WORD32 frame_len,
|
||||
FLOAT32* input,
|
||||
FLOAT32* output[])
|
||||
{
|
||||
ia_iir_filter_struct* pstr_lp_filt_coeff=&str_two_band_bank->low_pass;
|
||||
ia_iir_filter_struct* pstr_hp_filt_coeff=&str_two_band_bank->high_pass;
|
||||
WORD32 chan_idx, WORD32 frame_len,
|
||||
FLOAT32* input, FLOAT32* output[]) {
|
||||
ia_iir_filter_struct* pstr_lp_filt_coeff = &str_two_band_bank->low_pass;
|
||||
ia_iir_filter_struct* pstr_hp_filt_coeff = &str_two_band_bank->high_pass;
|
||||
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff,
|
||||
pstr_hp_filt_coeff,
|
||||
chan_idx,
|
||||
frame_len,
|
||||
input,
|
||||
output);
|
||||
return;
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, chan_idx,
|
||||
frame_len, input, output);
|
||||
return;
|
||||
}
|
||||
|
||||
VOID impd_three_band_filter_process(
|
||||
ia_three_band_filt_struct* str_three_band_bank, WORD32 c, WORD32 size,
|
||||
FLOAT32* input, FLOAT32* output[]) {
|
||||
WORD32 err_code = 0;
|
||||
ia_iir_filter_struct* all_pass_filter;
|
||||
ia_iir_filter_struct* pstr_lp_filt_coeff =
|
||||
&str_three_band_bank->str_low_pass_stage_1;
|
||||
ia_iir_filter_struct* pstr_hp_filt_coeff =
|
||||
&str_three_band_bank->str_high_pass_stage_1;
|
||||
FLOAT32* output1[2];
|
||||
output1[0] = output[0];
|
||||
output1[1] = output[1];
|
||||
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, c, size,
|
||||
input, output1);
|
||||
|
||||
VOID impd_three_band_filter_process(ia_three_band_filt_struct* str_three_band_bank,
|
||||
WORD32 c,
|
||||
WORD32 size,
|
||||
FLOAT32* input,
|
||||
FLOAT32* output[])
|
||||
{
|
||||
WORD32 err_code=0;
|
||||
ia_iir_filter_struct* all_pass_filter;
|
||||
ia_iir_filter_struct* pstr_lp_filt_coeff=&str_three_band_bank->str_low_pass_stage_1;
|
||||
ia_iir_filter_struct* pstr_hp_filt_coeff=&str_three_band_bank->str_high_pass_stage_1;
|
||||
FLOAT32* output1[2];
|
||||
output1[0]=output[0];
|
||||
output1[1]=output[1];
|
||||
all_pass_filter = &str_three_band_bank->str_all_pass_stage_2;
|
||||
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff,
|
||||
pstr_hp_filt_coeff,
|
||||
c,
|
||||
size,
|
||||
input,
|
||||
output1);
|
||||
impd_iir_second_order_filter_all_pass(all_pass_filter, c, size, output1[1],
|
||||
output[2]);
|
||||
pstr_lp_filt_coeff = &str_three_band_bank->str_low_pass_stage_2;
|
||||
pstr_hp_filt_coeff = &str_three_band_bank->str_high_pass_stage_2;
|
||||
|
||||
all_pass_filter =&str_three_band_bank->str_all_pass_stage_2;
|
||||
|
||||
impd_iir_second_order_filter_all_pass(all_pass_filter,
|
||||
c,
|
||||
size,
|
||||
output1[1],
|
||||
output[2]);
|
||||
pstr_lp_filt_coeff=&str_three_band_bank->str_low_pass_stage_2;
|
||||
pstr_hp_filt_coeff=&str_three_band_bank->str_high_pass_stage_2;
|
||||
|
||||
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff,
|
||||
pstr_hp_filt_coeff,
|
||||
c,
|
||||
size,
|
||||
output1[0],
|
||||
output1);
|
||||
|
||||
return;
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, c, size,
|
||||
output1[0], output1);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
VOID impd_four_band_filter_process(ia_four_band_filt_struct* str_four_band_bank,
|
||||
WORD32 cha_idx,
|
||||
WORD32 win_size,
|
||||
FLOAT32* input,
|
||||
FLOAT32* output[])
|
||||
{
|
||||
WORD32 err_code=0;
|
||||
ia_iir_filter_struct* all_pass_filter;
|
||||
ia_iir_filter_struct* pstr_lp_filt_coeff=&str_four_band_bank->str_low_pass_stage_1;
|
||||
ia_iir_filter_struct* pstr_hp_filt_coeff=&str_four_band_bank->str_high_pass_stage_1;
|
||||
FLOAT32* output1[2];
|
||||
FLOAT32* output2[2];
|
||||
output1[0]=output[0];
|
||||
output1[1]=output[1];
|
||||
output2[0]=output[2];
|
||||
output2[1]=output[3];
|
||||
WORD32 cha_idx, WORD32 win_size,
|
||||
FLOAT32* input, FLOAT32* output[]) {
|
||||
WORD32 err_code = 0;
|
||||
ia_iir_filter_struct* all_pass_filter;
|
||||
ia_iir_filter_struct* pstr_lp_filt_coeff =
|
||||
&str_four_band_bank->str_low_pass_stage_1;
|
||||
ia_iir_filter_struct* pstr_hp_filt_coeff =
|
||||
&str_four_band_bank->str_high_pass_stage_1;
|
||||
FLOAT32* output1[2];
|
||||
FLOAT32* output2[2];
|
||||
output1[0] = output[0];
|
||||
output1[1] = output[1];
|
||||
output2[0] = output[2];
|
||||
output2[1] = output[3];
|
||||
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff,
|
||||
pstr_hp_filt_coeff,
|
||||
cha_idx,
|
||||
win_size,
|
||||
input,
|
||||
output1);
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, cha_idx,
|
||||
win_size, input, output1);
|
||||
|
||||
all_pass_filter =&str_four_band_bank->str_all_pass_stage_2_low;
|
||||
all_pass_filter = &str_four_band_bank->str_all_pass_stage_2_low;
|
||||
|
||||
impd_iir_second_order_filter_all_pass(all_pass_filter,
|
||||
cha_idx,
|
||||
win_size,
|
||||
output1[0],
|
||||
output1[0]);
|
||||
impd_iir_second_order_filter_all_pass(all_pass_filter, cha_idx, win_size,
|
||||
output1[0], output1[0]);
|
||||
|
||||
all_pass_filter = &str_four_band_bank->str_all_pass_stage_2_high;
|
||||
|
||||
all_pass_filter =&str_four_band_bank->str_all_pass_stage_2_high;
|
||||
impd_iir_second_order_filter_all_pass(all_pass_filter, cha_idx, win_size,
|
||||
output1[1], output2[0]);
|
||||
|
||||
impd_iir_second_order_filter_all_pass(all_pass_filter,
|
||||
cha_idx,
|
||||
win_size,
|
||||
output1[1],
|
||||
output2[0]);
|
||||
pstr_lp_filt_coeff = &str_four_band_bank->str_low_pass_stage_3_low;
|
||||
pstr_hp_filt_coeff = &str_four_band_bank->str_high_pass_stage_3_low;
|
||||
|
||||
pstr_lp_filt_coeff = &str_four_band_bank->str_low_pass_stage_3_low;
|
||||
pstr_hp_filt_coeff = &str_four_band_bank->str_high_pass_stage_3_low;
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, cha_idx,
|
||||
win_size, output1[0], output1);
|
||||
|
||||
pstr_lp_filt_coeff = &str_four_band_bank->str_low_pass_stage_3_high;
|
||||
pstr_hp_filt_coeff = &str_four_band_bank->str_high_pass_stage_3_high;
|
||||
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff,
|
||||
pstr_hp_filt_coeff,
|
||||
cha_idx,
|
||||
win_size,
|
||||
output1[0],
|
||||
output1);
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, cha_idx,
|
||||
win_size, output2[0], output2);
|
||||
|
||||
pstr_lp_filt_coeff = &str_four_band_bank->str_low_pass_stage_3_high;
|
||||
pstr_hp_filt_coeff = &str_four_band_bank->str_high_pass_stage_3_high;
|
||||
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff,
|
||||
pstr_hp_filt_coeff,
|
||||
cha_idx,
|
||||
win_size,
|
||||
output2[0],
|
||||
output2);
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
VOID impd_all_pass_cascade_process(ia_all_pass_cascade_struct *str_all_pass_cascade,
|
||||
WORD32 ch_idx,
|
||||
WORD32 win_size,
|
||||
FLOAT32* input)
|
||||
{
|
||||
WORD32 i;
|
||||
VOID impd_all_pass_cascade_process(
|
||||
ia_all_pass_cascade_struct* str_all_pass_cascade, WORD32 ch_idx,
|
||||
WORD32 win_size, FLOAT32* input) {
|
||||
WORD32 i;
|
||||
|
||||
for (i=0; i<str_all_pass_cascade->num_filter; i++)
|
||||
{
|
||||
impd_iir_second_order_filter_all_pass (&(str_all_pass_cascade->str_all_pass_cascade_filter[i].str_all_pass_stage),
|
||||
ch_idx,
|
||||
win_size,
|
||||
input,
|
||||
input);
|
||||
}
|
||||
for (i = 0; i < str_all_pass_cascade->num_filter; i++) {
|
||||
impd_iir_second_order_filter_all_pass(
|
||||
&(str_all_pass_cascade->str_all_pass_cascade_filter[i]
|
||||
.str_all_pass_stage),
|
||||
ch_idx, win_size, input, input);
|
||||
}
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
|
@ -29,477 +29,403 @@
|
|||
#include "impd_drc_rom.h"
|
||||
|
||||
VOID impd_compute_filt_coeff(WORD32 crossover_freq_idx,
|
||||
ia_iir_filter_struct* pstr_lp_filt_coeff,
|
||||
ia_iir_filter_struct* pstr_hp_filt_coeff,
|
||||
ia_iir_filter_struct* pstr_ap_filt_coeff,
|
||||
WORD32 filter_type)
|
||||
{
|
||||
FLOAT32 gamma = normal_cross_freq[crossover_freq_idx].gamma;
|
||||
FLOAT32 delta = normal_cross_freq[crossover_freq_idx].delta;
|
||||
ia_iir_filter_struct* pstr_lp_filt_coeff,
|
||||
ia_iir_filter_struct* pstr_hp_filt_coeff,
|
||||
ia_iir_filter_struct* pstr_ap_filt_coeff,
|
||||
WORD32 filter_type) {
|
||||
FLOAT32 gamma = normal_cross_freq[crossover_freq_idx].gamma;
|
||||
FLOAT32 delta = normal_cross_freq[crossover_freq_idx].delta;
|
||||
|
||||
if(filter_type==0||filter_type==2){
|
||||
pstr_lp_filt_coeff->a0 = 1.0f;
|
||||
pstr_lp_filt_coeff->a1 = 2.0f * (gamma - delta);
|
||||
pstr_lp_filt_coeff->a2 = 2.0f * (gamma + delta) - 1.0f;
|
||||
pstr_lp_filt_coeff->b0 = gamma;
|
||||
pstr_lp_filt_coeff->b1 = 2.0f * gamma;
|
||||
pstr_lp_filt_coeff->b2 = gamma;
|
||||
if (filter_type == 0 || filter_type == 2) {
|
||||
pstr_lp_filt_coeff->a0 = 1.0f;
|
||||
pstr_lp_filt_coeff->a1 = 2.0f * (gamma - delta);
|
||||
pstr_lp_filt_coeff->a2 = 2.0f * (gamma + delta) - 1.0f;
|
||||
pstr_lp_filt_coeff->b0 = gamma;
|
||||
pstr_lp_filt_coeff->b1 = 2.0f * gamma;
|
||||
pstr_lp_filt_coeff->b2 = gamma;
|
||||
|
||||
pstr_hp_filt_coeff->a0 = 1.0f;
|
||||
pstr_hp_filt_coeff->a1 = pstr_lp_filt_coeff->a1;
|
||||
pstr_hp_filt_coeff->a2 = pstr_lp_filt_coeff->a2;
|
||||
pstr_hp_filt_coeff->b0 = delta;
|
||||
pstr_hp_filt_coeff->b1 = - 2.0f * delta;
|
||||
pstr_hp_filt_coeff->b2 = delta;
|
||||
}
|
||||
pstr_hp_filt_coeff->a0 = 1.0f;
|
||||
pstr_hp_filt_coeff->a1 = pstr_lp_filt_coeff->a1;
|
||||
pstr_hp_filt_coeff->a2 = pstr_lp_filt_coeff->a2;
|
||||
pstr_hp_filt_coeff->b0 = delta;
|
||||
pstr_hp_filt_coeff->b1 = -2.0f * delta;
|
||||
pstr_hp_filt_coeff->b2 = delta;
|
||||
}
|
||||
|
||||
if(filter_type==1||filter_type==2){
|
||||
pstr_ap_filt_coeff->a0 = 1.0f;
|
||||
pstr_ap_filt_coeff->a1 = 2.0f * (gamma - delta);;
|
||||
pstr_ap_filt_coeff->a2 = 2.0f * (gamma + delta) - 1.0f;;
|
||||
pstr_ap_filt_coeff->b0 = pstr_ap_filt_coeff->a2;
|
||||
pstr_ap_filt_coeff->b1 = pstr_ap_filt_coeff->a1;
|
||||
pstr_ap_filt_coeff->b2 = pstr_ap_filt_coeff->a0;
|
||||
}
|
||||
if (filter_type == 1 || filter_type == 2) {
|
||||
pstr_ap_filt_coeff->a0 = 1.0f;
|
||||
pstr_ap_filt_coeff->a1 = 2.0f * (gamma - delta);
|
||||
;
|
||||
pstr_ap_filt_coeff->a2 = 2.0f * (gamma + delta) - 1.0f;
|
||||
;
|
||||
pstr_ap_filt_coeff->b0 = pstr_ap_filt_coeff->a2;
|
||||
pstr_ap_filt_coeff->b1 = pstr_ap_filt_coeff->a1;
|
||||
pstr_ap_filt_coeff->b2 = pstr_ap_filt_coeff->a0;
|
||||
}
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
WORD32 impd_initialize_filt_bank(WORD32 num_sub_bands,
|
||||
ia_gain_params_struct* gain_params,
|
||||
ia_drc_filter_bank_struct* drc_filter_bank)
|
||||
{
|
||||
ia_two_band_filt_struct* str_two_band_bank;
|
||||
ia_three_band_filt_struct* str_three_band_bank;
|
||||
ia_four_band_filt_struct* str_four_band_bank;
|
||||
drc_filter_bank->complexity = 0;
|
||||
drc_filter_bank->num_bands = num_sub_bands;
|
||||
|
||||
|
||||
if(num_sub_bands==1){
|
||||
return 0;
|
||||
}
|
||||
else if(num_sub_bands==2){
|
||||
str_two_band_bank = &drc_filter_bank->str_two_band_bank;
|
||||
impd_compute_filt_coeff(gain_params[1].crossover_freq_idx,
|
||||
&(str_two_band_bank->low_pass),
|
||||
&(str_two_band_bank->high_pass),
|
||||
NULL,
|
||||
0);
|
||||
}
|
||||
else if(num_sub_bands==3){
|
||||
str_three_band_bank = &drc_filter_bank->str_three_band_bank;
|
||||
|
||||
impd_compute_filt_coeff(gain_params[1].crossover_freq_idx,
|
||||
&(str_three_band_bank->str_low_pass_stage_2),
|
||||
&(str_three_band_bank->str_high_pass_stage_2),
|
||||
&(str_three_band_bank->str_all_pass_stage_2),
|
||||
2);
|
||||
impd_compute_filt_coeff(gain_params[2].crossover_freq_idx,
|
||||
&(str_three_band_bank->str_low_pass_stage_1),
|
||||
&(str_three_band_bank->str_high_pass_stage_1),
|
||||
NULL,
|
||||
0);
|
||||
}
|
||||
|
||||
else if(num_sub_bands==4){
|
||||
str_four_band_bank = &drc_filter_bank->str_four_band_bank;
|
||||
|
||||
impd_compute_filt_coeff(gain_params[1].crossover_freq_idx,
|
||||
&(str_four_band_bank->str_low_pass_stage_3_low),
|
||||
&(str_four_band_bank->str_high_pass_stage_3_low),
|
||||
&(str_four_band_bank->str_all_pass_stage_2_high),
|
||||
2);
|
||||
impd_compute_filt_coeff(gain_params[2].crossover_freq_idx,
|
||||
&(str_four_band_bank->str_low_pass_stage_1),
|
||||
&(str_four_band_bank->str_high_pass_stage_1),
|
||||
NULL,
|
||||
0);
|
||||
impd_compute_filt_coeff(gain_params[3].crossover_freq_idx,
|
||||
&(str_four_band_bank->str_low_pass_stage_3_high),
|
||||
&(str_four_band_bank->str_high_pass_stage_3_high),
|
||||
&(str_four_band_bank->str_all_pass_stage_2_low),
|
||||
2);
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
ia_gain_params_struct* gain_params,
|
||||
ia_drc_filter_bank_struct* drc_filter_bank) {
|
||||
ia_two_band_filt_struct* str_two_band_bank;
|
||||
ia_three_band_filt_struct* str_three_band_bank;
|
||||
ia_four_band_filt_struct* str_four_band_bank;
|
||||
drc_filter_bank->complexity = 0;
|
||||
drc_filter_bank->num_bands = num_sub_bands;
|
||||
|
||||
if (num_sub_bands == 1) {
|
||||
return 0;
|
||||
} else if (num_sub_bands == 2) {
|
||||
str_two_band_bank = &drc_filter_bank->str_two_band_bank;
|
||||
impd_compute_filt_coeff(gain_params[1].crossover_freq_idx,
|
||||
&(str_two_band_bank->low_pass),
|
||||
&(str_two_band_bank->high_pass), NULL, 0);
|
||||
} else if (num_sub_bands == 3) {
|
||||
str_three_band_bank = &drc_filter_bank->str_three_band_bank;
|
||||
|
||||
impd_compute_filt_coeff(gain_params[1].crossover_freq_idx,
|
||||
&(str_three_band_bank->str_low_pass_stage_2),
|
||||
&(str_three_band_bank->str_high_pass_stage_2),
|
||||
&(str_three_band_bank->str_all_pass_stage_2), 2);
|
||||
impd_compute_filt_coeff(gain_params[2].crossover_freq_idx,
|
||||
&(str_three_band_bank->str_low_pass_stage_1),
|
||||
&(str_three_band_bank->str_high_pass_stage_1), NULL,
|
||||
0);
|
||||
}
|
||||
|
||||
else if (num_sub_bands == 4) {
|
||||
str_four_band_bank = &drc_filter_bank->str_four_band_bank;
|
||||
|
||||
impd_compute_filt_coeff(gain_params[1].crossover_freq_idx,
|
||||
&(str_four_band_bank->str_low_pass_stage_3_low),
|
||||
&(str_four_band_bank->str_high_pass_stage_3_low),
|
||||
&(str_four_band_bank->str_all_pass_stage_2_high),
|
||||
2);
|
||||
impd_compute_filt_coeff(gain_params[2].crossover_freq_idx,
|
||||
&(str_four_band_bank->str_low_pass_stage_1),
|
||||
&(str_four_band_bank->str_high_pass_stage_1), NULL,
|
||||
0);
|
||||
impd_compute_filt_coeff(gain_params[3].crossover_freq_idx,
|
||||
&(str_four_band_bank->str_low_pass_stage_3_high),
|
||||
&(str_four_band_bank->str_high_pass_stage_3_high),
|
||||
&(str_four_band_bank->str_all_pass_stage_2_low), 2);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
WORD32 impd_init_all_filter_banks( ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc,
|
||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||
ia_filter_banks_struct* ia_filter_banks_struct)
|
||||
{
|
||||
WORD32 err_code=0;
|
||||
WORD32 b, g, i, k, m, s , crossover_freq_idx, num_ch_in_groups, num_ph_align_ch_groups;
|
||||
WORD32 match_found = 0, num_filter;
|
||||
WORD32 cascade_cross_idx[CHANNEL_GROUP_COUNT_MAX+1][CHANNEL_GROUP_COUNT_MAX * 3];
|
||||
WORD32 count[CHANNEL_GROUP_COUNT_MAX + 1];
|
||||
WORD32 impd_init_all_filter_banks(
|
||||
ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc,
|
||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||
ia_filter_banks_struct* ia_filter_banks_struct) {
|
||||
WORD32 err_code = 0;
|
||||
WORD32 b, g, i, k, m, s, crossover_freq_idx, num_ch_in_groups,
|
||||
num_ph_align_ch_groups;
|
||||
WORD32 match_found = 0, num_filter;
|
||||
WORD32 cascade_cross_idx[CHANNEL_GROUP_COUNT_MAX + 1]
|
||||
[CHANNEL_GROUP_COUNT_MAX * 3];
|
||||
WORD32 count[CHANNEL_GROUP_COUNT_MAX + 1];
|
||||
|
||||
num_ch_in_groups = 0;
|
||||
num_ph_align_ch_groups = str_drc_instruction_str->num_drc_ch_groups;
|
||||
num_ch_in_groups = 0;
|
||||
num_ph_align_ch_groups = str_drc_instruction_str->num_drc_ch_groups;
|
||||
|
||||
for (g = 0; g < str_drc_instruction_str->num_drc_ch_groups; g++) {
|
||||
num_ch_in_groups += str_drc_instruction_str->num_chan_per_ch_group[g];
|
||||
}
|
||||
|
||||
for (g=0; g<str_drc_instruction_str->num_drc_ch_groups; g++)
|
||||
{
|
||||
num_ch_in_groups += str_drc_instruction_str->num_chan_per_ch_group[g];
|
||||
if (num_ch_in_groups < str_drc_instruction_str->audio_num_chan) {
|
||||
num_ph_align_ch_groups++;
|
||||
}
|
||||
|
||||
ia_filter_banks_struct->nfilter_banks =
|
||||
str_drc_instruction_str->num_drc_ch_groups;
|
||||
ia_filter_banks_struct->num_ph_align_ch_groups = num_ph_align_ch_groups;
|
||||
|
||||
if (str_p_loc_drc_coefficients_uni_drc == NULL) {
|
||||
ia_filter_banks_struct->str_drc_filter_bank->num_bands = 1;
|
||||
} else {
|
||||
for (g = 0; g < str_drc_instruction_str->num_drc_ch_groups; g++) {
|
||||
err_code = impd_initialize_filt_bank(
|
||||
str_p_loc_drc_coefficients_uni_drc
|
||||
->gain_set_params[str_drc_instruction_str
|
||||
->gain_set_index_for_channel_group[g]]
|
||||
.band_count,
|
||||
str_p_loc_drc_coefficients_uni_drc
|
||||
->gain_set_params[str_drc_instruction_str
|
||||
->gain_set_index_for_channel_group[g]]
|
||||
.gain_params,
|
||||
&(ia_filter_banks_struct->str_drc_filter_bank[g]));
|
||||
if (err_code != 0) return (err_code);
|
||||
}
|
||||
}
|
||||
|
||||
if (num_ch_in_groups < str_drc_instruction_str->audio_num_chan)
|
||||
{
|
||||
num_ph_align_ch_groups++;
|
||||
}
|
||||
|
||||
ia_filter_banks_struct->nfilter_banks = str_drc_instruction_str->num_drc_ch_groups;
|
||||
ia_filter_banks_struct->num_ph_align_ch_groups = num_ph_align_ch_groups;
|
||||
|
||||
if (str_p_loc_drc_coefficients_uni_drc == NULL)
|
||||
{
|
||||
ia_filter_banks_struct->str_drc_filter_bank->num_bands = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (g=0; g<str_drc_instruction_str->num_drc_ch_groups; g++)
|
||||
{
|
||||
err_code = impd_initialize_filt_bank(str_p_loc_drc_coefficients_uni_drc->gain_set_params[str_drc_instruction_str->gain_set_index_for_channel_group[g]].band_count,
|
||||
str_p_loc_drc_coefficients_uni_drc->gain_set_params[str_drc_instruction_str->gain_set_index_for_channel_group[g]].gain_params,
|
||||
&(ia_filter_banks_struct->str_drc_filter_bank[g]));
|
||||
if (err_code!=0)
|
||||
return (err_code);
|
||||
for (g = 0; g < CHANNEL_GROUP_COUNT_MAX + 1; g++) {
|
||||
count[g] = 0;
|
||||
}
|
||||
for (g = 0; g < str_drc_instruction_str->num_drc_ch_groups; g++) {
|
||||
for (b = 1;
|
||||
b < str_p_loc_drc_coefficients_uni_drc
|
||||
->gain_set_params[str_drc_instruction_str
|
||||
->gain_set_index_for_channel_group[g]]
|
||||
.band_count;
|
||||
b++) {
|
||||
crossover_freq_idx =
|
||||
str_p_loc_drc_coefficients_uni_drc
|
||||
->gain_set_params[str_drc_instruction_str
|
||||
->gain_set_index_for_channel_group[g]]
|
||||
.gain_params[b]
|
||||
.crossover_freq_idx;
|
||||
for (k = 0; k < num_ph_align_ch_groups; k++) {
|
||||
if (k != g) {
|
||||
cascade_cross_idx[k][count[k]] = crossover_freq_idx;
|
||||
count[k]++;
|
||||
if (count[k] > CHANNEL_GROUP_COUNT_MAX * 3) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (g=0; g<CHANNEL_GROUP_COUNT_MAX + 1; g++)
|
||||
{
|
||||
count[g] = 0;
|
||||
}
|
||||
for (g=0; g<str_drc_instruction_str->num_drc_ch_groups; g++)
|
||||
{
|
||||
for (b=1; b<str_p_loc_drc_coefficients_uni_drc->gain_set_params[str_drc_instruction_str->gain_set_index_for_channel_group[g]].band_count; b++)
|
||||
{
|
||||
crossover_freq_idx = str_p_loc_drc_coefficients_uni_drc->gain_set_params[str_drc_instruction_str->gain_set_index_for_channel_group[g]].gain_params[b].crossover_freq_idx;
|
||||
for (k=0; k<num_ph_align_ch_groups; k++)
|
||||
{
|
||||
if (k!=g)
|
||||
{
|
||||
cascade_cross_idx[k][count[k]] = crossover_freq_idx;
|
||||
count[k]++;
|
||||
if (count[k] > CHANNEL_GROUP_COUNT_MAX * 3)
|
||||
{
|
||||
return -1 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
while (i < count[0]) {
|
||||
crossover_freq_idx = cascade_cross_idx[0][i];
|
||||
match_found = 0;
|
||||
for (g = 1; g < num_ph_align_ch_groups; g++) {
|
||||
match_found = 0;
|
||||
for (k = 0; k < count[g]; k++) {
|
||||
if (cascade_cross_idx[g][k] == crossover_freq_idx) {
|
||||
match_found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (match_found == 0) break;
|
||||
}
|
||||
|
||||
i=0;
|
||||
while (i<count[0])
|
||||
{
|
||||
crossover_freq_idx = cascade_cross_idx[0][i];
|
||||
match_found = 0;
|
||||
for (g=1; g<num_ph_align_ch_groups; g++)
|
||||
{
|
||||
match_found = 0;
|
||||
for (k=0; k<count[g]; k++)
|
||||
{
|
||||
if (cascade_cross_idx[g][k] == crossover_freq_idx)
|
||||
{
|
||||
match_found = 1;
|
||||
break;
|
||||
}
|
||||
if (match_found == 1) {
|
||||
for (g = 0; g < num_ph_align_ch_groups; g++) {
|
||||
for (m = 0; m < count[g]; m++) {
|
||||
if (cascade_cross_idx[g][m] == crossover_freq_idx) {
|
||||
for (s = m + 1; s < count[g]; s++) {
|
||||
cascade_cross_idx[g][s - 1] = cascade_cross_idx[g][s];
|
||||
}
|
||||
if (match_found == 0)
|
||||
count[g]--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (match_found == 1)
|
||||
{
|
||||
for (g=0; g<num_ph_align_ch_groups; g++)
|
||||
{
|
||||
for (m=0; m<count[g]; m++)
|
||||
{
|
||||
if (cascade_cross_idx[g][m] == crossover_freq_idx)
|
||||
{
|
||||
for (s=m+1; s<count[g]; s++)
|
||||
{
|
||||
cascade_cross_idx[g][s-1] = cascade_cross_idx[g][s];
|
||||
}
|
||||
count[g]--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
for (g = 0; g < num_ph_align_ch_groups; g++) {
|
||||
num_filter = count[g];
|
||||
if (num_filter > 0) {
|
||||
for (i = 0; i < num_filter; i++) {
|
||||
impd_compute_filt_coeff(
|
||||
cascade_cross_idx[g][i], NULL, NULL,
|
||||
&(ia_filter_banks_struct->str_drc_filter_bank[g]
|
||||
.str_all_pass_cascade.str_all_pass_cascade_filter[i]
|
||||
.str_all_pass_stage),
|
||||
1);
|
||||
}
|
||||
ia_filter_banks_struct->str_drc_filter_bank[g]
|
||||
.str_all_pass_cascade.num_filter = num_filter;
|
||||
}
|
||||
|
||||
for (g=0; g<num_ph_align_ch_groups; g++)
|
||||
{
|
||||
num_filter = count[g];
|
||||
if(num_filter>0){
|
||||
for(i=0;i<num_filter;i++){
|
||||
impd_compute_filt_coeff(cascade_cross_idx[g][i],
|
||||
NULL,
|
||||
NULL,
|
||||
&(ia_filter_banks_struct->str_drc_filter_bank[g].str_all_pass_cascade.str_all_pass_cascade_filter[i].str_all_pass_stage),
|
||||
1);
|
||||
}
|
||||
ia_filter_banks_struct->str_drc_filter_bank[g].str_all_pass_cascade.num_filter = num_filter;
|
||||
}
|
||||
if (err_code != 0) return (err_code);
|
||||
}
|
||||
|
||||
if (err_code!=0)
|
||||
return (err_code);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
VOID impd_iir_second_order_filter_all_pass(ia_iir_filter_struct* filter,
|
||||
WORD32 chan_idx,
|
||||
WORD32 frame_len,
|
||||
FLOAT32* input,
|
||||
FLOAT32* output)
|
||||
{
|
||||
WORD32 i;
|
||||
FLOAT32 tmp;
|
||||
FLOAT32 a1 = filter->a1;
|
||||
FLOAT32 a2 = filter->a2;
|
||||
FLOAT32 b0 = filter->b0;
|
||||
FLOAT32 b1 = filter->b1;
|
||||
FLOAT32 b2 = filter->b2;
|
||||
WORD32 chan_idx, WORD32 frame_len,
|
||||
FLOAT32* input, FLOAT32* output) {
|
||||
WORD32 i;
|
||||
FLOAT32 tmp;
|
||||
FLOAT32 a1 = filter->a1;
|
||||
FLOAT32 a2 = filter->a2;
|
||||
FLOAT32 b0 = filter->b0;
|
||||
FLOAT32 b1 = filter->b1;
|
||||
FLOAT32 b2 = filter->b2;
|
||||
|
||||
FLOAT32 st1 = filter->x_p[chan_idx*2];
|
||||
FLOAT32 st2 = filter->y_p[chan_idx*2];
|
||||
FLOAT32 st1 = filter->x_p[chan_idx * 2];
|
||||
FLOAT32 st2 = filter->y_p[chan_idx * 2];
|
||||
|
||||
for (i=0; i<frame_len; i++)
|
||||
{
|
||||
tmp = input[i];
|
||||
output[i] = b0 * tmp + st1;
|
||||
st1 = b1 * tmp - a1 * output[i] + st2;
|
||||
st2 = b2 * tmp - a2 * output[i];
|
||||
}
|
||||
filter->x_p[chan_idx*2] = st1;
|
||||
filter->y_p[chan_idx*2] = st2;
|
||||
for (i = 0; i < frame_len; i++) {
|
||||
tmp = input[i];
|
||||
output[i] = b0 * tmp + st1;
|
||||
st1 = b1 * tmp - a1 * output[i] + st2;
|
||||
st2 = b2 * tmp - a2 * output[i];
|
||||
}
|
||||
filter->x_p[chan_idx * 2] = st1;
|
||||
filter->y_p[chan_idx * 2] = st2;
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
VOID impd_apply_low_high_filter(ia_iir_filter_struct* pstr_lp_filt_coeff,
|
||||
ia_iir_filter_struct* pstr_hp_filt_coeff,
|
||||
WORD32 chan_idx,
|
||||
WORD32 frame_len,
|
||||
FLOAT32* input,
|
||||
FLOAT32* output[])
|
||||
{
|
||||
WORD32 i;
|
||||
FLOAT32 tmp, tmp1;
|
||||
FLOAT32 a1_l = pstr_lp_filt_coeff->a1;
|
||||
FLOAT32 a2_l = pstr_lp_filt_coeff->a2;
|
||||
FLOAT32 b0_l = pstr_lp_filt_coeff->b0;
|
||||
FLOAT32 b1_l = pstr_lp_filt_coeff->b1;
|
||||
FLOAT32 b2_l = pstr_lp_filt_coeff->b2;
|
||||
ia_iir_filter_struct* pstr_hp_filt_coeff,
|
||||
WORD32 chan_idx, WORD32 frame_len,
|
||||
FLOAT32* input, FLOAT32* output[]) {
|
||||
WORD32 i;
|
||||
FLOAT32 tmp, tmp1;
|
||||
FLOAT32 a1_l = pstr_lp_filt_coeff->a1;
|
||||
FLOAT32 a2_l = pstr_lp_filt_coeff->a2;
|
||||
FLOAT32 b0_l = pstr_lp_filt_coeff->b0;
|
||||
FLOAT32 b1_l = pstr_lp_filt_coeff->b1;
|
||||
FLOAT32 b2_l = pstr_lp_filt_coeff->b2;
|
||||
|
||||
FLOAT32 st1_l = pstr_lp_filt_coeff->x_p[chan_idx*2+0];
|
||||
FLOAT32 st2_l = pstr_lp_filt_coeff->x_p[chan_idx*2+1];
|
||||
FLOAT32 st3_l = pstr_lp_filt_coeff->y_p[chan_idx*2+0];
|
||||
FLOAT32 st4_l = pstr_lp_filt_coeff->y_p[chan_idx*2+1];
|
||||
FLOAT32 st1_l = pstr_lp_filt_coeff->x_p[chan_idx * 2 + 0];
|
||||
FLOAT32 st2_l = pstr_lp_filt_coeff->x_p[chan_idx * 2 + 1];
|
||||
FLOAT32 st3_l = pstr_lp_filt_coeff->y_p[chan_idx * 2 + 0];
|
||||
FLOAT32 st4_l = pstr_lp_filt_coeff->y_p[chan_idx * 2 + 1];
|
||||
|
||||
FLOAT32 a1_h = pstr_hp_filt_coeff->a1;
|
||||
FLOAT32 a2_h = pstr_hp_filt_coeff->a2;
|
||||
FLOAT32 b0_h = pstr_hp_filt_coeff->b0;
|
||||
FLOAT32 b1_h = pstr_hp_filt_coeff->b1;
|
||||
FLOAT32 b2_h = pstr_hp_filt_coeff->b2;
|
||||
FLOAT32 a1_h = pstr_hp_filt_coeff->a1;
|
||||
FLOAT32 a2_h = pstr_hp_filt_coeff->a2;
|
||||
FLOAT32 b0_h = pstr_hp_filt_coeff->b0;
|
||||
FLOAT32 b1_h = pstr_hp_filt_coeff->b1;
|
||||
FLOAT32 b2_h = pstr_hp_filt_coeff->b2;
|
||||
|
||||
FLOAT32 st1_h = pstr_hp_filt_coeff->x_p[chan_idx*2+0];
|
||||
FLOAT32 st2_h = pstr_hp_filt_coeff->x_p[chan_idx*2+1];
|
||||
FLOAT32 st3_h = pstr_hp_filt_coeff->y_p[chan_idx*2+0];
|
||||
FLOAT32 st4_h = pstr_hp_filt_coeff->y_p[chan_idx*2+1];
|
||||
FLOAT32 st1_h = pstr_hp_filt_coeff->x_p[chan_idx * 2 + 0];
|
||||
FLOAT32 st2_h = pstr_hp_filt_coeff->x_p[chan_idx * 2 + 1];
|
||||
FLOAT32 st3_h = pstr_hp_filt_coeff->y_p[chan_idx * 2 + 0];
|
||||
FLOAT32 st4_h = pstr_hp_filt_coeff->y_p[chan_idx * 2 + 1];
|
||||
|
||||
FLOAT32* output_low = output[0];
|
||||
FLOAT32* output_high = output[1];
|
||||
FLOAT32* output_low = output[0];
|
||||
FLOAT32* output_high = output[1];
|
||||
|
||||
for (i=0; i<frame_len; i++)
|
||||
{
|
||||
tmp1 = input[i];
|
||||
tmp = b0_l * tmp1 + st1_l;
|
||||
st1_l = b1_l * tmp1 - a1_l * tmp + st2_l;
|
||||
st2_l = b2_l * tmp1 - a2_l * tmp;
|
||||
for (i = 0; i < frame_len; i++) {
|
||||
tmp1 = input[i];
|
||||
tmp = b0_l * tmp1 + st1_l;
|
||||
st1_l = b1_l * tmp1 - a1_l * tmp + st2_l;
|
||||
st2_l = b2_l * tmp1 - a2_l * tmp;
|
||||
|
||||
output_low[i] = b0_l * tmp + st3_l;
|
||||
st3_l = b1_l * tmp - a1_l * output_low[i] + st4_l;
|
||||
st4_l = b2_l * tmp - a2_l * output_low[i];
|
||||
output_low[i] = b0_l * tmp + st3_l;
|
||||
st3_l = b1_l * tmp - a1_l * output_low[i] + st4_l;
|
||||
st4_l = b2_l * tmp - a2_l * output_low[i];
|
||||
|
||||
tmp = b0_h * tmp1 + st1_h;
|
||||
st1_h = b1_h * tmp1 - a1_h * tmp + st2_h;
|
||||
st2_h = b2_h * tmp1 - a2_h * tmp;
|
||||
tmp = b0_h * tmp1 + st1_h;
|
||||
st1_h = b1_h * tmp1 - a1_h * tmp + st2_h;
|
||||
st2_h = b2_h * tmp1 - a2_h * tmp;
|
||||
|
||||
output_high[i] = b0_h * tmp + st3_h;
|
||||
st3_h = b1_h * tmp - a1_h * output_high[i] + st4_h;
|
||||
st4_h = b2_h * tmp - a2_h * output_high[i];
|
||||
}
|
||||
pstr_lp_filt_coeff->x_p[chan_idx*2+0] = st1_l;
|
||||
pstr_lp_filt_coeff->x_p[chan_idx*2+1] = st2_l;
|
||||
pstr_lp_filt_coeff->y_p[chan_idx*2+0] = st3_l;
|
||||
pstr_lp_filt_coeff->y_p[chan_idx*2+1] = st4_l;
|
||||
output_high[i] = b0_h * tmp + st3_h;
|
||||
st3_h = b1_h * tmp - a1_h * output_high[i] + st4_h;
|
||||
st4_h = b2_h * tmp - a2_h * output_high[i];
|
||||
}
|
||||
pstr_lp_filt_coeff->x_p[chan_idx * 2 + 0] = st1_l;
|
||||
pstr_lp_filt_coeff->x_p[chan_idx * 2 + 1] = st2_l;
|
||||
pstr_lp_filt_coeff->y_p[chan_idx * 2 + 0] = st3_l;
|
||||
pstr_lp_filt_coeff->y_p[chan_idx * 2 + 1] = st4_l;
|
||||
|
||||
pstr_hp_filt_coeff->x_p[chan_idx*2+0] = st1_h;
|
||||
pstr_hp_filt_coeff->x_p[chan_idx*2+1] = st2_h;
|
||||
pstr_hp_filt_coeff->y_p[chan_idx*2+0] = st3_h;
|
||||
pstr_hp_filt_coeff->y_p[chan_idx*2+1] = st4_h;
|
||||
pstr_hp_filt_coeff->x_p[chan_idx * 2 + 0] = st1_h;
|
||||
pstr_hp_filt_coeff->x_p[chan_idx * 2 + 1] = st2_h;
|
||||
pstr_hp_filt_coeff->y_p[chan_idx * 2 + 0] = st3_h;
|
||||
pstr_hp_filt_coeff->y_p[chan_idx * 2 + 1] = st4_h;
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
VOID impd_two_band_filter_process(ia_two_band_filt_struct* str_two_band_bank,
|
||||
WORD32 chan_idx,
|
||||
WORD32 frame_len,
|
||||
FLOAT32* input,
|
||||
FLOAT32* output[])
|
||||
{
|
||||
ia_iir_filter_struct* pstr_lp_filt_coeff=&str_two_band_bank->low_pass;
|
||||
ia_iir_filter_struct* pstr_hp_filt_coeff=&str_two_band_bank->high_pass;
|
||||
WORD32 chan_idx, WORD32 frame_len,
|
||||
FLOAT32* input, FLOAT32* output[]) {
|
||||
ia_iir_filter_struct* pstr_lp_filt_coeff = &str_two_band_bank->low_pass;
|
||||
ia_iir_filter_struct* pstr_hp_filt_coeff = &str_two_band_bank->high_pass;
|
||||
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff,
|
||||
pstr_hp_filt_coeff,
|
||||
chan_idx,
|
||||
frame_len,
|
||||
input,
|
||||
output);
|
||||
return;
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, chan_idx,
|
||||
frame_len, input, output);
|
||||
return;
|
||||
}
|
||||
|
||||
VOID impd_three_band_filter_process(
|
||||
ia_three_band_filt_struct* str_three_band_bank, WORD32 c, WORD32 size,
|
||||
FLOAT32* input, FLOAT32* output[]) {
|
||||
// WORD32 err_code=0;
|
||||
ia_iir_filter_struct* all_pass_filter;
|
||||
ia_iir_filter_struct* pstr_lp_filt_coeff =
|
||||
&str_three_band_bank->str_low_pass_stage_1;
|
||||
ia_iir_filter_struct* pstr_hp_filt_coeff =
|
||||
&str_three_band_bank->str_high_pass_stage_1;
|
||||
FLOAT32* output1[2];
|
||||
output1[0] = output[0];
|
||||
output1[1] = output[1];
|
||||
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, c, size,
|
||||
input, output1);
|
||||
|
||||
VOID impd_three_band_filter_process(ia_three_band_filt_struct* str_three_band_bank,
|
||||
WORD32 c,
|
||||
WORD32 size,
|
||||
FLOAT32* input,
|
||||
FLOAT32* output[])
|
||||
{
|
||||
// WORD32 err_code=0;
|
||||
ia_iir_filter_struct* all_pass_filter;
|
||||
ia_iir_filter_struct* pstr_lp_filt_coeff=&str_three_band_bank->str_low_pass_stage_1;
|
||||
ia_iir_filter_struct* pstr_hp_filt_coeff=&str_three_band_bank->str_high_pass_stage_1;
|
||||
FLOAT32* output1[2];
|
||||
output1[0]=output[0];
|
||||
output1[1]=output[1];
|
||||
all_pass_filter = &str_three_band_bank->str_all_pass_stage_2;
|
||||
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff,
|
||||
pstr_hp_filt_coeff,
|
||||
c,
|
||||
size,
|
||||
input,
|
||||
output1);
|
||||
impd_iir_second_order_filter_all_pass(all_pass_filter, c, size, output1[1],
|
||||
output[2]);
|
||||
pstr_lp_filt_coeff = &str_three_band_bank->str_low_pass_stage_2;
|
||||
pstr_hp_filt_coeff = &str_three_band_bank->str_high_pass_stage_2;
|
||||
|
||||
all_pass_filter =&str_three_band_bank->str_all_pass_stage_2;
|
||||
|
||||
impd_iir_second_order_filter_all_pass(all_pass_filter,
|
||||
c,
|
||||
size,
|
||||
output1[1],
|
||||
output[2]);
|
||||
pstr_lp_filt_coeff=&str_three_band_bank->str_low_pass_stage_2;
|
||||
pstr_hp_filt_coeff=&str_three_band_bank->str_high_pass_stage_2;
|
||||
|
||||
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff,
|
||||
pstr_hp_filt_coeff,
|
||||
c,
|
||||
size,
|
||||
output1[0],
|
||||
output1);
|
||||
|
||||
return;
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, c, size,
|
||||
output1[0], output1);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
VOID impd_four_band_filter_process(ia_four_band_filt_struct* str_four_band_bank,
|
||||
WORD32 cha_idx,
|
||||
WORD32 win_size,
|
||||
FLOAT32* input,
|
||||
FLOAT32* output[])
|
||||
{
|
||||
// WORD32 err_code=0;
|
||||
ia_iir_filter_struct* all_pass_filter;
|
||||
ia_iir_filter_struct* pstr_lp_filt_coeff=&str_four_band_bank->str_low_pass_stage_1;
|
||||
ia_iir_filter_struct* pstr_hp_filt_coeff=&str_four_band_bank->str_high_pass_stage_1;
|
||||
FLOAT32* output1[2];
|
||||
FLOAT32* output2[2];
|
||||
output1[0]=output[0];
|
||||
output1[1]=output[1];
|
||||
output2[0]=output[2];
|
||||
output2[1]=output[3];
|
||||
WORD32 cha_idx, WORD32 win_size,
|
||||
FLOAT32* input, FLOAT32* output[]) {
|
||||
// WORD32 err_code=0;
|
||||
ia_iir_filter_struct* all_pass_filter;
|
||||
ia_iir_filter_struct* pstr_lp_filt_coeff =
|
||||
&str_four_band_bank->str_low_pass_stage_1;
|
||||
ia_iir_filter_struct* pstr_hp_filt_coeff =
|
||||
&str_four_band_bank->str_high_pass_stage_1;
|
||||
FLOAT32* output1[2];
|
||||
FLOAT32* output2[2];
|
||||
output1[0] = output[0];
|
||||
output1[1] = output[1];
|
||||
output2[0] = output[2];
|
||||
output2[1] = output[3];
|
||||
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff,
|
||||
pstr_hp_filt_coeff,
|
||||
cha_idx,
|
||||
win_size,
|
||||
input,
|
||||
output1);
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, cha_idx,
|
||||
win_size, input, output1);
|
||||
|
||||
all_pass_filter =&str_four_band_bank->str_all_pass_stage_2_low;
|
||||
all_pass_filter = &str_four_band_bank->str_all_pass_stage_2_low;
|
||||
|
||||
impd_iir_second_order_filter_all_pass(all_pass_filter,
|
||||
cha_idx,
|
||||
win_size,
|
||||
output1[0],
|
||||
output1[0]);
|
||||
impd_iir_second_order_filter_all_pass(all_pass_filter, cha_idx, win_size,
|
||||
output1[0], output1[0]);
|
||||
|
||||
all_pass_filter = &str_four_band_bank->str_all_pass_stage_2_high;
|
||||
|
||||
all_pass_filter =&str_four_band_bank->str_all_pass_stage_2_high;
|
||||
impd_iir_second_order_filter_all_pass(all_pass_filter, cha_idx, win_size,
|
||||
output1[1], output2[0]);
|
||||
|
||||
impd_iir_second_order_filter_all_pass(all_pass_filter,
|
||||
cha_idx,
|
||||
win_size,
|
||||
output1[1],
|
||||
output2[0]);
|
||||
pstr_lp_filt_coeff = &str_four_band_bank->str_low_pass_stage_3_low;
|
||||
pstr_hp_filt_coeff = &str_four_band_bank->str_high_pass_stage_3_low;
|
||||
|
||||
pstr_lp_filt_coeff = &str_four_band_bank->str_low_pass_stage_3_low;
|
||||
pstr_hp_filt_coeff = &str_four_band_bank->str_high_pass_stage_3_low;
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, cha_idx,
|
||||
win_size, output1[0], output1);
|
||||
|
||||
pstr_lp_filt_coeff = &str_four_band_bank->str_low_pass_stage_3_high;
|
||||
pstr_hp_filt_coeff = &str_four_band_bank->str_high_pass_stage_3_high;
|
||||
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff,
|
||||
pstr_hp_filt_coeff,
|
||||
cha_idx,
|
||||
win_size,
|
||||
output1[0],
|
||||
output1);
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, cha_idx,
|
||||
win_size, output2[0], output2);
|
||||
|
||||
pstr_lp_filt_coeff = &str_four_band_bank->str_low_pass_stage_3_high;
|
||||
pstr_hp_filt_coeff = &str_four_band_bank->str_high_pass_stage_3_high;
|
||||
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff,
|
||||
pstr_hp_filt_coeff,
|
||||
cha_idx,
|
||||
win_size,
|
||||
output2[0],
|
||||
output2);
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
VOID impd_all_pass_cascade_process(ia_all_pass_cascade_struct *str_all_pass_cascade,
|
||||
WORD32 ch_idx,
|
||||
WORD32 win_size,
|
||||
FLOAT32* input)
|
||||
{
|
||||
WORD32 i;
|
||||
VOID impd_all_pass_cascade_process(
|
||||
ia_all_pass_cascade_struct* str_all_pass_cascade, WORD32 ch_idx,
|
||||
WORD32 win_size, FLOAT32* input) {
|
||||
WORD32 i;
|
||||
|
||||
for (i=0; i<str_all_pass_cascade->num_filter; i++)
|
||||
{
|
||||
impd_iir_second_order_filter_all_pass (&(str_all_pass_cascade->str_all_pass_cascade_filter[i].str_all_pass_stage),
|
||||
ch_idx,
|
||||
win_size,
|
||||
input,
|
||||
input);
|
||||
}
|
||||
for (i = 0; i < str_all_pass_cascade->num_filter; i++) {
|
||||
impd_iir_second_order_filter_all_pass(
|
||||
&(str_all_pass_cascade->str_all_pass_cascade_filter[i]
|
||||
.str_all_pass_stage),
|
||||
ch_idx, win_size, input, input);
|
||||
}
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
|
@ -21,145 +21,130 @@
|
|||
#define IMPD_DRC_FILTER_BANK_H
|
||||
|
||||
#define FILTER_BANK_PARAMETER_COUNT 16
|
||||
#define CASCADE_ALLPASS_COUNT_MAX 9
|
||||
#define QMF_NUM_FILT_BANDS 64
|
||||
#define QMF_FILT_RESOLUTION 64
|
||||
#define CASCADE_ALLPASS_COUNT_MAX 9
|
||||
#define QMF_NUM_FILT_BANDS 64
|
||||
#define QMF_FILT_RESOLUTION 64
|
||||
|
||||
typedef struct ia_drc_qmf_filt_struct {
|
||||
FLOAT64* ana_buff;
|
||||
FLOAT64* syn_buff;
|
||||
FLOAT64 ana_tab_real[QMF_NUM_FILT_BANDS][2 * QMF_NUM_FILT_BANDS];
|
||||
FLOAT64 ana_tab_imag[QMF_NUM_FILT_BANDS][2 * QMF_NUM_FILT_BANDS];
|
||||
FLOAT64 syn_tab_real[2 * QMF_NUM_FILT_BANDS][QMF_NUM_FILT_BANDS];
|
||||
FLOAT64 syn_tab_imag[2 * QMF_NUM_FILT_BANDS][QMF_NUM_FILT_BANDS];
|
||||
|
||||
typedef struct ia_drc_qmf_filt_struct
|
||||
{
|
||||
|
||||
FLOAT64* ana_buff;
|
||||
FLOAT64* syn_buff;
|
||||
FLOAT64 ana_tab_real[QMF_NUM_FILT_BANDS][2*QMF_NUM_FILT_BANDS];
|
||||
FLOAT64 ana_tab_imag[QMF_NUM_FILT_BANDS][2*QMF_NUM_FILT_BANDS];
|
||||
FLOAT64 syn_tab_real[2*QMF_NUM_FILT_BANDS][QMF_NUM_FILT_BANDS];
|
||||
FLOAT64 syn_tab_imag[2*QMF_NUM_FILT_BANDS][QMF_NUM_FILT_BANDS];
|
||||
|
||||
}ia_drc_qmf_filt_struct;
|
||||
} ia_drc_qmf_filt_struct;
|
||||
|
||||
typedef struct {
|
||||
FLOAT32 f_cross_norm;
|
||||
FLOAT32 gamma;
|
||||
FLOAT32 delta;
|
||||
FLOAT32 f_cross_norm;
|
||||
FLOAT32 gamma;
|
||||
FLOAT32 delta;
|
||||
} ia_filter_bank_params_struct;
|
||||
|
||||
|
||||
typedef struct {
|
||||
FLOAT32 s00;
|
||||
FLOAT32 s01;
|
||||
FLOAT32 s10;
|
||||
FLOAT32 s11;
|
||||
FLOAT32 s00;
|
||||
FLOAT32 s01;
|
||||
FLOAT32 s10;
|
||||
FLOAT32 s11;
|
||||
} ia_lr_filter_state_struct;
|
||||
|
||||
|
||||
typedef struct {
|
||||
FLOAT32 s0;
|
||||
FLOAT32 s1;
|
||||
FLOAT32 s0;
|
||||
FLOAT32 s1;
|
||||
} ia_all_pass_filter_state_struct;
|
||||
|
||||
typedef struct {
|
||||
FLOAT32 a0;
|
||||
FLOAT32 a1;
|
||||
FLOAT32 a2;
|
||||
FLOAT32 b0;
|
||||
FLOAT32 b1;
|
||||
FLOAT32 b2;
|
||||
FLOAT32 x_p[MAX_CHANNEL_COUNT*2];
|
||||
FLOAT32 y_p[MAX_CHANNEL_COUNT*2];
|
||||
FLOAT32 a0;
|
||||
FLOAT32 a1;
|
||||
FLOAT32 a2;
|
||||
FLOAT32 b0;
|
||||
FLOAT32 b1;
|
||||
FLOAT32 b2;
|
||||
FLOAT32 x_p[MAX_CHANNEL_COUNT * 2];
|
||||
FLOAT32 y_p[MAX_CHANNEL_COUNT * 2];
|
||||
} ia_iir_filter_struct;
|
||||
typedef struct {
|
||||
ia_iir_filter_struct low_pass;
|
||||
ia_iir_filter_struct high_pass;
|
||||
ia_iir_filter_struct low_pass;
|
||||
ia_iir_filter_struct high_pass;
|
||||
} ia_two_band_filt_struct;
|
||||
|
||||
typedef struct {
|
||||
ia_iir_filter_struct str_low_pass_stage_1;
|
||||
ia_iir_filter_struct str_high_pass_stage_1;
|
||||
ia_iir_filter_struct str_low_pass_stage_2;
|
||||
ia_iir_filter_struct str_high_pass_stage_2;
|
||||
ia_iir_filter_struct str_all_pass_stage_2;
|
||||
ia_iir_filter_struct str_low_pass_stage_1;
|
||||
ia_iir_filter_struct str_high_pass_stage_1;
|
||||
ia_iir_filter_struct str_low_pass_stage_2;
|
||||
ia_iir_filter_struct str_high_pass_stage_2;
|
||||
ia_iir_filter_struct str_all_pass_stage_2;
|
||||
} ia_three_band_filt_struct;
|
||||
|
||||
typedef struct {
|
||||
ia_iir_filter_struct str_low_pass_stage_1;
|
||||
ia_iir_filter_struct str_high_pass_stage_1;
|
||||
ia_iir_filter_struct str_all_pass_stage_2_high;
|
||||
ia_iir_filter_struct str_all_pass_stage_2_low;
|
||||
ia_iir_filter_struct str_low_pass_stage_3_high;
|
||||
ia_iir_filter_struct str_high_pass_stage_3_high;
|
||||
ia_iir_filter_struct str_low_pass_stage_3_low;
|
||||
ia_iir_filter_struct str_high_pass_stage_3_low;
|
||||
ia_iir_filter_struct str_low_pass_stage_1;
|
||||
ia_iir_filter_struct str_high_pass_stage_1;
|
||||
ia_iir_filter_struct str_all_pass_stage_2_high;
|
||||
ia_iir_filter_struct str_all_pass_stage_2_low;
|
||||
ia_iir_filter_struct str_low_pass_stage_3_high;
|
||||
ia_iir_filter_struct str_high_pass_stage_3_high;
|
||||
ia_iir_filter_struct str_low_pass_stage_3_low;
|
||||
ia_iir_filter_struct str_high_pass_stage_3_low;
|
||||
} ia_four_band_filt_struct;
|
||||
|
||||
typedef struct {
|
||||
ia_iir_filter_struct str_all_pass_stage;
|
||||
} ia_all_pass_filter_sturct;
|
||||
ia_iir_filter_struct str_all_pass_stage;
|
||||
} ia_all_pass_filter_sturct;
|
||||
|
||||
typedef struct {
|
||||
ia_all_pass_filter_sturct str_all_pass_cascade_filter[CASCADE_ALLPASS_COUNT_MAX];
|
||||
WORD32 num_filter;
|
||||
} ia_all_pass_cascade_struct;
|
||||
ia_all_pass_filter_sturct
|
||||
str_all_pass_cascade_filter[CASCADE_ALLPASS_COUNT_MAX];
|
||||
WORD32 num_filter;
|
||||
} ia_all_pass_cascade_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 num_bands;
|
||||
WORD32 complexity;
|
||||
ia_two_band_filt_struct str_two_band_bank;
|
||||
ia_three_band_filt_struct str_three_band_bank;
|
||||
ia_four_band_filt_struct str_four_band_bank;
|
||||
ia_all_pass_cascade_struct str_all_pass_cascade;
|
||||
WORD32 num_bands;
|
||||
WORD32 complexity;
|
||||
ia_two_band_filt_struct str_two_band_bank;
|
||||
ia_three_band_filt_struct str_three_band_bank;
|
||||
ia_four_band_filt_struct str_four_band_bank;
|
||||
ia_all_pass_cascade_struct str_all_pass_cascade;
|
||||
} ia_drc_filter_bank_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 nfilter_banks;
|
||||
WORD32 num_ph_align_ch_groups;
|
||||
WORD32 complexity;
|
||||
ia_drc_filter_bank_struct str_drc_filter_bank[8];
|
||||
WORD32 nfilter_banks;
|
||||
WORD32 num_ph_align_ch_groups;
|
||||
WORD32 complexity;
|
||||
ia_drc_filter_bank_struct str_drc_filter_bank[8];
|
||||
} ia_filter_banks_struct;
|
||||
|
||||
|
||||
WORD32
|
||||
impd_init_all_filter_banks( ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc,
|
||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||
ia_filter_banks_struct* ia_filter_banks_struct);
|
||||
impd_init_all_filter_banks(
|
||||
ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc,
|
||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||
ia_filter_banks_struct* ia_filter_banks_struct);
|
||||
|
||||
VOID impd_two_band_filter_process(ia_two_band_filt_struct* str_two_band_bank,
|
||||
WORD32 c,
|
||||
WORD32 size,
|
||||
FLOAT32* audio_in,
|
||||
FLOAT32* audio_out[]);
|
||||
WORD32 c, WORD32 size, FLOAT32* audio_in,
|
||||
FLOAT32* audio_out[]);
|
||||
|
||||
VOID impd_three_band_filter_process(ia_three_band_filt_struct* str_three_band_bank,
|
||||
WORD32 c,
|
||||
WORD32 size,
|
||||
FLOAT32* audio_in,
|
||||
FLOAT32* audio_out[]);
|
||||
VOID impd_three_band_filter_process(
|
||||
ia_three_band_filt_struct* str_three_band_bank, WORD32 c, WORD32 size,
|
||||
FLOAT32* audio_in, FLOAT32* audio_out[]);
|
||||
|
||||
VOID impd_four_band_filter_process(ia_four_band_filt_struct* str_four_band_bank,
|
||||
WORD32 c,
|
||||
WORD32 size,
|
||||
FLOAT32* audio_in,
|
||||
FLOAT32* audio_out[]);
|
||||
WORD32 c, WORD32 size, FLOAT32* audio_in,
|
||||
FLOAT32* audio_out[]);
|
||||
|
||||
VOID impd_all_pass_cascade_process(ia_all_pass_cascade_struct *str_all_pass_cascade,
|
||||
WORD32 c,
|
||||
WORD32 size,
|
||||
FLOAT32* audio_in);
|
||||
VOID impd_all_pass_cascade_process(
|
||||
ia_all_pass_cascade_struct* str_all_pass_cascade, WORD32 c, WORD32 size,
|
||||
FLOAT32* audio_in);
|
||||
|
||||
WORD32
|
||||
impd_shape_filt_block_init(ia_shape_filter_block_params_struct* pstr_shape_filter_block_params,
|
||||
shape_filter_block* shape_filter_block);
|
||||
impd_shape_filt_block_init(
|
||||
ia_shape_filter_block_params_struct* pstr_shape_filter_block_params,
|
||||
shape_filter_block* shape_filter_block);
|
||||
|
||||
WORD32
|
||||
impd_shape_filt_block_adapt(const FLOAT32 drc_gain,
|
||||
shape_filter_block* shape_filter_block);
|
||||
shape_filter_block* shape_filter_block);
|
||||
|
||||
|
||||
|
||||
WORD32 impd_shape_filt_block_time_process(shape_filter_block* shape_filter_block,
|
||||
FLOAT32* drc_gain,
|
||||
const WORD32 channel,
|
||||
FLOAT32 *audio_in,
|
||||
WORD32 start,
|
||||
WORD32 end);
|
||||
WORD32 impd_shape_filt_block_time_process(
|
||||
shape_filter_block* shape_filter_block, FLOAT32* drc_gain,
|
||||
const WORD32 channel, FLOAT32* audio_in, WORD32 start, WORD32 end);
|
||||
#endif
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -21,76 +21,73 @@
|
|||
#define IMPD_DRC_GAIN_DEC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
ia_node_struct str_node;
|
||||
ia_node_struct prev_node;
|
||||
FLOAT32 lpcm_gains[2 * AUDIO_CODEC_FRAME_SIZE_MAX + MAX_SIGNAL_DELAY];
|
||||
ia_node_struct str_node;
|
||||
ia_node_struct prev_node;
|
||||
FLOAT32 lpcm_gains[2 * AUDIO_CODEC_FRAME_SIZE_MAX + MAX_SIGNAL_DELAY];
|
||||
} ia_interp_buf_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 buf_interpolation_count;
|
||||
ia_interp_buf_struct* buf_interpolation;
|
||||
WORD32 buf_interpolation_count;
|
||||
ia_interp_buf_struct* buf_interpolation;
|
||||
} ia_gain_buffer_struct;
|
||||
|
||||
typedef struct {
|
||||
ia_gain_buffer_struct pstr_gain_buf[SEL_DRC_COUNT];
|
||||
ia_gain_buffer_struct pstr_gain_buf[SEL_DRC_COUNT];
|
||||
} ia_drc_gain_buffers_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 gain_interpolation_type;
|
||||
WORD32 gain_modification_flag;
|
||||
WORD32 ducking_flag;
|
||||
WORD32 clipping_flag;
|
||||
ia_ducking_modifiers_struct* pstr_ducking_modifiers;
|
||||
ia_gain_modifiers_struct* pstr_gain_modifiers;
|
||||
WORD32 drc_characteristic_present;
|
||||
WORD32 drc_source_characteristic_cicp_format;
|
||||
WORD32 source_drc_characteristic;
|
||||
ia_split_drc_characteristic_struct* split_source_characteristic_left;
|
||||
ia_split_drc_characteristic_struct* split_source_characteristic_right;
|
||||
WORD32 drc_target_characteristic_cicp_format;
|
||||
WORD32 target_drc_characteristic;
|
||||
ia_split_drc_characteristic_struct* split_target_characteristic_left;
|
||||
ia_split_drc_characteristic_struct* split_target_characteristic_right;
|
||||
WORD32 interpolation_loud_eq;
|
||||
WORD32 limiter_peak_target_present;
|
||||
FLOAT32 limiter_peak_target;
|
||||
FLOAT32 loudness_normalization_gain_db;
|
||||
WORD32 delta_tmin;
|
||||
WORD32 characteristic_index;
|
||||
FLOAT32 compress;
|
||||
FLOAT32 boost;
|
||||
WORD32 gain_interpolation_type;
|
||||
WORD32 gain_modification_flag;
|
||||
WORD32 ducking_flag;
|
||||
WORD32 clipping_flag;
|
||||
ia_ducking_modifiers_struct* pstr_ducking_modifiers;
|
||||
ia_gain_modifiers_struct* pstr_gain_modifiers;
|
||||
WORD32 drc_characteristic_present;
|
||||
WORD32 drc_source_characteristic_cicp_format;
|
||||
WORD32 source_drc_characteristic;
|
||||
ia_split_drc_characteristic_struct* split_source_characteristic_left;
|
||||
ia_split_drc_characteristic_struct* split_source_characteristic_right;
|
||||
WORD32 drc_target_characteristic_cicp_format;
|
||||
WORD32 target_drc_characteristic;
|
||||
ia_split_drc_characteristic_struct* split_target_characteristic_left;
|
||||
ia_split_drc_characteristic_struct* split_target_characteristic_right;
|
||||
WORD32 interpolation_loud_eq;
|
||||
WORD32 limiter_peak_target_present;
|
||||
FLOAT32 limiter_peak_target;
|
||||
FLOAT32 loudness_normalization_gain_db;
|
||||
WORD32 delta_tmin;
|
||||
WORD32 characteristic_index;
|
||||
FLOAT32 compress;
|
||||
FLOAT32 boost;
|
||||
} ia_interp_params_struct;
|
||||
|
||||
|
||||
typedef struct {
|
||||
WORD32 drc_instructions_index;
|
||||
WORD32 drc_coeff_idx;
|
||||
WORD32 dwnmix_instructions_index;
|
||||
WORD32 drc_instructions_index;
|
||||
WORD32 drc_coeff_idx;
|
||||
WORD32 dwnmix_instructions_index;
|
||||
} ia_sel_drc_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 sample_rate;
|
||||
WORD32 delta_tmin_default;
|
||||
WORD32 drc_frame_size;
|
||||
WORD32 delay_mode;
|
||||
WORD32 sub_band_domain_mode;
|
||||
WORD32 gain_delay_samples;
|
||||
WORD32 parametric_drc_delay;
|
||||
WORD32 eq_delay;
|
||||
WORD32 audio_delay_samples;
|
||||
WORD32 drc_set_counter;
|
||||
WORD32 multiband_sel_drc_idx;
|
||||
WORD32 sample_rate;
|
||||
WORD32 delta_tmin_default;
|
||||
WORD32 drc_frame_size;
|
||||
WORD32 delay_mode;
|
||||
WORD32 sub_band_domain_mode;
|
||||
WORD32 gain_delay_samples;
|
||||
WORD32 parametric_drc_delay;
|
||||
WORD32 eq_delay;
|
||||
WORD32 audio_delay_samples;
|
||||
WORD32 drc_set_counter;
|
||||
WORD32 multiband_sel_drc_idx;
|
||||
|
||||
ia_sel_drc_struct sel_drc_array[SEL_DRC_COUNT];
|
||||
ia_sel_drc_struct sel_drc_array[SEL_DRC_COUNT];
|
||||
|
||||
} ia_drc_params_struct;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -38,461 +38,465 @@
|
|||
#include "impd_drc_gain_decoder.h"
|
||||
#include "impd_drc_dec.h"
|
||||
|
||||
IA_ERRORCODE impd_init_drc_decode( WORD32 frame_size,
|
||||
WORD32 sample_rate,
|
||||
WORD32 gain_delay_samples,
|
||||
WORD32 delay_mode,
|
||||
WORD32 sub_band_domain_mode,
|
||||
ia_drc_gain_dec_struct* p_drc_gain_dec_structs)
|
||||
{
|
||||
IA_ERRORCODE err_code = IA_NO_ERROR;
|
||||
IA_ERRORCODE impd_init_drc_decode(
|
||||
WORD32 frame_size, WORD32 sample_rate, WORD32 gain_delay_samples,
|
||||
WORD32 delay_mode, WORD32 sub_band_domain_mode,
|
||||
ia_drc_gain_dec_struct* p_drc_gain_dec_structs) {
|
||||
IA_ERRORCODE err_code = IA_NO_ERROR;
|
||||
|
||||
err_code = impd_init_drc_params(
|
||||
frame_size, sample_rate, gain_delay_samples, delay_mode,
|
||||
sub_band_domain_mode, &p_drc_gain_dec_structs->ia_drc_params_struct);
|
||||
|
||||
err_code = impd_init_drc_params(frame_size,
|
||||
sample_rate,
|
||||
gain_delay_samples,
|
||||
delay_mode,
|
||||
sub_band_domain_mode,
|
||||
&p_drc_gain_dec_structs->ia_drc_params_struct);
|
||||
if (err_code != IA_NO_ERROR) return (err_code);
|
||||
|
||||
if (err_code!=IA_NO_ERROR)
|
||||
return (err_code);
|
||||
impd_init_parametric_drc(
|
||||
p_drc_gain_dec_structs->ia_drc_params_struct.drc_frame_size, sample_rate,
|
||||
sub_band_domain_mode, &p_drc_gain_dec_structs->parametricdrc_params);
|
||||
|
||||
impd_init_parametric_drc(p_drc_gain_dec_structs->ia_drc_params_struct.drc_frame_size,
|
||||
sample_rate,
|
||||
sub_band_domain_mode,
|
||||
&p_drc_gain_dec_structs->parametricdrc_params);
|
||||
if (err_code != IA_NO_ERROR) return (err_code);
|
||||
|
||||
if (err_code!=IA_NO_ERROR)
|
||||
return (err_code);
|
||||
|
||||
return err_code;
|
||||
return err_code;
|
||||
}
|
||||
|
||||
IA_ERRORCODE impd_init_drc_decode_post_config(
|
||||
WORD32 audio_num_chan, WORD32* drc_set_id_processed,
|
||||
WORD32* downmix_id_processed, WORD32 num_sets_processed,
|
||||
WORD32 eq_set_id_processed,
|
||||
|
||||
IA_ERRORCODE impd_init_drc_decode_post_config(WORD32 audio_num_chan,
|
||||
WORD32* drc_set_id_processed,
|
||||
WORD32* downmix_id_processed,
|
||||
WORD32 num_sets_processed,
|
||||
WORD32 eq_set_id_processed,
|
||||
ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info, pVOID* mem_ptr) {
|
||||
IA_ERRORCODE err_code = 0;
|
||||
WORD32 i, j, k, maxMultibandAudioSignalCount = 0;
|
||||
ia_drc_params_struct* p_drc_params_struct =
|
||||
&p_drc_gain_dec_structs->ia_drc_params_struct;
|
||||
ia_audio_in_out_buf* p_audio_in_out_buf =
|
||||
&p_drc_gain_dec_structs->audio_in_out_buf;
|
||||
|
||||
ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
pVOID *mem_ptr
|
||||
)
|
||||
{
|
||||
for (i = 0; i < num_sets_processed; i++) {
|
||||
err_code = impd_init_selected_drc_set(
|
||||
pstr_drc_config, p_drc_params_struct,
|
||||
&p_drc_gain_dec_structs->parametricdrc_params, audio_num_chan,
|
||||
drc_set_id_processed[i], downmix_id_processed[i],
|
||||
&p_drc_gain_dec_structs->ia_filter_banks_struct,
|
||||
&p_drc_gain_dec_structs->str_overlap_params,
|
||||
p_drc_gain_dec_structs->shape_filter_block);
|
||||
if (err_code) return (err_code);
|
||||
}
|
||||
|
||||
IA_ERRORCODE err_code = 0;
|
||||
WORD32 i,j,k, maxMultibandAudioSignalCount=0;
|
||||
ia_drc_params_struct* p_drc_params_struct = &p_drc_gain_dec_structs->ia_drc_params_struct;
|
||||
ia_audio_in_out_buf* p_audio_in_out_buf = &p_drc_gain_dec_structs->audio_in_out_buf;
|
||||
p_drc_gain_dec_structs->audio_num_chan = audio_num_chan;
|
||||
p_drc_gain_dec_structs->ia_drc_params_struct.audio_delay_samples =
|
||||
p_drc_gain_dec_structs->ia_drc_params_struct.parametric_drc_delay;
|
||||
if (pstr_drc_config->str_drc_config_ext.parametric_drc_present) {
|
||||
err_code = impd_init_parametric_drc_after_config(
|
||||
pstr_drc_config, pstr_loudness_info,
|
||||
&p_drc_gain_dec_structs->parametricdrc_params, mem_ptr);
|
||||
if (err_code) return (err_code);
|
||||
}
|
||||
|
||||
for (i = 0; i < num_sets_processed; i++)
|
||||
{
|
||||
err_code = impd_init_selected_drc_set(pstr_drc_config,
|
||||
p_drc_params_struct,
|
||||
&p_drc_gain_dec_structs->parametricdrc_params,
|
||||
audio_num_chan,
|
||||
drc_set_id_processed[i],
|
||||
downmix_id_processed[i],
|
||||
&p_drc_gain_dec_structs->ia_filter_banks_struct,
|
||||
&p_drc_gain_dec_structs->str_overlap_params
|
||||
,p_drc_gain_dec_structs->shape_filter_block
|
||||
);
|
||||
if (err_code)
|
||||
return (err_code);
|
||||
}
|
||||
p_audio_in_out_buf->audio_num_chan = audio_num_chan;
|
||||
p_audio_in_out_buf->audio_delay_samples =
|
||||
p_drc_params_struct->audio_delay_samples;
|
||||
p_audio_in_out_buf->frame_size = p_drc_params_struct->drc_frame_size;
|
||||
|
||||
p_drc_gain_dec_structs->audio_num_chan = audio_num_chan;
|
||||
p_drc_gain_dec_structs->ia_drc_params_struct.audio_delay_samples = p_drc_gain_dec_structs->ia_drc_params_struct.parametric_drc_delay;
|
||||
if (pstr_drc_config->str_drc_config_ext.parametric_drc_present) {
|
||||
err_code = impd_init_parametric_drc_after_config(pstr_drc_config,
|
||||
pstr_loudness_info,
|
||||
&p_drc_gain_dec_structs->parametricdrc_params,
|
||||
mem_ptr);
|
||||
if (err_code)
|
||||
return (err_code);
|
||||
}
|
||||
if (p_drc_params_struct->sub_band_domain_mode == SUBBAND_DOMAIN_MODE_QMF64) {
|
||||
p_audio_in_out_buf->audio_delay_sub_band_samples =
|
||||
p_drc_params_struct->audio_delay_samples /
|
||||
AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF64;
|
||||
p_audio_in_out_buf->audio_sub_band_frame_size =
|
||||
p_drc_params_struct->drc_frame_size /
|
||||
AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF64;
|
||||
p_audio_in_out_buf->audio_sub_band_count = AUDIO_CODEC_SUBBAND_COUNT_QMF64;
|
||||
} else if (p_drc_params_struct->sub_band_domain_mode ==
|
||||
SUBBAND_DOMAIN_MODE_QMF71) {
|
||||
p_audio_in_out_buf->audio_delay_sub_band_samples =
|
||||
p_drc_params_struct->audio_delay_samples /
|
||||
AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF71;
|
||||
p_audio_in_out_buf->audio_sub_band_frame_size =
|
||||
p_drc_params_struct->drc_frame_size /
|
||||
AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF71;
|
||||
p_audio_in_out_buf->audio_sub_band_count = AUDIO_CODEC_SUBBAND_COUNT_QMF71;
|
||||
} else if (p_drc_params_struct->sub_band_domain_mode ==
|
||||
SUBBAND_DOMAIN_MODE_STFT256) {
|
||||
p_audio_in_out_buf->audio_delay_sub_band_samples =
|
||||
p_drc_params_struct->audio_delay_samples /
|
||||
AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_STFT256;
|
||||
p_audio_in_out_buf->audio_sub_band_frame_size =
|
||||
p_drc_params_struct->drc_frame_size /
|
||||
AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_STFT256;
|
||||
p_audio_in_out_buf->audio_sub_band_count =
|
||||
AUDIO_CODEC_SUBBAND_COUNT_STFT256;
|
||||
} else {
|
||||
p_audio_in_out_buf->audio_delay_sub_band_samples = 0;
|
||||
p_audio_in_out_buf->audio_sub_band_frame_size = 0;
|
||||
p_audio_in_out_buf->audio_sub_band_count = 0;
|
||||
}
|
||||
|
||||
p_audio_in_out_buf->audio_num_chan = audio_num_chan;
|
||||
p_audio_in_out_buf->audio_delay_samples = p_drc_params_struct->audio_delay_samples;
|
||||
p_audio_in_out_buf->frame_size = p_drc_params_struct->drc_frame_size;
|
||||
for (k = 0; k < SEL_DRC_COUNT; k++) {
|
||||
if (p_drc_params_struct->sel_drc_array[k].drc_instructions_index >= 0) {
|
||||
ia_drc_instructions_struct* drc_instruction_str =
|
||||
&(pstr_drc_config->str_drc_instruction_str
|
||||
[p_drc_params_struct->sel_drc_array[k].drc_instructions_index]);
|
||||
if (drc_instruction_str->gain_element_count > 0) {
|
||||
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[k]
|
||||
.buf_interpolation = (ia_interp_buf_struct*)*mem_ptr;
|
||||
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
|
||||
drc_instruction_str->gain_element_count *
|
||||
sizeof(ia_interp_buf_struct) +
|
||||
32);
|
||||
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[k]
|
||||
.buf_interpolation_count = drc_instruction_str->gain_element_count;
|
||||
for (i = 0;
|
||||
i < p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[i]
|
||||
.buf_interpolation_count;
|
||||
i++) {
|
||||
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[i]
|
||||
.buf_interpolation[i]
|
||||
.str_node.time = 0;
|
||||
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[i]
|
||||
.buf_interpolation[i]
|
||||
.prev_node.time = -1;
|
||||
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[i]
|
||||
.buf_interpolation[i]
|
||||
.str_node.loc_db_gain = 0.0f;
|
||||
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[i]
|
||||
.buf_interpolation[i]
|
||||
.str_node.slope = 0.0f;
|
||||
|
||||
|
||||
if(p_drc_params_struct->sub_band_domain_mode == SUBBAND_DOMAIN_MODE_QMF64){
|
||||
p_audio_in_out_buf->audio_delay_sub_band_samples = p_drc_params_struct->audio_delay_samples / AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF64;
|
||||
p_audio_in_out_buf->audio_sub_band_frame_size = p_drc_params_struct->drc_frame_size / AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF64;
|
||||
p_audio_in_out_buf->audio_sub_band_count = AUDIO_CODEC_SUBBAND_COUNT_QMF64;
|
||||
}
|
||||
else if(p_drc_params_struct->sub_band_domain_mode == SUBBAND_DOMAIN_MODE_QMF71){
|
||||
p_audio_in_out_buf->audio_delay_sub_band_samples = p_drc_params_struct->audio_delay_samples / AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF71;
|
||||
p_audio_in_out_buf->audio_sub_band_frame_size = p_drc_params_struct->drc_frame_size / AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF71;
|
||||
p_audio_in_out_buf->audio_sub_band_count = AUDIO_CODEC_SUBBAND_COUNT_QMF71;
|
||||
}
|
||||
else if(p_drc_params_struct->sub_band_domain_mode == SUBBAND_DOMAIN_MODE_STFT256){
|
||||
p_audio_in_out_buf->audio_delay_sub_band_samples = p_drc_params_struct->audio_delay_samples / AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_STFT256;
|
||||
p_audio_in_out_buf->audio_sub_band_frame_size = p_drc_params_struct->drc_frame_size / AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_STFT256;
|
||||
p_audio_in_out_buf->audio_sub_band_count = AUDIO_CODEC_SUBBAND_COUNT_STFT256;
|
||||
}
|
||||
else{
|
||||
p_audio_in_out_buf->audio_delay_sub_band_samples = 0;
|
||||
p_audio_in_out_buf->audio_sub_band_frame_size = 0;
|
||||
p_audio_in_out_buf->audio_sub_band_count = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
for (k=0; k<SEL_DRC_COUNT; k++)
|
||||
{
|
||||
if (p_drc_params_struct->sel_drc_array[k].drc_instructions_index >= 0)
|
||||
{
|
||||
ia_drc_instructions_struct* drc_instruction_str = &(pstr_drc_config->str_drc_instruction_str[p_drc_params_struct->sel_drc_array[k].drc_instructions_index]);
|
||||
if (drc_instruction_str->gain_element_count > 0)
|
||||
{
|
||||
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[k].buf_interpolation = (ia_interp_buf_struct*)*mem_ptr;
|
||||
*mem_ptr=(pVOID)((SIZE_T)*mem_ptr+drc_instruction_str->gain_element_count*sizeof(ia_interp_buf_struct)+32);
|
||||
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[k].buf_interpolation_count = drc_instruction_str->gain_element_count;
|
||||
for (i=0; i<p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[i].buf_interpolation_count; i++)
|
||||
{
|
||||
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[i].buf_interpolation[i].str_node.time = 0;
|
||||
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[i].buf_interpolation[i].prev_node.time = -1;
|
||||
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[i].buf_interpolation[i].str_node.loc_db_gain = 0.0f;
|
||||
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[i].buf_interpolation[i].str_node.slope = 0.0f;
|
||||
|
||||
for (j=0; j<2 * AUDIO_CODEC_FRAME_SIZE_MAX + MAX_SIGNAL_DELAY; j++)
|
||||
{
|
||||
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[i].buf_interpolation[i].lpcm_gains[j] = 1.f;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (j = 0; j < 2 * AUDIO_CODEC_FRAME_SIZE_MAX + MAX_SIGNAL_DELAY;
|
||||
j++) {
|
||||
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[i]
|
||||
.buf_interpolation[i]
|
||||
.lpcm_gains[j] = 1.f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (eq_set_id_processed > 0) {
|
||||
for (i = 0; i < pstr_drc_config->str_drc_config_ext.eq_instructions_count;
|
||||
i++) {
|
||||
if (pstr_drc_config->str_drc_config_ext.str_eq_instructions[i]
|
||||
.eq_set_id == eq_set_id_processed)
|
||||
break;
|
||||
}
|
||||
if (i == pstr_drc_config->str_drc_config_ext.eq_instructions_count) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if (err_code) return (err_code);
|
||||
|
||||
err_code = impd_derive_eq_set(
|
||||
&pstr_drc_config->str_drc_config_ext.str_eq_coeff,
|
||||
&(pstr_drc_config->str_drc_config_ext.str_eq_instructions[i]),
|
||||
(FLOAT32)p_drc_gain_dec_structs->ia_drc_params_struct.sample_rate,
|
||||
p_drc_gain_dec_structs->ia_drc_params_struct.drc_frame_size,
|
||||
p_drc_gain_dec_structs->ia_drc_params_struct.sub_band_domain_mode,
|
||||
p_drc_gain_dec_structs->eq_set);
|
||||
if (err_code) return (err_code);
|
||||
|
||||
if (eq_set_id_processed > 0)
|
||||
{
|
||||
for(i=0; i<pstr_drc_config->str_drc_config_ext.eq_instructions_count; i++)
|
||||
{
|
||||
if (pstr_drc_config->str_drc_config_ext.str_eq_instructions[i].eq_set_id == eq_set_id_processed)
|
||||
break;
|
||||
}
|
||||
if (i==pstr_drc_config->str_drc_config_ext.eq_instructions_count)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
impd_get_eq_set_delay(
|
||||
p_drc_gain_dec_structs->eq_set,
|
||||
&p_drc_gain_dec_structs->ia_drc_params_struct.eq_delay);
|
||||
}
|
||||
|
||||
for (i = 0; i < p_drc_params_struct->drc_set_counter; i++) {
|
||||
ia_drc_instructions_struct* drc_instruction_str;
|
||||
drc_instruction_str =
|
||||
&(pstr_drc_config->str_drc_instruction_str
|
||||
[p_drc_params_struct->sel_drc_array[i].drc_instructions_index]);
|
||||
maxMultibandAudioSignalCount =
|
||||
max(maxMultibandAudioSignalCount,
|
||||
drc_instruction_str->multiband_audio_sig_count);
|
||||
}
|
||||
|
||||
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);
|
||||
p_drc_gain_dec_structs->audio_band_buffer.non_interleaved_audio = *mem_ptr;
|
||||
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
|
||||
(maxMultibandAudioSignalCount * sizeof(FLOAT32*)) + 32);
|
||||
|
||||
if (err_code)
|
||||
return (err_code);
|
||||
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);
|
||||
}
|
||||
p_drc_gain_dec_structs->audio_band_buffer.multiband_audio_sig_count =
|
||||
maxMultibandAudioSignalCount;
|
||||
p_drc_gain_dec_structs->audio_band_buffer.frame_size =
|
||||
p_drc_params_struct->drc_frame_size;
|
||||
;
|
||||
|
||||
err_code = impd_derive_eq_set (&pstr_drc_config->str_drc_config_ext.str_eq_coeff,
|
||||
&(pstr_drc_config->str_drc_config_ext.str_eq_instructions[i]),
|
||||
(FLOAT32)p_drc_gain_dec_structs->ia_drc_params_struct.sample_rate,
|
||||
p_drc_gain_dec_structs->ia_drc_params_struct.drc_frame_size,
|
||||
p_drc_gain_dec_structs->ia_drc_params_struct.sub_band_domain_mode,
|
||||
p_drc_gain_dec_structs->eq_set);
|
||||
if (err_code)
|
||||
return (err_code);
|
||||
|
||||
impd_get_eq_set_delay (p_drc_gain_dec_structs->eq_set,
|
||||
&p_drc_gain_dec_structs->ia_drc_params_struct.eq_delay);
|
||||
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);
|
||||
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);
|
||||
|
||||
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);
|
||||
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];
|
||||
}
|
||||
}
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
|
||||
for (i=0; i<p_drc_params_struct->drc_set_counter; i++)
|
||||
{
|
||||
ia_drc_instructions_struct* drc_instruction_str;
|
||||
drc_instruction_str = &(pstr_drc_config->str_drc_instruction_str[p_drc_params_struct->sel_drc_array[i].drc_instructions_index]);
|
||||
maxMultibandAudioSignalCount = max(maxMultibandAudioSignalCount, drc_instruction_str->multiband_audio_sig_count);
|
||||
p_audio_in_out_buf->audio_real_buff[i] =
|
||||
&p_audio_in_out_buf->audio_buffer_delayed_real
|
||||
[i][p_audio_in_out_buf->audio_delay_sub_band_samples *
|
||||
p_audio_in_out_buf->audio_sub_band_count];
|
||||
p_audio_in_out_buf->audio_imag_buff[i] =
|
||||
&p_audio_in_out_buf->audio_buffer_delayed_imag
|
||||
[i][p_audio_in_out_buf->audio_delay_sub_band_samples *
|
||||
p_audio_in_out_buf->audio_sub_band_count];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
p_drc_gain_dec_structs->audio_band_buffer.non_interleaved_audio = *mem_ptr;
|
||||
*mem_ptr = (pVOID) ((SIZE_T)*mem_ptr+(maxMultibandAudioSignalCount*sizeof(FLOAT32*))+32);
|
||||
|
||||
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
p_drc_gain_dec_structs->audio_band_buffer.multiband_audio_sig_count = maxMultibandAudioSignalCount;
|
||||
p_drc_gain_dec_structs->audio_band_buffer.frame_size = p_drc_params_struct->drc_frame_size;;
|
||||
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
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);
|
||||
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];
|
||||
|
||||
}
|
||||
}
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
p_audio_in_out_buf->audio_real_buff[i] = &p_audio_in_out_buf->audio_buffer_delayed_real[i][ p_audio_in_out_buf->audio_delay_sub_band_samples * p_audio_in_out_buf->audio_sub_band_count];
|
||||
p_audio_in_out_buf->audio_imag_buff[i] = &p_audio_in_out_buf->audio_buffer_delayed_imag[i][ p_audio_in_out_buf->audio_delay_sub_band_samples * p_audio_in_out_buf->audio_sub_band_count];
|
||||
}
|
||||
}
|
||||
|
||||
return err_code;
|
||||
return err_code;
|
||||
}
|
||||
|
||||
IA_ERRORCODE impd_drc_process_time_domain(
|
||||
ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||
ia_drc_config* pstr_drc_config, ia_drc_gain_struct* pstr_drc_gain,
|
||||
FLOAT32* audio_in_out_buf[], FLOAT32 loudness_normalization_gain_db,
|
||||
FLOAT32 boost, FLOAT32 compress, WORD32 drc_characteristic_target) {
|
||||
WORD32 sel_drc_index;
|
||||
IA_ERRORCODE err_code = 0;
|
||||
WORD32 passThru;
|
||||
ia_drc_instructions_struct* str_drc_instruction_str =
|
||||
pstr_drc_config->str_drc_instruction_str;
|
||||
|
||||
if (p_drc_gain_dec_structs->eq_set) {
|
||||
WORD32 ch;
|
||||
FLOAT32* audio_channel;
|
||||
for (ch = 0; ch < p_drc_gain_dec_structs->eq_set->audio_num_chan; ch++) {
|
||||
audio_channel = audio_in_out_buf[ch];
|
||||
|
||||
impd_process_eq_set_time_domain(
|
||||
p_drc_gain_dec_structs->eq_set, ch, audio_channel, audio_channel,
|
||||
p_drc_gain_dec_structs->ia_drc_params_struct.drc_frame_size);
|
||||
}
|
||||
}
|
||||
|
||||
err_code = impd_store_audio_io_buffer_time(
|
||||
audio_in_out_buf, &p_drc_gain_dec_structs->audio_in_out_buf);
|
||||
if (err_code != IA_NO_ERROR) return (err_code);
|
||||
|
||||
IA_ERRORCODE impd_drc_process_time_domain( ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_gain_struct* pstr_drc_gain,
|
||||
FLOAT32* audio_in_out_buf[],
|
||||
FLOAT32 loudness_normalization_gain_db,
|
||||
FLOAT32 boost,
|
||||
FLOAT32 compress,
|
||||
WORD32 drc_characteristic_target)
|
||||
{
|
||||
WORD32 sel_drc_index;
|
||||
IA_ERRORCODE err_code = 0;
|
||||
WORD32 passThru;
|
||||
ia_drc_instructions_struct* str_drc_instruction_str = pstr_drc_config->str_drc_instruction_str;
|
||||
|
||||
if (p_drc_gain_dec_structs->eq_set)
|
||||
{
|
||||
WORD32 ch;
|
||||
FLOAT32* audio_channel;
|
||||
for (ch=0; ch<p_drc_gain_dec_structs->eq_set->audio_num_chan; ch++)
|
||||
{
|
||||
audio_channel = audio_in_out_buf[ch];
|
||||
|
||||
impd_process_eq_set_time_domain(p_drc_gain_dec_structs->eq_set, ch, audio_channel, audio_channel, p_drc_gain_dec_structs->ia_drc_params_struct.drc_frame_size);
|
||||
|
||||
}
|
||||
if (pstr_drc_config->apply_drc) {
|
||||
for (sel_drc_index = 0;
|
||||
sel_drc_index <
|
||||
p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter;
|
||||
sel_drc_index++) {
|
||||
err_code = impd_get_drc_gain(
|
||||
p_drc_gain_dec_structs, pstr_drc_config, pstr_drc_gain, compress,
|
||||
boost, drc_characteristic_target, loudness_normalization_gain_db,
|
||||
sel_drc_index, &p_drc_gain_dec_structs->drc_gain_buffers);
|
||||
if (err_code != IA_NO_ERROR) return (err_code);
|
||||
}
|
||||
|
||||
err_code = impd_store_audio_io_buffer_time(audio_in_out_buf,
|
||||
&p_drc_gain_dec_structs->audio_in_out_buf);
|
||||
if(err_code!=IA_NO_ERROR)
|
||||
return (err_code);
|
||||
|
||||
if (pstr_drc_config->apply_drc)
|
||||
{
|
||||
for (sel_drc_index=0; sel_drc_index<p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter; sel_drc_index++)
|
||||
{
|
||||
err_code = impd_get_drc_gain (p_drc_gain_dec_structs,
|
||||
pstr_drc_config,
|
||||
pstr_drc_gain,
|
||||
compress,
|
||||
boost,
|
||||
drc_characteristic_target,
|
||||
loudness_normalization_gain_db,
|
||||
sel_drc_index,
|
||||
&p_drc_gain_dec_structs->drc_gain_buffers);
|
||||
if(err_code!=IA_NO_ERROR)
|
||||
return (err_code);
|
||||
}
|
||||
|
||||
if (p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter == 0)
|
||||
{
|
||||
err_code = impd_retrieve_audio_io_buffer_time(audio_in_out_buf,
|
||||
&p_drc_gain_dec_structs->audio_in_out_buf);
|
||||
if (err_code) return (err_code);
|
||||
} else
|
||||
{
|
||||
|
||||
for (sel_drc_index=0; sel_drc_index<p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter; sel_drc_index++)
|
||||
{
|
||||
if (p_drc_gain_dec_structs->ia_drc_params_struct.multiband_sel_drc_idx == sel_drc_index)
|
||||
{
|
||||
passThru = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
passThru = 1;
|
||||
}
|
||||
err_code = impd_filter_banks_process(str_drc_instruction_str,
|
||||
p_drc_gain_dec_structs->ia_drc_params_struct.sel_drc_array[sel_drc_index].drc_instructions_index,
|
||||
&p_drc_gain_dec_structs->ia_drc_params_struct,
|
||||
p_drc_gain_dec_structs->audio_in_out_buf.audio_io_buffer_delayed,
|
||||
&p_drc_gain_dec_structs->audio_band_buffer,
|
||||
&p_drc_gain_dec_structs->ia_filter_banks_struct,
|
||||
passThru);
|
||||
if(err_code!=IA_NO_ERROR)
|
||||
return (err_code);
|
||||
|
||||
err_code = impd_apply_gains_and_add(str_drc_instruction_str,
|
||||
p_drc_gain_dec_structs->ia_drc_params_struct.sel_drc_array[sel_drc_index].drc_instructions_index,
|
||||
&p_drc_gain_dec_structs->ia_drc_params_struct,
|
||||
&(p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[sel_drc_index]),
|
||||
p_drc_gain_dec_structs->shape_filter_block,
|
||||
p_drc_gain_dec_structs->audio_band_buffer.non_interleaved_audio,
|
||||
audio_in_out_buf,
|
||||
1);
|
||||
if(err_code!=IA_NO_ERROR)
|
||||
return (err_code);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
err_code = impd_advance_audio_io_buffer_time(&p_drc_gain_dec_structs->audio_in_out_buf);
|
||||
if(err_code!=IA_NO_ERROR)
|
||||
return (err_code);
|
||||
|
||||
return err_code;
|
||||
}
|
||||
|
||||
|
||||
IA_ERRORCODE impd_drc_process_freq_domain( ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_gain_struct* pstr_drc_gain,
|
||||
FLOAT32* audio_real_buff[],
|
||||
FLOAT32* audio_imag_buff[],
|
||||
FLOAT32 loudness_normalization_gain_db,
|
||||
FLOAT32 boost,
|
||||
FLOAT32 compress,
|
||||
WORD32 drc_characteristic_target)
|
||||
{
|
||||
WORD32 sel_drc_index;
|
||||
IA_ERRORCODE err_code = 0;
|
||||
ia_drc_instructions_struct* str_drc_instruction_str = pstr_drc_config->str_drc_instruction_str;
|
||||
|
||||
if (p_drc_gain_dec_structs->eq_set)
|
||||
{
|
||||
WORD32 ch;
|
||||
|
||||
for (ch=0; ch<p_drc_gain_dec_structs->eq_set->audio_num_chan; ch++)
|
||||
{
|
||||
err_code = impd_process_eq_set_subband_domain(p_drc_gain_dec_structs->eq_set,
|
||||
ch,
|
||||
audio_real_buff[ch],
|
||||
audio_imag_buff[ch]);
|
||||
if(err_code!=IA_NO_ERROR)
|
||||
return (err_code);
|
||||
}
|
||||
}
|
||||
err_code = impd_store_audio_io_buffer_freq(audio_real_buff,
|
||||
audio_imag_buff,
|
||||
&p_drc_gain_dec_structs->audio_in_out_buf);
|
||||
if(err_code!=IA_NO_ERROR)
|
||||
return (err_code);
|
||||
|
||||
if (pstr_drc_config->apply_drc)
|
||||
{
|
||||
for (sel_drc_index=0; sel_drc_index<p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter; sel_drc_index++)
|
||||
{
|
||||
|
||||
err_code = impd_get_drc_gain (p_drc_gain_dec_structs,
|
||||
pstr_drc_config,
|
||||
pstr_drc_gain,
|
||||
compress,
|
||||
boost,
|
||||
drc_characteristic_target,
|
||||
loudness_normalization_gain_db,
|
||||
sel_drc_index,
|
||||
&p_drc_gain_dec_structs->drc_gain_buffers);
|
||||
if(err_code!=IA_NO_ERROR)
|
||||
return (err_code);
|
||||
}
|
||||
|
||||
if (p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter == 0)
|
||||
{
|
||||
err_code = impd_retrieve_audio_buffer_freq(audio_real_buff,
|
||||
audio_imag_buff,
|
||||
&p_drc_gain_dec_structs->audio_in_out_buf);
|
||||
if(err_code!=IA_NO_ERROR)
|
||||
return (err_code);
|
||||
} else
|
||||
{
|
||||
for (sel_drc_index=0; sel_drc_index<p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter; sel_drc_index++)
|
||||
{
|
||||
err_code = impd_apply_gains_subband(str_drc_instruction_str,
|
||||
p_drc_gain_dec_structs->ia_drc_params_struct.sel_drc_array[sel_drc_index].drc_instructions_index,
|
||||
&p_drc_gain_dec_structs->ia_drc_params_struct,
|
||||
&(p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[sel_drc_index]),
|
||||
&p_drc_gain_dec_structs->str_overlap_params,
|
||||
p_drc_gain_dec_structs->audio_in_out_buf.audio_buffer_delayed_real,
|
||||
p_drc_gain_dec_structs->audio_in_out_buf.audio_buffer_delayed_imag,
|
||||
audio_real_buff,
|
||||
audio_imag_buff);
|
||||
if(err_code!=IA_NO_ERROR)
|
||||
return (err_code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
err_code = impd_advance_audio_buff_freq(&p_drc_gain_dec_structs->audio_in_out_buf);
|
||||
|
||||
return err_code;
|
||||
}
|
||||
|
||||
VOID impd_get_parametric_drc_delay(ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
WORD32* parametric_drc_delay,
|
||||
WORD32* parametric_drc_delay_max)
|
||||
{
|
||||
*parametric_drc_delay = p_drc_gain_dec_structs->ia_drc_params_struct.parametric_drc_delay;
|
||||
|
||||
if (pstr_drc_config->str_drc_config_ext.parametric_drc_present && pstr_drc_config->str_drc_config_ext.str_drc_coeff_param_drc.parametric_drc_delay_max_present) {
|
||||
*parametric_drc_delay_max = pstr_drc_config->str_drc_config_ext.str_drc_coeff_param_drc.parametric_drc_delay_max;
|
||||
} else if (pstr_drc_config->str_drc_config_ext.parametric_drc_present == 0) {
|
||||
*parametric_drc_delay_max = 0;
|
||||
if (p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter == 0) {
|
||||
err_code = impd_retrieve_audio_io_buffer_time(
|
||||
audio_in_out_buf, &p_drc_gain_dec_structs->audio_in_out_buf);
|
||||
if (err_code) return (err_code);
|
||||
} else {
|
||||
*parametric_drc_delay_max = -1;
|
||||
}
|
||||
for (sel_drc_index = 0;
|
||||
sel_drc_index <
|
||||
p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter;
|
||||
sel_drc_index++) {
|
||||
if (p_drc_gain_dec_structs->ia_drc_params_struct
|
||||
.multiband_sel_drc_idx == sel_drc_index) {
|
||||
passThru = 0;
|
||||
} else {
|
||||
passThru = 1;
|
||||
}
|
||||
err_code = impd_filter_banks_process(
|
||||
str_drc_instruction_str,
|
||||
p_drc_gain_dec_structs->ia_drc_params_struct
|
||||
.sel_drc_array[sel_drc_index]
|
||||
.drc_instructions_index,
|
||||
&p_drc_gain_dec_structs->ia_drc_params_struct,
|
||||
p_drc_gain_dec_structs->audio_in_out_buf.audio_io_buffer_delayed,
|
||||
&p_drc_gain_dec_structs->audio_band_buffer,
|
||||
&p_drc_gain_dec_structs->ia_filter_banks_struct, passThru);
|
||||
if (err_code != IA_NO_ERROR) return (err_code);
|
||||
|
||||
return;
|
||||
err_code = impd_apply_gains_and_add(
|
||||
str_drc_instruction_str,
|
||||
p_drc_gain_dec_structs->ia_drc_params_struct
|
||||
.sel_drc_array[sel_drc_index]
|
||||
.drc_instructions_index,
|
||||
&p_drc_gain_dec_structs->ia_drc_params_struct,
|
||||
&(p_drc_gain_dec_structs->drc_gain_buffers
|
||||
.pstr_gain_buf[sel_drc_index]),
|
||||
p_drc_gain_dec_structs->shape_filter_block,
|
||||
p_drc_gain_dec_structs->audio_band_buffer.non_interleaved_audio,
|
||||
audio_in_out_buf, 1);
|
||||
if (err_code != IA_NO_ERROR) return (err_code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
err_code = impd_advance_audio_io_buffer_time(
|
||||
&p_drc_gain_dec_structs->audio_in_out_buf);
|
||||
if (err_code != IA_NO_ERROR) return (err_code);
|
||||
|
||||
return err_code;
|
||||
}
|
||||
|
||||
VOID impd_get_eq_delay(ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
WORD32* eq_delay,
|
||||
WORD32* eq_delay_max)
|
||||
{
|
||||
*eq_delay = p_drc_gain_dec_structs->ia_drc_params_struct.eq_delay;
|
||||
IA_ERRORCODE impd_drc_process_freq_domain(
|
||||
ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||
ia_drc_config* pstr_drc_config, ia_drc_gain_struct* pstr_drc_gain,
|
||||
FLOAT32* audio_real_buff[], FLOAT32* audio_imag_buff[],
|
||||
FLOAT32 loudness_normalization_gain_db, FLOAT32 boost, FLOAT32 compress,
|
||||
WORD32 drc_characteristic_target) {
|
||||
WORD32 sel_drc_index;
|
||||
IA_ERRORCODE err_code = 0;
|
||||
ia_drc_instructions_struct* str_drc_instruction_str =
|
||||
pstr_drc_config->str_drc_instruction_str;
|
||||
|
||||
if (pstr_drc_config->str_drc_config_ext.eq_flag && pstr_drc_config->str_drc_config_ext.str_eq_coeff.eq_delay_max_present) {
|
||||
*eq_delay_max = pstr_drc_config->str_drc_config_ext.str_eq_coeff.eq_delay_max;
|
||||
} else if (pstr_drc_config->str_drc_config_ext.eq_flag == 0) {
|
||||
*eq_delay_max = 0;
|
||||
if (p_drc_gain_dec_structs->eq_set) {
|
||||
WORD32 ch;
|
||||
|
||||
for (ch = 0; ch < p_drc_gain_dec_structs->eq_set->audio_num_chan; ch++) {
|
||||
err_code = impd_process_eq_set_subband_domain(
|
||||
p_drc_gain_dec_structs->eq_set, ch, audio_real_buff[ch],
|
||||
audio_imag_buff[ch]);
|
||||
if (err_code != IA_NO_ERROR) return (err_code);
|
||||
}
|
||||
}
|
||||
err_code = impd_store_audio_io_buffer_freq(
|
||||
audio_real_buff, audio_imag_buff,
|
||||
&p_drc_gain_dec_structs->audio_in_out_buf);
|
||||
if (err_code != IA_NO_ERROR) return (err_code);
|
||||
|
||||
if (pstr_drc_config->apply_drc) {
|
||||
for (sel_drc_index = 0;
|
||||
sel_drc_index <
|
||||
p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter;
|
||||
sel_drc_index++) {
|
||||
err_code = impd_get_drc_gain(
|
||||
p_drc_gain_dec_structs, pstr_drc_config, pstr_drc_gain, compress,
|
||||
boost, drc_characteristic_target, loudness_normalization_gain_db,
|
||||
sel_drc_index, &p_drc_gain_dec_structs->drc_gain_buffers);
|
||||
if (err_code != IA_NO_ERROR) return (err_code);
|
||||
}
|
||||
|
||||
if (p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter == 0) {
|
||||
err_code = impd_retrieve_audio_buffer_freq(
|
||||
audio_real_buff, audio_imag_buff,
|
||||
&p_drc_gain_dec_structs->audio_in_out_buf);
|
||||
if (err_code != IA_NO_ERROR) return (err_code);
|
||||
} else {
|
||||
*eq_delay_max = -1;
|
||||
for (sel_drc_index = 0;
|
||||
sel_drc_index <
|
||||
p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter;
|
||||
sel_drc_index++) {
|
||||
err_code = impd_apply_gains_subband(
|
||||
str_drc_instruction_str,
|
||||
p_drc_gain_dec_structs->ia_drc_params_struct
|
||||
.sel_drc_array[sel_drc_index]
|
||||
.drc_instructions_index,
|
||||
&p_drc_gain_dec_structs->ia_drc_params_struct,
|
||||
&(p_drc_gain_dec_structs->drc_gain_buffers
|
||||
.pstr_gain_buf[sel_drc_index]),
|
||||
&p_drc_gain_dec_structs->str_overlap_params,
|
||||
p_drc_gain_dec_structs->audio_in_out_buf.audio_buffer_delayed_real,
|
||||
p_drc_gain_dec_structs->audio_in_out_buf.audio_buffer_delayed_imag,
|
||||
audio_real_buff, audio_imag_buff);
|
||||
if (err_code != IA_NO_ERROR) return (err_code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
err_code =
|
||||
impd_advance_audio_buff_freq(&p_drc_gain_dec_structs->audio_in_out_buf);
|
||||
|
||||
return err_code;
|
||||
}
|
||||
|
||||
VOID impd_get_parametric_drc_delay(
|
||||
ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||
ia_drc_config* pstr_drc_config, WORD32* parametric_drc_delay,
|
||||
WORD32* parametric_drc_delay_max) {
|
||||
*parametric_drc_delay =
|
||||
p_drc_gain_dec_structs->ia_drc_params_struct.parametric_drc_delay;
|
||||
|
||||
if (pstr_drc_config->str_drc_config_ext.parametric_drc_present &&
|
||||
pstr_drc_config->str_drc_config_ext.str_drc_coeff_param_drc
|
||||
.parametric_drc_delay_max_present) {
|
||||
*parametric_drc_delay_max =
|
||||
pstr_drc_config->str_drc_config_ext.str_drc_coeff_param_drc
|
||||
.parametric_drc_delay_max;
|
||||
} else if (pstr_drc_config->str_drc_config_ext.parametric_drc_present == 0) {
|
||||
*parametric_drc_delay_max = 0;
|
||||
} else {
|
||||
*parametric_drc_delay_max = -1;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
VOID impd_get_eq_delay(ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||
ia_drc_config* pstr_drc_config, WORD32* eq_delay,
|
||||
WORD32* eq_delay_max) {
|
||||
*eq_delay = p_drc_gain_dec_structs->ia_drc_params_struct.eq_delay;
|
||||
|
||||
if (pstr_drc_config->str_drc_config_ext.eq_flag &&
|
||||
pstr_drc_config->str_drc_config_ext.str_eq_coeff.eq_delay_max_present) {
|
||||
*eq_delay_max =
|
||||
pstr_drc_config->str_drc_config_ext.str_eq_coeff.eq_delay_max;
|
||||
} else if (pstr_drc_config->str_drc_config_ext.eq_flag == 0) {
|
||||
*eq_delay_max = 0;
|
||||
} else {
|
||||
*eq_delay_max = -1;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,88 +20,67 @@
|
|||
#ifndef IMPD_DRC_GAIN_DECODER2_H
|
||||
#define IMPD_DRC_GAIN_DECODER2_H
|
||||
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI (3.14159265358979323846)
|
||||
#endif
|
||||
|
||||
typedef struct ia_drc_gain_dec_struct
|
||||
{
|
||||
WORD32 audio_num_chan;
|
||||
ia_drc_params_struct ia_drc_params_struct;
|
||||
ia_drc_gain_buffers_struct drc_gain_buffers;
|
||||
ia_audio_band_buffer_struct audio_band_buffer;
|
||||
ia_overlap_params_struct str_overlap_params;
|
||||
ia_filter_banks_struct ia_filter_banks_struct;
|
||||
ia_audio_in_out_buf audio_in_out_buf;
|
||||
ia_parametric_drc_params_struct parametricdrc_params;
|
||||
shape_filter_block shape_filter_block[CHANNEL_GROUP_COUNT_MAX];
|
||||
ia_eq_set_struct* eq_set;
|
||||
}ia_drc_gain_dec_struct;
|
||||
typedef struct ia_drc_gain_dec_struct {
|
||||
WORD32 audio_num_chan;
|
||||
ia_drc_params_struct ia_drc_params_struct;
|
||||
ia_drc_gain_buffers_struct drc_gain_buffers;
|
||||
ia_audio_band_buffer_struct audio_band_buffer;
|
||||
ia_overlap_params_struct str_overlap_params;
|
||||
ia_filter_banks_struct ia_filter_banks_struct;
|
||||
ia_audio_in_out_buf audio_in_out_buf;
|
||||
ia_parametric_drc_params_struct parametricdrc_params;
|
||||
shape_filter_block shape_filter_block[CHANNEL_GROUP_COUNT_MAX];
|
||||
ia_eq_set_struct* eq_set;
|
||||
} ia_drc_gain_dec_struct;
|
||||
|
||||
WORD32 impd_init_drc_decode(WORD32 frame_size, WORD32 sample_rate,
|
||||
WORD32 gain_delay_samples, WORD32 delay_mode,
|
||||
WORD32 sub_band_domain_mode,
|
||||
ia_drc_gain_dec_struct* p_drc_gain_dec_structs);
|
||||
|
||||
WORD32 impd_init_drc_decode( WORD32 frame_size,
|
||||
WORD32 sample_rate,
|
||||
WORD32 gain_delay_samples,
|
||||
WORD32 delay_mode,
|
||||
WORD32 sub_band_domain_mode,
|
||||
ia_drc_gain_dec_struct* p_drc_gain_dec_structs);
|
||||
WORD32 impd_init_drc_decode_post_config(
|
||||
WORD32 audio_num_chan, WORD32* drc_set_id_processed,
|
||||
WORD32* downmix_id_processed, WORD32 num_sets_processed,
|
||||
WORD32 eq_set_id_processed,
|
||||
|
||||
WORD32 impd_init_drc_decode_post_config( WORD32 audio_num_chan,
|
||||
WORD32* drc_set_id_processed,
|
||||
WORD32* downmix_id_processed,
|
||||
WORD32 num_sets_processed,
|
||||
WORD32 eq_set_id_processed,
|
||||
ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info, pVOID* mem_ptr
|
||||
|
||||
ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||
ia_drc_config * pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
pVOID *mem_ptr
|
||||
);
|
||||
|
||||
);
|
||||
WORD32 impd_drc_process_time_domain(
|
||||
ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||
ia_drc_config* pstr_drc_config, ia_drc_gain_struct* pstr_drc_gain,
|
||||
FLOAT32* audio_in_out_buf[], FLOAT32 loudness_normalization_gain_db,
|
||||
FLOAT32 boost, FLOAT32 compress, WORD32 drc_characteristic);
|
||||
|
||||
WORD32 impd_drc_process_time_domain( ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_gain_struct* pstr_drc_gain,
|
||||
FLOAT32* audio_in_out_buf[],
|
||||
FLOAT32 loudness_normalization_gain_db,
|
||||
FLOAT32 boost,
|
||||
FLOAT32 compress,
|
||||
WORD32 drc_characteristic);
|
||||
WORD32 impd_drc_process_freq_domain(
|
||||
ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||
ia_drc_config* pstr_drc_config, ia_drc_gain_struct* pstr_drc_gain,
|
||||
FLOAT32* audio_real_buff[], FLOAT32* audio_imag_buff[],
|
||||
FLOAT32 loudness_normalization_gain_db, FLOAT32 boost, FLOAT32 compress,
|
||||
WORD32 drc_characteristic);
|
||||
|
||||
WORD32 impd_drc_process_freq_domain(ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_gain_struct* pstr_drc_gain,
|
||||
FLOAT32* audio_real_buff[],
|
||||
FLOAT32* audio_imag_buff[],
|
||||
FLOAT32 loudness_normalization_gain_db,
|
||||
FLOAT32 boost,
|
||||
FLOAT32 compress,
|
||||
WORD32 drc_characteristic);
|
||||
VOID impd_get_parametric_drc_delay(
|
||||
ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||
ia_drc_config* pstr_drc_config, WORD32* parametric_drc_delay,
|
||||
WORD32* parametric_drc_delay_max);
|
||||
|
||||
VOID impd_get_parametric_drc_delay(ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
WORD32* parametric_drc_delay,
|
||||
WORD32* parametric_drc_delay_max);
|
||||
|
||||
VOID impd_get_eq_delay(ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
WORD32* eq_delay,
|
||||
WORD32* eq_delay_max);
|
||||
VOID impd_get_eq_delay(ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||
ia_drc_config* pstr_drc_config, WORD32* eq_delay,
|
||||
WORD32* eq_delay_max);
|
||||
|
||||
WORD32
|
||||
impd_get_drc_gain (ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_gain_struct* pstr_drc_gain,
|
||||
FLOAT32 compress,
|
||||
FLOAT32 boost,
|
||||
WORD32 characteristic_index,
|
||||
FLOAT32 loudness_normalization_gain_db,
|
||||
WORD32 sub_drc_index,
|
||||
ia_drc_gain_buffers_struct* drc_gain_buffers);
|
||||
|
||||
|
||||
|
||||
|
||||
impd_get_drc_gain(ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_gain_struct* pstr_drc_gain, FLOAT32 compress,
|
||||
FLOAT32 boost, WORD32 characteristic_index,
|
||||
FLOAT32 loudness_normalization_gain_db, WORD32 sub_drc_index,
|
||||
ia_drc_gain_buffers_struct* drc_gain_buffers);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,11 +20,10 @@
|
|||
#ifndef IMPD_DRC_HASHDEFINES_H
|
||||
#define IMPD_DRC_HASHDEFINES_H
|
||||
|
||||
|
||||
#define DEC_TYPE_TD 0
|
||||
#define DEC_TYPE_TD_QMF64 1
|
||||
#define DEC_TYPE_QMF64 2
|
||||
#define DEC_TYPE_STFT256 3
|
||||
#define BITSTREAM_FILE_FORMAT_SPLIT 1
|
||||
#define DEC_TYPE_TD 0
|
||||
#define DEC_TYPE_TD_QMF64 1
|
||||
#define DEC_TYPE_QMF64 2
|
||||
#define DEC_TYPE_STFT256 3
|
||||
#define BITSTREAM_FILE_FORMAT_SPLIT 1
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -27,134 +27,171 @@
|
|||
#include "impd_drc_filter_bank.h"
|
||||
#include "impd_drc_rom.h"
|
||||
|
||||
WORD32 impd_set_default_params_selection_process(
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params) {
|
||||
pstr_drc_sel_proc_params->base_channel_count = -1;
|
||||
pstr_drc_sel_proc_params->base_layout = -1;
|
||||
pstr_drc_sel_proc_params->target_config_request_type = 0;
|
||||
pstr_drc_sel_proc_params->num_downmix_id_requests = 0;
|
||||
|
||||
WORD32 impd_set_default_params_selection_process(ia_drc_sel_proc_params_struct *pstr_drc_sel_proc_params)
|
||||
{
|
||||
pstr_drc_sel_proc_params->base_channel_count = -1;
|
||||
pstr_drc_sel_proc_params->base_layout = -1;
|
||||
pstr_drc_sel_proc_params->target_config_request_type = 0;
|
||||
pstr_drc_sel_proc_params->num_downmix_id_requests = 0;
|
||||
pstr_drc_sel_proc_params->album_mode = 0;
|
||||
|
||||
pstr_drc_sel_proc_params->album_mode = 0;
|
||||
pstr_drc_sel_proc_params->peak_limiter = 1;
|
||||
|
||||
pstr_drc_sel_proc_params->peak_limiter = 1;
|
||||
pstr_drc_sel_proc_params->loudness_normalization_on = 0;
|
||||
pstr_drc_sel_proc_params->target_loudness = -24.0f;
|
||||
|
||||
pstr_drc_sel_proc_params->loudness_normalization_on = 0;
|
||||
pstr_drc_sel_proc_params->target_loudness = -24.0f;
|
||||
pstr_drc_sel_proc_params->loudness_deviation_max =
|
||||
LOUDNESS_DEVIATION_MAX_DEFAULT;
|
||||
|
||||
pstr_drc_sel_proc_params->loudness_deviation_max = LOUDNESS_DEVIATION_MAX_DEFAULT;
|
||||
pstr_drc_sel_proc_params->loudness_measurement_method =
|
||||
USER_METHOD_DEFINITION_DEFAULT;
|
||||
pstr_drc_sel_proc_params->loudness_measurement_system =
|
||||
USER_MEASUREMENT_SYSTEM_DEFAULT;
|
||||
pstr_drc_sel_proc_params->loudness_measurement_pre_proc =
|
||||
USER_LOUDNESS_PREPROCESSING_DEFAULT;
|
||||
pstr_drc_sel_proc_params->device_cut_off_frequency = 500;
|
||||
pstr_drc_sel_proc_params->loudness_norm_gain_db_max =
|
||||
LOUDNESS_NORMALIZATION_GAIN_MAX_DEFAULT;
|
||||
pstr_drc_sel_proc_params->loudness_norm_gain_modification_db = 0.0f;
|
||||
pstr_drc_sel_proc_params->output_peak_level_max = 0.0f;
|
||||
if (pstr_drc_sel_proc_params->peak_limiter == 1) {
|
||||
pstr_drc_sel_proc_params->output_peak_level_max = 6.0f;
|
||||
}
|
||||
|
||||
pstr_drc_sel_proc_params->loudness_measurement_method = USER_METHOD_DEFINITION_DEFAULT;
|
||||
pstr_drc_sel_proc_params->loudness_measurement_system = USER_MEASUREMENT_SYSTEM_DEFAULT;
|
||||
pstr_drc_sel_proc_params->loudness_measurement_pre_proc = USER_LOUDNESS_PREPROCESSING_DEFAULT;
|
||||
pstr_drc_sel_proc_params->device_cut_off_frequency = 500;
|
||||
pstr_drc_sel_proc_params->loudness_norm_gain_db_max = LOUDNESS_NORMALIZATION_GAIN_MAX_DEFAULT;
|
||||
pstr_drc_sel_proc_params->loudness_norm_gain_modification_db = 0.0f;
|
||||
pstr_drc_sel_proc_params->output_peak_level_max = 0.0f;
|
||||
if (pstr_drc_sel_proc_params->peak_limiter == 1) {
|
||||
pstr_drc_sel_proc_params->dynamic_range_control_on = 1;
|
||||
pstr_drc_sel_proc_params->num_bands_supported = 4;
|
||||
pstr_drc_sel_proc_params->num_drc_feature_requests = 0;
|
||||
|
||||
pstr_drc_sel_proc_params->output_peak_level_max = 6.0f;
|
||||
pstr_drc_sel_proc_params->boost = 1.f;
|
||||
pstr_drc_sel_proc_params->compress = 1.f;
|
||||
pstr_drc_sel_proc_params->drc_characteristic_target = 0;
|
||||
|
||||
}
|
||||
|
||||
pstr_drc_sel_proc_params->dynamic_range_control_on = 1;
|
||||
pstr_drc_sel_proc_params->num_bands_supported = 4;
|
||||
pstr_drc_sel_proc_params->num_drc_feature_requests = 0;
|
||||
|
||||
|
||||
pstr_drc_sel_proc_params->boost = 1.f;
|
||||
pstr_drc_sel_proc_params->compress = 1.f;
|
||||
pstr_drc_sel_proc_params->drc_characteristic_target = 0;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
WORD32 impd_set_custom_params(const WORD32 param_set_idx,
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params)
|
||||
{
|
||||
WORD32 i, k;
|
||||
WORD32 impd_set_custom_params(
|
||||
const WORD32 param_set_idx,
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params) {
|
||||
WORD32 i, k;
|
||||
|
||||
const ia_loc_sys_interface_struct* system_interface = &(loc_sys_interface[param_set_idx-1]);
|
||||
const ia_loc_sys_interface_struct* system_interface =
|
||||
&(loc_sys_interface[param_set_idx - 1]);
|
||||
|
||||
const ia_loc_loudness_norm_ctrl_interface_struct* loudness_norm_ctrl_interface = &(loc_loudness_norm_ctrl_interface[param_set_idx-1]);
|
||||
const ia_loc_loudness_norm_param_interface_struct* loudness_norm_param_interface = &(loc_loudness_norm_param_interface[param_set_idx-1]);
|
||||
const ia_loc_loudness_norm_ctrl_interface_struct*
|
||||
loudness_norm_ctrl_interface =
|
||||
&(loc_loudness_norm_ctrl_interface[param_set_idx - 1]);
|
||||
const ia_loc_loudness_norm_param_interface_struct*
|
||||
loudness_norm_param_interface =
|
||||
&(loc_loudness_norm_param_interface[param_set_idx - 1]);
|
||||
|
||||
const ia_loc_drc_interface_struct* drc_ctrl_interface = &(loc_dyn_range_ctrl_interface[param_set_idx-1]);
|
||||
const ia_loc_requested_drc_effect_struct* requested_drc_effect_type = &(loc_requested_drc_effect_type_str[param_set_idx-1]);
|
||||
const ia_loc_drc_parameter_interface_struct* drc_parameter_interface = &(loc_drc_parameter_interface[param_set_idx-1]);
|
||||
const ia_loc_drc_interface_struct* drc_ctrl_interface =
|
||||
&(loc_dyn_range_ctrl_interface[param_set_idx - 1]);
|
||||
const ia_loc_requested_drc_effect_struct* requested_drc_effect_type =
|
||||
&(loc_requested_drc_effect_type_str[param_set_idx - 1]);
|
||||
const ia_loc_drc_parameter_interface_struct* drc_parameter_interface =
|
||||
&(loc_drc_parameter_interface[param_set_idx - 1]);
|
||||
|
||||
pstr_drc_sel_proc_params->target_config_request_type = system_interface->target_config_request_type;
|
||||
switch (system_interface->target_config_request_type) {
|
||||
case 1:
|
||||
pstr_drc_sel_proc_params->requested_target_layout = system_interface->requested_target_layout;
|
||||
break;
|
||||
case 2:
|
||||
pstr_drc_sel_proc_params->requested_target_ch_count = system_interface->requested_target_ch_count;
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
pstr_drc_sel_proc_params->num_downmix_id_requests = system_interface->num_downmix_id_requests;
|
||||
for (i=0; i<system_interface->num_downmix_id_requests; i++) {
|
||||
pstr_drc_sel_proc_params->requested_dwnmix_id[i] = system_interface->requested_dwnmix_id[i];
|
||||
}
|
||||
break;
|
||||
}
|
||||
pstr_drc_sel_proc_params->target_config_request_type =
|
||||
system_interface->target_config_request_type;
|
||||
switch (system_interface->target_config_request_type) {
|
||||
case 1:
|
||||
pstr_drc_sel_proc_params->requested_target_layout =
|
||||
system_interface->requested_target_layout;
|
||||
break;
|
||||
case 2:
|
||||
pstr_drc_sel_proc_params->requested_target_ch_count =
|
||||
system_interface->requested_target_ch_count;
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
pstr_drc_sel_proc_params->num_downmix_id_requests =
|
||||
system_interface->num_downmix_id_requests;
|
||||
for (i = 0; i < system_interface->num_downmix_id_requests; i++) {
|
||||
pstr_drc_sel_proc_params->requested_dwnmix_id[i] =
|
||||
system_interface->requested_dwnmix_id[i];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
pstr_drc_sel_proc_params->loudness_normalization_on = loudness_norm_ctrl_interface->loudness_normalization_on;
|
||||
pstr_drc_sel_proc_params->target_loudness = loudness_norm_ctrl_interface->target_loudness;
|
||||
pstr_drc_sel_proc_params->loudness_normalization_on =
|
||||
loudness_norm_ctrl_interface->loudness_normalization_on;
|
||||
pstr_drc_sel_proc_params->target_loudness =
|
||||
loudness_norm_ctrl_interface->target_loudness;
|
||||
|
||||
pstr_drc_sel_proc_params->album_mode = loudness_norm_param_interface->album_mode;
|
||||
pstr_drc_sel_proc_params->peak_limiter = loudness_norm_param_interface->peak_limiter;
|
||||
pstr_drc_sel_proc_params->loudness_deviation_max = loudness_norm_param_interface->loudness_deviation_max;
|
||||
pstr_drc_sel_proc_params->loudness_measurement_method = loudness_norm_param_interface->loudness_measurement_method;
|
||||
pstr_drc_sel_proc_params->loudness_measurement_system = loudness_norm_param_interface->loudness_measurement_system;
|
||||
pstr_drc_sel_proc_params->loudness_measurement_pre_proc = loudness_norm_param_interface->loudness_measurement_pre_proc;
|
||||
pstr_drc_sel_proc_params->device_cut_off_frequency= loudness_norm_param_interface->device_cut_off_frequency;
|
||||
pstr_drc_sel_proc_params->loudness_norm_gain_db_max = loudness_norm_param_interface->loudness_norm_gain_db_max;
|
||||
pstr_drc_sel_proc_params->loudness_norm_gain_modification_db = loudness_norm_param_interface->loudness_norm_gain_modification_db;
|
||||
pstr_drc_sel_proc_params->output_peak_level_max = loudness_norm_param_interface->output_peak_level_max;
|
||||
pstr_drc_sel_proc_params->album_mode =
|
||||
loudness_norm_param_interface->album_mode;
|
||||
pstr_drc_sel_proc_params->peak_limiter =
|
||||
loudness_norm_param_interface->peak_limiter;
|
||||
pstr_drc_sel_proc_params->loudness_deviation_max =
|
||||
loudness_norm_param_interface->loudness_deviation_max;
|
||||
pstr_drc_sel_proc_params->loudness_measurement_method =
|
||||
loudness_norm_param_interface->loudness_measurement_method;
|
||||
pstr_drc_sel_proc_params->loudness_measurement_system =
|
||||
loudness_norm_param_interface->loudness_measurement_system;
|
||||
pstr_drc_sel_proc_params->loudness_measurement_pre_proc =
|
||||
loudness_norm_param_interface->loudness_measurement_pre_proc;
|
||||
pstr_drc_sel_proc_params->device_cut_off_frequency =
|
||||
loudness_norm_param_interface->device_cut_off_frequency;
|
||||
pstr_drc_sel_proc_params->loudness_norm_gain_db_max =
|
||||
loudness_norm_param_interface->loudness_norm_gain_db_max;
|
||||
pstr_drc_sel_proc_params->loudness_norm_gain_modification_db =
|
||||
loudness_norm_param_interface->loudness_norm_gain_modification_db;
|
||||
pstr_drc_sel_proc_params->output_peak_level_max =
|
||||
loudness_norm_param_interface->output_peak_level_max;
|
||||
|
||||
pstr_drc_sel_proc_params->dynamic_range_control_on = drc_ctrl_interface->dynamic_range_control_on;
|
||||
pstr_drc_sel_proc_params->num_drc_feature_requests = drc_ctrl_interface->num_drc_feature_requests;
|
||||
for (i=0; i<drc_ctrl_interface->num_drc_feature_requests; i++)
|
||||
{
|
||||
pstr_drc_sel_proc_params->drc_feature_req_type[i] = drc_ctrl_interface->drc_feature_req_type[i];
|
||||
switch (drc_ctrl_interface->drc_feature_req_type[i])
|
||||
{
|
||||
case MATCH_EFFECT_TYPE:
|
||||
pstr_drc_sel_proc_params->requested_num_drc_effects[i] = requested_drc_effect_type->requested_num_drc_effects;
|
||||
pstr_drc_sel_proc_params->desired_num_drc_effects_of_requested[i] = requested_drc_effect_type->desired_num_drc_effects_of_requested;
|
||||
for (k=0; k<requested_drc_effect_type->requested_num_drc_effects; k++)
|
||||
{
|
||||
pstr_drc_sel_proc_params->requested_drc_effect_type[i][k] = requested_drc_effect_type->requested_drc_effect_type[k];
|
||||
}
|
||||
break;
|
||||
case MATCH_DYNAMIC_RANGE:
|
||||
pstr_drc_sel_proc_params->requested_dyn_range_measur_type[i] = drc_ctrl_interface->requested_dyn_rng_measurement_type;
|
||||
pstr_drc_sel_proc_params->requested_dyn_range_range_flag[i] = drc_ctrl_interface->requested_dyn_range_is_single_val_flag;
|
||||
pstr_drc_sel_proc_params->requested_dyn_range_value[i] = drc_ctrl_interface->requested_dyn_range_value;
|
||||
pstr_drc_sel_proc_params->requested_dyn_range_min_val[i] = drc_ctrl_interface->requested_dyn_range_min_val;
|
||||
pstr_drc_sel_proc_params->requested_dyn_range_max_val[i] = drc_ctrl_interface->requested_dyn_range_max_val;
|
||||
break;
|
||||
case MATCH_DRC_CHARACTERISTIC:
|
||||
pstr_drc_sel_proc_params->requested_drc_characteristic[i] = drc_ctrl_interface->requested_drc_characteristic;
|
||||
break;
|
||||
default:
|
||||
return (UNEXPECTED_ERROR);
|
||||
pstr_drc_sel_proc_params->dynamic_range_control_on =
|
||||
drc_ctrl_interface->dynamic_range_control_on;
|
||||
pstr_drc_sel_proc_params->num_drc_feature_requests =
|
||||
drc_ctrl_interface->num_drc_feature_requests;
|
||||
for (i = 0; i < drc_ctrl_interface->num_drc_feature_requests; i++) {
|
||||
pstr_drc_sel_proc_params->drc_feature_req_type[i] =
|
||||
drc_ctrl_interface->drc_feature_req_type[i];
|
||||
switch (drc_ctrl_interface->drc_feature_req_type[i]) {
|
||||
case MATCH_EFFECT_TYPE:
|
||||
pstr_drc_sel_proc_params->requested_num_drc_effects[i] =
|
||||
requested_drc_effect_type->requested_num_drc_effects;
|
||||
pstr_drc_sel_proc_params->desired_num_drc_effects_of_requested[i] =
|
||||
requested_drc_effect_type->desired_num_drc_effects_of_requested;
|
||||
for (k = 0; k < requested_drc_effect_type->requested_num_drc_effects;
|
||||
k++) {
|
||||
pstr_drc_sel_proc_params->requested_drc_effect_type[i][k] =
|
||||
requested_drc_effect_type->requested_drc_effect_type[k];
|
||||
}
|
||||
break;
|
||||
case MATCH_DYNAMIC_RANGE:
|
||||
pstr_drc_sel_proc_params->requested_dyn_range_measur_type[i] =
|
||||
drc_ctrl_interface->requested_dyn_rng_measurement_type;
|
||||
pstr_drc_sel_proc_params->requested_dyn_range_range_flag[i] =
|
||||
drc_ctrl_interface->requested_dyn_range_is_single_val_flag;
|
||||
pstr_drc_sel_proc_params->requested_dyn_range_value[i] =
|
||||
drc_ctrl_interface->requested_dyn_range_value;
|
||||
pstr_drc_sel_proc_params->requested_dyn_range_min_val[i] =
|
||||
drc_ctrl_interface->requested_dyn_range_min_val;
|
||||
pstr_drc_sel_proc_params->requested_dyn_range_max_val[i] =
|
||||
drc_ctrl_interface->requested_dyn_range_max_val;
|
||||
break;
|
||||
case MATCH_DRC_CHARACTERISTIC:
|
||||
pstr_drc_sel_proc_params->requested_drc_characteristic[i] =
|
||||
drc_ctrl_interface->requested_drc_characteristic;
|
||||
break;
|
||||
default:
|
||||
return (UNEXPECTED_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
pstr_drc_sel_proc_params->boost = drc_parameter_interface->boost;
|
||||
pstr_drc_sel_proc_params->compress = drc_parameter_interface->compress;
|
||||
pstr_drc_sel_proc_params->drc_characteristic_target = drc_parameter_interface->drc_characteristic_target;
|
||||
pstr_drc_sel_proc_params->boost = drc_parameter_interface->boost;
|
||||
pstr_drc_sel_proc_params->compress = drc_parameter_interface->compress;
|
||||
pstr_drc_sel_proc_params->drc_characteristic_target =
|
||||
drc_parameter_interface->drc_characteristic_target;
|
||||
|
||||
return (0);
|
||||
return (0);
|
||||
}
|
||||
WORD32 impd_eval_custom_params_selection_process(ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params)
|
||||
{
|
||||
pstr_drc_sel_proc_params->loudness_norm_gain_db_max = max (0.0f, pstr_drc_sel_proc_params->loudness_norm_gain_db_max);
|
||||
pstr_drc_sel_proc_params->loudness_deviation_max = max (0, pstr_drc_sel_proc_params->loudness_deviation_max);
|
||||
WORD32 impd_eval_custom_params_selection_process(
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params) {
|
||||
pstr_drc_sel_proc_params->loudness_norm_gain_db_max =
|
||||
max(0.0f, pstr_drc_sel_proc_params->loudness_norm_gain_db_max);
|
||||
pstr_drc_sel_proc_params->loudness_deviation_max =
|
||||
max(0, pstr_drc_sel_proc_params->loudness_deviation_max);
|
||||
|
||||
return (0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,12 +24,15 @@
|
|||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
WORD32 impd_set_default_params_selection_process(ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params);
|
||||
WORD32 impd_set_default_params_selection_process(
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params);
|
||||
|
||||
WORD32 impd_set_custom_params(const WORD32 param_set_idx,
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params);
|
||||
WORD32 impd_set_custom_params(
|
||||
const WORD32 param_set_idx,
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params);
|
||||
|
||||
WORD32 impd_eval_custom_params_selection_process(ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params);
|
||||
WORD32 impd_eval_custom_params_selection_process(
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -21,112 +21,113 @@
|
|||
#define IMPD_DRC_INTERFACE_H
|
||||
|
||||
typedef struct {
|
||||
WORD32 loudness_eq_request_flag;
|
||||
WORD32 loudness_eq_request;
|
||||
WORD32 sensitivity_flag;
|
||||
FLOAT32 sensitivity;
|
||||
WORD32 playback_gain_flag;
|
||||
FLOAT32 playback_gain;
|
||||
WORD32 loudness_eq_request_flag;
|
||||
WORD32 loudness_eq_request;
|
||||
WORD32 sensitivity_flag;
|
||||
FLOAT32 sensitivity;
|
||||
WORD32 playback_gain_flag;
|
||||
FLOAT32 playback_gain;
|
||||
} ia_loudness_eq_parameter_interface_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 eq_set_purpose_request;
|
||||
WORD32 eq_set_purpose_request;
|
||||
} ia_equalization_ctrl_interface_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 ext_size_bits;
|
||||
WORD32 ext_bit_size;
|
||||
WORD32 uni_drc_interface_ext_type;
|
||||
WORD32 ext_size_bits;
|
||||
WORD32 ext_bit_size;
|
||||
WORD32 uni_drc_interface_ext_type;
|
||||
} ia_specific_interface_extension_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 interface_ext_count;
|
||||
ia_specific_interface_extension_struct specific_interface_ext[EXT_COUNT_MAX];
|
||||
WORD32 loudness_eq_parameter_interface_flag;
|
||||
WORD32 eq_ctrl_interface_flag;
|
||||
ia_loudness_eq_parameter_interface_struct loudness_eq_parameter_interface;
|
||||
ia_equalization_ctrl_interface_struct eq_ctrl_interface;
|
||||
WORD32 interface_ext_count;
|
||||
ia_specific_interface_extension_struct specific_interface_ext[EXT_COUNT_MAX];
|
||||
WORD32 loudness_eq_parameter_interface_flag;
|
||||
WORD32 eq_ctrl_interface_flag;
|
||||
ia_loudness_eq_parameter_interface_struct loudness_eq_parameter_interface;
|
||||
ia_equalization_ctrl_interface_struct eq_ctrl_interface;
|
||||
} ia_drc_uni_interface_ext_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 change_compress;
|
||||
WORD32 change_boost;
|
||||
FLOAT32 compress;
|
||||
FLOAT32 boost;
|
||||
WORD32 change_drc_characteristic_target;
|
||||
WORD32 drc_characteristic_target;
|
||||
WORD32 change_compress;
|
||||
WORD32 change_boost;
|
||||
FLOAT32 compress;
|
||||
FLOAT32 boost;
|
||||
WORD32 change_drc_characteristic_target;
|
||||
WORD32 drc_characteristic_target;
|
||||
} ia_drc_parameter_interface_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 dynamic_range_control_on;
|
||||
WORD32 num_drc_feature_requests;
|
||||
WORD32 drc_feature_req_type[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 requested_num_drc_effects[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 desired_num_drc_effects_of_requested[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 requested_drc_effect_type[MAX_NUM_DRC_FEATURE_REQUESTS][MAX_NUM_DRC_EFFECT_TYPE_REQUESTS];
|
||||
WORD32 requested_dyn_rng_measurement_type[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 requested_dyn_range_is_single_val_flag[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
FLOAT32 requested_dyn_range_value[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
FLOAT32 requested_dyn_range_min_val[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
FLOAT32 requested_dyn_range_max_val[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 requested_drc_characteristic[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 dynamic_range_control_on;
|
||||
WORD32 num_drc_feature_requests;
|
||||
WORD32 drc_feature_req_type[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 requested_num_drc_effects[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 desired_num_drc_effects_of_requested[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 requested_drc_effect_type[MAX_NUM_DRC_FEATURE_REQUESTS]
|
||||
[MAX_NUM_DRC_EFFECT_TYPE_REQUESTS];
|
||||
WORD32 requested_dyn_rng_measurement_type[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 requested_dyn_range_is_single_val_flag[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
FLOAT32 requested_dyn_range_value[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
FLOAT32 requested_dyn_range_min_val[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
FLOAT32 requested_dyn_range_max_val[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 requested_drc_characteristic[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
} ia_dyn_rng_ctrl_interface_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 album_mode;
|
||||
WORD32 peak_limiter;
|
||||
WORD32 change_loudness_deviation_max;
|
||||
WORD32 loudness_deviation_max;
|
||||
WORD32 change_loudness_measur_method;
|
||||
WORD32 loudness_measurement_method;
|
||||
WORD32 change_loudness_measur_system;
|
||||
WORD32 loudness_measurement_system;
|
||||
WORD32 change_loudness_measur_pre_proc;
|
||||
WORD32 loudness_measurement_pre_proc;
|
||||
WORD32 change_device_cut_off_freq;
|
||||
WORD32 device_cut_off_frequency;
|
||||
WORD32 change_loudness_norm_gain_db_max;
|
||||
FLOAT32 loudness_norm_gain_db_max;
|
||||
WORD32 change_loudness_norm_gain_modification_db;
|
||||
FLOAT32 loudness_norm_gain_modification_db;
|
||||
WORD32 change_output_peak_level_max;
|
||||
FLOAT32 output_peak_level_max;
|
||||
WORD32 album_mode;
|
||||
WORD32 peak_limiter;
|
||||
WORD32 change_loudness_deviation_max;
|
||||
WORD32 loudness_deviation_max;
|
||||
WORD32 change_loudness_measur_method;
|
||||
WORD32 loudness_measurement_method;
|
||||
WORD32 change_loudness_measur_system;
|
||||
WORD32 loudness_measurement_system;
|
||||
WORD32 change_loudness_measur_pre_proc;
|
||||
WORD32 loudness_measurement_pre_proc;
|
||||
WORD32 change_device_cut_off_freq;
|
||||
WORD32 device_cut_off_frequency;
|
||||
WORD32 change_loudness_norm_gain_db_max;
|
||||
FLOAT32 loudness_norm_gain_db_max;
|
||||
WORD32 change_loudness_norm_gain_modification_db;
|
||||
FLOAT32 loudness_norm_gain_modification_db;
|
||||
WORD32 change_output_peak_level_max;
|
||||
FLOAT32 output_peak_level_max;
|
||||
} ia_loudness_norm_parameter_interface_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 loudness_normalization_on;
|
||||
FLOAT32 target_loudness;
|
||||
WORD32 loudness_normalization_on;
|
||||
FLOAT32 target_loudness;
|
||||
} ia_loudness_norm_ctrl_interface_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 target_config_request_type;
|
||||
WORD32 num_downmix_id_requests;
|
||||
WORD32 requested_dwnmix_id[MAX_NUM_DOWNMIX_ID_REQUESTS];
|
||||
WORD32 requested_target_layout;
|
||||
WORD32 requested_target_ch_count;
|
||||
WORD32 target_config_request_type;
|
||||
WORD32 num_downmix_id_requests;
|
||||
WORD32 requested_dwnmix_id[MAX_NUM_DOWNMIX_ID_REQUESTS];
|
||||
WORD32 requested_target_layout;
|
||||
WORD32 requested_target_ch_count;
|
||||
} ia_system_interface_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 interface_signat_type;
|
||||
WORD32 interface_signat_data_len;
|
||||
UWORD32 interface_signat_data[MAX_SIGNATURE_DATA_LENGTH_PLUS_ONE*8];
|
||||
WORD32 interface_signat_type;
|
||||
WORD32 interface_signat_data_len;
|
||||
UWORD32 interface_signat_data[MAX_SIGNATURE_DATA_LENGTH_PLUS_ONE * 8];
|
||||
} ia_drc_uni_interface_signat_struct;
|
||||
|
||||
typedef struct ia_drc_interface_struct{
|
||||
WORD32 interface_signat_flag;
|
||||
WORD32 system_interface_flag;
|
||||
WORD32 loudness_norm_ctrl_interface_flag;
|
||||
WORD32 loudness_norm_parameter_interface_flag;
|
||||
WORD32 drc_interface_flag;
|
||||
WORD32 drc_parameter_interface_flag;
|
||||
WORD32 drc_uni_interface_ext_flag;
|
||||
ia_drc_uni_interface_signat_struct drc_uni_interface_signature;
|
||||
ia_system_interface_struct system_interface;
|
||||
ia_loudness_norm_ctrl_interface_struct loudness_norm_ctrl_interface;
|
||||
ia_loudness_norm_parameter_interface_struct loudness_norm_param_interface;
|
||||
ia_dyn_rng_ctrl_interface_struct drc_ctrl_interface;
|
||||
ia_drc_parameter_interface_struct drc_parameter_interface;
|
||||
ia_drc_uni_interface_ext_struct drc_uni_interface_ext;
|
||||
typedef struct ia_drc_interface_struct {
|
||||
WORD32 interface_signat_flag;
|
||||
WORD32 system_interface_flag;
|
||||
WORD32 loudness_norm_ctrl_interface_flag;
|
||||
WORD32 loudness_norm_parameter_interface_flag;
|
||||
WORD32 drc_interface_flag;
|
||||
WORD32 drc_parameter_interface_flag;
|
||||
WORD32 drc_uni_interface_ext_flag;
|
||||
ia_drc_uni_interface_signat_struct drc_uni_interface_signature;
|
||||
ia_system_interface_struct system_interface;
|
||||
ia_loudness_norm_ctrl_interface_struct loudness_norm_ctrl_interface;
|
||||
ia_loudness_norm_parameter_interface_struct loudness_norm_param_interface;
|
||||
ia_dyn_rng_ctrl_interface_struct drc_ctrl_interface;
|
||||
ia_drc_parameter_interface_struct drc_parameter_interface;
|
||||
ia_drc_uni_interface_ext_struct drc_uni_interface_ext;
|
||||
} ia_drc_interface_struct;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -30,139 +30,148 @@
|
|||
#include "impd_drc_parser_interface.h"
|
||||
|
||||
WORD32
|
||||
impd_drc_dec_interface_process(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_interface_struct* pstr_drc_interface,
|
||||
UWORD8* it_bit_buf,
|
||||
WORD32 num_bit_stream_bits,
|
||||
WORD32* num_bits_read)
|
||||
{
|
||||
WORD32 err = 0;
|
||||
impd_drc_dec_interface_process(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_interface_struct* pstr_drc_interface,
|
||||
UWORD8* it_bit_buf, WORD32 num_bit_stream_bits,
|
||||
WORD32* num_bits_read) {
|
||||
WORD32 err = 0;
|
||||
|
||||
if (it_bit_buff != NULL && num_bit_stream_bits) {
|
||||
it_bit_buff = impd_create_init_bit_buf(it_bit_buff, it_bit_buf, num_bit_stream_bits/8);
|
||||
if (it_bit_buff != NULL && num_bit_stream_bits) {
|
||||
it_bit_buff = impd_create_init_bit_buf(it_bit_buff, it_bit_buf,
|
||||
num_bit_stream_bits / 8);
|
||||
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
err = impd_unidrc_interface_read(it_bit_buff, pstr_drc_interface);
|
||||
if (err) return(err);
|
||||
err = impd_unidrc_interface_read(it_bit_buff, pstr_drc_interface);
|
||||
if (err) return (err);
|
||||
|
||||
*num_bits_read = (it_bit_buff->size ) - it_bit_buff->cnt_bits;
|
||||
|
||||
return err;
|
||||
*num_bits_read = (it_bit_buff->size) - it_bit_buff->cnt_bits;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
WORD32
|
||||
impd_drc_dec_interface_add_effect_type(ia_drc_interface_struct* pstr_drc_interface,
|
||||
WORD32 drc_effect_type,
|
||||
WORD32 target_loudness,
|
||||
WORD32 loud_norm)
|
||||
{
|
||||
WORD32 err = 0;
|
||||
WORD32 i = 0;
|
||||
impd_drc_dec_interface_add_effect_type(
|
||||
ia_drc_interface_struct* pstr_drc_interface, WORD32 drc_effect_type,
|
||||
WORD32 target_loudness, WORD32 loud_norm) {
|
||||
WORD32 err = 0;
|
||||
WORD32 i = 0;
|
||||
|
||||
if (pstr_drc_interface != NULL)
|
||||
{
|
||||
pstr_drc_interface->interface_signat_flag = 0;
|
||||
for(i=0;i<MAX_SIGNATURE_DATA_LENGTH_PLUS_ONE * 8;i++)
|
||||
pstr_drc_interface->drc_uni_interface_signature.interface_signat_data[i] = 0;
|
||||
if (pstr_drc_interface != NULL) {
|
||||
pstr_drc_interface->interface_signat_flag = 0;
|
||||
for (i = 0; i < MAX_SIGNATURE_DATA_LENGTH_PLUS_ONE * 8; i++)
|
||||
pstr_drc_interface->drc_uni_interface_signature.interface_signat_data[i] =
|
||||
0;
|
||||
|
||||
pstr_drc_interface->drc_uni_interface_signature.interface_signat_data_len = 0;
|
||||
|
||||
pstr_drc_interface->system_interface_flag = 1;
|
||||
|
||||
pstr_drc_interface->system_interface.target_config_request_type = 0;
|
||||
pstr_drc_interface->system_interface.num_downmix_id_requests = 0;
|
||||
for (i = 0; i < MAX_NUM_DOWNMIX_ID_REQUESTS; i++)
|
||||
{
|
||||
pstr_drc_interface->system_interface.requested_dwnmix_id[i] = 0;
|
||||
}
|
||||
pstr_drc_interface->system_interface.requested_target_layout = 0;
|
||||
pstr_drc_interface->system_interface.requested_target_ch_count = 0;
|
||||
|
||||
pstr_drc_interface->loudness_norm_ctrl_interface_flag= 1;
|
||||
if(loud_norm==1)
|
||||
{
|
||||
pstr_drc_interface->loudness_norm_ctrl_interface.loudness_normalization_on = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
pstr_drc_interface->loudness_norm_ctrl_interface.loudness_normalization_on = 0;
|
||||
}
|
||||
pstr_drc_interface->loudness_norm_ctrl_interface.target_loudness = (FLOAT32)target_loudness;
|
||||
|
||||
pstr_drc_interface->loudness_norm_parameter_interface_flag = 1;
|
||||
pstr_drc_interface->loudness_norm_param_interface.album_mode = 0;
|
||||
pstr_drc_interface->loudness_norm_param_interface.peak_limiter = 0;
|
||||
pstr_drc_interface->loudness_norm_param_interface.change_loudness_deviation_max = 1;
|
||||
pstr_drc_interface->loudness_norm_param_interface.loudness_deviation_max = 63;
|
||||
pstr_drc_interface->loudness_norm_param_interface.change_loudness_measur_method = 1;
|
||||
pstr_drc_interface->loudness_norm_param_interface.loudness_measurement_method = 1;
|
||||
pstr_drc_interface->loudness_norm_param_interface.change_loudness_measur_system = 1;
|
||||
pstr_drc_interface->loudness_norm_param_interface.loudness_measurement_system = 1;
|
||||
pstr_drc_interface->loudness_norm_param_interface.change_loudness_measur_pre_proc = 0;
|
||||
pstr_drc_interface->loudness_norm_param_interface.loudness_measurement_pre_proc = 0;
|
||||
pstr_drc_interface->loudness_norm_param_interface.change_device_cut_off_freq = 1;
|
||||
pstr_drc_interface->loudness_norm_param_interface.device_cut_off_frequency = 20;
|
||||
pstr_drc_interface->loudness_norm_param_interface.change_loudness_norm_gain_db_max = 1;
|
||||
pstr_drc_interface->loudness_norm_param_interface.loudness_norm_gain_db_max = 1000.0;
|
||||
pstr_drc_interface->loudness_norm_param_interface.change_loudness_norm_gain_modification_db = 1;
|
||||
pstr_drc_interface->loudness_norm_param_interface.loudness_norm_gain_modification_db = 0.0;
|
||||
pstr_drc_interface->loudness_norm_param_interface.change_output_peak_level_max = 1;
|
||||
pstr_drc_interface->loudness_norm_param_interface.output_peak_level_max = 0.0;
|
||||
|
||||
pstr_drc_interface->drc_interface_flag = 1;
|
||||
if(drc_effect_type==-1)
|
||||
{
|
||||
pstr_drc_interface->drc_ctrl_interface.dynamic_range_control_on=0;
|
||||
pstr_drc_interface->drc_ctrl_interface.requested_drc_effect_type[0][0] = 0;
|
||||
}
|
||||
else if(drc_effect_type==0)
|
||||
{
|
||||
pstr_drc_interface->drc_ctrl_interface.dynamic_range_control_on=1;
|
||||
pstr_drc_interface->drc_ctrl_interface.num_drc_feature_requests = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
pstr_drc_interface->drc_ctrl_interface.dynamic_range_control_on = 1;
|
||||
pstr_drc_interface->drc_ctrl_interface.requested_drc_effect_type[0][0] = drc_effect_type;
|
||||
pstr_drc_interface->drc_ctrl_interface.num_drc_feature_requests = 3;
|
||||
pstr_drc_interface->drc_ctrl_interface.drc_feature_req_type[0] = 0;
|
||||
pstr_drc_interface->drc_ctrl_interface.drc_feature_req_type[1] = 1;
|
||||
pstr_drc_interface->drc_ctrl_interface.drc_feature_req_type[2] = 2;
|
||||
pstr_drc_interface->drc_ctrl_interface.requested_num_drc_effects[0] = 1;
|
||||
pstr_drc_interface->drc_ctrl_interface.desired_num_drc_effects_of_requested[0] = 1;
|
||||
}
|
||||
|
||||
pstr_drc_interface->drc_ctrl_interface.requested_dyn_rng_measurement_type[0] = 0;
|
||||
pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_is_single_val_flag[0] = 0;
|
||||
pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_is_single_val_flag[1] = 0;
|
||||
pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_min_val[1] = 3.0f;
|
||||
pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_max_val[1] = 10.0f;
|
||||
pstr_drc_interface->drc_ctrl_interface.requested_drc_characteristic[2] = 3;
|
||||
|
||||
pstr_drc_interface->drc_parameter_interface_flag = 1;
|
||||
pstr_drc_interface->drc_parameter_interface.change_compress = 1;
|
||||
pstr_drc_interface->drc_parameter_interface.change_boost = 1;
|
||||
pstr_drc_interface->drc_parameter_interface.compress = 1.0f;
|
||||
pstr_drc_interface->drc_parameter_interface.boost = 1.0f;
|
||||
pstr_drc_interface->drc_parameter_interface.change_drc_characteristic_target = 1;
|
||||
pstr_drc_interface->drc_parameter_interface.drc_characteristic_target = 0;
|
||||
|
||||
|
||||
pstr_drc_interface->drc_uni_interface_ext_flag = 0;
|
||||
pstr_drc_interface->drc_uni_interface_signature.interface_signat_data_len =
|
||||
0;
|
||||
|
||||
pstr_drc_interface->system_interface_flag = 1;
|
||||
|
||||
pstr_drc_interface->system_interface.target_config_request_type = 0;
|
||||
pstr_drc_interface->system_interface.num_downmix_id_requests = 0;
|
||||
for (i = 0; i < MAX_NUM_DOWNMIX_ID_REQUESTS; i++) {
|
||||
pstr_drc_interface->system_interface.requested_dwnmix_id[i] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return UNEXPECTED_ERROR;
|
||||
pstr_drc_interface->system_interface.requested_target_layout = 0;
|
||||
pstr_drc_interface->system_interface.requested_target_ch_count = 0;
|
||||
|
||||
pstr_drc_interface->loudness_norm_ctrl_interface_flag = 1;
|
||||
if (loud_norm == 1) {
|
||||
pstr_drc_interface->loudness_norm_ctrl_interface
|
||||
.loudness_normalization_on = 1;
|
||||
} else {
|
||||
pstr_drc_interface->loudness_norm_ctrl_interface
|
||||
.loudness_normalization_on = 0;
|
||||
}
|
||||
pstr_drc_interface->loudness_norm_ctrl_interface.target_loudness =
|
||||
(FLOAT32)target_loudness;
|
||||
|
||||
pstr_drc_interface->loudness_norm_parameter_interface_flag = 1;
|
||||
pstr_drc_interface->loudness_norm_param_interface.album_mode = 0;
|
||||
pstr_drc_interface->loudness_norm_param_interface.peak_limiter = 0;
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.change_loudness_deviation_max = 1;
|
||||
pstr_drc_interface->loudness_norm_param_interface.loudness_deviation_max =
|
||||
63;
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.change_loudness_measur_method = 1;
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.loudness_measurement_method = 1;
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.change_loudness_measur_system = 1;
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.loudness_measurement_system = 1;
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.change_loudness_measur_pre_proc = 0;
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.loudness_measurement_pre_proc = 0;
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.change_device_cut_off_freq = 1;
|
||||
pstr_drc_interface->loudness_norm_param_interface.device_cut_off_frequency =
|
||||
20;
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.change_loudness_norm_gain_db_max = 1;
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.loudness_norm_gain_db_max = 1000.0;
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.change_loudness_norm_gain_modification_db = 1;
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.loudness_norm_gain_modification_db = 0.0;
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.change_output_peak_level_max = 1;
|
||||
pstr_drc_interface->loudness_norm_param_interface.output_peak_level_max =
|
||||
0.0;
|
||||
|
||||
pstr_drc_interface->drc_interface_flag = 1;
|
||||
if (drc_effect_type == -1) {
|
||||
pstr_drc_interface->drc_ctrl_interface.dynamic_range_control_on = 0;
|
||||
pstr_drc_interface->drc_ctrl_interface.requested_drc_effect_type[0][0] =
|
||||
0;
|
||||
} else if (drc_effect_type == 0) {
|
||||
pstr_drc_interface->drc_ctrl_interface.dynamic_range_control_on = 1;
|
||||
pstr_drc_interface->drc_ctrl_interface.num_drc_feature_requests = 0;
|
||||
} else {
|
||||
pstr_drc_interface->drc_ctrl_interface.dynamic_range_control_on = 1;
|
||||
pstr_drc_interface->drc_ctrl_interface.requested_drc_effect_type[0][0] =
|
||||
drc_effect_type;
|
||||
pstr_drc_interface->drc_ctrl_interface.num_drc_feature_requests = 3;
|
||||
pstr_drc_interface->drc_ctrl_interface.drc_feature_req_type[0] = 0;
|
||||
pstr_drc_interface->drc_ctrl_interface.drc_feature_req_type[1] = 1;
|
||||
pstr_drc_interface->drc_ctrl_interface.drc_feature_req_type[2] = 2;
|
||||
pstr_drc_interface->drc_ctrl_interface.requested_num_drc_effects[0] = 1;
|
||||
pstr_drc_interface->drc_ctrl_interface
|
||||
.desired_num_drc_effects_of_requested[0] = 1;
|
||||
}
|
||||
|
||||
pstr_drc_interface->drc_ctrl_interface
|
||||
.requested_dyn_rng_measurement_type[0] = 0;
|
||||
pstr_drc_interface->drc_ctrl_interface
|
||||
.requested_dyn_range_is_single_val_flag[0] = 0;
|
||||
pstr_drc_interface->drc_ctrl_interface
|
||||
.requested_dyn_range_is_single_val_flag[1] = 0;
|
||||
pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_min_val[1] =
|
||||
3.0f;
|
||||
pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_max_val[1] =
|
||||
10.0f;
|
||||
pstr_drc_interface->drc_ctrl_interface.requested_drc_characteristic[2] = 3;
|
||||
|
||||
return err;
|
||||
pstr_drc_interface->drc_parameter_interface_flag = 1;
|
||||
pstr_drc_interface->drc_parameter_interface.change_compress = 1;
|
||||
pstr_drc_interface->drc_parameter_interface.change_boost = 1;
|
||||
pstr_drc_interface->drc_parameter_interface.compress = 1.0f;
|
||||
pstr_drc_interface->drc_parameter_interface.boost = 1.0f;
|
||||
pstr_drc_interface->drc_parameter_interface
|
||||
.change_drc_characteristic_target = 1;
|
||||
pstr_drc_interface->drc_parameter_interface.drc_characteristic_target = 0;
|
||||
|
||||
pstr_drc_interface->drc_uni_interface_ext_flag = 0;
|
||||
|
||||
} else {
|
||||
return UNEXPECTED_ERROR;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,488 +28,487 @@
|
|||
#include "impd_drc_extr_delta_coded_info.h"
|
||||
#include "impd_drc_struct.h"
|
||||
|
||||
WORD32 impd_unidrc_interface_signature_read(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_uni_interface_signat_struct* drc_uni_interface_signature)
|
||||
{
|
||||
//WORD32 err = 0
|
||||
WORD32 interface_signat_data_len = 0, i, tmp;
|
||||
WORD32 impd_unidrc_interface_signature_read(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_uni_interface_signat_struct* drc_uni_interface_signature) {
|
||||
// WORD32 err = 0
|
||||
WORD32 interface_signat_data_len = 0, i, tmp;
|
||||
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 16);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 16);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
drc_uni_interface_signature->interface_signat_type = (tmp>>8)&0xff;
|
||||
drc_uni_interface_signature->interface_signat_data_len = tmp&0xff;
|
||||
drc_uni_interface_signature->interface_signat_type = (tmp >> 8) & 0xff;
|
||||
drc_uni_interface_signature->interface_signat_data_len = tmp & 0xff;
|
||||
|
||||
interface_signat_data_len = drc_uni_interface_signature->interface_signat_data_len + 1;
|
||||
for (i=0; i<interface_signat_data_len; i++) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
drc_uni_interface_signature->interface_signat_data[i] = (UWORD32)tmp;
|
||||
}
|
||||
interface_signat_data_len =
|
||||
drc_uni_interface_signature->interface_signat_data_len + 1;
|
||||
for (i = 0; i < interface_signat_data_len; i++) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
drc_uni_interface_signature->interface_signat_data[i] = (UWORD32)tmp;
|
||||
}
|
||||
|
||||
return(0);
|
||||
return (0);
|
||||
}
|
||||
WORD32 impd_sys_interface_read(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_system_interface_struct* system_interface)
|
||||
{
|
||||
//WORD32 err = 0;
|
||||
WORD32 i = 0, tmp = 0;
|
||||
ia_system_interface_struct* system_interface) {
|
||||
// WORD32 err = 0;
|
||||
WORD32 i = 0, tmp = 0;
|
||||
|
||||
system_interface->target_config_request_type = impd_read_bits_buf(it_bit_buff, 2);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
system_interface->target_config_request_type =
|
||||
impd_read_bits_buf(it_bit_buff, 2);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
switch (system_interface->target_config_request_type) {
|
||||
switch (system_interface->target_config_request_type) {
|
||||
case 0:
|
||||
system_interface->num_downmix_id_requests =
|
||||
impd_read_bits_buf(it_bit_buff, 4);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
if (system_interface->num_downmix_id_requests == 0) {
|
||||
system_interface->num_downmix_id_requests = 1;
|
||||
system_interface->requested_dwnmix_id[0] = 0;
|
||||
break;
|
||||
}
|
||||
for (i = 0; i < system_interface->num_downmix_id_requests; i++) {
|
||||
system_interface->requested_dwnmix_id[i] =
|
||||
impd_read_bits_buf(it_bit_buff, 7);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
system_interface->requested_target_layout =
|
||||
impd_read_bits_buf(it_bit_buff, 8);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
break;
|
||||
case 2:
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 7);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
system_interface->requested_target_ch_count = tmp + 1;
|
||||
break;
|
||||
default:
|
||||
return (1);
|
||||
break;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
WORD32 impd_loudness_norm_control_interface_read(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_loudness_norm_ctrl_interface_struct* loudness_norm_ctrl_interface) {
|
||||
// WORD32 err = 0;
|
||||
WORD32 tmp = 0;
|
||||
|
||||
loudness_norm_ctrl_interface->loudness_normalization_on =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
if (loudness_norm_ctrl_interface->loudness_normalization_on == 1) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 12);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
loudness_norm_ctrl_interface->target_loudness = -tmp * 0.03125f;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
WORD32 impd_loudness_norm_param_interface_read(
|
||||
ia_bit_buf_struct* it_bit_buff, ia_loudness_norm_parameter_interface_struct*
|
||||
loudness_norm_param_interface) {
|
||||
// WORD32 err = 0;
|
||||
WORD32 tmp = 0;
|
||||
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 3);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
loudness_norm_param_interface->album_mode = (tmp >> 2) & 1;
|
||||
loudness_norm_param_interface->peak_limiter = (tmp >> 1) & 1;
|
||||
loudness_norm_param_interface->change_loudness_deviation_max = tmp & 1;
|
||||
|
||||
if (loudness_norm_param_interface->change_loudness_deviation_max == 1) {
|
||||
loudness_norm_param_interface->loudness_deviation_max =
|
||||
impd_read_bits_buf(it_bit_buff, 6);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
}
|
||||
|
||||
loudness_norm_param_interface->change_loudness_measur_method =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (loudness_norm_param_interface->change_loudness_measur_method == 1) {
|
||||
loudness_norm_param_interface->loudness_measurement_method =
|
||||
impd_read_bits_buf(it_bit_buff, 3);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
}
|
||||
|
||||
loudness_norm_param_interface->change_loudness_measur_system =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (loudness_norm_param_interface->change_loudness_measur_system == 1) {
|
||||
loudness_norm_param_interface->loudness_measurement_system =
|
||||
impd_read_bits_buf(it_bit_buff, 4);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
}
|
||||
|
||||
loudness_norm_param_interface->change_loudness_measur_pre_proc =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (loudness_norm_param_interface->change_loudness_measur_pre_proc == 1) {
|
||||
loudness_norm_param_interface->loudness_measurement_pre_proc =
|
||||
impd_read_bits_buf(it_bit_buff, 2);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
}
|
||||
|
||||
loudness_norm_param_interface->change_device_cut_off_freq =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (loudness_norm_param_interface->change_device_cut_off_freq == 1) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 6);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
loudness_norm_param_interface->device_cut_off_frequency =
|
||||
max(min(tmp * 10, 500), 20);
|
||||
}
|
||||
|
||||
loudness_norm_param_interface->change_loudness_norm_gain_db_max =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (loudness_norm_param_interface->change_loudness_norm_gain_db_max == 1) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 6);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (tmp < 63) {
|
||||
loudness_norm_param_interface->loudness_norm_gain_db_max = tmp * 0.5f;
|
||||
} else {
|
||||
loudness_norm_param_interface->loudness_norm_gain_db_max =
|
||||
LOUDNESS_NORMALIZATION_GAIN_MAX_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
loudness_norm_param_interface->change_loudness_norm_gain_modification_db =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (loudness_norm_param_interface
|
||||
->change_loudness_norm_gain_modification_db == 1) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 10);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
loudness_norm_param_interface->loudness_norm_gain_modification_db =
|
||||
-16 + tmp * 0.03125f;
|
||||
}
|
||||
|
||||
loudness_norm_param_interface->change_output_peak_level_max =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (loudness_norm_param_interface->change_output_peak_level_max == 1) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 6);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
loudness_norm_param_interface->output_peak_level_max = tmp * 0.5f;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
WORD32 impd_drc_interface_read(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_dyn_rng_ctrl_interface_struct* drc_ctrl_interface) {
|
||||
// WORD32 err = 0;
|
||||
WORD32 i = 0, j = 0, tmp = 0;
|
||||
|
||||
drc_ctrl_interface->dynamic_range_control_on =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
if (drc_ctrl_interface->dynamic_range_control_on == 1) {
|
||||
drc_ctrl_interface->num_drc_feature_requests =
|
||||
impd_read_bits_buf(it_bit_buff, 3);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
for (i = 0; i < drc_ctrl_interface->num_drc_feature_requests; i++) {
|
||||
drc_ctrl_interface->drc_feature_req_type[i] =
|
||||
impd_read_bits_buf(it_bit_buff, 2);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
switch (drc_ctrl_interface->drc_feature_req_type[i]) {
|
||||
case 0:
|
||||
system_interface->num_downmix_id_requests = impd_read_bits_buf(it_bit_buff, 4);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
if (system_interface->num_downmix_id_requests == 0) {
|
||||
system_interface->num_downmix_id_requests = 1;
|
||||
system_interface->requested_dwnmix_id[0] = 0;
|
||||
break;
|
||||
}
|
||||
for (i=0; i<system_interface->num_downmix_id_requests; i++) {
|
||||
system_interface->requested_dwnmix_id[i] = impd_read_bits_buf(it_bit_buff, 7);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
}
|
||||
break;
|
||||
drc_ctrl_interface->requested_num_drc_effects[i] = (tmp >> 4) & 0xf;
|
||||
drc_ctrl_interface->desired_num_drc_effects_of_requested[i] =
|
||||
tmp & 0xf;
|
||||
|
||||
for (j = 0; j < drc_ctrl_interface->requested_num_drc_effects[i];
|
||||
j++) {
|
||||
drc_ctrl_interface->requested_drc_effect_type[i][j] =
|
||||
impd_read_bits_buf(it_bit_buff, 4);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
system_interface->requested_target_layout = impd_read_bits_buf(it_bit_buff, 8);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
break;
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 3);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
drc_ctrl_interface->requested_dyn_rng_measurement_type[i] =
|
||||
(tmp >> 1) & 3;
|
||||
drc_ctrl_interface->requested_dyn_range_is_single_val_flag[i] =
|
||||
tmp & 1;
|
||||
|
||||
if (drc_ctrl_interface->requested_dyn_range_is_single_val_flag[i] ==
|
||||
0) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (tmp == 0)
|
||||
drc_ctrl_interface->requested_dyn_range_value[i] = 0.0f;
|
||||
else if (tmp <= 128)
|
||||
drc_ctrl_interface->requested_dyn_range_value[i] = tmp * 0.25f;
|
||||
else if (tmp <= 204)
|
||||
drc_ctrl_interface->requested_dyn_range_value[i] =
|
||||
0.5f * tmp - 32.0f;
|
||||
else
|
||||
drc_ctrl_interface->requested_dyn_range_value[i] = tmp - 134.0f;
|
||||
} else {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (tmp == 0)
|
||||
drc_ctrl_interface->requested_dyn_range_min_val[i] = 0.0f;
|
||||
else if (tmp <= 128)
|
||||
drc_ctrl_interface->requested_dyn_range_min_val[i] = tmp * 0.25f;
|
||||
else if (tmp <= 204)
|
||||
drc_ctrl_interface->requested_dyn_range_min_val[i] =
|
||||
0.5f * tmp - 32.0f;
|
||||
else
|
||||
drc_ctrl_interface->requested_dyn_range_min_val[i] = tmp - 134.0f;
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (tmp == 0)
|
||||
drc_ctrl_interface->requested_dyn_range_max_val[i] = 0.0f;
|
||||
else if (tmp <= 128)
|
||||
drc_ctrl_interface->requested_dyn_range_max_val[i] = tmp * 0.25f;
|
||||
else if (tmp <= 204)
|
||||
drc_ctrl_interface->requested_dyn_range_max_val[i] =
|
||||
0.5f * tmp - 32.0f;
|
||||
else
|
||||
drc_ctrl_interface->requested_dyn_range_max_val[i] = tmp - 134.0f;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 7);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
system_interface->requested_target_ch_count = tmp + 1;
|
||||
break;
|
||||
drc_ctrl_interface->requested_drc_characteristic[i] =
|
||||
impd_read_bits_buf(it_bit_buff, 7);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
break;
|
||||
default:
|
||||
return(1);
|
||||
break;
|
||||
return (1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
WORD32 impd_loudness_norm_control_interface_read(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_loudness_norm_ctrl_interface_struct* loudness_norm_ctrl_interface)
|
||||
{
|
||||
//WORD32 err = 0;
|
||||
WORD32 tmp = 0;
|
||||
WORD32 impd_drc_param_interface_read(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_parameter_interface_struct* drc_parameter_interface) {
|
||||
// WORD32 err = 0;
|
||||
WORD32 tmp = 0;
|
||||
|
||||
loudness_norm_ctrl_interface->loudness_normalization_on = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 2);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
if (loudness_norm_ctrl_interface->loudness_normalization_on == 1) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 12);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
loudness_norm_ctrl_interface->target_loudness = - tmp * 0.03125f;
|
||||
drc_parameter_interface->change_compress = (tmp >> 1) & 1;
|
||||
drc_parameter_interface->change_boost = tmp & 1;
|
||||
|
||||
if (drc_parameter_interface->change_compress == 1) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (tmp < 255) {
|
||||
drc_parameter_interface->compress = 1 - tmp * 0.00390625f;
|
||||
} else {
|
||||
drc_parameter_interface->compress = 0.f;
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
if (drc_parameter_interface->change_boost == 1) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (tmp < 255) {
|
||||
drc_parameter_interface->boost = 1 - tmp * 0.00390625f;
|
||||
} else {
|
||||
drc_parameter_interface->boost = 0.f;
|
||||
}
|
||||
}
|
||||
|
||||
drc_parameter_interface->change_drc_characteristic_target =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
if (drc_parameter_interface->change_drc_characteristic_target == 1) {
|
||||
drc_parameter_interface->drc_characteristic_target =
|
||||
impd_read_bits_buf(it_bit_buff, 8);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
WORD32 impd_loudness_norm_param_interface_read(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_loudness_norm_parameter_interface_struct* loudness_norm_param_interface)
|
||||
{
|
||||
//WORD32 err = 0;
|
||||
WORD32 tmp = 0;
|
||||
static WORD32 impd_parse_loud_eq_param_interface(
|
||||
ia_bit_buf_struct* it_bit_buff, ia_loudness_eq_parameter_interface_struct*
|
||||
loudness_eq_parameter_interface) {
|
||||
// WORD32 err = 0;
|
||||
WORD32 bsSensitivity, bsPlaybackGain;
|
||||
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 3);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
|
||||
loudness_norm_param_interface->album_mode = (tmp>>2)&1;
|
||||
loudness_norm_param_interface->peak_limiter = (tmp>>1)&1;
|
||||
loudness_norm_param_interface->change_loudness_deviation_max = tmp&1;
|
||||
|
||||
if (loudness_norm_param_interface->change_loudness_deviation_max == 1) {
|
||||
loudness_norm_param_interface->loudness_deviation_max = impd_read_bits_buf(it_bit_buff, 6);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
}
|
||||
|
||||
loudness_norm_param_interface->change_loudness_measur_method = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (loudness_norm_param_interface->change_loudness_measur_method == 1) {
|
||||
loudness_norm_param_interface->loudness_measurement_method = impd_read_bits_buf(it_bit_buff, 3);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
}
|
||||
|
||||
loudness_norm_param_interface->change_loudness_measur_system = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (loudness_norm_param_interface->change_loudness_measur_system == 1) {
|
||||
loudness_norm_param_interface->loudness_measurement_system = impd_read_bits_buf(it_bit_buff, 4);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
}
|
||||
|
||||
loudness_norm_param_interface->change_loudness_measur_pre_proc = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (loudness_norm_param_interface->change_loudness_measur_pre_proc == 1) {
|
||||
loudness_norm_param_interface->loudness_measurement_pre_proc = impd_read_bits_buf(it_bit_buff, 2);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
}
|
||||
|
||||
loudness_norm_param_interface->change_device_cut_off_freq = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (loudness_norm_param_interface->change_device_cut_off_freq == 1) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 6);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
loudness_norm_param_interface->device_cut_off_frequency = max(min(tmp*10,500),20);
|
||||
}
|
||||
|
||||
loudness_norm_param_interface->change_loudness_norm_gain_db_max = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (loudness_norm_param_interface->change_loudness_norm_gain_db_max == 1) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 6);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (tmp<63) {
|
||||
loudness_norm_param_interface->loudness_norm_gain_db_max = tmp*0.5f;
|
||||
} else {
|
||||
loudness_norm_param_interface->loudness_norm_gain_db_max = LOUDNESS_NORMALIZATION_GAIN_MAX_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
loudness_norm_param_interface->change_loudness_norm_gain_modification_db = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (loudness_norm_param_interface->change_loudness_norm_gain_modification_db == 1) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 10);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
loudness_norm_param_interface->loudness_norm_gain_modification_db = -16+tmp*0.03125f;
|
||||
}
|
||||
|
||||
loudness_norm_param_interface->change_output_peak_level_max = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (loudness_norm_param_interface->change_output_peak_level_max == 1) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 6);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
loudness_norm_param_interface->output_peak_level_max = tmp*0.5f;
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
WORD32 impd_drc_interface_read(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_dyn_rng_ctrl_interface_struct* drc_ctrl_interface)
|
||||
{
|
||||
//WORD32 err = 0;
|
||||
WORD32 i = 0, j = 0, tmp = 0;
|
||||
|
||||
drc_ctrl_interface->dynamic_range_control_on = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
|
||||
if (drc_ctrl_interface->dynamic_range_control_on == 1) {
|
||||
drc_ctrl_interface->num_drc_feature_requests = impd_read_bits_buf(it_bit_buff, 3);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
|
||||
for (i=0; i<drc_ctrl_interface->num_drc_feature_requests; i++) {
|
||||
drc_ctrl_interface->drc_feature_req_type[i] = impd_read_bits_buf(it_bit_buff, 2);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
|
||||
switch (drc_ctrl_interface->drc_feature_req_type[i]) {
|
||||
case 0:
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
|
||||
drc_ctrl_interface->requested_num_drc_effects[i] = (tmp>>4)&0xf;
|
||||
drc_ctrl_interface->desired_num_drc_effects_of_requested[i] = tmp&0xf;
|
||||
|
||||
for (j=0; j<drc_ctrl_interface->requested_num_drc_effects[i]; j++)
|
||||
{
|
||||
drc_ctrl_interface->requested_drc_effect_type[i][j] = impd_read_bits_buf(it_bit_buff, 4);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 3);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
|
||||
drc_ctrl_interface->requested_dyn_rng_measurement_type[i] = (tmp>>1)&3;
|
||||
drc_ctrl_interface->requested_dyn_range_is_single_val_flag[i] = tmp&1;
|
||||
|
||||
if (drc_ctrl_interface->requested_dyn_range_is_single_val_flag[i] == 0) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (tmp == 0)
|
||||
drc_ctrl_interface->requested_dyn_range_value[i] = 0.0f;
|
||||
else if(tmp <= 128)
|
||||
drc_ctrl_interface->requested_dyn_range_value[i] = tmp * 0.25f;
|
||||
else if(tmp <= 204)
|
||||
drc_ctrl_interface->requested_dyn_range_value[i] = 0.5f * tmp - 32.0f;
|
||||
else
|
||||
drc_ctrl_interface->requested_dyn_range_value[i] = tmp - 134.0f;
|
||||
} else {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (tmp == 0)
|
||||
drc_ctrl_interface->requested_dyn_range_min_val[i] = 0.0f;
|
||||
else if(tmp <= 128)
|
||||
drc_ctrl_interface->requested_dyn_range_min_val[i] = tmp * 0.25f;
|
||||
else if(tmp <= 204)
|
||||
drc_ctrl_interface->requested_dyn_range_min_val[i] = 0.5f * tmp - 32.0f;
|
||||
else
|
||||
drc_ctrl_interface->requested_dyn_range_min_val[i] = tmp - 134.0f;
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (tmp == 0)
|
||||
drc_ctrl_interface->requested_dyn_range_max_val[i] = 0.0f;
|
||||
else if(tmp <= 128)
|
||||
drc_ctrl_interface->requested_dyn_range_max_val[i] = tmp * 0.25f;
|
||||
else if(tmp <= 204)
|
||||
drc_ctrl_interface->requested_dyn_range_max_val[i] = 0.5f * tmp - 32.0f;
|
||||
else
|
||||
drc_ctrl_interface->requested_dyn_range_max_val[i] = tmp - 134.0f;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
drc_ctrl_interface->requested_drc_characteristic[i] = impd_read_bits_buf(it_bit_buff, 7);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
break;
|
||||
default:
|
||||
return(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
WORD32 impd_drc_param_interface_read(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_parameter_interface_struct* drc_parameter_interface)
|
||||
{
|
||||
//WORD32 err = 0;
|
||||
WORD32 tmp = 0;
|
||||
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 2);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
|
||||
drc_parameter_interface->change_compress = (tmp>>1)&1;
|
||||
drc_parameter_interface->change_boost = tmp&1;
|
||||
|
||||
if (drc_parameter_interface->change_compress == 1) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (tmp<255) {
|
||||
drc_parameter_interface->compress = 1 - tmp * 0.00390625f;
|
||||
} else {
|
||||
drc_parameter_interface->compress = 0.f;
|
||||
}
|
||||
}
|
||||
|
||||
if (drc_parameter_interface->change_boost == 1) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (tmp<255) {
|
||||
drc_parameter_interface->boost = 1 - tmp * 0.00390625f;
|
||||
} else {
|
||||
drc_parameter_interface->boost = 0.f;
|
||||
}
|
||||
}
|
||||
|
||||
drc_parameter_interface->change_drc_characteristic_target = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
|
||||
if (drc_parameter_interface->change_drc_characteristic_target == 1) {
|
||||
drc_parameter_interface->drc_characteristic_target = impd_read_bits_buf(it_bit_buff, 8);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static WORD32 impd_parse_loud_eq_param_interface(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_loudness_eq_parameter_interface_struct* loudness_eq_parameter_interface)
|
||||
{
|
||||
//WORD32 err = 0;
|
||||
WORD32 bsSensitivity, bsPlaybackGain;
|
||||
|
||||
loudness_eq_parameter_interface->loudness_eq_request_flag = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (loudness_eq_parameter_interface->loudness_eq_request_flag) {
|
||||
loudness_eq_parameter_interface->loudness_eq_request = impd_read_bits_buf(it_bit_buff, 2);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
}
|
||||
loudness_eq_parameter_interface->sensitivity_flag = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (loudness_eq_parameter_interface->sensitivity_flag) {
|
||||
bsSensitivity = impd_read_bits_buf(it_bit_buff, 7);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
loudness_eq_parameter_interface->sensitivity = bsSensitivity + 23.0f;
|
||||
}
|
||||
loudness_eq_parameter_interface->playback_gain_flag = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (loudness_eq_parameter_interface->playback_gain_flag) {
|
||||
bsPlaybackGain = impd_read_bits_buf(it_bit_buff, 7);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
loudness_eq_parameter_interface->playback_gain = (FLOAT32) - bsPlaybackGain;
|
||||
}
|
||||
return (0);
|
||||
loudness_eq_parameter_interface->loudness_eq_request_flag =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (loudness_eq_parameter_interface->loudness_eq_request_flag) {
|
||||
loudness_eq_parameter_interface->loudness_eq_request =
|
||||
impd_read_bits_buf(it_bit_buff, 2);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
}
|
||||
loudness_eq_parameter_interface->sensitivity_flag =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (loudness_eq_parameter_interface->sensitivity_flag) {
|
||||
bsSensitivity = impd_read_bits_buf(it_bit_buff, 7);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
loudness_eq_parameter_interface->sensitivity = bsSensitivity + 23.0f;
|
||||
}
|
||||
loudness_eq_parameter_interface->playback_gain_flag =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (loudness_eq_parameter_interface->playback_gain_flag) {
|
||||
bsPlaybackGain = impd_read_bits_buf(it_bit_buff, 7);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
loudness_eq_parameter_interface->playback_gain = (FLOAT32)-bsPlaybackGain;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
WORD32
|
||||
impd_unidrc_interface_extension_read(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_interface_struct* impd_drc_uni_interface,
|
||||
ia_drc_uni_interface_ext_struct* drc_uni_interface_ext)
|
||||
{
|
||||
WORD32 err = 0, i = 0, tmp = 0, dummy;
|
||||
WORD32 uni_drc_interface_ext_type;
|
||||
ia_specific_interface_extension_struct* specific_interface_ext;
|
||||
impd_unidrc_interface_extension_read(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_interface_struct* impd_drc_uni_interface,
|
||||
ia_drc_uni_interface_ext_struct* drc_uni_interface_ext) {
|
||||
WORD32 err = 0, i = 0, tmp = 0, dummy;
|
||||
WORD32 uni_drc_interface_ext_type;
|
||||
ia_specific_interface_extension_struct* specific_interface_ext;
|
||||
|
||||
uni_drc_interface_ext_type = impd_read_bits_buf(it_bit_buff, 4);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
uni_drc_interface_ext_type = impd_read_bits_buf(it_bit_buff, 4);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
while (uni_drc_interface_ext_type != UNIDRCINTERFACEEXT_TERM) {
|
||||
specific_interface_ext = &(drc_uni_interface_ext->specific_interface_ext[i]);
|
||||
specific_interface_ext->uni_drc_interface_ext_type = uni_drc_interface_ext_type;
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 4);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
specific_interface_ext->ext_size_bits = tmp+4;
|
||||
while (uni_drc_interface_ext_type != UNIDRCINTERFACEEXT_TERM) {
|
||||
specific_interface_ext =
|
||||
&(drc_uni_interface_ext->specific_interface_ext[i]);
|
||||
specific_interface_ext->uni_drc_interface_ext_type =
|
||||
uni_drc_interface_ext_type;
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 4);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
specific_interface_ext->ext_size_bits = tmp + 4;
|
||||
|
||||
tmp = impd_read_bits_buf(it_bit_buff, specific_interface_ext->ext_size_bits);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
tmp =
|
||||
impd_read_bits_buf(it_bit_buff, specific_interface_ext->ext_size_bits);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
specific_interface_ext->ext_bit_size = tmp+1;
|
||||
specific_interface_ext->ext_bit_size = tmp + 1;
|
||||
|
||||
switch (uni_drc_interface_ext_type) {
|
||||
case UNIDRCINTERFACEEXT_EQ:
|
||||
impd_drc_uni_interface->drc_uni_interface_ext.loudness_eq_parameter_interface_flag = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (impd_drc_uni_interface->drc_uni_interface_ext.loudness_eq_parameter_interface_flag) {
|
||||
err = impd_parse_loud_eq_param_interface(it_bit_buff, &(impd_drc_uni_interface->drc_uni_interface_ext.loudness_eq_parameter_interface));
|
||||
if (err) return(err);
|
||||
}
|
||||
impd_drc_uni_interface->drc_uni_interface_ext.eq_ctrl_interface_flag = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (impd_drc_uni_interface->drc_uni_interface_ext.eq_ctrl_interface_flag) {
|
||||
impd_drc_uni_interface->drc_uni_interface_ext.eq_ctrl_interface.eq_set_purpose_request = impd_read_bits_buf(it_bit_buff, 16);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
dummy = impd_read_bits_buf(it_bit_buff, specific_interface_ext->ext_bit_size);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
break;
|
||||
switch (uni_drc_interface_ext_type) {
|
||||
case UNIDRCINTERFACEEXT_EQ:
|
||||
impd_drc_uni_interface->drc_uni_interface_ext
|
||||
.loudness_eq_parameter_interface_flag =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (impd_drc_uni_interface->drc_uni_interface_ext
|
||||
.loudness_eq_parameter_interface_flag) {
|
||||
err = impd_parse_loud_eq_param_interface(
|
||||
it_bit_buff, &(impd_drc_uni_interface->drc_uni_interface_ext
|
||||
.loudness_eq_parameter_interface));
|
||||
if (err) return (err);
|
||||
}
|
||||
|
||||
i++;
|
||||
if (i==EXT_COUNT_MAX)
|
||||
{
|
||||
return(1);
|
||||
impd_drc_uni_interface->drc_uni_interface_ext.eq_ctrl_interface_flag =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (impd_drc_uni_interface->drc_uni_interface_ext
|
||||
.eq_ctrl_interface_flag) {
|
||||
impd_drc_uni_interface->drc_uni_interface_ext.eq_ctrl_interface
|
||||
.eq_set_purpose_request = impd_read_bits_buf(it_bit_buff, 16);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
}
|
||||
uni_drc_interface_ext_type = impd_read_bits_buf(it_bit_buff, 4);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
break;
|
||||
default:
|
||||
dummy = impd_read_bits_buf(it_bit_buff,
|
||||
specific_interface_ext->ext_bit_size);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
break;
|
||||
}
|
||||
drc_uni_interface_ext->interface_ext_count = i;
|
||||
return(0);
|
||||
|
||||
i++;
|
||||
if (i == EXT_COUNT_MAX) {
|
||||
return (1);
|
||||
}
|
||||
uni_drc_interface_ext_type = impd_read_bits_buf(it_bit_buff, 4);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
}
|
||||
drc_uni_interface_ext->interface_ext_count = i;
|
||||
return (0);
|
||||
}
|
||||
WORD32 impd_unidrc_interface_read(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_interface_struct* uniDrcInterface)
|
||||
{
|
||||
WORD32 err = 0;
|
||||
ia_drc_interface_struct* uniDrcInterface) {
|
||||
WORD32 err = 0;
|
||||
|
||||
uniDrcInterface->interface_signat_flag = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (uniDrcInterface->interface_signat_flag == 1) {
|
||||
err = impd_unidrc_interface_signature_read(it_bit_buff, &(uniDrcInterface->drc_uni_interface_signature));
|
||||
if (err) return(err);
|
||||
}
|
||||
uniDrcInterface->interface_signat_flag = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (uniDrcInterface->interface_signat_flag == 1) {
|
||||
err = impd_unidrc_interface_signature_read(
|
||||
it_bit_buff, &(uniDrcInterface->drc_uni_interface_signature));
|
||||
if (err) return (err);
|
||||
}
|
||||
|
||||
uniDrcInterface->system_interface_flag = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (uniDrcInterface->system_interface_flag == 1) {
|
||||
err = impd_sys_interface_read(it_bit_buff, &(uniDrcInterface->system_interface));
|
||||
if (err) return(err);
|
||||
}
|
||||
uniDrcInterface->system_interface_flag = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (uniDrcInterface->system_interface_flag == 1) {
|
||||
err = impd_sys_interface_read(it_bit_buff,
|
||||
&(uniDrcInterface->system_interface));
|
||||
if (err) return (err);
|
||||
}
|
||||
|
||||
uniDrcInterface->loudness_norm_ctrl_interface_flag = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (uniDrcInterface->loudness_norm_ctrl_interface_flag == 1) {
|
||||
err = impd_loudness_norm_control_interface_read(it_bit_buff, &(uniDrcInterface->loudness_norm_ctrl_interface));
|
||||
if (err) return(err);
|
||||
}
|
||||
uniDrcInterface->loudness_norm_ctrl_interface_flag =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (uniDrcInterface->loudness_norm_ctrl_interface_flag == 1) {
|
||||
err = impd_loudness_norm_control_interface_read(
|
||||
it_bit_buff, &(uniDrcInterface->loudness_norm_ctrl_interface));
|
||||
if (err) return (err);
|
||||
}
|
||||
|
||||
uniDrcInterface->loudness_norm_parameter_interface_flag = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (uniDrcInterface->loudness_norm_parameter_interface_flag == 1) {
|
||||
err = impd_loudness_norm_param_interface_read(it_bit_buff, &(uniDrcInterface->loudness_norm_param_interface));
|
||||
if (err) return(err);
|
||||
}
|
||||
uniDrcInterface->loudness_norm_parameter_interface_flag =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (uniDrcInterface->loudness_norm_parameter_interface_flag == 1) {
|
||||
err = impd_loudness_norm_param_interface_read(
|
||||
it_bit_buff, &(uniDrcInterface->loudness_norm_param_interface));
|
||||
if (err) return (err);
|
||||
}
|
||||
|
||||
uniDrcInterface->drc_interface_flag = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (uniDrcInterface->drc_interface_flag == 1) {
|
||||
err = impd_drc_interface_read(it_bit_buff, &(uniDrcInterface->drc_ctrl_interface));
|
||||
if (err) return(err);
|
||||
}
|
||||
uniDrcInterface->drc_interface_flag = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (uniDrcInterface->drc_interface_flag == 1) {
|
||||
err = impd_drc_interface_read(it_bit_buff,
|
||||
&(uniDrcInterface->drc_ctrl_interface));
|
||||
if (err) return (err);
|
||||
}
|
||||
|
||||
uniDrcInterface->drc_parameter_interface_flag = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (uniDrcInterface->drc_parameter_interface_flag == 1) {
|
||||
err = impd_drc_param_interface_read(it_bit_buff, &(uniDrcInterface->drc_parameter_interface));
|
||||
if (err) return(err);
|
||||
}
|
||||
uniDrcInterface->drc_parameter_interface_flag =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (uniDrcInterface->drc_parameter_interface_flag == 1) {
|
||||
err = impd_drc_param_interface_read(
|
||||
it_bit_buff, &(uniDrcInterface->drc_parameter_interface));
|
||||
if (err) return (err);
|
||||
}
|
||||
|
||||
uniDrcInterface->drc_uni_interface_ext_flag = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if(it_bit_buff->error)
|
||||
return it_bit_buff->error;
|
||||
if (uniDrcInterface->drc_uni_interface_ext_flag == 1) {
|
||||
err = impd_unidrc_interface_extension_read(it_bit_buff, uniDrcInterface, &(uniDrcInterface->drc_uni_interface_ext));
|
||||
if (err) return(err);
|
||||
}
|
||||
uniDrcInterface->drc_uni_interface_ext_flag =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (uniDrcInterface->drc_uni_interface_ext_flag == 1) {
|
||||
err = impd_unidrc_interface_extension_read(
|
||||
it_bit_buff, uniDrcInterface,
|
||||
&(uniDrcInterface->drc_uni_interface_ext));
|
||||
if (err) return (err);
|
||||
}
|
||||
|
||||
return(0);
|
||||
return (0);
|
||||
}
|
||||
|
|
@ -34,158 +34,136 @@
|
|||
#include "impd_drc_uni_process_audio.h"
|
||||
#include "impd_drc_rom.h"
|
||||
|
||||
WORD32 impd_parametric_drc_instance_reset(
|
||||
WORD32 instance_idx, ia_parametric_drc_instance_params_struct*
|
||||
pstr_parametric_drc_instance_params) {
|
||||
WORD32 err = 0;
|
||||
|
||||
WORD32 impd_parametric_drc_instance_reset(WORD32 instance_idx,
|
||||
ia_parametric_drc_instance_params_struct* pstr_parametric_drc_instance_params)
|
||||
{
|
||||
WORD32 err = 0;
|
||||
if (pstr_parametric_drc_instance_params->parametric_drc_type ==
|
||||
PARAM_DRC_TYPE_FF) {
|
||||
ia_parametric_drc_type_ff_params_struct*
|
||||
pstr_parametric_ffwd_type_drc_params =
|
||||
&(pstr_parametric_drc_instance_params
|
||||
->str_parametric_drc_type_ff_params);
|
||||
err = impd_parametric_ffwd_type_drc_reset(
|
||||
pstr_parametric_ffwd_type_drc_params);
|
||||
if (err) return (err);
|
||||
|
||||
if (pstr_parametric_drc_instance_params->parametric_drc_type == PARAM_DRC_TYPE_FF)
|
||||
{
|
||||
} else {
|
||||
return (UNEXPECTED_ERROR);
|
||||
}
|
||||
|
||||
ia_parametric_drc_type_ff_params_struct* pstr_parametric_ffwd_type_drc_params = &(pstr_parametric_drc_instance_params->str_parametric_drc_type_ff_params);
|
||||
err = impd_parametric_ffwd_type_drc_reset(pstr_parametric_ffwd_type_drc_params);
|
||||
if (err)
|
||||
return (err);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return (UNEXPECTED_ERROR);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
WORD32 impd_add_drc_band_audio(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||
const WORD32 drc_instructions_index,
|
||||
ia_drc_params_struct* ia_drc_params_struct,
|
||||
ia_audio_band_buffer_struct* audio_band_buffer,
|
||||
FLOAT32* audio_io_buf[])
|
||||
{
|
||||
WORD32 g, b, i, c;
|
||||
FLOAT32 sum;
|
||||
WORD32 signalIndex = 0;
|
||||
FLOAT32** drcBandAudio;
|
||||
FLOAT32** channel_audio;
|
||||
ia_drc_instructions_struct* str_drc_instruction_str;
|
||||
WORD32 impd_add_drc_band_audio(
|
||||
ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||
const WORD32 drc_instructions_index,
|
||||
ia_drc_params_struct* ia_drc_params_struct,
|
||||
ia_audio_band_buffer_struct* audio_band_buffer, FLOAT32* audio_io_buf[]) {
|
||||
WORD32 g, b, i, c;
|
||||
FLOAT32 sum;
|
||||
WORD32 signalIndex = 0;
|
||||
FLOAT32** drcBandAudio;
|
||||
FLOAT32** channel_audio;
|
||||
ia_drc_instructions_struct* str_drc_instruction_str;
|
||||
|
||||
drcBandAudio = audio_band_buffer->non_interleaved_audio;
|
||||
channel_audio = audio_io_buf;
|
||||
drcBandAudio = audio_band_buffer->non_interleaved_audio;
|
||||
channel_audio = audio_io_buf;
|
||||
|
||||
if (drc_instructions_index >= 0) {
|
||||
str_drc_instruction_str = &(pstr_drc_instruction_arr[drc_instructions_index]);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
if (drc_instructions_index >= 0) {
|
||||
str_drc_instruction_str =
|
||||
&(pstr_drc_instruction_arr[drc_instructions_index]);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (str_drc_instruction_str->drc_set_id > 0) {
|
||||
for (c = 0; c < str_drc_instruction_str->audio_num_chan; c++)
|
||||
|
||||
if (str_drc_instruction_str->drc_set_id > 0)
|
||||
{
|
||||
g = str_drc_instruction_str->channel_group_of_ch[c];
|
||||
if (g >= 0) {
|
||||
for (i = 0; i < ia_drc_params_struct->drc_frame_size; i++) {
|
||||
sum = 0.0f;
|
||||
for (b = 0; b < str_drc_instruction_str->band_count_of_ch_group[g];
|
||||
b++) {
|
||||
sum += drcBandAudio[signalIndex + b][i];
|
||||
}
|
||||
|
||||
for (c=0; c<str_drc_instruction_str->audio_num_chan; c++)
|
||||
|
||||
{
|
||||
g = str_drc_instruction_str->channel_group_of_ch[c];
|
||||
if (g>=0)
|
||||
{
|
||||
for (i=0; i<ia_drc_params_struct->drc_frame_size; i++)
|
||||
{
|
||||
sum = 0.0f;
|
||||
for (b=0; b<str_drc_instruction_str->band_count_of_ch_group[g]; b++)
|
||||
{
|
||||
sum += drcBandAudio[signalIndex+b][i];
|
||||
}
|
||||
|
||||
channel_audio[c][i] = sum;
|
||||
|
||||
}
|
||||
signalIndex += str_drc_instruction_str->band_count_of_ch_group[g];
|
||||
}
|
||||
else
|
||||
{
|
||||
signalIndex++;
|
||||
}
|
||||
channel_audio[c][i] = sum;
|
||||
}
|
||||
signalIndex += str_drc_instruction_str->band_count_of_ch_group[g];
|
||||
} else {
|
||||
signalIndex++;
|
||||
}
|
||||
}
|
||||
else
|
||||
} else {
|
||||
for (c = 0; c < str_drc_instruction_str->audio_num_chan; c++)
|
||||
|
||||
{
|
||||
for (c=0; c<str_drc_instruction_str->audio_num_chan; c++)
|
||||
|
||||
{
|
||||
for (i=0; i<ia_drc_params_struct->drc_frame_size; i++)
|
||||
{
|
||||
channel_audio[c][i] = drcBandAudio[c][i];
|
||||
}
|
||||
}
|
||||
for (i = 0; i < ia_drc_params_struct->drc_frame_size; i++) {
|
||||
channel_audio[c][i] = drcBandAudio[c][i];
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
WORD32 removeTables(void)
|
||||
{
|
||||
WORD32 removeTables(void) { return (0); }
|
||||
|
||||
return(0);
|
||||
const ia_slope_code_table_struct* impd_get_slope_code_tbl_by_value(void) {
|
||||
return (&(slopeCodeTableEntryByValue[0]));
|
||||
}
|
||||
|
||||
const ia_slope_code_table_struct*
|
||||
impd_get_slope_code_tbl_by_value(void)
|
||||
{
|
||||
return(&(slopeCodeTableEntryByValue[0]));
|
||||
FLOAT32 impd_decode_slope_idx(const WORD32 slopeCodeIndex) {
|
||||
const ia_slope_code_table_struct* slopeCodeTable =
|
||||
impd_get_slope_code_tbl_by_value();
|
||||
return slopeCodeTable[slopeCodeIndex].value;
|
||||
}
|
||||
|
||||
FLOAT32 impd_decode_slope_idx(const WORD32 slopeCodeIndex)
|
||||
{
|
||||
const ia_slope_code_table_struct* slopeCodeTable = impd_get_slope_code_tbl_by_value();
|
||||
return slopeCodeTable[slopeCodeIndex].value;
|
||||
FLOAT32 impd_decode_slope_idx_magnitude(const WORD32 slopeCodeIndex) {
|
||||
const ia_slope_code_table_struct* slopeCodeTable =
|
||||
impd_get_slope_code_tbl_by_value();
|
||||
return (FLOAT32)fabs((FLOAT64)slopeCodeTable[slopeCodeIndex].value);
|
||||
}
|
||||
|
||||
FLOAT32 impd_decode_slope_idx_magnitude(const WORD32 slopeCodeIndex)
|
||||
{
|
||||
const ia_slope_code_table_struct* slopeCodeTable = impd_get_slope_code_tbl_by_value();
|
||||
return (FLOAT32)fabs((FLOAT64)slopeCodeTable[slopeCodeIndex].value);
|
||||
}
|
||||
|
||||
|
||||
WORD32 impd_get_multi_band_drc_present(ia_drc_config* pstr_drc_config,
|
||||
WORD32 numSets[3],
|
||||
WORD32 multiBandDrcPresent[3])
|
||||
{
|
||||
WORD32 err=0, k, m;
|
||||
for(k=0; k<pstr_drc_config->drc_instructions_uni_drc_count; k++)
|
||||
{
|
||||
if ((pstr_drc_config->str_drc_instruction_str[k].downmix_id[0] == ID_FOR_BASE_LAYOUT) || (pstr_drc_config->str_drc_instruction_str[k].drc_apply_to_dwnmix == 0))
|
||||
{
|
||||
numSets[0]++;
|
||||
}
|
||||
else if (pstr_drc_config->str_drc_instruction_str[k].downmix_id[0] == ID_FOR_ANY_DOWNMIX)
|
||||
{
|
||||
numSets[1]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
numSets[2]++;
|
||||
}
|
||||
for (m=0; m<pstr_drc_config->str_drc_instruction_str[k].num_drc_ch_groups; m++)
|
||||
{
|
||||
if (pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_params[pstr_drc_config->str_drc_instruction_str->gain_set_index_for_channel_group[m]].band_count > 1)
|
||||
{
|
||||
if ((pstr_drc_config->str_drc_instruction_str[k].downmix_id[0] == ID_FOR_BASE_LAYOUT) || (pstr_drc_config->str_drc_instruction_str[k].drc_apply_to_dwnmix == 0))
|
||||
{
|
||||
multiBandDrcPresent[0] = 1;
|
||||
}
|
||||
else if (pstr_drc_config->str_drc_instruction_str[k].downmix_id[0] == ID_FOR_ANY_DOWNMIX)
|
||||
{
|
||||
multiBandDrcPresent[1] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
multiBandDrcPresent[2] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
WORD32 numSets[3],
|
||||
WORD32 multiBandDrcPresent[3]) {
|
||||
WORD32 err = 0, k, m;
|
||||
for (k = 0; k < pstr_drc_config->drc_instructions_uni_drc_count; k++) {
|
||||
if ((pstr_drc_config->str_drc_instruction_str[k].downmix_id[0] ==
|
||||
ID_FOR_BASE_LAYOUT) ||
|
||||
(pstr_drc_config->str_drc_instruction_str[k].drc_apply_to_dwnmix ==
|
||||
0)) {
|
||||
numSets[0]++;
|
||||
} else if (pstr_drc_config->str_drc_instruction_str[k].downmix_id[0] ==
|
||||
ID_FOR_ANY_DOWNMIX) {
|
||||
numSets[1]++;
|
||||
} else {
|
||||
numSets[2]++;
|
||||
}
|
||||
return err;
|
||||
for (m = 0;
|
||||
m < pstr_drc_config->str_drc_instruction_str[k].num_drc_ch_groups;
|
||||
m++) {
|
||||
if (pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0]
|
||||
.gain_set_params[pstr_drc_config->str_drc_instruction_str
|
||||
->gain_set_index_for_channel_group[m]]
|
||||
.band_count > 1) {
|
||||
if ((pstr_drc_config->str_drc_instruction_str[k].downmix_id[0] ==
|
||||
ID_FOR_BASE_LAYOUT) ||
|
||||
(pstr_drc_config->str_drc_instruction_str[k].drc_apply_to_dwnmix ==
|
||||
0)) {
|
||||
multiBandDrcPresent[0] = 1;
|
||||
} else if (pstr_drc_config->str_drc_instruction_str[k].downmix_id[0] ==
|
||||
ID_FOR_ANY_DOWNMIX) {
|
||||
multiBandDrcPresent[1] = 1;
|
||||
} else {
|
||||
multiBandDrcPresent[2] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -25,80 +25,68 @@ extern "C" {
|
|||
#endif /* __cplusplus */
|
||||
|
||||
WORD32
|
||||
impd_mixing_level_info(ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
WORD32 requested_dwnmix_id,
|
||||
WORD32 drc_set_id_requested,
|
||||
WORD32 eq_set_id_requested,
|
||||
FLOAT32* mixing_level);
|
||||
impd_mixing_level_info(
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
WORD32 requested_dwnmix_id, WORD32 drc_set_id_requested,
|
||||
WORD32 eq_set_id_requested, FLOAT32* mixing_level);
|
||||
WORD32
|
||||
impd_signal_peak_level_info(ia_drc_config* pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||
WORD32 requested_dwnmix_id,
|
||||
WORD32 album_mode,
|
||||
WORD32 num_compression_eq_count,
|
||||
WORD32* num_compression_eq_id,
|
||||
WORD32* peak_info_count,
|
||||
WORD32 eq_set_id[],
|
||||
FLOAT32 signal_peak_level[],
|
||||
WORD32 explicit_peak_information_present[]);
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||
WORD32 requested_dwnmix_id, WORD32 album_mode,
|
||||
WORD32 num_compression_eq_count,
|
||||
WORD32* num_compression_eq_id,
|
||||
WORD32* peak_info_count, WORD32 eq_set_id[],
|
||||
FLOAT32 signal_peak_level[],
|
||||
WORD32 explicit_peak_information_present[]);
|
||||
|
||||
WORD32
|
||||
impd_extract_loudness_peak_to_average_info(ia_loudness_info_struct* loudness_info,
|
||||
WORD32 dyn_range_measurement_type,
|
||||
WORD32 * loudness_peak_2_avg_value_present,
|
||||
FLOAT32* loudness_peak_2_avg_value);
|
||||
impd_extract_loudness_peak_to_average_info(
|
||||
ia_loudness_info_struct* loudness_info, WORD32 dyn_range_measurement_type,
|
||||
WORD32* loudness_peak_2_avg_value_present,
|
||||
FLOAT32* loudness_peak_2_avg_value);
|
||||
|
||||
WORD32
|
||||
impd_loudness_peak_to_average_info(
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||
WORD32 requested_dwnmix_id,
|
||||
WORD32 dyn_range_measurement_type,
|
||||
WORD32 album_mode,
|
||||
WORD32* loudness_peak_2_avg_value_present,
|
||||
FLOAT32* loudness_peak_2_avg_value);
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||
WORD32 requested_dwnmix_id, WORD32 dyn_range_measurement_type,
|
||||
WORD32 album_mode, WORD32* loudness_peak_2_avg_value_present,
|
||||
FLOAT32* loudness_peak_2_avg_value);
|
||||
|
||||
WORD32
|
||||
impd_overall_loudness_present( ia_loudness_info_struct* loudness_info,
|
||||
impd_overall_loudness_present(ia_loudness_info_struct* loudness_info,
|
||||
WORD32* loudness_info_present);
|
||||
|
||||
WORD32
|
||||
impd_find_overall_loudness_info(ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
WORD32 requested_dwnmix_id,
|
||||
WORD32 drc_set_id_requested,
|
||||
WORD32* overall_loudness_info_present,
|
||||
WORD32* loudness_info_count,
|
||||
ia_loudness_info_struct* loudness_info[]);
|
||||
impd_find_overall_loudness_info(
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
WORD32 requested_dwnmix_id, WORD32 drc_set_id_requested,
|
||||
WORD32* overall_loudness_info_present, WORD32* loudness_info_count,
|
||||
ia_loudness_info_struct* loudness_info[]);
|
||||
|
||||
WORD32
|
||||
impd_high_pass_loudness_adjust_info( ia_loudness_info_struct* loudness_info,
|
||||
WORD32* loudness_hp_adjust_present,
|
||||
FLOAT32* loudness_hp_adjust);
|
||||
impd_high_pass_loudness_adjust_info(ia_loudness_info_struct* loudness_info,
|
||||
WORD32* loudness_hp_adjust_present,
|
||||
FLOAT32* loudness_hp_adjust);
|
||||
|
||||
WORD32
|
||||
impd_find_high_pass_loudness_adjust(
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
WORD32 requested_dwnmix_id,
|
||||
WORD32 drc_set_id_requested,
|
||||
WORD32 album_mode,
|
||||
FLOAT32 device_cutoff_freq,
|
||||
WORD32* loudness_hp_adjust_present,
|
||||
FLOAT32* loudness_hp_adjust);
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
WORD32 requested_dwnmix_id, WORD32 drc_set_id_requested, WORD32 album_mode,
|
||||
FLOAT32 device_cutoff_freq, WORD32* loudness_hp_adjust_present,
|
||||
FLOAT32* loudness_hp_adjust);
|
||||
|
||||
WORD32
|
||||
impd_init_loudness_control (ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
WORD32 requested_dwnmix_id,
|
||||
WORD32 drc_set_id_requested,
|
||||
WORD32 num_compression_eq_count,
|
||||
WORD32* num_compression_eq_id,
|
||||
WORD32* loudness_info_count,
|
||||
WORD32 eq_set_id[],
|
||||
FLOAT32 loudness_normalization_gain_db[],
|
||||
FLOAT32 loudness[]);
|
||||
impd_init_loudness_control(
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
WORD32 requested_dwnmix_id, WORD32 drc_set_id_requested,
|
||||
WORD32 num_compression_eq_count, WORD32* num_compression_eq_id,
|
||||
WORD32* loudness_info_count, WORD32 eq_set_id[],
|
||||
FLOAT32 loudness_normalization_gain_db[], FLOAT32 loudness[]);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,197 +41,214 @@
|
|||
|
||||
#define BITSTREAM_FILE_FORMAT_SPLIT 1
|
||||
|
||||
static WORD32 impd_down_mix ( ia_drc_sel_proc_output_struct *uni_drc_sel_proc_output, FLOAT32** input_audio, WORD32 frame_len)
|
||||
{
|
||||
WORD32 num_base_ch = uni_drc_sel_proc_output->base_channel_count;
|
||||
WORD32 num_target_ch = uni_drc_sel_proc_output->target_channel_count;
|
||||
WORD32 i, i_ch, o_ch;
|
||||
FLOAT32 tmp_out[MAX_CHANNEL_COUNT];
|
||||
static WORD32 impd_down_mix(
|
||||
ia_drc_sel_proc_output_struct *uni_drc_sel_proc_output,
|
||||
FLOAT32 **input_audio, WORD32 frame_len) {
|
||||
WORD32 num_base_ch = uni_drc_sel_proc_output->base_channel_count;
|
||||
WORD32 num_target_ch = uni_drc_sel_proc_output->target_channel_count;
|
||||
WORD32 i, i_ch, o_ch;
|
||||
FLOAT32 tmp_out[MAX_CHANNEL_COUNT];
|
||||
|
||||
if (uni_drc_sel_proc_output->downmix_matrix_present == 0)
|
||||
return 0;
|
||||
if (uni_drc_sel_proc_output->downmix_matrix_present == 0) return 0;
|
||||
|
||||
if (input_audio == 0)
|
||||
return 0;
|
||||
if (input_audio == 0) return 0;
|
||||
|
||||
if (num_target_ch > MAX_CHANNEL_COUNT)
|
||||
return -1;
|
||||
if (num_target_ch > MAX_CHANNEL_COUNT) return -1;
|
||||
|
||||
if (num_target_ch > num_base_ch)
|
||||
return -1;
|
||||
if (num_target_ch > num_base_ch) return -1;
|
||||
|
||||
for (i=0; i<frame_len; i++) {
|
||||
for (o_ch=0; o_ch<num_target_ch; o_ch++)
|
||||
{
|
||||
tmp_out[o_ch] = 0.0f;
|
||||
for (i_ch=0; i_ch<num_base_ch; i_ch++)
|
||||
{
|
||||
tmp_out[o_ch] += input_audio[i_ch][i] * uni_drc_sel_proc_output->downmix_matrix[i_ch][o_ch];
|
||||
}
|
||||
}
|
||||
for (o_ch=0; o_ch<num_target_ch; o_ch++) {
|
||||
input_audio[o_ch][i] = tmp_out[o_ch];
|
||||
}
|
||||
for ( ; o_ch<num_base_ch; o_ch++) {
|
||||
input_audio[o_ch][i] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
WORD32 impd_init_process_audio_main_qmf (ia_drc_api_struct *p_obj_drc)
|
||||
|
||||
{
|
||||
WORD32 error=0, i, j, num_samples_per_channel;
|
||||
FLOAT32 *input_buffer;
|
||||
FLOAT32 *output_buffer;
|
||||
FLOAT32 *audio_io_buf_real[10];
|
||||
FLOAT32 *audio_io_buf_imag[10];
|
||||
FLOAT32 *scratch_buffer;
|
||||
WORD32 last_frame=0;
|
||||
scratch_buffer= (FLOAT32*)p_obj_drc->pp_mem[1];
|
||||
input_buffer = (FLOAT32*)p_obj_drc->pp_mem[2];
|
||||
output_buffer = (FLOAT32*)p_obj_drc->pp_mem[3];
|
||||
|
||||
if(p_obj_drc->p_state->ui_in_bytes<=0)
|
||||
{
|
||||
p_obj_drc->p_state->ui_out_bytes=0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if((p_obj_drc->p_state->ui_in_bytes/p_obj_drc->str_config.num_ch_in/(p_obj_drc->str_config.pcm_size>>3)) < (UWORD32)p_obj_drc->str_config.frame_size)
|
||||
last_frame=1;
|
||||
for(i=0;i<p_obj_drc->str_config.num_ch_in;i++){
|
||||
audio_io_buf_real[i]=scratch_buffer+i*(p_obj_drc->str_config.frame_size+32);
|
||||
audio_io_buf_imag[i]=scratch_buffer+p_obj_drc->str_config.num_ch_in*p_obj_drc->str_config.frame_size+p_obj_drc->str_config.num_ch_in*64+i*(p_obj_drc->str_config.frame_size+64);
|
||||
for(j=0;j<p_obj_drc->str_config.frame_size;j++){
|
||||
audio_io_buf_real[i][j]=input_buffer[j*p_obj_drc->str_config.num_ch_in + i];
|
||||
audio_io_buf_imag[i][j]=input_buffer[p_obj_drc->str_config.num_ch_in*p_obj_drc->str_config.frame_size+j*p_obj_drc->str_config.num_ch_in + i];
|
||||
for (i = 0; i < frame_len; i++) {
|
||||
for (o_ch = 0; o_ch < num_target_ch; o_ch++) {
|
||||
tmp_out[o_ch] = 0.0f;
|
||||
for (i_ch = 0; i_ch < num_base_ch; i_ch++) {
|
||||
tmp_out[o_ch] += input_audio[i_ch][i] *
|
||||
uni_drc_sel_proc_output->downmix_matrix[i_ch][o_ch];
|
||||
}
|
||||
}
|
||||
|
||||
error = impd_process_drc_bitstream_dec_gain(p_obj_drc->str_payload.pstr_bitstream_dec,
|
||||
p_obj_drc->pstr_bit_buf,
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain,
|
||||
&p_obj_drc->str_bit_handler.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||
|
||||
|
||||
|
||||
if (error > PROC_COMPLETE) return -1;
|
||||
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||
p_obj_drc->str_bit_handler.byte_index_bs += p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
if(p_obj_drc->str_bit_handler.gain_stream_flag==0) //ITTIAM: Flag for applying gain frame by frame
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs -= p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
for (o_ch = 0; o_ch < num_target_ch; o_ch++) {
|
||||
input_audio[o_ch][i] = tmp_out[o_ch];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (p_obj_drc->str_config.bitstream_file_format == BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||
if (p_obj_drc->str_bit_handler.num_bits_offset_bs != 0)
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bits_read_bs = p_obj_drc->str_bit_handler.num_bits_read_bs + 8 - p_obj_drc->str_bit_handler.num_bits_offset_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs = p_obj_drc->str_bit_handler.num_bytes_read_bs + 1;
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = 0;
|
||||
p_obj_drc->str_bit_handler.byte_index_bs = p_obj_drc->str_bit_handler.byte_index_bs + 1;
|
||||
if(p_obj_drc->str_bit_handler.gain_stream_flag==0) //ITTIAM: Flag for applying gain frame by frame
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs = p_obj_drc->str_bit_handler.num_bytes_bs - 1;
|
||||
}
|
||||
}
|
||||
for (; o_ch < num_base_ch; o_ch++) {
|
||||
input_audio[o_ch][i] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
error = impd_drc_process_freq_domain(p_obj_drc->str_payload.pstr_gain_dec[0],
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain,
|
||||
audio_io_buf_real,
|
||||
audio_io_buf_imag,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->drc_characteristic_target);
|
||||
if (error) return -1;
|
||||
|
||||
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||
audio_io_buf_real,
|
||||
p_obj_drc->str_config.frame_size);
|
||||
if (error) return -1;
|
||||
|
||||
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||
audio_io_buf_imag,
|
||||
p_obj_drc->str_config.frame_size);
|
||||
if (error) return -1;
|
||||
|
||||
error = impd_drc_process_freq_domain(p_obj_drc->str_payload.pstr_gain_dec[1],
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain,
|
||||
audio_io_buf_real,
|
||||
audio_io_buf_imag,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->drc_characteristic_target);
|
||||
if (error) return -1;
|
||||
|
||||
if (p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db != 0.0f)
|
||||
{
|
||||
FLOAT32 loudness_normalization_gain = (FLOAT32)pow(10.0,p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db/20.0);
|
||||
for (i=0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j=0; j <p_obj_drc->str_config. frame_size; j++) {
|
||||
audio_io_buf_real[i][j] *= loudness_normalization_gain;
|
||||
audio_io_buf_imag[i][j] *= loudness_normalization_gain;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
num_samples_per_channel = p_obj_drc->str_config.frame_size;
|
||||
|
||||
for (i=0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j=0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
output_buffer[j*p_obj_drc->str_config.num_ch_out + i] = audio_io_buf_real[i][j];
|
||||
output_buffer[p_obj_drc->str_config.frame_size*p_obj_drc->str_config.num_ch_in+j*p_obj_drc->str_config.num_ch_out + i] = audio_io_buf_imag[i][j];
|
||||
|
||||
}
|
||||
}
|
||||
p_obj_drc->p_state->ui_out_bytes=p_obj_drc->str_config.num_ch_out*(p_obj_drc->str_config.frame_size)*4;
|
||||
p_obj_drc->p_state->ui_out_bytes=p_obj_drc->str_config.num_ch_out*(p_obj_drc->p_state->ui_in_bytes/p_obj_drc->str_config.num_ch_in);
|
||||
|
||||
if(last_frame==0){
|
||||
|
||||
if (p_obj_drc->str_config.bitstream_file_format != BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||
error = impd_process_drc_bitstream_dec(p_obj_drc->str_payload.pstr_bitstream_dec,
|
||||
p_obj_drc->pstr_bit_buf,
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_loudness_info,
|
||||
&p_obj_drc->str_bit_handler.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||
|
||||
if (error > PROC_COMPLETE)
|
||||
return -1;
|
||||
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||
p_obj_drc->str_bit_handler.byte_index_bs += p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs -= p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return error;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
WORD32 impd_init_process_audio_main_qmf(ia_drc_api_struct *p_obj_drc)
|
||||
|
||||
{
|
||||
WORD32 error = 0, i, j, num_samples_per_channel;
|
||||
FLOAT32 *input_buffer;
|
||||
FLOAT32 *output_buffer;
|
||||
FLOAT32 *audio_io_buf_real[10];
|
||||
FLOAT32 *audio_io_buf_imag[10];
|
||||
FLOAT32 *scratch_buffer;
|
||||
WORD32 last_frame = 0;
|
||||
scratch_buffer = (FLOAT32 *)p_obj_drc->pp_mem[1];
|
||||
input_buffer = (FLOAT32 *)p_obj_drc->pp_mem[2];
|
||||
output_buffer = (FLOAT32 *)p_obj_drc->pp_mem[3];
|
||||
|
||||
if (p_obj_drc->p_state->ui_in_bytes <= 0) {
|
||||
p_obj_drc->p_state->ui_out_bytes = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((p_obj_drc->p_state->ui_in_bytes / p_obj_drc->str_config.num_ch_in /
|
||||
(p_obj_drc->str_config.pcm_size >> 3)) <
|
||||
(UWORD32)p_obj_drc->str_config.frame_size)
|
||||
last_frame = 1;
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_in; i++) {
|
||||
audio_io_buf_real[i] =
|
||||
scratch_buffer + i * (p_obj_drc->str_config.frame_size + 32);
|
||||
audio_io_buf_imag[i] =
|
||||
scratch_buffer +
|
||||
p_obj_drc->str_config.num_ch_in * p_obj_drc->str_config.frame_size +
|
||||
p_obj_drc->str_config.num_ch_in * 64 +
|
||||
i * (p_obj_drc->str_config.frame_size + 64);
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
audio_io_buf_real[i][j] =
|
||||
input_buffer[j * p_obj_drc->str_config.num_ch_in + i];
|
||||
audio_io_buf_imag[i][j] =
|
||||
input_buffer[p_obj_drc->str_config.num_ch_in *
|
||||
p_obj_drc->str_config.frame_size +
|
||||
j * p_obj_drc->str_config.num_ch_in + i];
|
||||
}
|
||||
}
|
||||
|
||||
error = impd_process_drc_bitstream_dec_gain(
|
||||
p_obj_drc->str_payload.pstr_bitstream_dec, p_obj_drc->pstr_bit_buf,
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain,
|
||||
&p_obj_drc->str_bit_handler
|
||||
.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||
|
||||
if (error > PROC_COMPLETE) return -1;
|
||||
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||
p_obj_drc->str_bit_handler.byte_index_bs +=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
if (p_obj_drc->str_bit_handler.gain_stream_flag ==
|
||||
0) // ITTIAM: Flag for applying gain frame by frame
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs -=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
}
|
||||
|
||||
if (p_obj_drc->str_config.bitstream_file_format ==
|
||||
BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||
if (p_obj_drc->str_bit_handler.num_bits_offset_bs != 0) {
|
||||
p_obj_drc->str_bit_handler.num_bits_read_bs =
|
||||
p_obj_drc->str_bit_handler.num_bits_read_bs + 8 -
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs + 1;
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = 0;
|
||||
p_obj_drc->str_bit_handler.byte_index_bs =
|
||||
p_obj_drc->str_bit_handler.byte_index_bs + 1;
|
||||
if (p_obj_drc->str_bit_handler.gain_stream_flag ==
|
||||
0) // ITTIAM: Flag for applying gain frame by frame
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs =
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
error = impd_drc_process_freq_domain(
|
||||
p_obj_drc->str_payload.pstr_gain_dec[0],
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain, audio_io_buf_real,
|
||||
audio_io_buf_imag, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->drc_characteristic_target);
|
||||
if (error) return -1;
|
||||
|
||||
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||
audio_io_buf_real, p_obj_drc->str_config.frame_size);
|
||||
if (error) return -1;
|
||||
|
||||
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||
audio_io_buf_imag, p_obj_drc->str_config.frame_size);
|
||||
if (error) return -1;
|
||||
|
||||
error = impd_drc_process_freq_domain(
|
||||
p_obj_drc->str_payload.pstr_gain_dec[1],
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain, audio_io_buf_real,
|
||||
audio_io_buf_imag, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->drc_characteristic_target);
|
||||
if (error) return -1;
|
||||
|
||||
if (p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db != 0.0f) {
|
||||
FLOAT32 loudness_normalization_gain =
|
||||
(FLOAT32)pow(10.0, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db /
|
||||
20.0);
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
audio_io_buf_real[i][j] *= loudness_normalization_gain;
|
||||
audio_io_buf_imag[i][j] *= loudness_normalization_gain;
|
||||
}
|
||||
}
|
||||
}
|
||||
num_samples_per_channel = p_obj_drc->str_config.frame_size;
|
||||
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
output_buffer[j * p_obj_drc->str_config.num_ch_out + i] =
|
||||
audio_io_buf_real[i][j];
|
||||
output_buffer[p_obj_drc->str_config.frame_size *
|
||||
p_obj_drc->str_config.num_ch_in +
|
||||
j * p_obj_drc->str_config.num_ch_out + i] =
|
||||
audio_io_buf_imag[i][j];
|
||||
}
|
||||
}
|
||||
p_obj_drc->p_state->ui_out_bytes =
|
||||
p_obj_drc->str_config.num_ch_out * (p_obj_drc->str_config.frame_size) * 4;
|
||||
p_obj_drc->p_state->ui_out_bytes =
|
||||
p_obj_drc->str_config.num_ch_out *
|
||||
(p_obj_drc->p_state->ui_in_bytes / p_obj_drc->str_config.num_ch_in);
|
||||
|
||||
if (last_frame == 0) {
|
||||
if (p_obj_drc->str_config.bitstream_file_format !=
|
||||
BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||
error = impd_process_drc_bitstream_dec(
|
||||
p_obj_drc->str_payload.pstr_bitstream_dec, p_obj_drc->pstr_bit_buf,
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_loudness_info,
|
||||
&p_obj_drc->str_bit_handler
|
||||
.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||
|
||||
if (error > PROC_COMPLETE) return -1;
|
||||
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||
p_obj_drc->str_bit_handler.byte_index_bs +=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs -=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
}
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,194 +39,216 @@
|
|||
|
||||
#define BITSTREAM_FILE_FORMAT_SPLIT 1
|
||||
|
||||
static WORD32 impd_down_mix(ia_drc_sel_proc_output_struct *uni_drc_sel_proc_output, FLOAT32** input_audio, WORD32 frame_len)
|
||||
{
|
||||
WORD32 num_base_ch = uni_drc_sel_proc_output->base_channel_count;
|
||||
WORD32 num_target_ch = uni_drc_sel_proc_output->target_channel_count;
|
||||
WORD32 i, i_ch, o_ch;
|
||||
FLOAT32 tmp_out[MAX_CHANNEL_COUNT];
|
||||
static WORD32 impd_down_mix(
|
||||
ia_drc_sel_proc_output_struct *uni_drc_sel_proc_output,
|
||||
FLOAT32 **input_audio, WORD32 frame_len) {
|
||||
WORD32 num_base_ch = uni_drc_sel_proc_output->base_channel_count;
|
||||
WORD32 num_target_ch = uni_drc_sel_proc_output->target_channel_count;
|
||||
WORD32 i, i_ch, o_ch;
|
||||
FLOAT32 tmp_out[MAX_CHANNEL_COUNT];
|
||||
|
||||
if (uni_drc_sel_proc_output->downmix_matrix_present == 0)
|
||||
return 0;
|
||||
if (uni_drc_sel_proc_output->downmix_matrix_present == 0) return 0;
|
||||
|
||||
if (input_audio == 0)
|
||||
return 0;
|
||||
if (input_audio == 0) return 0;
|
||||
|
||||
if (num_target_ch > MAX_CHANNEL_COUNT)
|
||||
return -1;
|
||||
if (num_target_ch > MAX_CHANNEL_COUNT) return -1;
|
||||
|
||||
if (num_target_ch > num_base_ch)
|
||||
return -1;
|
||||
if (num_target_ch > num_base_ch) return -1;
|
||||
|
||||
for (i=0; i<frame_len; i++) {
|
||||
for (o_ch=0; o_ch<num_target_ch; o_ch++) {
|
||||
tmp_out[o_ch] = 0.0f;
|
||||
for (i_ch=0; i_ch<num_base_ch; i_ch++) {
|
||||
tmp_out[o_ch] += input_audio[i_ch][i] * uni_drc_sel_proc_output->downmix_matrix[i_ch][o_ch];
|
||||
}
|
||||
}
|
||||
for (o_ch=0; o_ch<num_target_ch; o_ch++) {
|
||||
input_audio[o_ch][i] = tmp_out[o_ch];
|
||||
}
|
||||
for ( ; o_ch<num_base_ch; o_ch++) {
|
||||
input_audio[o_ch][i] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
WORD32 impd_init_process_audio_main_stft (ia_drc_api_struct *p_obj_drc)
|
||||
|
||||
{
|
||||
WORD32 error=0, i, j, num_samples_per_channel;
|
||||
FLOAT32 *input_buffer;
|
||||
FLOAT32 *output_buffer;
|
||||
FLOAT32 *audio_io_buf_real[10];
|
||||
FLOAT32 *audio_io_buf_imag[10];
|
||||
FLOAT32 *scratch_buffer;
|
||||
WORD32 last_frame=0;
|
||||
scratch_buffer= (FLOAT32*)p_obj_drc->pp_mem[1];
|
||||
input_buffer = (FLOAT32*)p_obj_drc->pp_mem[2];
|
||||
output_buffer = (FLOAT32*)p_obj_drc->pp_mem[3];
|
||||
|
||||
|
||||
if(p_obj_drc->p_state->ui_in_bytes<=0){
|
||||
p_obj_drc->p_state->ui_out_bytes=0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if((p_obj_drc->p_state->ui_in_bytes/p_obj_drc->str_config.num_ch_in/(p_obj_drc->str_config.pcm_size>>3)) < (UWORD32)p_obj_drc->str_config.frame_size)
|
||||
last_frame=1;
|
||||
for(i=0;i<p_obj_drc->str_config.num_ch_in;i++){
|
||||
audio_io_buf_real[i]=scratch_buffer+i*(p_obj_drc->str_config.frame_size+32);
|
||||
audio_io_buf_imag[i]=scratch_buffer+p_obj_drc->str_config.num_ch_in*p_obj_drc->str_config.frame_size+p_obj_drc->str_config.num_ch_in*64+i*(p_obj_drc->str_config.frame_size+64);
|
||||
for(j=0;j<p_obj_drc->str_config.frame_size;j++){
|
||||
audio_io_buf_real[i][j]=input_buffer[j*p_obj_drc->str_config.num_ch_in + i];
|
||||
audio_io_buf_imag[i][j]=input_buffer[p_obj_drc->str_config.num_ch_in*p_obj_drc->str_config.frame_size+j*p_obj_drc->str_config.num_ch_in + i];
|
||||
for (i = 0; i < frame_len; i++) {
|
||||
for (o_ch = 0; o_ch < num_target_ch; o_ch++) {
|
||||
tmp_out[o_ch] = 0.0f;
|
||||
for (i_ch = 0; i_ch < num_base_ch; i_ch++) {
|
||||
tmp_out[o_ch] += input_audio[i_ch][i] *
|
||||
uni_drc_sel_proc_output->downmix_matrix[i_ch][o_ch];
|
||||
}
|
||||
}
|
||||
|
||||
error = impd_process_drc_bitstream_dec_gain(p_obj_drc->str_payload.pstr_bitstream_dec,
|
||||
p_obj_drc->pstr_bit_buf,
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain,
|
||||
&p_obj_drc->str_bit_handler.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||
|
||||
|
||||
|
||||
if (error > PROC_COMPLETE) return -1;
|
||||
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||
p_obj_drc->str_bit_handler.byte_index_bs += p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
if(p_obj_drc->str_bit_handler.gain_stream_flag==0) //ITTIAM: Flag for applying gain frame by frame
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs -= p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
for (o_ch = 0; o_ch < num_target_ch; o_ch++) {
|
||||
input_audio[o_ch][i] = tmp_out[o_ch];
|
||||
}
|
||||
|
||||
|
||||
if (p_obj_drc->str_config.bitstream_file_format == BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||
if (p_obj_drc->str_bit_handler.num_bits_offset_bs != 0)
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bits_read_bs = p_obj_drc->str_bit_handler.num_bits_read_bs + 8 - p_obj_drc->str_bit_handler.num_bits_offset_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs = p_obj_drc->str_bit_handler.num_bytes_read_bs + 1;
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = 0;
|
||||
p_obj_drc->str_bit_handler.byte_index_bs = p_obj_drc->str_bit_handler.byte_index_bs + 1;
|
||||
if(p_obj_drc->str_bit_handler.gain_stream_flag==0) //ITTIAM: Flag for applying gain frame by frame
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs = p_obj_drc->str_bit_handler.num_bytes_bs - 1;
|
||||
}
|
||||
}
|
||||
for (; o_ch < num_base_ch; o_ch++) {
|
||||
input_audio[o_ch][i] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
error = impd_drc_process_freq_domain(p_obj_drc->str_payload.pstr_gain_dec[0],
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain,
|
||||
audio_io_buf_real,
|
||||
audio_io_buf_imag,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->drc_characteristic_target);
|
||||
if (error) return -1;
|
||||
|
||||
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||
audio_io_buf_real,
|
||||
p_obj_drc->str_config.frame_size);
|
||||
if (error) return -1;
|
||||
|
||||
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||
audio_io_buf_imag,
|
||||
p_obj_drc->str_config.frame_size);
|
||||
if (error) return -1;
|
||||
|
||||
error = impd_drc_process_freq_domain(p_obj_drc->str_payload.pstr_gain_dec[1],
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain,
|
||||
audio_io_buf_real,
|
||||
audio_io_buf_imag,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->drc_characteristic_target);
|
||||
if (error) return -1;
|
||||
|
||||
if (p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db != 0.0f)
|
||||
{
|
||||
FLOAT32 loudness_normalization_gain = (FLOAT32)pow(10.0,p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db/20.0);
|
||||
for (i=0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j=0; j <p_obj_drc->str_config. frame_size; j++) {
|
||||
audio_io_buf_real[i][j] *= loudness_normalization_gain;
|
||||
audio_io_buf_imag[i][j] *= loudness_normalization_gain;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
num_samples_per_channel = p_obj_drc->str_config.frame_size;
|
||||
|
||||
for (i=0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j=0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
output_buffer[j*p_obj_drc->str_config.num_ch_out + i] = audio_io_buf_real[i][j];
|
||||
output_buffer[p_obj_drc->str_config.frame_size*p_obj_drc->str_config.num_ch_in+j*p_obj_drc->str_config.num_ch_out + i] = audio_io_buf_imag[i][j];
|
||||
|
||||
}
|
||||
}
|
||||
p_obj_drc->p_state->ui_out_bytes=p_obj_drc->str_config.num_ch_out*(p_obj_drc->str_config.frame_size)*4;
|
||||
p_obj_drc->p_state->ui_out_bytes=p_obj_drc->str_config.num_ch_out*(p_obj_drc->p_state->ui_in_bytes/p_obj_drc->str_config.num_ch_in);
|
||||
|
||||
if(last_frame==0){
|
||||
|
||||
if (p_obj_drc->str_config.bitstream_file_format != BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||
error = impd_process_drc_bitstream_dec(p_obj_drc->str_payload.pstr_bitstream_dec,
|
||||
p_obj_drc->pstr_bit_buf,
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_loudness_info,
|
||||
&p_obj_drc->str_bit_handler.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||
|
||||
if (error > PROC_COMPLETE)
|
||||
return -1;
|
||||
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||
p_obj_drc->str_bit_handler.byte_index_bs += p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs -= p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return error;
|
||||
return 0;
|
||||
}
|
||||
|
||||
WORD32 impd_init_process_audio_main_stft(ia_drc_api_struct *p_obj_drc)
|
||||
|
||||
{
|
||||
WORD32 error = 0, i, j, num_samples_per_channel;
|
||||
FLOAT32 *input_buffer;
|
||||
FLOAT32 *output_buffer;
|
||||
FLOAT32 *audio_io_buf_real[10];
|
||||
FLOAT32 *audio_io_buf_imag[10];
|
||||
FLOAT32 *scratch_buffer;
|
||||
WORD32 last_frame = 0;
|
||||
scratch_buffer = (FLOAT32 *)p_obj_drc->pp_mem[1];
|
||||
input_buffer = (FLOAT32 *)p_obj_drc->pp_mem[2];
|
||||
output_buffer = (FLOAT32 *)p_obj_drc->pp_mem[3];
|
||||
|
||||
if (p_obj_drc->p_state->ui_in_bytes <= 0) {
|
||||
p_obj_drc->p_state->ui_out_bytes = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((p_obj_drc->p_state->ui_in_bytes / p_obj_drc->str_config.num_ch_in /
|
||||
(p_obj_drc->str_config.pcm_size >> 3)) <
|
||||
(UWORD32)p_obj_drc->str_config.frame_size)
|
||||
last_frame = 1;
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_in; i++) {
|
||||
audio_io_buf_real[i] =
|
||||
scratch_buffer + i * (p_obj_drc->str_config.frame_size + 32);
|
||||
audio_io_buf_imag[i] =
|
||||
scratch_buffer +
|
||||
p_obj_drc->str_config.num_ch_in * p_obj_drc->str_config.frame_size +
|
||||
p_obj_drc->str_config.num_ch_in * 64 +
|
||||
i * (p_obj_drc->str_config.frame_size + 64);
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
audio_io_buf_real[i][j] =
|
||||
input_buffer[j * p_obj_drc->str_config.num_ch_in + i];
|
||||
audio_io_buf_imag[i][j] =
|
||||
input_buffer[p_obj_drc->str_config.num_ch_in *
|
||||
p_obj_drc->str_config.frame_size +
|
||||
j * p_obj_drc->str_config.num_ch_in + i];
|
||||
}
|
||||
}
|
||||
|
||||
error = impd_process_drc_bitstream_dec_gain(
|
||||
p_obj_drc->str_payload.pstr_bitstream_dec, p_obj_drc->pstr_bit_buf,
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain,
|
||||
&p_obj_drc->str_bit_handler
|
||||
.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||
|
||||
if (error > PROC_COMPLETE) return -1;
|
||||
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||
p_obj_drc->str_bit_handler.byte_index_bs +=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
if (p_obj_drc->str_bit_handler.gain_stream_flag ==
|
||||
0) // ITTIAM: Flag for applying gain frame by frame
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs -=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
}
|
||||
|
||||
if (p_obj_drc->str_config.bitstream_file_format ==
|
||||
BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||
if (p_obj_drc->str_bit_handler.num_bits_offset_bs != 0) {
|
||||
p_obj_drc->str_bit_handler.num_bits_read_bs =
|
||||
p_obj_drc->str_bit_handler.num_bits_read_bs + 8 -
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs + 1;
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = 0;
|
||||
p_obj_drc->str_bit_handler.byte_index_bs =
|
||||
p_obj_drc->str_bit_handler.byte_index_bs + 1;
|
||||
if (p_obj_drc->str_bit_handler.gain_stream_flag ==
|
||||
0) // ITTIAM: Flag for applying gain frame by frame
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs =
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
error = impd_drc_process_freq_domain(
|
||||
p_obj_drc->str_payload.pstr_gain_dec[0],
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain, audio_io_buf_real,
|
||||
audio_io_buf_imag, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->drc_characteristic_target);
|
||||
if (error) return -1;
|
||||
|
||||
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||
audio_io_buf_real, p_obj_drc->str_config.frame_size);
|
||||
if (error) return -1;
|
||||
|
||||
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||
audio_io_buf_imag, p_obj_drc->str_config.frame_size);
|
||||
if (error) return -1;
|
||||
|
||||
error = impd_drc_process_freq_domain(
|
||||
p_obj_drc->str_payload.pstr_gain_dec[1],
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain, audio_io_buf_real,
|
||||
audio_io_buf_imag, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->drc_characteristic_target);
|
||||
if (error) return -1;
|
||||
|
||||
if (p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db != 0.0f) {
|
||||
FLOAT32 loudness_normalization_gain =
|
||||
(FLOAT32)pow(10.0, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db /
|
||||
20.0);
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
audio_io_buf_real[i][j] *= loudness_normalization_gain;
|
||||
audio_io_buf_imag[i][j] *= loudness_normalization_gain;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
num_samples_per_channel = p_obj_drc->str_config.frame_size;
|
||||
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
output_buffer[j * p_obj_drc->str_config.num_ch_out + i] =
|
||||
audio_io_buf_real[i][j];
|
||||
output_buffer[p_obj_drc->str_config.frame_size *
|
||||
p_obj_drc->str_config.num_ch_in +
|
||||
j * p_obj_drc->str_config.num_ch_out + i] =
|
||||
audio_io_buf_imag[i][j];
|
||||
}
|
||||
}
|
||||
p_obj_drc->p_state->ui_out_bytes =
|
||||
p_obj_drc->str_config.num_ch_out * (p_obj_drc->str_config.frame_size) * 4;
|
||||
p_obj_drc->p_state->ui_out_bytes =
|
||||
p_obj_drc->str_config.num_ch_out *
|
||||
(p_obj_drc->p_state->ui_in_bytes / p_obj_drc->str_config.num_ch_in);
|
||||
|
||||
if (last_frame == 0) {
|
||||
if (p_obj_drc->str_config.bitstream_file_format !=
|
||||
BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||
error = impd_process_drc_bitstream_dec(
|
||||
p_obj_drc->str_payload.pstr_bitstream_dec, p_obj_drc->pstr_bit_buf,
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_loudness_info,
|
||||
&p_obj_drc->str_bit_handler
|
||||
.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||
|
||||
if (error > PROC_COMPLETE) return -1;
|
||||
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||
p_obj_drc->str_bit_handler.byte_index_bs +=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs -=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
}
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,274 +41,285 @@
|
|||
#include "impd_drc_hashdefines.h"
|
||||
#include "impd_drc_peak_limiter.h"
|
||||
|
||||
static IA_ERRORCODE impd_down_mix ( ia_drc_sel_proc_output_struct *uni_drc_sel_proc_output, FLOAT32** input_audio, WORD32 frame_len)
|
||||
{
|
||||
WORD32 num_base_ch = uni_drc_sel_proc_output->base_channel_count;
|
||||
WORD32 num_target_ch = uni_drc_sel_proc_output->target_channel_count;
|
||||
WORD32 i, i_ch, o_ch;
|
||||
FLOAT32 tmp_out[MAX_CHANNEL_COUNT];
|
||||
static IA_ERRORCODE impd_down_mix(
|
||||
ia_drc_sel_proc_output_struct *uni_drc_sel_proc_output,
|
||||
FLOAT32 **input_audio, WORD32 frame_len) {
|
||||
WORD32 num_base_ch = uni_drc_sel_proc_output->base_channel_count;
|
||||
WORD32 num_target_ch = uni_drc_sel_proc_output->target_channel_count;
|
||||
WORD32 i, i_ch, o_ch;
|
||||
FLOAT32 tmp_out[MAX_CHANNEL_COUNT];
|
||||
|
||||
if (num_target_ch > MAX_CHANNEL_COUNT) return -1;
|
||||
|
||||
if (num_target_ch > MAX_CHANNEL_COUNT)
|
||||
return -1;
|
||||
if (num_target_ch > num_base_ch) return -1;
|
||||
|
||||
if (num_target_ch > num_base_ch)
|
||||
return -1;
|
||||
|
||||
for (i=0; i<frame_len; i++)
|
||||
{
|
||||
for (o_ch=0; o_ch<num_target_ch; o_ch++)
|
||||
{
|
||||
tmp_out[o_ch] = 0.0f;
|
||||
for (i_ch=0; i_ch<num_base_ch; i_ch++)
|
||||
{
|
||||
tmp_out[o_ch] += input_audio[i_ch][i] * uni_drc_sel_proc_output->downmix_matrix[i_ch][o_ch];
|
||||
}
|
||||
}
|
||||
for (o_ch=0; o_ch<num_target_ch; o_ch++)
|
||||
{
|
||||
input_audio[o_ch][i] = tmp_out[o_ch];
|
||||
}
|
||||
for ( ; o_ch<num_base_ch; o_ch++)
|
||||
{
|
||||
input_audio[o_ch][i] = 0.0f;
|
||||
}
|
||||
for (i = 0; i < frame_len; i++) {
|
||||
for (o_ch = 0; o_ch < num_target_ch; o_ch++) {
|
||||
tmp_out[o_ch] = 0.0f;
|
||||
for (i_ch = 0; i_ch < num_base_ch; i_ch++) {
|
||||
tmp_out[o_ch] += input_audio[i_ch][i] *
|
||||
uni_drc_sel_proc_output->downmix_matrix[i_ch][o_ch];
|
||||
}
|
||||
}
|
||||
for (o_ch = 0; o_ch < num_target_ch; o_ch++) {
|
||||
input_audio[o_ch][i] = tmp_out[o_ch];
|
||||
}
|
||||
for (; o_ch < num_base_ch; o_ch++) {
|
||||
input_audio[o_ch][i] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
return IA_NO_ERROR;
|
||||
}
|
||||
|
||||
IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc) {
|
||||
IA_ERRORCODE err_code = IA_NO_ERROR;
|
||||
WORD32 i, j;
|
||||
FLOAT32 *input_buffer;
|
||||
WORD16 *input_buffer16, *output_buffer16;
|
||||
FLOAT32 *output_buffer;
|
||||
FLOAT32 *audio_buff[10];
|
||||
FLOAT32 *scratch_buffer;
|
||||
WORD32 last_frame = 0;
|
||||
WORD32 num_sample_to_process;
|
||||
scratch_buffer = (FLOAT32 *)p_obj_drc->pp_mem[1];
|
||||
input_buffer = (FLOAT32 *)p_obj_drc->pp_mem[2];
|
||||
output_buffer = (FLOAT32 *)p_obj_drc->pp_mem[3];
|
||||
input_buffer16 = (WORD16 *)p_obj_drc->pp_mem[2];
|
||||
output_buffer16 = (WORD16 *)p_obj_drc->pp_mem[3];
|
||||
|
||||
if (p_obj_drc->p_state->ui_in_bytes <= 0) {
|
||||
p_obj_drc->p_state->ui_out_bytes = 0;
|
||||
return IA_NO_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc)
|
||||
{
|
||||
IA_ERRORCODE err_code= IA_NO_ERROR;
|
||||
WORD32 i, j;
|
||||
FLOAT32 *input_buffer;
|
||||
WORD16 *input_buffer16, *output_buffer16;
|
||||
FLOAT32 *output_buffer;
|
||||
FLOAT32 *audio_buff[10];
|
||||
FLOAT32 *scratch_buffer;
|
||||
WORD32 last_frame=0;
|
||||
WORD32 num_sample_to_process;
|
||||
scratch_buffer = (FLOAT32*)p_obj_drc->pp_mem[1];
|
||||
input_buffer = (FLOAT32*)p_obj_drc->pp_mem[2];
|
||||
output_buffer = (FLOAT32*)p_obj_drc->pp_mem[3];
|
||||
input_buffer16 = (WORD16*)p_obj_drc->pp_mem[2];
|
||||
output_buffer16 = (WORD16*)p_obj_drc->pp_mem[3];
|
||||
err_code = impd_process_drc_bitstream_dec_gain(
|
||||
p_obj_drc->str_payload.pstr_bitstream_dec, p_obj_drc->pstr_bit_buf,
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain,
|
||||
&p_obj_drc->str_bit_handler
|
||||
.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||
|
||||
if(p_obj_drc->p_state->ui_in_bytes<=0){
|
||||
p_obj_drc->p_state->ui_out_bytes=0;
|
||||
return IA_NO_ERROR;
|
||||
if (err_code > PROC_COMPLETE) return -1;
|
||||
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||
p_obj_drc->str_bit_handler.byte_index_bs +=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
if (p_obj_drc->str_bit_handler.gain_stream_flag ==
|
||||
0) // ITTIAM: Flag for applying gain frame by frame
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs -=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
}
|
||||
|
||||
if (p_obj_drc->str_config.bitstream_file_format ==
|
||||
BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||
if (p_obj_drc->str_bit_handler.num_bits_offset_bs != 0) {
|
||||
p_obj_drc->str_bit_handler.num_bits_read_bs =
|
||||
p_obj_drc->str_bit_handler.num_bits_read_bs + 8 -
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs + 1;
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = 0;
|
||||
p_obj_drc->str_bit_handler.byte_index_bs =
|
||||
p_obj_drc->str_bit_handler.byte_index_bs + 1;
|
||||
if (p_obj_drc->str_bit_handler.gain_stream_flag == 0) {
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs =
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
num_sample_to_process =
|
||||
(p_obj_drc->p_state->ui_in_bytes / p_obj_drc->str_config.num_ch_in /
|
||||
(p_obj_drc->str_config.pcm_size >> 3));
|
||||
|
||||
p_obj_drc->str_config.frame_size = num_sample_to_process;
|
||||
|
||||
if (num_sample_to_process < p_obj_drc->str_config.frame_size) last_frame = 1;
|
||||
|
||||
if (p_obj_drc->str_config.pcm_size == 16) {
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_in; i++) {
|
||||
audio_buff[i] =
|
||||
scratch_buffer + i * (p_obj_drc->str_config.frame_size + 32);
|
||||
|
||||
for (j = 0; j < num_sample_to_process; j++) {
|
||||
audio_buff[i][j] =
|
||||
((FLOAT32)input_buffer16[j * p_obj_drc->str_config.num_ch_in + i]) /
|
||||
32767.0f;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_in; i++) {
|
||||
audio_buff[i] =
|
||||
scratch_buffer + i * (p_obj_drc->str_config.frame_size + 32);
|
||||
|
||||
for (j = 0; j < num_sample_to_process; j++) {
|
||||
audio_buff[i][j] =
|
||||
input_buffer[j * p_obj_drc->str_config.num_ch_in + i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
err_code = impd_drc_process_time_domain(
|
||||
p_obj_drc->str_payload.pstr_gain_dec[0],
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain, audio_buff,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->drc_characteristic_target);
|
||||
|
||||
if (err_code != IA_NO_ERROR) return err_code;
|
||||
|
||||
if (p_obj_drc->str_payload.pstr_drc_sel_proc_output->downmix_matrix_present !=
|
||||
0)
|
||||
err_code = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||
audio_buff, p_obj_drc->str_config.frame_size);
|
||||
|
||||
if (err_code != IA_NO_ERROR) return err_code;
|
||||
|
||||
err_code = impd_drc_process_time_domain(
|
||||
p_obj_drc->str_payload.pstr_gain_dec[1],
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain, audio_buff,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->drc_characteristic_target);
|
||||
|
||||
if (err_code != IA_NO_ERROR) return err_code;
|
||||
|
||||
if (p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db != 0.0f) {
|
||||
FLOAT32 gain_value =
|
||||
(FLOAT32)pow(10.0, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db /
|
||||
20.0);
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
audio_buff[i][j] *= gain_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (p_obj_drc->str_config.peak_limiter) {
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
output_buffer[j * p_obj_drc->str_config.num_ch_out + i] =
|
||||
audio_buff[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
err_code = impd_process_drc_bitstream_dec_gain(p_obj_drc->str_payload.pstr_bitstream_dec,
|
||||
p_obj_drc->pstr_bit_buf,
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain,
|
||||
&p_obj_drc->str_bit_handler.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||
err_code =
|
||||
impd_limiter_process(p_obj_drc->str_payload.pstr_peak_limiter,
|
||||
output_buffer, p_obj_drc->str_config.frame_size);
|
||||
|
||||
if (err_code > PROC_COMPLETE)
|
||||
return -1;
|
||||
if (err_code != IA_NO_ERROR) return err_code;
|
||||
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||
p_obj_drc->str_bit_handler.byte_index_bs += p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
if(p_obj_drc->str_bit_handler.gain_stream_flag==0) //ITTIAM: Flag for applying gain frame by frame
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs -= p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
audio_buff[i][j] =
|
||||
output_buffer[j * p_obj_drc->str_config.num_ch_out + i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (p_obj_drc->str_config.bitstream_file_format == BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||
if (p_obj_drc->str_bit_handler.num_bits_offset_bs != 0)
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bits_read_bs = p_obj_drc->str_bit_handler.num_bits_read_bs + 8
|
||||
- p_obj_drc->str_bit_handler.num_bits_offset_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs = p_obj_drc->str_bit_handler.num_bytes_read_bs + 1;
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = 0;
|
||||
p_obj_drc->str_bit_handler.byte_index_bs = p_obj_drc->str_bit_handler.byte_index_bs + 1;
|
||||
if(p_obj_drc->str_bit_handler.gain_stream_flag==0)
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs = p_obj_drc->str_bit_handler.num_bytes_bs - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (p_obj_drc->str_config.pcm_size == 16) {
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
if (audio_buff[i][j] < -1.0f)
|
||||
output_buffer16[j * p_obj_drc->str_config.num_ch_out + i] = -32767;
|
||||
|
||||
num_sample_to_process=(p_obj_drc->p_state->ui_in_bytes/p_obj_drc->str_config.num_ch_in/(p_obj_drc->str_config.pcm_size>>3));
|
||||
else if (audio_buff[i][j] > 1.0f)
|
||||
output_buffer16[j * p_obj_drc->str_config.num_ch_out + i] = 32767;
|
||||
|
||||
p_obj_drc->str_config.frame_size = num_sample_to_process;
|
||||
|
||||
if(num_sample_to_process<p_obj_drc->str_config.frame_size)
|
||||
last_frame=1;
|
||||
|
||||
if(p_obj_drc->str_config.pcm_size==16)
|
||||
{
|
||||
for(i=0;i<p_obj_drc->str_config.num_ch_in;i++)
|
||||
{
|
||||
audio_buff[i]=scratch_buffer+i*(p_obj_drc->str_config.frame_size+32);
|
||||
|
||||
for(j=0;j<num_sample_to_process;j++)
|
||||
{
|
||||
|
||||
audio_buff[i][j]=((FLOAT32)input_buffer16[j*p_obj_drc->str_config.num_ch_in + i])/32767.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(i=0;i<p_obj_drc->str_config.num_ch_in;i++)
|
||||
{
|
||||
audio_buff[i]=scratch_buffer+i*(p_obj_drc->str_config.frame_size+32);
|
||||
|
||||
for(j=0;j<num_sample_to_process;j++)
|
||||
{
|
||||
audio_buff[i][j]=input_buffer[j*p_obj_drc->str_config.num_ch_in + i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
err_code = impd_drc_process_time_domain(p_obj_drc->str_payload.pstr_gain_dec[0],
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain,
|
||||
audio_buff,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->drc_characteristic_target);
|
||||
|
||||
if (err_code!=IA_NO_ERROR)
|
||||
return err_code;
|
||||
|
||||
if(p_obj_drc->str_payload.pstr_drc_sel_proc_output->downmix_matrix_present!=0)
|
||||
err_code = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||
audio_buff,
|
||||
p_obj_drc->str_config.frame_size);
|
||||
|
||||
if (err_code!=IA_NO_ERROR)
|
||||
return err_code;
|
||||
|
||||
err_code = impd_drc_process_time_domain(p_obj_drc->str_payload.pstr_gain_dec[1],
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain,
|
||||
audio_buff,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->drc_characteristic_target);
|
||||
|
||||
if (err_code!=IA_NO_ERROR)
|
||||
return err_code;
|
||||
|
||||
if (p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db != 0.0f)
|
||||
{
|
||||
FLOAT32 gain_value = (FLOAT32)pow(10.0,p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db/20.0);
|
||||
for (i=0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j=0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
audio_buff[i][j] *= gain_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (p_obj_drc->str_config.peak_limiter)
|
||||
{
|
||||
for (i=0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j=0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
output_buffer[j*p_obj_drc->str_config.num_ch_out + i] = audio_buff[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
err_code=impd_limiter_process(p_obj_drc->str_payload.pstr_peak_limiter,
|
||||
output_buffer,
|
||||
p_obj_drc->str_config.frame_size);
|
||||
|
||||
|
||||
if (err_code!=IA_NO_ERROR)
|
||||
return err_code;
|
||||
|
||||
for (i=0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j=0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
audio_buff[i][j] = output_buffer[j*p_obj_drc->str_config.num_ch_out + i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(p_obj_drc->str_config.pcm_size==16)
|
||||
{
|
||||
for (i=0; i < p_obj_drc->str_config.num_ch_out; i++)
|
||||
{
|
||||
for (j=0; j < p_obj_drc->str_config.frame_size; j++)
|
||||
{
|
||||
if(audio_buff[i][j]<-1.0f)
|
||||
output_buffer16[j*p_obj_drc->str_config.num_ch_out + i] = -32767;
|
||||
|
||||
else if (audio_buff[i][j]>1.0f)
|
||||
output_buffer16[j*p_obj_drc->str_config.num_ch_out + i] = 32767;
|
||||
|
||||
else
|
||||
output_buffer16[j*p_obj_drc->str_config.num_ch_out + i] = (WORD16)(audio_buff[i][j]*32767.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i=0; i < p_obj_drc->str_config.num_ch_out; i++)
|
||||
{
|
||||
for (j=0; j < p_obj_drc->str_config.frame_size; j++)
|
||||
{
|
||||
output_buffer[j*p_obj_drc->str_config.num_ch_out + i] = audio_buff[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p_obj_drc->p_state->ui_out_bytes=p_obj_drc->str_config.num_ch_out*(p_obj_drc->p_state->ui_in_bytes/p_obj_drc->str_config.num_ch_in);
|
||||
|
||||
if(p_obj_drc->p_state->delay_in_output!=0){
|
||||
p_obj_drc->p_state->ui_out_bytes=p_obj_drc->str_config.num_ch_out*(p_obj_drc->str_config.frame_size-p_obj_drc->p_state->delay_in_output)*(p_obj_drc->str_config.pcm_size>>3);
|
||||
if(p_obj_drc->str_config.pcm_size==16)
|
||||
memcpy(output_buffer16,(output_buffer16+(p_obj_drc->p_state->delay_in_output*p_obj_drc->str_config.num_ch_out)),p_obj_drc->p_state->ui_out_bytes);
|
||||
else
|
||||
memcpy(output_buffer,(output_buffer+(p_obj_drc->p_state->delay_in_output*p_obj_drc->str_config.num_ch_out)),p_obj_drc->p_state->ui_out_bytes);
|
||||
|
||||
p_obj_drc->p_state->delay_adjust_samples = p_obj_drc->p_state->delay_in_output;
|
||||
p_obj_drc->p_state->delay_in_output=0;
|
||||
|
||||
output_buffer16[j * p_obj_drc->str_config.num_ch_out + i] =
|
||||
(WORD16)(audio_buff[i][j] * 32767.0f);
|
||||
}
|
||||
}
|
||||
if(last_frame==1)
|
||||
{
|
||||
if((num_sample_to_process+p_obj_drc->p_state->delay_adjust_samples)<=p_obj_drc->str_config.frame_size)
|
||||
p_obj_drc->p_state->ui_out_bytes = (num_sample_to_process+p_obj_drc->p_state->delay_adjust_samples)*p_obj_drc->str_config.num_ch_out*(p_obj_drc->str_config.pcm_size>>3);
|
||||
else
|
||||
p_obj_drc->p_state->ui_out_bytes = (p_obj_drc->str_config.frame_size)*p_obj_drc->str_config.num_ch_out*(p_obj_drc->str_config.pcm_size>>3);
|
||||
|
||||
} else {
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
output_buffer[j * p_obj_drc->str_config.num_ch_out + i] =
|
||||
audio_buff[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(last_frame==0){
|
||||
p_obj_drc->p_state->ui_out_bytes =
|
||||
p_obj_drc->str_config.num_ch_out *
|
||||
(p_obj_drc->p_state->ui_in_bytes / p_obj_drc->str_config.num_ch_in);
|
||||
|
||||
if (p_obj_drc->p_state->delay_in_output != 0) {
|
||||
p_obj_drc->p_state->ui_out_bytes = p_obj_drc->str_config.num_ch_out *
|
||||
(p_obj_drc->str_config.frame_size -
|
||||
p_obj_drc->p_state->delay_in_output) *
|
||||
(p_obj_drc->str_config.pcm_size >> 3);
|
||||
if (p_obj_drc->str_config.pcm_size == 16)
|
||||
memcpy(output_buffer16,
|
||||
(output_buffer16 + (p_obj_drc->p_state->delay_in_output *
|
||||
p_obj_drc->str_config.num_ch_out)),
|
||||
p_obj_drc->p_state->ui_out_bytes);
|
||||
else
|
||||
memcpy(output_buffer,
|
||||
(output_buffer + (p_obj_drc->p_state->delay_in_output *
|
||||
p_obj_drc->str_config.num_ch_out)),
|
||||
p_obj_drc->p_state->ui_out_bytes);
|
||||
|
||||
p_obj_drc->p_state->delay_adjust_samples =
|
||||
p_obj_drc->p_state->delay_in_output;
|
||||
p_obj_drc->p_state->delay_in_output = 0;
|
||||
}
|
||||
if (last_frame == 1) {
|
||||
if ((num_sample_to_process + p_obj_drc->p_state->delay_adjust_samples) <=
|
||||
p_obj_drc->str_config.frame_size)
|
||||
p_obj_drc->p_state->ui_out_bytes =
|
||||
(num_sample_to_process + p_obj_drc->p_state->delay_adjust_samples) *
|
||||
p_obj_drc->str_config.num_ch_out *
|
||||
(p_obj_drc->str_config.pcm_size >> 3);
|
||||
else
|
||||
p_obj_drc->p_state->ui_out_bytes = (p_obj_drc->str_config.frame_size) *
|
||||
p_obj_drc->str_config.num_ch_out *
|
||||
(p_obj_drc->str_config.pcm_size >> 3);
|
||||
}
|
||||
|
||||
if (p_obj_drc->str_config.bitstream_file_format != BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||
err_code = impd_process_drc_bitstream_dec(p_obj_drc->str_payload.pstr_bitstream_dec,
|
||||
p_obj_drc->pstr_bit_buf,
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_loudness_info,
|
||||
&p_obj_drc->str_bit_handler.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||
if (last_frame == 0) {
|
||||
if (p_obj_drc->str_config.bitstream_file_format !=
|
||||
BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||
err_code = impd_process_drc_bitstream_dec(
|
||||
p_obj_drc->str_payload.pstr_bitstream_dec, p_obj_drc->pstr_bit_buf,
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_loudness_info,
|
||||
&p_obj_drc->str_bit_handler
|
||||
.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||
|
||||
if (err_code > PROC_COMPLETE)
|
||||
return -1;
|
||||
if (err_code > PROC_COMPLETE) return -1;
|
||||
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||
p_obj_drc->str_bit_handler.byte_index_bs += p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs -= p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
|
||||
}
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||
p_obj_drc->str_bit_handler.byte_index_bs +=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs -=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
}
|
||||
}
|
||||
|
||||
return err_code;
|
||||
return err_code;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,333 +39,326 @@
|
|||
#include "impd_drc_hashdefines.h"
|
||||
#include "impd_drc_rom.h"
|
||||
|
||||
VOID process_qmf_syn_filt_bank(ia_drc_qmf_filt_struct *qmf_filt, FLOAT64 *buff,
|
||||
FLOAT32 *input_real, FLOAT32 *input_imag,
|
||||
FLOAT32 *output) {
|
||||
WORD32 i, j;
|
||||
FLOAT64 U[10 * QMF_NUM_FILT_BANDS];
|
||||
FLOAT64 W[10 * QMF_NUM_FILT_BANDS];
|
||||
|
||||
VOID process_qmf_syn_filt_bank(ia_drc_qmf_filt_struct *qmf_filt,
|
||||
FLOAT64 *buff,
|
||||
FLOAT32 *input_real,
|
||||
FLOAT32 *input_imag,
|
||||
FLOAT32 *output)
|
||||
{
|
||||
WORD32 i,j;
|
||||
FLOAT64 U[10 * QMF_NUM_FILT_BANDS];
|
||||
FLOAT64 W[10 * QMF_NUM_FILT_BANDS];
|
||||
FLOAT64 tmp;
|
||||
|
||||
FLOAT64 tmp;
|
||||
|
||||
for ( i=20*QMF_FILT_RESOLUTION-1; i>=2*QMF_FILT_RESOLUTION; i-- ) {
|
||||
buff[i] = buff[i-2*QMF_FILT_RESOLUTION];
|
||||
for (i = 20 * QMF_FILT_RESOLUTION - 1; i >= 2 * QMF_FILT_RESOLUTION; i--) {
|
||||
buff[i] = buff[i - 2 * QMF_FILT_RESOLUTION];
|
||||
}
|
||||
|
||||
|
||||
for ( i=0; i<2*QMF_FILT_RESOLUTION; i++ ) {
|
||||
for (i = 0; i < 2 * QMF_FILT_RESOLUTION; i++) {
|
||||
tmp = 0.0;
|
||||
for ( j=0; j<QMF_FILT_RESOLUTION; j++ ) {
|
||||
tmp = tmp
|
||||
+ input_real[j] * qmf_filt->syn_tab_real[i][j]
|
||||
- input_imag[j] * qmf_filt->syn_tab_imag[i][j];
|
||||
|
||||
for (j = 0; j < QMF_FILT_RESOLUTION; j++) {
|
||||
tmp = tmp + input_real[j] * qmf_filt->syn_tab_real[i][j] -
|
||||
input_imag[j] * qmf_filt->syn_tab_imag[i][j];
|
||||
}
|
||||
buff[i] = tmp;
|
||||
}
|
||||
|
||||
|
||||
for ( i=0; i<5; i++ ) {
|
||||
for ( j=0; j<QMF_FILT_RESOLUTION; j++ ) {
|
||||
U[2*QMF_FILT_RESOLUTION*i+j] = buff[4*QMF_FILT_RESOLUTION*i+j];
|
||||
U[2*QMF_FILT_RESOLUTION*i+QMF_FILT_RESOLUTION+j] = buff[4*QMF_FILT_RESOLUTION*i+3*QMF_FILT_RESOLUTION+j];
|
||||
for (i = 0; i < 5; i++) {
|
||||
for (j = 0; j < QMF_FILT_RESOLUTION; j++) {
|
||||
U[2 * QMF_FILT_RESOLUTION * i + j] =
|
||||
buff[4 * QMF_FILT_RESOLUTION * i + j];
|
||||
U[2 * QMF_FILT_RESOLUTION * i + QMF_FILT_RESOLUTION + j] =
|
||||
buff[4 * QMF_FILT_RESOLUTION * i + 3 * QMF_FILT_RESOLUTION + j];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for ( i=0; i<10*QMF_FILT_RESOLUTION; i++ ) {
|
||||
|
||||
W[i] = U[i] * qmf_filter_coeff[i];
|
||||
for (i = 0; i < 10 * QMF_FILT_RESOLUTION; i++) {
|
||||
W[i] = U[i] * qmf_filter_coeff[i];
|
||||
}
|
||||
|
||||
|
||||
for ( i=0; i<QMF_FILT_RESOLUTION; i++ ) {
|
||||
for (i = 0; i < QMF_FILT_RESOLUTION; i++) {
|
||||
tmp = 0.0;
|
||||
for ( j=0; j<10; j++ ) {
|
||||
tmp = tmp + W[QMF_FILT_RESOLUTION*j+i];
|
||||
for (j = 0; j < 10; j++) {
|
||||
tmp = tmp + W[QMF_FILT_RESOLUTION * j + i];
|
||||
}
|
||||
output[i] = (FLOAT32) tmp;
|
||||
output[i] = (FLOAT32)tmp;
|
||||
}
|
||||
}
|
||||
|
||||
VOID process_qmf_ana_filt_bank(ia_drc_qmf_filt_struct *qmf_filt, FLOAT64 *buff,
|
||||
FLOAT32 *input, FLOAT32 *output_real,
|
||||
FLOAT32 *output_imag) {
|
||||
WORD32 i, j;
|
||||
FLOAT32 Z[10 * QMF_NUM_FILT_BANDS];
|
||||
FLOAT32 Y[2 * QMF_NUM_FILT_BANDS];
|
||||
|
||||
VOID process_qmf_ana_filt_bank(ia_drc_qmf_filt_struct *qmf_filt,
|
||||
FLOAT64 *buff,
|
||||
FLOAT32 *input,
|
||||
FLOAT32 *output_real,
|
||||
FLOAT32 *output_imag)
|
||||
{
|
||||
WORD32 i,j;
|
||||
FLOAT32 Z[10 * QMF_NUM_FILT_BANDS];
|
||||
FLOAT32 Y[2 * QMF_NUM_FILT_BANDS];
|
||||
|
||||
for ( i=10*QMF_FILT_RESOLUTION-1; i>=QMF_FILT_RESOLUTION; i-- ) {
|
||||
buff[i] = buff[i-QMF_FILT_RESOLUTION];
|
||||
for (i = 10 * QMF_FILT_RESOLUTION - 1; i >= QMF_FILT_RESOLUTION; i--) {
|
||||
buff[i] = buff[i - QMF_FILT_RESOLUTION];
|
||||
}
|
||||
|
||||
|
||||
for ( i=QMF_FILT_RESOLUTION-1; i>=0; i-- ) {
|
||||
buff[i] = input[QMF_FILT_RESOLUTION-1-i];
|
||||
for (i = QMF_FILT_RESOLUTION - 1; i >= 0; i--) {
|
||||
buff[i] = input[QMF_FILT_RESOLUTION - 1 - i];
|
||||
}
|
||||
|
||||
|
||||
for ( i=0; i<10*QMF_FILT_RESOLUTION; i++ ) {
|
||||
|
||||
Z[i] = (FLOAT32) (buff[i] * qmf_filter_coeff[i]);
|
||||
|
||||
for (i = 0; i < 10 * QMF_FILT_RESOLUTION; i++) {
|
||||
Z[i] = (FLOAT32)(buff[i] * qmf_filter_coeff[i]);
|
||||
}
|
||||
|
||||
for ( i=0; i<2*QMF_FILT_RESOLUTION; i++ ) {
|
||||
for (i = 0; i < 2 * QMF_FILT_RESOLUTION; i++) {
|
||||
Y[i] = 0.0f;
|
||||
for ( j=0; j<5; j++ ) {
|
||||
for (j = 0; j < 5; j++) {
|
||||
Y[i] += Z[i + j * 2 * QMF_FILT_RESOLUTION];
|
||||
}
|
||||
}
|
||||
|
||||
for ( i=0; i<QMF_FILT_RESOLUTION; i++ ) {
|
||||
for (i = 0; i < QMF_FILT_RESOLUTION; i++) {
|
||||
output_real[i] = 0.0f;
|
||||
output_imag[i] = 0.0f;
|
||||
for ( j=0; j<2*QMF_FILT_RESOLUTION; j++ ) {
|
||||
output_real[i] += (FLOAT32) (Y[j] * qmf_filt->ana_tab_real[i][j]);
|
||||
output_imag[i] += (FLOAT32) (Y[j] * qmf_filt->ana_tab_imag[i][j]);
|
||||
for (j = 0; j < 2 * QMF_FILT_RESOLUTION; j++) {
|
||||
output_real[i] += (FLOAT32)(Y[j] * qmf_filt->ana_tab_real[i][j]);
|
||||
output_imag[i] += (FLOAT32)(Y[j] * qmf_filt->ana_tab_imag[i][j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static WORD32 impd_down_mix(
|
||||
ia_drc_sel_proc_output_struct *uni_drc_sel_proc_output,
|
||||
FLOAT32 **input_audio, WORD32 frame_len) {
|
||||
WORD32 num_base_ch = uni_drc_sel_proc_output->base_channel_count;
|
||||
WORD32 num_target_ch = uni_drc_sel_proc_output->target_channel_count;
|
||||
WORD32 i, i_ch, o_ch;
|
||||
FLOAT32 tmp_out[MAX_CHANNEL_COUNT];
|
||||
|
||||
if (num_target_ch > MAX_CHANNEL_COUNT) return -1;
|
||||
|
||||
if (num_target_ch > num_base_ch) return -1;
|
||||
|
||||
for (i = 0; i < frame_len; i++) {
|
||||
for (o_ch = 0; o_ch < num_target_ch; o_ch++) {
|
||||
tmp_out[o_ch] = 0.0f;
|
||||
for (i_ch = 0; i_ch < num_base_ch; i_ch++) {
|
||||
tmp_out[o_ch] += input_audio[i_ch][i] *
|
||||
uni_drc_sel_proc_output->downmix_matrix[i_ch][o_ch];
|
||||
}
|
||||
}
|
||||
for (o_ch = 0; o_ch < num_target_ch; o_ch++) {
|
||||
input_audio[o_ch][i] = tmp_out[o_ch];
|
||||
}
|
||||
for (; o_ch < num_base_ch; o_ch++) {
|
||||
input_audio[o_ch][i] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
WORD32 impd_init_process_audio_main_td_qmf(ia_drc_api_struct *p_obj_drc)
|
||||
|
||||
static WORD32 impd_down_mix ( ia_drc_sel_proc_output_struct *uni_drc_sel_proc_output, FLOAT32** input_audio, WORD32 frame_len)
|
||||
{
|
||||
WORD32 num_base_ch = uni_drc_sel_proc_output->base_channel_count;
|
||||
WORD32 num_target_ch = uni_drc_sel_proc_output->target_channel_count;
|
||||
WORD32 i, i_ch, o_ch;
|
||||
FLOAT32 tmp_out[MAX_CHANNEL_COUNT];
|
||||
|
||||
|
||||
if (num_target_ch > MAX_CHANNEL_COUNT)
|
||||
return -1;
|
||||
|
||||
if (num_target_ch > num_base_ch)
|
||||
return -1;
|
||||
|
||||
for (i=0; i<frame_len; i++) {
|
||||
for (o_ch=0; o_ch<num_target_ch; o_ch++) {
|
||||
tmp_out[o_ch] = 0.0f;
|
||||
for (i_ch=0; i_ch<num_base_ch; i_ch++) {
|
||||
tmp_out[o_ch] += input_audio[i_ch][i] * uni_drc_sel_proc_output->downmix_matrix[i_ch][o_ch];
|
||||
}
|
||||
}
|
||||
for (o_ch=0; o_ch<num_target_ch; o_ch++) {
|
||||
input_audio[o_ch][i] = tmp_out[o_ch];
|
||||
}
|
||||
for ( ; o_ch<num_base_ch; o_ch++) {
|
||||
input_audio[o_ch][i] = 0.0f;
|
||||
}
|
||||
}
|
||||
WORD32 error, i, j, num_samples_per_channel;
|
||||
FLOAT32 *input_buffer;
|
||||
WORD16 *input_buffer16, *output_buffer16;
|
||||
FLOAT32 *output_buffer;
|
||||
FLOAT32 *audio_io_buf_real[10];
|
||||
FLOAT32 *audio_io_buf_imag[10];
|
||||
FLOAT32 *audio_in_out_buf[10];
|
||||
FLOAT32 *scratch_buffer;
|
||||
WORD32 last_frame = 0;
|
||||
error = 0;
|
||||
scratch_buffer = (FLOAT32 *)p_obj_drc->pp_mem[1];
|
||||
input_buffer = (FLOAT32 *)p_obj_drc->pp_mem[2];
|
||||
output_buffer = (FLOAT32 *)p_obj_drc->pp_mem[3];
|
||||
|
||||
input_buffer16 = (WORD16 *)p_obj_drc->pp_mem[2];
|
||||
output_buffer16 = (WORD16 *)p_obj_drc->pp_mem[3];
|
||||
|
||||
if (p_obj_drc->p_state->ui_in_bytes <= 0) {
|
||||
p_obj_drc->p_state->ui_out_bytes = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ((p_obj_drc->p_state->ui_in_bytes / p_obj_drc->str_config.num_ch_in /
|
||||
(p_obj_drc->str_config.pcm_size >> 3)) <
|
||||
(UWORD32)p_obj_drc->str_config.frame_size)
|
||||
last_frame = 1;
|
||||
|
||||
|
||||
|
||||
|
||||
WORD32 impd_init_process_audio_main_td_qmf (ia_drc_api_struct *p_obj_drc)
|
||||
|
||||
{
|
||||
WORD32 error, i, j, num_samples_per_channel;
|
||||
FLOAT32 *input_buffer;
|
||||
WORD16 *input_buffer16, *output_buffer16;
|
||||
FLOAT32 *output_buffer;
|
||||
FLOAT32 *audio_io_buf_real[10];
|
||||
FLOAT32 *audio_io_buf_imag[10];
|
||||
FLOAT32 *audio_in_out_buf[10];
|
||||
FLOAT32 *scratch_buffer;
|
||||
WORD32 last_frame=0;
|
||||
error=0;
|
||||
scratch_buffer= (FLOAT32*)p_obj_drc->pp_mem[1];
|
||||
input_buffer = (FLOAT32*)p_obj_drc->pp_mem[2];
|
||||
output_buffer = (FLOAT32*)p_obj_drc->pp_mem[3];
|
||||
|
||||
input_buffer16 = (WORD16*)p_obj_drc->pp_mem[2];
|
||||
output_buffer16 = (WORD16*)p_obj_drc->pp_mem[3];
|
||||
|
||||
|
||||
if(p_obj_drc->p_state->ui_in_bytes<=0){
|
||||
p_obj_drc->p_state->ui_out_bytes=0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if((p_obj_drc->p_state->ui_in_bytes/p_obj_drc->str_config.num_ch_in/(p_obj_drc->str_config.pcm_size>>3)) < (UWORD32)p_obj_drc->str_config.frame_size)
|
||||
last_frame=1;
|
||||
|
||||
|
||||
for(i=0;i<p_obj_drc->str_config.num_ch_in;i++){
|
||||
audio_in_out_buf[i]=scratch_buffer;
|
||||
scratch_buffer=scratch_buffer+(p_obj_drc->str_config.frame_size+32);
|
||||
audio_io_buf_real[i]=scratch_buffer+(p_obj_drc->str_config.frame_size*p_obj_drc->str_config.num_ch_in+512);
|
||||
audio_io_buf_imag[i]=scratch_buffer+2*(p_obj_drc->str_config.frame_size*p_obj_drc->str_config.num_ch_in+512);;
|
||||
for(j=0;j<p_obj_drc->str_config.frame_size;j++){
|
||||
if(p_obj_drc->str_config.pcm_size==16){
|
||||
audio_in_out_buf[i][j]=((FLOAT32)input_buffer16[j*p_obj_drc->str_config.num_ch_in + i])/32767.0f;
|
||||
}
|
||||
else {
|
||||
audio_in_out_buf[i][j]=input_buffer[j*p_obj_drc->str_config.num_ch_in + i];
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_in; i++) {
|
||||
audio_in_out_buf[i] = scratch_buffer;
|
||||
scratch_buffer = scratch_buffer + (p_obj_drc->str_config.frame_size + 32);
|
||||
audio_io_buf_real[i] =
|
||||
scratch_buffer +
|
||||
(p_obj_drc->str_config.frame_size * p_obj_drc->str_config.num_ch_in +
|
||||
512);
|
||||
audio_io_buf_imag[i] = scratch_buffer +
|
||||
2 * (p_obj_drc->str_config.frame_size *
|
||||
p_obj_drc->str_config.num_ch_in +
|
||||
512);
|
||||
;
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
if (p_obj_drc->str_config.pcm_size == 16) {
|
||||
audio_in_out_buf[i][j] =
|
||||
((FLOAT32)input_buffer16[j * p_obj_drc->str_config.num_ch_in + i]) /
|
||||
32767.0f;
|
||||
} else {
|
||||
audio_in_out_buf[i][j] =
|
||||
input_buffer[j * p_obj_drc->str_config.num_ch_in + i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
error = impd_process_drc_bitstream_dec_gain(
|
||||
p_obj_drc->str_payload.pstr_bitstream_dec, p_obj_drc->pstr_bit_buf,
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain,
|
||||
&p_obj_drc->str_bit_handler
|
||||
.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||
|
||||
if (error > PROC_COMPLETE) return -1;
|
||||
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||
p_obj_drc->str_bit_handler.byte_index_bs +=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
if (p_obj_drc->str_bit_handler.gain_stream_flag ==
|
||||
0) // ITTIAM: Flag for applying gain frame by frame
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs -=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
}
|
||||
if (p_obj_drc->str_config.bitstream_file_format ==
|
||||
BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||
/* shift over fill-bits for frame byte alignment */
|
||||
if (p_obj_drc->str_bit_handler.num_bits_offset_bs != 0) {
|
||||
p_obj_drc->str_bit_handler.num_bits_read_bs =
|
||||
p_obj_drc->str_bit_handler.num_bits_read_bs + 8 -
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs + 1;
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = 0;
|
||||
p_obj_drc->str_bit_handler.byte_index_bs =
|
||||
p_obj_drc->str_bit_handler.byte_index_bs + 1;
|
||||
if (p_obj_drc->str_bit_handler.gain_stream_flag ==
|
||||
0) // ITTIAM: Flag for applying gain frame by frame
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs =
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_in; i++) {
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j += 64) {
|
||||
process_qmf_ana_filt_bank(
|
||||
p_obj_drc->str_payload.pstr_qmf_filter,
|
||||
p_obj_drc->str_payload.pstr_qmf_filter->ana_buff +
|
||||
i * 4 * p_obj_drc->str_config.frame_size,
|
||||
&(audio_in_out_buf[i][j]), &(audio_io_buf_real[i][j]),
|
||||
&(audio_io_buf_imag[i][j]));
|
||||
}
|
||||
}
|
||||
error = impd_drc_process_freq_domain(
|
||||
p_obj_drc->str_payload.pstr_gain_dec[0],
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain, audio_io_buf_real,
|
||||
audio_io_buf_imag, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->drc_characteristic_target);
|
||||
|
||||
error = impd_process_drc_bitstream_dec_gain(p_obj_drc->str_payload.pstr_bitstream_dec,
|
||||
p_obj_drc->pstr_bit_buf,
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain,
|
||||
&p_obj_drc->str_bit_handler.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||
if (error) return error;
|
||||
|
||||
if (p_obj_drc->str_payload.pstr_drc_sel_proc_output->target_channel_count <
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->base_channel_count) {
|
||||
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||
audio_io_buf_real, p_obj_drc->str_config.frame_size);
|
||||
if (error) return error;
|
||||
|
||||
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||
audio_io_buf_imag, p_obj_drc->str_config.frame_size);
|
||||
if (error) return error;
|
||||
}
|
||||
|
||||
error = impd_drc_process_freq_domain(
|
||||
p_obj_drc->str_payload.pstr_gain_dec[1],
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain, audio_io_buf_real,
|
||||
audio_io_buf_imag, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->drc_characteristic_target);
|
||||
if (error) return -1;
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j += 64) {
|
||||
process_qmf_syn_filt_bank(
|
||||
p_obj_drc->str_payload.pstr_qmf_filter,
|
||||
p_obj_drc->str_payload.pstr_qmf_filter->syn_buff +
|
||||
i * 4 * p_obj_drc->str_config.frame_size,
|
||||
&(audio_io_buf_real[i][j]), &(audio_io_buf_imag[i][j]),
|
||||
&(audio_in_out_buf[i][j]));
|
||||
}
|
||||
}
|
||||
|
||||
if (p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db != 0.0f) {
|
||||
FLOAT32 loudness_normalization_gain =
|
||||
(FLOAT32)pow(10.0, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db /
|
||||
20.0);
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
audio_io_buf_real[i][j] *= loudness_normalization_gain;
|
||||
audio_io_buf_imag[i][j] *= loudness_normalization_gain;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
num_samples_per_channel = p_obj_drc->str_config.frame_size;
|
||||
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
if (p_obj_drc->str_config.pcm_size == 16) {
|
||||
output_buffer16[j * p_obj_drc->str_config.num_ch_out + i] =
|
||||
(WORD16)(audio_in_out_buf[i][j] * 32767.0f);
|
||||
} else {
|
||||
output_buffer[j * p_obj_drc->str_config.num_ch_out + i] =
|
||||
audio_in_out_buf[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
p_obj_drc->p_state->ui_out_bytes =
|
||||
p_obj_drc->str_config.num_ch_out *
|
||||
(p_obj_drc->p_state->ui_in_bytes / p_obj_drc->str_config.num_ch_in);
|
||||
|
||||
if (p_obj_drc->str_config.bitstream_file_format !=
|
||||
BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||
error = impd_process_drc_bitstream_dec(
|
||||
p_obj_drc->str_payload.pstr_bitstream_dec, p_obj_drc->pstr_bit_buf,
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_loudness_info,
|
||||
&p_obj_drc->str_bit_handler
|
||||
.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||
|
||||
if (error > PROC_COMPLETE) return -1;
|
||||
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||
p_obj_drc->str_bit_handler.byte_index_bs += p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
if(p_obj_drc->str_bit_handler.gain_stream_flag==0) //ITTIAM: Flag for applying gain frame by frame
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs -= p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
}
|
||||
if (p_obj_drc->str_config.bitstream_file_format == BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||
/* shift over fill-bits for frame byte alignment */
|
||||
if (p_obj_drc->str_bit_handler.num_bits_offset_bs != 0)
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bits_read_bs = p_obj_drc->str_bit_handler.num_bits_read_bs + 8 - p_obj_drc->str_bit_handler.num_bits_offset_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs = p_obj_drc->str_bit_handler.num_bytes_read_bs + 1;
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = 0;
|
||||
p_obj_drc->str_bit_handler.byte_index_bs = p_obj_drc->str_bit_handler.byte_index_bs + 1;
|
||||
if(p_obj_drc->str_bit_handler.gain_stream_flag==0) //ITTIAM: Flag for applying gain frame by frame
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs = p_obj_drc->str_bit_handler.num_bytes_bs - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i < p_obj_drc->str_config.num_ch_in; i++) {
|
||||
for (j=0; j < p_obj_drc->str_config.frame_size; j += 64) {
|
||||
|
||||
process_qmf_ana_filt_bank(p_obj_drc->str_payload.pstr_qmf_filter,
|
||||
p_obj_drc->str_payload.pstr_qmf_filter->ana_buff+i*4*p_obj_drc->str_config.frame_size,
|
||||
&(audio_in_out_buf[i][j]),
|
||||
&(audio_io_buf_real[i][j]),
|
||||
&(audio_io_buf_imag[i][j]));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
error = impd_drc_process_freq_domain(p_obj_drc->str_payload.pstr_gain_dec[0],
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain,
|
||||
audio_io_buf_real,
|
||||
audio_io_buf_imag,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->drc_characteristic_target);
|
||||
|
||||
|
||||
if (error) return error;
|
||||
|
||||
if(p_obj_drc->str_payload.pstr_drc_sel_proc_output->target_channel_count<p_obj_drc->str_payload.pstr_drc_sel_proc_output->base_channel_count){
|
||||
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||
audio_io_buf_real,
|
||||
p_obj_drc->str_config.frame_size);
|
||||
if (error) return error;
|
||||
|
||||
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||
audio_io_buf_imag,
|
||||
p_obj_drc->str_config.frame_size);
|
||||
if (error) return error;
|
||||
}
|
||||
|
||||
error = impd_drc_process_freq_domain(p_obj_drc->str_payload.pstr_gain_dec[1],
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain,
|
||||
audio_io_buf_real,
|
||||
audio_io_buf_imag,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->drc_characteristic_target);
|
||||
if (error) return -1;
|
||||
for (i=0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j=0; j < p_obj_drc->str_config.frame_size; j += 64) {
|
||||
|
||||
process_qmf_syn_filt_bank(p_obj_drc->str_payload.pstr_qmf_filter,
|
||||
p_obj_drc->str_payload.pstr_qmf_filter->syn_buff+i*4*p_obj_drc->str_config.frame_size,
|
||||
&(audio_io_buf_real[i][j]),
|
||||
&(audio_io_buf_imag[i][j]),
|
||||
&(audio_in_out_buf[i][j]));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db != 0.0f)
|
||||
{
|
||||
FLOAT32 loudness_normalization_gain = (FLOAT32)pow(10.0,p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db/20.0);
|
||||
for (i=0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j=0; j <p_obj_drc->str_config. frame_size; j++) {
|
||||
audio_io_buf_real[i][j] *= loudness_normalization_gain;
|
||||
audio_io_buf_imag[i][j] *= loudness_normalization_gain;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
num_samples_per_channel = p_obj_drc->str_config.frame_size;
|
||||
|
||||
for (i=0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j=0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
if(p_obj_drc->str_config.pcm_size==16){
|
||||
output_buffer16[j*p_obj_drc->str_config.num_ch_out + i] = (WORD16)(audio_in_out_buf[i][j]*32767.0f);
|
||||
}
|
||||
else {
|
||||
output_buffer[j*p_obj_drc->str_config.num_ch_out + i] = audio_in_out_buf[i][j];
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
p_obj_drc->p_state->ui_out_bytes=p_obj_drc->str_config.num_ch_out*(p_obj_drc->p_state->ui_in_bytes/p_obj_drc->str_config.num_ch_in);
|
||||
|
||||
if (p_obj_drc->str_config.bitstream_file_format != BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||
error = impd_process_drc_bitstream_dec(p_obj_drc->str_payload.pstr_bitstream_dec,
|
||||
p_obj_drc->pstr_bit_buf,
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_loudness_info,
|
||||
&p_obj_drc->str_bit_handler.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||
|
||||
if (error > PROC_COMPLETE)
|
||||
return -1;
|
||||
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||
p_obj_drc->str_bit_handler.byte_index_bs += p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs -= p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||
p_obj_drc->str_bit_handler.byte_index_bs +=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs -=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,51 +20,45 @@
|
|||
#ifndef IMPD_DRC_MULTI_BAND_H
|
||||
#define IMPD_DRC_MULTI_BAND_H
|
||||
|
||||
#define DRC_SUBBAND_COUNT_WITH_AUDIO_CODEC_FILTERBANK_MAX FILTER_BANK_PARAMETER_COUNT
|
||||
#define DRC_SUBBAND_COUNT_WITH_AUDIO_CODEC_FILTERBANK_MAX \
|
||||
FILTER_BANK_PARAMETER_COUNT
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
FLOAT32 overlap_weight[AUDIO_CODEC_SUBBAND_COUNT_MAX];
|
||||
FLOAT32 overlap_weight[AUDIO_CODEC_SUBBAND_COUNT_MAX];
|
||||
} ia_band_overlap_params_struct;
|
||||
|
||||
typedef struct {
|
||||
ia_band_overlap_params_struct str_band_overlap_params[BAND_COUNT_MAX];
|
||||
ia_band_overlap_params_struct str_band_overlap_params[BAND_COUNT_MAX];
|
||||
} ia_group_overlap_params_struct;
|
||||
|
||||
typedef struct {
|
||||
ia_group_overlap_params_struct str_group_overlap_params[CHANNEL_GROUP_COUNT_MAX];
|
||||
ia_group_overlap_params_struct
|
||||
str_group_overlap_params[CHANNEL_GROUP_COUNT_MAX];
|
||||
} ia_overlap_params_struct;
|
||||
|
||||
|
||||
WORD32
|
||||
impd_fcenter_norm_sb_init(WORD32 num_subbands, FLOAT32* fcenter_norm_subband);
|
||||
|
||||
WORD32
|
||||
impd_fcenter_norm_sb_init(WORD32 num_subbands,
|
||||
FLOAT32* fcenter_norm_subband);
|
||||
impd_generate_slope(WORD32 num_subbands, FLOAT32* fcenter_norm_subband,
|
||||
FLOAT32 fcross_norm_lo, FLOAT32 fcross_norm_hi,
|
||||
FLOAT32* response);
|
||||
|
||||
WORD32
|
||||
impd_generate_slope (WORD32 num_subbands,
|
||||
FLOAT32* fcenter_norm_subband,
|
||||
FLOAT32 fcross_norm_lo,
|
||||
FLOAT32 fcross_norm_hi,
|
||||
FLOAT32* response);
|
||||
impd_generate_overlap_weights(
|
||||
WORD32 num_drc_bands, WORD32 drc_band_type,
|
||||
ia_gain_params_struct* gain_params, WORD32 dec_subband_count,
|
||||
ia_group_overlap_params_struct* pstr_group_overlap_params);
|
||||
|
||||
WORD32
|
||||
impd_generate_overlap_weights (WORD32 num_drc_bands,
|
||||
WORD32 drc_band_type,
|
||||
ia_gain_params_struct* gain_params,
|
||||
WORD32 dec_subband_count,
|
||||
ia_group_overlap_params_struct* pstr_group_overlap_params);
|
||||
|
||||
WORD32
|
||||
impd_init_overlap_weight ( ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc,
|
||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||
WORD32 sub_band_domain_mode,
|
||||
ia_overlap_params_struct* pstr_overlap_params);
|
||||
|
||||
impd_init_overlap_weight(
|
||||
ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc,
|
||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||
WORD32 sub_band_domain_mode, ia_overlap_params_struct* pstr_overlap_params);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,157 +30,139 @@
|
|||
#include "impd_drc_rom.h"
|
||||
|
||||
IA_ERRORCODE impd_fcenter_norm_sb_init(WORD32 num_subbands,
|
||||
FLOAT32* fcenter_norm_subband)
|
||||
{
|
||||
WORD32 s;
|
||||
for (s=0; s<num_subbands; s++) {
|
||||
fcenter_norm_subband[s] = (s + 0.5f) / (2.0f * num_subbands);
|
||||
}
|
||||
return (0);
|
||||
FLOAT32* fcenter_norm_subband) {
|
||||
WORD32 s;
|
||||
for (s = 0; s < num_subbands; s++) {
|
||||
fcenter_norm_subband[s] = (s + 0.5f) / (2.0f * num_subbands);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
IA_ERRORCODE impd_generate_slope (WORD32 num_sub_bands,
|
||||
FLOAT32* fcenter_norm_subband,
|
||||
FLOAT32 fcross_norm_lo,
|
||||
FLOAT32 fcross_norm_hi,
|
||||
FLOAT32* response)
|
||||
{
|
||||
WORD32 i;
|
||||
FLOAT32 filter_slope =-24.0f;
|
||||
FLOAT32 inv_log10_2 =3.32192809f;
|
||||
FLOAT32 norm = 0.05f * filter_slope * inv_log10_2;
|
||||
IA_ERRORCODE impd_generate_slope(WORD32 num_sub_bands,
|
||||
FLOAT32* fcenter_norm_subband,
|
||||
FLOAT32 fcross_norm_lo, FLOAT32 fcross_norm_hi,
|
||||
FLOAT32* response) {
|
||||
WORD32 i;
|
||||
FLOAT32 filter_slope = -24.0f;
|
||||
FLOAT32 inv_log10_2 = 3.32192809f;
|
||||
FLOAT32 norm = 0.05f * filter_slope * inv_log10_2;
|
||||
|
||||
for (i=0; i<num_sub_bands; i++)
|
||||
{
|
||||
if (fcenter_norm_subband[i] < fcross_norm_lo)
|
||||
{
|
||||
response[i] = (FLOAT32)pow (10.0, norm * log10(fcross_norm_lo / fcenter_norm_subband[i]));
|
||||
}
|
||||
else if (fcenter_norm_subband[i] < fcross_norm_hi)
|
||||
{
|
||||
response[i] = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
response[i] = (FLOAT32)pow (10.0, norm * log10(fcenter_norm_subband[i] / fcross_norm_hi));
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
IA_ERRORCODE impd_generate_overlap_weights (WORD32 num_drc_bands,
|
||||
WORD32 drc_band_type,
|
||||
ia_gain_params_struct* gain_params,
|
||||
WORD32 dec_subband_count,
|
||||
ia_group_overlap_params_struct* pstr_group_overlap_params)
|
||||
{
|
||||
FLOAT32 fcenter_norm_subband[AUDIO_CODEC_SUBBAND_COUNT_MAX];
|
||||
FLOAT32 w_norm[AUDIO_CODEC_SUBBAND_COUNT_MAX];
|
||||
FLOAT32 fcross_norm_lo, fcross_norm_hi;
|
||||
WORD32 err, b, s, start_subband_index = 0, stop_sub_band_index = 0;
|
||||
err = impd_fcenter_norm_sb_init(dec_subband_count, fcenter_norm_subband);
|
||||
|
||||
if (drc_band_type == 1) {
|
||||
fcross_norm_lo = 0.0f;
|
||||
for (b=0; b<num_drc_bands; b++)
|
||||
{
|
||||
if (b<num_drc_bands - 1)
|
||||
{
|
||||
fcross_norm_hi = normal_cross_freq[gain_params[b+1].crossover_freq_idx].f_cross_norm;
|
||||
}
|
||||
else
|
||||
{
|
||||
fcross_norm_hi = 0.5f;
|
||||
}
|
||||
impd_generate_slope (dec_subband_count,
|
||||
fcenter_norm_subband,
|
||||
fcross_norm_lo,
|
||||
fcross_norm_hi,
|
||||
pstr_group_overlap_params->str_band_overlap_params[b].overlap_weight);
|
||||
|
||||
fcross_norm_lo = fcross_norm_hi;
|
||||
}
|
||||
for (s=0; s<dec_subband_count; s++)
|
||||
{
|
||||
w_norm[s] = pstr_group_overlap_params->str_band_overlap_params[0].overlap_weight[s];
|
||||
for (b=1; b<num_drc_bands; b++)
|
||||
{
|
||||
w_norm[s] += pstr_group_overlap_params->str_band_overlap_params[b].overlap_weight[s];
|
||||
}
|
||||
}
|
||||
|
||||
for (s=0; s<dec_subband_count; s++)
|
||||
{
|
||||
for (b=0; b<num_drc_bands; b++)
|
||||
{
|
||||
pstr_group_overlap_params->str_band_overlap_params[b].overlap_weight[s] /= w_norm[s];
|
||||
}
|
||||
}
|
||||
for (i = 0; i < num_sub_bands; i++) {
|
||||
if (fcenter_norm_subband[i] < fcross_norm_lo) {
|
||||
response[i] = (FLOAT32)pow(
|
||||
10.0, norm * log10(fcross_norm_lo / fcenter_norm_subband[i]));
|
||||
} else if (fcenter_norm_subband[i] < fcross_norm_hi) {
|
||||
response[i] = 1.0f;
|
||||
} else {
|
||||
start_subband_index = 0;
|
||||
for (b=0; b<num_drc_bands; b++)
|
||||
{
|
||||
if (b < num_drc_bands-1)
|
||||
{
|
||||
stop_sub_band_index = gain_params[b+1].start_subband_index-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
stop_sub_band_index = dec_subband_count-1;
|
||||
}
|
||||
for (s=0; s<dec_subband_count; s++)
|
||||
{
|
||||
if (s >= start_subband_index && s <= stop_sub_band_index)
|
||||
{
|
||||
pstr_group_overlap_params->str_band_overlap_params[b].overlap_weight[s] = 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
pstr_group_overlap_params->str_band_overlap_params[b].overlap_weight[s] = 0.0;
|
||||
}
|
||||
}
|
||||
start_subband_index = stop_sub_band_index+1;
|
||||
}
|
||||
response[i] = (FLOAT32)pow(
|
||||
10.0, norm * log10(fcenter_norm_subband[i] / fcross_norm_hi));
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
IA_ERRORCODE impd_init_overlap_weight ( ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc,
|
||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||
WORD32 sub_band_domain_mode,
|
||||
ia_overlap_params_struct* pstr_overlap_params)
|
||||
{
|
||||
WORD32 err = 0, g;
|
||||
WORD32 dec_subband_count = 0;
|
||||
switch (sub_band_domain_mode) {
|
||||
case SUBBAND_DOMAIN_MODE_QMF64:
|
||||
dec_subband_count = AUDIO_CODEC_SUBBAND_COUNT_QMF64;
|
||||
break;
|
||||
case SUBBAND_DOMAIN_MODE_QMF71:
|
||||
dec_subband_count = AUDIO_CODEC_SUBBAND_COUNT_QMF71;
|
||||
break;
|
||||
case SUBBAND_DOMAIN_MODE_STFT256:
|
||||
dec_subband_count = AUDIO_CODEC_SUBBAND_COUNT_STFT256;
|
||||
break;
|
||||
IA_ERRORCODE impd_generate_overlap_weights(
|
||||
WORD32 num_drc_bands, WORD32 drc_band_type,
|
||||
ia_gain_params_struct* gain_params, WORD32 dec_subband_count,
|
||||
ia_group_overlap_params_struct* pstr_group_overlap_params) {
|
||||
FLOAT32 fcenter_norm_subband[AUDIO_CODEC_SUBBAND_COUNT_MAX];
|
||||
FLOAT32 w_norm[AUDIO_CODEC_SUBBAND_COUNT_MAX];
|
||||
FLOAT32 fcross_norm_lo, fcross_norm_hi;
|
||||
WORD32 err, b, s, start_subband_index = 0, stop_sub_band_index = 0;
|
||||
err = impd_fcenter_norm_sb_init(dec_subband_count, fcenter_norm_subband);
|
||||
|
||||
if (drc_band_type == 1) {
|
||||
fcross_norm_lo = 0.0f;
|
||||
for (b = 0; b < num_drc_bands; b++) {
|
||||
if (b < num_drc_bands - 1) {
|
||||
fcross_norm_hi =
|
||||
normal_cross_freq[gain_params[b + 1].crossover_freq_idx]
|
||||
.f_cross_norm;
|
||||
} else {
|
||||
fcross_norm_hi = 0.5f;
|
||||
}
|
||||
impd_generate_slope(
|
||||
dec_subband_count, fcenter_norm_subband, fcross_norm_lo,
|
||||
fcross_norm_hi,
|
||||
pstr_group_overlap_params->str_band_overlap_params[b].overlap_weight);
|
||||
|
||||
fcross_norm_lo = fcross_norm_hi;
|
||||
}
|
||||
for (s = 0; s < dec_subband_count; s++) {
|
||||
w_norm[s] = pstr_group_overlap_params->str_band_overlap_params[0]
|
||||
.overlap_weight[s];
|
||||
for (b = 1; b < num_drc_bands; b++) {
|
||||
w_norm[s] += pstr_group_overlap_params->str_band_overlap_params[b]
|
||||
.overlap_weight[s];
|
||||
}
|
||||
}
|
||||
|
||||
for (g=0; g<str_drc_instruction_str->num_drc_ch_groups; g++)
|
||||
{
|
||||
if (str_drc_instruction_str->band_count_of_ch_group[g] > 1)
|
||||
{
|
||||
err = impd_generate_overlap_weights(str_drc_instruction_str->band_count_of_ch_group[g],
|
||||
str_p_loc_drc_coefficients_uni_drc->gain_set_params[str_drc_instruction_str->gain_set_index_for_channel_group[g]].drc_band_type,
|
||||
str_p_loc_drc_coefficients_uni_drc->gain_set_params[str_drc_instruction_str->gain_set_index_for_channel_group[g]].gain_params,
|
||||
dec_subband_count,
|
||||
&(pstr_overlap_params->str_group_overlap_params[g]));
|
||||
if (err) return (err);
|
||||
for (s = 0; s < dec_subband_count; s++) {
|
||||
for (b = 0; b < num_drc_bands; b++) {
|
||||
pstr_group_overlap_params->str_band_overlap_params[b]
|
||||
.overlap_weight[s] /= w_norm[s];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
start_subband_index = 0;
|
||||
for (b = 0; b < num_drc_bands; b++) {
|
||||
if (b < num_drc_bands - 1) {
|
||||
stop_sub_band_index = gain_params[b + 1].start_subband_index - 1;
|
||||
} else {
|
||||
stop_sub_band_index = dec_subband_count - 1;
|
||||
}
|
||||
for (s = 0; s < dec_subband_count; s++) {
|
||||
if (s >= start_subband_index && s <= stop_sub_band_index) {
|
||||
pstr_group_overlap_params->str_band_overlap_params[b]
|
||||
.overlap_weight[s] = 1.0;
|
||||
} else {
|
||||
pstr_group_overlap_params->str_band_overlap_params[b]
|
||||
.overlap_weight[s] = 0.0;
|
||||
}
|
||||
}
|
||||
start_subband_index = stop_sub_band_index + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
IA_ERRORCODE impd_init_overlap_weight(
|
||||
ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc,
|
||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||
WORD32 sub_band_domain_mode,
|
||||
ia_overlap_params_struct* pstr_overlap_params) {
|
||||
WORD32 err = 0, g;
|
||||
WORD32 dec_subband_count = 0;
|
||||
switch (sub_band_domain_mode) {
|
||||
case SUBBAND_DOMAIN_MODE_QMF64:
|
||||
dec_subband_count = AUDIO_CODEC_SUBBAND_COUNT_QMF64;
|
||||
break;
|
||||
case SUBBAND_DOMAIN_MODE_QMF71:
|
||||
dec_subband_count = AUDIO_CODEC_SUBBAND_COUNT_QMF71;
|
||||
break;
|
||||
case SUBBAND_DOMAIN_MODE_STFT256:
|
||||
dec_subband_count = AUDIO_CODEC_SUBBAND_COUNT_STFT256;
|
||||
break;
|
||||
}
|
||||
|
||||
for (g = 0; g < str_drc_instruction_str->num_drc_ch_groups; g++) {
|
||||
if (str_drc_instruction_str->band_count_of_ch_group[g] > 1) {
|
||||
err = impd_generate_overlap_weights(
|
||||
str_drc_instruction_str->band_count_of_ch_group[g],
|
||||
str_p_loc_drc_coefficients_uni_drc
|
||||
->gain_set_params[str_drc_instruction_str
|
||||
->gain_set_index_for_channel_group[g]]
|
||||
.drc_band_type,
|
||||
str_p_loc_drc_coefficients_uni_drc
|
||||
->gain_set_params[str_drc_instruction_str
|
||||
->gain_set_index_for_channel_group[g]]
|
||||
.gain_params,
|
||||
dec_subband_count,
|
||||
&(pstr_overlap_params->str_group_overlap_params[g]));
|
||||
if (err) return (err);
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -22,88 +22,80 @@
|
|||
|
||||
WORD32
|
||||
impd_dec_ducking_scaling(ia_bit_buf_struct* it_bit_buff,
|
||||
WORD32* ducking_scaling_flag,
|
||||
FLOAT32* ducking_scaling);
|
||||
WORD32* ducking_scaling_flag,
|
||||
FLOAT32* ducking_scaling);
|
||||
|
||||
WORD32
|
||||
impd_parse_loudness_info(ia_bit_buf_struct* it_bit_buff,
|
||||
WORD32 version,
|
||||
ia_loudness_info_struct* loudness_info);
|
||||
|
||||
impd_parse_loudness_info(ia_bit_buf_struct* it_bit_buff, WORD32 version,
|
||||
ia_loudness_info_struct* loudness_info);
|
||||
|
||||
WORD32
|
||||
impd_parse_loudness_info_set_ext(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_loudness_info_set_struct* loudness_info_set);
|
||||
impd_parse_loudness_info_set_ext(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_loudness_info_set_struct* loudness_info_set);
|
||||
|
||||
WORD32
|
||||
impd_sel_drc_coeff(ia_drc_config* drc_config,
|
||||
WORD32 location,
|
||||
ia_uni_drc_coeffs_struct** str_p_loc_drc_coefficients_uni_drc);
|
||||
impd_sel_drc_coeff(
|
||||
ia_drc_config* drc_config, WORD32 location,
|
||||
ia_uni_drc_coeffs_struct** str_p_loc_drc_coefficients_uni_drc);
|
||||
|
||||
WORD32
|
||||
impd_drc_parse_instructions_basic(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_instructions_basic_struct* str_drc_instructions_basic);
|
||||
impd_drc_parse_instructions_basic(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_instructions_basic_struct* str_drc_instructions_basic);
|
||||
|
||||
WORD32
|
||||
impd_parse_drc_instructions_uni_drc(ia_bit_buf_struct* it_bit_buff,
|
||||
WORD32 version,
|
||||
ia_drc_config* drc_config,
|
||||
ia_drc_instructions_struct* str_drc_instruction_str);
|
||||
|
||||
impd_parse_drc_instructions_uni_drc(
|
||||
ia_bit_buf_struct* it_bit_buff, WORD32 version, ia_drc_config* drc_config,
|
||||
ia_drc_instructions_struct* str_drc_instruction_str);
|
||||
|
||||
WORD32
|
||||
impd_parse_gain_set_params(ia_bit_buf_struct* it_bit_buff,
|
||||
WORD32 version,
|
||||
WORD32* gain_seq_idx,
|
||||
ia_gain_set_params_struct* gain_set_params);
|
||||
impd_parse_gain_set_params(ia_bit_buf_struct* it_bit_buff, WORD32 version,
|
||||
WORD32* gain_seq_idx,
|
||||
ia_gain_set_params_struct* gain_set_params);
|
||||
|
||||
WORD32
|
||||
impd_drc_parse_coeff(ia_bit_buf_struct* it_bit_buff,
|
||||
WORD32 version,
|
||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||
ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc);
|
||||
impd_drc_parse_coeff(
|
||||
ia_bit_buf_struct* it_bit_buff, WORD32 version,
|
||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||
ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc);
|
||||
|
||||
WORD32
|
||||
impd_parse_dwnmix_instructions(ia_bit_buf_struct* it_bit_buff,
|
||||
WORD32 version,
|
||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||
ia_channel_layout_struct* channel_layout,
|
||||
ia_downmix_instructions_struct* dwnmix_instructions);
|
||||
impd_parse_dwnmix_instructions(
|
||||
ia_bit_buf_struct* it_bit_buff, WORD32 version,
|
||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||
ia_channel_layout_struct* channel_layout,
|
||||
ia_downmix_instructions_struct* dwnmix_instructions);
|
||||
|
||||
WORD32
|
||||
impd_parse_drc_ext_v1(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||
ia_drc_config* drc_config,
|
||||
ia_drc_config_ext* str_drc_config_ext);
|
||||
impd_parse_drc_ext_v1(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||
ia_drc_config* drc_config,
|
||||
ia_drc_config_ext* str_drc_config_ext);
|
||||
|
||||
WORD32
|
||||
impd_parse_drc_config(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||
ia_drc_config* drc_config
|
||||
);
|
||||
impd_parse_drc_config(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||
ia_drc_config* drc_config);
|
||||
|
||||
WORD32
|
||||
impd_parse_loudness_info_set(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_loudness_info_set_struct* loudness_info_set);
|
||||
impd_parse_loudness_info_set(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_loudness_info_set_struct* loudness_info_set);
|
||||
|
||||
WORD32
|
||||
impd_parse_drc_gain_sequence(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_bits_dec_struct *pstr_drc_uni_bs_dec,
|
||||
ia_gain_set_params_struct* gain_set_params,
|
||||
ia_drc_gain_sequence_struct* drc_gain_sequence);
|
||||
impd_parse_drc_gain_sequence(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_bits_dec_struct* pstr_drc_uni_bs_dec,
|
||||
ia_gain_set_params_struct* gain_set_params,
|
||||
ia_drc_gain_sequence_struct* drc_gain_sequence);
|
||||
|
||||
WORD32
|
||||
impd_parse_uni_drc_gain_ext(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_uni_drc_gain_ext_struct* uni_drc_gain_ext);
|
||||
|
||||
WORD32 impd_drc_uni_gain_read(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_bits_dec_struct *pstr_drc_uni_bs_dec,
|
||||
ia_drc_config* drc_config,
|
||||
ia_drc_gain_struct* pstr_uni_drc_gain);
|
||||
ia_uni_drc_gain_ext_struct* uni_drc_gain_ext);
|
||||
|
||||
WORD32 impd_drc_uni_gain_read(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_bits_dec_struct* pstr_drc_uni_bs_dec,
|
||||
ia_drc_config* drc_config,
|
||||
ia_drc_gain_struct* pstr_uni_drc_gain);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -21,36 +21,41 @@
|
|||
#define IMPD_DRC_PARSER_INTERFACE_H
|
||||
|
||||
WORD32
|
||||
impd_unidrc_interface_signature_read(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_uni_interface_signat_struct* drc_uni_interface_signature);
|
||||
impd_unidrc_interface_signature_read(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_uni_interface_signat_struct* drc_uni_interface_signature);
|
||||
|
||||
WORD32
|
||||
impd_sys_interface_read(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_system_interface_struct* system_interface);
|
||||
ia_system_interface_struct* system_interface);
|
||||
|
||||
WORD32
|
||||
impd_loudness_norm_control_interface_read(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_loudness_norm_ctrl_interface_struct* loudness_norm_ctrl_interface);
|
||||
impd_loudness_norm_control_interface_read(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_loudness_norm_ctrl_interface_struct* loudness_norm_ctrl_interface);
|
||||
|
||||
WORD32
|
||||
impd_loudness_norm_param_interface_read(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_loudness_norm_parameter_interface_struct* loudness_norm_param_interface);
|
||||
impd_loudness_norm_param_interface_read(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_loudness_norm_parameter_interface_struct* loudness_norm_param_interface);
|
||||
|
||||
WORD32
|
||||
impd_drc_interface_read(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_dyn_rng_ctrl_interface_struct* drc_ctrl_interface);
|
||||
ia_dyn_rng_ctrl_interface_struct* drc_ctrl_interface);
|
||||
|
||||
WORD32
|
||||
impd_drc_param_interface_read(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_parameter_interface_struct* drc_parameter_interface);
|
||||
impd_drc_param_interface_read(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_parameter_interface_struct* drc_parameter_interface);
|
||||
|
||||
WORD32
|
||||
impd_unidrc_interface_extension_read(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_interface_struct* impd_drc_uni_interface,
|
||||
ia_drc_uni_interface_ext_struct* drc_uni_interface_ext);
|
||||
impd_unidrc_interface_extension_read(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_interface_struct* impd_drc_uni_interface,
|
||||
ia_drc_uni_interface_ext_struct* drc_uni_interface_ext);
|
||||
|
||||
WORD32
|
||||
impd_unidrc_interface_read(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_interface_struct* impd_drc_uni_interface);
|
||||
ia_drc_interface_struct* impd_drc_uni_interface);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -26,168 +26,156 @@
|
|||
#include "impd_drc_peak_limiter.h"
|
||||
|
||||
#ifndef max
|
||||
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef min
|
||||
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
WORD32 impd_peak_limiter_init(ia_drc_peak_limiter_struct *peak_limiter,
|
||||
FLOAT32 attack_time, FLOAT32 release_time,
|
||||
FLOAT32 limit_threshold, UWORD32 num_channels,
|
||||
UWORD32 sample_rate, FLOAT32 *buffer) {
|
||||
UWORD32 attack;
|
||||
attack = (UWORD32)(attack_time * sample_rate / 1000);
|
||||
|
||||
if (attack < 1) return 0;
|
||||
|
||||
WORD32 impd_peak_limiter_init( ia_drc_peak_limiter_struct *peak_limiter,
|
||||
FLOAT32 attack_time,
|
||||
FLOAT32 release_time,
|
||||
FLOAT32 limit_threshold,
|
||||
UWORD32 num_channels,
|
||||
UWORD32 sample_rate,
|
||||
FLOAT32 *buffer
|
||||
)
|
||||
{
|
||||
peak_limiter->max_buf = buffer;
|
||||
peak_limiter->delayed_input = buffer + attack * 4 + 32;
|
||||
|
||||
UWORD32 attack;
|
||||
attack = (UWORD32)(attack_time * sample_rate / 1000);
|
||||
peak_limiter->delayed_input_index = 0;
|
||||
peak_limiter->attack_time = attack_time;
|
||||
peak_limiter->release_time = release_time;
|
||||
peak_limiter->attack_time_samples = attack;
|
||||
peak_limiter->attack_constant = (FLOAT32)pow(0.1, 1.0 / (attack + 1));
|
||||
peak_limiter->release_constant =
|
||||
(FLOAT32)pow(0.1, 1.0 / (release_time * sample_rate / 1000 + 1));
|
||||
peak_limiter->limit_threshold = limit_threshold;
|
||||
peak_limiter->num_channels = num_channels;
|
||||
peak_limiter->sample_rate = sample_rate;
|
||||
peak_limiter->min_gain = 1.0f;
|
||||
peak_limiter->limiter_on = 1;
|
||||
peak_limiter->pre_smoothed_gain = 1.0f;
|
||||
peak_limiter->gain_modified = 1.0f;
|
||||
|
||||
if (attack < 1)
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
peak_limiter->max_buf=buffer;
|
||||
peak_limiter->delayed_input=buffer+attack*4+32;
|
||||
|
||||
peak_limiter->delayed_input_index = 0;
|
||||
peak_limiter->attack_time = attack_time;
|
||||
peak_limiter->release_time = release_time;
|
||||
peak_limiter->attack_time_samples = attack;
|
||||
peak_limiter->attack_constant = (FLOAT32)pow(0.1, 1.0 / (attack + 1));
|
||||
peak_limiter->release_constant = (FLOAT32)pow(0.1, 1.0 / (release_time * sample_rate / 1000 + 1));
|
||||
peak_limiter->limit_threshold = limit_threshold;
|
||||
peak_limiter->num_channels = num_channels;
|
||||
peak_limiter->sample_rate = sample_rate;
|
||||
WORD32 impd_peak_limiter_reinit(ia_drc_peak_limiter_struct *peak_limiter) {
|
||||
if (peak_limiter) {
|
||||
peak_limiter->delayed_input_index = 0;
|
||||
peak_limiter->pre_smoothed_gain = 1.0f;
|
||||
peak_limiter->gain_modified = 1.0f;
|
||||
peak_limiter->min_gain = 1.0f;
|
||||
peak_limiter->limiter_on=1;
|
||||
peak_limiter->pre_smoothed_gain=1.0f;
|
||||
peak_limiter->gain_modified=1.0f;
|
||||
memset(peak_limiter->max_buf, 0,
|
||||
(peak_limiter->attack_time_samples + 1) * sizeof(FLOAT32));
|
||||
memset(peak_limiter->delayed_input, 0, peak_limiter->attack_time_samples *
|
||||
peak_limiter->num_channels *
|
||||
sizeof(FLOAT32));
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
WORD32 impd_peak_limiter_reinit(ia_drc_peak_limiter_struct *peak_limiter)
|
||||
{
|
||||
if (peak_limiter)
|
||||
{
|
||||
peak_limiter->delayed_input_index = 0;
|
||||
peak_limiter->pre_smoothed_gain=1.0f;
|
||||
peak_limiter->gain_modified=1.0f;
|
||||
peak_limiter->min_gain = 1.0f;
|
||||
memset(peak_limiter->max_buf, 0, (peak_limiter->attack_time_samples + 1) * sizeof(FLOAT32) );
|
||||
memset(peak_limiter->delayed_input, 0, peak_limiter->attack_time_samples * peak_limiter->num_channels * sizeof(FLOAT32) );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
WORD32 impd_limiter_process(ia_drc_peak_limiter_struct *peak_limiter, FLOAT32 *samples, UWORD32 frame_len)
|
||||
{
|
||||
WORD32 impd_limiter_process(ia_drc_peak_limiter_struct *peak_limiter,
|
||||
FLOAT32 *samples, UWORD32 frame_len) {
|
||||
UWORD32 i, j;
|
||||
FLOAT32 tmp, gain;
|
||||
FLOAT32 min_gain = 1;
|
||||
FLOAT32 maximum, sectionMaximum;
|
||||
UWORD32 num_channels = peak_limiter->num_channels;
|
||||
UWORD32 attack_time_samples = peak_limiter->attack_time_samples;
|
||||
FLOAT32 attack_constant = peak_limiter->attack_constant;
|
||||
FLOAT32 release_constant = peak_limiter->release_constant;
|
||||
FLOAT32 limit_threshold = peak_limiter->limit_threshold;
|
||||
FLOAT32* max_buf = peak_limiter->max_buf;
|
||||
FLOAT32 gain_modified = peak_limiter->gain_modified;
|
||||
FLOAT32* delayed_input = peak_limiter->delayed_input;
|
||||
UWORD32 delayed_input_index = peak_limiter->delayed_input_index;
|
||||
FLOAT64 pre_smoothed_gain = peak_limiter->pre_smoothed_gain;
|
||||
|
||||
|
||||
|
||||
UWORD32 num_channels = peak_limiter->num_channels;
|
||||
UWORD32 attack_time_samples = peak_limiter->attack_time_samples;
|
||||
FLOAT32 attack_constant = peak_limiter->attack_constant;
|
||||
FLOAT32 release_constant = peak_limiter->release_constant;
|
||||
FLOAT32 limit_threshold = peak_limiter->limit_threshold;
|
||||
FLOAT32 *max_buf = peak_limiter->max_buf;
|
||||
FLOAT32 gain_modified = peak_limiter->gain_modified;
|
||||
FLOAT32 *delayed_input = peak_limiter->delayed_input;
|
||||
UWORD32 delayed_input_index = peak_limiter->delayed_input_index;
|
||||
FLOAT64 pre_smoothed_gain = peak_limiter->pre_smoothed_gain;
|
||||
|
||||
if (peak_limiter->limiter_on || (FLOAT32)pre_smoothed_gain < 1.0f) {
|
||||
for (i = 0; i < frame_len; i++) {
|
||||
tmp =0.0f;
|
||||
tmp = 0.0f;
|
||||
for (j = 0; j < num_channels; j++) {
|
||||
tmp = max(tmp, (FLOAT32)fabs(samples[i * num_channels + j]));
|
||||
}
|
||||
|
||||
for (j = attack_time_samples; j >0; j--) {
|
||||
max_buf[j]=max_buf[j-1];
|
||||
for (j = attack_time_samples; j > 0; j--) {
|
||||
max_buf[j] = max_buf[j - 1];
|
||||
}
|
||||
max_buf[0] = tmp;
|
||||
sectionMaximum=tmp;
|
||||
for (j = 1; j < (attack_time_samples+1); j++) {
|
||||
if (max_buf[j] > sectionMaximum)
|
||||
sectionMaximum = max_buf[j];
|
||||
sectionMaximum = tmp;
|
||||
for (j = 1; j < (attack_time_samples + 1); j++) {
|
||||
if (max_buf[j] > sectionMaximum) sectionMaximum = max_buf[j];
|
||||
}
|
||||
maximum=sectionMaximum;
|
||||
maximum = sectionMaximum;
|
||||
|
||||
if (maximum > limit_threshold) {
|
||||
gain = limit_threshold / maximum;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
gain = 1;
|
||||
}
|
||||
|
||||
if (gain < pre_smoothed_gain) {
|
||||
gain_modified = min(gain_modified, (gain - 0.1f * (FLOAT32)pre_smoothed_gain) * 1.11111111f);
|
||||
}
|
||||
else {
|
||||
gain_modified =
|
||||
min(gain_modified,
|
||||
(gain - 0.1f * (FLOAT32)pre_smoothed_gain) * 1.11111111f);
|
||||
} else {
|
||||
gain_modified = gain;
|
||||
}
|
||||
|
||||
if (gain_modified < pre_smoothed_gain) {
|
||||
pre_smoothed_gain = attack_constant * (pre_smoothed_gain - gain_modified) + gain_modified;
|
||||
pre_smoothed_gain =
|
||||
attack_constant * (pre_smoothed_gain - gain_modified) +
|
||||
gain_modified;
|
||||
pre_smoothed_gain = max(pre_smoothed_gain, gain);
|
||||
}
|
||||
else {
|
||||
pre_smoothed_gain = release_constant * (pre_smoothed_gain - gain_modified) + gain_modified;
|
||||
} else {
|
||||
pre_smoothed_gain =
|
||||
release_constant * (pre_smoothed_gain - gain_modified) +
|
||||
gain_modified;
|
||||
}
|
||||
|
||||
gain = (FLOAT32)pre_smoothed_gain;
|
||||
|
||||
for (j = 0; j < num_channels; j++) {
|
||||
tmp = delayed_input[delayed_input_index * num_channels + j];
|
||||
delayed_input[delayed_input_index * num_channels + j] = samples[i * num_channels + j];
|
||||
delayed_input[delayed_input_index * num_channels + j] =
|
||||
samples[i * num_channels + j];
|
||||
|
||||
tmp *= gain;
|
||||
if (tmp > limit_threshold)
|
||||
tmp = limit_threshold;
|
||||
tmp = limit_threshold;
|
||||
else if (tmp < -limit_threshold)
|
||||
tmp = -limit_threshold;
|
||||
tmp = -limit_threshold;
|
||||
|
||||
samples[i * num_channels + j] = tmp;
|
||||
}
|
||||
|
||||
delayed_input_index++;
|
||||
if (delayed_input_index >= attack_time_samples)
|
||||
delayed_input_index = 0;
|
||||
if (delayed_input_index >= attack_time_samples) delayed_input_index = 0;
|
||||
|
||||
if (gain < min_gain)
|
||||
min_gain = gain;
|
||||
if (gain < min_gain) min_gain = gain;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
for (i = 0; i < frame_len; i++) {
|
||||
for (j = 0; j < num_channels; j++) {
|
||||
tmp = delayed_input[delayed_input_index * num_channels + j];
|
||||
delayed_input[delayed_input_index * num_channels + j] = samples[i * num_channels + j];
|
||||
delayed_input[delayed_input_index * num_channels + j] =
|
||||
samples[i * num_channels + j];
|
||||
samples[i * num_channels + j] = tmp;
|
||||
}
|
||||
|
||||
delayed_input_index++;
|
||||
if (delayed_input_index >= attack_time_samples)
|
||||
delayed_input_index = 0;
|
||||
if (delayed_input_index >= attack_time_samples) delayed_input_index = 0;
|
||||
}
|
||||
}
|
||||
|
||||
peak_limiter->gain_modified = gain_modified;
|
||||
peak_limiter->gain_modified = gain_modified;
|
||||
peak_limiter->delayed_input_index = delayed_input_index;
|
||||
peak_limiter->pre_smoothed_gain = pre_smoothed_gain;
|
||||
peak_limiter->min_gain = min_gain;
|
||||
peak_limiter->pre_smoothed_gain = pre_smoothed_gain;
|
||||
peak_limiter->min_gain = min_gain;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -20,38 +20,34 @@
|
|||
#ifndef IMPD_DRC_PEAK_LIMITER_H
|
||||
#define IMPD_DRC_PEAK_LIMITER_H
|
||||
|
||||
|
||||
#define DEFAULT_ATTACK_TIME_MS (5.0f) /* default attack time in ms */
|
||||
#define DEFAULT_RELEASE_TIME_MS (50.0f) /* default release time in ms */
|
||||
|
||||
#define DEFAULT_ATTACK_TIME_MS (5.0f) /* default attack time in ms */
|
||||
#define DEFAULT_RELEASE_TIME_MS (50.0f) /* default release time in ms */
|
||||
|
||||
typedef struct ia_drc_peak_limiter_struct {
|
||||
FLOAT32 attack_time;
|
||||
FLOAT32 release_time;
|
||||
FLOAT32 attack_constant;
|
||||
FLOAT32 release_constant;
|
||||
FLOAT32 limit_threshold;
|
||||
UWORD32 num_channels;
|
||||
UWORD32 sample_rate;
|
||||
UWORD32 attack_time_samples;
|
||||
UWORD32 limiter_on;
|
||||
FLOAT32 gain_modified;
|
||||
FLOAT64 pre_smoothed_gain;
|
||||
FLOAT32* delayed_input;
|
||||
UWORD32 delayed_input_index;
|
||||
FLOAT32* max_buf;
|
||||
FLOAT32 min_gain;
|
||||
FLOAT32* buffer;
|
||||
}ia_drc_peak_limiter_struct;
|
||||
FLOAT32 attack_time;
|
||||
FLOAT32 release_time;
|
||||
FLOAT32 attack_constant;
|
||||
FLOAT32 release_constant;
|
||||
FLOAT32 limit_threshold;
|
||||
UWORD32 num_channels;
|
||||
UWORD32 sample_rate;
|
||||
UWORD32 attack_time_samples;
|
||||
UWORD32 limiter_on;
|
||||
FLOAT32 gain_modified;
|
||||
FLOAT64 pre_smoothed_gain;
|
||||
FLOAT32 *delayed_input;
|
||||
UWORD32 delayed_input_index;
|
||||
FLOAT32 *max_buf;
|
||||
FLOAT32 min_gain;
|
||||
FLOAT32 *buffer;
|
||||
} ia_drc_peak_limiter_struct;
|
||||
|
||||
WORD32 impd_peak_limiter_init(ia_drc_peak_limiter_struct *peak_limiter,
|
||||
FLOAT32 attack_time,
|
||||
FLOAT32 release_time,
|
||||
FLOAT32 limit_threshold,
|
||||
UWORD32 num_channels,
|
||||
UWORD32 sample_rate,
|
||||
FLOAT32 *buffer);
|
||||
FLOAT32 attack_time, FLOAT32 release_time,
|
||||
FLOAT32 limit_threshold, UWORD32 num_channels,
|
||||
UWORD32 sample_rate, FLOAT32 *buffer);
|
||||
|
||||
WORD32 impd_limiter_process(ia_drc_peak_limiter_struct *peak_limiter, FLOAT32 *samples, UWORD32 frame_len);
|
||||
WORD32 impd_limiter_process(ia_drc_peak_limiter_struct *peak_limiter,
|
||||
FLOAT32 *samples, UWORD32 frame_len);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,31 +20,26 @@
|
|||
#ifndef IMPD_DRC_PEAK_LIMITER_STRUCT_H
|
||||
#define IMPD_DRC_PEAK_LIMITER_STRUCT_H
|
||||
|
||||
|
||||
|
||||
#define DEFAULT_ATTACK_TIME_MS (5.0f) /* default attack time in ms */
|
||||
#define DEFAULT_RELEASE_TIME_MS (50.0f) /* default release time in ms */
|
||||
|
||||
#define DEFAULT_ATTACK_TIME_MS (5.0f) /* default attack time in ms */
|
||||
#define DEFAULT_RELEASE_TIME_MS (50.0f) /* default release time in ms */
|
||||
|
||||
typedef struct ia_drc_peak_limiter_struct {
|
||||
FLOAT32 attack_time;
|
||||
FLOAT32 release_time;
|
||||
FLOAT32 attack_constant;
|
||||
FLOAT32 release_constant;
|
||||
FLOAT32 limit_threshold;
|
||||
UWORD32 num_channels;
|
||||
UWORD32 sample_rate;
|
||||
UWORD32 attack_time_samples;
|
||||
UWORD32 limiter_on;
|
||||
FLOAT32 gain_modified;
|
||||
FLOAT64 pre_smoothed_gain;
|
||||
FLOAT32* delayed_input;
|
||||
UWORD32 delayed_input_index;
|
||||
FLOAT32* max_buf;
|
||||
FLOAT32 min_gain;
|
||||
FLOAT32* buffer;
|
||||
}ia_drc_peak_limiter_struct;
|
||||
FLOAT32 attack_time;
|
||||
FLOAT32 release_time;
|
||||
FLOAT32 attack_constant;
|
||||
FLOAT32 release_constant;
|
||||
FLOAT32 limit_threshold;
|
||||
UWORD32 num_channels;
|
||||
UWORD32 sample_rate;
|
||||
UWORD32 attack_time_samples;
|
||||
UWORD32 limiter_on;
|
||||
FLOAT32 gain_modified;
|
||||
FLOAT64 pre_smoothed_gain;
|
||||
FLOAT32* delayed_input;
|
||||
UWORD32 delayed_input_index;
|
||||
FLOAT32* max_buf;
|
||||
FLOAT32 min_gain;
|
||||
FLOAT32* buffer;
|
||||
} ia_drc_peak_limiter_struct;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -21,70 +21,67 @@
|
|||
#define IMPD_DRC_PROCESS_AUDIO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
WORD32 multiband_audio_sig_count;
|
||||
WORD32 frame_size;
|
||||
FLOAT32** non_interleaved_audio;
|
||||
WORD32 multiband_audio_sig_count;
|
||||
WORD32 frame_size;
|
||||
FLOAT32** non_interleaved_audio;
|
||||
} ia_audio_band_buffer_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 audio_num_chan;
|
||||
WORD32 frame_size;
|
||||
WORD32 audio_sub_band_count;
|
||||
WORD32 audio_sub_band_frame_size;
|
||||
WORD32 audio_delay_samples;
|
||||
WORD32 audio_delay_sub_band_samples;
|
||||
FLOAT32** audio_io_buffer_delayed;
|
||||
FLOAT32** audio_buffer_delayed_real;
|
||||
FLOAT32** audio_buffer_delayed_imag;
|
||||
FLOAT32** audio_in_out_buf;
|
||||
FLOAT32** audio_real_buff;
|
||||
FLOAT32** audio_imag_buff;
|
||||
WORD32 audio_num_chan;
|
||||
WORD32 frame_size;
|
||||
WORD32 audio_sub_band_count;
|
||||
WORD32 audio_sub_band_frame_size;
|
||||
WORD32 audio_delay_samples;
|
||||
WORD32 audio_delay_sub_band_samples;
|
||||
FLOAT32** audio_io_buffer_delayed;
|
||||
FLOAT32** audio_buffer_delayed_real;
|
||||
FLOAT32** audio_buffer_delayed_imag;
|
||||
FLOAT32** audio_in_out_buf;
|
||||
FLOAT32** audio_real_buff;
|
||||
FLOAT32** audio_imag_buff;
|
||||
} ia_audio_in_out_buf;
|
||||
|
||||
|
||||
WORD32
|
||||
impd_apply_gains_subband(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||
const WORD32 drc_instructions_index,
|
||||
ia_drc_params_struct* ia_drc_params_struct,
|
||||
ia_gain_buffer_struct* pstr_gain_buf,
|
||||
ia_overlap_params_struct* pstr_overlap_params,
|
||||
FLOAT32* deinterleaved_audio_delayed_re[],
|
||||
FLOAT32* deinterleaved_audio_delayed_im[],
|
||||
FLOAT32* deinterleaved_audio_re[],
|
||||
FLOAT32* deinterleaved_audio_im[]);
|
||||
|
||||
const WORD32 drc_instructions_index,
|
||||
ia_drc_params_struct* ia_drc_params_struct,
|
||||
ia_gain_buffer_struct* pstr_gain_buf,
|
||||
ia_overlap_params_struct* pstr_overlap_params,
|
||||
FLOAT32* deinterleaved_audio_delayed_re[],
|
||||
FLOAT32* deinterleaved_audio_delayed_im[],
|
||||
FLOAT32* deinterleaved_audio_re[],
|
||||
FLOAT32* deinterleaved_audio_im[]);
|
||||
|
||||
WORD32
|
||||
impd_filter_banks_process(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||
const WORD32 drc_instructions_index,
|
||||
ia_drc_params_struct* ia_drc_params_struct,
|
||||
FLOAT32* audio_io_buf[],
|
||||
ia_audio_band_buffer_struct* audio_band_buffer,
|
||||
ia_filter_banks_struct* ia_filter_banks_struct,
|
||||
const WORD32 passThru);
|
||||
const WORD32 drc_instructions_index,
|
||||
ia_drc_params_struct* ia_drc_params_struct,
|
||||
FLOAT32* audio_io_buf[],
|
||||
ia_audio_band_buffer_struct* audio_band_buffer,
|
||||
ia_filter_banks_struct* ia_filter_banks_struct,
|
||||
const WORD32 passThru);
|
||||
|
||||
WORD32
|
||||
impd_store_audio_io_buffer_time(FLOAT32* audio_in_out_buf[],
|
||||
ia_audio_in_out_buf* audio_io_buf_internal);
|
||||
impd_store_audio_io_buffer_time(FLOAT32* audio_in_out_buf[],
|
||||
ia_audio_in_out_buf* audio_io_buf_internal);
|
||||
|
||||
WORD32
|
||||
impd_store_audio_io_buffer_freq(FLOAT32* audio_real_buff[],
|
||||
FLOAT32* audio_imag_buff[],
|
||||
ia_audio_in_out_buf* audio_io_buf_internal);
|
||||
impd_store_audio_io_buffer_freq(FLOAT32* audio_real_buff[],
|
||||
FLOAT32* audio_imag_buff[],
|
||||
ia_audio_in_out_buf* audio_io_buf_internal);
|
||||
|
||||
WORD32
|
||||
impd_retrieve_audio_io_buffer_time(FLOAT32* audio_in_out_buf[],
|
||||
ia_audio_in_out_buf* audio_io_buf_internal);
|
||||
impd_retrieve_audio_io_buffer_time(FLOAT32* audio_in_out_buf[],
|
||||
ia_audio_in_out_buf* audio_io_buf_internal);
|
||||
|
||||
WORD32
|
||||
impd_retrieve_audio_buffer_freq(FLOAT32* audio_real_buff[],
|
||||
FLOAT32* audio_imag_buff[],
|
||||
ia_audio_in_out_buf* audio_io_buf_internal);
|
||||
impd_retrieve_audio_buffer_freq(FLOAT32* audio_real_buff[],
|
||||
FLOAT32* audio_imag_buff[],
|
||||
ia_audio_in_out_buf* audio_io_buf_internal);
|
||||
|
||||
WORD32
|
||||
impd_advance_audio_io_buffer_time(ia_audio_in_out_buf* audio_io_buf_internal);
|
||||
|
|
|
|||
|
|
@ -20,21 +20,17 @@
|
|||
#ifndef IMPD_DRC_QMF_FILTER_H
|
||||
#define IMPD_DRC_QMF_FILTER_H
|
||||
|
||||
#define QMF_NUM_FILT_BANDS 64
|
||||
#define QMF_FILT_RESOLUTION 64
|
||||
|
||||
#define QMF_NUM_FILT_BANDS 64
|
||||
#define QMF_FILT_RESOLUTION 64
|
||||
typedef struct ia_drc_qmf_filt_struct {
|
||||
FLOAT64* ana_buff;
|
||||
FLOAT64* syn_buff;
|
||||
FLOAT64 ana_tab_real[QMF_NUM_FILT_BANDS][2 * QMF_NUM_FILT_BANDS];
|
||||
FLOAT64 ana_tab_imag[QMF_NUM_FILT_BANDS][2 * QMF_NUM_FILT_BANDS];
|
||||
FLOAT64 syn_tab_real[2 * QMF_NUM_FILT_BANDS][QMF_NUM_FILT_BANDS];
|
||||
FLOAT64 syn_tab_imag[2 * QMF_NUM_FILT_BANDS][QMF_NUM_FILT_BANDS];
|
||||
|
||||
|
||||
typedef struct ia_drc_qmf_filt_struct
|
||||
{
|
||||
|
||||
FLOAT64* ana_buff;
|
||||
FLOAT64* syn_buff;
|
||||
FLOAT64 ana_tab_real[QMF_NUM_FILT_BANDS][2*QMF_NUM_FILT_BANDS];
|
||||
FLOAT64 ana_tab_imag[QMF_NUM_FILT_BANDS][2*QMF_NUM_FILT_BANDS];
|
||||
FLOAT64 syn_tab_real[2*QMF_NUM_FILT_BANDS][QMF_NUM_FILT_BANDS];
|
||||
FLOAT64 syn_tab_imag[2*QMF_NUM_FILT_BANDS][QMF_NUM_FILT_BANDS];
|
||||
|
||||
}ia_drc_qmf_filt_struct;
|
||||
} ia_drc_qmf_filt_struct;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -19,7 +19,7 @@
|
|||
*/
|
||||
#ifndef IMPD_DRC_ROM_H
|
||||
#define IMPD_DRC_ROM_H
|
||||
#define MAX_NUM_QMF_BANDS 128
|
||||
#define MAX_NUM_QMF_BANDS 128
|
||||
|
||||
#define NUM_GAIN_TBL_PROF_0_1_ENTRIES 25
|
||||
#define NUM_GAIN_TBL_PROF_2_ENTRIES 49
|
||||
|
|
@ -27,14 +27,16 @@
|
|||
|
||||
extern const FLOAT32 samp_rate_tbl[13][12];
|
||||
|
||||
extern const ia_delta_gain_code_table_struct ia_drc_gain_tbls_prof_0_1[NUM_GAIN_TBL_PROF_0_1_ENTRIES];
|
||||
extern const ia_delta_gain_code_table_struct
|
||||
ia_drc_gain_tbls_prof_0_1[NUM_GAIN_TBL_PROF_0_1_ENTRIES];
|
||||
|
||||
extern const ia_delta_gain_code_table_struct ia_drc_gain_tbls_prof_2[NUM_GAIN_TBL_PROF_2_ENTRIES];
|
||||
extern const ia_delta_gain_code_table_struct
|
||||
ia_drc_gain_tbls_prof_2[NUM_GAIN_TBL_PROF_2_ENTRIES];
|
||||
|
||||
extern const FLOAT32 channel_weight[];
|
||||
|
||||
extern const FLOAT32 dwnmix_coeff_v1[];
|
||||
extern const FLOAT32 eq_slope_tbl [];
|
||||
extern const FLOAT32 eq_slope_tbl[];
|
||||
|
||||
extern const FLOAT32 eq_gain_delta_tbl[];
|
||||
|
||||
|
|
@ -54,14 +56,14 @@ extern const FLOAT32 shape_filt_hf_radius_tbl[];
|
|||
|
||||
extern const FLOAT32 shape_filt_cutoff_freq_norm_hf_tbl[];
|
||||
|
||||
extern const ia_cicp_sigmoid_characteristic_param_struct pstr_cicp_sigmoid_characteristic_param[];
|
||||
extern const ia_cicp_sigmoid_characteristic_param_struct
|
||||
pstr_cicp_sigmoid_characteristic_param[];
|
||||
|
||||
|
||||
extern const ia_slope_code_table_struct slope_code_tbl_entries_by_size[NUM_SLOPE_TBL_ENTRIES];
|
||||
extern const ia_slope_code_table_struct
|
||||
slope_code_tbl_entries_by_size[NUM_SLOPE_TBL_ENTRIES];
|
||||
|
||||
extern const FLOAT32 dwnmix_coeff[];
|
||||
|
||||
|
||||
extern const FLOAT32 dwnmix_coeff_lfe[];
|
||||
|
||||
extern WORD32 drc_characteristic_order_default[][3];
|
||||
|
|
@ -82,69 +84,72 @@ extern WORD32 measurement_method_peak_loudness_tbl[];
|
|||
#define MAX_NUM_DOWNMIX_ID_REQUESTS_LOCAL 3
|
||||
|
||||
typedef struct {
|
||||
WORD32 target_config_request_type;
|
||||
WORD32 num_downmix_id_requests;
|
||||
WORD32 requested_dwnmix_id[MAX_NUM_DOWNMIX_ID_REQUESTS_LOCAL];
|
||||
WORD32 requested_target_layout;
|
||||
WORD32 requested_target_ch_count;
|
||||
WORD32 target_config_request_type;
|
||||
WORD32 num_downmix_id_requests;
|
||||
WORD32 requested_dwnmix_id[MAX_NUM_DOWNMIX_ID_REQUESTS_LOCAL];
|
||||
WORD32 requested_target_layout;
|
||||
WORD32 requested_target_ch_count;
|
||||
} ia_loc_sys_interface_struct;
|
||||
|
||||
|
||||
extern const ia_loc_sys_interface_struct loc_sys_interface[];
|
||||
|
||||
typedef struct {
|
||||
WORD32 loudness_normalization_on;
|
||||
FLOAT32 target_loudness;
|
||||
WORD32 loudness_normalization_on;
|
||||
FLOAT32 target_loudness;
|
||||
} ia_loc_loudness_norm_ctrl_interface_struct;
|
||||
|
||||
extern const ia_loc_loudness_norm_ctrl_interface_struct loc_loudness_norm_ctrl_interface[];
|
||||
extern const ia_loc_loudness_norm_ctrl_interface_struct
|
||||
loc_loudness_norm_ctrl_interface[];
|
||||
|
||||
typedef struct {
|
||||
WORD32 album_mode;
|
||||
WORD32 peak_limiter;
|
||||
WORD32 loudness_deviation_max;
|
||||
WORD32 loudness_measurement_method;
|
||||
WORD32 loudness_measurement_system;
|
||||
WORD32 loudness_measurement_pre_proc;
|
||||
WORD32 device_cut_off_frequency;
|
||||
FLOAT32 loudness_norm_gain_db_max;
|
||||
FLOAT32 loudness_norm_gain_modification_db;
|
||||
FLOAT32 output_peak_level_max;
|
||||
WORD32 album_mode;
|
||||
WORD32 peak_limiter;
|
||||
WORD32 loudness_deviation_max;
|
||||
WORD32 loudness_measurement_method;
|
||||
WORD32 loudness_measurement_system;
|
||||
WORD32 loudness_measurement_pre_proc;
|
||||
WORD32 device_cut_off_frequency;
|
||||
FLOAT32 loudness_norm_gain_db_max;
|
||||
FLOAT32 loudness_norm_gain_modification_db;
|
||||
FLOAT32 output_peak_level_max;
|
||||
} ia_loc_loudness_norm_param_interface_struct;
|
||||
|
||||
extern const ia_loc_loudness_norm_param_interface_struct loc_loudness_norm_param_interface[];
|
||||
extern const ia_loc_loudness_norm_param_interface_struct
|
||||
loc_loudness_norm_param_interface[];
|
||||
|
||||
#define MAX_NUM_DRC_FEATURE_REQUESTS_LOCAL 3
|
||||
typedef struct {
|
||||
WORD32 dynamic_range_control_on;
|
||||
WORD32 num_drc_feature_requests;
|
||||
WORD32 drc_feature_req_type[MAX_NUM_DRC_FEATURE_REQUESTS_LOCAL];
|
||||
WORD32 requested_dyn_rng_measurement_type;
|
||||
WORD32 requested_dyn_range_is_single_val_flag;
|
||||
FLOAT32 requested_dyn_range_value;
|
||||
FLOAT32 requested_dyn_range_min_val;
|
||||
FLOAT32 requested_dyn_range_max_val;
|
||||
WORD32 requested_drc_characteristic;
|
||||
WORD32 dynamic_range_control_on;
|
||||
WORD32 num_drc_feature_requests;
|
||||
WORD32 drc_feature_req_type[MAX_NUM_DRC_FEATURE_REQUESTS_LOCAL];
|
||||
WORD32 requested_dyn_rng_measurement_type;
|
||||
WORD32 requested_dyn_range_is_single_val_flag;
|
||||
FLOAT32 requested_dyn_range_value;
|
||||
FLOAT32 requested_dyn_range_min_val;
|
||||
FLOAT32 requested_dyn_range_max_val;
|
||||
WORD32 requested_drc_characteristic;
|
||||
} ia_loc_drc_interface_struct;
|
||||
|
||||
extern const ia_loc_drc_interface_struct loc_dyn_range_ctrl_interface[];
|
||||
|
||||
#define MAX_NUM_DRC_EFFECT_TYPE_REQUESTS_LOCAL 5
|
||||
typedef struct {
|
||||
WORD32 requested_num_drc_effects;
|
||||
WORD32 desired_num_drc_effects_of_requested;
|
||||
WORD32 requested_drc_effect_type[MAX_NUM_DRC_EFFECT_TYPE_REQUESTS_LOCAL];
|
||||
WORD32 requested_num_drc_effects;
|
||||
WORD32 desired_num_drc_effects_of_requested;
|
||||
WORD32 requested_drc_effect_type[MAX_NUM_DRC_EFFECT_TYPE_REQUESTS_LOCAL];
|
||||
} ia_loc_requested_drc_effect_struct;
|
||||
|
||||
extern const ia_loc_requested_drc_effect_struct loc_requested_drc_effect_type_str[];
|
||||
extern const ia_loc_requested_drc_effect_struct
|
||||
loc_requested_drc_effect_type_str[];
|
||||
|
||||
typedef struct {
|
||||
FLOAT32 compress;
|
||||
FLOAT32 boost;
|
||||
WORD32 drc_characteristic_target;
|
||||
FLOAT32 compress;
|
||||
FLOAT32 boost;
|
||||
WORD32 drc_characteristic_target;
|
||||
} ia_loc_drc_parameter_interface_struct;
|
||||
|
||||
extern const ia_loc_drc_parameter_interface_struct loc_drc_parameter_interface[];
|
||||
extern const ia_loc_drc_parameter_interface_struct
|
||||
loc_drc_parameter_interface[];
|
||||
|
||||
extern FLOAT32 f_bands_nrm_QMF71[71];
|
||||
extern FLOAT32 f_bands_nrm_QMF64[64];
|
||||
|
|
@ -152,5 +157,6 @@ extern FLOAT32 f_bands_nrm_STFT256[257];
|
|||
|
||||
FLOAT64 qmf_filter_coeff[640];
|
||||
|
||||
extern const ia_filter_bank_params_struct normal_cross_freq[FILTER_BANK_PARAMETER_COUNT];
|
||||
extern const ia_filter_bank_params_struct
|
||||
normal_cross_freq[FILTER_BANK_PARAMETER_COUNT];
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -24,28 +24,27 @@
|
|||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#define SELECTION_FLAG_DRC_TARGET_LOUDNESS_MATCH (1<<0)
|
||||
#define SELECTION_FLAG_EXPLICIT_PEAK_INFO_PRESENT (1<<1)
|
||||
#define SELECTION_FLAG_DRC_TARGET_LOUDNESS_MATCH (1 << 0)
|
||||
#define SELECTION_FLAG_EXPLICIT_PEAK_INFO_PRESENT (1 << 1)
|
||||
|
||||
typedef struct {
|
||||
WORD32 drc_instructions_index;
|
||||
WORD32 downmix_id_request_index;
|
||||
WORD32 eq_set_id;
|
||||
FLOAT32 output_peak_level;
|
||||
FLOAT32 loudness_norm_db_gain_adjusted;
|
||||
FLOAT32 output_loudness;
|
||||
FLOAT32 mixing_level;
|
||||
WORD32 selection_flags;
|
||||
WORD32 drc_instructions_index;
|
||||
WORD32 downmix_id_request_index;
|
||||
WORD32 eq_set_id;
|
||||
FLOAT32 output_peak_level;
|
||||
FLOAT32 loudness_norm_db_gain_adjusted;
|
||||
FLOAT32 output_loudness;
|
||||
FLOAT32 mixing_level;
|
||||
WORD32 selection_flags;
|
||||
} ia_selection_candidate_info_struct;
|
||||
|
||||
|
||||
WORD32
|
||||
impd_validate_requested_drc_feature(ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct);
|
||||
impd_validate_requested_drc_feature(
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct);
|
||||
|
||||
WORD32
|
||||
impd_map_requested_effect_bit_idx(WORD32 requested_effect_type,
|
||||
WORD32* effect_bit_idx);
|
||||
WORD32* effect_bit_idx);
|
||||
|
||||
WORD32
|
||||
impd_get_fading_drc_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc);
|
||||
|
|
@ -55,127 +54,123 @@ impd_get_ducking_drc_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc);
|
|||
|
||||
WORD32
|
||||
impd_get_selected_drc_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
WORD32 drc_set_id_selected);
|
||||
WORD32 drc_set_id_selected);
|
||||
|
||||
WORD32
|
||||
impd_get_dependent_drc_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc);
|
||||
|
||||
WORD32
|
||||
impd_get_dependent_drc_instructions(const ia_drc_config* drc_config,
|
||||
const ia_drc_instructions_struct* str_drc_instruction_str,
|
||||
ia_drc_instructions_struct** ppstr_drc_instructions_dependent);
|
||||
impd_get_dependent_drc_instructions(
|
||||
const ia_drc_config* drc_config,
|
||||
const ia_drc_instructions_struct* str_drc_instruction_str,
|
||||
ia_drc_instructions_struct** ppstr_drc_instructions_dependent);
|
||||
|
||||
WORD32
|
||||
impd_manage_drc_complexity (ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
ia_drc_config* pstr_drc_config);
|
||||
impd_manage_drc_complexity(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
ia_drc_config* pstr_drc_config);
|
||||
|
||||
WORD32
|
||||
impd_manage_eq_complexity (ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
ia_drc_config* pstr_drc_config);
|
||||
impd_manage_eq_complexity(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
ia_drc_config* pstr_drc_config);
|
||||
|
||||
WORD32
|
||||
impd_manage_complexity (ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
WORD32* repeat_selection);
|
||||
impd_manage_complexity(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
WORD32* repeat_selection);
|
||||
|
||||
WORD32
|
||||
impd_get_selected_eq_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
WORD32 eq_set_id_selected);
|
||||
WORD32 eq_set_id_selected);
|
||||
WORD32
|
||||
impd_get_dependent_eq_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc);
|
||||
|
||||
WORD32
|
||||
impd_get_selected_loud_eq_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
WORD32 loudEqSetIdSelected);
|
||||
WORD32 loudEqSetIdSelected);
|
||||
|
||||
WORD32
|
||||
impd_select_drcs_without_compr_effects (ia_drc_config* pstr_drc_config,
|
||||
WORD32* match_found_flag,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
impd_select_drcs_without_compr_effects(
|
||||
ia_drc_config* pstr_drc_config, WORD32* match_found_flag,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
|
||||
WORD32
|
||||
impd_match_effect_type_attempt(ia_drc_config* pstr_drc_config,
|
||||
WORD32 requested_effect_type,
|
||||
WORD32 stateRequested,
|
||||
WORD32* match_found_flag,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
impd_match_effect_type_attempt(
|
||||
ia_drc_config* pstr_drc_config, WORD32 requested_effect_type,
|
||||
WORD32 stateRequested, WORD32* match_found_flag,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
|
||||
WORD32
|
||||
impd_match_effect_types(ia_drc_config* pstr_drc_config,
|
||||
WORD32 total_effect_type_requested,
|
||||
WORD32 desired_effect_type_requested,
|
||||
WORD32* requested_effect_type,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
impd_match_effect_types(
|
||||
ia_drc_config* pstr_drc_config, WORD32 total_effect_type_requested,
|
||||
WORD32 desired_effect_type_requested, WORD32* requested_effect_type,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
|
||||
WORD32 impd_match_dynamic_range(ia_drc_config* pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||
WORD32 num_drc_requests,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
WORD32 impd_match_dynamic_range(
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||
WORD32 num_drc_requests, WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
|
||||
WORD32
|
||||
impd_match_drc_characteristic_attempt(ia_drc_config* pstr_drc_config,
|
||||
WORD32 requested_drc_characteristic,
|
||||
WORD32* match_found_flag,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
impd_match_drc_characteristic_attempt(
|
||||
ia_drc_config* pstr_drc_config, WORD32 requested_drc_characteristic,
|
||||
WORD32* match_found_flag, WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
|
||||
WORD32
|
||||
impd_match_drc_characteristic(ia_drc_config* pstr_drc_config,
|
||||
WORD32 requested_drc_characteristic,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
impd_match_drc_characteristic(
|
||||
ia_drc_config* pstr_drc_config, WORD32 requested_drc_characteristic,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
|
||||
VOID impd_select_drc_coeff3(ia_drc_config* drc_config,
|
||||
ia_uni_drc_coeffs_struct** str_p_loc_drc_coefficients_uni_drc);
|
||||
VOID impd_select_drc_coeff3(
|
||||
ia_drc_config* drc_config,
|
||||
ia_uni_drc_coeffs_struct** str_p_loc_drc_coefficients_uni_drc);
|
||||
|
||||
WORD32
|
||||
impd_drc_set_preselection(ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
WORD32 restrict_to_drc_with_album_loudness,
|
||||
ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
impd_drc_set_preselection(
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
WORD32 restrict_to_drc_with_album_loudness,
|
||||
ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
|
||||
WORD32 impd_drc_set_final_selection(ia_drc_config* pstr_drc_config,
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info
|
||||
, WORD32* eq_set_id_valid_flag
|
||||
);
|
||||
WORD32 impd_drc_set_final_selection(
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info,
|
||||
WORD32* eq_set_id_valid_flag);
|
||||
|
||||
WORD32 impd_match_eq_set_purpose(ia_drc_config* drc_config,
|
||||
WORD32 eq_set_purpose_requested,
|
||||
WORD32* eq_set_id_valid_flag,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info_step_2
|
||||
);
|
||||
WORD32 impd_match_eq_set_purpose(
|
||||
ia_drc_config* drc_config, WORD32 eq_set_purpose_requested,
|
||||
WORD32* eq_set_id_valid_flag, WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info_step_2);
|
||||
|
||||
WORD32
|
||||
impd_select_drc_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
WORD32* drc_set_id_selected
|
||||
, WORD32* eq_set_id_selected
|
||||
, WORD32* loud_eq_id_sel
|
||||
);
|
||||
WORD32* drc_set_id_selected, WORD32* eq_set_id_selected,
|
||||
WORD32* loud_eq_id_sel);
|
||||
|
||||
WORD32
|
||||
impd_drc_sel_proc_init_dflt(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc);
|
||||
|
||||
WORD32
|
||||
impd_drc_sel_proc_init_sel_proc_params(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct);
|
||||
impd_drc_sel_proc_init_sel_proc_params(
|
||||
ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct);
|
||||
|
||||
WORD32
|
||||
impd_drc_sel_proc_init_interface_params(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
ia_drc_interface_struct* pstr_drc_interface);
|
||||
|
||||
|
||||
impd_drc_sel_proc_init_interface_params(
|
||||
ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
ia_drc_interface_struct* pstr_drc_interface);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -20,168 +20,153 @@
|
|||
#ifndef IMPD_DRC_SECLECTION_PROCESS_H
|
||||
#define IMPD_DRC_SECLECTION_PROCESS_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define EFFECT_TYPE_REQUESTED_NONE 0
|
||||
#define EFFECT_TYPE_REQUESTED_NIGHT 1
|
||||
#define EFFECT_TYPE_REQUESTED_NOISY 2
|
||||
#define EFFECT_TYPE_REQUESTED_LIMITED 3
|
||||
#define EFFECT_TYPE_REQUESTED_LOWLEVEL 4
|
||||
#define EFFECT_TYPE_REQUESTED_DIALOG 5
|
||||
#define EFFECT_TYPE_REQUESTED_GENERAL_COMPR 6
|
||||
#define EFFECT_TYPE_REQUESTED_EXPAND 7
|
||||
#define EFFECT_TYPE_REQUESTED_ARTISTIC 8
|
||||
#define EFFECT_TYPE_REQUESTED_COUNT 9
|
||||
#define EFFECT_TYPE_REQUESTED_NONE 0
|
||||
#define EFFECT_TYPE_REQUESTED_NIGHT 1
|
||||
#define EFFECT_TYPE_REQUESTED_NOISY 2
|
||||
#define EFFECT_TYPE_REQUESTED_LIMITED 3
|
||||
#define EFFECT_TYPE_REQUESTED_LOWLEVEL 4
|
||||
#define EFFECT_TYPE_REQUESTED_DIALOG 5
|
||||
#define EFFECT_TYPE_REQUESTED_GENERAL_COMPR 6
|
||||
#define EFFECT_TYPE_REQUESTED_EXPAND 7
|
||||
#define EFFECT_TYPE_REQUESTED_ARTISTIC 8
|
||||
#define EFFECT_TYPE_REQUESTED_COUNT 9
|
||||
|
||||
#define MATCH_EFFECT_TYPE 0
|
||||
#define MATCH_DYNAMIC_RANGE 1
|
||||
#define MATCH_DRC_CHARACTERISTIC 2
|
||||
#define MATCH_EFFECT_TYPE 0
|
||||
#define MATCH_DYNAMIC_RANGE 1
|
||||
#define MATCH_DRC_CHARACTERISTIC 2
|
||||
|
||||
typedef struct ia_drc_sel_proc_params_struct {
|
||||
WORD32 base_channel_count;
|
||||
WORD32 base_layout;
|
||||
WORD32 target_config_request_type;
|
||||
WORD32 num_downmix_id_requests;
|
||||
WORD32 requested_dwnmix_id[MAX_NUM_DOWNMIX_ID_REQUESTS];
|
||||
WORD32 requested_target_layout;
|
||||
WORD32 requested_target_ch_count;
|
||||
WORD32 target_ch_count_prelim;
|
||||
|
||||
typedef struct ia_drc_sel_proc_params_struct
|
||||
{
|
||||
WORD32 base_channel_count;
|
||||
WORD32 base_layout;
|
||||
WORD32 target_config_request_type;
|
||||
WORD32 num_downmix_id_requests;
|
||||
WORD32 requested_dwnmix_id[MAX_NUM_DOWNMIX_ID_REQUESTS];
|
||||
WORD32 requested_target_layout;
|
||||
WORD32 requested_target_ch_count;
|
||||
WORD32 target_ch_count_prelim;
|
||||
WORD32 loudness_normalization_on;
|
||||
FLOAT32 target_loudness;
|
||||
WORD32 album_mode;
|
||||
WORD32 peak_limiter;
|
||||
WORD32 loudness_deviation_max;
|
||||
WORD32 loudness_measurement_method;
|
||||
WORD32 loudness_measurement_system;
|
||||
WORD32 loudness_measurement_pre_proc;
|
||||
WORD32 device_cut_off_frequency;
|
||||
FLOAT32 loudness_norm_gain_db_max;
|
||||
FLOAT32 loudness_norm_gain_modification_db;
|
||||
FLOAT32 output_peak_level_max;
|
||||
|
||||
WORD32 loudness_normalization_on;
|
||||
FLOAT32 target_loudness;
|
||||
WORD32 album_mode;
|
||||
WORD32 peak_limiter;
|
||||
WORD32 loudness_deviation_max;
|
||||
WORD32 loudness_measurement_method;
|
||||
WORD32 loudness_measurement_system;
|
||||
WORD32 loudness_measurement_pre_proc;
|
||||
WORD32 device_cut_off_frequency;
|
||||
FLOAT32 loudness_norm_gain_db_max;
|
||||
FLOAT32 loudness_norm_gain_modification_db;
|
||||
FLOAT32 output_peak_level_max;
|
||||
WORD32 num_bands_supported;
|
||||
WORD32 dynamic_range_control_on;
|
||||
WORD32 num_drc_feature_requests;
|
||||
WORD32 drc_feature_req_type[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 requested_num_drc_effects[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 desired_num_drc_effects_of_requested[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 requested_drc_effect_type[MAX_NUM_DRC_FEATURE_REQUESTS]
|
||||
[MAX_NUM_DRC_EFFECT_TYPE_REQUESTS];
|
||||
WORD32 requested_dyn_range_measur_type[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 requested_dyn_range_range_flag[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
FLOAT32 requested_dyn_range_value[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
FLOAT32 requested_dyn_range_min_val[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
FLOAT32 requested_dyn_range_max_val[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 requested_drc_characteristic[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
|
||||
WORD32 num_bands_supported;
|
||||
WORD32 dynamic_range_control_on;
|
||||
WORD32 num_drc_feature_requests;
|
||||
WORD32 drc_feature_req_type[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 requested_num_drc_effects[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 desired_num_drc_effects_of_requested[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 requested_drc_effect_type[MAX_NUM_DRC_FEATURE_REQUESTS][MAX_NUM_DRC_EFFECT_TYPE_REQUESTS];
|
||||
WORD32 requested_dyn_range_measur_type[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 requested_dyn_range_range_flag[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
FLOAT32 requested_dyn_range_value[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
FLOAT32 requested_dyn_range_min_val[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
FLOAT32 requested_dyn_range_max_val[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 requested_drc_characteristic[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 loudness_eq_request;
|
||||
FLOAT32 sensitivity;
|
||||
FLOAT32 playback_gain;
|
||||
WORD32 eq_set_purpose_request;
|
||||
|
||||
|
||||
WORD32 loudness_eq_request;
|
||||
FLOAT32 sensitivity;
|
||||
FLOAT32 playback_gain;
|
||||
WORD32 eq_set_purpose_request;
|
||||
|
||||
FLOAT32 boost;
|
||||
FLOAT32 compress;
|
||||
WORD32 drc_characteristic_target;
|
||||
FLOAT32 boost;
|
||||
FLOAT32 compress;
|
||||
WORD32 drc_characteristic_target;
|
||||
} ia_drc_sel_proc_params_struct;
|
||||
|
||||
typedef struct ia_drc_sel_pro_struct
|
||||
{
|
||||
typedef struct ia_drc_sel_pro_struct {
|
||||
WORD32 first_frame;
|
||||
WORD32 drc_config_flag;
|
||||
WORD32 loudness_info_set_flag;
|
||||
WORD32 sel_proc_request_flag;
|
||||
WORD32 subband_domain_mode;
|
||||
WORD32 eq_inst_index[SUB_EQ_COUNT];
|
||||
WORD32 drc_instructions_index[SUB_DRC_COUNT];
|
||||
|
||||
WORD32 first_frame;
|
||||
WORD32 drc_config_flag;
|
||||
WORD32 loudness_info_set_flag;
|
||||
WORD32 sel_proc_request_flag;
|
||||
WORD32 subband_domain_mode;
|
||||
WORD32 eq_inst_index[SUB_EQ_COUNT];
|
||||
WORD32 drc_instructions_index[SUB_DRC_COUNT];
|
||||
ia_drc_sel_proc_params_struct uni_drc_sel_proc_params;
|
||||
|
||||
ia_drc_sel_proc_params_struct uni_drc_sel_proc_params;
|
||||
ia_drc_config drc_config;
|
||||
ia_drc_loudness_info_set_struct loudness_info_set;
|
||||
|
||||
ia_drc_config drc_config;
|
||||
ia_drc_loudness_info_set_struct loudness_info_set;
|
||||
WORD32 drc_inst_index_sel;
|
||||
WORD32 drc_coef_index_sel;
|
||||
WORD32 downmix_inst_index_sel;
|
||||
|
||||
WORD32 drc_inst_index_sel;
|
||||
WORD32 drc_coef_index_sel;
|
||||
WORD32 downmix_inst_index_sel;
|
||||
WORD32 drc_set_id_valid_flag[DRC_INSTRUCTIONS_COUNT_MAX];
|
||||
WORD32 eq_set_id_valid_flag[EQ_INSTRUCTIONS_COUNT_MAX];
|
||||
|
||||
WORD32 drc_set_id_valid_flag[DRC_INSTRUCTIONS_COUNT_MAX];
|
||||
WORD32 eq_set_id_valid_flag[EQ_INSTRUCTIONS_COUNT_MAX];
|
||||
WORD32 eq_inst_index_sel;
|
||||
WORD32 loud_eq_inst_index_sel;
|
||||
|
||||
WORD32 eq_inst_index_sel;
|
||||
WORD32 loud_eq_inst_index_sel;
|
||||
FLOAT32 compl_level_supported_total;
|
||||
|
||||
FLOAT32 compl_level_supported_total;
|
||||
|
||||
ia_drc_sel_proc_output_struct uni_drc_sel_proc_output;
|
||||
ia_drc_sel_proc_output_struct uni_drc_sel_proc_output;
|
||||
|
||||
} ia_drc_sel_pro_struct;
|
||||
|
||||
WORD32 impd_map_target_config_req_downmix_id(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
ia_drc_config* pstr_drc_config);
|
||||
WORD32 impd_map_target_config_req_downmix_id(
|
||||
ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
ia_drc_config* pstr_drc_config);
|
||||
|
||||
VOID impd_sel_downmix_matrix(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
ia_drc_config* pstr_drc_config);
|
||||
ia_drc_config* pstr_drc_config);
|
||||
|
||||
WORD32
|
||||
impd_find_drc_instructions_uni_drc(ia_drc_config* drc_config,
|
||||
WORD32 drc_set_id_requested,
|
||||
ia_drc_instructions_struct** str_drc_instruction_str);
|
||||
impd_find_drc_instructions_uni_drc(
|
||||
ia_drc_config* drc_config, WORD32 drc_set_id_requested,
|
||||
ia_drc_instructions_struct** str_drc_instruction_str);
|
||||
WORD32
|
||||
impd_find_eq_instructions(ia_drc_config* drc_config,
|
||||
WORD32 eq_set_id_requested,
|
||||
ia_eq_instructions_struct** str_eq_instructions);
|
||||
impd_find_eq_instructions(ia_drc_config* drc_config, WORD32 eq_set_id_requested,
|
||||
ia_eq_instructions_struct** str_eq_instructions);
|
||||
WORD32
|
||||
impd_find_downmix(ia_drc_config* drc_config,
|
||||
WORD32 requested_dwnmix_id,
|
||||
ia_downmix_instructions_struct** dwnmix_instructions);
|
||||
impd_find_downmix(ia_drc_config* drc_config, WORD32 requested_dwnmix_id,
|
||||
ia_downmix_instructions_struct** dwnmix_instructions);
|
||||
|
||||
|
||||
WORD32
|
||||
WORD32
|
||||
impd_find_eq_set_no_compression(ia_drc_config* pstr_drc_config,
|
||||
WORD32 requested_dwnmix_id,
|
||||
WORD32* no_compression_eq_cnt,
|
||||
WORD32* no_compression_eq_id);
|
||||
WORD32
|
||||
impd_match_eq_set(ia_drc_config* drc_config,
|
||||
WORD32 downmix_id,
|
||||
WORD32 drc_set_id,
|
||||
WORD32* eq_set_id_valid_flag,
|
||||
WORD32* matching_eq_set_cnt,
|
||||
WORD32* matching_eq_set_idx);
|
||||
|
||||
|
||||
|
||||
WORD32
|
||||
impd_select_loud_eq(ia_drc_config* pstr_drc_config,
|
||||
WORD32 requested_dwnmix_id,
|
||||
WORD32 drc_set_id_requested,
|
||||
WORD32 eq_set_id_requested,
|
||||
WORD32* loud_eq_id_selected);
|
||||
WORD32 requested_dwnmix_id,
|
||||
WORD32* no_compression_eq_cnt,
|
||||
WORD32* no_compression_eq_id);
|
||||
WORD32
|
||||
impd_match_eq_set(ia_drc_config* drc_config, WORD32 downmix_id,
|
||||
WORD32 drc_set_id, WORD32* eq_set_id_valid_flag,
|
||||
WORD32* matching_eq_set_cnt, WORD32* matching_eq_set_idx);
|
||||
|
||||
WORD32
|
||||
impd_drc_uni_selction_proc_init(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
ia_drc_sel_proc_params_struct * pstr_drc_sel_proc_params_struct,
|
||||
ia_drc_interface_struct* pstr_drc_interface,
|
||||
WORD32 sub_band_domain_mode);
|
||||
impd_select_loud_eq(ia_drc_config* pstr_drc_config, WORD32 requested_dwnmix_id,
|
||||
WORD32 drc_set_id_requested, WORD32 eq_set_id_requested,
|
||||
WORD32* loud_eq_id_selected);
|
||||
|
||||
WORD32
|
||||
impd_drc_uni_sel_proc_process(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
ia_drc_sel_proc_output_struct* hia_drc_sel_proc_output_struct);
|
||||
impd_drc_uni_selction_proc_init(
|
||||
ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||
ia_drc_interface_struct* pstr_drc_interface, WORD32 sub_band_domain_mode);
|
||||
|
||||
WORD32
|
||||
impd_drc_uni_sel_proc_process(
|
||||
ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
ia_drc_sel_proc_output_struct* hia_drc_sel_proc_output_struct);
|
||||
|
||||
WORD32
|
||||
impd_find_loud_eq_instructions_idx_for_id(ia_drc_config* drc_config,
|
||||
WORD32 loud_eq_set_id_requested,
|
||||
WORD32* instructions_idx);
|
||||
|
||||
|
||||
WORD32 loud_eq_set_id_requested,
|
||||
WORD32* instructions_idx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -27,310 +27,504 @@
|
|||
#include "impd_drc_interface.h"
|
||||
#include "impd_drc_selection_process.h"
|
||||
|
||||
WORD32 impd_drc_sel_proc_init_dflt(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc)
|
||||
{
|
||||
if (pstr_drc_uni_sel_proc != NULL) {
|
||||
WORD32 impd_drc_sel_proc_init_dflt(
|
||||
ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc) {
|
||||
if (pstr_drc_uni_sel_proc != NULL) {
|
||||
pstr_drc_uni_sel_proc->first_frame = 0;
|
||||
|
||||
pstr_drc_uni_sel_proc->first_frame = 0;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.base_channel_count = -1;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.base_layout = -1;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.target_config_request_type =
|
||||
0;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.num_downmix_id_requests = 0;
|
||||
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.base_channel_count = -1;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.base_layout = -1;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.target_config_request_type = 0;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.num_downmix_id_requests = 0;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.album_mode = 0;
|
||||
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.album_mode = 0;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.peak_limiter = 0;
|
||||
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.peak_limiter = 0;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_normalization_on =
|
||||
0;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.target_loudness = -24.0f;
|
||||
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_normalization_on = 0;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.target_loudness = -24.0f;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_deviation_max =
|
||||
LOUDNESS_DEVIATION_MAX_DEFAULT;
|
||||
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_deviation_max = LOUDNESS_DEVIATION_MAX_DEFAULT;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_measurement_method =
|
||||
USER_METHOD_DEFINITION_DEFAULT;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_measurement_system =
|
||||
USER_MEASUREMENT_SYSTEM_DEFAULT;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.loudness_measurement_pre_proc = USER_LOUDNESS_PREPROCESSING_DEFAULT;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.device_cut_off_frequency =
|
||||
500;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_norm_gain_db_max =
|
||||
LOUDNESS_NORMALIZATION_GAIN_MAX_DEFAULT;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.loudness_norm_gain_modification_db = 0.0f;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.output_peak_level_max = 0.0f;
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.peak_limiter == 1) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.output_peak_level_max =
|
||||
6.0f;
|
||||
}
|
||||
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_measurement_method = USER_METHOD_DEFINITION_DEFAULT;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_measurement_system = USER_MEASUREMENT_SYSTEM_DEFAULT;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_measurement_pre_proc = USER_LOUDNESS_PREPROCESSING_DEFAULT;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.device_cut_off_frequency = 500;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_norm_gain_db_max = LOUDNESS_NORMALIZATION_GAIN_MAX_DEFAULT;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_norm_gain_modification_db = 0.0f;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.output_peak_level_max = 0.0f;
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.peak_limiter == 1) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.dynamic_range_control_on = 1;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.num_bands_supported = 4;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.num_drc_feature_requests = 0;
|
||||
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.output_peak_level_max = 6.0f;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.boost = 1.f;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.compress = 1.f;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.drc_characteristic_target =
|
||||
0;
|
||||
|
||||
}
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_eq_request =
|
||||
LOUD_EQ_REQUEST_OFF;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.eq_set_purpose_request =
|
||||
EQ_PURPOSE_EQ_OFF;
|
||||
pstr_drc_uni_sel_proc->compl_level_supported_total =
|
||||
COMPLEXITY_LEVEL_SUPPORTED_TOTAL;
|
||||
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.dynamic_range_control_on = 1;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.num_bands_supported = 4;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.num_drc_feature_requests = 0;
|
||||
pstr_drc_uni_sel_proc->drc_inst_index_sel = -1;
|
||||
pstr_drc_uni_sel_proc->drc_coef_index_sel = -1;
|
||||
pstr_drc_uni_sel_proc->downmix_inst_index_sel = -1;
|
||||
pstr_drc_uni_sel_proc->drc_instructions_index[0] = -1;
|
||||
pstr_drc_uni_sel_proc->drc_instructions_index[1] = -1;
|
||||
pstr_drc_uni_sel_proc->drc_instructions_index[2] = -1;
|
||||
pstr_drc_uni_sel_proc->drc_instructions_index[3] = -1;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.output_peak_level_db = 0;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output
|
||||
.loudness_normalization_gain_db = 0;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.output_loudness =
|
||||
UNDEFINED_LOUDNESS_VALUE;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.num_sel_drc_sets = 0;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.active_downmix_id = 0;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.base_channel_count = 0;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.target_channel_count = 0;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.downmix_matrix_present = 0;
|
||||
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.boost = 1.f;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.compress = 1.f;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.drc_characteristic_target = 0;
|
||||
pstr_drc_uni_sel_proc->eq_inst_index[0] = -1;
|
||||
pstr_drc_uni_sel_proc->eq_inst_index[1] = -1;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_eq_request = LOUD_EQ_REQUEST_OFF;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.eq_set_purpose_request = EQ_PURPOSE_EQ_OFF;
|
||||
pstr_drc_uni_sel_proc->compl_level_supported_total = COMPLEXITY_LEVEL_SUPPORTED_TOTAL;
|
||||
return 0;
|
||||
}
|
||||
WORD32
|
||||
impd_drc_sel_proc_init_sel_proc_params(
|
||||
ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct) {
|
||||
if (pstr_drc_uni_sel_proc != NULL &&
|
||||
pstr_drc_sel_proc_params_struct != NULL) {
|
||||
if (memcmp(&pstr_drc_uni_sel_proc->uni_drc_sel_proc_params,
|
||||
pstr_drc_sel_proc_params_struct,
|
||||
sizeof(ia_drc_sel_proc_params_struct))) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params =
|
||||
*pstr_drc_sel_proc_params_struct;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
|
||||
pstr_drc_uni_sel_proc->drc_inst_index_sel = -1;
|
||||
pstr_drc_uni_sel_proc->drc_coef_index_sel = -1;
|
||||
pstr_drc_uni_sel_proc->downmix_inst_index_sel = -1;
|
||||
pstr_drc_uni_sel_proc->drc_instructions_index[0] = -1;
|
||||
pstr_drc_uni_sel_proc->drc_instructions_index[1] = -1;
|
||||
pstr_drc_uni_sel_proc->drc_instructions_index[2] = -1;
|
||||
pstr_drc_uni_sel_proc->drc_instructions_index[3] = -1;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.output_peak_level_db = 0;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.loudness_normalization_gain_db = 0;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.output_loudness = UNDEFINED_LOUDNESS_VALUE;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.num_sel_drc_sets = 0;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.active_downmix_id = 0;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.base_channel_count = 0;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.target_channel_count = 0;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.downmix_matrix_present = 0;
|
||||
return 0;
|
||||
}
|
||||
WORD32
|
||||
impd_drc_sel_proc_init_interface_params(
|
||||
ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
ia_drc_interface_struct* pstr_drc_interface) {
|
||||
WORD32 i, j;
|
||||
|
||||
pstr_drc_uni_sel_proc->eq_inst_index[0] = -1;
|
||||
pstr_drc_uni_sel_proc->eq_inst_index[1] = -1;
|
||||
if (pstr_drc_uni_sel_proc != NULL && pstr_drc_interface != NULL) {
|
||||
if (pstr_drc_interface->system_interface_flag) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.target_config_request_type !=
|
||||
pstr_drc_interface->system_interface.target_config_request_type) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.target_config_request_type =
|
||||
pstr_drc_interface->system_interface.target_config_request_type;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
WORD32
|
||||
impd_drc_sel_proc_init_sel_proc_params(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct)
|
||||
{
|
||||
|
||||
if (pstr_drc_uni_sel_proc != NULL && pstr_drc_sel_proc_params_struct != NULL) {
|
||||
|
||||
if ( memcmp ( &pstr_drc_uni_sel_proc->uni_drc_sel_proc_params, pstr_drc_sel_proc_params_struct, sizeof(ia_drc_sel_proc_params_struct) ))
|
||||
{
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params = *pstr_drc_sel_proc_params_struct;
|
||||
}
|
||||
switch (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.target_config_request_type) {
|
||||
case 0:
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.num_downmix_id_requests !=
|
||||
pstr_drc_interface->system_interface.num_downmix_id_requests) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.num_downmix_id_requests =
|
||||
pstr_drc_interface->system_interface.num_downmix_id_requests;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.num_downmix_id_requests;
|
||||
i++) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.requested_dwnmix_id[i] !=
|
||||
pstr_drc_interface->system_interface.requested_dwnmix_id[i]) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.requested_dwnmix_id[i] =
|
||||
pstr_drc_interface->system_interface.requested_dwnmix_id[i];
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.requested_target_layout !=
|
||||
pstr_drc_interface->system_interface.requested_target_layout) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.requested_target_layout =
|
||||
pstr_drc_interface->system_interface.requested_target_layout;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.requested_target_ch_count !=
|
||||
pstr_drc_interface->system_interface.requested_target_ch_count) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.requested_target_ch_count =
|
||||
pstr_drc_interface->system_interface.requested_target_ch_count;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
WORD32
|
||||
impd_drc_sel_proc_init_interface_params(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
ia_drc_interface_struct* pstr_drc_interface)
|
||||
{
|
||||
WORD32 i,j;
|
||||
|
||||
if (pstr_drc_uni_sel_proc != NULL && pstr_drc_interface != NULL) {
|
||||
|
||||
if (pstr_drc_interface->system_interface_flag) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.target_config_request_type != pstr_drc_interface->system_interface.target_config_request_type) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.target_config_request_type = pstr_drc_interface->system_interface.target_config_request_type;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
switch (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.target_config_request_type) {
|
||||
case 0:
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.num_downmix_id_requests != pstr_drc_interface->system_interface.num_downmix_id_requests) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.num_downmix_id_requests = pstr_drc_interface->system_interface.num_downmix_id_requests;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
for (i=0; i<pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.num_downmix_id_requests; i++) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dwnmix_id[i] != pstr_drc_interface->system_interface.requested_dwnmix_id[i]) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dwnmix_id[i] = pstr_drc_interface->system_interface.requested_dwnmix_id[i];
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_target_layout != pstr_drc_interface->system_interface.requested_target_layout) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_target_layout = pstr_drc_interface->system_interface.requested_target_layout;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_target_ch_count != pstr_drc_interface->system_interface.requested_target_ch_count) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_target_ch_count = pstr_drc_interface->system_interface.requested_target_ch_count;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->loudness_norm_ctrl_interface_flag) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_normalization_on != pstr_drc_interface->loudness_norm_ctrl_interface.loudness_normalization_on) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_normalization_on = pstr_drc_interface->loudness_norm_ctrl_interface.loudness_normalization_on;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_normalization_on) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.target_loudness != pstr_drc_interface->loudness_norm_ctrl_interface.target_loudness) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.target_loudness = pstr_drc_interface->loudness_norm_ctrl_interface.target_loudness;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->loudness_norm_parameter_interface_flag) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.album_mode != pstr_drc_interface->loudness_norm_param_interface.album_mode) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.album_mode = pstr_drc_interface->loudness_norm_param_interface.album_mode;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.peak_limiter != pstr_drc_interface->loudness_norm_param_interface.peak_limiter) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.peak_limiter = pstr_drc_interface->loudness_norm_param_interface.peak_limiter;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
if (pstr_drc_interface->loudness_norm_param_interface.change_loudness_deviation_max) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_deviation_max != pstr_drc_interface->loudness_norm_param_interface.loudness_deviation_max) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_deviation_max = pstr_drc_interface->loudness_norm_param_interface.loudness_deviation_max;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->loudness_norm_param_interface.change_loudness_measur_method) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_measurement_method != pstr_drc_interface->loudness_norm_param_interface.loudness_measurement_method) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_measurement_method = pstr_drc_interface->loudness_norm_param_interface.loudness_measurement_method;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->loudness_norm_param_interface.change_loudness_measur_pre_proc) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_measurement_pre_proc != pstr_drc_interface->loudness_norm_param_interface.loudness_measurement_pre_proc) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_measurement_pre_proc = pstr_drc_interface->loudness_norm_param_interface.loudness_measurement_pre_proc;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->loudness_norm_param_interface.change_loudness_measur_system) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_measurement_system != pstr_drc_interface->loudness_norm_param_interface.loudness_measurement_system) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_measurement_system = pstr_drc_interface->loudness_norm_param_interface.loudness_measurement_system;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->loudness_norm_param_interface.change_device_cut_off_freq) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.device_cut_off_frequency != pstr_drc_interface->loudness_norm_param_interface.device_cut_off_frequency) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.device_cut_off_frequency = pstr_drc_interface->loudness_norm_param_interface.device_cut_off_frequency;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->loudness_norm_param_interface.change_loudness_norm_gain_db_max) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_norm_gain_db_max != pstr_drc_interface->loudness_norm_param_interface.loudness_norm_gain_db_max) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_norm_gain_db_max = pstr_drc_interface->loudness_norm_param_interface.loudness_norm_gain_db_max;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->loudness_norm_param_interface.change_loudness_norm_gain_modification_db ) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_norm_gain_modification_db != pstr_drc_interface->loudness_norm_param_interface.loudness_norm_gain_modification_db) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_norm_gain_modification_db = pstr_drc_interface->loudness_norm_param_interface.loudness_norm_gain_modification_db;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->loudness_norm_param_interface.change_output_peak_level_max) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.output_peak_level_max != pstr_drc_interface->loudness_norm_param_interface.output_peak_level_max) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.output_peak_level_max = pstr_drc_interface->loudness_norm_param_interface.output_peak_level_max;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->drc_interface_flag) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.dynamic_range_control_on != pstr_drc_interface->drc_ctrl_interface.dynamic_range_control_on) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.dynamic_range_control_on = pstr_drc_interface->drc_ctrl_interface.dynamic_range_control_on;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
if (!pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.dynamic_range_control_on) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.num_drc_feature_requests = 0;
|
||||
}
|
||||
}
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.dynamic_range_control_on) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.num_drc_feature_requests != pstr_drc_interface->drc_ctrl_interface.num_drc_feature_requests) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.num_drc_feature_requests = pstr_drc_interface->drc_ctrl_interface.num_drc_feature_requests;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
for (i=0; i<pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.num_drc_feature_requests; i++) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.drc_feature_req_type[i] != pstr_drc_interface->drc_ctrl_interface.drc_feature_req_type[i]) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.drc_feature_req_type[i] = pstr_drc_interface->drc_ctrl_interface.drc_feature_req_type[i];
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
switch (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.drc_feature_req_type[i]) {
|
||||
case 0:
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_num_drc_effects[i] != pstr_drc_interface->drc_ctrl_interface.requested_num_drc_effects[i]) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_num_drc_effects[i] = pstr_drc_interface->drc_ctrl_interface.requested_num_drc_effects[i];
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.desired_num_drc_effects_of_requested[i] != pstr_drc_interface->drc_ctrl_interface.desired_num_drc_effects_of_requested[i]) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.desired_num_drc_effects_of_requested[i] = pstr_drc_interface->drc_ctrl_interface.desired_num_drc_effects_of_requested[i];
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
for (j=0; j<pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_num_drc_effects[i]; j++) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_drc_effect_type[i][j] != pstr_drc_interface->drc_ctrl_interface.requested_drc_effect_type[i][j]) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_drc_effect_type[i][j] = pstr_drc_interface->drc_ctrl_interface.requested_drc_effect_type[i][j];
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dyn_range_measur_type[i] != pstr_drc_interface->drc_ctrl_interface.requested_dyn_rng_measurement_type[i]) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dyn_range_measur_type[i] = pstr_drc_interface->drc_ctrl_interface.requested_dyn_rng_measurement_type[i];
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dyn_range_range_flag[i] != pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_is_single_val_flag[i]) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dyn_range_range_flag[i] = pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_is_single_val_flag[i];
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dyn_range_range_flag[i] == 0) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dyn_range_value[i] != pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_value[i]) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dyn_range_value[i] = pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_value[i];
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
} else {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dyn_range_min_val[i] != pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_min_val[i]) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dyn_range_min_val[i] = pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_min_val[i];
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dyn_range_max_val[i] != pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_max_val[i]) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dyn_range_max_val[i] = pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_max_val[i];
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_drc_characteristic[i] != pstr_drc_interface->drc_ctrl_interface.requested_drc_characteristic[i]) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_drc_characteristic[i] = pstr_drc_interface->drc_ctrl_interface.requested_drc_characteristic[i];
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->drc_parameter_interface_flag) {
|
||||
if (pstr_drc_interface->drc_parameter_interface.change_compress) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.compress != pstr_drc_interface->drc_parameter_interface.compress) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.compress = pstr_drc_interface->drc_parameter_interface.compress;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->drc_parameter_interface.change_boost) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.boost != pstr_drc_interface->drc_parameter_interface.boost) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.boost = pstr_drc_interface->drc_parameter_interface.boost;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->drc_parameter_interface.change_drc_characteristic_target) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.drc_characteristic_target != pstr_drc_interface->drc_parameter_interface.drc_characteristic_target) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.drc_characteristic_target = pstr_drc_interface->drc_parameter_interface.drc_characteristic_target;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->drc_uni_interface_ext_flag) {
|
||||
ia_drc_uni_interface_ext_struct* drc_uni_interface_ext = &pstr_drc_interface->drc_uni_interface_ext;
|
||||
if (drc_uni_interface_ext->loudness_eq_parameter_interface_flag) {
|
||||
ia_loudness_eq_parameter_interface_struct* loudness_eq_parameter_interface = &drc_uni_interface_ext->loudness_eq_parameter_interface;
|
||||
if (loudness_eq_parameter_interface->loudness_eq_request_flag) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_eq_request = loudness_eq_parameter_interface->loudness_eq_request;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.sensitivity = loudness_eq_parameter_interface->sensitivity;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.playback_gain = loudness_eq_parameter_interface->playback_gain;
|
||||
}
|
||||
}
|
||||
if (drc_uni_interface_ext->eq_ctrl_interface_flag) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.eq_set_purpose_request = drc_uni_interface_ext->eq_ctrl_interface.eq_set_purpose_request;
|
||||
}
|
||||
if (pstr_drc_interface->loudness_norm_ctrl_interface_flag) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.loudness_normalization_on !=
|
||||
pstr_drc_interface->loudness_norm_ctrl_interface
|
||||
.loudness_normalization_on) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.loudness_normalization_on =
|
||||
pstr_drc_interface->loudness_norm_ctrl_interface
|
||||
.loudness_normalization_on;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.loudness_normalization_on) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.target_loudness !=
|
||||
pstr_drc_interface->loudness_norm_ctrl_interface.target_loudness) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.target_loudness =
|
||||
pstr_drc_interface->loudness_norm_ctrl_interface.target_loudness;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->loudness_norm_parameter_interface_flag) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.album_mode !=
|
||||
pstr_drc_interface->loudness_norm_param_interface.album_mode) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.album_mode =
|
||||
pstr_drc_interface->loudness_norm_param_interface.album_mode;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.peak_limiter !=
|
||||
pstr_drc_interface->loudness_norm_param_interface.peak_limiter) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.peak_limiter =
|
||||
pstr_drc_interface->loudness_norm_param_interface.peak_limiter;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
if (pstr_drc_interface->loudness_norm_param_interface
|
||||
.change_loudness_deviation_max) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.loudness_deviation_max !=
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.loudness_deviation_max) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.loudness_deviation_max =
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.loudness_deviation_max;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->loudness_norm_param_interface
|
||||
.change_loudness_measur_method) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.loudness_measurement_method !=
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.loudness_measurement_method) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.loudness_measurement_method =
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.loudness_measurement_method;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->loudness_norm_param_interface
|
||||
.change_loudness_measur_pre_proc) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.loudness_measurement_pre_proc !=
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.loudness_measurement_pre_proc) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.loudness_measurement_pre_proc =
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.loudness_measurement_pre_proc;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->loudness_norm_param_interface
|
||||
.change_loudness_measur_system) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.loudness_measurement_system !=
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.loudness_measurement_system) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.loudness_measurement_system =
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.loudness_measurement_system;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->loudness_norm_param_interface
|
||||
.change_device_cut_off_freq) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.device_cut_off_frequency !=
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.device_cut_off_frequency) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.device_cut_off_frequency =
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.device_cut_off_frequency;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->loudness_norm_param_interface
|
||||
.change_loudness_norm_gain_db_max) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.loudness_norm_gain_db_max !=
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.loudness_norm_gain_db_max) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.loudness_norm_gain_db_max =
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.loudness_norm_gain_db_max;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->loudness_norm_param_interface
|
||||
.change_loudness_norm_gain_modification_db) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.loudness_norm_gain_modification_db !=
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.loudness_norm_gain_modification_db) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.loudness_norm_gain_modification_db =
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.loudness_norm_gain_modification_db;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->loudness_norm_param_interface
|
||||
.change_output_peak_level_max) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.output_peak_level_max !=
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.output_peak_level_max) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.output_peak_level_max =
|
||||
pstr_drc_interface->loudness_norm_param_interface
|
||||
.output_peak_level_max;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->drc_interface_flag) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.dynamic_range_control_on !=
|
||||
pstr_drc_interface->drc_ctrl_interface.dynamic_range_control_on) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.dynamic_range_control_on =
|
||||
pstr_drc_interface->drc_ctrl_interface.dynamic_range_control_on;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
if (!pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.dynamic_range_control_on) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.num_drc_feature_requests = 0;
|
||||
}
|
||||
}
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.dynamic_range_control_on) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.num_drc_feature_requests !=
|
||||
pstr_drc_interface->drc_ctrl_interface.num_drc_feature_requests) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.num_drc_feature_requests =
|
||||
pstr_drc_interface->drc_ctrl_interface.num_drc_feature_requests;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
for (i = 0; i < pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.num_drc_feature_requests;
|
||||
i++) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.drc_feature_req_type[i] !=
|
||||
pstr_drc_interface->drc_ctrl_interface.drc_feature_req_type[i]) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.drc_feature_req_type[i] =
|
||||
pstr_drc_interface->drc_ctrl_interface.drc_feature_req_type[i];
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
switch (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.drc_feature_req_type[i]) {
|
||||
case 0:
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.requested_num_drc_effects[i] !=
|
||||
pstr_drc_interface->drc_ctrl_interface
|
||||
.requested_num_drc_effects[i]) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.requested_num_drc_effects[i] =
|
||||
pstr_drc_interface->drc_ctrl_interface
|
||||
.requested_num_drc_effects[i];
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.desired_num_drc_effects_of_requested[i] !=
|
||||
pstr_drc_interface->drc_ctrl_interface
|
||||
.desired_num_drc_effects_of_requested[i]) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.desired_num_drc_effects_of_requested[i] =
|
||||
pstr_drc_interface->drc_ctrl_interface
|
||||
.desired_num_drc_effects_of_requested[i];
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
for (j = 0; j < pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.requested_num_drc_effects[i];
|
||||
j++) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.requested_drc_effect_type[i][j] !=
|
||||
pstr_drc_interface->drc_ctrl_interface
|
||||
.requested_drc_effect_type[i][j]) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.requested_drc_effect_type[i][j] =
|
||||
pstr_drc_interface->drc_ctrl_interface
|
||||
.requested_drc_effect_type[i][j];
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.requested_dyn_range_measur_type[i] !=
|
||||
pstr_drc_interface->drc_ctrl_interface
|
||||
.requested_dyn_rng_measurement_type[i]) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.requested_dyn_range_measur_type[i] =
|
||||
pstr_drc_interface->drc_ctrl_interface
|
||||
.requested_dyn_rng_measurement_type[i];
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.requested_dyn_range_range_flag[i] !=
|
||||
pstr_drc_interface->drc_ctrl_interface
|
||||
.requested_dyn_range_is_single_val_flag[i]) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.requested_dyn_range_range_flag[i] =
|
||||
pstr_drc_interface->drc_ctrl_interface
|
||||
.requested_dyn_range_is_single_val_flag[i];
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.requested_dyn_range_range_flag[i] == 0) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.requested_dyn_range_value[i] !=
|
||||
pstr_drc_interface->drc_ctrl_interface
|
||||
.requested_dyn_range_value[i]) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.requested_dyn_range_value[i] =
|
||||
pstr_drc_interface->drc_ctrl_interface
|
||||
.requested_dyn_range_value[i];
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
} else {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.requested_dyn_range_min_val[i] !=
|
||||
pstr_drc_interface->drc_ctrl_interface
|
||||
.requested_dyn_range_min_val[i]) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.requested_dyn_range_min_val[i] =
|
||||
pstr_drc_interface->drc_ctrl_interface
|
||||
.requested_dyn_range_min_val[i];
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.requested_dyn_range_max_val[i] !=
|
||||
pstr_drc_interface->drc_ctrl_interface
|
||||
.requested_dyn_range_max_val[i]) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.requested_dyn_range_max_val[i] =
|
||||
pstr_drc_interface->drc_ctrl_interface
|
||||
.requested_dyn_range_max_val[i];
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.requested_drc_characteristic[i] !=
|
||||
pstr_drc_interface->drc_ctrl_interface
|
||||
.requested_drc_characteristic[i]) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.requested_drc_characteristic[i] =
|
||||
pstr_drc_interface->drc_ctrl_interface
|
||||
.requested_drc_characteristic[i];
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->drc_parameter_interface_flag) {
|
||||
if (pstr_drc_interface->drc_parameter_interface.change_compress) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.compress !=
|
||||
pstr_drc_interface->drc_parameter_interface.compress) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.compress =
|
||||
pstr_drc_interface->drc_parameter_interface.compress;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->drc_parameter_interface.change_boost) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.boost !=
|
||||
pstr_drc_interface->drc_parameter_interface.boost) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.boost =
|
||||
pstr_drc_interface->drc_parameter_interface.boost;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->drc_parameter_interface
|
||||
.change_drc_characteristic_target) {
|
||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.drc_characteristic_target !=
|
||||
pstr_drc_interface->drc_parameter_interface
|
||||
.drc_characteristic_target) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||
.drc_characteristic_target =
|
||||
pstr_drc_interface->drc_parameter_interface
|
||||
.drc_characteristic_target;
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pstr_drc_interface->drc_uni_interface_ext_flag) {
|
||||
ia_drc_uni_interface_ext_struct* drc_uni_interface_ext =
|
||||
&pstr_drc_interface->drc_uni_interface_ext;
|
||||
if (drc_uni_interface_ext->loudness_eq_parameter_interface_flag) {
|
||||
ia_loudness_eq_parameter_interface_struct*
|
||||
loudness_eq_parameter_interface =
|
||||
&drc_uni_interface_ext->loudness_eq_parameter_interface;
|
||||
if (loudness_eq_parameter_interface->loudness_eq_request_flag) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_eq_request =
|
||||
loudness_eq_parameter_interface->loudness_eq_request;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.sensitivity =
|
||||
loudness_eq_parameter_interface->sensitivity;
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.playback_gain =
|
||||
loudness_eq_parameter_interface->playback_gain;
|
||||
}
|
||||
}
|
||||
if (drc_uni_interface_ext->eq_ctrl_interface_flag) {
|
||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.eq_set_purpose_request =
|
||||
drc_uni_interface_ext->eq_ctrl_interface.eq_set_purpose_request;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -38,228 +38,270 @@
|
|||
#include "impd_drc_rom.h"
|
||||
|
||||
WORD32 impd_shape_filt_block_adapt(const FLOAT32 drc_gain,
|
||||
shape_filter_block* shape_filter_block)
|
||||
{
|
||||
// WORD32 err = 0;
|
||||
WORD32 i;
|
||||
FLOAT32 warpedGain, x1, y1;
|
||||
shape_filter_block->drc_gain_last = drc_gain;
|
||||
for (i=0; i<4; i++) {
|
||||
shape_filter_block* shape_filter_block) {
|
||||
// WORD32 err = 0;
|
||||
WORD32 i;
|
||||
FLOAT32 warpedGain, x1, y1;
|
||||
shape_filter_block->drc_gain_last = drc_gain;
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (shape_filter_block->shape_filter[i].type == SHAPE_FILTER_TYPE_OFF)
|
||||
continue;
|
||||
else if (shape_filter_block->shape_filter[i].type ==
|
||||
SHAPE_FILTER_TYPE_LF_CUT ||
|
||||
shape_filter_block->shape_filter[i].type ==
|
||||
SHAPE_FILTER_TYPE_HF_CUT) {
|
||||
if (drc_gain < 1.0f)
|
||||
warpedGain = -1.0f;
|
||||
else
|
||||
warpedGain =
|
||||
(drc_gain - 1.0f) /
|
||||
(drc_gain - 1.0f + shape_filter_block->shape_filter[i].gain_offset);
|
||||
x1 = shape_filter_block->shape_filter[i].a1;
|
||||
} else if (shape_filter_block->shape_filter[i].type ==
|
||||
SHAPE_FILTER_TYPE_LF_BOOST ||
|
||||
shape_filter_block->shape_filter[i].type ==
|
||||
SHAPE_FILTER_TYPE_HF_BOOST) {
|
||||
if (drc_gain >= 1.0f)
|
||||
warpedGain = -1.0f;
|
||||
else
|
||||
warpedGain =
|
||||
(1.0f - drc_gain) /
|
||||
(1.0f +
|
||||
drc_gain *
|
||||
(shape_filter_block->shape_filter[i].gain_offset - 1.0f));
|
||||
x1 = shape_filter_block->shape_filter[i].b1;
|
||||
}
|
||||
|
||||
if(shape_filter_block->shape_filter[i].type==SHAPE_FILTER_TYPE_OFF)
|
||||
continue;
|
||||
else if(shape_filter_block->shape_filter[i].type==SHAPE_FILTER_TYPE_LF_CUT||shape_filter_block->shape_filter[i].type==SHAPE_FILTER_TYPE_HF_CUT)
|
||||
{
|
||||
if (drc_gain < 1.0f)
|
||||
warpedGain = -1.0f;
|
||||
else
|
||||
warpedGain = (drc_gain - 1.0f) / (drc_gain - 1.0f + shape_filter_block->shape_filter[i].gain_offset);
|
||||
x1 = shape_filter_block->shape_filter[i].a1;
|
||||
if (warpedGain <= 0.0f) {
|
||||
y1 = x1;
|
||||
} else if (warpedGain <
|
||||
shape_filter_block->shape_filter[i].warped_gain_max) {
|
||||
y1 = x1 + shape_filter_block->shape_filter[i].factor * warpedGain;
|
||||
} else {
|
||||
y1 = shape_filter_block->shape_filter[i].y1_bound;
|
||||
}
|
||||
if (shape_filter_block->shape_filter[i].type == SHAPE_FILTER_TYPE_LF_CUT) {
|
||||
shape_filter_block->shape_filter[i].b1 = y1;
|
||||
} else if (shape_filter_block->shape_filter[i].type ==
|
||||
SHAPE_FILTER_TYPE_HF_CUT) {
|
||||
shape_filter_block->shape_filter[i].g_norm =
|
||||
shape_filter_block->shape_filter[i].coeff_sum /
|
||||
(shape_filter_block->shape_filter[i].partial_coeff_sum + y1);
|
||||
shape_filter_block->shape_filter[i].b1 = y1;
|
||||
} else if (shape_filter_block->shape_filter[i].type ==
|
||||
SHAPE_FILTER_TYPE_HF_BOOST) {
|
||||
shape_filter_block->shape_filter[i].g_norm =
|
||||
(shape_filter_block->shape_filter[i].partial_coeff_sum + y1) /
|
||||
shape_filter_block->shape_filter[i].coeff_sum;
|
||||
shape_filter_block->shape_filter[i].a1 = y1;
|
||||
} else if (shape_filter_block->shape_filter[i].type ==
|
||||
SHAPE_FILTER_TYPE_LF_BOOST) {
|
||||
shape_filter_block->shape_filter[i].a1 = y1;
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
WORD32 resetshape_flter_block(shape_filter_block* shape_filter_block) {
|
||||
WORD32 i, c;
|
||||
shape_filter_block->drc_gain_last = -1.0f;
|
||||
impd_shape_filt_block_adapt(1.0f, shape_filter_block);
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (c = 0; c < MAX_CHANNEL_COUNT; c++) {
|
||||
shape_filter_block->shape_filter[i].audio_in_state_1[c] = 0.0f;
|
||||
shape_filter_block->shape_filter[i].audio_in_state_2[c] = 0.0f;
|
||||
shape_filter_block->shape_filter[i].audio_out_state_1[c] = 0.0f;
|
||||
shape_filter_block->shape_filter[i].audio_out_state_2[c] = 0.0f;
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
WORD32 impd_shape_filt_block_init(
|
||||
ia_shape_filter_block_params_struct* shape_flter_block_params,
|
||||
shape_filter_block* shape_filter_block) {
|
||||
// WORD32 err = 0;
|
||||
FLOAT32 x1;
|
||||
FLOAT32 x2 = 0.0f;
|
||||
FLOAT32 radius;
|
||||
if (shape_flter_block_params->lf_cut_filter_present) {
|
||||
ia_shape_filter_params_struct* params =
|
||||
&shape_flter_block_params->str_lf_cut_params;
|
||||
shape_filter_block->shape_filter[0].type = SHAPE_FILTER_TYPE_LF_CUT;
|
||||
shape_filter_block->shape_filter[0].gain_offset =
|
||||
shape_filt_lf_gain_offset_tbl[params->corner_freq_index]
|
||||
[params->filter_strength_index];
|
||||
shape_filter_block->shape_filter[0].y1_bound =
|
||||
shape_filt_lf_y1_bound_tbl[params->corner_freq_index]
|
||||
[params->filter_strength_index];
|
||||
x1 = -shape_filt_lf_radius_tbl[params->corner_freq_index];
|
||||
shape_filter_block->shape_filter[0].warped_gain_max =
|
||||
SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE /
|
||||
(SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE +
|
||||
shape_filter_block->shape_filter[0].gain_offset);
|
||||
shape_filter_block->shape_filter[0].factor =
|
||||
(shape_filter_block->shape_filter[0].y1_bound - x1) /
|
||||
shape_filter_block->shape_filter[0].warped_gain_max;
|
||||
shape_filter_block->shape_filter[0].a1 = x1;
|
||||
|
||||
} else {
|
||||
shape_filter_block->shape_filter[0].type = SHAPE_FILTER_TYPE_OFF;
|
||||
}
|
||||
if (shape_flter_block_params->lf_boost_filter_present) {
|
||||
ia_shape_filter_params_struct* params =
|
||||
&shape_flter_block_params->str_lf_boost_params;
|
||||
shape_filter_block->shape_filter[1].type = SHAPE_FILTER_TYPE_LF_BOOST;
|
||||
shape_filter_block->shape_filter[1].gain_offset =
|
||||
shape_filt_lf_gain_offset_tbl[params->corner_freq_index]
|
||||
[params->filter_strength_index];
|
||||
shape_filter_block->shape_filter[1].y1_bound =
|
||||
shape_filt_lf_y1_bound_tbl[params->corner_freq_index]
|
||||
[params->filter_strength_index];
|
||||
x1 = -shape_filt_lf_radius_tbl[params->corner_freq_index];
|
||||
shape_filter_block->shape_filter[1].warped_gain_max =
|
||||
SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE /
|
||||
(SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE +
|
||||
shape_filter_block->shape_filter[1].gain_offset);
|
||||
shape_filter_block->shape_filter[1].factor =
|
||||
(shape_filter_block->shape_filter[1].y1_bound - x1) /
|
||||
shape_filter_block->shape_filter[1].warped_gain_max;
|
||||
shape_filter_block->shape_filter[1].b1 = x1;
|
||||
|
||||
} else {
|
||||
shape_filter_block->shape_filter[1].type = SHAPE_FILTER_TYPE_OFF;
|
||||
}
|
||||
if (shape_flter_block_params->hf_cut_filter_present) {
|
||||
ia_shape_filter_params_struct* params =
|
||||
&shape_flter_block_params->str_hfCutParams;
|
||||
shape_filter_block->shape_filter[2].type = SHAPE_FILTER_TYPE_HF_CUT;
|
||||
shape_filter_block->shape_filter[2].gain_offset =
|
||||
shape_filt_hf_gain_offset_tbl[params->corner_freq_index]
|
||||
[params->filter_strength_index];
|
||||
shape_filter_block->shape_filter[2].y1_bound =
|
||||
shape_filt_hf_y1_bound_tbl[params->corner_freq_index]
|
||||
[params->filter_strength_index];
|
||||
radius = shape_filt_hf_radius_tbl[params->corner_freq_index];
|
||||
x1 = (FLOAT32)(
|
||||
-2.0f * radius *
|
||||
cos(2.0f * M_PI *
|
||||
shape_filt_cutoff_freq_norm_hf_tbl[params->corner_freq_index]));
|
||||
x2 = radius * radius;
|
||||
shape_filter_block->shape_filter[2].warped_gain_max =
|
||||
SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE /
|
||||
(SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE +
|
||||
shape_filter_block->shape_filter[2].gain_offset);
|
||||
shape_filter_block->shape_filter[2].factor =
|
||||
(shape_filter_block->shape_filter[2].y1_bound - x1) /
|
||||
shape_filter_block->shape_filter[2].warped_gain_max;
|
||||
shape_filter_block->shape_filter[2].coeff_sum = 1.0f + x1 + x2;
|
||||
shape_filter_block->shape_filter[2].partial_coeff_sum = 1.0f + x2;
|
||||
shape_filter_block->shape_filter[2].a1 = x1;
|
||||
shape_filter_block->shape_filter[2].a2 = x2;
|
||||
shape_filter_block->shape_filter[2].b2 = x2;
|
||||
} else {
|
||||
shape_filter_block->shape_filter[2].type = SHAPE_FILTER_TYPE_OFF;
|
||||
}
|
||||
if (shape_flter_block_params->hf_boost_filter_present) {
|
||||
ia_shape_filter_params_struct* params =
|
||||
&shape_flter_block_params->str_hf_boost_params;
|
||||
shape_filter_block->shape_filter[3].type = SHAPE_FILTER_TYPE_HF_BOOST;
|
||||
shape_filter_block->shape_filter[3].gain_offset =
|
||||
shape_filt_hf_gain_offset_tbl[params->corner_freq_index]
|
||||
[params->filter_strength_index];
|
||||
shape_filter_block->shape_filter[3].y1_bound =
|
||||
shape_filt_hf_y1_bound_tbl[params->corner_freq_index]
|
||||
[params->filter_strength_index];
|
||||
radius = shape_filt_hf_radius_tbl[params->corner_freq_index];
|
||||
x1 = (FLOAT32)(
|
||||
-2.0f * radius *
|
||||
cos(2.0f * M_PI *
|
||||
shape_filt_cutoff_freq_norm_hf_tbl[params->corner_freq_index]));
|
||||
x2 = radius * radius;
|
||||
shape_filter_block->shape_filter[3].warped_gain_max =
|
||||
SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE /
|
||||
(SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE +
|
||||
shape_filter_block->shape_filter[3].gain_offset);
|
||||
shape_filter_block->shape_filter[3].factor =
|
||||
(shape_filter_block->shape_filter[3].y1_bound - x1) /
|
||||
shape_filter_block->shape_filter[3].warped_gain_max;
|
||||
shape_filter_block->shape_filter[3].coeff_sum = 1.0f + x1 + x2;
|
||||
shape_filter_block->shape_filter[3].partial_coeff_sum = 1.0f + x2;
|
||||
shape_filter_block->shape_filter[3].b1 = x1;
|
||||
shape_filter_block->shape_filter[3].b2 = x2;
|
||||
shape_filter_block->shape_filter[3].a2 = x2;
|
||||
|
||||
} else {
|
||||
shape_filter_block->shape_filter[3].type = SHAPE_FILTER_TYPE_OFF;
|
||||
}
|
||||
resetshape_flter_block(shape_filter_block);
|
||||
shape_filter_block->shape_flter_block_flag = 1;
|
||||
return (0);
|
||||
}
|
||||
|
||||
WORD32 impd_shape_filt_block_time_process(
|
||||
shape_filter_block* shape_filter_block, FLOAT32* drc_gain,
|
||||
const WORD32 channel, FLOAT32* audio_in, WORD32 start, WORD32 end) {
|
||||
WORD32 i, j, err = 0;
|
||||
FLOAT32 audio_out;
|
||||
|
||||
if (shape_filter_block->shape_flter_block_flag) {
|
||||
for (i = start; i < end; i++) {
|
||||
FLOAT32 tmp = audio_in[i];
|
||||
for (j = 0; j < 4; j++) {
|
||||
if (shape_filter_block->shape_filter[j].type ==
|
||||
SHAPE_FILTER_TYPE_LF_CUT ||
|
||||
shape_filter_block->shape_filter[j].type ==
|
||||
SHAPE_FILTER_TYPE_LF_BOOST) {
|
||||
audio_out = tmp +
|
||||
shape_filter_block->shape_filter[j].b1 *
|
||||
shape_filter_block->shape_filter[j]
|
||||
.audio_in_state_1[channel] -
|
||||
shape_filter_block->shape_filter[j].a1 *
|
||||
shape_filter_block->shape_filter[j]
|
||||
.audio_out_state_1[channel];
|
||||
shape_filter_block->shape_filter[j].audio_in_state_1[channel] = tmp;
|
||||
shape_filter_block->shape_filter[j].audio_out_state_1[channel] =
|
||||
audio_out;
|
||||
|
||||
} else if (shape_filter_block->shape_filter[j].type ==
|
||||
SHAPE_FILTER_TYPE_HF_CUT ||
|
||||
shape_filter_block->shape_filter[j].type ==
|
||||
SHAPE_FILTER_TYPE_HF_BOOST) {
|
||||
audio_out = shape_filter_block->shape_filter[j].g_norm * tmp +
|
||||
shape_filter_block->shape_filter[j].b1 *
|
||||
shape_filter_block->shape_filter[j]
|
||||
.audio_in_state_1[channel] +
|
||||
shape_filter_block->shape_filter[j].b2 *
|
||||
shape_filter_block->shape_filter[j]
|
||||
.audio_in_state_2[channel] -
|
||||
shape_filter_block->shape_filter[j].a1 *
|
||||
shape_filter_block->shape_filter[j]
|
||||
.audio_out_state_1[channel] -
|
||||
shape_filter_block->shape_filter[j].a2 *
|
||||
shape_filter_block->shape_filter[j]
|
||||
.audio_out_state_2[channel];
|
||||
shape_filter_block->shape_filter[j].audio_in_state_2[channel] =
|
||||
shape_filter_block->shape_filter[j].audio_in_state_1[channel];
|
||||
shape_filter_block->shape_filter[j].audio_in_state_1[channel] =
|
||||
shape_filter_block->shape_filter[j].g_norm * tmp;
|
||||
shape_filter_block->shape_filter[j].audio_out_state_2[channel] =
|
||||
shape_filter_block->shape_filter[j].audio_out_state_1[channel];
|
||||
shape_filter_block->shape_filter[j].audio_out_state_1[channel] =
|
||||
audio_out;
|
||||
} else {
|
||||
audio_out = tmp;
|
||||
}
|
||||
else if(shape_filter_block->shape_filter[i].type==SHAPE_FILTER_TYPE_LF_BOOST||shape_filter_block->shape_filter[i].type==SHAPE_FILTER_TYPE_HF_BOOST)
|
||||
{
|
||||
if (drc_gain >= 1.0f)
|
||||
warpedGain = -1.0f;
|
||||
else
|
||||
warpedGain = (1.0f - drc_gain) / (1.0f + drc_gain * (shape_filter_block->shape_filter[i].gain_offset - 1.0f));
|
||||
x1 = shape_filter_block->shape_filter[i].b1;
|
||||
tmp = audio_out;
|
||||
}
|
||||
|
||||
audio_in[i] = audio_out * drc_gain[i];
|
||||
}
|
||||
|
||||
if (warpedGain <= 0.0f)
|
||||
{
|
||||
y1 = x1;
|
||||
} else {
|
||||
for (i = start; i < end; i++) {
|
||||
audio_in[i] = audio_in[i] * drc_gain[i];
|
||||
}
|
||||
else if (warpedGain < shape_filter_block->shape_filter[i].warped_gain_max) {
|
||||
y1 = x1 + shape_filter_block->shape_filter[i].factor * warpedGain;
|
||||
}
|
||||
else
|
||||
{
|
||||
y1 = shape_filter_block->shape_filter[i].y1_bound;
|
||||
}
|
||||
if(shape_filter_block->shape_filter[i].type==SHAPE_FILTER_TYPE_LF_CUT)
|
||||
{
|
||||
shape_filter_block->shape_filter[i].b1 = y1;
|
||||
}
|
||||
else if(shape_filter_block->shape_filter[i].type==SHAPE_FILTER_TYPE_HF_CUT)
|
||||
{
|
||||
shape_filter_block->shape_filter[i].g_norm = shape_filter_block->shape_filter[i].coeff_sum / (shape_filter_block->shape_filter[i].partial_coeff_sum + y1);
|
||||
shape_filter_block->shape_filter[i].b1 = y1;
|
||||
}
|
||||
else if(shape_filter_block->shape_filter[i].type==SHAPE_FILTER_TYPE_HF_BOOST)
|
||||
{
|
||||
shape_filter_block->shape_filter[i].g_norm = (shape_filter_block->shape_filter[i].partial_coeff_sum + y1) / shape_filter_block->shape_filter[i].coeff_sum;
|
||||
shape_filter_block->shape_filter[i].a1 = y1;
|
||||
}
|
||||
else if(shape_filter_block->shape_filter[i].type==SHAPE_FILTER_TYPE_LF_BOOST)
|
||||
{
|
||||
shape_filter_block->shape_filter[i].a1 = y1;
|
||||
}
|
||||
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
WORD32 resetshape_flter_block(shape_filter_block* shape_filter_block)
|
||||
{
|
||||
WORD32 i, c;
|
||||
shape_filter_block->drc_gain_last = -1.0f;
|
||||
impd_shape_filt_block_adapt(1.0f, shape_filter_block);
|
||||
for (i=0; i<4; i++) {
|
||||
for (c=0; c<MAX_CHANNEL_COUNT; c++)
|
||||
{
|
||||
shape_filter_block->shape_filter[i].audio_in_state_1[c] = 0.0f;
|
||||
shape_filter_block->shape_filter[i].audio_in_state_2[c] = 0.0f;
|
||||
shape_filter_block->shape_filter[i].audio_out_state_1[c] = 0.0f;
|
||||
shape_filter_block->shape_filter[i].audio_out_state_2[c] = 0.0f;
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
WORD32 impd_shape_filt_block_init(ia_shape_filter_block_params_struct* shape_flter_block_params,
|
||||
shape_filter_block* shape_filter_block)
|
||||
{
|
||||
//WORD32 err = 0;
|
||||
FLOAT32 x1;
|
||||
FLOAT32 x2 = 0.0f;
|
||||
FLOAT32 radius;
|
||||
if (shape_flter_block_params->lf_cut_filter_present) {
|
||||
|
||||
ia_shape_filter_params_struct* params = &shape_flter_block_params->str_lf_cut_params;
|
||||
shape_filter_block->shape_filter[0].type = SHAPE_FILTER_TYPE_LF_CUT;
|
||||
shape_filter_block->shape_filter[0].gain_offset = shape_filt_lf_gain_offset_tbl[params->corner_freq_index][params->filter_strength_index];
|
||||
shape_filter_block->shape_filter[0].y1_bound = shape_filt_lf_y1_bound_tbl[params->corner_freq_index][params->filter_strength_index];
|
||||
x1 = - shape_filt_lf_radius_tbl[params->corner_freq_index];
|
||||
shape_filter_block->shape_filter[0].warped_gain_max = SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE / (SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE + shape_filter_block->shape_filter[0].gain_offset);
|
||||
shape_filter_block->shape_filter[0].factor = (shape_filter_block->shape_filter[0].y1_bound - x1) / shape_filter_block->shape_filter[0].warped_gain_max;
|
||||
shape_filter_block->shape_filter[0].a1 = x1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
shape_filter_block->shape_filter[0].type = SHAPE_FILTER_TYPE_OFF;
|
||||
}
|
||||
if (shape_flter_block_params->lf_boost_filter_present) {
|
||||
|
||||
ia_shape_filter_params_struct* params = &shape_flter_block_params->str_lf_boost_params;
|
||||
shape_filter_block->shape_filter[1].type = SHAPE_FILTER_TYPE_LF_BOOST;
|
||||
shape_filter_block->shape_filter[1].gain_offset = shape_filt_lf_gain_offset_tbl[params->corner_freq_index][params->filter_strength_index];
|
||||
shape_filter_block->shape_filter[1].y1_bound = shape_filt_lf_y1_bound_tbl[params->corner_freq_index][params->filter_strength_index];
|
||||
x1 = - shape_filt_lf_radius_tbl[params->corner_freq_index];
|
||||
shape_filter_block->shape_filter[1].warped_gain_max = SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE / (SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE + shape_filter_block->shape_filter[1].gain_offset);
|
||||
shape_filter_block->shape_filter[1].factor = (shape_filter_block->shape_filter[1].y1_bound - x1) / shape_filter_block->shape_filter[1].warped_gain_max;
|
||||
shape_filter_block->shape_filter[1].b1 = x1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
shape_filter_block->shape_filter[1].type = SHAPE_FILTER_TYPE_OFF;
|
||||
}
|
||||
if (shape_flter_block_params->hf_cut_filter_present) {
|
||||
|
||||
ia_shape_filter_params_struct* params = &shape_flter_block_params->str_hfCutParams;
|
||||
shape_filter_block->shape_filter[2].type = SHAPE_FILTER_TYPE_HF_CUT;
|
||||
shape_filter_block->shape_filter[2].gain_offset = shape_filt_hf_gain_offset_tbl[params->corner_freq_index][params->filter_strength_index];
|
||||
shape_filter_block->shape_filter[2].y1_bound = shape_filt_hf_y1_bound_tbl[params->corner_freq_index][params->filter_strength_index];
|
||||
radius = shape_filt_hf_radius_tbl[params->corner_freq_index];
|
||||
x1 = (FLOAT32)(- 2.0f * radius * cos(2.0f * M_PI * shape_filt_cutoff_freq_norm_hf_tbl[params->corner_freq_index]));
|
||||
x2 = radius * radius;
|
||||
shape_filter_block->shape_filter[2].warped_gain_max = SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE / (SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE + shape_filter_block->shape_filter[2].gain_offset);
|
||||
shape_filter_block->shape_filter[2].factor = (shape_filter_block->shape_filter[2].y1_bound - x1) / shape_filter_block->shape_filter[2].warped_gain_max;
|
||||
shape_filter_block->shape_filter[2].coeff_sum = 1.0f + x1 + x2;
|
||||
shape_filter_block->shape_filter[2].partial_coeff_sum = 1.0f + x2;
|
||||
shape_filter_block->shape_filter[2].a1 = x1;
|
||||
shape_filter_block->shape_filter[2].a2 = x2;
|
||||
shape_filter_block->shape_filter[2].b2 = x2;
|
||||
}
|
||||
else
|
||||
{
|
||||
shape_filter_block->shape_filter[2].type = SHAPE_FILTER_TYPE_OFF;
|
||||
}
|
||||
if (shape_flter_block_params->hf_boost_filter_present) {
|
||||
|
||||
ia_shape_filter_params_struct* params = &shape_flter_block_params->str_hf_boost_params;
|
||||
shape_filter_block->shape_filter[3].type = SHAPE_FILTER_TYPE_HF_BOOST;
|
||||
shape_filter_block->shape_filter[3].gain_offset = shape_filt_hf_gain_offset_tbl[params->corner_freq_index][params->filter_strength_index];
|
||||
shape_filter_block->shape_filter[3].y1_bound = shape_filt_hf_y1_bound_tbl[params->corner_freq_index][params->filter_strength_index];
|
||||
radius = shape_filt_hf_radius_tbl[params->corner_freq_index];
|
||||
x1 = (FLOAT32)(- 2.0f * radius * cos(2.0f * M_PI * shape_filt_cutoff_freq_norm_hf_tbl[params->corner_freq_index]));
|
||||
x2 = radius * radius;
|
||||
shape_filter_block->shape_filter[3].warped_gain_max = SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE / (SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE + shape_filter_block->shape_filter[3].gain_offset);
|
||||
shape_filter_block->shape_filter[3].factor = (shape_filter_block->shape_filter[3].y1_bound - x1) / shape_filter_block->shape_filter[3].warped_gain_max;
|
||||
shape_filter_block->shape_filter[3].coeff_sum = 1.0f + x1 + x2;
|
||||
shape_filter_block->shape_filter[3].partial_coeff_sum = 1.0f + x2;
|
||||
shape_filter_block->shape_filter[3].b1 = x1;
|
||||
shape_filter_block->shape_filter[3].b2 = x2;
|
||||
shape_filter_block->shape_filter[3].a2 = x2;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
shape_filter_block->shape_filter[3].type = SHAPE_FILTER_TYPE_OFF;
|
||||
}
|
||||
resetshape_flter_block(shape_filter_block);
|
||||
shape_filter_block->shape_flter_block_flag = 1;
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
WORD32 impd_shape_filt_block_time_process(shape_filter_block* shape_filter_block,
|
||||
FLOAT32* drc_gain,
|
||||
const WORD32 channel,
|
||||
FLOAT32 *audio_in,
|
||||
WORD32 start,
|
||||
WORD32 end)
|
||||
{
|
||||
WORD32 i,j, err=0;
|
||||
FLOAT32 audio_out;
|
||||
|
||||
if(shape_filter_block->shape_flter_block_flag){
|
||||
for (i=start; i<end; i++)
|
||||
{
|
||||
FLOAT32 tmp = audio_in[i];
|
||||
for (j=0; j<4; j++) {
|
||||
if(shape_filter_block->shape_filter[j].type==SHAPE_FILTER_TYPE_LF_CUT||shape_filter_block->shape_filter[j].type==SHAPE_FILTER_TYPE_LF_BOOST){
|
||||
|
||||
audio_out = tmp + shape_filter_block->shape_filter[j].b1 * shape_filter_block->shape_filter[j].audio_in_state_1[channel]
|
||||
- shape_filter_block->shape_filter[j].a1 * shape_filter_block->shape_filter[j].audio_out_state_1[channel];
|
||||
shape_filter_block->shape_filter[j].audio_in_state_1[channel] = tmp;
|
||||
shape_filter_block->shape_filter[j].audio_out_state_1[channel] = audio_out;
|
||||
|
||||
}
|
||||
else if(shape_filter_block->shape_filter[j].type==SHAPE_FILTER_TYPE_HF_CUT||shape_filter_block->shape_filter[j].type==SHAPE_FILTER_TYPE_HF_BOOST){
|
||||
|
||||
audio_out = shape_filter_block->shape_filter[j].g_norm * tmp + shape_filter_block->shape_filter[j].b1 * shape_filter_block->shape_filter[j].audio_in_state_1[channel]
|
||||
+ shape_filter_block->shape_filter[j].b2 * shape_filter_block->shape_filter[j].audio_in_state_2[channel]
|
||||
- shape_filter_block->shape_filter[j].a1 * shape_filter_block->shape_filter[j].audio_out_state_1[channel]
|
||||
- shape_filter_block->shape_filter[j].a2 * shape_filter_block->shape_filter[j].audio_out_state_2[channel];
|
||||
shape_filter_block->shape_filter[j].audio_in_state_2[channel] = shape_filter_block->shape_filter[j].audio_in_state_1[channel];
|
||||
shape_filter_block->shape_filter[j].audio_in_state_1[channel] = shape_filter_block->shape_filter[j].g_norm * tmp;
|
||||
shape_filter_block->shape_filter[j].audio_out_state_2[channel] = shape_filter_block->shape_filter[j].audio_out_state_1[channel];
|
||||
shape_filter_block->shape_filter[j].audio_out_state_1[channel] = audio_out;
|
||||
}
|
||||
else
|
||||
{
|
||||
audio_out = tmp;
|
||||
}
|
||||
tmp = audio_out;
|
||||
|
||||
}
|
||||
|
||||
audio_in[i] = audio_out * drc_gain[i];
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
for (i=start; i<end; i++){
|
||||
audio_in[i] = audio_in[i] * drc_gain[i];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -28,93 +28,75 @@
|
|||
#include "impd_drc_rom.h"
|
||||
|
||||
WORD32 impd_init_tbls(const WORD32 num_gain_max_values,
|
||||
ia_tables_struct* str_tables)
|
||||
{
|
||||
impd_gen_delta_time_code_tbl (num_gain_max_values,
|
||||
str_tables->delta_time_code_table);
|
||||
return(0);
|
||||
ia_tables_struct* str_tables) {
|
||||
impd_gen_delta_time_code_tbl(num_gain_max_values,
|
||||
str_tables->delta_time_code_table);
|
||||
return (0);
|
||||
}
|
||||
|
||||
void impd_get_slope_code_tbl_and_size(ia_slope_code_table_struct const** slope_code_tbl_entry,
|
||||
WORD32* num_slope_code_tbl_entries)
|
||||
{
|
||||
*slope_code_tbl_entry = &(slopeCodeTableEntryBySize[0]);
|
||||
*num_slope_code_tbl_entries = kNumSlopeValuesTable;
|
||||
void impd_get_slope_code_tbl_and_size(
|
||||
ia_slope_code_table_struct const** slope_code_tbl_entry,
|
||||
WORD32* num_slope_code_tbl_entries) {
|
||||
*slope_code_tbl_entry = &(slopeCodeTableEntryBySize[0]);
|
||||
*num_slope_code_tbl_entries = kNumSlopeValuesTable;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
impd_get_delta_gain_code_tbl(const WORD32 gain_coding_profile,
|
||||
ia_delta_gain_code_table_struct const** delta_time_code_tbl,
|
||||
WORD32 *num_entries)
|
||||
{
|
||||
if (gain_coding_profile==GAIN_CODING_PROFILE_CLIPPING)
|
||||
{
|
||||
*delta_time_code_tbl = deltaGainCodeTableProfile2BySize;
|
||||
*num_entries = kNumDeltaGainValuesTableProfile2;
|
||||
}
|
||||
else
|
||||
{
|
||||
*delta_time_code_tbl = deltaGainCodeTableBySize;
|
||||
*num_entries = kNumDeltaGainValuesTable;
|
||||
}
|
||||
void impd_get_delta_gain_code_tbl(
|
||||
const WORD32 gain_coding_profile,
|
||||
ia_delta_gain_code_table_struct const** delta_time_code_tbl,
|
||||
WORD32* num_entries) {
|
||||
if (gain_coding_profile == GAIN_CODING_PROFILE_CLIPPING) {
|
||||
*delta_time_code_tbl = deltaGainCodeTableProfile2BySize;
|
||||
*num_entries = kNumDeltaGainValuesTableProfile2;
|
||||
} else {
|
||||
*delta_time_code_tbl = deltaGainCodeTableBySize;
|
||||
*num_entries = kNumDeltaGainValuesTable;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
impd_gen_delta_time_code_tbl (const WORD32 num_gain_max_values,
|
||||
ia_delta_time_code_table_entry_struct* delta_time_code_tbl_item)
|
||||
{
|
||||
WORD32 n, k;
|
||||
void impd_gen_delta_time_code_tbl(
|
||||
const WORD32 num_gain_max_values,
|
||||
ia_delta_time_code_table_entry_struct* delta_time_code_tbl_item) {
|
||||
WORD32 n, k;
|
||||
|
||||
WORD32 Z = 1;
|
||||
while((1<<Z)<2*num_gain_max_values)
|
||||
{
|
||||
Z++;
|
||||
}
|
||||
WORD32 Z = 1;
|
||||
while ((1 << Z) < 2 * num_gain_max_values) {
|
||||
Z++;
|
||||
}
|
||||
|
||||
delta_time_code_tbl_item[0].size = -1;
|
||||
delta_time_code_tbl_item[0].code = -1;
|
||||
delta_time_code_tbl_item[0].value = -1;
|
||||
delta_time_code_tbl_item[0].size = -1;
|
||||
delta_time_code_tbl_item[0].code = -1;
|
||||
delta_time_code_tbl_item[0].value = -1;
|
||||
|
||||
delta_time_code_tbl_item[1].size = 2;
|
||||
delta_time_code_tbl_item[1].code = 0x0;
|
||||
delta_time_code_tbl_item[1].value = 1;
|
||||
for (n=0; n<4; n++)
|
||||
{
|
||||
delta_time_code_tbl_item[n+2].size = 4;
|
||||
delta_time_code_tbl_item[n+2].code = 0x4 + n;
|
||||
delta_time_code_tbl_item[n+2].value = n+2;
|
||||
}
|
||||
for (n=0; n<8; n++)
|
||||
{
|
||||
delta_time_code_tbl_item[n+6].size = 5;
|
||||
delta_time_code_tbl_item[n+6].code = 0x10 + n;
|
||||
delta_time_code_tbl_item[n+6].value = n+6;
|
||||
}
|
||||
|
||||
k = 2*num_gain_max_values-14+1;
|
||||
for (n=0; n<k; n++)
|
||||
{
|
||||
delta_time_code_tbl_item[n+14].size = 2+Z;
|
||||
delta_time_code_tbl_item[n+14].code = (0x3<<Z) + n;
|
||||
delta_time_code_tbl_item[n+14].value = n+14;
|
||||
}
|
||||
delta_time_code_tbl_item[1].size = 2;
|
||||
delta_time_code_tbl_item[1].code = 0x0;
|
||||
delta_time_code_tbl_item[1].value = 1;
|
||||
for (n = 0; n < 4; n++) {
|
||||
delta_time_code_tbl_item[n + 2].size = 4;
|
||||
delta_time_code_tbl_item[n + 2].code = 0x4 + n;
|
||||
delta_time_code_tbl_item[n + 2].value = n + 2;
|
||||
}
|
||||
for (n = 0; n < 8; n++) {
|
||||
delta_time_code_tbl_item[n + 6].size = 5;
|
||||
delta_time_code_tbl_item[n + 6].code = 0x10 + n;
|
||||
delta_time_code_tbl_item[n + 6].value = n + 6;
|
||||
}
|
||||
|
||||
k = 2 * num_gain_max_values - 14 + 1;
|
||||
for (n = 0; n < k; n++) {
|
||||
delta_time_code_tbl_item[n + 14].size = 2 + Z;
|
||||
delta_time_code_tbl_item[n + 14].code = (0x3 << Z) + n;
|
||||
delta_time_code_tbl_item[n + 14].value = n + 14;
|
||||
}
|
||||
}
|
||||
|
||||
WORD32
|
||||
impd_get_delta_tmin (const WORD32 sampling_rate)
|
||||
{
|
||||
WORD32 lowerBound = (WORD32) (0.5f + 0.0005f * sampling_rate);
|
||||
WORD32 result = 1;
|
||||
if (sampling_rate < 1000)
|
||||
{
|
||||
return(UNEXPECTED_ERROR);
|
||||
}
|
||||
while (result <= lowerBound) result = result << 1;
|
||||
return result;
|
||||
impd_get_delta_tmin(const WORD32 sampling_rate) {
|
||||
WORD32 lowerBound = (WORD32)(0.5f + 0.0005f * sampling_rate);
|
||||
WORD32 result = 1;
|
||||
if (sampling_rate < 1000) {
|
||||
return (UNEXPECTED_ERROR);
|
||||
}
|
||||
while (result <= lowerBound) result = result << 1;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -20,23 +20,24 @@
|
|||
#ifndef IMPD_DRC_TABLES_H
|
||||
#define IMPD_DRC_TABLES_H
|
||||
|
||||
const ia_filter_bank_params_struct normal_cross_freq[FILTER_BANK_PARAMETER_COUNT] = {
|
||||
{2.0f/1024.0f, 0.0000373252f, 0.9913600345f},
|
||||
{3.0f/1024.0f, 0.0000836207f, 0.9870680830f},
|
||||
{4.0f/1024.0f, 0.0001480220f, 0.9827947083f},
|
||||
{5.0f/1024.0f, 0.0002302960f, 0.9785398263f},
|
||||
{6.0f/1024.0f, 0.0003302134f, 0.9743033527f},
|
||||
{2.0f/256.0f, 0.0005820761f, 0.9658852897f},
|
||||
{3.0f/256.0f, 0.0012877837f, 0.9492662926f},
|
||||
{2.0f/128.0f, 0.0022515827f, 0.9329321561f},
|
||||
{3.0f/128.0f, 0.0049030350f, 0.9010958535f},
|
||||
{2.0f/64.0f, 0.0084426929f, 0.8703307793f},
|
||||
{3.0f/64.0f, 0.0178631928f, 0.8118317459f},
|
||||
{2.0f/32.0f, 0.0299545822f, 0.7570763753f},
|
||||
{3.0f/32.0f, 0.0604985076f, 0.6574551915f},
|
||||
{2.0f/16.0f, 0.0976310729f, 0.5690355937f},
|
||||
{3.0f/16.0f, 0.1866943331f, 0.4181633458f},
|
||||
{2.0f/8.0f, 0.2928932188f, 0.2928932188f},
|
||||
const ia_filter_bank_params_struct
|
||||
normal_cross_freq[FILTER_BANK_PARAMETER_COUNT] = {
|
||||
{2.0f / 1024.0f, 0.0000373252f, 0.9913600345f},
|
||||
{3.0f / 1024.0f, 0.0000836207f, 0.9870680830f},
|
||||
{4.0f / 1024.0f, 0.0001480220f, 0.9827947083f},
|
||||
{5.0f / 1024.0f, 0.0002302960f, 0.9785398263f},
|
||||
{6.0f / 1024.0f, 0.0003302134f, 0.9743033527f},
|
||||
{2.0f / 256.0f, 0.0005820761f, 0.9658852897f},
|
||||
{3.0f / 256.0f, 0.0012877837f, 0.9492662926f},
|
||||
{2.0f / 128.0f, 0.0022515827f, 0.9329321561f},
|
||||
{3.0f / 128.0f, 0.0049030350f, 0.9010958535f},
|
||||
{2.0f / 64.0f, 0.0084426929f, 0.8703307793f},
|
||||
{3.0f / 64.0f, 0.0178631928f, 0.8118317459f},
|
||||
{2.0f / 32.0f, 0.0299545822f, 0.7570763753f},
|
||||
{3.0f / 32.0f, 0.0604985076f, 0.6574551915f},
|
||||
{2.0f / 16.0f, 0.0976310729f, 0.5690355937f},
|
||||
{3.0f / 16.0f, 0.1866943331f, 0.4181633458f},
|
||||
{2.0f / 8.0f, 0.2928932188f, 0.2928932188f},
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,45 +20,32 @@
|
|||
#ifndef IMPD_DRC_UNI_BITSTREAM_DEC_API_H
|
||||
#define IMPD_DRC_UNI_BITSTREAM_DEC_API_H
|
||||
|
||||
WORD32 impd_init_drc_bitstream_dec(
|
||||
ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct, WORD32 sample_rate,
|
||||
WORD32 frame_size, WORD32 delay_mode, WORD32 lfe_channel_map_count,
|
||||
WORD32* lfe_channel_map);
|
||||
|
||||
WORD32 impd_init_drc_bitstream_dec(ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
||||
WORD32 sample_rate,
|
||||
WORD32 frame_size,
|
||||
WORD32 delay_mode,
|
||||
WORD32 lfe_channel_map_count,
|
||||
WORD32* lfe_channel_map);
|
||||
WORD32 impd_process_drc_bitstream_dec(
|
||||
ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
||||
ia_bit_buf_struct* it_bit_buff, ia_drc_config* pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
UWORD8* bitstream_config, WORD32 num_bytes, WORD32 num_bits_offset,
|
||||
WORD32* num_bits_read);
|
||||
|
||||
WORD32 impd_process_drc_bitstream_dec(ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
UWORD8* bitstream_config,
|
||||
WORD32 num_bytes,
|
||||
WORD32 num_bits_offset,
|
||||
WORD32* num_bits_read);
|
||||
WORD32 impd_process_drc_bitstream_dec_config(
|
||||
ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
||||
ia_bit_buf_struct* it_bit_buff, ia_drc_config* pstr_drc_config,
|
||||
UWORD8* bitstream_config, WORD32 num_bytes);
|
||||
|
||||
WORD32 impd_process_drc_bitstream_dec_config(ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
UWORD8* bitstream_config,
|
||||
WORD32 num_bytes);
|
||||
WORD32 impd_process_drc_bitstream_dec_gain(
|
||||
ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
||||
ia_bit_buf_struct* it_bit_buff, ia_drc_config* pstr_drc_config,
|
||||
ia_drc_gain_struct* pstr_drc_gain, UWORD8* bitstream_gain, WORD32 num_bytes,
|
||||
WORD32 num_bits_offset, WORD32* num_bits_read);
|
||||
|
||||
WORD32 impd_process_drc_bitstream_dec_gain(ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_gain_struct* pstr_drc_gain,
|
||||
UWORD8* bitstream_gain,
|
||||
WORD32 num_bytes,
|
||||
WORD32 num_bits_offset,
|
||||
WORD32* num_bits_read);
|
||||
|
||||
WORD32 impd_process_drc_bitstream_dec_loudness_info_set(ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
UWORD8* bitstream_loudness,
|
||||
WORD32 num_bytes_loudness
|
||||
);
|
||||
WORD32 impd_process_drc_bitstream_dec_loudness_info_set(
|
||||
ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
UWORD8* bitstream_loudness, WORD32 num_bytes_loudness);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -21,112 +21,107 @@
|
|||
#define IMPD_DRC_UNI_COMMON_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define AMD1_SYNTAX 0
|
||||
#define MPEG_D_DRC_EXTENSION_V1 0
|
||||
#define AMD1_PARAMETRIC_LIMITER 0
|
||||
#define AMD1_SYNTAX 0
|
||||
#define MPEG_D_DRC_EXTENSION_V1 0
|
||||
#define AMD1_PARAMETRIC_LIMITER 0
|
||||
|
||||
#define MPEG_H_SYNTAX 0
|
||||
#define MPEG_H_SYNTAX 0
|
||||
|
||||
#define EQ_IS_SUPPORTED 1
|
||||
#define EQ_IS_SUPPORTED 1
|
||||
|
||||
#define MEASURE_AVERAGE_BITRATE 0
|
||||
#define DEBUG_NODES 0
|
||||
#define MEASURE_AVERAGE_BITRATE 0
|
||||
#define DEBUG_NODES 0
|
||||
|
||||
#define DRC_GAIN_DEBUG_FILE 0
|
||||
#define DEBUG_BITSTREAM 0
|
||||
#define DEBUG_DRC_SELECTION 0
|
||||
#define DEBUG_WARNINGS 0
|
||||
#define ENABLE_ADDITIONAL_TESTS 1
|
||||
#define DRC_GAIN_DEBUG_FILE 0
|
||||
#define DEBUG_BITSTREAM 0
|
||||
#define DEBUG_DRC_SELECTION 0
|
||||
#define DEBUG_WARNINGS 0
|
||||
#define ENABLE_ADDITIONAL_TESTS 1
|
||||
|
||||
#define SPEAKER_POS_COUNT_MAX 128
|
||||
#define DOWNMIX_COEFF_COUNT_MAX 32*32
|
||||
#define MAX_CHANNEL_COUNT 128
|
||||
#define BAND_COUNT_MAX 8
|
||||
#define SEQUENCE_COUNT_MAX 24
|
||||
#define GAIN_SET_COUNT_MAX SEQUENCE_COUNT_MAX
|
||||
#define MEASUREMENT_COUNT_MAX 16
|
||||
#define DOWNMIX_INSTRUCTION_COUNT_MAX 16
|
||||
#define DRC_COEFF_COUNT_MAX 8
|
||||
#define DRC_INSTRUCTIONS_COUNT_MAX (DOWNMIX_INSTRUCTION_COUNT_MAX + 20)
|
||||
#define LOUDNESS_INFO_COUNT_MAX (DOWNMIX_INSTRUCTION_COUNT_MAX + 20)
|
||||
#define AUDIO_CODEC_FRAME_SIZE_MAX 4096
|
||||
#define DRC_CODEC_FRAME_SIZE_MAX (AUDIO_CODEC_FRAME_SIZE_MAX/8)
|
||||
#define NODE_COUNT_MAX DRC_CODEC_FRAME_SIZE_MAX
|
||||
#define CHANNEL_GROUP_COUNT_MAX SEQUENCE_COUNT_MAX
|
||||
#define SUB_DRC_COUNT 4
|
||||
#define SEL_DRC_COUNT 3
|
||||
#define DOWNMIX_ID_COUNT_MAX 8
|
||||
#define MAX_SIGNAL_DELAY 4500
|
||||
#define SPEAKER_POS_COUNT_MAX 128
|
||||
#define DOWNMIX_COEFF_COUNT_MAX 32 * 32
|
||||
#define MAX_CHANNEL_COUNT 128
|
||||
#define BAND_COUNT_MAX 8
|
||||
#define SEQUENCE_COUNT_MAX 24
|
||||
#define GAIN_SET_COUNT_MAX SEQUENCE_COUNT_MAX
|
||||
#define MEASUREMENT_COUNT_MAX 16
|
||||
#define DOWNMIX_INSTRUCTION_COUNT_MAX 16
|
||||
#define DRC_COEFF_COUNT_MAX 8
|
||||
#define DRC_INSTRUCTIONS_COUNT_MAX (DOWNMIX_INSTRUCTION_COUNT_MAX + 20)
|
||||
#define LOUDNESS_INFO_COUNT_MAX (DOWNMIX_INSTRUCTION_COUNT_MAX + 20)
|
||||
#define AUDIO_CODEC_FRAME_SIZE_MAX 4096
|
||||
#define DRC_CODEC_FRAME_SIZE_MAX (AUDIO_CODEC_FRAME_SIZE_MAX / 8)
|
||||
#define NODE_COUNT_MAX DRC_CODEC_FRAME_SIZE_MAX
|
||||
#define CHANNEL_GROUP_COUNT_MAX SEQUENCE_COUNT_MAX
|
||||
#define SUB_DRC_COUNT 4
|
||||
#define SEL_DRC_COUNT 3
|
||||
#define DOWNMIX_ID_COUNT_MAX 8
|
||||
#define MAX_SIGNAL_DELAY 4500
|
||||
|
||||
#define DELAY_MODE_REGULAR_DELAY 0
|
||||
#define DELAY_MODE_LOW_DELAY 1
|
||||
#define DELAY_MODE_DEFAULT DELAY_MODE_REGULAR_DELAY
|
||||
|
||||
#define DELAY_MODE_REGULAR_DELAY 0
|
||||
#define DELAY_MODE_LOW_DELAY 1
|
||||
#define DELAY_MODE_DEFAULT DELAY_MODE_REGULAR_DELAY
|
||||
#define FEATURE_REQUEST_COUNT_MAX 10
|
||||
#define EFFECT_TYPE_REQUEST_COUNT_MAX 10
|
||||
|
||||
#define FEATURE_REQUEST_COUNT_MAX 10
|
||||
#define EFFECT_TYPE_REQUEST_COUNT_MAX 10
|
||||
#define SELECTION_CANDIDATE_COUNT_MAX 32
|
||||
|
||||
#define SELECTION_CANDIDATE_COUNT_MAX 32
|
||||
#define PROC_COMPLETE 1
|
||||
#define UNEXPECTED_ERROR 2
|
||||
#define PARAM_ERROR 3
|
||||
#define EXTERNAL_ERROR 4
|
||||
#define ERRORHANDLING 5
|
||||
#define BITSTREAM_ERROR 6
|
||||
|
||||
#define PROC_COMPLETE 1
|
||||
#define UNEXPECTED_ERROR 2
|
||||
#define PARAM_ERROR 3
|
||||
#define EXTERNAL_ERROR 4
|
||||
#define ERRORHANDLING 5
|
||||
#define BITSTREAM_ERROR 6
|
||||
#define UNDEFINED_LOUDNESS_VALUE 1000.0f
|
||||
#define ID_FOR_BASE_LAYOUT 0x0
|
||||
#define ID_FOR_ANY_DOWNMIX 0x7F
|
||||
#define ID_FOR_NO_DRC 0x0
|
||||
#define ID_FOR_ANY_DRC 0x3F
|
||||
#define ID_FOR_ANY_EQ 0x3F
|
||||
|
||||
#define UNDEFINED_LOUDNESS_VALUE 1000.0f
|
||||
#define ID_FOR_BASE_LAYOUT 0x0
|
||||
#define ID_FOR_ANY_DOWNMIX 0x7F
|
||||
#define ID_FOR_NO_DRC 0x0
|
||||
#define ID_FOR_ANY_DRC 0x3F
|
||||
#define ID_FOR_ANY_EQ 0x3F
|
||||
#define LOCATION_MP4_INSTREAM_UNIDRC 0x1
|
||||
#define LOCATION_MP4_DYN_RANGE_INFO 0x2
|
||||
#define LOCATION_MP4_COMPRESSION_VALUE 0x3
|
||||
#define LOCATION_SELECTED LOCATION_MP4_INSTREAM_UNIDRC
|
||||
|
||||
#define LOCATION_MP4_INSTREAM_UNIDRC 0x1
|
||||
#define LOCATION_MP4_DYN_RANGE_INFO 0x2
|
||||
#define LOCATION_MP4_COMPRESSION_VALUE 0x3
|
||||
#define LOCATION_SELECTED LOCATION_MP4_INSTREAM_UNIDRC
|
||||
#define AUDIO_CODEC_SUBBAND_COUNT_MAX 256
|
||||
|
||||
#define AUDIO_CODEC_SUBBAND_COUNT_MAX 256
|
||||
#define SUBBAND_DOMAIN_MODE_OFF 0
|
||||
#define SUBBAND_DOMAIN_MODE_QMF64 1
|
||||
#define SUBBAND_DOMAIN_MODE_QMF71 2
|
||||
#define SUBBAND_DOMAIN_MODE_STFT256 3
|
||||
|
||||
#define SUBBAND_DOMAIN_MODE_OFF 0
|
||||
#define SUBBAND_DOMAIN_MODE_QMF64 1
|
||||
#define SUBBAND_DOMAIN_MODE_QMF71 2
|
||||
#define SUBBAND_DOMAIN_MODE_STFT256 3
|
||||
#define AUDIO_CODEC_SUBBAND_COUNT_QMF64 64
|
||||
#define AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF64 64
|
||||
#define AUDIO_CODEC_SUBBAND_ANALYSE_DELAY_QMF64 320
|
||||
|
||||
#define AUDIO_CODEC_SUBBAND_COUNT_QMF64 64
|
||||
#define AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF64 64
|
||||
#define AUDIO_CODEC_SUBBAND_ANALYSE_DELAY_QMF64 320
|
||||
#define AUDIO_CODEC_SUBBAND_COUNT_QMF71 71
|
||||
#define AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF71 64
|
||||
#define AUDIO_CODEC_SUBBAND_ANALYSE_DELAY_QMF71 320 + 384
|
||||
|
||||
#define AUDIO_CODEC_SUBBAND_COUNT_QMF71 71
|
||||
#define AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF71 64
|
||||
#define AUDIO_CODEC_SUBBAND_ANALYSE_DELAY_QMF71 320+384
|
||||
#define AUDIO_CODEC_SUBBAND_COUNT_STFT256 256
|
||||
#define AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_STFT256 256
|
||||
#define AUDIO_CODEC_SUBBAND_ANALYSE_DELAY_STFT256 256
|
||||
|
||||
#define AUDIO_CODEC_SUBBAND_COUNT_STFT256 256
|
||||
#define AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_STFT256 256
|
||||
#define AUDIO_CODEC_SUBBAND_ANALYSE_DELAY_STFT256 256
|
||||
|
||||
#define MAX_NUM_DOWNMIX_ID_REQUESTS 15
|
||||
#define MAX_NUM_DRC_FEATURE_REQUESTS 7
|
||||
#define MAX_NUM_DRC_EFFECT_TYPE_REQUESTS 15
|
||||
#define MAX_NUM_DOWNMIX_ID_REQUESTS 15
|
||||
#define MAX_NUM_DRC_FEATURE_REQUESTS 7
|
||||
#define MAX_NUM_DRC_EFFECT_TYPE_REQUESTS 15
|
||||
#define MAX_SIGNATURE_DATA_LENGTH_PLUS_ONE 256
|
||||
|
||||
#define EXT_COUNT_MAX 2
|
||||
#define UNIDRCGAINEXT_TERM 0x0
|
||||
#define UNIDRCLOUDEXT_TERM 0x0
|
||||
#define UNIDRCCONFEXT_TERM 0x0
|
||||
#define UNIDRCINTERFACEEXT_TERM 0x0
|
||||
#define EXT_COUNT_MAX 2
|
||||
#define UNIDRCGAINEXT_TERM 0x0
|
||||
#define UNIDRCLOUDEXT_TERM 0x0
|
||||
#define UNIDRCCONFEXT_TERM 0x0
|
||||
#define UNIDRCINTERFACEEXT_TERM 0x0
|
||||
|
||||
#define MAXPACKETLOSSTIME 2.5f
|
||||
|
||||
|
||||
|
||||
#define MAXPACKETLOSSTIME 2.5f
|
||||
|
||||
#define SLOPE_FACTOR_DB_TO_LINEAR 0.1151f
|
||||
#define SLOPE_FACTOR_DB_TO_LINEAR 0.1151f
|
||||
|
||||
#ifndef min
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
|
|
@ -139,27 +134,25 @@ extern "C"
|
|||
#define bool WORD32
|
||||
#endif
|
||||
|
||||
typedef struct ia_drc_sel_proc_output_struct
|
||||
{
|
||||
FLOAT32 output_peak_level_db;
|
||||
FLOAT32 loudness_normalization_gain_db;
|
||||
FLOAT32 output_loudness;
|
||||
typedef struct ia_drc_sel_proc_output_struct {
|
||||
FLOAT32 output_peak_level_db;
|
||||
FLOAT32 loudness_normalization_gain_db;
|
||||
FLOAT32 output_loudness;
|
||||
|
||||
WORD32 sel_drc_set_ids[SUB_DRC_COUNT];
|
||||
WORD32 sel_downmix_ids[SUB_DRC_COUNT];
|
||||
WORD32 num_sel_drc_sets;
|
||||
WORD32 sel_drc_set_ids[SUB_DRC_COUNT];
|
||||
WORD32 sel_downmix_ids[SUB_DRC_COUNT];
|
||||
WORD32 num_sel_drc_sets;
|
||||
|
||||
WORD32 active_downmix_id;
|
||||
WORD32 base_channel_count;
|
||||
WORD32 target_channel_count;
|
||||
WORD32 target_layout;
|
||||
WORD32 downmix_matrix_present;
|
||||
FLOAT32 downmix_matrix[MAX_CHANNEL_COUNT][MAX_CHANNEL_COUNT];
|
||||
|
||||
FLOAT32 boost;
|
||||
FLOAT32 compress;
|
||||
WORD32 drc_characteristic_target;
|
||||
WORD32 active_downmix_id;
|
||||
WORD32 base_channel_count;
|
||||
WORD32 target_channel_count;
|
||||
WORD32 target_layout;
|
||||
WORD32 downmix_matrix_present;
|
||||
FLOAT32 downmix_matrix[MAX_CHANNEL_COUNT][MAX_CHANNEL_COUNT];
|
||||
|
||||
FLOAT32 boost;
|
||||
FLOAT32 compress;
|
||||
WORD32 drc_characteristic_target;
|
||||
|
||||
} ia_drc_sel_proc_output_struct;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,22 +21,18 @@
|
|||
#define IMPD_DRC_UNI_DEC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
WORD32 impd_select_drc_coefficients(ia_drc_config* drc_config,
|
||||
ia_uni_drc_coeffs_struct** drc_coefficients_drc,
|
||||
WORD32* drc_coefficients_selected);
|
||||
WORD32 impd_select_drc_coefficients(
|
||||
ia_drc_config* drc_config, ia_uni_drc_coeffs_struct** drc_coefficients_drc,
|
||||
WORD32* drc_coefficients_selected);
|
||||
|
||||
WORD32 impd_init_selected_drc_set(ia_drc_config* drc_config,
|
||||
ia_drc_params_struct* ia_drc_params_struct,
|
||||
WORD32 audio_num_chan,
|
||||
WORD32 drc_set_id_selected,
|
||||
WORD32 downmix_id_selected,
|
||||
ia_filter_banks_struct* ia_filter_banks_struct,
|
||||
ia_overlap_params_struct* pstr_overlap_params
|
||||
);
|
||||
WORD32 impd_init_selected_drc_set(
|
||||
ia_drc_config* drc_config, ia_drc_params_struct* ia_drc_params_struct,
|
||||
WORD32 audio_num_chan, WORD32 drc_set_id_selected,
|
||||
WORD32 downmix_id_selected, ia_filter_banks_struct* ia_filter_banks_struct,
|
||||
ia_overlap_params_struct* pstr_overlap_params);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,24 +23,23 @@
|
|||
#ifndef COMPILE_FOR_DRC_ENCODER
|
||||
#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
|
||||
#define EQ_INTERMEDIATE_PARAMETER_COUNT_MAX 32
|
||||
#define EQ_FILTER_SECTION_COUNT_MAX 8
|
||||
#define EQ_FILTER_ELEMENT_COUNT_MAX 4
|
||||
#define EQ_FILTER_COUNT_MAX 4
|
||||
#define MATCHING_PHASE_FILTER_COUNT_MAX 32
|
||||
#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
|
||||
#define EQ_INTERMEDIATE_PARAMETER_COUNT_MAX 32
|
||||
#define EQ_FILTER_SECTION_COUNT_MAX 8
|
||||
#define EQ_FILTER_ELEMENT_COUNT_MAX 4
|
||||
#define EQ_FILTER_COUNT_MAX 4
|
||||
#define MATCHING_PHASE_FILTER_COUNT_MAX 32
|
||||
|
||||
#define EQ_FILTER_DOMAIN_NONE 0
|
||||
#define EQ_FILTER_DOMAIN_TIME (1<<0)
|
||||
#define EQ_FILTER_DOMAIN_SUBBAND (1<<1)
|
||||
#define EQ_FILTER_DOMAIN_NONE 0
|
||||
#define EQ_FILTER_DOMAIN_TIME (1 << 0)
|
||||
#define EQ_FILTER_DOMAIN_SUBBAND (1 << 1)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -20,115 +20,93 @@
|
|||
#ifndef IMPD_DRC_UNI_GAIN_DEC_H
|
||||
#define IMPD_DRC_UNI_GAIN_DEC_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
ia_node_struct str_node;
|
||||
ia_node_struct prev_node;
|
||||
FLOAT32 lpcm_gains[2 * AUDIO_CODEC_FRAME_SIZE_MAX + MAX_SIGNAL_DELAY];
|
||||
ia_node_struct str_node;
|
||||
ia_node_struct prev_node;
|
||||
FLOAT32 lpcm_gains[2 * AUDIO_CODEC_FRAME_SIZE_MAX + MAX_SIGNAL_DELAY];
|
||||
} ia_interp_buf_struct;
|
||||
|
||||
typedef struct {
|
||||
#if DRC_GAIN_DEBUG_FILE
|
||||
FILE* f_gain_debug;
|
||||
FILE* f_gain_debug;
|
||||
#endif
|
||||
WORD32 buf_interpolation_count;
|
||||
ia_interp_buf_struct* buf_interpolation;
|
||||
WORD32 buf_interpolation_count;
|
||||
ia_interp_buf_struct* buf_interpolation;
|
||||
} ia_gain_buffer_struct;
|
||||
|
||||
typedef struct {
|
||||
ia_gain_buffer_struct pstr_gain_buf[SEL_DRC_COUNT];
|
||||
ia_gain_buffer_struct pstr_gain_buf[SEL_DRC_COUNT];
|
||||
} ia_drc_gain_buffers_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 gain_interpolation_type;
|
||||
WORD32 gain_modification_flag;
|
||||
WORD32 ducking_flag;
|
||||
WORD32 clipping_flag;
|
||||
ia_ducking_modifiers_struct* pstr_ducking_modifiers;
|
||||
ia_gain_modifiers_struct* pstr_gain_modifiers;
|
||||
WORD32 limiter_peak_target_present;
|
||||
FLOAT32 limiter_peak_target;
|
||||
FLOAT32 loudness_normalization_gain_db;
|
||||
WORD32 delta_tmin;
|
||||
WORD32 characteristic_index;
|
||||
FLOAT32 compress;
|
||||
FLOAT32 boost;
|
||||
WORD32 gain_interpolation_type;
|
||||
WORD32 gain_modification_flag;
|
||||
WORD32 ducking_flag;
|
||||
WORD32 clipping_flag;
|
||||
ia_ducking_modifiers_struct* pstr_ducking_modifiers;
|
||||
ia_gain_modifiers_struct* pstr_gain_modifiers;
|
||||
WORD32 limiter_peak_target_present;
|
||||
FLOAT32 limiter_peak_target;
|
||||
FLOAT32 loudness_normalization_gain_db;
|
||||
WORD32 delta_tmin;
|
||||
WORD32 characteristic_index;
|
||||
FLOAT32 compress;
|
||||
FLOAT32 boost;
|
||||
} ia_interp_params_struct;
|
||||
|
||||
|
||||
typedef struct {
|
||||
WORD32 drc_instructions_index;
|
||||
WORD32 drc_coeff_idx;
|
||||
WORD32 dwnmix_instructions_index;
|
||||
WORD32 drc_instructions_index;
|
||||
WORD32 drc_coeff_idx;
|
||||
WORD32 dwnmix_instructions_index;
|
||||
} ia_sel_drc_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 sample_rate;
|
||||
WORD32 delta_tmin_default;
|
||||
WORD32 drc_frame_size;
|
||||
WORD32 delay_mode;
|
||||
WORD32 sub_band_domain_mode;
|
||||
WORD32 gain_delay_samples;
|
||||
WORD32 audio_delay_samples;
|
||||
WORD32 drc_set_counter;
|
||||
WORD32 multiband_sel_drc_idx;
|
||||
WORD32 sample_rate;
|
||||
WORD32 delta_tmin_default;
|
||||
WORD32 drc_frame_size;
|
||||
WORD32 delay_mode;
|
||||
WORD32 sub_band_domain_mode;
|
||||
WORD32 gain_delay_samples;
|
||||
WORD32 audio_delay_samples;
|
||||
WORD32 drc_set_counter;
|
||||
WORD32 multiband_sel_drc_idx;
|
||||
|
||||
ia_sel_drc_struct sel_drc_array[SEL_DRC_COUNT];
|
||||
ia_sel_drc_struct sel_drc_array[SEL_DRC_COUNT];
|
||||
|
||||
} ia_drc_params_struct;
|
||||
|
||||
WORD32
|
||||
impd_gain_buf_init(WORD32 index,
|
||||
WORD32 gain_element_count,
|
||||
WORD32 drc_frame_size,
|
||||
ia_gain_buffer_struct* pstr_gain_buf);
|
||||
impd_gain_buf_init(WORD32 index, WORD32 gain_element_count,
|
||||
WORD32 drc_frame_size, ia_gain_buffer_struct* pstr_gain_buf);
|
||||
|
||||
WORD32
|
||||
impd_advance_buf(WORD32 drc_frame_size,
|
||||
ia_gain_buffer_struct* pstr_gain_buf);
|
||||
|
||||
impd_advance_buf(WORD32 drc_frame_size, ia_gain_buffer_struct* pstr_gain_buf);
|
||||
|
||||
WORD32
|
||||
impd_map_gain (
|
||||
FLOAT32 gain_in_db,
|
||||
FLOAT32* gain_out_db);
|
||||
impd_map_gain(FLOAT32 gain_in_db, FLOAT32* gain_out_db);
|
||||
|
||||
WORD32
|
||||
impd_conv_to_linear_domain (ia_interp_params_struct* interp_params_str,
|
||||
WORD32 drc_band,
|
||||
FLOAT32 loc_db_gain,
|
||||
FLOAT32 in_param_db_slope,
|
||||
FLOAT32* out_param_lin_gain,
|
||||
FLOAT32* out_param_lin_slope);
|
||||
impd_conv_to_linear_domain(ia_interp_params_struct* interp_params_str,
|
||||
WORD32 drc_band, FLOAT32 loc_db_gain,
|
||||
FLOAT32 in_param_db_slope,
|
||||
FLOAT32* out_param_lin_gain,
|
||||
FLOAT32* out_param_lin_slope);
|
||||
|
||||
WORD32
|
||||
impd_interpolate_drc_gain(ia_interp_params_struct* interp_params_str,
|
||||
WORD32 drc_band,
|
||||
WORD32 gain_step_tdomain,
|
||||
FLOAT32 gain0,
|
||||
FLOAT32 gain1,
|
||||
FLOAT32 slope0,
|
||||
FLOAT32 slope1,
|
||||
FLOAT32* result);
|
||||
WORD32 drc_band, WORD32 gain_step_tdomain,
|
||||
FLOAT32 gain0, FLOAT32 gain1, FLOAT32 slope0,
|
||||
FLOAT32 slope1, FLOAT32* result);
|
||||
|
||||
WORD32
|
||||
impd_concatenate_segments(WORD32 drc_frame_size,
|
||||
WORD32 drc_band,
|
||||
ia_interp_params_struct* interp_params_str,
|
||||
ia_spline_nodes_struct* str_spline_nodes,
|
||||
ia_interp_buf_struct* buf_interpolation);
|
||||
|
||||
|
||||
|
||||
|
||||
impd_concatenate_segments(WORD32 drc_frame_size, WORD32 drc_band,
|
||||
ia_interp_params_struct* interp_params_str,
|
||||
ia_spline_nodes_struct* str_spline_nodes,
|
||||
ia_interp_buf_struct* buf_interpolation);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,97 +20,97 @@
|
|||
#ifndef IMPD_DRC_UNI_INTERFACE_H
|
||||
#define IMPD_DRC_UNI_INTERFACE_H
|
||||
|
||||
|
||||
typedef struct {
|
||||
WORD32 ext_size_bits;
|
||||
WORD32 ext_bit_size;
|
||||
WORD32 uni_drc_interface_ext_type;
|
||||
WORD32 ext_size_bits;
|
||||
WORD32 ext_bit_size;
|
||||
WORD32 uni_drc_interface_ext_type;
|
||||
} ia_specific_interface_extension_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 interface_ext_count;
|
||||
ia_specific_interface_extension_struct specific_interface_ext[EXT_COUNT_MAX];
|
||||
WORD32 interface_ext_count;
|
||||
ia_specific_interface_extension_struct specific_interface_ext[EXT_COUNT_MAX];
|
||||
} ia_drc_uni_interface_ext_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 change_compress;
|
||||
WORD32 change_boost;
|
||||
FLOAT32 compress;
|
||||
FLOAT32 boost;
|
||||
WORD32 change_drc_characteristic_target;
|
||||
WORD32 drc_characteristic_target;
|
||||
WORD32 change_compress;
|
||||
WORD32 change_boost;
|
||||
FLOAT32 compress;
|
||||
FLOAT32 boost;
|
||||
WORD32 change_drc_characteristic_target;
|
||||
WORD32 drc_characteristic_target;
|
||||
} ia_drc_parameter_interface_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 dynamic_range_control_on;
|
||||
WORD32 num_drc_feature_requests;
|
||||
WORD32 drc_feature_req_type[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 requested_num_drc_effects[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 desired_num_drc_effects_of_requested[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 requested_drc_effect_type[MAX_NUM_DRC_FEATURE_REQUESTS][MAX_NUM_DRC_EFFECT_TYPE_REQUESTS];
|
||||
WORD32 requested_dyn_rng_measurement_type[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 requested_dyn_range_is_single_val_flag[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
FLOAT32 requested_dyn_range_value[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
FLOAT32 requested_dyn_range_min_val[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
FLOAT32 requested_dyn_range_max_val[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 requested_drc_characteristic[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 dynamic_range_control_on;
|
||||
WORD32 num_drc_feature_requests;
|
||||
WORD32 drc_feature_req_type[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 requested_num_drc_effects[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 desired_num_drc_effects_of_requested[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 requested_drc_effect_type[MAX_NUM_DRC_FEATURE_REQUESTS]
|
||||
[MAX_NUM_DRC_EFFECT_TYPE_REQUESTS];
|
||||
WORD32 requested_dyn_rng_measurement_type[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 requested_dyn_range_is_single_val_flag[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
FLOAT32 requested_dyn_range_value[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
FLOAT32 requested_dyn_range_min_val[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
FLOAT32 requested_dyn_range_max_val[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
WORD32 requested_drc_characteristic[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||
} ia_dyn_rng_ctrl_interface_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 album_mode;
|
||||
WORD32 peak_limiter;
|
||||
WORD32 change_loudness_deviation_max;
|
||||
WORD32 loudness_deviation_max;
|
||||
WORD32 change_loudness_measur_method;
|
||||
WORD32 loudness_measurement_method;
|
||||
WORD32 change_loudness_measur_system;
|
||||
WORD32 loudness_measurement_system;
|
||||
WORD32 change_loudness_measur_pre_proc;
|
||||
WORD32 loudness_measurement_pre_proc;
|
||||
WORD32 change_device_cut_off_freq;
|
||||
WORD32 device_cut_off_frequency;
|
||||
WORD32 change_loudness_norm_gain_db_max;
|
||||
FLOAT32 loudness_norm_gain_db_max;
|
||||
WORD32 change_loudness_norm_gain_modification_db;
|
||||
FLOAT32 loudness_norm_gain_modification_db;
|
||||
WORD32 change_output_peak_level_max;
|
||||
FLOAT32 output_peak_level_max;
|
||||
WORD32 album_mode;
|
||||
WORD32 peak_limiter;
|
||||
WORD32 change_loudness_deviation_max;
|
||||
WORD32 loudness_deviation_max;
|
||||
WORD32 change_loudness_measur_method;
|
||||
WORD32 loudness_measurement_method;
|
||||
WORD32 change_loudness_measur_system;
|
||||
WORD32 loudness_measurement_system;
|
||||
WORD32 change_loudness_measur_pre_proc;
|
||||
WORD32 loudness_measurement_pre_proc;
|
||||
WORD32 change_device_cut_off_freq;
|
||||
WORD32 device_cut_off_frequency;
|
||||
WORD32 change_loudness_norm_gain_db_max;
|
||||
FLOAT32 loudness_norm_gain_db_max;
|
||||
WORD32 change_loudness_norm_gain_modification_db;
|
||||
FLOAT32 loudness_norm_gain_modification_db;
|
||||
WORD32 change_output_peak_level_max;
|
||||
FLOAT32 output_peak_level_max;
|
||||
} ia_loudness_norm_parameter_interface_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 loudness_normalization_on;
|
||||
FLOAT32 target_loudness;
|
||||
WORD32 loudness_normalization_on;
|
||||
FLOAT32 target_loudness;
|
||||
} ia_loudness_norm_ctrl_interface_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 target_config_request_type;
|
||||
WORD32 num_downmix_id_requests;
|
||||
WORD32 requested_dwnmix_id[MAX_NUM_DOWNMIX_ID_REQUESTS];
|
||||
WORD32 requested_target_layout;
|
||||
WORD32 requested_target_ch_count;
|
||||
WORD32 target_config_request_type;
|
||||
WORD32 num_downmix_id_requests;
|
||||
WORD32 requested_dwnmix_id[MAX_NUM_DOWNMIX_ID_REQUESTS];
|
||||
WORD32 requested_target_layout;
|
||||
WORD32 requested_target_ch_count;
|
||||
} ia_system_interface_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 interface_signat_type;
|
||||
WORD32 interface_signat_data_len;
|
||||
UWORD32 interface_signat_data[MAX_SIGNATURE_DATA_LENGTH_PLUS_ONE*8];
|
||||
WORD32 interface_signat_type;
|
||||
WORD32 interface_signat_data_len;
|
||||
UWORD32 interface_signat_data[MAX_SIGNATURE_DATA_LENGTH_PLUS_ONE * 8];
|
||||
} ia_drc_uni_interface_signat_struct;
|
||||
|
||||
typedef struct ia_drc_interface_struct{
|
||||
WORD32 interface_signat_flag;
|
||||
WORD32 system_interface_flag;
|
||||
WORD32 loudness_norm_ctrl_interface_flag;
|
||||
WORD32 loudness_norm_parameter_interface_flag;
|
||||
WORD32 drc_interface_flag;
|
||||
WORD32 drc_parameter_interface_flag;
|
||||
WORD32 drc_uni_interface_ext_flag;
|
||||
ia_drc_uni_interface_signat_struct drc_uni_interface_signature;
|
||||
ia_system_interface_struct system_interface;
|
||||
ia_loudness_norm_ctrl_interface_struct loudness_norm_ctrl_interface;
|
||||
ia_loudness_norm_parameter_interface_struct loudness_norm_param_interface;
|
||||
ia_dyn_rng_ctrl_interface_struct drc_ctrl_interface;
|
||||
ia_drc_parameter_interface_struct drc_parameter_interface;
|
||||
ia_drc_uni_interface_ext_struct drc_uni_interface_ext;
|
||||
typedef struct ia_drc_interface_struct {
|
||||
WORD32 interface_signat_flag;
|
||||
WORD32 system_interface_flag;
|
||||
WORD32 loudness_norm_ctrl_interface_flag;
|
||||
WORD32 loudness_norm_parameter_interface_flag;
|
||||
WORD32 drc_interface_flag;
|
||||
WORD32 drc_parameter_interface_flag;
|
||||
WORD32 drc_uni_interface_ext_flag;
|
||||
ia_drc_uni_interface_signat_struct drc_uni_interface_signature;
|
||||
ia_system_interface_struct system_interface;
|
||||
ia_loudness_norm_ctrl_interface_struct loudness_norm_ctrl_interface;
|
||||
ia_loudness_norm_parameter_interface_struct loudness_norm_param_interface;
|
||||
ia_dyn_rng_ctrl_interface_struct drc_ctrl_interface;
|
||||
ia_drc_parameter_interface_struct drc_parameter_interface;
|
||||
ia_drc_uni_interface_ext_struct drc_uni_interface_ext;
|
||||
} ia_drc_interface_struct;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,10 +20,8 @@
|
|||
#ifndef IMPD_DRC_UNI_LOUD_EQ_H
|
||||
#define IMPD_DRC_UNI_LOUD_EQ_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -20,51 +20,45 @@
|
|||
#ifndef IMPD_DRC_UNI_MULTI_BAND_H
|
||||
#define IMPD_DRC_UNI_MULTI_BAND_H
|
||||
|
||||
#define DRC_SUBBAND_COUNT_WITH_AUDIO_CODEC_FILTERBANK_MAX FILTER_BANK_PARAMETER_COUNT
|
||||
#define DRC_SUBBAND_COUNT_WITH_AUDIO_CODEC_FILTERBANK_MAX \
|
||||
FILTER_BANK_PARAMETER_COUNT
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
FLOAT32 overlap_weight[AUDIO_CODEC_SUBBAND_COUNT_MAX];
|
||||
FLOAT32 overlap_weight[AUDIO_CODEC_SUBBAND_COUNT_MAX];
|
||||
} ia_band_overlap_params_struct;
|
||||
|
||||
typedef struct {
|
||||
ia_band_overlap_params_struct str_band_overlap_params[BAND_COUNT_MAX];
|
||||
ia_band_overlap_params_struct str_band_overlap_params[BAND_COUNT_MAX];
|
||||
} ia_group_overlap_params_struct;
|
||||
|
||||
typedef struct {
|
||||
ia_group_overlap_params_struct str_group_overlap_params[CHANNEL_GROUP_COUNT_MAX];
|
||||
ia_group_overlap_params_struct
|
||||
str_group_overlap_params[CHANNEL_GROUP_COUNT_MAX];
|
||||
} ia_overlap_params_struct;
|
||||
|
||||
|
||||
WORD32
|
||||
impd_fcenter_norm_sb_init(WORD32 num_subbands, FLOAT32* fcenter_norm_subband);
|
||||
|
||||
WORD32
|
||||
impd_fcenter_norm_sb_init(WORD32 num_subbands,
|
||||
FLOAT32* fcenter_norm_subband);
|
||||
impd_generate_slope(WORD32 num_subbands, FLOAT32* fcenter_norm_subband,
|
||||
FLOAT32 fcross_norm_lo, FLOAT32 fcross_norm_hi,
|
||||
FLOAT32* response);
|
||||
|
||||
WORD32
|
||||
impd_generate_slope (WORD32 num_subbands,
|
||||
FLOAT32* fcenter_norm_subband,
|
||||
FLOAT32 fcross_norm_lo,
|
||||
FLOAT32 fcross_norm_hi,
|
||||
FLOAT32* response);
|
||||
impd_generate_overlap_weights(
|
||||
WORD32 num_drc_bands, WORD32 drc_band_type,
|
||||
ia_gain_params_struct* gain_params, WORD32 dec_subband_count,
|
||||
ia_group_overlap_params_struct* pstr_group_overlap_params);
|
||||
|
||||
WORD32
|
||||
impd_generate_overlap_weights (WORD32 num_drc_bands,
|
||||
WORD32 drc_band_type,
|
||||
ia_gain_params_struct* gain_params,
|
||||
WORD32 dec_subband_count,
|
||||
ia_group_overlap_params_struct* pstr_group_overlap_params);
|
||||
|
||||
WORD32
|
||||
impd_init_overlap_weight ( ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc,
|
||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||
WORD32 sub_band_domain_mode,
|
||||
ia_overlap_params_struct* pstr_overlap_params);
|
||||
|
||||
impd_init_overlap_weight(
|
||||
ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc,
|
||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||
WORD32 sub_band_domain_mode, ia_overlap_params_struct* pstr_overlap_params);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,86 +22,77 @@
|
|||
|
||||
WORD32
|
||||
impd_dec_ducking_scaling(ia_bit_buf_struct* it_bit_buff,
|
||||
WORD32* ducking_scaling_flag,
|
||||
FLOAT32* ducking_scaling);
|
||||
WORD32* ducking_scaling_flag,
|
||||
FLOAT32* ducking_scaling);
|
||||
|
||||
WORD32
|
||||
impd_parse_loudness_info(ia_bit_buf_struct* it_bit_buff,
|
||||
WORD32 version,
|
||||
ia_loudness_info_struct* loudness_info);
|
||||
|
||||
impd_parse_loudness_info(ia_bit_buf_struct* it_bit_buff, WORD32 version,
|
||||
ia_loudness_info_struct* loudness_info);
|
||||
|
||||
WORD32
|
||||
impd_parse_loudness_info_set_ext(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_loudness_info_set_struct* loudness_info_set);
|
||||
impd_parse_loudness_info_set_ext(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_loudness_info_set_struct* loudness_info_set);
|
||||
|
||||
WORD32
|
||||
impd_sel_drc_coeff(ia_drc_config* drc_config,
|
||||
WORD32 location,
|
||||
ia_uni_drc_coeffs_struct** str_p_loc_drc_coefficients_uni_drc);
|
||||
impd_sel_drc_coeff(
|
||||
ia_drc_config* drc_config, WORD32 location,
|
||||
ia_uni_drc_coeffs_struct** str_p_loc_drc_coefficients_uni_drc);
|
||||
|
||||
WORD32
|
||||
impd_drc_parse_instructions_basic(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_config* drc_config,
|
||||
ia_drc_instructions_basic_struct* str_drc_instructions_basic);
|
||||
impd_drc_parse_instructions_basic(
|
||||
ia_bit_buf_struct* it_bit_buff, ia_drc_config* drc_config,
|
||||
ia_drc_instructions_basic_struct* str_drc_instructions_basic);
|
||||
|
||||
WORD32
|
||||
impd_parse_drc_instructions_uni_drc(ia_bit_buf_struct* it_bit_buff,
|
||||
WORD32 version,
|
||||
ia_drc_config* drc_config,
|
||||
ia_channel_layout_struct* channel_layout,
|
||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||
ia_drc_instructions_struct* str_drc_instruction_str);
|
||||
|
||||
impd_parse_drc_instructions_uni_drc(
|
||||
ia_bit_buf_struct* it_bit_buff, WORD32 version, ia_drc_config* drc_config,
|
||||
ia_channel_layout_struct* channel_layout,
|
||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||
ia_drc_instructions_struct* str_drc_instruction_str);
|
||||
|
||||
WORD32
|
||||
impd_parse_gain_set_params(ia_bit_buf_struct* it_bit_buff,
|
||||
WORD32 version,
|
||||
WORD32* gain_seq_idx,
|
||||
ia_gain_set_params_struct* gain_set_params);
|
||||
impd_parse_gain_set_params(ia_bit_buf_struct* it_bit_buff, WORD32 version,
|
||||
WORD32* gain_seq_idx,
|
||||
ia_gain_set_params_struct* gain_set_params);
|
||||
|
||||
WORD32
|
||||
impd_drc_parse_coeff(ia_bit_buf_struct* it_bit_buff,
|
||||
WORD32 version,
|
||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||
ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc);
|
||||
impd_drc_parse_coeff(
|
||||
ia_bit_buf_struct* it_bit_buff, WORD32 version,
|
||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||
ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc);
|
||||
|
||||
WORD32
|
||||
impd_parse_dwnmix_instructions(ia_bit_buf_struct* it_bit_buff,
|
||||
WORD32 version,
|
||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||
ia_channel_layout_struct* channel_layout,
|
||||
ia_downmix_instructions_struct* dwnmix_instructions);
|
||||
|
||||
impd_parse_dwnmix_instructions(
|
||||
ia_bit_buf_struct* it_bit_buff, WORD32 version,
|
||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||
ia_channel_layout_struct* channel_layout,
|
||||
ia_downmix_instructions_struct* dwnmix_instructions);
|
||||
|
||||
WORD32
|
||||
impd_parse_drc_config(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||
ia_drc_config* drc_config
|
||||
);
|
||||
|
||||
WORD32
|
||||
impd_parse_loudness_info_set(ia_bit_buf_struct* it_bit_buff,
|
||||
impd_parse_drc_config(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||
ia_drc_loudness_info_set_struct* loudness_info_set);
|
||||
ia_drc_config* drc_config);
|
||||
|
||||
WORD32
|
||||
impd_parse_drc_gain_sequence(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_bits_dec_struct *pstr_drc_uni_bs_dec,
|
||||
ia_gain_set_params_struct* gain_set_params,
|
||||
ia_drc_gain_sequence_struct* drc_gain_sequence);
|
||||
impd_parse_loudness_info_set(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||
ia_drc_loudness_info_set_struct* loudness_info_set);
|
||||
|
||||
WORD32
|
||||
impd_parse_drc_gain_sequence(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_bits_dec_struct* pstr_drc_uni_bs_dec,
|
||||
ia_gain_set_params_struct* gain_set_params,
|
||||
ia_drc_gain_sequence_struct* drc_gain_sequence);
|
||||
|
||||
WORD32
|
||||
impd_parse_uni_drc_gain_ext(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_uni_drc_gain_ext_struct* uni_drc_gain_ext);
|
||||
|
||||
WORD32 impd_drc_uni_gain_read(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_bits_dec_struct *pstr_drc_uni_bs_dec,
|
||||
ia_drc_config* drc_config,
|
||||
ia_drc_gain_struct* pstr_uni_drc_gain);
|
||||
ia_uni_drc_gain_ext_struct* uni_drc_gain_ext);
|
||||
|
||||
WORD32 impd_drc_uni_gain_read(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_bits_dec_struct* pstr_drc_uni_bs_dec,
|
||||
ia_drc_config* drc_config,
|
||||
ia_drc_gain_struct* pstr_uni_drc_gain);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -21,37 +21,32 @@
|
|||
#define IMPD_DRC_UNI_PROCESS_AUDIO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
WORD32 multiband_audio_sig_count;
|
||||
WORD32 frame_size;
|
||||
FLOAT32** non_interleaved_audio;
|
||||
WORD32 multiband_audio_sig_count;
|
||||
WORD32 frame_size;
|
||||
FLOAT32** non_interleaved_audio;
|
||||
} ia_audio_band_buffer_struct;
|
||||
|
||||
|
||||
|
||||
WORD32
|
||||
impd_apply_gains_subband(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||
const WORD32 drc_instructions_index,
|
||||
ia_drc_params_struct* ia_drc_params_struct,
|
||||
ia_gain_buffer_struct* pstr_gain_buf,
|
||||
ia_overlap_params_struct* pstr_overlap_params,
|
||||
FLOAT32* deinterleaved_audio_re[],
|
||||
FLOAT32* deinterleaved_audio_im[]);
|
||||
|
||||
const WORD32 drc_instructions_index,
|
||||
ia_drc_params_struct* ia_drc_params_struct,
|
||||
ia_gain_buffer_struct* pstr_gain_buf,
|
||||
ia_overlap_params_struct* pstr_overlap_params,
|
||||
FLOAT32* deinterleaved_audio_re[],
|
||||
FLOAT32* deinterleaved_audio_im[]);
|
||||
|
||||
WORD32
|
||||
impd_filter_banks_process(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||
const WORD32 drc_instructions_index,
|
||||
ia_drc_params_struct* ia_drc_params_struct,
|
||||
FLOAT32* audio_io_buf[],
|
||||
ia_audio_band_buffer_struct* audio_band_buffer,
|
||||
ia_filter_banks_struct* ia_filter_banks_struct,
|
||||
const WORD32 passThru);
|
||||
|
||||
const WORD32 drc_instructions_index,
|
||||
ia_drc_params_struct* ia_drc_params_struct,
|
||||
FLOAT32* audio_io_buf[],
|
||||
ia_audio_band_buffer_struct* audio_band_buffer,
|
||||
ia_filter_banks_struct* ia_filter_banks_struct,
|
||||
const WORD32 passThru);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,28 +24,27 @@
|
|||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#define SELECTION_FLAG_DRC_TARGET_LOUDNESS_MATCH (1<<0)
|
||||
#define SELECTION_FLAG_EXPLICIT_PEAK_INFO_PRESENT (1<<1)
|
||||
#define SELECTION_FLAG_DRC_TARGET_LOUDNESS_MATCH (1 << 0)
|
||||
#define SELECTION_FLAG_EXPLICIT_PEAK_INFO_PRESENT (1 << 1)
|
||||
|
||||
typedef struct {
|
||||
WORD32 drc_instructions_index;
|
||||
WORD32 downmix_id_request_index;
|
||||
WORD32 eq_set_id;
|
||||
FLOAT32 output_peak_level;
|
||||
FLOAT32 loudness_norm_db_gain_adjusted;
|
||||
FLOAT32 output_loudness;
|
||||
FLOAT32 mixing_level;
|
||||
WORD32 selection_flags;
|
||||
WORD32 drc_instructions_index;
|
||||
WORD32 downmix_id_request_index;
|
||||
WORD32 eq_set_id;
|
||||
FLOAT32 output_peak_level;
|
||||
FLOAT32 loudness_norm_db_gain_adjusted;
|
||||
FLOAT32 output_loudness;
|
||||
FLOAT32 mixing_level;
|
||||
WORD32 selection_flags;
|
||||
} ia_selection_candidate_info_struct;
|
||||
|
||||
|
||||
WORD32
|
||||
impd_validate_requested_drc_feature(ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct);
|
||||
impd_validate_requested_drc_feature(
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct);
|
||||
|
||||
WORD32
|
||||
impd_map_requested_effect_bit_idx(WORD32 requested_effect_type,
|
||||
WORD32* effect_bit_idx);
|
||||
WORD32* effect_bit_idx);
|
||||
|
||||
WORD32
|
||||
impd_get_fading_drc_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc);
|
||||
|
|
@ -55,88 +54,84 @@ impd_get_ducking_drc_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc);
|
|||
|
||||
WORD32
|
||||
impd_get_selected_drc_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
WORD32 drc_set_id_selected);
|
||||
WORD32 drc_set_id_selected);
|
||||
|
||||
WORD32
|
||||
impd_get_dependent_drc_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc);
|
||||
|
||||
WORD32
|
||||
impd_get_dependent_drc_instructions(const ia_drc_config* drc_config,
|
||||
const ia_drc_instructions_struct* str_drc_instruction_str,
|
||||
ia_drc_instructions_struct** ppstr_drc_instructions_dependent);
|
||||
|
||||
impd_get_dependent_drc_instructions(
|
||||
const ia_drc_config* drc_config,
|
||||
const ia_drc_instructions_struct* str_drc_instruction_str,
|
||||
ia_drc_instructions_struct** ppstr_drc_instructions_dependent);
|
||||
|
||||
WORD32
|
||||
impd_select_drcs_without_compr_effects (ia_drc_config* pstr_drc_config,
|
||||
WORD32* match_found_flag,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
impd_select_drcs_without_compr_effects(
|
||||
ia_drc_config* pstr_drc_config, WORD32* match_found_flag,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
|
||||
WORD32
|
||||
impd_match_effect_type_attempt(ia_drc_config* pstr_drc_config,
|
||||
WORD32 requested_effect_type,
|
||||
WORD32 stateRequested,
|
||||
WORD32* match_found_flag,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
impd_match_effect_type_attempt(
|
||||
ia_drc_config* pstr_drc_config, WORD32 requested_effect_type,
|
||||
WORD32 stateRequested, WORD32* match_found_flag,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
|
||||
WORD32
|
||||
impd_match_effect_types(ia_drc_config* pstr_drc_config,
|
||||
WORD32 total_effect_type_requested,
|
||||
WORD32 desired_effect_type_requested,
|
||||
WORD32* requested_effect_type,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
impd_match_effect_types(
|
||||
ia_drc_config* pstr_drc_config, WORD32 total_effect_type_requested,
|
||||
WORD32 desired_effect_type_requested, WORD32* requested_effect_type,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
|
||||
WORD32 impd_match_dynamic_range(ia_drc_config* pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||
WORD32 num_drc_requests,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
WORD32 impd_match_dynamic_range(
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||
WORD32 num_drc_requests, WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
|
||||
WORD32
|
||||
impd_match_drc_characteristic_attempt(ia_drc_config* pstr_drc_config,
|
||||
WORD32 requested_drc_characteristic,
|
||||
WORD32* match_found_flag,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
impd_match_drc_characteristic_attempt(
|
||||
ia_drc_config* pstr_drc_config, WORD32 requested_drc_characteristic,
|
||||
WORD32* match_found_flag, WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
|
||||
WORD32
|
||||
impd_match_drc_characteristic(ia_drc_config* pstr_drc_config,
|
||||
WORD32 requested_drc_characteristic,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
impd_match_drc_characteristic(
|
||||
ia_drc_config* pstr_drc_config, WORD32 requested_drc_characteristic,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
|
||||
VOID impd_select_drc_coeff3(ia_drc_config* drc_config,
|
||||
ia_uni_drc_coeffs_struct** str_p_loc_drc_coefficients_uni_drc);
|
||||
VOID impd_select_drc_coeff3(
|
||||
ia_drc_config* drc_config,
|
||||
ia_uni_drc_coeffs_struct** str_p_loc_drc_coefficients_uni_drc);
|
||||
|
||||
WORD32
|
||||
impd_drc_set_preselection(ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
WORD32 restrict_to_drc_with_album_loudness,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
impd_drc_set_preselection(
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
WORD32 restrict_to_drc_with_album_loudness,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
|
||||
WORD32 impd_drc_set_final_selection(ia_drc_config* pstr_drc_config,
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info
|
||||
);
|
||||
WORD32 impd_drc_set_final_selection(
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||
|
||||
WORD32 impd_match_eq_set_purpose(ia_drc_config* drc_config,
|
||||
WORD32 eq_set_purpose_requested,
|
||||
WORD32* eq_set_id_valid_flag,
|
||||
WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info_step_2
|
||||
);
|
||||
WORD32 impd_match_eq_set_purpose(
|
||||
ia_drc_config* drc_config, WORD32 eq_set_purpose_requested,
|
||||
WORD32* eq_set_id_valid_flag, WORD32* selection_candidate_count,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info,
|
||||
ia_selection_candidate_info_struct* selection_candidate_info_step_2);
|
||||
|
||||
WORD32
|
||||
impd_select_drc_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
WORD32* drc_set_id_selected
|
||||
);
|
||||
WORD32* drc_set_id_selected);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,12 +28,14 @@ WORD32
|
|||
impd_drc_sel_proc_init_dflt(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc);
|
||||
|
||||
WORD32
|
||||
impd_drc_sel_proc_init_sel_proc_params(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct);
|
||||
impd_drc_sel_proc_init_sel_proc_params(
|
||||
ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct);
|
||||
|
||||
WORD32
|
||||
impd_drc_sel_proc_init_interface_params(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
ia_drc_interface_struct* pstr_drc_interface);
|
||||
impd_drc_sel_proc_init_interface_params(
|
||||
ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||
ia_drc_interface_struct* pstr_drc_interface);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,62 +26,55 @@ extern "C" {
|
|||
|
||||
WORD32
|
||||
impd_signal_peak_level_info(ia_drc_config* pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||
const WORD32 requested_dwnmix_id,
|
||||
const WORD32 album_mode,
|
||||
const WORD32 num_compression_eq_count,
|
||||
const WORD32* num_compression_eq_id,
|
||||
WORD32* peak_info_count,
|
||||
WORD32 eq_set_id[],
|
||||
FLOAT32 signal_peak_level[],
|
||||
WORD32 explicit_peak_information_present[]);
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||
const WORD32 requested_dwnmix_id,
|
||||
const WORD32 album_mode,
|
||||
const WORD32 num_compression_eq_count,
|
||||
const WORD32* num_compression_eq_id,
|
||||
WORD32* peak_info_count, WORD32 eq_set_id[],
|
||||
FLOAT32 signal_peak_level[],
|
||||
WORD32 explicit_peak_information_present[]);
|
||||
|
||||
WORD32
|
||||
impd_extract_loudness_peak_to_average_info(ia_loudness_info_struct* loudness_info,
|
||||
const WORD32 dyn_range_measurement_type,
|
||||
WORD32 * loudness_peak_2_avg_value_present,
|
||||
FLOAT32* loudness_peak_2_avg_value);
|
||||
impd_extract_loudness_peak_to_average_info(
|
||||
ia_loudness_info_struct* loudness_info,
|
||||
const WORD32 dyn_range_measurement_type,
|
||||
WORD32* loudness_peak_2_avg_value_present,
|
||||
FLOAT32* loudness_peak_2_avg_value);
|
||||
|
||||
WORD32
|
||||
impd_overall_loudness_present(const ia_loudness_info_struct* loudness_info,
|
||||
WORD32* loudness_info_present);
|
||||
|
||||
WORD32
|
||||
impd_find_overall_loudness_info(ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
const WORD32 requested_dwnmix_id,
|
||||
const WORD32 drc_set_id_requested,
|
||||
WORD32* overall_loudness_info_present,
|
||||
WORD32* loudness_info_count,
|
||||
ia_loudness_info_struct* loudness_info[]);
|
||||
impd_find_overall_loudness_info(
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
const WORD32 requested_dwnmix_id, const WORD32 drc_set_id_requested,
|
||||
WORD32* overall_loudness_info_present, WORD32* loudness_info_count,
|
||||
ia_loudness_info_struct* loudness_info[]);
|
||||
|
||||
WORD32
|
||||
impd_high_pass_loudness_adjust_info(const ia_loudness_info_struct* loudness_info,
|
||||
WORD32* loudness_hp_adjust_present,
|
||||
FLOAT32* loudness_hp_adjust);
|
||||
impd_high_pass_loudness_adjust_info(
|
||||
const ia_loudness_info_struct* loudness_info,
|
||||
WORD32* loudness_hp_adjust_present, FLOAT32* loudness_hp_adjust);
|
||||
|
||||
WORD32
|
||||
impd_find_high_pass_loudness_adjust(
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
const WORD32 requested_dwnmix_id,
|
||||
const WORD32 drc_set_id_requested,
|
||||
const WORD32 album_mode,
|
||||
const FLOAT32 device_cutoff_freq,
|
||||
WORD32* loudness_hp_adjust_present,
|
||||
FLOAT32* loudness_hp_adjust);
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
const WORD32 requested_dwnmix_id, const WORD32 drc_set_id_requested,
|
||||
const WORD32 album_mode, const FLOAT32 device_cutoff_freq,
|
||||
WORD32* loudness_hp_adjust_present, FLOAT32* loudness_hp_adjust);
|
||||
|
||||
WORD32
|
||||
impd_init_loudness_control (ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
const WORD32 requested_dwnmix_id,
|
||||
const WORD32 drc_set_id_requested,
|
||||
const WORD32 num_compression_eq_count,
|
||||
const WORD32* num_compression_eq_id,
|
||||
WORD32* loudness_info_count,
|
||||
WORD32 eq_set_id[],
|
||||
FLOAT32 loudness_normalization_gain_db[],
|
||||
FLOAT32 loudness[]);
|
||||
impd_init_loudness_control(
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
const WORD32 requested_dwnmix_id, const WORD32 drc_set_id_requested,
|
||||
const WORD32 num_compression_eq_count, const WORD32* num_compression_eq_id,
|
||||
WORD32* loudness_info_count, WORD32 eq_set_id[],
|
||||
FLOAT32 loudness_normalization_gain_db[], FLOAT32 loudness[]);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,4 @@
|
|||
#ifndef IMPD_DRC_UNI_SHAPE_FILTER_H
|
||||
#define IMPD_DRC_UNI_SHAPE_FILTER_H
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -21,70 +21,69 @@
|
|||
#define IMPD_DRC_UNI_TABLES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define N_DELTA_TIME_CODE_TABLE_ENTRIES_MAX (512+14)
|
||||
#define N_DELTA_TIME_CODE_TABLE_ENTRIES_MAX (512 + 14)
|
||||
|
||||
typedef struct {
|
||||
WORD32 size;
|
||||
WORD32 code;
|
||||
WORD32 value;
|
||||
WORD32 size;
|
||||
WORD32 code;
|
||||
WORD32 value;
|
||||
} ia_delta_time_code_table_entry_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 size;
|
||||
WORD32 code;
|
||||
FLOAT32 value;
|
||||
WORD32 index;
|
||||
WORD32 size;
|
||||
WORD32 code;
|
||||
FLOAT32 value;
|
||||
WORD32 index;
|
||||
} ia_slope_code_table_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 size;
|
||||
WORD32 code;
|
||||
FLOAT32 value;
|
||||
WORD32 size;
|
||||
WORD32 code;
|
||||
FLOAT32 value;
|
||||
} ia_delta_gain_code_table_struct;
|
||||
|
||||
typedef struct {
|
||||
ia_delta_time_code_table_entry_struct delta_time_code_table[N_DELTA_TIME_CODE_TABLE_ENTRIES_MAX];
|
||||
ia_delta_time_code_table_entry_struct
|
||||
delta_time_code_table[N_DELTA_TIME_CODE_TABLE_ENTRIES_MAX];
|
||||
} ia_tables_struct;
|
||||
|
||||
typedef struct {
|
||||
FLOAT32 in_out_ratio;
|
||||
FLOAT32 exp_lo;
|
||||
FLOAT32 exp_hi;
|
||||
FLOAT32 in_out_ratio;
|
||||
FLOAT32 exp_lo;
|
||||
FLOAT32 exp_hi;
|
||||
} ia_cicp_sigmoid_characteristic_param_struct;
|
||||
|
||||
typedef struct {
|
||||
FLOAT32 inLevel;
|
||||
FLOAT32 gain;
|
||||
FLOAT32 inLevel;
|
||||
FLOAT32 gain;
|
||||
} ia_characteristic_node_coordinate_struct;
|
||||
|
||||
typedef struct {
|
||||
WORD32 coordinateCount;
|
||||
ia_characteristic_node_coordinate_struct characteristicNodeCoordinate[5];
|
||||
WORD32 coordinateCount;
|
||||
ia_characteristic_node_coordinate_struct characteristicNodeCoordinate[5];
|
||||
} ia_cicp_node_characteristic_param;
|
||||
|
||||
WORD32
|
||||
impd_init_tbls(const WORD32 num_gain_max_values,
|
||||
ia_tables_struct* str_tables);
|
||||
impd_init_tbls(const WORD32 num_gain_max_values, ia_tables_struct* str_tables);
|
||||
|
||||
void
|
||||
impd_gen_delta_time_code_tbl (const WORD32 num_gain_max_values,
|
||||
ia_delta_time_code_table_entry_struct* delta_time_code_tbl_item);
|
||||
void impd_gen_delta_time_code_tbl(
|
||||
const WORD32 num_gain_max_values,
|
||||
ia_delta_time_code_table_entry_struct* delta_time_code_tbl_item);
|
||||
|
||||
void
|
||||
impd_get_delta_gain_code_tbl(const WORD32 gain_coding_profile,
|
||||
ia_delta_gain_code_table_struct const** delta_time_code_tbl,
|
||||
WORD32 *num_entries);
|
||||
void impd_get_delta_gain_code_tbl(
|
||||
const WORD32 gain_coding_profile,
|
||||
ia_delta_gain_code_table_struct const** delta_time_code_tbl,
|
||||
WORD32* num_entries);
|
||||
|
||||
void
|
||||
impd_get_slope_code_tbl_and_size(ia_slope_code_table_struct const** slope_code_tbl_entry,
|
||||
WORD32* num_slope_code_tbl_entries);
|
||||
void impd_get_slope_code_tbl_and_size(
|
||||
ia_slope_code_table_struct const** slope_code_tbl_entry,
|
||||
WORD32* num_slope_code_tbl_entries);
|
||||
|
||||
WORD32
|
||||
impd_get_delta_tmin (const WORD32 sampling_rate);
|
||||
impd_get_delta_tmin(const WORD32 sampling_rate);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,25 +34,25 @@
|
|||
/*****************************************************************************/
|
||||
/* Constant hash defines */
|
||||
/*****************************************************************************/
|
||||
#define IA_ERROR_NON_FATAL_IDX 0x0
|
||||
#define IA_ERROR_FATAL_IDX 0x1
|
||||
#define IA_ERROR_NON_FATAL_IDX 0x0
|
||||
#define IA_ERROR_FATAL_IDX 0x1
|
||||
|
||||
#define IA_ERROR_CLASS_0 0x0
|
||||
#define IA_ERROR_CLASS_1 0x1
|
||||
#define IA_ERROR_CLASS_2 0x2
|
||||
#define IA_ERROR_CLASS_3 0x3
|
||||
#define IA_ERROR_CLASS_4 0x4
|
||||
#define IA_ERROR_CLASS_5 0x5
|
||||
#define IA_ERROR_CLASS_6 0x6
|
||||
#define IA_ERROR_CLASS_7 0x7
|
||||
#define IA_ERROR_CLASS_8 0x8
|
||||
#define IA_ERROR_CLASS_9 0x9
|
||||
#define IA_ERROR_CLASS_A 0xA
|
||||
#define IA_ERROR_CLASS_B 0xB
|
||||
#define IA_ERROR_CLASS_C 0xC
|
||||
#define IA_ERROR_CLASS_D 0xD
|
||||
#define IA_ERROR_CLASS_E 0xE
|
||||
#define IA_ERROR_CLASS_F 0xF
|
||||
#define IA_ERROR_CLASS_0 0x0
|
||||
#define IA_ERROR_CLASS_1 0x1
|
||||
#define IA_ERROR_CLASS_2 0x2
|
||||
#define IA_ERROR_CLASS_3 0x3
|
||||
#define IA_ERROR_CLASS_4 0x4
|
||||
#define IA_ERROR_CLASS_5 0x5
|
||||
#define IA_ERROR_CLASS_6 0x6
|
||||
#define IA_ERROR_CLASS_7 0x7
|
||||
#define IA_ERROR_CLASS_8 0x8
|
||||
#define IA_ERROR_CLASS_9 0x9
|
||||
#define IA_ERROR_CLASS_A 0xA
|
||||
#define IA_ERROR_CLASS_B 0xB
|
||||
#define IA_ERROR_CLASS_C 0xC
|
||||
#define IA_ERROR_CLASS_D 0xD
|
||||
#define IA_ERROR_CLASS_E 0xE
|
||||
#define IA_ERROR_CLASS_F 0xF
|
||||
|
||||
/* each module, hence, needs to copy the following structure */
|
||||
/* the first index is for FATAL/NONFATAL */
|
||||
|
|
@ -63,11 +63,10 @@
|
|||
/*****************************************************************************/
|
||||
/* Type definitions */
|
||||
/*****************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
pWORD8 pb_module_name;
|
||||
pWORD8 ppb_class_names[16];
|
||||
WORD8 **ppppb_error_msg_pointers[2][16];
|
||||
typedef struct {
|
||||
pWORD8 pb_module_name;
|
||||
pWORD8 ppb_class_names[16];
|
||||
WORD8 **ppppb_error_msg_pointers[2][16];
|
||||
} ia_error_info_struct;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -76,19 +75,17 @@ typedef struct
|
|||
/* this error handler maps the code generated by a module to a error string */
|
||||
/* pb_context is a string to specify where the module broke */
|
||||
IA_ERRORCODE ia_error_handler(ia_error_info_struct *p_mod_err_info,
|
||||
WORD8 *pb_context, IA_ERRORCODE code);
|
||||
WORD8 *pb_context, IA_ERRORCODE code);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Macro functions */
|
||||
/*****************************************************************************/
|
||||
/* the following macro does a line job of returning back to the parent */
|
||||
/* in case a fatal error occurs after calling the errorhandler */
|
||||
#define _IA_HANDLE_ERROR(p_mod_err_info, context, e) \
|
||||
if((e) != IA_NO_ERROR) \
|
||||
{ \
|
||||
ia_error_handler((p_mod_err_info), (context), (e)); \
|
||||
if((e) & IA_FATAL_ERROR) \
|
||||
return (e); \
|
||||
}
|
||||
#define _IA_HANDLE_ERROR(p_mod_err_info, context, e) \
|
||||
if ((e) != IA_NO_ERROR) { \
|
||||
ia_error_handler((p_mod_err_info), (context), (e)); \
|
||||
if ((e)&IA_FATAL_ERROR) return (e); \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ typedef WORD32 IA_ERRORCODE;
|
|||
/*****************************************************************************/
|
||||
/* Constant hash defines */
|
||||
/*****************************************************************************/
|
||||
#define IA_NO_ERROR 0x00000000
|
||||
#define IA_NO_ERROR 0x00000000
|
||||
/* error handling 'AND' definition */
|
||||
#define IA_FATAL_ERROR 0x80000000
|
||||
#define IA_FATAL_ERROR 0x80000000
|
||||
|
||||
#endif /* __IMPD_ERROR_STANDARDS_H__ */
|
||||
|
|
|
|||
|
|
@ -25,85 +25,84 @@
|
|||
/* Type definitions */
|
||||
/*****************************************************************************/
|
||||
/* standard memory table descriptor for libraries */
|
||||
typedef struct
|
||||
{
|
||||
UWORD32 ui_size; /* size of the memory in bytes */
|
||||
UWORD32 ui_alignment; /* alignment in bytes */
|
||||
UWORD32 ui_type; /* type of memory */
|
||||
UWORD32 ui_placement[2]; /* 64 bit placement info */
|
||||
UWORD32 ui_priority; /* the importance for placement */
|
||||
UWORD32 ui_placed[2]; /* the o_red location for placement */
|
||||
}ia_mem_info_struct;
|
||||
typedef struct {
|
||||
UWORD32 ui_size; /* size of the memory in bytes */
|
||||
UWORD32 ui_alignment; /* alignment in bytes */
|
||||
UWORD32 ui_type; /* type of memory */
|
||||
UWORD32 ui_placement[2]; /* 64 bit placement info */
|
||||
UWORD32 ui_priority; /* the importance for placement */
|
||||
UWORD32 ui_placed[2]; /* the o_red location for placement */
|
||||
} ia_mem_info_struct;
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Constant hash defines */
|
||||
/*****************************************************************************/
|
||||
/* when you don't need alignment, pass this to memory library */
|
||||
#define IA_MEM_NO_ALIGN 0x01
|
||||
#define IA_MEM_NO_ALIGN 0x01
|
||||
|
||||
/* ittiam standard memory types */
|
||||
/* to be used inter frames */
|
||||
#define IA_MEMTYPE_PERSIST 0x00
|
||||
#define IA_MEMTYPE_PERSIST 0x00
|
||||
/* read write, to be used intra frames */
|
||||
#define IA_MEMTYPE_SCRATCH 0x01
|
||||
#define IA_MEMTYPE_SCRATCH 0x01
|
||||
/* read only memory, intra frame */
|
||||
#define IA_MEMTYPE_INPUT 0x02
|
||||
#define IA_MEMTYPE_INPUT 0x02
|
||||
/* read-write memory, for usable output, intra frame */
|
||||
#define IA_MEMTYPE_OUTPUT 0x03
|
||||
#define IA_MEMTYPE_OUTPUT 0x03
|
||||
/* readonly memory, inter frame */
|
||||
#define IA_MEMTYPE_TABLE 0x04
|
||||
#define IA_MEMTYPE_TABLE 0x04
|
||||
/* input buffer before mem tabs allocation */
|
||||
#define IA_MEMTYPE_PRE_FRAME_INPUT 0x05
|
||||
#define IA_MEMTYPE_PRE_FRAME_INPUT 0x05
|
||||
/* input buffer before mem tabs allocation */
|
||||
#define IA_MEMTYPE_PRE_FRAME_SCRATCH 0x06
|
||||
#define IA_MEMTYPE_PRE_FRAME_SCRATCH 0x06
|
||||
/* for local variables */
|
||||
#define IA_MEMTYPE_AUTO_VAR 0x80
|
||||
#define IA_MEMTYPE_AUTO_VAR 0x80
|
||||
|
||||
/* ittiam standard memory priorities */
|
||||
#define IA_MEMPRIORITY_ANYWHERE 0x00
|
||||
#define IA_MEMPRIORITY_LOWEST 0x01
|
||||
#define IA_MEMPRIORITY_LOW 0x02
|
||||
#define IA_MEMPRIORITY_NORM 0x03
|
||||
#define IA_MEMPRIORITY_ABOVE_NORM 0x04
|
||||
#define IA_MEMPRIORITY_HIGH 0x05
|
||||
#define IA_MEMPRIORITY_HIGHER 0x06
|
||||
#define IA_MEMPRIORITY_CRITICAL 0x07
|
||||
#define IA_MEMPRIORITY_ANYWHERE 0x00
|
||||
#define IA_MEMPRIORITY_LOWEST 0x01
|
||||
#define IA_MEMPRIORITY_LOW 0x02
|
||||
#define IA_MEMPRIORITY_NORM 0x03
|
||||
#define IA_MEMPRIORITY_ABOVE_NORM 0x04
|
||||
#define IA_MEMPRIORITY_HIGH 0x05
|
||||
#define IA_MEMPRIORITY_HIGHER 0x06
|
||||
#define IA_MEMPRIORITY_CRITICAL 0x07
|
||||
|
||||
/* ittiam standard memory placements */
|
||||
/* placement is defined by 64 bits */
|
||||
|
||||
#define IA_MEMPLACE_FAST_RAM_0 0x000001
|
||||
#define IA_MEMPLACE_FAST_RAM_1 0x000002
|
||||
#define IA_MEMPLACE_FAST_RAM_2 0x000004
|
||||
#define IA_MEMPLACE_FAST_RAM_3 0x000008
|
||||
#define IA_MEMPLACE_FAST_RAM_4 0x000010
|
||||
#define IA_MEMPLACE_FAST_RAM_5 0x000020
|
||||
#define IA_MEMPLACE_FAST_RAM_6 0x000040
|
||||
#define IA_MEMPLACE_FAST_RAM_7 0x000080
|
||||
#define IA_MEMPLACE_FAST_RAM_0 0x000001
|
||||
#define IA_MEMPLACE_FAST_RAM_1 0x000002
|
||||
#define IA_MEMPLACE_FAST_RAM_2 0x000004
|
||||
#define IA_MEMPLACE_FAST_RAM_3 0x000008
|
||||
#define IA_MEMPLACE_FAST_RAM_4 0x000010
|
||||
#define IA_MEMPLACE_FAST_RAM_5 0x000020
|
||||
#define IA_MEMPLACE_FAST_RAM_6 0x000040
|
||||
#define IA_MEMPLACE_FAST_RAM_7 0x000080
|
||||
|
||||
#define IA_MEMPLACE_INT_RAM_0 0x000100
|
||||
#define IA_MEMPLACE_INT_RAM_1 0x000200
|
||||
#define IA_MEMPLACE_INT_RAM_2 0x000400
|
||||
#define IA_MEMPLACE_INT_RAM_3 0x000800
|
||||
#define IA_MEMPLACE_INT_RAM_4 0x001000
|
||||
#define IA_MEMPLACE_INT_RAM_5 0x002000
|
||||
#define IA_MEMPLACE_INT_RAM_6 0x004000
|
||||
#define IA_MEMPLACE_INT_RAM_7 0x008000
|
||||
#define IA_MEMPLACE_INT_RAM_0 0x000100
|
||||
#define IA_MEMPLACE_INT_RAM_1 0x000200
|
||||
#define IA_MEMPLACE_INT_RAM_2 0x000400
|
||||
#define IA_MEMPLACE_INT_RAM_3 0x000800
|
||||
#define IA_MEMPLACE_INT_RAM_4 0x001000
|
||||
#define IA_MEMPLACE_INT_RAM_5 0x002000
|
||||
#define IA_MEMPLACE_INT_RAM_6 0x004000
|
||||
#define IA_MEMPLACE_INT_RAM_7 0x008000
|
||||
|
||||
#define IA_MEMPLACE_EXT_RAM_0 0x010000
|
||||
#define IA_MEMPLACE_EXT_RAM_1 0x020000
|
||||
#define IA_MEMPLACE_EXT_RAM_2 0x040000
|
||||
#define IA_MEMPLACE_EXT_RAM_3 0x080000
|
||||
#define IA_MEMPLACE_EXT_RAM_4 0x100000
|
||||
#define IA_MEMPLACE_EXT_RAM_5 0x200000
|
||||
#define IA_MEMPLACE_EXT_RAM_6 0x400000
|
||||
#define IA_MEMPLACE_EXT_RAM_7 0x800000
|
||||
#define IA_MEMPLACE_EXT_RAM_0 0x010000
|
||||
#define IA_MEMPLACE_EXT_RAM_1 0x020000
|
||||
#define IA_MEMPLACE_EXT_RAM_2 0x040000
|
||||
#define IA_MEMPLACE_EXT_RAM_3 0x080000
|
||||
#define IA_MEMPLACE_EXT_RAM_4 0x100000
|
||||
#define IA_MEMPLACE_EXT_RAM_5 0x200000
|
||||
#define IA_MEMPLACE_EXT_RAM_6 0x400000
|
||||
#define IA_MEMPLACE_EXT_RAM_7 0x800000
|
||||
|
||||
#define IA_MEMPLACE_DONTCARE_H 0xFFFFFFFF
|
||||
#define IA_MEMPLACE_DONTCARE_L 0xFFFFFFFF
|
||||
#define IA_MEMPLACE_DONTCARE_H 0xFFFFFFFF
|
||||
#define IA_MEMPLACE_DONTCARE_L 0xFFFFFFFF
|
||||
|
||||
/* the simple common PC RAM */
|
||||
#define IA_PC_RAM_H 0x00000000
|
||||
#define IA_PC_RAM_L IA_MEMPLACE_EXT_RAM_0
|
||||
#define IA_PC_RAM_H 0x00000000
|
||||
#define IA_PC_RAM_L IA_MEMPLACE_EXT_RAM_0
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,179 +20,173 @@
|
|||
#ifndef IMPD_PARAMETRIC_DRC_DEC_H
|
||||
#define IMPD_PARAMETRIC_DRC_DEC_H
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct ia_2nd_order_filt_coeff_struct_t {
|
||||
FLOAT32 b0, b1, b2;
|
||||
FLOAT32 a1, a2;
|
||||
FLOAT32 b0, b1, b2;
|
||||
FLOAT32 a1, a2;
|
||||
} ia_2nd_order_filt_coeff_struct;
|
||||
|
||||
typedef struct ia_2nd_order_filt_state_struct_t {
|
||||
FLOAT32 z1, z2;
|
||||
FLOAT32 z1, z2;
|
||||
} ia_2nd_order_filt_state_struct;
|
||||
|
||||
typedef struct ia_parametric_drc_type_ff_params_struct_t {
|
||||
WORD32 audio_num_chan;
|
||||
WORD32 frame_size;
|
||||
WORD32 sub_band_domain_mode;
|
||||
WORD32 sub_band_count;
|
||||
WORD32 level_estim_integration_time;
|
||||
WORD32 level_estim_frame_index;
|
||||
WORD32 level_estim_frame_count;
|
||||
FLOAT32 level[PARAM_DRC_TYPE_FF_LEVEL_ESTIM_FRAME_COUNT_MAX];
|
||||
WORD32 start_up_phase;
|
||||
FLOAT32 level_estim_ch_weight[MAX_CHANNEL_COUNT];
|
||||
WORD32 level_estim_k_weighting_type;
|
||||
ia_2nd_order_filt_coeff_struct pre_filt_coeff;
|
||||
ia_2nd_order_filt_coeff_struct rlb_filt_coeff;
|
||||
ia_2nd_order_filt_state_struct pre_filt_state[MAX_CHANNEL_COUNT];
|
||||
ia_2nd_order_filt_state_struct rlb_filt_state[MAX_CHANNEL_COUNT];
|
||||
FLOAT32 weighting_filt[AUDIO_CODEC_SUBBAND_COUNT_MAX];
|
||||
WORD32 sub_band_compensation_type;
|
||||
ia_2nd_order_filt_coeff_struct filt_coeff_subband;
|
||||
ia_2nd_order_filt_state_struct filt_state_subband_real[MAX_CHANNEL_COUNT];
|
||||
ia_2nd_order_filt_state_struct filt_state_subband_imag[MAX_CHANNEL_COUNT];
|
||||
FLOAT32 ref_level_parametric_drc;
|
||||
|
||||
WORD32 audio_num_chan;
|
||||
WORD32 frame_size;
|
||||
WORD32 sub_band_domain_mode;
|
||||
WORD32 sub_band_count;
|
||||
WORD32 level_estim_integration_time;
|
||||
WORD32 level_estim_frame_index;
|
||||
WORD32 level_estim_frame_count;
|
||||
FLOAT32 level[PARAM_DRC_TYPE_FF_LEVEL_ESTIM_FRAME_COUNT_MAX];
|
||||
WORD32 start_up_phase;
|
||||
FLOAT32 level_estim_ch_weight[MAX_CHANNEL_COUNT];
|
||||
WORD32 level_estim_k_weighting_type;
|
||||
ia_2nd_order_filt_coeff_struct pre_filt_coeff;
|
||||
ia_2nd_order_filt_coeff_struct rlb_filt_coeff;
|
||||
ia_2nd_order_filt_state_struct pre_filt_state[MAX_CHANNEL_COUNT];
|
||||
ia_2nd_order_filt_state_struct rlb_filt_state[MAX_CHANNEL_COUNT];
|
||||
FLOAT32 weighting_filt[AUDIO_CODEC_SUBBAND_COUNT_MAX];
|
||||
WORD32 sub_band_compensation_type;
|
||||
ia_2nd_order_filt_coeff_struct filt_coeff_subband;
|
||||
ia_2nd_order_filt_state_struct filt_state_subband_real[MAX_CHANNEL_COUNT];
|
||||
ia_2nd_order_filt_state_struct filt_state_subband_imag[MAX_CHANNEL_COUNT];
|
||||
FLOAT32 ref_level_parametric_drc;
|
||||
WORD32 node_count;
|
||||
WORD32 node_level[PARAM_DRC_TYPE_FF_NODE_COUNT_MAX];
|
||||
WORD32 node_gain[PARAM_DRC_TYPE_FF_NODE_COUNT_MAX];
|
||||
|
||||
WORD32 node_count;
|
||||
WORD32 node_level[PARAM_DRC_TYPE_FF_NODE_COUNT_MAX];
|
||||
WORD32 node_gain[PARAM_DRC_TYPE_FF_NODE_COUNT_MAX];
|
||||
|
||||
FLOAT32 gain_smooth_attack_alpha_slow;
|
||||
FLOAT32 gain_smooth_rel_alpha_slow;
|
||||
FLOAT32 gain_smooth_attack_alpha_fast;
|
||||
FLOAT32 gain_smooth_rel_alpha_fast;
|
||||
WORD32 gain_smooth_attack_threshold;
|
||||
WORD32 gain_smooth_rel_threshold;
|
||||
WORD32 gain_smooth_hold_off_count;
|
||||
FLOAT32 db_level_smooth;
|
||||
FLOAT32 db_gain_smooth;
|
||||
WORD32 hold_counter;
|
||||
FLOAT32 gain_smooth_attack_alpha_slow;
|
||||
FLOAT32 gain_smooth_rel_alpha_slow;
|
||||
FLOAT32 gain_smooth_attack_alpha_fast;
|
||||
FLOAT32 gain_smooth_rel_alpha_fast;
|
||||
WORD32 gain_smooth_attack_threshold;
|
||||
WORD32 gain_smooth_rel_threshold;
|
||||
WORD32 gain_smooth_hold_off_count;
|
||||
FLOAT32 db_level_smooth;
|
||||
FLOAT32 db_gain_smooth;
|
||||
WORD32 hold_counter;
|
||||
|
||||
} ia_parametric_drc_type_ff_params_struct;
|
||||
|
||||
typedef struct ia_parametric_drc_type_lim_params_struct_t {
|
||||
WORD32 audio_num_chan;
|
||||
WORD32 frame_size;
|
||||
FLOAT32 level_estim_ch_weight[MAX_CHANNEL_COUNT];
|
||||
|
||||
WORD32 audio_num_chan;
|
||||
WORD32 frame_size;
|
||||
FLOAT32 level_estim_ch_weight[MAX_CHANNEL_COUNT];
|
||||
|
||||
UWORD32 attack;
|
||||
FLOAT32 attack_constant;
|
||||
FLOAT32 release_constant;
|
||||
FLOAT32 attack_ms;
|
||||
FLOAT32 release_ms;
|
||||
FLOAT32 threshold;
|
||||
UWORD32 channels;
|
||||
UWORD32 sampling_rate;
|
||||
FLOAT32 cor;
|
||||
FLOAT32* max_buf;
|
||||
FLOAT32* max_buf_slow;
|
||||
UWORD32 max_buf_idx;
|
||||
UWORD32 max_buf_slow_idx;
|
||||
UWORD32 sec_len;
|
||||
UWORD32 num_max_buf_sec;
|
||||
UWORD32 max_buf_sec_idx;
|
||||
UWORD32 max_buf_sec_ctr;
|
||||
FLOAT64 smooth_state_0;
|
||||
UWORD32 attack;
|
||||
FLOAT32 attack_constant;
|
||||
FLOAT32 release_constant;
|
||||
FLOAT32 attack_ms;
|
||||
FLOAT32 release_ms;
|
||||
FLOAT32 threshold;
|
||||
UWORD32 channels;
|
||||
UWORD32 sampling_rate;
|
||||
FLOAT32 cor;
|
||||
FLOAT32* max_buf;
|
||||
FLOAT32* max_buf_slow;
|
||||
UWORD32 max_buf_idx;
|
||||
UWORD32 max_buf_slow_idx;
|
||||
UWORD32 sec_len;
|
||||
UWORD32 num_max_buf_sec;
|
||||
UWORD32 max_buf_sec_idx;
|
||||
UWORD32 max_buf_sec_ctr;
|
||||
FLOAT64 smooth_state_0;
|
||||
|
||||
} ia_parametric_drc_type_lim_params_struct;
|
||||
|
||||
typedef struct ia_parametric_drc_instance_params_struct_t {
|
||||
WORD32 disable_paramteric_drc;
|
||||
WORD32 parametric_drc_type;
|
||||
ia_spline_nodes_struct str_spline_nodes;
|
||||
ia_parametric_drc_type_ff_params_struct str_parametric_drc_type_ff_params;
|
||||
ia_parametric_drc_type_lim_params_struct str_parametric_drc_type_lim_params;
|
||||
WORD32 disable_paramteric_drc;
|
||||
WORD32 parametric_drc_type;
|
||||
ia_spline_nodes_struct str_spline_nodes;
|
||||
ia_parametric_drc_type_ff_params_struct str_parametric_drc_type_ff_params;
|
||||
ia_parametric_drc_type_lim_params_struct str_parametric_drc_type_lim_params;
|
||||
} ia_parametric_drc_instance_params_struct;
|
||||
|
||||
typedef struct ia_parametric_drc_params_struct_t {
|
||||
WORD32 sampling_rate;
|
||||
WORD32 audio_num_chan;
|
||||
WORD32 sub_band_domain_mode;
|
||||
WORD32 sub_band_count;
|
||||
WORD32 sampling_rate;
|
||||
WORD32 audio_num_chan;
|
||||
WORD32 sub_band_domain_mode;
|
||||
WORD32 sub_band_count;
|
||||
|
||||
WORD32 num_nodes;
|
||||
WORD32 drc_frame_size;
|
||||
WORD32 parametric_drc_frame_size;
|
||||
WORD32 parametric_drc_look_ahead_samples_max;
|
||||
WORD32 reset_parametric_drc;
|
||||
WORD32 num_nodes;
|
||||
WORD32 drc_frame_size;
|
||||
WORD32 parametric_drc_frame_size;
|
||||
WORD32 parametric_drc_look_ahead_samples_max;
|
||||
WORD32 reset_parametric_drc;
|
||||
|
||||
WORD32 parametric_drc_instance_count;
|
||||
WORD32 parametric_drc_idx[PARAM_DRC_INSTANCE_COUNT_MAX];
|
||||
WORD32 gain_set_index[PARAM_DRC_INSTANCE_COUNT_MAX];
|
||||
WORD32 dwnmix_id_from_drc_instructions[PARAM_DRC_INSTANCE_COUNT_MAX];
|
||||
WORD32 channel_map[PARAM_DRC_INSTANCE_COUNT_MAX][MAX_CHANNEL_COUNT];
|
||||
WORD32 parametric_drc_instance_count;
|
||||
WORD32 parametric_drc_idx[PARAM_DRC_INSTANCE_COUNT_MAX];
|
||||
WORD32 gain_set_index[PARAM_DRC_INSTANCE_COUNT_MAX];
|
||||
WORD32 dwnmix_id_from_drc_instructions[PARAM_DRC_INSTANCE_COUNT_MAX];
|
||||
WORD32 channel_map[PARAM_DRC_INSTANCE_COUNT_MAX][MAX_CHANNEL_COUNT];
|
||||
|
||||
ia_parametric_drc_instance_params_struct str_parametric_drc_instance_params[PARAM_DRC_INSTANCE_COUNT_MAX];
|
||||
ia_parametric_drc_instance_params_struct
|
||||
str_parametric_drc_instance_params[PARAM_DRC_INSTANCE_COUNT_MAX];
|
||||
|
||||
} ia_parametric_drc_params_struct;
|
||||
|
||||
WORD32 impd_init_parametric_drc( WORD32 drc_frame_size,
|
||||
WORD32 sampling_rate,
|
||||
WORD32 sub_band_domain_mode,
|
||||
ia_parametric_drc_params_struct* pstr_parametric_drc_params);
|
||||
|
||||
WORD32 impd_init_parametric_drc_after_config(ia_drc_config* pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
ia_parametric_drc_params_struct *pstr_parametric_drc_params,
|
||||
pVOID *mem_ptr);
|
||||
WORD32 impd_init_parametric_drc(
|
||||
WORD32 drc_frame_size, WORD32 sampling_rate, WORD32 sub_band_domain_mode,
|
||||
ia_parametric_drc_params_struct* pstr_parametric_drc_params);
|
||||
|
||||
WORD32 impd_init_parametric_drc_after_config(
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
ia_parametric_drc_params_struct* pstr_parametric_drc_params,
|
||||
pVOID* mem_ptr);
|
||||
|
||||
WORD32
|
||||
impd_init_lvl_est_filt_time( WORD32 level_estim_k_weighting_type,
|
||||
WORD32 sampling_rate,
|
||||
ia_2nd_order_filt_coeff_struct* pre_filt_coeff,
|
||||
ia_2nd_order_filt_coeff_struct* rlb_filt_coeff);
|
||||
impd_init_lvl_est_filt_time(WORD32 level_estim_k_weighting_type,
|
||||
WORD32 sampling_rate,
|
||||
ia_2nd_order_filt_coeff_struct* pre_filt_coeff,
|
||||
ia_2nd_order_filt_coeff_struct* rlb_filt_coeff);
|
||||
|
||||
WORD32
|
||||
impd_init_lvl_est_filt_subband( WORD32 level_estim_k_weighting_type,
|
||||
WORD32 sampling_rate,
|
||||
WORD32 sub_band_domain_mode,
|
||||
WORD32 sub_band_count,
|
||||
WORD32 sub_band_compensation_type,
|
||||
FLOAT32 *weighting_filt,
|
||||
ia_2nd_order_filt_coeff_struct* filt_coeff_subband);
|
||||
|
||||
impd_init_lvl_est_filt_subband(
|
||||
WORD32 level_estim_k_weighting_type, WORD32 sampling_rate,
|
||||
WORD32 sub_band_domain_mode, WORD32 sub_band_count,
|
||||
WORD32 sub_band_compensation_type, FLOAT32* weighting_filt,
|
||||
ia_2nd_order_filt_coeff_struct* filt_coeff_subband);
|
||||
|
||||
WORD32
|
||||
impd_parametric_ffwd_type_drc_reset(ia_parametric_drc_type_ff_params_struct* pstr_parametric_ffwd_type_drc_params);
|
||||
impd_parametric_ffwd_type_drc_reset(ia_parametric_drc_type_ff_params_struct*
|
||||
pstr_parametric_ffwd_type_drc_params);
|
||||
|
||||
WORD32
|
||||
impd_parametric_lim_type_drc_reset( WORD32 instance_idx,
|
||||
ia_parametric_drc_type_lim_params_struct* pstr_parametric_lim_type_drc_params);
|
||||
impd_parametric_lim_type_drc_reset(WORD32 instance_idx,
|
||||
ia_parametric_drc_type_lim_params_struct*
|
||||
pstr_parametric_lim_type_drc_params);
|
||||
|
||||
WORD32
|
||||
impd_parametric_drc_instance_process (FLOAT32* audio_in_out_buf[],
|
||||
FLOAT32* audio_real_buff[],
|
||||
FLOAT32* audio_imag_buff[],
|
||||
ia_parametric_drc_params_struct* pstr_parametric_drc_params,
|
||||
ia_parametric_drc_instance_params_struct* pstr_parametric_drc_instance_params);
|
||||
|
||||
impd_parametric_drc_instance_process(
|
||||
FLOAT32* audio_in_out_buf[], FLOAT32* audio_real_buff[],
|
||||
FLOAT32* audio_imag_buff[],
|
||||
ia_parametric_drc_params_struct* pstr_parametric_drc_params,
|
||||
ia_parametric_drc_instance_params_struct*
|
||||
pstr_parametric_drc_instance_params);
|
||||
|
||||
WORD32
|
||||
impd_parametric_ffwd_type_drc_process(FLOAT32* audio_in_out_buf[],
|
||||
FLOAT32* audio_real_buff[],
|
||||
FLOAT32* audio_imag_buff[],
|
||||
WORD32 nodeIdx,
|
||||
ia_parametric_drc_type_ff_params_struct* pstr_parametric_ffwd_type_drc_params,
|
||||
ia_spline_nodes_struct* str_spline_nodes);
|
||||
impd_parametric_ffwd_type_drc_process(FLOAT32* audio_in_out_buf[],
|
||||
FLOAT32* audio_real_buff[],
|
||||
FLOAT32* audio_imag_buff[],
|
||||
WORD32 nodeIdx,
|
||||
ia_parametric_drc_type_ff_params_struct*
|
||||
pstr_parametric_ffwd_type_drc_params,
|
||||
ia_spline_nodes_struct* str_spline_nodes);
|
||||
|
||||
WORD32
|
||||
impd_parametric_lim_type_drc_process(FLOAT32* audio_in_out_buf[],
|
||||
FLOAT32 loudness_normalization_gain_db,
|
||||
ia_parametric_drc_type_lim_params_struct* pstr_parametric_lim_type_drc_params,
|
||||
FLOAT32* lpcm_gains);
|
||||
|
||||
impd_parametric_lim_type_drc_process(FLOAT32* audio_in_out_buf[],
|
||||
FLOAT32 loudness_normalization_gain_db,
|
||||
ia_parametric_drc_type_lim_params_struct*
|
||||
pstr_parametric_lim_type_drc_params,
|
||||
FLOAT32* lpcm_gains);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -24,91 +24,89 @@
|
|||
/****************************************************************************/
|
||||
/* types type define prefix examples bytes */
|
||||
/************************ *********** ****** **************** ***** */
|
||||
typedef char CHAR8 ;/* c CHAR8 c_name 1 */
|
||||
typedef char * pCHAR8 ;/* pc pCHAR8 pc_nmae 1 */
|
||||
typedef char CHAR8; /* c CHAR8 c_name 1 */
|
||||
typedef char* pCHAR8; /* pc pCHAR8 pc_nmae 1 */
|
||||
|
||||
typedef signed char WORD8 ;/* b WORD8 b_name 1 */
|
||||
typedef signed char * pWORD8 ;/* pb pWORD8 pb_nmae 1 */
|
||||
typedef signed char WORD8; /* b WORD8 b_name 1 */
|
||||
typedef signed char* pWORD8; /* pb pWORD8 pb_nmae 1 */
|
||||
|
||||
typedef unsigned char UWORD8 ;/* ub UWORD8 ub_count 1 */
|
||||
typedef unsigned char * pUWORD8 ;/* pub pUWORD8 pub_count 1 */
|
||||
typedef unsigned char UWORD8; /* ub UWORD8 ub_count 1 */
|
||||
typedef unsigned char* pUWORD8; /* pub pUWORD8 pub_count 1 */
|
||||
|
||||
typedef signed short WORD16 ;/* s WORD16 s_count 2 */
|
||||
typedef signed short * pWORD16 ;/* ps pWORD16 ps_count 2 */
|
||||
typedef unsigned short UWORD16 ;/* us UWORD16 us_count 2 */
|
||||
typedef unsigned short * pUWORD16;/* pus pUWORD16 pus_count 2 */
|
||||
typedef signed short WORD16; /* s WORD16 s_count 2 */
|
||||
typedef signed short* pWORD16; /* ps pWORD16 ps_count 2 */
|
||||
typedef unsigned short UWORD16; /* us UWORD16 us_count 2 */
|
||||
typedef unsigned short* pUWORD16; /* pus pUWORD16 pus_count 2 */
|
||||
|
||||
typedef signed int WORD24 ;/* k WORD24 k_count 3 */
|
||||
typedef signed int * pWORD24 ;/* pk pWORD24 pk_count 3 */
|
||||
typedef unsigned int UWORD24 ;/* uk UWORD24 uk_count 3 */
|
||||
typedef unsigned int * pUWORD24;/* puk pUWORD24 puk_count 3 */
|
||||
typedef signed int WORD24; /* k WORD24 k_count 3 */
|
||||
typedef signed int* pWORD24; /* pk pWORD24 pk_count 3 */
|
||||
typedef unsigned int UWORD24; /* uk UWORD24 uk_count 3 */
|
||||
typedef unsigned int* pUWORD24; /* puk pUWORD24 puk_count 3 */
|
||||
|
||||
typedef signed int WORD32 ;/* i WORD32 i_count 4 */
|
||||
typedef signed int * pWORD32 ;/* pi pWORD32 pi_count 4 */
|
||||
typedef unsigned int UWORD32 ;/* ui UWORD32 ui_count 4 */
|
||||
typedef unsigned int * pUWORD32;/* pui pUWORD32 pui_count 4 */
|
||||
typedef signed int WORD32; /* i WORD32 i_count 4 */
|
||||
typedef signed int* pWORD32; /* pi pWORD32 pi_count 4 */
|
||||
typedef unsigned int UWORD32; /* ui UWORD32 ui_count 4 */
|
||||
typedef unsigned int* pUWORD32; /* pui pUWORD32 pui_count 4 */
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef ECLIPSE
|
||||
typedef signed __int64 WORD40 ;/* m WORD40 m_count 5 */
|
||||
typedef signed __int64 * pWORD40 ;/* pm pWORD40 pm_count 5 */
|
||||
typedef unsigned __int64 UWORD40 ;/* um UWORD40 um_count 5 */
|
||||
typedef unsigned __int64 * pUWORD40;/* pum pUWORD40 pum_count 5 */
|
||||
typedef signed __int64 WORD40; /* m WORD40 m_count 5 */
|
||||
typedef signed __int64* pWORD40; /* pm pWORD40 pm_count 5 */
|
||||
typedef unsigned __int64 UWORD40; /* um UWORD40 um_count 5 */
|
||||
typedef unsigned __int64* pUWORD40; /* pum pUWORD40 pum_count 5 */
|
||||
|
||||
typedef signed __int64 WORD64 ;/* h WORD64 h_count 8 */
|
||||
typedef signed __int64 * pWORD64 ;/* ph pWORD64 ph_count 8 */
|
||||
typedef unsigned __int64 UWORD64 ;/* uh UWORD64 uh_count 8 */
|
||||
typedef unsigned __int64 * pUWORD64;/* puh pUWORD64 puh_count 8 */
|
||||
typedef signed __int64 WORD64; /* h WORD64 h_count 8 */
|
||||
typedef signed __int64* pWORD64; /* ph pWORD64 ph_count 8 */
|
||||
typedef unsigned __int64 UWORD64; /* uh UWORD64 uh_count 8 */
|
||||
typedef unsigned __int64* pUWORD64; /* puh pUWORD64 puh_count 8 */
|
||||
#else
|
||||
typedef signed long long WORD40 ;/* m WORD40 m_count 5 */
|
||||
typedef signed long long * pWORD40 ;/* pm pWORD40 pm_count 5 */
|
||||
typedef unsigned long long UWORD40 ;/* um UWORD40 um_count 5 */
|
||||
typedef unsigned long long * pUWORD40;/* pum pUWORD40 pum_count 5 */
|
||||
typedef signed long long WORD40; /* m WORD40 m_count 5 */
|
||||
typedef signed long long* pWORD40; /* pm pWORD40 pm_count 5 */
|
||||
typedef unsigned long long UWORD40; /* um UWORD40 um_count 5 */
|
||||
typedef unsigned long long* pUWORD40; /* pum pUWORD40 pum_count 5 */
|
||||
|
||||
typedef signed long long WORD64 ;/* h WORD64 h_count 8 */
|
||||
typedef signed long long * pWORD64 ;/* ph pWORD64 ph_count 8 */
|
||||
typedef unsigned long long UWORD64 ;/* uh UWORD64 uh_count 8 */
|
||||
typedef unsigned long long * pUWORD64;/* puh pUWORD64 puh_count 8 */
|
||||
typedef signed long long WORD64; /* h WORD64 h_count 8 */
|
||||
typedef signed long long* pWORD64; /* ph pWORD64 ph_count 8 */
|
||||
typedef unsigned long long UWORD64; /* uh UWORD64 uh_count 8 */
|
||||
typedef unsigned long long* pUWORD64; /* puh pUWORD64 puh_count 8 */
|
||||
#endif
|
||||
#else
|
||||
|
||||
typedef signed long long WORD40 ;/* m WORD40 m_count 5 */
|
||||
typedef signed long long * pWORD40 ;/* pm pWORD40 pm_count 5 */
|
||||
typedef unsigned long long UWORD40 ;/* um UWORD40 um_count 5 */
|
||||
typedef unsigned long long * pUWORD40;/* pum pUWORD40 pum_count 5 */
|
||||
typedef signed long long WORD40; /* m WORD40 m_count 5 */
|
||||
typedef signed long long* pWORD40; /* pm pWORD40 pm_count 5 */
|
||||
typedef unsigned long long UWORD40; /* um UWORD40 um_count 5 */
|
||||
typedef unsigned long long* pUWORD40; /* pum pUWORD40 pum_count 5 */
|
||||
|
||||
typedef signed long long WORD64 ;/* h WORD64 h_count 8 */
|
||||
typedef signed long long * pWORD64 ;/* ph pWORD64 ph_count 8 */
|
||||
typedef unsigned long long UWORD64 ;/* uh UWORD64 uh_count 8 */
|
||||
typedef unsigned long long * pUWORD64;/* puh pUWORD64 puh_count 8 */
|
||||
typedef signed long long WORD64; /* h WORD64 h_count 8 */
|
||||
typedef signed long long* pWORD64; /* ph pWORD64 ph_count 8 */
|
||||
typedef unsigned long long UWORD64; /* uh UWORD64 uh_count 8 */
|
||||
typedef unsigned long long* pUWORD64; /* puh pUWORD64 puh_count 8 */
|
||||
|
||||
#endif
|
||||
|
||||
typedef float FLOAT32; /* f FLOAT32 f_count 4 */
|
||||
typedef float* pFLOAT32; /* pf pFLOAT32 pf_count 4 */
|
||||
typedef double FLOAT64; /* d UFLOAT64 d_count 8 */
|
||||
typedef double* pFlOAT64; /* pd pFLOAT64 pd_count 8 */
|
||||
|
||||
typedef float FLOAT32 ;/* f FLOAT32 f_count 4 */
|
||||
typedef float * pFLOAT32;/* pf pFLOAT32 pf_count 4 */
|
||||
typedef double FLOAT64 ;/* d UFLOAT64 d_count 8 */
|
||||
typedef double * pFlOAT64;/* pd pFLOAT64 pd_count 8 */
|
||||
|
||||
typedef void VOID ;/* v VOID v_flag 4 */
|
||||
typedef void * pVOID ;/* pv pVOID pv_flag 4 */
|
||||
typedef void VOID; /* v VOID v_flag 4 */
|
||||
typedef void* pVOID; /* pv pVOID pv_flag 4 */
|
||||
|
||||
/* variable size types: platform optimized implementation */
|
||||
typedef signed int BOOL ;/* bool BOOL bool_true */
|
||||
typedef unsigned int UBOOL ;/* ubool BOOL ubool_true */
|
||||
typedef signed int FLAG ;/* flag FLAG flag_false */
|
||||
typedef unsigned int UFLAG ;/* uflag FLAG uflag_false */
|
||||
typedef signed int LOOPIDX ;/* lp LOOPIDX lp_index */
|
||||
typedef unsigned int ULOOPIDX;/* ulp SLOOPIDX ulp_index */
|
||||
typedef signed int WORD ;/* lp LOOPIDX lp_index */
|
||||
typedef unsigned int UWORD ;/* ulp SLOOPIDX ulp_index */
|
||||
typedef signed int BOOL; /* bool BOOL bool_true */
|
||||
typedef unsigned int UBOOL; /* ubool BOOL ubool_true */
|
||||
typedef signed int FLAG; /* flag FLAG flag_false */
|
||||
typedef unsigned int UFLAG; /* uflag FLAG uflag_false */
|
||||
typedef signed int LOOPIDX; /* lp LOOPIDX lp_index */
|
||||
typedef unsigned int ULOOPIDX; /* ulp SLOOPIDX ulp_index */
|
||||
typedef signed int WORD; /* lp LOOPIDX lp_index */
|
||||
typedef unsigned int UWORD; /* ulp SLOOPIDX ulp_index */
|
||||
|
||||
typedef LOOPIDX LOOPINDEX; /* lp LOOPIDX lp_index */
|
||||
typedef ULOOPIDX ULOOPINDEX;/* ulp SLOOPIDX ulp_index */
|
||||
typedef LOOPIDX LOOPINDEX; /* lp LOOPIDX lp_index */
|
||||
typedef ULOOPIDX ULOOPINDEX; /* ulp SLOOPIDX ulp_index */
|
||||
|
||||
#define SIZE_T size_t
|
||||
|
||||
#define PLATFORM_INLINE __inline
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -230,20 +230,20 @@ VOID(*ixheaacd_aac_ld_dec_rearrange)
|
|||
(WORD32 *ip, WORD32 *op, WORD32 mdct_len_2,
|
||||
UWORD8 *re_arr_tab) = &ixheaacd_rearrange_dec;
|
||||
|
||||
VOID (*ixheaacd_fft32x32_ld)
|
||||
VOID(*ixheaacd_fft32x32_ld)
|
||||
(ia_aac_dec_imdct_tables_struct *imdct_tables_ptr, WORD32 npoints,
|
||||
WORD32 *ptr_x, WORD32 *ptr_y) = ixheaacd_fft32x32_ld_dec;
|
||||
|
||||
VOID (*ixheaacd_fft32x32_ld2)
|
||||
VOID(*ixheaacd_fft32x32_ld2)
|
||||
(ia_aac_dec_imdct_tables_struct *imdct_tables_ptr, WORD32 npoints,
|
||||
WORD32 *ptr_x, WORD32 *ptr_y) = &ixheaacd_fft32x32_ld_dec;
|
||||
|
||||
WORD16 (*ixheaacd_neg_expo_inc)(WORD16 neg_expo) = &ixheaacd_neg_expo_inc_dec;
|
||||
|
||||
VOID (*ixheaacd_inv_dit_fft_8pt)
|
||||
VOID(*ixheaacd_inv_dit_fft_8pt)
|
||||
(WORD32 *x, WORD32 *real, WORD32 *imag) = &ixheaacd_inv_dit_fft_8pt_dec;
|
||||
|
||||
VOID (*ixheaacd_scale_factor_process)
|
||||
VOID(*ixheaacd_scale_factor_process)
|
||||
(WORD32 *x_invquant, WORD16 *scale_fact, WORD no_band, WORD8 *width,
|
||||
WORD32 *scale_tables_ptr, WORD32 total_channels, WORD32 object_type,
|
||||
WORD32 aac_sf_data_resil_flag) = &ixheaacd_scale_factor_process_dec;
|
||||
|
|
|
|||
|
|
@ -706,8 +706,8 @@ VOID ixheaacd_cplx_anal_qmffilt(const WORD16 *time_sample_buf,
|
|||
}
|
||||
|
||||
VOID ixheaacd_inv_modulation_lp(WORD32 *qmf_real, WORD16 *filter_states,
|
||||
ia_sbr_qmf_filter_bank_struct *syn_qmf,
|
||||
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
|
||||
ia_sbr_qmf_filter_bank_struct *syn_qmf,
|
||||
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
|
||||
WORD32 L = syn_qmf->no_channels;
|
||||
const WORD32 M = (L >> 1);
|
||||
WORD32 *dct_in = qmf_real;
|
||||
|
|
@ -723,9 +723,9 @@ VOID ixheaacd_inv_modulation_lp(WORD32 *qmf_real, WORD16 *filter_states,
|
|||
filter_states[3 * M] = 0;
|
||||
}
|
||||
|
||||
VOID ixheaacd_inv_emodulation(
|
||||
WORD32 *qmf_real, ia_sbr_qmf_filter_bank_struct *syn_qmf,
|
||||
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
|
||||
VOID ixheaacd_inv_emodulation(WORD32 *qmf_real,
|
||||
ia_sbr_qmf_filter_bank_struct *syn_qmf,
|
||||
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
|
||||
if (syn_qmf->no_channels == 64)
|
||||
ixheaacd_cos_sin_mod(qmf_real, syn_qmf, qmf_dec_tables_ptr->w_32,
|
||||
qmf_dec_tables_ptr->dig_rev_table2_32);
|
||||
|
|
@ -1675,7 +1675,7 @@ VOID ixheaacd_radix4bfly(const WORD16 *w, WORD32 *x, WORD32 index1,
|
|||
|
||||
VOID ixheaacd_postradixcompute4(WORD32 *ptr_y, WORD32 *ptr_x,
|
||||
const WORD32 *p_dig_rev_tbl, WORD32 npoints) {
|
||||
WORD32 i, k;
|
||||
WORD32 i, k;
|
||||
WORD32 h2;
|
||||
WORD32 xh0_0, xh1_0, xl0_0, xl1_0;
|
||||
WORD32 xh0_1, xh1_1, xl0_1, xl1_1;
|
||||
|
|
@ -1782,7 +1782,7 @@ VOID ixheaacd_postradixcompute4(WORD32 *ptr_y, WORD32 *ptr_x,
|
|||
|
||||
VOID ixheaacd_postradixcompute2(WORD32 *ptr_y, WORD32 *ptr_x,
|
||||
const WORD32 *pdig_rev_tbl, WORD32 npoints) {
|
||||
WORD32 i, k;
|
||||
WORD32 i, k;
|
||||
WORD32 h2;
|
||||
WORD32 x_0, x_1, x_2, x_3;
|
||||
WORD32 x_4, x_5, x_6, x_7;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue