Merge Android R
Bug: 168057903 Merged-In: Ice88af6abbaec9ae277a56fcf7df516ba2e9486f Change-Id: Id25da2bf82cd73fddf16c439f775d8f085ebec30
This commit is contained in:
commit
26fedcbb46
156 changed files with 2791 additions and 5570 deletions
|
|
@ -108,15 +108,10 @@ cc_library_static {
|
|||
"decoder/drc_src/impd_drc_filter_bank.c",
|
||||
"decoder/drc_src/impd_drc_gain_dec.c",
|
||||
"decoder/drc_src/impd_drc_gain_decoder.c",
|
||||
"decoder/drc_src/impd_drc_host_params.c",
|
||||
"decoder/drc_src/impd_drc_init.c",
|
||||
"decoder/drc_src/impd_drc_interface_decoder.c",
|
||||
"decoder/drc_src/impd_drc_interface_parser.c",
|
||||
"decoder/drc_src/impd_drc_loudness_control.c",
|
||||
"decoder/drc_src/impd_drc_main_qmf_process.c",
|
||||
"decoder/drc_src/impd_drc_main_stft_process.c",
|
||||
"decoder/drc_src/impd_drc_main_td_process.c",
|
||||
"decoder/drc_src/impd_drc_main_td_qmf_process.c",
|
||||
"decoder/drc_src/impd_drc_multiband.c",
|
||||
"decoder/drc_src/impd_drc_parametric_dec.c",
|
||||
"decoder/drc_src/impd_drc_peak_limiter.c",
|
||||
|
|
|
|||
|
|
@ -121,15 +121,10 @@ list(
|
|||
"${XAAC_ROOT}/decoder/drc_src/impd_drc_filter_bank.c"
|
||||
"${XAAC_ROOT}/decoder/drc_src/impd_drc_gain_dec.c"
|
||||
"${XAAC_ROOT}/decoder/drc_src/impd_drc_gain_decoder.c"
|
||||
"${XAAC_ROOT}/decoder/drc_src/impd_drc_host_params.c"
|
||||
"${XAAC_ROOT}/decoder/drc_src/impd_drc_init.c"
|
||||
"${XAAC_ROOT}/decoder/drc_src/impd_drc_interface_decoder.c"
|
||||
"${XAAC_ROOT}/decoder/drc_src/impd_drc_interface_parser.c"
|
||||
"${XAAC_ROOT}/decoder/drc_src/impd_drc_loudness_control.c"
|
||||
"${XAAC_ROOT}/decoder/drc_src/impd_drc_main_qmf_process.c"
|
||||
"${XAAC_ROOT}/decoder/drc_src/impd_drc_main_stft_process.c"
|
||||
"${XAAC_ROOT}/decoder/drc_src/impd_drc_main_td_process.c"
|
||||
"${XAAC_ROOT}/decoder/drc_src/impd_drc_main_td_qmf_process.c"
|
||||
"${XAAC_ROOT}/decoder/drc_src/impd_drc_multiband.c"
|
||||
"${XAAC_ROOT}/decoder/drc_src/impd_drc_parametric_dec.c"
|
||||
"${XAAC_ROOT}/decoder/drc_src/impd_drc_peak_limiter.c"
|
||||
|
|
|
|||
2
PREUPLOAD.cfg
Normal file
2
PREUPLOAD.cfg
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
[Hook Scripts]
|
||||
mainline_hook = ${REPO_ROOT}/frameworks/av/tools/mainline_hook_project.sh
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
#include "ixheaacd_interface.h"
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_function_selector.h"
|
||||
|
||||
extern const WORD32 ixheaacd_twiddle_table_fft_32x32[514];
|
||||
|
|
|
|||
|
|
@ -20,15 +20,15 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops16.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops16.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_basic_ops.h"
|
||||
|
||||
#include <ixheaacd_basic_op.h>
|
||||
#include "ixheaacd_basic_op.h"
|
||||
#include "ixheaacd_intrinsics.h"
|
||||
#include "ixheaacd_common_rom.h"
|
||||
#include "ixheaacd_sbrdecsettings.h"
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
#include "ixheaacd_pns.h"
|
||||
|
||||
#include <ixheaacd_aac_rom.h>
|
||||
#include "ixheaacd_aac_rom.h"
|
||||
#include "ixheaacd_aac_imdct.h"
|
||||
#include "ixheaacd_pulsedata.h"
|
||||
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
#include "ixheaacd_sbr_scale.h"
|
||||
#include "ixheaacd_lpp_tran.h"
|
||||
#include "ixheaacd_env_extr_part.h"
|
||||
#include <ixheaacd_sbr_rom.h>
|
||||
#include "ixheaacd_sbr_rom.h"
|
||||
#include "ixheaacd_block.h"
|
||||
#include "ixheaacd_hybrid.h"
|
||||
#include "ixheaacd_ps_dec.h"
|
||||
|
|
|
|||
|
|
@ -20,15 +20,15 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops16.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops16.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_basic_ops.h"
|
||||
|
||||
#include <ixheaacd_basic_op.h>
|
||||
#include "ixheaacd_basic_op.h"
|
||||
#include "ixheaacd_intrinsics.h"
|
||||
#include "ixheaacd_common_rom.h"
|
||||
#include "ixheaacd_sbrdecsettings.h"
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
#include "ixheaacd_pns.h"
|
||||
|
||||
#include <ixheaacd_aac_rom.h>
|
||||
#include "ixheaacd_aac_rom.h"
|
||||
#include "ixheaacd_aac_imdct.h"
|
||||
#include "ixheaacd_pulsedata.h"
|
||||
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
#include "ixheaacd_sbr_scale.h"
|
||||
#include "ixheaacd_lpp_tran.h"
|
||||
#include "ixheaacd_env_extr_part.h"
|
||||
#include <ixheaacd_sbr_rom.h>
|
||||
#include "ixheaacd_sbr_rom.h"
|
||||
#include "ixheaacd_block.h"
|
||||
#include "ixheaacd_hybrid.h"
|
||||
#include "ixheaacd_ps_dec.h"
|
||||
|
|
@ -199,11 +199,11 @@ VOID(*ixheaacd_mps_complex_fft_64)
|
|||
WORD32 nlength) = &ixheaacd_mps_complex_fft_64_armv7;
|
||||
|
||||
VOID(*ixheaacd_mps_synt_pre_twiddle)
|
||||
(WORD32 *ptr_in, WORD32 *table_re, WORD32 *table_im,
|
||||
(WORD32 *ptr_in, const WORD32 *table_re, const WORD32 *table_im,
|
||||
WORD32 resolution) = &ixheaacd_mps_synt_pre_twiddle_armv7;
|
||||
|
||||
VOID(*ixheaacd_mps_synt_post_twiddle)
|
||||
(WORD32 *ptr_in, WORD32 *table_re, WORD32 *table_im,
|
||||
(WORD32 *ptr_in, const WORD32 *table_re, const WORD32 *table_im,
|
||||
WORD32 resolution) = &ixheaacd_mps_synt_post_twiddle_armv7;
|
||||
|
||||
VOID(*ixheaacd_calc_pre_twid)
|
||||
|
|
@ -215,8 +215,9 @@ VOID(*ixheaacd_calc_post_twid)
|
|||
const WORD32 *cos_ptr, const WORD32 *sin_ptr) = &ixheaacd_calc_post_twid_armv7;
|
||||
|
||||
VOID(*ixheaacd_mps_synt_post_fft_twiddle)
|
||||
(WORD32 resolution, WORD32 *fin_re, WORD32 *fin_im, WORD32 *table_re,
|
||||
WORD32 *table_im, WORD32 *state) = &ixheaacd_mps_synt_post_fft_twiddle_armv7;
|
||||
(WORD32 resolution, WORD32 *fin_re, WORD32 *fin_im, const WORD32 *table_re,
|
||||
const WORD32 *table_im,
|
||||
WORD32 *state) = &ixheaacd_mps_synt_post_fft_twiddle_armv7;
|
||||
|
||||
VOID(*ixheaacd_mps_synt_out_calc)
|
||||
(WORD32 resolution, WORD32 *out, WORD32 *state,
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_constants.h"
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
#include "ixheaacd_env_extr.h"
|
||||
#include "ixheaacd_qmf_dec.h"
|
||||
|
||||
#include <ixheaacd_basic_op.h>
|
||||
#include "ixheaacd_basic_op.h"
|
||||
#include "ixheaacd_env_calc.h"
|
||||
|
||||
#include "ixheaacd_interface.h"
|
||||
|
|
|
|||
|
|
@ -6,9 +6,10 @@
|
|||
ixheaacd_sbr_qmfanal32_winadds_eld:
|
||||
|
||||
STMFD sp!, {R4-R12, R14}
|
||||
LDR R5, [SP, #44] @filterStates
|
||||
LDR R6, [SP, #48] @timeIn
|
||||
LDR R7, [SP, #52] @stride
|
||||
VPUSH {D8 - D15}
|
||||
LDR R5, [SP, #108] @filterStates
|
||||
LDR R6, [SP, #112] @timeIn
|
||||
LDR R7, [SP, #116] @stride
|
||||
|
||||
MOV R9, R7, LSL #1
|
||||
|
||||
|
|
@ -43,7 +44,7 @@ LOOP:
|
|||
|
||||
BPL LOOP
|
||||
|
||||
LDR R4, [SP, #40] @winAdd
|
||||
LDR R4, [SP, #104] @winAdd
|
||||
|
||||
MOV R5, #8
|
||||
VLD1.16 D0, [R0]! @tmpQ1[n + 0] load and incremented R0 by 8
|
||||
|
|
@ -242,5 +243,5 @@ LOOP_1:
|
|||
VMLAL.S16 Q15, D18, D19
|
||||
|
||||
VST1.32 {Q15}, [R11]!
|
||||
|
||||
VPOP {D8 - D15}
|
||||
LDMFD sp!, {R4-R12, R15}
|
||||
|
|
|
|||
|
|
@ -20,15 +20,15 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops16.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops16.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_basic_ops.h"
|
||||
|
||||
#include <ixheaacd_basic_op.h>
|
||||
#include "ixheaacd_basic_op.h"
|
||||
#include "ixheaacd_intrinsics.h"
|
||||
#include "ixheaacd_common_rom.h"
|
||||
#include "ixheaacd_sbrdecsettings.h"
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
#include "ixheaacd_pns.h"
|
||||
|
||||
#include <ixheaacd_aac_rom.h>
|
||||
#include "ixheaacd_aac_rom.h"
|
||||
#include "ixheaacd_aac_imdct.h"
|
||||
#include "ixheaacd_pulsedata.h"
|
||||
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
#include "ixheaacd_sbr_scale.h"
|
||||
#include "ixheaacd_lpp_tran.h"
|
||||
#include "ixheaacd_env_extr_part.h"
|
||||
#include <ixheaacd_sbr_rom.h>
|
||||
#include "ixheaacd_sbr_rom.h"
|
||||
#include "ixheaacd_block.h"
|
||||
#include "ixheaacd_hybrid.h"
|
||||
#include "ixheaacd_ps_dec.h"
|
||||
|
|
@ -198,11 +198,11 @@ VOID(*ixheaacd_mps_complex_fft_64)
|
|||
WORD32 nlength) = &ixheaacd_mps_complex_fft_64_dec;
|
||||
|
||||
VOID(*ixheaacd_mps_synt_pre_twiddle)
|
||||
(WORD32 *ptr_in, WORD32 *table_re, WORD32 *table_im,
|
||||
(WORD32 *ptr_in, const WORD32 *table_re, const WORD32 *table_im,
|
||||
WORD32 resolution) = &ixheaacd_mps_synt_pre_twiddle_dec;
|
||||
|
||||
VOID(*ixheaacd_mps_synt_post_twiddle)
|
||||
(WORD32 *ptr_in, WORD32 *table_re, WORD32 *table_im,
|
||||
(WORD32 *ptr_in, const WORD32 *table_re, const WORD32 *table_im,
|
||||
WORD32 resolution) = &ixheaacd_mps_synt_post_twiddle_dec;
|
||||
|
||||
VOID(*ixheaacd_calc_pre_twid)
|
||||
|
|
@ -214,8 +214,9 @@ VOID(*ixheaacd_calc_post_twid)
|
|||
const WORD32 *cos_ptr, const WORD32 *sin_ptr) = &ixheaacd_calc_post_twid_dec;
|
||||
|
||||
VOID(*ixheaacd_mps_synt_post_fft_twiddle)
|
||||
(WORD32 resolution, WORD32 *fin_re, WORD32 *fin_im, WORD32 *table_re,
|
||||
WORD32 *table_im, WORD32 *state) = &ixheaacd_mps_synt_post_fft_twiddle_dec;
|
||||
(WORD32 resolution, WORD32 *fin_re, WORD32 *fin_im, const WORD32 *table_re,
|
||||
const WORD32 *table_im,
|
||||
WORD32 *state) = &ixheaacd_mps_synt_post_fft_twiddle_dec;
|
||||
|
||||
VOID(*ixheaacd_mps_synt_out_calc)
|
||||
(WORD32 resolution, WORD32 *out, WORD32 *state,
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
*/
|
||||
#include <string.h>
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_constants.h"
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
#include "ixheaacd_env_extr.h"
|
||||
#include "ixheaacd_qmf_dec.h"
|
||||
|
||||
#include <ixheaacd_basic_op.h>
|
||||
#include "ixheaacd_basic_op.h"
|
||||
#include "ixheaacd_env_calc.h"
|
||||
|
||||
#include "ixheaacd_interface.h"
|
||||
|
|
@ -88,22 +88,22 @@ VOID ixheaacd_dct3_32(WORD32 *input, WORD32 *output,
|
|||
for (n = 1; n < DCT3_LEN / 2; n++) {
|
||||
temp1[0] = *ptr_forward++;
|
||||
temp1[1] = *ptr_reverse--;
|
||||
temp1[0] = ixheaacd_add32(ixheaacd_shr32(temp1[0], LP_SHIFT_VAL),
|
||||
ixheaacd_shr32(temp1[1], LP_SHIFT_VAL));
|
||||
temp1[0] = ixheaacd_add32_sat(ixheaacd_shr32(temp1[0], LP_SHIFT_VAL),
|
||||
ixheaacd_shr32(temp1[1], LP_SHIFT_VAL));
|
||||
|
||||
temp1[2] = *(ptr_forward - 33);
|
||||
temp1[3] = *(ptr_reverse - 31);
|
||||
temp1[1] = ixheaacd_sub32(ixheaacd_shr32(temp1[2], LP_SHIFT_VAL),
|
||||
ixheaacd_shr32(temp1[3], LP_SHIFT_VAL));
|
||||
temp1[1] = ixheaacd_sub32_sat(ixheaacd_shr32(temp1[2], LP_SHIFT_VAL),
|
||||
ixheaacd_shr32(temp1[3], LP_SHIFT_VAL));
|
||||
twid_re = *twidle_fwd++;
|
||||
|
||||
twid_im = *twidle_fwd;
|
||||
twidle_fwd += 3;
|
||||
|
||||
*p_out++ = ixheaacd_mult32x16in32(temp1[0], twid_re) +
|
||||
ixheaacd_mult32x16in32(temp1[1], twid_im);
|
||||
*p_out++ = -ixheaacd_mult32x16in32(temp1[1], twid_re) +
|
||||
ixheaacd_mult32x16in32(temp1[0], twid_im);
|
||||
*p_out++ = ixheaacd_add32_sat(ixheaacd_mult32x16in32(temp1[0], twid_re),
|
||||
ixheaacd_mult32x16in32(temp1[1], twid_im));
|
||||
*p_out++ = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(temp1[0], twid_im),
|
||||
ixheaacd_mult32x16in32(temp1[1], twid_re));
|
||||
}
|
||||
|
||||
twid_re = *twidle_fwd++;
|
||||
|
|
@ -113,15 +113,15 @@ VOID ixheaacd_dct3_32(WORD32 *input, WORD32 *output,
|
|||
|
||||
temp1[1] = *ptr_reverse--;
|
||||
temp1[0] = *(ptr_reverse - 31);
|
||||
temp1[1] = ixheaacd_sub32(ixheaacd_shr32(temp1[1], LP_SHIFT_VAL),
|
||||
ixheaacd_shr32(temp1[0], LP_SHIFT_VAL));
|
||||
temp1[1] = ixheaacd_sub32_sat(ixheaacd_shr32(temp1[1], LP_SHIFT_VAL),
|
||||
ixheaacd_shr32(temp1[0], LP_SHIFT_VAL));
|
||||
|
||||
temp1[0] = temp1[1];
|
||||
|
||||
temp2[2] = ixheaacd_mult32x16in32(temp1[0], twid_re) +
|
||||
ixheaacd_mult32x16in32(temp1[1], twid_im);
|
||||
temp2[3] = -ixheaacd_mult32x16in32(temp1[1], twid_re) +
|
||||
ixheaacd_mult32x16in32(temp1[0], twid_im);
|
||||
temp2[2] = ixheaacd_add32_sat(ixheaacd_mult32x16in32(temp1[0], twid_re),
|
||||
ixheaacd_mult32x16in32(temp1[1], twid_im));
|
||||
temp2[3] = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(temp1[0], twid_im),
|
||||
ixheaacd_mult32x16in32(temp1[1], twid_re));
|
||||
|
||||
ptr_forward = output;
|
||||
ptr_reverse = &output[DCT3_LEN - 1];
|
||||
|
|
@ -129,10 +129,12 @@ VOID ixheaacd_dct3_32(WORD32 *input, WORD32 *output,
|
|||
temp2[0] = *ptr_forward++;
|
||||
temp2[1] = *ptr_forward--;
|
||||
|
||||
temp1[0] = -temp2[1] - temp2[3];
|
||||
temp1[1] = temp2[0] - temp2[2];
|
||||
temp2[0] = (temp2[0] + temp2[2] + temp1[0]);
|
||||
temp2[1] = (temp2[1] - temp2[3] + temp1[1]);
|
||||
temp1[0] = ixheaacd_negate32_sat(ixheaacd_add32_sat(temp2[1], temp2[3]));
|
||||
temp1[1] = ixheaacd_sub32_sat(temp2[0], temp2[2]);
|
||||
temp2[0] =
|
||||
ixheaacd_add32_sat(ixheaacd_add32_sat(temp2[0], temp2[2]), temp1[0]);
|
||||
temp2[1] =
|
||||
ixheaacd_add32_sat(ixheaacd_sub32_sat(temp2[1], temp2[3]), temp1[1]);
|
||||
|
||||
temp2[0] >>= 1;
|
||||
temp2[1] >>= 1;
|
||||
|
|
@ -154,25 +156,25 @@ VOID ixheaacd_dct3_32(WORD32 *input, WORD32 *output,
|
|||
twid_im = *twidle_fwd;
|
||||
twidle_fwd += 2;
|
||||
|
||||
temp1[0] = temp2[0] - temp2[2];
|
||||
temp1[1] = (temp2[0] + temp2[2]);
|
||||
temp1[0] = ixheaacd_sub32_sat(temp2[0], temp2[2]);
|
||||
temp1[1] = ixheaacd_add32_sat(temp2[0], temp2[2]);
|
||||
|
||||
temp1[2] = temp2[1] + temp2[3];
|
||||
temp1[3] = (temp2[1] - temp2[3]);
|
||||
temp1[2] = ixheaacd_add32_sat(temp2[1], temp2[3]);
|
||||
temp1[3] = ixheaacd_sub32_sat(temp2[1], temp2[3]);
|
||||
|
||||
temp1[4] = ixheaacd_mult32x16in32(temp1[0], twid_re) +
|
||||
ixheaacd_mult32x16in32(temp1[2], twid_im);
|
||||
temp1[5] = -ixheaacd_mult32x16in32(temp1[2], twid_re) +
|
||||
ixheaacd_mult32x16in32(temp1[0], twid_im);
|
||||
temp1[4] = ixheaacd_add32_sat(ixheaacd_mult32x16in32(temp1[0], twid_re),
|
||||
ixheaacd_mult32x16in32(temp1[2], twid_im));
|
||||
temp1[5] = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(temp1[0], twid_im),
|
||||
ixheaacd_mult32x16in32(temp1[2], twid_re));
|
||||
|
||||
temp1[1] >>= 1;
|
||||
temp1[3] >>= 1;
|
||||
|
||||
*ptr_forward++ = temp1[1] - temp1[4];
|
||||
*ptr_forward++ = temp1[3] + temp1[5];
|
||||
*ptr_forward++ = ixheaacd_sub32_sat(temp1[1], temp1[4]);
|
||||
*ptr_forward++ = ixheaacd_add32_sat(temp1[3], temp1[5]);
|
||||
|
||||
*ptr_reverse-- = -temp1[3] + temp1[5];
|
||||
*ptr_reverse-- = temp1[1] + temp1[4];
|
||||
*ptr_reverse-- = ixheaacd_sub32_sat(temp1[5], temp1[3]);
|
||||
*ptr_reverse-- = ixheaacd_add32_sat(temp1[1], temp1[4]);
|
||||
}
|
||||
temp2[0] = *ptr_forward++;
|
||||
temp2[1] = *ptr_forward--;
|
||||
|
|
@ -184,21 +186,21 @@ VOID ixheaacd_dct3_32(WORD32 *input, WORD32 *output,
|
|||
twid_im = *twidle_fwd;
|
||||
twidle_fwd += 2;
|
||||
|
||||
temp1[0] = temp2[0] - temp2[2];
|
||||
temp1[1] = (temp2[0] + temp2[2]);
|
||||
temp1[0] = ixheaacd_sub32_sat(temp2[0], temp2[2]);
|
||||
temp1[1] = ixheaacd_add32_sat(temp2[0], temp2[2]);
|
||||
|
||||
temp1[2] = temp2[1] + temp2[3];
|
||||
temp1[3] = (temp2[1] - temp2[3]);
|
||||
temp1[2] = ixheaacd_add32_sat(temp2[1], temp2[3]);
|
||||
temp1[3] = ixheaacd_sub32_sat(temp2[1], temp2[3]);
|
||||
|
||||
temp1[4] = ixheaacd_mult32x16in32(temp1[0], twid_re) -
|
||||
ixheaacd_mult32x16in32(temp1[2], twid_im);
|
||||
temp1[5] = ixheaacd_mult32x16in32(temp1[2], twid_re) +
|
||||
ixheaacd_mult32x16in32(temp1[0], twid_im);
|
||||
temp1[4] = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(temp1[0], twid_re),
|
||||
ixheaacd_mult32x16in32(temp1[2], twid_im));
|
||||
temp1[5] = ixheaacd_add32_sat(ixheaacd_mult32x16in32(temp1[2], twid_re),
|
||||
ixheaacd_mult32x16in32(temp1[0], twid_im));
|
||||
|
||||
temp1[1] >>= 1;
|
||||
temp1[3] >>= 1;
|
||||
*ptr_forward++ = temp1[1] + temp1[4];
|
||||
*ptr_forward++ = temp1[3] + temp1[5];
|
||||
*ptr_forward++ = ixheaacd_add32_sat(temp1[1], temp1[4]);
|
||||
*ptr_forward++ = ixheaacd_add32_sat(temp1[3], temp1[5]);
|
||||
|
||||
ixheaacd_radix4bfly(w_16, output, 1, 4);
|
||||
ixheaacd_postradixcompute4(input, output, p_table, 16);
|
||||
|
|
@ -314,7 +316,7 @@ VOID ixheaacd_fwd_modulation(const WORD32 *p_time_in1, WORD32 *real_subband,
|
|||
|
||||
*t_real_subband++ = ixheaacd_sub32_sat(temp1, temp2);
|
||||
;
|
||||
*t_imag_subband++ = ixheaacd_add32(temp1, temp2);
|
||||
*t_imag_subband++ = ixheaacd_add32_sat(temp1, temp2);
|
||||
;
|
||||
}
|
||||
|
||||
|
|
@ -332,8 +334,8 @@ VOID ixheaacd_fwd_modulation(const WORD32 *p_time_in1, WORD32 *real_subband,
|
|||
im = *imag_subband;
|
||||
cosh = *tcos++;
|
||||
sinh = *tcos++;
|
||||
*real_subband++ = ixheaacd_add32(ixheaacd_mult32x16in32_shl(re, cosh),
|
||||
ixheaacd_mult32x16in32_shl(im, sinh));
|
||||
*real_subband++ = ixheaacd_add32_sat(ixheaacd_mult32x16in32_shl(re, cosh),
|
||||
ixheaacd_mult32x16in32_shl(im, sinh));
|
||||
*imag_subband++ = ixheaacd_sub32_sat(ixheaacd_mult32x16in32_shl(im, cosh),
|
||||
ixheaacd_mult32x16in32_shl(re, sinh));
|
||||
}
|
||||
|
|
@ -582,27 +584,27 @@ VOID ixheaacd_esbr_radix4bfly(const WORD32 *w, WORD32 *x, WORD32 index1,
|
|||
|
||||
mul_11 = ixheaacd_mult64(xt2_0, co30);
|
||||
mul_3 = ixheaacd_mult64(yt2_0, si30);
|
||||
x[l2] = (WORD32)((mul_3 + mul_11) >> 32) << RADIXSHIFT;
|
||||
x[l2] = ixheaacd_sat64_32(((mul_3 + mul_11) >> 32) << RADIXSHIFT);
|
||||
|
||||
mul_5 = ixheaacd_mult64(xt2_0, si30);
|
||||
mul_9 = ixheaacd_mult64(yt2_0, co30);
|
||||
x[l2 + 1] = (WORD32)((mul_9 - mul_5) >> 32) << RADIXSHIFT;
|
||||
x[l2 + 1] = ixheaacd_sat64_32(((mul_9 - mul_5) >> 32) << RADIXSHIFT);
|
||||
|
||||
mul_12 = ixheaacd_mult64(xt0_0, co20);
|
||||
mul_2 = ixheaacd_mult64(yt0_0, si20);
|
||||
x[l1] = (WORD32)((mul_2 + mul_12) >> 32) << RADIXSHIFT;
|
||||
x[l1] = ixheaacd_sat64_32(((mul_2 + mul_12) >> 32) << RADIXSHIFT);
|
||||
|
||||
mul_6 = ixheaacd_mult64(xt0_0, si20);
|
||||
mul_8 = ixheaacd_mult64(yt0_0, co20);
|
||||
x[l1 + 1] = (WORD32)((mul_8 - mul_6) >> 32) << RADIXSHIFT;
|
||||
x[l1 + 1] = ixheaacd_sat64_32(((mul_8 - mul_6) >> 32) << RADIXSHIFT);
|
||||
|
||||
mul_4 = ixheaacd_mult64(xt1_0, co10);
|
||||
mul_1 = ixheaacd_mult64(yt1_0, si10);
|
||||
x[h2] = (WORD32)((mul_1 + mul_4) >> 32) << RADIXSHIFT;
|
||||
x[h2] = ixheaacd_sat64_32(((mul_1 + mul_4) >> 32) << RADIXSHIFT);
|
||||
|
||||
mul_10 = ixheaacd_mult64(xt1_0, si10);
|
||||
mul_7 = ixheaacd_mult64(yt1_0, co10);
|
||||
x[h2 + 1] = (WORD32)((mul_7 - mul_10) >> 32) << RADIXSHIFT;
|
||||
x[h2 + 1] = ixheaacd_sat64_32(((mul_7 - mul_10) >> 32) << RADIXSHIFT);
|
||||
|
||||
x += 2;
|
||||
}
|
||||
|
|
@ -718,23 +720,23 @@ VOID ixheaacd_esbr_postradixcompute4(WORD32 *ptr_y, WORD32 *ptr_x,
|
|||
x_6 = *x0++;
|
||||
x_7 = *x0++;
|
||||
|
||||
xh0_0 = x_0 + x_4;
|
||||
xh1_0 = x_1 + x_5;
|
||||
xl0_0 = x_0 - x_4;
|
||||
xl1_0 = x_1 - x_5;
|
||||
xh0_1 = x_2 + x_6;
|
||||
xh1_1 = x_3 + x_7;
|
||||
xl0_1 = x_2 - x_6;
|
||||
xl1_1 = x_3 - x_7;
|
||||
xh0_0 = ixheaacd_add32_sat(x_0, x_4);
|
||||
xh1_0 = ixheaacd_add32_sat(x_1, x_5);
|
||||
xl0_0 = ixheaacd_sub32_sat(x_0, x_4);
|
||||
xl1_0 = ixheaacd_sub32_sat(x_1, x_5);
|
||||
xh0_1 = ixheaacd_add32_sat(x_2, x_6);
|
||||
xh1_1 = ixheaacd_add32_sat(x_3, x_7);
|
||||
xl0_1 = ixheaacd_sub32_sat(x_2, x_6);
|
||||
xl1_1 = ixheaacd_sub32_sat(x_3, x_7);
|
||||
|
||||
n00 = xh0_0 + xh0_1;
|
||||
n01 = xh1_0 + xh1_1;
|
||||
n10 = xl0_0 + xl1_1;
|
||||
n11 = xl1_0 - xl0_1;
|
||||
n20 = xh0_0 - xh0_1;
|
||||
n21 = xh1_0 - xh1_1;
|
||||
n30 = xl0_0 - xl1_1;
|
||||
n31 = xl1_0 + xl0_1;
|
||||
n00 = ixheaacd_add32_sat(xh0_0, xh0_1);
|
||||
n01 = ixheaacd_add32_sat(xh1_0, xh1_1);
|
||||
n10 = ixheaacd_add32_sat(xl0_0, xl1_1);
|
||||
n11 = ixheaacd_sub32_sat(xl1_0, xl0_1);
|
||||
n20 = ixheaacd_sub32_sat(xh0_0, xh0_1);
|
||||
n21 = ixheaacd_sub32_sat(xh1_0, xh1_1);
|
||||
n30 = ixheaacd_sub32_sat(xl0_0, xl1_1);
|
||||
n31 = ixheaacd_add32_sat(xl1_0, xl0_1);
|
||||
|
||||
y0[h2] = n00;
|
||||
y0[h2 + 1] = n01;
|
||||
|
|
@ -754,23 +756,23 @@ VOID ixheaacd_esbr_postradixcompute4(WORD32 *ptr_y, WORD32 *ptr_x,
|
|||
x_e = *x2++;
|
||||
x_f = *x2++;
|
||||
|
||||
xh0_2 = x_8 + x_c;
|
||||
xh1_2 = x_9 + x_d;
|
||||
xl0_2 = x_8 - x_c;
|
||||
xl1_2 = x_9 - x_d;
|
||||
xh0_3 = x_a + x_e;
|
||||
xh1_3 = x_b + x_f;
|
||||
xl0_3 = x_a - x_e;
|
||||
xl1_3 = x_b - x_f;
|
||||
xh0_2 = ixheaacd_add32_sat(x_8, x_c);
|
||||
xh1_2 = ixheaacd_add32_sat(x_9, x_d);
|
||||
xl0_2 = ixheaacd_sub32_sat(x_8, x_c);
|
||||
xl1_2 = ixheaacd_sub32_sat(x_9, x_d);
|
||||
xh0_3 = ixheaacd_add32_sat(x_a, x_e);
|
||||
xh1_3 = ixheaacd_add32_sat(x_b, x_f);
|
||||
xl0_3 = ixheaacd_sub32_sat(x_a, x_e);
|
||||
xl1_3 = ixheaacd_sub32_sat(x_b, x_f);
|
||||
|
||||
n02 = xh0_2 + xh0_3;
|
||||
n03 = xh1_2 + xh1_3;
|
||||
n12 = xl0_2 + xl1_3;
|
||||
n13 = xl1_2 - xl0_3;
|
||||
n22 = xh0_2 - xh0_3;
|
||||
n23 = xh1_2 - xh1_3;
|
||||
n32 = xl0_2 - xl1_3;
|
||||
n33 = xl1_2 + xl0_3;
|
||||
n02 = ixheaacd_add32_sat(xh0_2, xh0_3);
|
||||
n03 = ixheaacd_add32_sat(xh1_2, xh1_3);
|
||||
n12 = ixheaacd_add32_sat(xl0_2, xl1_3);
|
||||
n13 = ixheaacd_sub32_sat(xl1_2, xl0_3);
|
||||
n22 = ixheaacd_sub32_sat(xh0_2, xh0_3);
|
||||
n23 = ixheaacd_sub32_sat(xh1_2, xh1_3);
|
||||
n32 = ixheaacd_sub32_sat(xl0_2, xl1_3);
|
||||
n33 = ixheaacd_add32_sat(xl1_2, xl0_3);
|
||||
|
||||
y0[h2 + 2] = n02;
|
||||
y0[h2 + 3] = n03;
|
||||
|
|
@ -978,8 +980,8 @@ VOID ixheaacd_esbr_cos_sin_mod(WORD32 *subband,
|
|||
(*ixheaacd_complex_fft_p2)(temp, &temp[8], 8, -1, &scaleshift);
|
||||
|
||||
for (z = 0; z < (qmf_bank->no_channels >> 1); z++) {
|
||||
subband[2 * z] = temp[z] << scaleshift;
|
||||
subband[2 * z + 1] = temp[z + 8] << scaleshift;
|
||||
subband[2 * z] = ixheaacd_shl32_sat(temp[z], scaleshift);
|
||||
subband[2 * z + 1] = ixheaacd_shl32_sat(temp[z + 8], scaleshift);
|
||||
}
|
||||
scaleshift = 0;
|
||||
for (z = 0; z < (qmf_bank->no_channels >> 1); z++) {
|
||||
|
|
@ -990,8 +992,8 @@ VOID ixheaacd_esbr_cos_sin_mod(WORD32 *subband,
|
|||
(*ixheaacd_complex_fft_p2)(temp, &temp[8], 8, -1, &scaleshift);
|
||||
|
||||
for (z = 0; z < (qmf_bank->no_channels >> 1); z++) {
|
||||
subband[64 + 2 * z] = temp[z] << scaleshift;
|
||||
subband[64 + 2 * z + 1] = temp[8 + z] << scaleshift;
|
||||
subband[64 + 2 * z] = ixheaacd_shl32_sat(temp[z], scaleshift);
|
||||
subband[64 + 2 * z + 1] = ixheaacd_shl32_sat(temp[8 + z], scaleshift);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1113,7 +1115,7 @@ VOID ixheaacd_esbr_fwd_modulation(
|
|||
|
||||
*t_real_subband++ = ixheaacd_sub32_sat(temp1, temp2);
|
||||
;
|
||||
*t_imag_subband++ = ixheaacd_add32(temp1, temp2);
|
||||
*t_imag_subband++ = ixheaacd_add32_sat(temp1, temp2);
|
||||
;
|
||||
}
|
||||
|
||||
|
|
@ -1131,13 +1133,14 @@ VOID ixheaacd_esbr_fwd_modulation(
|
|||
im = *imag_subband;
|
||||
cosh = *tcos++;
|
||||
sinh = *tcos++;
|
||||
*real_subband++ = (WORD32)((ixheaacd_add64(ixheaacd_mult64(re, cosh),
|
||||
ixheaacd_mult64(im, sinh))) >>
|
||||
31);
|
||||
*real_subband++ =
|
||||
ixheaacd_sat64_32((ixheaacd_add64(ixheaacd_mult64(re, cosh),
|
||||
ixheaacd_mult64(im, sinh))) >>
|
||||
31);
|
||||
*imag_subband++ =
|
||||
(WORD32)((ixheaacd_sub64_sat(ixheaacd_mult64(im, cosh),
|
||||
ixheaacd_mult64(re, sinh))) >>
|
||||
31);
|
||||
ixheaacd_sat64_32((ixheaacd_sub64_sat(ixheaacd_mult64(im, cosh),
|
||||
ixheaacd_mult64(re, sinh))) >>
|
||||
31);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1170,7 +1173,7 @@ VOID ixheaacd_esbr_qmfsyn64_winadd(WORD32 *tmp1, WORD32 *tmp2, WORD32 *inp1,
|
|||
syn_out =
|
||||
ixheaacd_add64(syn_out, ixheaacd_mult64(tmp2[1152 + k], inp1[k + 576]));
|
||||
|
||||
sample_buffer[ch_fac * k] = (WORD32)(syn_out >> 31);
|
||||
sample_buffer[ch_fac * k] = ixheaacd_sat64_32(syn_out >> 31);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1276,58 +1279,58 @@ VOID ixheaacd_radix4bfly(const WORD16 *w, WORD32 *x, WORD32 index1,
|
|||
x_l1_0 = x[l1];
|
||||
x_l2_0 = x[l2];
|
||||
|
||||
xh0_0 = x_0 + x_l1_0;
|
||||
xl0_0 = x_0 - x_l1_0;
|
||||
xh0_0 = ixheaacd_add32_sat(x_0, x_l1_0);
|
||||
xl0_0 = ixheaacd_sub32_sat(x_0, x_l1_0);
|
||||
|
||||
xh20_0 = x_h2_0 + x_l2_0;
|
||||
xl20_0 = x_h2_0 - x_l2_0;
|
||||
xh20_0 = ixheaacd_add32_sat(x_h2_0, x_l2_0);
|
||||
xl20_0 = ixheaacd_sub32_sat(x_h2_0, x_l2_0);
|
||||
|
||||
x[0] = xh0_0 + xh20_0;
|
||||
xt0_0 = xh0_0 - xh20_0;
|
||||
x[0] = ixheaacd_add32_sat(xh0_0, xh20_0);
|
||||
xt0_0 = ixheaacd_sub32_sat(xh0_0, xh20_0);
|
||||
|
||||
x_1 = x[1];
|
||||
x_h2_1 = x[h2 + 1];
|
||||
x_l1_1 = x[l1 + 1];
|
||||
x_l2_1 = x[l2 + 1];
|
||||
|
||||
xh1_0 = x_1 + x_l1_1;
|
||||
xl1_0 = x_1 - x_l1_1;
|
||||
xh1_0 = ixheaacd_add32_sat(x_1, x_l1_1);
|
||||
xl1_0 = ixheaacd_sub32_sat(x_1, x_l1_1);
|
||||
|
||||
xh21_0 = x_h2_1 + x_l2_1;
|
||||
xl21_0 = x_h2_1 - x_l2_1;
|
||||
xh21_0 = ixheaacd_add32_sat(x_h2_1, x_l2_1);
|
||||
xl21_0 = ixheaacd_sub32_sat(x_h2_1, x_l2_1);
|
||||
|
||||
x[1] = xh1_0 + xh21_0;
|
||||
yt0_0 = xh1_0 - xh21_0;
|
||||
x[1] = ixheaacd_add32_sat(xh1_0, xh21_0);
|
||||
yt0_0 = ixheaacd_sub32_sat(xh1_0, xh21_0);
|
||||
|
||||
xt1_0 = xl0_0 + xl21_0;
|
||||
xt2_0 = xl0_0 - xl21_0;
|
||||
xt1_0 = ixheaacd_add32_sat(xl0_0, xl21_0);
|
||||
xt2_0 = ixheaacd_sub32_sat(xl0_0, xl21_0);
|
||||
|
||||
yt2_0 = xl1_0 + xl20_0;
|
||||
yt1_0 = xl1_0 - xl20_0;
|
||||
yt2_0 = ixheaacd_add32_sat(xl1_0, xl20_0);
|
||||
yt1_0 = ixheaacd_sub32_sat(xl1_0, xl20_0);
|
||||
|
||||
mul_11 = ixheaacd_mult32x16in32(xt2_0, co30);
|
||||
mul_3 = ixheaacd_mult32x16in32(yt2_0, si30);
|
||||
x[l2] = (mul_3 + mul_11) << RADIXSHIFT;
|
||||
x[l2] = ixheaacd_shl32_sat((mul_3 + mul_11), RADIXSHIFT);
|
||||
|
||||
mul_5 = ixheaacd_mult32x16in32(xt2_0, si30);
|
||||
mul_9 = ixheaacd_mult32x16in32(yt2_0, co30);
|
||||
x[l2 + 1] = (mul_9 - mul_5) << RADIXSHIFT;
|
||||
x[l2 + 1] = ixheaacd_shl32_sat((mul_9 - mul_5), RADIXSHIFT);
|
||||
|
||||
mul_12 = ixheaacd_mult32x16in32(xt0_0, co20);
|
||||
mul_2 = ixheaacd_mult32x16in32(yt0_0, si20);
|
||||
x[l1] = (mul_2 + mul_12) << RADIXSHIFT;
|
||||
x[l1] = ixheaacd_shl32_sat((mul_2 + mul_12), RADIXSHIFT);
|
||||
|
||||
mul_6 = ixheaacd_mult32x16in32(xt0_0, si20);
|
||||
mul_8 = ixheaacd_mult32x16in32(yt0_0, co20);
|
||||
x[l1 + 1] = (mul_8 - mul_6) << RADIXSHIFT;
|
||||
x[l1 + 1] = ixheaacd_shl32_sat((mul_8 - mul_6), RADIXSHIFT);
|
||||
|
||||
mul_4 = ixheaacd_mult32x16in32(xt1_0, co10);
|
||||
mul_1 = ixheaacd_mult32x16in32(yt1_0, si10);
|
||||
x[h2] = (mul_1 + mul_4) << RADIXSHIFT;
|
||||
x[h2] = ixheaacd_shl32_sat((mul_1 + mul_4), RADIXSHIFT);
|
||||
|
||||
mul_10 = ixheaacd_mult32x16in32(xt1_0, si10);
|
||||
mul_7 = ixheaacd_mult32x16in32(yt1_0, co10);
|
||||
x[h2 + 1] = (mul_7 - mul_10) << RADIXSHIFT;
|
||||
x[h2 + 1] = ixheaacd_shl32_sat((mul_7 - mul_10), RADIXSHIFT);
|
||||
|
||||
x += 2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,8 +56,6 @@ IA_ERRORCODE impd_drc_mem_api(ia_drc_api_struct *p_obj_drc, WORD32 i_cmd,
|
|||
|
||||
IA_ERRORCODE impd_drc_fill_mem_tables(ia_drc_api_struct *p_obj_drc);
|
||||
|
||||
VOID impd_drc_set_default_config_params(ia_drc_config_struct *ptr_config);
|
||||
|
||||
IA_ERRORCODE impd_drc_process_frame(ia_drc_api_struct *p_obj_drc);
|
||||
IA_ERRORCODE impd_drc_init(ia_drc_api_struct *p_obj_drc);
|
||||
IA_ERRORCODE impd_drc_set_default_config(ia_drc_api_struct *p_obj_drc);
|
||||
|
|
@ -83,10 +81,10 @@ IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc);
|
|||
sizeof(ia_drc_sel_proc_output_struct) + \
|
||||
sizeof(ia_drc_peak_limiter_struct) + sizeof(ia_drc_peak_limiter_struct) + \
|
||||
sizeof(ia_drc_qmf_filt_struct) + ANALY_BUF_SIZE + SYNTH_BUF_SIZE + \
|
||||
PEAK_LIM_BUF_SIZE + MAX_BS_BUF_SIZE + /*DRC Config Bitstream*/ \
|
||||
MAX_DRC_CONFG_BUF_SIZE + /*DRC loudness info Bitstream*/ \
|
||||
MAX_LOUD_INFO_BUF_SIZE + /*DRC interface Bitstream*/ \
|
||||
MAX_INTERFACE_BUF_SIZE + \
|
||||
PEAK_LIM_BUF_SIZE + MAX_DRC_BS_BUF_SIZE + \
|
||||
MAX_DRC_CONFG_BUF_SIZE + /*DRC Config Bitstream*/ \
|
||||
MAX_LOUD_INFO_BUF_SIZE + /*DRC loudness info Bitstream*/ \
|
||||
MAX_INTERFACE_BUF_SIZE + /*DRC interface Bitstream*/ \
|
||||
NUM_GAIN_DEC_INSTANCES * \
|
||||
(SEL_DRC_COUNT * sizeof(ia_interp_buf_struct) * MAX_GAIN_ELE_COUNT + \
|
||||
sizeof(ia_eq_set_struct) + /*non_interleaved_audio*/ \
|
||||
|
|
@ -151,7 +149,7 @@ IA_ERRORCODE ia_drc_dec_api(pVOID p_ia_drc_dec_obj, WORD32 i_cmd, WORD32 i_idx,
|
|||
case IA_API_CMD_INIT: {
|
||||
switch (i_idx) {
|
||||
case IA_CMD_TYPE_INIT_SET_BUFF_PTR: {
|
||||
p_obj_drc->p_state->persistant_ptr =
|
||||
p_obj_drc->p_state->persistent_ptr =
|
||||
(UWORD8 *)p_obj_drc->pp_mem[IA_DRC_PERSIST_IDX] +
|
||||
sizeof(ia_drc_state_struct);
|
||||
impd_drc_set_struct_pointer(p_obj_drc);
|
||||
|
|
@ -207,11 +205,16 @@ IA_ERRORCODE ia_drc_dec_api(pVOID p_ia_drc_dec_obj, WORD32 i_cmd, WORD32 i_idx,
|
|||
}
|
||||
case IA_CMD_TYPE_INIT_CPY_BSF_BUFF: {
|
||||
memcpy(p_obj_drc->str_bit_handler.it_bit_buf +
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||
p_obj_drc->str_bit_handler.num_bytes_offset_bs,
|
||||
p_obj_drc->pp_mem[2], p_obj_drc->str_bit_handler.num_byts_cur);
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs =
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs +
|
||||
p_obj_drc->str_bit_handler.num_byts_cur;
|
||||
p_obj_drc->str_bit_handler.num_bytes_offset_bs =
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs;
|
||||
p_obj_drc->str_bit_handler.num_total_bytes =
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs;
|
||||
|
||||
break;
|
||||
}
|
||||
case IA_CMD_TYPE_INIT_CPY_IC_BSF_BUFF: {
|
||||
|
|
@ -268,60 +271,6 @@ IA_ERRORCODE ia_drc_dec_api(pVOID p_ia_drc_dec_obj, WORD32 i_cmd, WORD32 i_idx,
|
|||
}
|
||||
case IA_API_CMD_SET_CONFIG_PARAM: {
|
||||
switch (i_idx) {
|
||||
case IA_DRC_DEC_CONFIG_PARAM_DEC_TYPE: {
|
||||
if (*pus_value == 1) {
|
||||
p_obj_drc->str_config.dec_type = DEC_TYPE_TD_QMF64;
|
||||
p_obj_drc->str_config.sub_band_domain_mode =
|
||||
SUBBAND_DOMAIN_MODE_QMF64;
|
||||
p_obj_drc->str_config.sub_band_down_sampling_factor =
|
||||
AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF64;
|
||||
p_obj_drc->str_config.sub_band_count =
|
||||
AUDIO_CODEC_SUBBAND_COUNT_QMF64;
|
||||
} else if (*pus_value == 2) {
|
||||
p_obj_drc->str_config.dec_type = DEC_TYPE_QMF64;
|
||||
p_obj_drc->str_config.sub_band_domain_mode =
|
||||
SUBBAND_DOMAIN_MODE_QMF64;
|
||||
p_obj_drc->str_config.sub_band_down_sampling_factor =
|
||||
AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF64;
|
||||
p_obj_drc->str_config.sub_band_count =
|
||||
AUDIO_CODEC_SUBBAND_COUNT_QMF64;
|
||||
} else if (*pus_value == 3) {
|
||||
p_obj_drc->str_config.dec_type = DEC_TYPE_STFT256;
|
||||
p_obj_drc->str_config.sub_band_domain_mode =
|
||||
SUBBAND_DOMAIN_MODE_STFT256;
|
||||
p_obj_drc->str_config.sub_band_down_sampling_factor =
|
||||
AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_STFT256;
|
||||
p_obj_drc->str_config.sub_band_count =
|
||||
AUDIO_CODEC_SUBBAND_COUNT_STFT256;
|
||||
} else {
|
||||
p_obj_drc->str_config.dec_type = DEC_TYPE_TD;
|
||||
p_obj_drc->str_config.sub_band_domain_mode =
|
||||
SUBBAND_DOMAIN_MODE_OFF;
|
||||
}
|
||||
|
||||
if (*pus_value < 0 || *pus_value > 3) {
|
||||
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_DECODE_TYPE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IA_DRC_DEC_CONFIG_PARAM_CTRL_PARAM: {
|
||||
if (*pus_value < 1 || *pus_value > 39) {
|
||||
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_CTRL_PARAM_IDX;
|
||||
}
|
||||
p_obj_drc->str_config.control_parameter_index = *pus_value;
|
||||
break;
|
||||
}
|
||||
case IA_DRC_DEC_CONFIG_PARAM_PEAK_LIMITER: {
|
||||
if (*pus_value < 0 || *pus_value > 1) {
|
||||
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_PEAK_LIM_FLAG;
|
||||
}
|
||||
p_obj_drc->str_config.peak_limiter = *pus_value;
|
||||
break;
|
||||
}
|
||||
|
||||
case IA_DRC_DEC_CONFIG_PARAM_VER_MODE: {
|
||||
break;
|
||||
}
|
||||
case IA_DRC_DEC_CONFIG_PARAM_SAMP_FREQ: {
|
||||
if (*pus_value < 8000 || *pus_value > 96000) {
|
||||
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_SAMP_FREQ;
|
||||
|
|
@ -338,8 +287,13 @@ IA_ERRORCODE ia_drc_dec_api(pVOID p_ia_drc_dec_obj, WORD32 i_cmd, WORD32 i_idx,
|
|||
}
|
||||
|
||||
case IA_DRC_DEC_CONFIG_PARAM_PCM_WDSZ: {
|
||||
if ((*pus_value != 16) && (*pus_value != 32)) {
|
||||
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_PCM_SIZE;
|
||||
switch (*pus_value) {
|
||||
case 16:
|
||||
case 24:
|
||||
case 32:
|
||||
break;
|
||||
default:
|
||||
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_PCM_SIZE;
|
||||
}
|
||||
|
||||
p_obj_drc->str_config.pcm_size = *pus_value;
|
||||
|
|
@ -348,54 +302,9 @@ IA_ERRORCODE ia_drc_dec_api(pVOID p_ia_drc_dec_obj, WORD32 i_cmd, WORD32 i_idx,
|
|||
}
|
||||
|
||||
case IA_DRC_DEC_CONFIG_PARAM_BITS_FORMAT: {
|
||||
if ((*pus_value != 1) && (*pus_value != 0)) {
|
||||
return -1;
|
||||
}
|
||||
p_obj_drc->str_config.bitstream_file_format = *pus_value;
|
||||
|
||||
break;
|
||||
}
|
||||
case IA_DRC_DEC_CONFIG_PARAM_INT_PRESENT: {
|
||||
if ((*pus_value != 1) && (*pus_value != 0)) {
|
||||
return -1;
|
||||
}
|
||||
p_obj_drc->str_config.interface_bitstream_present = *pus_value;
|
||||
|
||||
break;
|
||||
}
|
||||
case IA_DRC_DEC_CONFIG_PARAM_DELAY_MODE: {
|
||||
if ((*pus_value != 1) && (*pus_value != 0)) {
|
||||
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_DELAY_MODE;
|
||||
}
|
||||
p_obj_drc->str_config.delay_mode = *pus_value;
|
||||
|
||||
break;
|
||||
}
|
||||
case IA_DRC_DEC_CONFIG_PARAM_GAIN_DELAY: {
|
||||
if ((*pus_value > MAX_SIGNAL_DELAY) || (*pus_value < 0)) {
|
||||
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_GAIN_DELAY;
|
||||
}
|
||||
|
||||
p_obj_drc->str_config.gain_delay_samples = *pus_value;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/*Sujith: introduce error*/
|
||||
case IA_DRC_DEC_CONFIG_PARAM_AUDIO_DELAY: {
|
||||
break;
|
||||
}
|
||||
case IA_DRC_DEC_CONFIG_PARAM_CON_DELAY_MODE: {
|
||||
if (*pus_value < 0 || *pus_value > 1) {
|
||||
return IA_DRC_DEC_CONFIG_PARAM_CON_DELAY_MODE;
|
||||
}
|
||||
p_obj_drc->str_config.constant_delay_on = *pus_value;
|
||||
|
||||
break;
|
||||
}
|
||||
case IA_DRC_DEC_CONFIG_PARAM_ABSO_DELAY_OFF: {
|
||||
p_obj_drc->str_config.absorb_delay_on = *pus_value;
|
||||
|
||||
break;
|
||||
}
|
||||
case IA_DRC_DEC_CONFIG_PARAM_FRAME_SIZE: {
|
||||
|
|
@ -408,7 +317,6 @@ IA_ERRORCODE ia_drc_dec_api(pVOID p_ia_drc_dec_obj, WORD32 i_cmd, WORD32 i_idx,
|
|||
break;
|
||||
}
|
||||
case IA_DRC_DEC_CONFIG_GAIN_STREAM_FLAG: {
|
||||
p_obj_drc->str_bit_handler.gain_stream_flag = *pus_value;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -460,12 +368,17 @@ IA_ERRORCODE ia_drc_dec_api(pVOID p_ia_drc_dec_obj, WORD32 i_cmd, WORD32 i_idx,
|
|||
} else if (p_obj_drc->str_config.dec_type == DEC_TYPE_TD) {
|
||||
error_code = impd_process_time_domain(p_obj_drc);
|
||||
} else if (p_obj_drc->str_config.dec_type == DEC_TYPE_QMF64) {
|
||||
error_code = impd_init_process_audio_main_qmf(p_obj_drc);
|
||||
error_code = IA_FATAL_ERROR;
|
||||
} else if (p_obj_drc->str_config.dec_type == DEC_TYPE_STFT256) {
|
||||
error_code = impd_init_process_audio_main_stft(p_obj_drc);
|
||||
error_code = IA_FATAL_ERROR;
|
||||
} else if (p_obj_drc->str_config.dec_type == DEC_TYPE_TD_QMF64) {
|
||||
error_code = impd_init_process_audio_main_td_qmf(p_obj_drc);
|
||||
error_code = IA_FATAL_ERROR;
|
||||
}
|
||||
p_obj_drc->str_bit_handler.byte_index_bs =
|
||||
p_obj_drc->str_bit_handler.num_total_bytes -
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_offset_bs = 0;
|
||||
|
||||
break;
|
||||
}
|
||||
case IA_CMD_TYPE_DONE_QUERY: {
|
||||
|
|
@ -499,22 +412,6 @@ IA_ERRORCODE ia_drc_dec_api(pVOID p_ia_drc_dec_obj, WORD32 i_cmd, WORD32 i_idx,
|
|||
p_obj_drc->p_state->ui_exe_done = 1;
|
||||
break;
|
||||
}
|
||||
case IA_API_CMD_INPUT_OVER_BS: {
|
||||
p_obj_drc->str_bit_handler.cpy_over = 1;
|
||||
break;
|
||||
}
|
||||
case IA_API_CMD_INPUT_OVER_IC_BS: {
|
||||
p_obj_drc->str_bit_handler.cpy_over_ic = 1;
|
||||
break;
|
||||
}
|
||||
case IA_API_CMD_INPUT_OVER_IL_BS: {
|
||||
p_obj_drc->str_bit_handler.cpy_over_il = 1;
|
||||
break;
|
||||
}
|
||||
case IA_API_CMD_INPUT_OVER_IN_BS: {
|
||||
p_obj_drc->str_bit_handler.cpy_over_in = 1;
|
||||
break;
|
||||
}
|
||||
case IA_API_CMD_SET_INPUT_BYTES_BS: {
|
||||
p_obj_drc->str_bit_handler.num_byts_cur = *pus_value;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -71,6 +71,8 @@ typedef struct bits_handler {
|
|||
WORD32 num_bits_read_bs;
|
||||
WORD32 num_bytes_read_bs;
|
||||
WORD32 num_bytes_bs;
|
||||
WORD32 num_bytes_offset_bs;
|
||||
WORD32 num_total_bytes;
|
||||
WORD32 num_bits_offset_bs;
|
||||
WORD32 byte_index_bs;
|
||||
WORD32 num_byts_cur;
|
||||
|
|
@ -112,7 +114,7 @@ typedef struct ia_drc_state_struct {
|
|||
UWORD32 ui_ir_used;
|
||||
WORD32 delay_in_output;
|
||||
WORD32 delay_adjust_samples;
|
||||
pVOID persistant_ptr;
|
||||
pVOID persistent_ptr;
|
||||
} ia_drc_state_struct;
|
||||
|
||||
typedef struct IA_PSM_API_Struct {
|
||||
|
|
|
|||
|
|
@ -121,6 +121,9 @@ WORD32 impd_init_drc_bitstream_dec(ia_drc_bits_dec_struct* p_drc_bs_dec_struct,
|
|||
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;
|
||||
if (sample_rate < MIN_DRC_SAMP_FREQ) {
|
||||
return -1;
|
||||
}
|
||||
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 /
|
||||
|
|
@ -131,9 +134,6 @@ WORD32 impd_init_drc_bitstream_dec(ia_drc_bits_dec_struct* p_drc_bs_dec_struct,
|
|||
(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) {
|
||||
|
|
@ -165,51 +165,6 @@ WORD32 impd_init_drc_bitstream_dec(ia_drc_bits_dec_struct* p_drc_bs_dec_struct,
|
|||
return err_code;
|
||||
}
|
||||
|
||||
WORD32 impd_process_drc_bitstream_dec(
|
||||
ia_drc_bits_dec_struct* p_drc_bs_dec_struct, ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_config* pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
UWORD8* bitstream_config, WORD32 num_bytes, WORD32 num_bits_offset,
|
||||
WORD32* num_bits_read) {
|
||||
WORD32 err_code = 0;
|
||||
|
||||
WORD32 loudness_info_set_present, drc_config_present, dummy;
|
||||
|
||||
if (bitstream_config == NULL) {
|
||||
*num_bits_read = 0;
|
||||
} else {
|
||||
it_bit_buff =
|
||||
impd_create_init_bit_buf(it_bit_buff, bitstream_config, num_bytes);
|
||||
|
||||
dummy = impd_read_bits_buf(it_bit_buff, num_bits_offset);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
loudness_info_set_present = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
if (loudness_info_set_present) {
|
||||
drc_config_present = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
if (drc_config_present) {
|
||||
err_code = impd_parse_drc_config(
|
||||
it_bit_buff, &p_drc_bs_dec_struct->ia_drc_params_struct,
|
||||
pstr_drc_config);
|
||||
|
||||
if (err_code) return (err_code);
|
||||
}
|
||||
|
||||
err_code = impd_parse_loudness_info_set(it_bit_buff, pstr_loudness_info);
|
||||
|
||||
if (err_code) return (err_code);
|
||||
}
|
||||
|
||||
*num_bits_read = it_bit_buff->size - it_bit_buff->cnt_bits;
|
||||
}
|
||||
|
||||
return err_code;
|
||||
}
|
||||
|
||||
WORD32 impd_process_drc_bitstream_dec_config(
|
||||
ia_drc_bits_dec_struct* p_drc_bs_dec_struct, ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_config* pstr_drc_config, UWORD8* bitstream_config,
|
||||
|
|
|
|||
|
|
@ -25,13 +25,6 @@ WORD32 impd_init_drc_bitstream_dec(
|
|||
WORD32 frame_size, WORD32 delay_mode, WORD32 lfe_channel_map_count,
|
||||
WORD32* lfe_channel_map);
|
||||
|
||||
WORD32 impd_process_drc_bitstream_dec(
|
||||
ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
||||
ia_bit_buf_struct* it_bit_buff, ia_drc_config* pstr_drc_config,
|
||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||
UWORD8* bitstream_config, WORD32 num_bytes, WORD32 num_bits_offset,
|
||||
WORD32* num_bits_read);
|
||||
|
||||
WORD32 impd_process_drc_bitstream_dec_config(
|
||||
ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
||||
ia_bit_buf_struct* it_bit_buff, ia_drc_config* pstr_drc_config,
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ extern "C" {
|
|||
|
||||
#define NUM_ELE_IN_CPLX_NUM 2
|
||||
#define MAX_BS_BUF_SIZE 768
|
||||
#define MAX_NUM_DRC_PAYROLL 3
|
||||
#define MAX_DRC_BS_BUF_SIZE (MAX_BS_BUF_SIZE * MAX_NUM_DRC_PAYROLL)
|
||||
#define MAX_DRC_CONFG_BUF_SIZE MAX_BS_BUF_SIZE
|
||||
#define MAX_LOUD_INFO_BUF_SIZE MAX_BS_BUF_SIZE
|
||||
#define MAX_INTERFACE_BUF_SIZE MAX_BS_BUF_SIZE
|
||||
|
|
@ -213,6 +215,8 @@ extern "C" {
|
|||
|
||||
#define SLOPE_FACTOR_DB_TO_LINEAR 0.1151f
|
||||
|
||||
#define MIN_DRC_SAMP_FREQ 1000
|
||||
|
||||
#ifndef min
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -272,8 +272,10 @@ WORD32 impd_dec_times(ia_bit_buf_struct* it_bit_buff,
|
|||
e++;
|
||||
}
|
||||
}
|
||||
str_node[k].time = time_offs + time_delta * delta_tmin;
|
||||
time_offs = str_node[k].time;
|
||||
time_offs += time_delta * delta_tmin;
|
||||
if (time_offs >= (2 * AUDIO_CODEC_FRAME_SIZE_MAX - drc_frame_size))
|
||||
return UNEXPECTED_ERROR;
|
||||
str_node[k].time = time_offs;
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
|
|
@ -295,9 +297,13 @@ WORD32 impd_drc_uni_gain_read(ia_bit_buf_struct* it_bit_buff,
|
|||
for (seq = 0; seq < gain_sequence_count; seq++) {
|
||||
WORD32 index = drc_config->str_p_loc_drc_coefficients_uni_drc[0]
|
||||
.gain_set_params_index_for_gain_sequence[seq];
|
||||
ia_gain_set_params_struct* gain_set_params =
|
||||
&(drc_config->str_p_loc_drc_coefficients_uni_drc
|
||||
->gain_set_params[index]);
|
||||
ia_gain_set_params_struct str_gain_set_params = {0};
|
||||
ia_gain_set_params_struct* gain_set_params = &str_gain_set_params;
|
||||
|
||||
if (index != -1) {
|
||||
gain_set_params = &(drc_config->str_p_loc_drc_coefficients_uni_drc
|
||||
->gain_set_params[index]);
|
||||
}
|
||||
if (gain_set_params->gain_coding_profile ==
|
||||
GAIN_CODING_PROFILE_CONSTANT) {
|
||||
str_spline_nodes =
|
||||
|
|
@ -394,6 +400,9 @@ WORD32 impd_parse_spline_nodes(ia_bit_buf_struct* it_bit_buff,
|
|||
}
|
||||
|
||||
if (it_bit_buff->ptr_bit_buf_base == NULL) {
|
||||
if ((str_spline_nodes->num_nodes < 1) ||
|
||||
(str_spline_nodes->num_nodes > NODE_COUNT_MAX))
|
||||
return UNEXPECTED_ERROR;
|
||||
FLOAT32 prev_db_gain =
|
||||
str_spline_nodes->str_node[str_spline_nodes->num_nodes - 1].loc_db_gain;
|
||||
str_spline_nodes->drc_gain_coding_mode = 0;
|
||||
|
|
@ -413,6 +422,9 @@ WORD32 impd_parse_spline_nodes(ia_bit_buf_struct* it_bit_buff,
|
|||
} else {
|
||||
str_spline_nodes->drc_gain_coding_mode = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error == PROC_COMPLETE) {
|
||||
if ((str_spline_nodes->num_nodes < 1) ||
|
||||
(str_spline_nodes->num_nodes > NODE_COUNT_MAX))
|
||||
return UNEXPECTED_ERROR;
|
||||
str_spline_nodes->drc_gain_coding_mode = 0;
|
||||
str_spline_nodes->str_node[0].slope = 0.0;
|
||||
str_spline_nodes->str_node[0].time =
|
||||
|
|
@ -509,9 +521,12 @@ WORD32 impd_parse_drc_gain_sequence(
|
|||
}
|
||||
}
|
||||
for (k = 0; k < num_nodes_node_reservoir; k++) {
|
||||
drc_gain_sequence->str_spline_nodes[i].str_node[k].time =
|
||||
prev_frame_time_buf[k] -
|
||||
2 * pstr_drc_uni_bs_dec->ia_drc_params_struct.drc_frame_size;
|
||||
WORD32 tmp = prev_frame_time_buf[k] -
|
||||
2 * pstr_drc_uni_bs_dec->ia_drc_params_struct.drc_frame_size;
|
||||
if (tmp >= (2 * AUDIO_CODEC_FRAME_SIZE_MAX -
|
||||
pstr_drc_uni_bs_dec->ia_drc_params_struct.drc_frame_size))
|
||||
return UNEXPECTED_ERROR;
|
||||
drc_gain_sequence->str_spline_nodes[i].str_node[k].time = tmp;
|
||||
}
|
||||
for (m = 0; m < num_nodes_cur; m++, k++) {
|
||||
drc_gain_sequence->str_spline_nodes[i].str_node[k].time =
|
||||
|
|
@ -574,6 +589,11 @@ WORD32 impd_parse_drc_ext_v1(ia_bit_buf_struct* it_bit_buff,
|
|||
|
||||
drc_instructions_uni_drc_v1_count = impd_read_bits_buf(it_bit_buff, 6);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (drc_config->drc_instructions_uni_drc_count +
|
||||
drc_instructions_uni_drc_v1_count >
|
||||
DRC_INSTRUCTIONS_COUNT_MAX)
|
||||
return (UNEXPECTED_ERROR);
|
||||
|
||||
for (i = 0; i < drc_instructions_uni_drc_v1_count; i++) {
|
||||
err = impd_parse_drc_instructions_uni_drc(
|
||||
it_bit_buff, version, drc_config,
|
||||
|
|
@ -591,9 +611,6 @@ WORD32 impd_parse_drc_ext_v1(ia_bit_buf_struct* it_bit_buff,
|
|||
if (str_drc_config_ext->loud_eq_instructions_flag == 1) {
|
||||
str_drc_config_ext->loud_eq_instructions_count =
|
||||
impd_read_bits_buf(it_bit_buff, 4);
|
||||
if (str_drc_config_ext->loud_eq_instructions_count >
|
||||
LOUD_EQ_INSTRUCTIONS_COUNT_MAX)
|
||||
return UNEXPECTED_ERROR;
|
||||
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (str_drc_config_ext->loud_eq_instructions_count >
|
||||
|
|
@ -1072,7 +1089,7 @@ WORD32 impd_parser_td_filter_cascade(
|
|||
WORD32 impd_parse_eq_instructions(
|
||||
ia_bit_buf_struct* it_bit_buff, ia_drc_config* drc_config,
|
||||
ia_eq_instructions_struct* str_eq_instructions) {
|
||||
WORD32 i, k, channel_count, temp;
|
||||
WORD32 i, channel_count, temp;
|
||||
WORD32 dmix_id_present, additional_dmix_id_present,
|
||||
additional_dmix_id_cnt = 0;
|
||||
WORD32 additional_drc_set_id_present, additional_drc_set_id_cnt;
|
||||
|
|
@ -1182,22 +1199,20 @@ WORD32 impd_parse_eq_instructions(
|
|||
str_eq_instructions->eq_ch_group_count = 0;
|
||||
|
||||
for (i = 0; i < channel_count; i++) {
|
||||
WORD32 new_group = 1;
|
||||
str_eq_instructions->eq_ch_group_of_channel[i] =
|
||||
impd_read_bits_buf(it_bit_buff, 7);
|
||||
WORD32 tmp = impd_read_bits_buf(it_bit_buff, 7);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
for (k = 0; k < i; k++) {
|
||||
if (str_eq_instructions->eq_ch_group_of_channel[i] ==
|
||||
str_eq_instructions->eq_ch_group_of_channel[k]) {
|
||||
new_group = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (new_group == 1) {
|
||||
str_eq_instructions->eq_ch_group_count += 1;
|
||||
}
|
||||
if (tmp >= EQ_CHANNEL_GROUP_COUNT_MAX) return UNEXPECTED_ERROR;
|
||||
str_eq_instructions->eq_ch_group_of_channel[i] = tmp;
|
||||
}
|
||||
{
|
||||
WORD32 total;
|
||||
WORD32 groups_used[EQ_CHANNEL_GROUP_COUNT_MAX] = {0};
|
||||
for (i = 0; i < channel_count; i++)
|
||||
groups_used[str_eq_instructions->eq_ch_group_of_channel[i]] = 1;
|
||||
total = 0;
|
||||
for (i = 0; i < EQ_CHANNEL_GROUP_COUNT_MAX; i++)
|
||||
if (groups_used[i]) total++;
|
||||
str_eq_instructions->eq_ch_group_count = total;
|
||||
}
|
||||
|
||||
if (str_eq_instructions->eq_ch_group_count > EQ_CHANNEL_GROUP_COUNT_MAX)
|
||||
|
|
@ -1208,9 +1223,10 @@ WORD32 impd_parse_eq_instructions(
|
|||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
if (str_eq_instructions->td_filter_cascade_present) {
|
||||
impd_parser_td_filter_cascade(
|
||||
WORD32 err = impd_parser_td_filter_cascade(
|
||||
it_bit_buff, str_eq_instructions,
|
||||
&(str_eq_instructions->str_td_filter_cascade));
|
||||
if (err) return err;
|
||||
}
|
||||
|
||||
str_eq_instructions->subband_gains_present =
|
||||
|
|
@ -1219,9 +1235,10 @@ WORD32 impd_parse_eq_instructions(
|
|||
|
||||
if (str_eq_instructions->subband_gains_present) {
|
||||
for (i = 0; i < str_eq_instructions->eq_ch_group_count; i++) {
|
||||
str_eq_instructions->subband_gains_index[i] =
|
||||
impd_read_bits_buf(it_bit_buff, 6);
|
||||
WORD32 tmp = impd_read_bits_buf(it_bit_buff, 6);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (tmp >= UNIQUE_SUBBAND_GAIN_COUNT_MAX) return UNEXPECTED_ERROR;
|
||||
str_eq_instructions->subband_gains_index[i] = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1254,26 +1254,6 @@ VOID impd_pole_zero_filt_process(ia_pole_zero_filt_struct* pstr_pole_zero_filt,
|
|||
return;
|
||||
}
|
||||
|
||||
VOID impd_subband_filter_process(ia_subband_filt_struct* pstr_subband_filt,
|
||||
FLOAT32* ptr_audio_real_buff,
|
||||
FLOAT32* ptr_audio_imag_buff) {
|
||||
WORD32 i, j;
|
||||
WORD32 eq_frame_size_subband = pstr_subband_filt->eq_frame_size_subband;
|
||||
WORD32 coeff_count = pstr_subband_filt->coeff_count;
|
||||
|
||||
FLOAT32* ptr_subband_coeff = pstr_subband_filt->subband_coeff;
|
||||
|
||||
for (i = 0; i < eq_frame_size_subband; i++) {
|
||||
for (j = 0; j < coeff_count; j++) {
|
||||
ptr_audio_real_buff[j] *= ptr_subband_coeff[j];
|
||||
ptr_audio_imag_buff[j] *= ptr_subband_coeff[j];
|
||||
}
|
||||
ptr_audio_real_buff += coeff_count;
|
||||
ptr_audio_imag_buff += coeff_count;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
VOID impd_phase_align_filt_process(
|
||||
ia_ph_alignment_filt_struct* ph_alignment_filt, WORD32 channel,
|
||||
FLOAT32* ptr_audio_out) {
|
||||
|
|
@ -1365,23 +1345,3 @@ WORD32 impd_process_eq_set_time_domain(ia_eq_set_struct* pstr_eq_set,
|
|||
return 0;
|
||||
}
|
||||
|
||||
WORD32 impd_process_eq_set_subband_domain(ia_eq_set_struct* pstr_eq_set,
|
||||
WORD32 channel,
|
||||
FLOAT32* ptr_audio_real_buff,
|
||||
FLOAT32* ptr_audio_imag_buff) {
|
||||
WORD32 g;
|
||||
|
||||
if (pstr_eq_set != NULL) {
|
||||
g = pstr_eq_set->eq_ch_group_of_channel[channel];
|
||||
if (g >= 0) {
|
||||
if (pstr_eq_set->domain == 0) {
|
||||
return (-1);
|
||||
} else {
|
||||
impd_subband_filter_process(&pstr_eq_set->subband_filt[g],
|
||||
&ptr_audio_real_buff[0],
|
||||
&ptr_audio_imag_buff[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,11 +178,6 @@ impd_process_eq_set_td(ia_eq_set_struct* eq_set, WORD32 channel,
|
|||
WORD32 impd_process_eq_set_time_domain(ia_eq_set_struct* eq_set, WORD32 channel,
|
||||
FLOAT32* audio_in, FLOAT32* audio_out,
|
||||
WORD32 frame_size);
|
||||
WORD32
|
||||
impd_process_eq_set_subband_domain(ia_eq_set_struct* eq_set, WORD32 channel,
|
||||
FLOAT32* subbandSampleIn,
|
||||
FLOAT32* subbandSampleOut);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -87,9 +87,6 @@ WORD32
|
|||
impd_get_delta_tmin(const WORD32 sampling_rate) {
|
||||
WORD32 lowerBound = (WORD32)(0.5f + 0.0005f * sampling_rate);
|
||||
WORD32 result = 1;
|
||||
if (sampling_rate < 1000) {
|
||||
return (UNEXPECTED_ERROR);
|
||||
}
|
||||
while (result <= lowerBound) result = result << 1;
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,431 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "impd_type_def.h"
|
||||
#include "impd_drc_uni_tables.h"
|
||||
#include "impd_drc_uni_common.h"
|
||||
#include "impd_drc_struct.h"
|
||||
#include "impd_drc_filter_bank.h"
|
||||
#include "impd_drc_rom.h"
|
||||
|
||||
VOID impd_compute_filt_coeff(WORD32 crossover_freq_idx,
|
||||
ia_iir_filter_struct* pstr_lp_filt_coeff,
|
||||
ia_iir_filter_struct* pstr_hp_filt_coeff,
|
||||
ia_iir_filter_struct* pstr_ap_filt_coeff,
|
||||
WORD32 filter_type) {
|
||||
FLOAT32 gamma = normal_cross_freq[crossover_freq_idx].gamma;
|
||||
FLOAT32 delta = normal_cross_freq[crossover_freq_idx].delta;
|
||||
|
||||
if (filter_type == 0 || filter_type == 2) {
|
||||
pstr_lp_filt_coeff->a0 = 1.0f;
|
||||
pstr_lp_filt_coeff->a1 = 2.0f * (gamma - delta);
|
||||
pstr_lp_filt_coeff->a2 = 2.0f * (gamma + delta) - 1.0f;
|
||||
pstr_lp_filt_coeff->b0 = gamma;
|
||||
pstr_lp_filt_coeff->b1 = 2.0f * gamma;
|
||||
pstr_lp_filt_coeff->b2 = gamma;
|
||||
|
||||
pstr_hp_filt_coeff->a0 = 1.0f;
|
||||
pstr_hp_filt_coeff->a1 = pstr_lp_filt_coeff->a1;
|
||||
pstr_hp_filt_coeff->a2 = pstr_lp_filt_coeff->a2;
|
||||
pstr_hp_filt_coeff->b0 = delta;
|
||||
pstr_hp_filt_coeff->b1 = -2.0f * delta;
|
||||
pstr_hp_filt_coeff->b2 = delta;
|
||||
}
|
||||
|
||||
if (filter_type == 1 || filter_type == 2) {
|
||||
pstr_ap_filt_coeff->a0 = 1.0f;
|
||||
pstr_ap_filt_coeff->a1 = 2.0f * (gamma - delta);
|
||||
;
|
||||
pstr_ap_filt_coeff->a2 = 2.0f * (gamma + delta) - 1.0f;
|
||||
;
|
||||
pstr_ap_filt_coeff->b0 = pstr_ap_filt_coeff->a2;
|
||||
pstr_ap_filt_coeff->b1 = pstr_ap_filt_coeff->a1;
|
||||
pstr_ap_filt_coeff->b2 = pstr_ap_filt_coeff->a0;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
WORD32 impd_initialize_filt_bank(WORD32 num_sub_bands,
|
||||
ia_gain_params_struct* gain_params,
|
||||
ia_drc_filter_bank_struct* drc_filter_bank) {
|
||||
ia_two_band_filt_struct* str_two_band_bank;
|
||||
ia_three_band_filt_struct* str_three_band_bank;
|
||||
ia_four_band_filt_struct* str_four_band_bank;
|
||||
drc_filter_bank->complexity = 0;
|
||||
drc_filter_bank->num_bands = num_sub_bands;
|
||||
|
||||
if (num_sub_bands == 1) {
|
||||
return 0;
|
||||
} else if (num_sub_bands == 2) {
|
||||
str_two_band_bank = &drc_filter_bank->str_two_band_bank;
|
||||
impd_compute_filt_coeff(gain_params[1].crossover_freq_idx,
|
||||
&(str_two_band_bank->low_pass),
|
||||
&(str_two_band_bank->high_pass), NULL, 0);
|
||||
} else if (num_sub_bands == 3) {
|
||||
str_three_band_bank = &drc_filter_bank->str_three_band_bank;
|
||||
|
||||
impd_compute_filt_coeff(gain_params[1].crossover_freq_idx,
|
||||
&(str_three_band_bank->str_low_pass_stage_2),
|
||||
&(str_three_band_bank->str_high_pass_stage_2),
|
||||
&(str_three_band_bank->str_all_pass_stage_2), 2);
|
||||
impd_compute_filt_coeff(gain_params[2].crossover_freq_idx,
|
||||
&(str_three_band_bank->str_low_pass_stage_1),
|
||||
&(str_three_band_bank->str_high_pass_stage_1), NULL,
|
||||
0);
|
||||
}
|
||||
|
||||
else if (num_sub_bands == 4) {
|
||||
str_four_band_bank = &drc_filter_bank->str_four_band_bank;
|
||||
|
||||
impd_compute_filt_coeff(gain_params[1].crossover_freq_idx,
|
||||
&(str_four_band_bank->str_low_pass_stage_3_low),
|
||||
&(str_four_band_bank->str_high_pass_stage_3_low),
|
||||
&(str_four_band_bank->str_all_pass_stage_2_high),
|
||||
2);
|
||||
impd_compute_filt_coeff(gain_params[2].crossover_freq_idx,
|
||||
&(str_four_band_bank->str_low_pass_stage_1),
|
||||
&(str_four_band_bank->str_high_pass_stage_1), NULL,
|
||||
0);
|
||||
impd_compute_filt_coeff(gain_params[3].crossover_freq_idx,
|
||||
&(str_four_band_bank->str_low_pass_stage_3_high),
|
||||
&(str_four_band_bank->str_high_pass_stage_3_high),
|
||||
&(str_four_band_bank->str_all_pass_stage_2_low), 2);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
WORD32 impd_init_all_filter_banks(
|
||||
ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc,
|
||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||
ia_filter_banks_struct* ia_filter_banks_struct) {
|
||||
WORD32 err_code = 0;
|
||||
WORD32 b, g, i, k, m, s, crossover_freq_idx, num_ch_in_groups,
|
||||
num_ph_align_ch_groups;
|
||||
WORD32 match_found = 0, num_filter;
|
||||
WORD32 cascade_cross_idx[CHANNEL_GROUP_COUNT_MAX + 1]
|
||||
[CHANNEL_GROUP_COUNT_MAX * 3];
|
||||
WORD32 count[CHANNEL_GROUP_COUNT_MAX + 1];
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
if (num_ch_in_groups < str_drc_instruction_str->audio_num_chan) {
|
||||
num_ph_align_ch_groups++;
|
||||
}
|
||||
|
||||
ia_filter_banks_struct->nfilter_banks =
|
||||
str_drc_instruction_str->num_drc_ch_groups;
|
||||
ia_filter_banks_struct->num_ph_align_ch_groups = num_ph_align_ch_groups;
|
||||
|
||||
if (str_p_loc_drc_coefficients_uni_drc == NULL) {
|
||||
ia_filter_banks_struct->str_drc_filter_bank->num_bands = 1;
|
||||
} else {
|
||||
for (g = 0; g < str_drc_instruction_str->num_drc_ch_groups; g++) {
|
||||
err_code = impd_initialize_filt_bank(
|
||||
str_p_loc_drc_coefficients_uni_drc
|
||||
->gain_set_params[str_drc_instruction_str
|
||||
->gain_set_index_for_channel_group[g]]
|
||||
.band_count,
|
||||
str_p_loc_drc_coefficients_uni_drc
|
||||
->gain_set_params[str_drc_instruction_str
|
||||
->gain_set_index_for_channel_group[g]]
|
||||
.gain_params,
|
||||
&(ia_filter_banks_struct->str_drc_filter_bank[g]));
|
||||
if (err_code != 0) return (err_code);
|
||||
}
|
||||
}
|
||||
|
||||
for (g = 0; g < CHANNEL_GROUP_COUNT_MAX + 1; g++) {
|
||||
count[g] = 0;
|
||||
}
|
||||
for (g = 0; g < str_drc_instruction_str->num_drc_ch_groups; g++) {
|
||||
for (b = 1;
|
||||
b < str_p_loc_drc_coefficients_uni_drc
|
||||
->gain_set_params[str_drc_instruction_str
|
||||
->gain_set_index_for_channel_group[g]]
|
||||
.band_count;
|
||||
b++) {
|
||||
crossover_freq_idx =
|
||||
str_p_loc_drc_coefficients_uni_drc
|
||||
->gain_set_params[str_drc_instruction_str
|
||||
->gain_set_index_for_channel_group[g]]
|
||||
.gain_params[b]
|
||||
.crossover_freq_idx;
|
||||
for (k = 0; k < num_ph_align_ch_groups; k++) {
|
||||
if (k != g) {
|
||||
cascade_cross_idx[k][count[k]] = crossover_freq_idx;
|
||||
count[k]++;
|
||||
if (count[k] > CHANNEL_GROUP_COUNT_MAX * 3) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while (i < count[0]) {
|
||||
crossover_freq_idx = cascade_cross_idx[0][i];
|
||||
match_found = 0;
|
||||
for (g = 1; g < num_ph_align_ch_groups; g++) {
|
||||
match_found = 0;
|
||||
for (k = 0; k < count[g]; k++) {
|
||||
if (cascade_cross_idx[g][k] == crossover_freq_idx) {
|
||||
match_found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (match_found == 0) break;
|
||||
}
|
||||
if (match_found == 1) {
|
||||
for (g = 0; g < num_ph_align_ch_groups; g++) {
|
||||
for (m = 0; m < count[g]; m++) {
|
||||
if (cascade_cross_idx[g][m] == crossover_freq_idx) {
|
||||
for (s = m + 1; s < count[g]; s++) {
|
||||
cascade_cross_idx[g][s - 1] = cascade_cross_idx[g][s];
|
||||
}
|
||||
count[g]--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
for (g = 0; g < num_ph_align_ch_groups; g++) {
|
||||
num_filter = count[g];
|
||||
if (num_filter > 0) {
|
||||
for (i = 0; i < num_filter; i++) {
|
||||
impd_compute_filt_coeff(
|
||||
cascade_cross_idx[g][i], NULL, NULL,
|
||||
&(ia_filter_banks_struct->str_drc_filter_bank[g]
|
||||
.str_all_pass_cascade.str_all_pass_cascade_filter[i]
|
||||
.str_all_pass_stage),
|
||||
1);
|
||||
}
|
||||
ia_filter_banks_struct->str_drc_filter_bank[g]
|
||||
.str_all_pass_cascade.num_filter = num_filter;
|
||||
}
|
||||
|
||||
if (err_code != 0) return (err_code);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
VOID impd_iir_second_order_filter_all_pass(ia_iir_filter_struct* filter,
|
||||
WORD32 chan_idx, WORD32 frame_len,
|
||||
FLOAT32* input, FLOAT32* output) {
|
||||
WORD32 i;
|
||||
FLOAT32 tmp;
|
||||
FLOAT32 a1 = filter->a1;
|
||||
FLOAT32 a2 = filter->a2;
|
||||
FLOAT32 b0 = filter->b0;
|
||||
FLOAT32 b1 = filter->b1;
|
||||
FLOAT32 b2 = filter->b2;
|
||||
|
||||
FLOAT32 st1 = filter->x_p[chan_idx * 2];
|
||||
FLOAT32 st2 = filter->y_p[chan_idx * 2];
|
||||
|
||||
for (i = 0; i < frame_len; i++) {
|
||||
tmp = input[i];
|
||||
output[i] = b0 * tmp + st1;
|
||||
st1 = b1 * tmp - a1 * output[i] + st2;
|
||||
st2 = b2 * tmp - a2 * output[i];
|
||||
}
|
||||
filter->x_p[chan_idx * 2] = st1;
|
||||
filter->y_p[chan_idx * 2] = st2;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
VOID impd_apply_low_high_filter(ia_iir_filter_struct* pstr_lp_filt_coeff,
|
||||
ia_iir_filter_struct* pstr_hp_filt_coeff,
|
||||
WORD32 chan_idx, WORD32 frame_len,
|
||||
FLOAT32* input, FLOAT32* output[]) {
|
||||
WORD32 i;
|
||||
FLOAT32 tmp, tmp1;
|
||||
FLOAT32 a1_l = pstr_lp_filt_coeff->a1;
|
||||
FLOAT32 a2_l = pstr_lp_filt_coeff->a2;
|
||||
FLOAT32 b0_l = pstr_lp_filt_coeff->b0;
|
||||
FLOAT32 b1_l = pstr_lp_filt_coeff->b1;
|
||||
FLOAT32 b2_l = pstr_lp_filt_coeff->b2;
|
||||
|
||||
FLOAT32 st1_l = pstr_lp_filt_coeff->x_p[chan_idx * 2 + 0];
|
||||
FLOAT32 st2_l = pstr_lp_filt_coeff->x_p[chan_idx * 2 + 1];
|
||||
FLOAT32 st3_l = pstr_lp_filt_coeff->y_p[chan_idx * 2 + 0];
|
||||
FLOAT32 st4_l = pstr_lp_filt_coeff->y_p[chan_idx * 2 + 1];
|
||||
|
||||
FLOAT32 a1_h = pstr_hp_filt_coeff->a1;
|
||||
FLOAT32 a2_h = pstr_hp_filt_coeff->a2;
|
||||
FLOAT32 b0_h = pstr_hp_filt_coeff->b0;
|
||||
FLOAT32 b1_h = pstr_hp_filt_coeff->b1;
|
||||
FLOAT32 b2_h = pstr_hp_filt_coeff->b2;
|
||||
|
||||
FLOAT32 st1_h = pstr_hp_filt_coeff->x_p[chan_idx * 2 + 0];
|
||||
FLOAT32 st2_h = pstr_hp_filt_coeff->x_p[chan_idx * 2 + 1];
|
||||
FLOAT32 st3_h = pstr_hp_filt_coeff->y_p[chan_idx * 2 + 0];
|
||||
FLOAT32 st4_h = pstr_hp_filt_coeff->y_p[chan_idx * 2 + 1];
|
||||
|
||||
FLOAT32* output_low = output[0];
|
||||
FLOAT32* output_high = output[1];
|
||||
|
||||
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];
|
||||
}
|
||||
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;
|
||||
|
||||
return;
|
||||
}
|
||||
VOID impd_two_band_filter_process(ia_two_band_filt_struct* str_two_band_bank,
|
||||
WORD32 chan_idx, WORD32 frame_len,
|
||||
FLOAT32* input, FLOAT32* output[]) {
|
||||
ia_iir_filter_struct* pstr_lp_filt_coeff = &str_two_band_bank->low_pass;
|
||||
ia_iir_filter_struct* pstr_hp_filt_coeff = &str_two_band_bank->high_pass;
|
||||
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, chan_idx,
|
||||
frame_len, input, output);
|
||||
return;
|
||||
}
|
||||
|
||||
VOID impd_three_band_filter_process(
|
||||
ia_three_band_filt_struct* str_three_band_bank, WORD32 c, WORD32 size,
|
||||
FLOAT32* input, FLOAT32* output[]) {
|
||||
WORD32 err_code = 0;
|
||||
ia_iir_filter_struct* all_pass_filter;
|
||||
ia_iir_filter_struct* pstr_lp_filt_coeff =
|
||||
&str_three_band_bank->str_low_pass_stage_1;
|
||||
ia_iir_filter_struct* pstr_hp_filt_coeff =
|
||||
&str_three_band_bank->str_high_pass_stage_1;
|
||||
FLOAT32* output1[2];
|
||||
output1[0] = output[0];
|
||||
output1[1] = output[1];
|
||||
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, c, size,
|
||||
input, output1);
|
||||
|
||||
all_pass_filter = &str_three_band_bank->str_all_pass_stage_2;
|
||||
|
||||
impd_iir_second_order_filter_all_pass(all_pass_filter, c, size, output1[1],
|
||||
output[2]);
|
||||
pstr_lp_filt_coeff = &str_three_band_bank->str_low_pass_stage_2;
|
||||
pstr_hp_filt_coeff = &str_three_band_bank->str_high_pass_stage_2;
|
||||
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, c, size,
|
||||
output1[0], output1);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
VOID impd_four_band_filter_process(ia_four_band_filt_struct* str_four_band_bank,
|
||||
WORD32 cha_idx, WORD32 win_size,
|
||||
FLOAT32* input, FLOAT32* output[]) {
|
||||
WORD32 err_code = 0;
|
||||
ia_iir_filter_struct* all_pass_filter;
|
||||
ia_iir_filter_struct* pstr_lp_filt_coeff =
|
||||
&str_four_band_bank->str_low_pass_stage_1;
|
||||
ia_iir_filter_struct* pstr_hp_filt_coeff =
|
||||
&str_four_band_bank->str_high_pass_stage_1;
|
||||
FLOAT32* output1[2];
|
||||
FLOAT32* output2[2];
|
||||
output1[0] = output[0];
|
||||
output1[1] = output[1];
|
||||
output2[0] = output[2];
|
||||
output2[1] = output[3];
|
||||
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, cha_idx,
|
||||
win_size, input, output1);
|
||||
|
||||
all_pass_filter = &str_four_band_bank->str_all_pass_stage_2_low;
|
||||
|
||||
impd_iir_second_order_filter_all_pass(all_pass_filter, cha_idx, win_size,
|
||||
output1[0], output1[0]);
|
||||
|
||||
all_pass_filter = &str_four_band_bank->str_all_pass_stage_2_high;
|
||||
|
||||
impd_iir_second_order_filter_all_pass(all_pass_filter, cha_idx, win_size,
|
||||
output1[1], output2[0]);
|
||||
|
||||
pstr_lp_filt_coeff = &str_four_band_bank->str_low_pass_stage_3_low;
|
||||
pstr_hp_filt_coeff = &str_four_band_bank->str_high_pass_stage_3_low;
|
||||
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, cha_idx,
|
||||
win_size, output1[0], output1);
|
||||
|
||||
pstr_lp_filt_coeff = &str_four_band_bank->str_low_pass_stage_3_high;
|
||||
pstr_hp_filt_coeff = &str_four_band_bank->str_high_pass_stage_3_high;
|
||||
|
||||
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, cha_idx,
|
||||
win_size, output2[0], 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) {
|
||||
WORD32 i;
|
||||
|
||||
for (i = 0; i < str_all_pass_cascade->num_filter; i++) {
|
||||
impd_iir_second_order_filter_all_pass(
|
||||
&(str_all_pass_cascade->str_all_pass_cascade_filter[i]
|
||||
.str_all_pass_stage),
|
||||
ch_idx, win_size, input, input);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
#include "impd_drc_eq.h"
|
||||
#include "impd_drc_gain_decoder.h"
|
||||
|
||||
extern ia_cicp_sigmoid_characteristic_param_struct
|
||||
extern const ia_cicp_sigmoid_characteristic_param_struct
|
||||
pstr_cicp_sigmoid_characteristic_param[];
|
||||
|
||||
WORD32 impd_gain_db_to_lin(ia_interp_params_struct* interp_params_str,
|
||||
|
|
@ -433,15 +433,15 @@ WORD32 impd_interpolate_drc_gain(ia_interp_params_struct* interp_params_str,
|
|||
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) {
|
||||
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);
|
||||
|
||||
slope_t1 = slope_t1 / (FLOAT32)interp_params_str->delta_tmin;
|
||||
slope_t2 = slope_t2 / (FLOAT32)interp_params_str->delta_tmin;
|
||||
if ((FLOAT32)fabs((FLOAT64)slope_t1) > (FLOAT32)fabs((FLOAT64)slope_t2)) {
|
||||
|
|
@ -522,14 +522,9 @@ WORD32 impd_interpolate_drc_gain(ia_interp_params_struct* interp_params_str,
|
|||
}
|
||||
}
|
||||
} else {
|
||||
err = impd_conv_to_linear_domain(interp_params_str, drc_band, gain1, slope1,
|
||||
&gain_t2, &slope_t2);
|
||||
if (err) return (err);
|
||||
|
||||
a = 0;
|
||||
b = gain_t2;
|
||||
|
||||
result[0] = gain_t2;
|
||||
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++) {
|
||||
FLOAT32 t = (FLOAT32)n;
|
||||
|
|
|
|||
|
|
@ -380,76 +380,6 @@ IA_ERRORCODE impd_drc_process_time_domain(
|
|||
return err_code;
|
||||
}
|
||||
|
||||
IA_ERRORCODE impd_drc_process_freq_domain(
|
||||
ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||
ia_drc_config* pstr_drc_config, ia_drc_gain_struct* pstr_drc_gain,
|
||||
FLOAT32* audio_real_buff[], FLOAT32* audio_imag_buff[],
|
||||
FLOAT32 loudness_normalization_gain_db, FLOAT32 boost, FLOAT32 compress,
|
||||
WORD32 drc_characteristic_target) {
|
||||
WORD32 sel_drc_index;
|
||||
IA_ERRORCODE err_code = 0;
|
||||
ia_drc_instructions_struct* str_drc_instruction_str =
|
||||
pstr_drc_config->str_drc_instruction_str;
|
||||
|
||||
if (p_drc_gain_dec_structs->eq_set) {
|
||||
WORD32 ch;
|
||||
|
||||
for (ch = 0; ch < p_drc_gain_dec_structs->eq_set->audio_num_chan; ch++) {
|
||||
err_code = impd_process_eq_set_subband_domain(
|
||||
p_drc_gain_dec_structs->eq_set, ch, audio_real_buff[ch],
|
||||
audio_imag_buff[ch]);
|
||||
if (err_code != IA_NO_ERROR) return (err_code);
|
||||
}
|
||||
}
|
||||
err_code = impd_store_audio_io_buffer_freq(
|
||||
audio_real_buff, audio_imag_buff,
|
||||
&p_drc_gain_dec_structs->audio_in_out_buf);
|
||||
if (err_code != IA_NO_ERROR) return (err_code);
|
||||
|
||||
if (pstr_drc_config->apply_drc) {
|
||||
for (sel_drc_index = 0;
|
||||
sel_drc_index <
|
||||
p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter;
|
||||
sel_drc_index++) {
|
||||
err_code = impd_get_drc_gain(
|
||||
p_drc_gain_dec_structs, pstr_drc_config, pstr_drc_gain, compress,
|
||||
boost, drc_characteristic_target, loudness_normalization_gain_db,
|
||||
sel_drc_index, &p_drc_gain_dec_structs->drc_gain_buffers);
|
||||
if (err_code != IA_NO_ERROR) return (err_code);
|
||||
}
|
||||
|
||||
if (p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter == 0) {
|
||||
err_code = impd_retrieve_audio_buffer_freq(
|
||||
audio_real_buff, audio_imag_buff,
|
||||
&p_drc_gain_dec_structs->audio_in_out_buf);
|
||||
if (err_code != IA_NO_ERROR) return (err_code);
|
||||
} else {
|
||||
for (sel_drc_index = 0;
|
||||
sel_drc_index <
|
||||
p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter;
|
||||
sel_drc_index++) {
|
||||
err_code = impd_apply_gains_subband(
|
||||
str_drc_instruction_str,
|
||||
p_drc_gain_dec_structs->ia_drc_params_struct
|
||||
.sel_drc_array[sel_drc_index]
|
||||
.drc_instructions_index,
|
||||
&p_drc_gain_dec_structs->ia_drc_params_struct,
|
||||
&(p_drc_gain_dec_structs->drc_gain_buffers
|
||||
.pstr_gain_buf[sel_drc_index]),
|
||||
&p_drc_gain_dec_structs->str_overlap_params,
|
||||
p_drc_gain_dec_structs->audio_in_out_buf.audio_buffer_delayed_real,
|
||||
p_drc_gain_dec_structs->audio_in_out_buf.audio_buffer_delayed_imag,
|
||||
audio_real_buff, audio_imag_buff);
|
||||
if (err_code != IA_NO_ERROR) return (err_code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
err_code =
|
||||
impd_advance_audio_buff_freq(&p_drc_gain_dec_structs->audio_in_out_buf);
|
||||
|
||||
return err_code;
|
||||
}
|
||||
|
||||
VOID impd_get_parametric_drc_delay(
|
||||
ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||
|
|
|
|||
|
|
@ -1,197 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "impd_type_def.h"
|
||||
#include "impd_drc_extr_delta_coded_info.h"
|
||||
#include "impd_drc_common.h"
|
||||
#include "impd_drc_struct.h"
|
||||
#include "impd_drc_interface.h"
|
||||
#include "impd_drc_selection_process.h"
|
||||
#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;
|
||||
|
||||
pstr_drc_sel_proc_params->loudness_normalization_on = 0;
|
||||
pstr_drc_sel_proc_params->target_loudness = -24.0f;
|
||||
|
||||
pstr_drc_sel_proc_params->loudness_deviation_max =
|
||||
LOUDNESS_DEVIATION_MAX_DEFAULT;
|
||||
|
||||
pstr_drc_sel_proc_params->loudness_measurement_method =
|
||||
USER_METHOD_DEFINITION_DEFAULT;
|
||||
pstr_drc_sel_proc_params->loudness_measurement_system =
|
||||
USER_MEASUREMENT_SYSTEM_DEFAULT;
|
||||
pstr_drc_sel_proc_params->loudness_measurement_pre_proc =
|
||||
USER_LOUDNESS_PREPROCESSING_DEFAULT;
|
||||
pstr_drc_sel_proc_params->device_cut_off_frequency = 500;
|
||||
pstr_drc_sel_proc_params->loudness_norm_gain_db_max =
|
||||
LOUDNESS_NORMALIZATION_GAIN_MAX_DEFAULT;
|
||||
pstr_drc_sel_proc_params->loudness_norm_gain_modification_db = 0.0f;
|
||||
pstr_drc_sel_proc_params->output_peak_level_max = 0.0f;
|
||||
if (pstr_drc_sel_proc_params->peak_limiter == 1) {
|
||||
pstr_drc_sel_proc_params->output_peak_level_max = 6.0f;
|
||||
}
|
||||
|
||||
pstr_drc_sel_proc_params->dynamic_range_control_on = 1;
|
||||
pstr_drc_sel_proc_params->num_bands_supported = 4;
|
||||
pstr_drc_sel_proc_params->num_drc_feature_requests = 0;
|
||||
|
||||
pstr_drc_sel_proc_params->boost = 1.f;
|
||||
pstr_drc_sel_proc_params->compress = 1.f;
|
||||
pstr_drc_sel_proc_params->drc_characteristic_target = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
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]);
|
||||
|
||||
pstr_drc_sel_proc_params->target_config_request_type =
|
||||
system_interface->target_config_request_type;
|
||||
switch (system_interface->target_config_request_type) {
|
||||
case 1:
|
||||
pstr_drc_sel_proc_params->requested_target_layout =
|
||||
system_interface->requested_target_layout;
|
||||
break;
|
||||
case 2:
|
||||
pstr_drc_sel_proc_params->requested_target_ch_count =
|
||||
system_interface->requested_target_ch_count;
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
pstr_drc_sel_proc_params->num_downmix_id_requests =
|
||||
system_interface->num_downmix_id_requests;
|
||||
for (i = 0; i < system_interface->num_downmix_id_requests; i++) {
|
||||
pstr_drc_sel_proc_params->requested_dwnmix_id[i] =
|
||||
system_interface->requested_dwnmix_id[i];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
pstr_drc_sel_proc_params->loudness_normalization_on =
|
||||
loudness_norm_ctrl_interface->loudness_normalization_on;
|
||||
pstr_drc_sel_proc_params->target_loudness =
|
||||
loudness_norm_ctrl_interface->target_loudness;
|
||||
|
||||
pstr_drc_sel_proc_params->album_mode =
|
||||
loudness_norm_param_interface->album_mode;
|
||||
pstr_drc_sel_proc_params->peak_limiter =
|
||||
loudness_norm_param_interface->peak_limiter;
|
||||
pstr_drc_sel_proc_params->loudness_deviation_max =
|
||||
loudness_norm_param_interface->loudness_deviation_max;
|
||||
pstr_drc_sel_proc_params->loudness_measurement_method =
|
||||
loudness_norm_param_interface->loudness_measurement_method;
|
||||
pstr_drc_sel_proc_params->loudness_measurement_system =
|
||||
loudness_norm_param_interface->loudness_measurement_system;
|
||||
pstr_drc_sel_proc_params->loudness_measurement_pre_proc =
|
||||
loudness_norm_param_interface->loudness_measurement_pre_proc;
|
||||
pstr_drc_sel_proc_params->device_cut_off_frequency =
|
||||
loudness_norm_param_interface->device_cut_off_frequency;
|
||||
pstr_drc_sel_proc_params->loudness_norm_gain_db_max =
|
||||
loudness_norm_param_interface->loudness_norm_gain_db_max;
|
||||
pstr_drc_sel_proc_params->loudness_norm_gain_modification_db =
|
||||
loudness_norm_param_interface->loudness_norm_gain_modification_db;
|
||||
pstr_drc_sel_proc_params->output_peak_level_max =
|
||||
loudness_norm_param_interface->output_peak_level_max;
|
||||
|
||||
pstr_drc_sel_proc_params->dynamic_range_control_on =
|
||||
drc_ctrl_interface->dynamic_range_control_on;
|
||||
pstr_drc_sel_proc_params->num_drc_feature_requests =
|
||||
drc_ctrl_interface->num_drc_feature_requests;
|
||||
for (i = 0; i < drc_ctrl_interface->num_drc_feature_requests; i++) {
|
||||
pstr_drc_sel_proc_params->drc_feature_req_type[i] =
|
||||
drc_ctrl_interface->drc_feature_req_type[i];
|
||||
switch (drc_ctrl_interface->drc_feature_req_type[i]) {
|
||||
case MATCH_EFFECT_TYPE:
|
||||
pstr_drc_sel_proc_params->requested_num_drc_effects[i] =
|
||||
requested_drc_effect_type->requested_num_drc_effects;
|
||||
pstr_drc_sel_proc_params->desired_num_drc_effects_of_requested[i] =
|
||||
requested_drc_effect_type->desired_num_drc_effects_of_requested;
|
||||
for (k = 0; k < requested_drc_effect_type->requested_num_drc_effects;
|
||||
k++) {
|
||||
pstr_drc_sel_proc_params->requested_drc_effect_type[i][k] =
|
||||
requested_drc_effect_type->requested_drc_effect_type[k];
|
||||
}
|
||||
break;
|
||||
case MATCH_DYNAMIC_RANGE:
|
||||
pstr_drc_sel_proc_params->requested_dyn_range_measur_type[i] =
|
||||
drc_ctrl_interface->requested_dyn_rng_measurement_type;
|
||||
pstr_drc_sel_proc_params->requested_dyn_range_range_flag[i] =
|
||||
drc_ctrl_interface->requested_dyn_range_is_single_val_flag;
|
||||
pstr_drc_sel_proc_params->requested_dyn_range_value[i] =
|
||||
drc_ctrl_interface->requested_dyn_range_value;
|
||||
pstr_drc_sel_proc_params->requested_dyn_range_min_val[i] =
|
||||
drc_ctrl_interface->requested_dyn_range_min_val;
|
||||
pstr_drc_sel_proc_params->requested_dyn_range_max_val[i] =
|
||||
drc_ctrl_interface->requested_dyn_range_max_val;
|
||||
break;
|
||||
case MATCH_DRC_CHARACTERISTIC:
|
||||
pstr_drc_sel_proc_params->requested_drc_characteristic[i] =
|
||||
drc_ctrl_interface->requested_drc_characteristic;
|
||||
break;
|
||||
default:
|
||||
return (UNEXPECTED_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
pstr_drc_sel_proc_params->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);
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
#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);
|
||||
|
||||
WORD32 impd_eval_custom_params_selection_process(
|
||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
|
@ -41,7 +41,6 @@
|
|||
#include "impd_drc_selection_process.h"
|
||||
#include "impd_drc_api_struct_def.h"
|
||||
#include "impd_drc_peak_limiter.h"
|
||||
#include "impd_drc_host_params.h"
|
||||
|
||||
#define PARAMETRIC_DRC_DELAY_MAX_DEFAULT 4096
|
||||
#define EQ_DELAY_MAX_DEFAULT 256
|
||||
|
|
@ -90,7 +89,7 @@ static WORD32 impd_match_downmix(WORD32 downmix_id, WORD32 dec_downmix_id) {
|
|||
|
||||
IA_ERRORCODE impd_drc_set_default_config(ia_drc_api_struct *p_obj_drc) {
|
||||
memset(p_obj_drc, 0, sizeof(*p_obj_drc));
|
||||
p_obj_drc->str_config.bitstream_file_format = 0;
|
||||
p_obj_drc->str_config.bitstream_file_format = 1;
|
||||
p_obj_drc->str_config.dec_type = 0;
|
||||
p_obj_drc->str_config.sub_band_domain_mode = 0;
|
||||
p_obj_drc->str_config.sub_band_count = 0;
|
||||
|
|
@ -102,10 +101,11 @@ IA_ERRORCODE impd_drc_set_default_config(ia_drc_api_struct *p_obj_drc) {
|
|||
p_obj_drc->str_config.control_parameter_index = -1;
|
||||
p_obj_drc->str_config.peak_limiter = 0;
|
||||
p_obj_drc->str_config.delay_mode = 0;
|
||||
p_obj_drc->str_config.interface_bitstream_present = 0;
|
||||
p_obj_drc->str_config.interface_bitstream_present = 1;
|
||||
p_obj_drc->str_config.gain_delay_samples = 0;
|
||||
p_obj_drc->str_config.absorb_delay_on = 1;
|
||||
p_obj_drc->str_config.subband_domain_io_flag = 0;
|
||||
p_obj_drc->str_bit_handler.gain_stream_flag = 1;
|
||||
p_obj_drc->str_config.constant_delay_on = 0;
|
||||
p_obj_drc->str_config.audio_delay_samples = 0;
|
||||
p_obj_drc->str_config.effect_type = 0;
|
||||
|
|
@ -274,79 +274,85 @@ IA_ERRORCODE impd_drc_set_default_bitstream_config(
|
|||
}
|
||||
|
||||
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;
|
||||
SIZE_T persistent_ptr = (SIZE_T)p_obj_drc->p_state->persistent_ptr;
|
||||
|
||||
SIZE_T persistent_size_consumed = 0;
|
||||
p_obj_drc->str_payload.pstr_bitstream_dec =
|
||||
(ia_drc_bits_dec_struct *)persistant_ptr;
|
||||
persistant_ptr = persistant_ptr + sizeof(ia_drc_bits_dec_struct);
|
||||
(ia_drc_bits_dec_struct *)persistent_ptr;
|
||||
persistent_ptr = persistent_ptr + sizeof(ia_drc_bits_dec_struct);
|
||||
|
||||
p_obj_drc->str_payload.pstr_gain_dec[0] =
|
||||
(ia_drc_gain_dec_struct *)persistant_ptr;
|
||||
persistant_ptr = persistant_ptr + sizeof(ia_drc_gain_dec_struct);
|
||||
(ia_drc_gain_dec_struct *)persistent_ptr;
|
||||
persistent_ptr = persistent_ptr + sizeof(ia_drc_gain_dec_struct);
|
||||
|
||||
p_obj_drc->str_payload.pstr_gain_dec[1] =
|
||||
(ia_drc_gain_dec_struct *)persistant_ptr;
|
||||
persistant_ptr = persistant_ptr + sizeof(ia_drc_gain_dec_struct);
|
||||
(ia_drc_gain_dec_struct *)persistent_ptr;
|
||||
persistent_ptr = persistent_ptr + sizeof(ia_drc_gain_dec_struct);
|
||||
|
||||
p_obj_drc->str_payload.pstr_loudness_info =
|
||||
(ia_drc_loudness_info_set_struct *)persistant_ptr;
|
||||
persistant_ptr = persistant_ptr + sizeof(ia_drc_loudness_info_set_struct);
|
||||
(ia_drc_loudness_info_set_struct *)persistent_ptr;
|
||||
persistent_ptr = persistent_ptr + sizeof(ia_drc_loudness_info_set_struct);
|
||||
|
||||
p_obj_drc->str_payload.pstr_drc_gain = (ia_drc_gain_struct *)persistant_ptr;
|
||||
persistant_ptr = persistant_ptr + sizeof(ia_drc_gain_struct);
|
||||
p_obj_drc->str_payload.pstr_drc_gain = (ia_drc_gain_struct *)persistent_ptr;
|
||||
persistent_ptr = persistent_ptr + sizeof(ia_drc_gain_struct);
|
||||
|
||||
p_obj_drc->str_payload.pstr_drc_interface =
|
||||
(ia_drc_interface_struct *)persistant_ptr;
|
||||
persistant_ptr = persistant_ptr + sizeof(ia_drc_interface_struct);
|
||||
(ia_drc_interface_struct *)persistent_ptr;
|
||||
persistent_ptr = persistent_ptr + sizeof(ia_drc_interface_struct);
|
||||
|
||||
p_obj_drc->str_payload.pstr_drc_config = (ia_drc_config *)persistant_ptr;
|
||||
persistant_ptr = persistant_ptr + sizeof(ia_drc_config);
|
||||
p_obj_drc->str_payload.pstr_drc_config = (ia_drc_config *)persistent_ptr;
|
||||
persistent_ptr = persistent_ptr + sizeof(ia_drc_config);
|
||||
|
||||
p_obj_drc->str_payload.pstr_selection_proc =
|
||||
(ia_drc_sel_pro_struct *)persistant_ptr;
|
||||
persistant_ptr = persistant_ptr + sizeof(ia_drc_sel_pro_struct);
|
||||
(ia_drc_sel_pro_struct *)persistent_ptr;
|
||||
persistent_ptr = persistent_ptr + sizeof(ia_drc_sel_pro_struct);
|
||||
|
||||
p_obj_drc->str_bit_handler.it_bit_buf = (UWORD8 *)persistant_ptr;
|
||||
persistant_ptr = persistant_ptr + MAX_BS_BUF_SIZE;
|
||||
p_obj_drc->str_bit_handler.it_bit_buf = (UWORD8 *)persistent_ptr;
|
||||
persistent_ptr = persistent_ptr + MAX_DRC_BS_BUF_SIZE;
|
||||
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_params =
|
||||
(ia_drc_sel_proc_params_struct *)persistant_ptr;
|
||||
persistant_ptr = persistant_ptr + sizeof(ia_drc_sel_proc_params_struct);
|
||||
(ia_drc_sel_proc_params_struct *)persistent_ptr;
|
||||
persistent_ptr = persistent_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 = persistant_ptr + sizeof(ia_drc_sel_proc_output_struct);
|
||||
(ia_drc_sel_proc_output_struct *)persistent_ptr;
|
||||
persistent_ptr = persistent_ptr + sizeof(ia_drc_sel_proc_output_struct);
|
||||
|
||||
p_obj_drc->str_bit_handler.bitstream_drc_config = (UWORD8 *)persistant_ptr;
|
||||
persistant_ptr = persistant_ptr + MAX_BS_BUF_SIZE;
|
||||
p_obj_drc->str_bit_handler.bitstream_drc_config = (UWORD8 *)persistent_ptr;
|
||||
persistent_ptr = persistent_ptr + MAX_BS_BUF_SIZE;
|
||||
|
||||
p_obj_drc->str_bit_handler.bitstream_loudness_info = (UWORD8 *)persistant_ptr;
|
||||
persistant_ptr = persistant_ptr + MAX_BS_BUF_SIZE;
|
||||
p_obj_drc->str_bit_handler.bitstream_loudness_info = (UWORD8 *)persistent_ptr;
|
||||
persistent_ptr = persistent_ptr + MAX_BS_BUF_SIZE;
|
||||
|
||||
p_obj_drc->str_bit_handler.bitstream_unidrc_interface =
|
||||
(UWORD8 *)persistant_ptr;
|
||||
persistant_ptr = persistant_ptr + MAX_BS_BUF_SIZE;
|
||||
(UWORD8 *)persistent_ptr;
|
||||
persistent_ptr = persistent_ptr + MAX_BS_BUF_SIZE;
|
||||
|
||||
p_obj_drc->str_payload.pstr_peak_limiter =
|
||||
(ia_drc_peak_limiter_struct *)persistant_ptr;
|
||||
persistant_ptr = persistant_ptr + sizeof(ia_drc_peak_limiter_struct);
|
||||
(ia_drc_peak_limiter_struct *)persistent_ptr;
|
||||
persistent_ptr = persistent_ptr + sizeof(ia_drc_peak_limiter_struct);
|
||||
|
||||
p_obj_drc->str_payload.pstr_peak_limiter->buffer =
|
||||
(FLOAT32 *)((SIZE_T)p_obj_drc->str_payload.pstr_peak_limiter +
|
||||
sizeof(ia_drc_peak_limiter_struct));
|
||||
persistant_ptr = persistant_ptr + PEAK_LIM_BUF_SIZE;
|
||||
persistent_ptr = persistent_ptr + PEAK_LIM_BUF_SIZE;
|
||||
|
||||
p_obj_drc->str_payload.pstr_qmf_filter =
|
||||
(ia_drc_qmf_filt_struct *)persistant_ptr;
|
||||
persistant_ptr = persistant_ptr + sizeof(ia_drc_qmf_filt_struct);
|
||||
(ia_drc_qmf_filt_struct *)persistent_ptr;
|
||||
persistent_ptr = persistent_ptr + sizeof(ia_drc_qmf_filt_struct);
|
||||
|
||||
p_obj_drc->str_payload.pstr_qmf_filter->ana_buff = (FLOAT64 *)persistant_ptr;
|
||||
persistant_ptr = persistant_ptr + ANALY_BUF_SIZE;
|
||||
p_obj_drc->str_payload.pstr_qmf_filter->ana_buff = (FLOAT64 *)persistent_ptr;
|
||||
persistent_ptr = persistent_ptr + ANALY_BUF_SIZE;
|
||||
|
||||
p_obj_drc->str_payload.pstr_qmf_filter->syn_buff = (FLOAT64 *)persistant_ptr;
|
||||
persistant_ptr = persistant_ptr + SYNTH_BUF_SIZE;
|
||||
p_obj_drc->str_payload.pstr_qmf_filter->syn_buff = (FLOAT64 *)persistent_ptr;
|
||||
persistent_ptr = persistent_ptr + SYNTH_BUF_SIZE;
|
||||
persistent_size_consumed =
|
||||
(UWORD32)persistent_ptr - (UWORD32)p_obj_drc->p_state->persistent_ptr;
|
||||
if (p_obj_drc->p_mem_info[IA_MEMTYPE_PERSIST].ui_size <
|
||||
persistent_size_consumed)
|
||||
return IA_FATAL_ERROR;
|
||||
|
||||
p_obj_drc->p_state->persistant_ptr = (pVOID)persistant_ptr;
|
||||
p_obj_drc->p_state->persistent_ptr = (pVOID)persistent_ptr;
|
||||
return IA_NO_ERROR;
|
||||
}
|
||||
|
||||
|
|
@ -373,7 +379,7 @@ 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 persistent_ptr = p_obj_drc->p_state->persistent_ptr;
|
||||
|
||||
struct ia_bit_buf_struct *it_bit_buff;
|
||||
|
||||
|
|
@ -401,99 +407,52 @@ IA_ERRORCODE impd_drc_init(ia_drc_api_struct *p_obj_drc) {
|
|||
p_obj_drc->str_payload.pstr_gain_dec[i]);
|
||||
}
|
||||
|
||||
if (p_obj_drc->str_config.interface_bitstream_present) {
|
||||
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);
|
||||
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;
|
||||
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,
|
||||
p_obj_drc->str_config.sub_band_domain_mode);
|
||||
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,
|
||||
p_obj_drc->str_config.sub_band_domain_mode);
|
||||
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 {
|
||||
err_code = impd_set_default_params_selection_process(
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_params);
|
||||
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) 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) 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) return err_code;
|
||||
|
||||
if (p_obj_drc->str_payload.pstr_drc_sel_proc_params->peak_limiter) {
|
||||
p_obj_drc->str_config.peak_limiter = 1;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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->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);
|
||||
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->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) {
|
||||
memset(p_obj_drc->str_payload.pstr_drc_config, 0, sizeof(ia_drc_config));
|
||||
err_code = impd_drc_set_default_bitstream_config(
|
||||
p_obj_drc->str_payload.pstr_drc_config);
|
||||
p_obj_drc->str_payload.pstr_drc_config->channel_layout
|
||||
.base_channel_count = p_obj_drc->str_config.num_ch_in;
|
||||
}
|
||||
|
||||
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_bit_handler.bitstream_loudness_info[0],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs_loudness_info);
|
||||
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->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_loudness_info,
|
||||
&p_obj_drc->str_bit_handler
|
||||
.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||
|
||||
if (err_code > PROC_COMPLETE) return -1;
|
||||
|
||||
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;
|
||||
if (err_code == 1) {
|
||||
memset(p_obj_drc->str_payload.pstr_drc_config, 0, sizeof(ia_drc_config));
|
||||
err_code = impd_drc_set_default_bitstream_config(
|
||||
p_obj_drc->str_payload.pstr_drc_config);
|
||||
p_obj_drc->str_payload.pstr_drc_config->channel_layout.base_channel_count =
|
||||
p_obj_drc->str_config.num_ch_in;
|
||||
}
|
||||
|
||||
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_bit_handler.bitstream_loudness_info[0],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs_loudness_info);
|
||||
if (err_code != IA_NO_ERROR) return err_code;
|
||||
|
||||
err_code = impd_drc_uni_sel_proc_process(
|
||||
p_obj_drc->str_payload.pstr_selection_proc,
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
|
|
@ -538,7 +497,7 @@ 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);
|
||||
p_obj_drc->str_payload.pstr_loudness_info, &persistent_ptr);
|
||||
|
||||
impd_get_parametric_drc_delay(
|
||||
p_obj_drc->str_payload.pstr_gain_dec[i],
|
||||
|
|
|
|||
|
|
@ -29,29 +29,6 @@
|
|||
#include "impd_drc_interface.h"
|
||||
#include "impd_drc_parser_interface.h"
|
||||
|
||||
WORD32
|
||||
impd_drc_dec_interface_process(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_interface_struct* pstr_drc_interface,
|
||||
UWORD8* it_bit_buf, WORD32 num_bit_stream_bits,
|
||||
WORD32* num_bits_read) {
|
||||
WORD32 err = 0;
|
||||
|
||||
if (it_bit_buff != NULL && num_bit_stream_bits) {
|
||||
it_bit_buff = impd_create_init_bit_buf(it_bit_buff, it_bit_buf,
|
||||
num_bit_stream_bits / 8);
|
||||
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -1,514 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "impd_type_def.h"
|
||||
#include "impd_drc_bitbuffer.h"
|
||||
#include "impd_drc_common.h"
|
||||
#include "impd_drc_interface.h"
|
||||
#include "impd_drc_extr_delta_coded_info.h"
|
||||
#include "impd_drc_struct.h"
|
||||
|
||||
WORD32 impd_unidrc_interface_signature_read(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_uni_interface_signat_struct* drc_uni_interface_signature) {
|
||||
// WORD32 err = 0
|
||||
WORD32 interface_signat_data_len = 0, i, tmp;
|
||||
|
||||
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;
|
||||
|
||||
interface_signat_data_len =
|
||||
drc_uni_interface_signature->interface_signat_data_len + 1;
|
||||
for (i = 0; i < interface_signat_data_len; i++) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
drc_uni_interface_signature->interface_signat_data[i] = (UWORD32)tmp;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
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;
|
||||
|
||||
switch (system_interface->target_config_request_type) {
|
||||
case 0:
|
||||
system_interface->num_downmix_id_requests =
|
||||
impd_read_bits_buf(it_bit_buff, 4);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
if (system_interface->num_downmix_id_requests == 0) {
|
||||
system_interface->num_downmix_id_requests = 1;
|
||||
system_interface->requested_dwnmix_id[0] = 0;
|
||||
break;
|
||||
}
|
||||
for (i = 0; i < system_interface->num_downmix_id_requests; i++) {
|
||||
system_interface->requested_dwnmix_id[i] =
|
||||
impd_read_bits_buf(it_bit_buff, 7);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
system_interface->requested_target_layout =
|
||||
impd_read_bits_buf(it_bit_buff, 8);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
break;
|
||||
case 2:
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 7);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
system_interface->requested_target_ch_count = tmp + 1;
|
||||
break;
|
||||
default:
|
||||
return (1);
|
||||
break;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
WORD32 impd_loudness_norm_control_interface_read(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_loudness_norm_ctrl_interface_struct* loudness_norm_ctrl_interface) {
|
||||
// WORD32 err = 0;
|
||||
WORD32 tmp = 0;
|
||||
|
||||
loudness_norm_ctrl_interface->loudness_normalization_on =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
if (loudness_norm_ctrl_interface->loudness_normalization_on == 1) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 12);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
loudness_norm_ctrl_interface->target_loudness = -tmp * 0.03125f;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
WORD32 impd_loudness_norm_param_interface_read(
|
||||
ia_bit_buf_struct* it_bit_buff, ia_loudness_norm_parameter_interface_struct*
|
||||
loudness_norm_param_interface) {
|
||||
// WORD32 err = 0;
|
||||
WORD32 tmp = 0;
|
||||
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 3);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
loudness_norm_param_interface->album_mode = (tmp >> 2) & 1;
|
||||
loudness_norm_param_interface->peak_limiter = (tmp >> 1) & 1;
|
||||
loudness_norm_param_interface->change_loudness_deviation_max = tmp & 1;
|
||||
|
||||
if (loudness_norm_param_interface->change_loudness_deviation_max == 1) {
|
||||
loudness_norm_param_interface->loudness_deviation_max =
|
||||
impd_read_bits_buf(it_bit_buff, 6);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
}
|
||||
|
||||
loudness_norm_param_interface->change_loudness_measur_method =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (loudness_norm_param_interface->change_loudness_measur_method == 1) {
|
||||
loudness_norm_param_interface->loudness_measurement_method =
|
||||
impd_read_bits_buf(it_bit_buff, 3);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
}
|
||||
|
||||
loudness_norm_param_interface->change_loudness_measur_system =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (loudness_norm_param_interface->change_loudness_measur_system == 1) {
|
||||
loudness_norm_param_interface->loudness_measurement_system =
|
||||
impd_read_bits_buf(it_bit_buff, 4);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
}
|
||||
|
||||
loudness_norm_param_interface->change_loudness_measur_pre_proc =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (loudness_norm_param_interface->change_loudness_measur_pre_proc == 1) {
|
||||
loudness_norm_param_interface->loudness_measurement_pre_proc =
|
||||
impd_read_bits_buf(it_bit_buff, 2);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
}
|
||||
|
||||
loudness_norm_param_interface->change_device_cut_off_freq =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (loudness_norm_param_interface->change_device_cut_off_freq == 1) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 6);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
loudness_norm_param_interface->device_cut_off_frequency =
|
||||
max(min(tmp * 10, 500), 20);
|
||||
}
|
||||
|
||||
loudness_norm_param_interface->change_loudness_norm_gain_db_max =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (loudness_norm_param_interface->change_loudness_norm_gain_db_max == 1) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 6);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (tmp < 63) {
|
||||
loudness_norm_param_interface->loudness_norm_gain_db_max = tmp * 0.5f;
|
||||
} else {
|
||||
loudness_norm_param_interface->loudness_norm_gain_db_max =
|
||||
LOUDNESS_NORMALIZATION_GAIN_MAX_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
loudness_norm_param_interface->change_loudness_norm_gain_modification_db =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (loudness_norm_param_interface
|
||||
->change_loudness_norm_gain_modification_db == 1) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 10);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
loudness_norm_param_interface->loudness_norm_gain_modification_db =
|
||||
-16 + tmp * 0.03125f;
|
||||
}
|
||||
|
||||
loudness_norm_param_interface->change_output_peak_level_max =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (loudness_norm_param_interface->change_output_peak_level_max == 1) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 6);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
loudness_norm_param_interface->output_peak_level_max = tmp * 0.5f;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
WORD32 impd_drc_interface_read(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_dyn_rng_ctrl_interface_struct* drc_ctrl_interface) {
|
||||
// WORD32 err = 0;
|
||||
WORD32 i = 0, j = 0, tmp = 0;
|
||||
|
||||
drc_ctrl_interface->dynamic_range_control_on =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
if (drc_ctrl_interface->dynamic_range_control_on == 1) {
|
||||
drc_ctrl_interface->num_drc_feature_requests =
|
||||
impd_read_bits_buf(it_bit_buff, 3);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
for (i = 0; i < drc_ctrl_interface->num_drc_feature_requests; i++) {
|
||||
drc_ctrl_interface->drc_feature_req_type[i] =
|
||||
impd_read_bits_buf(it_bit_buff, 2);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
switch (drc_ctrl_interface->drc_feature_req_type[i]) {
|
||||
case 0:
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
drc_ctrl_interface->requested_num_drc_effects[i] = (tmp >> 4) & 0xf;
|
||||
drc_ctrl_interface->desired_num_drc_effects_of_requested[i] =
|
||||
tmp & 0xf;
|
||||
|
||||
for (j = 0; j < drc_ctrl_interface->requested_num_drc_effects[i];
|
||||
j++) {
|
||||
drc_ctrl_interface->requested_drc_effect_type[i][j] =
|
||||
impd_read_bits_buf(it_bit_buff, 4);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 3);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
drc_ctrl_interface->requested_dyn_rng_measurement_type[i] =
|
||||
(tmp >> 1) & 3;
|
||||
drc_ctrl_interface->requested_dyn_range_is_single_val_flag[i] =
|
||||
tmp & 1;
|
||||
|
||||
if (drc_ctrl_interface->requested_dyn_range_is_single_val_flag[i] ==
|
||||
0) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (tmp == 0)
|
||||
drc_ctrl_interface->requested_dyn_range_value[i] = 0.0f;
|
||||
else if (tmp <= 128)
|
||||
drc_ctrl_interface->requested_dyn_range_value[i] = tmp * 0.25f;
|
||||
else if (tmp <= 204)
|
||||
drc_ctrl_interface->requested_dyn_range_value[i] =
|
||||
0.5f * tmp - 32.0f;
|
||||
else
|
||||
drc_ctrl_interface->requested_dyn_range_value[i] = tmp - 134.0f;
|
||||
} else {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (tmp == 0)
|
||||
drc_ctrl_interface->requested_dyn_range_min_val[i] = 0.0f;
|
||||
else if (tmp <= 128)
|
||||
drc_ctrl_interface->requested_dyn_range_min_val[i] = tmp * 0.25f;
|
||||
else if (tmp <= 204)
|
||||
drc_ctrl_interface->requested_dyn_range_min_val[i] =
|
||||
0.5f * tmp - 32.0f;
|
||||
else
|
||||
drc_ctrl_interface->requested_dyn_range_min_val[i] = tmp - 134.0f;
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (tmp == 0)
|
||||
drc_ctrl_interface->requested_dyn_range_max_val[i] = 0.0f;
|
||||
else if (tmp <= 128)
|
||||
drc_ctrl_interface->requested_dyn_range_max_val[i] = tmp * 0.25f;
|
||||
else if (tmp <= 204)
|
||||
drc_ctrl_interface->requested_dyn_range_max_val[i] =
|
||||
0.5f * tmp - 32.0f;
|
||||
else
|
||||
drc_ctrl_interface->requested_dyn_range_max_val[i] = tmp - 134.0f;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
drc_ctrl_interface->requested_drc_characteristic[i] =
|
||||
impd_read_bits_buf(it_bit_buff, 7);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
break;
|
||||
default:
|
||||
return (1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
WORD32 impd_drc_param_interface_read(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_parameter_interface_struct* drc_parameter_interface) {
|
||||
// WORD32 err = 0;
|
||||
WORD32 tmp = 0;
|
||||
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 2);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
drc_parameter_interface->change_compress = (tmp >> 1) & 1;
|
||||
drc_parameter_interface->change_boost = tmp & 1;
|
||||
|
||||
if (drc_parameter_interface->change_compress == 1) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (tmp < 255) {
|
||||
drc_parameter_interface->compress = 1 - tmp * 0.00390625f;
|
||||
} else {
|
||||
drc_parameter_interface->compress = 0.f;
|
||||
}
|
||||
}
|
||||
|
||||
if (drc_parameter_interface->change_boost == 1) {
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (tmp < 255) {
|
||||
drc_parameter_interface->boost = 1 - tmp * 0.00390625f;
|
||||
} else {
|
||||
drc_parameter_interface->boost = 0.f;
|
||||
}
|
||||
}
|
||||
|
||||
drc_parameter_interface->change_drc_characteristic_target =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
if (drc_parameter_interface->change_drc_characteristic_target == 1) {
|
||||
drc_parameter_interface->drc_characteristic_target =
|
||||
impd_read_bits_buf(it_bit_buff, 8);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
static WORD32 impd_parse_loud_eq_param_interface(
|
||||
ia_bit_buf_struct* it_bit_buff, ia_loudness_eq_parameter_interface_struct*
|
||||
loudness_eq_parameter_interface) {
|
||||
// WORD32 err = 0;
|
||||
WORD32 bsSensitivity, bsPlaybackGain;
|
||||
|
||||
loudness_eq_parameter_interface->loudness_eq_request_flag =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (loudness_eq_parameter_interface->loudness_eq_request_flag) {
|
||||
loudness_eq_parameter_interface->loudness_eq_request =
|
||||
impd_read_bits_buf(it_bit_buff, 2);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
}
|
||||
loudness_eq_parameter_interface->sensitivity_flag =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (loudness_eq_parameter_interface->sensitivity_flag) {
|
||||
bsSensitivity = impd_read_bits_buf(it_bit_buff, 7);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
loudness_eq_parameter_interface->sensitivity = bsSensitivity + 23.0f;
|
||||
}
|
||||
loudness_eq_parameter_interface->playback_gain_flag =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (loudness_eq_parameter_interface->playback_gain_flag) {
|
||||
bsPlaybackGain = impd_read_bits_buf(it_bit_buff, 7);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
loudness_eq_parameter_interface->playback_gain = (FLOAT32)-bsPlaybackGain;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
WORD32
|
||||
impd_unidrc_interface_extension_read(
|
||||
ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_interface_struct* impd_drc_uni_interface,
|
||||
ia_drc_uni_interface_ext_struct* drc_uni_interface_ext) {
|
||||
WORD32 err = 0, i = 0, tmp = 0, dummy;
|
||||
WORD32 uni_drc_interface_ext_type;
|
||||
ia_specific_interface_extension_struct* specific_interface_ext;
|
||||
|
||||
uni_drc_interface_ext_type = impd_read_bits_buf(it_bit_buff, 4);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
while (uni_drc_interface_ext_type != UNIDRCINTERFACEEXT_TERM) {
|
||||
specific_interface_ext =
|
||||
&(drc_uni_interface_ext->specific_interface_ext[i]);
|
||||
specific_interface_ext->uni_drc_interface_ext_type =
|
||||
uni_drc_interface_ext_type;
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 4);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
specific_interface_ext->ext_size_bits = tmp + 4;
|
||||
|
||||
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;
|
||||
if (impd_drc_uni_interface->drc_uni_interface_ext
|
||||
.loudness_eq_parameter_interface_flag) {
|
||||
err = impd_parse_loud_eq_param_interface(
|
||||
it_bit_buff, &(impd_drc_uni_interface->drc_uni_interface_ext
|
||||
.loudness_eq_parameter_interface));
|
||||
if (err) return (err);
|
||||
}
|
||||
impd_drc_uni_interface->drc_uni_interface_ext.eq_ctrl_interface_flag =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (impd_drc_uni_interface->drc_uni_interface_ext
|
||||
.eq_ctrl_interface_flag) {
|
||||
impd_drc_uni_interface->drc_uni_interface_ext.eq_ctrl_interface
|
||||
.eq_set_purpose_request = impd_read_bits_buf(it_bit_buff, 16);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
dummy = impd_read_bits_buf(it_bit_buff,
|
||||
specific_interface_ext->ext_bit_size);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
break;
|
||||
}
|
||||
|
||||
i++;
|
||||
if (i == EXT_COUNT_MAX) {
|
||||
return (1);
|
||||
}
|
||||
uni_drc_interface_ext_type = impd_read_bits_buf(it_bit_buff, 4);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
}
|
||||
drc_uni_interface_ext->interface_ext_count = i;
|
||||
return (0);
|
||||
}
|
||||
WORD32 impd_unidrc_interface_read(ia_bit_buf_struct* it_bit_buff,
|
||||
ia_drc_interface_struct* uniDrcInterface) {
|
||||
WORD32 err = 0;
|
||||
|
||||
uniDrcInterface->interface_signat_flag = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (uniDrcInterface->interface_signat_flag == 1) {
|
||||
err = impd_unidrc_interface_signature_read(
|
||||
it_bit_buff, &(uniDrcInterface->drc_uni_interface_signature));
|
||||
if (err) return (err);
|
||||
}
|
||||
|
||||
uniDrcInterface->system_interface_flag = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (uniDrcInterface->system_interface_flag == 1) {
|
||||
err = impd_sys_interface_read(it_bit_buff,
|
||||
&(uniDrcInterface->system_interface));
|
||||
if (err) return (err);
|
||||
}
|
||||
|
||||
uniDrcInterface->loudness_norm_ctrl_interface_flag =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (uniDrcInterface->loudness_norm_ctrl_interface_flag == 1) {
|
||||
err = impd_loudness_norm_control_interface_read(
|
||||
it_bit_buff, &(uniDrcInterface->loudness_norm_ctrl_interface));
|
||||
if (err) return (err);
|
||||
}
|
||||
|
||||
uniDrcInterface->loudness_norm_parameter_interface_flag =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (uniDrcInterface->loudness_norm_parameter_interface_flag == 1) {
|
||||
err = impd_loudness_norm_param_interface_read(
|
||||
it_bit_buff, &(uniDrcInterface->loudness_norm_param_interface));
|
||||
if (err) return (err);
|
||||
}
|
||||
|
||||
uniDrcInterface->drc_interface_flag = impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (uniDrcInterface->drc_interface_flag == 1) {
|
||||
err = impd_drc_interface_read(it_bit_buff,
|
||||
&(uniDrcInterface->drc_ctrl_interface));
|
||||
if (err) return (err);
|
||||
}
|
||||
|
||||
uniDrcInterface->drc_parameter_interface_flag =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (uniDrcInterface->drc_parameter_interface_flag == 1) {
|
||||
err = impd_drc_param_interface_read(
|
||||
it_bit_buff, &(uniDrcInterface->drc_parameter_interface));
|
||||
if (err) return (err);
|
||||
}
|
||||
|
||||
uniDrcInterface->drc_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);
|
||||
}
|
||||
|
|
@ -1,169 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include "impd_type_def.h"
|
||||
#include "impd_drc_uni_tables.h"
|
||||
#include "impd_drc_uni_common.h"
|
||||
#include "impd_drc_uni_interface.h"
|
||||
#include "impd_drc_struct.h"
|
||||
#include "impd_drc_uni_gain_dec.h"
|
||||
#include "impd_drc_uni_loud_eq.h"
|
||||
#include "impd_parametric_drc_dec.h"
|
||||
#include "impd_drc_uni_multi_band.h"
|
||||
#include "impd_drc_filter_bank.h"
|
||||
#include "impd_drc_uni_process_audio.h"
|
||||
#include "impd_drc_rom.h"
|
||||
|
||||
WORD32 impd_parametric_drc_instance_reset(
|
||||
WORD32 instance_idx, ia_parametric_drc_instance_params_struct*
|
||||
pstr_parametric_drc_instance_params) {
|
||||
WORD32 err = 0;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
WORD32 impd_add_drc_band_audio(
|
||||
ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||
const WORD32 drc_instructions_index,
|
||||
ia_drc_params_struct* ia_drc_params_struct,
|
||||
ia_audio_band_buffer_struct* audio_band_buffer, FLOAT32* audio_io_buf[]) {
|
||||
WORD32 g, b, i, c;
|
||||
FLOAT32 sum;
|
||||
WORD32 signalIndex = 0;
|
||||
FLOAT32** drcBandAudio;
|
||||
FLOAT32** channel_audio;
|
||||
ia_drc_instructions_struct* str_drc_instruction_str;
|
||||
|
||||
drcBandAudio = audio_band_buffer->non_interleaved_audio;
|
||||
channel_audio = audio_io_buf;
|
||||
|
||||
if (drc_instructions_index >= 0) {
|
||||
str_drc_instruction_str =
|
||||
&(pstr_drc_instruction_arr[drc_instructions_index]);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (str_drc_instruction_str->drc_set_id > 0) {
|
||||
for (c = 0; c < str_drc_instruction_str->audio_num_chan; c++)
|
||||
|
||||
{
|
||||
g = str_drc_instruction_str->channel_group_of_ch[c];
|
||||
if (g >= 0) {
|
||||
for (i = 0; i < ia_drc_params_struct->drc_frame_size; i++) {
|
||||
sum = 0.0f;
|
||||
for (b = 0; b < str_drc_instruction_str->band_count_of_ch_group[g];
|
||||
b++) {
|
||||
sum += drcBandAudio[signalIndex + b][i];
|
||||
}
|
||||
|
||||
channel_audio[c][i] = sum;
|
||||
}
|
||||
signalIndex += str_drc_instruction_str->band_count_of_ch_group[g];
|
||||
} else {
|
||||
signalIndex++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (c = 0; c < str_drc_instruction_str->audio_num_chan; c++)
|
||||
|
||||
{
|
||||
for (i = 0; i < ia_drc_params_struct->drc_frame_size; i++) {
|
||||
channel_audio[c][i] = drcBandAudio[c][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
WORD32 removeTables(void) { return (0); }
|
||||
|
||||
const ia_slope_code_table_struct* impd_get_slope_code_tbl_by_value(void) {
|
||||
return (&(slopeCodeTableEntryByValue[0]));
|
||||
}
|
||||
|
||||
FLOAT32 impd_decode_slope_idx(const WORD32 slopeCodeIndex) {
|
||||
const ia_slope_code_table_struct* slopeCodeTable =
|
||||
impd_get_slope_code_tbl_by_value();
|
||||
return slopeCodeTable[slopeCodeIndex].value;
|
||||
}
|
||||
|
||||
FLOAT32 impd_decode_slope_idx_magnitude(const WORD32 slopeCodeIndex) {
|
||||
const ia_slope_code_table_struct* slopeCodeTable =
|
||||
impd_get_slope_code_tbl_by_value();
|
||||
return (FLOAT32)fabs((FLOAT64)slopeCodeTable[slopeCodeIndex].value);
|
||||
}
|
||||
|
||||
WORD32 impd_get_multi_band_drc_present(ia_drc_config* pstr_drc_config,
|
||||
WORD32 numSets[3],
|
||||
WORD32 multiBandDrcPresent[3]) {
|
||||
WORD32 err = 0, k, m;
|
||||
for (k = 0; k < pstr_drc_config->drc_instructions_uni_drc_count; k++) {
|
||||
if ((pstr_drc_config->str_drc_instruction_str[k].downmix_id[0] ==
|
||||
ID_FOR_BASE_LAYOUT) ||
|
||||
(pstr_drc_config->str_drc_instruction_str[k].drc_apply_to_dwnmix ==
|
||||
0)) {
|
||||
numSets[0]++;
|
||||
} else if (pstr_drc_config->str_drc_instruction_str[k].downmix_id[0] ==
|
||||
ID_FOR_ANY_DOWNMIX) {
|
||||
numSets[1]++;
|
||||
} else {
|
||||
numSets[2]++;
|
||||
}
|
||||
for (m = 0;
|
||||
m < pstr_drc_config->str_drc_instruction_str[k].num_drc_ch_groups;
|
||||
m++) {
|
||||
if (pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0]
|
||||
.gain_set_params[pstr_drc_config->str_drc_instruction_str
|
||||
->gain_set_index_for_channel_group[m]]
|
||||
.band_count > 1) {
|
||||
if ((pstr_drc_config->str_drc_instruction_str[k].downmix_id[0] ==
|
||||
ID_FOR_BASE_LAYOUT) ||
|
||||
(pstr_drc_config->str_drc_instruction_str[k].drc_apply_to_dwnmix ==
|
||||
0)) {
|
||||
multiBandDrcPresent[0] = 1;
|
||||
} else if (pstr_drc_config->str_drc_instruction_str[k].downmix_id[0] ==
|
||||
ID_FOR_ANY_DOWNMIX) {
|
||||
multiBandDrcPresent[1] = 1;
|
||||
} else {
|
||||
multiBandDrcPresent[2] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
|
@ -737,7 +737,7 @@ WORD32 impd_init_loudness_control(
|
|||
WORD32 requested_measurement_system = MEASUREMENT_SYSTEM_BS_1770_4;
|
||||
WORD32 requested_preprocessing = 0;
|
||||
|
||||
WORD32* system_bonus = measurement_system_default_tbl;
|
||||
const WORD32* system_bonus = measurement_system_default_tbl;
|
||||
|
||||
WORD32 match_measure;
|
||||
FLOAT32 method_val = 0;
|
||||
|
|
|
|||
|
|
@ -1,254 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
#include <math.h>
|
||||
#include "impd_type_def.h"
|
||||
#include "impd_memory_standards.h"
|
||||
#include "impd_drc_bitbuffer.h"
|
||||
#include "impd_drc_extr_delta_coded_info.h"
|
||||
#include "impd_drc_common.h"
|
||||
#include "impd_drc_struct.h"
|
||||
#include "impd_drc_interface.h"
|
||||
|
||||
#include "impd_drc_bitstream_dec_api.h"
|
||||
#include "impd_drc_gain_dec.h"
|
||||
#include "impd_drc_filter_bank.h"
|
||||
#include "impd_drc_multi_band.h"
|
||||
#include "impd_drc_process_audio.h"
|
||||
#include "impd_parametric_drc_dec.h"
|
||||
#include "impd_drc_eq.h"
|
||||
#include "impd_drc_gain_decoder.h"
|
||||
#include "impd_drc_selection_process.h"
|
||||
|
||||
#include "impd_drc_peak_limiter.h"
|
||||
#include "impd_drc_api_struct_def.h"
|
||||
|
||||
#define BITSTREAM_FILE_FORMAT_SPLIT 1
|
||||
|
||||
static WORD32 impd_down_mix(
|
||||
ia_drc_sel_proc_output_struct *uni_drc_sel_proc_output,
|
||||
FLOAT32 **input_audio, WORD32 frame_len) {
|
||||
WORD32 num_base_ch = uni_drc_sel_proc_output->base_channel_count;
|
||||
WORD32 num_target_ch = uni_drc_sel_proc_output->target_channel_count;
|
||||
WORD32 i, i_ch, o_ch;
|
||||
FLOAT32 tmp_out[MAX_CHANNEL_COUNT];
|
||||
|
||||
if (uni_drc_sel_proc_output->downmix_matrix_present == 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;
|
||||
for (i_ch = 0; i_ch < num_base_ch; i_ch++) {
|
||||
tmp_out[o_ch] += input_audio[i_ch][i] *
|
||||
uni_drc_sel_proc_output->downmix_matrix[i_ch][o_ch];
|
||||
}
|
||||
}
|
||||
for (o_ch = 0; o_ch < num_target_ch; o_ch++) {
|
||||
input_audio[o_ch][i] = tmp_out[o_ch];
|
||||
}
|
||||
for (; o_ch < num_base_ch; o_ch++) {
|
||||
input_audio[o_ch][i] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
WORD32 impd_init_process_audio_main_qmf(ia_drc_api_struct *p_obj_drc)
|
||||
|
||||
{
|
||||
WORD32 error = 0, i, j, num_samples_per_channel;
|
||||
FLOAT32 *input_buffer;
|
||||
FLOAT32 *output_buffer;
|
||||
FLOAT32 *audio_io_buf_real[10];
|
||||
FLOAT32 *audio_io_buf_imag[10];
|
||||
FLOAT32 *scratch_buffer;
|
||||
WORD32 last_frame = 0;
|
||||
scratch_buffer = (FLOAT32 *)p_obj_drc->pp_mem[1];
|
||||
input_buffer = (FLOAT32 *)p_obj_drc->pp_mem[2];
|
||||
output_buffer = (FLOAT32 *)p_obj_drc->pp_mem[3];
|
||||
|
||||
if (p_obj_drc->p_state->ui_in_bytes <= 0) {
|
||||
p_obj_drc->p_state->ui_out_bytes = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((p_obj_drc->p_state->ui_in_bytes / p_obj_drc->str_config.num_ch_in /
|
||||
(p_obj_drc->str_config.pcm_size >> 3)) <
|
||||
(UWORD32)p_obj_drc->str_config.frame_size)
|
||||
last_frame = 1;
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_in; i++) {
|
||||
audio_io_buf_real[i] =
|
||||
scratch_buffer + i * (p_obj_drc->str_config.frame_size + 32);
|
||||
audio_io_buf_imag[i] =
|
||||
scratch_buffer +
|
||||
p_obj_drc->str_config.num_ch_in * p_obj_drc->str_config.frame_size +
|
||||
p_obj_drc->str_config.num_ch_in * 64 +
|
||||
i * (p_obj_drc->str_config.frame_size + 64);
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
audio_io_buf_real[i][j] =
|
||||
input_buffer[j * p_obj_drc->str_config.num_ch_in + i];
|
||||
audio_io_buf_imag[i][j] =
|
||||
input_buffer[p_obj_drc->str_config.num_ch_in *
|
||||
p_obj_drc->str_config.frame_size +
|
||||
j * p_obj_drc->str_config.num_ch_in + i];
|
||||
}
|
||||
}
|
||||
|
||||
error = impd_process_drc_bitstream_dec_gain(
|
||||
p_obj_drc->str_payload.pstr_bitstream_dec, p_obj_drc->pstr_bit_buf,
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain,
|
||||
&p_obj_drc->str_bit_handler
|
||||
.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||
|
||||
if (error > PROC_COMPLETE) return -1;
|
||||
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||
p_obj_drc->str_bit_handler.byte_index_bs +=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
if (p_obj_drc->str_bit_handler.gain_stream_flag ==
|
||||
0) // ITTIAM: Flag for applying gain frame by frame
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs -=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
}
|
||||
|
||||
if (p_obj_drc->str_config.bitstream_file_format ==
|
||||
BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||
if (p_obj_drc->str_bit_handler.num_bits_offset_bs != 0) {
|
||||
p_obj_drc->str_bit_handler.num_bits_read_bs =
|
||||
p_obj_drc->str_bit_handler.num_bits_read_bs + 8 -
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs + 1;
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = 0;
|
||||
p_obj_drc->str_bit_handler.byte_index_bs =
|
||||
p_obj_drc->str_bit_handler.byte_index_bs + 1;
|
||||
if (p_obj_drc->str_bit_handler.gain_stream_flag ==
|
||||
0) // ITTIAM: Flag for applying gain frame by frame
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs =
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
error = impd_drc_process_freq_domain(
|
||||
p_obj_drc->str_payload.pstr_gain_dec[0],
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain, audio_io_buf_real,
|
||||
audio_io_buf_imag, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->drc_characteristic_target);
|
||||
if (error) return -1;
|
||||
|
||||
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||
audio_io_buf_real, p_obj_drc->str_config.frame_size);
|
||||
if (error) return -1;
|
||||
|
||||
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||
audio_io_buf_imag, p_obj_drc->str_config.frame_size);
|
||||
if (error) return -1;
|
||||
|
||||
error = impd_drc_process_freq_domain(
|
||||
p_obj_drc->str_payload.pstr_gain_dec[1],
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain, audio_io_buf_real,
|
||||
audio_io_buf_imag, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->drc_characteristic_target);
|
||||
if (error) return -1;
|
||||
|
||||
if (p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db != 0.0f) {
|
||||
FLOAT32 loudness_normalization_gain =
|
||||
(FLOAT32)pow(10.0, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db /
|
||||
20.0);
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
audio_io_buf_real[i][j] *= loudness_normalization_gain;
|
||||
audio_io_buf_imag[i][j] *= loudness_normalization_gain;
|
||||
}
|
||||
}
|
||||
}
|
||||
num_samples_per_channel = p_obj_drc->str_config.frame_size;
|
||||
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
output_buffer[j * p_obj_drc->str_config.num_ch_out + i] =
|
||||
audio_io_buf_real[i][j];
|
||||
output_buffer[p_obj_drc->str_config.frame_size *
|
||||
p_obj_drc->str_config.num_ch_in +
|
||||
j * p_obj_drc->str_config.num_ch_out + i] =
|
||||
audio_io_buf_imag[i][j];
|
||||
}
|
||||
}
|
||||
p_obj_drc->p_state->ui_out_bytes =
|
||||
p_obj_drc->str_config.num_ch_out * (p_obj_drc->str_config.frame_size) * 4;
|
||||
p_obj_drc->p_state->ui_out_bytes =
|
||||
p_obj_drc->str_config.num_ch_out *
|
||||
(p_obj_drc->p_state->ui_in_bytes / p_obj_drc->str_config.num_ch_in);
|
||||
|
||||
if (last_frame == 0) {
|
||||
if (p_obj_drc->str_config.bitstream_file_format !=
|
||||
BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||
error = impd_process_drc_bitstream_dec(
|
||||
p_obj_drc->str_payload.pstr_bitstream_dec, p_obj_drc->pstr_bit_buf,
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_loudness_info,
|
||||
&p_obj_drc->str_bit_handler
|
||||
.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||
|
||||
if (error > PROC_COMPLETE) return -1;
|
||||
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||
p_obj_drc->str_bit_handler.byte_index_bs +=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs -=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
}
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
|
@ -1,254 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
#include <math.h>
|
||||
#include "impd_type_def.h"
|
||||
#include "impd_memory_standards.h"
|
||||
#include "impd_drc_bitbuffer.h"
|
||||
#include "impd_drc_extr_delta_coded_info.h"
|
||||
#include "impd_drc_common.h"
|
||||
#include "impd_drc_struct.h"
|
||||
#include "impd_drc_interface.h"
|
||||
#include "impd_drc_peak_limiter.h"
|
||||
#include "impd_drc_bitstream_dec_api.h"
|
||||
#include "impd_drc_gain_dec.h"
|
||||
#include "impd_drc_filter_bank.h"
|
||||
#include "impd_drc_multi_band.h"
|
||||
#include "impd_drc_process_audio.h"
|
||||
#include "impd_parametric_drc_dec.h"
|
||||
#include "impd_drc_eq.h"
|
||||
#include "impd_drc_gain_decoder.h"
|
||||
#include "impd_drc_selection_process.h"
|
||||
#include "impd_drc_api_struct_def.h"
|
||||
|
||||
#define BITSTREAM_FILE_FORMAT_SPLIT 1
|
||||
|
||||
static WORD32 impd_down_mix(
|
||||
ia_drc_sel_proc_output_struct *uni_drc_sel_proc_output,
|
||||
FLOAT32 **input_audio, WORD32 frame_len) {
|
||||
WORD32 num_base_ch = uni_drc_sel_proc_output->base_channel_count;
|
||||
WORD32 num_target_ch = uni_drc_sel_proc_output->target_channel_count;
|
||||
WORD32 i, i_ch, o_ch;
|
||||
FLOAT32 tmp_out[MAX_CHANNEL_COUNT];
|
||||
|
||||
if (uni_drc_sel_proc_output->downmix_matrix_present == 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;
|
||||
for (i_ch = 0; i_ch < num_base_ch; i_ch++) {
|
||||
tmp_out[o_ch] += input_audio[i_ch][i] *
|
||||
uni_drc_sel_proc_output->downmix_matrix[i_ch][o_ch];
|
||||
}
|
||||
}
|
||||
for (o_ch = 0; o_ch < num_target_ch; o_ch++) {
|
||||
input_audio[o_ch][i] = tmp_out[o_ch];
|
||||
}
|
||||
for (; o_ch < num_base_ch; o_ch++) {
|
||||
input_audio[o_ch][i] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
WORD32 impd_init_process_audio_main_stft(ia_drc_api_struct *p_obj_drc)
|
||||
|
||||
{
|
||||
WORD32 error = 0, i, j, num_samples_per_channel;
|
||||
FLOAT32 *input_buffer;
|
||||
FLOAT32 *output_buffer;
|
||||
FLOAT32 *audio_io_buf_real[10];
|
||||
FLOAT32 *audio_io_buf_imag[10];
|
||||
FLOAT32 *scratch_buffer;
|
||||
WORD32 last_frame = 0;
|
||||
scratch_buffer = (FLOAT32 *)p_obj_drc->pp_mem[1];
|
||||
input_buffer = (FLOAT32 *)p_obj_drc->pp_mem[2];
|
||||
output_buffer = (FLOAT32 *)p_obj_drc->pp_mem[3];
|
||||
|
||||
if (p_obj_drc->p_state->ui_in_bytes <= 0) {
|
||||
p_obj_drc->p_state->ui_out_bytes = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((p_obj_drc->p_state->ui_in_bytes / p_obj_drc->str_config.num_ch_in /
|
||||
(p_obj_drc->str_config.pcm_size >> 3)) <
|
||||
(UWORD32)p_obj_drc->str_config.frame_size)
|
||||
last_frame = 1;
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_in; i++) {
|
||||
audio_io_buf_real[i] =
|
||||
scratch_buffer + i * (p_obj_drc->str_config.frame_size + 32);
|
||||
audio_io_buf_imag[i] =
|
||||
scratch_buffer +
|
||||
p_obj_drc->str_config.num_ch_in * p_obj_drc->str_config.frame_size +
|
||||
p_obj_drc->str_config.num_ch_in * 64 +
|
||||
i * (p_obj_drc->str_config.frame_size + 64);
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
audio_io_buf_real[i][j] =
|
||||
input_buffer[j * p_obj_drc->str_config.num_ch_in + i];
|
||||
audio_io_buf_imag[i][j] =
|
||||
input_buffer[p_obj_drc->str_config.num_ch_in *
|
||||
p_obj_drc->str_config.frame_size +
|
||||
j * p_obj_drc->str_config.num_ch_in + i];
|
||||
}
|
||||
}
|
||||
|
||||
error = impd_process_drc_bitstream_dec_gain(
|
||||
p_obj_drc->str_payload.pstr_bitstream_dec, p_obj_drc->pstr_bit_buf,
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain,
|
||||
&p_obj_drc->str_bit_handler
|
||||
.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||
|
||||
if (error > PROC_COMPLETE) return -1;
|
||||
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||
p_obj_drc->str_bit_handler.byte_index_bs +=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
if (p_obj_drc->str_bit_handler.gain_stream_flag ==
|
||||
0) // ITTIAM: Flag for applying gain frame by frame
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs -=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
}
|
||||
|
||||
if (p_obj_drc->str_config.bitstream_file_format ==
|
||||
BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||
if (p_obj_drc->str_bit_handler.num_bits_offset_bs != 0) {
|
||||
p_obj_drc->str_bit_handler.num_bits_read_bs =
|
||||
p_obj_drc->str_bit_handler.num_bits_read_bs + 8 -
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs + 1;
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = 0;
|
||||
p_obj_drc->str_bit_handler.byte_index_bs =
|
||||
p_obj_drc->str_bit_handler.byte_index_bs + 1;
|
||||
if (p_obj_drc->str_bit_handler.gain_stream_flag ==
|
||||
0) // ITTIAM: Flag for applying gain frame by frame
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs =
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
error = impd_drc_process_freq_domain(
|
||||
p_obj_drc->str_payload.pstr_gain_dec[0],
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain, audio_io_buf_real,
|
||||
audio_io_buf_imag, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->drc_characteristic_target);
|
||||
if (error) return -1;
|
||||
|
||||
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||
audio_io_buf_real, p_obj_drc->str_config.frame_size);
|
||||
if (error) return -1;
|
||||
|
||||
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||
audio_io_buf_imag, p_obj_drc->str_config.frame_size);
|
||||
if (error) return -1;
|
||||
|
||||
error = impd_drc_process_freq_domain(
|
||||
p_obj_drc->str_payload.pstr_gain_dec[1],
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain, audio_io_buf_real,
|
||||
audio_io_buf_imag, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->drc_characteristic_target);
|
||||
if (error) return -1;
|
||||
|
||||
if (p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db != 0.0f) {
|
||||
FLOAT32 loudness_normalization_gain =
|
||||
(FLOAT32)pow(10.0, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db /
|
||||
20.0);
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
audio_io_buf_real[i][j] *= loudness_normalization_gain;
|
||||
audio_io_buf_imag[i][j] *= loudness_normalization_gain;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
num_samples_per_channel = p_obj_drc->str_config.frame_size;
|
||||
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
output_buffer[j * p_obj_drc->str_config.num_ch_out + i] =
|
||||
audio_io_buf_real[i][j];
|
||||
output_buffer[p_obj_drc->str_config.frame_size *
|
||||
p_obj_drc->str_config.num_ch_in +
|
||||
j * p_obj_drc->str_config.num_ch_out + i] =
|
||||
audio_io_buf_imag[i][j];
|
||||
}
|
||||
}
|
||||
p_obj_drc->p_state->ui_out_bytes =
|
||||
p_obj_drc->str_config.num_ch_out * (p_obj_drc->str_config.frame_size) * 4;
|
||||
p_obj_drc->p_state->ui_out_bytes =
|
||||
p_obj_drc->str_config.num_ch_out *
|
||||
(p_obj_drc->p_state->ui_in_bytes / p_obj_drc->str_config.num_ch_in);
|
||||
|
||||
if (last_frame == 0) {
|
||||
if (p_obj_drc->str_config.bitstream_file_format !=
|
||||
BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||
error = impd_process_drc_bitstream_dec(
|
||||
p_obj_drc->str_payload.pstr_bitstream_dec, p_obj_drc->pstr_bit_buf,
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_loudness_info,
|
||||
&p_obj_drc->str_bit_handler
|
||||
.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||
|
||||
if (error > PROC_COMPLETE) return -1;
|
||||
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||
p_obj_drc->str_bit_handler.byte_index_bs +=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs -=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
}
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
|
@ -75,18 +75,9 @@ static IA_ERRORCODE impd_down_mix(
|
|||
IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc) {
|
||||
IA_ERRORCODE err_code = IA_NO_ERROR;
|
||||
WORD32 i, j;
|
||||
FLOAT32 *input_buffer;
|
||||
WORD16 *input_buffer16, *output_buffer16;
|
||||
FLOAT32 *output_buffer;
|
||||
FLOAT32 *audio_buff[10];
|
||||
FLOAT32 *scratch_buffer;
|
||||
WORD32 last_frame = 0;
|
||||
WORD32 num_sample_to_process;
|
||||
scratch_buffer = (FLOAT32 *)p_obj_drc->pp_mem[1];
|
||||
input_buffer = (FLOAT32 *)p_obj_drc->pp_mem[2];
|
||||
output_buffer = (FLOAT32 *)p_obj_drc->pp_mem[3];
|
||||
input_buffer16 = (WORD16 *)p_obj_drc->pp_mem[2];
|
||||
output_buffer16 = (WORD16 *)p_obj_drc->pp_mem[3];
|
||||
|
||||
if (p_obj_drc->p_state->ui_in_bytes <= 0) {
|
||||
p_obj_drc->p_state->ui_out_bytes = 0;
|
||||
|
|
@ -111,29 +102,16 @@ IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc) {
|
|||
(p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||
p_obj_drc->str_bit_handler.byte_index_bs +=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
if (p_obj_drc->str_bit_handler.gain_stream_flag ==
|
||||
0) // ITTIAM: Flag for applying gain frame by frame
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs -=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
}
|
||||
|
||||
if (p_obj_drc->str_config.bitstream_file_format ==
|
||||
BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||
if (p_obj_drc->str_bit_handler.num_bits_offset_bs != 0) {
|
||||
p_obj_drc->str_bit_handler.num_bits_read_bs =
|
||||
p_obj_drc->str_bit_handler.num_bits_read_bs + 8 -
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs + 1;
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = 0;
|
||||
p_obj_drc->str_bit_handler.byte_index_bs =
|
||||
p_obj_drc->str_bit_handler.byte_index_bs + 1;
|
||||
if (p_obj_drc->str_bit_handler.gain_stream_flag == 0) {
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs =
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs - 1;
|
||||
}
|
||||
}
|
||||
if (p_obj_drc->str_bit_handler.num_bits_offset_bs != 0) {
|
||||
p_obj_drc->str_bit_handler.num_bits_read_bs =
|
||||
p_obj_drc->str_bit_handler.num_bits_read_bs + 8 -
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs + 1;
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = 0;
|
||||
p_obj_drc->str_bit_handler.byte_index_bs =
|
||||
p_obj_drc->str_bit_handler.byte_index_bs + 1;
|
||||
}
|
||||
|
||||
num_sample_to_process =
|
||||
|
|
@ -145,6 +123,8 @@ IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc) {
|
|||
if (num_sample_to_process < p_obj_drc->str_config.frame_size) last_frame = 1;
|
||||
|
||||
if (p_obj_drc->str_config.pcm_size == 16) {
|
||||
FLOAT32 *scratch_buffer = (FLOAT32 *)p_obj_drc->pp_mem[1];
|
||||
WORD16 *input_buffer16 = (WORD16 *)p_obj_drc->pp_mem[2];
|
||||
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);
|
||||
|
|
@ -155,7 +135,29 @@ IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc) {
|
|||
32767.0f;
|
||||
}
|
||||
}
|
||||
} else if (p_obj_drc->str_config.pcm_size == 24) {
|
||||
FLOAT32 *scratch_buffer = (FLOAT32 *)p_obj_drc->pp_mem[1];
|
||||
WORD8 *input_buffer8 = (WORD8 *)p_obj_drc->pp_mem[2];
|
||||
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++) {
|
||||
WORD32 temp;
|
||||
|
||||
WORD8 *addr =
|
||||
(WORD8 *)(&input_buffer8[3 * j * p_obj_drc->str_config.num_ch_in +
|
||||
3 * i]);
|
||||
temp = (WORD8)(*(addr + 2));
|
||||
temp = (temp << 8) | ((WORD8)(*(addr + 1)) & 0xff);
|
||||
temp = (temp << 8) | (((WORD8) * (addr)) & 0xff);
|
||||
|
||||
audio_buff[i][j] = (FLOAT32)((temp) / 8388607.0f);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
FLOAT32 *scratch_buffer = (FLOAT32 *)p_obj_drc->pp_mem[1];
|
||||
FLOAT32 *input_buffer = (FLOAT32 *)p_obj_drc->pp_mem[2];
|
||||
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);
|
||||
|
|
@ -214,6 +216,7 @@ IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc) {
|
|||
}
|
||||
|
||||
if (p_obj_drc->str_config.peak_limiter) {
|
||||
FLOAT32 *output_buffer = (FLOAT32 *)p_obj_drc->pp_mem[3];
|
||||
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] =
|
||||
|
|
@ -236,6 +239,7 @@ IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc) {
|
|||
}
|
||||
|
||||
if (p_obj_drc->str_config.pcm_size == 16) {
|
||||
WORD16 *output_buffer16 = (WORD16 *)p_obj_drc->pp_mem[3];
|
||||
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)
|
||||
|
|
@ -249,7 +253,30 @@ IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc) {
|
|||
(WORD16)(audio_buff[i][j] * 32767.0f);
|
||||
}
|
||||
}
|
||||
} else if (p_obj_drc->str_config.pcm_size == 24) {
|
||||
WORD8 *output_buffer8 = (WORD8 *)p_obj_drc->pp_mem[3];
|
||||
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++) {
|
||||
WORD32 temp = 0;
|
||||
WORD8 *temp_addr =
|
||||
&output_buffer8[3 * j * p_obj_drc->str_config.num_ch_out + 3 * i];
|
||||
|
||||
if (audio_buff[i][j] < -1.0f)
|
||||
temp = -8388607;
|
||||
|
||||
else if (audio_buff[i][j] > 1.0f)
|
||||
temp = 8388607;
|
||||
|
||||
else
|
||||
temp = (WORD32)(audio_buff[i][j] * 8388607.0f);
|
||||
|
||||
*temp_addr++ = (WORD8)(temp & 0xff);
|
||||
*temp_addr++ = (WORD8)((WORD32)temp >> 8) & 0xff;
|
||||
*temp_addr = (WORD8)((WORD32)temp >> 16) & 0xff;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
FLOAT32 *output_buffer = (FLOAT32 *)p_obj_drc->pp_mem[3];
|
||||
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] =
|
||||
|
|
@ -263,6 +290,8 @@ IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc) {
|
|||
(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) {
|
||||
FLOAT32 *output_buffer = (FLOAT32 *)p_obj_drc->pp_mem[3];
|
||||
WORD16 *output_buffer16 = (WORD16 *)p_obj_drc->pp_mem[3];
|
||||
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) *
|
||||
|
|
@ -294,32 +323,5 @@ IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc) {
|
|||
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->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_loudness_info,
|
||||
&p_obj_drc->str_bit_handler
|
||||
.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||
|
||||
if (err_code > PROC_COMPLETE) return -1;
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,364 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
#include <math.h>
|
||||
#include "impd_type_def.h"
|
||||
#include "impd_memory_standards.h"
|
||||
#include "impd_drc_peak_limiter.h"
|
||||
#include "impd_drc_extr_delta_coded_info.h"
|
||||
#include "impd_drc_common.h"
|
||||
#include "impd_drc_struct.h"
|
||||
#include "impd_drc_interface.h"
|
||||
#include "impd_drc_bitbuffer.h"
|
||||
#include "impd_drc_bitstream_dec_api.h"
|
||||
#include "impd_drc_gain_dec.h"
|
||||
#include "impd_drc_filter_bank.h"
|
||||
#include "impd_drc_multi_band.h"
|
||||
#include "impd_drc_process_audio.h"
|
||||
#include "impd_parametric_drc_dec.h"
|
||||
#include "impd_drc_eq.h"
|
||||
#include "impd_drc_gain_decoder.h"
|
||||
#include "impd_drc_selection_process.h"
|
||||
#include "impd_drc_api_struct_def.h"
|
||||
#include "impd_drc_hashdefines.h"
|
||||
#include "impd_drc_rom.h"
|
||||
|
||||
VOID process_qmf_syn_filt_bank(ia_drc_qmf_filt_struct *qmf_filt, FLOAT64 *buff,
|
||||
FLOAT32 *input_real, FLOAT32 *input_imag,
|
||||
FLOAT32 *output) {
|
||||
WORD32 i, j;
|
||||
FLOAT64 U[10 * QMF_NUM_FILT_BANDS];
|
||||
FLOAT64 W[10 * QMF_NUM_FILT_BANDS];
|
||||
|
||||
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] -
|
||||
input_imag[j] * qmf_filt->syn_tab_imag[i][j];
|
||||
}
|
||||
buff[i] = tmp;
|
||||
}
|
||||
|
||||
for (i = 0; i < 5; i++) {
|
||||
for (j = 0; j < QMF_FILT_RESOLUTION; j++) {
|
||||
U[2 * QMF_FILT_RESOLUTION * i + j] =
|
||||
buff[4 * QMF_FILT_RESOLUTION * i + j];
|
||||
U[2 * QMF_FILT_RESOLUTION * i + QMF_FILT_RESOLUTION + j] =
|
||||
buff[4 * QMF_FILT_RESOLUTION * i + 3 * QMF_FILT_RESOLUTION + j];
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 10 * QMF_FILT_RESOLUTION; 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++) {
|
||||
tmp = tmp + W[QMF_FILT_RESOLUTION * j + i];
|
||||
}
|
||||
output[i] = (FLOAT32)tmp;
|
||||
}
|
||||
}
|
||||
|
||||
VOID process_qmf_ana_filt_bank(ia_drc_qmf_filt_struct *qmf_filt, FLOAT64 *buff,
|
||||
FLOAT32 *input, FLOAT32 *output_real,
|
||||
FLOAT32 *output_imag) {
|
||||
WORD32 i, j;
|
||||
FLOAT32 Z[10 * QMF_NUM_FILT_BANDS];
|
||||
FLOAT32 Y[2 * QMF_NUM_FILT_BANDS];
|
||||
|
||||
for (i = 10 * QMF_FILT_RESOLUTION - 1; i >= QMF_FILT_RESOLUTION; i--) {
|
||||
buff[i] = buff[i - QMF_FILT_RESOLUTION];
|
||||
}
|
||||
|
||||
for (i = QMF_FILT_RESOLUTION - 1; i >= 0; i--) {
|
||||
buff[i] = input[QMF_FILT_RESOLUTION - 1 - i];
|
||||
}
|
||||
|
||||
for (i = 0; i < 10 * QMF_FILT_RESOLUTION; i++) {
|
||||
Z[i] = (FLOAT32)(buff[i] * qmf_filter_coeff[i]);
|
||||
}
|
||||
|
||||
for (i = 0; i < 2 * QMF_FILT_RESOLUTION; i++) {
|
||||
Y[i] = 0.0f;
|
||||
for (j = 0; j < 5; j++) {
|
||||
Y[i] += Z[i + j * 2 * QMF_FILT_RESOLUTION];
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < QMF_FILT_RESOLUTION; i++) {
|
||||
output_real[i] = 0.0f;
|
||||
output_imag[i] = 0.0f;
|
||||
for (j = 0; j < 2 * QMF_FILT_RESOLUTION; j++) {
|
||||
output_real[i] += (FLOAT32)(Y[j] * qmf_filt->ana_tab_real[i][j]);
|
||||
output_imag[i] += (FLOAT32)(Y[j] * qmf_filt->ana_tab_imag[i][j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static WORD32 impd_down_mix(
|
||||
ia_drc_sel_proc_output_struct *uni_drc_sel_proc_output,
|
||||
FLOAT32 **input_audio, WORD32 frame_len) {
|
||||
WORD32 num_base_ch = uni_drc_sel_proc_output->base_channel_count;
|
||||
WORD32 num_target_ch = uni_drc_sel_proc_output->target_channel_count;
|
||||
WORD32 i, i_ch, o_ch;
|
||||
FLOAT32 tmp_out[MAX_CHANNEL_COUNT];
|
||||
|
||||
if (num_target_ch > MAX_CHANNEL_COUNT) return -1;
|
||||
|
||||
if (num_target_ch > num_base_ch) return -1;
|
||||
|
||||
for (i = 0; i < frame_len; i++) {
|
||||
for (o_ch = 0; o_ch < num_target_ch; o_ch++) {
|
||||
tmp_out[o_ch] = 0.0f;
|
||||
for (i_ch = 0; i_ch < num_base_ch; i_ch++) {
|
||||
tmp_out[o_ch] += input_audio[i_ch][i] *
|
||||
uni_drc_sel_proc_output->downmix_matrix[i_ch][o_ch];
|
||||
}
|
||||
}
|
||||
for (o_ch = 0; o_ch < num_target_ch; o_ch++) {
|
||||
input_audio[o_ch][i] = tmp_out[o_ch];
|
||||
}
|
||||
for (; o_ch < num_base_ch; o_ch++) {
|
||||
input_audio[o_ch][i] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
WORD32 impd_init_process_audio_main_td_qmf(ia_drc_api_struct *p_obj_drc)
|
||||
|
||||
{
|
||||
WORD32 error, i, j, num_samples_per_channel;
|
||||
FLOAT32 *input_buffer;
|
||||
WORD16 *input_buffer16, *output_buffer16;
|
||||
FLOAT32 *output_buffer;
|
||||
FLOAT32 *audio_io_buf_real[10];
|
||||
FLOAT32 *audio_io_buf_imag[10];
|
||||
FLOAT32 *audio_in_out_buf[10];
|
||||
FLOAT32 *scratch_buffer;
|
||||
WORD32 last_frame = 0;
|
||||
error = 0;
|
||||
scratch_buffer = (FLOAT32 *)p_obj_drc->pp_mem[1];
|
||||
input_buffer = (FLOAT32 *)p_obj_drc->pp_mem[2];
|
||||
output_buffer = (FLOAT32 *)p_obj_drc->pp_mem[3];
|
||||
|
||||
input_buffer16 = (WORD16 *)p_obj_drc->pp_mem[2];
|
||||
output_buffer16 = (WORD16 *)p_obj_drc->pp_mem[3];
|
||||
|
||||
if (p_obj_drc->p_state->ui_in_bytes <= 0) {
|
||||
p_obj_drc->p_state->ui_out_bytes = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((p_obj_drc->p_state->ui_in_bytes / p_obj_drc->str_config.num_ch_in /
|
||||
(p_obj_drc->str_config.pcm_size >> 3)) <
|
||||
(UWORD32)p_obj_drc->str_config.frame_size)
|
||||
last_frame = 1;
|
||||
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_in; i++) {
|
||||
audio_in_out_buf[i] = scratch_buffer;
|
||||
scratch_buffer = scratch_buffer + (p_obj_drc->str_config.frame_size + 32);
|
||||
audio_io_buf_real[i] =
|
||||
scratch_buffer +
|
||||
(p_obj_drc->str_config.frame_size * p_obj_drc->str_config.num_ch_in +
|
||||
512);
|
||||
audio_io_buf_imag[i] = scratch_buffer +
|
||||
2 * (p_obj_drc->str_config.frame_size *
|
||||
p_obj_drc->str_config.num_ch_in +
|
||||
512);
|
||||
;
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
if (p_obj_drc->str_config.pcm_size == 16) {
|
||||
audio_in_out_buf[i][j] =
|
||||
((FLOAT32)input_buffer16[j * p_obj_drc->str_config.num_ch_in + i]) /
|
||||
32767.0f;
|
||||
} else {
|
||||
audio_in_out_buf[i][j] =
|
||||
input_buffer[j * p_obj_drc->str_config.num_ch_in + i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
error = impd_process_drc_bitstream_dec_gain(
|
||||
p_obj_drc->str_payload.pstr_bitstream_dec, p_obj_drc->pstr_bit_buf,
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain,
|
||||
&p_obj_drc->str_bit_handler
|
||||
.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||
|
||||
if (error > PROC_COMPLETE) return -1;
|
||||
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||
p_obj_drc->str_bit_handler.byte_index_bs +=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
if (p_obj_drc->str_bit_handler.gain_stream_flag ==
|
||||
0) // ITTIAM: Flag for applying gain frame by frame
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs -=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
}
|
||||
if (p_obj_drc->str_config.bitstream_file_format ==
|
||||
BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||
/* shift over fill-bits for frame byte alignment */
|
||||
if (p_obj_drc->str_bit_handler.num_bits_offset_bs != 0) {
|
||||
p_obj_drc->str_bit_handler.num_bits_read_bs =
|
||||
p_obj_drc->str_bit_handler.num_bits_read_bs + 8 -
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs + 1;
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = 0;
|
||||
p_obj_drc->str_bit_handler.byte_index_bs =
|
||||
p_obj_drc->str_bit_handler.byte_index_bs + 1;
|
||||
if (p_obj_drc->str_bit_handler.gain_stream_flag ==
|
||||
0) // ITTIAM: Flag for applying gain frame by frame
|
||||
{
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs =
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_in; i++) {
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j += 64) {
|
||||
process_qmf_ana_filt_bank(
|
||||
p_obj_drc->str_payload.pstr_qmf_filter,
|
||||
p_obj_drc->str_payload.pstr_qmf_filter->ana_buff +
|
||||
i * 4 * p_obj_drc->str_config.frame_size,
|
||||
&(audio_in_out_buf[i][j]), &(audio_io_buf_real[i][j]),
|
||||
&(audio_io_buf_imag[i][j]));
|
||||
}
|
||||
}
|
||||
error = impd_drc_process_freq_domain(
|
||||
p_obj_drc->str_payload.pstr_gain_dec[0],
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain, audio_io_buf_real,
|
||||
audio_io_buf_imag, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->drc_characteristic_target);
|
||||
|
||||
if (error) return error;
|
||||
|
||||
if (p_obj_drc->str_payload.pstr_drc_sel_proc_output->target_channel_count <
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->base_channel_count) {
|
||||
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||
audio_io_buf_real, p_obj_drc->str_config.frame_size);
|
||||
if (error) return error;
|
||||
|
||||
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||
audio_io_buf_imag, p_obj_drc->str_config.frame_size);
|
||||
if (error) return error;
|
||||
}
|
||||
|
||||
error = impd_drc_process_freq_domain(
|
||||
p_obj_drc->str_payload.pstr_gain_dec[1],
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_drc_gain, audio_io_buf_real,
|
||||
audio_io_buf_imag, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->drc_characteristic_target);
|
||||
if (error) return -1;
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j += 64) {
|
||||
process_qmf_syn_filt_bank(
|
||||
p_obj_drc->str_payload.pstr_qmf_filter,
|
||||
p_obj_drc->str_payload.pstr_qmf_filter->syn_buff +
|
||||
i * 4 * p_obj_drc->str_config.frame_size,
|
||||
&(audio_io_buf_real[i][j]), &(audio_io_buf_imag[i][j]),
|
||||
&(audio_in_out_buf[i][j]));
|
||||
}
|
||||
}
|
||||
|
||||
if (p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db != 0.0f) {
|
||||
FLOAT32 loudness_normalization_gain =
|
||||
(FLOAT32)pow(10.0, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||
->loudness_normalization_gain_db /
|
||||
20.0);
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
audio_io_buf_real[i][j] *= loudness_normalization_gain;
|
||||
audio_io_buf_imag[i][j] *= loudness_normalization_gain;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
num_samples_per_channel = p_obj_drc->str_config.frame_size;
|
||||
|
||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||
if (p_obj_drc->str_config.pcm_size == 16) {
|
||||
output_buffer16[j * p_obj_drc->str_config.num_ch_out + i] =
|
||||
(WORD16)(audio_in_out_buf[i][j] * 32767.0f);
|
||||
} else {
|
||||
output_buffer[j * p_obj_drc->str_config.num_ch_out + i] =
|
||||
audio_in_out_buf[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
p_obj_drc->p_state->ui_out_bytes =
|
||||
p_obj_drc->str_config.num_ch_out *
|
||||
(p_obj_drc->p_state->ui_in_bytes / p_obj_drc->str_config.num_ch_in);
|
||||
|
||||
if (p_obj_drc->str_config.bitstream_file_format !=
|
||||
BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||
error = impd_process_drc_bitstream_dec(
|
||||
p_obj_drc->str_payload.pstr_bitstream_dec, p_obj_drc->pstr_bit_buf,
|
||||
p_obj_drc->str_payload.pstr_drc_config,
|
||||
p_obj_drc->str_payload.pstr_loudness_info,
|
||||
&p_obj_drc->str_bit_handler
|
||||
.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||
|
||||
if (error > PROC_COMPLETE) return -1;
|
||||
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||
p_obj_drc->str_bit_handler.num_bits_offset_bs =
|
||||
(p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||
p_obj_drc->str_bit_handler.byte_index_bs +=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
p_obj_drc->str_bit_handler.num_bytes_bs -=
|
||||
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
WORD32 impd_init_parametric_drc(
|
||||
WORD32 drc_frame_size, WORD32 sampling_rate, WORD32 sub_band_domain_mode,
|
||||
ia_parametric_drc_params_struct* p_parametricdrc_params) {
|
||||
WORD32 sub_band_count_tbl[4] = {0, 64, 71, 256};
|
||||
static const WORD32 sub_band_count_tbl[4] = {0, 64, 71, 256};
|
||||
p_parametricdrc_params->drc_frame_size = drc_frame_size;
|
||||
p_parametricdrc_params->sampling_rate = sampling_rate;
|
||||
p_parametricdrc_params->sub_band_domain_mode = sub_band_domain_mode;
|
||||
|
|
@ -568,7 +568,7 @@ WORD32 impd_init_lvl_est_filt_subband(
|
|||
FLOAT32 w0, alpha, sinw0, cosw0;
|
||||
FLOAT32 b0, b1, b2, a0, a1, a2;
|
||||
FLOAT32 num_real, num_imag, den_real, den_imag;
|
||||
FLOAT32* f_bands_nrm;
|
||||
const FLOAT32* f_bands_nrm;
|
||||
WORD32 b;
|
||||
WORD32 i;
|
||||
const FLOAT32* ptr_samp_tbl;
|
||||
|
|
|
|||
|
|
@ -130,6 +130,9 @@ WORD32 impd_apply_gains_and_add(
|
|||
impd_shape_filt_block_adapt(lpcm_gains[iEnd],
|
||||
&shape_filter_block[g]);
|
||||
}
|
||||
if ((iEnd == iStart) &&
|
||||
(drc_gain_last == shape_filter_block[g].drc_gain_last))
|
||||
break;
|
||||
iStart = iEnd;
|
||||
}
|
||||
}
|
||||
|
|
@ -176,183 +179,6 @@ WORD32 impd_apply_gains_and_add(
|
|||
return (0);
|
||||
}
|
||||
|
||||
/* subband-domain DRC: in-place application of DRC gains to audio frame */
|
||||
WORD32
|
||||
impd_apply_gains_subband(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||
const WORD32 drc_instructions_index,
|
||||
ia_drc_params_struct* ia_drc_params_struct,
|
||||
ia_gain_buffer_struct* pstr_gain_buf,
|
||||
ia_overlap_params_struct* pstr_overlap_params,
|
||||
FLOAT32* deinterleaved_audio_delayed_re[],
|
||||
FLOAT32* deinterleaved_audio_delayed_im[],
|
||||
FLOAT32* deinterleaved_audio_re[],
|
||||
FLOAT32* deinterleaved_audio_im[]) {
|
||||
WORD32 c, b, g, m, s;
|
||||
WORD32 gainIndexForGroup[CHANNEL_GROUP_COUNT_MAX];
|
||||
FLOAT32* lpcm_gains;
|
||||
FLOAT32 gainSb, gainLr;
|
||||
ia_drc_instructions_struct* str_drc_instruction_str;
|
||||
WORD32 offset = 0, signalIndex = 0;
|
||||
WORD32 drc_frame_sizeSb = 0;
|
||||
WORD32 nDecoderSubbands = 0;
|
||||
WORD32 L = 0; /* L: downsampling factor */
|
||||
WORD32 analysisDelay = 0;
|
||||
switch (ia_drc_params_struct->sub_band_domain_mode) {
|
||||
case SUBBAND_DOMAIN_MODE_QMF64:
|
||||
nDecoderSubbands = AUDIO_CODEC_SUBBAND_COUNT_QMF64;
|
||||
L = AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF64;
|
||||
analysisDelay = AUDIO_CODEC_SUBBAND_ANALYSE_DELAY_QMF64;
|
||||
break;
|
||||
case SUBBAND_DOMAIN_MODE_QMF71:
|
||||
nDecoderSubbands = AUDIO_CODEC_SUBBAND_COUNT_QMF71;
|
||||
L = AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF71;
|
||||
analysisDelay = AUDIO_CODEC_SUBBAND_ANALYSE_DELAY_QMF71;
|
||||
break;
|
||||
case SUBBAND_DOMAIN_MODE_STFT256:
|
||||
nDecoderSubbands = AUDIO_CODEC_SUBBAND_COUNT_STFT256;
|
||||
L = AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_STFT256;
|
||||
analysisDelay = AUDIO_CODEC_SUBBAND_ANALYSE_DELAY_STFT256;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
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]);
|
||||
{
|
||||
if (str_drc_instruction_str->drc_set_id > 0) {
|
||||
if (ia_drc_params_struct->delay_mode == DELAY_MODE_LOW_DELAY) {
|
||||
offset = ia_drc_params_struct->drc_frame_size;
|
||||
}
|
||||
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]; /* index of first gain sequence
|
||||
in channel group */
|
||||
}
|
||||
|
||||
for (c = 0; c < str_drc_instruction_str->audio_num_chan; c++)
|
||||
|
||||
{
|
||||
g = str_drc_instruction_str->channel_group_of_ch[c];
|
||||
if (g >= 0) {
|
||||
for (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++) {
|
||||
gainSb = 0.0f;
|
||||
for (b = 0;
|
||||
b < str_drc_instruction_str->band_count_of_ch_group[g];
|
||||
b++) {
|
||||
if (str_drc_instruction_str
|
||||
->ch_group_parametric_drc_flag[g] == 0) {
|
||||
lpcm_gains =
|
||||
pstr_gain_buf
|
||||
->buf_interpolation[gainIndexForGroup[g] + b]
|
||||
.lpcm_gains +
|
||||
MAX_SIGNAL_DELAY -
|
||||
ia_drc_params_struct->gain_delay_samples -
|
||||
ia_drc_params_struct->audio_delay_samples + offset;
|
||||
} else {
|
||||
lpcm_gains =
|
||||
pstr_gain_buf
|
||||
->buf_interpolation[gainIndexForGroup[g] + b]
|
||||
.lpcm_gains +
|
||||
MAX_SIGNAL_DELAY +
|
||||
str_drc_instruction_str
|
||||
->parametric_drc_look_ahead_samples[g] -
|
||||
ia_drc_params_struct->audio_delay_samples +
|
||||
analysisDelay;
|
||||
}
|
||||
/* get gain for this timeslot by downsampling */
|
||||
gainLr = lpcm_gains[(m * L + (L - 1) / 2)];
|
||||
gainSb += pstr_overlap_params->str_group_overlap_params[g]
|
||||
.str_band_overlap_params[b]
|
||||
.overlap_weight[s] *
|
||||
gainLr;
|
||||
}
|
||||
deinterleaved_audio_re[signalIndex][m * nDecoderSubbands +
|
||||
s] =
|
||||
gainSb *
|
||||
deinterleaved_audio_delayed_re[signalIndex]
|
||||
[m * nDecoderSubbands + s];
|
||||
if (ia_drc_params_struct->sub_band_domain_mode ==
|
||||
SUBBAND_DOMAIN_MODE_STFT256) { /* For STFT filterbank, the
|
||||
real value of the
|
||||
nyquist band is stored
|
||||
at the imag value of the
|
||||
first band */
|
||||
if (s != 0)
|
||||
deinterleaved_audio_im[signalIndex][m * nDecoderSubbands +
|
||||
s] =
|
||||
gainSb *
|
||||
deinterleaved_audio_delayed_im[signalIndex]
|
||||
[m * nDecoderSubbands +
|
||||
s];
|
||||
if (s == (nDecoderSubbands - 1))
|
||||
deinterleaved_audio_im[signalIndex][m * nDecoderSubbands +
|
||||
0] =
|
||||
gainSb *
|
||||
deinterleaved_audio_delayed_im[signalIndex]
|
||||
[m * nDecoderSubbands +
|
||||
0];
|
||||
} else {
|
||||
deinterleaved_audio_im[signalIndex][m * nDecoderSubbands +
|
||||
s] =
|
||||
gainSb *
|
||||
deinterleaved_audio_delayed_im[signalIndex]
|
||||
[m * nDecoderSubbands +
|
||||
s];
|
||||
}
|
||||
}
|
||||
} else { /* single-band DRC */
|
||||
if (str_drc_instruction_str->ch_group_parametric_drc_flag[g] ==
|
||||
0) {
|
||||
lpcm_gains =
|
||||
pstr_gain_buf->buf_interpolation[gainIndexForGroup[g]]
|
||||
.lpcm_gains +
|
||||
MAX_SIGNAL_DELAY -
|
||||
ia_drc_params_struct->gain_delay_samples -
|
||||
ia_drc_params_struct->audio_delay_samples + offset;
|
||||
} else {
|
||||
lpcm_gains =
|
||||
pstr_gain_buf->buf_interpolation[gainIndexForGroup[g]]
|
||||
.lpcm_gains +
|
||||
MAX_SIGNAL_DELAY +
|
||||
str_drc_instruction_str
|
||||
->parametric_drc_look_ahead_samples[g] -
|
||||
ia_drc_params_struct->audio_delay_samples + analysisDelay;
|
||||
}
|
||||
/* get gain for this timeslot by downsampling */
|
||||
gainSb = lpcm_gains[(m * L + (L - 1) / 2)];
|
||||
for (s = 0; s < nDecoderSubbands; s++) {
|
||||
deinterleaved_audio_re[signalIndex][m * nDecoderSubbands +
|
||||
s] =
|
||||
gainSb *
|
||||
deinterleaved_audio_delayed_re[signalIndex]
|
||||
[m * nDecoderSubbands + s];
|
||||
deinterleaved_audio_im[signalIndex][m * nDecoderSubbands +
|
||||
s] =
|
||||
gainSb *
|
||||
deinterleaved_audio_delayed_im[signalIndex]
|
||||
[m * nDecoderSubbands + s];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
signalIndex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
WORD32
|
||||
impd_filter_banks_process(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||
const WORD32 drc_instructions_index,
|
||||
|
|
@ -473,37 +299,6 @@ impd_store_audio_io_buffer_time(FLOAT32* audio_in_out_buf[],
|
|||
return 0;
|
||||
}
|
||||
|
||||
WORD32
|
||||
impd_store_audio_io_buffer_freq(FLOAT32* audio_real_buff[],
|
||||
FLOAT32* audio_imag_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++) {
|
||||
audio_io_buf_internal->audio_buffer_delayed_real
|
||||
[i][audio_io_buf_internal->audio_delay_sub_band_samples *
|
||||
audio_io_buf_internal->audio_sub_band_count +
|
||||
j] = audio_real_buff[i][j];
|
||||
audio_io_buf_internal->audio_buffer_delayed_imag
|
||||
[i][audio_io_buf_internal->audio_delay_sub_band_samples *
|
||||
audio_io_buf_internal->audio_sub_band_count +
|
||||
j] = audio_imag_buff[i][j];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
audio_io_buf_internal->audio_buffer_delayed_real = audio_real_buff;
|
||||
audio_io_buf_internal->audio_buffer_delayed_imag = audio_imag_buff;
|
||||
audio_io_buf_internal->audio_real_buff = audio_real_buff;
|
||||
audio_io_buf_internal->audio_imag_buff = audio_imag_buff;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
WORD32
|
||||
impd_retrieve_audio_io_buffer_time(FLOAT32* audio_in_out_buf[],
|
||||
ia_audio_in_out_buf* audio_io_buf_internal) {
|
||||
|
|
@ -521,30 +316,6 @@ impd_retrieve_audio_io_buffer_time(FLOAT32* audio_in_out_buf[],
|
|||
return 0;
|
||||
}
|
||||
|
||||
WORD32
|
||||
impd_retrieve_audio_buffer_freq(FLOAT32* audio_real_buff[],
|
||||
FLOAT32* audio_imag_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++) {
|
||||
audio_real_buff[i][j] =
|
||||
audio_io_buf_internal->audio_buffer_delayed_real
|
||||
[i][audio_io_buf_internal->audio_sub_band_count + j];
|
||||
audio_imag_buff[i][j] =
|
||||
audio_io_buf_internal->audio_buffer_delayed_imag
|
||||
[i][audio_io_buf_internal->audio_sub_band_count + j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
WORD32
|
||||
impd_advance_audio_io_buffer_time(ia_audio_in_out_buf* audio_io_buf_internal) {
|
||||
WORD32 i;
|
||||
|
|
@ -560,27 +331,3 @@ impd_advance_audio_io_buffer_time(ia_audio_in_out_buf* audio_io_buf_internal) {
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
WORD32
|
||||
impd_advance_audio_buff_freq(ia_audio_in_out_buf* audio_io_buf_internal) {
|
||||
WORD32 i;
|
||||
if (audio_io_buf_internal->audio_delay_sub_band_samples) {
|
||||
for (i = 0; i < audio_io_buf_internal->audio_num_chan; i++) {
|
||||
memmove(audio_io_buf_internal->audio_buffer_delayed_real[i],
|
||||
&audio_io_buf_internal->audio_buffer_delayed_real
|
||||
[i][audio_io_buf_internal->audio_sub_band_frame_size *
|
||||
audio_io_buf_internal->audio_sub_band_count],
|
||||
sizeof(FLOAT32) *
|
||||
audio_io_buf_internal->audio_delay_sub_band_samples *
|
||||
audio_io_buf_internal->audio_sub_band_count);
|
||||
memmove(audio_io_buf_internal->audio_buffer_delayed_imag[i],
|
||||
&audio_io_buf_internal->audio_buffer_delayed_imag
|
||||
[i][audio_io_buf_internal->audio_sub_band_frame_size *
|
||||
audio_io_buf_internal->audio_sub_band_count],
|
||||
sizeof(FLOAT32) *
|
||||
audio_io_buf_internal->audio_delay_sub_band_samples *
|
||||
audio_io_buf_internal->audio_sub_band_count);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,17 +45,6 @@ typedef struct {
|
|||
FLOAT32** audio_imag_buff;
|
||||
} ia_audio_in_out_buf;
|
||||
|
||||
WORD32
|
||||
impd_apply_gains_subband(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||
const WORD32 drc_instructions_index,
|
||||
ia_drc_params_struct* ia_drc_params_struct,
|
||||
ia_gain_buffer_struct* pstr_gain_buf,
|
||||
ia_overlap_params_struct* pstr_overlap_params,
|
||||
FLOAT32* deinterleaved_audio_delayed_re[],
|
||||
FLOAT32* deinterleaved_audio_delayed_im[],
|
||||
FLOAT32* deinterleaved_audio_re[],
|
||||
FLOAT32* deinterleaved_audio_im[]);
|
||||
|
||||
WORD32
|
||||
impd_filter_banks_process(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||
const WORD32 drc_instructions_index,
|
||||
|
|
@ -78,16 +67,9 @@ 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);
|
||||
|
||||
WORD32
|
||||
impd_advance_audio_buff_freq(ia_audio_in_out_buf* audio_io_buf_internal);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -66,20 +66,20 @@ extern const FLOAT32 dwnmix_coeff[];
|
|||
|
||||
extern const FLOAT32 dwnmix_coeff_lfe[];
|
||||
|
||||
extern WORD32 drc_characteristic_order_default[][3];
|
||||
extern const WORD32 drc_characteristic_order_default[][3];
|
||||
|
||||
extern WORD32 measurement_system_default_tbl[];
|
||||
extern const WORD32 measurement_system_default_tbl[];
|
||||
|
||||
extern WORD32 measurement_system_bs1770_3_tbl[];
|
||||
extern WORD32 measurement_system_user_tbl[];
|
||||
extern WORD32 measurement_system_expert_tbl[];
|
||||
extern WORD32 measurement_system_rms_a_tbl[];
|
||||
extern WORD32 measurement_system_rms_b_tbl[];
|
||||
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 const WORD32 measurement_system_bs1770_3_tbl[];
|
||||
extern const WORD32 measurement_system_user_tbl[];
|
||||
extern const WORD32 measurement_system_expert_tbl[];
|
||||
extern const WORD32 measurement_system_rms_a_tbl[];
|
||||
extern const WORD32 measurement_system_rms_b_tbl[];
|
||||
extern const WORD32 measurement_system_rms_c_tbl[];
|
||||
extern const WORD32 measurement_system_rms_d_tbl[];
|
||||
extern const WORD32 measurement_system_rms_e_tbl[];
|
||||
extern const WORD32 measurement_method_prog_loudness_tbl[];
|
||||
extern const WORD32 measurement_method_peak_loudness_tbl[];
|
||||
|
||||
#define MAX_NUM_DOWNMIX_ID_REQUESTS_LOCAL 3
|
||||
|
||||
|
|
@ -151,11 +151,11 @@ typedef struct {
|
|||
extern const ia_loc_drc_parameter_interface_struct
|
||||
loc_drc_parameter_interface[];
|
||||
|
||||
extern FLOAT32 f_bands_nrm_QMF71[71];
|
||||
extern FLOAT32 f_bands_nrm_QMF64[64];
|
||||
extern FLOAT32 f_bands_nrm_STFT256[257];
|
||||
extern const FLOAT32 f_bands_nrm_QMF71[71];
|
||||
extern const FLOAT32 f_bands_nrm_QMF64[64];
|
||||
extern const FLOAT32 f_bands_nrm_STFT256[257];
|
||||
|
||||
FLOAT64 qmf_filter_coeff[640];
|
||||
extern const FLOAT64 qmf_filter_coeff[640];
|
||||
|
||||
extern const ia_filter_bank_params_struct
|
||||
normal_cross_freq[FILTER_BANK_PARAMETER_COUNT];
|
||||
|
|
|
|||
|
|
@ -129,7 +129,6 @@ impd_drc_uni_sel_proc_process(
|
|||
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);
|
||||
|
|
@ -170,9 +169,10 @@ impd_drc_uni_sel_proc_process(
|
|||
for (i = SUB_DRC_COUNT - 1; i >= 0; i--) {
|
||||
WORD32 drc_instructions_index =
|
||||
pstr_drc_uni_sel_proc->drc_instructions_index[i];
|
||||
ia_drc_instructions_struct* str_drc_instruction_str;
|
||||
if (drc_instructions_index < 0) continue;
|
||||
|
||||
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]);
|
||||
|
||||
|
|
@ -213,11 +213,6 @@ impd_drc_uni_sel_proc_process(
|
|||
err = impd_manage_complexity(pstr_drc_uni_sel_proc, pstr_drc_config,
|
||||
&repeat_selection);
|
||||
if (err) return (err);
|
||||
|
||||
loop_cnt++;
|
||||
if (loop_cnt > 100) {
|
||||
return (UNEXPECTED_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 0;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#include "impd_drc_filter_bank.h"
|
||||
#include "impd_drc_rom.h"
|
||||
|
||||
static WORD32 effect_types_request_table[] = {
|
||||
static const WORD32 effect_types_request_table[] = {
|
||||
EFFECT_BIT_NIGHT, EFFECT_BIT_NOISY, EFFECT_BIT_LIMITED,
|
||||
EFFECT_BIT_LOWLEVEL, EFFECT_BIT_DIALOG, EFFECT_BIT_GENERAL_COMPR,
|
||||
EFFECT_BIT_EXPAND, EFFECT_BIT_ARTISTIC};
|
||||
|
|
@ -673,9 +673,9 @@ WORD32 impd_match_drc_characteristic(
|
|||
WORD32 k, err;
|
||||
WORD32 match_found_flag = 0;
|
||||
|
||||
WORD32* drc_characteristic_order =
|
||||
const WORD32* drc_characteristic_order =
|
||||
drc_characteristic_order_default[requested_drc_characteristic - 1];
|
||||
WORD32 drc_characteristic_order_count =
|
||||
const WORD32 drc_characteristic_order_count =
|
||||
sizeof(drc_characteristic_order_default[requested_drc_characteristic]) /
|
||||
sizeof(WORD32);
|
||||
k = 0;
|
||||
|
|
@ -910,6 +910,7 @@ WORD32 impd_drc_set_preselection(
|
|||
for (l = 0; l < loudness_info_count; l++) {
|
||||
WORD32 match_found_flag = 0;
|
||||
WORD32 p;
|
||||
if (k >= SELECTION_CANDIDATE_COUNT_MAX) return UNEXPECTED_ERROR;
|
||||
for (p = 0; p < peak_info_count; p++) {
|
||||
if (eq_set_id_Peak[p] == eq_set_id_loudness[l]) {
|
||||
if (eq_set_id_valid_flag[eq_set_id_Peak[p]] == 1) {
|
||||
|
|
@ -924,7 +925,6 @@ WORD32 impd_drc_set_preselection(
|
|||
signal_peak_level[p] + loudness_normalization_gain_db[l] -
|
||||
pstr_drc_sel_proc_params_struct->output_peak_level_max);
|
||||
adjustment = min(adjustment, max(0.0f, loudness_deviation_max));
|
||||
if (k >= SELECTION_CANDIDATE_COUNT_MAX) return UNEXPECTED_ERROR;
|
||||
selection_candidate_info[k].loudness_norm_db_gain_adjusted =
|
||||
loudness_normalization_gain_db[l] - adjustment;
|
||||
|
||||
|
|
@ -967,11 +967,9 @@ WORD32 impd_drc_set_preselection(
|
|||
}
|
||||
}
|
||||
}
|
||||
if (k > SELECTION_CANDIDATE_COUNT_MAX) return UNEXPECTED_ERROR;
|
||||
*selection_candidate_count = k;
|
||||
|
||||
if (*selection_candidate_count > SELECTION_CANDIDATE_COUNT_MAX) {
|
||||
return UNEXPECTED_ERROR;
|
||||
} else if (pstr_drc_sel_proc_params_struct->dynamic_range_control_on == 1) {
|
||||
if (pstr_drc_sel_proc_params_struct->dynamic_range_control_on == 1) {
|
||||
n = 0;
|
||||
for (k = 0; k < *selection_candidate_count; k++) {
|
||||
str_drc_instruction_str =
|
||||
|
|
@ -1172,6 +1170,7 @@ WORD32 impd_drc_set_final_selection(
|
|||
if (pstr_drc_sel_proc_params_struct->requested_dwnmix_id
|
||||
[selection_candidate_info_step_2[i].downmix_id_request_index] ==
|
||||
str_drc_instruction_str->downmix_id[n]) {
|
||||
if (k >= SELECTION_CANDIDATE_COUNT_MAX) return UNEXPECTED_ERROR;
|
||||
memcpy(&selection_candidate_info_step_2[k],
|
||||
&selection_candidate_info_step_2[i],
|
||||
sizeof(ia_selection_candidate_info_struct));
|
||||
|
|
|
|||
|
|
@ -338,7 +338,7 @@ impd_parametric_drc_parse_gain_set_params(
|
|||
str_parametric_drc_gain_set_params->parametric_drc_id = (temp >> 3) & 0xf;
|
||||
str_parametric_drc_gain_set_params->side_chain_config_type = temp & 7;
|
||||
|
||||
if (str_parametric_drc_gain_set_params->side_chain_config_type) {
|
||||
if (str_parametric_drc_gain_set_params->side_chain_config_type == 1) {
|
||||
temp = impd_read_bits_buf(it_bit_buff, 8);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
|
|
@ -443,9 +443,13 @@ static WORD32 impd_parametric_drc_gen_virtual_gain_sets(
|
|||
str_p_loc_drc_coefficients_uni_drc->gain_sequence_count = 0;
|
||||
drc_config->drc_coefficients_drc_count += 1;
|
||||
}
|
||||
str_p_loc_drc_coefficients_uni_drc->gain_set_count_plus =
|
||||
str_p_loc_drc_coefficients_uni_drc->gain_set_count +
|
||||
str_drc_coeff_param_drc->parametric_drc_gain_set_count;
|
||||
{
|
||||
WORD32 tmp = str_p_loc_drc_coefficients_uni_drc->gain_set_count +
|
||||
str_drc_coeff_param_drc->parametric_drc_gain_set_count;
|
||||
if (tmp > GAIN_SET_COUNT_MAX) return UNEXPECTED_ERROR;
|
||||
str_p_loc_drc_coefficients_uni_drc->gain_set_count_plus = tmp;
|
||||
}
|
||||
|
||||
for (i = str_p_loc_drc_coefficients_uni_drc->gain_set_count;
|
||||
i < str_p_loc_drc_coefficients_uni_drc->gain_set_count_plus; i++) {
|
||||
str_p_loc_drc_coefficients_uni_drc->gain_set_params[i].band_count = 1;
|
||||
|
|
@ -518,9 +522,12 @@ static WORD32 impd_parametic_drc_parse_coeff(
|
|||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
||||
str_drc_coeff_param_drc->drc_location = (temp >> 1) & 0xf;
|
||||
if (str_drc_coeff_param_drc->drc_location < 1 ||
|
||||
str_drc_coeff_param_drc->drc_location > 4)
|
||||
return UNEXPECTED_ERROR;
|
||||
str_drc_coeff_param_drc->parametric_drc_frame_size_format = temp & 1;
|
||||
|
||||
if (str_drc_coeff_param_drc->parametric_drc_frame_size) {
|
||||
if (str_drc_coeff_param_drc->parametric_drc_frame_size_format) {
|
||||
code = impd_read_bits_buf(it_bit_buff, 15);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
str_drc_coeff_param_drc->parametric_drc_frame_size = code + 1;
|
||||
|
|
@ -532,6 +539,7 @@ static WORD32 impd_parametic_drc_parse_coeff(
|
|||
|
||||
str_drc_coeff_param_drc->parametric_drc_delay_max_present =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (str_drc_coeff_param_drc->parametric_drc_delay_max_present) {
|
||||
temp = impd_read_bits_buf(it_bit_buff, 8);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
|
|
@ -723,6 +731,8 @@ WORD32 impd_parse_ch_layout(ia_bit_buf_struct* it_bit_buff,
|
|||
|
||||
channel_layout->base_channel_count = impd_read_bits_buf(it_bit_buff, 7);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (channel_layout->base_channel_count > MAX_CHANNEL_COUNT)
|
||||
return (UNEXPECTED_ERROR);
|
||||
if (ia_drc_params_struct->lfe_channel_map_count != -1 &&
|
||||
channel_layout->base_channel_count !=
|
||||
ia_drc_params_struct->lfe_channel_map_count) {
|
||||
|
|
@ -767,6 +777,8 @@ impd_parse_dwnmix_instructions(
|
|||
|
||||
dwnmix_instructions->downmix_id = (temp >> 16) & 0x7f;
|
||||
dwnmix_instructions->target_channel_count = (temp >> 9) & 0x7f;
|
||||
if (dwnmix_instructions->target_channel_count > MAX_CHANNEL_COUNT)
|
||||
return (UNEXPECTED_ERROR);
|
||||
dwnmix_instructions->target_layout = (temp >> 1) & 0xff;
|
||||
dwnmix_instructions->downmix_coefficients_present = temp & 1;
|
||||
|
||||
|
|
@ -1219,6 +1231,9 @@ impd_parse_drc_config(ia_bit_buf_struct* it_bit_buff,
|
|||
if (err) return (err);
|
||||
}
|
||||
|
||||
if ((drc_config->drc_instructions_uni_drc_count +
|
||||
drc_config->dwnmix_instructions_count) >= DRC_INSTRUCTIONS_COUNT_MAX)
|
||||
return (UNEXPECTED_ERROR);
|
||||
impd_drc_gen_instructions_for_drc_off(drc_config);
|
||||
return (0);
|
||||
}
|
||||
|
|
@ -1440,13 +1455,15 @@ impd_dec_gain_modifiers(ia_bit_buf_struct* it_bit_buff, WORD32 version,
|
|||
}
|
||||
}
|
||||
if (band_count == 1) {
|
||||
WORD32 tmp;
|
||||
pstr_gain_modifiers->shape_filter_flag =
|
||||
impd_read_bits_buf(it_bit_buff, 1);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (pstr_gain_modifiers->shape_filter_flag) {
|
||||
pstr_gain_modifiers->shape_filter_idx =
|
||||
impd_read_bits_buf(it_bit_buff, 4);
|
||||
tmp = impd_read_bits_buf(it_bit_buff, 4);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if (tmp >= (SHAPE_FILTER_COUNT_MAX + 1)) return UNEXPECTED_ERROR;
|
||||
pstr_gain_modifiers->shape_filter_idx = tmp;
|
||||
}
|
||||
}
|
||||
} else if (version == 0) {
|
||||
|
|
@ -1663,6 +1680,9 @@ impd_drc_parse_coeff(
|
|||
drc_frame_size = impd_read_bits_buf(it_bit_buff, 15);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
str_p_loc_drc_coefficients_uni_drc->drc_frame_size = drc_frame_size + 1;
|
||||
if (str_p_loc_drc_coefficients_uni_drc->drc_frame_size >
|
||||
MAX_DRC_FRAME_SIZE)
|
||||
return UNEXPECTED_ERROR;
|
||||
}
|
||||
|
||||
str_p_loc_drc_coefficients_uni_drc->drc_characteristic_left_present = 0;
|
||||
|
|
@ -1695,6 +1715,10 @@ impd_drc_parse_coeff(
|
|||
ia_drc_params_struct->drc_frame_size /
|
||||
str_p_loc_drc_coefficients_uni_drc->gain_set_params[i]
|
||||
.time_delt_min_val;
|
||||
if (str_p_loc_drc_coefficients_uni_drc->gain_set_params[i]
|
||||
.num_gain_max_values >
|
||||
(N_DELTA_TIME_CODE_TABLE_ENTRIES_MAX / 2 - 1))
|
||||
return (UNEXPECTED_ERROR);
|
||||
err = impd_init_tbls(
|
||||
str_p_loc_drc_coefficients_uni_drc->gain_set_params[i]
|
||||
.num_gain_max_values,
|
||||
|
|
@ -1871,6 +1895,11 @@ impd_drc_parse_coeff(
|
|||
ia_drc_params_struct->drc_frame_size /
|
||||
str_p_loc_drc_coefficients_uni_drc->gain_set_params[i]
|
||||
.time_delt_min_val;
|
||||
if (str_p_loc_drc_coefficients_uni_drc->gain_set_params[i]
|
||||
.num_gain_max_values >
|
||||
(N_DELTA_TIME_CODE_TABLE_ENTRIES_MAX / 2 - 1))
|
||||
return (UNEXPECTED_ERROR);
|
||||
|
||||
err = impd_init_tbls(
|
||||
str_p_loc_drc_coefficients_uni_drc->gain_set_params[i]
|
||||
.num_gain_max_values,
|
||||
|
|
@ -2152,8 +2181,7 @@ impd_parse_drc_instructions_uni_drc(
|
|||
WORD32 bs_gain_set_idx;
|
||||
bs_gain_set_idx = impd_read_bits_buf(it_bit_buff, 6);
|
||||
if (it_bit_buff->error) return it_bit_buff->error;
|
||||
if ((bs_gain_set_idx == 0) || (bs_gain_set_idx > GAIN_SET_COUNT_MAX))
|
||||
return UNEXPECTED_ERROR;
|
||||
if (bs_gain_set_idx > GAIN_SET_COUNT_MAX) return UNEXPECTED_ERROR;
|
||||
str_drc_instruction_str->gain_set_index[c] = bs_gain_set_idx - 1;
|
||||
impd_dec_ducking_scaling(
|
||||
it_bit_buff,
|
||||
|
|
@ -2257,6 +2285,7 @@ impd_parse_drc_instructions_uni_drc(
|
|||
(str_drc_instruction_str->drc_set_effect & EFFECT_BIT_DUCK_OTHER)
|
||||
? ducking_sequence
|
||||
: unique_idx[g];
|
||||
if (set < 0) return UNEXPECTED_ERROR;
|
||||
str_drc_instruction_str->gain_set_index_for_channel_group[g] = set;
|
||||
str_drc_instruction_str->str_ducking_modifiers_for_channel_group[g]
|
||||
.ducking_scaling = unique_scaling[g];
|
||||
|
|
@ -2305,8 +2334,7 @@ impd_parse_drc_instructions_uni_drc(
|
|||
bs_gain_set_idx = (temp >> 1) & 0x7f;
|
||||
repeat_gain_set_idx = temp & 1;
|
||||
|
||||
if ((bs_gain_set_idx == 0) || (bs_gain_set_idx > GAIN_SET_COUNT_MAX))
|
||||
return UNEXPECTED_ERROR;
|
||||
if (bs_gain_set_idx > GAIN_SET_COUNT_MAX) return UNEXPECTED_ERROR;
|
||||
|
||||
str_drc_instruction_str->gain_set_index[c] = bs_gain_set_idx - 1;
|
||||
c++;
|
||||
|
|
@ -2368,6 +2396,7 @@ impd_parse_drc_instructions_uni_drc(
|
|||
WORD32 set, band_count;
|
||||
|
||||
set = unique_idx[g];
|
||||
if (set < 0) return UNEXPECTED_ERROR;
|
||||
str_drc_instruction_str->gain_set_index_for_channel_group[g] = set;
|
||||
|
||||
if (str_p_loc_drc_coefficients_uni_drc != NULL &&
|
||||
|
|
|
|||
|
|
@ -1,102 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "impd_type_def.h"
|
||||
#include "impd_drc_uni_tables.h"
|
||||
#include "impd_drc_uni_common.h"
|
||||
#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) {
|
||||
impd_gen_delta_time_code_tbl(num_gain_max_values,
|
||||
str_tables->delta_time_code_table);
|
||||
return (0);
|
||||
}
|
||||
|
||||
void impd_get_slope_code_tbl_and_size(
|
||||
ia_slope_code_table_struct const** slope_code_tbl_entry,
|
||||
WORD32* num_slope_code_tbl_entries) {
|
||||
*slope_code_tbl_entry = &(slopeCodeTableEntryBySize[0]);
|
||||
*num_slope_code_tbl_entries = kNumSlopeValuesTable;
|
||||
}
|
||||
|
||||
void impd_get_delta_gain_code_tbl(
|
||||
const WORD32 gain_coding_profile,
|
||||
ia_delta_gain_code_table_struct const** delta_time_code_tbl,
|
||||
WORD32* num_entries) {
|
||||
if (gain_coding_profile == GAIN_CODING_PROFILE_CLIPPING) {
|
||||
*delta_time_code_tbl = deltaGainCodeTableProfile2BySize;
|
||||
*num_entries = kNumDeltaGainValuesTableProfile2;
|
||||
} else {
|
||||
*delta_time_code_tbl = deltaGainCodeTableBySize;
|
||||
*num_entries = kNumDeltaGainValuesTable;
|
||||
}
|
||||
}
|
||||
|
||||
void impd_gen_delta_time_code_tbl(
|
||||
const WORD32 num_gain_max_values,
|
||||
ia_delta_time_code_table_entry_struct* delta_time_code_tbl_item) {
|
||||
WORD32 n, k;
|
||||
|
||||
WORD32 Z = 1;
|
||||
while ((1 << Z) < 2 * num_gain_max_values) {
|
||||
Z++;
|
||||
}
|
||||
|
||||
delta_time_code_tbl_item[0].size = -1;
|
||||
delta_time_code_tbl_item[0].code = -1;
|
||||
delta_time_code_tbl_item[0].value = -1;
|
||||
|
||||
delta_time_code_tbl_item[1].size = 2;
|
||||
delta_time_code_tbl_item[1].code = 0x0;
|
||||
delta_time_code_tbl_item[1].value = 1;
|
||||
for (n = 0; n < 4; n++) {
|
||||
delta_time_code_tbl_item[n + 2].size = 4;
|
||||
delta_time_code_tbl_item[n + 2].code = 0x4 + n;
|
||||
delta_time_code_tbl_item[n + 2].value = n + 2;
|
||||
}
|
||||
for (n = 0; n < 8; n++) {
|
||||
delta_time_code_tbl_item[n + 6].size = 5;
|
||||
delta_time_code_tbl_item[n + 6].code = 0x10 + n;
|
||||
delta_time_code_tbl_item[n + 6].value = n + 6;
|
||||
}
|
||||
|
||||
k = 2 * num_gain_max_values - 14 + 1;
|
||||
for (n = 0; n < k; n++) {
|
||||
delta_time_code_tbl_item[n + 14].size = 2 + Z;
|
||||
delta_time_code_tbl_item[n + 14].code = (0x3 << Z) + n;
|
||||
delta_time_code_tbl_item[n + 14].value = n + 14;
|
||||
}
|
||||
}
|
||||
|
||||
WORD32
|
||||
impd_get_delta_tmin(const WORD32 sampling_rate) {
|
||||
WORD32 lowerBound = (WORD32)(0.5f + 0.0005f * sampling_rate);
|
||||
WORD32 result = 1;
|
||||
if (sampling_rate < 1000) {
|
||||
return (UNEXPECTED_ERROR);
|
||||
}
|
||||
while (result <= lowerBound) result = result << 1;
|
||||
return result;
|
||||
}
|
||||
|
|
@ -1,162 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
#ifndef IMPD_DRC_UNI_COMMON_H
|
||||
#define IMPD_DRC_UNI_COMMON_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#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 MEASURE_AVERAGE_BITRATE 0
|
||||
#define DEBUG_NODES 0
|
||||
|
||||
#define DRC_GAIN_DEBUG_FILE 0
|
||||
#define DEBUG_BITSTREAM 0
|
||||
#define DEBUG_DRC_SELECTION 0
|
||||
#define DEBUG_WARNINGS 0
|
||||
#define ENABLE_ADDITIONAL_TESTS 1
|
||||
|
||||
#define SPEAKER_POS_COUNT_MAX 128
|
||||
#define DOWNMIX_COEFF_COUNT_MAX 32 * 32
|
||||
#define MAX_CHANNEL_COUNT 128
|
||||
#define BAND_COUNT_MAX 8
|
||||
#define SEQUENCE_COUNT_MAX 24
|
||||
#define GAIN_SET_COUNT_MAX SEQUENCE_COUNT_MAX
|
||||
#define MEASUREMENT_COUNT_MAX 16
|
||||
#define DOWNMIX_INSTRUCTION_COUNT_MAX 16
|
||||
#define DRC_COEFF_COUNT_MAX 8
|
||||
#define DRC_INSTRUCTIONS_COUNT_MAX (DOWNMIX_INSTRUCTION_COUNT_MAX + 20)
|
||||
#define LOUDNESS_INFO_COUNT_MAX (DOWNMIX_INSTRUCTION_COUNT_MAX + 20)
|
||||
#define AUDIO_CODEC_FRAME_SIZE_MAX 4096
|
||||
#define DRC_CODEC_FRAME_SIZE_MAX (AUDIO_CODEC_FRAME_SIZE_MAX / 8)
|
||||
#define NODE_COUNT_MAX DRC_CODEC_FRAME_SIZE_MAX
|
||||
#define CHANNEL_GROUP_COUNT_MAX SEQUENCE_COUNT_MAX
|
||||
#define SUB_DRC_COUNT 4
|
||||
#define SEL_DRC_COUNT 3
|
||||
#define DOWNMIX_ID_COUNT_MAX 8
|
||||
#define MAX_SIGNAL_DELAY 4500
|
||||
|
||||
#define DELAY_MODE_REGULAR_DELAY 0
|
||||
#define DELAY_MODE_LOW_DELAY 1
|
||||
#define DELAY_MODE_DEFAULT DELAY_MODE_REGULAR_DELAY
|
||||
|
||||
#define FEATURE_REQUEST_COUNT_MAX 10
|
||||
#define EFFECT_TYPE_REQUEST_COUNT_MAX 10
|
||||
|
||||
#define SELECTION_CANDIDATE_COUNT_MAX 32
|
||||
|
||||
#define PROC_COMPLETE 1
|
||||
#define UNEXPECTED_ERROR 2
|
||||
#define PARAM_ERROR 3
|
||||
#define EXTERNAL_ERROR 4
|
||||
#define ERRORHANDLING 5
|
||||
#define BITSTREAM_ERROR 6
|
||||
|
||||
#define UNDEFINED_LOUDNESS_VALUE 1000.0f
|
||||
#define ID_FOR_BASE_LAYOUT 0x0
|
||||
#define ID_FOR_ANY_DOWNMIX 0x7F
|
||||
#define ID_FOR_NO_DRC 0x0
|
||||
#define ID_FOR_ANY_DRC 0x3F
|
||||
#define ID_FOR_ANY_EQ 0x3F
|
||||
|
||||
#define LOCATION_MP4_INSTREAM_UNIDRC 0x1
|
||||
#define LOCATION_MP4_DYN_RANGE_INFO 0x2
|
||||
#define LOCATION_MP4_COMPRESSION_VALUE 0x3
|
||||
#define LOCATION_SELECTED LOCATION_MP4_INSTREAM_UNIDRC
|
||||
|
||||
#define AUDIO_CODEC_SUBBAND_COUNT_MAX 256
|
||||
|
||||
#define SUBBAND_DOMAIN_MODE_OFF 0
|
||||
#define SUBBAND_DOMAIN_MODE_QMF64 1
|
||||
#define SUBBAND_DOMAIN_MODE_QMF71 2
|
||||
#define SUBBAND_DOMAIN_MODE_STFT256 3
|
||||
|
||||
#define 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
|
||||
#define MAX_SIGNATURE_DATA_LENGTH_PLUS_ONE 256
|
||||
|
||||
#define EXT_COUNT_MAX 2
|
||||
#define UNIDRCGAINEXT_TERM 0x0
|
||||
#define UNIDRCLOUDEXT_TERM 0x0
|
||||
#define UNIDRCCONFEXT_TERM 0x0
|
||||
#define UNIDRCINTERFACEEXT_TERM 0x0
|
||||
|
||||
#define MAXPACKETLOSSTIME 2.5f
|
||||
|
||||
#define SLOPE_FACTOR_DB_TO_LINEAR 0.1151f
|
||||
|
||||
#ifndef min
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef max
|
||||
#define max(a, b) ((a) > (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#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;
|
||||
WORD32 target_layout;
|
||||
WORD32 downmix_matrix_present;
|
||||
FLOAT32 downmix_matrix[MAX_CHANNEL_COUNT][MAX_CHANNEL_COUNT];
|
||||
|
||||
FLOAT32 boost;
|
||||
FLOAT32 compress;
|
||||
WORD32 drc_characteristic_target;
|
||||
|
||||
} ia_drc_sel_proc_output_struct;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -20,15 +20,15 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops16.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops16.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_basic_ops.h"
|
||||
|
||||
#include <ixheaacd_basic_op.h>
|
||||
#include "ixheaacd_basic_op.h"
|
||||
#include "ixheaacd_intrinsics.h"
|
||||
#include "ixheaacd_common_rom.h"
|
||||
#include "ixheaacd_sbrdecsettings.h"
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
#include "ixheaacd_pns.h"
|
||||
|
||||
#include <ixheaacd_aac_rom.h>
|
||||
#include "ixheaacd_aac_rom.h"
|
||||
#include "ixheaacd_aac_imdct.h"
|
||||
#include "ixheaacd_pulsedata.h"
|
||||
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
#include "ixheaacd_sbr_scale.h"
|
||||
#include "ixheaacd_lpp_tran.h"
|
||||
#include "ixheaacd_env_extr_part.h"
|
||||
#include <ixheaacd_sbr_rom.h>
|
||||
#include "ixheaacd_sbr_rom.h"
|
||||
#include "ixheaacd_block.h"
|
||||
#include "ixheaacd_hybrid.h"
|
||||
#include "ixheaacd_ps_dec.h"
|
||||
|
|
@ -199,11 +199,11 @@ VOID(*ixheaacd_mps_complex_fft_64)
|
|||
WORD32 nlength) = &ixheaacd_mps_complex_fft_64_dec;
|
||||
|
||||
VOID(*ixheaacd_mps_synt_pre_twiddle)
|
||||
(WORD32 *ptr_in, WORD32 *table_re, WORD32 *table_im,
|
||||
(WORD32 *ptr_in, const WORD32 *table_re, const WORD32 *table_im,
|
||||
WORD32 resolution) = &ixheaacd_mps_synt_pre_twiddle_dec;
|
||||
|
||||
VOID(*ixheaacd_mps_synt_post_twiddle)
|
||||
(WORD32 *ptr_in, WORD32 *table_re, WORD32 *table_im,
|
||||
(WORD32 *ptr_in, const WORD32 *table_re, const WORD32 *table_im,
|
||||
WORD32 resolution) = &ixheaacd_mps_synt_post_twiddle_dec;
|
||||
|
||||
VOID(*ixheaacd_calc_pre_twid)
|
||||
|
|
@ -215,8 +215,9 @@ VOID(*ixheaacd_calc_post_twid)
|
|||
const WORD32 *cos_ptr, const WORD32 *sin_ptr) = &ixheaacd_calc_post_twid_dec;
|
||||
|
||||
VOID(*ixheaacd_mps_synt_post_fft_twiddle)
|
||||
(WORD32 resolution, WORD32 *fin_re, WORD32 *fin_im, WORD32 *table_re,
|
||||
WORD32 *table_im, WORD32 *state) = &ixheaacd_mps_synt_post_fft_twiddle_dec;
|
||||
(WORD32 resolution, WORD32 *fin_re, WORD32 *fin_im, const WORD32 *table_re,
|
||||
const WORD32 *table_im,
|
||||
WORD32 *state) = &ixheaacd_mps_synt_post_fft_twiddle_dec;
|
||||
|
||||
VOID(*ixheaacd_mps_synt_out_calc)
|
||||
(WORD32 resolution, WORD32 *out, WORD32 *state,
|
||||
|
|
@ -249,4 +250,3 @@ VOID(*ixheaacd_scale_factor_process)
|
|||
WORD32 aac_sf_data_resil_flag) = &ixheaacd_scale_factor_process_dec;
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_constants.h"
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
#include "ixheaacd_env_extr.h"
|
||||
#include "ixheaacd_qmf_dec.h"
|
||||
|
||||
#include <ixheaacd_basic_op.h>
|
||||
#include "ixheaacd_basic_op.h"
|
||||
#include "ixheaacd_env_calc.h"
|
||||
|
||||
#include "ixheaacd_interface.h"
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@
|
|||
#include "ixheaacd_cnst.h"
|
||||
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
|
||||
#include "ixheaacd_windows.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -60,5 +60,6 @@
|
|||
#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
|
||||
#define IA_ENHAACPLUS_DEC_CONFIG_GET_NUM_PRE_ROLL_FRAMES 0x0026
|
||||
|
||||
#endif /* IXHEAACD_AAC_CONFIG_H */
|
||||
|
|
|
|||
|
|
@ -18,22 +18,22 @@
|
|||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops16.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops16.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_basic_ops.h"
|
||||
|
||||
#include "ixheaacd_defines.h"
|
||||
#include "ixheaacd_common_rom.h"
|
||||
#include "ixheaacd_basic_funcs.h"
|
||||
#include <ixheaacd_aac_rom.h>
|
||||
#include "ixheaacd_aac_rom.h"
|
||||
#include "ixheaacd_aac_imdct.h"
|
||||
#include "ixheaacd_intrinsics.h"
|
||||
|
||||
#include <ixheaacd_basic_op.h>
|
||||
#include "ixheaacd_basic_op.h"
|
||||
#include "ixheaacd_function_selector.h"
|
||||
|
||||
#include "ixheaacd_audioobjtypes.h"
|
||||
|
|
@ -2008,14 +2008,14 @@ VOID ixheaacd_fft32x32_ld_dec(ia_aac_dec_imdct_tables_struct *imdct_tables_ptr,
|
|||
x_h2_0 = x[h2];
|
||||
x_h2_1 = x[h2 + 1];
|
||||
|
||||
xh0_0 = x_0 + x_l1_0;
|
||||
xh1_0 = x_1 + x_l1_1;
|
||||
xl0_0 = x_0 - x_l1_0;
|
||||
xl1_0 = x_1 - x_l1_1;
|
||||
xh20_0 = x_h2_0 + x_l2_0;
|
||||
xh21_0 = x_h2_1 + x_l2_1;
|
||||
xl20_0 = x_h2_0 - x_l2_0;
|
||||
xl21_0 = x_h2_1 - x_l2_1;
|
||||
xh0_0 = ixheaacd_add32_sat(x_0, x_l1_0);
|
||||
xh1_0 = ixheaacd_add32_sat(x_1, x_l1_1);
|
||||
xl0_0 = ixheaacd_sub32_sat(x_0, x_l1_0);
|
||||
xl1_0 = ixheaacd_sub32_sat(x_1, x_l1_1);
|
||||
xh20_0 = ixheaacd_add32_sat(x_h2_0, x_l2_0);
|
||||
xh21_0 = ixheaacd_add32_sat(x_h2_1, x_l2_1);
|
||||
xl20_0 = ixheaacd_sub32_sat(x_h2_0, x_l2_0);
|
||||
xl21_0 = ixheaacd_sub32_sat(x_h2_1, x_l2_1);
|
||||
|
||||
x0 = x;
|
||||
x2 = x0;
|
||||
|
|
@ -2026,14 +2026,14 @@ VOID ixheaacd_fft32x32_ld_dec(ia_aac_dec_imdct_tables_struct *imdct_tables_ptr,
|
|||
if (!predj) x += fft_jmp;
|
||||
if (!predj) j = 0;
|
||||
|
||||
x0[0] = xh0_0 + xh20_0;
|
||||
x0[1] = xh1_0 + xh21_0;
|
||||
xt0_0 = xh0_0 - xh20_0;
|
||||
yt0_0 = xh1_0 - xh21_0;
|
||||
xt1_0 = xl0_0 + xl21_0;
|
||||
yt2_0 = xl1_0 + xl20_0;
|
||||
xt2_0 = xl0_0 - xl21_0;
|
||||
yt1_0 = xl1_0 - xl20_0;
|
||||
x0[0] = ixheaacd_add32_sat(xh0_0, xh20_0);
|
||||
x0[1] = ixheaacd_add32_sat(xh1_0, xh21_0);
|
||||
xt0_0 = ixheaacd_sub32_sat(xh0_0, xh20_0);
|
||||
yt0_0 = ixheaacd_sub32_sat(xh1_0, xh21_0);
|
||||
xt1_0 = ixheaacd_add32_sat(xl0_0, xl21_0);
|
||||
yt2_0 = ixheaacd_add32_sat(xl1_0, xl20_0);
|
||||
xt2_0 = ixheaacd_sub32_sat(xl0_0, xl21_0);
|
||||
yt1_0 = ixheaacd_sub32_sat(xl1_0, xl20_0);
|
||||
|
||||
x2[h2] =
|
||||
MPYHIRC(si10, yt1_0) + MPYHIRC(co10, xt1_0) +
|
||||
|
|
@ -2095,33 +2095,33 @@ VOID ixheaacd_fft32x32_ld_dec(ia_aac_dec_imdct_tables_struct *imdct_tables_ptr,
|
|||
x_7 = x0[7];
|
||||
x0 += 8;
|
||||
|
||||
xh0_0 = x_0 + x_4;
|
||||
xh1_0 = x_1 + x_5;
|
||||
xl0_0 = x_0 - x_4;
|
||||
xl1_0 = x_1 - x_5;
|
||||
xh0_1 = x_2 + x_6;
|
||||
xh1_1 = x_3 + x_7;
|
||||
xl0_1 = x_2 - x_6;
|
||||
xl1_1 = x_3 - x_7;
|
||||
xh0_0 = ixheaacd_add32_sat(x_0, x_4);
|
||||
xh1_0 = ixheaacd_add32_sat(x_1, x_5);
|
||||
xl0_0 = ixheaacd_sub32_sat(x_0, x_4);
|
||||
xl1_0 = ixheaacd_sub32_sat(x_1, x_5);
|
||||
xh0_1 = ixheaacd_add32_sat(x_2, x_6);
|
||||
xh1_1 = ixheaacd_add32_sat(x_3, x_7);
|
||||
xl0_1 = ixheaacd_sub32_sat(x_2, x_6);
|
||||
xl1_1 = ixheaacd_sub32_sat(x_3, x_7);
|
||||
|
||||
n00 = xh0_0 + xh0_1;
|
||||
n01 = xh1_0 + xh1_1;
|
||||
n10 = xl0_0 + xl1_1;
|
||||
n11 = xl1_0 - xl0_1;
|
||||
n20 = xh0_0 - xh0_1;
|
||||
n21 = xh1_0 - xh1_1;
|
||||
n30 = xl0_0 - xl1_1;
|
||||
n31 = xl1_0 + xl0_1;
|
||||
n00 = ixheaacd_add32_sat(xh0_0, xh0_1);
|
||||
n01 = ixheaacd_add32_sat(xh1_0, xh1_1);
|
||||
n10 = ixheaacd_add32_sat(xl0_0, xl1_1);
|
||||
n11 = ixheaacd_sub32_sat(xl1_0, xl0_1);
|
||||
n20 = ixheaacd_sub32_sat(xh0_0, xh0_1);
|
||||
n21 = ixheaacd_sub32_sat(xh1_0, xh1_1);
|
||||
n30 = ixheaacd_sub32_sat(xl0_0, xl1_1);
|
||||
n31 = ixheaacd_add32_sat(xl1_0, xl0_1);
|
||||
|
||||
if (radix == 2) {
|
||||
n00 = x_0 + x_2;
|
||||
n01 = x_1 + x_3;
|
||||
n20 = x_0 - x_2;
|
||||
n21 = x_1 - x_3;
|
||||
n10 = x_4 + x_6;
|
||||
n11 = x_5 + x_7;
|
||||
n30 = x_4 - x_6;
|
||||
n31 = x_5 - x_7;
|
||||
n00 = ixheaacd_add32_sat(x_0, x_2);
|
||||
n01 = ixheaacd_add32_sat(x_1, x_3);
|
||||
n20 = ixheaacd_sub32_sat(x_0, x_2);
|
||||
n21 = ixheaacd_sub32_sat(x_1, x_3);
|
||||
n10 = ixheaacd_add32_sat(x_4, x_6);
|
||||
n11 = ixheaacd_add32_sat(x_5, x_7);
|
||||
n30 = ixheaacd_sub32_sat(x_4, x_6);
|
||||
n31 = ixheaacd_sub32_sat(x_5, x_7);
|
||||
}
|
||||
|
||||
y0[2 * h2] = n00;
|
||||
|
|
@ -2143,33 +2143,33 @@ VOID ixheaacd_fft32x32_ld_dec(ia_aac_dec_imdct_tables_struct *imdct_tables_ptr,
|
|||
x_f = x2[7];
|
||||
x2 += 8;
|
||||
|
||||
xh0_2 = x_8 + x_c;
|
||||
xh1_2 = x_9 + x_d;
|
||||
xl0_2 = x_8 - x_c;
|
||||
xl1_2 = x_9 - x_d;
|
||||
xh0_3 = x_a + x_e;
|
||||
xh1_3 = x_b + x_f;
|
||||
xl0_3 = x_a - x_e;
|
||||
xl1_3 = x_b - x_f;
|
||||
xh0_2 = ixheaacd_add32_sat(x_8, x_c);
|
||||
xh1_2 = ixheaacd_add32_sat(x_9, x_d);
|
||||
xl0_2 = ixheaacd_sub32_sat(x_8, x_c);
|
||||
xl1_2 = ixheaacd_sub32_sat(x_9, x_d);
|
||||
xh0_3 = ixheaacd_add32_sat(x_a, x_e);
|
||||
xh1_3 = ixheaacd_add32_sat(x_b, x_f);
|
||||
xl0_3 = ixheaacd_sub32_sat(x_a, x_e);
|
||||
xl1_3 = ixheaacd_sub32_sat(x_b, x_f);
|
||||
|
||||
n02 = xh0_2 + xh0_3;
|
||||
n03 = xh1_2 + xh1_3;
|
||||
n12 = xl0_2 + xl1_3;
|
||||
n13 = xl1_2 - xl0_3;
|
||||
n22 = xh0_2 - xh0_3;
|
||||
n23 = xh1_2 - xh1_3;
|
||||
n32 = xl0_2 - xl1_3;
|
||||
n33 = xl1_2 + xl0_3;
|
||||
n02 = ixheaacd_add32_sat(xh0_2, xh0_3);
|
||||
n03 = ixheaacd_add32_sat(xh1_2, xh1_3);
|
||||
n12 = ixheaacd_add32_sat(xl0_2, xl1_3);
|
||||
n13 = ixheaacd_sub32_sat(xl1_2, xl0_3);
|
||||
n22 = ixheaacd_sub32_sat(xh0_2, xh0_3);
|
||||
n23 = ixheaacd_sub32_sat(xh1_2, xh1_3);
|
||||
n32 = ixheaacd_sub32_sat(xl0_2, xl1_3);
|
||||
n33 = ixheaacd_add32_sat(xl1_2, xl0_3);
|
||||
|
||||
if (radix == 2) {
|
||||
n02 = x_8 + x_a;
|
||||
n03 = x_9 + x_b;
|
||||
n22 = x_8 - x_a;
|
||||
n23 = x_9 - x_b;
|
||||
n12 = x_c + x_e;
|
||||
n13 = x_d + x_f;
|
||||
n32 = x_c - x_e;
|
||||
n33 = x_d - x_f;
|
||||
n02 = ixheaacd_add32_sat(x_8, x_a);
|
||||
n03 = ixheaacd_add32_sat(x_9, x_b);
|
||||
n22 = ixheaacd_sub32_sat(x_8, x_a);
|
||||
n23 = ixheaacd_sub32_sat(x_9, x_b);
|
||||
n12 = ixheaacd_add32_sat(x_c, x_e);
|
||||
n13 = ixheaacd_add32_sat(x_d, x_f);
|
||||
n32 = ixheaacd_sub32_sat(x_c, x_e);
|
||||
n33 = ixheaacd_sub32_sat(x_d, x_f);
|
||||
}
|
||||
|
||||
y0[2 * h2 + 2] = n02;
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@
|
|||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
#include "ixheaacd_defines.h"
|
||||
#include <ixheaacd_aac_rom.h>
|
||||
#include "ixheaacd_aac_rom.h"
|
||||
#include "ixheaacd_intrinsics.h"
|
||||
|
||||
// -1 is appended at the end of each table to identify
|
||||
|
|
|
|||
|
|
@ -18,19 +18,19 @@
|
|||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops16.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops16.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_basic_ops.h"
|
||||
|
||||
#include "ixheaacd_defines.h"
|
||||
#include "ixheaacd_bitbuffer.h"
|
||||
|
||||
#include "ixheaacd_error_codes.h"
|
||||
#include <ixheaacd_aac_rom.h>
|
||||
#include "ixheaacd_aac_rom.h"
|
||||
#include "ixheaacd_pulsedata.h"
|
||||
|
||||
#include "ixheaacd_pns.h"
|
||||
|
|
@ -63,15 +63,6 @@ static PLATFORM_INLINE WORD32 ixheaacd_mac32_tns_sat(WORD32 a, WORD32 b,
|
|||
return (result);
|
||||
}
|
||||
|
||||
static PLATFORM_INLINE WORD64 mac32x32in64_dual(WORD32 a, WORD32 b, WORD64 c) {
|
||||
WORD64 result;
|
||||
WORD64 temp_result;
|
||||
|
||||
temp_result = (WORD64)a * (WORD64)b;
|
||||
result = c + (temp_result);
|
||||
return (result);
|
||||
}
|
||||
|
||||
VOID ixheaacd_tns_decode_coefficients(
|
||||
const ia_filter_info_struct *filter, WORD32 *a,
|
||||
ia_aac_dec_tables_struct *ptr_aac_tables) {
|
||||
|
|
@ -294,7 +285,7 @@ VOID ixheaacd_tns_ar_filter_fixed_non_neon_armv7(WORD32 *spectrum, WORD32 size,
|
|||
WORD32 acc1;
|
||||
y = ixheaacd_shl32_sat((*spectrum), scale_spec);
|
||||
for (j = order; j > 0; j--) {
|
||||
acc = mac32x32in64_dual(state[j - 1], lpc[j], acc);
|
||||
acc = ixheaacd_mac32x32in64_dual(state[j - 1], lpc[j], acc);
|
||||
state[j] = state[j - 1];
|
||||
}
|
||||
acc1 = (WORD32)(acc >> 32);
|
||||
|
|
@ -349,7 +340,7 @@ VOID ixheaacd_tns_ar_filter_fixed_armv8(WORD32 *spectrum, WORD32 size,
|
|||
}
|
||||
acc1 = (WORD32)(acc >> 32);
|
||||
|
||||
y = ixheaacd_sub32(y, ixheaacd_shl32_sat(acc1, 1));
|
||||
y = ixheaacd_sub32_sat(y, ixheaacd_shl32_sat(acc1, 1));
|
||||
state[0] = ixheaacd_shl32_sat(y, shift_value);
|
||||
|
||||
*spectrum = y >> scale_spec;
|
||||
|
|
@ -387,11 +378,15 @@ VOID ixheaacd_tns_ar_filter_dec(WORD32 *spectrum, WORD32 size, WORD32 inc,
|
|||
WORD32 acc;
|
||||
|
||||
if ((order & 3) != 0) {
|
||||
for (i = order + 1; i < ((WORD32)(order & 0xfffffffc) + 4); i++) {
|
||||
for (i = order + 1; i < ((WORD32)(order & (~3)) + 4); i++) {
|
||||
lpc[i] = 0;
|
||||
}
|
||||
lpc[i] = 0;
|
||||
order = ((order & 0xfffffffc) + 4);
|
||||
if (i < (MAX_ORDER + 1)) {
|
||||
lpc[i] = 0;
|
||||
order = ((order & (~3)) + 4);
|
||||
} else {
|
||||
order = MAX_ORDER;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < order; i++) {
|
||||
|
|
|
|||
|
|
@ -20,21 +20,21 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops16.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops16.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_basic_ops.h"
|
||||
#include "ixheaacd_bitbuffer.h"
|
||||
|
||||
#include <ixheaacd_basic_op.h>
|
||||
#include "ixheaacd_basic_op.h"
|
||||
#include "ixheaacd_intrinsics.h"
|
||||
|
||||
#include "ixheaacd_defines.h"
|
||||
|
||||
#include <ixheaacd_aac_rom.h>
|
||||
#include "ixheaacd_aac_rom.h"
|
||||
|
||||
#include "ixheaacd_definitions.h"
|
||||
|
||||
|
|
@ -56,13 +56,10 @@
|
|||
|
||||
#include "ixheaacd_sbr_payload.h"
|
||||
#include "ixheaacd_common_rom.h"
|
||||
|
||||
#include <ixheaacd_type_def.h>
|
||||
|
||||
#include "ixheaacd_sbrdecsettings.h"
|
||||
#include "ixheaacd_sbr_scale.h"
|
||||
#include "ixheaacd_env_extr_part.h"
|
||||
#include <ixheaacd_sbr_rom.h>
|
||||
#include "ixheaacd_sbr_rom.h"
|
||||
#include "ixheaacd_stereo.h"
|
||||
#include "ixheaacd_lpp_tran.h"
|
||||
#include "ixheaacd_hybrid.h"
|
||||
|
|
|
|||
|
|
@ -20,22 +20,22 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops16.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops16.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_basic_ops.h"
|
||||
|
||||
#include <ixheaacd_basic_op.h>
|
||||
#include "ixheaacd_basic_op.h"
|
||||
#include "ixheaacd_intrinsics.h"
|
||||
#include "ixheaacd_bitbuffer.h"
|
||||
#include "ixheaacd_defines.h"
|
||||
|
||||
#include "ixheaacd_pns.h"
|
||||
|
||||
#include <ixheaacd_aac_rom.h>
|
||||
#include "ixheaacd_aac_rom.h"
|
||||
#include "ixheaacd_pulsedata.h"
|
||||
#include "ixheaacd_drc_data_struct.h"
|
||||
|
||||
|
|
@ -158,7 +158,6 @@ FLAG ixheaacd_check_for_sbr_payload(
|
|||
}
|
||||
it_bit_buff->ptr_read_next += count - 1;
|
||||
it_bit_buff->cnt_bits -= ((count - 1) << 3);
|
||||
|
||||
}
|
||||
}
|
||||
if (it_bit_buff->cnt_bits < 0) ret = -1;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_acelp_com.h"
|
||||
#include "ixheaacd_windows.h"
|
||||
|
|
@ -48,9 +48,8 @@
|
|||
#include "ixheaacd_main.h"
|
||||
#include "ixheaacd_func_def.h"
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
|
||||
WORD32 ixheaacd_get_mode_lpc(WORD32 lpc_set, ia_bit_buf_struct *it_bit_buff,
|
||||
WORD32 *nk_mode) {
|
||||
|
|
@ -264,7 +263,7 @@ VOID ixheaacd_fac_decoding(WORD32 fac_length, WORD32 k, WORD32 *fac_prm,
|
|||
}
|
||||
}
|
||||
|
||||
UWORD8 ixheaacd_num_bites_celp_coding[8][4] = {
|
||||
const UWORD8 ixheaacd_num_bites_celp_coding[8][4] = {
|
||||
{5, 5, 5, 5}, {9, 9, 5, 5}, {9, 9, 9, 9}, {13, 13, 9, 9},
|
||||
{13, 13, 13, 13}, {16, 16, 16, 16}, {1, 5, 1, 5}, {1, 5, 5, 5}};
|
||||
|
||||
|
|
@ -273,7 +272,7 @@ VOID ixheaacd_acelp_decoding(WORD32 k, ia_usac_data_struct *usac_data,
|
|||
ia_bit_buf_struct *it_bit_buff, WORD32 chan) {
|
||||
WORD32 sfr, kk;
|
||||
WORD32 nb_subfr = usac_data->num_subfrm;
|
||||
UWORD8 *ptr_num_bits =
|
||||
const UWORD8 *ptr_num_bits =
|
||||
&ixheaacd_num_bites_celp_coding[pstr_td_frame_data->acelp_core_mode][0];
|
||||
|
||||
chan = 0;
|
||||
|
|
@ -557,4 +556,4 @@ VOID ixheaacd_td_frm_dec(ia_usac_data_struct *usac_data, WORD32 k,
|
|||
p_ioverlap[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ VOID ixheaacd_lpc_coeff_wt_apply(FLOAT32 *a, FLOAT32 *ap);
|
|||
|
||||
VOID ixheaacd_acelp_pitch_sharpening(FLOAT32 *x, WORD32 pit_lag);
|
||||
|
||||
VOID ixheaacd_acelp_decode_pulses_per_track(WORD32 index[], WORD16 nbbits,
|
||||
VOID ixheaacd_acelp_decode_pulses_per_track(WORD32 index[], const WORD16 nbbits,
|
||||
FLOAT32 code[]);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_bitbuffer.h"
|
||||
|
||||
|
|
@ -218,7 +218,8 @@ static VOID ixheaacd_d_acelp_decode_1p_n1(WORD32 index, WORD32 N,
|
|||
return;
|
||||
}
|
||||
|
||||
VOID ixheaacd_acelp_decode_pulses_per_track(WORD32 cb_index[], WORD16 code_bits,
|
||||
VOID ixheaacd_acelp_decode_pulses_per_track(WORD32 cb_index[],
|
||||
const WORD16 code_bits,
|
||||
FLOAT32 code_vec[]) {
|
||||
WORD32 track_idx, index, ixheaacd_drc_offset, pos[6], i;
|
||||
memset(code_vec, 0, 64 * sizeof(FLOAT32));
|
||||
|
|
@ -349,8 +350,8 @@ WORD32 ixheaacd_acelp_alias_cnx(ia_usac_data_struct *usac_data,
|
|||
FLOAT32 tmp, pitch_gain, gain_code, voicing_factor, r_v, innov_energy,
|
||||
pitch_energy, mean_ener_code;
|
||||
FLOAT32 gain_smooth, gain_code0, cpe;
|
||||
FLOAT32 code[LEN_SUBFR], synth_temp[128 + 16];
|
||||
FLOAT32 post_process_exc[LEN_SUBFR];
|
||||
FLOAT32 code[LEN_SUBFR] = {0}, synth_temp[128 + 16] = {0};
|
||||
FLOAT32 post_process_exc[LEN_SUBFR] = {0};
|
||||
FLOAT32 gain_smooth_factor;
|
||||
FLOAT32 *ptr_lp_filt_coeff;
|
||||
WORD32 pitch_min;
|
||||
|
|
@ -358,9 +359,9 @@ WORD32 ixheaacd_acelp_alias_cnx(ia_usac_data_struct *usac_data,
|
|||
WORD32 pitch_fr1;
|
||||
WORD32 pitch_max;
|
||||
WORD32 subfr_nb = 0;
|
||||
WORD16 num_codebits_table[8] = {20, 28, 36, 44, 52, 64, 12, 16};
|
||||
FLOAT32 x[FAC_LENGTH], xn2[2 * FAC_LENGTH + 16];
|
||||
WORD32 int_x[FAC_LENGTH];
|
||||
static const WORD16 num_codebits_table[8] = {20, 28, 36, 44, 52, 64, 12, 16};
|
||||
FLOAT32 x[FAC_LENGTH] = {0}, xn2[2 * FAC_LENGTH + 16] = {0};
|
||||
WORD32 int_x[FAC_LENGTH] = {0};
|
||||
WORD32 TTT;
|
||||
WORD32 len_subfr = usac_data->len_subfrm;
|
||||
WORD32 fac_length;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_bitbuffer.h"
|
||||
#include "ixheaacd_interface.h"
|
||||
|
|
@ -46,9 +46,8 @@
|
|||
|
||||
#include "ixheaacd_func_def.h"
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
|
||||
extern const WORD32 ixheaacd_pre_post_twid_cos_sin_512[4][512];
|
||||
extern const WORD32 ixheaacd_pre_post_twid_cos_sin_384[4][384];
|
||||
|
|
|
|||
|
|
@ -19,14 +19,14 @@
|
|||
*/
|
||||
#include <math.h>
|
||||
#include <memory.h>
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_cnst.h"
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
|
||||
static FLOAT32 ixheaacd_gamma_table[17] = {
|
||||
static const FLOAT32 ixheaacd_gamma_table[17] = {
|
||||
1.0f, 0.92f, 0.8464f, 0.778688f, 0.716393f, 0.659082f,
|
||||
0.606355f, 0.557847f, 0.513219f, 0.472161f, 0.434389f, 0.399637f,
|
||||
0.367666f, 0.338253f, 0.311193f, 0.286298f, 0.263394f};
|
||||
|
|
|
|||
|
|
@ -17,16 +17,15 @@
|
|||
*****************************************************************************
|
||||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_bitbuffer.h"
|
||||
#include "ixheaacd_defines.h"
|
||||
#include <ixheaacd_aac_rom.h>
|
||||
#include "ixheaacd_aac_rom.h"
|
||||
|
||||
#include "ixheaacd_sbrdecsettings.h"
|
||||
#include "ixheaacd_env_extr_part.h"
|
||||
#include <ixheaacd_sbr_rom.h>
|
||||
#include "ixheaacd_sbr_rom.h"
|
||||
|
||||
#include "ixheaacd_common_rom.h"
|
||||
#include "ixheaacd_pulsedata.h"
|
||||
|
|
|
|||
|
|
@ -20,13 +20,13 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops16.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops16.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_basic_ops.h"
|
||||
|
||||
#include "ixheaacd_error_standards.h"
|
||||
|
|
@ -45,12 +45,12 @@
|
|||
#include "ixheaacd_bitbuffer.h"
|
||||
#include "ixheaacd_adts.h"
|
||||
#include "ixheaacd_defines.h"
|
||||
#include <ixheaacd_aac_rom.h>
|
||||
#include "ixheaacd_aac_rom.h"
|
||||
|
||||
#include "ixheaacd_sbr_scale.h"
|
||||
#include "ixheaacd_lpp_tran.h"
|
||||
#include "ixheaacd_env_extr_part.h"
|
||||
#include <ixheaacd_sbr_rom.h>
|
||||
#include "ixheaacd_sbr_rom.h"
|
||||
|
||||
#include "ixheaacd_hybrid.h"
|
||||
#include "ixheaacd_ps_dec.h"
|
||||
|
|
@ -440,8 +440,14 @@ IA_ERRORCODE ixheaacd_dec_api(pVOID p_ia_enhaacplus_dec_obj, WORD32 i_cmd,
|
|||
}
|
||||
case IA_CMD_TYPE_INIT_PROCESS: {
|
||||
WORD32 err_code = 0;
|
||||
err_code = ixheaacd_dec_init(p_obj_exhaacplus_dec);
|
||||
if (p_obj_exhaacplus_dec->p_state_aac->fatal_err_present) {
|
||||
err_code = IA_FATAL_ERROR;
|
||||
} else {
|
||||
err_code = ixheaacd_dec_init(p_obj_exhaacplus_dec);
|
||||
}
|
||||
if (err_code != 0) {
|
||||
if (err_code < 0)
|
||||
p_obj_exhaacplus_dec->p_state_aac->fatal_err_present = 1;
|
||||
p_obj_exhaacplus_dec->p_state_aac->i_bytes_consumed =
|
||||
p_obj_exhaacplus_dec->p_state_aac->ui_in_bytes;
|
||||
}
|
||||
|
|
@ -701,6 +707,20 @@ IA_ERRORCODE ixheaacd_dec_api(pVOID p_ia_enhaacplus_dec_obj, WORD32 i_cmd,
|
|||
|
||||
if (i_idx >= 0 && i_idx <= 8) {
|
||||
*pui_value = pvalue[i_idx];
|
||||
} else if (IA_ENHAACPLUS_DEC_CONFIG_GET_NUM_PRE_ROLL_FRAMES == i_idx) {
|
||||
WORD32 *ptri_value = (WORD32 *)pv_value;
|
||||
ia_audio_specific_config_struct *ptr_audio_specific_config =
|
||||
((ia_audio_specific_config_struct *)
|
||||
p_obj_exhaacplus_dec->p_state_aac->ia_audio_specific_config);
|
||||
|
||||
for (i = 0; i < MAX_AUDIO_PREROLLS + 1; i++) {
|
||||
if (ptr_audio_specific_config->str_usac_config.str_usac_dec_config
|
||||
.preroll_bytes[i] == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*ptri_value = i;
|
||||
} 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 *)
|
||||
|
|
@ -762,15 +782,29 @@ IA_ERRORCODE ixheaacd_dec_api(pVOID p_ia_enhaacplus_dec_obj, WORD32 i_cmd,
|
|||
ia_audio_specific_config_struct *ptr_audio_specific_config =
|
||||
((ia_audio_specific_config_struct *)
|
||||
p_obj_exhaacplus_dec->p_state_aac->ia_audio_specific_config);
|
||||
*ptri_value = ptr_audio_specific_config->str_usac_config
|
||||
.str_usac_dec_config.usac_ext_gain_payload_len;
|
||||
WORD32 preroll_counter = ptr_audio_specific_config->str_usac_config
|
||||
.str_usac_dec_config.preroll_counter;
|
||||
*ptri_value =
|
||||
ptr_audio_specific_config->str_usac_config.str_usac_dec_config
|
||||
.usac_ext_gain_payload_len[preroll_counter];
|
||||
} else if (IA_ENHAACPLUS_DEC_CONFIG_GAIN_PAYLOAD_BUF == i_idx) {
|
||||
WORD32 payload_buffer_offeset = 0;
|
||||
ia_audio_specific_config_struct *ptr_audio_specific_config =
|
||||
((ia_audio_specific_config_struct *)
|
||||
p_obj_exhaacplus_dec->p_state_aac->ia_audio_specific_config);
|
||||
WORD32 preroll_counter = ptr_audio_specific_config->str_usac_config
|
||||
.str_usac_dec_config.preroll_counter;
|
||||
for (i = 0; i < (UWORD32)preroll_counter; i++)
|
||||
payload_buffer_offeset +=
|
||||
ptr_audio_specific_config->str_usac_config.str_usac_dec_config
|
||||
.usac_ext_gain_payload_len[i] *
|
||||
sizeof(WORD8);
|
||||
*pp_value = ptr_audio_specific_config->str_usac_config
|
||||
.str_usac_dec_config.usac_ext_gain_payload_buf;
|
||||
} else {
|
||||
.str_usac_dec_config.usac_ext_gain_payload_buf +
|
||||
payload_buffer_offeset;
|
||||
}
|
||||
|
||||
else {
|
||||
return IA_ENHAACPLUS_DEC_API_FATAL_INVALID_CONFIG_PARAM;
|
||||
}
|
||||
break;
|
||||
|
|
@ -806,12 +840,15 @@ IA_ERRORCODE ixheaacd_dec_api(pVOID p_ia_enhaacplus_dec_obj, WORD32 i_cmd,
|
|||
switch (i_idx) {
|
||||
case IA_CMD_TYPE_DO_EXECUTE: {
|
||||
WORD32 err_code = 0;
|
||||
if (!p_obj_exhaacplus_dec->p_state_aac->ui_init_done) {
|
||||
if (!p_obj_exhaacplus_dec->p_state_aac->ui_init_done ||
|
||||
p_obj_exhaacplus_dec->p_state_aac->fatal_err_present) {
|
||||
err_code = IA_FATAL_ERROR;
|
||||
} else {
|
||||
err_code = ixheaacd_dec_execute(p_obj_exhaacplus_dec);
|
||||
}
|
||||
if (err_code != IA_NO_ERROR) {
|
||||
if (err_code < 0)
|
||||
p_obj_exhaacplus_dec->p_state_aac->fatal_err_present = 1;
|
||||
p_obj_exhaacplus_dec->p_state_aac->i_bytes_consumed =
|
||||
p_obj_exhaacplus_dec->p_state_aac->ui_in_bytes;
|
||||
}
|
||||
|
|
@ -840,7 +877,24 @@ IA_ERRORCODE ixheaacd_dec_api(pVOID p_ia_enhaacplus_dec_obj, WORD32 i_cmd,
|
|||
break;
|
||||
}
|
||||
case IA_API_CMD_GET_OUTPUT_BYTES: {
|
||||
*pui_value = p_obj_exhaacplus_dec->p_state_aac->ui_out_bytes;
|
||||
if (p_obj_exhaacplus_dec->p_state_aac->audio_object_type == AOT_USAC) {
|
||||
ia_audio_specific_config_struct *ptr_audio_specific_config =
|
||||
((ia_audio_specific_config_struct *)
|
||||
p_obj_exhaacplus_dec->p_state_aac->ia_audio_specific_config);
|
||||
|
||||
WORD32 preroll_counter = ptr_audio_specific_config->str_usac_config
|
||||
.str_usac_dec_config.preroll_counter;
|
||||
|
||||
*pui_value = ptr_audio_specific_config->str_usac_config
|
||||
.str_usac_dec_config.preroll_bytes[preroll_counter];
|
||||
|
||||
preroll_counter++;
|
||||
if (preroll_counter > (MAX_AUDIO_PREROLLS + 1)) return IA_FATAL_ERROR;
|
||||
ptr_audio_specific_config->str_usac_config.str_usac_dec_config
|
||||
.preroll_counter = preroll_counter;
|
||||
} else {
|
||||
*pui_value = p_obj_exhaacplus_dec->p_state_aac->ui_out_bytes;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IA_API_CMD_INPUT_OVER: {
|
||||
|
|
@ -1174,7 +1228,7 @@ IA_ERRORCODE ixheaacd_fill_aac_mem_tables(
|
|||
{
|
||||
p_mem_info_aac =
|
||||
&p_obj_exhaacplus_dec->p_mem_info_aac[IA_ENHAACPLUS_DEC_OUTPUT_IDX];
|
||||
p_mem_info_aac->ui_size = num_channels * IA_ENHAACPLUS_DEC_OUT_BUF_SIZE;
|
||||
p_mem_info_aac->ui_size = IA_ENHAACPLUS_DEC_OUT_BUF_SIZE;
|
||||
p_mem_info_aac->ui_alignment = 8;
|
||||
p_mem_info_aac->ui_type = IA_MEMTYPE_OUTPUT;
|
||||
}
|
||||
|
|
@ -1929,6 +1983,7 @@ IA_ERRORCODE ixheaacd_dec_init(
|
|||
WORD ch_idx_err = 0;
|
||||
WORD persistent_used_t = 0;
|
||||
WORD channel_check = 0;
|
||||
WORD cc_channel_check = 0;
|
||||
WORD max_ch_num = p_obj_exhaacplus_dec->aac_config.ui_max_channels;
|
||||
i = 0;
|
||||
|
||||
|
|
@ -1953,30 +2008,34 @@ IA_ERRORCODE ixheaacd_dec_init(
|
|||
while (p_obj_exhaacplus_dec->aac_config.element_type[i] >= 0 &&
|
||||
p_obj_exhaacplus_dec->aac_config.element_type[i] <= 3) {
|
||||
WORD32 channel = 0;
|
||||
if (p_obj_exhaacplus_dec->aac_config.element_type[i] == 0 ||
|
||||
p_obj_exhaacplus_dec->aac_config.element_type[i] == 3) {
|
||||
channel = 1;
|
||||
}
|
||||
|
||||
if (p_obj_exhaacplus_dec->aac_config.element_type[i] == 1) {
|
||||
channel = 2;
|
||||
}
|
||||
|
||||
if (p_obj_exhaacplus_dec->aac_config.element_type[i] == 2) {
|
||||
if (max_ch_num > 2) {
|
||||
if (p_obj_exhaacplus_dec->aac_config.element_instance_order[i] !=
|
||||
p_obj_exhaacplus_dec->aac_config.ui_coupling_channel) {
|
||||
switch (p_obj_exhaacplus_dec->aac_config.element_type[i]) {
|
||||
case 0:
|
||||
case 3:
|
||||
channel = 1;
|
||||
break;
|
||||
case 1:
|
||||
channel = 2;
|
||||
break;
|
||||
case 2:
|
||||
if (max_ch_num > 2) {
|
||||
if (p_obj_exhaacplus_dec->aac_config.element_instance_order[i] !=
|
||||
p_obj_exhaacplus_dec->aac_config.ui_coupling_channel) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
channel = 1;
|
||||
} else {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
channel = 1;
|
||||
} else
|
||||
|
||||
{
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
cc_channel_check++;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
if (cc_channel_check > MAX_CC_CHANNEL_NUM)
|
||||
return IA_ENHAACPLUS_DEC_EXE_FATAL_UNIMPLEMENTED_CCE;
|
||||
if (ps_enable == 1) {
|
||||
channel = 2;
|
||||
}
|
||||
|
|
@ -2034,9 +2093,19 @@ IA_ERRORCODE ixheaacd_dec_init(
|
|||
p_state_enhaacplus_dec->str_sbr_dec_info[i]->xaac_jmp_buf =
|
||||
&(p_state_enhaacplus_dec->xaac_jmp_buf);
|
||||
}
|
||||
if (sbr_present_flag &&
|
||||
((p_obj_exhaacplus_dec->p_state_aac->audio_object_type ==
|
||||
AOT_AAC_LC) ||
|
||||
(p_obj_exhaacplus_dec->p_state_aac->audio_object_type ==
|
||||
AOT_SBR) ||
|
||||
(p_obj_exhaacplus_dec->p_state_aac->audio_object_type == AOT_PS)))
|
||||
p_obj_exhaacplus_dec->aac_config.flag_to_stereo = 1;
|
||||
|
||||
i++;
|
||||
}
|
||||
p_state_enhaacplus_dec->pers_mem_ptr =
|
||||
(WORD8 *)p_state_enhaacplus_dec->aac_persistent_mem_v +
|
||||
persistent_used_t;
|
||||
|
||||
p_obj_exhaacplus_dec->aac_config.i_channel_mask =
|
||||
ixheaacd_get_channel_mask(p_obj_exhaacplus_dec);
|
||||
|
|
@ -2203,7 +2272,37 @@ IA_ERRORCODE ixheaacd_dec_execute(
|
|||
|
||||
WORD32 frames_done = p_obj_exhaacplus_dec->p_state_aac->frame_counter;
|
||||
|
||||
ia_dec_data_struct *pstr_dec_data =
|
||||
(ia_dec_data_struct *)(p_obj_exhaacplus_dec->p_state_aac
|
||||
->pstr_dec_data);
|
||||
|
||||
if (pstr_dec_data->str_usac_data.down_samp_sbr != 0) return IA_FATAL_ERROR;
|
||||
|
||||
if (p_obj_exhaacplus_dec->p_state_aac->ui_input_over == 0) {
|
||||
ia_audio_specific_config_struct *ptr_audio_specific_config =
|
||||
((ia_audio_specific_config_struct *)
|
||||
p_obj_exhaacplus_dec->p_state_aac->ia_audio_specific_config);
|
||||
|
||||
ptr_audio_specific_config->str_usac_config.str_usac_dec_config
|
||||
.preroll_counter = 0;
|
||||
{
|
||||
WORD32 iii = 0;
|
||||
for (iii = 0; iii < (MAX_AUDIO_PREROLLS + 1); iii++) {
|
||||
((ia_dec_data_struct *)(p_obj_exhaacplus_dec->p_state_aac
|
||||
->pstr_dec_data))
|
||||
->str_frame_data.str_audio_specific_config.str_usac_config
|
||||
.str_usac_dec_config.usac_ext_gain_payload_len[iii] = 0;
|
||||
ptr_audio_specific_config->str_usac_config.str_usac_dec_config
|
||||
.usac_ext_gain_payload_len[iii] =
|
||||
0; // reinitilize the payload len buff
|
||||
ptr_audio_specific_config->str_usac_config.str_usac_dec_config
|
||||
.preroll_bytes[iii] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
((ia_dec_data_struct *)(p_obj_exhaacplus_dec->p_state_aac->pstr_dec_data))
|
||||
->str_frame_data.str_audio_specific_config.str_usac_config
|
||||
.str_usac_dec_config.preroll_counter = 0;
|
||||
error_code = ixheaacd_dec_main(
|
||||
p_obj_exhaacplus_dec, inbuffer, outbuffer, &out_bytes, frames_done,
|
||||
pcm_size, &p_obj_exhaacplus_dec->p_state_aac->num_of_output_ch);
|
||||
|
|
@ -2362,7 +2461,7 @@ IA_ERRORCODE ixheaacd_dec_execute(
|
|||
p_state_enhaacplus_dec,
|
||||
(ia_sampling_rate_info_struct *)&p_obj_exhaacplus_dec->aac_tables
|
||||
.pstr_huffmann_tables->str_sample_rate_info[0]);
|
||||
if (result < 0) return result;
|
||||
if (result) return result;
|
||||
if (!p_state_enhaacplus_dec->latm_initialized) {
|
||||
p_state_enhaacplus_dec->sampling_rate =
|
||||
p_state_enhaacplus_dec->latm_struct_element.layer_info[0][0]
|
||||
|
|
@ -2446,14 +2545,12 @@ IA_ERRORCODE ixheaacd_dec_execute(
|
|||
WORD32 pers_used = 0;
|
||||
skip_full_decode = 1;
|
||||
pers_used = ixheaacd_set_aac_persistent_buffers(
|
||||
(WORD8 *)p_state_enhaacplus_dec->aac_scratch_mem_v + (8 * 1024),
|
||||
channel);
|
||||
p_state_enhaacplus_dec->pers_mem_ptr, channel);
|
||||
|
||||
{
|
||||
struct ia_aac_persistent_struct *aac_persistent_mem =
|
||||
(struct ia_aac_persistent_struct
|
||||
*)((WORD8 *)p_state_enhaacplus_dec->aac_scratch_mem_v +
|
||||
(8 * 1024));
|
||||
(struct ia_aac_persistent_struct *)
|
||||
p_state_enhaacplus_dec->pers_mem_ptr;
|
||||
aac_persistent_mem->str_aac_decoder.pstr_aac_tables =
|
||||
&p_obj_exhaacplus_dec->aac_tables;
|
||||
aac_persistent_mem->str_aac_decoder.pstr_common_tables =
|
||||
|
|
@ -2470,8 +2567,7 @@ IA_ERRORCODE ixheaacd_dec_execute(
|
|||
|
||||
p_state_enhaacplus_dec->pstr_stream_sbr[ch_idx],
|
||||
|
||||
channel,
|
||||
(WORD8 *)p_state_enhaacplus_dec->aac_scratch_mem_v + (8 * 1024),
|
||||
channel, p_state_enhaacplus_dec->pers_mem_ptr,
|
||||
p_state_enhaacplus_dec->frame_length
|
||||
|
||||
);
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@
|
|||
*/
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops16.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops16.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_bitbuffer.h"
|
||||
#include "ixheaacd_interface.h"
|
||||
|
||||
|
|
@ -49,10 +49,10 @@
|
|||
|
||||
#define ARITH_ESCAPE 16
|
||||
|
||||
UWORD16 ixheaacd_ari_cf_r[3][4] = {
|
||||
static const UWORD16 ixheaacd_ari_cf_r[3][4] = {
|
||||
{12571, 10569, 3696, 0}, {12661, 5700, 3751, 0}, {10827, 6884, 2929, 0}};
|
||||
|
||||
static UWORD16 ixheaacd_ari_lookup_m[742] = {
|
||||
static const UWORD16 ixheaacd_ari_lookup_m[742] = {
|
||||
0x01, 0x34, 0x0D, 0x13, 0x12, 0x25, 0x00, 0x3A, 0x05, 0x00, 0x21, 0x13,
|
||||
0x1F, 0x1A, 0x1D, 0x36, 0x24, 0x2B, 0x1B, 0x33, 0x37, 0x29, 0x1D, 0x33,
|
||||
0x37, 0x33, 0x37, 0x33, 0x37, 0x33, 0x2C, 0x00, 0x21, 0x13, 0x25, 0x2A,
|
||||
|
|
@ -116,7 +116,7 @@ static UWORD16 ixheaacd_ari_lookup_m[742] = {
|
|||
0x27, 0x17, 0x27, 0x17, 0x27, 0x17, 0x27, 0x17, 0x27, 0x17, 0x27, 0x17,
|
||||
0x27, 0x17, 0x27, 0x17, 0x27, 0x15, 0x27, 0x27, 0x15, 0x27};
|
||||
|
||||
static UWORD32 ixheaacd_ari_hash_m[742] = {
|
||||
static const UWORD32 ixheaacd_ari_hash_m[742] = {
|
||||
0x00000104UL >> 8, 0x0000030AUL >> 8, 0x00000510UL >> 8, 0x00000716UL >> 8,
|
||||
0x00000A1FUL >> 8, 0x00000F2EUL >> 8, 0x00011100UL >> 8, 0x00111103UL >> 8,
|
||||
0x00111306UL >> 8, 0x00111436UL >> 8, 0x00111623UL >> 8, 0x00111929UL >> 8,
|
||||
|
|
@ -304,7 +304,7 @@ static UWORD32 ixheaacd_ari_hash_m[742] = {
|
|||
0x06000F27UL >> 8, 0x069FFF17UL >> 8, 0x06FFFF17UL >> 8, 0x08110017UL >> 8,
|
||||
0x08EFFF15UL >> 8, 0xFFFFFF00UL >> 8};
|
||||
|
||||
static UWORD8 ixheaacd_ari_hash_m_1[742] = {
|
||||
static const UWORD8 ixheaacd_ari_hash_m_1[742] = {
|
||||
(UWORD8)0x04, (UWORD8)0x0A, (UWORD8)0x10, (UWORD8)0x16, (UWORD8)0x1F,
|
||||
(UWORD8)0x2E, (UWORD8)0x00, (UWORD8)0x03, (UWORD8)0x06, (UWORD8)0x36,
|
||||
(UWORD8)0x23, (UWORD8)0x29, (UWORD8)0x2E, (UWORD8)0x1B, (UWORD8)0x35,
|
||||
|
|
@ -455,7 +455,7 @@ static UWORD8 ixheaacd_ari_hash_m_1[742] = {
|
|||
(UWORD8)0x2F, (UWORD8)0x27, (UWORD8)0x17, (UWORD8)0x17, (UWORD8)0x17,
|
||||
(UWORD8)0x15, (UWORD8)0x00};
|
||||
|
||||
UWORD16 ixheaacd_ari_cf_m[64][17] = {
|
||||
static const UWORD16 ixheaacd_ari_cf_m[64][17] = {
|
||||
{708, 706, 579, 569, 568, 567, 479, 469, 297, 138, 97, 91, 72, 52, 38, 34,
|
||||
0},
|
||||
{7619, 6917, 6519, 6412, 5514, 5003, 4683, 4563, 3907, 3297, 3125, 3060,
|
||||
|
|
@ -1625,8 +1625,8 @@ const WORD32 ixheaacd_pow_table_Q13[1025] = {0,
|
|||
84441795,
|
||||
84551870};
|
||||
|
||||
static WORD32 ixheaacd_esc_nb_offset[8] = {0, 131072, 262144, 393216,
|
||||
524288, 655360, 786432, 917504};
|
||||
static const WORD32 ixheaacd_esc_nb_offset[8] = {
|
||||
0, 131072, 262144, 393216, 524288, 655360, 786432, 917504};
|
||||
|
||||
static void ixheaacd_arith_map_context(WORD32 pres_n, WORD32 prev_n,
|
||||
WORD8 *c_prev, WORD8 *c,
|
||||
|
|
@ -1730,34 +1730,26 @@ static WORD32 ixheaacd_arith_decode(ia_bit_buf_struct *it_bit_buff,
|
|||
UWORD16 const *cum_freq, WORD32 cfl) {
|
||||
register WORD32 symbol;
|
||||
register WORD32 low, high, range, value;
|
||||
register WORD32 cum;
|
||||
register WORD32 cumulative;
|
||||
register UWORD16 const *p;
|
||||
register UWORD16 const *q;
|
||||
|
||||
WORD32 short_value, i = 16;
|
||||
int shift_value;
|
||||
if (it_bit_buff->cnt_bits < 16) {
|
||||
shift_value = 16 - it_bit_buff->cnt_bits;
|
||||
short_value = ixheaacd_read_bits_buf(it_bit_buff, it_bit_buff->cnt_bits);
|
||||
short_value <<= shift_value;
|
||||
} else {
|
||||
shift_value = 0;
|
||||
short_value = ixheaacd_read_bits_buf(it_bit_buff, 16);
|
||||
}
|
||||
|
||||
low = s->low;
|
||||
high = s->high;
|
||||
value = s->value;
|
||||
|
||||
range = high - low + 1;
|
||||
cum = ((((WORD32)(value - low + 1)) << 14) - ((WORD32)1)) / ((WORD32)range);
|
||||
cumulative = ((((WORD32)(value - low + 1)) << 14) - ((WORD32)1)) / ((WORD32)range);
|
||||
|
||||
if (it_bit_buff->cnt_bits == 0)
|
||||
if (cumulative <= 0) return -1;
|
||||
|
||||
p = cum_freq - 1;
|
||||
|
||||
do {
|
||||
q = p + (cfl >> 1);
|
||||
|
||||
if (*q > cum) {
|
||||
if (*q > cumulative) {
|
||||
p = q;
|
||||
cfl++;
|
||||
}
|
||||
|
|
@ -1786,12 +1778,14 @@ static WORD32 ixheaacd_arith_decode(ia_bit_buf_struct *it_bit_buff,
|
|||
low += low;
|
||||
high += high + 1;
|
||||
|
||||
i--;
|
||||
value = (value << 1) | ((short_value >> i) & 1);
|
||||
if (it_bit_buff->cnt_bits > 0)
|
||||
value = (value << 1) | ixheaacd_read_bits_buf(it_bit_buff, 1);
|
||||
else
|
||||
value = (value << 1);
|
||||
|
||||
bit_count++;
|
||||
}
|
||||
|
||||
ixheaacd_read_bidirection(it_bit_buff, -(i - shift_value));
|
||||
s->low = low;
|
||||
s->high = high;
|
||||
s->value = value;
|
||||
|
|
@ -1847,10 +1841,6 @@ 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;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (m == 0) {
|
||||
|
|
@ -1891,8 +1881,8 @@ WORD32 ixheaacd_arth_decoding_level2(ia_bit_buf_struct *it_bit_buff,
|
|||
|
||||
if (bit_count > 0) {
|
||||
bit_count_5 = bit_count >> 5;
|
||||
for (i = 0; i < bit_count_5; i++) ixheaacd_read_bits_buf(it_bit_buff, 32);
|
||||
ixheaacd_read_bits_buf(it_bit_buff, bit_count & 31);
|
||||
bit_count_5 = (bit_count_5 * 32) + (bit_count & 31);
|
||||
ixheaacd_skip_bits_buf(it_bit_buff, bit_count_5);
|
||||
}
|
||||
|
||||
for (i = 0; i < pres_n; i++) {
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@
|
|||
#include <math.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_acelp_com.h"
|
||||
|
||||
extern const WORD32 ixheaacd_factorial_7[8];
|
||||
|
|
@ -50,11 +50,12 @@ static VOID ixheaacd_nearest_neighbor_2d(WORD32 x[], WORD32 y[], WORD32 count,
|
|||
sum = 0;
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (x[i] < 0) {
|
||||
y[i] = -2 * (((WORD32)(1 - x[i])) >> 1);
|
||||
y[i] = ixheaacd_negate32_sat(
|
||||
ixheaacd_shl32_sat((ixheaacd_sub32_sat(1, x[i]) >> 1), 1));
|
||||
} else {
|
||||
y[i] = 2 * (((WORD32)(1 + x[i])) >> 1);
|
||||
y[i] = ixheaacd_shl32_sat((ixheaacd_add32_sat(1, x[i]) >> 1), 1);
|
||||
}
|
||||
sum += y[i];
|
||||
sum = ixheaacd_add32_sat(sum, y[i]);
|
||||
|
||||
if (x[i] % 2 != 0) {
|
||||
if (x[i] < 0) {
|
||||
|
|
@ -89,7 +90,7 @@ static VOID ixheaacd_nearest_neighbor_2d(WORD32 x[], WORD32 y[], WORD32 count,
|
|||
y[j] -= 2;
|
||||
rem_temp[j] = ixheaacd_add32_sat(rem_temp[j], (2 << count));
|
||||
} else {
|
||||
y[j] += 2;
|
||||
y[j] = ixheaacd_add32_sat(y[j], 2);
|
||||
rem_temp[j] = ixheaacd_sub32_sat(rem_temp[j], (2 << count));
|
||||
}
|
||||
}
|
||||
|
|
@ -114,14 +115,14 @@ VOID ixheaacd_voronoi_search(WORD32 x[], WORD32 y[], WORD32 count, WORD32 *rem1,
|
|||
rem2[i] = ixheaacd_sub32_sat(rem2[i], (1 << count));
|
||||
}
|
||||
} else {
|
||||
x1[i] = x[i] - 1;
|
||||
x1[i] = ixheaacd_sub32_sat(x[i], 1);
|
||||
}
|
||||
}
|
||||
|
||||
ixheaacd_nearest_neighbor_2d(x1, y1, count, rem2);
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
y1[i] += 1;
|
||||
y1[i] = ixheaacd_add32_sat(y1[i], 1);
|
||||
}
|
||||
|
||||
e0 = e1 = 0;
|
||||
|
|
@ -164,11 +165,11 @@ VOID ixheaacd_voronoi_idx_dec(WORD32 *kv, WORD32 m, WORD32 *y, WORD32 count) {
|
|||
y[0] = ixheaacd_add32_sat(
|
||||
y[0],
|
||||
ixheaacd_add32_sat(ixheaacd_sat64_32((WORD64)4 * (WORD64)kv[0]), sum));
|
||||
z[0] = (y[0] - 2) >> count;
|
||||
z[0] = (ixheaacd_sub32_sat(y[0], 2)) >> count;
|
||||
if (m != 0)
|
||||
rem1[0] = (y[0] - 2) % m;
|
||||
rem1[0] = (ixheaacd_sub32_sat(y[0], 2)) % m;
|
||||
else
|
||||
rem1[0] = (y[0] - 2);
|
||||
rem1[0] = ixheaacd_sub32_sat(y[0], 2);
|
||||
|
||||
memcpy(rem2, rem1, 8 * sizeof(WORD32));
|
||||
|
||||
|
|
@ -177,7 +178,9 @@ VOID ixheaacd_voronoi_idx_dec(WORD32 *kv, WORD32 m, WORD32 *y, WORD32 count) {
|
|||
ptr1 = y;
|
||||
ptr2 = v;
|
||||
for (i = 0; i < 8; i++) {
|
||||
*ptr1++ -= ixheaacd_sat64_32((WORD64)m * (WORD64)*ptr2++);
|
||||
*ptr1 = ixheaacd_sub32_sat(*ptr1,
|
||||
ixheaacd_sat64_32((WORD64)m * (WORD64)*ptr2++));
|
||||
ptr1++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -306,4 +309,4 @@ VOID ixheaacd_rotated_gosset_mtx_dec(WORD32 qn, WORD32 code_book_idx,
|
|||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
*****************************************************************************
|
||||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
#include "ixheaacd_acelp_com.h"
|
||||
#include "ixheaacd_cnst.h"
|
||||
|
||||
|
|
@ -402,7 +402,7 @@ const FLOAT32 ixheaacd_interpol_filt[INTER_LP_FIL_LEN] = {
|
|||
0.001151f, 0.000259f, -0.000417f, -0.000618f, -0.000434f, -0.000133f,
|
||||
0.000063f, 0.000098f, 0.000048f, 0.000007f, 0.000000f};
|
||||
|
||||
FLOAT32 ixheaacd_weight_table_avq[16 * 256] = {
|
||||
const FLOAT32 ixheaacd_weight_table_avq[16 * 256] = {
|
||||
51.35722351f, 56.66270447f, 56.93847275f, 47.94641876f, 51.14369583f,
|
||||
55.13227081f, 55.94912338f, 55.60356140f, 55.40005112f, 55.63003922f,
|
||||
56.32114792f, 58.34404755f, 58.28456116f, 57.81193161f, 57.67873764f,
|
||||
|
|
|
|||
|
|
@ -18,15 +18,14 @@
|
|||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops16.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include <ixheaacd_basic_ops.h>
|
||||
|
||||
#include <ixheaacd_basic_op.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops16.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_basic_op.h"
|
||||
#include "ixheaacd_basic_ops.h"
|
||||
#include "ixheaacd_intrinsics.h"
|
||||
#include "ixheaacd_common_rom.h"
|
||||
#include "ixheaacd_basic_funcs.h"
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@
|
|||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_constants.h"
|
||||
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_windows.h"
|
||||
|
||||
static PLATFORM_INLINE WORD32 ixheaacd_mult32_sh1(WORD32 a, WORD32 b) {
|
||||
|
|
@ -65,7 +65,8 @@ VOID ixheaacd_combine_fac(WORD32 *src1, WORD32 *src2, WORD32 *dest, WORD32 len,
|
|||
}
|
||||
} else {
|
||||
for (i = 0; i < len; i++) {
|
||||
*dest = ixheaacd_add32_sat(*src1, ((*src2) << (output_q - fac_q)));
|
||||
*dest = ixheaacd_add32_sat(
|
||||
*src1, ixheaacd_shl32_sat((*src2), (output_q - fac_q)));
|
||||
dest++;
|
||||
src1++;
|
||||
src2++;
|
||||
|
|
@ -86,7 +87,8 @@ WORD8 ixheaacd_windowing_long1(WORD32 *src1, WORD32 *src2,
|
|||
((ixheaacd_mult32_sh1(*src1, *win_fwd)) >> (shift1 - shift2)),
|
||||
ixheaacd_mult32_sh1(*src2, *win_rev));
|
||||
*(dest + (vlen - (2 * i)) - 1) = ixheaacd_add32_sat(
|
||||
((ixheaacd_mult32_sh1(-(*src1), *win_rev)) >> (shift1 - shift2)),
|
||||
((ixheaacd_mult32_sh1(ixheaacd_negate32_sat(*src1), *win_rev)) >>
|
||||
(shift1 - shift2)),
|
||||
ixheaacd_mult32_sh1(*rsrc2, *win_fwd));
|
||||
|
||||
src1++;
|
||||
|
|
@ -104,7 +106,7 @@ WORD8 ixheaacd_windowing_long1(WORD32 *src1, WORD32 *src2,
|
|||
((ixheaacd_mult32_sh1(*src2, *win_rev)) >> (shift2 - shift1)));
|
||||
|
||||
*(dest + (vlen - (2 * i)) - 1) = ixheaacd_add32_sat(
|
||||
ixheaacd_mult32_sh1(-(*src1), *win_rev),
|
||||
ixheaacd_mult32_sh1(ixheaacd_negate32_sat(*src1), *win_rev),
|
||||
((ixheaacd_mult32_sh1(*rsrc2, *win_fwd)) >> (shift2 - shift1)));
|
||||
src1++;
|
||||
src2++;
|
||||
|
|
@ -139,10 +141,11 @@ WORD8 ixheaacd_windowing_long2(WORD32 *src1, const WORD32 *win_fwd,
|
|||
i < ixheaacd_drc_offset->n_flat_ls + ixheaacd_drc_offset->n_trans_ls;
|
||||
i++) {
|
||||
dest[i] = ixheaacd_add32_sat(
|
||||
(ixheaacd_mult32_sh1(-src1[ixheaacd_drc_offset->n_long / 2 +
|
||||
ixheaacd_drc_offset->n_flat_ls +
|
||||
ixheaacd_drc_offset->lfac - i - 1],
|
||||
*win_fwd) >>
|
||||
(ixheaacd_mult32_sh1(
|
||||
ixheaacd_negate32_sat(src1[ixheaacd_drc_offset->n_long / 2 +
|
||||
ixheaacd_drc_offset->n_flat_ls +
|
||||
ixheaacd_drc_offset->lfac - i - 1]),
|
||||
*win_fwd) >>
|
||||
(shiftp - fac_q)),
|
||||
(*fac_data_out));
|
||||
win_fwd++;
|
||||
|
|
@ -152,20 +155,21 @@ WORD8 ixheaacd_windowing_long2(WORD32 *src1, const WORD32 *win_fwd,
|
|||
for (;
|
||||
i < ixheaacd_drc_offset->n_flat_ls + (ixheaacd_drc_offset->lfac * 3);
|
||||
i++) {
|
||||
dest[i] =
|
||||
ixheaacd_add32_sat((-src1[ixheaacd_drc_offset->n_long / 2 +
|
||||
ixheaacd_drc_offset->n_flat_ls +
|
||||
ixheaacd_drc_offset->lfac - i - 1] >>
|
||||
(shiftp - fac_q)),
|
||||
(*fac_data_out));
|
||||
dest[i] = ixheaacd_add32_sat(
|
||||
(ixheaacd_negate32_sat(src1[ixheaacd_drc_offset->n_long / 2 +
|
||||
ixheaacd_drc_offset->n_flat_ls +
|
||||
ixheaacd_drc_offset->lfac - i - 1]) >>
|
||||
(shiftp - fac_q)),
|
||||
(*fac_data_out));
|
||||
fac_data_out++;
|
||||
}
|
||||
|
||||
for (; i < ixheaacd_drc_offset->n_long; i++) {
|
||||
dest[i] = -src1[ixheaacd_drc_offset->n_long / 2 +
|
||||
ixheaacd_drc_offset->n_flat_ls +
|
||||
ixheaacd_drc_offset->lfac - i - 1] >>
|
||||
(shiftp - fac_q);
|
||||
dest[i] =
|
||||
ixheaacd_negate32_sat(src1[ixheaacd_drc_offset->n_long / 2 +
|
||||
ixheaacd_drc_offset->n_flat_ls +
|
||||
ixheaacd_drc_offset->lfac - i - 1]) >>
|
||||
(shiftp - fac_q);
|
||||
}
|
||||
return (fac_q);
|
||||
} else {
|
||||
|
|
@ -176,10 +180,11 @@ WORD8 ixheaacd_windowing_long2(WORD32 *src1, const WORD32 *win_fwd,
|
|||
i < ixheaacd_drc_offset->n_flat_ls + ixheaacd_drc_offset->n_trans_ls;
|
||||
i++) {
|
||||
dest[i] = ixheaacd_add32_sat(
|
||||
(ixheaacd_mult32_sh1(-src1[ixheaacd_drc_offset->n_long / 2 +
|
||||
ixheaacd_drc_offset->n_flat_ls +
|
||||
ixheaacd_drc_offset->lfac - i - 1],
|
||||
*win_fwd) >>
|
||||
(ixheaacd_mult32_sh1(
|
||||
ixheaacd_negate32_sat(src1[ixheaacd_drc_offset->n_long / 2 +
|
||||
ixheaacd_drc_offset->n_flat_ls +
|
||||
ixheaacd_drc_offset->lfac - i - 1]),
|
||||
*win_fwd) >>
|
||||
(shiftp - shift_olap)),
|
||||
(*fac_data_out) >> (fac_q - shift_olap));
|
||||
win_fwd++;
|
||||
|
|
@ -189,20 +194,21 @@ WORD8 ixheaacd_windowing_long2(WORD32 *src1, const WORD32 *win_fwd,
|
|||
for (;
|
||||
i < ixheaacd_drc_offset->n_flat_ls + (ixheaacd_drc_offset->lfac * 3);
|
||||
i++) {
|
||||
dest[i] =
|
||||
ixheaacd_add32_sat((-src1[ixheaacd_drc_offset->n_long / 2 +
|
||||
ixheaacd_drc_offset->n_flat_ls +
|
||||
ixheaacd_drc_offset->lfac - i - 1] >>
|
||||
(shiftp - shift_olap)),
|
||||
(*fac_data_out) >> (fac_q - shift_olap));
|
||||
dest[i] = ixheaacd_add32_sat(
|
||||
(ixheaacd_negate32_sat(src1[ixheaacd_drc_offset->n_long / 2 +
|
||||
ixheaacd_drc_offset->n_flat_ls +
|
||||
ixheaacd_drc_offset->lfac - i - 1]) >>
|
||||
(shiftp - shift_olap)),
|
||||
(*fac_data_out) >> (fac_q - shift_olap));
|
||||
fac_data_out++;
|
||||
}
|
||||
|
||||
for (; i < ixheaacd_drc_offset->n_long; i++) {
|
||||
dest[i] = -src1[ixheaacd_drc_offset->n_long / 2 +
|
||||
ixheaacd_drc_offset->n_flat_ls +
|
||||
ixheaacd_drc_offset->lfac - i - 1] >>
|
||||
(shiftp - shift_olap);
|
||||
dest[i] =
|
||||
ixheaacd_negate32_sat(src1[ixheaacd_drc_offset->n_long / 2 +
|
||||
ixheaacd_drc_offset->n_flat_ls +
|
||||
ixheaacd_drc_offset->lfac - i - 1]) >>
|
||||
(shiftp - shift_olap);
|
||||
}
|
||||
return (shift_olap);
|
||||
}
|
||||
|
|
@ -218,10 +224,11 @@ WORD8 ixheaacd_windowing_long2(WORD32 *src1, const WORD32 *win_fwd,
|
|||
i < ixheaacd_drc_offset->n_flat_ls + ixheaacd_drc_offset->n_trans_ls;
|
||||
i++) {
|
||||
dest[i] = ixheaacd_add32_sat(
|
||||
ixheaacd_mult32_sh1(-src1[ixheaacd_drc_offset->n_long / 2 +
|
||||
ixheaacd_drc_offset->n_flat_ls +
|
||||
ixheaacd_drc_offset->lfac - i - 1],
|
||||
*win_fwd),
|
||||
ixheaacd_mult32_sh1(
|
||||
ixheaacd_negate32_sat(src1[ixheaacd_drc_offset->n_long / 2 +
|
||||
ixheaacd_drc_offset->n_flat_ls +
|
||||
ixheaacd_drc_offset->lfac - i - 1]),
|
||||
*win_fwd),
|
||||
(*fac_data_out) >> (fac_q - shiftp));
|
||||
win_fwd++;
|
||||
fac_data_out++;
|
||||
|
|
@ -230,17 +237,19 @@ WORD8 ixheaacd_windowing_long2(WORD32 *src1, const WORD32 *win_fwd,
|
|||
for (;
|
||||
i < ixheaacd_drc_offset->n_flat_ls + (ixheaacd_drc_offset->lfac * 3);
|
||||
i++) {
|
||||
dest[i] = ixheaacd_add32_sat(-src1[ixheaacd_drc_offset->n_long / 2 +
|
||||
ixheaacd_drc_offset->n_flat_ls +
|
||||
ixheaacd_drc_offset->lfac - i - 1],
|
||||
(*fac_data_out) >> (fac_q - shiftp));
|
||||
dest[i] = ixheaacd_add32_sat(
|
||||
ixheaacd_negate32_sat(src1[ixheaacd_drc_offset->n_long / 2 +
|
||||
ixheaacd_drc_offset->n_flat_ls +
|
||||
ixheaacd_drc_offset->lfac - i - 1]),
|
||||
(*fac_data_out) >> (fac_q - shiftp));
|
||||
fac_data_out++;
|
||||
}
|
||||
|
||||
for (; i < ixheaacd_drc_offset->n_long; i++) {
|
||||
dest[i] = -src1[ixheaacd_drc_offset->n_long / 2 +
|
||||
ixheaacd_drc_offset->n_flat_ls +
|
||||
ixheaacd_drc_offset->lfac - i - 1];
|
||||
dest[i] =
|
||||
ixheaacd_negate32_sat(src1[ixheaacd_drc_offset->n_long / 2 +
|
||||
ixheaacd_drc_offset->n_flat_ls +
|
||||
ixheaacd_drc_offset->lfac - i - 1]);
|
||||
}
|
||||
return (shiftp);
|
||||
} else {
|
||||
|
|
@ -251,10 +260,11 @@ WORD8 ixheaacd_windowing_long2(WORD32 *src1, const WORD32 *win_fwd,
|
|||
i < ixheaacd_drc_offset->n_flat_ls + ixheaacd_drc_offset->n_trans_ls;
|
||||
i++) {
|
||||
dest[i] = ixheaacd_add32_sat(
|
||||
(ixheaacd_mult32_sh1(-src1[ixheaacd_drc_offset->n_long / 2 +
|
||||
ixheaacd_drc_offset->n_flat_ls +
|
||||
ixheaacd_drc_offset->lfac - i - 1],
|
||||
*win_fwd) >>
|
||||
(ixheaacd_mult32_sh1(
|
||||
ixheaacd_negate32_sat(src1[ixheaacd_drc_offset->n_long / 2 +
|
||||
ixheaacd_drc_offset->n_flat_ls +
|
||||
ixheaacd_drc_offset->lfac - i - 1]),
|
||||
*win_fwd) >>
|
||||
(shiftp - shift_olap)),
|
||||
(*fac_data_out) >> (fac_q - shift_olap));
|
||||
win_fwd++;
|
||||
|
|
@ -264,20 +274,21 @@ WORD8 ixheaacd_windowing_long2(WORD32 *src1, const WORD32 *win_fwd,
|
|||
for (;
|
||||
i < ixheaacd_drc_offset->n_flat_ls + (ixheaacd_drc_offset->lfac * 3);
|
||||
i++) {
|
||||
dest[i] =
|
||||
ixheaacd_add32_sat((-src1[ixheaacd_drc_offset->n_long / 2 +
|
||||
ixheaacd_drc_offset->n_flat_ls +
|
||||
ixheaacd_drc_offset->lfac - i - 1] >>
|
||||
(shiftp - shift_olap)),
|
||||
(*fac_data_out) >> (fac_q - shift_olap));
|
||||
dest[i] = ixheaacd_add32_sat(
|
||||
(ixheaacd_negate32_sat(src1[ixheaacd_drc_offset->n_long / 2 +
|
||||
ixheaacd_drc_offset->n_flat_ls +
|
||||
ixheaacd_drc_offset->lfac - i - 1]) >>
|
||||
(shiftp - shift_olap)),
|
||||
(*fac_data_out) >> (fac_q - shift_olap));
|
||||
fac_data_out++;
|
||||
}
|
||||
|
||||
for (; i < ixheaacd_drc_offset->n_long; i++) {
|
||||
dest[i] = -src1[ixheaacd_drc_offset->n_long / 2 +
|
||||
ixheaacd_drc_offset->n_flat_ls +
|
||||
ixheaacd_drc_offset->lfac - i - 1] >>
|
||||
(shiftp - shift_olap);
|
||||
dest[i] =
|
||||
ixheaacd_negate32_sat(src1[ixheaacd_drc_offset->n_long / 2 +
|
||||
ixheaacd_drc_offset->n_flat_ls +
|
||||
ixheaacd_drc_offset->lfac - i - 1]) >>
|
||||
(shiftp - shift_olap);
|
||||
}
|
||||
return (shift_olap);
|
||||
}
|
||||
|
|
@ -308,8 +319,9 @@ WORD8 ixheaacd_windowing_long3(WORD32 *src1, const WORD32 *win_fwd,
|
|||
i < ixheaacd_drc_offset->n_flat_ls + ixheaacd_drc_offset->n_trans_ls;
|
||||
i++) {
|
||||
dest[i] = ixheaacd_add32_sat(
|
||||
(ixheaacd_mult32_sh1(-src1[ixheaacd_drc_offset->n_long - i - 1],
|
||||
*win_fwd) >>
|
||||
(ixheaacd_mult32_sh1(
|
||||
ixheaacd_negate32_sat(src1[ixheaacd_drc_offset->n_long - i - 1]),
|
||||
*win_fwd) >>
|
||||
(shiftp - shift_olap)),
|
||||
ixheaacd_mult32_sh1(over_lap[i], *win_rev));
|
||||
win_fwd++;
|
||||
|
|
@ -318,7 +330,8 @@ WORD8 ixheaacd_windowing_long3(WORD32 *src1, const WORD32 *win_fwd,
|
|||
|
||||
for (; i < ixheaacd_drc_offset->n_long; i++) {
|
||||
dest[i] =
|
||||
-src1[ixheaacd_drc_offset->n_long - i - 1] >> (shiftp - shift_olap);
|
||||
ixheaacd_negate32_sat(src1[ixheaacd_drc_offset->n_long - i - 1]) >>
|
||||
(shiftp - shift_olap);
|
||||
}
|
||||
|
||||
return (shift_olap);
|
||||
|
|
@ -340,15 +353,17 @@ WORD8 ixheaacd_windowing_long3(WORD32 *src1, const WORD32 *win_fwd,
|
|||
i < ixheaacd_drc_offset->n_flat_ls + ixheaacd_drc_offset->n_trans_ls;
|
||||
i++) {
|
||||
dest[i] = ixheaacd_add32_sat(
|
||||
ixheaacd_mult32_sh1(-src1[ixheaacd_drc_offset->n_long - i - 1],
|
||||
*win_fwd),
|
||||
ixheaacd_mult32_sh1(
|
||||
ixheaacd_negate32_sat(src1[ixheaacd_drc_offset->n_long - i - 1]),
|
||||
*win_fwd),
|
||||
ixheaacd_mult32_sh1(over_lap[i], *win_rev) >> (shift_olap - shiftp));
|
||||
win_fwd++;
|
||||
win_rev--;
|
||||
}
|
||||
|
||||
for (; i < ixheaacd_drc_offset->n_long; i++) {
|
||||
dest[i] = -src1[ixheaacd_drc_offset->n_long - i - 1];
|
||||
dest[i] =
|
||||
ixheaacd_negate32_sat(src1[ixheaacd_drc_offset->n_long - i - 1]);
|
||||
}
|
||||
|
||||
return (shiftp);
|
||||
|
|
@ -369,7 +384,8 @@ VOID ixheaacd_windowing_short1(WORD32 *src1, WORD32 *src2, WORD32 *fp,
|
|||
for (i = ixheaacd_drc_offset->lfac; i < ixheaacd_drc_offset->n_short;
|
||||
i++) {
|
||||
dest[i] = ixheaacd_mult32_sh1(
|
||||
-src1[ixheaacd_drc_offset->n_short - i - 1], src2[i]);
|
||||
ixheaacd_negate32_sat(src1[ixheaacd_drc_offset->n_short - i - 1]),
|
||||
src2[i]);
|
||||
}
|
||||
|
||||
for (; i < ixheaacd_drc_offset->n_flat_ls + ixheaacd_drc_offset->lfac;
|
||||
|
|
@ -390,9 +406,11 @@ VOID ixheaacd_windowing_short1(WORD32 *src1, WORD32 *src2, WORD32 *fp,
|
|||
if (ixheaacd_drc_offset->n_short > ixheaacd_drc_offset->lfac) {
|
||||
for (i = ixheaacd_drc_offset->lfac; i < ixheaacd_drc_offset->n_short;
|
||||
i++) {
|
||||
dest[i] = ixheaacd_mult32_sh1(
|
||||
-src1[ixheaacd_drc_offset->n_short - i - 1], src2[i]) >>
|
||||
(shiftp - shift_olap);
|
||||
dest[i] =
|
||||
ixheaacd_mult32_sh1(ixheaacd_negate32_sat(
|
||||
src1[ixheaacd_drc_offset->n_short - i - 1]),
|
||||
src2[i]) >>
|
||||
(shiftp - shift_olap);
|
||||
}
|
||||
|
||||
for (; i < ixheaacd_drc_offset->n_flat_ls + ixheaacd_drc_offset->lfac;
|
||||
|
|
@ -423,7 +441,7 @@ VOID ixheaacd_windowing_short2(WORD32 *src1, WORD32 *win_fwd, WORD32 *fp,
|
|||
(ixheaacd_mult32_sh1(fp[i], *win_rev) >> (shift_olap - shiftp)));
|
||||
|
||||
fp[ixheaacd_drc_offset->n_short - i - 1] = ixheaacd_add32_sat(
|
||||
ixheaacd_mult32_sh1(-src1[i], *win_rev),
|
||||
ixheaacd_mult32_sh1(ixheaacd_negate32_sat(src1[i]), *win_rev),
|
||||
(ixheaacd_mult32_sh1(fp[ixheaacd_drc_offset->n_short - i - 1],
|
||||
*win_fwd) >>
|
||||
(shift_olap - shiftp)));
|
||||
|
|
@ -443,7 +461,8 @@ VOID ixheaacd_windowing_short2(WORD32 *src1, WORD32 *win_fwd, WORD32 *fp,
|
|||
ixheaacd_mult32_sh1(fp[i], *win_rev));
|
||||
|
||||
fp[ixheaacd_drc_offset->n_short - i - 1] = ixheaacd_add32_sat(
|
||||
(ixheaacd_mult32_sh1(-src1[i], *win_rev) >> (shiftp - shift_olap)),
|
||||
(ixheaacd_mult32_sh1(ixheaacd_negate32_sat(src1[i]), *win_rev) >>
|
||||
(shiftp - shift_olap)),
|
||||
ixheaacd_mult32_sh1(fp[ixheaacd_drc_offset->n_short - i - 1],
|
||||
*win_fwd));
|
||||
|
||||
|
|
@ -467,11 +486,13 @@ WORD8 ixheaacd_windowing_short3(WORD32 *src1, WORD32 *win_rev, WORD32 *fp,
|
|||
if (shift_olap > shiftp) {
|
||||
for (i = 0; i < n_short / 2; i++) {
|
||||
fp[i] = ixheaacd_add32_sat(
|
||||
ixheaacd_mult32_sh1(-src1[n_short / 2 - i - 1], *win_rev),
|
||||
ixheaacd_mult32_sh1(ixheaacd_negate32_sat(src1[n_short / 2 - i - 1]),
|
||||
*win_rev),
|
||||
(fp[i] >> (shift_olap - shiftp)));
|
||||
|
||||
fp[n_short - i - 1] = ixheaacd_add32_sat(
|
||||
ixheaacd_mult32_sh1(-src1[n_short / 2 - i - 1], *win_fwd),
|
||||
ixheaacd_mult32_sh1(ixheaacd_negate32_sat(src1[n_short / 2 - i - 1]),
|
||||
*win_fwd),
|
||||
(fp[n_short - i - 1] >> (shift_olap - shiftp)));
|
||||
win_rev--;
|
||||
win_fwd++;
|
||||
|
|
@ -480,12 +501,14 @@ WORD8 ixheaacd_windowing_short3(WORD32 *src1, WORD32 *win_rev, WORD32 *fp,
|
|||
} else {
|
||||
for (i = 0; i < n_short / 2; i++) {
|
||||
fp[i] = ixheaacd_add32_sat(
|
||||
(ixheaacd_mult32_sh1(-src1[n_short / 2 - i - 1], *win_rev) >>
|
||||
(ixheaacd_mult32_sh1(ixheaacd_negate32_sat(src1[n_short / 2 - i - 1]),
|
||||
*win_rev) >>
|
||||
(shiftp - shift_olap)),
|
||||
fp[i]);
|
||||
|
||||
fp[n_short - i - 1] = ixheaacd_add32_sat(
|
||||
(ixheaacd_mult32_sh1(-src1[n_short / 2 - i - 1], *win_fwd) >>
|
||||
(ixheaacd_mult32_sh1(ixheaacd_negate32_sat(src1[n_short / 2 - i - 1]),
|
||||
*win_fwd) >>
|
||||
(shiftp - shift_olap)),
|
||||
fp[n_short - i - 1]);
|
||||
|
||||
|
|
@ -511,7 +534,8 @@ WORD8 ixheaacd_windowing_short4(WORD32 *src1, WORD32 *win_fwd, WORD32 *fp,
|
|||
fp[i]);
|
||||
|
||||
fp[n_short - i - 1] = ixheaacd_add32_sat(
|
||||
ixheaacd_mult32_sh1(-src1[n_short / 2 + i], *win_rev) >>
|
||||
ixheaacd_mult32_sh1(ixheaacd_negate32_sat(src1[n_short / 2 + i]),
|
||||
*win_rev) >>
|
||||
(shiftp - output_q),
|
||||
fp[n_short - i - 1]);
|
||||
|
||||
|
|
@ -521,12 +545,14 @@ WORD8 ixheaacd_windowing_short4(WORD32 *src1, WORD32 *win_fwd, WORD32 *fp,
|
|||
if (flag == 1) {
|
||||
for (; i < n_short; i++) {
|
||||
fp[i + n_short / 2] = ixheaacd_add32_sat(
|
||||
ixheaacd_mult32_sh1(-src1[n_short - i - 1], *win_fwd1) >>
|
||||
ixheaacd_mult32_sh1(ixheaacd_negate32_sat(src1[n_short - i - 1]),
|
||||
*win_fwd1) >>
|
||||
(shiftp - output_q),
|
||||
(fp[i + n_short / 2] >> (shift_olap - output_q)));
|
||||
|
||||
fp[3 * n_short - n_short / 2 - i - 1] = ixheaacd_add32_sat(
|
||||
ixheaacd_mult32_sh1(-src1[n_short - i - 1], *win_rev1) >>
|
||||
ixheaacd_mult32_sh1(ixheaacd_negate32_sat(src1[n_short - i - 1]),
|
||||
*win_rev1) >>
|
||||
(shiftp - output_q),
|
||||
(fp[3 * n_short - n_short / 2 - i - 1] >> (shift_olap - output_q)));
|
||||
|
||||
|
|
@ -535,11 +561,11 @@ WORD8 ixheaacd_windowing_short4(WORD32 *src1, WORD32 *win_fwd, WORD32 *fp,
|
|||
}
|
||||
} else {
|
||||
for (; i < n_short; i++) {
|
||||
fp[i + n_short / 2] =
|
||||
ixheaacd_add32_sat(-src1[n_short - i - 1] >> (shiftp - output_q),
|
||||
fp[i + n_short / 2] >> (shift_olap - output_q));
|
||||
fp[i + n_short / 2] = ixheaacd_add32_sat(
|
||||
ixheaacd_negate32_sat(src1[n_short - i - 1]) >> (shiftp - output_q),
|
||||
fp[i + n_short / 2] >> (shift_olap - output_q));
|
||||
fp[3 * n_short - n_short / 2 - i - 1] = ixheaacd_add32_sat(
|
||||
-src1[n_short - i - 1] >> (shiftp - output_q),
|
||||
ixheaacd_negate32_sat(src1[n_short - i - 1]) >> (shiftp - output_q),
|
||||
fp[3 * n_short - n_short / 2 - i - 1] >> (shift_olap - output_q));
|
||||
}
|
||||
}
|
||||
|
|
@ -552,7 +578,8 @@ WORD8 ixheaacd_windowing_short4(WORD32 *src1, WORD32 *win_fwd, WORD32 *fp,
|
|||
fp[i] >> (output_q - shift_olap));
|
||||
|
||||
fp[n_short - i - 1] = ixheaacd_add32_sat(
|
||||
ixheaacd_mult32_sh1(-src1[n_short / 2 + i], *win_rev) >>
|
||||
ixheaacd_mult32_sh1(ixheaacd_negate32_sat(src1[n_short / 2 + i]),
|
||||
*win_rev) >>
|
||||
(shiftp - shift_olap),
|
||||
fp[n_short - i - 1]);
|
||||
|
||||
|
|
@ -562,12 +589,14 @@ WORD8 ixheaacd_windowing_short4(WORD32 *src1, WORD32 *win_fwd, WORD32 *fp,
|
|||
if (flag == 1) {
|
||||
for (; i < n_short; i++) {
|
||||
fp[i + n_short / 2] = ixheaacd_add32_sat(
|
||||
ixheaacd_mult32_sh1(-src1[n_short - i - 1], *win_fwd1) >>
|
||||
ixheaacd_mult32_sh1(ixheaacd_negate32_sat(src1[n_short - i - 1]),
|
||||
*win_fwd1) >>
|
||||
(shiftp - shift_olap),
|
||||
fp[i + n_short / 2]);
|
||||
|
||||
fp[3 * n_short - n_short / 2 - i - 1] = ixheaacd_add32_sat(
|
||||
ixheaacd_mult32_sh1(-src1[n_short - i - 1], *win_rev1) >>
|
||||
ixheaacd_mult32_sh1(ixheaacd_negate32_sat(src1[n_short - i - 1]),
|
||||
*win_rev1) >>
|
||||
(shiftp - shift_olap),
|
||||
fp[3 * n_short - n_short / 2 - i - 1]);
|
||||
|
||||
|
|
@ -577,10 +606,12 @@ WORD8 ixheaacd_windowing_short4(WORD32 *src1, WORD32 *win_fwd, WORD32 *fp,
|
|||
} else {
|
||||
for (; i < n_short; i++) {
|
||||
fp[i + n_short / 2] =
|
||||
ixheaacd_add32_sat(-src1[n_short - i - 1] >> (shiftp - shift_olap),
|
||||
ixheaacd_add32_sat(ixheaacd_negate32_sat(src1[n_short - i - 1]) >>
|
||||
(shiftp - shift_olap),
|
||||
fp[i + n_short / 2]);
|
||||
fp[3 * n_short - n_short / 2 - i - 1] =
|
||||
ixheaacd_add32_sat(-src1[n_short - i - 1] >> (shiftp - shift_olap),
|
||||
ixheaacd_add32_sat(ixheaacd_negate32_sat(src1[n_short - i - 1]) >>
|
||||
(shiftp - shift_olap),
|
||||
fp[3 * n_short - n_short / 2 - i - 1]);
|
||||
}
|
||||
}
|
||||
|
|
@ -599,7 +630,26 @@ VOID ixheaacd_scale_down(WORD32 *dest, WORD32 *src, WORD32 len, WORD8 shift1,
|
|||
}
|
||||
} else {
|
||||
for (i = 0; i < len; i++) {
|
||||
*dest = *src << (shift2 - shift1);
|
||||
*dest = ixheaacd_shl32_sat((*src), (shift2 - shift1));
|
||||
src++;
|
||||
dest++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VOID ixheaacd_scale_down_adj(WORD32 *dest, WORD32 *src, WORD32 len,
|
||||
WORD8 shift1, WORD8 shift2) {
|
||||
WORD32 i;
|
||||
if (shift1 > shift2) {
|
||||
for (i = 0; i < len; i++) {
|
||||
*dest = ixheaacd_add32_sat((*src >> (shift1 - shift2)), ADJ_SCALE);
|
||||
src++;
|
||||
dest++;
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < len; i++) {
|
||||
*dest = ixheaacd_add32_sat(ixheaacd_shl32_sat((*src), (shift2 - shift1)),
|
||||
ADJ_SCALE);
|
||||
src++;
|
||||
dest++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ static PLATFORM_INLINE WORD64 ixheaacd_mac32x32in64_dual(WORD32 a, WORD32 b,
|
|||
WORD64 temp_result;
|
||||
|
||||
temp_result = (WORD64)a * (WORD64)b;
|
||||
result = c + (temp_result);
|
||||
result = ixheaacd_add64_sat(c, temp_result);
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -180,11 +180,8 @@ static PLATFORM_INLINE WORD32 ixheaacd_add32_sat(WORD32 a, WORD32 b) {
|
|||
|
||||
sum = (WORD64)a + (WORD64)b;
|
||||
|
||||
if ((((WORD32)a ^ (WORD32)b) & (WORD32)MIN_32) == 0) {
|
||||
if (((WORD32)sum ^ (WORD32)a) & (WORD32)MIN_32) {
|
||||
sum = (a < 0) ? MIN_32 : MAX_32;
|
||||
}
|
||||
}
|
||||
if (sum >= MAX_32) return MAX_32;
|
||||
if (sum <= MIN_32) return MIN_32;
|
||||
|
||||
return (WORD32)sum;
|
||||
}
|
||||
|
|
@ -212,11 +209,8 @@ static PLATFORM_INLINE WORD32 ixheaacd_sub32_sat(WORD32 a, WORD32 b) {
|
|||
|
||||
diff = (WORD64)a - (WORD64)b;
|
||||
|
||||
if ((((WORD32)a ^ (WORD32)b) & (WORD32)MIN_32) != 0) {
|
||||
if (((WORD32)diff ^ (WORD32)a) & (WORD32)MIN_32) {
|
||||
diff = (a < 0L) ? MIN_32 : MAX_32;
|
||||
}
|
||||
}
|
||||
if (diff >= MAX_32) return MAX_32;
|
||||
if (diff <= MIN_32) return MIN_32;
|
||||
|
||||
return (WORD32)diff;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -293,9 +293,9 @@ static PLATFORM_INLINE WORD64 ixheaacd_mac32x32in64(WORD64 sum, WORD32 a,
|
|||
return (sum);
|
||||
}
|
||||
|
||||
static PLATFORM_INLINE WORD64 ixheaacd_mac32x32in64_7(WORD64 sum,
|
||||
const WORD32 *a,
|
||||
static PLATFORM_INLINE WORD64 ixheaacd_mac32x32in64_7(const WORD32 *a,
|
||||
const WORD16 *b) {
|
||||
WORD64 sum;
|
||||
sum = (WORD64)a[0] * (WORD64)b[0];
|
||||
sum += (WORD64)a[1] * (WORD64)b[1];
|
||||
sum += (WORD64)a[2] * (WORD64)b[2];
|
||||
|
|
|
|||
|
|
@ -17,17 +17,18 @@
|
|||
*****************************************************************************
|
||||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include <assert.h>
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include "ixheaacd_type_def.h"
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops16.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops16.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_basic_ops.h"
|
||||
|
||||
#include <ixheaacd_basic_op.h>
|
||||
#include "ixheaacd_basic_op.h"
|
||||
#include "ixheaacd_intrinsics.h"
|
||||
#include "ixheaacd_bitbuffer.h"
|
||||
|
||||
|
|
@ -50,7 +51,7 @@ WORD32 ixheaacd_skip_bits_buf(ia_bit_buf_struct *it_bit_buff, WORD no_of_bits) {
|
|||
UWORD8 *ptr_read_next = it_bit_buff->ptr_read_next;
|
||||
WORD bit_pos = it_bit_buff->bit_pos;
|
||||
|
||||
if (it_bit_buff->cnt_bits < no_of_bits)
|
||||
if (it_bit_buff->cnt_bits < no_of_bits || it_bit_buff->cnt_bits < 0)
|
||||
longjmp(*(it_bit_buff->xaac_jmp_buf),
|
||||
IA_ENHAACPLUS_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
|
||||
it_bit_buff->cnt_bits -= no_of_bits;
|
||||
|
|
@ -73,7 +74,12 @@ WORD32 ixheaacd_show_bits_buf(ia_bit_buf_struct *it_bit_buff, WORD no_of_bits) {
|
|||
UWORD8 *ptr_read_next = it_bit_buff->ptr_read_next;
|
||||
WORD bit_pos = it_bit_buff->bit_pos;
|
||||
|
||||
if (it_bit_buff->cnt_bits < no_of_bits) {
|
||||
if (no_of_bits == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (it_bit_buff->cnt_bits < no_of_bits || it_bit_buff->cnt_bits < 0 ||
|
||||
no_of_bits > 25) {
|
||||
longjmp(*(it_bit_buff->xaac_jmp_buf),
|
||||
IA_ENHAACPLUS_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
|
||||
}
|
||||
|
|
@ -81,7 +87,7 @@ WORD32 ixheaacd_show_bits_buf(ia_bit_buf_struct *it_bit_buff, WORD no_of_bits) {
|
|||
ret_val = (UWORD32)*ptr_read_next;
|
||||
|
||||
bit_pos -= no_of_bits;
|
||||
while (bit_pos < 0) {
|
||||
while (bit_pos < -1) {
|
||||
bit_pos += 8;
|
||||
ptr_read_next++;
|
||||
|
||||
|
|
@ -90,6 +96,12 @@ WORD32 ixheaacd_show_bits_buf(ia_bit_buf_struct *it_bit_buff, WORD no_of_bits) {
|
|||
ret_val |= (UWORD32)*ptr_read_next;
|
||||
}
|
||||
|
||||
if (bit_pos == -1) {
|
||||
bit_pos += 8;
|
||||
ret_val <<= 8;
|
||||
ptr_read_next++;
|
||||
}
|
||||
|
||||
ret_val = ret_val << ((31 - no_of_bits) - bit_pos) >> (32 - no_of_bits);
|
||||
|
||||
return ret_val;
|
||||
|
|
@ -104,7 +116,8 @@ WORD32 ixheaacd_read_bits_buf(ia_bit_buf_struct *it_bit_buff, WORD no_of_bits) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (it_bit_buff->cnt_bits < no_of_bits) {
|
||||
if (it_bit_buff->cnt_bits < no_of_bits || it_bit_buff->cnt_bits < 0 ||
|
||||
no_of_bits > 25) {
|
||||
longjmp(*(it_bit_buff->xaac_jmp_buf),
|
||||
IA_ENHAACPLUS_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
|
||||
}
|
||||
|
|
@ -113,25 +126,19 @@ WORD32 ixheaacd_read_bits_buf(ia_bit_buf_struct *it_bit_buff, WORD no_of_bits) {
|
|||
ret_val = (UWORD32)*ptr_read_next;
|
||||
|
||||
bit_pos -= no_of_bits;
|
||||
if (0 == it_bit_buff->cnt_bits) {
|
||||
while (bit_pos < -1) {
|
||||
bit_pos += 8;
|
||||
ptr_read_next++;
|
||||
ret_val <<= 8;
|
||||
ret_val |= (UWORD32)*ptr_read_next;
|
||||
}
|
||||
while (bit_pos < -1) {
|
||||
bit_pos += 8;
|
||||
ptr_read_next++;
|
||||
|
||||
ret_val <<= 8;
|
||||
|
||||
ret_val |= (UWORD32)*ptr_read_next;
|
||||
}
|
||||
|
||||
if (bit_pos == -1) {
|
||||
bit_pos += 8;
|
||||
ret_val <<= 8;
|
||||
ptr_read_next++;
|
||||
} else {
|
||||
while (bit_pos < 0) {
|
||||
bit_pos += 8;
|
||||
ptr_read_next++;
|
||||
|
||||
ret_val <<= 8;
|
||||
|
||||
ret_val |= (UWORD32)*ptr_read_next;
|
||||
}
|
||||
}
|
||||
|
||||
ret_val = ret_val << ((31 - no_of_bits) - bit_pos) >> (32 - no_of_bits);
|
||||
|
|
@ -232,7 +239,7 @@ WORD32 ixheaacd_aac_read_bit_rev(ia_bit_buf_struct *it_bit_buff) {
|
|||
UWORD32 temp;
|
||||
WORD no_of_bits = 1;
|
||||
|
||||
if (it_bit_buff->cnt_bits < no_of_bits) {
|
||||
if (it_bit_buff->cnt_bits < no_of_bits || it_bit_buff->cnt_bits < 0) {
|
||||
longjmp(*(it_bit_buff->xaac_jmp_buf),
|
||||
IA_ENHAACPLUS_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,17 +18,17 @@
|
|||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops16.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops16.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_basic_ops.h"
|
||||
#include "ixheaacd_common_rom.h"
|
||||
#include "ixheaacd_basic_funcs.h"
|
||||
#include "ixheaacd_defines.h"
|
||||
#include <ixheaacd_aac_rom.h>
|
||||
#include "ixheaacd_aac_rom.h"
|
||||
#include "ixheaacd_bitbuffer.h"
|
||||
#include "ixheaacd_intrinsics.h"
|
||||
#include "ixheaacd_pulsedata.h"
|
||||
|
|
@ -44,7 +44,7 @@
|
|||
#include "ixheaacd_block.h"
|
||||
#include "ixheaacd_channel.h"
|
||||
|
||||
#include <ixheaacd_basic_op.h>
|
||||
#include "ixheaacd_basic_op.h"
|
||||
|
||||
#include "ixheaacd_tns.h"
|
||||
#include "ixheaacd_sbrdecoder.h"
|
||||
|
|
@ -59,7 +59,9 @@ static PLATFORM_INLINE WORD32 ixheaacd_shr32_drc(WORD32 a, WORD32 b) {
|
|||
WORD32 out_val;
|
||||
|
||||
b = ((UWORD32)(b << 24) >> 24);
|
||||
if (b >= 31) {
|
||||
if (b == 0) {
|
||||
out_val = a;
|
||||
} else if (b >= 31) {
|
||||
if (a < 0)
|
||||
out_val = -1;
|
||||
else
|
||||
|
|
|
|||
|
|
@ -19,18 +19,18 @@
|
|||
*/
|
||||
#include <string.h>
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops16.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops16.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_basic_ops.h"
|
||||
|
||||
#include "ixheaacd_bitbuffer.h"
|
||||
#include "ixheaacd_error_codes.h"
|
||||
#include "ixheaacd_defines.h"
|
||||
#include <ixheaacd_aac_rom.h>
|
||||
#include "ixheaacd_aac_rom.h"
|
||||
#include "ixheaacd_pulsedata.h"
|
||||
|
||||
#include "ixheaacd_pns.h"
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
#include "ixheaacd_common_rom.h"
|
||||
#include "ixheaacd_basic_funcs.h"
|
||||
#include <ixheaacd_basic_op.h>
|
||||
#include "ixheaacd_basic_op.h"
|
||||
#include "ixheaacd_intrinsics.h"
|
||||
#include "ixheaacd_stereo.h"
|
||||
|
||||
|
|
@ -67,7 +67,7 @@
|
|||
#include "ixheaacd_sbrdecsettings.h"
|
||||
#include "ixheaacd_sbr_scale.h"
|
||||
#include "ixheaacd_env_extr_part.h"
|
||||
#include <ixheaacd_sbr_rom.h>
|
||||
#include "ixheaacd_sbr_rom.h"
|
||||
#include "ixheaacd_audioobjtypes.h"
|
||||
#include "ixheaacd_sbrdecoder.h"
|
||||
#include "ixheaacd_memory_standards.h"
|
||||
|
|
|
|||
|
|
@ -19,16 +19,15 @@
|
|||
*/
|
||||
#include <string.h>
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops16.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops16.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_bitbuffer.h"
|
||||
#include "ixheaacd_defines.h"
|
||||
#include <ixheaacd_aac_rom.h>
|
||||
#include "ixheaacd_aac_rom.h"
|
||||
#include "ixheaacd_pulsedata.h"
|
||||
|
||||
#include "ixheaacd_pns.h"
|
||||
|
|
@ -50,7 +49,7 @@
|
|||
#include "ixheaacd_sbr_scale.h"
|
||||
#include "ixheaacd_lpp_tran.h"
|
||||
#include "ixheaacd_env_extr_part.h"
|
||||
#include <ixheaacd_sbr_rom.h>
|
||||
#include "ixheaacd_sbr_rom.h"
|
||||
|
||||
#include "ixheaacd_hybrid.h"
|
||||
#include "ixheaacd_ps_dec.h"
|
||||
|
|
@ -75,7 +74,7 @@
|
|||
|
||||
#include "ixheaacd_multichannel.h"
|
||||
|
||||
#include <ixheaacd_basic_op.h>
|
||||
#include "ixheaacd_basic_op.h"
|
||||
#include "ixheaacd_adts_crc_check.h"
|
||||
#include "ixheaacd_function_selector.h"
|
||||
|
||||
|
|
@ -158,30 +157,24 @@ ia_bit_buf_struct *ixheaacd_create_init_bit_buf(ia_bit_buf_struct *it_bit_buff,
|
|||
VOID ixheaacd_read_bidirection(ia_bit_buf_struct *it_bit_buff,
|
||||
WORD32 ixheaacd_drc_offset) {
|
||||
if (ixheaacd_drc_offset != 0) {
|
||||
WORD32 bit_offset;
|
||||
|
||||
WORD32 byte_offset;
|
||||
if ((it_bit_buff->cnt_bits < 0) ||
|
||||
(it_bit_buff->cnt_bits - ixheaacd_drc_offset < 0) ||
|
||||
(it_bit_buff->cnt_bits - ixheaacd_drc_offset > it_bit_buff->size)) {
|
||||
longjmp(*(it_bit_buff->xaac_jmp_buf),
|
||||
IA_ENHAACPLUS_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
|
||||
}
|
||||
it_bit_buff->cnt_bits = it_bit_buff->cnt_bits - ixheaacd_drc_offset;
|
||||
it_bit_buff->bit_pos = it_bit_buff->bit_pos - ixheaacd_drc_offset;
|
||||
bit_offset = it_bit_buff->bit_pos >> 3;
|
||||
it_bit_buff->bit_pos = it_bit_buff->bit_pos - (bit_offset << 3);
|
||||
byte_offset = it_bit_buff->bit_pos >> 3;
|
||||
it_bit_buff->bit_pos = it_bit_buff->bit_pos - (byte_offset << 3);
|
||||
|
||||
if (bit_offset) {
|
||||
if (byte_offset) {
|
||||
UWORD8 *ptr_read_next;
|
||||
WORD32 temp;
|
||||
|
||||
ptr_read_next = it_bit_buff->ptr_read_next;
|
||||
|
||||
ptr_read_next = ptr_read_next - (bit_offset);
|
||||
|
||||
temp = it_bit_buff->ptr_bit_buf_end - it_bit_buff->ptr_bit_buf_base + 1;
|
||||
|
||||
if (ptr_read_next > it_bit_buff->ptr_bit_buf_end) {
|
||||
ptr_read_next -= temp;
|
||||
}
|
||||
|
||||
if (ptr_read_next < it_bit_buff->ptr_bit_buf_base) {
|
||||
ptr_read_next += temp;
|
||||
}
|
||||
ptr_read_next = ptr_read_next - (byte_offset);
|
||||
|
||||
it_bit_buff->ptr_read_next = ptr_read_next;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,18 +17,16 @@
|
|||
*****************************************************************************
|
||||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
#include "string.h"
|
||||
#include <string.h>
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops16.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops16.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_bitbuffer.h"
|
||||
#include "ixheaacd_defines.h"
|
||||
#include <ixheaacd_aac_rom.h>
|
||||
#include "ixheaacd_aac_rom.h"
|
||||
#include "ixheaacd_pulsedata.h"
|
||||
|
||||
#include "ixheaacd_pns.h"
|
||||
|
|
@ -50,7 +48,7 @@
|
|||
#include "ixheaacd_sbr_scale.h"
|
||||
#include "ixheaacd_lpp_tran.h"
|
||||
#include "ixheaacd_env_extr_part.h"
|
||||
#include <ixheaacd_sbr_rom.h>
|
||||
#include "ixheaacd_sbr_rom.h"
|
||||
|
||||
#include "ixheaacd_hybrid.h"
|
||||
#include "ixheaacd_ps_dec.h"
|
||||
|
|
@ -77,7 +75,7 @@
|
|||
|
||||
#include "ixheaacd_multichannel.h"
|
||||
|
||||
#include <ixheaacd_basic_op.h>
|
||||
#include "ixheaacd_basic_op.h"
|
||||
#include "ixheaacd_intrinsics.h"
|
||||
|
||||
static PLATFORM_INLINE UWORD32
|
||||
|
|
@ -217,7 +215,6 @@ VOID ixheaacd_read_data_stream_element(ia_bit_buf_struct *it_bit_buff,
|
|||
}
|
||||
it_bit_buff->ptr_read_next += cnt;
|
||||
it_bit_buff->cnt_bits -= ((cnt) << 3);
|
||||
|
||||
}
|
||||
|
||||
VOID ixheaacd_read_fill_element(ia_bit_buf_struct *it_bit_buff,
|
||||
|
|
@ -250,7 +247,6 @@ VOID ixheaacd_read_fill_element(ia_bit_buf_struct *it_bit_buff,
|
|||
}
|
||||
it_bit_buff->ptr_read_next += count - 1;
|
||||
it_bit_buff->cnt_bits -= ((count - 1) << 3);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,16 +18,16 @@
|
|||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops16.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops16.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_common_rom.h"
|
||||
#include "ixheaacd_basic_funcs.h"
|
||||
#include "ixheaacd_bitbuffer.h"
|
||||
#include "ixheaacd_defines.h"
|
||||
#include <ixheaacd_aac_rom.h>
|
||||
#include "ixheaacd_aac_rom.h"
|
||||
#include "ixheaacd_pulsedata.h"
|
||||
|
||||
#include "ixheaacd_pns.h"
|
||||
|
|
@ -43,7 +43,7 @@
|
|||
#include "ixheaacd_lpp_tran.h"
|
||||
#include "ixheaacd_env_extr_part.h"
|
||||
|
||||
#include <ixheaacd_sbr_rom.h>
|
||||
#include "ixheaacd_sbr_rom.h"
|
||||
#include "ixheaacd_hybrid.h"
|
||||
#include "ixheaacd_ps_dec.h"
|
||||
#include "ixheaacd_env_extr.h"
|
||||
|
|
|
|||
|
|
@ -161,6 +161,7 @@ typedef struct {
|
|||
#define DRC_BAND_COUNT_MAX BAND_COUNT_MAX
|
||||
#define SPEAKER_POS_COUNT_MAX (128)
|
||||
#define DOWNMIX_COEFF_COUNT_MAX (32 * 32)
|
||||
#define MAX_AUDIO_PREROLLS 3
|
||||
|
||||
typedef struct {
|
||||
UINT32 tw_mdct;
|
||||
|
|
@ -185,10 +186,13 @@ typedef struct {
|
|||
WORD32 usac_ext_ele_payload_present[USAC_MAX_ELEMENTS];
|
||||
WORD32 usac_cfg_ext_info_len[USAC_MAX_CONFIG_EXTENSIONS];
|
||||
WORD32 usac_ext_ele_payload_len[USAC_MAX_ELEMENTS];
|
||||
WORD32 usac_ext_gain_payload_len;
|
||||
WORD32 usac_ext_gain_payload_len[MAX_AUDIO_PREROLLS + 2];
|
||||
UWORD8 usac_cfg_ext_info_buf[USAC_MAX_CONFIG_EXTENSIONS][768];
|
||||
UWORD8 usac_ext_ele_payload_buf[USAC_MAX_ELEMENTS][768];
|
||||
UWORD8 usac_ext_gain_payload_buf[768];
|
||||
UWORD8 usac_ext_gain_payload_buf[MAX_AUDIO_PREROLLS * 768];
|
||||
UWORD32 preroll_bytes[MAX_AUDIO_PREROLLS +
|
||||
2]; // Contain the number of bytes in each preroll
|
||||
WORD32 preroll_counter; // count the number of prerolls in a frame.
|
||||
|
||||
WORD32 preroll_flag;
|
||||
|
||||
|
|
|
|||
|
|
@ -63,9 +63,14 @@
|
|||
#define MAX_16 (WORD16)0x7fff
|
||||
#define MIN_16 (WORD16)0x8000
|
||||
|
||||
#define MAX_24 (WORD32)0x007fffff
|
||||
#define MIN_24 (WORD32)0xff800000
|
||||
|
||||
#define NULLPTR ((VOID *)0)
|
||||
|
||||
#define IT_NULL ((VOID *)0)
|
||||
|
||||
#define ADJ_SCALE 11
|
||||
/*****************************************************************************/
|
||||
/* function macros */
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_cnst.h"
|
||||
|
||||
|
|
@ -60,13 +60,12 @@
|
|||
|
||||
#include "ixheaacd_arith_dec.h"
|
||||
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_memory_standards.h"
|
||||
#include "ixheaacd_sbrdecsettings.h"
|
||||
#include "ixheaacd_defines.h"
|
||||
#include <ixheaacd_aac_rom.h>
|
||||
#include "ixheaacd_aac_rom.h"
|
||||
#include "ixheaacd_common_rom.h"
|
||||
#include <ixheaacd_sbr_rom.h>
|
||||
#include "ixheaacd_sbr_rom.h"
|
||||
#include "ixheaacd_bitbuffer.h"
|
||||
#include "ixheaacd_pulsedata.h"
|
||||
#include "ixheaacd_pns.h"
|
||||
|
|
@ -99,19 +98,19 @@
|
|||
#include "ixheaacd_func_def.h"
|
||||
#include "ixheaacd_interface.h"
|
||||
|
||||
extern ia_huff_code_word_struct ixheaacd_huff_book_scl[];
|
||||
extern const ia_huff_code_word_struct ixheaacd_huff_book_scl[];
|
||||
|
||||
extern WORD32 ixheaacd_book_scl_index[];
|
||||
extern WORD16 ixheaacd_book_scl_code_book[];
|
||||
extern const WORD32 ixheaacd_book_scl_index[];
|
||||
extern const WORD16 ixheaacd_book_scl_code_book[];
|
||||
|
||||
extern ia_usac_samp_rate_info ixheaacd_samp_rate_info[];
|
||||
extern const ia_usac_samp_rate_info ixheaacd_samp_rate_info[];
|
||||
extern const WORD32 ixheaacd_sampling_boundaries[(1 << LEN_SAMP_IDX)];
|
||||
|
||||
const WORD32 ixheaacd_sampl_freq_idx_table[17] = {
|
||||
96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000,
|
||||
12000, 11025, 8000, 7350, -1, -1, -1, -1};
|
||||
|
||||
static VOID ixheaacd_info_init(ia_usac_samp_rate_info *ptr_samp_info,
|
||||
static VOID ixheaacd_info_init(const ia_usac_samp_rate_info *ptr_samp_info,
|
||||
WORD32 block_size_samples,
|
||||
ia_sfb_info_struct *pstr_sfb_info_long,
|
||||
ia_sfb_info_struct *pstr_sfb_info_short,
|
||||
|
|
@ -279,8 +278,11 @@ WORD32 ixheaacd_decode_init(
|
|||
|
||||
for (i = 0; i < MAX_NUM_CHANNELS; i++) {
|
||||
usac_data->str_tddec[i] = &usac_data->arr_str_tddec[i];
|
||||
usac_data->str_tddec[i]->fscale =
|
||||
((fscale)*usac_data->ccfl) / LEN_SUPERFRAME;
|
||||
if (usac_data->ccfl == 768)
|
||||
usac_data->str_tddec[i]->fscale = pstr_stream_config->sampling_frequency;
|
||||
else
|
||||
usac_data->str_tddec[i]->fscale =
|
||||
((fscale)*usac_data->ccfl) / LEN_SUPERFRAME;
|
||||
usac_data->len_subfrm = usac_data->ccfl / 4;
|
||||
usac_data->num_subfrm = (MAX_NUM_SUBFR * usac_data->ccfl) / LEN_SUPERFRAME;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,21 +19,20 @@
|
|||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
#include "ixheaacd_constants.h"
|
||||
#include "ixheaacd_error_standards.h"
|
||||
#include "ixheaacd_memory_standards.h"
|
||||
#include "ixheaacd_sbrdecsettings.h"
|
||||
#include "ixheaacd_env_extr_part.h"
|
||||
#include "ixheaacd_defines.h"
|
||||
#include <ixheaacd_aac_rom.h>
|
||||
#include "ixheaacd_aac_rom.h"
|
||||
#include "ixheaacd_common_rom.h"
|
||||
#include <ixheaacd_sbr_rom.h>
|
||||
#include "ixheaacd_sbr_rom.h"
|
||||
#include "ixheaacd_bitbuffer.h"
|
||||
#include "ixheaacd_pulsedata.h"
|
||||
#include "ixheaacd_pns.h"
|
||||
|
||||
#include "ixheaacd_lt_predict.h"
|
||||
|
||||
#include "ixheaacd_channelinfo.h"
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include "ixheaacd_drc_data_struct.h"
|
||||
|
|
@ -45,44 +44,33 @@
|
|||
#include "ixheaacd_latmdemux.h"
|
||||
#include "ixheaacd_aacdec.h"
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
|
||||
#include "ixheaacd_mps_polyphase.h"
|
||||
#include "ixheaacd_config.h"
|
||||
#include "ixheaacd_mps_dec.h"
|
||||
|
||||
#include "ixheaacd_struct_def.h"
|
||||
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_bitbuffer.h"
|
||||
#include "ixheaacd_interface.h"
|
||||
|
||||
#include "ixheaacd_tns_usac.h"
|
||||
#include "ixheaacd_cnst.h"
|
||||
|
||||
#include "ixheaacd_acelp_info.h"
|
||||
|
||||
#include "ixheaacd_sbrdecsettings.h"
|
||||
#include "ixheaacd_info.h"
|
||||
#include "ixheaacd_sbrdecoder.h"
|
||||
#include "ixheaacd_mps_polyphase.h"
|
||||
#include "ixheaacd_sbr_const.h"
|
||||
#include "ixheaacd_main.h"
|
||||
|
||||
#include "ixheaacd_arith_dec.h"
|
||||
|
||||
#include "ixheaacd_config.h"
|
||||
#include "ixheaacd_struct.h"
|
||||
|
||||
#include "ixheaacd_create.h"
|
||||
|
||||
#include "ixheaacd_dec_main.h"
|
||||
|
||||
#include "ixheaacd_error_standards.h"
|
||||
VOID ixheaacd_samples_sat(WORD8 *outbuffer, WORD32 num_samples_out,
|
||||
WORD32 pcmsize, FLOAT32 (*out_samples)[4096],
|
||||
WORD32 *out_bytes, WORD32 num_channel_out) {
|
||||
WORD32 num;
|
||||
WORD32 i;
|
||||
WORD64 write_local;
|
||||
FLOAT32 sample;
|
||||
|
||||
WORD16 *out_buf = (WORD16 *)outbuffer;
|
||||
|
||||
|
|
@ -90,31 +78,30 @@ VOID ixheaacd_samples_sat(WORD8 *outbuffer, WORD32 num_samples_out,
|
|||
|
||||
if (pcmsize == 16) {
|
||||
for (i = 0; i < num; i++) {
|
||||
write_local =
|
||||
((WORD64)(out_samples[i % num_channel_out][i / num_channel_out]));
|
||||
sample = (out_samples[i % num_channel_out][i / num_channel_out]);
|
||||
|
||||
if (write_local > 32767) {
|
||||
write_local = 32767;
|
||||
if (sample > MAX_16) {
|
||||
sample = MAX_16;
|
||||
} else if (sample < MIN_16) {
|
||||
sample = MIN_16;
|
||||
}
|
||||
if (write_local < -32768) {
|
||||
write_local = -32768;
|
||||
}
|
||||
out_buf[i] = (WORD16)write_local;
|
||||
out_buf[i] = (WORD16)sample;
|
||||
}
|
||||
|
||||
*out_bytes = num * sizeof(WORD16);
|
||||
} else {
|
||||
WORD8 *out_24bit = (WORD8 *)out_buf;
|
||||
for (i = 0; i < num; i++) {
|
||||
write_local = ((WORD64)(
|
||||
out_samples[i % num_channel_out][i / num_channel_out] * 256));
|
||||
WORD32 write_local;
|
||||
sample = (out_samples[i % num_channel_out][i / num_channel_out] * 256);
|
||||
|
||||
if (write_local > 8388607) {
|
||||
write_local = 8388607;
|
||||
}
|
||||
if (write_local < -8388608) {
|
||||
write_local = -8388608;
|
||||
if (sample > MAX_24) {
|
||||
sample = MAX_24;
|
||||
} else if (sample < MIN_24) {
|
||||
sample = MIN_24;
|
||||
}
|
||||
write_local = (WORD32)sample;
|
||||
|
||||
*out_24bit++ = (WORD32)write_local & 0xff;
|
||||
*out_24bit++ = ((WORD32)write_local >> 8) & 0xff;
|
||||
*out_24bit++ = ((WORD32)write_local >> 16) & 0xff;
|
||||
|
|
@ -141,8 +128,7 @@ static WORD32 ixheaacd_audio_preroll_parsing(ia_dec_data_struct *pstr_dec_data,
|
|||
WORD32 num_pre_roll_frames = 0;
|
||||
|
||||
WORD32 frame_idx = 0;
|
||||
WORD32 frame_len[18] = {
|
||||
0}; // max of escapedValue(2, 4, 0) i.e. 2^2 -1 + 2^4 -1;
|
||||
WORD32 frame_len[MAX_AUDIO_PREROLLS] = {0};
|
||||
WORD32 temp = 0;
|
||||
|
||||
WORD32 config_len = 0;
|
||||
|
|
@ -196,6 +182,8 @@ static WORD32 ixheaacd_audio_preroll_parsing(ia_dec_data_struct *pstr_dec_data,
|
|||
num_pre_roll_frames += val_add;
|
||||
}
|
||||
|
||||
if (num_pre_roll_frames > MAX_AUDIO_PREROLLS) return IA_FATAL_ERROR;
|
||||
|
||||
for (frame_idx = 0; frame_idx < num_pre_roll_frames; frame_idx++) {
|
||||
WORD32 au_len = 0; // escapedValued(16,16,0)
|
||||
au_len = ixheaacd_read_bits_buf(temp_buff, 16);
|
||||
|
|
@ -259,6 +247,7 @@ WORD32 ixheaacd_dec_main(VOID *temp_handle, WORD8 *inbuffer, WORD8 *outbuffer,
|
|||
}
|
||||
|
||||
{
|
||||
WORD32 tot_out_bytes = 0;
|
||||
pstr_dec_data = (ia_dec_data_struct *)aac_dec_handle->pstr_dec_data;
|
||||
|
||||
if (frames_done == 0) {
|
||||
|
|
@ -297,6 +286,8 @@ WORD32 ixheaacd_dec_main(VOID *temp_handle, WORD8 *inbuffer, WORD8 *outbuffer,
|
|||
config_len = ixheaacd_audio_preroll_parsing(pstr_dec_data, &config[0],
|
||||
&preroll_units,
|
||||
&preroll_frame_offset[0]);
|
||||
|
||||
if (config_len == IA_FATAL_ERROR) return IA_FATAL_ERROR;
|
||||
}
|
||||
|
||||
if (config_len != 0) {
|
||||
|
|
@ -386,25 +377,61 @@ WORD32 ixheaacd_dec_main(VOID *temp_handle, WORD8 *inbuffer, WORD8 *outbuffer,
|
|||
|
||||
num_samples_out = pstr_dec_data->str_usac_data.output_samples;
|
||||
|
||||
ixheaacd_samples_sat(outbuffer, num_samples_out, pcmsize,
|
||||
ixheaacd_samples_sat((WORD8 *)outbuffer + tot_out_bytes, num_samples_out,
|
||||
pcmsize,
|
||||
pstr_dec_data->str_usac_data.time_sample_vector,
|
||||
out_bytes, *num_channel_out);
|
||||
pstr_audio_specific_config->str_usac_config.str_usac_dec_config
|
||||
.usac_ext_gain_payload_len =
|
||||
pstr_dec_data->str_frame_data.str_audio_specific_config
|
||||
.str_usac_config.str_usac_dec_config.usac_ext_gain_payload_len;
|
||||
memcpy(pstr_audio_specific_config->str_usac_config.str_usac_dec_config
|
||||
.usac_ext_gain_payload_buf,
|
||||
pstr_dec_data->str_frame_data.str_audio_specific_config
|
||||
.str_usac_config.str_usac_dec_config.usac_ext_gain_payload_buf,
|
||||
pstr_dec_data->str_frame_data.str_audio_specific_config
|
||||
.str_usac_config.str_usac_dec_config
|
||||
.usac_ext_gain_payload_len *
|
||||
sizeof(WORD8));
|
||||
{
|
||||
WORD32 preroll_counter =
|
||||
pstr_dec_data->str_frame_data.str_audio_specific_config
|
||||
.str_usac_config.str_usac_dec_config.preroll_counter;
|
||||
|
||||
UWORD8 i; // for looping index used for payload calculation
|
||||
WORD32 payload_buffer_offset = 0;
|
||||
WORD32 copy_bytes =
|
||||
pstr_dec_data->str_frame_data.str_audio_specific_config
|
||||
.str_usac_config.str_usac_dec_config
|
||||
.usac_ext_gain_payload_len[preroll_counter] *
|
||||
sizeof(WORD8);
|
||||
|
||||
pstr_audio_specific_config->str_usac_config.str_usac_dec_config
|
||||
.usac_ext_gain_payload_len[preroll_counter] =
|
||||
pstr_dec_data->str_frame_data.str_audio_specific_config
|
||||
.str_usac_config.str_usac_dec_config
|
||||
.usac_ext_gain_payload_len[preroll_counter];
|
||||
|
||||
for (i = 0; i < preroll_counter; i++)
|
||||
payload_buffer_offset +=
|
||||
pstr_dec_data->str_frame_data.str_audio_specific_config
|
||||
.str_usac_config.str_usac_dec_config
|
||||
.usac_ext_gain_payload_len[i] *
|
||||
sizeof(WORD8);
|
||||
|
||||
memcpy(pstr_audio_specific_config->str_usac_config.str_usac_dec_config
|
||||
.usac_ext_gain_payload_buf +
|
||||
payload_buffer_offset,
|
||||
pstr_dec_data->str_frame_data.str_audio_specific_config
|
||||
.str_usac_config.str_usac_dec_config
|
||||
.usac_ext_gain_payload_buf +
|
||||
payload_buffer_offset,
|
||||
copy_bytes);
|
||||
|
||||
pstr_audio_specific_config->str_usac_config.str_usac_dec_config
|
||||
.preroll_bytes[preroll_counter] = *out_bytes;
|
||||
|
||||
preroll_counter++;
|
||||
|
||||
if (preroll_counter > (MAX_AUDIO_PREROLLS + 1)) return IA_FATAL_ERROR;
|
||||
|
||||
pstr_dec_data->str_frame_data.str_audio_specific_config.str_usac_config
|
||||
.str_usac_dec_config.preroll_counter = preroll_counter;
|
||||
}
|
||||
|
||||
access_units++;
|
||||
preroll_units--;
|
||||
tot_out_bytes += (*out_bytes);
|
||||
} while (preroll_units >= 0);
|
||||
*out_bytes = tot_out_bytes;
|
||||
}
|
||||
|
||||
return err;
|
||||
|
|
|
|||
|
|
@ -39,13 +39,18 @@
|
|||
#define IA_MPS_DEC_INPUT_IDX (2)
|
||||
#define IA_MPS_DEC_MPS_INPUT_IDX (3)
|
||||
#define IA_MPS_DEC_OUTPUT_IDX (4)
|
||||
#define IA_MAX_PREROLL_FRAMES (4)
|
||||
#define IA_MAX_OUTPUT_PCM_SIZE (3)
|
||||
#define IA_MAX_USAC_CH (2)
|
||||
#define IA_MAX_OUT_SAMPLES_PER_FRAME (4096)
|
||||
|
||||
#define IA_ENHAACPLUS_DEC_INP_BUF_SIZE (6144 / 8)
|
||||
|
||||
#define IA_ENHAACPLUS_DEC_SAMPLES_PER_FRAME (1024)
|
||||
|
||||
#define IA_ENHAACPLUS_DEC_OUT_BUF_SIZE \
|
||||
(2 * IA_ENHAACPLUS_DEC_SAMPLES_PER_FRAME * sizeof(WORD16))
|
||||
#define IA_ENHAACPLUS_DEC_OUT_BUF_SIZE \
|
||||
(IA_MAX_USAC_CH * IA_MAX_PREROLL_FRAMES * IA_MAX_OUT_SAMPLES_PER_FRAME * \
|
||||
IA_MAX_OUTPUT_PCM_SIZE)
|
||||
|
||||
#define IA_MPS_DEC_INP_BUF_SIZE (0)
|
||||
#define IA_MPS_DEC_OUT_BUF_SIZE (0)
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@
|
|||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
#include <string.h>
|
||||
#include "stdio.h"
|
||||
#include "math.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
|
||||
#include "ixheaacd_cnst.h"
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
#include "ixheaacd_basic_ops.h"
|
||||
#include "ixheaacd_bitbuffer.h"
|
||||
#include "ixheaacd_error_standards.h"
|
||||
#include <ixheaacd_basic_op.h>
|
||||
#include "ixheaacd_basic_op.h"
|
||||
#include "ixheaacd_intrinsics.h"
|
||||
#include "ixheaacd_defines.h"
|
||||
|
||||
|
|
@ -56,9 +56,6 @@
|
|||
|
||||
#include "ixheaacd_sbr_payload.h"
|
||||
#include "ixheaacd_common_rom.h"
|
||||
|
||||
#include <ixheaacd_type_def.h>
|
||||
|
||||
#include "ixheaacd_sbrdecsettings.h"
|
||||
#include "ixheaacd_sbr_scale.h"
|
||||
#include "ixheaacd_env_extr_part.h"
|
||||
|
|
@ -115,7 +112,7 @@ static PLATFORM_INLINE WORD32 ixheaacd_mult32x16in32_shift25(WORD32 a,
|
|||
return (result);
|
||||
}
|
||||
|
||||
static WORD32 ixheaacd_drc_pow_tbl_2_q29[] = {
|
||||
static const WORD32 ixheaacd_drc_pow_tbl_2_q29[] = {
|
||||
536870912, 537242967, 537615991, 537988562, 538361391, 538734479,
|
||||
539108539, 539482144, 539856009, 540230847, 540605230, 540979873,
|
||||
541354776, 541730654, 542106077, 542481760, 542858421, 543234626,
|
||||
|
|
@ -284,7 +281,7 @@ static WORD32 ixheaacd_drc_pow_tbl_2_q29[] = {
|
|||
1066324778, 1067063748, 1067804642, 1068544637, 1069285146, 1070027582,
|
||||
1070769118, 1071511168, 1072253732, 1072998229};
|
||||
|
||||
static WORD32 ixheaacd_drc_pow_tbl_1_2_q29[] = {
|
||||
static const WORD32 ixheaacd_drc_pow_tbl_1_2_q29[] = {
|
||||
536870912, 536499115, 536126866, 535755584, 535384559, 535013791, 534642573,
|
||||
534272319, 533902321, 533531874, 533162389, 532793160, 532424187, 532054765,
|
||||
531686303, 531318096, 530949443, 530581746, 530214304, 529847117, 529479484,
|
||||
|
|
@ -878,7 +875,7 @@ VOID ixheaacd_drc_apply(ia_drc_dec_struct *pstr_drc_dec,
|
|||
WORD32 drc_band, spec_pos, start_pos, end_pos;
|
||||
WORD32 low_hi, drc_norm, drc_freq_fac;
|
||||
WORD32 drc_fac, div_val, mod_val, ret_val, offset_value;
|
||||
WORD32 *table;
|
||||
const WORD32 *table;
|
||||
ixheaac_drc_data_struct *pstr_drc_data;
|
||||
WORD32 num_qmf_sub_sample = (frame_size >> 5);
|
||||
WORD32 num_qmf_sub_sample_by_2 = (frame_size >> 6);
|
||||
|
|
|
|||
|
|
@ -18,18 +18,18 @@
|
|||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops16.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops16.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_basic_ops.h"
|
||||
#include "ixheaacd_common_rom.h"
|
||||
#include "ixheaacd_dsp_fft32x32s.h"
|
||||
#include "ixheaacd_intrinsics.h"
|
||||
|
||||
#include <ixheaacd_basic_op.h>
|
||||
#include "ixheaacd_basic_op.h"
|
||||
|
||||
VOID ixheaacd_inv_dit_fft_8pt_dec(WORD32 *y, WORD32 *real, WORD32 *imag) {
|
||||
WORD32 a0, a1, a2, a3, a00, a10, a20, a30;
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@
|
|||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops16.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops16.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_basic_ops.h"
|
||||
|
||||
#include "ixheaacd_intrinsics.h"
|
||||
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
#include "ixheaacd_pns.h"
|
||||
|
||||
#include <ixheaacd_aac_rom.h>
|
||||
#include "ixheaacd_aac_rom.h"
|
||||
#include "ixheaacd_pulsedata.h"
|
||||
#include "ixheaacd_drc_data_struct.h"
|
||||
|
||||
|
|
@ -47,7 +47,7 @@
|
|||
#include "ixheaacd_lpp_tran.h"
|
||||
|
||||
#include "ixheaacd_env_extr_part.h"
|
||||
#include <ixheaacd_sbr_rom.h>
|
||||
#include "ixheaacd_sbr_rom.h"
|
||||
#include "ixheaacd_hybrid.h"
|
||||
#include "ixheaacd_ps_dec.h"
|
||||
#include "ixheaacd_env_extr.h"
|
||||
|
|
@ -60,7 +60,7 @@
|
|||
#include "ixheaacd_env_extr.h"
|
||||
|
||||
#include "ixheaacd_env_calc.h"
|
||||
#include <ixheaacd_basic_op.h>
|
||||
#include "ixheaacd_basic_op.h"
|
||||
|
||||
#include "ixheaacd_qmf_dec.h"
|
||||
|
||||
|
|
@ -664,7 +664,7 @@ VOID ixheaacd_calc_subband_gains(ia_freq_band_data_struct *pstr_freq_band_data,
|
|||
|
||||
#define ALIGN_SIZE64(x) ((((x) + 7) >> 3) << 3)
|
||||
|
||||
VOID ixheaacd_calc_sbrenvelope(
|
||||
IA_ERRORCODE ixheaacd_calc_sbrenvelope(
|
||||
ia_sbr_scale_fact_struct *ptr_sbr_scale_fac,
|
||||
ia_sbr_calc_env_struct *ptr_sbr_calc_env,
|
||||
ia_sbr_header_data_struct *ptr_header_data,
|
||||
|
|
@ -681,7 +681,7 @@ VOID ixheaacd_calc_sbrenvelope(
|
|||
WORD32 freq_res;
|
||||
WORD32 num_env = ptr_frame_data->str_frame_info_details.num_env;
|
||||
WORD16 *ptr_border_vec = ptr_frame_data->str_frame_info_details.border_vec;
|
||||
|
||||
IA_ERRORCODE err_code = IA_NO_ERROR;
|
||||
WORD16 *ptr_noise_floor;
|
||||
ia_freq_band_data_struct *pstr_freq_band_data =
|
||||
ptr_header_data->pstr_freq_band_data;
|
||||
|
|
@ -809,8 +809,12 @@ VOID ixheaacd_calc_sbrenvelope(
|
|||
start_pos = SBR_TIME_STEP * ptr_border_vec[i];
|
||||
end_pos = SBR_TIME_STEP * ptr_border_vec[i + 1];
|
||||
}
|
||||
if ((start_pos >= MAX_ENV_COLS) || (end_pos > MAX_ENV_COLS))
|
||||
return IA_FATAL_ERROR;
|
||||
freq_res = ptr_frame_data->str_frame_info_details.freq_res[i];
|
||||
|
||||
if (noise_floor_idx >= MAX_NOISE_ENVELOPES) return IA_FATAL_ERROR;
|
||||
|
||||
if (ptr_border_vec[i] ==
|
||||
ptr_frame_data->str_frame_info_details
|
||||
.noise_border_vec[noise_floor_idx + 1]) {
|
||||
|
|
@ -944,6 +948,7 @@ VOID ixheaacd_calc_sbrenvelope(
|
|||
} else {
|
||||
ptr_sbr_calc_env->tansient_env_prev = -1;
|
||||
}
|
||||
return err_code;
|
||||
}
|
||||
|
||||
VOID ixheaacd_equalize_filt_buff_exp(WORD16 *ptr_filt_buf, WORD16 *nrg_gain,
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ typedef struct {
|
|||
WORD16 harm_index;
|
||||
} ia_sbr_calc_env_struct;
|
||||
|
||||
VOID ixheaacd_calc_sbrenvelope(
|
||||
IA_ERRORCODE ixheaacd_calc_sbrenvelope(
|
||||
ia_sbr_scale_fact_struct *sbr_scale_factor,
|
||||
ia_sbr_calc_env_struct *ptr_sbr_calc_env,
|
||||
ia_sbr_header_data_struct *ptr_header_data,
|
||||
|
|
|
|||
|
|
@ -18,36 +18,31 @@
|
|||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
#include "ixheaacd_error_standards.h"
|
||||
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops16.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops16.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_basic_ops.h"
|
||||
|
||||
#include <ixheaacd_basic_op.h>
|
||||
#include "ixheaacd_basic_op.h"
|
||||
#include "ixheaacd_intrinsics.h"
|
||||
#include "ixheaacd_bitbuffer.h"
|
||||
#include "ixheaacd_sbrdecsettings.h"
|
||||
#include "ixheaacd_sbr_scale.h"
|
||||
#include "ixheaacd_lpp_tran.h"
|
||||
#include "ixheaacd_env_extr_part.h"
|
||||
#include <ixheaacd_sbr_rom.h>
|
||||
#include "ixheaacd_sbr_rom.h"
|
||||
#include "ixheaacd_hybrid.h"
|
||||
#include "ixheaacd_ps_dec.h"
|
||||
|
||||
#include "ixheaacd_env_extr.h"
|
||||
#include "ixheaacd_common_rom.h"
|
||||
#include "ixheaacd_env_dec.h"
|
||||
#include "ixheaacd_sbr_const.h"
|
||||
|
||||
#include "ixheaacd_basic_funcs.h"
|
||||
|
||||
#include "math.h"
|
||||
|
||||
#define add16_m(a, b) ((a) + (b))
|
||||
#define sub16_m(a, b) ((a) - (b))
|
||||
|
||||
|
|
@ -58,7 +53,7 @@ static VOID ixheaacd_dequant_esbr_env_data(FLOAT32 *ptr_env_sf,
|
|||
WORD32 num_noise_fac, WORD32 amp_res,
|
||||
FLOAT32 *ptr_noise_floor) {
|
||||
WORD32 i;
|
||||
FLOAT32 array[2] = {0.5f, 1.0f};
|
||||
static const FLOAT32 array[2] = {0.5f, 1.0f};
|
||||
FLOAT32 a_flt = array[amp_res];
|
||||
|
||||
for (i = 0; i < num_env_sf; i++) {
|
||||
|
|
@ -328,7 +323,7 @@ VOID ixheaacd_dequant_env_data(ia_sbr_frame_info_data_struct *ptr_sbr_data,
|
|||
WORD32 exponent;
|
||||
WORD32 exp_add = (7 + NRG_EXP_OFFSET);
|
||||
WORD16 *ptr_env_sf = ptr_sbr_data->int_env_sf_arr;
|
||||
WORD32 mant_arr[2] = {0x4000, 0x5a80};
|
||||
static const WORD32 mant_arr[2] = {0x4000, 0x5a80};
|
||||
|
||||
amp_res_1 = (1 - amp_res);
|
||||
|
||||
|
|
@ -433,7 +428,8 @@ IA_ERRORCODE ixheaacd_calc_noise_floor(
|
|||
|
||||
memcpy(ptr2, ptr1, sizeof(WORD16) * (num_nf_bands));
|
||||
|
||||
if (ptr_sbr_data->coupling_mode != COUPLING_BAL) {
|
||||
if ((ptr_sbr_data->coupling_mode != COUPLING_BAL) ||
|
||||
(ptr_header_data->usac_flag)) {
|
||||
WORD32 noise_floor_exp, tot_nf_bands;
|
||||
|
||||
tot_nf_bands = (num_nf_bands * num_noise_env);
|
||||
|
|
@ -551,8 +547,8 @@ VOID ixheaacd_sbr_env_dequant_coup(
|
|||
|
||||
WORD32 i;
|
||||
FLOAT32 temp_l, temp_r;
|
||||
FLOAT32 pan_offset[2] = {24.0f, 12.0f};
|
||||
FLOAT32 a_arr[2] = {0.5f, 1.0f};
|
||||
static const FLOAT32 pan_offset[2] = {24.0f, 12.0f};
|
||||
static const FLOAT32 a_arr[2] = {0.5f, 1.0f};
|
||||
|
||||
FLOAT32 a = a_arr[amp_res];
|
||||
|
||||
|
|
@ -648,6 +644,9 @@ WORD32 ixheaacd_dec_sbrdata(ia_sbr_header_data_struct *ptr_header_data_ch_0,
|
|||
}
|
||||
|
||||
if (ptr_sbr_data_ch_0->coupling_mode) {
|
||||
ptr_sbr_data_ch_0->num_noise_sfac =
|
||||
ptr_header_data_ch_1->pstr_freq_band_data->num_nf_bands *
|
||||
ptr_sbr_data_ch_1->str_frame_info_details.num_noise_env;
|
||||
ixheaacd_sbr_env_dequant_coup_fix(ptr_header_data_ch_0, ptr_sbr_data_ch_0,
|
||||
ptr_sbr_data_ch_1, ptr_common_tables);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,16 +18,17 @@
|
|||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops16.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops16.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_basic_ops.h"
|
||||
|
||||
#include <ixheaacd_basic_op.h>
|
||||
#include "ixheaacd_basic_op.h"
|
||||
#include "ixheaacd_intrinsics.h"
|
||||
#include "ixheaacd_common_rom.h"
|
||||
#include "ixheaacd_basic_funcs.h"
|
||||
|
|
@ -40,13 +41,11 @@
|
|||
#include "ixheaacd_sbr_scale.h"
|
||||
#include "ixheaacd_lpp_tran.h"
|
||||
#include "ixheaacd_env_extr_part.h"
|
||||
#include <ixheaacd_sbr_rom.h>
|
||||
#include "ixheaacd_sbr_rom.h"
|
||||
#include "ixheaacd_hybrid.h"
|
||||
#include "ixheaacd_ps_dec.h"
|
||||
#include "ixheaacd_env_extr.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "ixheaacd_sbr_const.h"
|
||||
#include "ixheaacd_intrinsics.h"
|
||||
|
||||
|
|
@ -1551,7 +1550,7 @@ WORD16 ixheaacd_sbr_time_freq_grid_info(
|
|||
bs_var_bord = 0, temp = 0;
|
||||
WORD32 freq_res_0 = 0, frame_class;
|
||||
WORD32 abs_bord_lead, abs_bord_trail, num_rel_trail, num_rel_lead;
|
||||
WORD32 pointer_bits_array[7] = {1, 2, 2, 3, 3, 3, 3};
|
||||
static const WORD32 pointer_bits_array[7] = {1, 2, 2, 3, 3, 3, 3};
|
||||
ia_frame_info_struct *p_fixfix_tab;
|
||||
ia_frame_info_struct *p_frame_info = &ptr_frame_data->str_frame_info_details;
|
||||
|
||||
|
|
@ -1733,4 +1732,4 @@ WORD16 ixheaacd_sbr_time_freq_grid_info(
|
|||
p_frame_info->border_vec[bs_num_env];
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -31,6 +31,7 @@
|
|||
#define ROUNDING (1 << (EXP_BITS - 1))
|
||||
#define NRG_EXP_OFFSET 16
|
||||
#define NOISE_EXP_OFFSET 38
|
||||
#define MAX_QMF_SUB_BANDS 64
|
||||
|
||||
typedef const UWORD16 *ia_huffman_data_type;
|
||||
|
||||
|
|
@ -100,13 +101,13 @@ typedef struct {
|
|||
WORD32 gate_mode[4];
|
||||
WORD8 harm_flag_varlen_prev[64];
|
||||
WORD8 harm_flag_varlen[64];
|
||||
FLOAT32 qmapped_pvc[64][48];
|
||||
FLOAT32 env_tmp[64][48];
|
||||
FLOAT32 noise_level_pvc[64][48];
|
||||
FLOAT32 nrg_est_pvc[64][48];
|
||||
FLOAT32 nrg_ref_pvc[64][48];
|
||||
FLOAT32 nrg_gain_pvc[64][48];
|
||||
FLOAT32 nrg_tone_pvc[64][48];
|
||||
FLOAT32 qmapped_pvc[MAX_QMF_SUB_BANDS][MAX_FREQ_COEFFS_SBR];
|
||||
FLOAT32 env_tmp[MAX_QMF_SUB_BANDS][MAX_FREQ_COEFFS_SBR];
|
||||
FLOAT32 noise_level_pvc[MAX_QMF_SUB_BANDS][MAX_FREQ_COEFFS_SBR];
|
||||
FLOAT32 nrg_est_pvc[MAX_QMF_SUB_BANDS][MAX_FREQ_COEFFS_SBR];
|
||||
FLOAT32 nrg_ref_pvc[MAX_QMF_SUB_BANDS][MAX_FREQ_COEFFS_SBR];
|
||||
FLOAT32 nrg_gain_pvc[MAX_QMF_SUB_BANDS][MAX_FREQ_COEFFS_SBR];
|
||||
FLOAT32 nrg_tone_pvc[MAX_QMF_SUB_BANDS][MAX_FREQ_COEFFS_SBR];
|
||||
WORD32 stereo_config_idx;
|
||||
FLAG reset_flag;
|
||||
FLAG mps_sbr_flag;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@
|
|||
#define IA_ERROR_CLASS_E 0xE
|
||||
#define IA_ERROR_CLASS_F 0xF
|
||||
|
||||
#define IA_MAX_ERROR_SUB_CODE 28
|
||||
|
||||
typedef struct {
|
||||
pWORD8 pb_module_name;
|
||||
pWORD8 ppb_class_names[16];
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
#include "ixheaacd_error_standards.h"
|
||||
#include "ixheaacd_sbr_const.h"
|
||||
#include "ixheaacd_sbrdecsettings.h"
|
||||
|
|
@ -30,11 +30,9 @@
|
|||
#include "ixheaacd_drc_data_struct.h"
|
||||
#include "ixheaacd_drc_dec.h"
|
||||
#include "ixheaacd_sbrdecoder.h"
|
||||
|
||||
#include "ixheaacd_bitbuffer.h"
|
||||
|
||||
#include "ixheaacd_env_extr_part.h"
|
||||
#include <ixheaacd_sbr_rom.h>
|
||||
#include "ixheaacd_sbr_rom.h"
|
||||
#include "ixheaacd_common_rom.h"
|
||||
#include "ixheaacd_hybrid.h"
|
||||
#include "ixheaacd_sbr_scale.h"
|
||||
|
|
@ -45,6 +43,8 @@
|
|||
|
||||
#include "ixheaacd_esbr_rom.h"
|
||||
|
||||
#define ABS(A) fabs(A)
|
||||
|
||||
VOID ixheaacd_shellsort(WORD32 *in, WORD32 n) {
|
||||
WORD32 i, j, v;
|
||||
WORD32 inc = 1;
|
||||
|
|
@ -207,12 +207,14 @@ WORD32 ixheaacd_sbr_env_calc(ia_sbr_frame_info_data_struct *frame_data,
|
|||
}
|
||||
|
||||
for (i = 0; i < bs_num_env; i++) {
|
||||
if (kk > MAX_NOISE_ENVELOPES) return IA_FATAL_ERROR;
|
||||
if (p_frame_info->border_vec[i] == p_frame_info->noise_border_vec[kk])
|
||||
kk++, next++;
|
||||
|
||||
start_pos = p_frame_info->border_vec[i];
|
||||
end_pos = p_frame_info->border_vec[i + 1];
|
||||
|
||||
if ((start_pos < 0) || (end_pos > MAX_FREQ_COEFFS_SBR))
|
||||
return IA_FATAL_ERROR;
|
||||
for (t = start_pos; t < end_pos; t++) {
|
||||
band_loop_end = num_sf_bands[p_frame_info->freq_res[i]];
|
||||
|
||||
|
|
@ -224,6 +226,7 @@ WORD32 ixheaacd_sbr_env_calc(ia_sbr_frame_info_data_struct *frame_data,
|
|||
|
||||
for (k = 0; k < ui - li; k++) {
|
||||
o = (k + li >= ui2) ? o + 1 : o;
|
||||
if (o >= MAX_NOISE_COEFFS) return IA_FATAL_ERROR;
|
||||
ui2 = freq_band_table_noise[o + 1];
|
||||
|
||||
frame_data->qmapped_pvc[c][t] =
|
||||
|
|
@ -238,12 +241,14 @@ WORD32 ixheaacd_sbr_env_calc(ia_sbr_frame_info_data_struct *frame_data,
|
|||
next = -1;
|
||||
|
||||
for (i = 0; i < bs_num_env; i++) {
|
||||
if (kk > MAX_NOISE_ENVELOPES) return IA_FATAL_ERROR;
|
||||
if (p_frame_info->border_vec[i] == p_frame_info->noise_border_vec[kk])
|
||||
kk++, next++;
|
||||
|
||||
start_pos = pvc_frame_info->border_vec[i];
|
||||
end_pos = pvc_frame_info->border_vec[i + 1];
|
||||
|
||||
if ((start_pos < 0) || (end_pos > MAX_FREQ_COEFFS_SBR))
|
||||
return IA_FATAL_ERROR;
|
||||
for (t = start_pos; t < end_pos; t++) {
|
||||
for (c = 0; c < 64; c++) {
|
||||
env_tmp[c][t] = env_out[64 * t + c];
|
||||
|
|
@ -301,6 +306,7 @@ WORD32 ixheaacd_sbr_env_calc(ia_sbr_frame_info_data_struct *frame_data,
|
|||
|
||||
for (k = 0; k < ui - li; k++) {
|
||||
o = (k + li >= ui2) ? o + 1 : o;
|
||||
if (o >= MAX_NOISE_COEFFS) return IA_FATAL_ERROR;
|
||||
ui2 = freq_band_table_noise[o + 1];
|
||||
nrg_est_pvc[c][t] = (!int_mode) ? nrg : nrg_est_pvc[c][t];
|
||||
nrg_tone_pvc[c][t] = 0.0f;
|
||||
|
|
@ -419,6 +425,7 @@ WORD32 ixheaacd_sbr_env_calc(ia_sbr_frame_info_data_struct *frame_data,
|
|||
|
||||
for (k = 0; k < ui - li; k++) {
|
||||
o = (k + li >= ui2) ? o + 1 : o;
|
||||
if (o >= MAX_NOISE_COEFFS) return IA_FATAL_ERROR;
|
||||
ui2 = freq_band_table_noise[o + 1];
|
||||
nrg_est_pvc[c][t] = (!int_mode) ? nrg : nrg_est_pvc[c][t];
|
||||
nrg_tone_pvc[c][t] = 0.0f;
|
||||
|
|
@ -610,7 +617,9 @@ WORD32 ixheaacd_sbr_env_calc(ia_sbr_frame_info_data_struct *frame_data,
|
|||
c -= (ui - li);
|
||||
|
||||
for (k = 0; k < ui - li; k++) {
|
||||
FLOAT64 guard = 1e-17;
|
||||
o = (k + li >= ui2) ? o + 1 : o;
|
||||
if (o >= MAX_NOISE_COEFFS) return IA_FATAL_ERROR;
|
||||
ui2 = frame_data->pstr_sbr_header->pstr_freq_band_data
|
||||
->freq_band_tbl_noise[o + 1];
|
||||
nrg_ref[c] = sfb_nrg[m];
|
||||
|
|
@ -624,16 +633,16 @@ WORD32 ixheaacd_sbr_env_calc(ia_sbr_frame_info_data_struct *frame_data,
|
|||
(harmonics[c] &&
|
||||
(i >= trans_env || (*harm_flag_prev)[c + sub_band_start]))
|
||||
? sqrt(nrg_ref[c] * tmp /
|
||||
noise_floor[next * num_nf_bands + o])
|
||||
ABS(noise_floor[next * num_nf_bands + o] + guard))
|
||||
: nrg_tone[c]);
|
||||
} else {
|
||||
if (noise_absc_flag)
|
||||
nrg_gain[c] = (FLOAT32)sqrt(nrg_ref[c] / (nrg_est[c] + 1));
|
||||
else
|
||||
nrg_gain[c] =
|
||||
(FLOAT32)sqrt(nrg_ref[c] * tmp /
|
||||
((nrg_est[c] + 1) *
|
||||
(noise_floor[next * num_nf_bands + o])));
|
||||
nrg_gain[c] = (FLOAT32)sqrt(
|
||||
nrg_ref[c] * tmp /
|
||||
((nrg_est[c] + 1) *
|
||||
ABS(noise_floor[next * num_nf_bands + o] + guard)));
|
||||
}
|
||||
noise_level[c] = (FLOAT32)sqrt(nrg_ref[c] * tmp);
|
||||
c++;
|
||||
|
|
@ -778,6 +787,10 @@ WORD32 ixheaacd_sbr_env_calc(ia_sbr_frame_info_data_struct *frame_data,
|
|||
frame_data->var_len_id_prev = 1;
|
||||
}
|
||||
|
||||
if ((frame_data->str_frame_info_details.num_noise_env < 1) ||
|
||||
(frame_data->str_frame_info_details.num_noise_env > 2))
|
||||
return IA_FATAL_ERROR;
|
||||
|
||||
for (i = 0; i < num_nf_bands; i++) {
|
||||
prev_env_noise_level[i] =
|
||||
frame_data->flt_noise_floor
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
|
||||
#define PLATFORM_INLINE __inline
|
||||
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
(j) = _ >> (m); \
|
||||
} while (0)
|
||||
|
||||
extern FLOAT32 ixheaacd_twiddle_table_fft_float[514];
|
||||
extern const FLOAT32 ixheaacd_twiddle_table_fft_float[514];
|
||||
const FLOAT32 ixheaacd_twidle_tbl_48[64];
|
||||
const FLOAT32 ixheaacd_twidle_tbl_24[32];
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@
|
|||
*****************************************************************************
|
||||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include <string.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
#include "ixheaacd_bitbuffer.h"
|
||||
#include "ixheaacd_interface.h"
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
|
|
@ -28,7 +29,7 @@
|
|||
#include "ixheaacd_sbrdecsettings.h"
|
||||
#include "ixheaacd_sbrdecoder.h"
|
||||
#include "ixheaacd_env_extr_part.h"
|
||||
#include <ixheaacd_sbr_rom.h>
|
||||
#include "ixheaacd_sbr_rom.h"
|
||||
#include "ixheaacd_common_rom.h"
|
||||
#include "ixheaacd_hybrid.h"
|
||||
#include "ixheaacd_sbr_scale.h"
|
||||
|
|
@ -44,8 +45,6 @@
|
|||
#include "ixheaacd_qmf_poly.h"
|
||||
#include "ixheaacd_esbr_rom.h"
|
||||
|
||||
#include "string.h"
|
||||
|
||||
WORD32 ixheaacd_complex_anal_filt(ia_esbr_hbe_txposer_struct *ptr_hbe_txposer) {
|
||||
WORD32 idx;
|
||||
WORD32 anal_size = 2 * ptr_hbe_txposer->synth_size;
|
||||
|
|
@ -252,4 +251,4 @@ WORD32 ixheaacd_real_synth_filt(ia_esbr_hbe_txposer_struct *ptr_hbe_txposer,
|
|||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -17,8 +17,9 @@
|
|||
*****************************************************************************
|
||||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
#include "ixheaacd_sbr_const.h"
|
||||
#include "ixheaacd_esbr_rom.h"
|
||||
|
||||
const FLOAT32 ixheaacd_sub_samp_qmf_window_coeff[40 + 80 + 120 + 160 + 200 +
|
||||
240 + 320 + 400] = {
|
||||
|
|
@ -941,19 +942,18 @@ const FLOAT32 ixheaacd_hphase_tbl[2][8] = {{1.0f, 0.0f, -1.0f, 0.0f},
|
|||
|
||||
const FLOAT32 ixheaacd_g_lim_gains[4] = {0.70795f, 1.0f, 1.41254f, 1e10f};
|
||||
|
||||
typedef const FLOAT32 FIR_FILTER[5];
|
||||
FIR_FILTER ixheaacd_fir_0 = {1.0f};
|
||||
FIR_FILTER ixheaacd_fir_1 = {0.33333333333333f, 0.66666666666666f};
|
||||
FIR_FILTER ixheaacd_fir_2 = {0.12500000000000f, 0.37500000000000f,
|
||||
0.50000000000000f};
|
||||
FIR_FILTER ixheaacd_fir_3 = {0.05857864376269f, 0.20000000000000f,
|
||||
0.34142135623731f, 0.40000000000000f};
|
||||
FIR_FILTER ixheaacd_fir_4 = {0.03183050093751f, 0.11516383427084f,
|
||||
0.21816949906249f, 0.30150283239582f,
|
||||
0.33333333333333f};
|
||||
FIR_FILTER *ixheaacd_fir_table[5] = {&ixheaacd_fir_0, &ixheaacd_fir_1,
|
||||
&ixheaacd_fir_2, &ixheaacd_fir_3,
|
||||
&ixheaacd_fir_4};
|
||||
const FIR_FILTER ixheaacd_fir_0 = {1.0f};
|
||||
const FIR_FILTER ixheaacd_fir_1 = {0.33333333333333f, 0.66666666666666f};
|
||||
const FIR_FILTER ixheaacd_fir_2 = {0.12500000000000f, 0.37500000000000f,
|
||||
0.50000000000000f};
|
||||
const FIR_FILTER ixheaacd_fir_3 = {0.05857864376269f, 0.20000000000000f,
|
||||
0.34142135623731f, 0.40000000000000f};
|
||||
const FIR_FILTER ixheaacd_fir_4 = {0.03183050093751f, 0.11516383427084f,
|
||||
0.21816949906249f, 0.30150283239582f,
|
||||
0.33333333333333f};
|
||||
const FIR_FILTER* const ixheaacd_fir_table[5] = {
|
||||
&ixheaacd_fir_0, &ixheaacd_fir_1, &ixheaacd_fir_2, &ixheaacd_fir_3,
|
||||
&ixheaacd_fir_4};
|
||||
const FLOAT32 ixheaacd_q_gamma_table[4] = {0.0f, 1.0f, 2.0f, 4.0f};
|
||||
|
||||
const WORD32 ixheaacd_start_subband2kL_tbl[33] = {
|
||||
|
|
|
|||
|
|
@ -27,13 +27,13 @@ extern const FLOAT32 ixheaacd_hphase_tbl[2][8];
|
|||
|
||||
extern const FLOAT32 ixheaacd_g_lim_gains[4];
|
||||
|
||||
typedef const FLOAT32 FIR_FILTER[5];
|
||||
extern FIR_FILTER ixheaacd_fir_0;
|
||||
extern FIR_FILTER ixheaacd_fir_1;
|
||||
extern FIR_FILTER ixheaacd_fir_2;
|
||||
extern FIR_FILTER ixheaacd_fir_3;
|
||||
extern FIR_FILTER ixheaacd_fir_4;
|
||||
extern FIR_FILTER *ixheaacd_fir_table[5];
|
||||
typedef FLOAT32 FIR_FILTER[5];
|
||||
extern const FIR_FILTER ixheaacd_fir_0;
|
||||
extern const FIR_FILTER ixheaacd_fir_1;
|
||||
extern const FIR_FILTER ixheaacd_fir_2;
|
||||
extern const FIR_FILTER ixheaacd_fir_3;
|
||||
extern const FIR_FILTER ixheaacd_fir_4;
|
||||
extern const FIR_FILTER* const ixheaacd_fir_table[5];
|
||||
extern const FLOAT32 ixheaacd_q_gamma_table[4];
|
||||
extern const WORD32 ixheaacd_start_subband2kL_tbl[33];
|
||||
extern const FLOAT32 ixheaacd_cos_table_trans_qmf[7][32 * 2];
|
||||
|
|
@ -47,15 +47,15 @@ extern const FLOAT32 ixheaacd_hbe_x_prod_cos_table_trans_3[2 * (128 + 128)];
|
|||
extern const FLOAT32 ixheaacd_hbe_x_prod_cos_table_trans_4[2 * (128 + 128)];
|
||||
extern const FLOAT32 ixheaacd_hbe_x_prod_cos_table_trans_4_1[2 * (128 + 128)];
|
||||
|
||||
extern const FLOAT32 ixheaacd_synth_cos_table_kl_4[8 * 4];
|
||||
extern const FLOAT32 ixheaacd_synth_cos_table_kl_8[16 * 8];
|
||||
extern const FLOAT32 ixheaacd_synth_cos_table_kl_12[24 * 12];
|
||||
extern const FLOAT32 ixheaacd_synth_cos_table_kl_16[32 * 16];
|
||||
extern const FLOAT32 ixheaacd_synth_cos_table_kl_4[16];
|
||||
extern const FLOAT32 ixheaacd_synth_cos_table_kl_8[32];
|
||||
extern const FLOAT32 ixheaacd_synth_cos_table_kl_12[48];
|
||||
extern const FLOAT32 ixheaacd_synth_cos_table_kl_16[64];
|
||||
extern const FLOAT32 ixheaacd_synth_cos_table_kl_20[40 * 20];
|
||||
extern const FLOAT32 ixheaacd_analy_cos_sin_table_kl_8[8 * 8 * 2];
|
||||
extern const FLOAT32 ixheaacd_analy_cos_sin_table_kl_16[16 * 16 * 2];
|
||||
extern const FLOAT32 ixheaacd_analy_cos_sin_table_kl_24[24 * 24 * 2];
|
||||
extern const FLOAT32 ixheaacd_analy_cos_sin_table_kl_32[32 * 32 * 2];
|
||||
extern const FLOAT32 ixheaacd_analy_cos_sin_table_kl_40[40 * 80 * 2];
|
||||
extern const FLOAT32 ixheaacd_analy_cos_sin_table_kl_8[32];
|
||||
extern const FLOAT32 ixheaacd_analy_cos_sin_table_kl_16[64];
|
||||
extern const FLOAT32 ixheaacd_analy_cos_sin_table_kl_24[96];
|
||||
extern const FLOAT32 ixheaacd_analy_cos_sin_table_kl_32[128];
|
||||
extern const FLOAT32 ixheaacd_analy_cos_sin_table_kl_40[40 * 40 * 2];
|
||||
extern const FLOAT32 ixheaacd_sel_case[5][8];
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_cnst.h"
|
||||
|
||||
|
|
@ -50,9 +50,8 @@
|
|||
#include "ixheaacd_bit_extract.h"
|
||||
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
|
||||
#include "ixheaacd_func_def.h"
|
||||
|
||||
|
|
@ -70,7 +69,7 @@ const WORD16 ixheaacd_mdst_fcoeff_long_sin_kbd[] = {-1499, -1876, -17718, 0,
|
|||
const WORD16 ixheaacd_mdst_fcoeff_long_kbd_sin[] = {-1499, 1876, -17718, 0,
|
||||
17718, -1876, 1499};
|
||||
|
||||
const WORD16 *ixheaacd_mdst_fcoeff_longshort_curr[2][2] = {
|
||||
const WORD16 *const ixheaacd_mdst_fcoeff_longshort_curr[2][2] = {
|
||||
{ixheaacd_mdst_fcoeff_long_sin, ixheaacd_mdst_fcoeff_long_sin_kbd},
|
||||
{ixheaacd_mdst_fcoeff_long_kbd_sin, ixheaacd_mdst_fcoeff_long_kbd}};
|
||||
|
||||
|
|
@ -83,7 +82,7 @@ const WORD16 ixheaacd_mdst_fcoeff_start_sin_kbd[] = {-3433, -3447, -18608, 0,
|
|||
const WORD16 ixheaacd_mdst_fcoeff_start_kbd_sin[] = {-4863, -1525, -19918, 0,
|
||||
19918, 1525, 4863};
|
||||
|
||||
const WORD16 *ixheaacd_mdst_fcoeff_start_curr[2][2] = {
|
||||
const WORD16 *const ixheaacd_mdst_fcoeff_start_curr[2][2] = {
|
||||
{ixheaacd_mdst_fcoeff_start_sin, ixheaacd_mdst_fcoeff_start_sin_kbd},
|
||||
{ixheaacd_mdst_fcoeff_start_kbd_sin, ixheaacd_mdst_fcoeff_start_kbd}};
|
||||
|
||||
|
|
@ -96,7 +95,7 @@ const WORD16 ixheaacd_mdst_fcoeff_stop_sin_kbd[] = {-4863, 1525, -19918, 0,
|
|||
const WORD16 ixheaacd_mdst_fcoeff_stop_kbd_sin[] = {-3433, 3447, -18608, 0,
|
||||
18608, -3447, 3433};
|
||||
|
||||
const WORD16 *ixheaacd_mdst_fcoeff_stop_cur[2][2] = {
|
||||
const WORD16 *const ixheaacd_mdst_fcoeff_stop_cur[2][2] = {
|
||||
{ixheaacd_mdst_fcoeff_stop_sin, ixheaacd_mdst_fcoeff_stop_sin_kbd},
|
||||
{ixheaacd_mdst_fcoeff_stop_kbd_sin, ixheaacd_mdst_fcoeff_stop_kbd}};
|
||||
|
||||
|
|
@ -109,7 +108,7 @@ const WORD16 ixheaacd_mdst_fcoeff_stopstart_sin_kbd[] = {-6797, -46, -20808, 0,
|
|||
const WORD16 ixheaacd_mdst_fcoeff_stopstart_kbd_sin[] = {-6797, 46, -20808, 0,
|
||||
20808, 46, 6797};
|
||||
|
||||
const WORD16 *ixheaacd_mdst_fcoeff_stopstart_cur[2][2] = {
|
||||
const WORD16 *const ixheaacd_mdst_fcoeff_stopstart_cur[2][2] = {
|
||||
{ixheaacd_mdst_fcoeff_stopstart_sin,
|
||||
ixheaacd_mdst_fcoeff_stopstart_sin_kbd},
|
||||
{ixheaacd_mdst_fcoeff_stopstart_kbd_sin,
|
||||
|
|
@ -125,10 +124,10 @@ const WORD16 ixheaacd_mdst_fcoeff_stop_stopstart_left_sin[] = {
|
|||
const WORD16 ixheaacd_mdst_fcoeff_stop_stopstart_left_kbd[] = {
|
||||
857, 866, 871, 873, 871, 866, 857};
|
||||
|
||||
const WORD16 *ixheaacd_mdst_fcoeff_l_s_start_left_prev[2] = {
|
||||
const WORD16 *const ixheaacd_mdst_fcoeff_l_s_start_left_prev[2] = {
|
||||
ixheaacd_mdst_fcoeff_l_s_start_left_sin,
|
||||
ixheaacd_mdst_fcoeff_l_s_start_left_kbd};
|
||||
const WORD16 *ixheaacd_mdst_fcoeff_stop_stopstart_left_prev[2] = {
|
||||
const WORD16 *const ixheaacd_mdst_fcoeff_stop_stopstart_left_prev[2] = {
|
||||
ixheaacd_mdst_fcoeff_stop_stopstart_left_sin,
|
||||
ixheaacd_mdst_fcoeff_stop_stopstart_left_kbd};
|
||||
|
||||
|
|
@ -153,7 +152,7 @@ static WORD32 ixheaacd_cplx_pred_data(
|
|||
ia_usac_tmp_core_coder_struct *pstr_core_coder, WORD32 num_window_groups,
|
||||
ia_bit_buf_struct *it_bit_buff) {
|
||||
ia_huff_code_book_struct *ptr_huff_code_book = &ixheaacd_book;
|
||||
ia_huff_code_word_struct *ptr_huff_code_word =
|
||||
const ia_huff_code_word_struct *ptr_huff_code_word =
|
||||
ptr_huff_code_book->pstr_huff_code_word;
|
||||
WORD32 cplx_pred_all;
|
||||
WORD32 delta_code_time;
|
||||
|
|
@ -371,14 +370,12 @@ static VOID ixheaacd_filter_and_add(const WORD32 *in, const WORD32 length,
|
|||
out++;
|
||||
|
||||
for (i = 3; i < length - 4; i += 2) {
|
||||
sum = 0;
|
||||
sum = ixheaacd_mac32x32in64_7(sum, &in[i - 3], filter);
|
||||
sum = ixheaacd_mac32x32in64_7(&in[i - 3], filter);
|
||||
*out = ixheaacd_add32_sat(
|
||||
*out, ixheaacd_sat64_32((((WORD64)sum * (WORD64)factor_odd) >> 15)));
|
||||
out++;
|
||||
|
||||
sum = 0;
|
||||
sum = ixheaacd_mac32x32in64_7(sum, &in[i - 2], filter);
|
||||
sum = ixheaacd_mac32x32in64_7(&in[i - 2], filter);
|
||||
*out = ixheaacd_add32_sat(
|
||||
*out, ixheaacd_sat64_32((((WORD64)sum * (WORD64)factor_even) >> 15)));
|
||||
out++;
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
#include "ixheaacd_interface.h"
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_function_selector.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -22,15 +22,15 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops16.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops16.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_basic_ops.h"
|
||||
|
||||
#include <ixheaacd_basic_op.h>
|
||||
#include "ixheaacd_basic_op.h"
|
||||
#include "ixheaacd_intrinsics.h"
|
||||
#include "ixheaacd_common_rom.h"
|
||||
#include "ixheaacd_basic_funcs.h"
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
#include "ixheaacd_sbr_scale.h"
|
||||
#include "ixheaacd_lpp_tran.h"
|
||||
#include "ixheaacd_env_extr_part.h"
|
||||
#include <ixheaacd_sbr_rom.h>
|
||||
#include "ixheaacd_sbr_rom.h"
|
||||
#include "ixheaacd_hybrid.h"
|
||||
#include "ixheaacd_ps_dec.h"
|
||||
#include "ixheaacd_env_extr.h"
|
||||
|
|
@ -49,13 +49,13 @@
|
|||
#include "ixheaacd_freq_sca.h"
|
||||
#include "ixheaacd_intrinsics.h"
|
||||
|
||||
WORD32 ixheaacd_samp_rate_table[12] = {92017, 75132, 55426, 46009,
|
||||
37566, 27713, 23004, 18783,
|
||||
13856, 11502, 9391, 16428320};
|
||||
const WORD32 ixheaacd_samp_rate_table[12] = {92017, 75132, 55426, 46009,
|
||||
37566, 27713, 23004, 18783,
|
||||
13856, 11502, 9391, 16428320};
|
||||
|
||||
WORD32 ixheaacd_v_offset_40[16] = {3 + 1, 2 + 1, 2 + 1, 2 + 1, 2 + 1, 2 + 1,
|
||||
2 + 1, 2 + 1, 2 + 1, 2 + 1, 2 + 1, 2 + 1,
|
||||
2 + 1, 2 + 1, 1 + 1, 0};
|
||||
const WORD32 ixheaacd_v_offset_40[16] = {
|
||||
3 + 1, 2 + 1, 2 + 1, 2 + 1, 2 + 1, 2 + 1, 2 + 1, 2 + 1,
|
||||
2 + 1, 2 + 1, 2 + 1, 2 + 1, 2 + 1, 2 + 1, 1 + 1, 0};
|
||||
|
||||
static WORD32 ixheaacd_int_div(WORD32 num, WORD32 den) {
|
||||
if (den != 0) {
|
||||
|
|
@ -253,7 +253,7 @@ ixheaacd_calc_stop_band(WORD32 fs, const WORD32 stop_freq, FLOAT32 upsamp_fac) {
|
|||
|
||||
result = k1_min;
|
||||
for (i = 0; i < stop_freq; i++) {
|
||||
result = result + arr_diff_stop_freq[i];
|
||||
result = ixheaacd_add32_sat(result, arr_diff_stop_freq[i]);
|
||||
}
|
||||
|
||||
return (result);
|
||||
|
|
@ -401,8 +401,7 @@ WORD16 ixheaacd_calc_master_frq_bnd_tbl(
|
|||
num_bands1 = bands * num_bands1;
|
||||
|
||||
if (ptr_header_data->alter_scale) {
|
||||
num_bands1 = num_bands1 * (0x6276);
|
||||
num_bands1 = num_bands1 >> 15;
|
||||
num_bands1 = (WORD32)(((WORD64)num_bands1 * (0x6276)) >> 15);
|
||||
}
|
||||
num_bands1 = num_bands1 + 0x1000;
|
||||
|
||||
|
|
@ -421,10 +420,6 @@ WORD16 ixheaacd_calc_master_frq_bnd_tbl(
|
|||
|
||||
ixheaacd_aac_shellsort(vec_dk0, num_bands0);
|
||||
|
||||
if (vec_dk0[0] == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
f_master_tbl[0] = k0;
|
||||
|
||||
for (k = 1; k <= num_bands0; k++)
|
||||
|
|
@ -610,7 +605,7 @@ WORD32 ixheaacd_derive_noise_freq_bnd_tbl(
|
|||
kx = pstr_freq_band_data->freq_band_table[HIGH][0];
|
||||
|
||||
if (ptr_header_data->noise_bands == 0) {
|
||||
pstr_freq_band_data->num_nf_bands = 1;
|
||||
temp = 1;
|
||||
} else {
|
||||
temp = pstr_common_tables->log_dual_is_table[k2] -
|
||||
pstr_common_tables->log_dual_is_table[kx];
|
||||
|
|
@ -620,13 +615,12 @@ WORD32 ixheaacd_derive_noise_freq_bnd_tbl(
|
|||
if (temp == 0) {
|
||||
temp = 1;
|
||||
}
|
||||
pstr_freq_band_data->num_nf_bands = temp;
|
||||
}
|
||||
pstr_freq_band_data->num_if_bands = pstr_freq_band_data->num_nf_bands;
|
||||
|
||||
if (pstr_freq_band_data->num_nf_bands > MAX_NOISE_COEFFS) {
|
||||
if (temp > MAX_NOISE_COEFFS) {
|
||||
return -1;
|
||||
}
|
||||
pstr_freq_band_data->num_nf_bands = temp;
|
||||
pstr_freq_band_data->num_if_bands = pstr_freq_band_data->num_nf_bands;
|
||||
{
|
||||
WORD16 i_k, k;
|
||||
WORD16 num, den;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_constants.h"
|
||||
#include "ixheaacd_intrinsics.h"
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
#include "ixheaacd_pns.h"
|
||||
|
||||
#include <ixheaacd_aac_rom.h>
|
||||
#include "ixheaacd_aac_rom.h"
|
||||
#include "ixheaacd_pulsedata.h"
|
||||
|
||||
#include "ixheaacd_drc_data_struct.h"
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
#include "ixheaacd_sbr_scale.h"
|
||||
#include "ixheaacd_lpp_tran.h"
|
||||
#include "ixheaacd_env_extr_part.h"
|
||||
#include <ixheaacd_sbr_rom.h>
|
||||
#include "ixheaacd_sbr_rom.h"
|
||||
#include "ixheaacd_hybrid.h"
|
||||
#include "ixheaacd_ps_dec.h"
|
||||
#include "ixheaacd_env_extr.h"
|
||||
|
|
@ -147,12 +147,14 @@ extern VOID (*ixheaacd_complex_fft_p2)(WORD32 *xr, WORD32 *xi, WORD32 nlength,
|
|||
extern VOID (*ixheaacd_mps_complex_fft_64)(WORD32 *ptr_x, WORD32 *fin_re,
|
||||
WORD32 *fin_im, WORD32 nlength);
|
||||
|
||||
extern VOID (*ixheaacd_mps_synt_pre_twiddle)(WORD32 *ptr_in, WORD32 *table_re,
|
||||
WORD32 *table_im,
|
||||
extern VOID (*ixheaacd_mps_synt_pre_twiddle)(WORD32 *ptr_in,
|
||||
const WORD32 *table_re,
|
||||
const WORD32 *table_im,
|
||||
WORD32 resolution);
|
||||
|
||||
extern VOID (*ixheaacd_mps_synt_post_twiddle)(WORD32 *ptr_in, WORD32 *table_re,
|
||||
WORD32 *table_im,
|
||||
extern VOID (*ixheaacd_mps_synt_post_twiddle)(WORD32 *ptr_in,
|
||||
const WORD32 *table_re,
|
||||
const WORD32 *table_im,
|
||||
WORD32 resolution);
|
||||
|
||||
extern VOID (*ixheaacd_calc_pre_twid)(WORD32 *ptr_x, WORD32 *r_ptr,
|
||||
|
|
@ -166,8 +168,8 @@ extern VOID (*ixheaacd_calc_post_twid)(WORD32 *ptr_x, WORD32 *r_ptr,
|
|||
const WORD32 *sin_ptr);
|
||||
|
||||
extern VOID (*ixheaacd_mps_synt_post_fft_twiddle)(
|
||||
WORD32 resolution, WORD32 *fin_re, WORD32 *fin_im, WORD32 *table_re,
|
||||
WORD32 *table_im, WORD32 *state);
|
||||
WORD32 resolution, WORD32 *fin_re, WORD32 *fin_im, const WORD32 *table_re,
|
||||
const WORD32 *table_im, WORD32 *state);
|
||||
extern VOID (*ixheaacd_mps_synt_out_calc)(WORD32 resolution, WORD32 *out,
|
||||
WORD32 *state,
|
||||
const WORD32 *filter_coeff);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
#include "ixheaacd_bitbuffer.h"
|
||||
#include "ixheaacd_interface.h"
|
||||
#include "ixheaacd_tns_usac.h"
|
||||
|
|
@ -40,9 +40,8 @@
|
|||
#include "ixheaacd_arith_dec.h"
|
||||
#include "ixheaacd_windows.h"
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_func_def.h"
|
||||
#include "ixheaacd_acelp_com.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_bitbuffer.h"
|
||||
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
#include "ixheaacd_sbr_const.h"
|
||||
|
||||
#include "ixheaacd_env_extr_part.h"
|
||||
#include <ixheaacd_sbr_rom.h>
|
||||
#include "ixheaacd_sbr_rom.h"
|
||||
#include "ixheaacd_common_rom.h"
|
||||
#include "ixheaacd_hybrid.h"
|
||||
#include "ixheaacd_sbr_scale.h"
|
||||
|
|
@ -61,8 +61,8 @@
|
|||
#include "ixheaacd_qmf_poly.h"
|
||||
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_op.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_op.h"
|
||||
|
||||
#include "ixheaacd_esbr_rom.h"
|
||||
|
||||
|
|
@ -576,7 +576,7 @@ VOID ixheaacd_hbe_xprod_proc_4(ia_esbr_hbe_txposer_struct *ptr_hbe_txposer,
|
|||
max_n1 = max_n2 = max_trans_fac = 0;
|
||||
|
||||
for (tr = 1; tr < 4; tr++) {
|
||||
temp_fac = (2.0f * qmf_band_idx + 1 - tr * p) * 0.25;
|
||||
temp_fac = (2.0 * qmf_band_idx + 1 - tr * p) * 0.25;
|
||||
n1 = ((WORD32)(temp_fac)) << 1;
|
||||
n2 = ((WORD32)(temp_fac + p)) << 1;
|
||||
|
||||
|
|
@ -1083,7 +1083,7 @@ VOID ixheaacd_hbe_post_anal_xprod2(ia_esbr_hbe_txposer_struct *ptr_hbe_txposer,
|
|||
WORD32 n1, n2;
|
||||
FLOAT64 temp_fac;
|
||||
FLOAT32 mag_cmplx_gain = 1.666666667f;
|
||||
temp_fac = (2.0f * qmf_band_idx + 1 - p) * 0.5;
|
||||
temp_fac = (2.0 * qmf_band_idx + 1 - p) * 0.5;
|
||||
n1 = ((WORD32)(temp_fac)) << 1;
|
||||
n2 = ((WORD32)(temp_fac + p)) << 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,22 +18,22 @@
|
|||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
#include "ixheaacd_error_standards.h"
|
||||
#include "ixheaacd_constants.h"
|
||||
#include <ixheaacd_basic_ops32.h>
|
||||
#include <ixheaacd_basic_ops16.h>
|
||||
#include <ixheaacd_basic_ops40.h>
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
#include "ixheaacd_basic_ops16.h"
|
||||
#include "ixheaacd_basic_ops40.h"
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
|
||||
#include "ixheaacd_bitbuffer.h"
|
||||
#include "ixheaacd_defines.h"
|
||||
#include <ixheaacd_aac_rom.h>
|
||||
#include "ixheaacd_aac_rom.h"
|
||||
|
||||
#include "ixheaacd_sbrdecsettings.h"
|
||||
#include "ixheaacd_sbr_scale.h"
|
||||
#include "ixheaacd_env_extr_part.h"
|
||||
#include <ixheaacd_sbr_rom.h>
|
||||
#include "ixheaacd_sbr_rom.h"
|
||||
|
||||
#include "ixheaacd_lpp_tran.h"
|
||||
#include "ixheaacd_hybrid.h"
|
||||
|
|
@ -488,6 +488,8 @@ WORD32 ixheaacd_ga_hdr_dec(ia_aac_dec_state_struct *aac_state_struct,
|
|||
WORD32 tmp;
|
||||
WORD32 cnt_bits = it_bit_buff->cnt_bits;
|
||||
WORD32 dummy = 0;
|
||||
UWORD32 aot_init;
|
||||
|
||||
ia_audio_specific_config_struct *pstr_audio_specific_config;
|
||||
|
||||
memset(aac_state_struct->ia_audio_specific_config, 0,
|
||||
|
|
@ -501,6 +503,8 @@ WORD32 ixheaacd_ga_hdr_dec(ia_aac_dec_state_struct *aac_state_struct,
|
|||
aac_state_struct->p_config->str_prog_config.alignment_bits =
|
||||
it_bit_buff->bit_pos;
|
||||
|
||||
aot_init = aac_state_struct->audio_object_type;
|
||||
|
||||
aac_state_struct->audio_object_type = ixheaacd_read_bits_buf(it_bit_buff, 5);
|
||||
|
||||
if (aac_state_struct->audio_object_type == 31) {
|
||||
|
|
@ -541,6 +545,10 @@ WORD32 ixheaacd_ga_hdr_dec(ia_aac_dec_state_struct *aac_state_struct,
|
|||
ixheaacd_read_bits_buf(it_bit_buff, 5);
|
||||
}
|
||||
|
||||
if (aac_state_struct->ui_init_done) {
|
||||
if (aac_state_struct->audio_object_type != aot_init) return IA_FATAL_ERROR;
|
||||
}
|
||||
|
||||
if (((aac_state_struct->audio_object_type >= AOT_AAC_MAIN &&
|
||||
aac_state_struct->audio_object_type <= AOT_AAC_LTP) ||
|
||||
aac_state_struct->audio_object_type == AOT_AAC_SCAL ||
|
||||
|
|
@ -997,7 +1005,7 @@ WORD32 ixheaacd_aac_headerdecode(
|
|||
|
||||
handle_bit_buff = ixheaacd_create_init_bit_buf(
|
||||
&it_bit_buff, (UWORD8 *)(buffer + adts.aac_frame_length),
|
||||
(WORD16)(header_len - adts.aac_frame_length));
|
||||
(WORD16)(header_len - bytes_taken - adts.aac_frame_length));
|
||||
|
||||
adts_loc.sync_word =
|
||||
(WORD16)ixheaacd_read_bits_buf(handle_bit_buff, 12);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
*/
|
||||
#include <string.h>
|
||||
#include "ixheaacd_sbr_common.h"
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
|
||||
#include "ixheaacd_constants.h"
|
||||
#include "ixheaacd_basic_ops32.h"
|
||||
|
|
|
|||
|
|
@ -20,29 +20,18 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <ixheaacd_type_def.h>
|
||||
#include "ixheaacd_type_def.h"
|
||||
#include "ixheaacd_interface.h"
|
||||
|
||||
#include "ixheaacd_bitbuffer.h"
|
||||
#include "ixheaacd_info.h"
|
||||
#include "ixheaacd_bitbuffer.h"
|
||||
|
||||
WORD32 ixheaacd_qsort_cmp(const VOID *va, const VOID *vb) {
|
||||
const ia_huff_code_word_struct *huff1, *huff2;
|
||||
|
||||
huff1 = (ia_huff_code_word_struct *)va;
|
||||
huff2 = (ia_huff_code_word_struct *)vb;
|
||||
if (huff1->len < huff2->len) return -1;
|
||||
if ((huff1->len == huff2->len) && (huff1->code_word < huff2->code_word))
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
VOID ixheaacd_hufftab(ia_huff_code_book_struct *ptr_huff_code_book,
|
||||
ia_huff_code_word_struct *ptr_huff_code_word,
|
||||
WORD16 *code_book_tbl, WORD32 *index, WORD32 dim,
|
||||
WORD32 lav, WORD32 lav_incr_esc, WORD32 sign_code_book,
|
||||
UWORD8 max_code_word_len) {
|
||||
const ia_huff_code_word_struct *ptr_huff_code_word,
|
||||
const WORD16 *code_book_tbl, const WORD32 *index,
|
||||
WORD32 dim, WORD32 lav, WORD32 lav_incr_esc,
|
||||
WORD32 sign_code_book, UWORD8 max_code_word_len) {
|
||||
WORD32 i, num;
|
||||
|
||||
if (!sign_code_book) {
|
||||
|
|
@ -64,14 +53,11 @@ VOID ixheaacd_hufftab(ia_huff_code_book_struct *ptr_huff_code_book,
|
|||
ptr_huff_code_book->code_book_tbl = code_book_tbl;
|
||||
ptr_huff_code_book->idx_tbl = index;
|
||||
ptr_huff_code_book->max_code_word_len = max_code_word_len;
|
||||
|
||||
qsort(ptr_huff_code_word, num, sizeof(ia_huff_code_word_struct),
|
||||
ixheaacd_qsort_cmp);
|
||||
}
|
||||
|
||||
WORD32 ixheaacd_huff_codeword(ia_huff_code_word_struct *ptr_huff_code_word,
|
||||
UWORD16 data_present,
|
||||
ia_bit_buf_struct *it_bit_buff)
|
||||
WORD32 ixheaacd_huff_codeword(
|
||||
const ia_huff_code_word_struct *ptr_huff_code_word, UWORD16 data_present,
|
||||
ia_bit_buf_struct *it_bit_buff)
|
||||
|
||||
{
|
||||
WORD32 i, j;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue