diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..38a62e2 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,17 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "lldb", + "request": "launch", + "name": "test", + "program": "${workspaceFolder}/build/xaacenc", + "args": ["-ifile:sq96.wav", "-ofile:/dev/null", "-adts:1", "-br:64000", "-aot:5"], + "cwd": "${workspaceFolder}/build/" + } + + ] +} \ No newline at end of file diff --git a/encoder/ixheaace_sbr_code_envelope_lp.c b/encoder/ixheaace_sbr_code_envelope_lp.c index 95c9adf..cc38803 100644 --- a/encoder/ixheaace_sbr_code_envelope_lp.c +++ b/encoder/ixheaace_sbr_code_envelope_lp.c @@ -18,6 +18,7 @@ * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore */ +#include #include #include "ixheaac_type_def.h" @@ -136,6 +137,8 @@ IA_ERRORCODE ixheaace_code_envelope(WORD32 *ptr_sfb_energy, const ixheaace_freq_ else no_of_bands = pstr_code_env->num_scf[FREQ_RES_LOW]; + printf("scf bands: %d, i: %d\n", no_of_bands, i); + ptr_energy = ptr_sfb_energy; current_energy = *ptr_energy; delta_f[0] = ixheaac_shr32(current_energy, env_data_tab_comp_factor); @@ -162,6 +165,7 @@ IA_ERRORCODE ixheaace_code_envelope(WORD32 *ptr_sfb_energy, const ixheaace_freq_ band = no_of_bands - 1; while (band > 0) { if (ptr_energy[band] - ptr_energy[band - 1] > code_book_scf_lav_lvl_freq) { + printf("align 1: %d, a: %d, b: %d, c: %d\n", ptr_energy[band] - code_book_scf_lav_lvl_freq, ptr_energy[band], ptr_energy[band - 1], code_book_scf_lav_lvl_freq); ptr_energy[band - 1] = ptr_energy[band] - code_book_scf_lav_lvl_freq; } band--; @@ -174,12 +178,14 @@ IA_ERRORCODE ixheaace_code_envelope(WORD32 *ptr_sfb_energy, const ixheaace_freq_ if (ixheaac_sub32_sat(ptr_energy[band - 1], ptr_energy[band]) > code_book_scf_lav_lvl_freq) { + printf("align 2: %d\n", ptr_energy[band - 1] - code_book_scf_lav_lvl_freq); ptr_energy[band] = ptr_energy[band - 1] - code_book_scf_lav_lvl_freq; } last_nrg = *ptr_energy++; current_energy = *ptr_energy; delta_f[band] = ixheaac_shr32((current_energy - last_nrg), env_data_tab_comp_factor); + printf("shr: (current_energy - last_nrg) >> env_data_tab_comp_factor: %d, eng: %d, nrg: %d, comp_factor: %d\n", delta_f[band], current_energy, last_nrg, env_data_tab_comp_factor); err_code = ixheaace_compute_bits( delta_f[band], code_book_scf_lav_lvl_freq, code_book_scf_lav_bal_freq, diff --git a/encoder/ixheaace_sbr_env_est.c b/encoder/ixheaace_sbr_env_est.c index 9f78654..c25d5f5 100644 --- a/encoder/ixheaace_sbr_env_est.c +++ b/encoder/ixheaace_sbr_env_est.c @@ -18,6 +18,7 @@ * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore */ +#include #include #include #include @@ -2424,6 +2425,7 @@ IA_ERRORCODE ixheaace_extract_sbr_envelope(FLOAT32 *ptr_in_time, FLOAT32 *ptr_co // ptr_noise_floor[]. However, MSVS static analysis is marking this as a potential error. // So, suppressed this in source ixheaace_sbr_noise_floor_levels_quantisation(ptr_noise_level[0], ptr_noise_floor[0], 0); + printf("left right code 1\n"); err_code = ixheaace_code_envelope( ptr_noise_level[0], res, &pstr_env_ch[0]->str_sbr_code_noise_floor, @@ -2434,6 +2436,7 @@ IA_ERRORCODE ixheaace_extract_sbr_envelope(FLOAT32 *ptr_in_time, FLOAT32 *ptr_co } ixheaace_sbr_noise_floor_levels_quantisation(ptr_noise_level[1], ptr_noise_floor[1], 0); + printf("left right code 2\n"); err_code = ixheaace_code_envelope( ptr_noise_level[1], res, &pstr_env_ch[1]->str_sbr_code_noise_floor, @@ -2721,6 +2724,7 @@ IA_ERRORCODE ixheaace_extract_sbr_envelope(FLOAT32 *ptr_in_time, FLOAT32 *ptr_co i++; } + printf("noise level: %d\n", ptr_noise_lvl_coupling[0]); err_code = ixheaace_code_envelope( ptr_noise_lvl_coupling[0], res, &pstr_env_ch[0]->str_sbr_code_noise_floor, pstr_env_0->domain_vec_noise, 1, (pstr_const_frame_info[0]->n_envelopes > 1 ? 2 : 1), 0, diff --git a/encoder/ixheaace_sbr_write_bitstream.c b/encoder/ixheaace_sbr_write_bitstream.c index 1afe4d1..b1107ac 100644 --- a/encoder/ixheaace_sbr_write_bitstream.c +++ b/encoder/ixheaace_sbr_write_bitstream.c @@ -19,6 +19,8 @@ */ #include +#include +#include #include #include "ixheaac_type_def.h" #include "ixheaac_constants.h" @@ -1374,21 +1376,26 @@ ixheaace_compute_bits(WORD32 delta, WORD32 code_book_scf_lav_lvl, : ixheaac_min32(delta, code_book_scf_lav_balance); if (index != delta) { + raise(SIGTRAP); return IA_EXHEAACE_EXE_FATAL_SBR_INVALID_BS; } *ptr_delta_bits = ptr_huff_tbl_bal[index + code_book_scf_lav_balance]; } else { + printf("cp2\n"); + printf("lav: %d, del: %d\n", code_book_scf_lav_lvl, delta); index = (delta < 0) ? ixheaac_max32(delta, -code_book_scf_lav_lvl) : ixheaac_min32(delta, code_book_scf_lav_lvl); if (index != delta) { + raise(SIGTRAP); return IA_EXHEAACE_EXE_FATAL_SBR_INVALID_BS; } *ptr_delta_bits = ptr_huff_tbl_lvl[index + code_book_scf_lav_lvl]; } } else { + printf("def2\n"); index = (delta < 0) ? ixheaac_max32(delta, -code_book_scf_lav_lvl) : ixheaac_min32(delta, code_book_scf_lav_lvl);