Sanitization fixes from new CTS tests am: 4908247643

am: 54276032af

Change-Id: I99205d19510d505d956a61bee1841dbf13b4f151
This commit is contained in:
Ray Essick 2018-05-25 16:55:26 -07:00 • committed by android-build-merger
commit c0320afbba
151 changed files with 12153 additions and 9239 deletions

View file

@ -11,7 +11,8 @@ cc_library_static {
],
export_include_dirs: [
"decoder"
"decoder",
"decoder/drc_src"
],
srcs: [
@ -215,7 +216,8 @@ cc_library_static {
"decoder/armv7/ixheaacd_fft_15_ld.s",
"decoder/armv7/ixheaacd_aac_ld_dec_rearrange.s",
"decoder/armv7/ixheaacd_fft32x32_ld2_armv7.s",
"decoder/armv7/ixheaacd_apply_scale_fac.s"
"decoder/armv7/ixheaacd_apply_scale_fac.s",
"decoder/armv7/ixheaacd_tns_ar_filter_fixed.s"
],
}
},
@ -248,6 +250,7 @@ cc_library_static {
"decoder/armv8/ixheaacd_apply_scale_factors.s",
"decoder/armv8/ixheaacd_cos_sin_mod_loop1.s",
"decoder/armv8/ixheaacd_cos_sin_mod_loop2.s",
"decoder/armv8/ixheaacd_post_twiddle_overlap.s",
],
},

View file

@ -134,7 +134,7 @@ 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_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,

View file

@ -212,7 +212,7 @@ NEON_PROLOGUE:
CORE_LOOP:
CORE_LOOP_PT:
VMULL.U16 Q15, D2, D13
VST2.32 {Q12, Q13}, [R7], R8
VMULL.U16 Q14, D0, D13
@ -315,7 +315,7 @@ CORE_LOOP:
VADD.I32 Q8, Q11, Q8
SUBS R3, R3, #1
BNE CORE_LOOP
BNE CORE_LOOP_PT

View file

@ -445,7 +445,7 @@ PROLOGUE_NEON:
VUZP.16 D22, D23
VMOV D23, D30
CORE_LOOP:
CORE_LOOP_PTO:
VST1.16 D14[0], [R0, : 16], R9
VMULL.U16 Q15, D0, D9
@ -709,7 +709,7 @@ CORE_LOOP:
VMOV D23, D30
SUBS R3, R3, #1
BNE CORE_LOOP
BNE CORE_LOOP_PTO

View file

@ -186,7 +186,7 @@ NEON_PROLOGUE:
SUB R4, R4, #2
CORE_LOOP:
CORE_LOOP_PTC:
VMULL.U16 Q15, D2, D9
VST2.32 {Q8, Q9}, [R2]!
VMULL.U16 Q14, D4, D9
@ -248,7 +248,7 @@ CORE_LOOP:
VSHL.S32 Q8, Q14, Q7
SUBS R4, R4, #1
BNE CORE_LOOP
BNE CORE_LOOP_PTC
NEON_EPILOGUE:
VMULL.U16 Q15, D2, D9

View file

@ -0,0 +1,553 @@
@/******************************************************************************
@ *
@ * Copyright (C) 2018 The Android Open Source Project
@ *
@ * Licensed under the Apache License, Version 2.0 (the "License")@
@ * you may not use this file except in compliance with the License.
@ * You may obtain a copy of the License at:
@ *
@ * http://www.apache.org/licenses/LICENSE-2.0
@ *
@ * Unless required by applicable law or agreed to in writing, software
@ * distributed under the License is distributed on an "AS IS" BASIS,
@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ * See the License for the specific language governing permissions and
@ * limitations under the License.
@ *
@ *****************************************************************************
@ * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
@*/
.text
.p2align 2
.text
.p2align 2
.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
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 )
FILTER_LOOP:
LDR r1, [sp,#240] @scaleSpec
@filtering loop here
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]
INNER_LOOP1:
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 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
@inc=1,order=4
FILTER_LOOP2:
LDR R1, [sp] @size
ADD R8, R3, #4
SUBS R7 , R1 , r4 @size-order
BEQ EXIT
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]
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
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
ORDER4:
LDR r8 , [r0] @r8 = y = *spectrum
OUTER_LOOP2_4:
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
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]
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]
STR r9 , [r0],#4 @*spectrum = y@
VEXT.32 Q6,Q7,Q6,#3
LDRGT r8 , [r0] @r8 = y = *spectrum
BGT OUTER_LOOP2_4
B EXIT
ORDER8:
LDR r8 , [r0] @r8 = y = *spectrum
OUTER_LOOP2_8:
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
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)@
@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 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
BGT OUTER_LOOP2_8
B EXIT
ORDER12:
LDR r8 , [r0] @r8 = y = *spectrum
OUTER_LOOP2_12:
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
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
@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 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
BGT OUTER_LOOP2_12
B EXIT
ORDER16:
LDR r8 , [r0] @r8 = y = *spectrum
OUTER_LOOP2_16:
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
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
@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 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
BGT OUTER_LOOP2_16
B EXIT
ORDER20:
LDR r8 , [r0] @r8 = y = *spectrum
OUTER_LOOP2_20:
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
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
@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 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
BGT OUTER_LOOP2_20
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
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]
NEGINNER_LOOP1:
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 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
ADD R8, R3, #4
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
CMP R4,#4
VLD1.32 {D12, D13}, [R12]! @state[j - 1]
BEQ NEGORDER4
VLD1.32 {D18, D19}, [R8]!
CMP R4,#8
VLD1.32 {D22, D23}, [R12]!
BEQ NEGORDER8
VLD1.32 {D20, D21}, [R8]!
CMP R4,#12
VLD1.32 {D24, D25}, [R12]!
BEQ NEGORDER12
NEGORDER4:
LDR r8 , [r0] @r8 = y = *spectrum
NEGOUTER_LOOP2_4:
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
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))
MOV r2 , r8 ,lsl r6
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
BGT NEGOUTER_LOOP2_4
B EXIT
NEGORDER8:
LDR r8 , [r0] @r8 = y = *spectrum
NEGOUTER_LOOP2_8:
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
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
@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
STR r9 , [r0],#-4 @*spectrum = y@
VEXT.32 Q6,Q7,Q6,#3
LDRGT r8 , [r0] @r8 = y = *spectrum
BGT NEGOUTER_LOOP2_8
B EXIT
NEGORDER12:
LDR r8 , [r0] @r8 = y = *spectrum
NEGOUTER_LOOP2_12:
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
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
@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
STR r9 , [r0],#-4 @*spectrum = y@
VEXT.32 Q6,Q7,Q6,#3
LDRGT r8 , [r0] @r8 = y = *spectrum
BGT NEGOUTER_LOOP2_12
EXIT:
ADD sp, sp ,#128
vpop {d8-d15}
LDMFD r13!, {r4 - r12, r15}

File diff suppressed because it is too large Load diff

View file

@ -1,21 +1,21 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_API_CMD_STANDARDS_H
@ -24,67 +24,70 @@
/*****************************************************************************/
/* 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_RESET 0x0010
#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_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_RESET 0x0010
#define IA_API_CMD_INPUT_OVER 0x0020
#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_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_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_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_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_POST_CONFIG_PARAMS 0x0200
#define IA_CMD_TYPE_INIT_PROCESS 0x0300
#define IA_CMD_TYPE_INIT_DONE_QUERY 0x0400
#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_CPY_BSF_BUFF 0x0201
#define IA_CMD_TYPE_INIT_CPY_IC_BSF_BUFF 0x0202
@ -100,7 +103,7 @@
#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
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_API_DEFS_H
@ -26,26 +26,26 @@
/* 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

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_API_STRUCT_DEF_H
#define IMPD_DRC_API_STRUCT_DEF_H
@ -52,7 +52,11 @@ typedef struct ia_drc_config_struct
WORD32 delay_line_samples;
WORD32 constant_delay_on;
WORD32 audio_delay_samples;
WORD32 effect_type;
WORD32 target_loudness;
WORD32 loud_norm_flag;
}ia_drc_config_struct;
/* DRC bitsteam handler */
@ -79,7 +83,7 @@ typedef struct bits_handler
WORD32 cpy_over_ic;
WORD32 cpy_over_il;
WORD32 cpy_over_in;
WORD32 gain_stream_flag;
WORD32 gain_stream_flag;
}ia_drc_bits_handler_struct;
typedef struct
@ -93,25 +97,25 @@ typedef struct
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_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;
typedef struct ia_drc_state_struct
{
UWORD32 ui_out_bytes;
UWORD32 ui_in_bytes;
UWORD32 ui_ir_bytes;
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;
UWORD32 ui_init_done;
UWORD32 ui_exe_done;
UWORD32 ui_ir_used;
WORD32 delay_in_output;
WORD32 delay_adjust_samples;
WORD32 delay_adjust_samples;
pVOID persistant_ptr;
}ia_drc_state_struct;
@ -120,10 +124,10 @@ 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_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;
struct ia_bit_buf_struct str_bit_buf, *pstr_bit_buf;
} ia_drc_api_struct;

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
@ -31,261 +31,261 @@
#include "impd_drc_parser.h"
WORD32 impd_read_bits_buf(ia_bit_buf_struct* it_bit_buff,
WORD no_of_bits)
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;
if(it_bit_buff->cnt_bits <= 0)
{
it_bit_buff->error = 1;
return -1;
}
if (no_of_bits==0){
return 0;
}
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;
}
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;
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(it_bit_buff->cnt_bits <= 0)
{
it_bit_buff->error = 1;
return -1;
}
if (no_of_bits==0){
return 0;
}
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;
}
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;
}
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_bit_buf(ia_bit_buf_struct* it_bit_buff,
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_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;
return it_bit_buff;
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->cnt_bits = 0;
it_bit_buff->size = bit_buf_size << 3;
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)
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);
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 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_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 (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_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++)
{
for (i=0; i<lfe_channel_map_count; i++)
{
ia_drc_params_struct->lfe_channel_map[i] = lfe_channel_map[i];
}
}
else
{
}
else
{
ia_drc_params_struct->lfe_channel_map_count = -1;
for (i=0; i<MAX_CHANNEL_COUNT; i++)
{
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);
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)
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;
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;
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;
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)
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)
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);
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;
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)
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;
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)
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)
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);
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(err_code);
return 0;
}

View file

@ -1,53 +1,53 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_BITBUFFER_H
#define IMPD_DRC_BITBUFFER_H
typedef struct ia_bit_buf_struct
typedef struct ia_bit_buf_struct
{
UWORD8 *ptr_bit_buf_base;
UWORD8 *ptr_bit_buf_end;
UWORD8 *ptr_read_next;
WORD32 bit_pos;
WORD32 cnt_bits;
WORD32 size;
WORD32 error;
UWORD8 *ptr_bit_buf_base;
UWORD8 *ptr_bit_buf_end;
UWORD8 *ptr_read_next;
WORD32 bit_pos;
WORD32 cnt_bits;
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);
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);
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);
WORD no_of_bits);
#endif

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_BITSTREAM_DEC_API_H
#define IMPD_DRC_BITSTREAM_DEC_API_H
@ -25,37 +25,37 @@ WORD32 impd_init_drc_bitstream_dec(ia_drc_bits_dec_struct* p_uni_drc_bs_dec_stru
WORD32 sample_rate,
WORD32 frame_size,
WORD32 delay_mode,
WORD32 lfe_channel_map_count,
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_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_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_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,
ia_drc_loudness_info_set_struct* pstr_loudness_info,
UWORD8* bitstream_loudness,
WORD32 num_bytes_loudness
WORD32 num_bytes_loudness
);
#endif

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_COMMON_H
#define IMPD_DRC_COMMON_H
@ -25,41 +25,41 @@ extern "C"
{
#endif
#define EQ_IS_SUPPORTED 1
#define EQ_IS_SUPPORTED 1
#define MEASURE_AVERAGE_BITRATE 0
#define ENABLE_ADDITIONAL_TESTS 1
#define SPEAKER_POS_COUNT_MAX 128
#define DOWNMIX_COEFF_COUNT_MAX 32*32
#define DOWNMIX_COEFF_COUNT_MAX 32*32
#define MAX_CHANNEL_COUNT 128
#define BAND_COUNT_MAX 8
#define SEQUENCE_COUNT_MAX 24
#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 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 MAX_SIGNAL_DELAY 4500
#define DRC_BAND_COUNT_MAX BAND_COUNT_MAX
#define SPLIT_CHARACTERISTIC_COUNT_MAX 8
#define SPLIT_CHARACTERISTIC_COUNT_MAX 8
#define GAIN_SET_COUNT_MAX SEQUENCE_COUNT_MAX
#define SHAPE_FILTER_COUNT_MAX 8
#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 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
@ -68,13 +68,13 @@ extern "C"
#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 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 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
@ -85,7 +85,7 @@ extern "C"
#define FEATURE_REQUEST_COUNT_MAX 10
#define EFFECT_TYPE_REQUEST_COUNT_MAX 10
#define SELECTION_CANDIDATE_COUNT_MAX 32
#define PROC_COMPLETE 1
@ -101,11 +101,11 @@ extern "C"
#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_SELECTED LOCATION_MP4_INSTREAM_UNIDRC
#define AUDIO_CODEC_SUBBAND_COUNT_MAX 256
@ -113,19 +113,19 @@ extern "C"
#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_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 MAX_NUM_DOWNMIX_ID_REQUESTS 15
#define MAX_NUM_DRC_FEATURE_REQUESTS 7
#define MAX_NUM_DRC_EFFECT_TYPE_REQUESTS 15
@ -142,21 +142,21 @@ extern "C"
#define PARAM_DRC_INSTRUCTIONS_COUNT_MAX 8
#define PARAM_DRC_INSTANCE_COUNT_MAX 8
#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 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
@ -170,12 +170,12 @@ extern "C"
#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 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))
@ -187,17 +187,17 @@ extern "C"
#ifndef bool
#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;
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;
@ -208,7 +208,7 @@ typedef struct ia_drc_sel_proc_output_struct
FLOAT32 boost;
FLOAT32 compress;
WORD32 drc_characteristic_target;
FLOAT32 mixing_level;
WORD32 sel_eq_set_ids[SELECTED_EQ_SET_COUNT_MAX];

View file

@ -1,42 +1,45 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#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_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_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_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

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <stdlib.h>
#include "impd_type_def.h"
#include "impd_drc_extr_delta_coded_info.h"
@ -40,45 +40,45 @@ WORD32 impd_init_drc_params(WORD32 frame_size,
{
return -1;
}
if (sample_rate < 1000)
{
return -1;
}
ia_drc_params_struct->drc_frame_size = frame_size;
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->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 ((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->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;
}
if ((gain_delay_samples > MAX_SIGNAL_DELAY) || (gain_delay_samples < 0))
{
return -1;
@ -87,23 +87,23 @@ WORD32 impd_init_drc_params(WORD32 frame_size,
{
ia_drc_params_struct->gain_delay_samples = gain_delay_samples;
}
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;
default:
return -1;
break;
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;
default:
return -1;
break;
}
ia_drc_params_struct->parametric_drc_delay = 0;
ia_drc_params_struct->eq_delay = 0;
return 0;
}
@ -132,7 +132,7 @@ WORD32 impd_select_drc_coefficients(ia_drc_config* drc_config,
}
}
if (cof1 >= 0) {
*drc_coefficients_drc = &(drc_config->str_p_loc_drc_coefficients_uni_drc[cof1]);
}
@ -140,10 +140,10 @@ WORD32 impd_select_drc_coefficients(ia_drc_config* drc_config,
*drc_coefficients_drc = &(drc_config->str_p_loc_drc_coefficients_uni_drc[cof0]);
}
else {
*drc_coefficients_drc = NULL;
*drc_coefficients_drc = NULL;
}
return 0;
}
@ -162,8 +162,8 @@ WORD32 impd_init_selected_drc_set(ia_drc_config* drc_config,
{
WORD32 g, n, c, err = 0;
WORD32 channel_count = 0;
WORD32 i;
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;
@ -171,19 +171,19 @@ WORD32 impd_init_selected_drc_set(ia_drc_config* drc_config,
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;
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)
if (drc_config->str_drc_instruction_str[n].drc_set_id == drc_set_id_selected)
break;
}
if (n == drc_config->drc_instructions_count_plus)
@ -192,21 +192,21 @@ WORD32 impd_init_selected_drc_set(ia_drc_config* drc_config,
}
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)
{
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)
{
}
else if (downmix_id_selected == ID_FOR_ANY_DOWNMIX)
{
channel_count = audio_num_chan;
}
else
{
}
else
{
for(n=0; n<drc_config->dwnmix_instructions_count; n++)
{
if (drc_config->dwnmix_instructions[n].downmix_id == downmix_id_selected)
break;
if (drc_config->dwnmix_instructions[n].downmix_id == downmix_id_selected)
break;
}
if (n == drc_config->dwnmix_instructions_count)
{
@ -215,9 +215,9 @@ WORD32 impd_init_selected_drc_set(ia_drc_config* drc_config,
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;
@ -226,20 +226,20 @@ WORD32 impd_init_selected_drc_set(ia_drc_config* drc_config,
{
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))
{
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++)
{
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++) {
@ -248,7 +248,7 @@ WORD32 impd_init_selected_drc_set(ia_drc_config* drc_config,
}
}
}
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 {
@ -262,7 +262,7 @@ WORD32 impd_init_selected_drc_set(ia_drc_config* drc_config,
}
}
}
for (g=0; g<drc_instructions_uni_drc->num_drc_ch_groups; g++)
{
if (g==0) {
@ -272,9 +272,9 @@ WORD32 impd_init_selected_drc_set(ia_drc_config* drc_config,
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);
}
{
return (UNEXPECTED_ERROR);
}
selected_drc_is_multiband = 1;
}
} else {
@ -282,17 +282,17 @@ WORD32 impd_init_selected_drc_set(ia_drc_config* drc_config,
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);
}
{
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) {
@ -316,21 +316,21 @@ WORD32 impd_init_selected_drc_set(ia_drc_config* drc_config,
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)
{
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)
{
}
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);
}
} 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])
{
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;
@ -338,22 +338,22 @@ WORD32 impd_init_selected_drc_set(ia_drc_config* drc_config,
}
}
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);
&(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);
&(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
{
@ -363,7 +363,7 @@ WORD32 impd_init_selected_drc_set(ia_drc_config* drc_config,
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]);
&shape_filter_block[g]);
}
else
{
@ -371,8 +371,8 @@ WORD32 impd_init_selected_drc_set(ia_drc_config* drc_config,
}
}
}
ia_drc_params_struct->drc_set_counter++;
return (0);
}

View file

@ -1,54 +1,54 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#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 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
, shape_filter_block* shape_filter_block
);
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
);
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);
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

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_DEFINITIONS_H
@ -28,10 +28,10 @@
#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 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

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_EQ_H
#define IMPD_DRC_EQ_H
@ -49,10 +49,10 @@ typedef struct {
WORD32 delay;
FLOAT32 state[EQ_CHANNEL_COUNT_MAX][EQ_AUDIO_DELAY_MAX];
} ia_audio_delay_struct;
typedef struct {
FLOAT32 radius;
FLOAT32 coeff[2];
FLOAT32 coeff[2];
} ia_2nd_order_filt_params_struct;
typedef struct {
@ -101,7 +101,7 @@ typedef struct {
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;
@ -111,7 +111,7 @@ typedef struct {
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 {
@ -119,7 +119,7 @@ typedef struct {
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];
@ -164,17 +164,17 @@ typedef 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);
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);
WORD32* cascade_delay);
WORD32
impd_process_eq_set_td(ia_eq_set_struct* eq_set,
WORD32 channel,
WORD32 channel,
FLOAT32 audio_in,
FLOAT32* audio_out);
@ -185,9 +185,9 @@ WORD32 impd_process_eq_set_time_domain(ia_eq_set_struct* eq_set,
WORD32 frame_size);
WORD32
impd_process_eq_set_subband_domain(ia_eq_set_struct* eq_set,
WORD32 channel,
FLOAT32* subbandSampleIn,
FLOAT32* subbandSampleOut);
WORD32 channel,
FLOAT32* subbandSampleIn,
FLOAT32* subbandSampleOut);
#ifdef __cplusplus

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_ERROR_CODES_H
@ -26,31 +26,31 @@
#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_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_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

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <stdio.h>
#include <math.h>
@ -26,7 +26,7 @@
#include "impd_drc_struct.h"
#include "impd_drc_filter_bank.h"
#include "impd_drc_rom.h"
WORD32 impd_init_tbls(const WORD32 num_gain_max_values,
ia_tables_struct* str_tables)
{
@ -67,8 +67,8 @@ impd_gen_delta_time_code_tbl (const WORD32 num_gain_max_values,
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].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;
@ -107,7 +107,7 @@ impd_get_delta_tmin (const WORD32 sampling_rate)
while (result <= lowerBound) result = result << 1;
return result;
}

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_TABLES_H
#define IMPD_DRC_TABLES_H
@ -49,7 +49,7 @@ typedef struct {
typedef struct {
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;
@ -65,7 +65,7 @@ typedef struct {
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);

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
@ -33,10 +33,10 @@ VOID impd_compute_filt_coeff(WORD32 crossover_freq_idx,
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);
@ -44,7 +44,7 @@ VOID impd_compute_filt_coeff(WORD32 crossover_freq_idx,
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;
@ -52,7 +52,7 @@ VOID impd_compute_filt_coeff(WORD32 crossover_freq_idx,
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);;
@ -60,8 +60,8 @@ VOID impd_compute_filt_coeff(WORD32 crossover_freq_idx,
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;
}
@ -85,7 +85,7 @@ WORD32 impd_initialize_filt_bank(WORD32 num_sub_bands,
&(str_two_band_bank->low_pass),
&(str_two_band_bank->high_pass),
NULL,
0);
0);
}
else if(num_sub_bands==3){
str_three_band_bank = &drc_filter_bank->str_three_band_bank;
@ -99,7 +99,7 @@ WORD32 impd_initialize_filt_bank(WORD32 num_sub_bands,
&(str_three_band_bank->str_low_pass_stage_1),
&(str_three_band_bank->str_high_pass_stage_1),
NULL,
0);
0);
}
else if(num_sub_bands==4){
@ -114,7 +114,7 @@ WORD32 impd_initialize_filt_bank(WORD32 num_sub_bands,
&(str_four_band_bank->str_low_pass_stage_1),
&(str_four_band_bank->str_high_pass_stage_1),
NULL,
0);
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),
@ -137,11 +137,11 @@ WORD32 impd_init_all_filter_banks( ia_uni_drc_coeffs_struct* str_p_loc_drc_coeff
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;
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];
@ -151,10 +151,10 @@ WORD32 impd_init_all_filter_banks( ia_uni_drc_coeffs_struct* str_p_loc_drc_coeff
{
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;
@ -166,11 +166,11 @@ WORD32 impd_init_all_filter_banks( ia_uni_drc_coeffs_struct* str_p_loc_drc_coeff
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)
if (err_code!=0)
return (err_code);
}
}
for (g=0; g<CHANNEL_GROUP_COUNT_MAX + 1; g++)
{
count[g] = 0;
@ -194,7 +194,7 @@ WORD32 impd_init_all_filter_banks( ia_uni_drc_coeffs_struct* str_p_loc_drc_coeff
}
}
}
i=0;
while (i<count[0])
{
@ -211,7 +211,7 @@ WORD32 impd_init_all_filter_banks( ia_uni_drc_coeffs_struct* str_p_loc_drc_coeff
break;
}
}
if (match_found == 0)
if (match_found == 0)
break;
}
if (match_found == 1)
@ -238,22 +238,22 @@ WORD32 impd_init_all_filter_banks( ia_uni_drc_coeffs_struct* str_p_loc_drc_coeff
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++){
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);
1);
}
ia_filter_banks_struct->str_drc_filter_bank[g].str_all_pass_cascade.num_filter = num_filter;
}
if (err_code!=0)
}
if (err_code!=0)
return (err_code);
}
@ -262,7 +262,7 @@ WORD32 impd_init_all_filter_banks( ia_uni_drc_coeffs_struct* str_p_loc_drc_coeff
VOID impd_iir_second_order_filter_all_pass(ia_iir_filter_struct* filter,
WORD32 chan_idx,
WORD32 chan_idx,
WORD32 frame_len,
FLOAT32* input,
FLOAT32* output)
@ -274,20 +274,20 @@ VOID impd_iir_second_order_filter_all_pass(ia_iir_filter_struct* filter,
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];
for (i=0; i<frame_len; i++)
{
tmp = input[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;
}
@ -324,36 +324,36 @@ VOID impd_apply_low_high_filter(ia_iir_filter_struct* pstr_lp_filt_coeff,
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;
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;
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];
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->y_p[chan_idx*2+1] = st4_h;
return;
}
VOID impd_two_band_filter_process(ia_two_band_filt_struct* str_two_band_bank,
@ -364,14 +364,14 @@ VOID impd_two_band_filter_process(ia_two_band_filt_struct* str_two_band_bank,
{
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;
return;
}
@ -389,34 +389,34 @@ VOID impd_three_band_filter_process(ia_three_band_filt_struct* str_three_band_ba
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);
all_pass_filter =&str_three_band_bank->str_all_pass_stage_2;
impd_iir_second_order_filter_all_pass(all_pass_filter,
c,
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;
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;
}
@ -436,7 +436,7 @@ VOID impd_four_band_filter_process(ia_four_band_filt_struct* str_four_band_bank,
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,
@ -444,51 +444,51 @@ VOID impd_four_band_filter_process(ia_four_band_filt_struct* str_four_band_bank,
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,
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,
cha_idx,
win_size,
output1[1],
output2[0]);
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_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;
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);
output2);
return;
}
VOID impd_all_pass_cascade_process(ia_all_pass_cascade_struct *str_all_pass_cascade,
WORD32 ch_idx,
WORD32 win_size,
FLOAT32* input)
FLOAT32* input)
{
WORD32 i;
@ -500,6 +500,6 @@ VOID impd_all_pass_cascade_process(ia_all_pass_cascade_struct *str_all_pass_casc
input,
input);
}
return;
}

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
@ -33,10 +33,10 @@ VOID impd_compute_filt_coeff(WORD32 crossover_freq_idx,
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);
@ -44,7 +44,7 @@ VOID impd_compute_filt_coeff(WORD32 crossover_freq_idx,
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;
@ -52,7 +52,7 @@ VOID impd_compute_filt_coeff(WORD32 crossover_freq_idx,
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);;
@ -60,8 +60,8 @@ VOID impd_compute_filt_coeff(WORD32 crossover_freq_idx,
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;
}
@ -85,7 +85,7 @@ WORD32 impd_initialize_filt_bank(WORD32 num_sub_bands,
&(str_two_band_bank->low_pass),
&(str_two_band_bank->high_pass),
NULL,
0);
0);
}
else if(num_sub_bands==3){
str_three_band_bank = &drc_filter_bank->str_three_band_bank;
@ -99,7 +99,7 @@ WORD32 impd_initialize_filt_bank(WORD32 num_sub_bands,
&(str_three_band_bank->str_low_pass_stage_1),
&(str_three_band_bank->str_high_pass_stage_1),
NULL,
0);
0);
}
else if(num_sub_bands==4){
@ -114,7 +114,7 @@ WORD32 impd_initialize_filt_bank(WORD32 num_sub_bands,
&(str_four_band_bank->str_low_pass_stage_1),
&(str_four_band_bank->str_high_pass_stage_1),
NULL,
0);
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),
@ -137,11 +137,11 @@ WORD32 impd_init_all_filter_banks( ia_uni_drc_coeffs_struct* str_p_loc_drc_coeff
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;
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];
@ -151,10 +151,10 @@ WORD32 impd_init_all_filter_banks( ia_uni_drc_coeffs_struct* str_p_loc_drc_coeff
{
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;
@ -166,11 +166,11 @@ WORD32 impd_init_all_filter_banks( ia_uni_drc_coeffs_struct* str_p_loc_drc_coeff
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)
if (err_code!=0)
return (err_code);
}
}
for (g=0; g<CHANNEL_GROUP_COUNT_MAX + 1; g++)
{
count[g] = 0;
@ -194,7 +194,7 @@ WORD32 impd_init_all_filter_banks( ia_uni_drc_coeffs_struct* str_p_loc_drc_coeff
}
}
}
i=0;
while (i<count[0])
{
@ -211,7 +211,7 @@ WORD32 impd_init_all_filter_banks( ia_uni_drc_coeffs_struct* str_p_loc_drc_coeff
break;
}
}
if (match_found == 0)
if (match_found == 0)
break;
}
if (match_found == 1)
@ -238,22 +238,22 @@ WORD32 impd_init_all_filter_banks( ia_uni_drc_coeffs_struct* str_p_loc_drc_coeff
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++){
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);
1);
}
ia_filter_banks_struct->str_drc_filter_bank[g].str_all_pass_cascade.num_filter = num_filter;
}
if (err_code!=0)
}
if (err_code!=0)
return (err_code);
}
@ -262,7 +262,7 @@ WORD32 impd_init_all_filter_banks( ia_uni_drc_coeffs_struct* str_p_loc_drc_coeff
VOID impd_iir_second_order_filter_all_pass(ia_iir_filter_struct* filter,
WORD32 chan_idx,
WORD32 chan_idx,
WORD32 frame_len,
FLOAT32* input,
FLOAT32* output)
@ -274,20 +274,20 @@ VOID impd_iir_second_order_filter_all_pass(ia_iir_filter_struct* filter,
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];
for (i=0; i<frame_len; i++)
{
tmp = input[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;
}
@ -324,36 +324,36 @@ VOID impd_apply_low_high_filter(ia_iir_filter_struct* pstr_lp_filt_coeff,
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;
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;
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];
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->y_p[chan_idx*2+1] = st4_h;
return;
}
VOID impd_two_band_filter_process(ia_two_band_filt_struct* str_two_band_bank,
@ -364,14 +364,14 @@ VOID impd_two_band_filter_process(ia_two_band_filt_struct* str_two_band_bank,
{
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;
return;
}
@ -389,34 +389,34 @@ VOID impd_three_band_filter_process(ia_three_band_filt_struct* str_three_band_ba
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);
all_pass_filter =&str_three_band_bank->str_all_pass_stage_2;
impd_iir_second_order_filter_all_pass(all_pass_filter,
c,
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;
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;
}
@ -436,7 +436,7 @@ VOID impd_four_band_filter_process(ia_four_band_filt_struct* str_four_band_bank,
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,
@ -444,51 +444,51 @@ VOID impd_four_band_filter_process(ia_four_band_filt_struct* str_four_band_bank,
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,
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,
cha_idx,
win_size,
output1[1],
output2[0]);
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_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;
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);
output2);
return;
}
VOID impd_all_pass_cascade_process(ia_all_pass_cascade_struct *str_all_pass_cascade,
WORD32 ch_idx,
WORD32 win_size,
FLOAT32* input)
FLOAT32* input)
{
WORD32 i;
@ -500,6 +500,6 @@ VOID impd_all_pass_cascade_process(ia_all_pass_cascade_struct *str_all_pass_casc
input,
input);
}
return;
}

View file

@ -1,27 +1,27 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_FILTER_BANK_H
#define IMPD_DRC_FILTER_BANK_H
#define FILTER_BANK_PARAMETER_COUNT 16
#define CASCADE_ALLPASS_COUNT_MAX 9
#define CASCADE_ALLPASS_COUNT_MAX 9
#define QMF_NUM_FILT_BANDS 64
#define QMF_FILT_RESOLUTION 64
@ -66,7 +66,7 @@ typedef struct {
FLOAT32 b1;
FLOAT32 b2;
FLOAT32 x_p[MAX_CHANNEL_COUNT*2];
FLOAT32 y_p[MAX_CHANNEL_COUNT*2];
FLOAT32 y_p[MAX_CHANNEL_COUNT*2];
} ia_iir_filter_struct;
typedef struct {
ia_iir_filter_struct low_pass;
@ -83,9 +83,9 @@ typedef 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_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_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;
@ -95,19 +95,19 @@ typedef struct {
typedef struct {
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;
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;
ia_all_pass_cascade_struct str_all_pass_cascade;
} ia_drc_filter_bank_struct;
typedef struct {
@ -120,31 +120,31 @@ typedef 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);
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[]);
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);
WORD32 c,
WORD32 size,
FLOAT32* audio_in);
WORD32
impd_shape_filt_block_init(ia_shape_filter_block_params_struct* pstr_shape_filter_block_params,
@ -161,5 +161,5 @@ WORD32 impd_shape_filt_block_time_process(shape_filter_block* shape_filter_block
const WORD32 channel,
FLOAT32 *audio_in,
WORD32 start,
WORD32 end);
WORD32 end);
#endif

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
@ -46,16 +46,16 @@ WORD32 impd_gain_db_to_lin (ia_interp_params_struct* interp_params_str,
FLOAT32 loc_db_gain = in_param_db_gain;
FLOAT32 gain_ratio = 1.0;
ia_gain_modifiers_struct* pstr_gain_modifiers = interp_params_str->pstr_gain_modifiers;
if (interp_params_str->gain_modification_flag) {
if ((interp_params_str->characteristic_index > 0) && (loc_db_gain != 0.0f)){
gain_ratio = 1.0f;
gain_ratio = 1.0f;
}
if (loc_db_gain < 0.0f) {
gain_ratio *= interp_params_str->compress;
}
@ -74,11 +74,11 @@ WORD32 impd_gain_db_to_lin (ia_interp_params_struct* interp_params_str,
if ((interp_params_str->pstr_ducking_modifiers->ducking_scaling_flag == 1) && (interp_params_str->ducking_flag == 1)) {
gain_ratio *= interp_params_str->pstr_ducking_modifiers->ducking_scaling;
}
{
*out_param_lin_gain = (FLOAT32)pow(2.0, (FLOAT64)(gain_ratio * loc_db_gain / 6.0f));
*out_param_lin_slope = SLOPE_FACTOR_DB_TO_LINEAR * gain_ratio * *out_param_lin_gain * in_param_db_slope;
if (pstr_gain_modifiers->gain_offset_flag[drc_band] == 1) {
*out_param_lin_gain *= (FLOAT32)pow(2.0, (FLOAT64)(pstr_gain_modifiers->gain_offset[drc_band]/6.0f));
}
@ -108,12 +108,12 @@ impd_compressor_io_sigmoid(ia_split_drc_characteristic_struct* split_drc_charact
FLOAT32 in_out_ratio = split_drc_characteristic->in_out_ratio;
FLOAT32 gainDbLimit = split_drc_characteristic->gain;
FLOAT32 exp = split_drc_characteristic->exp;
tmp = (DRC_INPUT_LOUDNESS_TARGET - in_db_level) * in_out_ratio;
if (exp < 1000.0f) {
FLOAT32 x = tmp/gainDbLimit;
if (x < 0.0f)
{
if (x < 0.0f)
{
return(UNEXPECTED_ERROR);
}
*out_db_gain = (FLOAT32)(tmp / pow(1.0f + pow(x, exp), 1.0f/exp));
@ -135,20 +135,20 @@ impd_compressor_io_sigmoid_inv(ia_split_drc_characteristic_struct* split_drc_cha
FLOAT32 gainDbLimit = split_drc_characteristic->gain;
FLOAT32 exp = split_drc_characteristic->exp;
FLOAT32 tmp = loc_db_gain;
if (split_drc_characteristic->flip_sign == 1) {
tmp = - loc_db_gain;
}
if (exp < 1000.0f) {
FLOAT32 x = tmp/gainDbLimit;
if (x < 0.0f)
{
if (x < 0.0f)
{
return(UNEXPECTED_ERROR);
}
tmp = (FLOAT32)(tmp / pow(1.0f - pow(x, exp), 1.0f / exp));
}
*in_level = DRC_INPUT_LOUDNESS_TARGET - tmp / in_out_ratio;
return(0);
}
@ -161,9 +161,9 @@ impd_compressor_io_nodes_lt(ia_split_drc_characteristic_struct* split_drc_charac
FLOAT32 w;
FLOAT32* node_level = split_drc_characteristic->node_level;
FLOAT32* node_gain = split_drc_characteristic->node_gain;
if (in_db_level > DRC_INPUT_LOUDNESS_TARGET)
{
if (in_db_level > DRC_INPUT_LOUDNESS_TARGET)
{
return (UNEXPECTED_ERROR);
}
for (n=1; n<=split_drc_characteristic->characteristic_node_count; n++) {
@ -185,9 +185,9 @@ impd_compressor_io_nodes_rt(ia_split_drc_characteristic_struct* split_drc_charac
FLOAT32 w;
FLOAT32* node_level = split_drc_characteristic->node_level;
FLOAT32* node_gain = split_drc_characteristic->node_gain;
if (in_db_level < DRC_INPUT_LOUDNESS_TARGET)
{
if (in_db_level < DRC_INPUT_LOUDNESS_TARGET)
{
return (UNEXPECTED_ERROR);
}
for (n=1; n<=split_drc_characteristic->characteristic_node_count; n++) {
@ -211,7 +211,7 @@ impd_compressor_io_nodes_inverse(ia_split_drc_characteristic_struct* split_drc_c
FLOAT32* node_level = split_drc_characteristic->node_level;
FLOAT32* node_gain = split_drc_characteristic->node_gain;
WORD32 node_count = split_drc_characteristic->characteristic_node_count;
if (node_gain[1] < 0.0f) {
if (loc_db_gain <= node_gain[node_count]) {
*in_level = node_level[node_count];
@ -261,7 +261,7 @@ impd_map_gain (
{
FLOAT32 inLevel;
WORD32 err = 0;
switch (split_drc_characteristic_source->characteristic_format) {
case CHARACTERISTIC_SIGMOID:
err = impd_compressor_io_sigmoid_inv(split_drc_characteristic_source, gain_in_db, &inLevel);
@ -319,7 +319,7 @@ impd_conv_to_linear_domain (ia_interp_params_struct* interp_params_str,
ia_split_drc_characteristic_struct* split_drc_characteristic_source;
WORD32 slopeIsNegative;
if (interp_params_str->drc_characteristic_present) {
if (interp_params_str->drc_source_characteristic_cicp_format)
{
@ -345,7 +345,7 @@ impd_conv_to_linear_domain (ia_interp_params_struct* interp_params_str,
(interp_params_str->split_target_characteristic_right->characteristic_format == CHARACTERISTIC_PASS_THRU)))
{
mapped_db_gain = DRC_INPUT_LOUDNESS_TARGET;
loc_db_gain = DRC_INPUT_LOUDNESS_TARGET;
loc_db_gain = DRC_INPUT_LOUDNESS_TARGET;
}
}
else
@ -356,7 +356,7 @@ impd_conv_to_linear_domain (ia_interp_params_struct* interp_params_str,
{
err = impd_map_gain(split_drc_characteristic_source, interp_params_str->split_target_characteristic_left, loc_db_gain, &mapped_db_gain);
if (err) return (err);
gain_ratio = mapped_db_gain / loc_db_gain;
gain_ratio = mapped_db_gain / loc_db_gain;
}
}
@ -367,13 +367,13 @@ impd_conv_to_linear_domain (ia_interp_params_struct* interp_params_str,
split_drc_characteristic_source = interp_params_str->split_source_characteristic_right;
err = impd_map_gain(split_drc_characteristic_source, interp_params_str->split_target_characteristic_right, loc_db_gain, &mapped_db_gain);
if (err) return (err);
gain_ratio = mapped_db_gain / loc_db_gain;
gain_ratio = mapped_db_gain / loc_db_gain;
}
}
}
}
}
if (loc_db_gain < 0.0f) {
gain_ratio *= interp_params_str->compress;
}
@ -392,17 +392,17 @@ impd_conv_to_linear_domain (ia_interp_params_struct* interp_params_str,
if ((interp_params_str->pstr_ducking_modifiers->ducking_scaling_flag == 1) && (interp_params_str->ducking_flag == 1)) {
gain_ratio *= interp_params_str->pstr_ducking_modifiers->ducking_scaling;
}
if (interp_params_str->interpolation_loud_eq == 1)
{
*out_param_lin_gain = gain_ratio * loc_db_gain + pstr_gain_modifiers->gain_offset[drc_band];
*out_param_lin_slope = 0.0f;
*out_param_lin_gain = gain_ratio * loc_db_gain + pstr_gain_modifiers->gain_offset[drc_band];
*out_param_lin_slope = 0.0f;
}
else
{
*out_param_lin_gain = (FLOAT32)pow(2.0, (FLOAT64)(gain_ratio * loc_db_gain / 6.0f));
*out_param_lin_slope = SLOPE_FACTOR_DB_TO_LINEAR * gain_ratio * *out_param_lin_gain * in_param_db_slope;
if (pstr_gain_modifiers->gain_offset_flag[drc_band] == 1) {
*out_param_lin_gain *= (FLOAT32)pow(2.0, (FLOAT64)(pstr_gain_modifiers->gain_offset[drc_band]/6.0f));
}
@ -425,7 +425,7 @@ WORD32 impd_interpolate_drc_gain(ia_interp_params_struct* interp_params_str,
FLOAT32 slope0,
FLOAT32 slope1,
FLOAT32* result)
{
{
WORD32 err = 0;
WORD32 n;
FLOAT32 k1, k2, a, b, c, d;
@ -433,23 +433,23 @@ WORD32 impd_interpolate_drc_gain(ia_interp_params_struct* interp_params_str,
FLOAT32 slope_t2;
FLOAT32 gain_t1;
FLOAT32 gain_t2;
WORD32 cubic_interpolation = 1;
WORD32 node_inser;
FLOAT32 node_inser_float;
if (gain_step_tdomain <= 0)
{
return (UNEXPECTED_ERROR);
}
err = impd_conv_to_linear_domain (interp_params_str, drc_band, gain0, slope0, &gain_t1, &slope_t1);
if (err)
return (err);
err = impd_conv_to_linear_domain (interp_params_str, drc_band, gain1, slope1, &gain_t2, &slope_t2);
if (err)
return (err);
if (interp_params_str->gain_interpolation_type == GAIN_INTERPOLATION_TYPE_SPLINE) {
slope_t1 = slope_t1/(FLOAT32) interp_params_str->delta_tmin;
slope_t2 = slope_t2/(FLOAT32) interp_params_str->delta_tmin;
@ -459,10 +459,10 @@ WORD32 impd_interpolate_drc_gain(ia_interp_params_struct* interp_params_str,
node_inser = (WORD32) (0.5f + node_inser_float);
if ((node_inser >= 0) && (node_inser < gain_step_tdomain)) {
cubic_interpolation = 0;
result[0] = gain_t1;
result[gain_step_tdomain] = gain_t2;
a = 0.5f*(slope_t2 - slope_t1) / node_inser_float;
b = slope_t1;
c = gain_t1;
@ -487,10 +487,10 @@ WORD32 impd_interpolate_drc_gain(ia_interp_params_struct* interp_params_str,
node_inser = (WORD32) (0.5f + node_inser_float);
if ((node_inser >= 0) && (node_inser < gain_step_tdomain)) {
cubic_interpolation = 0;
result[0] = gain_t1;
result[gain_step_tdomain] = gain_t2;
a = slope_t1;
b = gain_t1;
for (n=1; n<node_inser; n++) {
@ -507,20 +507,20 @@ WORD32 impd_interpolate_drc_gain(ia_interp_params_struct* interp_params_str,
}
}
}
if (cubic_interpolation == 1)
{
FLOAT32 gain_step_inv = 1.0f / (FLOAT32)gain_step_tdomain;
FLOAT32 gain_step_inv2 = gain_step_inv * gain_step_inv;
k1 = (gain_t2 - gain_t1) * gain_step_inv2;
k2 = slope_t2 + slope_t1;
a = gain_step_inv * (gain_step_inv * k2 - 2.0f * k1);
b = 3.0f * k1 - gain_step_inv * (k2 + slope_t1);
c = slope_t1;
d = gain_t1;
result[0] = gain_t1;
result[gain_step_tdomain] = gain_t2;
for (n=1; n<gain_step_tdomain; n++) {
@ -530,10 +530,10 @@ WORD32 impd_interpolate_drc_gain(ia_interp_params_struct* interp_params_str,
}
}
}
else {
else {
a = (gain_t2 - gain_t1) / (FLOAT32)gain_step_tdomain;
b = gain_t1;
result[0] = gain_t1;
result[gain_step_tdomain] = gain_t2;
for (n=1; n<gain_step_tdomain; n++) {
@ -569,7 +569,7 @@ impd_concatenate_segments(WORD32 drc_frame_size,
{
WORD32 timePrev, duration, n, err = 0;
FLOAT32 loc_db_gain = 0.0f, prev_db_gain, slope = 0.0f, slopePrev;
timePrev = buf_interpolation->prev_node.time;
prev_db_gain = buf_interpolation->prev_node.loc_db_gain;
slopePrev = buf_interpolation->prev_node.slope;
@ -588,16 +588,16 @@ impd_concatenate_segments(WORD32 drc_frame_size,
slope,
buf_interpolation->lpcm_gains + MAX_SIGNAL_DELAY + drc_frame_size + timePrev);
if (err) return (err);
timePrev = str_spline_nodes->str_node[n].time;
prev_db_gain = loc_db_gain;
slopePrev = slope;
}
buf_interpolation->str_node.loc_db_gain = loc_db_gain;
buf_interpolation->str_node.slope = slope;
buf_interpolation->str_node.time = timePrev;
return(0);
}
@ -620,7 +620,7 @@ impd_get_drc_gain (ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
WORD32 b, g, gainElementIndex, err = 0;
WORD32 parametricDrcInstanceIndex = 0;
ia_interp_params_struct interp_params_str = {0};
ia_drc_instructions_struct* str_drc_instruction_str = &(pstr_drc_config->str_drc_instruction_str[drc_instructions_index]);
WORD32 drc_set_effect = str_drc_instruction_str->drc_set_effect;
WORD32 num_drc_ch_groups = str_drc_instruction_str->num_drc_ch_groups;
@ -635,14 +635,14 @@ impd_get_drc_gain (ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
{
return (UNEXPECTED_ERROR);
}
interp_params_str.loudness_normalization_gain_db = loudness_normalization_gain_db;
interp_params_str.characteristic_index = characteristic_index;
interp_params_str.characteristic_index = characteristic_index;
interp_params_str.compress = compress;
interp_params_str.boost = boost;
interp_params_str.limiter_peak_target_present = str_drc_instruction_str->limiter_peak_target_present;
interp_params_str.limiter_peak_target = str_drc_instruction_str->limiter_peak_target;
if ( ((drc_set_effect & (EFFECT_BIT_DUCK_OTHER | EFFECT_BIT_DUCK_SELF)) == 0) && (drc_set_effect != EFFECT_BIT_FADE) && (drc_set_effect != EFFECT_BIT_CLIPPING))
{
interp_params_str.gain_modification_flag = 1;
@ -659,7 +659,7 @@ impd_get_drc_gain (ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
{
interp_params_str.ducking_flag = 0;
}
if (drc_set_effect == EFFECT_BIT_CLIPPING)
if (drc_set_effect == EFFECT_BIT_CLIPPING)
{
interp_params_str.clipping_flag = 1;
}
@ -667,10 +667,10 @@ impd_get_drc_gain (ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
{
interp_params_str.clipping_flag = 0;
}
err = impd_advance_buf(ia_drc_params_struct->drc_frame_size, &(drc_gain_buffers->pstr_gain_buf[sel_drc_index]));
if (err) return (err);
gainElementIndex = 0;
for(g=0; g<num_drc_ch_groups; g++)
{
@ -710,7 +710,7 @@ impd_get_drc_gain (ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
&p_drc_gain_dec_structs->parametricdrc_params,
&p_drc_gain_dec_structs->parametricdrc_params.str_parametric_drc_instance_params[parametricDrcInstanceIndex]);
if (err) return (err);
err = impd_concatenate_segments(ia_drc_params_struct->drc_frame_size,
0,
&interp_params_str,
@ -738,9 +738,9 @@ impd_get_drc_gain (ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
&p_drc_gain_dec_structs->parametricdrc_params.str_parametric_drc_instance_params[parametricDrcInstanceIndex].str_spline_nodes,
&(drc_gain_buffers->pstr_gain_buf[sel_drc_index].buf_interpolation[gainElementIndex]));
if (err) return (err);
} else {
return (UNEXPECTED_ERROR);
return (UNEXPECTED_ERROR);
}
gainElementIndex++;
parametricDrcInstanceIndex++;

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_GAIN_DEC_H
#define IMPD_DRC_GAIN_DEC_H

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
@ -47,25 +47,25 @@ IA_ERRORCODE impd_init_drc_decode( WORD32 frame_size,
{
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);
if (err_code!=IA_NO_ERROR)
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);
if (err_code!=IA_NO_ERROR)
if (err_code!=IA_NO_ERROR)
return (err_code);
return err_code;
}
@ -75,19 +75,19 @@ IA_ERRORCODE impd_init_drc_decode_post_config(WORD32 audio_num
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
pVOID *mem_ptr
)
{
IA_ERRORCODE err_code = 0;
WORD32 i,j,k, maxMultibandAudioSignalCount=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;
for (i = 0; i < num_sets_processed; i++)
{
err_code = impd_init_selected_drc_set(pstr_drc_config,
@ -100,10 +100,10 @@ IA_ERRORCODE impd_init_drc_decode_post_config(WORD32 audio_num
&p_drc_gain_dec_structs->str_overlap_params
,p_drc_gain_dec_structs->shape_filter_block
);
if (err_code)
if (err_code)
return (err_code);
}
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) {
@ -111,15 +111,15 @@ IA_ERRORCODE impd_init_drc_decode_post_config(WORD32 audio_num
pstr_loudness_info,
&p_drc_gain_dec_structs->parametricdrc_params,
mem_ptr);
if (err_code)
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;
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;
@ -147,12 +147,12 @@ IA_ERRORCODE impd_init_drc_decode_post_config(WORD32 audio_num
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);
*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++)
{
@ -160,7 +160,7 @@ IA_ERRORCODE impd_init_drc_decode_post_config(WORD32 audio_num
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;
@ -170,9 +170,9 @@ IA_ERRORCODE impd_init_drc_decode_post_config(WORD32 audio_num
}
}
if (eq_set_id_processed > 0)
{
for(i=0; i<pstr_drc_config->str_drc_config_ext.eq_instructions_count; i++)
@ -180,16 +180,16 @@ IA_ERRORCODE impd_init_drc_decode_post_config(WORD32 audio_num
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)
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)
if (err_code)
return (err_code);
err_code = impd_derive_eq_set (&pstr_drc_config->str_drc_config_ext.str_eq_coeff,
@ -198,14 +198,14 @@ IA_ERRORCODE impd_init_drc_decode_post_config(WORD32 audio_num
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)
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);
}
for (i=0; i<p_drc_params_struct->drc_set_counter; i++)
@ -214,7 +214,7 @@ IA_ERRORCODE impd_init_drc_decode_post_config(WORD32 audio_num
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);
}
@ -222,7 +222,7 @@ IA_ERRORCODE impd_init_drc_decode_post_config(WORD32 audio_num
*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;
@ -236,9 +236,9 @@ IA_ERRORCODE impd_init_drc_decode_post_config(WORD32 audio_num
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;
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);
@ -249,20 +249,20 @@ IA_ERRORCODE impd_init_drc_decode_post_config(WORD32 audio_num
if (p_drc_params_struct->sub_band_domain_mode != SUBBAND_DOMAIN_MODE_OFF && p_audio_in_out_buf->audio_delay_sub_band_samples) {
p_audio_in_out_buf->audio_buffer_delayed_real = *mem_ptr;
*mem_ptr = (pVOID) ((SIZE_T)*mem_ptr+(p_audio_in_out_buf->audio_num_chan*sizeof(FLOAT32*))+32);
*mem_ptr = (pVOID) ((SIZE_T)*mem_ptr+(p_audio_in_out_buf->audio_num_chan*sizeof(FLOAT32*))+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);
*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);
*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);
*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);
*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);
*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];
@ -285,11 +285,11 @@ IA_ERRORCODE impd_drc_process_time_domain( ia_drc_gain_dec_struct* p_drc_gain_d
FLOAT32 compress,
WORD32 drc_characteristic_target)
{
WORD32 sel_drc_index;
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;
@ -305,13 +305,13 @@ IA_ERRORCODE impd_drc_process_time_domain( ia_drc_gain_dec_struct* p_drc_gain_d
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)
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,
@ -321,10 +321,10 @@ IA_ERRORCODE impd_drc_process_time_domain( ia_drc_gain_dec_struct* p_drc_gain_d
loudness_normalization_gain_db,
sel_drc_index,
&p_drc_gain_dec_structs->drc_gain_buffers);
if(err_code!=IA_NO_ERROR)
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,
@ -350,9 +350,9 @@ IA_ERRORCODE impd_drc_process_time_domain( ia_drc_gain_dec_struct* p_drc_gain_d
&p_drc_gain_dec_structs->audio_band_buffer,
&p_drc_gain_dec_structs->ia_filter_banks_struct,
passThru);
if(err_code!=IA_NO_ERROR)
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,
@ -363,11 +363,11 @@ IA_ERRORCODE impd_drc_process_time_domain( ia_drc_gain_dec_struct* p_drc_gain_d
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);
@ -386,14 +386,14 @@ IA_ERRORCODE impd_drc_process_freq_domain( ia_drc_gain_dec_struct* p_drc_gain_
FLOAT32 compress,
WORD32 drc_characteristic_target)
{
WORD32 sel_drc_index;
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,
@ -409,7 +409,7 @@ IA_ERRORCODE impd_drc_process_freq_domain( ia_drc_gain_dec_struct* p_drc_gain_
&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++)
@ -453,7 +453,7 @@ IA_ERRORCODE impd_drc_process_freq_domain( ia_drc_gain_dec_struct* p_drc_gain_
}
}
}
err_code = impd_advance_audio_buff_freq(&p_drc_gain_dec_structs->audio_in_out_buf);
return err_code;
@ -465,7 +465,7 @@ VOID impd_get_parametric_drc_delay(ia_drc_gain_dec_struct* p_drc_gain_dec_struc
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) {
@ -483,7 +483,7 @@ VOID impd_get_eq_delay(ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
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) {
@ -491,7 +491,7 @@ VOID impd_get_eq_delay(ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
} else {
*eq_delay_max = -1;
}
return;
}

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_GAIN_DECODER2_H
#define IMPD_DRC_GAIN_DECODER2_H
@ -56,9 +56,9 @@ WORD32 impd_init_drc_decode_post_config( WORD32 audio_num_chan,
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
);
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,
@ -83,7 +83,7 @@ VOID impd_get_parametric_drc_delay(ia_drc_gain_dec_struct* p_drc_gain_dec_struc
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,
@ -101,7 +101,7 @@ impd_get_drc_gain (ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
ia_drc_gain_buffers_struct* drc_gain_buffers);
#endif

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_HASHDEFINES_H
#define IMPD_DRC_HASHDEFINES_H

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <stdio.h>
#include "impd_type_def.h"
#include "impd_drc_extr_delta_coded_info.h"
@ -27,14 +27,14 @@
#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;
pstr_drc_sel_proc_params->album_mode = 0;
pstr_drc_sel_proc_params->peak_limiter = 1;
@ -48,7 +48,7 @@ WORD32 impd_set_default_params_selection_process(ia_drc_sel_proc_params_struct *
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_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) {
@ -56,28 +56,28 @@ WORD32 impd_set_default_params_selection_process(ia_drc_sel_proc_params_struct *
pstr_drc_sel_proc_params->output_peak_level_max = 6.0f;
}
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_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;
}
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_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]);
@ -98,10 +98,10 @@ WORD32 impd_set_custom_params(const WORD32 param_set_idx,
}
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->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;
@ -142,19 +142,19 @@ WORD32 impd_set_custom_params(const WORD32 param_set_idx,
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->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);
}
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);
}

View file

@ -1,36 +1,36 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_HOST_PARAMS_H
#define IMPD_DRC_HOST_PARAMS_H
#ifdef __cplusplus
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_custom_params(const WORD32 param_set_idx,
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params);
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
}
#endif /* __cplusplus */

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <stdlib.h>
#include <math.h>
#include "impd_type_def.h"
@ -43,31 +43,34 @@
#include "impd_drc_host_params.h"
#define PARAMETRIC_DRC_DELAY_MAX_DEFAULT 4096
#define EQ_DELAY_MAX_DEFAULT 256
#define PARAMETRIC_DRC_DELAY_MAX_DEFAULT 4096
#define EQ_DELAY_MAX_DEFAULT 256
IA_ERRORCODE impd_drc_mem_api(ia_drc_api_struct *p_obj_drc,
WORD32 iCmd, WORD32 iIdx, pVOID pvValue);
WORD32 iCmd, WORD32 iIdx, pVOID pvValue);
IA_ERRORCODE impd_drc_fill_mem_tables(ia_drc_api_struct *p_obj_drc);
WORD32
impd_drc_dec_interface_process(
ia_bit_buf_struct* it_bit_buff,
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
impd_drc_dec_interface_add_effect_type(ia_drc_interface_struct* pstr_drc_interface,
WORD32 drc_effect_type,WORD32 target_loudness, WORD32 loud_norm);
#define NUM_GAIN_DEC_INSTANCES 2
#define BITSTREAM_FILE_FORMAT_SPLIT 1
#define LIM_DEFAULT_THRESHOLD (0.89125094f)
#define LIM_DEFAULT_THRESHOLD (0.89125094f)
static WORD32 impd_match_downmix(WORD32 downmix_id, WORD32 dec_downmix_id)
{
{
WORD32 id_match = 0;
switch (dec_downmix_id )
@ -110,7 +113,10 @@ IA_ERRORCODE impd_drc_set_default_config(ia_drc_api_struct *p_obj_drc)
p_obj_drc->str_config.absorb_delay_on = 1;
p_obj_drc->str_config.subband_domain_io_flag = 0;
p_obj_drc->str_config.constant_delay_on = 0;
p_obj_drc->str_config.audio_delay_samples = 0;
p_obj_drc->str_config.audio_delay_samples = 0;
p_obj_drc->str_config.effect_type = 0;
p_obj_drc->str_config.target_loudness = -24;
p_obj_drc->str_config.loud_norm_flag = 0;
p_obj_drc->str_bit_handler.byte_index_bs = 0;
p_obj_drc->str_bit_handler.num_bytes_bs = 0;
p_obj_drc->str_bit_handler.num_bits_offset_bs = 0;
@ -123,7 +129,7 @@ IA_ERRORCODE impd_drc_set_default_config(ia_drc_api_struct *p_obj_drc)
p_obj_drc->str_bit_handler.num_bytes_bs_unidrc_interface = 0;
p_obj_drc->str_bit_handler.num_bits_read_bs_unidrc_interface = 0;
p_obj_drc->str_bit_handler.cpy_over_in = 0;
p_obj_drc->str_bit_handler.gain_stream_flag = 0;
p_obj_drc->str_bit_handler.gain_stream_flag = 0;
return IA_NO_ERROR;
}
@ -131,118 +137,118 @@ IA_ERRORCODE impd_drc_set_default_config(ia_drc_api_struct *p_obj_drc)
IA_ERRORCODE impd_drc_set_default_bitstream_config(ia_drc_config *pstr_drc_config)
{
WORD32 i;
WORD32 i;
pstr_drc_config->sample_rate_present=0;
pstr_drc_config->sampling_rate=0;
pstr_drc_config->dwnmix_instructions_count=0;
pstr_drc_config->drc_coefficients_drc_count=1;
pstr_drc_config->drc_instructions_uni_drc_count=4;
pstr_drc_config->drc_instructions_count_plus=5;
pstr_drc_config->drc_description_basic_present=0;
pstr_drc_config->drc_coefficients_basic_count=0;
pstr_drc_config->drc_instructions_basic_count=0;
pstr_drc_config->drc_config_ext_present=1;
pstr_drc_config->apply_drc=0;
pstr_drc_config->str_drc_config_ext.drc_config_ext_type[0]=2;
pstr_drc_config->str_drc_config_ext.ext_bit_size[0]=345;
pstr_drc_config->str_drc_config_ext.parametric_drc_present=0;
pstr_drc_config->str_drc_config_ext.drc_extension_v1_present=1;
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].version=1;
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].drc_location=1;
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_count=4;
for(i=0;i<pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_count;i++)
{
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_params[i].gain_interpolation_type=1;
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_params[i].band_count=1;
}
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_sequence_count=4;
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_params_index_for_gain_sequence[0]=0;
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_params_index_for_gain_sequence[1]=1;
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_params_index_for_gain_sequence[2]=2;
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_params_index_for_gain_sequence[3]=3;
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_count_plus=4;
pstr_drc_config->str_drc_instruction_str[0].drc_set_id=1;
pstr_drc_config->str_drc_instruction_str[0].drc_set_complexity_level=2;
pstr_drc_config->str_drc_instruction_str[0].drc_location=1;
pstr_drc_config->str_drc_instruction_str[0].dwnmix_id_count=1;
pstr_drc_config->str_drc_instruction_str[0].drc_set_effect=1;
pstr_drc_config->str_drc_instruction_str[0].gain_set_index[1]=1;
pstr_drc_config->str_drc_instruction_str[0].drc_set_target_loudness_value_lower=-63;
pstr_drc_config->str_drc_instruction_str[0].num_drc_ch_groups=2;
pstr_drc_config->str_drc_instruction_str[0].gain_set_index_for_channel_group[1]=1;
pstr_drc_config->str_drc_instruction_str[0].band_count_of_ch_group[0]=1;
pstr_drc_config->str_drc_instruction_str[0].band_count_of_ch_group[1]=1;
pstr_drc_config->str_drc_instruction_str[0].gain_interpolation_type_for_channel_group[0]=1;
pstr_drc_config->str_drc_instruction_str[0].gain_interpolation_type_for_channel_group[1]=1;
pstr_drc_config->str_drc_instruction_str[0].time_delta_min_for_channel_group[0]=32;
pstr_drc_config->str_drc_instruction_str[0].time_delta_min_for_channel_group[1]=32;
pstr_drc_config->str_drc_instruction_str[0].channel_group_of_ch[1]=1;
pstr_drc_config->str_drc_instruction_str[0].gain_element_count=2;
pstr_drc_config->sample_rate_present=0;
pstr_drc_config->sampling_rate=0;
pstr_drc_config->dwnmix_instructions_count=0;
pstr_drc_config->drc_coefficients_drc_count=1;
pstr_drc_config->drc_instructions_uni_drc_count=4;
pstr_drc_config->drc_instructions_count_plus=5;
pstr_drc_config->drc_description_basic_present=0;
pstr_drc_config->drc_coefficients_basic_count=0;
pstr_drc_config->drc_instructions_basic_count=0;
pstr_drc_config->drc_config_ext_present=1;
pstr_drc_config->apply_drc=0;
pstr_drc_config->str_drc_config_ext.drc_config_ext_type[0]=2;
pstr_drc_config->str_drc_config_ext.ext_bit_size[0]=345;
pstr_drc_config->str_drc_config_ext.parametric_drc_present=0;
pstr_drc_config->str_drc_config_ext.drc_extension_v1_present=1;
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].version=1;
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].drc_location=1;
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_count=4;
for(i=0;i<pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_count;i++)
{
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_params[i].gain_interpolation_type=1;
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_params[i].band_count=1;
}
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_sequence_count=4;
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_params_index_for_gain_sequence[0]=0;
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_params_index_for_gain_sequence[1]=1;
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_params_index_for_gain_sequence[2]=2;
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_params_index_for_gain_sequence[3]=3;
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_count_plus=4;
pstr_drc_config->str_drc_instruction_str[0].drc_set_id=1;
pstr_drc_config->str_drc_instruction_str[0].drc_set_complexity_level=2;
pstr_drc_config->str_drc_instruction_str[0].drc_location=1;
pstr_drc_config->str_drc_instruction_str[0].dwnmix_id_count=1;
pstr_drc_config->str_drc_instruction_str[0].drc_set_effect=1;
pstr_drc_config->str_drc_instruction_str[0].gain_set_index[1]=1;
pstr_drc_config->str_drc_instruction_str[0].drc_set_target_loudness_value_lower=-63;
pstr_drc_config->str_drc_instruction_str[0].num_drc_ch_groups=2;
pstr_drc_config->str_drc_instruction_str[0].gain_set_index_for_channel_group[1]=1;
pstr_drc_config->str_drc_instruction_str[0].band_count_of_ch_group[0]=1;
pstr_drc_config->str_drc_instruction_str[0].band_count_of_ch_group[1]=1;
pstr_drc_config->str_drc_instruction_str[0].gain_interpolation_type_for_channel_group[0]=1;
pstr_drc_config->str_drc_instruction_str[0].gain_interpolation_type_for_channel_group[1]=1;
pstr_drc_config->str_drc_instruction_str[0].time_delta_min_for_channel_group[0]=32;
pstr_drc_config->str_drc_instruction_str[0].time_delta_min_for_channel_group[1]=32;
pstr_drc_config->str_drc_instruction_str[0].channel_group_of_ch[1]=1;
pstr_drc_config->str_drc_instruction_str[0].gain_element_count=2;
pstr_drc_config->str_drc_instruction_str[1].drc_set_id=2;
pstr_drc_config->str_drc_instruction_str[1].drc_set_complexity_level=2;
pstr_drc_config->str_drc_instruction_str[1].drc_location=1;
pstr_drc_config->str_drc_instruction_str[1].dwnmix_id_count=1;
pstr_drc_config->str_drc_instruction_str[1].drc_set_effect=2;
pstr_drc_config->str_drc_instruction_str[1].gain_set_index[0]=1;
pstr_drc_config->str_drc_instruction_str[1].gain_set_index[1]=2;
pstr_drc_config->str_drc_instruction_str[1].drc_set_target_loudness_value_lower=-63;
pstr_drc_config->str_drc_instruction_str[1].num_drc_ch_groups=2;
pstr_drc_config->str_drc_instruction_str[1].gain_set_index_for_channel_group[0]=1;
pstr_drc_config->str_drc_instruction_str[1].gain_set_index_for_channel_group[1]=2;
pstr_drc_config->str_drc_instruction_str[1].band_count_of_ch_group[0]=1;
pstr_drc_config->str_drc_instruction_str[1].band_count_of_ch_group[1]=1;
pstr_drc_config->str_drc_instruction_str[1].gain_interpolation_type_for_channel_group[0]=1;
pstr_drc_config->str_drc_instruction_str[1].gain_interpolation_type_for_channel_group[1]=1;
pstr_drc_config->str_drc_instruction_str[1].time_delta_min_for_channel_group[0]=32;
pstr_drc_config->str_drc_instruction_str[1].time_delta_min_for_channel_group[1]=32;
pstr_drc_config->str_drc_instruction_str[1].channel_group_of_ch[1]=1;
pstr_drc_config->str_drc_instruction_str[1].gain_element_count=2;
pstr_drc_config->str_drc_instruction_str[2].drc_set_id=3;
pstr_drc_config->str_drc_instruction_str[2].drc_set_complexity_level=2;
pstr_drc_config->str_drc_instruction_str[2].drc_location=1;
pstr_drc_config->str_drc_instruction_str[2].dwnmix_id_count=1;
pstr_drc_config->str_drc_instruction_str[2].drc_set_effect=4;
pstr_drc_config->str_drc_instruction_str[2].gain_set_index[0]=2;
pstr_drc_config->str_drc_instruction_str[2].gain_set_index[1]=3;
pstr_drc_config->str_drc_instruction_str[2].drc_set_target_loudness_value_lower=-63;
pstr_drc_config->str_drc_instruction_str[2].num_drc_ch_groups=2;
pstr_drc_config->str_drc_instruction_str[2].gain_set_index_for_channel_group[0]=2;
pstr_drc_config->str_drc_instruction_str[2].gain_set_index_for_channel_group[1]=3;
pstr_drc_config->str_drc_instruction_str[2].band_count_of_ch_group[0]=1;
pstr_drc_config->str_drc_instruction_str[2].band_count_of_ch_group[1]=1;
pstr_drc_config->str_drc_instruction_str[2].gain_interpolation_type_for_channel_group[0]=1;
pstr_drc_config->str_drc_instruction_str[2].gain_interpolation_type_for_channel_group[1]=1;
pstr_drc_config->str_drc_instruction_str[2].time_delta_min_for_channel_group[0]=32;
pstr_drc_config->str_drc_instruction_str[2].time_delta_min_for_channel_group[1]=32;
pstr_drc_config->str_drc_instruction_str[2].channel_group_of_ch[1]=1;
pstr_drc_config->str_drc_instruction_str[2].gain_element_count=2;
pstr_drc_config->str_drc_instruction_str[3].drc_set_id=4;
pstr_drc_config->str_drc_instruction_str[3].drc_set_complexity_level=2;
pstr_drc_config->str_drc_instruction_str[3].drc_location=1;
pstr_drc_config->str_drc_instruction_str[3].dwnmix_id_count=1;
pstr_drc_config->str_drc_instruction_str[3].drc_set_effect=32;
pstr_drc_config->str_drc_instruction_str[3].gain_set_index[0]=3;
pstr_drc_config->str_drc_instruction_str[3].gain_set_index[1]=0;
pstr_drc_config->str_drc_instruction_str[3].drc_set_target_loudness_value_lower=-63;
pstr_drc_config->str_drc_instruction_str[3].num_drc_ch_groups=2;
pstr_drc_config->str_drc_instruction_str[3].gain_set_index_for_channel_group[0]=3;
pstr_drc_config->str_drc_instruction_str[3].gain_set_index_for_channel_group[1]=0;
pstr_drc_config->str_drc_instruction_str[3].band_count_of_ch_group[0]=1;
pstr_drc_config->str_drc_instruction_str[3].band_count_of_ch_group[1]=1;
pstr_drc_config->str_drc_instruction_str[3].gain_interpolation_type_for_channel_group[0]=1;
pstr_drc_config->str_drc_instruction_str[3].gain_interpolation_type_for_channel_group[1]=1;
pstr_drc_config->str_drc_instruction_str[3].time_delta_min_for_channel_group[0]=32;
pstr_drc_config->str_drc_instruction_str[3].time_delta_min_for_channel_group[1]=32;
pstr_drc_config->str_drc_instruction_str[3].channel_group_of_ch[1]=1;
pstr_drc_config->str_drc_instruction_str[3].gain_element_count=2;
pstr_drc_config->str_drc_instruction_str[4].drc_set_id=-1;
pstr_drc_config->str_drc_instruction_str[4].dwnmix_id_count=1;
pstr_drc_config->channel_layout.base_channel_count=2;
pstr_drc_config->str_drc_instruction_str[1].drc_set_id=2;
pstr_drc_config->str_drc_instruction_str[1].drc_set_complexity_level=2;
pstr_drc_config->str_drc_instruction_str[1].drc_location=1;
pstr_drc_config->str_drc_instruction_str[1].dwnmix_id_count=1;
pstr_drc_config->str_drc_instruction_str[1].drc_set_effect=2;
pstr_drc_config->str_drc_instruction_str[1].gain_set_index[0]=1;
pstr_drc_config->str_drc_instruction_str[1].gain_set_index[1]=2;
pstr_drc_config->str_drc_instruction_str[1].drc_set_target_loudness_value_lower=-63;
pstr_drc_config->str_drc_instruction_str[1].num_drc_ch_groups=2;
pstr_drc_config->str_drc_instruction_str[1].gain_set_index_for_channel_group[0]=1;
pstr_drc_config->str_drc_instruction_str[1].gain_set_index_for_channel_group[1]=2;
pstr_drc_config->str_drc_instruction_str[1].band_count_of_ch_group[0]=1;
pstr_drc_config->str_drc_instruction_str[1].band_count_of_ch_group[1]=1;
pstr_drc_config->str_drc_instruction_str[1].gain_interpolation_type_for_channel_group[0]=1;
pstr_drc_config->str_drc_instruction_str[1].gain_interpolation_type_for_channel_group[1]=1;
pstr_drc_config->str_drc_instruction_str[1].time_delta_min_for_channel_group[0]=32;
pstr_drc_config->str_drc_instruction_str[1].time_delta_min_for_channel_group[1]=32;
pstr_drc_config->str_drc_instruction_str[1].channel_group_of_ch[1]=1;
pstr_drc_config->str_drc_instruction_str[1].gain_element_count=2;
pstr_drc_config->str_drc_instruction_str[2].drc_set_id=3;
pstr_drc_config->str_drc_instruction_str[2].drc_set_complexity_level=2;
pstr_drc_config->str_drc_instruction_str[2].drc_location=1;
pstr_drc_config->str_drc_instruction_str[2].dwnmix_id_count=1;
pstr_drc_config->str_drc_instruction_str[2].drc_set_effect=4;
pstr_drc_config->str_drc_instruction_str[2].gain_set_index[0]=2;
pstr_drc_config->str_drc_instruction_str[2].gain_set_index[1]=3;
pstr_drc_config->str_drc_instruction_str[2].drc_set_target_loudness_value_lower=-63;
pstr_drc_config->str_drc_instruction_str[2].num_drc_ch_groups=2;
pstr_drc_config->str_drc_instruction_str[2].gain_set_index_for_channel_group[0]=2;
pstr_drc_config->str_drc_instruction_str[2].gain_set_index_for_channel_group[1]=3;
pstr_drc_config->str_drc_instruction_str[2].band_count_of_ch_group[0]=1;
pstr_drc_config->str_drc_instruction_str[2].band_count_of_ch_group[1]=1;
pstr_drc_config->str_drc_instruction_str[2].gain_interpolation_type_for_channel_group[0]=1;
pstr_drc_config->str_drc_instruction_str[2].gain_interpolation_type_for_channel_group[1]=1;
pstr_drc_config->str_drc_instruction_str[2].time_delta_min_for_channel_group[0]=32;
pstr_drc_config->str_drc_instruction_str[2].time_delta_min_for_channel_group[1]=32;
pstr_drc_config->str_drc_instruction_str[2].channel_group_of_ch[1]=1;
pstr_drc_config->str_drc_instruction_str[2].gain_element_count=2;
pstr_drc_config->str_drc_instruction_str[3].drc_set_id=4;
pstr_drc_config->str_drc_instruction_str[3].drc_set_complexity_level=2;
pstr_drc_config->str_drc_instruction_str[3].drc_location=1;
pstr_drc_config->str_drc_instruction_str[3].dwnmix_id_count=1;
pstr_drc_config->str_drc_instruction_str[3].drc_set_effect=32;
pstr_drc_config->str_drc_instruction_str[3].gain_set_index[0]=3;
pstr_drc_config->str_drc_instruction_str[3].gain_set_index[1]=0;
pstr_drc_config->str_drc_instruction_str[3].drc_set_target_loudness_value_lower=-63;
pstr_drc_config->str_drc_instruction_str[3].num_drc_ch_groups=2;
pstr_drc_config->str_drc_instruction_str[3].gain_set_index_for_channel_group[0]=3;
pstr_drc_config->str_drc_instruction_str[3].gain_set_index_for_channel_group[1]=0;
pstr_drc_config->str_drc_instruction_str[3].band_count_of_ch_group[0]=1;
pstr_drc_config->str_drc_instruction_str[3].band_count_of_ch_group[1]=1;
pstr_drc_config->str_drc_instruction_str[3].gain_interpolation_type_for_channel_group[0]=1;
pstr_drc_config->str_drc_instruction_str[3].gain_interpolation_type_for_channel_group[1]=1;
pstr_drc_config->str_drc_instruction_str[3].time_delta_min_for_channel_group[0]=32;
pstr_drc_config->str_drc_instruction_str[3].time_delta_min_for_channel_group[1]=32;
pstr_drc_config->str_drc_instruction_str[3].channel_group_of_ch[1]=1;
pstr_drc_config->str_drc_instruction_str[3].gain_element_count=2;
pstr_drc_config->str_drc_instruction_str[4].drc_set_id=-1;
pstr_drc_config->str_drc_instruction_str[4].dwnmix_id_count=1;
pstr_drc_config->channel_layout.base_channel_count=2;
return IA_NO_ERROR;
}
@ -251,61 +257,61 @@ IA_ERRORCODE impd_drc_set_default_bitstream_config(ia_drc_config *pstr_drc_confi
IA_ERRORCODE impd_drc_set_struct_pointer(ia_drc_api_struct *p_obj_drc)
{
SIZE_T persistant_ptr = (SIZE_T)p_obj_drc->p_state->persistant_ptr;
p_obj_drc->str_payload.pstr_bitstream_dec = (ia_drc_bits_dec_struct*)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_bits_dec_struct)+32;
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_bits_dec_struct)+32;
p_obj_drc->str_payload.pstr_gain_dec[0] = (ia_drc_gain_dec_struct*)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_gain_dec_struct)+32;
p_obj_drc->str_payload.pstr_gain_dec[1] = (ia_drc_gain_dec_struct*)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_gain_dec_struct)+32;
p_obj_drc->str_payload.pstr_loudness_info = (ia_drc_loudness_info_set_struct*)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_loudness_info_set_struct)+32;
p_obj_drc->str_payload.pstr_drc_gain = (ia_drc_gain_struct*)persistant_ptr;;
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_gain_struct)+32;
p_obj_drc->str_payload.pstr_drc_interface = (ia_drc_interface_struct*)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_interface_struct)+32;
p_obj_drc->str_payload.pstr_drc_config = (ia_drc_config*)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_config)+32;
p_obj_drc->str_payload.pstr_selection_proc = (ia_drc_sel_pro_struct*)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_sel_pro_struct)+32;
p_obj_drc->str_bit_handler.it_bit_buf = (UWORD8*)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + 32*1024; /*varify the sizelater*/
p_obj_drc->str_payload.pstr_drc_sel_proc_params = (ia_drc_sel_proc_params_struct*)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_sel_proc_params_struct);
p_obj_drc->str_payload.pstr_drc_sel_proc_output = (ia_drc_sel_proc_output_struct*)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_sel_proc_output_struct)+16*1024;
p_obj_drc->str_bit_handler.bitstream_drc_config = (UWORD8*)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + 8*1024;
p_obj_drc->str_bit_handler.bitstream_loudness_info = (UWORD8*)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + 8*1024;
p_obj_drc->str_bit_handler.bitstream_unidrc_interface = (UWORD8*)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + 8*1024;
p_obj_drc->str_payload.pstr_peak_limiter = (ia_drc_peak_limiter_struct*)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_peak_limiter_struct)+32;
p_obj_drc->str_payload.pstr_peak_limiter->buffer = (FLOAT32*)((SIZE_T) p_obj_drc->str_payload.pstr_peak_limiter+sizeof(ia_drc_peak_limiter_struct)+32);
p_obj_drc->str_payload.pstr_peak_limiter->buffer = (FLOAT32*)((SIZE_T) p_obj_drc->str_payload.pstr_peak_limiter+sizeof(ia_drc_peak_limiter_struct)+32);
persistant_ptr = (SIZE_T)persistant_ptr + 16*1024;
p_obj_drc->str_payload.pstr_qmf_filter = (ia_drc_qmf_filt_struct*)persistant_ptr;
p_obj_drc->str_payload.pstr_qmf_filter = (ia_drc_qmf_filt_struct*)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_qmf_filt_struct)+32;
p_obj_drc->str_payload.pstr_qmf_filter->ana_buff = (FLOAT64*)persistant_ptr;
p_obj_drc->str_payload.pstr_qmf_filter->ana_buff = (FLOAT64*)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + 16*1024;
p_obj_drc->str_payload.pstr_qmf_filter->syn_buff = (FLOAT64*)persistant_ptr;
persistant_ptr = (SIZE_T)persistant_ptr + 16*1024;
@ -320,16 +326,16 @@ VOID init_qmf_filt_bank(ia_drc_qmf_filt_struct *qmf_filt)
FLOAT64 gain_ana =64.0 / QMF_FILT_RESOLUTION;
FLOAT64 gain_syn =1.0 / 64.0;
for ( l=0; l<2*QMF_FILT_RESOLUTION; l++ )
for ( l=0; l<2*QMF_FILT_RESOLUTION; l++ )
{
for ( k=0; k<QMF_FILT_RESOLUTION; k++ )
for ( k=0; k<QMF_FILT_RESOLUTION; k++ )
{
qmf_filt->syn_tab_real[l][k] = gain_syn * cos((0.0245436926) * (k+0.5) * (2*l-255.0));
qmf_filt->syn_tab_imag[l][k] = gain_syn * sin((0.0245436926) * (k+0.5) * (2*l-255.0));
qmf_filt->ana_tab_real[k][l] = gain_ana * cos((0.0245436926) * (k+0.5) * (2*l-1.0));
qmf_filt->ana_tab_imag[k][l] = gain_ana * sin((0.0245436926) * (k+0.5) * (2*l-1.0));
qmf_filt->ana_tab_imag[k][l] = gain_ana * sin((0.0245436926) * (k+0.5) * (2*l-1.0));
}
}
}
}
@ -341,127 +347,130 @@ IA_ERRORCODE impd_drc_init(ia_drc_api_struct *p_obj_drc){
IA_ERRORCODE err_code = IA_NO_ERROR;
WORD32 i,j;
pVOID persistant_ptr =p_obj_drc->p_state->persistant_ptr;
pVOID persistant_ptr =p_obj_drc->p_state->persistant_ptr;
struct ia_bit_buf_struct *it_bit_buff;
struct ia_bit_buf_struct *it_bit_buff;
WORD32 decDownmixIdList[NUM_GAIN_DEC_INSTANCES] = { 0, 4 };
p_obj_drc->p_state->delay_in_output =0;
p_obj_drc->p_state->delay_in_output =0;
p_obj_drc->str_payload.pstr_selection_proc->first_frame=1;
p_obj_drc->pstr_bit_buf = impd_create_init_bit_buf(&p_obj_drc->str_bit_buf, p_obj_drc->str_bit_handler.it_bit_buf, p_obj_drc->str_bit_handler.num_bytes_bs/8);
it_bit_buff = p_obj_drc->pstr_bit_buf;
err_code = impd_init_drc_bitstream_dec(p_obj_drc->str_payload.pstr_bitstream_dec,
p_obj_drc->str_config.sampling_rate,
p_obj_drc->str_config.frame_size,
p_obj_drc->str_config.delay_mode,
-1,
p_obj_drc->pstr_bit_buf = impd_create_init_bit_buf(&p_obj_drc->str_bit_buf, p_obj_drc->str_bit_handler.it_bit_buf, p_obj_drc->str_bit_handler.num_bytes_bs/8);
it_bit_buff = p_obj_drc->pstr_bit_buf;
err_code = impd_init_drc_bitstream_dec(p_obj_drc->str_payload.pstr_bitstream_dec,
p_obj_drc->str_config.sampling_rate,
p_obj_drc->str_config.frame_size,
p_obj_drc->str_config.delay_mode,
-1,
0);
for (i=0; i<NUM_GAIN_DEC_INSTANCES; i++) {
for (i=0; i<NUM_GAIN_DEC_INSTANCES; i++) {
err_code = impd_init_drc_decode(p_obj_drc->str_config.frame_size,
p_obj_drc->str_config.sampling_rate,
p_obj_drc->str_config.gain_delay_samples,
p_obj_drc->str_config.delay_mode,
p_obj_drc->str_config.sub_band_domain_mode,
p_obj_drc->str_payload.pstr_gain_dec[i]);
}
}
if (p_obj_drc->str_config.interface_bitstream_present) {
err_code = impd_drc_dec_interface_process(
p_obj_drc->pstr_bit_buf,
p_obj_drc->str_payload.pstr_drc_interface,
p_obj_drc->str_bit_handler.bitstream_unidrc_interface,
p_obj_drc->str_bit_handler.num_bytes_bs_unidrc_interface*8,
&p_obj_drc->str_bit_handler.num_bits_read_bs_unidrc_interface);
if (err_code!=IA_NO_ERROR)
err_code = impd_drc_dec_interface_add_effect_type(p_obj_drc->str_payload.pstr_drc_interface,
p_obj_drc->str_config.effect_type,
p_obj_drc->str_config.target_loudness,
p_obj_drc->str_config.loud_norm_flag);
if (err_code!=IA_NO_ERROR)
return err_code;
err_code = impd_drc_uni_selction_proc_init(p_obj_drc->str_payload.pstr_selection_proc,
0,
p_obj_drc->str_payload.pstr_drc_interface,
err_code = impd_drc_uni_selction_proc_init(p_obj_drc->str_payload.pstr_selection_proc,
0,
p_obj_drc->str_payload.pstr_drc_interface,
p_obj_drc->str_config.sub_band_domain_mode);
if (err_code!=IA_NO_ERROR)
if (err_code!=IA_NO_ERROR)
return err_code;
if (p_obj_drc->str_payload.pstr_drc_interface->loudness_norm_parameter_interface_flag && p_obj_drc->str_payload.pstr_drc_interface->loudness_norm_param_interface.peak_limiter) {
p_obj_drc->str_config.peak_limiter = 1;
}
}
else {
else {
err_code = impd_set_default_params_selection_process(p_obj_drc->str_payload.pstr_drc_sel_proc_params);
if (err_code!=IA_NO_ERROR)
if (err_code!=IA_NO_ERROR)
return err_code;
err_code = impd_set_custom_params(p_obj_drc->str_config.control_parameter_index,p_obj_drc->str_payload.pstr_drc_sel_proc_params);
if (err_code!=IA_NO_ERROR)
if (err_code!=IA_NO_ERROR)
return err_code;
err_code = impd_eval_custom_params_selection_process(p_obj_drc->str_payload.pstr_drc_sel_proc_params);
if (err_code!=IA_NO_ERROR)
if (err_code!=IA_NO_ERROR)
return err_code;
err_code = impd_drc_uni_selction_proc_init(p_obj_drc->str_payload.pstr_selection_proc, p_obj_drc->str_payload.pstr_drc_sel_proc_params, 0, p_obj_drc->str_config.sub_band_domain_mode);
if (err_code!=IA_NO_ERROR)
if (err_code!=IA_NO_ERROR)
return err_code;
if (p_obj_drc->str_payload.pstr_drc_sel_proc_params->peak_limiter) {
p_obj_drc->str_config.peak_limiter = 1;
}
}
p_obj_drc->str_payload.pstr_loudness_info->loudness_info_album_count=0;
p_obj_drc->str_payload.pstr_loudness_info->loudness_info_count=0;
}
}
p_obj_drc->str_payload.pstr_loudness_info->loudness_info_album_count=0;
p_obj_drc->str_payload.pstr_loudness_info->loudness_info_count=0;
p_obj_drc->str_payload.pstr_loudness_info->loudness_info_set_ext_present=0;
p_obj_drc->p_state->ui_exe_done =0;
if(p_obj_drc->str_config.bitstream_file_format == BITSTREAM_FILE_FORMAT_SPLIT) {
err_code = impd_process_drc_bitstream_dec_config(p_obj_drc->str_payload.pstr_bitstream_dec,
p_obj_drc->pstr_bit_buf,
p_obj_drc->pstr_bit_buf,
p_obj_drc->str_payload.pstr_drc_config,
&p_obj_drc->str_bit_handler.bitstream_drc_config[0],
p_obj_drc->str_bit_handler.num_bytes_bs_drc_config);
if(err_code==1)
{
err_code=impd_drc_set_default_bitstream_config(p_obj_drc->str_payload.pstr_drc_config);
}
if(err_code==1)
{
err_code=impd_drc_set_default_bitstream_config(p_obj_drc->str_payload.pstr_drc_config);
p_obj_drc->str_payload.pstr_drc_config->channel_layout.base_channel_count =
p_obj_drc->str_config.num_ch_in;
}
if (err_code!=IA_NO_ERROR)
if (err_code!=IA_NO_ERROR)
return err_code;
err_code = impd_process_drc_bitstream_dec_loudness_info_set(p_obj_drc->pstr_bit_buf,
p_obj_drc->str_payload.pstr_loudness_info,
p_obj_drc->str_payload.pstr_loudness_info,
&p_obj_drc->str_bit_handler.bitstream_loudness_info[0],
p_obj_drc->str_bit_handler.num_bytes_bs_loudness_info
p_obj_drc->str_bit_handler.num_bytes_bs_loudness_info
);
if (err_code!=IA_NO_ERROR)
if (err_code!=IA_NO_ERROR)
return err_code;
}
else {
err_code = impd_process_drc_bitstream_dec(p_obj_drc->str_payload.pstr_bitstream_dec,
p_obj_drc->pstr_bit_buf,
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)
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;
@ -473,7 +482,7 @@ IA_ERRORCODE impd_drc_init(ia_drc_api_struct *p_obj_drc){
p_obj_drc->str_payload.pstr_drc_config,
p_obj_drc->str_payload.pstr_loudness_info,
p_obj_drc->str_payload.pstr_drc_sel_proc_output);
if (err_code!=IA_NO_ERROR)
if (err_code!=IA_NO_ERROR)
return err_code;
for (i=0; i<NUM_GAIN_DEC_INSTANCES; i++){
@ -492,15 +501,15 @@ IA_ERRORCODE impd_drc_init(ia_drc_api_struct *p_obj_drc){
if (i==0)
{
if (p_obj_drc->str_config.num_ch_in != p_obj_drc->str_payload.pstr_drc_sel_proc_output->base_channel_count)
return -1;
audio_num_chan = p_obj_drc->str_config.num_ch_in;
} else if (i==1)
} else if (i==1)
{
p_obj_drc->str_config.num_ch_out = p_obj_drc->str_payload.pstr_drc_sel_proc_output->target_channel_count;
audio_num_chan = p_obj_drc->str_config.num_ch_out;
}
err_code = impd_init_drc_decode_post_config(audio_num_chan,
matchingDrcSetIds,
matchingDownmixIds,
@ -510,9 +519,9 @@ IA_ERRORCODE impd_drc_init(ia_drc_api_struct *p_obj_drc){
, p_obj_drc->str_payload.pstr_gain_dec[i]
, p_obj_drc->str_payload.pstr_drc_config
, p_obj_drc->str_payload.pstr_loudness_info
, &persistant_ptr
, &persistant_ptr
);
impd_get_parametric_drc_delay(p_obj_drc->str_payload.pstr_gain_dec[i], p_obj_drc->str_payload.pstr_drc_config, & p_obj_drc->str_config.parametric_drc_delay_gain_dec_instance, &p_obj_drc->str_config.parametric_drc_delay_max);
impd_get_eq_delay(p_obj_drc->str_payload.pstr_gain_dec[i], p_obj_drc->str_payload.pstr_drc_config, & p_obj_drc->str_config.eq_delay_gain_dec_instance, & p_obj_drc->str_config.eq_delay_max);
p_obj_drc->str_config.parametric_drc_delay += p_obj_drc->str_config.parametric_drc_delay_gain_dec_instance;
@ -527,42 +536,42 @@ IA_ERRORCODE impd_drc_init(ia_drc_api_struct *p_obj_drc){
if (p_obj_drc->str_config.eq_delay_max == -1) {
p_obj_drc->str_config.eq_delay_max = EQ_DELAY_MAX_DEFAULT;
}
if (!p_obj_drc->str_config.constant_delay_on) {
p_obj_drc->p_state->delay_in_output += p_obj_drc->str_config.parametric_drc_delay + p_obj_drc->str_config.eq_delay + p_obj_drc->str_config.audio_delay_samples;
p_obj_drc->str_config.delay_line_samples = p_obj_drc->str_config.audio_delay_samples;
if (!p_obj_drc->str_config.absorb_delay_on) {
p_obj_drc->p_state->delay_in_output = 0;
}
} else {
p_obj_drc->p_state->delay_in_output += p_obj_drc->str_config.parametric_drc_delay_max + p_obj_drc->str_config.eq_delay_max + p_obj_drc->str_config.audio_delay_samples;
p_obj_drc->str_config.delay_line_samples = p_obj_drc->p_state->delay_in_output - p_obj_drc->str_config.parametric_drc_delay + p_obj_drc->str_config.eq_delay;
if (!p_obj_drc->str_config.absorb_delay_on ) {
p_obj_drc->p_state->delay_in_output = 0;
}
}
}
if(p_obj_drc->str_config.dec_type==1)
if(p_obj_drc->str_config.dec_type==1)
{
init_qmf_filt_bank(p_obj_drc->str_payload.pstr_qmf_filter);
init_qmf_filt_bank(p_obj_drc->str_payload.pstr_qmf_filter);
}
if (p_obj_drc->str_config.peak_limiter)
{
impd_peak_limiter_init(p_obj_drc->str_payload.pstr_peak_limiter,
DEFAULT_ATTACK_TIME_MS,
DEFAULT_ATTACK_TIME_MS,
DEFAULT_RELEASE_TIME_MS,
LIM_DEFAULT_THRESHOLD,
p_obj_drc->str_config.num_ch_out,
p_obj_drc->str_config.sampling_rate,
p_obj_drc->str_payload.pstr_peak_limiter->buffer);
p_obj_drc->str_payload.pstr_peak_limiter->buffer);
}
return IA_NO_ERROR;
return IA_NO_ERROR;
}

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_INTERFACE_H
#define IMPD_DRC_INTERFACE_H
@ -76,7 +76,7 @@ typedef struct {
WORD32 album_mode;
WORD32 peak_limiter;
WORD32 change_loudness_deviation_max;
WORD32 loudness_deviation_max;
WORD32 loudness_deviation_max;
WORD32 change_loudness_measur_method;
WORD32 loudness_measurement_method;
WORD32 change_loudness_measur_system;

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
@ -31,27 +31,138 @@
WORD32
impd_drc_dec_interface_process(
ia_bit_buf_struct* it_bit_buff,
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);
it_bit_buff = impd_create_init_bit_buf(it_bit_buff, it_bit_buf, num_bit_stream_bits/8);
} else {
return -1;
}
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;
}
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;
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;
}
else
{
return UNEXPECTED_ERROR;
}
return err;
}

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <stdio.h>
#include <string.h>
#include <math.h>
@ -32,61 +32,61 @@ 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 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;
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);
}
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;
system_interface->target_config_request_type = impd_read_bits_buf(it_bit_buff, 2);
if(it_bit_buff->error)
return it_bit_buff->error;
//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;
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;
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;
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;
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;
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:
@ -100,16 +100,16 @@ 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;
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;
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);
@ -119,93 +119,93 @@ 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;
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->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;
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->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;
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->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;
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->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;
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;
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;
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;
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;
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;
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;
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;
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);
}
@ -213,50 +213,50 @@ 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;
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;
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;
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;
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;
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;
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;
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;
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;
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)
@ -266,9 +266,9 @@ WORD32 impd_drc_interface_read(ia_bit_buf_struct* it_bit_buff,
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;
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)
@ -277,9 +277,9 @@ WORD32 impd_drc_interface_read(ia_bit_buf_struct* it_bit_buff,
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;
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)
@ -291,9 +291,9 @@ WORD32 impd_drc_interface_read(ia_bit_buf_struct* it_bit_buff,
}
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;
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);
@ -308,45 +308,45 @@ 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;
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;
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;
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;
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;
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;
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);
}
@ -356,31 +356,31 @@ static WORD32 impd_parse_loud_eq_param_interface(ia_bit_buf_struct* it_bit_buff,
{
//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;
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->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;
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;
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;
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;
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);
@ -394,58 +394,58 @@ impd_unidrc_interface_extension_read(ia_bit_buf_struct* it_bit_buff,
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;
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;
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;
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;
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;
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;
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;
}
i++;
if (i==EXT_COUNT_MAX)
{
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;
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);
@ -454,62 +454,62 @@ WORD32 impd_unidrc_interface_read(ia_bit_buf_struct* it_bit_buff,
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;
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;
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;
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;
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;
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;
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;
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);
}

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
@ -36,25 +36,25 @@
WORD32 impd_parametric_drc_instance_reset(WORD32 instance_idx,
ia_parametric_drc_instance_params_struct* pstr_parametric_drc_instance_params)
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)
{
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);
}
else
{
return (UNEXPECTED_ERROR);
if (err)
return (err);
}
else
{
return (UNEXPECTED_ERROR);
}
return 0;
}
@ -70,10 +70,10 @@ WORD32 impd_add_drc_band_audio(ia_drc_instructions_struct* pstr_drc_instruction_
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;
if (drc_instructions_index >= 0) {
str_drc_instruction_str = &(pstr_drc_instruction_arr[drc_instructions_index]);
} else {

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <stdio.h>
#include <math.h>
@ -55,7 +55,7 @@ WORD32 impd_signal_peak_level_info(ia_drc_config* pstr_drc_config,
eq_set_id[0] = 0;
signal_peak_level[0] = 0.0f;
explicit_peak_information_present[0] = 0;
k=0;
if (drc_set_id_requested < 0)
{
@ -70,7 +70,7 @@ WORD32 impd_signal_peak_level_info(ia_drc_config* pstr_drc_config,
signal_peak_level[k] = 0.0f;
explicit_peak_information_present[k] = 0;
k++;
pre_lim_count = k;
if (drc_set_id_requested < 0)
@ -92,7 +92,7 @@ WORD32 impd_signal_peak_level_info(ia_drc_config* pstr_drc_config,
mode = 0;
loudness_info_count = pstr_loudness_info->loudness_info_count;
}
for (n=0; n<loudness_info_count; n++)
{
if (mode == 1)
@ -175,7 +175,7 @@ WORD32 impd_signal_peak_level_info(ia_drc_config* pstr_drc_config,
}
}
if (match_found_flag == 0) {
for (i=0; i<str_drc_instruction_str->dwnmix_id_count; i++)
for (i=0; i<str_drc_instruction_str->dwnmix_id_count; i++)
{
if (requested_dwnmix_id == str_drc_instruction_str->downmix_id[0] || ID_FOR_ANY_DOWNMIX == str_drc_instruction_str->downmix_id[0])
{
@ -200,7 +200,7 @@ WORD32 impd_signal_peak_level_info(ia_drc_config* pstr_drc_config,
}
}
}
else
else
{
eq_set_id[peak_count] = 0;
@ -335,7 +335,7 @@ WORD32 impd_signal_peak_level_info(ia_drc_config* pstr_drc_config,
}
}
}
if (match_found_flag == 0) {
if (match_found_flag == 0) {
ia_drc_instructions_struct* drc_instructions_drc_tmp;
for (n=0; n<pstr_drc_config->drc_instructions_count_plus; n++) {
drc_instructions_drc_tmp = &pstr_drc_config->str_drc_instruction_str[n];
@ -343,7 +343,7 @@ WORD32 impd_signal_peak_level_info(ia_drc_config* pstr_drc_config,
for (k=0; k<drc_instructions_drc_tmp->dwnmix_id_count; k++) {
if (ID_FOR_BASE_LAYOUT == drc_instructions_drc_tmp->downmix_id[k]) {
if (drc_instructions_drc_tmp->limiter_peak_target_present) {
eq_set_id[peak_count] = -1;
eq_set_id[peak_count] = -1;
signal_peak_level[peak_count] = drc_instructions_drc_tmp->limiter_peak_target + signal_peak_level_tmp;
explicit_peak_information_present[peak_count] = 0;
match_found_flag = 1;
@ -369,7 +369,7 @@ WORD32 impd_signal_peak_level_info(ia_drc_config* pstr_drc_config,
}
WORD32
impd_extract_loudness_peak_to_average_info(ia_loudness_info_struct* loudness_info,
WORD32 dyn_range_measurement_type,
@ -409,7 +409,7 @@ impd_extract_loudness_peak_to_average_info(ia_loudness_info_struct* loudness_inf
}
}
break;
case MOMENTARY_LOUDNESS_TO_AVG:
if (loudness_measure->method_def == METHOD_DEFINITION_MOMENTARY_LOUDNESS_MAX)
{
@ -421,7 +421,7 @@ impd_extract_loudness_peak_to_average_info(ia_loudness_info_struct* loudness_inf
}
}
break;
case TOP_OF_LOUDNESS_RANGE_TO_AVG:
if (loudness_measure->method_def == METHOD_DEFINITION_MAX_OF_LOUDNESS_RANGE)
{
@ -433,10 +433,10 @@ impd_extract_loudness_peak_to_average_info(ia_loudness_info_struct* loudness_inf
}
}
break;
default:
return (UNEXPECTED_ERROR);
break;
}
}
@ -459,7 +459,7 @@ WORD32 impd_loudness_peak_to_average_info(
{
WORD32 n, err;
WORD32 drc_set_id = max(0,str_drc_instruction_str->drc_set_id);
*loudness_peak_2_avg_value_present = 0;
if (album_mode == 1)
@ -510,7 +510,7 @@ WORD32 impd_overall_loudness_present( ia_loudness_info_struct* loudness_info,
WORD32* loudness_info_present)
{
WORD32 m;
*loudness_info_present = 0;
for (m=0; m<loudness_info->measurement_count; m++)
{
@ -539,8 +539,8 @@ WORD32 impd_check_loud_info(WORD32 loudness_info_count,
if (drc_set_id_requested == loudness_info[n].drc_set_id)
{
err = impd_overall_loudness_present(&(loudness_info[n]), &loudness_info_present);
if (err)
return (err);
if (err)
return (err);
if (loudness_info_present)
{
loudness_info_matching[*info_count] = &(loudness_info[n]);
@ -548,9 +548,9 @@ WORD32 impd_check_loud_info(WORD32 loudness_info_count,
}
}
}
}
return (0);
}
return (0);
}
WORD32 impd_check_loud_payload(WORD32 loudness_info_count,
@ -561,9 +561,9 @@ WORD32 impd_check_loud_payload(WORD32 loudness_info_count,
ia_loudness_info_struct* loudness_info_matching[])
{
WORD32 err = 0;
err = impd_check_loud_info(loudness_info_count, loudness_info, requested_dwnmix_id, drc_set_id_requested, info_count, loudness_info_matching);
if (err || *info_count) goto matchEnd;
if (err || *info_count) goto matchEnd;
err = impd_check_loud_info(loudness_info_count, loudness_info, ID_FOR_ANY_DOWNMIX, drc_set_id_requested, info_count, loudness_info_matching); if (err || *info_count) goto matchEnd;
err = impd_check_loud_info(loudness_info_count, loudness_info, requested_dwnmix_id, ID_FOR_ANY_DRC, info_count, loudness_info_matching); if (err || *info_count) goto matchEnd;
err = impd_check_loud_info(loudness_info_count, loudness_info, requested_dwnmix_id, ID_FOR_NO_DRC, info_count, loudness_info_matching); if (err || *info_count) goto matchEnd;
@ -587,7 +587,7 @@ WORD32 impd_find_overall_loudness_info(ia_drc_sel_proc_params_struct* pstr_drc_s
{
WORD32 err;
WORD32 loudness_drc_set_id_requested;
*info_count = 0;
if (drc_set_id_requested < 0)
{
@ -606,7 +606,7 @@ WORD32 impd_find_overall_loudness_info(ia_drc_sel_proc_params_struct* pstr_drc_s
info_count,
loudness_info_matching);
if (err) return (err);
}
if (*info_count == 0)
{
@ -630,7 +630,7 @@ impd_high_pass_loudness_adjust_info( ia_loudness_info_struct* loudness_info,
FLOAT32* loudness_hp_adjust)
{
WORD32 m, k;
*loudness_hp_adjust_present = 0;
*loudness_hp_adjust = 0.0f;
for (m=0; m<loudness_info->measurement_count; m++)
@ -664,7 +664,7 @@ WORD32 impd_find_high_pass_loudness_adjust(
{
WORD32 n, err;
WORD32 loudness_drc_set_id_requested;
if (drc_set_id_requested < 0)
{
loudness_drc_set_id_requested = 0;
@ -673,9 +673,9 @@ WORD32 impd_find_high_pass_loudness_adjust(
{
loudness_drc_set_id_requested = drc_set_id_requested;
}
*loudness_hp_adjust_present = 0;
if (album_mode == 1)
{
for (n=0; n<pstr_loudness_info->loudness_info_album_count; n++)
@ -742,7 +742,7 @@ WORD32 impd_find_high_pass_loudness_adjust(
}
return(0);
}
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,
@ -759,7 +759,7 @@ WORD32 impd_init_loudness_control (ia_drc_sel_proc_params_struct* pstr_drc_sel_p
WORD32 loudness_hp_adjust_present;
WORD32 overall_loudness_info_present;
FLOAT32 pre_proc_adjust;
k=0;
if (drc_set_id_requested < 0)
{
@ -774,7 +774,7 @@ WORD32 impd_init_loudness_control (ia_drc_sel_proc_params_struct* pstr_drc_sel_p
loudness[k] = UNDEFINED_LOUDNESS_VALUE;
loudness_normalization_gain_db[k] = 0.0f;
k++;
pre_lim_count = k;
if (pstr_drc_sel_proc_params_struct->loudness_normalization_on == 1)
@ -789,19 +789,19 @@ WORD32 impd_init_loudness_control (ia_drc_sel_proc_params_struct* pstr_drc_sel_p
&info_count,
loudness_info);
if (err) return (err);
if (overall_loudness_info_present == 1)
{
WORD32 requested_method_definition = METHOD_DEFINITION_PROGRAM_LOUDNESS;
WORD32 other_method_definition = METHOD_DEFINITION_PROGRAM_LOUDNESS;
WORD32 requested_measurement_system = MEASUREMENT_SYSTEM_BS_1770_4;
WORD32 requested_preprocessing = 0;
WORD32 requested_preprocessing = 0;
WORD32* system_bonus = measurement_system_default_tbl;
WORD32 match_measure;
FLOAT32 method_val = 0;
switch (pstr_drc_sel_proc_params_struct->loudness_measurement_method) {
case USER_METHOD_DEFINITION_DEFAULT:
case USER_METHOD_DEFINITION_PROGRAM_LOUDNESS:
@ -812,12 +812,12 @@ WORD32 impd_init_loudness_control (ia_drc_sel_proc_params_struct* pstr_drc_sel_p
requested_method_definition = METHOD_DEFINITION_ANCHOR_LOUDNESS;
other_method_definition = METHOD_DEFINITION_PROGRAM_LOUDNESS;
break;
default:
return (UNEXPECTED_ERROR);
break;
}
switch (pstr_drc_sel_proc_params_struct->loudness_measurement_system) {
case USER_MEASUREMENT_SYSTEM_DEFAULT:
case USER_MEASUREMENT_SYSTEM_BS_1770_4:
@ -852,12 +852,12 @@ WORD32 impd_init_loudness_control (ia_drc_sel_proc_params_struct* pstr_drc_sel_p
requested_measurement_system = USER_MEASUREMENT_SYSTEM_RESERVED_E;
system_bonus = measurement_system_rms_e_tbl;
break;
default:
return (UNEXPECTED_ERROR);
break;
}
switch (pstr_drc_sel_proc_params_struct->loudness_measurement_pre_proc) {
case USER_LOUDNESS_PREPROCESSING_DEFAULT:
case USER_LOUDNESS_PREPROCESSING_OFF:
@ -866,12 +866,12 @@ WORD32 impd_init_loudness_control (ia_drc_sel_proc_params_struct* pstr_drc_sel_p
case USER_LOUDNESS_PREPROCESSING_HIGHPASS:
requested_preprocessing = 1;
break;
default:
return (UNEXPECTED_ERROR);
break;
}
for (k=0; k<info_count; k++)
{
match_measure = -1;
@ -884,7 +884,7 @@ WORD32 impd_init_loudness_control (ia_drc_sel_proc_params_struct* pstr_drc_sel_p
match_measure = system_bonus[loudness_measure->measurement_system];
}
}
if (match_measure == -1)
if (match_measure == -1)
{
for (n=0; n<loudness_info[k]->measurement_count; n++)
{
@ -896,13 +896,13 @@ WORD32 impd_init_loudness_control (ia_drc_sel_proc_params_struct* pstr_drc_sel_p
}
}
}
if (requested_preprocessing == 1)
{
err = impd_find_high_pass_loudness_adjust(pstr_loudness_info, requested_dwnmix_id, drc_set_id_requested, pstr_drc_sel_proc_params_struct->album_mode, (FLOAT32)pstr_drc_sel_proc_params_struct->device_cut_off_frequency,
&loudness_hp_adjust_present, &pre_proc_adjust);
if (err) return (err);
if (loudness_hp_adjust_present == 0)
{
pre_proc_adjust = -2.0f;
@ -943,7 +943,7 @@ impd_mixing_level_info(ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_s
WORD32 album_mode = pstr_drc_sel_proc_params_struct->album_mode;
WORD32 loudness_drc_set_id_requested;
ia_loudness_info_struct* loudness_info;
*mixing_level = MIXING_LEVEL_DEFAULT;
if (drc_set_id_requested < 0)
{

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_LOUDNESS_CONTROL_H
#define IMPD_DRC_LOUDNESS_CONTROL_H

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <math.h>
#include "impd_type_def.h"
#include "impd_memory_standards.h"
@ -47,25 +47,25 @@ static WORD32 impd_down_mix ( ia_drc_sel_proc_output_struct *uni_drc_sel_proc_ou
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;
return 0;
if (input_audio == 0)
return 0;
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++)
{
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++)
{
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];
}
}
@ -76,8 +76,8 @@ static WORD32 impd_down_mix ( ia_drc_sel_proc_output_struct *uni_drc_sel_proc_ou
input_audio[o_ch][i] = 0.0f;
}
}
return 0;
}
@ -90,30 +90,30 @@ WORD32 impd_init_process_audio_main_qmf (ia_drc_api_struct *p_obj_drc)
FLOAT32 *audio_io_buf_real[10];
FLOAT32 *audio_io_buf_imag[10];
FLOAT32 *scratch_buffer;
WORD32 last_frame=0;
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;
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)
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);
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->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],
@ -124,21 +124,21 @@ WORD32 impd_init_process_audio_main_qmf (ia_drc_api_struct *p_obj_drc)
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_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)
{
@ -146,12 +146,12 @@ WORD32 impd_init_process_audio_main_qmf (ia_drc_api_struct *p_obj_drc)
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;
}
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,
@ -163,17 +163,17 @@ WORD32 impd_init_process_audio_main_qmf (ia_drc_api_struct *p_obj_drc)
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,
@ -192,7 +192,7 @@ WORD32 impd_init_process_audio_main_qmf (ia_drc_api_struct *p_obj_drc)
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;
}
}
}
@ -201,37 +201,37 @@ WORD32 impd_init_process_audio_main_qmf (ia_drc_api_struct *p_obj_drc)
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];
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);
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(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->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)
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 error;
}

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <math.h>
#include "impd_type_def.h"
#include "impd_memory_standards.h"
@ -45,19 +45,19 @@ static WORD32 impd_down_mix(ia_drc_sel_proc_output_struct *uni_drc_sel_proc_outp
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;
return 0;
if (input_audio == 0)
return 0;
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;
@ -72,8 +72,8 @@ static WORD32 impd_down_mix(ia_drc_sel_proc_output_struct *uni_drc_sel_proc_outp
input_audio[o_ch][i] = 0.0f;
}
}
return 0;
}
@ -89,30 +89,30 @@ WORD32 impd_init_process_audio_main_stft (ia_drc_api_struct *p_obj_drc)
FLOAT32 *audio_io_buf_real[10];
FLOAT32 *audio_io_buf_imag[10];
FLOAT32 *scratch_buffer;
WORD32 last_frame=0;
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;
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)
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);
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->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],
@ -123,16 +123,16 @@ WORD32 impd_init_process_audio_main_stft (ia_drc_api_struct *p_obj_drc)
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_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)
{
@ -140,12 +140,12 @@ WORD32 impd_init_process_audio_main_stft (ia_drc_api_struct *p_obj_drc)
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;
}
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,
@ -157,17 +157,17 @@ WORD32 impd_init_process_audio_main_stft (ia_drc_api_struct *p_obj_drc)
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,
@ -186,47 +186,47 @@ WORD32 impd_init_process_audio_main_stft (ia_drc_api_struct *p_obj_drc)
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];
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);
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(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->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)
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 error;
}

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <math.h>
#include <string.h>
#include "impd_type_def.h"
@ -47,35 +47,35 @@ static IA_ERRORCODE impd_down_mix ( ia_drc_sel_proc_output_struct *uni_drc_sel_p
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++)
{
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++)
{
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++)
{
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++)
{
for ( ; o_ch<num_base_ch; o_ch++)
{
input_audio[o_ch][i] = 0.0f;
}
}
return IA_NO_ERROR;
}
@ -88,21 +88,21 @@ IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc)
FLOAT32 *output_buffer;
FLOAT32 *audio_buff[10];
FLOAT32 *scratch_buffer;
WORD32 last_frame=0;
WORD32 num_sample_to_process;
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;
return IA_NO_ERROR;
}
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->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],
@ -110,63 +110,65 @@ IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc)
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)
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_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_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_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));
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];
}
}
}
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,
@ -175,18 +177,18 @@ IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc)
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)
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)
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,
@ -195,20 +197,20 @@ IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc)
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)
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);
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;
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++) {
@ -216,28 +218,28 @@ IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc)
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,
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)
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(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;
@ -246,67 +248,67 @@ IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc)
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++)
{
}
}
}
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);
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_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);
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(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->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)
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;
}
}
}
return err_code;
}

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <math.h>
#include "impd_type_def.h"
#include "impd_memory_standards.h"
@ -41,7 +41,7 @@
VOID process_qmf_syn_filt_bank(ia_drc_qmf_filt_struct *qmf_filt,
FLOAT64 *buff,
FLOAT64 *buff,
FLOAT32 *input_real,
FLOAT32 *input_imag,
FLOAT32 *output)
@ -51,24 +51,24 @@ VOID process_qmf_syn_filt_bank(ia_drc_qmf_filt_struct *qmf_filt,
FLOAT64 W[10 * QMF_NUM_FILT_BANDS];
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=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]
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];
@ -76,13 +76,13 @@ VOID process_qmf_syn_filt_bank(ia_drc_qmf_filt_struct *qmf_filt,
}
}
for ( i=0; i<10*QMF_FILT_RESOLUTION; i++ ) {
W[i] = U[i] * qmf_filter_coeff[i];
W[i] = U[i] * qmf_filter_coeff[i];
}
for ( i=0; i<QMF_FILT_RESOLUTION; i++ ) {
tmp = 0.0;
for ( j=0; j<10; j++ ) {
@ -94,7 +94,7 @@ VOID process_qmf_syn_filt_bank(ia_drc_qmf_filt_struct *qmf_filt,
VOID process_qmf_ana_filt_bank(ia_drc_qmf_filt_struct *qmf_filt,
FLOAT64 *buff,
FLOAT64 *buff,
FLOAT32 *input,
FLOAT32 *output_real,
FLOAT32 *output_imag)
@ -107,15 +107,15 @@ VOID process_qmf_ana_filt_bank(ia_drc_qmf_filt_struct *qmf_filt,
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=0; i<10*QMF_FILT_RESOLUTION; i++ ) {
Z[i] = (FLOAT32) (buff[i] * qmf_filter_coeff[i]);
Z[i] = (FLOAT32) (buff[i] * qmf_filter_coeff[i]);
}
@ -144,14 +144,14 @@ static WORD32 impd_down_mix ( ia_drc_sel_proc_output_struct *uni_drc_sel_proc_o
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;
@ -166,8 +166,8 @@ static WORD32 impd_down_mix ( ia_drc_sel_proc_output_struct *uni_drc_sel_proc_o
input_audio[o_ch][i] = 0.0f;
}
}
return 0;
}
@ -186,30 +186,30 @@ WORD32 impd_init_process_audio_main_td_qmf (ia_drc_api_struct *p_obj_drc)
FLOAT32 *audio_io_buf_imag[10];
FLOAT32 *audio_in_out_buf[10];
FLOAT32 *scratch_buffer;
WORD32 last_frame=0;
error=0;
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;
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)
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);;
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;
@ -219,10 +219,10 @@ WORD32 impd_init_process_audio_main_td_qmf (ia_drc_api_struct *p_obj_drc)
}
}
}
error = impd_process_drc_bitstream_dec_gain(p_obj_drc->str_payload.pstr_bitstream_dec,
p_obj_drc->pstr_bit_buf,
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],
@ -233,14 +233,14 @@ WORD32 impd_init_process_audio_main_td_qmf (ia_drc_api_struct *p_obj_drc)
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_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)
@ -249,22 +249,22 @@ WORD32 impd_init_process_audio_main_td_qmf (ia_drc_api_struct *p_obj_drc)
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;
}
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]),
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]));
}
}
@ -281,12 +281,12 @@ WORD32 impd_init_process_audio_main_td_qmf (ia_drc_api_struct *p_obj_drc)
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){
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);
@ -306,16 +306,16 @@ WORD32 impd_init_process_audio_main_td_qmf (ia_drc_api_struct *p_obj_drc)
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,
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);
@ -323,15 +323,15 @@ WORD32 impd_init_process_audio_main_td_qmf (ia_drc_api_struct *p_obj_drc)
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){
@ -343,29 +343,29 @@ WORD32 impd_init_process_audio_main_td_qmf (ia_drc_api_struct *p_obj_drc)
}
}
}
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);
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->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)
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 error;
}

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_MULTI_BAND_H
#define IMPD_DRC_MULTI_BAND_H

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
@ -46,10 +46,10 @@ IA_ERRORCODE impd_generate_slope (WORD32 num_sub_bands,
FLOAT32* response)
{
WORD32 i;
FLOAT32 filter_slope =-24.0f;
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)
@ -80,8 +80,8 @@ IA_ERRORCODE impd_generate_overlap_weights (WORD32 num_drc_bands,
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) {
if (drc_band_type == 1) {
fcross_norm_lo = 0.0f;
for (b=0; b<num_drc_bands; b++)
{
@ -98,7 +98,7 @@ IA_ERRORCODE impd_generate_overlap_weights (WORD32 num_drc_bands,
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++)
@ -109,7 +109,7 @@ IA_ERRORCODE impd_generate_overlap_weights (WORD32 num_drc_bands,
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++)
@ -143,7 +143,7 @@ IA_ERRORCODE impd_generate_overlap_weights (WORD32 num_drc_bands,
start_subband_index = stop_sub_band_index+1;
}
}
return (0);
}
@ -178,7 +178,7 @@ IA_ERRORCODE impd_init_overlap_weight ( ia_uni_drc_coeffs_struct* str_p_loc_drc_
if (err) return (err);
}
}
return (0);
}

File diff suppressed because it is too large Load diff

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_PARSER_H
#define IMPD_DRC_PARSER_H
@ -34,7 +34,7 @@ impd_parse_loudness_info(ia_bit_buf_struct* it_bit_buff,
WORD32
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,
@ -72,14 +72,14 @@ impd_parse_dwnmix_instructions(ia_bit_buf_struct* it_bit_buff,
WORD32
impd_parse_drc_ext_v1(
ia_bit_buf_struct* it_bit_buff,
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_bit_buf_struct* it_bit_buff,
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
ia_drc_config* drc_config
);
@ -90,7 +90,7 @@ impd_parse_loudness_info_set(ia_bit_buf_struct* it_bit_buff,
WORD32
impd_parse_drc_gain_sequence(
ia_bit_buf_struct* it_bit_buff,
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);
@ -100,7 +100,7 @@ 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_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);

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_PARSER_INTERFACE_H
#define IMPD_DRC_PARSER_INTERFACE_H

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
@ -34,55 +34,55 @@
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
)
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;
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;
peak_limiter->min_gain = 1.0f;
peak_limiter->limiter_on=1;
peak_limiter->pre_smoothed_gain=1.0f;
peak_limiter->gain_modified=1.0f;
return 0;
UWORD32 attack;
attack = (UWORD32)(attack_time * sample_rate / 1000);
if (attack < 1)
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;
peak_limiter->min_gain = 1.0f;
peak_limiter->limiter_on=1;
peak_limiter->pre_smoothed_gain=1.0f;
peak_limiter->gain_modified=1.0f;
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;
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)
@ -103,8 +103,8 @@ WORD32 impd_limiter_process(ia_drc_peak_limiter_struct *peak_limiter, FLOAT32 *s
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;
@ -118,33 +118,33 @@ WORD32 impd_limiter_process(ia_drc_peak_limiter_struct *peak_limiter, FLOAT32 *s
max_buf[0] = tmp;
sectionMaximum=tmp;
for (j = 1; j < (attack_time_samples+1); j++) {
if (max_buf[j] > sectionMaximum)
if (max_buf[j] > sectionMaximum)
sectionMaximum = max_buf[j];
}
maximum=sectionMaximum;
if (maximum > limit_threshold) {
gain = limit_threshold / maximum;
}
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 = gain;
}
if (gain_modified < pre_smoothed_gain) {
pre_smoothed_gain = attack_constant * (pre_smoothed_gain - gain_modified) + gain_modified;
pre_smoothed_gain = max(pre_smoothed_gain, gain);
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;
pre_smoothed_gain = release_constant * (pre_smoothed_gain - gain_modified) + gain_modified;
}
gain = (FLOAT32)pre_smoothed_gain;
for (j = 0; j < num_channels; j++) {
@ -152,23 +152,23 @@ WORD32 impd_limiter_process(ia_drc_peak_limiter_struct *peak_limiter, FLOAT32 *s
delayed_input[delayed_input_index * num_channels + j] = samples[i * num_channels + j];
tmp *= gain;
if (tmp > limit_threshold)
if (tmp > limit_threshold)
tmp = limit_threshold;
else if (tmp < -limit_threshold)
else if (tmp < -limit_threshold)
tmp = -limit_threshold;
samples[i * num_channels + j] = tmp;
}
delayed_input_index++;
if (delayed_input_index >= attack_time_samples)
if (delayed_input_index >= attack_time_samples)
delayed_input_index = 0;
if (gain < min_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];
@ -181,7 +181,7 @@ WORD32 impd_limiter_process(ia_drc_peak_limiter_struct *peak_limiter, FLOAT32 *s
delayed_input_index = 0;
}
}
peak_limiter->gain_modified = gain_modified;
peak_limiter->delayed_input_index = delayed_input_index;
peak_limiter->pre_smoothed_gain = pre_smoothed_gain;

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_PEAK_LIMITER_H
#define IMPD_DRC_PEAK_LIMITER_H
@ -44,13 +44,13 @@ typedef struct ia_drc_peak_limiter_struct {
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);
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);
WORD32 impd_limiter_process(ia_drc_peak_limiter_struct *peak_limiter, FLOAT32 *samples, UWORD32 frame_len);

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_PEAK_LIMITER_STRUCT_H
#define IMPD_DRC_PEAK_LIMITER_STRUCT_H

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
@ -51,7 +51,7 @@ WORD32 impd_apply_gains_and_add(ia_drc_instructions_struct* pstr_drc_instruction
FLOAT32 drc_gain_last, gainThr;
WORD32 iEnd, iStart;
ia_drc_instructions_struct* str_drc_instruction_str = &(pstr_drc_instruction_arr[drc_instructions_index]);
if (drc_instructions_index >= 0)
{
str_drc_instruction_str = &(pstr_drc_instruction_arr[drc_instructions_index]);
@ -65,7 +65,7 @@ WORD32 impd_apply_gains_and_add(ia_drc_instructions_struct* pstr_drc_instruction
gainIndexForGroup[0] = 0;
for (g=0; g<str_drc_instruction_str->num_drc_ch_groups-1; g++)
{
gainIndexForGroup[g+1] = gainIndexForGroup[g] + str_drc_instruction_str->band_count_of_ch_group[g];
gainIndexForGroup[g+1] = gainIndexForGroup[g] + str_drc_instruction_str->band_count_of_ch_group[g];
}
signalIndexForChannel[0] = 0;
for (c=0; c<str_drc_instruction_str->audio_num_chan-1; c++)
@ -79,7 +79,7 @@ WORD32 impd_apply_gains_and_add(ia_drc_instructions_struct* pstr_drc_instruction
signalIndexForChannel[c+1] = signalIndexForChannel[c] + 1;
}
}
for (g=0; g<str_drc_instruction_str->num_drc_ch_groups; g++)
{
for (b=0; b<str_drc_instruction_str->band_count_of_ch_group[g]; b++)
@ -109,7 +109,7 @@ WORD32 impd_apply_gains_and_add(ia_drc_instructions_struct* pstr_drc_instruction
if (g == str_drc_instruction_str->channel_group_of_ch[c])
{
signalIndex = signalIndexForChannel[c] + b;
if(impd_apply_gains == 1) {
impd_shape_filt_block_time_process(&shape_filter_block[g],
@ -118,10 +118,10 @@ WORD32 impd_apply_gains_and_add(ia_drc_instructions_struct* pstr_drc_instruction
&deinterleaved_audio[signalIndex][0],
iStart,
iEnd);
}
else {
for (i=iStart; i<iEnd; i++){
else {
for (i=iStart; i<iEnd; i++){
deinterleaved_audio[signalIndex][i] = lpcm_gains[i];
}
}
@ -130,9 +130,9 @@ WORD32 impd_apply_gains_and_add(ia_drc_instructions_struct* pstr_drc_instruction
}
}
if ((iEnd < ia_drc_params_struct->drc_frame_size) && (shape_filter_block[g].shape_flter_block_flag))
{
@ -145,9 +145,9 @@ WORD32 impd_apply_gains_and_add(ia_drc_instructions_struct* pstr_drc_instruction
}
}
}
signalIndex=0;
signalIndex=0;
if (str_drc_instruction_str->drc_set_id > 0)
{
@ -190,22 +190,22 @@ if (str_drc_instruction_str->drc_set_id > 0)
channel_audio[c][i] = deinterleaved_audio[c][i];
}
}
}
}
return (0);
}
@ -257,7 +257,7 @@ WORD32
break;
}
drc_frame_sizeSb = ia_drc_params_struct->drc_frame_size/L;
if (drc_instructions_index >= 0)
{
str_drc_instruction_str = &(pstr_drc_instruction_arr[drc_instructions_index]);
@ -273,7 +273,7 @@ WORD32
{
gainIndexForGroup[g+1] = gainIndexForGroup[g] + str_drc_instruction_str->band_count_of_ch_group[g]; /* index of first gain sequence in channel group */
}
for (c=0; c<str_drc_instruction_str->audio_num_chan; c++)
@ -282,7 +282,7 @@ WORD32
if (g>=0)
{
for (m=0; m<drc_frame_sizeSb; m++)
{
{
if (str_drc_instruction_str->band_count_of_ch_group[g] > 1)
{ /* multiband DRC */
for (s=0; s<nDecoderSubbands; s++)
@ -345,7 +345,7 @@ impd_filter_banks_process(ia_drc_instructions_struct* pstr_drc_instruction_arr,
const WORD32 passThru)
{
WORD32 c, g, e, i, num_bands;
//WORD32 err = 0;
//WORD32 err = 0;
FLOAT32* audio_in;
FLOAT32** audio_out;
ia_drc_filter_bank_struct* str_drc_filter_bank;
@ -372,7 +372,7 @@ impd_filter_banks_process(ia_drc_instructions_struct* pstr_drc_instruction_arr,
{
if (str_drc_instruction_str->drc_set_id < 0)
{
num_bands = 1;
num_bands = 1;
}
else
{
@ -397,7 +397,7 @@ impd_filter_banks_process(ia_drc_instructions_struct* pstr_drc_instruction_arr,
//{
//if (&str_drc_filter_bank->str_all_pass_cascade != NULL)
//{
impd_all_pass_cascade_process(&str_drc_filter_bank->str_all_pass_cascade, c, drc_frame_size, audio_in);
impd_all_pass_cascade_process(&str_drc_filter_bank->str_all_pass_cascade, c, drc_frame_size, audio_in);
//}
//}
}
@ -443,7 +443,7 @@ impd_filter_banks_process(ia_drc_instructions_struct* pstr_drc_instruction_arr,
break;
}
}
return (0);
}
@ -454,7 +454,7 @@ impd_store_audio_io_buffer_time(FLOAT32* audio_in_out_buf[],
ia_audio_in_out_buf* audio_io_buf_internal)
{
WORD32 i,j;
if (audio_io_buf_internal->audio_delay_samples) {
for (i=0; i<audio_io_buf_internal->audio_num_chan; i++) {
for (j=0; j<audio_io_buf_internal->frame_size; j++) {
@ -465,7 +465,7 @@ impd_store_audio_io_buffer_time(FLOAT32* audio_in_out_buf[],
audio_io_buf_internal->audio_io_buffer_delayed = audio_in_out_buf;
audio_io_buf_internal->audio_in_out_buf = audio_in_out_buf;
}
return 0;
}
@ -475,7 +475,7 @@ impd_store_audio_io_buffer_freq(FLOAT32* audio_real_buff[],
ia_audio_in_out_buf* audio_io_buf_internal)
{
WORD32 i,j;
if (audio_io_buf_internal->audio_delay_sub_band_samples) {
for (i=0; i<audio_io_buf_internal->audio_num_chan; i++) {
for (j=0; j<audio_io_buf_internal->audio_sub_band_frame_size*audio_io_buf_internal->audio_sub_band_count; j++) {
@ -489,7 +489,7 @@ impd_store_audio_io_buffer_freq(FLOAT32* audio_real_buff[],
audio_io_buf_internal->audio_real_buff = audio_real_buff;
audio_io_buf_internal->audio_imag_buff = audio_imag_buff;
}
return 0;
}
@ -498,7 +498,7 @@ impd_retrieve_audio_io_buffer_time(FLOAT32* audio_in_out_buf[],
ia_audio_in_out_buf* audio_io_buf_internal)
{
WORD32 i,j;
if (audio_io_buf_internal->audio_delay_samples) {
for (i=0; i<audio_io_buf_internal->audio_num_chan; i++) {
for (j=0; j<audio_io_buf_internal->frame_size; j++) {
@ -506,7 +506,7 @@ impd_retrieve_audio_io_buffer_time(FLOAT32* audio_in_out_buf[],
}
}
}
return 0;
}
@ -516,7 +516,7 @@ impd_retrieve_audio_buffer_freq(FLOAT32* audio_real_buff[],
ia_audio_in_out_buf* audio_io_buf_internal)
{
WORD32 i,j;
if (audio_io_buf_internal->audio_delay_sub_band_samples) {
for (i=0; i<audio_io_buf_internal->audio_num_chan; i++) {
for (j=0; j<audio_io_buf_internal->audio_sub_band_frame_size*audio_io_buf_internal->audio_sub_band_count; j++) {
@ -525,7 +525,7 @@ impd_retrieve_audio_buffer_freq(FLOAT32* audio_real_buff[],
}
}
}
return 0;
}

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_PROCESS_AUDIO_H
#define IMPD_DRC_PROCESS_AUDIO_H
@ -80,12 +80,12 @@ impd_store_audio_io_buffer_freq(FLOAT32* audio_real_buff[],
WORD32
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);
WORD32
impd_advance_audio_io_buffer_time(ia_audio_in_out_buf* audio_io_buf_internal);

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_QMF_FILTER_H
#define IMPD_DRC_QMF_FILTER_H

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <stdio.h>
#include <math.h>
#include "impd_type_def.h"
@ -30,20 +30,20 @@
const FLOAT32 samp_rate_tbl[13][12]=
{
{1.559742927551f,-2.926673889160f,1.378173947334f,-1.844531774521f,0.855774641037f,0.997517585754f,-1.995035171509f,0.997517585754f,-1.995032072067f,0.995038211346f},
{1.557545065880f,-2.905559301376f,1.361245870590f,-1.830842256546f,0.844074070454f,0.997298538685f,-1.994597077370f,0.997298538685f,-1.994593381882f,0.994600534439f},
{1.547380685806f,-2.808161973953f,1.285161137581f,-1.767331838608f,0.791711509228f,0.996279776096f,-1.992559552193f,0.996279776096f,-1.992552518845f,0.992566406727f},
{1.535182833672f,-2.691803932190f,1.198426246643f,-1.690699458122f,0.732504665852f,0.995044350624f,-1.990088701248f,0.995044350624f,-1.990076303482f,0.990100920200f},
{1.530909657478f,-2.651169300079f,1.169166922569f,-1.663750052452f,0.712657511234f,0.994607865810f,-1.989215731621f,0.994607865810f,-1.989201068878f,0.989230215549f},
{1.511321425438f,-2.465713739395f,1.042117238045f,-1.539572954178f,0.627297878265f,0.992580235004f,-1.985160470009f,0.992580235004f,-1.985132932663f,0.985188126564f},
{1.488207340240f,-2.248480796814f,0.906192243099f,-1.391770243645f,0.537688970566f,0.990125238895f,-1.980250477791f,0.990125238895f,-1.980201482773f,0.980299532413f},
{1.480212569237f,-2.173723459244f,0.862487196922f,-1.340346932411f,0.509323298931f,0.989259064198f,-1.978518128395f,0.989259064198f,-1.978460073471f,0.978576123714f},
{1.444234013557f,-1.839543223381f,0.685432314873f,-1.107139229774f,0.397262454033f,0.985242545605f,-1.970485091209f,0.985242545605f,-1.970375299454f,0.970594763756f},
{1.403080821037f,-1.461511373520f,0.519652962685f,-0.837045848370f,0.298268288374f,0.980395674706f,-1.960791349411f,0.980395674706f,-1.960597157478f,0.960985362530f},
{1.389132857323f,-1.334347724915f,0.471855700016f,-0.744739949703f,0.271380871534f,0.978689610958f,-1.957379221916f,0.978689610958f,-1.957149744034f,0.957608699799f},
{1.327733159065f,-0.780098080635f,0.309720277786f,-0.334008187056f,0.191363617778f,0.970807731152f,-1.941615462303f,0.970807731152f,-1.941183090210f,0.942047894001f},
{1.308971643448f,-0.612507879734f,0.275601744652f,-0.207099482417f,0.179165065289f,0.968287348747f,-1.936574697495f,0.968287348747f,-1.936063885689f,0.937085747719f}
};
{1.559742927551f,-2.926673889160f,1.378173947334f,-1.844531774521f,0.855774641037f,0.997517585754f,-1.995035171509f,0.997517585754f,-1.995032072067f,0.995038211346f},
{1.557545065880f,-2.905559301376f,1.361245870590f,-1.830842256546f,0.844074070454f,0.997298538685f,-1.994597077370f,0.997298538685f,-1.994593381882f,0.994600534439f},
{1.547380685806f,-2.808161973953f,1.285161137581f,-1.767331838608f,0.791711509228f,0.996279776096f,-1.992559552193f,0.996279776096f,-1.992552518845f,0.992566406727f},
{1.535182833672f,-2.691803932190f,1.198426246643f,-1.690699458122f,0.732504665852f,0.995044350624f,-1.990088701248f,0.995044350624f,-1.990076303482f,0.990100920200f},
{1.530909657478f,-2.651169300079f,1.169166922569f,-1.663750052452f,0.712657511234f,0.994607865810f,-1.989215731621f,0.994607865810f,-1.989201068878f,0.989230215549f},
{1.511321425438f,-2.465713739395f,1.042117238045f,-1.539572954178f,0.627297878265f,0.992580235004f,-1.985160470009f,0.992580235004f,-1.985132932663f,0.985188126564f},
{1.488207340240f,-2.248480796814f,0.906192243099f,-1.391770243645f,0.537688970566f,0.990125238895f,-1.980250477791f,0.990125238895f,-1.980201482773f,0.980299532413f},
{1.480212569237f,-2.173723459244f,0.862487196922f,-1.340346932411f,0.509323298931f,0.989259064198f,-1.978518128395f,0.989259064198f,-1.978460073471f,0.978576123714f},
{1.444234013557f,-1.839543223381f,0.685432314873f,-1.107139229774f,0.397262454033f,0.985242545605f,-1.970485091209f,0.985242545605f,-1.970375299454f,0.970594763756f},
{1.403080821037f,-1.461511373520f,0.519652962685f,-0.837045848370f,0.298268288374f,0.980395674706f,-1.960791349411f,0.980395674706f,-1.960597157478f,0.960985362530f},
{1.389132857323f,-1.334347724915f,0.471855700016f,-0.744739949703f,0.271380871534f,0.978689610958f,-1.957379221916f,0.978689610958f,-1.957149744034f,0.957608699799f},
{1.327733159065f,-0.780098080635f,0.309720277786f,-0.334008187056f,0.191363617778f,0.970807731152f,-1.941615462303f,0.970807731152f,-1.941183090210f,0.942047894001f},
{1.308971643448f,-0.612507879734f,0.275601744652f,-0.207099482417f,0.179165065289f,0.968287348747f,-1.936574697495f,0.968287348747f,-1.936063885689f,0.937085747719f}
};
@ -74,60 +74,60 @@ const ia_delta_gain_code_table_struct ia_drc_gain_tbls_prof_0_1[NUM_GAIN_TBL_PRO
{ 10, 0x1AD , -1.250f },
{ 11, 0x0E2 , -1.750f },
{ 11, 0x0E3 , -1.625f }
};
const ia_delta_gain_code_table_struct ia_drc_gain_tbls_prof_2[NUM_GAIN_TBL_PROF_2_ENTRIES] =
{
{ 3, 0x007, -0.125f },
{ 4, 0x00C, -0.625f },
{ 4, 0x009, -0.500f },
{ 4, 0x005, -0.375f },
{ 4, 0x003, -0.250f },
{ 4, 0x001, 0.000f },
{ 4, 0x00B, 0.125f },
{ 5, 0x011, -0.875f },
{ 5, 0x00E, -0.750f },
{ 5, 0x005, 0.250f },
{ 5, 0x004, 0.375f },
{ 5, 0x008, 0.500f },
{ 5, 0x000, 0.625f },
{ 5, 0x00D, 0.750f },
{ 5, 0x00F, 0.875f },
{ 5, 0x010, 1.000f },
{ 5, 0x01B, 1.125f },
{ 6, 0x02B, -1.250f },
{ 6, 0x028, -1.125f },
{ 6, 0x002, -1.000f },
{ 6, 0x012, 1.250f },
{ 6, 0x018, 1.375f },
{ 6, 0x029, 1.500f },
{ 7, 0x06A, -4.000f },
{ 7, 0x054, -1.750f },
{ 7, 0x068, -1.625f },
{ 7, 0x026, -1.500f },
{ 7, 0x006, -1.375f },
{ 7, 0x032, 1.625f },
{ 8, 0x0D2, -2.250f },
{ 8, 0x0AB, -2.125f },
{ 8, 0x0AA, -2.000f },
{ 8, 0x04F, -1.875f },
{ 8, 0x04E, 1.750f },
{ 8, 0x0D7, 1.875f },
{ 8, 0x00E, 2.000f },
{ 9, 0x1AD, -3.625f },
{ 9, 0x1AC, -3.375f },
{ 9, 0x1A6, -3.250f },
{ 9, 0x0CD, -3.125f },
{ 9, 0x0CE, -2.750f },
{ 9, 0x1A7, -2.625f },
{ 9, 0x01F, -2.500f },
{ 9, 0x0CC, -2.375f },
{ 10, 0x03C, -3.500f },
{ 10, 0x19E, -3.000f },
{ 10, 0x19F, -2.875f },
{ 11, 0x07A, -3.875f },
{ 11, 0x07B, -3.750f }
{ 3, 0x007, -0.125f },
{ 4, 0x00C, -0.625f },
{ 4, 0x009, -0.500f },
{ 4, 0x005, -0.375f },
{ 4, 0x003, -0.250f },
{ 4, 0x001, 0.000f },
{ 4, 0x00B, 0.125f },
{ 5, 0x011, -0.875f },
{ 5, 0x00E, -0.750f },
{ 5, 0x005, 0.250f },
{ 5, 0x004, 0.375f },
{ 5, 0x008, 0.500f },
{ 5, 0x000, 0.625f },
{ 5, 0x00D, 0.750f },
{ 5, 0x00F, 0.875f },
{ 5, 0x010, 1.000f },
{ 5, 0x01B, 1.125f },
{ 6, 0x02B, -1.250f },
{ 6, 0x028, -1.125f },
{ 6, 0x002, -1.000f },
{ 6, 0x012, 1.250f },
{ 6, 0x018, 1.375f },
{ 6, 0x029, 1.500f },
{ 7, 0x06A, -4.000f },
{ 7, 0x054, -1.750f },
{ 7, 0x068, -1.625f },
{ 7, 0x026, -1.500f },
{ 7, 0x006, -1.375f },
{ 7, 0x032, 1.625f },
{ 8, 0x0D2, -2.250f },
{ 8, 0x0AB, -2.125f },
{ 8, 0x0AA, -2.000f },
{ 8, 0x04F, -1.875f },
{ 8, 0x04E, 1.750f },
{ 8, 0x0D7, 1.875f },
{ 8, 0x00E, 2.000f },
{ 9, 0x1AD, -3.625f },
{ 9, 0x1AC, -3.375f },
{ 9, 0x1A6, -3.250f },
{ 9, 0x0CD, -3.125f },
{ 9, 0x0CE, -2.750f },
{ 9, 0x1A7, -2.625f },
{ 9, 0x01F, -2.500f },
{ 9, 0x0CC, -2.375f },
{ 10, 0x03C, -3.500f },
{ 10, 0x19E, -3.000f },
{ 10, 0x19F, -2.875f },
{ 11, 0x07A, -3.875f },
{ 11, 0x07B, -3.750f }
};
const FLOAT32 channel_weight[] =
@ -149,7 +149,7 @@ const FLOAT32 channel_weight[] =
-40.0f,
-1000.0f
};
const FLOAT32 dwnmix_coeff_v1[] =
{
10.00f,
@ -186,65 +186,65 @@ const FLOAT32 dwnmix_coeff_v1[] =
-100000.0f
};
const FLOAT32 eq_slope_tbl [] =
const FLOAT32 eq_slope_tbl [] =
{
-32.0f,
-24.0f,
-18.0f,
-12.0f,
-7.0f,
-4.0f,
-2.0f,
-1.0f,
1.0f,
2.0f,
4.0f,
7.0f,
12.0f,
18.0f,
24.0f,
32.0f
-32.0f,
-24.0f,
-18.0f,
-12.0f,
-7.0f,
-4.0f,
-2.0f,
-1.0f,
1.0f,
2.0f,
4.0f,
7.0f,
12.0f,
18.0f,
24.0f,
32.0f
};
const FLOAT32 eq_gain_delta_tbl[] =
const FLOAT32 eq_gain_delta_tbl[] =
{
-22.0f,
-16.0f,
-13.0f,
-11.0f,
-9.0f,
-7.0f,
-6.0f,
-5.0f,
-4.0f,
-3.0f,
-2.5f,
-2.0f,
-1.5f,
-1.0f,
-0.5f,
0.0f,
0.5f,
1.0f,
1.5f,
2.0f,
2.5f,
3.0f,
4.0f,
5.0f,
6.0f,
7.0f,
9.0f,
11.0f,
13.0f,
16.0f,
22.0f,
32.0f,
-9.0f,
-7.0f,
-6.0f,
-5.0f,
-4.0f,
-3.0f,
-2.5f,
-2.0f,
-1.5f,
-1.0f,
-0.5f,
0.0f,
0.5f,
1.0f,
1.5f,
2.0f,
2.5f,
3.0f,
4.0f,
5.0f,
6.0f,
7.0f,
9.0f,
11.0f,
13.0f,
16.0f,
22.0f,
32.0f,
};
const FLOAT32 zero_pole_radius_tbl[] =
const FLOAT32 zero_pole_radius_tbl[] =
{
0.00000000E+00f,
7.57409621E-11f,
@ -376,7 +376,7 @@ const FLOAT32 zero_pole_radius_tbl[] =
9.77237225E-01f
};
const FLOAT32 zero_pole_angle_tbl[] =
const FLOAT32 zero_pole_angle_tbl[] =
{
0.00000000E+00f,
6.90533966E-04f,
@ -508,7 +508,7 @@ const FLOAT32 zero_pole_angle_tbl[] =
1.00000000E+00f
};
const FLOAT32 shape_filt_lf_y1_bound_tbl[][3] =
const FLOAT32 shape_filt_lf_y1_bound_tbl[][3] =
{
{-0.994f,-0.996f, -1.0f},
{-0.99f, -0.995f, -0.999f},
@ -516,7 +516,7 @@ const FLOAT32 shape_filt_lf_y1_bound_tbl[][3] =
{-0.97f, -0.983f, -0.994f},
};
const FLOAT32 shape_filt_hf_y1_bound_tbl[][3] =
const FLOAT32 shape_filt_hf_y1_bound_tbl[][3] =
{
{0.15f, 0.75f, 1.05f },
{0.43f, 0.87f, 1.07f},
@ -660,13 +660,13 @@ WORD32 measurement_system_rms_e_tbl[] = {0, 0, 1, 0,
WORD32 measurement_method_prog_loudness_tbl[] = {0, 0, 1, 0, 0, 0, 0, 2, 3, 4, 0, 0};
WORD32 measurement_method_peak_loudness_tbl[] = {0, 7, 0, 0, 0, 0, 6, 5, 4, 3, 2, 1};
const ia_loc_sys_interface_struct loc_sys_interface[]=
{
const ia_loc_sys_interface_struct loc_sys_interface[]=
{
{0, 1, {0,0,0}, 0, 0},
{0, 1, {2,0,0}, 0, 0},
};
const ia_loc_loudness_norm_ctrl_interface_struct loc_loudness_norm_ctrl_interface[] =
const ia_loc_loudness_norm_ctrl_interface_struct loc_loudness_norm_ctrl_interface[] =
{
{0,0.0f},
{0,0.0f},
@ -674,7 +674,7 @@ const ia_loc_loudness_norm_ctrl_interface_struct loc_loudness_norm_ctrl_interfac
const ia_loc_loudness_norm_param_interface_struct loc_loudness_norm_param_interface[] = {
{0, 0, LOUDNESS_DEVIATION_MAX_DEFAULT, USER_METHOD_DEFINITION_PROGRAM_LOUDNESS, USER_MEASUREMENT_SYSTEM_BS_1770_3, USER_LOUDNESS_PREPROCESSING_OFF, 20, LOUDNESS_NORMALIZATION_GAIN_MAX_DEFAULT, 0.0f, 0.0f},
{0, 0, LOUDNESS_DEVIATION_MAX_DEFAULT, USER_METHOD_DEFINITION_PROGRAM_LOUDNESS, USER_MEASUREMENT_SYSTEM_BS_1770_3, USER_LOUDNESS_PREPROCESSING_OFF, 20, LOUDNESS_NORMALIZATION_GAIN_MAX_DEFAULT, 0.0f, 0.0f},
@ -682,11 +682,11 @@ const ia_loc_loudness_norm_param_interface_struct loc_loudness_norm_param_interf
const ia_loc_drc_interface_struct loc_dyn_range_ctrl_interface[] = {
{1, 3, {MATCH_EFFECT_TYPE, MATCH_DYNAMIC_RANGE, MATCH_DRC_CHARACTERISTIC}, SHORT_TERM_LOUDNESS_TO_AVG, 1, 5.0f, 3.0f, 10.0f, 3},
{1, 3, {MATCH_EFFECT_TYPE, MATCH_DYNAMIC_RANGE, MATCH_DRC_CHARACTERISTIC}, TOP_OF_LOUDNESS_RANGE_TO_AVG, 0, 5.0f, 3.0f, 10.0f, 3},
};
@ -694,13 +694,13 @@ const ia_loc_requested_drc_effect_struct loc_requested_drc_effect_type_str[] = {
{1, 1, {EFFECT_TYPE_REQUESTED_NIGHT, EFFECT_TYPE_REQUESTED_GENERAL_COMPR, EFFECT_TYPE_REQUESTED_ARTISTIC, EFFECT_TYPE_REQUESTED_LIMITED, EFFECT_TYPE_REQUESTED_DIALOG}},
{4, 1, {EFFECT_TYPE_REQUESTED_LOWLEVEL, EFFECT_TYPE_REQUESTED_NIGHT, EFFECT_TYPE_REQUESTED_LIMITED, EFFECT_TYPE_REQUESTED_ARTISTIC, EFFECT_TYPE_REQUESTED_DIALOG}},
};
const ia_loc_drc_parameter_interface_struct loc_drc_parameter_interface[] = {
{1.0f,1.0f,0},
{1.0f,1.0f,0},
};
@ -820,30 +820,30 @@ const ia_loc_drc_parameter_interface_struct loc_drc_parameter_interface[] = {
0.5859400000000000f,
0.6015600000000000f,
0.6171900000000000f,
0.6328100000000000f,
0.6484400000000000f,
0.6640600000000000f,
0.6796900000000000f,
0.6953100000000000f,
0.7109400000000000f,
0.7265600000000000f,
0.7421900000000000f,
0.7578100000000000f,
0.7734400000000000f,
0.7890600000000000f,
0.8046900000000000f,
0.8203100000000000f,
0.8359400000000000f,
0.8515600000000000f,
0.8671900000000000f,
0.8828100000000000f,
0.8984400000000000f,
0.9140600000000000f,
0.9296900000000000f,
0.9453100000000000f,
0.9609400000000000f,
0.9765600000000000f,
0.9921900000000000f
0.6328100000000000f,
0.6484400000000000f,
0.6640600000000000f,
0.6796900000000000f,
0.6953100000000000f,
0.7109400000000000f,
0.7265600000000000f,
0.7421900000000000f,
0.7578100000000000f,
0.7734400000000000f,
0.7890600000000000f,
0.8046900000000000f,
0.8203100000000000f,
0.8359400000000000f,
0.8515600000000000f,
0.8671900000000000f,
0.8828100000000000f,
0.8984400000000000f,
0.9140600000000000f,
0.9296900000000000f,
0.9453100000000000f,
0.9609400000000000f,
0.9765600000000000f,
0.9921900000000000f
};
FLOAT32 f_bands_nrm_STFT256[257]={
@ -1105,7 +1105,7 @@ const ia_loc_drc_parameter_interface_struct loc_drc_parameter_interface[] = {
0.996093750000000f,
1.000000000000000f
};
FLOAT64 qmf_filter_coeff[640] = {
0, -0.00055252865047, -0.00056176925738, -0.00049475180896,
@ -1271,21 +1271,21 @@ FLOAT64 qmf_filter_coeff[640] = {
};
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},
{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},
};

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_ROM_H
#define IMPD_DRC_ROM_H
#define MAX_NUM_QMF_BANDS 128
@ -32,7 +32,7 @@ extern const ia_delta_gain_code_table_struct ia_drc_gain_tbls_prof_0_1[NUM_GAIN_
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 [];
@ -77,7 +77,7 @@ extern WORD32 measurement_system_rms_c_tbl[];
extern WORD32 measurement_system_rms_d_tbl[];
extern WORD32 measurement_system_rms_e_tbl[];
extern WORD32 measurement_method_prog_loudness_tbl[];
extern WORD32 measurement_method_peak_loudness_tbl[];
extern WORD32 measurement_method_peak_loudness_tbl[];
#define MAX_NUM_DOWNMIX_ID_REQUESTS_LOCAL 3
@ -97,8 +97,8 @@ typedef struct {
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;
@ -137,7 +137,7 @@ typedef struct {
} ia_loc_requested_drc_effect_struct;
extern const ia_loc_requested_drc_effect_struct loc_requested_drc_effect_type_str[];
typedef struct {
FLOAT32 compress;
FLOAT32 boost;
@ -153,4 +153,4 @@ 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];
#endif
#endif

View file

@ -1,33 +1,33 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_SEL_PROC_DRC_SET_SEL_H
#define IMPD_DRC_SEL_PROC_DRC_SET_SEL_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#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;
@ -42,7 +42,7 @@ typedef struct {
WORD32
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);
@ -87,7 +87,7 @@ 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
impd_select_drcs_without_compr_effects (ia_drc_config* pstr_drc_config,
WORD32* match_found_flag,
@ -112,8 +112,8 @@ impd_match_effect_types(ia_drc_config* pstr_drc_config,
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,
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);
@ -129,7 +129,7 @@ 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);
@ -138,7 +138,7 @@ impd_drc_set_preselection(ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_param
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,
ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
WORD32* selection_candidate_count,
ia_selection_candidate_info_struct* selection_candidate_info);
@ -152,11 +152,11 @@ WORD32 impd_drc_set_final_selection(ia_drc_config* pstr_drc_config,
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* 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
@ -173,10 +173,10 @@ impd_drc_sel_proc_init_sel_proc_params(ia_drc_sel_pro_struct* pstr_drc_uni_sel_p
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);
ia_drc_interface_struct* pstr_drc_interface);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
@ -35,16 +35,16 @@ WORD32 impd_drc_uni_selction_proc_init(ia_drc_sel_pro_struct* pstr_drc_uni_sel_p
WORD32 subband_domain_mode)
{
WORD32 err = 0;
if (pstr_drc_uni_sel_proc == NULL) {
return 1;
}
if (pstr_drc_uni_sel_proc->first_frame == 1) {
err = impd_drc_sel_proc_init_dflt(pstr_drc_uni_sel_proc);
if (err) return (err);
}
err = impd_drc_sel_proc_init_sel_proc_params(pstr_drc_uni_sel_proc,
pstr_drc_sel_proc_params_struct);
if (err) return (err);
@ -65,7 +65,7 @@ WORD32 impd_drc_uni_selction_proc_init(ia_drc_sel_pro_struct* pstr_drc_uni_sel_p
err = impd_drc_sel_proc_init_interface_params(pstr_drc_uni_sel_proc,
pstr_drc_interface);
if (err) return (err);
pstr_drc_uni_sel_proc->subband_domain_mode = subband_domain_mode;
return 0;
@ -81,15 +81,15 @@ impd_drc_uni_sel_proc_process(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
WORD32 i, err, drc_set_id_selected, activeDrcSetIndex;
WORD32 eq_set_id_selected;
WORD32 loudEqSetIdSelected;
if (pstr_drc_config != NULL)
{
if ( memcmp ( &pstr_drc_uni_sel_proc->drc_config, pstr_drc_config, sizeof(ia_drc_config) ))
{
pstr_drc_uni_sel_proc->drc_config = *pstr_drc_config;
pstr_drc_uni_sel_proc->drc_config_flag = 1;
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.base_channel_count != pstr_drc_uni_sel_proc->drc_config.channel_layout.base_channel_count)
{
@ -127,12 +127,12 @@ impd_drc_uni_sel_proc_process(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
&pstr_drc_uni_sel_proc->drc_config);
if (err) return (err);
}
if (pstr_drc_uni_sel_proc->drc_config_flag || pstr_drc_uni_sel_proc->loudness_info_set_flag || pstr_drc_uni_sel_proc->sel_proc_request_flag) {
WORD32 repeat_selection = 1;
WORD32 loop_cnt = 0;
err = impd_manage_drc_complexity (pstr_drc_uni_sel_proc, pstr_drc_config);
if (err) return(err);
err = impd_manage_eq_complexity (pstr_drc_uni_sel_proc, pstr_drc_config);
@ -145,44 +145,44 @@ impd_drc_uni_sel_proc_process(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
, &loudEqSetIdSelected
);
if (err) return (err);
err = impd_get_selected_drc_set(pstr_drc_uni_sel_proc,
drc_set_id_selected);
if (err) return (err);
err = impd_get_dependent_drc_set(pstr_drc_uni_sel_proc);
if (err) return (err);
err = impd_get_fading_drc_set(pstr_drc_uni_sel_proc);
if (err) return (err);
err = impd_get_ducking_drc_set(pstr_drc_uni_sel_proc);
if (err) return (err);
pstr_drc_uni_sel_proc->eq_inst_index[0] = -1;
pstr_drc_uni_sel_proc->eq_inst_index[1] = -1;
err = impd_get_selected_eq_set(pstr_drc_uni_sel_proc, eq_set_id_selected);
if (err) return (err);
err = impd_get_dependent_eq_set(pstr_drc_uni_sel_proc);
if (err) return (err);
err = impd_get_selected_loud_eq_set(pstr_drc_uni_sel_proc, loudEqSetIdSelected);
if (err) return (err);
activeDrcSetIndex = 0;
for (i=SUB_DRC_COUNT-1; i>=0; i--) {
for (i=SUB_DRC_COUNT-1; i>=0; i--) {
WORD32 drc_instructions_index = pstr_drc_uni_sel_proc->drc_instructions_index[i];
ia_drc_instructions_struct str_drc_instruction_str;
str_drc_instruction_str = pstr_drc_uni_sel_proc->drc_config.str_drc_instruction_str[drc_instructions_index];
if (drc_instructions_index >= 0 && str_drc_instruction_str.drc_set_id > 0)
if (drc_instructions_index >= 0 && str_drc_instruction_str.drc_set_id > 0)
{
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.sel_drc_set_ids[activeDrcSetIndex] = str_drc_instruction_str.drc_set_id;
if ((i==3) && (str_drc_instruction_str.drc_set_effect & (EFFECT_BIT_DUCK_SELF | EFFECT_BIT_DUCK_OTHER))) {
if ((i==3) && (str_drc_instruction_str.drc_set_effect & (EFFECT_BIT_DUCK_SELF | EFFECT_BIT_DUCK_OTHER))) {
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.sel_downmix_ids[activeDrcSetIndex] = 0;
}
else {
@ -192,25 +192,25 @@ impd_drc_uni_sel_proc_process(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.sel_downmix_ids[activeDrcSetIndex] = 0;
}
}
activeDrcSetIndex++;
}
}
if (activeDrcSetIndex <= 3)
{
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.num_sel_drc_sets = activeDrcSetIndex;
} else
{
} else
{
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.num_sel_drc_sets = -1;
return(UNEXPECTED_ERROR);
}
impd_sel_downmix_matrix(pstr_drc_uni_sel_proc,
&pstr_drc_uni_sel_proc->drc_config);
err = impd_manage_complexity (pstr_drc_uni_sel_proc, pstr_drc_config, &repeat_selection);
if (err) return(err);
loop_cnt++;
if (loop_cnt > 100)
{
@ -223,11 +223,11 @@ impd_drc_uni_sel_proc_process(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.compress = pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.compress;
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.drc_characteristic_target = pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.drc_characteristic_target;
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.loudness_normalization_gain_db += pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_norm_gain_modification_db;
}
for (i=0; i<2; i++)
for (i=0; i<2; i++)
{
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.sel_eq_set_ids[i] = pstr_drc_uni_sel_proc->drc_config.str_drc_config_ext.str_eq_instructions[pstr_drc_uni_sel_proc->eq_inst_index[i]].eq_set_id;
}
@ -240,16 +240,16 @@ impd_drc_uni_sel_proc_process(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.sel_loud_eq_id = 0;
}
*hia_drc_sel_proc_output_struct = pstr_drc_uni_sel_proc->uni_drc_sel_proc_output;
return 0;
}
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 i, dwnmix_instructions_count;
WORD32 target_ch_count_prelim = pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.base_channel_count;
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.num_downmix_id_requests = 0;
switch (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.target_config_request_type) {
case 0:
@ -324,19 +324,19 @@ VOID impd_sel_downmix_matrix(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
ia_drc_config* pstr_drc_config)
{
WORD32 i, j, n;
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.base_channel_count = pstr_drc_config->channel_layout.base_channel_count;
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.target_channel_count = pstr_drc_config->channel_layout.base_channel_count;
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.target_layout = -1;
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.downmix_matrix_present = 0;
pstr_drc_uni_sel_proc->downmix_inst_index_sel = -1;
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.active_downmix_id != 0) {
for (n=0; n<pstr_drc_config->dwnmix_instructions_count; n++) {
ia_downmix_instructions_struct* dwnmix_instructions = &(pstr_drc_config->dwnmix_instructions[n]);
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.active_downmix_id == dwnmix_instructions->downmix_id) {
pstr_drc_uni_sel_proc->downmix_inst_index_sel = n;
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.target_channel_count = dwnmix_instructions->target_channel_count;
@ -363,9 +363,9 @@ WORD32 impd_get_selected_eq_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
WORD32 eq_set_id_selected)
{
WORD32 n;
pstr_drc_uni_sel_proc->eq_inst_index_sel = -1;
if (eq_set_id_selected > 0)
{
for(n=0; n<pstr_drc_uni_sel_proc->drc_config.str_drc_config_ext.eq_instructions_count; n++)
@ -396,12 +396,12 @@ WORD32 impd_get_dependent_eq_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc)
if (pstr_drc_uni_sel_proc->eq_inst_index_sel >= 0)
{
str_eq_instructions = &(pstr_drc_uni_sel_proc->drc_config.str_drc_config_ext.str_eq_instructions[pstr_drc_uni_sel_proc->eq_inst_index_sel]);
if (str_eq_instructions->depends_on_eq_set_present == 1)
{
WORD32 n;
WORD32 dependsOnEqSetID = str_eq_instructions->depends_on_eq_set;
for(n=0; n<pstr_drc_uni_sel_proc->drc_config.str_drc_config_ext.eq_instructions_count; n++)
{
if (pstr_drc_uni_sel_proc->drc_config.str_drc_config_ext.str_eq_instructions[n].eq_set_id == dependsOnEqSetID) break;
@ -427,9 +427,9 @@ WORD32 impd_get_selected_loud_eq_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_pro
WORD32 loudEqSetIdSelected)
{
WORD32 n;
pstr_drc_uni_sel_proc->loud_eq_inst_index_sel = -1;
if (loudEqSetIdSelected > 0)
{
for(n=0; n<pstr_drc_uni_sel_proc->drc_config.str_drc_config_ext.loud_eq_instructions_count; n++)
@ -452,7 +452,7 @@ WORD32 impd_select_loud_eq(ia_drc_config* pstr_drc_config,
WORD32* loud_eq_id_sel)
{
WORD32 i, c, d, e;
*loud_eq_id_sel = 0;
for (i=0; i<pstr_drc_config->str_drc_config_ext.loud_eq_instructions_count; i++)
{
@ -478,7 +478,7 @@ WORD32 impd_select_loud_eq(ia_drc_config* pstr_drc_config,
}
return (0);
}
WORD32 impd_match_eq_set(ia_drc_config* drc_config,
WORD32 downmix_id,
WORD32 drc_set_id,
@ -493,7 +493,7 @@ WORD32 impd_match_eq_set(ia_drc_config* drc_config,
for (i=0; i<drc_config->str_drc_config_ext.eq_instructions_count; i++)
{
str_eq_instructions = &drc_config->str_drc_config_ext.str_eq_instructions[i];
if (str_eq_instructions->depends_on_eq_set_present == 0) {
if (str_eq_instructions->no_independent_eq_use == 1) continue;
}
@ -516,52 +516,52 @@ WORD32 impd_match_eq_set(ia_drc_config* drc_config,
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* selection_candidate_count,
ia_selection_candidate_info_struct* selection_candidate_info,
ia_selection_candidate_info_struct* selection_candidate_info_step_2
)
{
WORD32 i,j,k;
WORD32 match_found_flag;
WORD32 loop_cnt = 0;
WORD32 match_found_flag;
WORD32 loop_cnt = 0;
ia_eq_instructions_struct* str_eq_instructions = NULL;
match_found_flag = 0;
k = 0;
while ((k==0) && (loop_cnt < 2))
{
for (j=0; j < *selection_candidate_count; j++)
{
WORD32 eq_set_id_requested = selection_candidate_info[j].eq_set_id;
for (i=0; i<drc_config->str_drc_config_ext.eq_instructions_count; i++)
{
str_eq_instructions = &drc_config->str_drc_config_ext.str_eq_instructions[i];
if (str_eq_instructions->depends_on_eq_set_present == 0) {
if (eq_set_id_valid_flag[str_eq_instructions->eq_set_id] == 0) continue;
}
if (eq_set_id_valid_flag[str_eq_instructions->eq_set_id] == 0) continue;
if ((str_eq_instructions->eq_set_id == eq_set_id_requested) && (str_eq_instructions->eq_set_purpose & eq_set_purpose_requested))
{
match_found_flag = 1;
}
}
if (match_found_flag > 0)
{
memcpy(&selection_candidate_info_step_2[k], &selection_candidate_info[j], sizeof(ia_selection_candidate_info_struct));
k++;
}
}
eq_set_purpose_requested = EQ_PURPOSE_DEFAULT;
loop_cnt++;
}
if (k>0) {
memcpy(&selection_candidate_info[0], &selection_candidate_info_step_2[0], k * sizeof(ia_selection_candidate_info_struct));
*selection_candidate_count = k;
}
match_found_flag = 0;
k = 0;
while ((k==0) && (loop_cnt < 2))
{
for (j=0; j < *selection_candidate_count; j++)
{
WORD32 eq_set_id_requested = selection_candidate_info[j].eq_set_id;
for (i=0; i<drc_config->str_drc_config_ext.eq_instructions_count; i++)
{
str_eq_instructions = &drc_config->str_drc_config_ext.str_eq_instructions[i];
if (str_eq_instructions->depends_on_eq_set_present == 0) {
if (eq_set_id_valid_flag[str_eq_instructions->eq_set_id] == 0) continue;
}
if (eq_set_id_valid_flag[str_eq_instructions->eq_set_id] == 0) continue;
if ((str_eq_instructions->eq_set_id == eq_set_id_requested) && (str_eq_instructions->eq_set_purpose & eq_set_purpose_requested))
{
match_found_flag = 1;
}
}
if (match_found_flag > 0)
{
memcpy(&selection_candidate_info_step_2[k], &selection_candidate_info[j], sizeof(ia_selection_candidate_info_struct));
k++;
}
}
eq_set_purpose_requested = EQ_PURPOSE_DEFAULT;
loop_cnt++;
}
if (k>0) {
memcpy(&selection_candidate_info[0], &selection_candidate_info_step_2[0], k * sizeof(ia_selection_candidate_info_struct));
*selection_candidate_count = k;
}
return(0);
}
@ -623,7 +623,7 @@ VOID impd_select_drc_coeff3(ia_drc_config* drc_config,
*str_p_loc_drc_coefficients_uni_drc = &(drc_config->str_p_loc_drc_coefficients_uni_drc[cV0]);
}
else {
*str_p_loc_drc_coefficients_uni_drc = NULL;
*str_p_loc_drc_coefficients_uni_drc = NULL;
}
return;
}
@ -678,7 +678,7 @@ WORD32 impd_manage_drc_complexity (ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
}
}
complexityDrcPrelim =(FLOAT32)( channel_count * (1 << str_drc_instruction_str->drc_set_complexity_level));
if (str_drc_instruction_str->depends_on_drc_set > 0)
{
err = impd_find_drc_instructions_uni_drc(pstr_drc_config, str_drc_instruction_str->depends_on_drc_set, &drc_inst_uni_drc_dependent);
@ -713,7 +713,7 @@ WORD32 impd_manage_drc_complexity (ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
}
complexityDrcPrelim *= pstr_drc_config->sampling_rate / 48000.0f;
if ((complexityDrcPrelim <= complexitySupportedTotal) && (numBandsTooLarge == 0))
{
pstr_drc_uni_sel_proc->drc_set_id_valid_flag[str_drc_instruction_str->drc_set_id] = 1;
@ -721,7 +721,7 @@ WORD32 impd_manage_drc_complexity (ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
}
return (0);
}
WORD32 impd_manage_eq_complexity (ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
ia_drc_config* pstr_drc_config)
{
@ -733,14 +733,14 @@ WORD32 impd_manage_eq_complexity (ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
ia_drc_config* drc_config = &pstr_drc_uni_sel_proc->drc_config;
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct = &pstr_drc_uni_sel_proc->uni_drc_sel_proc_params;
FLOAT32 complexitySupportedTotal =(FLOAT32)( pow(2.0f, pstr_drc_uni_sel_proc->compl_level_supported_total));
for (n=0; n<drc_config->str_drc_config_ext.eq_instructions_count; n++)
{
ia_eq_instructions_struct* str_eq_instructions = &pstr_drc_config->str_drc_config_ext.str_eq_instructions[n];
eqChannelCountPrimary = pstr_drc_sel_proc_params_struct->base_channel_count;
eqChannelCountDependent = pstr_drc_sel_proc_params_struct->base_channel_count;
eqComplexityPrimary = 1 << str_eq_instructions->eq_set_complexity_level;
if (pstr_drc_uni_sel_proc->subband_domain_mode == SUBBAND_DOMAIN_MODE_OFF)
{
@ -824,10 +824,10 @@ WORD32 impd_manage_eq_complexity (ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
}
complexityTotalEq += eqChannelCountDependent * eqComplexityDependent;
}
pstr_drc_uni_sel_proc->eq_set_id_valid_flag[str_eq_instructions->eq_set_id] = 0;
complexityTotalEq *= pstr_drc_config->sampling_rate / 48000.0f;
if (complexityTotalEq <= complexitySupportedTotal)
{
pstr_drc_uni_sel_proc->eq_set_id_valid_flag[str_eq_instructions->eq_set_id] = 1;
@ -836,7 +836,7 @@ WORD32 impd_manage_eq_complexity (ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
return 0;
}
WORD32 impd_manage_complexity (ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
ia_drc_config* pstr_drc_config,
WORD32* repeat_selection)
@ -857,7 +857,7 @@ WORD32 impd_manage_complexity (ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
impd_select_drc_coeff3(pstr_drc_config, &str_p_loc_drc_coefficients_uni_drc);
for (p=0; p<4; p++)
for (p=0; p<4; p++)
{
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.sel_drc_set_ids[p] <= 0) continue;
err = impd_find_drc_instructions_uni_drc(pstr_drc_config, pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.sel_drc_set_ids[p], &str_drc_instruction_str);
@ -878,12 +878,12 @@ WORD32 impd_manage_complexity (ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
ia_gain_set_params_struct* gain_set_params = &(str_p_loc_drc_coefficients_uni_drc->gain_set_params[str_drc_instruction_str->gain_set_index_for_channel_group[j]]);
if (gain_set_params->band_count > pstr_drc_sel_proc_params_struct->num_bands_supported)
{
if (p<2)
{
if (p<2)
{
numBandsTooLarge = 1;
}
else
{
else
{
pstr_drc_uni_sel_proc->drc_set_id_valid_flag[str_drc_instruction_str->drc_set_id] = 0;
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.sel_drc_set_ids[p] = 0;
}
@ -899,7 +899,7 @@ WORD32 impd_manage_complexity (ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
}
complexityDrcTotal += channel_count * (1 << str_drc_instruction_str->drc_set_complexity_level);
}
if (uni_drc_sel_proc_output->active_downmix_id > 0)
{
FLOAT32 complexityPerCoeff;
@ -932,7 +932,7 @@ WORD32 impd_manage_complexity (ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
/* add standard downmix here */
}
}
for (p=0; p<2; p++)
{
if(pstr_drc_uni_sel_proc->eq_inst_index[p] >= 0)
@ -946,7 +946,7 @@ WORD32 impd_manage_complexity (ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
{
channel_count = uni_drc_sel_proc_output->target_channel_count;
}
complexityEq =(FLOAT32)(1 << str_eq_instructions->eq_set_complexity_level);
if (pstr_drc_uni_sel_proc->subband_domain_mode == SUBBAND_DOMAIN_MODE_OFF)
{
@ -966,17 +966,17 @@ WORD32 impd_manage_complexity (ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
complexityEqTotal += channel_count * complexityEq;
}
}
complexityDrcTotal *= freqNorm;
complexityEqTotal *= freqNorm;
if (numBandsTooLarge == 1)
{
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.sel_drc_set_ids[0] > 0)
{
err = impd_find_drc_instructions_uni_drc(pstr_drc_config, pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.sel_drc_set_ids[0], &str_drc_instruction_str);
if (err) return (err);
pstr_drc_uni_sel_proc->drc_set_id_valid_flag[str_drc_instruction_str->drc_set_id] = 0;
}
*repeat_selection = 1;
@ -990,7 +990,7 @@ WORD32 impd_manage_complexity (ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
else
{
drcRequiresEq = 0;
for (p=0; p<2; p++)
for (p=0; p<2; p++)
{
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.sel_drc_set_ids[p] <= 0) continue;
err = impd_find_drc_instructions_uni_drc(pstr_drc_config, pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.sel_drc_set_ids[p], &str_drc_instruction_str);
@ -1014,13 +1014,13 @@ WORD32 impd_manage_complexity (ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
{
err = impd_find_drc_instructions_uni_drc(pstr_drc_config, pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.sel_drc_set_ids[0], &str_drc_instruction_str);
if (err) return (err);
pstr_drc_uni_sel_proc->drc_set_id_valid_flag[str_drc_instruction_str->drc_set_id] = 0;
}
else
{
for (p=2; p<4; p++)
{
for (p=2; p<4; p++)
{
pstr_drc_uni_sel_proc->drc_set_id_valid_flag[str_drc_instruction_str->drc_set_id] = 0;
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.sel_drc_set_ids[p] = 0;
}
@ -1050,8 +1050,8 @@ WORD32 impd_find_loud_eq_instructions_idx_for_id(ia_drc_config* drc_config,
{
if (drc_config->str_drc_config_ext.loud_eq_instructions[i].loud_eq_set_id == loud_eq_set_id_requested) break;
}
if (i == drc_config->str_drc_config_ext.loud_eq_instructions_count)
{
if (i == drc_config->str_drc_config_ext.loud_eq_instructions_count)
{
return (UNEXPECTED_ERROR);
}
*instructions_idx = i;
@ -1063,7 +1063,7 @@ WORD32 impd_find_loud_eq_instructions_idx_for_id(ia_drc_config* drc_config,
return (0);
}
WORD32 impd_find_eq_instructions(ia_drc_config* drc_config,
WORD32 eq_set_id_requested,
ia_eq_instructions_struct** str_eq_instructions)
@ -1073,8 +1073,8 @@ WORD32 impd_find_eq_instructions(ia_drc_config* drc_config,
{
if (eq_set_id_requested == drc_config->str_drc_config_ext.str_eq_instructions[i].eq_set_id) break;
}
if (i == drc_config->str_drc_config_ext.eq_instructions_count)
{
if (i == drc_config->str_drc_config_ext.eq_instructions_count)
{
return (UNEXPECTED_ERROR);
}
*str_eq_instructions = &drc_config->str_drc_config_ext.str_eq_instructions[i];
@ -1090,12 +1090,11 @@ WORD32 impd_find_downmix(ia_drc_config* drc_config,
{
if (requested_dwnmix_id == drc_config->dwnmix_instructions[i].downmix_id) break;
}
if (i == drc_config->dwnmix_instructions_count)
{
if (i == drc_config->dwnmix_instructions_count)
{
return (UNEXPECTED_ERROR);
}
*dwnmix_instructions = &drc_config->dwnmix_instructions[i];
return (0);
}

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_SECLECTION_PROCESS_H
#define IMPD_DRC_SECLECTION_PROCESS_H
@ -43,20 +43,20 @@ extern "C" {
typedef struct ia_drc_sel_proc_params_struct
{
WORD32 base_channel_count;
WORD32 base_layout;
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_deviation_max;
WORD32 loudness_measurement_method;
WORD32 loudness_measurement_system;
WORD32 loudness_measurement_pre_proc;
@ -64,7 +64,7 @@ typedef struct ia_drc_sel_proc_params_struct
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;
@ -78,56 +78,56 @@ typedef struct ia_drc_sel_proc_params_struct
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;
FLOAT32 boost;
FLOAT32 compress;
WORD32 drc_characteristic_target;
} ia_drc_sel_proc_params_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 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_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_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;
FLOAT32 compl_level_supported_total;
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);
VOID impd_sel_downmix_matrix(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
ia_drc_config* pstr_drc_config);
WORD32
impd_find_drc_instructions_uni_drc(ia_drc_config* drc_config,
WORD32 drc_set_id_requested,
@ -142,22 +142,22 @@ impd_find_downmix(ia_drc_config* drc_config,
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
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
WORD32
impd_select_loud_eq(ia_drc_config* pstr_drc_config,
WORD32 requested_dwnmix_id,
WORD32 drc_set_id_requested,
@ -169,7 +169,7 @@ 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,
@ -181,7 +181,7 @@ impd_find_loud_eq_instructions_idx_for_id(ia_drc_config* drc_config,
WORD32 loud_eq_set_id_requested,
WORD32* instructions_idx);
#ifdef __cplusplus
}

File diff suppressed because it is too large Load diff

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -30,14 +30,14 @@
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->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.peak_limiter = 0;
@ -51,7 +51,7 @@ WORD32 impd_drc_sel_proc_init_dflt(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc)
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_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) {
@ -59,26 +59,26 @@ WORD32 impd_drc_sel_proc_init_dflt(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc)
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.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.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->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->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;
@ -87,30 +87,30 @@ WORD32 impd_drc_sel_proc_init_dflt(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc)
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->eq_inst_index[0] = -1;
pstr_drc_uni_sel_proc->eq_inst_index[1] = -1;
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;
}
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;
}
}
return 0;
}
WORD32
@ -118,9 +118,9 @@ impd_drc_sel_proc_init_interface_params(ia_drc_sel_pro_struct* pstr_drc_uni_sel_
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;
@ -289,7 +289,7 @@ impd_drc_sel_proc_init_interface_params(ia_drc_sel_pro_struct* pstr_drc_uni_sel_
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
}
break;
}
}
}
}
}
@ -328,9 +328,9 @@ impd_drc_sel_proc_init_interface_params(ia_drc_sel_pro_struct* pstr_drc_uni_sel_
}
}
}
return 0;
}

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
@ -40,8 +40,8 @@
WORD32 impd_shape_filt_block_adapt(const FLOAT32 drc_gain,
shape_filter_block* shape_filter_block)
{
// WORD32 err = 0;
WORD32 i;
// WORD32 err = 0;
WORD32 i;
FLOAT32 warpedGain, x1, y1;
shape_filter_block->drc_gain_last = drc_gain;
for (i=0; i<4; i++) {
@ -50,9 +50,9 @@ WORD32 impd_shape_filt_block_adapt(const FLOAT32 drc_gain,
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)
if (drc_gain < 1.0f)
warpedGain = -1.0f;
else
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;
}
@ -60,12 +60,12 @@ WORD32 impd_shape_filt_block_adapt(const FLOAT32 drc_gain,
{
if (drc_gain >= 1.0f)
warpedGain = -1.0f;
else
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 (warpedGain <= 0.0f)
{
y1 = x1;
@ -117,25 +117,25 @@ WORD32 resetshape_flter_block(shape_filter_block* shape_filter_block)
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 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;
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];
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
{
@ -147,11 +147,11 @@ WORD32 impd_shape_filt_block_init(ia_shape_filter_block_params_struct* shape_flt
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];
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
{
@ -172,30 +172,30 @@ WORD32 impd_shape_filt_block_init(ia_shape_filter_block_params_struct* shape_flt
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;
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;
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;
shape_filter_block->shape_filter[3].a2 = x2;
}
else
{
@ -215,7 +215,7 @@ WORD32 impd_shape_filt_block_time_process(shape_filter_block* shape_filter_block
WORD32 start,
WORD32 end)
{
WORD32 i,j, err=0;
WORD32 i,j, err=0;
FLOAT32 audio_out;
if(shape_filter_block->shape_flter_block_flag){
@ -224,42 +224,42 @@ WORD32 impd_shape_filt_block_time_process(shape_filter_block* shape_filter_block
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]
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]
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;
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];
audio_in[i] = audio_in[i] * drc_gain[i];
}
}
return err;
return err;
}

File diff suppressed because it is too large Load diff

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_STURCT_H
#define IMPD_DRC_STURCT_H
@ -59,7 +59,7 @@ extern "C"
#define EFFECT_BIT_COUNT 12
#define EFFECT_BIT_NONE (-1)
#define EFFECT_BIT_NONE (-1)
#define EFFECT_BIT_NIGHT 0x0001
#define EFFECT_BIT_NOISY 0x0002
#define EFFECT_BIT_LIMITED 0x0004
@ -100,9 +100,9 @@ extern "C"
#define USER_LOUDNESS_PREPROCESSING_DEFAULT 0
#define USER_LOUDNESS_PREPROCESSING_OFF 1
#define USER_LOUDNESS_PREPROCESSING_HIGHPASS 2
#define LOUDNESS_DEVIATION_MAX_DEFAULT 63
#define LOUDNESS_NORMALIZATION_GAIN_MAX_DEFAULT 1000
#define LOUDNESS_NORMALIZATION_GAIN_MAX_DEFAULT 1000
#define SHORT_TERM_LOUDNESS_TO_AVG 0
#define MOMENTARY_LOUDNESS_TO_AVG 1
@ -110,7 +110,7 @@ extern "C"
#define DRC_COMPLEXITY_LEVEL_MAX 0xF
#define EQ_COMPLEXITY_LEVEL_MAX 0xF
#define COMPLEXITY_LEVEL_SUPPORTED_TOTAL 20.0f
#define COMPLEXITY_LEVEL_SUPPORTED_TOTAL 20.0f
#define COMPLEXITY_W_SUBBAND_EQ 2.5f
#define COMPLEXITY_W_FIR 0.4f
@ -125,14 +125,14 @@ extern "C"
#define COMPLEXITY_W_PARAM_DRC_SUBBAND 5.0f
#define COMPLEXITY_W_PARAM_LIM_FILT 4.5f
#define COMPLEXITY_W_PARAM_DRC_ATTACK 136.0f
#define LEFT_SIDE 0
#define RIGHT_SIDE 1
#define CHARACTERISTIC_SIGMOID 0
#define CHARACTERISTIC_NODES 1
#define CHARACTERISTIC_PASS_THRU 2
#define GAINFORMAT_QMF32 0x1
#define GAINFORMAT_QMFHYBRID39 0x2
#define GAINFORMAT_QMF64 0x3
@ -140,17 +140,17 @@ extern "C"
#define GAINFORMAT_QMF128 0x5
#define GAINFORMAT_QMFHYBRID135 0x6
#define GAINFORMAT_UNIFORM 0x7
#define DRC_INPUT_LOUDNESS_TARGET (-31.0f)
#define DRC_INPUT_LOUDNESS_TARGET (-31.0f)
#define SHAPE_FILTER_TYPE_OFF 0
#define SHAPE_FILTER_TYPE_LF_CUT 1
#define SHAPE_FILTER_TYPE_LF_BOOST 2
#define SHAPE_FILTER_TYPE_HF_CUT 3
#define SHAPE_FILTER_TYPE_HF_BOOST 4
#define SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE 1583.8931924611f
#define SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE 1583.8931924611f
typedef struct {
WORD32 type;
FLOAT32 gain_offset;
@ -196,10 +196,10 @@ typedef struct {
WORD32 gain_smooth_rel_threshold;
WORD32 gain_smooth_hold_off_count_present;
WORD32 gain_smooth_hold_off;
WORD32 disable_paramteric_drc;
} ia_parametric_drc_type_feed_forward_struct;
typedef struct {
WORD32 parametric_lim_threshold_present;
FLOAT32 parametric_lim_threshold;
@ -207,7 +207,7 @@ typedef struct {
WORD32 parametric_lim_release_present;
WORD32 parametric_lim_release;
WORD32 drc_characteristic;
WORD32 disable_paramteric_drc;
} ia_parametric_drc_lim_struct;
@ -221,7 +221,7 @@ typedef struct {
WORD32 len_bit_size;
ia_parametric_drc_type_feed_forward_struct str_parametric_drc_type_feed_forward;
ia_parametric_drc_lim_struct parametric_drc_lim;
WORD32 drc_characteristic;
WORD32 disable_paramteric_drc;
} ia_parametric_drc_instructions_struct;
@ -234,7 +234,7 @@ typedef struct {
FLOAT32 level_estim_ch_weight[MAX_CHANNEL_COUNT];
WORD32 drc_input_loudness_present;
FLOAT32 drc_input_loudness;
WORD32 ch_count_from_dwnmix_id;
} ia_parametric_drc_gain_set_params_struct;
@ -248,7 +248,7 @@ typedef struct {
WORD32 parametric_drc_gain_set_count;
ia_parametric_drc_gain_set_params_struct str_parametric_drc_gain_set_params[SEQUENCE_COUNT_MAX];
} ia_drc_coeff_parametric_drc_struct;
typedef struct {
WORD32 base_channel_count;
WORD32 layout_signaling_present;
@ -305,12 +305,12 @@ typedef struct {
WORD32 band_count;
WORD32 drc_band_type;
ia_gain_params_struct gain_params[BAND_COUNT_MAX];
WORD32 num_gain_max_values;
ia_tables_struct str_tables;
} ia_gain_set_params_struct;
#define SPLIT_CHARACTERISTIC_NODE_COUNT_MAX 4
#define SPLIT_CHARACTERISTIC_NODE_COUNT_MAX 4
typedef struct {
WORD32 characteristic_format;
FLOAT32 in_out_ratio;
@ -337,7 +337,7 @@ typedef struct {
WORD32 hf_boost_filter_present;
ia_shape_filter_params_struct str_hf_boost_params;
} ia_shape_filter_block_params_struct;
typedef struct {
WORD32 drc_location;
WORD32 drc_characteristic;
@ -362,7 +362,7 @@ typedef struct {
WORD32 gain_sequence_count;
WORD32 gain_set_params_index_for_gain_sequence[SEQUENCE_COUNT_MAX];
WORD32 gain_set_count_plus;
} ia_uni_drc_coeffs_struct;
typedef struct {
@ -400,8 +400,8 @@ typedef struct {
WORD32 drc_set_target_loudness_value_upper;
WORD32 drc_set_target_loudness_value_lower_present;
WORD32 drc_set_target_loudness_value_lower;
WORD32 audio_num_chan;
WORD32 audio_num_chan;
WORD32 num_drc_ch_groups;
WORD32 gain_set_index_for_channel_group[CHANNEL_GROUP_COUNT_MAX];
WORD32 band_count_of_ch_group[CHANNEL_GROUP_COUNT_MAX];
@ -411,8 +411,8 @@ typedef struct {
ia_ducking_modifiers_struct str_ducking_modifiers_for_channel_group[CHANNEL_GROUP_COUNT_MAX];
WORD32 channel_group_of_ch[MAX_CHANNEL_COUNT];
WORD32 num_chan_per_ch_group[CHANNEL_GROUP_COUNT_MAX];
WORD32 gain_element_count;
WORD32 multiband_audio_sig_count;
WORD32 gain_element_count;
WORD32 multiband_audio_sig_count;
WORD32 ch_group_parametric_drc_flag[CHANNEL_GROUP_COUNT_MAX];
WORD32 gain_set_idx_of_ch_group_parametric_drc[CHANNEL_GROUP_COUNT_MAX];
WORD32 parametric_drc_look_ahead_samples[CHANNEL_GROUP_COUNT_MAX];
@ -439,7 +439,7 @@ typedef struct {
WORD32 measurement_count;
ia_loudness_measure_struct loudness_measure[MEASUREMENT_COUNT_MAX];
} ia_loudness_info_struct;
typedef struct {
WORD32 loud_eq_set_id;
WORD32 drc_location;
@ -558,7 +558,7 @@ typedef struct {
typedef struct {
WORD32 drc_config_ext_type[EXT_COUNT_MAX];
WORD32 ext_bit_size[EXT_COUNT_MAX-1];
WORD32 parametric_drc_present;
ia_drc_coeff_parametric_drc_struct str_drc_coeff_param_drc;
WORD32 parametric_drc_instructions_count;
@ -579,7 +579,7 @@ typedef struct ia_drc_config{
WORD32 dwnmix_instructions_count;
WORD32 drc_coefficients_drc_count;
WORD32 drc_instructions_uni_drc_count;
WORD32 drc_instructions_count_plus;
WORD32 drc_instructions_count_plus;
WORD32 drc_description_basic_present;
WORD32 drc_coefficients_basic_count;
WORD32 drc_instructions_basic_count;
@ -641,16 +641,16 @@ typedef struct {
WORD32 drc_frame_size;
WORD32 num_gain_values_max_default;
WORD32 delay_mode;
WORD32 lfe_channel_map_count;
WORD32 lfe_channel_map_count;
WORD32 lfe_channel_map[MAX_CHANNEL_COUNT];
} ia_drc_params_bs_dec_struct;
typedef struct ia_drc_bits_dec_struct
{
ia_tables_struct tables_default;
ia_drc_params_bs_dec_struct ia_drc_params_struct;
}ia_drc_bits_dec_struct;

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <stdio.h>
#include <math.h>
@ -26,7 +26,7 @@
#include "impd_drc_struct.h"
#include "impd_drc_filter_bank.h"
#include "impd_drc_rom.h"
WORD32 impd_init_tbls(const WORD32 num_gain_max_values,
ia_tables_struct* str_tables)
{
@ -74,8 +74,8 @@ impd_gen_delta_time_code_tbl (const WORD32 num_gain_max_values,
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].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;
@ -114,7 +114,7 @@ impd_get_delta_tmin (const WORD32 sampling_rate)
while (result <= lowerBound) result = result << 1;
return result;
}

View file

@ -1,42 +1,42 @@
/******************************************************************************
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#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},
{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

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_UNI_BITSTREAM_DEC_API_H
#define IMPD_DRC_UNI_BITSTREAM_DEC_API_H
@ -25,38 +25,38 @@ WORD32 impd_init_drc_bitstream_dec(ia_drc_bits_dec_struct* p_uni_drc_bs_dec_stru
WORD32 sample_rate,
WORD32 frame_size,
WORD32 delay_mode,
WORD32 lfe_channel_map_count,
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_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_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_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,
ia_bit_buf_struct* it_bit_buff,
ia_drc_loudness_info_set_struct* pstr_loudness_info,
UWORD8* bitstream_loudness,
WORD32 num_bytes_loudness
WORD32 num_bytes_loudness
);
#endif

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_UNI_COMMON_H
#define IMPD_DRC_UNI_COMMON_H
@ -28,40 +28,40 @@ extern "C"
#define AMD1_SYNTAX 0
#define MPEG_D_DRC_EXTENSION_V1 0
#define AMD1_PARAMETRIC_LIMITER 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 DRC_GAIN_DEBUG_FILE 0
#define DEBUG_BITSTREAM 0
#define DEBUG_DRC_SELECTION 0
#define DEBUG_WARNINGS 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 SPEAKER_POS_COUNT_MAX 128
#define DOWNMIX_COEFF_COUNT_MAX 32*32
#define DOWNMIX_COEFF_COUNT_MAX 32*32
#define MAX_CHANNEL_COUNT 128
#define BAND_COUNT_MAX 8
#define SEQUENCE_COUNT_MAX 24
#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 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 MAX_SIGNAL_DELAY 4500
#define DELAY_MODE_REGULAR_DELAY 0
#define DELAY_MODE_LOW_DELAY 1
@ -69,7 +69,7 @@ extern "C"
#define FEATURE_REQUEST_COUNT_MAX 10
#define EFFECT_TYPE_REQUEST_COUNT_MAX 10
#define SELECTION_CANDIDATE_COUNT_MAX 32
#define PROC_COMPLETE 1
@ -85,11 +85,11 @@ extern "C"
#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_SELECTED LOCATION_MP4_INSTREAM_UNIDRC
#define AUDIO_CODEC_SUBBAND_COUNT_MAX 256
@ -97,19 +97,19 @@ extern "C"
#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_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 MAX_NUM_DOWNMIX_ID_REQUESTS 15
#define MAX_NUM_DRC_FEATURE_REQUESTS 7
#define MAX_NUM_DRC_EFFECT_TYPE_REQUESTS 15
@ -121,12 +121,12 @@ extern "C"
#define UNIDRCCONFEXT_TERM 0x0
#define UNIDRCINTERFACEEXT_TERM 0x0
#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))
@ -138,17 +138,17 @@ extern "C"
#ifndef bool
#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;
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;
@ -159,7 +159,7 @@ typedef struct ia_drc_sel_proc_output_struct
FLOAT32 boost;
FLOAT32 compress;
WORD32 drc_characteristic_target;
} ia_drc_sel_proc_output_struct;

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_UNI_DEC_H
#define IMPD_DRC_UNI_DEC_H
@ -28,7 +28,7 @@ extern "C"
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,

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_UNI_EQ_H
#define IMPD_DRC_UNI_EQ_H

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_UNI_GAIN_DEC_H
#define IMPD_DRC_UNI_GAIN_DEC_H

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_UNI_INTERFACE_H
#define IMPD_DRC_UNI_INTERFACE_H
@ -60,7 +60,7 @@ typedef struct {
WORD32 album_mode;
WORD32 peak_limiter;
WORD32 change_loudness_deviation_max;
WORD32 loudness_deviation_max;
WORD32 loudness_deviation_max;
WORD32 change_loudness_measur_method;
WORD32 loudness_measurement_method;
WORD32 change_loudness_measur_system;

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_UNI_LOUD_EQ_H
#define IMPD_DRC_UNI_LOUD_EQ_H
@ -25,7 +25,7 @@
extern "C"
{
#endif
#ifdef __cplusplus
}
#endif

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_UNI_MULTI_BAND_H
#define IMPD_DRC_UNI_MULTI_BAND_H

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_UNI_PARSER_H
#define IMPD_DRC_UNI_PARSER_H
@ -34,7 +34,7 @@ impd_parse_loudness_info(ia_bit_buf_struct* it_bit_buff,
WORD32
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,
@ -73,10 +73,10 @@ impd_parse_dwnmix_instructions(ia_bit_buf_struct* it_bit_buff,
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_bit_buf_struct* it_bit_buff,
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
ia_drc_config* drc_config
);
@ -88,7 +88,7 @@ impd_parse_loudness_info_set(ia_bit_buf_struct* it_bit_buff,
WORD32
impd_parse_drc_gain_sequence(
ia_bit_buf_struct* it_bit_buff,
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);
@ -98,7 +98,7 @@ 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_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);

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_UNI_PROCESS_AUDIO_H
#define IMPD_DRC_UNI_PROCESS_AUDIO_H

View file

@ -1,33 +1,33 @@
/******************************************************************************
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_UNI_SEL_PROC_DRC_SET_SEL_H
#define IMPD_DRC_UNI_SEL_PROC_DRC_SET_SEL_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#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;
@ -42,7 +42,7 @@ typedef struct {
WORD32
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);
@ -65,7 +65,7 @@ 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,
@ -90,8 +90,8 @@ impd_match_effect_types(ia_drc_config* pstr_drc_config,
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,
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);
@ -107,7 +107,7 @@ 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);
@ -128,11 +128,11 @@ WORD32 impd_drc_set_final_selection(ia_drc_config* pstr_drc_config,
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* 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

View file

@ -1,29 +1,29 @@
/******************************************************************************
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_UNI_SEL_PROC_INIT_H
#define IMPD_DRC_UNI_SEL_PROC_INIT_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
WORD32
impd_drc_sel_proc_init_dflt(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc);
@ -34,7 +34,7 @@ impd_drc_sel_proc_init_sel_proc_params(ia_drc_sel_pro_struct* pstr_drc_uni_sel_p
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);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_UNI_SEL_PROC_LOUDNESS_CONTROL_H
#define IMPD_DRC_UNI_SEL_PROC_LOUDNESS_CONTROL_H

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_UNI_SHAPE_FILTER_H
#define IMPD_DRC_UNI_SHAPE_FILTER_H

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_DRC_UNI_TABLES_H
#define IMPD_DRC_UNI_TABLES_H
@ -49,7 +49,7 @@ typedef struct {
typedef struct {
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;
@ -65,7 +65,7 @@ typedef struct {
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);

View file

@ -1,21 +1,21 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_ERROR_HANDLER_H
@ -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 */
@ -65,9 +65,9 @@
/*****************************************************************************/
typedef struct
{
pWORD8 pb_module_name;
pWORD8 ppb_class_names[16];
WORD8 **ppppb_error_msg_pointers[2][16];
pWORD8 pb_module_name;
pWORD8 ppb_class_names[16];
WORD8 **ppppb_error_msg_pointers[2][16];
} ia_error_info_struct;
/*****************************************************************************/
@ -75,8 +75,8 @@ 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);
IA_ERRORCODE ia_error_handler(ia_error_info_struct *p_mod_err_info,
WORD8 *pb_context, IA_ERRORCODE code);
/*****************************************************************************/
/* Macro functions */
@ -84,11 +84,11 @@ IA_ERRORCODE ia_error_handler(ia_error_info_struct *p_mod_err_info,
/* 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); \
}
if((e) != IA_NO_ERROR) \
{ \
ia_error_handler((p_mod_err_info), (context), (e)); \
if((e) & IA_FATAL_ERROR) \
return (e); \
}
#endif

View file

@ -1,21 +1,21 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_ERROR_STANDARDS_H
@ -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__ */

View file

@ -1,21 +1,21 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_MEMORY_STANDARDS_H
@ -25,85 +25,85 @@
/* Type definitions */
/*****************************************************************************/
/* standard memory table descriptor for libraries */
typedef 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 */
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

View file

@ -1,22 +1,22 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_PARAMETRIC_DRC_DEC_H
#define IMPD_PARAMETRIC_DRC_DEC_H
@ -26,18 +26,18 @@
extern "C"
{
#endif
typedef struct ia_2nd_order_filt_coeff_struct_t {
typedef struct ia_2nd_order_filt_coeff_struct_t {
FLOAT32 b0, b1, b2;
FLOAT32 a1, a2;
} ia_2nd_order_filt_coeff_struct;
typedef struct ia_2nd_order_filt_state_struct_t {
typedef struct ia_2nd_order_filt_state_struct_t {
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;
@ -59,11 +59,11 @@ typedef struct ia_parametric_drc_type_ff_params_struct_t {
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];
FLOAT32 gain_smooth_attack_alpha_slow;
FLOAT32 gain_smooth_rel_alpha_slow;
FLOAT32 gain_smooth_attack_alpha_fast;
@ -74,15 +74,15 @@ typedef struct ia_parametric_drc_type_ff_params_struct_t {
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];
UWORD32 attack;
FLOAT32 attack_constant;
FLOAT32 release_constant;
@ -101,9 +101,9 @@ typedef struct ia_parametric_drc_type_lim_params_struct_t {
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;
@ -111,8 +111,8 @@ typedef struct ia_parametric_drc_instance_params_struct_t {
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 {
typedef struct ia_parametric_drc_params_struct_t {
WORD32 sampling_rate;
WORD32 audio_num_chan;
WORD32 sub_band_domain_mode;
@ -123,34 +123,34 @@ typedef struct ia_parametric_drc_params_struct_t {
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 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_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);
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);
WORD32
impd_init_lvl_est_filt_subband( WORD32 level_estim_k_weighting_type,
WORD32 sampling_rate,
@ -160,14 +160,14 @@ impd_init_lvl_est_filt_subband( WORD32 level_estim_k_weighting_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);
WORD32
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[],
@ -175,7 +175,7 @@ impd_parametric_drc_instance_process (FLOAT32*
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[],

View file

@ -1,28 +1,28 @@
/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_TYPE_DEF_H
#define IMPD_TYPE_DEF_H
/****************************************************************************/
/* types type define prefix examples bytes */
/* types type define prefix examples bytes */
/************************ *********** ****** **************** ***** */
typedef char CHAR8 ;/* c CHAR8 c_name 1 */
typedef char * pCHAR8 ;/* pc pCHAR8 pc_nmae 1 */
@ -30,78 +30,78 @@ 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 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 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 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 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 FLOAT32 ;/* f FLOAT32 f_count 4 */
typedef float * pFLOAT32;/* pf pFLOAT32 pf_count 4 */
typedef double FLOAT64 ;/* d UFLOAT64 d_count 8 */
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 unsigned int UBOOL ;/* ubool BOOL ubool_true */
typedef signed int FLAG ;/* flag FLAG flag_false */
typedef unsigned int UFLAG ;/* uflag FLAG uflag_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 unsigned int ULOOPIDX;/* ulp SLOOPIDX ulp_index */
typedef signed int WORD ;/* lp LOOPIDX lp_index */
typedef unsigned int UWORD ;/* ulp SLOOPIDX ulp_index */
typedef unsigned int UWORD ;/* ulp SLOOPIDX ulp_index */
typedef LOOPIDX LOOPINDEX; /* lp LOOPIDX lp_index */
typedef ULOOPIDX ULOOPINDEX;/* ulp SLOOPIDX ulp_index */

View file

@ -26,35 +26,39 @@
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_CHANNEL_MASK 0x0003
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_CHANNEL_MODE 0x0004
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_SBR_MODE 0x0005
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_EFFECT_TYPE 0x0006
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_TARGET_LOUDNESS 0x0007
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_LOUD_NORM 0x0008
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_DOWNMIX 0x0006
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_OUT08KHZ 0x0007
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_OUT16KHZ 0x0008
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_TOSTEREO 0x0009
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_DSAMPLE 0x000A
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_FRAMEOK 0x000B
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_ISMP4 0x000C
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_MAX_CHANNEL 0x000D
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_COUP_CHANNEL 0x000E
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_DOWNMIX_STEREO 0x000F
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_DISABLE_SYNC 0x0010
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_AUTO_SBR_UPSAMPLE 0x0011
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_ISLOAS 0x0012
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_ENABLE 0x0013
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_CUT 0x0014
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_BOOST 0x0015
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_TARGET_LEVEL 0x0016
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_HEAVY_COMP 0x0017
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_FRAMESIZE 0x0018
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_ELD_SBR_PRESENT 0x0019
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_DOWNMIX 0x0009
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_OUT08KHZ 0x000A
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_OUT16KHZ 0x000B
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_TOSTEREO 0x000C
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_DSAMPLE 0x000D
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_FRAMEOK 0x000E
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_ISMP4 0x000F
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_MAX_CHANNEL 0x0010
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_COUP_CHANNEL 0x0011
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_DOWNMIX_STEREO 0x0012
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_DISABLE_SYNC 0x0013
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_AUTO_SBR_UPSAMPLE 0x0014
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_ISLOAS 0x0015
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_ENABLE 0x0016
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_CUT 0x0017
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_BOOST 0x0018
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_TARGET_LEVEL 0x0019
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_HEAVY_COMP 0x001A
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_FRAMESIZE 0x001B
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_ELD_SBR_PRESENT 0x001C
#define IA_ENHAACPLUS_DEC_CONFIG_PARAM_LD_TESTING 0x001D
#ifdef ENABLE_DRC
#define IA_ENHAACPLUS_DEC_CONFIG_EXT_ELE_PTR 0x001A
#define IA_ENHAACPLUS_DEC_CONFIG_EXT_ELE_BUF_SIZES 0x001B
#define IA_ENHAACPLUS_DEC_CONFIG_NUM_ELE 0x001C
#define IA_ENHAACPLUS_DEC_CONFIG_NUM_CONFIG_EXT 0x001D
#define IA_ENHAACPLUS_DEC_CONFIG_GAIN_PAYLOAD_LEN 0x001E
#define IA_ENHAACPLUS_DEC_CONFIG_GAIN_PAYLOAD_BUF 0x001F
#endif
#define IA_ENHAACPLUS_DEC_CONFIG_EXT_ELE_PTR 0x001E
#define IA_ENHAACPLUS_DEC_CONFIG_EXT_ELE_BUF_SIZES 0x001F
#define IA_ENHAACPLUS_DEC_CONFIG_NUM_ELE 0x0020
#define IA_ENHAACPLUS_DEC_CONFIG_NUM_CONFIG_EXT 0x0021
#define IA_ENHAACPLUS_DEC_CONFIG_GAIN_PAYLOAD_LEN 0x0022
#define IA_ENHAACPLUS_DEC_CONFIG_GAIN_PAYLOAD_BUF 0x0023
#define IA_ENHAACPLUS_DEC_DRC_EFFECT_TYPE 0x0024
#define IA_ENHAACPLUS_DEC_DRC_TARGET_LOUDNESS 0x0025
#endif /* IXHEAACD_AAC_CONFIG_H */

View file

@ -78,7 +78,7 @@ static PLATFORM_INLINE WORD32 ixheaacd_shr32_drc(WORD32 a, WORD32 b) {
else
out_val = 0;
} else {
a += (1 << (b - 1));
a = ixheaacd_add32_sat(a,(1 << (b - 1)));
out_val = (WORD32)a >> b;
}
@ -786,327 +786,6 @@ VOID ixheaacd_post_twid_overlap_add_dec(
}
}
VOID ixheaacd_post_twid_overlap_add_armv8(
WORD16 pcm_out[], WORD32 spec_data[],
ia_aac_dec_imdct_tables_struct *ptr_imdct_tables, WORD npoints,
WORD32 *ptr_overlap_buf, WORD16 q_shift, const WORD16 *window,
WORD16 ch_fac) {
WORD i;
WORD16 cos, cos1, sin, sin1;
WORD32 size = npoints / 2;
WORD16 *pcmout1 = pcm_out + (ch_fac * size);
const WORD16 *cos_sin_ptr = ptr_imdct_tables->cosine_array_2048_256p;
pcm_out = pcmout1 - ch_fac;
spec_data += size;
if (q_shift > 0) {
WORD32 tempr, tempi, outr, outi, win1, accu, temp1, temp2;
WORD16 adjust, adjust1;
WORD32 overlap_data;
tempr = *(spec_data - size);
tempi = *(spec_data - size + 1);
adjust = 50;
adjust1 = -50;
cos = *cos_sin_ptr++;
sin = *cos_sin_ptr++;
outi = ixheaacd_sub32(ixheaacd_mult32x16in32(tempi, cos),
ixheaacd_mult32x16in32(tempr, sin));
outr = -1 * ixheaacd_add32(ixheaacd_mult32x16in32(tempr, cos),
ixheaacd_mult32x16in32(tempi, sin));
overlap_data = *ptr_overlap_buf;
temp1 = ixheaacd_mult32x16in32(outi, adjust1);
temp2 = ixheaacd_mult32x16in32(outr, adjust);
outr = outr + temp1;
outi = outi + temp2;
*ptr_overlap_buf++ = ixheaacd_shr32_drc(outr, 16 - q_shift);
win1 = *((WORD32 *)window + size - 1);
accu = ixheaacd_sub32_sat(
ixheaacd_shl32_sat(ixheaacd_mult32x16lin32(outi, win1), q_shift),
ixheaacd_mult32x16lin32_drc(overlap_data, (WORD16)(win1 >> 16)));
*pcm_out = ixheaacd_round16(ixheaacd_shl32_sat(accu, 2));
pcm_out -= ch_fac;
accu = ixheaacd_sub32_sat(
ixheaacd_shl32_sat(
ixheaacd_mult32x16hin32_drc(ixheaacd_negate32(outi), win1),
q_shift),
ixheaacd_mult32x16lin32_drc(overlap_data, (WORD16)(win1)));
*pcmout1 = ixheaacd_round16(ixheaacd_shl32_sat(accu, 2));
pcmout1 += ch_fac;
for (i = size - 2; i != 0;) {
sin = *cos_sin_ptr++;
cos = *cos_sin_ptr++;
tempr = *(spec_data + i);
tempi = *(spec_data + i + 1);
outr = -1 * ixheaacd_add32(ixheaacd_mult32x16in32(tempr, cos),
ixheaacd_mult32x16in32(tempi, sin));
outi = ixheaacd_sub32(ixheaacd_mult32x16in32(tempi, cos),
ixheaacd_mult32x16in32(tempr, sin));
temp1 = ixheaacd_mult32x16in32(outi, adjust);
temp1 = -1 * temp1;
temp2 = ixheaacd_mult32x16in32(outr, adjust);
outr = outr + temp1;
outi = outi + temp2;
overlap_data = *ptr_overlap_buf;
*ptr_overlap_buf++ = ixheaacd_shr32_drc(outi, 16 - q_shift);
win1 = *((WORD32 *)window + i);
accu = ixheaacd_sub32_sat(
ixheaacd_shl32_sat(ixheaacd_mult32x16lin32(outr, win1), q_shift),
ixheaacd_mult32x16lin32_drc(overlap_data, (WORD16)(win1 >> 16)));
*pcm_out = ixheaacd_round16(ixheaacd_shl32_sat(accu, 2));
pcm_out -= ch_fac;
accu = ixheaacd_sub32_sat(
ixheaacd_shl32_sat(
ixheaacd_mult32x16hin32_drc(ixheaacd_negate32(outr), win1),
q_shift),
ixheaacd_mult32x16lin32_drc(overlap_data, (WORD16)win1));
*pcmout1 = ixheaacd_round16(ixheaacd_shl32_sat(accu, 2));
pcmout1 += ch_fac;
tempr = *(spec_data - i);
tempi = *(spec_data - i + 1);
i -= 2;
outi = ixheaacd_sub32(ixheaacd_mult32x16in32(tempi, sin),
ixheaacd_mult32x16in32(tempr, cos));
outr = -1 * ixheaacd_add32(ixheaacd_mult32x16in32(tempr, sin),
ixheaacd_mult32x16in32(tempi, cos));
overlap_data = *ptr_overlap_buf;
temp1 = ixheaacd_mult32x16in32(outi, adjust);
temp1 = temp1 * -1;
temp2 = ixheaacd_mult32x16in32(outr, adjust);
outr = outr + temp1;
outi = outi + temp2;
*ptr_overlap_buf++ = ixheaacd_shr32_drc(outr, 16 - q_shift);
win1 = *((WORD32 *)window + i + 1);
accu = ixheaacd_sub32_sat(
ixheaacd_shl32_sat(ixheaacd_mult32x16lin32(outi, win1), q_shift),
ixheaacd_mult32x16lin32_drc(overlap_data, (WORD16)(win1 >> 16)));
*pcm_out = ixheaacd_round16(ixheaacd_shl32_sat(accu, 2));
pcm_out -= ch_fac;
accu = ixheaacd_sub32_sat(
ixheaacd_shl32_sat(
ixheaacd_mult32x16hin32_drc(ixheaacd_negate32(outi), win1),
q_shift),
ixheaacd_mult32x16lin32_drc(overlap_data, (WORD16)(win1)));
*pcmout1 = ixheaacd_round16(ixheaacd_shl32_sat(accu, 2));
pcmout1 += ch_fac;
}
cos1 = *cos_sin_ptr++;
sin1 = *cos_sin_ptr;
tempr = *(spec_data + i);
tempi = *(spec_data + i + 1);
outr = -1 * ixheaacd_add32(ixheaacd_mult32x16in32(tempr, cos1),
ixheaacd_mult32x16in32(tempi, sin1));
outi = ixheaacd_sub32(ixheaacd_mult32x16in32(tempi, cos1),
ixheaacd_mult32x16in32(tempr, sin1));
temp1 = ixheaacd_mult32x16in32(outi, adjust);
temp1 = -1 * temp1;
temp2 = ixheaacd_mult32x16in32(outr, adjust);
outr = outr + temp1;
outi = outi + temp2;
overlap_data = *ptr_overlap_buf;
*ptr_overlap_buf++ = ixheaacd_shr32_drc(outi, 16 - q_shift);
win1 = *((WORD32 *)window + i);
accu = ixheaacd_sub32_sat(
ixheaacd_shl32_sat(ixheaacd_mult32x16lin32(outr, win1), q_shift),
ixheaacd_mult32x16lin32_drc(overlap_data, (WORD16)(win1 >> 16)));
*pcm_out = ixheaacd_round16(ixheaacd_shl32_sat(accu, 2));
pcm_out -= ch_fac;
accu = ixheaacd_sub32_sat(
ixheaacd_shl32_sat(
ixheaacd_mult32x16hin32_drc(ixheaacd_negate32(outr), win1),
q_shift),
ixheaacd_mult32x16lin32_drc(overlap_data, (WORD16)win1));
*pcmout1 = ixheaacd_round16(ixheaacd_shl32_sat(accu, 2));
pcmout1 += ch_fac;
} else {
q_shift = -q_shift;
{
WORD32 tempr, tempi, temp1, temp2, outr, outi, win1, accu;
WORD16 adjust, adjust1;
WORD16 overlap_data;
tempr = *(spec_data - size);
tempi = *(spec_data - size + 1);
adjust = 50;
adjust1 = -50;
cos = *cos_sin_ptr++;
sin = *cos_sin_ptr++;
outi = ixheaacd_sub32(ixheaacd_mult32x16in32(tempi, cos),
ixheaacd_mult32x16in32(tempr, sin));
outr = -1 * ixheaacd_add32(ixheaacd_mult32x16in32(tempr, cos),
ixheaacd_mult32x16in32(tempi, sin));
overlap_data = *ptr_overlap_buf;
temp1 = ixheaacd_mult32x16in32(outi, adjust1);
temp2 = ixheaacd_mult32x16in32(outr, adjust);
outr = outr + temp1;
outi = outi + temp2;
*ptr_overlap_buf++ = ixheaacd_shr32_drc(outr, 16 + q_shift);
win1 = *((WORD32 *)window + size - 1);
accu = ixheaacd_sub32_sat(
ixheaacd_shr32(ixheaacd_mult32x16lin32(outi, win1), q_shift),
ixheaacd_mult32x16lin32_drc(overlap_data, (WORD16)(win1 >> 16)));
*pcm_out = ixheaacd_round16(ixheaacd_shl32_sat(accu, 2));
pcm_out -= ch_fac;
accu = ixheaacd_sub32_sat(
ixheaacd_shr32(
ixheaacd_mult32x16hin32_drc(ixheaacd_negate32(outi), win1),
q_shift),
ixheaacd_mult32x16lin32_drc(overlap_data, (WORD16)(win1)));
*pcmout1 = ixheaacd_round16(ixheaacd_shl32_sat(accu, 2));
pcmout1 += ch_fac;
for (i = size - 2; i != 0;) {
sin = *cos_sin_ptr++;
cos = *cos_sin_ptr++;
tempr = *(spec_data + i);
tempi = *(spec_data + i + 1);
outr = -1 * ixheaacd_add32(ixheaacd_mult32x16in32(tempr, cos),
ixheaacd_mult32x16in32(tempi, sin));
outi = ixheaacd_sub32(ixheaacd_mult32x16in32(tempi, cos),
ixheaacd_mult32x16in32(tempr, sin));
overlap_data = *ptr_overlap_buf;
temp1 = ixheaacd_mult32x16in32(outi, adjust);
temp1 = -1 * temp1;
temp2 = ixheaacd_mult32x16in32(outr, adjust);
outr = outr + temp1;
outi = outi + temp2;
*ptr_overlap_buf++ = ixheaacd_shr32_drc(outi, 16 + q_shift);
win1 = *((WORD32 *)window + i);
accu = ixheaacd_sub32_sat(
ixheaacd_shr32(ixheaacd_mult32x16lin32(outr, win1), q_shift),
ixheaacd_mult32x16lin32_drc(overlap_data, (WORD16)(win1 >> 16)));
*pcm_out = ixheaacd_round16(ixheaacd_shl32_sat(accu, 2));
pcm_out -= ch_fac;
accu = ixheaacd_sub32_sat(
ixheaacd_shr32(
ixheaacd_mult32x16hin32_drc(ixheaacd_negate32(outr), win1),
q_shift),
ixheaacd_mult32x16lin32_drc(overlap_data, (WORD16)win1));
*pcmout1 = ixheaacd_round16(ixheaacd_shl32_sat(accu, 2));
pcmout1 += ch_fac;
tempr = *(spec_data - i);
tempi = *(spec_data - i + 1);
i -= 2;
outi = ixheaacd_sub32(ixheaacd_mult32x16in32(tempi, sin),
ixheaacd_mult32x16in32(tempr, cos));
outr = -1 * ixheaacd_add32(ixheaacd_mult32x16in32(tempr, sin),
ixheaacd_mult32x16in32(tempi, cos));
overlap_data = *ptr_overlap_buf;
temp1 = ixheaacd_mult32x16in32(outi, adjust);
temp1 = -1 * temp1;
temp2 = ixheaacd_mult32x16in32(outr, adjust);
outr = outr + temp1;
outi = outi + temp2;
*ptr_overlap_buf++ = ixheaacd_shr32_drc(outr, 16 + q_shift);
win1 = *((WORD32 *)window + i + 1);
accu = ixheaacd_sub32_sat(
ixheaacd_shr32(ixheaacd_mult32x16lin32(outi, win1), q_shift),
ixheaacd_mult32x16lin32_drc(overlap_data, (WORD16)(win1 >> 16)));
*pcm_out = ixheaacd_round16(ixheaacd_shl32_sat(accu, 2));
pcm_out -= ch_fac;
accu = ixheaacd_sub32_sat(
ixheaacd_shr32(
ixheaacd_mult32x16hin32_drc(ixheaacd_negate32(outi), win1),
q_shift),
ixheaacd_mult32x16lin32_drc(overlap_data, (WORD16)(win1)));
*pcmout1 = ixheaacd_round16(ixheaacd_shl32_sat(accu, 2));
pcmout1 += ch_fac;
}
cos1 = *cos_sin_ptr++;
sin1 = *cos_sin_ptr++;
tempr = *(spec_data + i);
tempi = *(spec_data + i + 1);
outr = -1 * ixheaacd_add32(ixheaacd_mult32x16in32(tempr, cos1),
ixheaacd_mult32x16in32(tempi, sin1));
outi = ixheaacd_sub32(ixheaacd_mult32x16in32(tempi, cos1),
ixheaacd_mult32x16in32(tempr, sin1));
overlap_data = *ptr_overlap_buf;
temp1 = ixheaacd_mult32x16in32(outi, adjust);
temp1 = -1 * temp1;
temp2 = ixheaacd_mult32x16in32(outr, adjust);
outr = outr + temp1;
outi = outi + temp2;
*ptr_overlap_buf++ = ixheaacd_shr32_drc(outi, 16 + q_shift);
win1 = *((WORD32 *)window + i);
accu = ixheaacd_sub32_sat(
ixheaacd_shr32(ixheaacd_mult32x16lin32(outr, win1), q_shift),
ixheaacd_mult32x16lin32_drc(overlap_data, (WORD16)(win1 >> 16)));
*pcm_out = ixheaacd_round16(ixheaacd_shl32_sat(accu, 2));
pcm_out -= ch_fac;
accu = ixheaacd_sub32_sat(
ixheaacd_shr32(
ixheaacd_mult32x16hin32_drc(ixheaacd_negate32(outr), win1),
q_shift),
ixheaacd_mult32x16lin32_drc(overlap_data, (WORD16)win1));
*pcmout1 = ixheaacd_round16(ixheaacd_shl32_sat(accu, 2));
pcmout1 += ch_fac;
}
}
}
VOID ixheaacd_imdct_using_fft_dec(
ia_aac_dec_imdct_tables_struct *ptr_imdct_tables, WORD32 npoints,
WORD32 *ptr_x, WORD32 *ptr_y)
@ -2025,13 +1704,17 @@ VOID ixheaacd_fft_480_ld(WORD32 *inp, WORD32 *op,
}
}
static PLATFORM_INLINE VOID ixheaacd_pre_twiddle_compute_ld(
WORD32 *in_ptr1, WORD32 *in_ptr2, WORD32 *xptr, WORD32 *cos_sin_ptr,
WORD npoints_4, WORD32 neg_expo) {
WORD32 i;
VOID ixheaacd_pre_twiddle(WORD32 *xptr, WORD32 *data, WORD32 n,
WORD32 *cos_sin_ptr, WORD32 neg_expo) {
WORD npoints_4, i;
WORD32 tempr, tempi, temp;
WORD32 c, c1, s, s1;
WORD32 *in_ptr1, *in_ptr2;
npoints_4 = n >> 2;
in_ptr1 = data;
in_ptr2 = data + n - 1;
if (neg_expo >= 0) {
for (i = npoints_4 - 1; i >= 0; i--) {
@ -2108,20 +1791,6 @@ static PLATFORM_INLINE VOID ixheaacd_pre_twiddle_compute_ld(
}
}
VOID ixheaacd_pre_twiddle(WORD32 *xptr, WORD32 *data, WORD32 n,
WORD32 *cos_array_ptr, WORD32 neg_expo) {
WORD npoints_4;
WORD32 *in_ptr1, *in_ptr2;
npoints_4 = n >> 2;
in_ptr1 = data;
in_ptr2 = data + n - 1;
ixheaacd_pre_twiddle_compute_ld(in_ptr1, in_ptr2, xptr, cos_array_ptr,
npoints_4, neg_expo);
}
VOID ixheaacd_post_twiddle_ld(WORD32 out[], WORD32 x[],
const WORD32 *cos_sin_ptr, WORD m) {
WORD i;

View file

@ -255,7 +255,7 @@ VOID ixheaacd_tns_ar_filter_fixed_dec(WORD32 *spectrum, WORD32 size, WORD32 inc,
}
}
VOID ixheaacd_tns_ar_filter_fixed_armv7(WORD32 *spectrum, WORD32 size,
VOID ixheaacd_tns_ar_filter_fixed_non_neon_armv7(WORD32 *spectrum, WORD32 size,
WORD32 inc, WORD32 *lpc, WORD32 order,
WORD32 shift_value, WORD scale_spec) {
WORD32 i, j;

View file

@ -647,10 +647,10 @@ WORD32 ixheaacd_aacdec_decodeframe(
it_bit_buff, ptr_ics_info, object_type,
aac_dec_handle->samples_per_frame, LEFT);
if(temp!=0)
{
return temp;
}
if(temp!=0)
{
return temp;
}
}
}
}
@ -706,7 +706,8 @@ WORD32 ixheaacd_aacdec_decodeframe(
ixheaacd_extension_payload(it_bit_buff, cnt_bits);
}
if ((object_type == AOT_ER_AAC_ELD) || (object_type == AOT_ER_AAC_LD)) {
if (((object_type == AOT_ER_AAC_ELD) || (object_type == AOT_ER_AAC_LD))
&& (p_obj_exhaacplus_dec->aac_config.ld_decoder != 1)) {
if (it_bit_buff->cnt_bits) {
WORD32 alignment = it_bit_buff->bit_pos & 0x07;
it_bit_buff->cnt_bits = (it_bit_buff->cnt_bits + alignment) & 7;

View file

@ -154,7 +154,7 @@ IA_ERRORCODE ixheaacd_dec_mem_api(
p_obj_exhaacplus_dec->p_state_aac->ia_audio_specific_config =
p_temp + sizeof(ia_dec_data_struct);
p_obj_exhaacplus_dec->p_state_aac->header_ptr = p_temp + sizeof(ia_dec_data_struct)
+ sizeof(ia_audio_specific_config_struct);
+ sizeof(ia_audio_specific_config_struct);
}
} else {
@ -315,10 +315,9 @@ IA_ERRORCODE ixheaacd_dec_api(pVOID p_ia_enhaacplus_dec_obj, WORD32 i_cmd,
WORD32 i_idx, pVOID pv_value) {
ia_exhaacplus_dec_api_struct *p_obj_exhaacplus_dec = p_ia_enhaacplus_dec_obj;
pUWORD32 pui_value = pv_value;
pWORD32 pui_value_signed = pv_value;
pWORD8 pb_value = pv_value;
#ifdef ENABLE_DRC
pVOID *pp_value = (pVOID *)pv_value;
#endif
if ((i_cmd != IA_API_CMD_GET_API_SIZE) &&
(i_cmd != IA_API_CMD_GET_LIB_ID_STRINGS)) {
@ -393,9 +392,12 @@ IA_ERRORCODE ixheaacd_dec_api(pVOID p_ia_enhaacplus_dec_obj, WORD32 i_cmd,
p_obj_exhaacplus_dec->aac_config.ui_samp_freq = 0;
p_obj_exhaacplus_dec->aac_config.ui_channel_mode = 3;
p_obj_exhaacplus_dec->aac_config.ui_sbr_mode = 0;
p_obj_exhaacplus_dec->aac_config.ui_effect_type = 0;
p_obj_exhaacplus_dec->aac_config.ui_target_loudness = -24;
p_obj_exhaacplus_dec->aac_config.ui_loud_norm_flag = 0;
p_obj_exhaacplus_dec->aac_config.ui_pce_found_in_hdr = 0;
p_obj_exhaacplus_dec->aac_config.loas_present = 0;
p_obj_exhaacplus_dec->aac_config.ld_decoder = 0;
p_obj_exhaacplus_dec->aac_config.ui_drc_enable = 1;
p_obj_exhaacplus_dec->aac_config.ui_drc_boost = 0;
p_obj_exhaacplus_dec->aac_config.ui_drc_cut = 0;
@ -623,6 +625,17 @@ IA_ERRORCODE ixheaacd_dec_api(pVOID p_ia_enhaacplus_dec_obj, WORD32 i_cmd,
break;
}
case IA_ENHAACPLUS_DEC_CONFIG_PARAM_LD_TESTING: {
if (*pui_value == 1) {
p_obj_exhaacplus_dec->aac_config.ld_decoder = 1;
} else if (*pui_value == 0) {
p_obj_exhaacplus_dec->aac_config.ld_decoder = 0;
} else {
return (IA_ENHAACPLUS_DEC_CONFIG_NONFATAL_INVALID_LD_CONFIG);
}
break;
}
case IA_ENHAACPLUS_DEC_CONFIG_PARAM_ELD_SBR_PRESENT: {
if (*pui_value == 1) {
p_obj_exhaacplus_dec->aac_config.eld_sbr_present = 1;
@ -651,22 +664,40 @@ IA_ERRORCODE ixheaacd_dec_api(pVOID p_ia_enhaacplus_dec_obj, WORD32 i_cmd,
break;
}
case IA_ENHAACPLUS_DEC_DRC_EFFECT_TYPE: {
if (((*pui_value_signed) > 8) || ((*pui_value_signed) < -1) ) {
p_obj_exhaacplus_dec->aac_config.ui_effect_type = -1;
return (IA_ENHAACPLUS_DEC_CONFIG_NON_FATAL_INVALID_EFFECT_TYPE);
}
p_obj_exhaacplus_dec->aac_config.ui_effect_type = *pui_value_signed;
break;
}
case IA_ENHAACPLUS_DEC_DRC_TARGET_LOUDNESS: {
if(*pui_value_signed>=0)
{
p_obj_exhaacplus_dec->aac_config.ui_loud_norm_flag=1;
}
*pui_value_signed = -(*pui_value_signed >> 2);
if (((*pui_value_signed) > 0) ||((*pui_value_signed) < -63)) {
p_obj_exhaacplus_dec->aac_config.ui_target_loudness = 0;
return (IA_ENHAACPLUS_DEC_CONFIG_NONFATAL_INVALID_TARGET_LOUDNESS);
}
p_obj_exhaacplus_dec->aac_config.ui_target_loudness = *pui_value_signed;
break;
}
default: { return IA_ENHAACPLUS_DEC_API_FATAL_INVALID_CONFIG_PARAM; }
}
break;
}
case IA_API_CMD_GET_CONFIG_PARAM: {
#ifdef ENABLE_DRC
UWORD32 i;
#endif
WORD32 *pvalue =
(WORD32 *)(&p_obj_exhaacplus_dec->aac_config.ui_pcm_wdsz);
if (i_idx >= 0 && i_idx <= 5) {
if (i_idx >= 0 && i_idx <= 8) {
*pui_value = pvalue[i_idx];
}
#ifdef ENABLE_DRC
else if (IA_ENHAACPLUS_DEC_CONFIG_EXT_ELE_PTR == i_idx) {
ia_audio_specific_config_struct *ptr_audio_specific_config =
((ia_audio_specific_config_struct *)
@ -737,7 +768,6 @@ IA_ERRORCODE ixheaacd_dec_api(pVOID p_ia_enhaacplus_dec_obj, WORD32 i_cmd,
*pp_value = ptr_audio_specific_config->str_usac_config
.str_usac_dec_config.usac_ext_gain_payload_buf;
}
#endif
else {
return IA_ENHAACPLUS_DEC_API_FATAL_INVALID_CONFIG_PARAM;
}
@ -890,7 +920,7 @@ IA_ERRORCODE ixheaacd_decoder_flush_api(
p_obj_exhaacplus_dec->p_state_aac->ia_audio_specific_config =
p_temp + sizeof(ia_dec_data_struct);
p_obj_exhaacplus_dec->p_state_aac->header_ptr = p_temp + sizeof(ia_dec_data_struct)
+ sizeof(ia_audio_specific_config_struct);
+ sizeof(ia_audio_specific_config_struct);
}
memset(&(p_obj_exhaacplus_dec->aac_config), 0,
sizeof(ia_aac_dec_config_struct));
@ -1065,7 +1095,7 @@ IA_ERRORCODE ixheaacd_fill_aac_mem_tables(
p_mem_info_aac->ui_size += sizeof(ia_dec_data_struct);
p_mem_info_aac->ui_size += sizeof(ia_audio_specific_config_struct);
p_mem_info_aac->ui_size += 8300;
p_mem_info_aac->ui_size += 8300;
p_mem_info_aac->ui_alignment = 8;
p_mem_info_aac->ui_type = IA_MEMTYPE_PERSIST;
@ -1466,12 +1496,14 @@ IA_ERRORCODE ixheaacd_dec_init(
p_state_enhaacplus_dec->ptr_bit_stream =
p_state_enhaacplus_dec->pstr_bit_buf;
if (p_state_enhaacplus_dec->s_adts_hdr_present) { //rajat
if (p_obj_exhaacplus_dec->aac_config.ld_decoder == 1)
p_state_enhaacplus_dec->audio_object_type = 23;
}
if ((p_state_enhaacplus_dec->audio_object_type == AOT_ER_AAC_ELD) ||
(p_state_enhaacplus_dec->audio_object_type == AOT_ER_AAC_LD))
if (p_state_enhaacplus_dec->s_adts_hdr_present) {
if (p_obj_exhaacplus_dec->aac_config.ld_decoder == 1)
p_state_enhaacplus_dec->audio_object_type = 23;
if (p_state_enhaacplus_dec->audio_object_type == AOT_ER_AAC_ELD) {
p_state_enhaacplus_dec->eld_specific_config.ld_sbr_samp_rate = 1;
p_state_enhaacplus_dec->eld_specific_config.ld_sbr_crc_flag = 0;
@ -1790,6 +1822,7 @@ IA_ERRORCODE ixheaacd_dec_init(
p_state_enhaacplus_dec->eld_specific_config.ld_sbr_flag_present,
p_state_enhaacplus_dec->audio_object_type) != SBRDEC_OK) {
p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx] = 0;
return -1;
} else {
if (!p_obj_exhaacplus_dec->aac_config.down_sample_flag) {
sample_rate_1 *= 2;
@ -2306,6 +2339,11 @@ IA_ERRORCODE ixheaacd_dec_execute(
{ it_bit_buff->initial_cnt_bits = it_bit_buff->cnt_bits; }
if (p_state_enhaacplus_dec->audio_object_type == AOT_ER_AAC_LD) {
if(p_state_enhaacplus_dec->s_adts_hdr_present)
p_state_enhaacplus_dec->frame_size = adts.aac_frame_length;
}
if (p_state_enhaacplus_dec->pstr_drc_dec) {
p_state_enhaacplus_dec->pstr_drc_dec->num_drc_elements = 0;
@ -2502,6 +2540,7 @@ IA_ERRORCODE ixheaacd_dec_execute(
p_state_enhaacplus_dec->eld_specific_config.ld_sbr_flag_present,
p_state_enhaacplus_dec->audio_object_type) != SBRDEC_OK) {
p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx] = 0;
return -1;
} else {
if (!p_obj_exhaacplus_dec->aac_config.down_sample_flag) {
frame_size = (WORD16)(frame_size * 2);

View file

@ -36,4 +36,4 @@
IA_MAKE_VERSION_STR(IA_LASTCOMP_APIVERSION_MAJOR, \
IA_LASTCOMP_APIVERSION_MINOR)
#endif
#endif

View file

@ -1815,6 +1815,10 @@ WORD32 ixheaacd_arth_decoding_level2(ia_bit_buf_struct *it_bit_buff,
pki = ixheaacd_arith_get_pk(s1 + ixheaacd_esc_nb_offset[esc_nb]);
bit_count = ixheaacd_arith_decode(&it_bit_buff_temp, bit_count, &m, &as,
ixheaacd_ari_cf_m[pki], 17);
if(bit_count == -1)
{
return -1;
}
if (m < ARITH_ESCAPE) {
break;
@ -1826,6 +1830,9 @@ WORD32 ixheaacd_arth_decoding_level2(ia_bit_buf_struct *it_bit_buff,
if (esc_nb > 7) {
esc_nb = 7;
}
if (esc_nb < 0) {
esc_nb = 0;
}
}
if (m == 0) {
@ -1842,10 +1849,17 @@ WORD32 ixheaacd_arth_decoding_level2(ia_bit_buf_struct *it_bit_buff,
WORD32 lsbidx = (a == 0) ? 1 : ((b == 0) ? 0 : 2);
bit_count = ixheaacd_arith_decode(&it_bit_buff_temp, bit_count, &m, &as,
ixheaacd_ari_cf_r[lsbidx], 4);
if(bit_count == -1)
{
return -1;
}
a = (a << 1) | (m & 1);
b = (b << 1) | ((m >> 1) & 1);
}
if((a > (8183)) || (b > (8183)))
return -1;
if((a < (-8183)) || (b < (-8183)))
return -1;
quant[2 * i + 0] = a;
quant[2 * i + 1] = b;
temp = a + b + 1;
@ -1882,6 +1896,10 @@ WORD32 ixheaacd_arth_decoding_level2(ia_bit_buf_struct *it_bit_buff,
m = (m << 1) * temp1;
temp1 = m - (temp1);
}
if((temp0 > (8183)) || (temp1 > (8183)))
return -1;
if((temp0 < (-8183)) || (temp1 < (-8183)))
return -1;
*quant++ = temp0;
*quant++ = temp1;
}

View file

@ -319,11 +319,15 @@ static PLATFORM_INLINE WORD32 ixheaacd_negate32(WORD32 a) {
static PLATFORM_INLINE WORD32 ixheaacd_negate32_sat(WORD32 a) {
WORD32 neg_val;
neg_val = -a;
if (a == MIN_32) {
if (a == MIN_32)
{
neg_val = MAX_32;
}
else
{
neg_val = -a;
}
return neg_val;
}

View file

@ -324,6 +324,16 @@ static PLATFORM_INLINE WORD64 ixheaacd_mult64(WORD32 a, WORD32 b) {
return (result);
}
static PLATFORM_INLINE WORD64 ixheaacd_add64_sat(WORD64 a, WORD64 b) {
WORD64 result , comp;
result = (a < 0) ? MIN_64 : MAX_64;
comp = result - a;
if ((a < 0) == (b > comp))
result = a + b;
return (result);
}
static PLATFORM_INLINE WORD64 ixheaacd_add64(WORD64 a, WORD64 b) {
WORD64 result;
result = a + b;

View file

@ -213,8 +213,8 @@ static WORD16 ixheaacd_read_block_data(
if (error_code) {
return error_code;
}
if (aac_sf_data_resil_flag && ((object_type == AOT_ER_AAC_ELD)
|| (object_type == AOT_ER_AAC_LD)))
if (aac_sf_data_resil_flag && ((object_type == AOT_ER_AAC_ELD)
|| (object_type == AOT_ER_AAC_LD)))
ixheaacd_rvlc_read(it_bit_buff, ptr_aac_dec_channel_info);
else
ixheaacd_read_scale_factor_data(it_bit_buff, ptr_aac_dec_channel_info,
@ -297,7 +297,7 @@ static WORD16 ixheaacd_read_block_data(
WORD16 ixheaacd_ltp_decode(ia_bit_buf_struct *it_bit_buff,
ia_ics_info_struct *ptr_ics_info,
WORD32 object_type,
WORD32 object_type,
WORD32 frame_size, WORD32 ch) {
WORD32 retval = AAC_DEC_OK;
@ -514,10 +514,10 @@ WORD16 ixheaacd_individual_ch_stream(
it_bit_buff, ptr_ics_info, object_type,
aac_dec_handle->samples_per_frame, 1);
if(temp!=0)
{
return temp;
}
if(temp!=0)
{
return temp;
}
aac_dec_handle->pstr_aac_dec_ch_info[ch + 1]->str_ics_info.ltp.lag =
ptr_ics_info->ltp2.lag;
}

View file

@ -335,7 +335,7 @@ WORD16 ixheaacd_ics_read(ia_bit_buf_struct *it_bit_buff,
WORD16 ixheaacd_ltp_decode(ia_bit_buf_struct *it_bit_buff,
ia_ics_info_struct *ptr_ics_info,
WORD32 object_type,
WORD32 object_type,
WORD32 frame_size, WORD32 ch);
#endif /* #ifndef IXHEAACD_CHANNELINFO_H */

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