From d37098d09557e829952f82e0c59c5bfa6e194e6a Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Thu, 13 Jun 2024 13:28:16 +0200 Subject: [PATCH 01/10] Add DEBUGGING features from IVAS PC branch ivas-float-update-debug sha 7a7d09ca --- Workspace_msvc/Workspace_msvc.sln | 206 +-- Workspace_msvc/decoder.vcxproj | 340 ++--- Workspace_msvc/encoder.vcxproj | 354 ++--- Workspace_msvc/lib_com.vcxproj | 616 ++++----- Workspace_msvc/lib_com.vcxproj.filters | 1100 +++++++-------- Workspace_msvc/lib_debug.vcxproj | 235 ++-- Workspace_msvc/lib_dec.vcxproj | 698 +++++----- Workspace_msvc/lib_dec.vcxproj.filters | 1142 ++++++++-------- Workspace_msvc/lib_enc.vcxproj | 730 +++++----- Workspace_msvc/lib_enc.vcxproj.filters | 1256 +++++++++--------- Workspace_msvc/lib_rend.vcxproj | 412 +++--- Workspace_msvc/lib_rend.vcxproj.filters | 440 +++--- Workspace_msvc/lib_util.vcxproj | 310 ++--- Workspace_msvc/renderer.vcxproj | 358 ++--- apps/decoder.c | 498 ++++++- apps/encoder.c | 375 +++++- apps/renderer.c | 19 +- lib_com/ACcontextMapping.c | 3 + lib_com/arith_coder.c | 3 + lib_com/basop_mpy.c | 3 + lib_com/basop_mpy.h | 3 + lib_com/basop_tcx_utils.c | 3 + lib_com/basop_util.c | 3 + lib_com/bitalloc.c | 3 + lib_com/bitallocsum.c | 3 + lib_com/bits_alloc.c | 63 + lib_com/bitstream.c | 724 ++++++++++ lib_com/calc_st_com.c | 3 + lib_com/cb_shape.c | 3 + lib_com/cldfb.c | 3 + lib_com/cng_exc.c | 3 + lib_com/cnst.h | 10 + lib_com/codec_tcx_common.c | 3 + lib_com/common_api_types.h | 12 + lib_com/core_com_config.c | 3 + lib_com/deemph.c | 3 + lib_com/delay_comp.c | 3 + lib_com/disclaimer.c | 3 + lib_com/dlpc_bfi.c | 3 + lib_com/edct.c | 7 + lib_com/enhancer.c | 3 + lib_com/enr_1_az.c | 3 + lib_com/env_adj.c | 3 + lib_com/env_stab.c | 9 + lib_com/env_stab_trans.c | 3 + lib_com/est_tilt.c | 3 + lib_com/fd_cng_com.c | 3 + lib_com/fft.c | 3 + lib_com/fft_rel.c | 3 + lib_com/fill_spectrum.c | 3 + lib_com/findpulse.c | 3 + lib_com/fine_gain_bits.c | 3 + lib_com/frame_ener.c | 3 + lib_com/get_gain.c | 3 + lib_com/gs_bitallocation.c | 6 + lib_com/gs_gains.c | 3 + lib_com/gs_inact_switching.c | 3 + lib_com/gs_noisefill.c | 3 + lib_com/gs_preech.c | 3 + lib_com/hp50.c | 3 + lib_com/hq2_bit_alloc.c | 3 + lib_com/hq2_core_com.c | 3 + lib_com/hq2_noise_inject.c | 3 + lib_com/hq_bit_allocation.c | 3 + lib_com/hq_conf.c | 3 + lib_com/hq_tools.c | 3 + lib_com/hvq_pvq_bitalloc.c | 3 + lib_com/ifft_rel.c | 3 + lib_com/igf_base.c | 3 + lib_com/index_pvq_opt.c | 3 + lib_com/int_lsp.c | 3 + lib_com/interleave_spectrum.c | 3 + lib_com/interpol.c | 3 + lib_com/isf_dec_amr_wb.c | 3 + lib_com/ivas_agc_com.c | 24 + lib_com/ivas_arith.c | 3 + lib_com/ivas_avq_pos_reorder_com.c | 3 + lib_com/ivas_cnst.h | 7 + lib_com/ivas_cov_smooth.c | 3 + lib_com/ivas_entropy_coder_common.c | 3 + lib_com/ivas_error.h | 13 + lib_com/ivas_error_utils.h | 24 + lib_com/ivas_fb_mixer.c | 3 + lib_com/ivas_filters.c | 3 + lib_com/ivas_ism_com.c | 20 + lib_com/ivas_lfe_com.c | 3 + lib_com/ivas_masa_com.c | 6 + lib_com/ivas_mc_com.c | 3 + lib_com/ivas_mc_param_com.c | 6 + lib_com/ivas_mcmasa_com.c | 3 + lib_com/ivas_mdct_imdct.c | 3 + lib_com/ivas_mdft_imdft.c | 3 + lib_com/ivas_omasa_com.c | 3 + lib_com/ivas_pca_tools.c | 3 + lib_com/ivas_prot.h | 34 + lib_com/ivas_qmetadata_com.c | 13 + lib_com/ivas_qspherical_com.c | 30 + lib_com/ivas_rom_com.c | 3 + lib_com/ivas_rom_com.h | 3 + lib_com/ivas_sba_config.c | 3 + lib_com/ivas_sns_com.c | 3 + lib_com/ivas_spar_com.c | 47 + lib_com/ivas_spar_com_quant_util.c | 3 + lib_com/ivas_stat_com.h | 4 + lib_com/ivas_stereo_dft_com.c | 32 + lib_com/ivas_stereo_eclvq_com.c | 7 + lib_com/ivas_stereo_ica_com.c | 3 + lib_com/ivas_stereo_mdct_bands_com.c | 6 + lib_com/ivas_stereo_td_bit_alloc.c | 3 + lib_com/ivas_tools.c | 9 + lib_com/ivas_transient_det.c | 3 + lib_com/lag_wind.c | 3 + lib_com/limit_t0.c | 3 + lib_com/logqnorm.c | 3 + lib_com/low_rate_band_att.c | 3 + lib_com/lpc_tools.c | 3 + lib_com/lsf_msvq_ma.c | 3 + lib_com/lsf_tools.c | 27 + lib_com/lsp_conv_poly.c | 3 + lib_com/modif_fs.c | 3 + lib_com/options.h | 82 ++ lib_com/parameter_bitmaping.c | 3 + lib_com/phase_dispersion.c | 3 + lib_com/ppp.c | 3 + lib_com/pred_lt4.c | 3 + lib_com/preemph.c | 3 + lib_com/prot.h | 80 ++ lib_com/pvq_com.c | 3 + lib_com/range_com.c | 3 + lib_com/re8_ppv.c | 3 + lib_com/re8_util.c | 3 + lib_com/realft.c | 3 + lib_com/recovernorm.c | 3 + lib_com/reordvct.c | 3 + lib_com/residu.c | 3 + lib_com/rom_com.c | 3 + lib_com/rom_com.h | 3 + lib_com/stab_est.c | 3 + lib_com/stat_com.h | 3 + lib_com/stat_noise_uv_mod.c | 3 + lib_com/swb_bwe_com.c | 3 + lib_com/swb_bwe_com_hr.c | 3 + lib_com/swb_bwe_com_lr.c | 3 + lib_com/swb_tbe_com.c | 3 + lib_com/syn_12k8.c | 3 + lib_com/syn_filt.c | 3 + lib_com/tcq_position_arith.c | 3 + lib_com/tcx_ltp.c | 3 + lib_com/tcx_mdct_window.c | 3 + lib_com/tcx_utils.c | 3 + lib_com/tools.c | 3 + lib_com/trans_direct.c | 3 + lib_com/trans_inv.c | 3 + lib_com/weight.c | 3 + lib_com/weight_a.c | 3 + lib_com/window.c | 3 + lib_com/window_ola.c | 3 + lib_com/wtda.c | 9 + lib_debug/debug.c | 978 ++++++++++++++ lib_debug/debug.h | 257 ++++ lib_debug/sba_debug.c | 431 ++++++ lib_debug/sba_debug.h | 61 + lib_debug/snr.c | 465 +++++++ lib_dec/ACcontextMapping_dec.c | 12 + lib_dec/FEC.c | 3 + lib_dec/FEC_HQ_core.c | 3 + lib_dec/FEC_HQ_phase_ecu.c | 3 + lib_dec/FEC_adapt_codebook.c | 3 + lib_dec/FEC_clas_estim.c | 3 + lib_dec/FEC_lsf_estim.c | 3 + lib_dec/FEC_pitch_estim.c | 3 + lib_dec/FEC_scale_syn.c | 3 + lib_dec/LD_music_post_filter.c | 3 + lib_dec/TonalComponentDetection.c | 3 + lib_dec/acelp_core_dec.c | 18 + lib_dec/acelp_core_switch_dec.c | 3 + lib_dec/amr_wb_dec.c | 17 + lib_dec/arith_coder_dec.c | 3 + lib_dec/avq_dec.c | 3 + lib_dec/bass_psfilter.c | 3 + lib_dec/cng_dec.c | 6 + lib_dec/core_dec_init.c | 3 + lib_dec/core_dec_reconf.c | 3 + lib_dec/core_dec_switch.c | 3 + lib_dec/core_switching_dec.c | 3 + lib_dec/d_gain2p.c | 3 + lib_dec/dec2t32.c | 3 + lib_dec/dec4t64.c | 3 + lib_dec/dec_LPD.c | 3 + lib_dec/dec_ace.c | 3 + lib_dec/dec_acelp_tcx_main.c | 3 + lib_dec/dec_amr_wb.c | 3 + lib_dec/dec_gen_voic.c | 3 + lib_dec/dec_higher_acelp.c | 3 + lib_dec/dec_nelp.c | 3 + lib_dec/dec_pit_exc.c | 3 + lib_dec/dec_post.c | 3 + lib_dec/dec_ppp.c | 3 + lib_dec/dec_prm.c | 3 + lib_dec/dec_tcx.c | 38 + lib_dec/dec_tran.c | 3 + lib_dec/decision_matrix_dec.c | 3 + lib_dec/dlpc_stoch.c | 3 + lib_dec/er_dec_acelp.c | 3 + lib_dec/er_dec_tcx.c | 3 + lib_dec/er_util.c | 11 + lib_dec/evs_dec.c | 34 + lib_dec/fd_cng_dec.c | 39 + lib_dec/gain_dec.c | 3 + lib_dec/gaus_dec.c | 3 + lib_dec/gs_dec.c | 3 + lib_dec/gs_dec_amr_wb.c | 3 + lib_dec/hdecnrm.c | 3 + lib_dec/hf_synth.c | 3 + lib_dec/hq_classifier_dec.c | 3 + lib_dec/hq_conf_fec.c | 3 + lib_dec/hq_core_dec.c | 3 + lib_dec/hq_env_dec.c | 3 + lib_dec/hq_hr_dec.c | 3 + lib_dec/hq_lr_dec.c | 3 + lib_dec/igf_dec.c | 13 + lib_dec/igf_scf_dec.c | 3 + lib_dec/init_dec.c | 3 + lib_dec/inov_dec.c | 3 + lib_dec/ivas_agc_dec.c | 20 + lib_dec/ivas_binRenderer_internal.c | 209 +++ lib_dec/ivas_core_dec.c | 129 ++ lib_dec/ivas_corecoder_dec_reconfig.c | 3 + lib_dec/ivas_cpe_dec.c | 40 + lib_dec/ivas_dec.c | 3 + lib_dec/ivas_decision_matrix_dec.c | 3 + lib_dec/ivas_dirac_dec.c | 85 ++ lib_dec/ivas_dirac_output_synthesis_cov.c | 3 + lib_dec/ivas_entropy_decoder.c | 3 + lib_dec/ivas_init_dec.c | 25 + lib_dec/ivas_ism_dec.c | 3 + lib_dec/ivas_ism_dtx_dec.c | 3 + lib_dec/ivas_ism_metadata_dec.c | 3 + lib_dec/ivas_ism_param_dec.c | 10 + lib_dec/ivas_ism_renderer.c | 3 + lib_dec/ivas_jbm_dec.c | 90 ++ lib_dec/ivas_lfe_dec.c | 3 + lib_dec/ivas_lfe_plc.c | 3 + lib_dec/ivas_ls_custom_dec.c | 3 + lib_dec/ivas_masa_dec.c | 3 + lib_dec/ivas_mc_param_dec.c | 36 + lib_dec/ivas_mc_paramupmix_dec.c | 13 + lib_dec/ivas_mcmasa_dec.c | 3 + lib_dec/ivas_mct_core_dec.c | 3 + lib_dec/ivas_mct_dec.c | 45 + lib_dec/ivas_mdct_core_dec.c | 46 + lib_dec/ivas_objectRenderer_internal.c | 3 + lib_dec/ivas_omasa_dec.c | 3 + lib_dec/ivas_osba_dec.c | 3 + lib_dec/ivas_out_setup_conversion.c | 3 + lib_dec/ivas_output_config.c | 37 + lib_dec/ivas_pca_dec.c | 6 + lib_dec/ivas_post_proc.c | 57 + lib_dec/ivas_qmetadata_dec.c | 241 ++++ lib_dec/ivas_range_uni_dec.c | 34 + lib_dec/ivas_rom_dec.c | 3 + lib_dec/ivas_rom_dec.h | 3 + lib_dec/ivas_sba_dec.c | 9 + lib_dec/ivas_sba_dirac_stereo_dec.c | 11 + lib_dec/ivas_sba_rendering_internal.c | 53 + lib_dec/ivas_sce_dec.c | 34 + lib_dec/ivas_spar_decoder.c | 69 +- lib_dec/ivas_spar_md_dec.c | 58 + lib_dec/ivas_stat_dec.h | 11 + lib_dec/ivas_stereo_adapt_GR_dec.c | 9 + lib_dec/ivas_stereo_cng_dec.c | 3 + lib_dec/ivas_stereo_dft_dec.c | 242 ++++ lib_dec/ivas_stereo_dft_dec_dmx.c | 6 + lib_dec/ivas_stereo_dft_plc.c | 3 + lib_dec/ivas_stereo_eclvq_dec.c | 6 + lib_dec/ivas_stereo_esf_dec.c | 3 + lib_dec/ivas_stereo_ica_dec.c | 8 + lib_dec/ivas_stereo_icbwe_dec.c | 22 + lib_dec/ivas_stereo_mdct_core_dec.c | 6 + lib_dec/ivas_stereo_mdct_stereo_dec.c | 22 + lib_dec/ivas_stereo_switching_dec.c | 12 + lib_dec/ivas_stereo_td_dec.c | 9 + lib_dec/ivas_svd_dec.c | 3 + lib_dec/ivas_tcx_core_dec.c | 47 + lib_dec/ivas_td_low_rate_dec.c | 3 + lib_dec/jbm_jb4_circularbuffer.c | 3 + lib_dec/jbm_jb4_inputbuffer.c | 11 + lib_dec/jbm_jb4_jmf.c | 3 + lib_dec/jbm_jb4sb.c | 3 + lib_dec/jbm_pcmdsp_apa.c | 3 + lib_dec/jbm_pcmdsp_similarityestimation.c | 3 + lib_dec/jbm_pcmdsp_window.c | 3 + lib_dec/lead_deindexing.c | 3 + lib_dec/lib_dec.c | 244 ++++ lib_dec/lib_dec.h | 52 + lib_dec/lp_exc_d.c | 3 + lib_dec/lsf_dec.c | 3 + lib_dec/lsf_msvq_ma_dec.c | 3 + lib_dec/nelp_dec.c | 3 + lib_dec/peak_vq_dec.c | 3 + lib_dec/pit_dec.c | 3 + lib_dec/pitch_extr.c | 3 + lib_dec/post_dec.c | 3 + lib_dec/pvq_core_dec.c | 3 + lib_dec/pvq_decode.c | 3 + lib_dec/range_dec.c | 3 + lib_dec/re8_dec.c | 3 + lib_dec/rom_dec.c | 3 + lib_dec/rom_dec.h | 3 + lib_dec/rst_dec.c | 3 + lib_dec/stat_dec.h | 6 + lib_dec/stat_noise_uv_dec.c | 3 + lib_dec/swb_bwe_dec.c | 3 + lib_dec/swb_bwe_dec_hr.c | 3 + lib_dec/swb_bwe_dec_lr.c | 3 + lib_dec/swb_tbe_dec.c | 3 + lib_dec/syn_outp.c | 3 + lib_dec/tcq_core_dec.c | 3 + lib_dec/tcx_utils_dec.c | 3 + lib_dec/tonalMDCTconcealment.c | 3 + lib_dec/transition_dec.c | 3 + lib_dec/updt_dec.c | 3 + lib_dec/waveadjust_fec_dec.c | 3 + lib_enc/ACcontextMapping_enc.c | 15 + lib_enc/FEC_enc.c | 3 + lib_enc/acelp_core_enc.c | 45 + lib_enc/acelp_core_switch_enc.c | 6 + lib_enc/acelp_enc_util.c | 3 + lib_enc/amr_wb_enc.c | 28 + lib_enc/analy_lp.c | 3 + lib_enc/analy_sp.c | 3 + lib_enc/ari_enc.c | 3 + lib_enc/arith_coder_enc.c | 3 + lib_enc/avq_cod.c | 3 + lib_enc/bass_psfilter_enc.c | 3 + lib_enc/bw_detect.c | 3 + lib_enc/cng_enc.c | 3 + lib_enc/cod2t32.c | 3 + lib_enc/cod4t64.c | 3 + lib_enc/cod4t64_fast.c | 3 + lib_enc/cod_ace.c | 14 + lib_enc/cod_tcx.c | 47 + lib_enc/core_enc_2div.c | 3 + lib_enc/core_enc_init.c | 3 + lib_enc/core_enc_ol.c | 16 + lib_enc/core_enc_reconf.c | 3 + lib_enc/core_enc_switch.c | 3 + lib_enc/core_enc_updt.c | 3 + lib_enc/core_switching_enc.c | 3 + lib_enc/corr_xh.c | 3 + lib_enc/decision_matrix_enc.c | 18 + lib_enc/detect_transient.c | 3 + lib_enc/diffcod.c | 3 + lib_enc/dtx.c | 13 + lib_enc/enc_acelp.c | 3 + lib_enc/enc_acelp_tcx_main.c | 3 + lib_enc/enc_acelpx.c | 3 + lib_enc/enc_amr_wb.c | 3 + lib_enc/enc_gen_voic.c | 3 + lib_enc/enc_gen_voic_rf.c | 3 + lib_enc/enc_higher_acelp.c | 3 + lib_enc/enc_nelp.c | 3 + lib_enc/enc_pit_exc.c | 3 + lib_enc/enc_ppp.c | 3 + lib_enc/enc_prm.c | 29 + lib_enc/enc_tran.c | 3 + lib_enc/enc_uv.c | 6 + lib_enc/eval_pit_contr.c | 3 + lib_enc/evs_enc.c | 45 + lib_enc/ext_sig_ana.c | 6 + lib_enc/fd_cng_enc.c | 9 + lib_enc/find_tar.c | 3 + lib_enc/find_tilt.c | 3 + lib_enc/find_uv.c | 3 + lib_enc/find_wsp.c | 3 + lib_enc/gain_enc.c | 3 + lib_enc/gaus_enc.c | 3 + lib_enc/gp_clip.c | 3 + lib_enc/gs_enc.c | 3 + lib_enc/hf_cod_amrwb.c | 3 + lib_enc/hq_classifier_enc.c | 3 + lib_enc/hq_core_enc.c | 3 + lib_enc/hq_env_enc.c | 3 + lib_enc/hq_hr_enc.c | 7 + lib_enc/hq_lr_enc.c | 7 + lib_enc/hvq_enc.c | 10 + lib_enc/igf_enc.c | 6 + lib_enc/igf_scf_enc.c | 3 + lib_enc/init_enc.c | 3 + lib_enc/inov_enc.c | 9 + lib_enc/isf_enc_amr_wb.c | 3 + lib_enc/ivas_agc_enc.c | 56 + lib_enc/ivas_core_enc.c | 120 ++ lib_enc/ivas_core_pre_proc.c | 13 + lib_enc/ivas_core_pre_proc_front.c | 18 + lib_enc/ivas_corecoder_enc_reconfig.c | 19 + lib_enc/ivas_cpe_enc.c | 86 ++ lib_enc/ivas_decision_matrix_enc.c | 36 + lib_enc/ivas_dirac_enc.c | 104 ++ lib_enc/ivas_enc.c | 29 + lib_enc/ivas_enc_cov_handler.c | 26 + lib_enc/ivas_entropy_coder.c | 3 + lib_enc/ivas_front_vad.c | 10 + lib_enc/ivas_init_enc.c | 12 + lib_enc/ivas_ism_dtx_enc.c | 3 + lib_enc/ivas_ism_enc.c | 48 + lib_enc/ivas_ism_metadata_enc.c | 3 + lib_enc/ivas_ism_param_enc.c | 6 + lib_enc/ivas_lfe_enc.c | 3 + lib_enc/ivas_masa_enc.c | 12 + lib_enc/ivas_mc_param_enc.c | 24 + lib_enc/ivas_mc_paramupmix_enc.c | 10 + lib_enc/ivas_mcmasa_enc.c | 3 + lib_enc/ivas_mct_core_enc.c | 40 + lib_enc/ivas_mct_enc.c | 33 + lib_enc/ivas_mct_enc_mct.c | 82 ++ lib_enc/ivas_mdct_core_enc.c | 32 + lib_enc/ivas_omasa_enc.c | 32 + lib_enc/ivas_osba_enc.c | 3 + lib_enc/ivas_pca_enc.c | 6 + lib_enc/ivas_qmetadata_enc.c | 475 +++++++ lib_enc/ivas_range_uni_enc.c | 49 + lib_enc/ivas_rom_enc.c | 3 + lib_enc/ivas_rom_enc.h | 3 + lib_enc/ivas_sba_enc.c | 17 + lib_enc/ivas_sce_enc.c | 17 + lib_enc/ivas_sns_enc.c | 16 + lib_enc/ivas_spar_encoder.c | 152 +++ lib_enc/ivas_spar_md_enc.c | 255 ++++ lib_enc/ivas_stat_enc.h | 21 + lib_enc/ivas_stereo_adapt_GR_enc.c | 3 + lib_enc/ivas_stereo_classifier.c | 69 + lib_enc/ivas_stereo_cng_enc.c | 3 + lib_enc/ivas_stereo_dft_enc.c | 462 +++++++ lib_enc/ivas_stereo_dft_enc_itd.c | 54 + lib_enc/ivas_stereo_dft_td_itd.c | 35 + lib_enc/ivas_stereo_dmx_evs.c | 3 + lib_enc/ivas_stereo_eclvq_enc.c | 125 ++ lib_enc/ivas_stereo_ica_enc.c | 13 + lib_enc/ivas_stereo_icbwe_enc.c | 3 + lib_enc/ivas_stereo_mdct_core_enc.c | 31 + lib_enc/ivas_stereo_mdct_stereo_enc.c | 137 ++ lib_enc/ivas_stereo_switching_enc.c | 6 + lib_enc/ivas_stereo_td_analysis.c | 8 + lib_enc/ivas_stereo_td_enc.c | 39 + lib_enc/ivas_tcx_core_enc.c | 63 + lib_enc/ivas_td_low_rate_enc.c | 3 + lib_enc/lead_indexing.c | 3 + lib_enc/lib_enc.c | 242 ++++ lib_enc/lib_enc.h | 51 + lib_enc/long_enr.c | 3 + lib_enc/lp_exc_e.c | 3 + lib_enc/lsf_enc.c | 10 + lib_enc/lsf_msvq_ma_enc.c | 3 + lib_enc/mdct_classifier.c | 3 + lib_enc/mdct_selector.c | 3 + lib_enc/multi_harm.c | 3 + lib_enc/nelp_enc.c | 3 + lib_enc/noise_adjust.c | 3 + lib_enc/normalizecoefs.c | 3 + lib_enc/peak_vq_enc.c | 30 + lib_enc/pitch_ol2.c | 3 + lib_enc/pre_proc.c | 3 + lib_enc/pvq_core_enc.c | 3 + lib_enc/pvq_encode.c | 3 + lib_enc/q_gain2p.c | 3 + lib_enc/qlpc_stoch.c | 3 + lib_enc/range_enc.c | 3 + lib_enc/re8_cod.c | 3 + lib_enc/reordernorm.c | 3 + lib_enc/rom_enc.c | 3 + lib_enc/rom_enc.h | 3 + lib_enc/rst_enc.c | 3 + lib_enc/setmodeindex.c | 3 + lib_enc/sig_clas.c | 3 + lib_enc/speech_music_classif.c | 42 + lib_enc/stat_enc.h | 9 + lib_enc/stat_noise_uv_enc.c | 3 + lib_enc/swb_bwe_enc.c | 3 + lib_enc/swb_bwe_enc_hr.c | 3 + lib_enc/swb_bwe_enc_lr.c | 3 + lib_enc/swb_pre_proc.c | 3 + lib_enc/swb_tbe_enc.c | 3 + lib_enc/tcq_core_enc.c | 35 + lib_enc/tcx_ltp_enc.c | 6 + lib_enc/tcx_utils_enc.c | 3 + lib_enc/transient_detection.c | 3 + lib_enc/transition_enc.c | 3 + lib_enc/updt_enc.c | 3 + lib_enc/updt_tar.c | 3 + lib_enc/vad.c | 3 + lib_enc/vad_param_updt.c | 3 + lib_enc/vbr_average_rate.c | 3 + lib_enc/vlpc_1st_cod.c | 17 + lib_rend/ivas_allrad_dec.c | 41 + lib_rend/ivas_crend.c | 3 + lib_rend/ivas_dirac_ana.c | 3 + lib_rend/ivas_dirac_dec_binaural_functions.c | 9 + lib_rend/ivas_dirac_decorr_dec.c | 18 + lib_rend/ivas_dirac_onsets_dec.c | 3 + lib_rend/ivas_dirac_output_synthesis_dec.c | 6 + lib_rend/ivas_dirac_rend.c | 3 + lib_rend/ivas_efap.c | 49 + lib_rend/ivas_limiter.c | 9 + lib_rend/ivas_mcmasa_ana.c | 3 + lib_rend/ivas_objectRenderer.c | 3 + lib_rend/ivas_objectRenderer_mix.c | 3 + lib_rend/ivas_objectRenderer_sources.c | 3 + lib_rend/ivas_objectRenderer_vec.c | 3 + lib_rend/ivas_omasa_ana.c | 3 + lib_rend/ivas_orient_trk.c | 3 + lib_rend/ivas_output_init.c | 8 + lib_rend/ivas_reflections.c | 3 + lib_rend/ivas_render_config.c | 6 + lib_rend/ivas_reverb.c | 6 + lib_rend/ivas_reverb_delay_line.c | 3 + lib_rend/ivas_reverb_fft_filter.c | 3 + lib_rend/ivas_reverb_filter_design.c | 3 + lib_rend/ivas_reverb_iir_filter.c | 3 + lib_rend/ivas_reverb_utils.c | 3 + lib_rend/ivas_rom_TdBinauralRenderer.c | 3 + lib_rend/ivas_rom_TdBinauralRenderer.h | 3 + lib_rend/ivas_rom_binauralRenderer.c | 3 + lib_rend/ivas_rom_binauralRenderer.h | 3 + lib_rend/ivas_rom_rend.c | 3 + lib_rend/ivas_rom_rend.h | 3 + lib_rend/ivas_rotation.c | 3 + lib_rend/ivas_sba_rendering.c | 3 + lib_rend/ivas_stat_rend.h | 3 + lib_rend/ivas_td_decorr.c | 3 + lib_rend/ivas_vbap.c | 7 + lib_rend/lib_rend.c | 59 + lib_rend/lib_rend.h | 9 + lib_util/bitstream_reader.c | 16 + lib_util/bitstream_reader.h | 3 + lib_util/masa_file_reader.c | 3 + lib_util/render_config_reader.c | 139 ++ 537 files changed, 15873 insertions(+), 4100 deletions(-) create mode 100644 lib_debug/debug.c create mode 100644 lib_debug/debug.h create mode 100644 lib_debug/sba_debug.c create mode 100644 lib_debug/sba_debug.h create mode 100644 lib_debug/snr.c diff --git a/Workspace_msvc/Workspace_msvc.sln b/Workspace_msvc/Workspace_msvc.sln index a0783ddbf..dc89573d4 100644 --- a/Workspace_msvc/Workspace_msvc.sln +++ b/Workspace_msvc/Workspace_msvc.sln @@ -1,103 +1,103 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.902 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_dec", "lib_dec.vcxproj", "{E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_enc", "lib_enc.vcxproj", "{824DA4CF-06F0-45C9-929A-8792F0E19C3E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_com", "lib_com.vcxproj", "{39EC200D-7795-4FF8-B214-B24EDA5526AE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_rend", "lib_rend.vcxproj", "{718DE063-A18B-BB72-9150-62B892E6FFA6}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_util", "lib_util.vcxproj", "{2FA8F384-0775-F3B7-F8C3-85209222FC70}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_debug", "lib_debug.vcxproj", "{54509728-928B-44D9-A118-A6F92F08B34F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "decoder", "decoder.vcxproj", "{E3DCBC31-7FC9-D127-E000-529F8460D5FD}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "encoder", "encoder.vcxproj", "{B3FC9DFC-7268-8660-7C0D-B60BAF02C554}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "renderer", "renderer.vcxproj", "{12B4C8A5-1E06-4E30-B443-D1F916F52B47}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{51160D4C-55C9-4C16-A792-D94507225746}" - ProjectSection(SolutionItems) = preProject - ..\.clang-format = ..\.clang-format - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}.Debug|Win32.ActiveCfg = Debug|Win32 - {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}.Debug|Win32.Build.0 = Debug|Win32 - {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}.Debug|x64.ActiveCfg = Debug|Win32 - {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}.Release|Win32.ActiveCfg = Release|Win32 - {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}.Release|Win32.Build.0 = Release|Win32 - {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}.Release|x64.ActiveCfg = Release|Win32 - {824DA4CF-06F0-45C9-929A-8792F0E19C3E}.Debug|Win32.ActiveCfg = Debug|Win32 - {824DA4CF-06F0-45C9-929A-8792F0E19C3E}.Debug|Win32.Build.0 = Debug|Win32 - {824DA4CF-06F0-45C9-929A-8792F0E19C3E}.Debug|x64.ActiveCfg = Debug|Win32 - {824DA4CF-06F0-45C9-929A-8792F0E19C3E}.Release|Win32.ActiveCfg = Release|Win32 - {824DA4CF-06F0-45C9-929A-8792F0E19C3E}.Release|Win32.Build.0 = Release|Win32 - {824DA4CF-06F0-45C9-929A-8792F0E19C3E}.Release|x64.ActiveCfg = Release|Win32 - {39EC200D-7795-4FF8-B214-B24EDA5526AE}.Debug|Win32.ActiveCfg = Debug|Win32 - {39EC200D-7795-4FF8-B214-B24EDA5526AE}.Debug|Win32.Build.0 = Debug|Win32 - {39EC200D-7795-4FF8-B214-B24EDA5526AE}.Debug|x64.ActiveCfg = Debug|Win32 - {39EC200D-7795-4FF8-B214-B24EDA5526AE}.Release|Win32.ActiveCfg = Release|Win32 - {39EC200D-7795-4FF8-B214-B24EDA5526AE}.Release|Win32.Build.0 = Release|Win32 - {39EC200D-7795-4FF8-B214-B24EDA5526AE}.Release|x64.ActiveCfg = Release|Win32 - {718DE063-A18B-BB72-9150-62B892E6FFA6}.Debug|Win32.ActiveCfg = Debug|Win32 - {718DE063-A18B-BB72-9150-62B892E6FFA6}.Debug|Win32.Build.0 = Debug|Win32 - {718DE063-A18B-BB72-9150-62B892E6FFA6}.Debug|x64.ActiveCfg = Debug|Win32 - {718DE063-A18B-BB72-9150-62B892E6FFA6}.Release|Win32.ActiveCfg = Release|Win32 - {718DE063-A18B-BB72-9150-62B892E6FFA6}.Release|Win32.Build.0 = Release|Win32 - {718DE063-A18B-BB72-9150-62B892E6FFA6}.Release|x64.ActiveCfg = Release|Win32 - {2FA8F384-0775-F3B7-F8C3-85209222FC70}.Debug|Win32.ActiveCfg = Debug|Win32 - {2FA8F384-0775-F3B7-F8C3-85209222FC70}.Debug|Win32.Build.0 = Debug|Win32 - {2FA8F384-0775-F3B7-F8C3-85209222FC70}.Debug|x64.ActiveCfg = Debug|Win32 - {2FA8F384-0775-F3B7-F8C3-85209222FC70}.Release|Win32.ActiveCfg = Release|Win32 - {2FA8F384-0775-F3B7-F8C3-85209222FC70}.Release|Win32.Build.0 = Release|Win32 - {2FA8F384-0775-F3B7-F8C3-85209222FC70}.Release|x64.ActiveCfg = Release|Win32 - {54509728-928B-44D9-A118-A6F92F08B34F}.Debug|Win32.ActiveCfg = Debug|Win32 - {54509728-928B-44D9-A118-A6F92F08B34F}.Debug|Win32.Build.0 = Debug|Win32 - {54509728-928B-44D9-A118-A6F92F08B34F}.Debug|x64.ActiveCfg = Debug|Win32 - {54509728-928B-44D9-A118-A6F92F08B34F}.Release|Win32.ActiveCfg = Release|Win32 - {54509728-928B-44D9-A118-A6F92F08B34F}.Release|Win32.Build.0 = Release|Win32 - {54509728-928B-44D9-A118-A6F92F08B34F}.Release|x64.ActiveCfg = Release|Win32 - {E3DCBC31-7FC9-D127-E000-529F8460D5FD}.Debug|Win32.ActiveCfg = Debug|Win32 - {E3DCBC31-7FC9-D127-E000-529F8460D5FD}.Debug|Win32.Build.0 = Debug|Win32 - {E3DCBC31-7FC9-D127-E000-529F8460D5FD}.Debug|x64.ActiveCfg = Debug|Win32 - {E3DCBC31-7FC9-D127-E000-529F8460D5FD}.Release|Win32.ActiveCfg = Release|Win32 - {E3DCBC31-7FC9-D127-E000-529F8460D5FD}.Release|Win32.Build.0 = Release|Win32 - {E3DCBC31-7FC9-D127-E000-529F8460D5FD}.Release|x64.ActiveCfg = Release|Win32 - {B3FC9DFC-7268-8660-7C0D-B60BAF02C554}.Debug|Win32.ActiveCfg = Debug|Win32 - {B3FC9DFC-7268-8660-7C0D-B60BAF02C554}.Debug|Win32.Build.0 = Debug|Win32 - {B3FC9DFC-7268-8660-7C0D-B60BAF02C554}.Debug|x64.ActiveCfg = Debug|Win32 - {B3FC9DFC-7268-8660-7C0D-B60BAF02C554}.Release|Win32.ActiveCfg = Release|Win32 - {B3FC9DFC-7268-8660-7C0D-B60BAF02C554}.Release|Win32.Build.0 = Release|Win32 - {B3FC9DFC-7268-8660-7C0D-B60BAF02C554}.Release|x64.ActiveCfg = Release|Win32 - {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Debug|Win32.ActiveCfg = Debug|Win32 - {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Debug|Win32.Build.0 = Debug|Win32 - {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Debug|x64.ActiveCfg = Debug|Win32 - {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Release|Win32.ActiveCfg = Release|Win32 - {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Release|Win32.Build.0 = Release|Win32 - {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Release|x64.ActiveCfg = Release|Win32 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|Win32.ActiveCfg = Debug|Win32 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|Win32.Build.0 = Debug|Win32 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|x64.ActiveCfg = Debug|Win32 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|Win32.ActiveCfg = Release|Win32 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|Win32.Build.0 = Release|Win32 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|x64.ActiveCfg = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {74E3E3B8-3E51-4003-816B-8ED3057AAC21} - EndGlobalSection -EndGlobal +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.902 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_dec", "lib_dec.vcxproj", "{E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_enc", "lib_enc.vcxproj", "{824DA4CF-06F0-45C9-929A-8792F0E19C3E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_com", "lib_com.vcxproj", "{39EC200D-7795-4FF8-B214-B24EDA5526AE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_rend", "lib_rend.vcxproj", "{718DE063-A18B-BB72-9150-62B892E6FFA6}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_util", "lib_util.vcxproj", "{2FA8F384-0775-F3B7-F8C3-85209222FC70}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_debug", "lib_debug.vcxproj", "{54509728-928B-44D9-A118-A6F92F08B34F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "decoder", "decoder.vcxproj", "{E3DCBC31-7FC9-D127-E000-529F8460D5FD}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "encoder", "encoder.vcxproj", "{B3FC9DFC-7268-8660-7C0D-B60BAF02C554}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "renderer", "renderer.vcxproj", "{12B4C8A5-1E06-4E30-B443-D1F916F52B47}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{51160D4C-55C9-4C16-A792-D94507225746}" + ProjectSection(SolutionItems) = preProject + ..\.clang-format = ..\.clang-format + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}.Debug|Win32.ActiveCfg = Debug|Win32 + {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}.Debug|Win32.Build.0 = Debug|Win32 + {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}.Debug|x64.ActiveCfg = Debug|Win32 + {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}.Release|Win32.ActiveCfg = Release|Win32 + {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}.Release|Win32.Build.0 = Release|Win32 + {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}.Release|x64.ActiveCfg = Release|Win32 + {824DA4CF-06F0-45C9-929A-8792F0E19C3E}.Debug|Win32.ActiveCfg = Debug|Win32 + {824DA4CF-06F0-45C9-929A-8792F0E19C3E}.Debug|Win32.Build.0 = Debug|Win32 + {824DA4CF-06F0-45C9-929A-8792F0E19C3E}.Debug|x64.ActiveCfg = Debug|Win32 + {824DA4CF-06F0-45C9-929A-8792F0E19C3E}.Release|Win32.ActiveCfg = Release|Win32 + {824DA4CF-06F0-45C9-929A-8792F0E19C3E}.Release|Win32.Build.0 = Release|Win32 + {824DA4CF-06F0-45C9-929A-8792F0E19C3E}.Release|x64.ActiveCfg = Release|Win32 + {39EC200D-7795-4FF8-B214-B24EDA5526AE}.Debug|Win32.ActiveCfg = Debug|Win32 + {39EC200D-7795-4FF8-B214-B24EDA5526AE}.Debug|Win32.Build.0 = Debug|Win32 + {39EC200D-7795-4FF8-B214-B24EDA5526AE}.Debug|x64.ActiveCfg = Debug|Win32 + {39EC200D-7795-4FF8-B214-B24EDA5526AE}.Release|Win32.ActiveCfg = Release|Win32 + {39EC200D-7795-4FF8-B214-B24EDA5526AE}.Release|Win32.Build.0 = Release|Win32 + {39EC200D-7795-4FF8-B214-B24EDA5526AE}.Release|x64.ActiveCfg = Release|Win32 + {718DE063-A18B-BB72-9150-62B892E6FFA6}.Debug|Win32.ActiveCfg = Debug|Win32 + {718DE063-A18B-BB72-9150-62B892E6FFA6}.Debug|Win32.Build.0 = Debug|Win32 + {718DE063-A18B-BB72-9150-62B892E6FFA6}.Debug|x64.ActiveCfg = Debug|Win32 + {718DE063-A18B-BB72-9150-62B892E6FFA6}.Release|Win32.ActiveCfg = Release|Win32 + {718DE063-A18B-BB72-9150-62B892E6FFA6}.Release|Win32.Build.0 = Release|Win32 + {718DE063-A18B-BB72-9150-62B892E6FFA6}.Release|x64.ActiveCfg = Release|Win32 + {2FA8F384-0775-F3B7-F8C3-85209222FC70}.Debug|Win32.ActiveCfg = Debug|Win32 + {2FA8F384-0775-F3B7-F8C3-85209222FC70}.Debug|Win32.Build.0 = Debug|Win32 + {2FA8F384-0775-F3B7-F8C3-85209222FC70}.Debug|x64.ActiveCfg = Debug|Win32 + {2FA8F384-0775-F3B7-F8C3-85209222FC70}.Release|Win32.ActiveCfg = Release|Win32 + {2FA8F384-0775-F3B7-F8C3-85209222FC70}.Release|Win32.Build.0 = Release|Win32 + {2FA8F384-0775-F3B7-F8C3-85209222FC70}.Release|x64.ActiveCfg = Release|Win32 + {54509728-928B-44D9-A118-A6F92F08B34F}.Debug|Win32.ActiveCfg = Debug|Win32 + {54509728-928B-44D9-A118-A6F92F08B34F}.Debug|Win32.Build.0 = Debug|Win32 + {54509728-928B-44D9-A118-A6F92F08B34F}.Debug|x64.ActiveCfg = Debug|Win32 + {54509728-928B-44D9-A118-A6F92F08B34F}.Release|Win32.ActiveCfg = Release|Win32 + {54509728-928B-44D9-A118-A6F92F08B34F}.Release|Win32.Build.0 = Release|Win32 + {54509728-928B-44D9-A118-A6F92F08B34F}.Release|x64.ActiveCfg = Release|Win32 + {E3DCBC31-7FC9-D127-E000-529F8460D5FD}.Debug|Win32.ActiveCfg = Debug|Win32 + {E3DCBC31-7FC9-D127-E000-529F8460D5FD}.Debug|Win32.Build.0 = Debug|Win32 + {E3DCBC31-7FC9-D127-E000-529F8460D5FD}.Debug|x64.ActiveCfg = Debug|Win32 + {E3DCBC31-7FC9-D127-E000-529F8460D5FD}.Release|Win32.ActiveCfg = Release|Win32 + {E3DCBC31-7FC9-D127-E000-529F8460D5FD}.Release|Win32.Build.0 = Release|Win32 + {E3DCBC31-7FC9-D127-E000-529F8460D5FD}.Release|x64.ActiveCfg = Release|Win32 + {B3FC9DFC-7268-8660-7C0D-B60BAF02C554}.Debug|Win32.ActiveCfg = Debug|Win32 + {B3FC9DFC-7268-8660-7C0D-B60BAF02C554}.Debug|Win32.Build.0 = Debug|Win32 + {B3FC9DFC-7268-8660-7C0D-B60BAF02C554}.Debug|x64.ActiveCfg = Debug|Win32 + {B3FC9DFC-7268-8660-7C0D-B60BAF02C554}.Release|Win32.ActiveCfg = Release|Win32 + {B3FC9DFC-7268-8660-7C0D-B60BAF02C554}.Release|Win32.Build.0 = Release|Win32 + {B3FC9DFC-7268-8660-7C0D-B60BAF02C554}.Release|x64.ActiveCfg = Release|Win32 + {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Debug|Win32.ActiveCfg = Debug|Win32 + {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Debug|Win32.Build.0 = Debug|Win32 + {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Debug|x64.ActiveCfg = Debug|Win32 + {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Release|Win32.ActiveCfg = Release|Win32 + {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Release|Win32.Build.0 = Release|Win32 + {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Release|x64.ActiveCfg = Release|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|Win32.ActiveCfg = Debug|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|Win32.Build.0 = Debug|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|x64.ActiveCfg = Debug|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|Win32.ActiveCfg = Release|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|Win32.Build.0 = Release|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|x64.ActiveCfg = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {74E3E3B8-3E51-4003-816B-8ED3057AAC21} + EndGlobalSection +EndGlobal diff --git a/Workspace_msvc/decoder.vcxproj b/Workspace_msvc/decoder.vcxproj index e59992847..1ea98099d 100644 --- a/Workspace_msvc/decoder.vcxproj +++ b/Workspace_msvc/decoder.vcxproj @@ -1,171 +1,171 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - decoder - {E3DCBC31-7FC9-D127-E000-529F8460D5FD} - decoder - 10.0.17763.0 - - - - Application - v141 - false - MultiByte - - - Application - v141 - false - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - ..\ - .\Debug_$(ProjectName)\ - false - false - IVAS_dec - - - ..\ - .\Release_$(ProjectName)\ - false - false - IVAS_dec - - - - - - - $(IntDir)$(ProjectName).tlb - - - - Disabled - ..\lib_dec;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) - - EnableFastChecks - MultiThreadedDebug - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - - $(OutDir)$(TargetName).exe - true - - true - $(IntDir)$(ProjectName).pdb - Console - false - - MachineX86 - - - - - $(IntDir)$(ProjectName).tlb - - - - MaxSpeed - AnySuitable - false - Neither - false - false - ..\lib_dec;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - Precise - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - - Default - %(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - $(OutDir)$(TargetName).exe - true - - false - $(IntDir)$(ProjectName).pdb - Console - false - - MachineX86 - libcmtd.lib - - - - - - - - {e822ddaf-0f5f-4cd0-a694-38ae69de74d3} - false - - - {2fa8f384-0775-f3b7-f8c3-85209222fc70} - false - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + decoder + {E3DCBC31-7FC9-D127-E000-529F8460D5FD} + decoder + 10.0.17763.0 + + + + Application + v141 + false + MultiByte + + + Application + v141 + false + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + ..\ + .\Debug_$(ProjectName)\ + false + false + IVAS_dec + + + ..\ + .\Release_$(ProjectName)\ + false + false + IVAS_dec + + + + + + + $(IntDir)$(ProjectName).tlb + + + + Disabled + ..\lib_dec;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) + + EnableFastChecks + MultiThreadedDebug + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + OldStyle + Default + %(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + + $(OutDir)$(TargetName).exe + true + + true + $(IntDir)$(ProjectName).pdb + Console + false + + MachineX86 + + + + + $(IntDir)$(ProjectName).tlb + + + + MaxSpeed + AnySuitable + false + Neither + false + false + ..\lib_dec;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + Precise + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + + Default + %(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + $(OutDir)$(TargetName).exe + true + + false + $(IntDir)$(ProjectName).pdb + Console + false + + MachineX86 + libcmtd.lib + + + + + + + + {e822ddaf-0f5f-4cd0-a694-38ae69de74d3} + false + + + {2fa8f384-0775-f3b7-f8c3-85209222fc70} + false + + + + + + + + + + \ No newline at end of file diff --git a/Workspace_msvc/encoder.vcxproj b/Workspace_msvc/encoder.vcxproj index 9578e488d..5ec7a2c01 100644 --- a/Workspace_msvc/encoder.vcxproj +++ b/Workspace_msvc/encoder.vcxproj @@ -1,178 +1,178 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - encoder - {B3FC9DFC-7268-8660-7C0D-B60BAF02C554} - encoder - 10.0.17763.0 - - - - Application - v141 - false - MultiByte - - - Application - v141 - false - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - ..\ - .\Debug_$(ProjectName)\ - false - false - IVAS_cod - - - ..\ - .\Release_$(ProjectName)\ - false - false - IVAS_cod - - - - - - - $(IntDir)$(ProjectName).tlb - - - - Disabled - ..\lib_enc;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) - - EnableFastChecks - MultiThreadedDebug - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - - $(OutDir)$(TargetName).exe - true - - false - true - $(IntDir)$(ProjectName).pdb - Console - - false - - MachineX86 - - - - - - - - - - - $(IntDir)$(ProjectName).tlb - - - - MaxSpeed - AnySuitable - false - Neither - false - false - ..\lib_enc;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - Precise - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - - Default - %(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - $(OutDir)$(TargetName).exe - true - - false - $(IntDir)$(ProjectName).pdb - Console - false - - MachineX86 - - - - - - - - {824da4cf-06f0-45c9-929a-8792f0e19c3e} - false - - - {2fa8f384-0775-f3b7-f8c3-85209222fc70} - false - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + encoder + {B3FC9DFC-7268-8660-7C0D-B60BAF02C554} + encoder + 10.0.17763.0 + + + + Application + v141 + false + MultiByte + + + Application + v141 + false + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + ..\ + .\Debug_$(ProjectName)\ + false + false + IVAS_cod + + + ..\ + .\Release_$(ProjectName)\ + false + false + IVAS_cod + + + + + + + $(IntDir)$(ProjectName).tlb + + + + Disabled + ..\lib_enc;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) + + EnableFastChecks + MultiThreadedDebug + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + OldStyle + Default + %(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + + $(OutDir)$(TargetName).exe + true + + false + true + $(IntDir)$(ProjectName).pdb + Console + + false + + MachineX86 + + + + + + + + + + + $(IntDir)$(ProjectName).tlb + + + + MaxSpeed + AnySuitable + false + Neither + false + false + ..\lib_enc;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + Precise + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + + Default + %(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + $(OutDir)$(TargetName).exe + true + + false + $(IntDir)$(ProjectName).pdb + Console + false + + MachineX86 + + + + + + + + {824da4cf-06f0-45c9-929a-8792f0e19c3e} + false + + + {2fa8f384-0775-f3b7-f8c3-85209222fc70} + false + + + + + + + + + + \ No newline at end of file diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj index 0c5d4dcca..b118e727a 100644 --- a/Workspace_msvc/lib_com.vcxproj +++ b/Workspace_msvc/lib_com.vcxproj @@ -1,309 +1,309 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {39EC200D-7795-4FF8-B214-B24EDA5526AE} - common - 10.0.17763.0 - - - - StaticLibrary - v141 - false - MultiByte - - - StaticLibrary - v141 - false - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - libivascom - - - .\Release_$(ProjectName)\ - .\Release_$(ProjectName)\ - libivascom - - - - - - - Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) - - EnableFastChecks - MultiThreadedDebug - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - - - MaxSpeed - AnySuitable - false - Neither - false - false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - - - $(IntDir)$(ProjectName).pdb - Level4 - true - - Default - %(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + {39EC200D-7795-4FF8-B214-B24EDA5526AE} + common + 10.0.17763.0 + + + + StaticLibrary + v141 + false + MultiByte + + + StaticLibrary + v141 + false + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + .\Debug_$(ProjectName)\ + .\Debug_$(ProjectName)\ + libivascom + + + .\Release_$(ProjectName)\ + .\Release_$(ProjectName)\ + libivascom + + + + + + + Disabled + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) + + EnableFastChecks + MultiThreadedDebug + + + $(IntDir)$(ProjectName).pdb + Level4 + true + OldStyle + Default + %(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + + + + MaxSpeed + AnySuitable + false + Neither + false + false + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + + + $(IntDir)$(ProjectName).pdb + Level4 + true + + Default + %(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Workspace_msvc/lib_com.vcxproj.filters b/Workspace_msvc/lib_com.vcxproj.filters index 85fd7e8d6..66edeac26 100644 --- a/Workspace_msvc/lib_com.vcxproj.filters +++ b/Workspace_msvc/lib_com.vcxproj.filters @@ -1,551 +1,551 @@ - - - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_evs_c - - - common_evs_c - - - common_evs_c - - - common_evs_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_evs_c - - - common_evs_c - - - common_evs_c - - - common_evs_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - - common_h - - - - - - {890c2f45-9385-4fce-859b-6a65469e8dc0} - - - {201ea764-9626-4dca-9cc4-5b4106f8b8b2} - - - {fbb860e2-79d0-45b1-ada1-c3a0a369ce2c} - - - {b95b7bed-a666-4a00-9332-2b528638503e} - - + + + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_evs_c + + + common_evs_c + + + common_evs_c + + + common_evs_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_evs_c + + + common_evs_c + + + common_evs_c + + + common_evs_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + + common_h + + + + + + {890c2f45-9385-4fce-859b-6a65469e8dc0} + + + {201ea764-9626-4dca-9cc4-5b4106f8b8b2} + + + {fbb860e2-79d0-45b1-ada1-c3a0a369ce2c} + + + {b95b7bed-a666-4a00-9332-2b528638503e} + + \ No newline at end of file diff --git a/Workspace_msvc/lib_debug.vcxproj b/Workspace_msvc/lib_debug.vcxproj index f54f282f0..7a3f87e44 100644 --- a/Workspace_msvc/lib_debug.vcxproj +++ b/Workspace_msvc/lib_debug.vcxproj @@ -1,116 +1,121 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {54509728-928B-44D9-A118-A6F92F08B34F} - debug - 10.0.17763.0 - - - - StaticLibrary - v141 - MultiByte - - - StaticLibrary - v141 - MultiByte - true - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - libivasdebug - - - .\Release_$(ProjectName)\ - .\Release_$(ProjectName)\ - libivasdebug - - - - - - - Disabled - ..\lib_com;..\lib_debug;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) - false - - EnableFastChecks - MultiThreadedDebug - false - $(IntDir)$(ProjectName).pdb - Level4 - OldStyle - Default - %(DisableSpecificWarnings) - - - $(OutDir)$(TargetName).lib - - - - - - - - MaxSpeed - AnySuitable - false - false - ..\lib_com;..\lib_debug;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - $(IntDir)$(ProjectName).pdb - Level4 - - Default - %(DisableSpecificWarnings) - - - $(OutDir)$(TargetName).lib - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + {54509728-928B-44D9-A118-A6F92F08B34F} + debug + 10.0.17763.0 + + + + StaticLibrary + v141 + MultiByte + + + StaticLibrary + v141 + MultiByte + true + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + .\Debug_$(ProjectName)\ + .\Debug_$(ProjectName)\ + libivasdebug + + + .\Release_$(ProjectName)\ + .\Release_$(ProjectName)\ + libivasdebug + + + + + + + Disabled + ..\lib_com;..\lib_debug;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) + false + + EnableFastChecks + MultiThreadedDebug + false + $(IntDir)$(ProjectName).pdb + Level4 + OldStyle + Default + %(DisableSpecificWarnings) + + + $(OutDir)$(TargetName).lib + + + + + + + + MaxSpeed + AnySuitable + false + false + ..\lib_com;..\lib_debug;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + $(IntDir)$(ProjectName).pdb + Level4 + + Default + %(DisableSpecificWarnings) + + + $(OutDir)$(TargetName).lib + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Workspace_msvc/lib_dec.vcxproj b/Workspace_msvc/lib_dec.vcxproj index 0266955ab..55dcb0cdd 100644 --- a/Workspace_msvc/lib_dec.vcxproj +++ b/Workspace_msvc/lib_dec.vcxproj @@ -1,349 +1,349 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - lib_dec - {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3} - evs_dec - 10.0.17763.0 - - - StaticLibrary - v141 - false - MultiByte - - - - StaticLibrary - v141 - false - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - false - false - libivasdec - - - .\Release_$(ProjectName)\ - .\Release_$(ProjectName)\ - false - false - libivasdec - - - - - - - .\Debug\$(ProjectName).tlb - - - - Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) - - EnableFastChecks - MultiThreadedDebug - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - - - $(IntDir)$(ProjectName).tlb - - - - MaxSpeed - AnySuitable - false - Neither - false - false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - - Default - %(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {39ec200d-7795-4ff8-b214-b24eda5526ae} - false - - - {54509728-928b-44d9-a118-a6f92f08b34f} - false - - - {718DE063-A18B-BB72-9150-62B892E6FFA6} - false - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + lib_dec + {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3} + evs_dec + 10.0.17763.0 + + + StaticLibrary + v141 + false + MultiByte + + + + StaticLibrary + v141 + false + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + .\Debug_$(ProjectName)\ + .\Debug_$(ProjectName)\ + false + false + libivasdec + + + .\Release_$(ProjectName)\ + .\Release_$(ProjectName)\ + false + false + libivasdec + + + + + + + .\Debug\$(ProjectName).tlb + + + + Disabled + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) + + EnableFastChecks + MultiThreadedDebug + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + OldStyle + Default + %(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + + + + $(IntDir)$(ProjectName).tlb + + + + MaxSpeed + AnySuitable + false + Neither + false + false + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + + Default + %(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {39ec200d-7795-4ff8-b214-b24eda5526ae} + false + + + {54509728-928b-44d9-a118-a6f92f08b34f} + false + + + {718DE063-A18B-BB72-9150-62B892E6FFA6} + false + + + + + + + + + + + diff --git a/Workspace_msvc/lib_dec.vcxproj.filters b/Workspace_msvc/lib_dec.vcxproj.filters index 24d58eb97..80340b480 100644 --- a/Workspace_msvc/lib_dec.vcxproj.filters +++ b/Workspace_msvc/lib_dec.vcxproj.filters @@ -1,572 +1,572 @@ - - - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - - - - {f63b6db2-97ec-4d8d-be9c-e798ac8bb645} - - - {0853864e-7de7-411d-975b-5045652f22c3} - - - {e29aae34-aeeb-45dd-a986-61b39890c5bb} - - - {c33b80b3-67ce-466b-91c0-4adfc9efcb5c} - - + + + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + + + + {f63b6db2-97ec-4d8d-be9c-e798ac8bb645} + + + {0853864e-7de7-411d-975b-5045652f22c3} + + + {e29aae34-aeeb-45dd-a986-61b39890c5bb} + + + {c33b80b3-67ce-466b-91c0-4adfc9efcb5c} + + \ No newline at end of file diff --git a/Workspace_msvc/lib_enc.vcxproj b/Workspace_msvc/lib_enc.vcxproj index e2db02d61..afaac6e1b 100644 --- a/Workspace_msvc/lib_enc.vcxproj +++ b/Workspace_msvc/lib_enc.vcxproj @@ -1,365 +1,365 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - lib_enc - {824DA4CF-06F0-45C9-929A-8792F0E19C3E} - evs_enc - 10.0.17763.0 - - - - StaticLibrary - v141 - false - MultiByte - - - StaticLibrary - v141 - false - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - false - false - libivasenc - - - .\Release_$(ProjectName)\ - .\Release_$(ProjectName)\ - false - false - libivasenc - - - - - - - $(IntDir)$(ProjectName).tlb - - - - Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) - - EnableFastChecks - MultiThreadedDebug - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - - - - - - $(IntDir)$(ProjectName).tlb - - - - MaxSpeed - AnySuitable - false - Neither - false - false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - Precise - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - - Default - %(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {39ec200d-7795-4ff8-b214-b24eda5526ae} - false - - - {54509728-928b-44d9-a118-a6f92f08b34f} - false - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + lib_enc + {824DA4CF-06F0-45C9-929A-8792F0E19C3E} + evs_enc + 10.0.17763.0 + + + + StaticLibrary + v141 + false + MultiByte + + + StaticLibrary + v141 + false + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + .\Debug_$(ProjectName)\ + .\Debug_$(ProjectName)\ + false + false + libivasenc + + + .\Release_$(ProjectName)\ + .\Release_$(ProjectName)\ + false + false + libivasenc + + + + + + + $(IntDir)$(ProjectName).tlb + + + + Disabled + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) + + EnableFastChecks + MultiThreadedDebug + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + OldStyle + Default + %(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + + + + + + + $(IntDir)$(ProjectName).tlb + + + + MaxSpeed + AnySuitable + false + Neither + false + false + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + Precise + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + + Default + %(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {39ec200d-7795-4ff8-b214-b24eda5526ae} + false + + + {54509728-928b-44d9-a118-a6f92f08b34f} + false + + + + + + + + + + + diff --git a/Workspace_msvc/lib_enc.vcxproj.filters b/Workspace_msvc/lib_enc.vcxproj.filters index 250aecf0b..4995de5c9 100644 --- a/Workspace_msvc/lib_enc.vcxproj.filters +++ b/Workspace_msvc/lib_enc.vcxproj.filters @@ -1,629 +1,629 @@ - - - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_evs_c - - - enc_evs_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_all_c - - - enc_evs_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - - - enc_h - - - enc_h - - - enc_h - - - enc_h - - - - - - {b7ee0526-8b79-4554-a3ec-04e51d38475f} - - - {dabed049-70a2-48f2-9da6-3b81a3664033} - - - {5717f1cb-c593-400b-b23a-45c422fd95c8} - - - {6cccabbe-510f-43d3-90e1-8ed5ea3837d7} - - + + + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_evs_c + + + enc_evs_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_all_c + + + enc_evs_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + + + enc_h + + + enc_h + + + enc_h + + + enc_h + + + + + + {b7ee0526-8b79-4554-a3ec-04e51d38475f} + + + {dabed049-70a2-48f2-9da6-3b81a3664033} + + + {5717f1cb-c593-400b-b23a-45c422fd95c8} + + + {6cccabbe-510f-43d3-90e1-8ed5ea3837d7} + + \ No newline at end of file diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index ee40123a8..021a037fb 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -1,207 +1,207 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - lib_rend - {718DE063-A18B-BB72-9150-62B892E6FFA6} - evs_dec - 10.0.17763.0 - - - StaticLibrary - v141 - false - MultiByte - - - - StaticLibrary - v141 - false - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - false - false - libivasrend - - - .\Release_$(ProjectName)\ - .\Release_$(ProjectName)\ - false - false - libivasrend - - - - - - - .\Debug\$(ProjectName).tlb - - - - Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) - - EnableFastChecks - MultiThreadedDebug - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - - - $(IntDir)$(ProjectName).tlb - - - - MaxSpeed - AnySuitable - false - Neither - false - false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - - Default - %(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {39ec200d-7795-4ff8-b214-b24eda5526ae} - false - - - {54509728-928b-44d9-a118-a6f92f08b34f} - false - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + lib_rend + {718DE063-A18B-BB72-9150-62B892E6FFA6} + evs_dec + 10.0.17763.0 + + + StaticLibrary + v141 + false + MultiByte + + + + StaticLibrary + v141 + false + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + .\Debug_$(ProjectName)\ + .\Debug_$(ProjectName)\ + false + false + libivasrend + + + .\Release_$(ProjectName)\ + .\Release_$(ProjectName)\ + false + false + libivasrend + + + + + + + .\Debug\$(ProjectName).tlb + + + + Disabled + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) + + EnableFastChecks + MultiThreadedDebug + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + OldStyle + Default + %(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + + + + $(IntDir)$(ProjectName).tlb + + + + MaxSpeed + AnySuitable + false + Neither + false + false + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + + Default + %(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {39ec200d-7795-4ff8-b214-b24eda5526ae} + false + + + {54509728-928b-44d9-a118-a6f92f08b34f} + false + + + + + + + + + + \ No newline at end of file diff --git a/Workspace_msvc/lib_rend.vcxproj.filters b/Workspace_msvc/lib_rend.vcxproj.filters index 4707a48b2..e5e6c9401 100644 --- a/Workspace_msvc/lib_rend.vcxproj.filters +++ b/Workspace_msvc/lib_rend.vcxproj.filters @@ -1,221 +1,221 @@ - - - - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - - - - rend_h - - - rend_h - - - rend_h - - - rend_h - - - rend_h - - - rend_h - - - rend_h - - - rend_h - - - rend_h - - - rend_h - - - rend_h - - - - - {54449ece-ef29-44b5-9512-ed8f555851a8} - - - {672b0eb6-cce8-425c-8bf2-aba4b45639bb} - - + + + + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + + + + rend_h + + + rend_h + + + rend_h + + + rend_h + + + rend_h + + + rend_h + + + rend_h + + + rend_h + + + rend_h + + + rend_h + + + rend_h + + + + + {54449ece-ef29-44b5-9512-ed8f555851a8} + + + {672b0eb6-cce8-425c-8bf2-aba4b45639bb} + + \ No newline at end of file diff --git a/Workspace_msvc/lib_util.vcxproj b/Workspace_msvc/lib_util.vcxproj index 6696ee00a..889d6f79c 100644 --- a/Workspace_msvc/lib_util.vcxproj +++ b/Workspace_msvc/lib_util.vcxproj @@ -1,156 +1,156 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {2FA8F384-0775-F3B7-F8C3-85209222FC70} - utility - 10.0.17763.0 - - - - StaticLibrary - v141 - MultiByte - - - StaticLibrary - v141 - MultiByte - true - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - true - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - libivasutil - - - false - .\Release_$(ProjectName)\ - .\Release_$(ProjectName)\ - libivasutil - - - - Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);ZLIB_WINAPI;%(PreprocessorDefinitions) - false - - EnableFastChecks - MultiThreadedDebug - false - $(IntDir)$(ProjectName).pdb - Level4 - OldStyle - Default - %(DisableSpecificWarnings) - - - $(OutDir)$(TargetName).lib - - - - - MaxSpeed - AnySuitable - false - false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);ZLIB_WINAPI;%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - $(IntDir)$(ProjectName).pdb - Level4 - - Default - %(DisableSpecificWarnings) - - - $(OutDir)$(TargetName).lib - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + {2FA8F384-0775-F3B7-F8C3-85209222FC70} + utility + 10.0.17763.0 + + + + StaticLibrary + v141 + MultiByte + + + StaticLibrary + v141 + MultiByte + true + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + true + .\Debug_$(ProjectName)\ + .\Debug_$(ProjectName)\ + libivasutil + + + false + .\Release_$(ProjectName)\ + .\Release_$(ProjectName)\ + libivasutil + + + + Disabled + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);ZLIB_WINAPI;%(PreprocessorDefinitions) + false + + EnableFastChecks + MultiThreadedDebug + false + $(IntDir)$(ProjectName).pdb + Level4 + OldStyle + Default + %(DisableSpecificWarnings) + + + $(OutDir)$(TargetName).lib + + + + + MaxSpeed + AnySuitable + false + false + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);ZLIB_WINAPI;%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + $(IntDir)$(ProjectName).pdb + Level4 + + Default + %(DisableSpecificWarnings) + + + $(OutDir)$(TargetName).lib + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Workspace_msvc/renderer.vcxproj b/Workspace_msvc/renderer.vcxproj index c62874ec0..b51cde0bc 100644 --- a/Workspace_msvc/renderer.vcxproj +++ b/Workspace_msvc/renderer.vcxproj @@ -1,180 +1,180 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - renderer - {12B4C8A5-1E06-4E30-B443-D1F916F52B47} - renderer - 10.0.17763.0 - - - - Application - v141 - false - MultiByte - - - Application - v141 - false - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - ..\ - .\Debug_$(ProjectName)\ - false - false - IVAS_rend - - - ..\ - .\Release_$(ProjectName)\ - false - false - IVAS_rend - - - - $(IntDir)$(ProjectName).tlb - - - - Disabled - ..\lib_com;..\lib_debug;..\lib_util;..\lib_rend;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) - - EnableFastChecks - MultiThreadedDebug - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - - $(OutDir)$(TargetName).exe - true - - true - $(IntDir)$(ProjectName).pdb - Console - false - - MachineX86 - - - - - $(IntDir)$(ProjectName).tlb - - - - MaxSpeed - AnySuitable - false - Neither - false - false - ..\lib_com;..\lib_debug;..\lib_util;..\lib_rend;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - Precise - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - - Default - %(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - $(OutDir)$(TargetName).exe - true - - false - $(IntDir)$(ProjectName).pdb - Console - false - - MachineX86 - libcmtd.lib - - - - - - - - {54509728-928B-44D9-A118-A6F92F08B34F} - false - - - {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3} - false - - - {2FA8F384-0775-F3B7-F8C3-85209222FC70} - false - - - {39ec200d-7795-4ff8-b214-b24eda5526ae} - false - - - {718DE063-A18B-BB72-9150-62B892E6FFA6} - false - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + renderer + {12B4C8A5-1E06-4E30-B443-D1F916F52B47} + renderer + 10.0.17763.0 + + + + Application + v141 + false + MultiByte + + + Application + v141 + false + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + ..\ + .\Debug_$(ProjectName)\ + false + false + IVAS_rend + + + ..\ + .\Release_$(ProjectName)\ + false + false + IVAS_rend + + + + $(IntDir)$(ProjectName).tlb + + + + Disabled + ..\lib_com;..\lib_debug;..\lib_util;..\lib_rend;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) + + EnableFastChecks + MultiThreadedDebug + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + OldStyle + Default + %(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + + $(OutDir)$(TargetName).exe + true + + true + $(IntDir)$(ProjectName).pdb + Console + false + + MachineX86 + + + + + $(IntDir)$(ProjectName).tlb + + + + MaxSpeed + AnySuitable + false + Neither + false + false + ..\lib_com;..\lib_debug;..\lib_util;..\lib_rend;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + Precise + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + + Default + %(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + $(OutDir)$(TargetName).exe + true + + false + $(IntDir)$(ProjectName).pdb + Console + false + + MachineX86 + libcmtd.lib + + + + + + + + {54509728-928B-44D9-A118-A6F92F08B34F} + false + + + {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3} + false + + + {2FA8F384-0775-F3B7-F8C3-85209222FC70} + false + + + {39ec200d-7795-4ff8-b214-b24eda5526ae} + false + + + {718DE063-A18B-BB72-9150-62B892E6FFA6} + false + + + + + + + + + + \ No newline at end of file diff --git a/apps/decoder.c b/apps/decoder.c index 0a4da2bdb..7b3a5410d 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -43,7 +43,14 @@ #include "masa_file_writer.h" #include "render_config_reader.h" #include "rotation_file_reader.h" +#ifdef VARIABLE_SPEED_DECODING +#include "tsm_scale_file_reader.h" +#include +#endif #include "vector3_pair_file_reader.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -53,7 +60,7 @@ * Local constants *------------------------------------------------------------------------------------------*/ -#if !defined( WMOPS ) +#if !defined( DEBUGGING ) && !defined( WMOPS ) static #endif int32_t frame = 0; /* Counter of frames */ @@ -68,6 +75,9 @@ static #define ORIENT_TRK_REF_VEC ( 3 ) #define ORIENT_TRK_REF_VEC_LEV ( 4 ) +#ifdef VARIABLE_SPEED_DECODING +#define VARIABLE_SPEED_FETCH_FRAMESIZE_MS 20 +#endif #define JBM_FRONTEND_FETCH_FRAMESIZE_MS 20 #define HEADROTATION_FETCH_FRAMESIZE_MS 5 #define DEFAULT_FETCH_FRAMESIZE_MS 20 @@ -114,6 +124,17 @@ typedef struct IVAS_DEC_COMPLEXITY_LEVEL complexityLevel; bool tsmEnabled; IVAS_RENDER_FRAMESIZE renderFramesize; +#ifdef DEBUGGING + IVAS_DEC_FORCED_REND_MODE forcedRendMode; +#ifdef DEBUG_FOA_AGC + FILE *agcBitstream; /* temporary */ +#endif +#ifdef VARIABLE_SPEED_DECODING + bool tsmScaleFileEnabled; + char *tsmScaleFileName; + uint16_t tsmScale; +#endif +#endif uint16_t acousticEnvironmentId; int16_t Opt_dpid_on; uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS]; @@ -130,6 +151,11 @@ static void usage_dec( void ); static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec ); +#ifdef DEBUGGING +static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); +static int16_t app_own_random( int16_t *seed ); +static IVAS_DEC_FORCED_REND_MODE parseForcedRendModeDec( char *forcedRendModeChar ); +#endif /*------------------------------------------------------------------------------------------* * main() @@ -157,7 +183,17 @@ int main( RenderConfigReader *renderConfigReader = NULL; int16_t *pcmBuf = NULL; IVAS_RENDER_FRAMESIZE asked_frame_size; +#ifdef DEBUGGING + int32_t noClipping; + int32_t cnt_frames_limited; +#ifdef DEBUG_SBA_AUDIO_DUMP + int16_t numOutChannels, numTransportChannels, pca_ingest_channels; +#endif +#endif +#ifdef DEBUGGING + dbgargs( &argc, argv ); +#endif #ifdef WMOPS reset_wmops(); reset_mem( USE_BYTES ); @@ -398,7 +434,110 @@ int main( } } +#ifdef DEBUGGING + /*-----------------------------------------------------------------* + * Preview bitstream and print config information + *-----------------------------------------------------------------*/ + + if ( arg.voipMode ) + { + if ( ( error = printBitstreamInfoVoip( arg, hBsReader, hIvasDec ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error while previewing VoIP bitstream: %s\n", ivas_error_to_string( error ) ); + goto cleanup; + } + } + else + { + uint16_t bit_stream[IVAS_MAX_BITS_PER_FRAME + 4 * 8]; + int16_t num_bits; + int16_t bfi = 0; + do + { + if ( BS_Reader_ReadFrame_short( hBsReader, bit_stream, &num_bits, &bfi ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError: input bitstream file %s couldn't be read\n\n", arg.inputBitstreamFilename ); + goto cleanup; + } + } while ( bfi || num_bits < MIN_NUM_BITS_ACTIVE_FRAME || num_bits == NUM_BITS_SID_IVAS_5K2 ); + + BS_Reader_Rewind( hBsReader ); + + IVAS_DEC_PrintConfigWithBitstream( hIvasDec, arg.quietModeEnabled, bit_stream, num_bits ); + +#ifdef VARIABLE_SPEED_DECODING + if ( arg.tsmEnabled ) + { + if ( arg.tsmScaleFileEnabled ) + { + fprintf( stdout, "Variable speed file: %s\n", arg.tsmScaleFileName ); + } + else + { + fprintf( stdout, "Variable speed factor: %i\n", arg.tsmScale ); + } + } +#endif + } + + /*------------------------------------------------------------------------------------------* + * Binaural rendering mode: set and print info + *------------------------------------------------------------------------------------------*/ + + if ( arg.forcedRendMode != IVAS_DEC_FORCE_REND_UNFORCED ) + { + if ( ( error = IVAS_DEC_SetForcedRendMode( hIvasDec, arg.forcedRendMode ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError: Forcing binaural rendering mode failed (only TDREND and CLDFBREND are expected).\n\n" ); + goto cleanup; + } + + if ( arg.forcedRendMode == IVAS_DEC_FORCE_REND_TD_RENDERER ) + { + fprintf( stdout, "Forcing rendering to: TD renderer\n" ); + } + else if ( arg.forcedRendMode == IVAS_DEC_FORCE_REND_CLDFB_RENDERER ) + { + fprintf( stdout, "Forcing rendering to: CLDFB renderer\n" ); + } + } + + /*-----------------------------------------------------------------* + * Open Error pattern file for simulation + *-----------------------------------------------------------------*/ + + if ( arg.FEPatternFileName != NULL ) + { + if ( ( FEC_pattern = fopen( arg.FEPatternFileName, "rb" ) ) == NULL ) + { + fprintf( stderr, "Error: Missing or incorrect FEC filename specification\n\n" ); + usage_dec(); + goto cleanup; + } + } + +#ifdef DEBUG_SBA_AUDIO_DUMP + ivas_open_sba_decoder_debug_files( arg.output_Fs, 1, 1 ); +#endif + + /*-----------------------------------------------------------------* + * Print information about FEC + *-----------------------------------------------------------------*/ + + if ( !arg.voipMode && ( arg.FEPatternFileName != NULL || arg.FER > 0 ) ) + { + if ( arg.FEPatternFileName != NULL ) + { + fprintf( stdout, "FEC: %s\n", arg.FEPatternFileName ); + } + else + { + fprintf( stdout, "FEC: %.2f %%\n", arg.FER ); + } + } +#else IVAS_DEC_PrintConfig( hIvasDec, 1, arg.voipMode ); +#endif /*-------------------------------------------------------------------* * Load renderer configuration from file @@ -584,6 +723,16 @@ int main( goto cleanup; } +#ifdef DEBUGGING + if ( ( cnt_frames_limited = IVAS_DEC_GetCntFramesLimited( hIvasDec ) ) > 0 ) + { + fprintf( stdout, "Limiter applied in %d frames.\n\n", cnt_frames_limited ); + } + if ( ( noClipping = IVAS_DEC_GetNoCLipping( hIvasDec ) ) > 0 ) + { + fprintf( stdout, "Clipping (saturation) detected: %d samples clipped!!!\n\n", noClipping ); + } +#endif /*------------------------------------------------------------------------------------------* * Close files and deallocate resources @@ -595,6 +744,10 @@ cleanup: free( pcmBuf ); +#ifdef DEBUG_SBA_AUDIO_DUMP + IVAS_DEC_GetSbaDebugParams( hIvasDec, &numOutChannels, &numTransportChannels, &pca_ingest_channels ); + +#endif if ( arg.hrtfReaderEnabled ) { IVAS_DEC_HRTF_HANDLE hHrtfTD = NULL; @@ -628,6 +781,12 @@ cleanup: printf( "\n" ); } +#ifdef DEBUGGING +#ifdef DEBUG_SBA_AUDIO_DUMP + ivas_close_sba_decoder_debug_files( arg.output_Fs, numOutChannels, numTransportChannels, pca_ingest_channels ); +#endif + dbgclose(); +#endif return mainFailed ? -1 : 0; } @@ -728,6 +887,14 @@ static bool parseCmdlIVAS_dec( int16_t i; char argv_to_upper[FILENAME_MAX]; +#ifdef DEBUGGING + float ftmp; + + arg->forcedRendMode = IVAS_DEC_FORCE_REND_UNFORCED; +#ifdef DEBUG_FOA_AGC + arg->agcBitstream = NULL; +#endif +#endif arg->output_Fs = 48000; arg->outputConfig = IVAS_AUDIO_CONFIG_MONO; arg->decMode = IVAS_DEC_MODE_IVAS; @@ -770,6 +937,13 @@ static bool parseCmdlIVAS_dec( arg->non_diegetic_pan_gain = 0.f; arg->tsmEnabled = false; arg->renderFramesize = IVAS_RENDER_FRAMESIZE_20MS; +#ifdef DEBUGGING +#ifdef VARIABLE_SPEED_DECODING + arg->tsmScale = 100; + arg->tsmScaleFileEnabled = false; + arg->tsmScaleFileName = NULL; +#endif +#endif arg->acousticEnvironmentId = 65535; for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) { @@ -864,6 +1038,75 @@ static bool parseCmdlIVAS_dec( i++; } } +#ifdef DEBUGGING + else if ( strcmp( argv_to_upper, "-FEC" ) == 0 ) + { + ftmp = 0.0f; + if ( sscanf( argv[i + 1], "%f", &ftmp ) != 1 ) + { + arg->FEPatternFileName = argv[i + 1]; + } + else + { + arg->FER = ftmp; + } + i += 2; + } + else if ( strcmp( argv_to_upper, "-FORCE" ) == 0 ) + { + i++; + if ( i < argc - 3 ) + { + strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 ); + argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; + arg->forcedRendMode = parseForcedRendModeDec( argv_to_upper ); + i++; + } + } +#ifdef DEBUG_MODE_INFO +#ifdef DEBUG_MODE_INFO_TWEAK + /* Define additional subfolder for debug info output in ./res */ + else if ( strcmp( argv_to_upper, "-INFO" ) == 0 ) + { + extern char infoFolder[FILENAME_MAX]; + strncpy( infoFolder, argv[i + 1], sizeof( infoFolder ) ); + i += 2; + } +#endif /* #ifdef DEBUG_MODE_INFO_TWEAK */ +#endif /* #ifdef DEBUG_MODE_INFO */ +#ifdef VARIABLE_SPEED_DECODING + else if ( strcmp( argv_to_upper, "-VS" ) == 0 ) + { + i++; + int32_t tmp = 100; + arg->tsmEnabled = true; + if ( i < argc - 3 ) + { + if ( !is_digits_only( argv[i] ) ) + { + arg->tsmScaleFileEnabled = true; + arg->tsmScaleFileName = argv[i]; + i++; + } + else + { + if ( ( sscanf( argv[i], "%d", &tmp ) > 0 ) ) + { + i++; + } + } + arg->tsmScale = (uint16_t) tmp; + + if ( arg->tsmScale < 50 || arg->tsmScale > 150 ) + { + fprintf( stderr, "Error: Scaling factor value must be 50 <= fac <= 150!\n\n" ); + usage_dec(); + return false; + } + } + } +#endif +#endif /* #ifdef DEBUGGING */ else if ( strcmp( argv_to_upper, "-MIME" ) == 0 ) { @@ -1248,6 +1491,12 @@ static void usage_dec( void ) fprintf( stdout, " Reading RFC4867 AMR/AMR-WB RTP payload format is not supported.\n" ); #ifdef SUPPORT_JBM_TRACEFILE fprintf( stdout, "-Tracefile TF : VoIP mode: Generate trace file named TF\n" ); +#endif +#ifdef DEBUGGING +#ifdef VARIABLE_SPEED_DECODING + fprintf( stdout, "-VS fac : Variable Speed mode: change speed of playout fac as integer in percent.\n" ); + fprintf( stdout, " 50 <= fac <= 150; fac<100 faster, fac>100 slower\n" ); +#endif #endif fprintf( stdout, "-fr L : render frame size in ms L=(5,10,20), default is 20)\n" ); fprintf( stdout, "-fec_cfg_file : Optimal channel aware configuration computed by the JBM \n" ); @@ -1271,6 +1520,14 @@ static void usage_dec( void ) fprintf( stdout, "-render_config File : Renderer configuration File\n" ); fprintf( stdout, "-non_diegetic_pan P : panning mono non-diegetic sound to stereo with paning P, -90<= P <=90,\n" ); fprintf( stdout, " left or l or 90->left, right or r or -90->right, center or c or 0->middle\n" ); +#ifdef DEBUGGING + fprintf( stdout, "-FEC X : Insert frame erasures, X = 0-10 is the percentage\n" ); + fprintf( stdout, " of erased frames, or X may be the name of binary file or \n" ); + fprintf( stdout, " file with G192 headers indicating GOOD FRAME or BAD FRAME\n" ); + fprintf( stdout, " containing FEC pattern (short values of 0 (good) or 1 (bad))\n" ); + fprintf( stdout, " default is OFF, if this option is not used\n" ); + fprintf( stdout, "-force R : Force specific binaural rendering mode, R = (TDREND, CLDFBREND),\n" ); +#endif fprintf( stdout, "-exof File : External orientation File for external orientation trajectory\n" ); fprintf( stdout, "-dpid ID : Directivity pattern ID(s) = [ID1, ID2, ID3, ID4]. Space-separated list of up\n" ); fprintf( stdout, " to 4 numbers (unsigned integers) can be specified for BINAURAL and BINAURAL_ROOM_REVERB\n" ); @@ -1282,11 +1539,30 @@ static void usage_dec( void ) fprintf( stdout, " Currently, all values default to level 3 (full functionality).\n" ); fprintf( stdout, "-q : Quiet mode, no frame counter\n" ); fprintf( stdout, " default is deactivated\n" ); +#ifdef DEBUG_MODE_INFO +#ifdef DEBUG_MODE_INFO_TWEAK + fprintf( stdout, "-info : specify subfolder name for debug output\n" ); +#endif +#endif fprintf( stdout, "\n" ); return; } +#ifdef DEBUGGING +/*---------------------------------------------------------------------* + * app_own_random() + * + * Generator of random numbers + *---------------------------------------------------------------------*/ + +static int16_t app_own_random( int16_t *seed ) +{ + *seed = (int16_t) ( *seed * 31821L + 13849L ); + + return ( *seed ); +} +#endif /*---------------------------------------------------------------------* @@ -1477,6 +1753,9 @@ static ivas_error decodeG192( uint16_t bit_stream[IVAS_MAX_BITS_PER_FRAME + 4 * 8]; int16_t i, num_bits; int16_t bfi = 0; +#ifdef DEBUGGING + int16_t fec_seed = 12558; /* FEC_SEED */ +#endif AudioFileWriter *afWriter = NULL; MasaFileWriter *masaWriter = NULL; bool decodedGoodFrame = false; @@ -1492,6 +1771,12 @@ static ivas_error decodeG192( uint16_t nSamplesAvailableNext; bool needNewFrame; int16_t nSamplesRendered, nSamplesRendered_loop, nSamplesToRender; +#ifdef DEBUGGING +#ifdef VARIABLE_SPEED_DECODING + TsmScaleFileReader *tsmScaleFileReader = NULL; + int16_t scale; +#endif +#endif IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS]; IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }; int16_t vec_pos_update, vec_pos_len; @@ -1535,6 +1820,42 @@ static ivas_error decodeG192( return error; } +#ifdef DEBUGGING +#ifdef VARIABLE_SPEED_DECODING + /*------------------------------------------------------------------------------------------* + * Open TSM scale file or set global TSM scale + *------------------------------------------------------------------------------------------*/ + + if ( arg.tsmEnabled ) + { + if ( arg.tsmScaleFileEnabled ) + { + if ( ( tsmScaleFileReader = TsmScaleFileReader_open( arg.tsmScaleFileName ) ) == NULL ) + { + fprintf( stderr, "\nError: Can't open TSM scale file %s \n\n", arg.tsmScaleFileName ); + goto cleanup; + } + } + else + { + int16_t maxScaling; + /* max scaling as abs diff to the normal frame size in samples */ + maxScaling = (int16_t) ceilf( (float) abs( arg.tsmScale - 100 ) / 100.0f * (float) ( nOutSamples * vec_pos_len ) ); + if ( ( error = IVAS_DEC_VoIP_SetScale( hIvasDec, maxScaling, arg.tsmScale ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_VoIP_SetScale failed: %s \n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + } + /* set lowest possbile TSM quality to make sure it is applied as much as possible */ + if ( ( error = IVAS_DEC_TSM_SetQuality( hIvasDec, -2.0f ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_TSM_SetQuality failed: %s \n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + } +#endif +#endif /*------------------------------------------------------------------------------------------* * Loop for every packet (frame) of bitstream data @@ -1645,6 +1966,26 @@ static ivas_error decodeG192( { if ( needNewFrame ) { +#ifdef DEBUGGING +#ifdef VARIABLE_SPEED_DECODING + if ( arg.tsmScaleFileEnabled ) + { + if ( ( error = TsmScaleFileReader_readScale( tsmScaleFileReader, &scale ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError: input bitstream file couldn't be read: %s \n\n", arg.inputBitstreamFilename ); + goto cleanup; + } + int16_t maxScaling; + /* max scaling as abs diff to the normal frame size in samples */ + maxScaling = (int16_t) ceilf( (float) abs( arg.tsmScale - 100 ) / 100.0f * (float) ( nOutSamples * vec_pos_len ) ); + if ( ( error = IVAS_DEC_VoIP_SetScale( hIvasDec, maxScaling, arg.tsmScale ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_VoIP_SetScale failed: %s \n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + } +#endif +#endif if ( ( error = BS_Reader_ReadFrame_short( hBsReader, bit_stream, &num_bits, &bfi ) ) != IVAS_ERR_OK ) { if ( error == IVAS_ERR_END_OF_FILE ) @@ -1655,6 +1996,21 @@ static ivas_error decodeG192( goto cleanup; } +#ifdef DEBUGGING + /* Random FEC simulation */ + if ( arg.FER > 0.0f ) + { + float ftmp = (float) app_own_random( &fec_seed ) + 32768.0f; + if ( ftmp <= arg.FER / 100.0f * 65535.0f ) + { + bfi = 1; + } + else + { + bfi = 0; + } + } +#endif /* Feed into decoder */ if ( ( error = IVAS_DEC_FeedFrame_Serial( hIvasDec, bit_stream, num_bits, bfi ) ) != IVAS_ERR_OK ) { @@ -1677,6 +2033,12 @@ static ivas_error decodeG192( if ( !arg.quietModeEnabled ) { fprintf( stdout, "%-8d\b\b\b\b\b\b\b\b", frame ); +#ifdef DEBUGGING + if ( IVAS_DEC_GetBerDetectFlag( hIvasDec ) ) + { + fprintf( stdout, "\n Decoding error: BER detected in frame %d !!!!!\n", frame - 1 ); + } +#endif } } @@ -1911,6 +2273,12 @@ static ivas_error decodeG192( if ( !arg.quietModeEnabled ) { fprintf( stdout, "%-8d\b\b\b\b\b\b\b\b", frame ); +#ifdef DEBUGGING + if ( IVAS_DEC_GetBerDetectFlag( hIvasDec ) ) + { + fprintf( stdout, "\n Decoding error: BER detected in frame %d !!!!!\n", frame - 1 ); + } +#endif } } @@ -1968,6 +2336,11 @@ cleanup: AudioFileWriter_close( &afWriter ); MasaFileWriter_close( &masaWriter ); +#ifdef DEBUGGING +#ifdef VARIABLE_SPEED_DECODING + TsmScaleFileReader_close( &tsmScaleFileReader ); +#endif +#endif for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; i++ ) { IsmFileWriter_close( &ismWriters[i] ); @@ -1981,6 +2354,106 @@ cleanup: return error; } +#ifdef DEBUGGING +/*---------------------------------------------------------------------* + * printBitstreamInfoVoip() + * + * Print bitstream info of a VoIP G.192 or RTPDUMP bitstream. + *---------------------------------------------------------------------*/ + +static ivas_error printBitstreamInfoVoip( + DecArguments arg, + BS_READER_HANDLE hBsReader, + IVAS_DEC_HANDLE hIvasDec ) +{ + bool previewFailed = true; + ivas_error error = IVAS_ERR_OK; + FILE *f_rtpstream = NULL; + EVS_RTPDUMP_DEPACKER rtpdumpDepacker; + EVS_RTPDUMP_DEPACKER_ERROR rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_NO_ERROR; + uint8_t au[( IVAS_MAX_BITS_PER_FRAME + 7 ) >> 3]; + int16_t auSizeBits; + uint8_t *auPtr = NULL; + bool isAMRWB_IOmode; + uint16_t frameTypeIndex; + bool qBit; + uint32_t nextPacketRcvTime_ms = 0; + uint16_t rtpSequenceNumber; + uint32_t rtpTimeStamp; + + rtpdumpDepacker.rtpdump = NULL; + switch ( arg.inputFormat ) + { + case IVAS_DEC_INPUT_FORMAT_RTPDUMP: + case IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF: + f_rtpstream = fopen( arg.inputBitstreamFilename, "r" ); + + if ( f_rtpstream == NULL ) + { + fprintf( stderr, "could not open: %s\n", arg.inputBitstreamFilename ); + goto cleanup; + } + + rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_open( &rtpdumpDepacker, f_rtpstream, arg.inputFormat == IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF ); + if ( rtpdumpDepackerError != EVS_RTPDUMP_DEPACKER_NO_ERROR ) + { + fprintf( stderr, "error in EVS_RTPDUMP_DEPACKER_open(): %d\n", rtpdumpDepackerError ); + goto cleanup; + } + break; + case IVAS_DEC_INPUT_FORMAT_G192: + auPtr = au; + break; + default: + fprintf( stderr, "Unsupported format of input bitstream" ); + goto cleanup; + } + + /* Keep reading until full frame is found */ + do + { + if ( arg.inputFormat == IVAS_DEC_INPUT_FORMAT_G192 ) + { + error = BS_Reader_ReadVoipFrame_compact( hBsReader, au, &auSizeBits, &rtpSequenceNumber, &rtpTimeStamp, &nextPacketRcvTime_ms ); + qBit = 1; /* good q_bit for INPUT_FORMAT_G192 */ + } + else + { + auPtr = au; /* might have been set to RTP packet in prev call */ + rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_readNextFrame( &rtpdumpDepacker, &rtpSequenceNumber, &rtpTimeStamp, &nextPacketRcvTime_ms, &isAMRWB_IOmode, &frameTypeIndex, &qBit, &auPtr, (uint16_t *) &auSizeBits ); + + /* EVS RTP payload format has timescale 16000, JBM uses 1000 internally */ + rtpTimeStamp = rtpTimeStamp / 16; + } + if ( error != IVAS_ERR_OK || rtpdumpDepackerError != EVS_RTPDUMP_DEPACKER_NO_ERROR ) + { + fprintf( stderr, "failed to read first RTP packet\n" ); + goto cleanup; + } + } while ( !qBit || auSizeBits < MIN_NUM_BITS_ACTIVE_FRAME || auSizeBits == NUM_BITS_SID_IVAS_5K2 ); + + BS_Reader_Rewind( hBsReader ); + + IVAS_DEC_PrintConfigWithVoipBitstream( hIvasDec, arg.quietModeEnabled, au, auSizeBits ); + + /*------------------------------------------------------------------------------------------* + * Close fhandles and deallocate resources + *------------------------------------------------------------------------------------------*/ + + previewFailed = false; /* This will stay set to true if cleanup is reached via a goto due to an error */ + +cleanup: + + EVS_RTPDUMP_DEPACKER_close( &rtpdumpDepacker ); + + if ( previewFailed && error == IVAS_ERR_OK ) + { + return IVAS_ERR_UNKNOWN; + } + + return IVAS_ERR_OK; +} +#endif #ifdef SUPPORT_JBM_TRACEFILE static ivas_error writeJbmTraceFileFrameWrapper( const void *data, void *writer ) @@ -2516,5 +2989,28 @@ cleanup: } +#ifdef DEBUGGING + +/*---------------------------------------------------------------------* + * parseForcedRendModeDec() + * + * + *---------------------------------------------------------------------*/ + +static IVAS_DEC_FORCED_REND_MODE parseForcedRendModeDec( + char *forcedRendModeChar ) +{ + if ( ( strcmp( to_upper( forcedRendModeChar ), "TDREND" ) == 0 ) ) + { + return IVAS_DEC_FORCE_REND_TD_RENDERER; + } + if ( ( strcmp( to_upper( forcedRendModeChar ), "CLDFBREND" ) == 0 ) ) + { + return IVAS_DEC_FORCE_REND_CLDFB_RENDERER; + } + + return IVAS_DEC_FORCE_REND_UNDEFINED; +} +#endif #undef WMC_TOOL_SKIP diff --git a/apps/encoder.c b/apps/encoder.c index c255170a7..21aa5d0b1 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -38,6 +38,9 @@ #include "ism_file_reader.h" #include "jbm_file_reader.h" #include "masa_file_reader.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -47,7 +50,7 @@ * Local constants, enums *------------------------------------------------------------------------------------------*/ -#if !defined( WMOPS ) +#if !defined( DEBUGGING ) && !defined( WMOPS ) static #endif int32_t frame = 0; /* Counter of frames */ @@ -60,6 +63,10 @@ typedef union _EncInputFormatConfig /* MONO details */ bool stereoToMonoDownmix; +#ifdef DEBUGGING + /* STEREO details */ + IVAS_ENC_STEREO_MODE stereoMode; +#endif /* ISM details */ struct EncIsmConfig @@ -124,6 +131,19 @@ typedef struct const char *ca_config_file; bool mimeOutput; IVAS_ENC_COMPLEXITY_LEVEL complexityLevel; +#ifdef DEBUGGING + IVAS_ENC_FORCED_MODE forcedMode; + const char *forcedModeFile; +#ifdef DEBUG_AGC_ENCODER_CMD_OPTION + IVAS_ENC_AGC agc; +#endif +#ifdef DEBUG_FOA_AGC + FILE *agcBitstream; /* temporary */ +#endif +#ifdef DEBUG_SBA + const char *dbg_file_tag; +#endif +#endif bool pca; bool ism_extended_metadata; @@ -139,6 +159,10 @@ static bool parseCmdlIVAS_enc( int16_t argc, char *argv[], EncArguments *arg ); static void usage_enc( void ); static bool readBandwidth( FILE *file, IVAS_ENC_BANDWIDTH *bandwidth, int32_t *bandwidthFrameCounter ); static bool readBitrate( FILE *file, int32_t *bitrate ); +#ifdef DEBUGGING +static ivas_error readForcedMode( FILE *file, IVAS_ENC_FORCED_MODE *forcedMode, int32_t *forceFrameCounter ); +static IVAS_ENC_FORCED_MODE parseForcedMode( char *forcedModeChar ); +#endif /*------------------------------------------------------------------------------------------* @@ -166,7 +190,16 @@ int main( MasaFileReader *masaReader = NULL; IsmFileReader *ismReaders[IVAS_MAX_NUM_OBJECTS] = { NULL, NULL, NULL, NULL }; int16_t *pcmBuf = NULL; +#ifdef DEBUGGING + FILE *f_forcedModeProfile = NULL; +#ifdef DEBUG_SBA + int16_t numTransportChannels = 1; +#endif +#endif +#ifdef DEBUGGING + dbgargs( &argc, argv ); +#endif #ifdef WMOPS reset_wmops(); reset_mem( USE_BYTES ); @@ -349,7 +382,11 @@ int main( } break; case IVAS_ENC_INPUT_STEREO: +#ifdef DEBUGGING + if ( ( error = IVAS_ENC_ConfigureForStereo( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.is_binaural, arg.inputFormatConfig.stereoMode ) ) != IVAS_ERR_OK ) +#else if ( ( error = IVAS_ENC_ConfigureForStereo( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.is_binaural ) ) != IVAS_ERR_OK ) +#endif { fprintf( stderr, "\nIVAS_ENC_ConfigureForStereo failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); goto cleanup; @@ -364,7 +401,14 @@ int main( break; case IVAS_ENC_INPUT_SBA: if ( ( error = IVAS_ENC_ConfigureForAmbisonics( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.inputFormatConfig.sba.order, arg.inputFormatConfig.sba.isPlanar, +#ifdef DEBUG_AGC_ENCODER_CMD_OPTION + arg.agc, +#endif arg.pca +#ifdef DEBUG_SBA_AUDIO_DUMP + , + &numTransportChannels +#endif ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_ENC_ConfigureForAmbisonics failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); @@ -499,6 +543,20 @@ int main( } } +#ifdef DEBUGGING + IVAS_ENC_FORCED_MODE forcedMode = arg.forcedMode; + int32_t force_profile_cnt = 0; + + if ( arg.forcedModeFile ) + { + if ( ( f_forcedModeProfile = fopen( arg.forcedModeFile, "rb" ) ) == NULL ) + { + fprintf( stderr, "\nError: Incorrect mode specification or the profile file could not be opened: %s\n\n", arg.forcedModeFile ); + usage_enc(); + goto cleanup; + } + } +#endif /*------------------------------------------------------------------------------------------* * Allocate input data buffer @@ -538,6 +596,12 @@ int main( int16_t numSamplesRead = 0; uint16_t bitStream[IVAS_MAX_BITS_PER_FRAME]; uint16_t numBits = 0; +#ifdef DEBUG_SBA +#ifdef DEBUG_AGC + ivas_open_agc_debug_files( (int16_t) arg.agc ); +#endif + ivas_open_sba_encoder_debug_files( arg.inputFs, numTransportChannels, arg.dbg_file_tag, arg.initBitrate, (int16_t) arg.dtxConfig.enabled ); +#endif if ( !arg.quietModeEnabled ) { @@ -633,6 +697,26 @@ int main( } } +#ifdef DEBUGGING + if ( f_forcedModeProfile ) + { + if ( ( error = readForcedMode( f_forcedModeProfile, &forcedMode, &force_profile_cnt ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError reading from file: %s\n%s\n", arg.forcedModeFile, IVAS_ENC_GetErrorMessage( error ) ); + goto cleanup; + } + } + + /* Force mode not set when configuring, set in first frame even if not reading from file */ + if ( f_forcedModeProfile || frame == 0 ) + { + if ( ( error = IVAS_ENC_SetForcedMode( hIvasEnc, forcedMode ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_ENC_SetForcedMode failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); + goto cleanup; + } + } +#endif /* Read ISM input metadata */ for ( i = 0; i < numIsmInputs; ++i ) { @@ -707,6 +791,9 @@ int main( fprintf( stdout, "\n\nEncoding of %d frames finished\n", frame ); } +#ifdef DEBUGGING + print_snr(); +#endif /*------------------------------------------------------------------------------------------* * Close files and deallocate resources *------------------------------------------------------------------------------------------*/ @@ -758,6 +845,21 @@ cleanup: #ifdef WMOPS print_wmops(); print_mem( NULL ); +#endif +#ifdef DEBUGGING + dbgclose(); + + if ( f_forcedModeProfile ) + { + fclose( f_forcedModeProfile ); + } + +#ifdef DEBUG_SBA + ivas_close_sba_encoder_debug_files(); +#ifdef DEBUG_AGC + ivas_close_agc_debug_files(); +#endif +#endif #endif return mainFailed ? -1 : 0; @@ -794,6 +896,19 @@ static void initArgStruct( EncArguments *arg ) arg->ism_extended_metadata = false; arg->complexityLevel = IVAS_ENC_COMPLEXITY_LEVEL_THREE; +#ifdef DEBUGGING + arg->forcedMode = IVAS_ENC_FORCE_UNFORCED; + arg->forcedModeFile = NULL; +#ifdef DEBUG_AGC_ENCODER_CMD_OPTION + arg->agc = IVAS_ENC_AGC_UNDEFINED; +#endif +#ifdef DEBUG_FOA_AGC + arg->agcBitstream = NULL; +#endif +#ifdef DEBUG_SBA + arg->dbg_file_tag = NULL; +#endif +#endif arg->pca = false; return; @@ -923,6 +1038,91 @@ static bool parseCmdlIVAS_enc( } } +#ifdef DEBUGGING + /*-----------------------------------------------------------------* + * Force specific mode + *-----------------------------------------------------------------*/ + + else if ( strcmp( argv_to_upper, "-FORCE" ) == 0 ) + { + strncpy( stmp, argv[i + 1], sizeof( stmp ) ); + + arg->forcedMode = parseForcedMode( stmp ); + + if ( arg->forcedMode == IVAS_ENC_FORCE_UNDEFINED ) + { + arg->forcedModeFile = argv[i + 1]; + fprintf( stdout, "Force switching file: %s\n", argv[i + 1] ); + } + else + { + fprintf( stdout, "Forcing codec to: %s\n", argv[i + 1] ); + } + + i += 2; + } +#ifdef DEBUG_MODE_INFO +#ifdef DEBUG_MODE_INFO_TWEAK + /*-----------------------------------------------------------------* + * Define additional subfolder for debug info output in ./res + *-----------------------------------------------------------------*/ + else if ( strcmp( argv_to_upper, "-INFO" ) == 0 ) + { + extern char infoFolder[FILENAME_MAX]; + strncpy( infoFolder, argv[i + 1], sizeof( infoFolder ) ); + i += 2; + } +#endif /* #ifdef DEBUG_MODE_INFO_TWEAK */ +#endif /* #ifdef DEBUG_MODE_INFO */ + +#ifdef DEBUG_AGC_ENCODER_CMD_OPTION + /*-----------------------------------------------------------------* + * IVAS SPAR AGC option + *-----------------------------------------------------------------*/ + else if ( strcmp( argv_to_upper, "-AGC" ) == 0 ) + { + i++; + if ( i < argc - 4 ) + { + arg->agc = ( atoi( argv[i] ) ) ? IVAS_ENC_AGC_ENABLED : IVAS_ENC_AGC_DISABLED; + if ( argv[i] == NULL || atoi( argv[i] ) < 0 || atoi( argv[i] ) > 1 ) + { + fprintf( stderr, "Error: wrong adaptive gain control option specified (%d), expected 0 or 1\n\n", (int32_t) atoi( argv[i] ) ); + usage_enc(); + return false; + } + i++; + } + else + { + fprintf( stderr, "Error: unspecified adaptive gain control option\n\n" ); + usage_enc(); + return false; + } + } +#endif + +#ifdef DEBUG_SBA + /*-----------------------------------------------------------------* + * IVAS SPAR debug files tag + *-----------------------------------------------------------------*/ + else if ( strcmp( argv_to_upper, "-TAG" ) == 0 ) + { + i++; + if ( i < argc - 4 ) + { + arg->dbg_file_tag = argv[i]; + ++i; + } + else + { + fprintf( stderr, "Error: [IVAS SPAR Encoder] unspecified tag value \n\n" ); + usage_enc(); + return false; + } + } +#endif +#endif /* #ifdef DEBUGGING */ /*-----------------------------------------------------------------* * deactivate delay compensation @@ -1027,6 +1227,77 @@ static bool parseCmdlIVAS_enc( i++; arg->inputFormat = IVAS_ENC_INPUT_STEREO; +#ifdef DEBUGGING + if ( ( i < argc - 4 ) && argv[i][0] != 45 ) /* note: 45 corresponds to "-" */ + { + if ( sscanf( argv[i], "%d", &tmp ) > 0 ) + { + if ( tmp == 1 ) + { + arg->inputFormatConfig.stereoMode = IVAS_ENC_STEREO_MODE_DFT; + i++; + } + else if ( tmp == 2 ) + { + arg->inputFormatConfig.stereoMode = IVAS_ENC_STEREO_MODE_TD; + i++; + } + else if ( tmp == 3 ) + { + arg->inputFormatConfig.stereoMode = IVAS_ENC_STEREO_MODE_MDCT_DECISION; +#ifdef DEBUG_FORCE_MDCT_STEREO_MODE + i++; + + /* force mdct stereo mode for debugging purposes */ + if ( i < argc - 4 ) + { + if ( sscanf( argv[i], "%d", &tmp ) > 0 ) + { + if ( tmp == 0 ) + { + /* keep "DECISION" */ + arg->inputFormatConfig.stereoMode = IVAS_ENC_STEREO_MODE_MDCT_DECISION; + i++; + } + else if ( tmp == 1 ) + { + arg->inputFormatConfig.stereoMode = IVAS_ENC_STEREO_MODE_MDCT_FORCE_LR; + i++; + } + else if ( tmp == 2 ) + { + arg->inputFormatConfig.stereoMode = IVAS_ENC_STEREO_MODE_MDCT_FORCE_MS; + i++; + } + else + { + fprintf( stderr, "Error: Incorrect mdct stereo coding method (%d) specified\n\n", tmp ); + usage_enc(); + return false; + } + } + } +#endif + } + else + { + fprintf( stderr, "Error: Incorrect stereo mode (%d) specified\n\n", tmp ); + usage_enc(); + return false; + } + } + else + { + fprintf( stderr, "Error: Stereo mode not specified.\n\n" ); /* in the debugging stage */ + usage_enc(); + return false; + } + } + else + { + arg->inputFormatConfig.stereoMode = IVAS_ENC_STEREO_MODE_UNIFIED; + } +#endif /* DEBUGGING */ } else if ( strcmp( argv_to_upper, "-BINAURAL" ) == 0 ) { @@ -1623,6 +1894,23 @@ static void usage_enc( void ) fprintf( stdout, "-pca : activate PCA in SBA format FOA at 256 kbps \n" ); fprintf( stdout, "-level level : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" ); fprintf( stdout, " Currently, all values default to level 3 (full functionality).\n" ); +#ifdef DEBUGGING + fprintf( stdout, "-force T : Force specific mode, T = (speech, music, ACELP, GSC, TCX, HQ),\n" ); + fprintf( stdout, " alternatively, T can be a text file where each line contains \"nb_frames T\"\n" ); +#ifdef DEBUG_SBA + fprintf( stdout, "-tag : Tag name for intermediate debug files\n" ); +#endif +#ifdef DEBUG_AGC_ENCODER_CMD_OPTION + fprintf( stdout, "-agc op : SBA Adaptive gain control, op = (0, 1). \n" ); + fprintf( stdout, " By default op is 1 (activated) for bitrates between 24400 and 32000,\n" ); + fprintf( stdout, " otherwise it is 0 (deactivated) for all other bitrates\n" ); +#endif +#ifdef DEBUG_MODE_INFO +#ifdef DEBUG_MODE_INFO_TWEAK + fprintf( stdout, "-info : specify subfolder name for debug output\n" ); +#endif +#endif +#endif fprintf( stdout, "-q : Quiet mode, no frame counters\n" ); fprintf( stdout, " default is deactivated\n" ); fprintf( stdout, "\n" ); @@ -1716,5 +2004,90 @@ static bool readBitrate( } +#ifdef DEBUGGING +/*---------------------------------------------------------------------* + * parseForcedMode() + * + * + *---------------------------------------------------------------------*/ + +static IVAS_ENC_FORCED_MODE parseForcedMode( + char *forcedModeChar ) +{ + to_upper( forcedModeChar ); + + if ( ( strcmp( forcedModeChar, "SPEECH" ) == 0 ) || ( strcmp( forcedModeChar, "'SPEECH'" ) == 0 ) || + ( strcmp( forcedModeChar, "0" ) == 0 ) ) + { + return IVAS_ENC_FORCE_SPEECH; + } + if ( ( strcmp( forcedModeChar, "MUSIC" ) == 0 ) || ( strcmp( forcedModeChar, "'MUSIC'" ) == 0 ) || ( strcmp( forcedModeChar, "AUDIO" ) == 0 ) || ( strcmp( forcedModeChar, "'AUDIO'" ) == 0 ) || ( strcmp( forcedModeChar, "1" ) == 0 ) ) + { + return IVAS_ENC_FORCE_MUSIC; + } + if ( ( strcmp( forcedModeChar, "ACELP" ) == 0 ) || ( strcmp( forcedModeChar, "'ACELP'" ) == 0 ) ) + { + return IVAS_ENC_FORCE_ACELP; + } + if ( ( strcmp( forcedModeChar, "GSC" ) == 0 ) || ( strcmp( forcedModeChar, "'GSC'" ) == 0 ) ) + { + return IVAS_ENC_FORCE_GSC; + } + if ( ( strcmp( forcedModeChar, "TCX" ) == 0 ) || ( strcmp( forcedModeChar, "'TCX'" ) == 0 ) ) + { + return IVAS_ENC_FORCE_TCX; + } + if ( ( strcmp( forcedModeChar, "HQ" ) == 0 ) || ( strcmp( forcedModeChar, "'HQ'" ) == 0 ) ) + { + return IVAS_ENC_FORCE_HQ; + } + + return IVAS_ENC_FORCE_UNDEFINED; +} + + +/*---------------------------------------------------------------------* + * readForcedMode() + * + * + *---------------------------------------------------------------------*/ + +static ivas_error readForcedMode( + FILE *file, + IVAS_ENC_FORCED_MODE *forcedMode, + int32_t *forceFrameCounter ) +{ + int16_t res; + char stmp[8]; + + if ( *forceFrameCounter == 0 ) + { + /* read next force and number of frames from the profile file */ + while ( ( res = (int16_t) fscanf( file, "%d %7s", forceFrameCounter, stmp ) ) != 2 && feof( file ) ) + { + rewind( file ); + } + + *forcedMode = parseForcedMode( stmp ); + + if ( *forcedMode == IVAS_ENC_FORCE_UNDEFINED ) + { + fprintf( stderr, "Error: incorect mode specification or the force profile file could not be opened: %s\n\n", stmp ); + return IVAS_ERR_WRONG_PARAMS; + } + + if ( res != 2 && !feof( file ) ) + { + fprintf( stderr, "Error: incorrect format of the force profile file (please ensure that it does not contain any empty lines)\n\n" ); + return IVAS_ERR_WRONG_PARAMS; + } + } + + /* current profile still active, only decrease the counter */ + ( *forceFrameCounter )--; + + return IVAS_ERR_OK; +} +#endif #undef WMC_TOOL_SKIP diff --git a/apps/renderer.c b/apps/renderer.c index 6ac6b0aa3..24967f2cd 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -46,6 +46,9 @@ #include "render_config_reader.h" #include "rotation_file_reader.h" #include "vector3_pair_file_reader.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -63,7 +66,7 @@ #define IVAS_MAX16B_FLT 32767.0f #define IVAS_MIN16B_FLT ( -32768.0f ) -#if !defined( WMOPS ) +#if !defined( DEBUGGING ) && !defined( WMOPS ) static #endif int32_t frame = 0; @@ -1545,6 +1548,17 @@ int main( fprintf( stdout, "\n\nRendering of %d frames finished\n\n", frame ); +#ifdef DEBUGGING + int32_t cnt_frames_limited, noClipping; + if ( ( cnt_frames_limited = IVAS_REND_GetCntFramesLimited( hIvasRend ) ) > 0 ) + { + fprintf( stdout, "Limiter applied in %d frames.\n\n", cnt_frames_limited ); + } + if ( ( noClipping = IVAS_REND_GetNoCLipping( hIvasRend ) ) > 0 ) + { + fprintf( stdout, "Clipping (saturation) detected: %d samples clipped!!!\n\n", noClipping ); + } +#endif /* === Close === */ free( inpInt16Buffer ); @@ -1573,6 +1587,9 @@ int main( IsmPositionProvider_close( positionProvider ); RenderConfigReader_close( &renderConfigReader ); +#ifdef DEBUGGING + dbgclose(); +#endif #ifdef WMOPS print_wmops(); print_mem( NULL ); diff --git a/lib_com/ACcontextMapping.c b/lib_com/ACcontextMapping.c index 13cbe8482..1705a3f7d 100644 --- a/lib_com/ACcontextMapping.c +++ b/lib_com/ACcontextMapping.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_com/arith_coder.c b/lib_com/arith_coder.c index f27617b27..cc29c9747 100644 --- a/lib_com/arith_coder.c +++ b/lib_com/arith_coder.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_com/basop_mpy.c b/lib_com/basop_mpy.c index cb6268d62..db2a14c0b 100644 --- a/lib_com/basop_mpy.c +++ b/lib_com/basop_mpy.c @@ -37,6 +37,9 @@ #include "basop_mpy.h" #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #define WMC_TOOL_SKIP diff --git a/lib_com/basop_mpy.h b/lib_com/basop_mpy.h index c35531fa6..4a8d4473c 100644 --- a/lib_com/basop_mpy.h +++ b/lib_com/basop_mpy.h @@ -40,6 +40,9 @@ #include "stl.h" #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif /** * \brief 32*16 Bit fractional Multiplication using 40 bit OPS diff --git a/lib_com/basop_tcx_utils.c b/lib_com/basop_tcx_utils.c index f57bf10a8..6d2c80f6b 100644 --- a/lib_com/basop_tcx_utils.c +++ b/lib_com/basop_tcx_utils.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "basop_proto_func.h" #include "stl.h" diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index f3247f2d0..0a168852b 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "basop_util.h" #include "rom_com.h" #include "basop_settings.h" diff --git a/lib_com/bitalloc.c b/lib_com/bitalloc.c index 351ab9e3a..e560e300a 100644 --- a/lib_com/bitalloc.c +++ b/lib_com/bitalloc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_com/bitallocsum.c b/lib_com/bitallocsum.c index 2daf67b73..d3f880752 100644 --- a/lib_com/bitallocsum.c +++ b/lib_com/bitallocsum.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_com/bits_alloc.c b/lib_com/bits_alloc.c index 0d1611de6..cb3945a6c 100644 --- a/lib_com/bits_alloc.c +++ b/lib_com/bits_alloc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "rom_com.h" #include "prot.h" #include "ivas_cnst.h" @@ -438,6 +441,16 @@ static ivas_error acelp_FCB_allocator( } } cdbk--; +#ifdef DEBUGGING + if ( cdbk < 0 && coder_type != TRANSITION ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Too low bit-budget for fixed innovation codebook (frame = %d). Exiting! \n", frame ); + } + if ( ( L_subfr == L_SUBFR && cdbk >= ACELP_FIXED_CDK_NB ) || ( L_subfr == 2 * L_SUBFR && fcb_table( cdbk, L_subfr ) == 128 /*stop value*/ ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Too high bit-budget for fixed innovation codebook (frame = %d). Exiting! \n", frame ); + } +#endif set_s( p_fixed_cdk_index, cdbk, nb_subfr ); nBits_tmp = 0; @@ -547,6 +560,9 @@ ivas_error config_acelp1( int16_t i, bits, nb_subfr; int16_t flag_hardcoded, coder_type_sw, fix_first; int32_t core_brate; +#ifdef DEBUGGING + int32_t core_brate_inpI = core_brate_inp; +#endif ivas_error error; error = IVAS_ERR_OK; @@ -572,11 +588,28 @@ ivas_error config_acelp1( { nb_subfr = NB_SUBFR; +#ifdef DEBUGGING + if ( ( ( core_brate_inp < 5900 && coder_type > UNVOICED ) && !( core_brate_inp < MIN_TC_BRATE && coder_type == TRANSITION ) ) && !( idchan > 0 && element_mode == IVAS_CPE_TD ) && !( element_mode == IVAS_SCE && tdm_low_rate_mode ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Too low bitrate (%d bps) for ACELP@12k8 in frame %d. Exiting!\n", core_brate_inpI, frame ); + } + + if ( core_brate_inp > ACELP_12k8_HIGH_LIMIT && core == ACELP_CORE ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Too high bitrate (%d bps) for ACELP@12k8 in frame %d. Exiting!\n", core_brate_inpI, frame ); + } +#endif } else /* L_frame == L_FRAME16k */ { nb_subfr = NB_SUBFR16k; +#ifdef DEBUGGING + if ( core_brate_inp < ACELP_16k_LOW_LIMIT && core == ACELP_CORE ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Too low bitrate (%d bps) for ACELP@16k in frame %d. Exiting!\n", core_brate_inpI, frame ); + } +#endif } coder_type_sw = coder_type; @@ -999,6 +1032,14 @@ ivas_error config_acelp1( } acelp_cfg->fcb_mode = 1; +#ifdef DEBUGGING + if ( bits >= 55 ) + { + printf( "too much bits -> %d, LPC = %d and pitch = %d\n", bits, tdm_lp_reuse_flag, tdm_Pitch_reuse_flag ); + acelp_FCB_allocator( &bits, acelp_cfg->fixed_cdk_index, 2, 2 * L_SUBFR, GENERIC, -1, 0 ); + } + else +#endif if ( bits >= 16 ) { acelp_FCB_allocator( &bits, acelp_cfg->fixed_cdk_index, 2, 2 * L_SUBFR, GENERIC, -1, 0 ); @@ -1084,6 +1125,10 @@ ivas_error config_acelp1( i--; /* must be odd */ } i = min( i, 13 ); +#ifdef DEBUG_MODE_TD + if ( i < 0 ) + IVAS_ERROR( IVAS_ERR_INTERNAL, "ERROR::: UC negative index should not happen at frame %d\n", frame ); +#endif i = max( i, 0 ); /* If i == 0-> random noise generator will be used as FCB */ set_s( acelp_cfg->fixed_cdk_index, i, NB_SUBFR ); bits -= ( i * NB_SUBFR ); @@ -1120,6 +1165,9 @@ ivas_error config_acelp1( } else /* No FCB */ { +#ifdef DEBUGGING + IVAS_ERROR( IVAS_ERR_INTERNAL, "WARNING!!!, No bit allocated to FCB, check frame %d\n", frame ); +#endif acelp_cfg->fixed_cdk_index[0] = -1; acelp_cfg->fixed_cdk_index[1] = -1; acelp_cfg->fixed_cdk_index[2] = -1; @@ -1273,6 +1321,9 @@ ivas_error config_acelp1( } else if ( flag_hardcoded && core == ACELP_CORE && bits != 0 ) { +#ifdef DEBUGGING + IVAS_ERROR( IVAS_ERR_INTERNAL, "ERROR: bit-budget incorrect (%d bits) in frame %d.\n", (int32_t) bits, frame ); +#endif } else if ( bits > 0 && !( coder_type == UNVOICED && tdm_low_rate_mode == 1 && element_mode == IVAS_CPE_TD ) ) { @@ -1307,6 +1358,12 @@ ivas_error config_acelp1( bits -= allocate_unused( core_brate, coder_type, bits, 1, 0, LSFPRM, &acelp_cfg->lsf_bits ); } } +#ifdef DEBUGGING + if ( idchan > 0 && bits > 0 && ( coder_type > UNVOICED || tdm_low_rate_mode == 0 ) ) + { + IVAS_ERROR( IVAS_ERR_INTERNAL, "WARNING !! Unused bits in secondary channel at frame %d\n", frame ); + } +#endif } else if ( core == ACELP_CORE && coder_type >= UNVOICED && coder_type <= GENERIC && L_frame == L_FRAME ) @@ -1331,6 +1388,9 @@ ivas_error config_acelp1( } else if ( bits < 0 && !( coder_type == UNVOICED && tdm_low_rate_mode == 1 && element_mode == IVAS_CPE_TD ) ) { +#ifdef DEBUGGING + IVAS_ERROR( IVAS_ERR_INTERNAL, "ERROR: bit-budget incorrect (%d bits) in frame %d.\n", (int32_t) bits, frame ); +#endif } } @@ -1400,6 +1460,9 @@ static int16_t allocate_unused( } else { +#ifdef DEBUG_MODE_TD + IVAS_ERROR( IVAS_ERR_WRONG_MODE, "unknown mode in bit_alloc.c" ); +#endif } max_bit_per_pos = min( unused_bits, max_bit_per_pos - prm_bit_mode[subfr] ); diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index 0aeed3040..4a24d905a 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "stat_enc.h" @@ -48,6 +51,16 @@ #include "ivas_rom_com.h" #include "wmc_auto.h" +#ifdef DEBUGGING + +#define FEC_SEED 12558 + +/*-------------------------------------------------------------------* + * Global variables + *--------------------------------------------------------------------*/ + +FILE *FEC_pattern = NULL; /* FEC pattern file (for simulation of FEC) */ +#endif #define STEP_MAX_NUM_INDICES 100 /* increase the maximum number of allowed indices in the list by this amount */ @@ -830,6 +843,9 @@ ivas_error check_ind_list_limits( /* the re-allocation can be avoided by increasing the limits in get_ivas_max_num_indices() or get_ivas_max_num_indices_metadata() */ if ( ( &hBstr->ind_list[hBstr->nb_ind_tot] - ivas_ind_list_zero ) >= *( hBstr->ivas_max_num_indices ) ) { +#ifdef DEBUGGING + fprintf( stderr, "Warning: The maximum number of indices %d has been exceeded in frame %d! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata().\n", *( hBstr->ivas_max_num_indices ), frame ); +#endif /* reallocate the buffer of indices with increased limit */ if ( ( error = ind_list_realloc( *hBstr->ivas_ind_list_zero, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES, hBstr->st_ivas ) ) != IVAS_ERR_OK ) @@ -843,6 +859,9 @@ ivas_error check_ind_list_limits( { if ( hBstr->nb_ind_tot == 0 ) { +#ifdef DEBUGGING + fprintf( stderr, "Warning: Trying to overwrite an existing indice ID = %d in frame %d!\n", hBstr->ind_list[hBstr->nb_ind_tot].id, frame ); +#endif /* move the pointer to the next available empty slot */ ivas_ind_list_last = &ivas_ind_list_zero[*( hBstr->ivas_max_num_indices )]; while ( hBstr->ind_list[0].nb_bits > 0 && hBstr->ind_list < ivas_ind_list_last ) @@ -852,6 +871,9 @@ ivas_error check_ind_list_limits( if ( hBstr->ind_list >= ivas_ind_list_last ) { +#ifdef DEBUGGING + fprintf( stderr, "Warning: The maximum number of indices %d has been exceeded in frame %d! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata().\n", *( hBstr->ivas_max_num_indices ), frame ); +#endif /* no available empty slot -> need to re-allocate the buffer */ if ( ( error = ind_list_realloc( *hBstr->ivas_ind_list_zero, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES, hBstr->st_ivas ) ) != IVAS_ERR_OK ) @@ -876,11 +898,20 @@ ivas_error check_ind_list_limits( * Push a new indice into the buffer *-------------------------------------------------------------------*/ +#ifdef DEBUG_BS_READ_WRITE +ivas_error push_indice_( +#else ivas_error push_indice( +#endif BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ int16_t id, /* i : ID of the indice */ uint16_t value, /* i : value of the quantized indice */ int16_t nb_bits /* i : number of bits used to quantize the indice */ +#ifdef DEBUG_BS_READ_WRITE + , + int16_t line, + const char *func +#endif ) { int16_t i; @@ -889,6 +920,21 @@ ivas_error push_indice( error = IVAS_ERR_OK; +#ifdef DEBUG_BS_READ_WRITE + printf( "%s: %d: %d: %d\n", func, line, nb_bits, value ); +#endif +#ifdef DEBUGGING + if ( nb_bits < ( 32 - 1 ) && ( value >> nb_bits ) > 0 ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Indice ID = %d with value %d exceeds the range of %d bits (frame %d) !\n", id, value, nb_bits, frame ); + } + + if ( nb_bits > 16 ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Indice ID = %d with value %d is trying to allocate %d bits which exceeds 16 bits (frame %d) !\n", id, value, nb_bits, frame ); + } + +#endif /* check the limits of the list of indices */ if ( ( error = check_ind_list_limits( hBstr ) ) != IVAS_ERR_OK ) @@ -933,10 +979,19 @@ ivas_error push_indice( * Push a new indice into the buffer at the next position *-------------------------------------------------------------------*/ +#ifdef DEBUG_BS_READ_WRITE +ivas_error push_next_indice_( +#else ivas_error push_next_indice( +#endif BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ uint16_t value, /* i : value of the quantized indice */ int16_t nb_bits /* i : number of bits used to quantize the indice */ +#ifdef DEBUG_BS_READ_WRITE + , + int16_t line, + const char *func +#endif ) { int16_t prev_id; @@ -944,6 +999,21 @@ ivas_error push_next_indice( error = IVAS_ERR_OK; +#ifdef DEBUG_BS_READ_WRITE + printf( "%s: %d: %d: %d\n", func, line, nb_bits, value ); +#endif +#ifdef DEBUGGING + if ( nb_bits < ( 32 - 1 ) && ( value >> nb_bits ) > 0 ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Indice with value %d exceeds the range of %d bits (frame %d) !\n", value, nb_bits, frame ); + } + + if ( nb_bits > 16 ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Indice with value %d is trying to allocate %d bits which exceeds 16 bits !\n", value, nb_bits ); + } + +#endif /* check the limits of the list of indices */ if ( ( error = check_ind_list_limits( hBstr ) ) != IVAS_ERR_OK ) @@ -979,10 +1049,19 @@ ivas_error push_next_indice( * Push a bit buffer into the buffer at the next position *-------------------------------------------------------------------*/ +#ifdef DEBUG_BS_READ_WRITE +ivas_error push_next_bits_( +#else ivas_error push_next_bits( +#endif BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const uint16_t bits[], /* i : bit buffer to pack, sequence of single bits */ const int16_t nb_bits /* i : number of bits to pack */ +#ifdef DEBUG_BS_READ_WRITE + , + int16_t line, + const char *func +#endif ) { uint16_t code; @@ -992,6 +1071,9 @@ ivas_error push_next_bits( ivas_error error; error = IVAS_ERR_OK; +#ifdef DEBUG_BS_READ_WRITE + printf( "%s: %d: %d\n", func, line, nb_bits ); +#endif ptr = &hBstr->ind_list[hBstr->nb_ind_tot]; @@ -1018,6 +1100,9 @@ ivas_error push_next_bits( ptr = &hBstr->ind_list[hBstr->nb_ind_tot]; ptr->value = code; +#ifdef DEBUG_BS_READ_WRITE + printf( "code: %d\n", code ); +#endif ptr->nb_bits = 16; ptr->id = prev_id; hBstr->nb_ind_tot++; @@ -1034,6 +1119,9 @@ ivas_error push_next_bits( ptr = &hBstr->ind_list[hBstr->nb_ind_tot]; ptr->value = bits[i]; +#ifdef DEBUG_BS_READ_WRITE + printf( "value: %d\n", ptr->value ); +#endif ptr->nb_bits = 1; ptr->id = prev_id; hBstr->nb_ind_tot++; @@ -1129,9 +1217,18 @@ uint16_t delete_indice( *-------------------------------------------------------------------*/ /*! r: value of the indice */ +#ifdef DEBUG_BS_READ_WRITE +uint16_t get_next_indice_( +#else uint16_t get_next_indice( +#endif Decoder_State *st, /* i/o: decoder state structure */ int16_t nb_bits /* i : number of bits that were used to quantize the indice */ +#ifdef DEBUG_BS_READ_WRITE + , + int16_t line, + const char *func +#endif ) { uint16_t value; @@ -1154,6 +1251,9 @@ uint16_t get_next_indice( value <<= 1; value += st->bit_stream[st->next_bit_pos + i]; } +#ifdef DEBUG_BS_READ_WRITE + printf( "%s: %d: %d: %d\n", func, line, nb_bits, value ); +#endif /* update the position in the bitstream */ st->next_bit_pos += nb_bits; @@ -1210,10 +1310,19 @@ void get_next_indice_tmp( *-------------------------------------------------------------------*/ /*! r: value of the indice */ +#ifdef DEBUG_BS_READ_WRITE +uint16_t get_indice_( +#else uint16_t get_indice( +#endif Decoder_State *st, /* i/o: decoder state structure */ int16_t pos, /* i : absolute position in the bitstream (update after the read) */ int16_t nb_bits /* i : number of bits that were used to quantize the indice */ +#ifdef DEBUG_BS_READ_WRITE + , + int16_t line, + const char *func +#endif ) { uint16_t value; @@ -1237,6 +1346,9 @@ uint16_t get_indice( value <<= 1; value += st->bit_stream[pos + i]; } +#ifdef DEBUG_BS_READ_WRITE + printf( "%s: %d: %d: %d\n", func, line, nb_bits, value ); +#endif return value; } @@ -1355,6 +1467,9 @@ static int16_t write_indices_to_stream( int16_t i, k; int16_t value, nb_bits; uint16_t mask; +#ifdef ENABLE_BITRATE_VERIFICATION + int16_t total_nb_bits = 0; +#endif for ( i = 0; i < num_indices; i++ ) { @@ -1363,6 +1478,9 @@ static int16_t write_indices_to_stream( if ( nb_bits > 0 ) { +#ifdef ENABLE_BITRATE_VERIFICATION + total_nb_bits += nb_bits; +#endif /* mask from MSB to LSB */ mask = 1 << ( nb_bits - 1 ); @@ -1383,8 +1501,22 @@ static int16_t write_indices_to_stream( mask >>= 1; } } +#ifdef DEBUGGING + else if ( nb_bits == 0 ) + { + /* fprintf( stderr, "Warning: %s: nb_bits == 0!\n", __func__ ); */ + } + else + { + /* fprintf( stderr, "Warning: %s: nb_bits == %d!\n", __func__, nb_bits ); */ + } +#endif } +#ifdef ENABLE_BITRATE_VERIFICATION + return total_nb_bits; +#else return 0; +#endif } /*-------------------------------------------------------------------* @@ -1410,6 +1542,9 @@ static ivas_error write_indices_element( Indice *ind_list_metadata; int16_t n, n_channels; +#ifdef ENABLE_BITRATE_VERIFICATION + int16_t total_nb_bits; +#endif ivas_error error; error = IVAS_ERR_OK; @@ -1447,6 +1582,12 @@ static ivas_error write_indices_element( nb_ind_tot_metadata = st_ivas->hCPE[element_id]->hMetaData->nb_ind_tot; } } +#ifdef DEBUGGING + else + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Bitstream writing error in frame %d. Exiting!\n", frame ); + } +#endif } n_channels = 1; @@ -1476,15 +1617,33 @@ static ivas_error write_indices_element( pt_stream_loc += nb_bits_tot_metadata - 1; pt_stream_end = pt_stream_loc + 1; +#ifdef ENABLE_BITRATE_VERIFICATION + total_nb_bits = +#endif write_indices_to_stream( ind_list_metadata, &pt_stream_loc, -1, nb_ind_tot_metadata ); +#ifdef ENABLE_BITRATE_VERIFICATION + if ( total_nb_bits != nb_bits_tot_metadata ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Bitstream write size mismatch! Written bits: %d vs. Reference bits: %d\n", total_nb_bits, nb_bits_tot_metadata ); + } +#endif /* restore previous pointer position */ pt_stream_loc = pt_stream_backup; } +#ifdef ENABLE_BITRATE_VERIFICATION + total_nb_bits = +#endif write_indices_to_stream( sts[n]->hBstr->ind_list, &pt_stream_loc, 1, sts[n]->hBstr->nb_ind_tot ); +#ifdef ENABLE_BITRATE_VERIFICATION + if ( total_nb_bits != sts[n]->hBstr->nb_bits_tot ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Bitstream write size mismatch! Written bits: %d vs. Reference bits: %d\n", total_nb_bits, sts[n]->hBstr->nb_bits_tot ); + } +#endif if ( pt_stream_loc > pt_stream_end ) { pt_stream_end = pt_stream_loc; @@ -1539,6 +1698,11 @@ ivas_error write_indices_ivas( { int16_t i, n; uint16_t *pt_stream; +#ifdef ENABLE_BITRATE_VERIFICATION + Encoder_State **sts; + int32_t ivas_total_brate; + int16_t ch; +#endif ivas_error error; error = IVAS_ERR_OK; @@ -1549,6 +1713,45 @@ ivas_error write_indices_ivas( bit_stream[i] = 0; } +#ifdef ENABLE_BITRATE_VERIFICATION + i = 0; + + for ( n = 0; n < st_ivas->nSCE; n++ ) + { + sts = st_ivas->hSCE[n]->hCoreCoder; + i += sts[0]->hBstr->nb_bits_tot; + + if ( st_ivas->hSCE[n]->hMetaData != NULL ) + { + i += st_ivas->hSCE[n]->hMetaData->nb_bits_tot; + } + } + + for ( n = 0; n < st_ivas->nCPE; n++ ) + { + sts = st_ivas->hCPE[n]->hCoreCoder; + for ( ch = 0; ch < CPE_CHANNELS; ch++ ) + { + i += sts[ch]->hBstr->nb_bits_tot; + } + + if ( st_ivas->hCPE[n]->hMetaData != NULL ) + { + i += st_ivas->hCPE[n]->hMetaData->nb_bits_tot; + } + } + + ivas_total_brate = st_ivas->hEncoderConfig->ivas_total_brate; + if ( st_ivas->hEncoderConfig->Opt_SC_VBR ) + { + ivas_total_brate = st_ivas->hSCE[0]->hCoreCoder[0]->total_brate; + } + + if ( i * FRAMES_PER_SEC != ivas_total_brate && i >= ACELP_11k60 / FRAMES_PER_SEC ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Bitstream write size mismatch! Actual bitrate: %ld vs. Reference bitrate: %d\n", i * 50L, ivas_total_brate ); + } +#endif /*-----------------------------------------------------------------* * Encode Payload @@ -1663,6 +1866,9 @@ static void decoder_selectCodec( st->codec_mode = MODE1; break; default: /* validate that total_brate (derived from RTP packet or a file header) is one of the defined bitrates */ +#ifdef DEBUGGING + IVAS_ERROR( IVAS_ERR_INTERNAL, "Error illegal total bitrate (= %d) \n", total_brate ); +#endif st->codec_mode = st->last_codec_mode; st->bfi = 1; break; @@ -1734,6 +1940,12 @@ static void dec_prm_core( break; } } +#ifdef DEBUGGING + if ( n == FRAME_SIZE_NB ) + { + assert( !"Bitrate not supported: not part of EVS" ); + } +#endif /* Get audio bandwidth info */ st->bwidth = get_next_indice( st, FrameSizeConfig[frame_size_index].bandwidth_bits ); @@ -1832,6 +2044,9 @@ static void decision_matrix_core_dec( while ( acelp_sig_tbl[start_idx] != st->total_brate ) { start_idx++; +#ifdef DEBUGGING + assert( ( start_idx < 194 ) && "ERROR: start_idx larger than acelp_sig_tbl[].\n" ); +#endif } /* skip the bitrate */ @@ -1977,8 +2192,233 @@ void mdct_switching_dec( return; } +#ifdef DEBUGGING +#ifdef ALLOW_BYTE_EP +/*-------------------------------------------------------------------* + * ep_type_check() + * + * + *-------------------------------------------------------------------*/ +static Word16 ep_type_check() +{ + static int16_t ep_type = -1; /* 0=G192 (0x6b21 or 0x6b20), 1=byte(0x21 or 0x20) , + 2=ascii "0xa30" or "0xa31" , 3=short( 0x0000 or 0x0001) */ + int16_t tmp; + + if ( ep_type < 0 ) + { + tmp = 0; + + if ( fread( &tmp, sizeof( int16_t ), 1, FEC_pattern ) != 1 ) + { + IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error reading first two bytes from the FEC pattern file !" ); + } + else + { + switch ( tmp ) + { + case G192_SYNC_BAD_FRAME: + case G192_SYNC_GOOD_FRAME: + ep_type = 0; /* G192 */ + break; + case 0x2020: /* BAD,BAD */ + case 0x2021: /* BAD,SYNC */ + case 0x2120: /* SYNC,BAD */ + case 0x2121: /* SYNC,SYNC */ + ep_type = 1; /* byte */ + break; + case 0xa31: + case 0xa30: + ep_type = 2; /* ascii */ + break; + case 0x0000: + case 0x0001: + ep_type = 3; /* short */ + break; + default: + IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error reading the FEC pattern file :: illegal format of the first two byte word=0x%02x ", tmp ); + IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Allowed formats are G192(0x6b20,0x6b21), byte(0x20,0x21), ASCII(\"0\n\" \"1\n\") or short(0x0000, 0x0001) \n" ); + break; + } + + fseek( FEC_pattern, 0L, SEEK_SET ); /* rewind */ + } + } + return ep_type; +} + +/*-------------------------------------------------------------------* + * ep_flag_check_apply() + * + * + *-------------------------------------------------------------------*/ +static Word16 ep_flag_check_apply( + Word16 ep_type, + Word16 tmp, + Word16 bfi_so_far ) +{ + if ( ep_type == 0 && ( tmp == G192_SYNC_GOOD_FRAME || tmp == G192_SYNC_BAD_FRAME ) ) + { /* g192 validity check */ + if ( tmp == G192_SYNC_BAD_FRAME ) + { + return 1; + } + } + else if ( ep_type == 1 && ( tmp == 0x0021 || tmp == 0x0020 ) ) + { /* byte validity check*/ + if ( tmp == 0x0020 ) + { + return 1; + } + } + else if ( ep_type == 2 && ( tmp == 0x0a31 || tmp == 0x0a30 ) ) + { /* ascii validity check */ + if ( tmp == 0x0a31 ) + { + return 1; + } + } + else if ( ep_type == 3 && ( tmp == 0 || tmp == 1 ) ) + { /* short validity check */ + if ( tmp == 0x0001 ) + { + return 1; + } + } + else + { + IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error reading the FEC pattern flag 0x%02x from the type %d FEC pattern file , frame=%d", tmp, ep_type, frame ); + } + + return bfi_so_far; /* no change */ +} + +/*-------------------------------------------------------------------* + * read_error_flag ( ) + * + * + *-------------------------------------------------------------------*/ +static Word16 read_error_flag( + Word16 bfi_so_far ) +{ + Word16 tmp; + Word16 ep_type; + Word16 wrap; + wrap = 0; + + ep_type = ep_type_check(); + tmp = 0; + + if ( ( ep_type == 1 ) ? ( fread( &tmp, sizeof( int8_t ), 1, FEC_pattern ) != 1 ) /* read byte directly stored in short variable */ + : ( fread( &tmp, sizeof( int16_t ), 1, FEC_pattern ) != 1 ) ) + { + if ( feof( FEC_pattern ) != 0 ) + { + wrap = 1; /* wrap event flag */ + fseek( FEC_pattern, 0L, SEEK_SET ); +#ifndef WRAP_AS_EIDXOR + /* good frame injected in wrap event */ + switch ( ep_type ) + { + case 0: + tmp = SYNC_GOOD_FRAME; + break; + case 1: + tmp = 0x21; + break; + case 2: + tmp = 0x0a30; + break; + default: + tmp = 0; + break; /* 4: short */ + } +#endif + } + else + { + IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error reading the FEC pattern file !" ); + } + } +#ifdef WRAP_AS_EIDXOR + if ( wrap != 0 ) /* wrap file and read again, try to get the next flag , */ + { + tmp = 0; /* needed for byte re-reading */ + if ( ( ep_type == 1 ) ? ( fread( &tmp, sizeof( int8_t ), 1, FEC_pattern ) != 1 ) /* read byte directly stored in short variable */ + : ( fread( &tmp, sizeof( int16_t ), 1, FEC_pattern ) != 1 ) ) + { + IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error reading the wrapped FEC pattern file !" ); + } + } + + return ep_flag_check_apply( ep_type, tmp, bfi_so_far ); +#else + if ( wrap == 0 ) + { + return ep_flag_check_apply( ep_type, tmp, bfi_so_far ); + } + else + { + return bfi_so_far; + } +#endif +} +#endif +#endif + + +#ifdef DEBUGGING +/*-------------------------------------------------------------------* + * file_read_FECpattern() + * + * Simulate packet losses by reading FEC pattern from external file + *-------------------------------------------------------------------*/ + +static ivas_error file_read_FECpattern( + int16_t *bfi ) +{ + ivas_error error; + + error = IVAS_ERR_OK; + *bfi = 0; + + /* FEC pattern file provided */ + if ( FEC_pattern != NULL ) + { + int16_t tmp = 0; + if ( fread( &tmp, sizeof( int16_t ), 1, FEC_pattern ) != 1 ) + { + if ( feof( FEC_pattern ) != 0 ) + { +#ifdef WRAP_AS_EIDXOR + fseek( FEC_pattern, 0L, SEEK_SET ); + fread( &tmp, sizeof( int16_t ), 1, FEC_pattern ); +#else + tmp = 0; + fseek( FEC_pattern, 0L, SEEK_SET ); +#endif + } + else + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error reading the FEC pattern file !" ); + } + } + + if ( tmp == 2609 || tmp == 1 || tmp == (uint16_t) 0x6B20 /* == G192_SYNC_BAD_FRAME */ ) + { + *bfi = 1; + } + else + { + *bfi = 0; + } + } + + return error; +} +#endif /*-------------------------------------------------------------------* @@ -2060,6 +2500,277 @@ void ivas_set_bitstream_pointers( } +#ifdef DEBUGGING +/*-------------------------------------------------------------------* + * preview_indices() + * + * Read indices from serial bitstream to the buffer to print out info + * about technologies. + * + * !!The read parmeters are temporary only and not used for decoding!! + *-------------------------------------------------------------------*/ + +ivas_error preview_indices( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + uint16_t bit_stream[], /* i : bitstream buffer */ + UWord16 num_bits /* i : number of bits in bitstream */ +) +{ + int16_t k, idx; + int32_t total_brate; + ivas_error error; + + error = IVAS_ERR_OK; + + /* convert the frame length to total bitrate */ + total_brate = (int32_t) ( num_bits * FRAMES_PER_SEC ); + + if ( st_ivas->ivas_format != MONO_FORMAT && is_DTXrate( total_brate ) == 0 ) + { + /* read IVAS format */ + k = 0; + if ( bit_stream[0] == 1 ) + { + k = 1; + } + k <<= 1; + if ( bit_stream[1] == 1 ) + { + k += 1; + } + + switch ( k ) + { + case 0: + st_ivas->ivas_format = STEREO_FORMAT; + break; + case 1: + st_ivas->ivas_format = MC_FORMAT; + break; + case 2: + st_ivas->ivas_format = ISM_FORMAT; + + if ( total_brate >= IVAS_24k4 ) + { + if ( bit_stream[2] ) + { + if ( bit_stream[3] ) + { + st_ivas->ivas_format = SBA_ISM_FORMAT; + } + else + { + st_ivas->ivas_format = MASA_ISM_FORMAT; + } + } + } + break; + case 3: + if ( bit_stream[2] == 0 ) + { + st_ivas->ivas_format = SBA_FORMAT; + } + else + { + st_ivas->ivas_format = MASA_FORMAT; + } + break; + } + } + else if ( total_brate == IVAS_SID_5k2 ) + { + /* read SID format */ + st_ivas->sid_format = 0; + if ( bit_stream[0] == 1 ) + { + st_ivas->sid_format += 4; + } + if ( bit_stream[1] == 1 ) + { + st_ivas->sid_format += 2; + } + if ( bit_stream[2] == 1 ) + { + st_ivas->sid_format += 1; + } + + switch ( st_ivas->sid_format ) + { + case SID_DFT_STEREO: + st_ivas->element_mode_init = IVAS_CPE_DFT; + st_ivas->ivas_format = STEREO_FORMAT; + break; + case SID_MDCT_STEREO: + st_ivas->element_mode_init = IVAS_CPE_MDCT; + st_ivas->ivas_format = STEREO_FORMAT; + break; + case SID_ISM: + st_ivas->ivas_format = ISM_FORMAT; + break; + case SID_MULTICHANNEL: + st_ivas->ivas_format = MC_FORMAT; + break; + case SID_SBA_1TC: + st_ivas->ivas_format = SBA_FORMAT; + st_ivas->element_mode_init = IVAS_SCE; + break; + case SID_SBA_2TC: + st_ivas->ivas_format = SBA_FORMAT; + st_ivas->element_mode_init = IVAS_CPE_MDCT; + break; + case SID_MASA_1TC: + st_ivas->ivas_format = MASA_FORMAT; + st_ivas->element_mode_init = IVAS_SCE; + break; + case SID_MASA_2TC: + st_ivas->ivas_format = MASA_FORMAT; + if ( bit_stream[total_brate / FRAMES_PER_SEC - 1] == 1 ) + { + st_ivas->element_mode_init = IVAS_CPE_MDCT; + } + else + { + st_ivas->element_mode_init = IVAS_CPE_DFT; + } + break; + default: + /* This should actually be impossible, since only 3 bits are read, so if this happens something is broken */ + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Invalid value %c found in SID format field.", st_ivas->sid_format ); + } + } + + /* only read element mode from active frames */ + if ( is_DTXrate( total_brate ) == 0 ) + { + /* read element_mode - needed in init_decoder() */ + if ( st_ivas->ivas_format == STEREO_FORMAT || st_ivas->ivas_format == MC_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) + { + if ( st_ivas->ivas_format == MASA_FORMAT ) + { + /* read number of MASA transport channels */ + if ( bit_stream[num_bits - 1] == 1 ) + { + st_ivas->nchan_transport = 2; + } + else + { + st_ivas->nchan_transport = 1; + } + } + + if ( st_ivas->ivas_format == MC_FORMAT ) + { + /* read MC configuration */ + idx = 0; + for ( k = 0; k < MC_LS_SETUP_BITS; k++ ) + { + if ( bit_stream[IVAS_FORMAT_SIGNALING_NBITS + k] == 1 ) + { + idx += ( 1 << ( MC_LS_SETUP_BITS - 1 - k ) ); + } + } + st_ivas->transport_config = ivas_mc_map_ls_setup_to_output_config( (MC_LS_SETUP) idx ); + } + + if ( !( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nchan_transport == 1 ) && st_ivas->ivas_format != MC_FORMAT ) + { + /* read stereo technology info */ + k = IVAS_FORMAT_SIGNALING_NBITS; + if ( st_ivas->ivas_format == MASA_FORMAT ) + { + k = IVAS_FORMAT_SIGNALING_NBITS_EXTENDED; + } + + if ( total_brate < MIN_BRATE_MDCT_STEREO ) + { + /* 1 bit */ + if ( bit_stream[k] == 1 ) + { + st_ivas->element_mode_init = 1 + IVAS_CPE_DFT; + } + else + { + st_ivas->element_mode_init = 0 + IVAS_CPE_DFT; + } + } + else + { + st_ivas->element_mode_init = IVAS_CPE_MDCT; + } + } + } + else if ( st_ivas->ivas_format == ISM_FORMAT ) + { + /* read number of objects from the bitstream */ + st_ivas->nchan_transport = 1; + + k = (int16_t) ( ( total_brate / FRAMES_PER_SEC ) - 1 ); + while ( bit_stream[k] == 1 && st_ivas->nchan_transport < MAX_NUM_OBJECTS ) + { + st_ivas->nchan_transport++; + k--; + } + st_ivas->transport_config = IVAS_AUDIO_CONFIG_EXTERNAL + st_ivas->nchan_transport; + + st_ivas->ism_mode = ivas_ism_mode_select( st_ivas->nchan_transport, total_brate ); + st_ivas->nSCE = st_ivas->nchan_transport; + } + else if ( st_ivas->ivas_format == SBA_FORMAT ) + { + /* Read SBA planar flag and SBA order */ + st_ivas->sba_planar = ( bit_stream[IVAS_FORMAT_SIGNALING_NBITS_EXTENDED] == 1 ); + st_ivas->sba_order = ( bit_stream[IVAS_FORMAT_SIGNALING_NBITS_EXTENDED + 2] == 1 ); + st_ivas->sba_order += 2 * ( bit_stream[IVAS_FORMAT_SIGNALING_NBITS_EXTENDED + 1] == 1 ); + + st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( total_brate, st_ivas->sba_order ); + + ivas_sba_config( total_brate, st_ivas->sba_analysis_order, -1, &( st_ivas->nchan_transport ), st_ivas->sba_planar, &( st_ivas->nSCE ), &( st_ivas->nCPE ), &( st_ivas->element_mode_init ) ); + } + else if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) + { + /* read number of objects from the bitstream */ + if ( total_brate != SID_2k40 && total_brate != FRAME_NO_DATA ) + { + st_ivas->nchan_ism = 2 * bit_stream[total_brate / FRAMES_PER_SEC - 1] + bit_stream[total_brate / FRAMES_PER_SEC - 2] + 1; + st_ivas->ism_mode = ISM_SBA_MODE_DISC; + } + + /* Read SBA planar flag and SBA order */ + st_ivas->sba_planar = ( bit_stream[IVAS_FORMAT_SIGNALING_NBITS_EXTENDED + IVAS_COMBINED_FORMAT_SIGNALLING_BITS] == 1 ); + + if ( total_brate >= IVAS_256k ) + { + st_ivas->sba_order = ( bit_stream[IVAS_FORMAT_SIGNALING_NBITS_EXTENDED + IVAS_COMBINED_FORMAT_SIGNALLING_BITS + 2] == 1 ); + st_ivas->sba_order += 2 * ( bit_stream[IVAS_FORMAT_SIGNALING_NBITS_EXTENDED + IVAS_COMBINED_FORMAT_SIGNALLING_BITS + 1] == 1 ); + } + else + { + st_ivas->sba_order = 3; + } + + st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( total_brate, st_ivas->sba_order ); + + ivas_sba_config( total_brate, st_ivas->sba_analysis_order, -1, &( st_ivas->nchan_transport ), st_ivas->sba_planar, &( st_ivas->nSCE ), &( st_ivas->nCPE ), &( st_ivas->element_mode_init ) ); + } + else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + /* read number of objects from the bitstream */ + st_ivas->nchan_transport = 2; /* always 2 MASA transport channels */ + st_ivas->nchan_ism = 0; + + if ( total_brate != SID_2k40 && total_brate != FRAME_NO_DATA ) + { + st_ivas->nchan_ism = 2 * bit_stream[total_brate / FRAMES_PER_SEC - 1] + bit_stream[total_brate / FRAMES_PER_SEC - 2] + 1; + st_ivas->ism_mode = ivas_omasa_ism_mode_select( total_brate, st_ivas->nchan_ism ); + } + } + } + + st_ivas->hDecoderConfig->ivas_total_brate = total_brate; + + return error; +} +#endif /*-------------------------------------------------------------------* @@ -2093,7 +2804,20 @@ ivas_error read_indices( st_ivas->BER_detect = 0; sts = reset_elements( st_ivas ); +#ifdef DEBUGGING + file_read_FECpattern( &st_ivas->bfi ); + st_ivas->bfi |= bfi; + + if ( bfi == FRAMEMODE_MISSING ) + { + for ( k = 0; k < num_bits; k++ ) + { + bit_stream[k] = 0; + } + } +#else st_ivas->bfi = bfi; +#endif /* convert the frame length to total bitrate */ total_brate = (int32_t) ( num_bits * FRAMES_PER_SEC ); diff --git a/lib_com/calc_st_com.c b/lib_com/calc_st_com.c index 59ceb09da..2f2cc5633 100644 --- a/lib_com/calc_st_com.c +++ b/lib_com/calc_st_com.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_com/cb_shape.c b/lib_com/cb_shape.c index 77f17eb23..364ed639f 100644 --- a/lib_com/cb_shape.c +++ b/lib_com/cb_shape.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_com/cldfb.c b/lib_com/cldfb.c index 716dff7a3..1490703ae 100644 --- a/lib_com/cldfb.c +++ b/lib_com/cldfb.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "stat_dec.h" #include "prot.h" diff --git a/lib_com/cng_exc.c b/lib_com/cng_exc.c index 8fdc68921..9f0a22320 100644 --- a/lib_com/cng_exc.c +++ b/lib_com/cng_exc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_com/cnst.h b/lib_com/cnst.h index 5bfffa4dd..0d604896c 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -76,6 +76,16 @@ #define DEC_IVAS 2 /* Index for IVAS decoder */ +#ifdef DEBUGGING +#define FORCE_SPEECH 100 /* debugging - force speech on the command line */ +#define FORCE_MUSIC 101 /* debugging - force music on the command line */ +#define FORCE_ACELP 102 /* debugging - force ACELP core on the command line */ +#define FORCE_GSC 103 /* debugging - force GSC core on the command line */ +#define FORCE_TCX 104 /* debugging - force TCX core on the command line */ +#define FORCE_HQ 105 /* debugging - force HQ core on the command line */ +#define FORCE_TD_RENDERER 201 +#define FORCE_CLDFB_RENDERER 202 +#endif enum{ NB = 0, /* Indicator of 4 kHz bandwidth */ diff --git a/lib_com/codec_tcx_common.c b/lib_com/codec_tcx_common.c index 2375ef387..7bb6dac40 100644 --- a/lib_com/codec_tcx_common.c +++ b/lib_com/codec_tcx_common.c @@ -38,6 +38,9 @@ #include "options.h" #include #include "prot.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" /*-------------------------------------------------------------------* diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index c4454fd62..4870ff5d0 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -200,6 +200,15 @@ typedef struct _IVAS_JBM_TRACE_DATA * Renderer API structures and enums *----------------------------------------------------------------------------------*/ +#ifdef DEBUGGING +typedef enum +{ + IVAS_RENDER_TYPE_OVERRIDE_NONE, + IVAS_RENDER_TYPE_OVERRIDE_CREND, + IVAS_RENDER_TYPE_OVERRIDE_FASTCONV + +} IVAS_RENDER_TYPE_OVERRIDE; +#endif typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG { @@ -222,6 +231,9 @@ typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG typedef struct _IVAS_RENDER_CONFIG { +#ifdef DEBUGGING + IVAS_RENDER_TYPE_OVERRIDE renderer_type_override; +#endif IVAS_ROOM_ACOUSTICS_CONFIG_DATA roomAcoustics; float directivity[IVAS_MAX_NUM_OBJECTS * 3]; diff --git a/lib_com/core_com_config.c b/lib_com/core_com_config.c index 13fe05bbb..0ee9b40ae 100644 --- a/lib_com/core_com_config.c +++ b/lib_com/core_com_config.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "rom_com.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_com/deemph.c b/lib_com/deemph.c index 26baccd04..9f4463d6a 100644 --- a/lib_com/deemph.c +++ b/lib_com/deemph.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "wmc_auto.h" diff --git a/lib_com/delay_comp.c b/lib_com/delay_comp.c index 66c81d440..73d9db9f4 100644 --- a/lib_com/delay_comp.c +++ b/lib_com/delay_comp.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "ivas_cnst.h" #include "wmc_auto.h" diff --git a/lib_com/disclaimer.c b/lib_com/disclaimer.c index f8af72f54..10a31d94c 100644 --- a/lib_com/disclaimer.c +++ b/lib_com/disclaimer.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #define WMC_TOOL_SKIP diff --git a/lib_com/dlpc_bfi.c b/lib_com/dlpc_bfi.c index ea701a3fe..b894b845f 100644 --- a/lib_com/dlpc_bfi.c +++ b/lib_com/dlpc_bfi.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "rom_com.h" #include "wmc_auto.h" diff --git a/lib_com/edct.c b/lib_com/edct.c index a265794f3..6f6d6c32b 100644 --- a/lib_com/edct.c +++ b/lib_com/edct.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" @@ -98,6 +101,10 @@ static ivas_error get_edct_table( case 80: *edct_table = edct_table_40; break; +#ifdef DEBUGGING + default: + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "edct/edst(): length is not in table!" ); +#endif } return error; diff --git a/lib_com/enhancer.c b/lib_com/enhancer.c index 407588bc3..d0eeeb76c 100644 --- a/lib_com/enhancer.c +++ b/lib_com/enhancer.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_com/enr_1_az.c b/lib_com/enr_1_az.c index 800fa185c..2b66a14d7 100644 --- a/lib_com/enr_1_az.c +++ b/lib_com/enr_1_az.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_com/env_adj.c b/lib_com/env_adj.c index 459c40338..03b7d6cef 100644 --- a/lib_com/env_adj.c +++ b/lib_com/env_adj.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_com/env_stab.c b/lib_com/env_stab.c index ee07218f9..a1957566b 100644 --- a/lib_com/env_stab.c +++ b/lib_com/env_stab.c @@ -36,12 +36,18 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" #include "rom_com.h" #include "wmc_auto.h" #include "stl.h" +#ifdef DEBUGGING +#include "assert.h" +#endif /*--------------------------------------------------------------------------* * Local constants @@ -102,6 +108,9 @@ float env_stability( mem_norm[i] = ynrm[i]; } +#ifdef DEBUGGING + assert( nb_sfm == 27 || nb_sfm == 26 ); +#endif inv_nb_sfm = 19418; /* Q19 */ if ( nb_sfm == 26 ) { diff --git a/lib_com/env_stab_trans.c b/lib_com/env_stab_trans.c index 1850ed48b..a2d4492b3 100644 --- a/lib_com/env_stab_trans.c +++ b/lib_com/env_stab_trans.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_com/est_tilt.c b/lib_com/est_tilt.c index 2f5b5bbac..8073e39df 100644 --- a/lib_com/est_tilt.c +++ b/lib_com/est_tilt.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_com/fd_cng_com.c b/lib_com/fd_cng_com.c index a6029e105..dd82c4f06 100644 --- a/lib_com/fd_cng_com.c +++ b/lib_com/fd_cng_com.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "rom_com.h" diff --git a/lib_com/fft.c b/lib_com/fft.c index e5607dcc3..a36712b8e 100644 --- a/lib_com/fft.c +++ b/lib_com/fft.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_com/fft_rel.c b/lib_com/fft_rel.c index e45736be8..46ee5e943 100644 --- a/lib_com/fft_rel.c +++ b/lib_com/fft_rel.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "rom_com.h" #include "wmc_auto.h" diff --git a/lib_com/fill_spectrum.c b/lib_com/fill_spectrum.c index 93d4cd572..669482487 100644 --- a/lib_com/fill_spectrum.c +++ b/lib_com/fill_spectrum.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_com/findpulse.c b/lib_com/findpulse.c index 3f8321160..3383397bc 100644 --- a/lib_com/findpulse.c +++ b/lib_com/findpulse.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "cnst.h" diff --git a/lib_com/fine_gain_bits.c b/lib_com/fine_gain_bits.c index 5e65b12e4..9f10bcd70 100644 --- a/lib_com/fine_gain_bits.c +++ b/lib_com/fine_gain_bits.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "rom_com.h" #include "prot.h" #include diff --git a/lib_com/frame_ener.c b/lib_com/frame_ener.c index 1592c6e9f..f44cb099c 100644 --- a/lib_com/frame_ener.c +++ b/lib_com/frame_ener.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_com/get_gain.c b/lib_com/get_gain.c index 94e23a1c6..e3457128f 100644 --- a/lib_com/get_gain.c +++ b/lib_com/get_gain.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "wmc_auto.h" diff --git a/lib_com/gs_bitallocation.c b/lib_com/gs_bitallocation.c index 8bbf1d21c..d099c2200 100644 --- a/lib_com/gs_bitallocation.c +++ b/lib_com/gs_bitallocation.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" @@ -919,6 +922,9 @@ static float Find_bit_frac( else { inv_bandQ15 = (int16_t) ( ( 1.0f / nb_band ) * 32678 + 0.5f ); +#ifdef DEBUGGING + printf( "1/%d NOT DEFINED in Find_bit_frac\n", nb_band ); +#endif } L_num = inv_bandQ15 * remaining_bits; diff --git a/lib_com/gs_gains.c b/lib_com/gs_gains.c index 72b1ccf35..40626468b 100644 --- a/lib_com/gs_gains.c +++ b/lib_com/gs_gains.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_com/gs_inact_switching.c b/lib_com/gs_inact_switching.c index 04ad8a3eb..cd380e86e 100644 --- a/lib_com/gs_inact_switching.c +++ b/lib_com/gs_inact_switching.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_com/gs_noisefill.c b/lib_com/gs_noisefill.c index f452dab7a..a92aec075 100644 --- a/lib_com/gs_noisefill.c +++ b/lib_com/gs_noisefill.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_com/gs_preech.c b/lib_com/gs_preech.c index ae2bbf6f5..5a98f4093 100644 --- a/lib_com/gs_preech.c +++ b/lib_com/gs_preech.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_com/hp50.c b/lib_com/hp50.c index b9268c8f9..3624fabb4 100644 --- a/lib_com/hp50.c +++ b/lib_com/hp50.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "wmc_auto.h" diff --git a/lib_com/hq2_bit_alloc.c b/lib_com/hq2_bit_alloc.c index d471b170e..34c37babd 100644 --- a/lib_com/hq2_bit_alloc.c +++ b/lib_com/hq2_bit_alloc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "rom_com.h" diff --git a/lib_com/hq2_core_com.c b/lib_com/hq2_core_com.c index 280d492ae..22a596a75 100644 --- a/lib_com/hq2_core_com.c +++ b/lib_com/hq2_core_com.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_com/hq2_noise_inject.c b/lib_com/hq2_noise_inject.c index ed48dab7b..0404056dd 100644 --- a/lib_com/hq2_noise_inject.c +++ b/lib_com/hq2_noise_inject.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "wmc_auto.h" diff --git a/lib_com/hq_bit_allocation.c b/lib_com/hq_bit_allocation.c index 7556ed505..faba9f8da 100644 --- a/lib_com/hq_bit_allocation.c +++ b/lib_com/hq_bit_allocation.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "rom_com.h" diff --git a/lib_com/hq_conf.c b/lib_com/hq_conf.c index d0f793921..ac9298159 100644 --- a/lib_com/hq_conf.c +++ b/lib_com/hq_conf.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_com/hq_tools.c b/lib_com/hq_tools.c index df59ac172..4ad78fc90 100644 --- a/lib_com/hq_tools.c +++ b/lib_com/hq_tools.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "rom_com.h" diff --git a/lib_com/hvq_pvq_bitalloc.c b/lib_com/hvq_pvq_bitalloc.c index 5ff0d3344..2808030ae 100644 --- a/lib_com/hvq_pvq_bitalloc.c +++ b/lib_com/hvq_pvq_bitalloc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "rom_com.h" diff --git a/lib_com/ifft_rel.c b/lib_com/ifft_rel.c index 597a5d173..28334b06d 100644 --- a/lib_com/ifft_rel.c +++ b/lib_com/ifft_rel.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "rom_com.h" #include "wmc_auto.h" diff --git a/lib_com/igf_base.c b/lib_com/igf_base.c index 73f7228d0..ac1965100 100644 --- a/lib_com/igf_base.c +++ b/lib_com/igf_base.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "rom_com.h" #include "wmc_auto.h" diff --git a/lib_com/index_pvq_opt.c b/lib_com/index_pvq_opt.c index b14fd8fa3..097732442 100644 --- a/lib_com/index_pvq_opt.c +++ b/lib_com/index_pvq_opt.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_com/int_lsp.c b/lib_com/int_lsp.c index 448a97e33..ff1c9cace 100644 --- a/lib_com/int_lsp.c +++ b/lib_com/int_lsp.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "rom_com.h" diff --git a/lib_com/interleave_spectrum.c b/lib_com/interleave_spectrum.c index 300295355..6046bf8f2 100644 --- a/lib_com/interleave_spectrum.c +++ b/lib_com/interleave_spectrum.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "rom_com.h" diff --git a/lib_com/interpol.c b/lib_com/interpol.c index 332f34d54..4172c4acf 100644 --- a/lib_com/interpol.c +++ b/lib_com/interpol.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "wmc_auto.h" diff --git a/lib_com/isf_dec_amr_wb.c b/lib_com/isf_dec_amr_wb.c index 49afd071f..d51731d1c 100644 --- a/lib_com/isf_dec_amr_wb.c +++ b/lib_com/isf_dec_amr_wb.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_com/ivas_agc_com.c b/lib_com/ivas_agc_com.c index 3bb4bdea2..e39b8df82 100644 --- a/lib_com/ivas_agc_com.c +++ b/lib_com/ivas_agc_com.c @@ -35,6 +35,9 @@ #include "cnst.h" #include "ivas_cnst.h" #include "ivas_prot.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "wmc_auto.h" #include "prot.h" @@ -110,3 +113,24 @@ void ivas_agc_calcGainParams( return; } +#ifdef DEBUG_AGC +/*-----------------------------------------------------------------------------------------* + * Function ivas_agc_debug_inout() + * + * + *-----------------------------------------------------------------------------------------*/ +int16_t ivas_agc_debug_inout( FILE *inStream, float **in, int16_t n_channels, int16_t frame_len ) +{ + if ( inStream == NULL ) + { + return TRUE; + } + + for ( int16_t i = 0; i < n_channels; i++ ) + { + fwrite( &in[i][0], sizeof( float ), frame_len, inStream ); + } + + return FALSE; +} +#endif diff --git a/lib_com/ivas_arith.c b/lib_com/ivas_arith.c index 98243b0f4..0957d4ae5 100644 --- a/lib_com/ivas_arith.c +++ b/lib_com/ivas_arith.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" #include "prot.h" #include "ivas_prot.h" diff --git a/lib_com/ivas_avq_pos_reorder_com.c b/lib_com/ivas_avq_pos_reorder_com.c index 015a3988f..c75d20533 100644 --- a/lib_com/ivas_avq_pos_reorder_com.c +++ b/lib_com/ivas_avq_pos_reorder_com.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 6a50483e5..efe045e48 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -460,6 +460,9 @@ enum #define STEREO_DFT32MS_OVL_NS 3125000L /* 3.125ms - Overlap for the outer edges of windows on decoder */ #define STEREO_DFT32MS_OVL2_NS 9375000L /* 9.375ms - Overlap for the inner edges of windows on decoder */ #define STEREO_DFT32MS_WIN_CENTER_NS ( int32_t )( ( FRAME_SIZE_NS + STEREO_DFT32MS_OVL_NS ) * 0.5f ) /* 11.5625ms - mid point of the two windows wrt the left edge of overlap */ +#if defined( DEBUG_MODE_DFT ) || defined( DEBUG_STEREO_DFT_NOCORE ) +#define STEREO_DFT32MS_HOP_NS 10000000L /* 10ms */ +#endif #define STEREO_DFT32MS_ZP_NS ( int32_t )( 0.5f * ( STEREO_DFT32MS_N_NS - STEREO_DFT32MS_WIN_CENTER_NS - ( STEREO_DFT32MS_OVL2_NS * 0.5f ) ) ) /* 2 sided zp calculated such that window size is satisfied */ #define STEREO_DFT32MS_OVL_MAX NS2SA( 48000, STEREO_DFT32MS_OVL_NS ) @@ -804,6 +807,10 @@ enum fea_names /* MDCT stereo modes */ #define SMDCT_MS_DECISION 0 +#ifdef DEBUG_FORCE_MDCT_STEREO_MODE +#define SMDCT_FORCE_LR 1 +#define SMDCT_FORCE_MS 2 +#endif #define MAX_SFB 70 /* Maximum number of stereo frequency bands = 64 + 6 for TCX after ACELP */ diff --git a/lib_com/ivas_cov_smooth.c b/lib_com/ivas_cov_smooth.c index f15b21d79..54d0d5f8d 100644 --- a/lib_com/ivas_cov_smooth.c +++ b/lib_com/ivas_cov_smooth.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "ivas_prot.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_entropy_coder_common.c b/lib_com/ivas_entropy_coder_common.c index 7696932cb..a2fa26cad 100644 --- a/lib_com/ivas_entropy_coder_common.c +++ b/lib_com/ivas_entropy_coder_common.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "ivas_prot.h" #include "ivas_rom_com.h" #include "math.h" diff --git a/lib_com/ivas_error.h b/lib_com/ivas_error.h index fbb18cf9f..b61819ea3 100644 --- a/lib_com/ivas_error.h +++ b/lib_com/ivas_error.h @@ -89,6 +89,15 @@ typedef enum IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED, IVAS_ERR_TSM_NOT_ENABLED, IVAS_ERR_FETCH_SIZE_NO_MULTIPLE_OF_5MS, +#ifdef DEBUGGING + IVAS_ERR_INVALID_FORCE_MODE, +#ifdef DEBUG_AGC_ENCODER_CMD_OPTION + IVAS_ERR_INVALID_AGC, +#endif +#ifdef VARIABLE_SPEED_DECODING + IVAS_ERR_VS_FRAME_NEEDED, +#endif +#endif /*----------------------------------------* * input data errors * @@ -210,6 +219,10 @@ static inline const char *ivas_error_to_string( ivas_error error_code ) return "Unexpected NULL pointer"; case IVAS_ERR_METADATA_NOT_EXPECTED: return "Metadata input not expected for current configuration"; +#ifdef DEBUGGING + case IVAS_ERR_INVALID_FORCE_MODE: + return "Invalid force mode"; +#endif case IVAS_ERR_NOT_IMPLEMENTED: return "Not implemented"; case IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT: diff --git a/lib_com/ivas_error_utils.h b/lib_com/ivas_error_utils.h index 204acc40e..b9a6b3f87 100644 --- a/lib_com/ivas_error_utils.h +++ b/lib_com/ivas_error_utils.h @@ -38,6 +38,9 @@ #include "ivas_error.h" +#ifdef DEBUGGING +#include +#endif #ifndef IVAS_ERROR_UTILS_H #define IVAS_ERROR_UTILS_H @@ -63,11 +66,32 @@ * If unexpected values are printed or the macro causes a crash, double check that the * format specifiers are correct. */ +#ifdef DEBUGGING +#define IVAS_ERROR( error_code, ... ) ivas_error_wrapper( error_code, __func__, __FILE__, __LINE__, __VA_ARGS__ ) +#else #define IVAS_ERROR( error_code, ... ) ivas_error_wrapper( error_code ) +#endif +#ifdef DEBUGGING +static inline ivas_error ivas_error_wrapper( const ivas_error error_code, const char *function, const char *file, int32_t line, const char *description, ... ) +{ + fprintf( stderr, "\n%s: ", ivas_error_to_string( error_code ) ); + + va_list args; + va_start( args, description ); + vfprintf( stderr, description, args ); + va_end( args ); + + fprintf( stderr, "\n\nIn function: %s(), %s:%d\n\n", function, file, line ); + // assert( 0 ); + + return error_code; +} +#else static inline ivas_error ivas_error_wrapper( const ivas_error error_code ) { return error_code; } +#endif #endif /* IVAS_ERROR_UTILS_H */ diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index f914d4e75..9772f2e8d 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "ivas_prot.h" diff --git a/lib_com/ivas_filters.c b/lib_com/ivas_filters.c index 8344fe33f..579e9d17c 100644 --- a/lib_com/ivas_filters.c +++ b/lib_com/ivas_filters.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_stat_com.h" diff --git a/lib_com/ivas_ism_com.c b/lib_com/ivas_ism_com.c index d8cb958cc..3ec4656a9 100644 --- a/lib_com/ivas_ism_com.c +++ b/lib_com/ivas_ism_com.c @@ -39,6 +39,9 @@ #include "ivas_prot.h" #include "ivas_stat_com.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -338,6 +341,12 @@ ivas_error ivas_ism_config( else { bits_CoreCoder[ch] += diff; +#ifdef DEBUGGING + if ( bits_CoreCoder[ch] == SID_2k40 / FRAMES_PER_SEC ) + { + printf( "\nWarning: ISM bitbudget equal to SID!\n" ); + } +#endif if ( combined_format_flag ) { @@ -375,6 +384,17 @@ ivas_error ivas_ism_config( bitbudget_to_brate( bits_CoreCoder, total_brate, n_ISms ); } +#ifdef DEBUGGING + if ( nb_bits_metadata != NULL ) + { + int32_t tmpL; + tmpL = sum_l( total_brate, n_ISms ) + bits_side * FRAMES_PER_SEC; + if ( ism_total_brate != tmpL ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "\nError: Mismatch in ISM bit-budget distribution. Exiting!\n" ); + } + } +#endif return error; } diff --git a/lib_com/ivas_lfe_com.c b/lib_com/ivas_lfe_com.c index 6b323a13c..45dcae7c0 100644 --- a/lib_com/ivas_lfe_com.c +++ b/lib_com/ivas_lfe_com.c @@ -33,6 +33,9 @@ #include #include "math.h" #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "ivas_stat_com.h" #include "prot.h" #include "ivas_prot.h" diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index abb4dbd55..17e4b4773 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -39,6 +39,9 @@ #include "ivas_prot.h" #include "ivas_rom_com.h" #include "ivas_stat_dec.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" /*--------------------------------------------------------------- @@ -290,6 +293,9 @@ void ivas_masa_set_coding_config( config->numCodingBands = nbands; config->numTwoDirBands = nTwoDirBands; +#ifdef DEBUGGING + assert( nbands > 0 ); +#endif if ( config->joinedSubframes == TRUE ) { config->mergeRatiosOverSubframes = FALSE; diff --git a/lib_com/ivas_mc_com.c b/lib_com/ivas_mc_com.c index 664dd3a70..966fd21a5 100644 --- a/lib_com/ivas_mc_com.c +++ b/lib_com/ivas_mc_com.c @@ -33,6 +33,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "ivas_prot.h" diff --git a/lib_com/ivas_mc_param_com.c b/lib_com/ivas_mc_param_com.c index e81605270..44efdebe2 100644 --- a/lib_com/ivas_mc_param_com.c +++ b/lib_com/ivas_mc_param_com.c @@ -39,6 +39,9 @@ #include "ivas_prot.h" #include "ivas_stat_com.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -69,6 +72,9 @@ uint16_t ivas_param_mc_get_configuration_index( return cur_idx; } } +#ifdef DEBUGGING + assert( 0 && "No Parametric MC configuration for this bitrate/channel setup!" ); +#endif return PARAM_MC_NUM_CONFIGS; } diff --git a/lib_com/ivas_mcmasa_com.c b/lib_com/ivas_mcmasa_com.c index 341964319..7e81e1fd1 100644 --- a/lib_com/ivas_mcmasa_com.c +++ b/lib_com/ivas_mcmasa_com.c @@ -33,6 +33,9 @@ #include "ivas_cnst.h" #include "ivas_prot.h" #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_com/ivas_mdct_imdct.c b/lib_com/ivas_mdct_imdct.c index 656788717..5dcd850c2 100644 --- a/lib_com/ivas_mdct_imdct.c +++ b/lib_com/ivas_mdct_imdct.c @@ -35,6 +35,9 @@ #include "prot.h" #include "ivas_prot.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "ivas_stat_com.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_mdft_imdft.c b/lib_com/ivas_mdft_imdft.c index 73a732316..0b03f63d9 100644 --- a/lib_com/ivas_mdft_imdft.c +++ b/lib_com/ivas_mdft_imdft.c @@ -34,6 +34,9 @@ #include "options.h" #include "prot.h" #include "ivas_prot.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "ivas_rom_com.h" #include #include "wmc_auto.h" diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index 31874a7b5..7416dad11 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -37,6 +37,9 @@ #include "prot.h" #include "ivas_rom_com.h" #include +#ifdef DEBUGGING +#include "debug.h" +#endif /*--------------------------------------------------------------- * Local constants diff --git a/lib_com/ivas_pca_tools.c b/lib_com/ivas_pca_tools.c index a9dcffd1e..a1f8efd62 100644 --- a/lib_com/ivas_pca_tools.c +++ b/lib_com/ivas_pca_tools.c @@ -34,6 +34,9 @@ #include "options.h" #include "ivas_prot.h" #include "ivas_cnst.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include #include "ivas_rom_com.h" diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 68f3a9de6..6e807ae08 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -688,6 +688,14 @@ void smooth_dft2td_transition( const int16_t output_frame /* i : output frame length */ ); +#ifdef DEBUG_MODE_INFO +void output_debug_mode_info_dec( + Decoder_State **sts, + const int16_t n_channels, + const int16_t output_frame, + float pitch_buf[CPE_CHANNELS][NB_SUBFR16k] +); +#endif /*! r: flag indicating a valid bitrate */ int16_t is_IVAS_bitrate( @@ -1628,6 +1636,9 @@ void stereo_td_itd( ITD_DATA *hITD, /* i/o: ITD data structure */ float input_mem_itd[CPE_CHANNELS][STEREO_DFT_OVL_MAX], /* o : ITD memory (only used in DFT Stereo) */ const int16_t hybrid_itd_flag, /* i : flag for hybrid TD/FD ITD processing */ +#ifdef DEBUG_MODE_DFT + const int16_t itd_mode, /* i : main ITD processing flag */ +#endif const int16_t dft_ovl, /* i : size of DFT overlap */ Encoder_State **sts, /* i/o: Encoder state structure */ const int16_t input_frame, /* i : input frame length */ @@ -4107,6 +4118,9 @@ void ivas_sba_mix_matrix_determiner( /* AGC */ /*! r: AGC enable flag */ int16_t ivas_agc_enc_get_flag( +#ifdef DEBUG_AGC_ENCODER_CMD_OPTION + const int16_t agc_configuration, /* i : AGC configuration from command-line */ +#endif const int16_t nchan_transport /* i : number of transport channels */ ); @@ -5132,11 +5146,27 @@ ivas_error ivas_allocate_binaural_hrtf( const int16_t allocate_init_flag /* i : Memory allocation flag */ ); +#ifdef DEBUGGING +void ivas_binaural_cldfb( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ +); + +void ivas_binaural_cldfb_sf( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t n_samples_to_render, /* i : output frame length per channel */ + const int16_t slot_size, /* i : JBM slot size */ + float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ +); +#endif void ivas_binRenderer( BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle */ const int16_t numTimeSlots, /* i : number of time slots to process */ +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + HEAD_TRACK_DATA_HANDLE hPostRendHeadTrackData, +#endif float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ float Cldfb_ImagBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ @@ -5608,6 +5638,10 @@ void ivas_omasa_enc( void ivas_set_surplus_brate_enc( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +#ifdef DEBUG_MODE_INFO + , + const int16_t *nb_bits_metadata /* i : number of metadata bits */ +#endif ); void ivas_set_surplus_brate_dec( diff --git a/lib_com/ivas_qmetadata_com.c b/lib_com/ivas_qmetadata_com.c index 57adf7c6a..d3b11da6d 100644 --- a/lib_com/ivas_qmetadata_com.c +++ b/lib_com/ivas_qmetadata_com.c @@ -101,6 +101,9 @@ ivas_error ivas_qmetadata_allocate_memory( int16_t j, dir; uint8_t do_realloc; +#ifdef DEBUGGING + assert( hQMetaData != NULL ); +#endif /* Check if we need to reallocate memory or do we need to do the first time allocation. */ if ( hQMetaData->q_direction != NULL ) @@ -337,6 +340,12 @@ ivas_error only_reduce_bits_direction( while ( n < rem ) { max_nb = 0; +#ifdef DEBUGGING + if ( delta > MASA_MIN_BITS_TF ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Not enough bits for MASA param." ); + } +#endif for ( j = 0; j < coding_subbands; j++ ) { bits_dir0 = (int16_t *) q_direction->band_data[j].bits_sph_idx; @@ -574,6 +583,10 @@ void ivas_qmetadata_azimuth_elevation_to_direction_vector( { float radius_length; +#ifdef DEBUGGING + assert( fabsf( el ) <= 90.0f ); + /*assert((0.0f <= az) && (az <= 360.0f)); */ +#endif dv[2] = sinf( el * PI_OVER_180 ); radius_length = cosf( el * PI_OVER_180 ); diff --git a/lib_com/ivas_qspherical_com.c b/lib_com/ivas_qspherical_com.c index e754fb692..874f66d05 100644 --- a/lib_com/ivas_qspherical_com.c +++ b/lib_com/ivas_qspherical_com.c @@ -101,10 +101,18 @@ int16_t ivas_dirac_project_elevation_index( ) { int16_t el_idx_proj; +#ifdef DEBUGGING + assert( ( el_idx >= 0 ) && ( el_idx < el_alph ) ); + assert( el_alph == 2 * ( el_alph >> 1 ) + 1 ); /* el_alph of the form 2 * n_points + 1 */ + assert( el_alph_proj == 2 * ( el_alph_proj >> 1 ) + 1 ); +#endif /* evaluate floor((el_idx / (el_alph - 1)) * (el_alph_proj - 1) + 0.5) using only integer */ el_idx_proj = ( 2 * el_idx * ( el_alph_proj - 1 ) + ( el_alph - 1 ) ) / ( 2 * ( el_alph - 1 ) ); +#ifdef DEBUGGING + assert( ( 0 <= el_idx_proj ) && ( el_idx_proj < el_alph_proj ) ); +#endif return el_idx_proj; } @@ -123,6 +131,9 @@ int16_t ivas_chan_project_elevation_index( ) { int16_t el_idx_proj; +#ifdef DEBUGGING + assert( ( el_idx >= 0 ) && ( el_idx < el_alph ) ); +#endif /* evaluate floor((el_idx / (el_alph - 1)) * (el_alph_proj - 1) + 0.5) using only integer */ if ( el_idx == el_alph - 1 ) @@ -134,6 +145,9 @@ int16_t ivas_chan_project_elevation_index( el_idx_proj = ( 2 * el_idx * el_alph_proj + el_alph ) / ( 2 * el_alph ); } +#ifdef DEBUGGING + assert( ( 0 <= el_idx_proj ) && ( el_idx_proj < el_alph_proj ) ); +#endif return el_idx_proj; } @@ -152,6 +166,9 @@ int16_t ivas_dirac_project_azimuth_index( ) { int16_t az_idx_proj; +#ifdef DEBUGGING + assert( ( az_idx >= 0 ) && ( az_idx < az_alph ) ); +#endif if ( az_alph_proj == 1 ) { @@ -166,6 +183,9 @@ int16_t ivas_dirac_project_azimuth_index( az_idx_proj = 0; } +#ifdef DEBUGGING + assert( ( 0 <= az_idx_proj ) && ( az_idx_proj < az_alph_proj ) ); +#endif return az_idx_proj; } @@ -226,6 +246,9 @@ int16_t quantize_phi( float dd; float delta_phi; +#ifdef DEBUGGING + assert( ( phi >= 0.f ) && ( phi <= 360.f ) ); +#endif delta_phi = 360.0f / (float) n; @@ -387,6 +410,10 @@ int16_t quantize_phi_chan_lbr( { int16_t id_phi; +#ifdef DEBUGGING + assert( ( phi >= -180.f ) && ( phi <= 180.f ) ); + assert( n <= 9 ); +#endif if ( n <= 1 ) { @@ -430,6 +457,9 @@ int16_t quantize_phi_chan_compand( int16_t id_phi; float delta_phi; +#ifdef DEBUGGING + assert( ( phi >= 0.f ) && ( phi <= 360.f ) ); +#endif if ( n <= 1 ) { diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index ad8279712..a054221f9 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "ivas_cnst.h" diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index b13d41548..9a6f9ddf3 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -39,6 +39,9 @@ #include "ivas_cnst.h" #include "stat_com.h" #include "ivas_stat_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif /*----------------------------------------------------------------------------------* diff --git a/lib_com/ivas_sba_config.c b/lib_com/ivas_sba_config.c index fd1bb70fd..778a7bb90 100644 --- a/lib_com/ivas_sba_config.c +++ b/lib_com/ivas_sba_config.c @@ -41,6 +41,9 @@ #include "ivas_prot.h" #include "ivas_stat_com.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_com/ivas_sns_com.c b/lib_com/ivas_sns_com.c index 4708b32c2..da7b37e8c 100644 --- a/lib_com/ivas_sns_com.c +++ b/lib_com/ivas_sns_com.c @@ -39,6 +39,9 @@ #include "ivas_rom_com.h" #include #include +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index e80dbf428..f519ffec1 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -33,6 +33,9 @@ #include #include "math.h" #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "ivas_stat_com.h" #include "prot.h" #include "ivas_prot.h" @@ -1383,6 +1386,27 @@ void ivas_compute_spar_params( { ivas_calc_c_p_coeffs( hSparMd, cov_real, i_ts, mixer_mat, num_ch, ndm, b, dtx_vad, 1, dyn_active_w_flag ); +#ifdef SPAR_HOA_DBG + /* if (b == 0) */ + { + fprintf( stdout, "\n\nUnquantised C, P coeffs -- band %d:\n", b ); + + for ( int16_t ii = 0; ii < num_ch; ii++ ) + { + fprintf( stdout, "%f |", hSparMd->band_coeffs[b].pred_re[ii] ); + + if ( ii < num_ch - ndm ) + { + for ( int16_t jj = 0; jj < ndm - 1; jj++ ) + { + fprintf( stdout, "%f,\t", hSparMd->band_coeffs[b].C_re[ii][jj] ); + } + fprintf( stdout, "| %f", hSparMd->band_coeffs[b].P_re[ii] ); + } + fprintf( stdout, "\n" ); + } + } +#endif } } @@ -1655,6 +1679,29 @@ void ivas_get_spar_md_from_dirac( } } +#ifdef DEBUG_SBA_MD_DUMP + { + static FILE *fid = 0; + int16_t k = 0; + float tmp_buf[10]; + if ( !fid ) + { + fid = fopen( "cov_real_dirac.txt", "wt" ); + } + + for ( i = 0; i < num_ch; i++ ) + { + for ( j = 0; j < num_ch; j++ ) + { + for ( k = start_band; k < end_band; k++ ) + { + fprintf( fid, "%.6f\n", cov_real_dirac[i][j][k] ); + } + } + } + fprintf( fid, "\n" ); + } +#endif active_w = ( dyn_active_w_flag == 1 ) || ( hSpar_md_cfg->active_w == 1 ); diff --git a/lib_com/ivas_spar_com_quant_util.c b/lib_com/ivas_spar_com_quant_util.c index c01f95d1e..977f36e37 100644 --- a/lib_com/ivas_spar_com_quant_util.c +++ b/lib_com/ivas_spar_com_quant_util.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "math.h" #include "prot.h" #include "ivas_prot.h" diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index f34610c11..566abcb44 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -99,6 +99,10 @@ typedef struct stereo_dft_config_data_struct int16_t dmx_active; int16_t band_res; int16_t prm_res; /* Send prm every # DFT frames */ +#ifdef DEBUG_MODE_DFT + int16_t gipd_mode; /* mode : from 0 (off) to 1 (on) */ + int16_t itd_mode; /* mode : from 0 (off) to 1 (on) */ +#endif int16_t res_pred_mode; /* mode : from 0 (off) to 1 (on) */ int16_t res_cod_mode; /* mode : from 0 (off) to 3 */ int16_t hybrid_itd_flag; diff --git a/lib_com/ivas_stereo_dft_com.c b/lib_com/ivas_stereo_dft_com.c index 541f90a12..ae6b772a3 100644 --- a/lib_com/ivas_stereo_dft_com.c +++ b/lib_com/ivas_stereo_dft_com.c @@ -57,7 +57,11 @@ void stereo_dft_config( { hConfig->band_res = STEREO_DFT_BAND_RES_HIGH; hConfig->prm_res = 2; +#ifndef DEBUG_STEREO_DFT_NOSTEREO hConfig->dmx_active = STEREO_DFT_DMX_ACTIVE; +#else + hConfig->dmx_active = 0; +#endif hConfig->ada_wb_res_cod_mode = 0; } @@ -69,6 +73,10 @@ void stereo_dft_config( *bits_frame_nominal = FRAME_NO_DATA; if ( hConfig != NULL ) { +#ifdef DEBUG_MODE_DFT + hConfig->itd_mode = 1; + hConfig->gipd_mode = 1; +#endif hConfig->res_pred_mode = STEREO_DFT_RESPRED_OFF; hConfig->band_res = STEREO_DFT_BAND_RES_LOW; hConfig->res_cod_mode = STEREO_DFT_RES_COD_OFF; @@ -79,6 +87,10 @@ void stereo_dft_config( *bits_frame_nominal = SID_2k40 / FRAMES_PER_SEC; if ( hConfig != NULL ) { +#ifdef DEBUG_MODE_DFT + hConfig->itd_mode = 1; + hConfig->gipd_mode = 1; +#endif hConfig->res_pred_mode = STEREO_DFT_RESPRED_OFF; hConfig->band_res = STEREO_DFT_BAND_RES_LOW; hConfig->res_cod_mode = STEREO_DFT_RES_COD_OFF; @@ -89,6 +101,10 @@ void stereo_dft_config( *bits_frame_nominal = ACELP_9k60 / FRAMES_PER_SEC; if ( hConfig != NULL ) { +#ifdef DEBUG_MODE_DFT + hConfig->itd_mode = 1; + hConfig->gipd_mode = 1; +#endif hConfig->res_pred_mode = STEREO_DFT_RESPRED_ESF; hConfig->band_res = STEREO_DFT_BAND_RES_LOW; hConfig->res_cod_mode = STEREO_DFT_RES_COD_OFF; @@ -99,6 +115,10 @@ void stereo_dft_config( *bits_frame_nominal = ACELP_13k20 / FRAMES_PER_SEC; if ( hConfig != NULL ) { +#ifdef DEBUG_MODE_DFT + hConfig->itd_mode = 1; + hConfig->gipd_mode = 1; +#endif hConfig->res_pred_mode = STEREO_DFT_RESPRED_ESF; hConfig->band_res = STEREO_DFT_BAND_RES_LOW; hConfig->res_cod_mode = STEREO_DFT_RES_COD_OFF; @@ -109,6 +129,10 @@ void stereo_dft_config( *bits_frame_nominal = ACELP_16k40 / FRAMES_PER_SEC; if ( hConfig != NULL ) { +#ifdef DEBUG_MODE_DFT + hConfig->itd_mode = 1; + hConfig->gipd_mode = 1; +#endif hConfig->res_pred_mode = STEREO_DFT_RESPRED_ESF; hConfig->res_cod_mode = STEREO_DFT_RES_COD_OFF; } @@ -119,6 +143,10 @@ void stereo_dft_config( if ( hConfig != NULL ) { hConfig->ada_wb_res_cod_mode = 1; +#ifdef DEBUG_MODE_DFT + hConfig->itd_mode = 1; + hConfig->gipd_mode = 1; +#endif hConfig->res_pred_mode = STEREO_DFT_RESPRED_STEFI; hConfig->res_cod_mode = STEREO_DFT_RES_COD_1kHz; } @@ -128,6 +156,10 @@ void stereo_dft_config( *bits_frame_nominal = ACELP_32k / FRAMES_PER_SEC; if ( hConfig != NULL ) { +#ifdef DEBUG_MODE_DFT + hConfig->itd_mode = 1; + hConfig->gipd_mode = 1; +#endif hConfig->res_pred_mode = STEREO_DFT_RESPRED_STEFI; hConfig->res_cod_mode = STEREO_DFT_RES_COD_1_6kHz; } diff --git a/lib_com/ivas_stereo_eclvq_com.c b/lib_com/ivas_stereo_eclvq_com.c index f3b4e51fe..ff78a66eb 100644 --- a/lib_com/ivas_stereo_eclvq_com.c +++ b/lib_com/ivas_stereo_eclvq_com.c @@ -70,6 +70,9 @@ float ECSQ_dequantize_gain( const int16_t index ) { float global_gain; +#ifdef DEBUGGING + assert( ( index >= 0 ) && ( index <= 126 ) ); +#endif global_gain = powf( 10.0f, (float) index * ECLVQ_INV_GLOBAL_GAIN_FACTOR ); @@ -89,6 +92,10 @@ void ECSQ_dequantize_vector( float *output ) { int16_t i; +#ifdef DEBUGGING + assert( N > 0 ); + assert( global_gain > 0.0f ); +#endif for ( i = 0; i < N; ++i ) { diff --git a/lib_com/ivas_stereo_ica_com.c b/lib_com/ivas_stereo_ica_com.c index 31f9447a5..a68a9a709 100644 --- a/lib_com/ivas_stereo_ica_com.c +++ b/lib_com/ivas_stereo_ica_com.c @@ -37,6 +37,9 @@ #include "ivas_cnst.h" #include "prot.h" #include "ivas_prot.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" #include "rom_com.h" #include "ivas_rom_com.h" diff --git a/lib_com/ivas_stereo_mdct_bands_com.c b/lib_com/ivas_stereo_mdct_bands_com.c index 35524a20a..19a1295f2 100644 --- a/lib_com/ivas_stereo_mdct_bands_com.c +++ b/lib_com/ivas_stereo_mdct_bands_com.c @@ -225,6 +225,9 @@ void stereo_mdct_init_igf_start_band( { int16_t i, bitRateIndex, igfStartLine; const int16_t *swb_offset; +#ifdef DEBUGGING + stbParams->sfbIgfStart = 0; +#endif bitRateIndex = IGF_MapBitRateToIndex( element_brate, bwidth, IVAS_CPE_MDCT, 0 ); swb_offset = &swb_offset_LB_new[bitRateIndex][1]; @@ -241,6 +244,9 @@ void stereo_mdct_init_igf_start_band( stbParams->nBandsStereoCore = stbParams->sfbIgfStart; +#ifdef DEBUGGING + assert( stbParams->sfbIgfStart > 0 ); +#endif return; } diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index 35bfe9046..ce3a5f20f 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "stat_enc.h" #include "rom_com.h" diff --git a/lib_com/ivas_tools.c b/lib_com/ivas_tools.c index 4e28892da..ee7a06ca7 100644 --- a/lib_com/ivas_tools.c +++ b/lib_com/ivas_tools.c @@ -33,6 +33,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "ivas_prot.h" @@ -129,6 +132,12 @@ uint32_t ivas_syn_output( { noClipping += mvr2s( synth[n], synth_loc, output_frame ); +#ifdef DEBUG_MODE_LFE + if ( n == LFE_CHANNEL ) + { + dbgwrite( synth_loc, sizeof( int16_t ), output_frame, 1, "./lfe_out.raw" ); + } +#endif for ( i = 0; i < output_frame; i++ ) { synth_out[i * n_channels + n] = synth_loc[i]; diff --git a/lib_com/ivas_transient_det.c b/lib_com/ivas_transient_det.c index 7e38f8ce6..54c12e916 100644 --- a/lib_com/ivas_transient_det.c +++ b/lib_com/ivas_transient_det.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "math.h" #include "wmc_auto.h" #include "prot.h" diff --git a/lib_com/lag_wind.c b/lib_com/lag_wind.c index fdaa4a7a7..c4c5e803b 100644 --- a/lib_com/lag_wind.c +++ b/lib_com/lag_wind.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "cnst.h" #include "rom_com.h" diff --git a/lib_com/limit_t0.c b/lib_com/limit_t0.c index 1176a8132..0a844bbc5 100644 --- a/lib_com/limit_t0.c +++ b/lib_com/limit_t0.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_com/logqnorm.c b/lib_com/logqnorm.c index 04b822a14..c8185dd5a 100644 --- a/lib_com/logqnorm.c +++ b/lib_com/logqnorm.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_com/low_rate_band_att.c b/lib_com/low_rate_band_att.c index c715e0ac5..393cae5ff 100644 --- a/lib_com/low_rate_band_att.c +++ b/lib_com/low_rate_band_att.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "rom_com.h" #include "prot.h" diff --git a/lib_com/lpc_tools.c b/lib_com/lpc_tools.c index 9c936da11..82c8cddbd 100644 --- a/lib_com/lpc_tools.c +++ b/lib_com/lpc_tools.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_com/lsf_msvq_ma.c b/lib_com/lsf_msvq_ma.c index 940233e4c..3396e9fde 100644 --- a/lib_com/lsf_msvq_ma.c +++ b/lib_com/lsf_msvq_ma.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "rom_com.h" diff --git a/lib_com/lsf_tools.c b/lib_com/lsf_tools.c index eaa94b506..70d1e655c 100644 --- a/lib_com/lsf_tools.c +++ b/lib_com/lsf_tools.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" @@ -182,6 +185,12 @@ void a2isp( { xint -= ylow * ( xhigh - xlow ) / ( ymid ); } +#ifdef DEBUGGING + else if ( ymid == 0 && ylow != 0 ) + { + IVAS_ERROR( IVAS_ERR_INTERNAL, "issue in a2lsp_stab()" ); + } +#endif isp[nf] = xint; /* new root */ nf++; @@ -667,6 +676,12 @@ void a2lsp_stab( { xint -= ylow * ( xhigh - xlow ) / ( ymid ); } +#ifdef DEBUGGING + else if ( ymid == 0 && ylow != 0 ) + { + IVAS_ERROR( IVAS_ERR_INTERNAL, "issue in a2lsp_stab()" ); + } +#endif lsp[nf] = xint; /* new root */ nf++; ip = 1 - ip; /* flag to other polynomial */ @@ -1167,6 +1182,12 @@ ivas_error lsf_allocate( levels1[0] = bits_lvq; } } +#ifdef DEBUGGING + else + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "lsf_allocate(): invalid number of bits in used predictive mode\n" ); + } +#endif } return error; @@ -1244,6 +1265,12 @@ ivas_error find_pred_mode( } } +#ifdef DEBUGGING + if ( *predmode == -1 ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "\nfind_pred_mode(): incorrect coder_type specification: %d\n", coder_type ); + } +#endif return error; } diff --git a/lib_com/lsp_conv_poly.c b/lib_com/lsp_conv_poly.c index ee567b3e8..d43d74fb5 100644 --- a/lib_com/lsp_conv_poly.c +++ b/lib_com/lsp_conv_poly.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_com/modif_fs.c b/lib_com/modif_fs.c index c0f3c56ce..f1ae7c61d 100644 --- a/lib_com/modif_fs.c +++ b/lib_com/modif_fs.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_com/options.h b/lib_com/options.h index b70e22adf..9c9532a28 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -47,12 +47,94 @@ /* ################### Start DEBUGGING switches ########################### */ +#ifndef RELEASE +#define DEBUGGING /* Activate debugging part of the code */ +#endif /*#define WMOPS*/ /* Activate complexity and memory counters */ /*#define WMOPS_PER_FRAME*/ /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */ /*#define WMOPS_DETAIL*/ /* Output detailed complexity printout for every function. Increases runtime overhead */ /*#define WMOPS_WC_FRAME_ANALYSIS*/ /* Output detailed complexity analysis for the worst-case frame */ /*#define MEM_COUNT_DETAILS*/ /* Output detailed memory analysis for the worst-case frame (writes to the file "mem_analysis.csv") */ +#ifdef DEBUGGING + +/*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ +#ifdef DEBUG_MODE_INFO +/*#define DEBUG_MODE_ACELP*/ /* output most important ACELP core parameters to the subdirectory "res/" */ +/*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ +/*#define DEBUG_MODE_DFT*/ /* output most important DFT stereo parameters to the subdirectory "res/" */ +/*#define DEBUG_MODE_TD*/ /* output most important TD stereo parameters to the subdirectory "res/ */ +/*#define DEBUG_MODE_DIRAC*/ /* output most important DIRAC parameters to the subdirectory "res/" */ +/*#define DEBUG_MODE_MDCT*/ /* output most important MDCT parameters to the subdirectory "res/" */ +/*#define DEBUG_MODE_PARAM_MC*/ /* output Parametric MC paramters to the subdirectory "res/" */ +/*#define DEBUG_MODE_PARAM_ISM*/ /* output Parametric ISM paramters to the subdirectory "res/" */ +/*#define DEBUG_MODE_INFO_TWEAK*/ /* enable command line switch to specify subdirectory for debug info output inside "./res/" */ +/*#define DEBUG_MODE_INFO_PLC */ /* define to output PLC related parameters */ +/*#define DEBUG_MODE_INFO_ALLRAD*/ /* define to output generated HOA decoding mtx */ +/*#define DEBUG_MODE_LFE */ /* define to output LFE relevant parameters */ +#endif + +#ifdef DEBUG_MODE_MDCT +#define DEBUG_PLOT_BITS +#endif + +#define ENABLE_BITRATE_VERIFICATION /* Enable bitrate verification - use when playing with bit budget */ +/*#define DEBUG_PLOT*/ +/*#define ALLOW_BYTE_EP*/ /* allow byte fer pattern files and check fer pattern file validity */ +#define WRAP_AS_EIDXOR /* wraps FER file (as in STL_eid-xor.c/softbit.c) */ + +/*#define DEBUG_FORCE_MDCT_STEREO_MODE*/ /* Force stereo mode decision for MDCT stereo: -stereo 3 1 forces L/R coding and -stereo 3 2 forces full M/S coding */ +/*#define DEBUG_STEREO_DFT_NOCORE*/ /* DFT stereo: by-pass core coder at decoder side*/ +/*#define DEBUG_STEREO_DFT_NOSTEREO*/ /* DFT stereo: by-pass stereo processing at encoder and decoder side*/ +/*#define DEBUG_STEREO_DFT_NOQRES*/ +/*#define DEBUG_STEREO_DFT_OUTRESPRED*/ /* output residual prediction signal instead of L/R*/ + +/*DirAC Debug switches*/ +/*#define DEBUG_DISABLE_DIRAC_DELAY_COMP */ /* temporarily disable delay compensation on DirAC encoder */ +/*#define DEBUG_BS_READ_WRITE*/ +/*#define DEBUG_MODE_DIRAC_NOCORE*/ +/*#define DEBUG_MODE_QMETADATA*/ /* output q_metadata parameters */ + +/*MCT Debug switches*/ +/*#define DEBUG_FORCE_MCT_CP*/ /* force MCT Stereo pairs for verification with SPAR */ +#ifdef DEBUG_FORCE_MCT_CP +/*#define DEBUG_SINGLE_CODE_OMNI*/ /* force 3 TC SBA always code W channel separately */ +#endif + +/*PLC Debug switches*/ +/*#define DEBUG_NO_TONAL_PLC*/ +/*#define DEBUG_NO_TD_TCX_PLC */ +/*#define DEBUG_FORCE_TD_TCX_CONCEALMENT*/ +/*#define DEBUG_PLC_INFO*/ + +/*#define DEBUG_EFAP_POLY_TOFILE*/ /* Write poly_select values to file in EFAP, used for generating ROM LUTs */ +/*#define TDREND_HRTF_TABLE_METHODS*/ /* Enable HRTF lookup from tables, for testing & evaluation. Supply file in table format to use. Note that a suitable HR filter lookup method should be written if the filters sample point grids are not in the formats. */ +/*#define TDREND_STANDALONE*/ /* Used when renderer is built in standalone form, without IVAS encoding/decoding (see scripts/object_renderer_standalone). This is just here to ensure this is cleaned out by prepare_instrumentation.sh */ + +/*#define DEBUG_SBA*/ /* debug DIRAC/SPAR in-out */ +#ifdef DEBUG_SBA +/*#define DEBUG_LBR_SBA*/ /* debug low bitrate SBA (SPAR+DirAC) */ +/*#define DEBUG_SBA_AUDIO_DUMP*/ /* SBA intermediate audio wav file dumping */ +/*#define DEBUG_SBA_MD_DUMP*/ /* SBA metadata and variable file dumping */ +/*#define DEBUG_SPAR_MD_TARGET_TUNING*/ /* SPAR MD target bitrate tuning debug code */ +/*#define DEBUG_SPAR_BYPASS_EVS_CODEC*/ /* bypass EVS coding in float precision, emulating EVS encoder/decoder delay */ +/*#define DEBUG_SPAR_WRITE_OUT_COV*/ /* write covariance per frame into a text file for verification */ +/*#define DEBUG_SPAR_DIRAC_WRITE_OUT_PRED_PARS*//* Log SPAR Prediction coefficients to a text file for verification */ +/*#define DEBUG_AGC*/ /* debug SPAR AGC in-out */ +#endif +/*#define SPAR_HOA_DBG*/ /* SPAR HOA debug statements */ +/* #define DEBUG_OSBA */ +/*#define DEBUG_BINAURAL_FILTER_DESIGN*/ /* debugging of Crend binaural filter design */ +/*#define DEBUG_AGC_ENCODER_CMD_OPTION*/ /* Ability to force enable or disable AGC behaviour in DIRAC/SPAR via command line option */ +/*#define DEBUG_JBM_CMD_OPTION*/ /* ability for telling the decoder the frontend fetch size and to not delay compensate for bad frames at the beginning */ +/*#define VARIABLE_SPEED_DECODING*/ /* variable speed decoding employing the JBM functioniality; move to DEBUGGING after build for disabled is fixed */ + +/*Split Rendering Debug switches*/ +/*#define DBG_WAV_WRITER*/ /* add debugging function dbgwrite_wav() */ +/*#define SPLIT_POSE_CORRECTION_DEBUG*/ /* debugging switch for split rendering pose correction */ +/*#define SPLIT_MD_CODING_DEBUG*/ /* debugging switch for split rendering metadata coding */ + +#endif /* DEBUGGING */ /* #################### End DEBUGGING switches ############################ */ diff --git a/lib_com/parameter_bitmaping.c b/lib_com/parameter_bitmaping.c index 720324b1e..d722c8a3b 100644 --- a/lib_com/parameter_bitmaping.c +++ b/lib_com/parameter_bitmaping.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "stat_com.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_com/phase_dispersion.c b/lib_com/phase_dispersion.c index eeecc7aaa..a89b98c15 100644 --- a/lib_com/phase_dispersion.c +++ b/lib_com/phase_dispersion.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "rom_com.h" diff --git a/lib_com/ppp.c b/lib_com/ppp.c index d9e553124..882c94b69 100644 --- a/lib_com/ppp.c +++ b/lib_com/ppp.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "rom_com.h" diff --git a/lib_com/pred_lt4.c b/lib_com/pred_lt4.c index 51a0227ea..832c7d0dc 100644 --- a/lib_com/pred_lt4.c +++ b/lib_com/pred_lt4.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_com/preemph.c b/lib_com/preemph.c index 024ad379c..5e5eb2341 100644 --- a/lib_com/preemph.c +++ b/lib_com/preemph.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "wmc_auto.h" diff --git a/lib_com/prot.h b/lib_com/prot.h index a032dcf7e..55bfccc91 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -41,6 +41,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "typedef.h" #include "stat_enc.h" #include "stat_dec.h" @@ -463,23 +466,53 @@ void delay_signal( const int16_t delay /* i : delay in samples */ ); +#ifdef DEBUG_BS_READ_WRITE +#define push_indice( ... ) push_indice_( __VA_ARGS__, __LINE__, __func__ ) +ivas_error push_indice_( +#else ivas_error push_indice( +#endif BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ int16_t id, /* i : ID of the indice */ uint16_t value, /* i : value of the quantized indice */ int16_t nb_bits /* i : number of bits used to quantize the indice */ +#ifdef DEBUG_BS_READ_WRITE + , + int16_t line, + const char *func +#endif ); +#ifdef DEBUG_BS_READ_WRITE +#define push_next_indice( ... ) push_next_indice_( __VA_ARGS__, __LINE__, __func__ ) +ivas_error push_next_indice_( +#else ivas_error push_next_indice( +#endif BSTR_ENC_HANDLE hBstr, uint16_t value, /* i : value of the quantized indice */ int16_t nb_bits /* i : number of bits used to quantize the indice */ +#ifdef DEBUG_BS_READ_WRITE + , + int16_t line, + const char *func +#endif ); +#ifdef DEBUG_BS_READ_WRITE +#define push_next_bits( ... ) push_next_bits_( __VA_ARGS__, __LINE__, __func__ ) +ivas_error push_next_bits_( +#else ivas_error push_next_bits( +#endif BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const uint16_t bits[], /* i : bit buffer to pack, sequence of single bits */ const int16_t nb_bits /* i : number of bits to pack */ +#ifdef DEBUG_BS_READ_WRITE + , + int16_t line, + const char *func +#endif ); /*! r: maximum number of indices */ @@ -530,9 +563,19 @@ uint16_t delete_indice( ); /*! r: value of the indice */ +#ifdef DEBUG_BS_READ_WRITE +#define get_next_indice( ... ) get_next_indice_( __VA_ARGS__, __LINE__, __func__ ) +uint16_t get_next_indice_( +#else uint16_t get_next_indice( +#endif Decoder_State *st, /* i/o: decoder state structure */ int16_t nb_bits /* i : number of bits that were used to quantize the indice */ +#ifdef DEBUG_BS_READ_WRITE + , + int16_t line, + const char *func +#endif ); /*! r: value of the indice */ @@ -546,10 +589,20 @@ void get_next_indice_tmp( ); /*! r: value of the indice */ +#ifdef DEBUG_BS_READ_WRITE +#define get_indice( ... ) get_indice_( __VA_ARGS__, __LINE__, __func__ ) +uint16_t get_indice_( +#else uint16_t get_indice( +#endif Decoder_State *st, /* i/o: decoder state structure */ int16_t pos, /* i : absolute position in the bitstream */ int16_t nb_bits /* i : number of bits that were used to quantize the indice */ +#ifdef DEBUG_BS_READ_WRITE + , + int16_t line, + const char *func +#endif ); /*! r: value of the indice */ @@ -589,6 +642,14 @@ ivas_error read_indices( int16_t bfi /* i : bad frame indicator */ ); +#ifdef DEBUGGING +/*! r: 1 = reading OK, 0 = problem */ +ivas_error preview_indices( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + uint16_t bit_stream[], /* i : bitstream buffer */ + UWord16 num_bits /* i : number of bits in bitstream */ +); +#endif void ivas_set_bitstream_pointers( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ @@ -1695,6 +1756,9 @@ void hq_configure( int16_t hvq_enc( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const int16_t bwidth, /* i : audio bandwidth */ +#ifdef DEBUGGING + const int16_t idchan, /* i : channel ID */ +#endif const int32_t core_brate, /* i : core bitrate */ const int16_t hvq_bits, /* i : HVQ bit budget */ const int16_t Npeaks, /* i : Number of peaks */ @@ -2060,6 +2124,9 @@ Word32 encode_magnitude_usq_fx( ivas_error tcq_core_LR_enc( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ +#ifdef DEBUGGING + const int16_t idchan, +#endif int32_t inp_vector[], const float coefs_norm[], float coefs_quant[], @@ -2152,6 +2219,9 @@ void io_ini_enc( FILE **f_rate, /* o : bitrate switching profile (0 if N/A) */ FILE **f_bwidth, /* o : bandwidth switching profile (0 if N/A) */ FILE **f_metadata, /* o : metadata files (NULL if N/A) */ +#ifdef DEBUGGING + FILE **f_force, /* o : force switching profile (0 if N/A) */ +#endif FILE **f_rf, /* o : channel aware configuration file */ int16_t *quietMode, /* o : limit printouts */ int16_t *noDelayCmp, /* o : turn off delay compensation */ @@ -2182,6 +2252,13 @@ void read_next_bwidth( int32_t input_Fs /* i : input sampling rate */ ); +#ifdef DEBUGGING +void read_next_force( + int16_t *force, /* i/o: force value (0/1, 0 = speech, 1 = music)*/ + FILE *f_force, /* i : force switching profile (0 if N/A) */ + int32_t *force_profile_cnt /* i/o: counter of frames for force switching profile file */ +); +#endif ivas_error init_encoder( Encoder_State *st, /* i/o: state structure */ @@ -6114,6 +6191,9 @@ void reverse_transient_frame_energies( int16_t peak_vq_enc( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const int16_t bwidth, /* i : audio bandwidth */ +#ifdef DEBUGGING + const int16_t idchan, /* i : channel ID */ +#endif const float *coefs, /* i : Input coefficient vector */ float *coefs_out, /* o : Quantized output vector */ const int32_t core_brate, /* i : Core bitrate */ diff --git a/lib_com/pvq_com.c b/lib_com/pvq_com.c index 7a13fe3f5..2368f8436 100644 --- a/lib_com/pvq_com.c +++ b/lib_com/pvq_com.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_com/range_com.c b/lib_com/range_com.c index 7b3ca8d5e..b01dc7156 100644 --- a/lib_com/range_com.c +++ b/lib_com/range_com.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_com/re8_ppv.c b/lib_com/re8_ppv.c index 75e78ebec..f6c5ab681 100644 --- a/lib_com/re8_ppv.c +++ b/lib_com/re8_ppv.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_com/re8_util.c b/lib_com/re8_util.c index d0737c9d9..d23ae1c0c 100644 --- a/lib_com/re8_util.c +++ b/lib_com/re8_util.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include /* for ldexp() */ #include "cnst.h" #include "rom_com.h" diff --git a/lib_com/realft.c b/lib_com/realft.c index 10a08fbf8..b7a3fef0d 100644 --- a/lib_com/realft.c +++ b/lib_com/realft.c @@ -37,6 +37,9 @@ #include "cnst.h" #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "wmc_auto.h" diff --git a/lib_com/recovernorm.c b/lib_com/recovernorm.c index 5b02843c0..52e9edcd2 100644 --- a/lib_com/recovernorm.c +++ b/lib_com/recovernorm.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "cnst.h" #include "rom_com.h" diff --git a/lib_com/reordvct.c b/lib_com/reordvct.c index 7655220d5..182050bfb 100644 --- a/lib_com/reordvct.c +++ b/lib_com/reordvct.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "wmc_auto.h" diff --git a/lib_com/residu.c b/lib_com/residu.c index a46001c26..e220d81c0 100644 --- a/lib_com/residu.c +++ b/lib_com/residu.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "rom_com.h" diff --git a/lib_com/rom_com.c b/lib_com/rom_com.c index 2282b0b3d..f08f41a1d 100644 --- a/lib_com/rom_com.c +++ b/lib_com/rom_com.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_com/rom_com.h b/lib_com/rom_com.h index f5e2eef1d..ad234e26d 100644 --- a/lib_com/rom_com.h +++ b/lib_com/rom_com.h @@ -39,6 +39,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "stat_enc.h" #include "stat_dec.h" #include "stl.h" diff --git a/lib_com/stab_est.c b/lib_com/stab_est.c index 2b11c7f5f..63466220c 100644 --- a/lib_com/stab_est.c +++ b/lib_com/stab_est.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_com/stat_com.h b/lib_com/stat_com.h index a3e139c18..90203dc47 100644 --- a/lib_com/stat_com.h +++ b/lib_com/stat_com.h @@ -42,6 +42,9 @@ #include "options.h" #include "typedef.h" #include "cnst.h" +#ifdef DEBUGGING +#include "debug.h" +#endif /* Forward declaration of Decoder_State */ struct Decoder_State; diff --git a/lib_com/stat_noise_uv_mod.c b/lib_com/stat_noise_uv_mod.c index b269b3fb0..83c2d321c 100644 --- a/lib_com/stat_noise_uv_mod.c +++ b/lib_com/stat_noise_uv_mod.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "wmc_auto.h" diff --git a/lib_com/swb_bwe_com.c b/lib_com/swb_bwe_com.c index f879d274b..4efbaa735 100644 --- a/lib_com/swb_bwe_com.c +++ b/lib_com/swb_bwe_com.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_com/swb_bwe_com_hr.c b/lib_com/swb_bwe_com_hr.c index 937660f23..fbdcf70b9 100644 --- a/lib_com/swb_bwe_com_hr.c +++ b/lib_com/swb_bwe_com_hr.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "wmc_auto.h" diff --git a/lib_com/swb_bwe_com_lr.c b/lib_com/swb_bwe_com_lr.c index ef3af7ae3..daa7d1673 100644 --- a/lib_com/swb_bwe_com_lr.c +++ b/lib_com/swb_bwe_com_lr.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_com/swb_tbe_com.c b/lib_com/swb_tbe_com.c index fb1382ae4..768078e27 100644 --- a/lib_com/swb_tbe_com.c +++ b/lib_com/swb_tbe_com.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_com/syn_12k8.c b/lib_com/syn_12k8.c index 7d670e1a3..15892f62c 100644 --- a/lib_com/syn_12k8.c +++ b/lib_com/syn_12k8.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_com/syn_filt.c b/lib_com/syn_filt.c index 9b766c1bc..08e687c12 100644 --- a/lib_com/syn_filt.c +++ b/lib_com/syn_filt.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "rom_com.h" diff --git a/lib_com/tcq_position_arith.c b/lib_com/tcq_position_arith.c index a1a2d39ab..306f29a60 100644 --- a/lib_com/tcq_position_arith.c +++ b/lib_com/tcq_position_arith.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "rom_com.h" diff --git a/lib_com/tcx_ltp.c b/lib_com/tcx_ltp.c index b92c0b607..1711ad24b 100644 --- a/lib_com/tcx_ltp.c +++ b/lib_com/tcx_ltp.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "rom_com.h" #include "wmc_auto.h" diff --git a/lib_com/tcx_mdct_window.c b/lib_com/tcx_mdct_window.c index 05a70cdc9..0ef69587a 100644 --- a/lib_com/tcx_mdct_window.c +++ b/lib_com/tcx_mdct_window.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_com/tcx_utils.c b/lib_com/tcx_utils.c index a96c19e11..ec219456b 100644 --- a/lib_com/tcx_utils.c +++ b/lib_com/tcx_utils.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_com/tools.c b/lib_com/tools.c index a30895bac..ecd2fdbfa 100644 --- a/lib_com/tools.c +++ b/lib_com/tools.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "wmc_auto.h" diff --git a/lib_com/trans_direct.c b/lib_com/trans_direct.c index cc63ce39f..964ba36f7 100644 --- a/lib_com/trans_direct.c +++ b/lib_com/trans_direct.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "rom_com.h" diff --git a/lib_com/trans_inv.c b/lib_com/trans_inv.c index 5b4d485af..1eea807b2 100644 --- a/lib_com/trans_inv.c +++ b/lib_com/trans_inv.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_com/weight.c b/lib_com/weight.c index 619857178..6c2e1c291 100644 --- a/lib_com/weight.c +++ b/lib_com/weight.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_com/weight_a.c b/lib_com/weight_a.c index 5b5619eec..96b8014e4 100644 --- a/lib_com/weight_a.c +++ b/lib_com/weight_a.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "wmc_auto.h" diff --git a/lib_com/window.c b/lib_com/window.c index a54cb7c07..093dbd4fc 100644 --- a/lib_com/window.c +++ b/lib_com/window.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #define WMC_TOOL_SKIP diff --git a/lib_com/window_ola.c b/lib_com/window_ola.c index 8d1b98e38..07798af16 100644 --- a/lib_com/window_ola.c +++ b/lib_com/window_ola.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_com/wtda.c b/lib_com/wtda.c index ec7bc080a..3bd839e5a 100644 --- a/lib_com/wtda.c +++ b/lib_com/wtda.c @@ -36,11 +36,17 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "rom_com.h" #include #include "wmc_auto.h" +#ifdef DEBUG_PLOT +#include "deb_out.h" +#endif /*--------------------------------------------------------------------------* * mvr2r_inv() @@ -284,6 +290,9 @@ void wtda( { allsig_r = new_audio + n; allsig_l = new_audio + n - L; +#ifdef DEBUG_PLOT + sendDebout( "tcx_mdct", 2 * L, 1, "mdct_sig", MTV_FLOAT, allsig_l ); +#endif } else { diff --git a/lib_debug/debug.c b/lib_debug/debug.c new file mode 100644 index 000000000..736f35d43 --- /dev/null +++ b/lib_debug/debug.c @@ -0,0 +1,978 @@ +/****************************************************************************************************** + + (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#ifdef DEBUG_MODE_INFO +#ifdef DEBUG_MODE_INFO_TWEAK +#include +#include +#endif +#endif +#endif +#include "cnst.h" +#include +#include +#include +#ifdef _WIN32 +#include +#else +#endif +#ifdef DBG_WAV_WRITER +#include "tinywaveout_c.h" +#endif +#include "wmc_auto.h" + + +/*-------------------------------------------------------------------* + * Global variables used for debugging but not under DEBUGGING flag + *--------------------------------------------------------------------*/ + +#ifdef DEBUGGING +uint16_t g_nPrintedLines = 0; + +int16_t g_verbose = 0; /* global variable for debugging */ +#ifdef DEBUG_MODE_INFO +#ifdef DEBUG_MODE_INFO_TWEAK +char infoFolder[FILENAME_MAX]; +#endif +#endif +#endif + +FILE *DJB_delay = NULL; /* per-frame de-jitter buffer delay dump out file */ + +#ifdef DEBUGGING +int16_t debug_level = 0; +#endif + +/*-------------------------------------------------------------------* + * Read/write I/O tool + *--------------------------------------------------------------------*/ + +#ifdef DEBUGGING +#define N_FILEPTR 500 +#define N_DBGFLAG 100 +#define N_DBGVAL 100 +#define N_TYPES 6 + +static FILE *in_fileptr[N_FILEPTR]; +static FILE *out_fileptr[N_FILEPTR]; +#ifdef DBG_WAV_WRITER +static WAVEFILEOUT *out_wavfileptr[N_FILEPTR]; +#endif +static char *in_filename[N_FILEPTR]; +static char *out_filename[N_FILEPTR]; +#ifdef DBG_WAV_WRITER +static char *out_wavfilename[N_FILEPTR]; +#endif +static int16_t in_count = 0; +static int16_t out_count = 0; +#ifdef DBG_WAV_WRITER +static int16_t out_wav_count = 0; +#endif + +static int16_t flag_count = 0; +static char *flag_name[N_DBGFLAG]; +static int16_t val_count = 0; +static char *val_name[N_DBGVAL]; +static char *val[N_DBGVAL]; + +static char *type_list[N_TYPES] = { "char", "short", "int", "long", "float", "double" }; + +static void setvalue( + const char *value_name, /* i : Value name */ + const char *value /* i : Value as string */ +); + +static int16_t make_dirs( const char *const pathname ); + +/*-------------------------------------------------------------------* + * dbgwrite() + * + * Writes the buffer content to the specified file. If the file is not in the + * debug file list, it is opened before write. + *--------------------------------------------------------------------*/ + +int16_t dbgwrite( + const void *const buffer, /* i : Write buffer */ + const int16_t size, /* i : Element size */ + const int16_t count, /* i : Number of elements */ + const int16_t repeat, /* i : Number of times the elements are repeated */ +#ifdef DEBUG_MODE_INFO_TWEAK + const char *filename /* i : Output file name */ +#else + const char *const filename +#endif +) +{ + int16_t index, i; + void *tmp_buf; + +#ifdef DEBUG_MODE_INFO +#ifdef DEBUG_MODE_INFO_TWEAK + char filename_mod[FILENAME_MAX]; + int16_t textmode = 0; + int16_t x = *(const int16_t *const) buffer; /* currently the textmode is only defined with "short" as input */ + memset( filename_mod, 0, FILENAME_MAX ); + tweakdbgfolder( filename, filename_mod, &textmode ); + if ( filename_mod[0] != 0 ) + { + filename = filename_mod; + } +#endif +#endif + + index = lookup( filename, (const char *const *) out_filename, out_count ); + + if ( index == -1 ) + { + if ( make_dirs( filename ) != 0 ) + { + fprintf( stderr, "dbgwrite: Could not create directory structure for %s. Exiting..\n", filename ); + exit( -1 ); + } + + index = out_count; + out_fileptr[index] = fopen( filename, "wb" ); + out_filename[index] = malloc( sizeof( char ) * ( strlen( filename ) + 1 ) ); + strcpy( out_filename[index], filename ); + out_count++; + } + + if ( out_fileptr[index] != NULL ) + { + tmp_buf = calloc( count * repeat, size ); + if ( buffer != NULL ) + { + for ( i = 0; i < repeat; i++ ) + { + memcpy( (char *) tmp_buf + i * size * count, buffer, size * count ); + } + } +#ifdef DEBUG_MODE_INFO +#ifdef DEBUG_MODE_INFO_TWEAK + if ( 1 == textmode && 2 == size ) + { /* currently the textmode is only defined with "short" as input */ + fprintf( out_fileptr[index], "%d\n", x ); + } + else + { +#endif +#endif + fwrite( tmp_buf, size * count * repeat, 1, out_fileptr[index] ); +#ifdef DEBUG_MODE_INFO +#ifdef DEBUG_MODE_INFO_TWEAK + } +#endif +#endif + free( tmp_buf ); + } + else + { + fprintf( stderr, "dbgwrite: Could not write to file: %s. Exiting..\n", filename ); + exit( -1 ); + } + + return 0; +} + + +/*-------------------------------------------------------------------* + * dbgwrite_mat_repeat() + * + * Writes buffer a buffer containing a column-wise ordered matrix + * to the specified file. If the file is not in the + * debug file list, it is opened before write. + *--------------------------------------------------------------------*/ + +void dbgwrite_mat_repeat( float *buffer, /* i : write buffer */ + int16_t nRow, /* i : matrix size (rows) */ + int16_t mCol, /* i : matrix size (columns) */ + int16_t row_repeat, /* i : number of times rows are repeated */ + int16_t col_repeat, /* i : number of times columns are repeated */ +#ifdef DEBUG_MODE_INFO_TWEAK + const char *filename /* i : Output file name */ +#else + const char *const filename +#endif +) +{ + float *copy_buffer = calloc( nRow * row_repeat * mCol * col_repeat, sizeof( float ) ); + int16_t r, c, rr, cc; + float *cp = ©_buffer[0]; + float *colp; + for ( c = 0; c < mCol; c++ ) + { + for ( cc = 0; cc < col_repeat; cc++ ) + { + colp = buffer + c * nRow; + for ( r = 0; r < nRow; r++ ) + { + for ( rr = 0; rr < row_repeat; rr++ ) + { + *( cp++ ) = *colp; + } + colp++; + } + } + } + + dbgwrite( copy_buffer, sizeof( float ), nRow * row_repeat * mCol * col_repeat, 1, filename ); + free( copy_buffer ); +} + + +/*-------------------------------------------------------------------* + * dbgappend() + * + * Appends the buffer content to the specified file. If the file is not in the + * debug file list, it is opened before first write. + *--------------------------------------------------------------------*/ + +int16_t dbgappend( + const void *const buffer, /* i : Append buffer */ + const int16_t size, /* i : Element size */ + const int16_t count, /* i : Number of elements */ + const int16_t repeat, /* i : Number of times the elements are repeated */ +#ifdef DEBUG_MODE_INFO_TWEAK + const char *filename /* i : Output file name */ +#else + const char *const filename +#endif +) +{ + int16_t index, i; + +#ifdef DEBUG_MODE_INFO +#ifdef DEBUG_MODE_INFO_TWEAK + char filename_mod[FILENAME_MAX]; + int16_t textmode = 0; /* textmode is only implemented in dbgwrite() currently */ + memset( filename_mod, 0, FILENAME_MAX ); + tweakdbgfolder( filename, filename_mod, &textmode ); + if ( filename_mod[0] != 0 ) + { + filename = filename_mod; + } +#endif +#endif + index = lookup( filename, (const char *const *) out_filename, out_count ); + + if ( index == -1 ) + { + if ( make_dirs( filename ) != 0 ) + { + fprintf( stderr, "dbgwrite: Could not create directory structure for %s. Exiting..\n", filename ); + exit( -1 ); + } + + index = out_count; + out_fileptr[index] = fopen( filename, "ab" ); + out_filename[index] = malloc( sizeof( char ) * ( strlen( filename ) + 1 ) ); + strcpy( out_filename[index], filename ); + out_count++; + } + + if ( out_fileptr[index] != NULL ) + { + for ( i = 0; i < repeat; i++ ) + { + fwrite( buffer, size, count, out_fileptr[index] ); + } + } + else + { + fprintf( stderr, "dbgappend: Could not write to file: %s. Exiting..\n", filename ); + exit( -1 ); + } + + return 0; +} + +/*-------------------------------------------------------------------* + * dbgread() + * + * Reads data from the specified file. If the file is not open, it will be + * opened. + *--------------------------------------------------------------------*/ + +int16_t dbgread( + void *const buffer, /* o : Read buffer */ + const int16_t size, /* i : Element size */ + const int16_t count, /* i : Number of elements */ +#ifdef DEBUG_MODE_INFO_TWEAK + const char *filename /* i : Input file name */ +#else + const char *const filename +#endif +) +{ + int16_t index; + +#ifdef DEBUG_MODE_INFO +#ifdef DEBUG_MODE_INFO_TWEAK + char filename_mod[FILENAME_MAX]; + int16_t textmode = 0; /* textmode is only implemented in dbgwrite() currently */ + memset( filename_mod, 0, FILENAME_MAX ); + tweakdbgfolder( filename, filename_mod, &textmode ); + if ( filename_mod[0] != 0 ) + { + filename = filename_mod; + } +#endif +#endif + + index = lookup( filename, (const char *const *) in_filename, in_count ); + + if ( index == -1 ) + { + index = in_count; + in_fileptr[index] = fopen( filename, "rb" ); + in_filename[index] = malloc( sizeof( char ) * ( strlen( filename ) + 1 ) ); + strcpy( in_filename[index], filename ); + in_count++; + } + + if ( in_fileptr[index] != NULL ) + { + fread( buffer, size, count, in_fileptr[index] ); + } + else + { + fprintf( stderr, "dbgread: Could not read from file: %s. Exiting..\n", filename ); + exit( -1 ); + } + + return 0; +} + +/*-------------------------------------------------------------------* + * dbgclose() + * + * Closes opened files and frees allocated memory + *--------------------------------------------------------------------*/ + +void dbgclose( void ) +{ + int16_t i; + + for ( i = 0; i < in_count; i++ ) + { + fclose( in_fileptr[i] ); + free( in_filename[i] ); + } + + for ( i = 0; i < out_count; i++ ) + { + fclose( out_fileptr[i] ); + free( out_filename[i] ); + } + +#ifdef DBG_WAV_WRITER + for ( i = 0; i < out_wav_count; i++ ) + { + CloseWav( out_wavfileptr[i] ); + free( out_wavfilename[i] ); + } +#endif + for ( i = 0; i < snr_count; i++ ) + { + free( snr_name[i] ); + } + + for ( i = 0; i < flag_count; i++ ) + { + free( flag_name[i] ); + } + + for ( i = 0; i < val_count; i++ ) + { + free( val_name[i] ); + free( val[i] ); + } + + return; +} + + +/*-------------------------------------------------------------------* + * dbgflag() + * + * Checks if a debug flag is set. The flag is identified with a string. + *--------------------------------------------------------------------*/ + +int16_t dbgflag( + const char *flagname /* i : Flag name */ +) +{ + int16_t result; + + result = lookup( flagname, (const char *const *) flag_name, flag_count ); + + return ( result != -1 ); +} + +/*-------------------------------------------------------------------* + * setflag() + * + * Sets the flag with the specified string + *--------------------------------------------------------------------*/ + +void setflag( + const char *flagname /* i : Flag name */ +) +{ + int16_t result; + + result = lookup( flagname, (const char *const *) flag_name, flag_count ); + + if ( result == -1 ) + { + flag_name[flag_count] = malloc( sizeof( char ) * ( strlen( flagname ) + 1 ) ); + strcpy( flag_name[flag_count], flagname ); + flag_count++; + } + + return; +} + +/*----------------------------------------------------------------------------* + * dbgargs() + * + * N.B. Should be run before existing command line interpretation + * + * Command line interpreter for debug arguments. Removes the debug + * arguments after interpretation so that existing command line interpretation + * may be run afterwards. + * + * Arguments: + * -D flag_name Sets the debug flag labelled flag_name. + * The function dbgflag("flag_name") will return 1. + * + * -V val_name val Sets the debug value labelled val_name to val. + * dbgvalue("type","val_name",&value) will retrieve the value + * + *-----------------------------------------------------------------------------*/ + +/*! r: No. debug arguments */ +int16_t dbgargs( + int32_t *argc, /* i/o: No. input arguments / No. arguments without dbg arguments */ + char *argv[] /* i/o: Input arguments / Input arguments without dbg arguments */ +) +{ + int16_t i, j, dbgargs; + + i = 0; + dbgargs = 0; + while ( i < *argc ) + { + if ( strcmp( argv[i], "-D" ) == 0 ) + { + j = i; + dbgargs++; + i++; + setflag( argv[i] ); + for ( ; j < *argc - 2; j++ ) + { + argv[j] = argv[j + 2]; + } + *argc -= 2; + i -= 2; + } + + if ( strcmp( argv[i], "-V" ) == 0 ) + { + j = i; + dbgargs++; + i++; + setvalue( argv[i], argv[i + 1] ); + for ( ; j < *argc - 3; j++ ) + { + argv[j] = argv[j + 3]; + } + *argc -= 3; + i -= 3; + } + i++; + } + + return dbgargs; +} + +/*-------------------------------------------------------------------* + * dbgvalue() + * + * Lookup a debug value + * + * Allowed typestr values: + * "char","short","int","long","float","double" + * + * If the value is not set, the output value is not assigned + * + *-------------------------------------------------------------------*/ + +/*! r: Returns 1 if value is assigned, otherwise 0 */ +int16_t dbgvalue( + const char *typestr, /* i : Type as string:"int","char",... */ + const char *value_name, /* i : Value tag name given on command line */ + ... /* o : Output variable, type: pointer to "typestr" */ +) +{ + int16_t index; + char *value; + int16_t assigned; + char *c; + int16_t *sh; + int *i; + int32_t *l; + float *f; + double *d; + va_list ap; + va_start( ap, value_name ); + + index = lookup( value_name, (const char *const *) val_name, val_count ); + + if ( index != -1 ) + { + value = val[index]; + index = lookup( typestr, (const char *const *) type_list, N_TYPES ); + switch ( index ) + { + case 0: + c = va_arg( ap, char * ); + sscanf( value, "%c", c ); + break; + case 1: + sh = va_arg( ap, int16_t * ); + sscanf( value, "%hi", sh ); + break; + case 2: + i = va_arg( ap, int * ); + sscanf( value, "%i", i ); + break; + case 3: + l = va_arg( ap, int32_t * ); + sscanf( value, "%i", l ); + break; + case 4: + f = va_arg( ap, float * ); + sscanf( value, "%f", f ); + break; + case 5: + d = va_arg( ap, double * ); + sscanf( value, "%lf", d ); + break; + default: + fprintf( stderr, "dbgvalue::Unsupported type string %s. Exiting...\n", typestr ); + exit( -1 ); + } + assigned = 1; + } + else + { + assigned = 0; + } + + va_end( ap ); + + return assigned; +} + +/*-------------------------------------------------------------------* + * lookup() + * + * Returns the index of the given string, or -1 if not found + *--------------------------------------------------------------------*/ + +/*! r: Index of string, -1 if not found */ +int16_t lookup( + const char *const str, /* i : String to lookup */ + const char *const *const list, /* i : List of strings */ + const int16_t n_elem /* i : Number of elements */ +) +{ + int16_t i, result; + + result = -1; + i = 0; + while ( i < n_elem && result == -1 ) + { + if ( strcmp( str, list[i] ) == 0 ) + { + result = i; + } + i++; + } + + return result; +} + +/*-------------------------------------------------------------------* + * setvalue() + * + * Sets the debug name value pair + *--------------------------------------------------------------------*/ + +static void setvalue( + const char *value_name, /* i : Value name */ + const char *value ) /* i : Value as string */ + +{ + int16_t result; + + result = lookup( value_name, (const char *const *) val_name, val_count ); + + if ( result == -1 ) + { + val_name[val_count] = malloc( sizeof( char ) * ( strlen( value_name ) + 1 ) ); + strcpy( val_name[val_count], value_name ); + val[val_count] = malloc( sizeof( char ) * ( strlen( value ) + 1 ) ); + strcpy( val[val_count], value ); + val_count++; + fprintf( stdout, "\nDebug value set: %s = %s\n", value_name, value ); + } + else + { + fprintf( stdout, "\n*** Value %s already set: %s\n", value_name, val[result] ); + } + + return; +} + +#ifdef DEBUG_MODE_INFO +#ifdef DEBUG_MODE_INFO_TWEAK +/*-------------------------------------------------------------------* + * tweakdbgfolder() + * + * in: filename + * out: filename_mod + * + * returns modified path to debug files for reading and writing functions. + * creates in "./res" if given on command line + * with switch -info . + * + *--------------------------------------------------------------------*/ + +int16_t tweakdbgfolder( const char *filename, char *filename_mod, int16_t *textmode ) +{ + int16_t i, j; + char *p_infoFolder = infoFolder; + char *p_filename_mod = filename_mod; + int16_t n_prefix = 0; + char *suffix; + + /* if debug folder name given on command line, write debug info to sub folder */ + if ( infoFolder[0] != 0 ) + { + if ( filename[0] == '.' ) + { + n_prefix = 5; + } + else if ( filename[0] == 'r' ) + { + n_prefix = 3; + } + else + { + fprintf( stderr, "tweakdbgfolder: Unexpected debug folder. Exiting..\n" ); + exit( -1 ); + } + for ( i = 0; i <= n_prefix; i++ ) + { + p_filename_mod[i] = filename[i]; + } + j = i; + while ( *p_infoFolder != 0 ) + { + p_filename_mod[i] = *p_infoFolder; + i++; + p_infoFolder++; + } + p_filename_mod[i] = '/'; + i++; + + while ( filename[j] != 0 ) + { + p_filename_mod[i] = filename[j]; + i++; + j++; + } + /* detect textmode, only working with given debug folder name, otherwise no counter available for length of filename */ + suffix = &p_filename_mod[i - 4]; + if ( strncmp( suffix, ".txt", 4 ) == 0 ) + { + *textmode = 1; + } + else + { + *textmode = 0; + } + } + + + return 0; +} +#endif +#endif + + +#ifdef DEBUG_MODE_INFO +/*-------------------------------------------------------------------* + * fname() + * + * returns file name (string) that identifies - parameter/signal to be outputted + - channel ID (0 or 1) + - element ID (0, 1, etc.) + *--------------------------------------------------------------------*/ + +char debug_dir[6] = "res/"; + +char tmp_fname[FILENAME_MAX]; + +char *fname( + char *dir, + char *file, + const int16_t n, + const int16_t id, + const int16_t enc_dec ) +{ + char idd[5] = ".idX"; + idd[3] = (char) ( id + '0' ); + + strcpy( tmp_fname, dir ); + strcat( tmp_fname, file ); + + if ( enc_dec == DEC ) + strcat( tmp_fname, ".dec" ); + if ( id > 0 ) + strcat( tmp_fname, idd ); + if ( n > 0 ) + strcat( tmp_fname, ".ch2" ); + + return tmp_fname; +} +#endif + + +/*-------------------------------------------------------------------* + * make_dirs() + * + * extract path(s) form the pathname and create them if not existing + *--------------------------------------------------------------------*/ + +int16_t make_dirs( const char *const pathname ) +{ + const char *p; + char *temp; + char sep = 0; +#ifdef _WIN32 + struct _stat s = { 0 }; +#else + struct stat s = { 0 }; +#endif + /* find path separator */ + if ( strchr( pathname, '\\' ) != NULL ) + { + sep = '\\'; + } + else if ( strchr( pathname, '/' ) != NULL ) + { + sep = '/'; + } + + if ( sep != 0 ) + { + temp = calloc( 1, strlen( pathname ) + 1 ); + p = pathname; + while ( ( p = strchr( p, sep ) ) != NULL ) + { + /* skip consecutive separators and '.', '..' symbols */ + if ( p != pathname && ( *( p - 1 ) == sep || *( p - 1 ) == '.' ) ) + { + p++; + continue; + } + + /* put the path up to this point into a temp dir */ + memcpy( temp, pathname, p - pathname ); + temp[p - pathname] = '\0'; + p++; + + /* check if path exists and create it with mkdir() if not */ +#ifdef _WIN32 + if ( _stat( temp, &s ) == -1 ) + { + if ( _mkdir( temp ) != 0 ) + { + if ( errno != 0 ) + { + return 1; + } + } + } +#else + if ( stat( temp, &s ) == -1 ) + { + if ( mkdir( temp, 0755 ) != 0 ) + { + if ( errno != 0 ) + { + return 1; + } + } + } +#endif + } + + free( temp ); + } + + return 0; +} + +#ifdef DBG_WAV_WRITER +int16_t dbgwrite_wav( + const float *buffer[], /* i : Write buffer */ + const int16_t count_per_ch, /* i : Number of elements */ + const char *const filename, + int32_t fs, + int16_t num_chs ) +{ + int16_t index, i; + int16_t *tmp_buf; + + index = lookup( filename, (const char *const *) out_wavfilename, out_wav_count ); + + if ( index == -1 ) + { + if ( make_dirs( filename ) != 0 ) + { + fprintf( stderr, "dbgwrite: Could not create directory structure for %s. Exiting..\n", filename ); + exit( -1 ); + } + + index = out_wav_count; + out_wavfileptr[index] = CreateWav( (const char *) filename, fs, num_chs, 16 /* const uint32_t writeWaveExt */ ); + out_wavfilename[index] = malloc( sizeof( char ) * ( strlen( filename ) + 1 ) ); + strcpy( out_wavfilename[index], filename ); + out_wav_count++; + } + + if ( out_wavfileptr[index] != NULL ) + { + int16_t j, k; + float tmp; + tmp_buf = (int16_t *) calloc( count_per_ch * num_chs, sizeof( int16_t ) ); + k = 0; + for ( j = 0; j < count_per_ch; j++ ) + { + for ( i = 0; i < num_chs; i++, k++ ) + { + tmp = roundf( buffer[i][j] ); + tmp_buf[k] = ( tmp > MAX16B_FLT ) ? MAX16B : ( tmp < MIN16B_FLT ) ? MIN16B + : (short) tmp; + } + } + WriteWavShort( out_wavfileptr[index], tmp_buf, count_per_ch * num_chs ); + free( tmp_buf ); + } + else + { + fprintf( stderr, "dbgwrite_wav: Could not write to file: %s. Exiting..\n", filename ); + exit( -1 ); + } + + return 0; +} + + +int16_t dbgwrite_txt( + const float *buffer, /* i : Write buffer */ + const int16_t count, /* i : Number of elements */ + const char *const filename, + const char *const msg_opt ) +{ + int16_t index, i; + + index = lookup( filename, (const char *const *) out_filename, out_count ); + + if ( index == -1 ) + { + if ( make_dirs( filename ) != 0 ) + { + fprintf( stderr, "dbgwrite: Could not create directory structure for %s. Exiting..\n", filename ); + exit( -1 ); + } + + index = out_count; + out_fileptr[index] = fopen( filename, "w" ); + out_filename[index] = malloc( sizeof( char ) * ( strlen( filename ) + 1 ) ); + strcpy( out_filename[index], filename ); + out_count++; + } + + if ( out_fileptr[index] != NULL ) + { + if ( buffer != NULL ) + { + if ( msg_opt == NULL ) + { + for ( i = 0; i < count; i++ ) + { + fprintf( out_fileptr[index], "%f\n", buffer[i] ); + } + } + else + { + for ( i = 0; i < count; i++ ) + { + fprintf( out_fileptr[index], "%s %f\n", msg_opt, buffer[i] ); + } + } + } + } + else + { + fprintf( stderr, "dbgwrite_txt: Could not write to file: %s. Exiting..\n", filename ); + exit( -1 ); + } + + return 0; +} +#endif +#endif /* DEBUGGING */ diff --git a/lib_debug/debug.h b/lib_debug/debug.h new file mode 100644 index 000000000..ac2ac689b --- /dev/null +++ b/lib_debug/debug.h @@ -0,0 +1,257 @@ +/****************************************************************************************************** + + (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#ifndef DEBUG_H +#define DEBUG_H + +#include "options.h" +#include +#include +#ifdef DEBUG_SBA +#include "sba_debug.h" +#endif + +/*------------------------------------------------------------------------------------------* + * Global variables used for debugging + *------------------------------------------------------------------------------------------*/ + +#ifdef DEBUGGING +extern int32_t frame; +#endif + +#ifdef DEBUGGING +extern uint16_t g_nPrintedLines; +extern int16_t g_verbose; +#endif + +#ifdef DEBUGGING +extern int16_t debug_level; +#define DEBUG_LINE( level ) if ( ( level ) <= debug_level ) +#else +#define DEBUG_LINE( level ) if ( 0 ) +#endif + +#ifdef DEBUG_MODE_INFO +extern char tmp_fname[]; +extern char debug_dir[6]; +char *fname( char *dir, char *file, const int16_t n, const int16_t id, const int16_t enc_dec ); +#endif + +/*------------------------------------------------------------------------------------------* + * Read/write I/O tool + *------------------------------------------------------------------------------------------*/ + +#ifdef DEBUGGING + +int16_t lookup( + const char *const str, + const char *const *const list, + const int16_t n_elem ); + +#ifdef DEBUG_MODE_INFO +#ifdef DEBUG_MODE_INFO_TWEAK +int16_t tweakdbgfolder( + const char *filename, + char *filename_mod, + int16_t *textmode ); +#endif +#endif + +int16_t dbgwrite( + const void *const buffer, + const int16_t size, + const int16_t count, + const int16_t repeat, +#ifdef DEBUG_MODE_INFO_TWEAK + const char *filename +#else + const char *const filename +#endif +); + +#ifdef DBG_WAV_WRITER +int16_t dbgwrite_wav( + const float *buffer[], /* i : Write buffer */ + const int16_t count_per_ch, /* i : Number of elements */ + const char *const filename, + int32_t fs, + int16_t num_chs ); +int16_t dbgwrite_txt( + const float *buffer, /* i : Write buffer */ + const int16_t count, /* i : Number of elements */ + const char *const filename, + const char *const msg_opt ); +#endif +void dbgwrite_mat_repeat( + float *buffer, /* i : write buffer */ + int16_t nRow, /* i : matrix size (rows) */ + int16_t mCol, /* i : matrix size (columns) */ + int16_t row_repeat, /* i : number of times rows are repeated */ + int16_t col_repeat, /* i : number of times columns are repeated */ +#ifdef DEBUG_MODE_INFO_TWEAK + const char *filename /* i : Output file name */ +#else + const char *const filename +#endif +); + +int16_t dbgappend( + const void *const buffer, + const int16_t size, + const int16_t count, + const int16_t repeat, +#ifdef DEBUG_MODE_INFO_TWEAK + const char *filename +#else + const char *const filename +#endif +); + +int16_t dbgread( + void *const buffer, + const int16_t size, + const int16_t count, +#ifdef DEBUG_MODE_INFO_TWEAK + const char *filename +#else + const char *const filename +#endif +); + +void dbgclose( void ); + +int16_t dbgflag( + const char *flagname ); + +void setflag( + const char *flagname ); + +int16_t dbgargs( + int32_t *argc, + char *argv[] ); + +int16_t dbgvalue( + const char *typestr, + const char *value_name, + ... ); + +extern FILE *DJB_delay; + +extern FILE *FEC_pattern; + +#endif /* DEBUGGING */ + +/*------------------------------------------------------------------------------------------* + * SNR measurement tool + *------------------------------------------------------------------------------------------*/ + +#ifdef DEBUGGING + +extern int16_t snr_count; +extern char *snr_name[]; + +void snr( + const float *const signal, + const float *const noise, + const int16_t length, + const char *const name ); + +void snr_diff( + const float *const clean, + const float *const degraded, + const int16_t length, + const int16_t delay, + const char *const name ); + +void snr_celp( + const int16_t L_frame, + const int16_t L_subfr, + const float gamma, + const float tilt_fac, + const int16_t vad_flag, + const int16_t coder_type, + const float *input, + const float *output, + const float *A, + const int16_t idchan, + const char *name ); + +void print_snr( void ); + +#else + +#define print_snr( void ) + +#endif + +/*------------------------------------------------------------------------------------------* + * SD analysis tool + *------------------------------------------------------------------------------------------*/ + +#ifdef DEBUGGING + +/*! r: SD in a given frequency range */ +float sd_range( + const float lsf[], /* i : vector of unquantized LSF values */ + const float lsf_q[], /* i : vector of quantized LSF values */ + const int16_t order, /* i : dimension of the vectors */ + const int32_t fs, /* i : sampling frequency */ + const float min_freq, /* i : minimum frequency of interest */ + const float max_freq, /* i : maximum frequency of interest */ + const char *const name, /* i : string for SD entry in the global table */ + const int16_t Opt_AMR_WB /* i : flag indicating AMR-WB IO mode */ +); + +/*! r: SD respecting critical bands */ +float sd_crit( + const float lsf[], /* i : vector of unquantized LSF values */ + const float lsf_q[], /* i : vector of quantized LSF values */ + const int16_t order, /* i : dimension of the vectors */ + const int32_t fs, /* i : sampling frequency */ + const float min_freq, /* i : minimal frequency */ + const float max_freq, /* i : maximal frequency */ + int16_t *min_band, /* o : minimal critical band */ + int16_t *max_band, /* o : maximal critical band */ + float sd_bands[], /* i/o: SD in critical bands */ + const char *const name, /* i : string for SD entry in the global table */ + const int16_t Opt_AMR_WB /* i : flag indicating AMR-WB IO mode */ +); + +void print_sd( void ); + +#else + +#define print_sd( void ) + +#endif + +#endif /* DEBUG_H */ diff --git a/lib_debug/sba_debug.c b/lib_debug/sba_debug.c new file mode 100644 index 000000000..de4b549aa --- /dev/null +++ b/lib_debug/sba_debug.c @@ -0,0 +1,431 @@ +/****************************************************************************************************** + + (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include +#include +#include +#include +#include +#include "options.h" +#include "ivas_cnst.h" +#include "sba_debug.h" +#include +#include "wmc_auto.h" +#ifdef DEBUG_SBA +#include +#include "tinywaveout_c.h" + +/*-------------------------------------------------------------------* + * Global variables used for debugging but not under DEBUGGING flag + *--------------------------------------------------------------------*/ + +#define MAX_IN_FILE_LEN ( 1000 ) +#define MAX_PLUG_IN_FILE_LEN ( MAX_IN_FILE_LEN ) +#define MAX_DEBUG_TAG_LEN ( 50 ) +#define NUM_DEBUG_FILES ( 5 ) +#define MAX_TAG_LEN ( 200 ) + +WAVEFILEOUT *spar_foa_enc_wav[3]; +WAVEFILEOUT *spar_foa_dec_wav[NUM_DEBUG_FILES]; +float max_diff = 0; +int32_t dbg_frm_num; +int32_t dbg_band; +int32_t dbg_type; +int32_t iter_max = 0; +FILE *fFb_pcm = NULL; +int8_t file_names[NUM_DEBUG_FILES][MAX_TAG_LEN + MAX_DEBUG_TAG_LEN]; + + +#ifdef DEBUG_AGC +FILE *agcOut = NULL; /* temporary AGC bitstream */ +#endif + +/*-----------------------------------------------------------------------------------------* + * Function description + * cstrcpy() - Custom implementation of strcpy + * + * Inputs: + * const char* _Source -> Source buffer + * _SizeInBytes -> Destination buffer size in bytes + * + * Outputs: + * char* _Destination -> Destination buffer + *-----------------------------------------------------------------------------------------*/ + +static void cstrcpy( char *_Destination, size_t _SizeInBytes, const char *_Source ) +{ + size_t SourceSizeInBytes = strlen( _Source ); + if ( _SizeInBytes > SourceSizeInBytes ) + { + strcpy( _Destination, _Source ); + } + else + { + assert( 0 ); + } + + return; +} + + +/*-----------------------------------------------------------------------------------------* + * Function description + * cstrcat() - Custom implementation of strcat + * + * Inputs: + * const char* _Source -> Source buffer + * _SizeInBytes -> Destination buffer size in bytes + * + * Outputs: + * char* _Destination -> Destination buffer + *-----------------------------------------------------------------------------------------*/ + +static void cstrcat( char *_Destination, size_t _SizeInBytes, const char *_Source ) +{ + size_t SourceSizeInBytes = strlen( _Source ); + size_t DestSizeInBytes = _SizeInBytes - strlen( _Destination ); + if ( DestSizeInBytes > SourceSizeInBytes ) + { + strcat( _Destination, _Source ); + } + else + { + assert( 0 ); + } + + return; +} + + +#ifdef DEBUG_AGC +void ivas_close_agc_debug_files( void ) +{ + if ( agcOut != NULL ) + { + fclose( agcOut ); + agcOut = NULL; + } + + return; +} + +void ivas_open_agc_debug_files( int16_t agc ) +{ + /* Temporary AGC file */ + if ( agc > 0 ) + { + char agcFilename[50] = "agcBitstream.bin"; + if ( ( agcOut = fopen( agcFilename, "wb" ) ) == NULL ) + { + fprintf( stderr, "Error: Gain Control bitstream file %s could not be opened\n\n", agcFilename ); + exit( -1 ); + } + fprintf( stdout, "Temporary gain control bitstream file %s is opened\n", agcFilename ); + } + + return; +} +#endif + +static void UpdateWave( + const uint32_t sampleRate, + const uint32_t numChannels, + const uint32_t bps, + WAVEFILEOUT *spar_wav ) +{ + uint32_t blockAlignment = 0; + uint16_t writeValue16; + uint32_t writeValue32; + + writeValue16 = LittleEndian16( (int16_t) numChannels ); + /*Fseek to number of channel writing position*/ + fseek( spar_wav->theFile, 22, SEEK_SET ); + fwrite( &writeValue16, sizeof( writeValue16 ), 1, spar_wav->theFile ); + blockAlignment = numChannels * ( bps >> 3 ); + writeValue16 = LittleEndian16( (int16_t) blockAlignment ); + fseek( spar_wav->theFile, 4, SEEK_CUR ); + writeValue32 = LittleEndian32( sampleRate * blockAlignment ); + fwrite( &writeValue32, sizeof( writeValue32 ), 1, spar_wav->theFile ); + fwrite( &writeValue16, sizeof( writeValue16 ), 1, spar_wav->theFile ); + + return; +} + + +void ivas_spar_dump_signal_wav( + const int16_t input_frame, + float **ppPcm, + float pcm_array[IVAS_SPAR_MAX_CH][L_FRAME48k], + const int16_t no_channel, + WAVEFILEOUT *wave_file, + char *location ) +{ + float tmp_value; + int16_t pcm_value, i, j, k; + int16_t debug_tmp[IVAS_SPAR_MAX_CH * L_FRAME48k * 2]; + + k = 0; + int16_t Clipping = 0; + float largest_value = 0; + float db_value = 0; + + for ( j = 0; j < input_frame; j++ ) + { + for ( i = 0; i < no_channel; i++, k++ ) + { + if ( ppPcm ) + { + tmp_value = roundf( ppPcm[i][j] ); + } + else + { + tmp_value = roundf( pcm_array[i][j] ); + } + + if ( tmp_value > MAX16B_FLT ) + { + largest_value = (float) fabs( tmp_value ) > largest_value ? (float) fabs( tmp_value ) : largest_value; + tmp_value = MAX16B; + Clipping++; + } + else if ( tmp_value < MIN16B_FLT ) + { + largest_value = (float) fabs( tmp_value ) > largest_value ? (float) fabs( tmp_value ) : largest_value; + tmp_value = MIN16B; + Clipping++; + } + pcm_value = (int16_t) tmp_value; + /*pcm_value = (tmp_value > MAX16B_FLT) ? MAX16B : (tmp_value < MIN16B_FLT) ? MIN16B + : (short)tmp_value;*/ + debug_tmp[k] = pcm_value; + } + } + if ( Clipping ) + { + db_value = 20.f * (float) log( largest_value ); + fprintf( stderr, "%d\t Clipping detected ", Clipping ); + } + + WriteWavShort( wave_file, debug_tmp, ( no_channel * input_frame ) ); + + if ( db_value ) + { + fprintf( stderr, "\t In %s largest clipped sample in dB %f \n", location, db_value ); + } + + return; +} + + +void ivas_close_sba_decoder_debug_files( + const int32_t fs, + const int16_t n_ch, + const int16_t n_transport, + const int16_t pca_ingest_channels ) +{ + if ( spar_foa_dec_wav[0] != NULL ) + { + UpdateWave( fs, n_transport, 32, spar_foa_dec_wav[0] ); + CloseWav( spar_foa_dec_wav[0] ); + } + if ( spar_foa_dec_wav[1] != NULL ) + { + UpdateWave( fs, n_transport, 16, spar_foa_dec_wav[1] ); + CloseWav( spar_foa_dec_wav[1] ); + } + if ( spar_foa_dec_wav[2] != NULL ) + { + UpdateWave( fs, pca_ingest_channels, 16, spar_foa_dec_wav[2] ); + CloseWav( spar_foa_dec_wav[2] ); + } + if ( spar_foa_dec_wav[3] != NULL ) + { + UpdateWave( fs, n_ch, 16, spar_foa_dec_wav[3] ); + CloseWav( spar_foa_dec_wav[3] ); + } + + if ( spar_foa_dec_wav[4] != NULL ) + { + UpdateWave( fs, n_ch, 16, spar_foa_dec_wav[4] ); + CloseWav( spar_foa_dec_wav[4] ); + } + + return; +} + + +void ivas_close_sba_encoder_debug_files( void ) +{ + + if ( spar_foa_enc_wav[0] != NULL ) + { + CloseWav( spar_foa_enc_wav[0] ); + } + if ( spar_foa_enc_wav[1] != NULL ) + { + CloseWav( spar_foa_enc_wav[1] ); + } + if ( spar_foa_enc_wav[2] != NULL ) + { + CloseWav( spar_foa_enc_wav[2] ); + } + + /* Enable print max diff to a file */ + + /* FILE *fp = fopen("max_diff.txt", "a"); + fprintf(fp, "%s\n", file_names[0]); + fprintf(fp, "max diff = %0.15f\n frame_no = %d\n band num = %d\n coeff type %d\n", max_diff, dbg_frm_num, dbg_band, dbg_type); + fclose(fp); */ + + /* Enable print max eig iters to a file */ + + /*FILE *fp = fopen("max_iters.txt", "a"); + fprintf(fp, "%s\n", file_names[0]); + fprintf(fp, "%d\n", iter_max); + fclose(fp); */ + + return; +} + + +void ivas_open_sba_decoder_debug_files( + const int32_t fs, + const int16_t n_ch, + const int16_t n_transport ) +{ + int8_t fb_wav_dump_path[NUM_DEBUG_FILES][MAX_PLUG_IN_FILE_LEN] = { "", "", "", "", "" }; + + cstrcat( (char *) fb_wav_dump_path[0], sizeof( fb_wav_dump_path[0] ), "dec_out.wav" ); + spar_foa_dec_wav[0] = CreateWav( (const char *) fb_wav_dump_path[0], fs, n_ch, 32 /* const uint32_t writeWaveExt */ ); + + cstrcat( (char *) fb_wav_dump_path[1], sizeof( fb_wav_dump_path[1] ), "agc_dec_out.wav" ); + spar_foa_dec_wav[1] = CreateWav( (const char *) fb_wav_dump_path[1], fs, n_transport, 16 /* const uint32_t writeWaveExt */ ); + + cstrcat( (char *) fb_wav_dump_path[2], sizeof( fb_wav_dump_path[2] ), "pca_dec.wav" ); + spar_foa_dec_wav[2] = CreateWav( (const char *) fb_wav_dump_path[2], fs, n_transport, 16 /* const uint32_t writeWaveExt */ ); + + cstrcat( (char *) fb_wav_dump_path[3], sizeof( fb_wav_dump_path[3] ), "cldfbSynthesis.wav" ); + spar_foa_dec_wav[3] = CreateWav( (const char *) fb_wav_dump_path[3], fs, n_transport, 16 /* const uint32_t writeWaveExt */ ); + + cstrcat( (char *) fb_wav_dump_path[4], sizeof( fb_wav_dump_path[4] ), "cldfbAnalysis.wav" ); + spar_foa_dec_wav[4] = CreateWav( (const char *) fb_wav_dump_path[4], fs, n_transport, 16 /* const uint32_t writeWaveExt */ ); + + return; +} + + +void ivas_open_sba_encoder_debug_files( + const int32_t fs, + const int16_t n_transport, + const char *file_tag, + const int32_t ivas_total_brate, + const int16_t dtx_on ) +{ + int8_t fb_wav_dump_path[3][MAX_PLUG_IN_FILE_LEN] = { "spar_foa_enc", "spar_foa_enc", "spar_foa_enc" }; + + if ( file_tag != NULL ) + { + cstrcpy( (char *) file_names[0], sizeof( file_names[0] ), (const char *) file_tag ); + } + + /* ivas_total_brate */ + switch ( ivas_total_brate ) + { + case IVAS_24k4: + cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_ivasbr24k" ); + break; + case IVAS_32k: + cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_ivasbr32k" ); + break; + case IVAS_48k: + cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_ivasbr48k" ); + break; + case IVAS_64k: + cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_ivasbr64k" ); + break; + case IVAS_80k: + cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_ivasbr80k" ); + break; + case IVAS_96k: + cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_ivasbr96k" ); + break; + case IVAS_128k: + cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_ivasbr128k" ); + break; + case IVAS_160k: + cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_ivasbr160k" ); + break; + case IVAS_192k: + cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_ivasbr192k" ); + break; + case IVAS_256k: + cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_ivasbr256k" ); + break; + case IVAS_384k: + cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_ivasbr384k" ); + break; + case IVAS_512k: + cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_ivasbr512k" ); + break; + } + + /* DTX */ + if ( dtx_on ) + { + cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_DTX1" ); + } + else + { + cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_DTX0" ); + } + + cstrcpy( (char *) file_names[1], sizeof( file_names[1] ), (const char *) file_names[0] ); + cstrcpy( (char *) file_names[2], sizeof( file_names[2] ), (const char *) file_names[0] ); + cstrcpy( (char *) file_names[3], sizeof( file_names[3] ), (const char *) file_names[0] ); + cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_pcm.txt" ); + + cstrcat( (char *) fb_wav_dump_path[0], sizeof( fb_wav_dump_path[0] ), (const char *) file_names[2] ); + cstrcat( (char *) fb_wav_dump_path[0], sizeof( fb_wav_dump_path[0] ), "_pca_enc.wav" ); + spar_foa_enc_wav[0] = CreateWav( (const char *) fb_wav_dump_path[0], fs, n_transport, 16 /* const uint32_t writeWaveExt */ ); + + cstrcat( (char *) fb_wav_dump_path[1], sizeof( fb_wav_dump_path[1] ), (const char *) file_names[2] ); + cstrcat( (char *) fb_wav_dump_path[1], sizeof( fb_wav_dump_path[1] ), "_fb_mixer_enc.wav" ); + spar_foa_enc_wav[1] = CreateWav( (const char *) fb_wav_dump_path[1], fs, n_transport, 16 /* const uint32_t writeWaveExt */ ); + + cstrcat( (char *) fb_wav_dump_path[2], sizeof( fb_wav_dump_path[2] ), (const char *) file_names[2] ); + cstrcat( (char *) fb_wav_dump_path[2], sizeof( fb_wav_dump_path[2] ), "_agc_enc.wav" ); + spar_foa_enc_wav[2] = CreateWav( (const char *) fb_wav_dump_path[2], fs, n_transport, 16 /* const uint32_t writeWaveExt */ ); + + return; +} + +#endif /* DEBUG_SBA */ diff --git a/lib_debug/sba_debug.h b/lib_debug/sba_debug.h new file mode 100644 index 000000000..a314d1568 --- /dev/null +++ b/lib_debug/sba_debug.h @@ -0,0 +1,61 @@ +/****************************************************************************************************** + + (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#ifndef SBA_DEBUG_H +#define SBA_DEBUG_H + +#include "options.h" +#include +#include +#ifdef DEBUG_SBA +#include "cnst.h" +#include "ivas_cnst.h" +#include "tinywaveout_c.h" + + +#ifdef DEBUG_SBA_AUDIO_DUMP +extern WAVEFILEOUT *spar_foa_enc_wav[3]; +extern WAVEFILEOUT *spar_foa_dec_wav[5]; +#endif + +#ifdef DEBUG_AGC +void ivas_close_agc_debug_files( void ); +void ivas_open_agc_debug_files( int16_t agc ); +#endif +void ivas_spar_dump_signal_wav( const int16_t input_frame, float **ppPcm, float pcm_array[IVAS_SPAR_MAX_CH][L_FRAME48k], const int16_t no_channel, WAVEFILEOUT *wave_file, char *location ); +void ivas_close_sba_encoder_debug_files( void ); +void ivas_open_sba_encoder_debug_files( const int32_t fs, const int16_t n_transport, const char *file_tag, const int32_t ivas_total_brate, const int16_t dtx_on ); +void ivas_close_sba_decoder_debug_files( const int32_t fs, const int16_t n_ch, const int16_t n_transport, const int16_t pca_ingest_channels ); +void ivas_open_sba_decoder_debug_files( const int32_t fs, const int16_t n_ch, const int16_t n_transport ); +#endif + +#endif /* SBA_DEBUG_H */ diff --git a/lib_debug/snr.c b/lib_debug/snr.c new file mode 100644 index 000000000..3e817287c --- /dev/null +++ b/lib_debug/snr.c @@ -0,0 +1,465 @@ +/****************************************************************************************************** + + (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include +#include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif +#include +#include +#include +#include "wmc_auto.h" +#include "cnst.h" +#include "ivas_cnst.h" + +#ifdef DEBUGGING + +/*-------------------------------------------------------------------* + * Local constants + *--------------------------------------------------------------------*/ + +#define N_SNRPTR 100 +#define MAX_SIGNAL_LENGTH 1024 +#define MAX_DELAY 320 + +/*-------------------------------------------------------------------* + * Global variables + *--------------------------------------------------------------------*/ + +int16_t snr_count = 0; +char *snr_name[N_SNRPTR] = { 0 }; + +#ifdef DEBUG_MODE_INFO +float snr_[2][320]; +#endif + +/*-------------------------------------------------------------------* + * Local variables + *--------------------------------------------------------------------*/ + +static double signal_energy[N_SNRPTR]; +static double noise_energy[N_SNRPTR]; +static double acc_seg_snr[N_SNRPTR]; +static int32_t seg_count[N_SNRPTR]; +static double acc_wseg_snr[N_SNRPTR]; +static double wseg_count[N_SNRPTR]; +static float *mem_delay_comp[N_SNRPTR] = { 0 }; +static float mem_deemph_x[MAX_INPUT_CHANNELS] = { 0 }; +static float mem_deemph_y[MAX_INPUT_CHANNELS] = { 0 }; +static float mem_synth_snr[MAX_INPUT_CHANNELS][M]; + + +/*-------------------------------------------------------------------* + * Local functions - they are copies of functions declared in prot.h but + here we do not want to include prot.h due to its dependencies + *--------------------------------------------------------------------*/ + +#ifdef DEBUG_MODE_INFO +static void set_f( + float y[], /* i/o: Vector to set */ + const float a, /* i : Value to set the vector to */ + const int16_t N /* i : Lenght of the vector */ +) +{ + int16_t i; + + for ( i = 0; i < N; i++ ) + { + y[i] = a; + } + + return; +} +#endif + +static float sum2_f( + const float *vec, /* i : input vector */ + const int16_t lvec /* i : length of input vector */ +) +{ + int16_t i; + float tmp; + + tmp = 0.0f; + for ( i = 0; i < lvec; i++ ) + { + tmp += vec[i] * vec[i]; + } + + return tmp; +} + + +static void mvr2r( + const float x[], /* i : input vector */ + float y[], /* o : output vector */ + const int16_t n /* i : vector size */ +) +{ + int16_t i; + + if ( n <= 0 ) + { + /* cannot transfer vectors with size 0 */ + return; + } + + if ( y < x ) + { + for ( i = 0; i < n; i++ ) + { + y[i] = x[i]; + } + } + else + { + for ( i = n - 1; i >= 0; i-- ) + { + y[i] = x[i]; + } + } + + return; +} + +static void residu( + const float *a, /* i : LP filter coefficients */ + const int16_t m, /* i : order of LP filter */ + const float *x, /* i : input signal (usually speech) */ + float *y, /* o : output signal (usually residual) */ + const int16_t l /* i : size of filtering */ +) +{ + float s; + int16_t i, j; + + for ( i = 0; i < l; i++ ) + { + s = x[i]; + for ( j = 1; j <= m; j++ ) + { + s += a[j] * x[i - j]; + } + y[i] = s; + } + + return; +} + +static void deemph( + float *signal, /* i/o: signal */ + const float mu, /* i : deemphasis factor */ + const int16_t L, /* i : vector size */ + float *mem /* i/o: memory (y[-1]) */ +) +{ + int16_t i; + + signal[0] = signal[0] + mu * ( *mem ); + for ( i = 1; i < L; i++ ) + { + signal[i] = signal[i] + mu * signal[i - 1]; + } + + *mem = signal[L - 1]; + + if ( ( *mem < 1e-10 ) & ( *mem > -1e-10 ) ) + { + *mem = 0; + } + + return; +} + +static void weight_a( + const float *a, /* i : LP filter coefficients */ + float *ap, /* o : weighted LP filter coefficients */ + const float gamma, /* i : weighting factor */ + const int16_t m /* i : order of LP filter */ +) +{ + float f; + int16_t i; + + ap[0] = a[0]; + f = gamma; + + for ( i = 1; i <= m; i++ ) + { + ap[i] = f * a[i]; + f *= gamma; + } + + return; +} + + +/*-------------------------------------------------------------------* + * snr() + * + * Calculates and accumulates SNR values for a signal specified with a + * certain string. The signal is input in segments having certain length, + * for which a global SNR, segmental SNR and weighted segmental SNR is computed. + *--------------------------------------------------------------------*/ + +void snr( + const float *const signal, + const float *const noise, + const int16_t length, + const char *const name ) +{ + int16_t index; + double signal_sumsq, noise_sumsq, frame_snr, seg_en; + + index = lookup( name, (const char *const *) snr_name, snr_count ); + if ( index == -1 ) + { + index = snr_count; + signal_energy[index] = 0; + noise_energy[index] = 0; + acc_seg_snr[index] = 0; + seg_count[index] = 0; + acc_wseg_snr[index] = 0; + wseg_count[index] = 0; + snr_name[index] = malloc( sizeof( char ) * ( strlen( name ) + 1 ) ); + strcpy( snr_name[index], name ); + snr_count++; + } + + signal_sumsq = sum2_f( signal, length ) + 0.001f; + noise_sumsq = sum2_f( noise, length ) + 0.001f; + if ( signal_sumsq < noise_sumsq ) + signal_sumsq = noise_sumsq; + frame_snr = 10 * log10( signal_sumsq / noise_sumsq ); + seg_en = 10 * log10( signal_sumsq / length ); + if ( seg_en < 0.0 ) + seg_en = 0.0; + + signal_energy[index] += signal_sumsq; + noise_energy[index] += noise_sumsq; + acc_seg_snr[index] += frame_snr; + seg_count[index]++; + acc_wseg_snr[index] += frame_snr * seg_en; + wseg_count[index] += seg_en; + + return; +} + + +/*-------------------------------------------------------------------* + * snr_diff() + * + * Calculates and accumulates SNR values for a signal specified with a + * certain string. The signal is input in segments having certain length, + * for which a global SNR, segmental SNR and weighted segmental SNR is computed. + * A delay between both signals is taken into account + * and compensated for (positive value means degraded signal is delayed). + *--------------------------------------------------------------------*/ + +void snr_diff( + const float *const clean, + const float *const degraded, + const int16_t length, + const int16_t delay, + const char *const name ) +{ + int16_t i, index; + float noise[MAX_SIGNAL_LENGTH], comp_buf[MAX_SIGNAL_LENGTH + MAX_DELAY]; + + if ( length > MAX_SIGNAL_LENGTH ) + { + fprintf( stdout, "snr_diff::Input segment too long. Exiting...\n" ); + exit( -1 ); + } + + if ( delay < 0 ) + { + fprintf( stdout, "snr_diff::Degraded signal cannot have negative delay. Exiting...\n" ); + exit( -1 ); + } + + /* search for the name in the database */ + index = (int16_t) lookup( name, (const char *const *) snr_name, snr_count ); + if ( index == -1 ) + { + index = (int16_t) snr_count; + signal_energy[index] = 0.0f; + noise_energy[index] = 0.0f; + acc_seg_snr[index] = 0.0f; + seg_count[index] = 0; + acc_wseg_snr[index] = 0.001f; + wseg_count[index] = 0.001f; + snr_name[index] = malloc( sizeof( char ) * ( strlen( name ) + 1 ) ); + mem_delay_comp[index] = calloc( delay, sizeof( float ) ); + strcpy( snr_name[index], name ); + snr_count++; + } + + /* delay compensation - introduction of delay to the clean signal */ + mvr2r( mem_delay_comp[index], comp_buf, delay ); + mvr2r( clean, comp_buf + delay, length ); + mvr2r( comp_buf + length, mem_delay_comp[index], delay ); + + for ( i = 0; i < length; i++ ) + { + noise[i] = comp_buf[i] - degraded[i]; + } + + snr( comp_buf, noise, length, name ); + + return; +} + + +/*-------------------------------------------------------------------* + * snr_celp() + * + * Calculates SNR, segmental SNR and weighted segmental SNR values for active + * frames (GENERIC, VOICED, TRANSITION and AUDIO) of CELP-coded signals. Both, the input and output + * signals are first converted to the perceptually weighted domain, subtracted to + * obtain the noise signal and de-emphasized. + *--------------------------------------------------------------------*/ + +void snr_celp( + const int16_t L_frame, + const int16_t L_subfr, + const float gamma, + const float tilt_fac, + const int16_t vad_flag, + const int16_t coder_type, + const float *input, + const float *output, + const float *A, + const int16_t idchan, + const char *name ) +{ + int16_t i; + float noise[L_FRAME16k], Ap[M + 1], x[L_FRAME16k], y[L_FRAME16k], synth_buf[M + L_FRAME16k], *synth; + const float *p_A; + int16_t j; +#ifdef DEBUG_MODE_INFO + float signal2, noise2, subframe_snr; +#endif + + synth = synth_buf + M; + mvr2r( mem_synth_snr[idchan], synth_buf, M ); + mvr2r( output, synth, L_frame ); + mvr2r( synth_buf + L_frame, mem_synth_snr[idchan], M ); + + p_A = A; + for ( i = 0; i < L_frame; i += L_subfr ) + { + weight_a( p_A, Ap, gamma, M ); + residu( Ap, M, &input[i], &x[i], L_subfr ); + residu( Ap, M, &synth[i], &y[i], L_subfr ); + p_A += ( M + 1 ); + + deemph( &x[i], tilt_fac, L_subfr, &mem_deemph_x[idchan] ); + deemph( &y[i], tilt_fac, L_subfr, &mem_deemph_y[idchan] ); + + for ( j = 0; j < L_subfr; j++ ) + { + noise[i + j] = x[i + j] - y[i + j]; + } + +#ifdef DEBUG_MODE_INFO + signal2 = sum2_f( &x[i], L_subfr ) + 0.001f; + noise2 = sum2_f( &noise[i], L_subfr ) + 0.001f; + if ( signal2 < noise2 ) + signal2 = noise2; + subframe_snr = 10.0f * log10f( signal2 / noise2 ); + + if ( L_frame == L_FRAME ) + { + set_f( snr_[idchan] + i * 5 / 4, subframe_snr, L_subfr * 5 / 4 ); + } + else + { + set_f( snr_[idchan] + i, subframe_snr, L_subfr ); + } +#endif + } + + if ( vad_flag == 1 && ( coder_type == GENERIC || coder_type == VOICED || coder_type == TRANSITION || coder_type == AUDIO ) ) + { + snr( x, noise, L_frame, name ); + } + + return; +} + +/*-------------------------------------------------------------------* + * print_snr() + * + * Finalizes and presents accumulated SNR data + *--------------------------------------------------------------------*/ + +void print_snr( void ) +{ + int16_t i; + double snr, segsnr, wsegsnr; + + if ( snr_count > 0 ) + { + fprintf( stdout, "\n --- SNR report --- \n" ); + + for ( i = 0; i < snr_count; i++ ) + { + snr = 10 * log10( signal_energy[i] / ( noise_energy[i] + 0.0001f ) ); + segsnr = acc_seg_snr[i] / ( seg_count[i] + 0.0001f ); + wsegsnr = acc_wseg_snr[i] / ( wseg_count[i] + 0.0001f ); + fprintf( stdout, "%-22s %6.3f dB SNR %6.3f dB SegSNR %6.3f dB WSegSNR\n", snr_name[i], snr, segsnr, wsegsnr ); + } + fprintf( stdout, "\n" ); + } + + /* free allocated memory */ + for ( i = 0; i < N_SNRPTR; i++ ) + { + if ( snr_name[i] ) + { + free( snr_name[i] ); + snr_name[i] = NULL; + } + + if ( mem_delay_comp[i] ) + { + free( mem_delay_comp[i] ); + mem_delay_comp[i] = NULL; + } + } + + return; +} + +#endif diff --git a/lib_dec/ACcontextMapping_dec.c b/lib_dec/ACcontextMapping_dec.c index cabbef7c2..5139106d9 100644 --- a/lib_dec/ACcontextMapping_dec.c +++ b/lib_dec/ACcontextMapping_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "ivas_rom_com.h" @@ -491,6 +494,9 @@ int16_t RCcontextMapping_decode2_no_mem_s17_LCS( st->next_bit_pos = start_bit_pos + bits_tups + rc_uni_dec_virtual_finish( &rc_st_dec ); /* Confirm that there is no overflow */ +#ifdef DEBUGGING + assert( st->next_bit_pos - start_bit_pos + rest_bits <= 0 ); +#endif /* Store decoded data */ x[a1_i] = a; @@ -538,6 +544,9 @@ int16_t RCcontextMapping_decode2_no_mem_s17_LCS( assert( rc_st_dec.bit_error_detected == 0 ); /* Cross-check: No overflow */ +#ifdef DEBUGGING + assert( k == lastnz ); +#endif /* Decode signs */ n = nt; @@ -625,6 +634,9 @@ int16_t RCcontextMapping_decode2_no_mem_s17_LCS( st->next_bit_pos = start_bit_pos + bits_tups + rc_uni_dec_virtual_finish( &rc_st_dec ); /* Confirm that there is no overflow */ +#ifdef DEBUGGING + assert( st->next_bit_pos - start_bit_pos + rest_bits <= 0 ); +#endif /* Store decoded data */ x[k + 0] = a; diff --git a/lib_dec/FEC.c b/lib_dec/FEC.c index 31b05b390..c0db9325f 100644 --- a/lib_dec/FEC.c +++ b/lib_dec/FEC.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_dec/FEC_HQ_core.c b/lib_dec/FEC_HQ_core.c index edc1c2490..988689b76 100644 --- a/lib_dec/FEC_HQ_core.c +++ b/lib_dec/FEC_HQ_core.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_dec.h" diff --git a/lib_dec/FEC_HQ_phase_ecu.c b/lib_dec/FEC_HQ_phase_ecu.c index 49e363608..28cafd473 100644 --- a/lib_dec/FEC_HQ_phase_ecu.c +++ b/lib_dec/FEC_HQ_phase_ecu.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "rom_dec.h" #include "rom_com.h" diff --git a/lib_dec/FEC_adapt_codebook.c b/lib_dec/FEC_adapt_codebook.c index 3ef001909..1200e2651 100644 --- a/lib_dec/FEC_adapt_codebook.c +++ b/lib_dec/FEC_adapt_codebook.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_dec.h" diff --git a/lib_dec/FEC_clas_estim.c b/lib_dec/FEC_clas_estim.c index e514326be..d20760ddb 100644 --- a/lib_dec/FEC_clas_estim.c +++ b/lib_dec/FEC_clas_estim.c @@ -37,6 +37,9 @@ #include "cnst.h" #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "rom_com.h" diff --git a/lib_dec/FEC_lsf_estim.c b/lib_dec/FEC_lsf_estim.c index e8e165991..dce8b8351 100644 --- a/lib_dec/FEC_lsf_estim.c +++ b/lib_dec/FEC_lsf_estim.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_dec/FEC_pitch_estim.c b/lib_dec/FEC_pitch_estim.c index 738000a4d..3076f7bca 100644 --- a/lib_dec/FEC_pitch_estim.c +++ b/lib_dec/FEC_pitch_estim.c @@ -37,6 +37,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_dec/FEC_scale_syn.c b/lib_dec/FEC_scale_syn.c index 5ac57bb91..7d43ad3a9 100644 --- a/lib_dec/FEC_scale_syn.c +++ b/lib_dec/FEC_scale_syn.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_dec/LD_music_post_filter.c b/lib_dec/LD_music_post_filter.c index dd2493b0e..b7885d35b 100644 --- a/lib_dec/LD_music_post_filter.c +++ b/lib_dec/LD_music_post_filter.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_dec/TonalComponentDetection.c b/lib_dec/TonalComponentDetection.c index f3b73bf8c..fedfe0c2e 100644 --- a/lib_dec/TonalComponentDetection.c +++ b/lib_dec/TonalComponentDetection.c @@ -39,6 +39,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "cnst.h" diff --git a/lib_dec/acelp_core_dec.c b/lib_dec/acelp_core_dec.c index 5218f6010..d22d6138f 100644 --- a/lib_dec/acelp_core_dec.c +++ b/lib_dec/acelp_core_dec.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" @@ -557,6 +560,9 @@ ivas_error acelp_core_dec( } } +#ifdef DEBUG_MODE_ACELP + dbgwrite( exc, sizeof( float ), st->L_frame, 1, fname( debug_dir, "exc", st->idchan, st->id_element, DEC ) ); +#endif /* synthesis at 12.8kHz sampling rate */ syn_12k8( st->L_frame, Aq, exc2, syn, st->mem_syn2, 1 ); @@ -816,6 +822,9 @@ ivas_error acelp_core_dec( } } +#ifdef DEBUG_MODE_ACELP + dbgwrite( exc, sizeof( float ), st->L_frame, 1, fname( debug_dir, "exc", st->idchan, st->id_element, DEC ) ); +#endif /* synthesis for ACELP core switching and SWB BWE */ syn_12k8( st->L_frame, Aq, exc, temp_buf, st->mem_syn1, 1 ); @@ -1218,6 +1227,9 @@ ivas_error acelp_core_dec( } } +#ifdef DEBUG_MODE_ACELP + dbgwrite( syn, sizeof( float ), st->L_frame, 1, fname( debug_dir, "syn.intFs", st->idchan, st->id_element, DEC ) ); +#endif /*----------------------------------------------------------------* * Resample to the output sampling rate (8/16/32/48 kHz) @@ -1348,6 +1360,9 @@ ivas_error acelp_core_dec( /* save synthesis - needed in case of core switching */ mvr2r( synth, st->previoussynth, output_frame ); +#ifdef DEBUG_MODE_ACELP + dbgwrite( synth, sizeof( float ), output_frame, 1, fname( debug_dir, "output.Fs", st->idchan, st->id_element, DEC ) ); +#endif } else { @@ -1367,6 +1382,9 @@ ivas_error acelp_core_dec( mvr2r( bpf_error_signal, st->p_bpf_noise_buf, st->L_frame ); } +#ifdef DEBUG_MODE_ACELP + dbgwrite( synth, sizeof( float ), output_frame, 1, fname( debug_dir, "output.Fs", st->idchan, st->id_element, DEC ) ); +#endif set_f( synth, 0.0f, output_frame ); } diff --git a/lib_dec/acelp_core_switch_dec.c b/lib_dec/acelp_core_switch_dec.c index 96e6bec4e..51d459b20 100644 --- a/lib_dec/acelp_core_switch_dec.c +++ b/lib_dec/acelp_core_switch_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_dec/amr_wb_dec.c b/lib_dec/amr_wb_dec.c index b585eecf9..5252b2656 100644 --- a/lib_dec/amr_wb_dec.c +++ b/lib_dec/amr_wb_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" @@ -806,6 +809,20 @@ ivas_error amr_wb_dec( /* final output of synthesis signal */ mvr2r( synth_out, output, output_frame ); +#ifdef DEBUG_MODE_INFO + dbgwrite( &st->clas_dec, sizeof( int16_t ), 1, output_frame, "res/clas.dec" ); + dbgwrite( &st->codec_mode, sizeof( int16_t ), 1, output_frame, "res/codec.dec" ); + dbgwrite( &st->core, sizeof( int16_t ), 1, output_frame, "res/core.dec" ); + dbgwrite( &st->extl, sizeof( int16_t ), 1, output_frame, "res/extl.dec" ); + dbgwrite( &st->bwidth, sizeof( int16_t ), 1, output_frame, "res/bwidth.dec" ); + dbgwrite( &st->cng_type, sizeof( int16_t ), 1, output_frame, "res/cng_type.dec" ); + tmp = st->core_brate / 1000.0f; + dbgwrite( &tmp, sizeof( float ), 1, output_frame, "res/core_brate.dec" ); + dbgwrite( &tmp, sizeof( float ), 1, output_frame, "res/total_brate.dec" ); + dbgwrite( &st->coder_type, sizeof( int16_t ), 1, output_frame, "res/coder_type.dec" ); + dbgwrite( &st->L_frame, sizeof( int16_t ), 1, output_frame, "res/L_frame.dec" ); + dbgwrite( &st->bfi, sizeof( int16_t ), 1, output_frame, "res/bfi" ); +#endif return error; } diff --git a/lib_dec/arith_coder_dec.c b/lib_dec/arith_coder_dec.c index 82f35846c..09f169813 100644 --- a/lib_dec/arith_coder_dec.c +++ b/lib_dec/arith_coder_dec.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "rom_com.h" diff --git a/lib_dec/avq_dec.c b/lib_dec/avq_dec.c index 6a7245d9d..ec74ea538 100644 --- a/lib_dec/avq_dec.c +++ b/lib_dec/avq_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "cnst.h" #include "wmc_auto.h" diff --git a/lib_dec/bass_psfilter.c b/lib_dec/bass_psfilter.c index 94538e1e7..09daa4ae9 100644 --- a/lib_dec/bass_psfilter.c +++ b/lib_dec/bass_psfilter.c @@ -42,6 +42,9 @@ #include "cnst.h" #include "stat_dec.h" #include "rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "wmc_auto.h" diff --git a/lib_dec/cng_dec.c b/lib_dec/cng_dec.c index 486d2d857..b7f462aa9 100644 --- a/lib_dec/cng_dec.c +++ b/lib_dec/cng_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" @@ -738,6 +741,9 @@ static void shb_CNG_decod( gain = (float) sqrt( pow( 10, 0.1f * ener ) * L_FRAME16k / ener_excSHB ); st->hTdCngDec->shb_cng_gain = ener; +#ifdef DEBUGGING + /* note: state shb_cng_gain is actually an energy value in dB */ +#endif for ( i = 0; i < L_FRAME16k; i++ ) { diff --git a/lib_dec/core_dec_init.c b/lib_dec/core_dec_init.c index eed6fc8c0..3ceee9a2f 100644 --- a/lib_dec/core_dec_init.c +++ b/lib_dec/core_dec_init.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "stat_com.h" #include "cnst.h" #include "prot.h" diff --git a/lib_dec/core_dec_reconf.c b/lib_dec/core_dec_reconf.c index ffbcfca95..7734d1317 100644 --- a/lib_dec/core_dec_reconf.c +++ b/lib_dec/core_dec_reconf.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "rom_com.h" #include "rom_dec.h" diff --git a/lib_dec/core_dec_switch.c b/lib_dec/core_dec_switch.c index d093afc3d..16519aec4 100644 --- a/lib_dec/core_dec_switch.c +++ b/lib_dec/core_dec_switch.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "rom_com.h" #include "wmc_auto.h" diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index 2625d59a6..e70b1d59d 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_dec/d_gain2p.c b/lib_dec/d_gain2p.c index 826208b9a..d2fe3e875 100644 --- a/lib_dec/d_gain2p.c +++ b/lib_dec/d_gain2p.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "cnst.h" diff --git a/lib_dec/dec2t32.c b/lib_dec/dec2t32.c index 57ad88f2f..258e36da4 100644 --- a/lib_dec/dec2t32.c +++ b/lib_dec/dec2t32.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_dec/dec4t64.c b/lib_dec/dec4t64.c index a0e969b1b..9f2ab5d1c 100644 --- a/lib_dec/dec4t64.c +++ b/lib_dec/dec4t64.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "ivas_prot.h" diff --git a/lib_dec/dec_LPD.c b/lib_dec/dec_LPD.c index e3d0561c2..af6a937e1 100644 --- a/lib_dec/dec_LPD.c +++ b/lib_dec/dec_LPD.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "rom_com.h" diff --git a/lib_dec/dec_ace.c b/lib_dec/dec_ace.c index 1012b8e77..ee32d6714 100644 --- a/lib_dec/dec_ace.c +++ b/lib_dec/dec_ace.c @@ -37,6 +37,9 @@ #include #include "options.h" #include "prot.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "rom_com.h" #include "wmc_auto.h" diff --git a/lib_dec/dec_acelp_tcx_main.c b/lib_dec/dec_acelp_tcx_main.c index 98e641563..1ab6b5265 100644 --- a/lib_dec/dec_acelp_tcx_main.c +++ b/lib_dec/dec_acelp_tcx_main.c @@ -39,6 +39,9 @@ #include "rom_com.h" #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "stat_dec.h" #include "wmc_auto.h" diff --git a/lib_dec/dec_amr_wb.c b/lib_dec/dec_amr_wb.c index 88605c5ba..29fe0a253 100644 --- a/lib_dec/dec_amr_wb.c +++ b/lib_dec/dec_amr_wb.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_dec/dec_gen_voic.c b/lib_dec/dec_gen_voic.c index 9f9e7cec8..c8220be86 100644 --- a/lib_dec/dec_gen_voic.c +++ b/lib_dec/dec_gen_voic.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_dec/dec_higher_acelp.c b/lib_dec/dec_higher_acelp.c index 5ae6b8b7c..1990de936 100644 --- a/lib_dec/dec_higher_acelp.c +++ b/lib_dec/dec_higher_acelp.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_dec/dec_nelp.c b/lib_dec/dec_nelp.c index 3c2688d41..8516f4cfd 100644 --- a/lib_dec/dec_nelp.c +++ b/lib_dec/dec_nelp.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_dec/dec_pit_exc.c b/lib_dec/dec_pit_exc.c index 27e49a6ef..2b67a6042 100644 --- a/lib_dec/dec_pit_exc.c +++ b/lib_dec/dec_pit_exc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_dec/dec_post.c b/lib_dec/dec_post.c index 6116539e9..6c5cd0423 100644 --- a/lib_dec/dec_post.c +++ b/lib_dec/dec_post.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_dec/dec_ppp.c b/lib_dec/dec_ppp.c index aa20b3194..b36f9190a 100644 --- a/lib_dec/dec_ppp.c +++ b/lib_dec/dec_ppp.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_dec/dec_prm.c b/lib_dec/dec_prm.c index 347abd25e..d2e9aa26e 100644 --- a/lib_dec/dec_prm.c +++ b/lib_dec/dec_prm.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index 2e131391e..cffb6a109 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -39,11 +39,17 @@ #include "ivas_prot.h" #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "stat_com.h" #include "cnst.h" #include "wmc_auto.h" #include "ivas_rom_com.h" +#ifdef DEBUG_PLOT +#include "deb_out.h" +#endif /*-----------------------------------------------------------------* @@ -248,6 +254,16 @@ void decoder_tcx_post( /* Update synth, exc and old_Aq */ tcx_decoder_memory_update( st, xn_buf, synth, A ); +#ifdef DEBUG_MODE_TCX + { + int16_t tmp[320]; + for ( i = 0; i < L_EXC_MEM; i++ ) + { + tmp[i] = (int16_t) ( st->old_exc[L_EXC_MEM_DEC - L_EXC_MEM + i] + 0.5f ); + } + dbgwrite( tmp, 2, L_EXC_MEM, 1, "res/exc_old.dec.pcm" ); + } +#endif /* PLC: [TCX: Memory update] */ st->old_pitch_buf[0] = st->old_pitch_buf[st->nb_subfr]; @@ -1501,6 +1517,10 @@ void decoder_tcx_tns( } } +#ifdef DEBUG_PLOT + if ( !whitenedDomain ) + sendDebout( "tnsSpec2", L_frameTCX, 1, "aftInvertGrouping", MTV_FLOAT, x ); +#endif /*-----------------------------------------------------------* * Temporal Noise Shaping Synthesis * @@ -1517,6 +1537,9 @@ void decoder_tcx_tns( } ApplyTnsFilter( hTcxCfg->pCurrentTnsConfig, tnsData, x, 0 ); +#ifdef DEBUG_PLOT + sendDebout( "tnsSpec2", L_frameTCX, 1, "aftTNS", MTV_FLOAT, x ); +#endif if ( ( L_frame == st->L_frame >> 1 ) && st->tcxonly && isTCX5 ) { @@ -1536,6 +1559,10 @@ void decoder_tcx_tns( tcx5SpectrumInterleaving( L >> 1, x ); } +#ifdef DEBUG_PLOT + if ( !whitenedDomain ) + sendDebout( "tnsSpec1", L_frameTCX, 1, "aftTNS", MTV_FLOAT, x ); +#endif /* restore index */ if ( ( L_frame == st->L_frame >> 1 ) && st->tcxonly && frame_cnt && !bfi && st->last_core != ACELP_CORE ) { @@ -1673,6 +1700,9 @@ void decoder_tcx_imdct( * Compute inverse MDCT of x[]. * *-----------------------------------------------------------*/ +#ifdef DEBUG_PLOT + sendDebout( "tnsSpec", L_frameTCX, 1, "befIMDCT", MTV_FLOAT, x ); +#endif if ( st->element_mode == IVAS_CPE_MDCT ) { @@ -1934,6 +1964,14 @@ void decoder_tcx_IGF_stereo( * both channels have the same IGF configuration */ +#ifdef DEBUGGING + /* sanity checks: check if both channels have the same configuration...*/ + assert( ( sts[0]->core == sts[1]->core ) ); + if ( sts[0]->last_core_from_bs == ACELP_CORE || sts[1]->last_core_from_bs == ACELP_CORE ) + { + assert( ( sts[0]->last_core_from_bs == sts[1]->last_core_from_bs ) ); + } +#endif /* initialization */ sfbConf = ( core == TCX_20_CORE ) ? &hStereoMdct->stbParamsTCX20 : &hStereoMdct->stbParamsTCX10; diff --git a/lib_dec/dec_tran.c b/lib_dec/dec_tran.c index 0e105703e..875ce5eab 100644 --- a/lib_dec/dec_tran.c +++ b/lib_dec/dec_tran.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_dec/decision_matrix_dec.c b/lib_dec/decision_matrix_dec.c index e6378ed0a..f3b1194b0 100644 --- a/lib_dec/decision_matrix_dec.c +++ b/lib_dec/decision_matrix_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "stat_dec.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_dec/dlpc_stoch.c b/lib_dec/dlpc_stoch.c index c033c5bb0..22a1cda26 100644 --- a/lib_dec/dlpc_stoch.c +++ b/lib_dec/dlpc_stoch.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "rom_com.h" #include "basop_proto_func.h" diff --git a/lib_dec/er_dec_acelp.c b/lib_dec/er_dec_acelp.c index 5fdce1773..7024cfb3f 100644 --- a/lib_dec/er_dec_acelp.c +++ b/lib_dec/er_dec_acelp.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "wmc_auto.h" diff --git a/lib_dec/er_dec_tcx.c b/lib_dec/er_dec_tcx.c index bf2fbe9c2..24a481705 100644 --- a/lib_dec/er_dec_tcx.c +++ b/lib_dec/er_dec_tcx.c @@ -39,6 +39,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "rom_dec.h" diff --git a/lib_dec/er_util.c b/lib_dec/er_util.c index 965b527a7..5326f28e9 100644 --- a/lib_dec/er_util.c +++ b/lib_dec/er_util.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "cnst.h" @@ -291,7 +294,11 @@ int16_t GetPLCModeDecision( } else { +#ifndef DEBUG_NO_TD_TCX_PLC core = ACELP_CORE; +#else + core = st->last_core; +#endif if ( st->nbLostCmpt > 1 ) { core = st->last_core_bfi; @@ -316,13 +323,16 @@ int16_t GetPLCModeDecision( if ( ( numIndices > 10 ) || ( ( numIndices > 5 ) && ( fabs( hTcxDec->tcxltp_third_last_pitch - hTcxDec->tcxltp_second_last_pitch ) < 0.5f ) ) || ( ( numIndices > 0 ) && ( ( st->last_good <= UNVOICED_TRANSITION ) || ( hTcxDec->tcxltp_last_gain_unmodified <= 0.4f ) ) && ( fabs( hTcxDec->tcxltp_third_last_pitch - hTcxDec->tcxltp_second_last_pitch ) < 0.5f ) ) ) { core = TCX_20_CORE; +#ifndef DEBUG_NO_TONAL_PLC st->tonal_mdct_plc_active = 1; +#endif } else if ( st->last_good <= UNVOICED_TRANSITION || hTcxDec->tcxltp_last_gain_unmodified <= 0.4f ) { core = TCX_20_CORE; } } +#ifndef DEBUG_FORCE_TD_TCX_CONCEALMENT else if ( st->last_core != ACELP_CORE ) { if ( st->last_good <= UNVOICED_TRANSITION || hTcxDec->tcxltp_last_gain_unmodified <= 0.4f ) @@ -330,6 +340,7 @@ int16_t GetPLCModeDecision( core = st->last_core; } } +#endif } } } diff --git a/lib_dec/evs_dec.c b/lib_dec/evs_dec.c index 7b6dc2b9d..39815e633 100644 --- a/lib_dec/evs_dec.c +++ b/lib_dec/evs_dec.c @@ -36,11 +36,17 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" #include "prot.h" #include "wmc_auto.h" +#ifdef DEBUG_PLOT +#include "deb_out.h" +#endif /*--------------------------------------------------------------------------* * evs_dec() @@ -938,6 +944,34 @@ ivas_error evs_dec( } +#ifdef DEBUG_MODE_INFO + for ( i = 0; i < ( st->L_frame / L_SUBFR ); i++ ) + { + dbgwrite( &pitch_buf[i], sizeof( float ), 1, output_frame / ( st->L_frame / L_SUBFR ), "res/pitch_buf.dec" ); + } + dbgwrite( &st->clas_dec, sizeof( int16_t ), 1, output_frame, "res/clas.dec" ); + dbgwrite( &st->codec_mode, sizeof( int16_t ), 1, output_frame, "res/codec.dec" ); + dbgwrite( &st->core, sizeof( int16_t ), 1, output_frame, "res/core.dec" ); + dbgwrite( &st->extl, sizeof( int16_t ), 1, output_frame, "res/extl.dec" ); + dbgwrite( &st->bwidth, sizeof( int16_t ), 1, output_frame, "res/bwidth.dec" ); + dbgwrite( &st->cng_type, sizeof( int16_t ), 1, output_frame, "res/cng_type.dec" ); + tmp = st->extl_brate / 1000.0f; + dbgwrite( &tmp, sizeof( float ), 1, output_frame, "res/extl_brate.dec" ); + tmp = st->core_brate / 1000.0f; + dbgwrite( &tmp, sizeof( float ), 1, output_frame, "res/core_brate.dec" ); + tmp = st->total_brate / 1000.0f; + dbgwrite( &tmp, sizeof( float ), 1, output_frame, "res/total_brate.dec" ); + dbgwrite( &st->coder_type, sizeof( int16_t ), 1, output_frame, "res/coder_type.dec" ); + dbgwrite( &st->L_frame, sizeof( int16_t ), 1, output_frame, "res/L_frame.dec" ); + dbgwrite( &st->bfi, sizeof( int16_t ), 1, output_frame, "res/bfi" ); + dbgwrite( &st->BER_detect, sizeof( int16_t ), 1, output_frame, "res/BER_detect" ); + + if ( st->core != ACELP_CORE ) + { + set_f( hb_synth, 0, output_frame ); + dbgwrite( hb_synth, 4, st->L_frame, 1, "res/exc.dec" ); + } +#endif pop_wmops(); return error; diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 7745630fe..69d007825 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "ivas_prot.h" @@ -1823,6 +1826,13 @@ void generate_masking_noise_lb_dirac( n_samples_start = 0; /*LB CLDFB - CNA from STFT*/ +#ifdef DEBUG_MODE_DIRAC + { + int16_t tmp_s; + tmp_s = (int16_t) ( 32768.f * 0.5f * hFdCngCom->likelihood_noisy_speech * cna_flag + 0.5f ); + dbgwrite( &tmp_s, sizeof( int16_t ), 1, hFdCngCom->frameSize / 16, "./res/ivas_dirac_likelihood_noisy.pcm" ); + } +#endif if ( cna_flag ) { /* skip noise generating if level is very low, to avoid problems with possibly running into denormals */ @@ -1892,6 +1902,17 @@ void generate_masking_noise_lb_dirac( /* Perform STFT synthesis */ SynthesisSTFT_dirac( fftBuffer, tdBuffer + n_samples_start, hFdCngCom->olapBufferSynth2, hFdCngCom->olapWinSyn, n_samples_out_loop, hFdCngCom ); +#ifdef DEBUG_MODE_DIRAC + { + int16_t tmp[1000]; + + for ( i = 0; i < hFdCngCom->frameSize; i++ ) + { + tmp[i] = (int16_t) ( tdBuffer[i] + 0.5f ); + } + dbgwrite( tmp, sizeof( int16_t ), hFdCngCom->frameSize, 1, "./res/ivas_dirac_cna_fft.pcm" ); + } +#endif } else @@ -1904,6 +1925,17 @@ void generate_masking_noise_lb_dirac( /* Perform STFT synthesis */ SynthesisSTFT_dirac( fftBuffer, tdBuffer + n_samples_start, hFdCngCom->olapBufferSynth2, hFdCngCom->olapWinSyn, n_samples_out_loop, hFdCngCom ); +#ifdef DEBUG_MODE_DIRAC + { + int16_t tmp[1000]; + + for ( i = 0; i < hFdCngCom->frameSize; i++ ) + { + tmp[i] = (int16_t) ( tdBuffer[i] + 0.5f ); + } + dbgwrite( tmp, sizeof( int16_t ), hFdCngCom->frameSize, 1, "./res/ivas_dirac_cna_fft.pcm" ); + } +#endif } n_samples_out -= hFdCngCom->frameSize; n_samples_start += hFdCngCom->frameSize; @@ -1953,6 +1985,13 @@ void generate_masking_noise_dirac( set_zero( Cldfb_ImagBuffer, CLDFB_NO_CHANNELS_MAX ); /*LB CLDFB - CNA from STFT*/ +#ifdef DEBUG_MODE_DIRAC + { + int16_t tmp_s; + tmp_s = (int16_t) ( 32768.f * 0.5f * hFdCngCom->likelihood_noisy_speech * cna_flag + 0.5f ); + dbgwrite( &tmp_s, sizeof( int16_t ), 1, hFdCngCom->frameSize / 16, "./res/ivas_dirac_likelihood_noisy.pcm" ); + } +#endif if ( cna_flag ) { /* skip noise generating if level is very low, to avoid problems with possibly running into denormals */ diff --git a/lib_dec/gain_dec.c b/lib_dec/gain_dec.c index 2717abe0f..6f769dd6e 100644 --- a/lib_dec/gain_dec.c +++ b/lib_dec/gain_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_dec/gaus_dec.c b/lib_dec/gaus_dec.c index 141812b30..a05359772 100644 --- a/lib_dec/gaus_dec.c +++ b/lib_dec/gaus_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_dec/gs_dec.c b/lib_dec/gs_dec.c index ba9c574af..5ed7aa92c 100644 --- a/lib_dec/gs_dec.c +++ b/lib_dec/gs_dec.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_dec/gs_dec_amr_wb.c b/lib_dec/gs_dec_amr_wb.c index b0950b350..1d41f367f 100644 --- a/lib_dec/gs_dec_amr_wb.c +++ b/lib_dec/gs_dec_amr_wb.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_dec/hdecnrm.c b/lib_dec/hdecnrm.c index 215840996..1f247ef1f 100644 --- a/lib_dec/hdecnrm.c +++ b/lib_dec/hdecnrm.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "rom_com.h" diff --git a/lib_dec/hf_synth.c b/lib_dec/hf_synth.c index 5be0404f8..a4d75b4e9 100644 --- a/lib_dec/hf_synth.c +++ b/lib_dec/hf_synth.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_dec/hq_classifier_dec.c b/lib_dec/hq_classifier_dec.c index 920554280..10a1a783f 100644 --- a/lib_dec/hq_classifier_dec.c +++ b/lib_dec/hq_classifier_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "rom_com.h" diff --git a/lib_dec/hq_conf_fec.c b/lib_dec/hq_conf_fec.c index a35206441..7d3c79fcf 100644 --- a/lib_dec/hq_conf_fec.c +++ b/lib_dec/hq_conf_fec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_dec/hq_core_dec.c b/lib_dec/hq_core_dec.c index 99d74c63b..cdb960167 100644 --- a/lib_dec/hq_core_dec.c +++ b/lib_dec/hq_core_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_dec/hq_env_dec.c b/lib_dec/hq_env_dec.c index 74309410c..e584bfa82 100644 --- a/lib_dec/hq_env_dec.c +++ b/lib_dec/hq_env_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "rom_com.h" #include "wmc_auto.h" diff --git a/lib_dec/hq_hr_dec.c b/lib_dec/hq_hr_dec.c index 923d3b05e..5153af07e 100644 --- a/lib_dec/hq_hr_dec.c +++ b/lib_dec/hq_hr_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_dec/hq_lr_dec.c b/lib_dec/hq_lr_dec.c index 2d1ab7809..3b9ae0c6f 100644 --- a/lib_dec/hq_lr_dec.c +++ b/lib_dec/hq_lr_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_dec/igf_dec.c b/lib_dec/igf_dec.c index e5903902e..8095f6da4 100644 --- a/lib_dec/igf_dec.c +++ b/lib_dec/igf_dec.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "cnst.h" @@ -513,6 +516,9 @@ static void IGF_prepStereo( { for ( tb = swb_offset[sfb]; tb < swb_offset[sfb + 1]; tb++ ) { +#ifdef DEBUGGING + assert( strt_cpy < hGrid->swb_offset[0] ); +#endif if ( coreMsMask[tb] == 0 ) { @@ -595,6 +601,9 @@ static void IGF_prepStereo( { for ( tb = swb_offset[sfb]; tb < swb_offset[sfb + 1]; tb++ ) { +#ifdef DEBUGGING + assert( strt_cpy < hGrid->swb_offset[0] ); +#endif if ( coreMsMask[tb] == 0 ) { @@ -715,6 +724,10 @@ static void IGF_appl( lFactor = hGrid->lFactor; swb_offset = hGrid->swb_offset; +#ifdef DEBUGGING + /* make sure we don't read/write OOB for arrays whose size was reduced by IGF_START_MN to safe on memory */ + assert( swb_offset[start_sfb] >= IGF_START_MN ); +#endif /* collect energy below hGrid->startLine: */ for ( tb = hGrid->startLine - 24; tb < hGrid->startLine; tb++ ) diff --git a/lib_dec/igf_scf_dec.c b/lib_dec/igf_scf_dec.c index 11c6f0845..f152f637a 100644 --- a/lib_dec/igf_scf_dec.c +++ b/lib_dec/igf_scf_dec.c @@ -37,6 +37,9 @@ #include #include "options.h" #include "prot.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "stat_dec.h" #include "wmc_auto.h" diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index 6d2849841..ba18a8e85 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "ivas_cnst.h" #include "rom_com.h" diff --git a/lib_dec/inov_dec.c b/lib_dec/inov_dec.c index adbbb4fd3..43c7eb2c7 100644 --- a/lib_dec/inov_dec.c +++ b/lib_dec/inov_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "ivas_prot.h" diff --git a/lib_dec/ivas_agc_dec.c b/lib_dec/ivas_agc_dec.c index c41dedf21..9722514db 100644 --- a/lib_dec/ivas_agc_dec.c +++ b/lib_dec/ivas_agc_dec.c @@ -36,9 +36,15 @@ #include "ivas_prot.h" #include #include +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" +#ifdef DEBUG_AGC +extern FILE *agcIn; +#endif /*-----------------------------------------------------------------------------------------* * Function ivas_agc_dec_init() @@ -272,6 +278,20 @@ void ivas_agc_read_bits( } } +#ifdef DEBUG_AGC + FILE *stream = agcIn; + int16_t num_bits = 0, num_dmx_bits[4] = { 0 }; + for ( i = 0; i < n_channels; i++ ) + { + fread( &( pState->gain_data[i].absGainExpCurr ), sizeof( int32_t ), 1, stream ); /* n bits */ + num_bits += pState->agc_com.betaE; + num_dmx_bits[i]++; + + /*fprintf(stdout, "AbsGain[%d]:= %d[%d bits]; ", i, pState->gain_data[i].absGainExp, pState->betaE);*/ + } + /*fprintf(stdout, "AGC bits:= %d ", num_bits);*/ + +#endif return; } diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 77e01cd30..baef6cd93 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -42,6 +42,9 @@ #include "ivas_rom_dec.h" #include "ivas_rom_com.h" #include "ivas_rom_binauralRenderer.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -305,6 +308,12 @@ static ivas_error ivas_binRenderer_convModuleOpen( { tmp = channelIndex_CICP19[chIdx]; } +#ifdef DEBUGGING + else + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Channel configuration not specified!\n\n" ); + } +#endif } if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) @@ -319,6 +328,13 @@ static ivas_error ivas_binRenderer_convModuleOpen( hBinRenConvModule->filterTapsRightReal[bandIdx][chIdx] = hHrtf->rightBRIRReal[bandIdx][tmp]; hBinRenConvModule->filterTapsRightImag[bandIdx][chIdx] = hHrtf->rightBRIRImag[bandIdx][tmp]; } +#ifdef DEBUGGING + else + { + /* HOA3 filter coefficients */ + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: The tables corresponding to HOA3 for BRIR are missing \n\n" ); + } +#endif } else { @@ -1302,6 +1318,196 @@ void ivas_binaural_add_LFE( } +#ifdef DEBUGGING +/*-------------------------------------------------------------------------* + * ivas_binaural_cldfb() + * + * Perform CLDFB analysis, fastconv binaural rendering and CLDFB synthesis + *-------------------------------------------------------------------------*/ + +void ivas_binaural_cldfb( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ +) +{ + float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + int16_t slot_idx, subframeIdx, index_slot, idx_in, idx_lfe, maxBand, ch; + + /* Implement a 5 msec loops */ + maxBand = (int16_t) ( ( CLDFB_NO_CHANNELS_MAX * st_ivas->hDecoderConfig->output_Fs ) / 48000 ); + + for ( subframeIdx = 0; subframeIdx < ( CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES ); subframeIdx++ ) + { + for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) + { + index_slot = subframeIdx * MAX_PARAM_SPATIAL_SUBFRAMES + slot_idx; + + /* Implement CLDFB analysis */ + idx_in = 0; + idx_lfe = 0; + + for ( ch = 0; ch < ( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe ); ch++ ) + { + if ( ( st_ivas->hIntSetup.num_lfe > 0 ) && ( st_ivas->hIntSetup.index_lfe[idx_lfe] == ch ) ) + { + if ( idx_lfe < ( st_ivas->hIntSetup.num_lfe - 1 ) ) + { + idx_lfe++; + } + } + else + { + cldfbAnalysis_ts( &( output_f[ch][maxBand * index_slot] ), Cldfb_RealBuffer[idx_in][slot_idx], Cldfb_ImagBuffer[idx_in][slot_idx], maxBand, st_ivas->cldfbAnaDec[idx_in] ); + idx_in++; + } + } + } + + /* Implement binaural rendering */ + ivas_binRenderer( + st_ivas->hBinRenderer, + st_ivas->hCombinedOrientationData, + JBM_CLDFB_SLOTS_IN_SUBFRAME, +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + NULL, +#endif + Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, + Cldfb_RealBuffer, Cldfb_ImagBuffer ); + + + /* update combined orientation access index */ + ivas_combined_orientation_update_index( st_ivas->hCombinedOrientationData, maxBand * MAX_PARAM_SPATIAL_SUBFRAMES ); + + /* Implement CLDFB synthesis */ + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + + index_slot = subframeIdx * MAX_PARAM_SPATIAL_SUBFRAMES; + + for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) + { + RealBuffer[slot_idx] = Cldfb_RealBuffer_Binaural[ch][slot_idx]; + ImagBuffer[slot_idx] = Cldfb_ImagBuffer_Binaural[ch][slot_idx]; + } + + cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * maxBand] ), maxBand * MAX_PARAM_SPATIAL_SUBFRAMES, st_ivas->cldfbSynDec[ch] ); + } + } + + return; +} + + +/*-------------------------------------------------------------------------* + * ivas_binaural_cldfb_sf() + * + * Perform CLDFB analysis, fastconv binaural rendering and CLDFB synthesis + *-------------------------------------------------------------------------*/ + +void ivas_binaural_cldfb_sf( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t n_samples_to_render, /* i : output frame length per channel */ + const int16_t slot_size, /* i : JBM slot size */ + float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ +) +{ + float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + int16_t slot_idx, subframeIdx, index_slot, idx_in, idx_lfe, maxBand, ch; + int16_t slots_to_render, first_sf, last_sf; + int16_t slot_index_start, slot_index_start_cldfb; + + /* Implement a 5 msec loops */ + maxBand = (int16_t) ( ( CLDFB_NO_CHANNELS_MAX * st_ivas->hDecoderConfig->output_Fs ) / 48000 ); + + /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ + slots_to_render = min( st_ivas->hTcBuffer->num_slots - st_ivas->hTcBuffer->slots_rendered, n_samples_to_render / slot_size ); + first_sf = st_ivas->hTcBuffer->subframes_rendered; + last_sf = first_sf; + slot_index_start = st_ivas->hTcBuffer->slots_rendered; + slot_index_start_cldfb = 0; + st_ivas->hTcBuffer->slots_rendered += slots_to_render; + + while ( slots_to_render > 0 ) + { + slots_to_render -= st_ivas->hTcBuffer->subframe_nbslots[last_sf]; + last_sf++; + } + for ( subframeIdx = first_sf; subframeIdx < last_sf; subframeIdx++ ) + { + for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[subframeIdx]; slot_idx++ ) + { + index_slot = slot_index_start + slot_idx; + + /* Implement CLDFB analysis */ + idx_in = 0; + idx_lfe = 0; + + for ( ch = 0; ch < ( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe ); ch++ ) + { + if ( ( st_ivas->hIntSetup.num_lfe > 0 ) && ( st_ivas->hIntSetup.index_lfe[idx_lfe] == ch ) ) + { + if ( idx_lfe < ( st_ivas->hIntSetup.num_lfe - 1 ) ) + { + idx_lfe++; + } + } + else + { + cldfbAnalysis_ts( &( st_ivas->hTcBuffer->tc[ch][maxBand * index_slot] ), Cldfb_RealBuffer[idx_in][slot_idx], Cldfb_ImagBuffer[idx_in][slot_idx], maxBand, st_ivas->cldfbAnaDec[idx_in] ); + idx_in++; + } + } + + } + + /* Implement binaural rendering */ + ivas_binRenderer( + st_ivas->hBinRenderer, + st_ivas->hCombinedOrientationData, + st_ivas->hTcBuffer->subframe_nbslots[subframeIdx], +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + NULL, +#endif + Cldfb_RealBuffer_Binaural, + Cldfb_ImagBuffer_Binaural, + Cldfb_RealBuffer, + Cldfb_ImagBuffer ); + + + /* update combined orientation access index */ + ivas_combined_orientation_update_index( st_ivas->hCombinedOrientationData, maxBand * st_ivas->hTcBuffer->subframe_nbslots[subframeIdx] ); + + /* Implement CLDFB synthesis */ + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + + for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[subframeIdx]; slot_idx++ ) + { + RealBuffer[slot_idx] = Cldfb_RealBuffer_Binaural[ch][slot_idx]; + ImagBuffer[slot_idx] = Cldfb_ImagBuffer_Binaural[ch][slot_idx]; + } + + cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][slot_index_start_cldfb * maxBand] ), maxBand * st_ivas->hTcBuffer->subframe_nbslots[subframeIdx], st_ivas->cldfbSynDec[ch] ); + } + slot_index_start += st_ivas->hTcBuffer->subframe_nbslots[subframeIdx]; + slot_index_start_cldfb += st_ivas->hTcBuffer->subframe_nbslots[subframeIdx]; + } + + st_ivas->hTcBuffer->subframes_rendered = last_sf; + + return; +} +#endif /*------------------------------------------------------------------------- @@ -1314,6 +1520,9 @@ void ivas_binRenderer( BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle*/ const int16_t numTimeSlots, /* i : number of time slots to render */ +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + HEAD_TRACK_DATA_HANDLE hPostRendHeadTrackData, +#endif float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ float Cldfb_ImagBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index aa3c2a8c8..1e803dc03 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include #include "cnst.h" @@ -40,6 +43,9 @@ #include "ivas_prot.h" #include "ivas_rom_com.h" #include "wmc_auto.h" +#ifdef DEBUG_PLOT +#include "deb_out.h" +#endif /*-------------------------------------------------------------------* @@ -425,6 +431,9 @@ ivas_error ivas_core_dec( for ( n = 0; n < n_channels; n++ ) { +#ifdef DEBUG_PLOT + setDeboutVars( -1, -1, n, -1 ); +#endif st = sts[n]; /*---------------------------------------------------------------------* @@ -709,6 +718,9 @@ ivas_error ivas_core_dec( mvr2r( synth[n], output[n], output_frame ); +#ifdef DEBUG_PLOT + sendDebout( "mdct_dec", output_frame, 1, "aftLPD", MTV_FLOAT, output[n] ); +#endif /*--------------------------------------------------------* * Common updates *--------------------------------------------------------*/ @@ -722,9 +734,126 @@ ivas_error ivas_core_dec( } /* n_channels loop */ +#ifdef DEBUG_MODE_INFO + output_debug_mode_info_dec( sts, n_channels, output_frame, pitch_buf ); +#endif pop_wmops(); return error; } +#ifdef DEBUG_MODE_INFO +/*-------------------------------------------------------------------* + * output_debug_mode_info_dec() + * + * Debugging function to output most important codec parameters + *-------------------------------------------------------------------*/ + +void output_debug_mode_info_dec( + Decoder_State **sts, + const int16_t n_channels, + const int16_t output_frame, + float pitch_buf[CPE_CHANNELS][NB_SUBFR16k] ) +{ + int16_t n; + Decoder_State *st; + + for ( n = 0; n < n_channels; n++ ) + { + float tmpF; + int16_t tmpS, id; + + if ( pitch_buf == NULL ) + { + /* very first frame is lost */ + id = 0; + } + else + { + id = sts[n]->id_element; + } + + st = sts[n]; + + dbgwrite( &st->core, sizeof( int16_t ), 1, output_frame, fname( debug_dir, "core", n, id, DEC ) ); + dbgwrite( &st->extl, sizeof( int16_t ), 1, output_frame, fname( debug_dir, "extl", n, id, DEC ) ); + dbgwrite( &st->bwidth, sizeof( int16_t ), 1, output_frame, fname( debug_dir, "bwidth", n, id, DEC ) ); + dbgwrite( &st->cng_type, sizeof( int16_t ), 1, output_frame, fname( debug_dir, "cng_type", n, id, DEC ) ); + dbgwrite( &st->clas_dec, sizeof( int16_t ), 1, output_frame, fname( debug_dir, "clas", n, id, DEC ) ); + tmpF = st->extl_brate / 1000.0f; + dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "extl_brate", n, id, DEC ) ); + tmpF = st->core_brate / 1000.0f; + dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "core_brate", n, id, DEC ) ); + tmpF = st->total_brate / 1000.0f; + dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "total_brate", n, id, DEC ) ); + tmpS = st->bits_frame_nominal; + dbgwrite( &tmpS, sizeof( int16_t ), 1, output_frame, fname( debug_dir, "bits_nominal", n, id, DEC ) ); + +#ifdef DEBUG_MODE_INFO_PLC + dbgwrite( &st->last_core_bfi, sizeof( int16_t ), 1, output_frame, fname( debug_dir, "last_core_bfi", n, id, DEC ) ); + dbgwrite( &st->second_last_core, sizeof( int16_t ), 1, output_frame, fname( debug_dir, "second_last_core", n, id, DEC ) ); + dbgwrite( &st->con_tcx, sizeof( int16_t ), 1, output_frame, fname( debug_dir, "con_tcx", n, id, DEC ) ); + dbgwrite( &st->last_con_tcx, sizeof( int16_t ), 1, output_frame, fname( debug_dir, "last_con_tcx", n, id, DEC ) ); + dbgwrite( &st->prev_bfi, sizeof( int16_t ), 1, output_frame, fname( debug_dir, "prev_bfi", n, id, DEC ) ); + dbgwrite( &st->prev_old_bfi, sizeof( int16_t ), 1, output_frame, fname( debug_dir, "prev_old_bfi", n, id, DEC ) ); +#endif + + if ( pitch_buf != NULL ) + { + dbgwrite( &st->coder_type, sizeof( int16_t ), 1, output_frame, fname( debug_dir, "coder_type", n, id, DEC ) ); + } + else + { + tmpS = -1; + dbgwrite( &tmpS, sizeof( int16_t ), 1, output_frame, fname( debug_dir, "coder_type", n, id, DEC ) ); + } + + if ( st->hTcxCfg != NULL ) + tmpS = st->hTcxCfg->coder_type; + else + tmpS = -1; +#ifdef DEBUG_MODE_TCX + dbgwrite( &tmpS, sizeof( int16_t ), 1, output_frame, fname( debug_dir, "tcx_core_type", n, id, DEC ) ); +#endif + dbgwrite( &st->L_frame, sizeof( int16_t ), 1, output_frame, fname( debug_dir, "L_frame", n, id, DEC ) ); + dbgwrite( &st->VAD, 2, 1, output_frame, fname( debug_dir, "VAD", n, id, DEC ) ); + dbgwrite( &st->flag_cna, sizeof( int16_t ), 1, output_frame, fname( debug_dir, "cna_flag", n, id, DEC ) ); + +#if ( defined DEBUG_MODE_ACELP ) || ( defined DEBUG_MODE_TCX ) + if ( pitch_buf != NULL && st->core != HQ_CORE ) + { + int16_t i; + for ( i = 0; i < ( st->L_frame / L_SUBFR ); i++ ) + { + dbgwrite( &pitch_buf[n][i], sizeof( float ), 1, output_frame / ( st->L_frame / L_SUBFR ), fname( debug_dir, "pitch_buf", n, id, DEC ) ); + } + } + else + { + tmpF = 0; + dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "pitch_buf", n, id, DEC ) ); + } +#endif + +#ifdef DEBUG_MODE_ACELP + if ( st->core != ACELP_CORE ) + { + tmpF = 0.0f; + dbgwrite( &tmpF, sizeof( float ), 1, st->L_frame, fname( debug_dir, "exc", n, id, DEC ) ); + dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "output.Fs", n, id, DEC ) ); + dbgwrite( &tmpF, sizeof( float ), 1, min( st->L_frame, L_FRAME16k ), fname( debug_dir, "syn.intFs", n, id, DEC ) ); + } + + if ( sts[0]->element_mode == IVAS_CPE_DFT ) + { + tmpF = 0.0f; + dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "output.Fs", 1, id, DEC ) ); + dbgwrite( &tmpF, sizeof( float ), 1, L_FRAME, fname( debug_dir, "syn.intFs", 1, id, DEC ) ); + } +#endif + } + + return; +} +#endif diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index e8d73d28c..aaff963d5 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -35,6 +35,9 @@ #include "ivas_prot.h" #include "prot.h" #include +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 85c7b7a11..1972c3262 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -39,6 +39,9 @@ #include "prot.h" #include "ivas_prot.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" #include @@ -135,6 +138,9 @@ ivas_error ivas_cpe_dec( sts[n]->tdm_LRTD_flag = 0; } +#ifdef DEBUGGING + sts[n]->id_element = cpe_id + st_ivas->nSCE; +#endif /* TD stereo parameters */ if ( hCPE->hStereoTD != NULL ) { @@ -515,11 +521,14 @@ ivas_error ivas_cpe_dec( applyDmxMdctStereo( hCPE, output, output_frame ); } +#ifndef DEBUG_STEREO_DFT_OUTRESPRED /*----------------------------------------------------------------* * IC-BWE: output LB and HB mix in ACELP mode *----------------------------------------------------------------*/ +#ifndef DEBUG_STEREO_DFT_NOCORE stereo_icBWE_decproc( hCPE, output, outputHB, last_core, last_bwidth, output_frame ); +#endif smooth_dft2td_transition( hCPE, output, output_frame ); @@ -528,6 +537,7 @@ ivas_error ivas_cpe_dec( *----------------------------------------------------------------*/ stereo_tca_dec( hCPE, output, output_frame ); +#endif /*----------------------------------------------------------------* * Common Stereo updates @@ -549,6 +559,36 @@ ivas_error ivas_cpe_dec( st_ivas->BER_detect |= sts[0]->BER_detect; st_ivas->BER_detect |= sts[1]->BER_detect; +#ifdef DEBUG_MODE_INFO + { + float tmpF = hCPE->element_brate / 1000.0f; + + n = 1; + if ( st_ivas->ini_frame == 0 && frame > 0 ) + { + /* in case first frame(s) is/are lost, write info several times */ + n = (int16_t) frame - st_ivas->ini_frame + 1; + } + + for ( i = 0; i < n; i++ ) + { + dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "element_brate", 0, cpe_id, DEC ) ); + dbgwrite( &hCPE->element_mode, sizeof( int16_t ), 1, output_frame, fname( debug_dir, "element_mode", 0, cpe_id, DEC ) ); + + for ( int16_t j = 0; j < CPE_CHANNELS; j++ ) + { + dbgwrite( output[j], sizeof( float ), output_frame, 1, fname( debug_dir, "output.cpe", j, cpe_id, DEC ) ); + } + + if ( st_ivas->ivas_format != MASA_ISM_FORMAT ) + { + tmpF = 0; + dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "output.sce", 0, cpe_id, DEC ) ); + dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "output.mct", 0, cpe_id, DEC ) ); + } + } + } +#endif pop_wmops(); return error; diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index e32a69539..aeb2b1d06 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -39,6 +39,9 @@ #include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_dec/ivas_decision_matrix_dec.c b/lib_dec/ivas_decision_matrix_dec.c index 0134e2ef6..ba53de1da 100644 --- a/lib_dec/ivas_decision_matrix_dec.c +++ b/lib_dec/ivas_decision_matrix_dec.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "stat_dec.h" #include "rom_com.h" #include "ivas_prot.h" diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 348a5ed5f..725ea879b 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -42,6 +42,9 @@ #include "ivas_rom_com.h" #include "ivas_rom_dec.h" #include "ivas_rom_rend.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -1023,6 +1026,9 @@ void ivas_dirac_dec_read_BS( *nb_bits += ivas_qmetadata_dec_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), hodirac_flag ); } +#ifdef DEBUGGING + assert( *nb_bits >= 0 ); +#endif st->next_bit_pos = next_bit_pos_orig; } @@ -1299,6 +1305,9 @@ void ivas_qmetadata_to_dirac( qBand_idx = band; } diffuseness = 1.0f - q_direction->band_data[qBand_idx].energy_ratio[0]; +#ifdef DEBUG_MODE_DIRAC + dbgwrite( &diffuseness, sizeof( float ), 1, 1, "./res/dirac_dec_diffuseness.dat" ); +#endif diff_idx = q_direction->band_data[qBand_idx].energy_ratio_index[0]; for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) @@ -1442,6 +1451,9 @@ void ivas_dirac_dec_set_md_map( hDirAC = st_ivas->hDirAC; hSpatParamRendCom = st_ivas->hSpatParamRendCom; +#ifdef DEBUGGING + assert( hSpatParamRendCom ); +#endif /* adapt subframes */ hSpatParamRendCom->num_slots = nCldfbTs; @@ -1524,6 +1536,9 @@ void ivas_dirac_dec_render( hSpatParamRendCom = st_ivas->hSpatParamRendCom; nchan_intern = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; +#ifdef DEBUGGING + assert( hSpatParamRendCom ); +#endif for ( ch = 0; ch < nchan_intern; ch++ ) { output_f_local[ch] = output_f_local_buff[ch]; @@ -1543,6 +1558,9 @@ void ivas_dirac_dec_render( last_sf++; } +#ifdef DEBUGGING + assert( slots_to_render == 0 ); +#endif for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { ivas_dirac_dec_render_sf( st_ivas, output_f_local, nchan_transport, NULL, NULL ); @@ -1651,6 +1669,23 @@ void ivas_dirac_dec_render_sf( coherence_flag = 0; } +#ifdef DEBUG_MODE_DIRAC + { + int16_t n, tmp[IVAS_SPAR_MAX_CH * L_FRAME48k]; + char file_name[50] = { 0 }; + const int16_t output_frame = st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC; + + for ( n = 0; n < nchan_transport; n++ ) + { + for ( i = 0; i < output_frame; i++ ) + { + tmp[nchan_transport * i + n] = (int16_t) ( output_f[n][i] + 0.5f ); + } + } + sprintf( file_name, "./res/ivas_dirac_dec_DMX%d.%d.pcm", nchan_transport, (int16_t) ( output_frame * 0.05 ) ); + dbgwrite( tmp, sizeof( int16_t ), nchan_transport * output_frame, 1, file_name ); + } +#endif /* Subframe loop */ slot_idx_start = hSpatParamRendCom->slots_rendered; @@ -1993,6 +2028,53 @@ void ivas_dirac_dec_render_sf( computeDiffuseness( hDirACRend->buffer_intensity_real, hDirACRend->buffer_energy, num_freq_bands, hSpatParamRendCom->diffuseness_vector[md_idx] ); } +#ifdef DEBUG_MODE_DIRAC + { + static FILE *fp_direction_vector = NULL, *fp_diffuseness = NULL, *fp_referencePower = NULL; + + + if ( fp_direction_vector == NULL ) + fp_direction_vector = fopen( "./res/dbg_direction_vector_C_dec.bin", "wb" ); + if ( fp_diffuseness == NULL ) + fp_diffuseness = fopen( "./res/dbg_diffuseness_C_dec.bin", "wb" ); + if ( fp_referencePower == NULL ) + fp_referencePower = fopen( "./res/dbg_reference_power_C_dec.bin", "wb" ); + + + for ( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) + { + float radius_length; + float dv[3]; + + if ( hDirAC->hConfig->dec_param_estim == FALSE ) + { + radius_length = cos( hDirAC->elevation[subframe_idx][i] * PI_OVER_180 ); + dv[0] = radius_length * cos( hDirAC->azimuth[subframe_idx][i] * PI_OVER_180 ); + dv[1] = radius_length * sin( hDirAC->azimuth[subframe_idx][i] * PI_OVER_180 ); + dv[2] = sin( hDirAC->elevation[subframe_idx][i] * PI_OVER_180 ); + + fwrite( dv, sizeof( float ), 3, fp_direction_vector ); + fwrite( &( hDirAC->diffuseness_vector[0][i] ), sizeof( float ), 1, fp_diffuseness ); + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + reference_power[i] = Cldfb_RealBuffer[0][0][i] * Cldfb_RealBuffer[0][0][i] + Cldfb_ImagBuffer[0][0][i] * Cldfb_ImagBuffer[0][0][i]; + } + fwrite( &( reference_power[i] ), sizeof( float ), 1, fp_referencePower ); + } + else + { + radius_length = cos( hDirAC->elevation[index_slot][i] * PI_OVER_180 ); + dv[0] = radius_length * cos( hDirAC->azimuth[index_slot][i] * PI_OVER_180 ); + dv[1] = radius_length * sin( hDirAC->azimuth[index_slot][i] * PI_OVER_180 ); + dv[2] = sin( hDirAC->elevation[index_slot][i] * PI_OVER_180 ); + + fwrite( dv, sizeof( float ), 3, fp_direction_vector ); + fwrite( &( hDirAC->diffuseness_vector[index_slot][i] ), sizeof( float ), 1, fp_diffuseness ); + fwrite( &( reference_power[i] ), sizeof( float ), 1, fp_referencePower ); + } + } + } +#endif /*-----------------------------------------------------------------* * frequency domain decorrelation @@ -2249,6 +2331,9 @@ void ivas_dirac_dec_render_sf( st_ivas->hCombinedOrientationData, hSpatParamRendCom->subframe_nbslots[subframe_idx], +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + NULL, +#endif Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); /* Inverse CLDFB*/ diff --git a/lib_dec/ivas_dirac_output_synthesis_cov.c b/lib_dec/ivas_dirac_output_synthesis_cov.c index 092ffe411..d71d81655 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov.c @@ -45,6 +45,9 @@ #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "ivas_rom_dec.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" #include "rom_dec.h" diff --git a/lib_dec/ivas_entropy_decoder.c b/lib_dec/ivas_entropy_decoder.c index 360dfbe87..bf91f3e69 100644 --- a/lib_dec/ivas_entropy_decoder.c +++ b/lib_dec/ivas_entropy_decoder.c @@ -35,6 +35,9 @@ #include "prot.h" #include "ivas_prot.h" #include "ivas_cnst.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "ivas_rom_com.h" #include #include "wmc_auto.h" diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index d23a36417..d93bc9dd3 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -40,6 +40,9 @@ #include #include #include +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -715,6 +718,11 @@ ivas_error ivas_init_decoder_front( /* HRTF binauralization latency in ns */ st_ivas->binaural_latency_ns = 0; +#ifdef DEBUGGING + st_ivas->noClipping = 0; + + st_ivas->hDecoderConfig->force_rend = -1; +#endif /*-------------------------------------------------------------------* * Allocate and initialize Custom loudspeaker layout handle *--------------------------------------------------------------------*/ @@ -1604,6 +1612,12 @@ ivas_error ivas_init_decoder( } } } +#ifdef DEBUGGING + else + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Invalid IVAS format. Exiting,\n" ); + } +#endif /*-----------------------------------------------------------------* @@ -2725,6 +2739,17 @@ static ivas_error doSanityChecks_IVAS( } } +#ifdef DEBUGGING + if ( ( st_ivas->hDecoderConfig->force_rend == FORCE_TD_RENDERER ) && ( ( st_ivas->ivas_format != MC_FORMAT && st_ivas->ivas_format != ISM_FORMAT ) || ( output_config != IVAS_AUDIO_CONFIG_BINAURAL && output_config != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode != MC_MODE_MCT ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration: Time Domain object renderer not supported in this configuration" ); + } + + if ( ( st_ivas->hHrtfTD != NULL && st_ivas->hDecoderConfig->force_rend == FORCE_CLDFB_RENDERER ) ) + { + return IVAS_ERROR( IVAS_ERR_INVALID_FORCE_MODE, "Incorrect debug configuration: Cannot force CLDFB renderer in combination with TD renderer HRTF file" ); + } +#endif return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index d784324e9..d7c0d4086 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -35,6 +35,9 @@ #include "prot.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" /*-------------------------------------------------------------------------* diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index 998dc97ee..523002e74 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -35,6 +35,9 @@ #include "options.h" #include "ivas_prot.h" #include "prot.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index c4b07078d..bde79fcb5 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -38,6 +38,9 @@ #include "prot.h" #include "ivas_stat_enc.h" #include +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 9f48c82e1..ee0b86682 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -39,6 +39,9 @@ #include "prot.h" #include "ivas_rom_com.h" #include "ivas_rom_dec.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -1405,6 +1408,10 @@ void ivas_param_ism_dec_render( hParamIsmDec = st_ivas->hParamIsmDec; hSpatParamRendCom = st_ivas->hSpatParamRendCom; hSetup = st_ivas->hIntSetup; +#ifdef DEBUGGING + assert( hParamIsmDec ); + assert( hSpatParamRendCom ); +#endif nchan_transport = st_ivas->nchan_transport; if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) { @@ -1430,6 +1437,9 @@ void ivas_param_ism_dec_render( slots_to_render -= hSpatParamRendCom->subframe_nbslots[last_sf]; last_sf++; } +#ifdef DEBUGGING + assert( slots_to_render == 0 ); +#endif for ( ch = 0; ch < nchan_out; ch++ ) { diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 767144ddb..ab922db4c 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -40,6 +40,9 @@ #include "ivas_rom_com.h" #include "ivas_rom_dec.h" #include +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 8673c8259..fbebfd225 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -40,6 +40,9 @@ #include "ivas_prot_rend.h" #include "ivas_rom_com.h" #include +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -120,6 +123,12 @@ ivas_error ivas_jbm_dec_tc( set_f( p_output[n], 0.0f, output_frame ); } +#ifdef DEBUG_MODE_INFO + create_sce_dec( st_ivas, 0, ivas_total_brate ); + output_debug_mode_info_dec( st_ivas->hSCE[0]->hCoreCoder, 1, output_frame, NULL ); + destroy_sce_dec( st_ivas->hSCE[0] ); + st_ivas->hSCE[0] = NULL; +#endif } else if ( st_ivas->ivas_format == STEREO_FORMAT ) { @@ -252,6 +261,10 @@ ivas_error ivas_jbm_dec_tc( } } +#ifdef DEBUG_SBA_AUDIO_DUMP + /* Dump audio signal after core-decoding */ + ivas_spar_dump_signal_wav( output_frame, NULL, output, st_ivas->nchan_transport, spar_foa_dec_wav[0], "core-decoding" ); +#endif /* TCs remapping */ nchan_remapped = st_ivas->nchan_transport; if ( st_ivas->sba_dirac_stereo_flag ) @@ -278,10 +291,12 @@ ivas_error ivas_jbm_dec_tc( } /* HP filtering */ +#ifndef DEBUG_SPAR_BYPASS_EVS_CODEC for ( n = 0; n < nchan_remapped; n++ ) { hp20( p_output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); } +#endif if ( st_ivas->ivas_format == SBA_FORMAT ) { @@ -465,6 +480,20 @@ ivas_error ivas_jbm_dec_tc( nchan_remapped = ivas_sba_remapTCs( &p_output[sba_ch_idx], st_ivas, output_frame ); +#ifdef DEBUG_OSBA + if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + { + int16_t nchan = st_ivas->nchan_transport + st_ivas->nchan_ism; + for ( int16_t t = 0; t < output_frame; t++ ) + { + for ( int16_t c = 0; c < nchan; c++ ) + { + int16_t val = (int16_t) ( output[c][t] + 0.5f ); + dbgwrite( &val, sizeof( int16_t ), 1, 1, "./res/TC_dec_core_out.raw" ); + } + } + } +#endif if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) { num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); @@ -718,6 +747,14 @@ ivas_error ivas_jbm_dec_tc( st_ivas->last_ivas_format = st_ivas->ivas_format; +#ifdef DEBUG_MODE_INFO + dbgwrite( &st_ivas->bfi, sizeof( int16_t ), 1, output_frame, "res/bfi" ); + dbgwrite( &st_ivas->BER_detect, sizeof( int16_t ), 1, output_frame, "res/BER_detect" ); + { + float tmpF = ivas_total_brate / 1000.0f; + dbgwrite( &tmpF, sizeof( float ), 1, output_frame, "res/ivas_total_brate.dec" ); + } +#endif pop_wmops(); return IVAS_ERR_OK; @@ -1029,6 +1066,12 @@ ivas_error ivas_jbm_dec_render( return error; } } +#ifdef DEBUGGING + else if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { + ivas_binaural_cldfb_sf( st_ivas, *nSamplesRendered, st_ivas->hTcBuffer->nb_subframes, p_output ); + } +#endif } } else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) @@ -1167,6 +1210,9 @@ ivas_error ivas_jbm_dec_render( if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) { +#ifdef DEBUGGING + assert( st_ivas->ism_mode == ISM_MODE_NONE ); +#endif for ( n = st_ivas->hIntSetup.nchan_out_woLFE - 1; n >= 0; n-- ) { mvr2r( p_output[n], p_output[n + st_ivas->nchan_ism], *nSamplesRendered ); @@ -1342,6 +1388,9 @@ ivas_error ivas_jbm_dec_render( } } +#ifdef DEBUGGING + st_ivas->noClipping += +#endif ivas_syn_output( p_output, *nSamplesRendered, nchan_out, data ); @@ -1529,6 +1578,9 @@ ivas_error ivas_jbm_dec_flush_renderer( last_spar_md_idx = st_ivas->hSpar->render_to_md_map[st_ivas->hSpar->slots_rendered - 1]; last_dirac_md_idx = st_ivas->hSpatParamRendCom->render_to_md_map[st_ivas->hSpatParamRendCom->slots_rendered - 1]; +#ifdef DEBUGGING + assert( ism_mode_old == ISM_SBA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ); +#endif /* copy from ISM delay buffer to the correct place in tcs */ for ( ch_idx = 0; ch_idx < st_ivas->nchan_ism; ch_idx++ ) { @@ -1582,6 +1634,9 @@ ivas_error ivas_jbm_dec_flush_renderer( } } +#ifdef DEBUGGING + st_ivas->noClipping += +#endif ivas_syn_output( p_output, *nSamplesRendered, st_ivas->hDecoderConfig->nchan_out, data ); @@ -1630,6 +1685,9 @@ void ivas_jbm_dec_get_adapted_linear_interpolator( { int16_t jbm_segment_len, idx; float dec; +#ifdef DEBUGGING + assert( default_interp_length % 2 == 0 ); +#endif jbm_segment_len = ( default_interp_length >> 1 ); dec = 1.0f / default_interp_length; @@ -1720,6 +1778,9 @@ void ivas_jbm_dec_get_md_map( int16_t jbm_segment_len, map_idx, src_idx, src_idx_map; float dec, src_idx_f; +#ifdef DEBUGGING + assert( default_len % 2 == 0 ); +#endif jbm_segment_len = ( default_len >> 1 ); dec = 1.0f / default_len; @@ -2207,9 +2268,24 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( /* if granularity changes, adapt subframe_nb_slots */ if ( n_samples_granularity != hTcBuffer->n_samples_granularity ) { +#ifdef DEBUGGING + int16_t nMaxSlotsPerSubframeOld; +#endif int16_t nMaxSlotsPerSubframeNew; nMaxSlotsPerSubframeNew = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ) / n_samples_granularity; +#ifdef DEBUGGING + nMaxSlotsPerSubframeOld = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ) / st_ivas->hTcBuffer->n_samples_granularity; + assert( hTcBuffer->subframe_nbslots[hTcBuffer->subframes_rendered - 1] == nMaxSlotsPerSubframeOld ); + if ( n_samples_granularity < hTcBuffer->n_samples_granularity ) + { + assert( ( hTcBuffer->n_samples_granularity % n_samples_granularity ) == 0 ); + } + else + { + assert( ( n_samples_granularity % hTcBuffer->n_samples_granularity ) == 0 ); + } +#endif /* if samples were flushed, take that into account here */ if ( n_samples_granularity < hTcBuffer->n_samples_granularity && hTcBuffer->n_samples_flushed > 0 ) { @@ -2229,6 +2305,10 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( nchan_residual = nchan_transport_internal - nchan_full; hTcBuffer->n_samples_granularity = n_samples_granularity; +#ifdef DEBUGGING + /* what is remaining from last frames needs always be smaller than n_samples_granularity */ + assert( ( hTcBuffer->n_samples_buffered - hTcBuffer->n_samples_rendered ) < n_samples_granularity ); +#endif /* realloc buffers */ if ( hTcBuffer->tc_buffer != NULL ) { @@ -2496,6 +2576,10 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode( buffer_mode = TC_BUFFER_MODE_RENDERER; } break; +#ifdef DEBUGGING + default: + assert( 0 ); +#endif } return buffer_mode; @@ -2559,6 +2643,12 @@ void ivas_jbm_dec_copy_tc_no_tsm( cldfb_imag_buffer = st_ivas->hParamMC->Cldfb_ImagBuffer_tc; num_freq_bands = st_ivas->hParamMC->num_freq_bands; } +#ifdef DEBUGGING + else + { + assert( 0 && "Residual (direct CLDFB transport channels) only possible for ParamMC/ParamISM!" ); + } +#endif /* CLDFB Analysis*/ for ( cldfb_ch = 0; cldfb_ch < n_ch_cldfb; cldfb_ch++, ch_idx++ ) diff --git a/lib_dec/ivas_lfe_dec.c b/lib_dec/ivas_lfe_dec.c index 441b33356..63899b107 100644 --- a/lib_dec/ivas_lfe_dec.c +++ b/lib_dec/ivas_lfe_dec.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "ivas_prot.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_lfe_plc.c b/lib_dec/ivas_lfe_plc.c index d973dc4a0..491121af3 100644 --- a/lib_dec/ivas_lfe_plc.c +++ b/lib_dec/ivas_lfe_plc.c @@ -36,6 +36,9 @@ #include "ivas_prot.h" #include "ivas_rom_com.h" #include +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" /*------------------------------------------------------------------------------------------* diff --git a/lib_dec/ivas_ls_custom_dec.c b/lib_dec/ivas_ls_custom_dec.c index e926b1fbe..71e8bd229 100644 --- a/lib_dec/ivas_ls_custom_dec.c +++ b/lib_dec/ivas_ls_custom_dec.c @@ -33,6 +33,9 @@ #include "options.h" #include "ivas_prot.h" #include "prot.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 0eb9691b1..d9369f317 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -39,6 +39,9 @@ #include "ivas_rom_com.h" #include "ivas_stat_dec.h" #include "prot.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "wmc_auto.h" diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 5536baa14..0034a2810 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -43,6 +43,12 @@ #include "ivas_rom_com.h" #include "ivas_rom_dec.h" #include "math.h" +#ifdef DEBUGGING +#include "debug.h" +#endif +#ifdef DEBUG_PLOT +#include "deb_out.h" +#endif #include "wmc_auto.h" #include "rom_dec.h" @@ -205,6 +211,10 @@ ivas_error ivas_param_mc_dec_open( st_ivas->element_mode_init = IVAS_CPE_MDCT; break; +#ifdef DEBUGGING + default: + assert( 0 && "Number of TC not supported for Parametric MC!" ); +#endif } /*-----------------------------------------------------------------* @@ -602,6 +612,10 @@ ivas_error ivas_param_mc_dec_reconfig( st_ivas->element_mode_init = IVAS_CPE_MDCT; break; +#ifdef DEBUGGING + default: + assert( 0 && "Number of TC not supported for Parametric MC!" ); +#endif } /*-----------------------------------------------------------------* @@ -615,6 +629,9 @@ ivas_error ivas_param_mc_dec_reconfig( for ( k = 0; k < 2; k++ ) { +#ifdef DEBUGGING + assert( hParamMC->hMetadataPMC->icc_map_full[k] != NULL ); +#endif if ( hParamMC->hMetadataPMC->icc_map_full[k] != NULL ) { free( hParamMC->hMetadataPMC->icc_map_full[k] ); @@ -1039,6 +1056,12 @@ int16_t param_mc_get_num_cldfb_syntheses( { num_cldfb_syntheses = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; } +#ifdef DEBUGGING + else + { + assert( 0 && "Renderer settings not valid for ParamMC!\n" ); + } +#endif return num_cldfb_syntheses; } @@ -1622,6 +1645,9 @@ void ivas_param_mc_dec_render( slots_to_render -= hParamMC->subframe_nbslots[last_sf]; last_sf++; } +#ifdef DEBUGGING + assert( slots_to_render == 0 ); +#endif if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) @@ -1842,6 +1868,10 @@ void ivas_param_mc_dec( nSamplesAsked = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); ivas_param_mc_dec_digest_tc( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS, output_f ); ivas_param_mc_dec_render( st_ivas, nSamplesAsked, &nSamplesRendered, &nSamplesAvailableNext, output_f ); +#ifdef DEBUGGING + assert( nSamplesRendered == nSamplesAsked ); + assert( nSamplesAvailableNext == 0 ); +#endif /* set handle pointers back to NULL */ hParamMC->Cldfb_RealBuffer_tc = NULL; @@ -1889,6 +1919,9 @@ static void ivas_param_mc_dec_init( if ( hParamMC->band_grouping[k] <= hParamMC->max_band_decorr ) { max_param_band_residual = k; +#ifdef DEBUGGING + assert( hParamMC->band_grouping[k] == hParamMC->max_band_decorr ); +#endif break; } } @@ -2249,6 +2282,9 @@ static void ivas_param_mc_get_mixing_matrices( if ( hSynthesisOutputSetup->num_lfe ) { float *proto_matrix_ptr_in; +#ifdef DEBUGGING + assert( ( nY_cov == ( hSynthesisOutputSetup->nchan_out_woLFE + hSynthesisOutputSetup->num_lfe ) ) && "Number of channels do not match!" ); +#endif for ( lfe_idx1 = 0; lfe_idx1 < hSynthesisOutputSetup->num_lfe; lfe_idx1++ ) { lfe_indices[lfe_idx1 + 1] = hSynthesisOutputSetup->index_lfe[lfe_idx1]; diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index d98788695..f31a8ef5d 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -41,6 +41,12 @@ #include "ivas_rom_com.h" #include "ivas_rom_dec.h" #include "math.h" +#ifdef DEBUGGING +#include "debug.h" +#endif +#ifdef DEBUG_PLOT +#include "deb_out.h" +#endif #include "wmc_auto.h" #include "rom_dec.h" @@ -228,6 +234,9 @@ void ivas_mc_paramupmix_dec_render( slots_to_render -= st_ivas->hTcBuffer->subframe_nbslots[last_sf]; last_sf++; } +#ifdef DEBUGGING + assert( slots_to_render == 0 ); +#endif { for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ ) @@ -303,6 +312,10 @@ ivas_error ivas_mc_paramupmix_dec_open( st_ivas->nSCE = 0; st_ivas->element_mode_init = IVAS_CPE_MDCT; break; +#ifdef DEBUGGING + default: + assert( 0 && "Number of TC not supported for MC ParamUpmix!" ); +#endif } hMCParamUpmix->hoa_encoder = NULL; diff --git a/lib_dec/ivas_mcmasa_dec.c b/lib_dec/ivas_mcmasa_dec.c index 832572ded..14db85a00 100644 --- a/lib_dec/ivas_mcmasa_dec.c +++ b/lib_dec/ivas_mcmasa_dec.c @@ -36,6 +36,9 @@ #include "ivas_prot.h" #include "ivas_prot_rend.h" #include "prot.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_dec/ivas_mct_core_dec.c b/lib_dec/ivas_mct_core_dec.c index 7364813ff..faffe1a1b 100644 --- a/lib_dec/ivas_mct_core_dec.c +++ b/lib_dec/ivas_mct_core_dec.c @@ -35,6 +35,9 @@ #include "options.h" #include "prot.h" #include "rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" #include "cnst.h" #include "basop_proto_func.h" diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 0212b00b5..ec4c0dbbe 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -41,7 +41,13 @@ #include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" +#ifdef DEBUG_PLOT +#include "deb_out.h" +#endif /*-----------------------------------------------------------------------* @@ -248,6 +254,9 @@ ivas_error ivas_mct_dec( /* CoreCoder common updates */ updt_dec_common( sts[n], NORMAL_HQ_CORE, -1, output[cpe_id * CPE_CHANNELS + n] ); +#ifdef DEBUG_PLOT + sendDebout( "mct_synth", output_frame, 1, "aftPostPro", MTV_FLOAT, output[cpe_id * CPE_CHANNELS + n] ); +#endif } /* n_channels loop */ @@ -257,6 +266,13 @@ ivas_error ivas_mct_dec( synchro_synthesis( ivas_total_brate, hCPE, output + cpe_id * CPE_CHANNELS, output_frame, 0 ); } +#ifdef DEBUG_PLOT + for ( n = 0; n < CPE_CHANNELS; n++ ) + { + setDeboutVars( -1, -1, n, cpe_id ); + sendDebout( "mct_synth", output_frame, 1, "aftSynchro", MTV_FLOAT, output[cpe_id * CPE_CHANNELS + n] ); + } +#endif } /* move channels after LFE to correct output for multi-channel MCT */ @@ -277,6 +293,18 @@ ivas_error ivas_mct_dec( mvr2r( output_lfe_ch, output[LFE_CHANNEL], output_frame ); } +#ifdef DEBUG_MODE_INFO + for ( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) + { + float tmpF = st_ivas->hCPE[cpe_id]->element_brate / 1000.0f; + dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "element_brate", 0, cpe_id, DEC ) ); + + dbgwrite( output[0], sizeof( float ), output_frame, 1, fname( debug_dir, "output.mct", 0, cpe_id, DEC ) ); + tmpF = 0; + dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "output.sce", 0, cpe_id, DEC ) ); + dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "output.cpe", 0, cpe_id, DEC ) ); + } +#endif pop_wmops(); return error; @@ -843,6 +871,12 @@ static ivas_error ivas_mc_dec_reconfig( return error; } } +#ifdef DEBUGGING + else + { + assert( 0 ); + } +#endif } else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) { @@ -1199,7 +1233,18 @@ static ivas_error ivas_mc_dec_reconfig( /* LS */ else if ( output_config == IVAS_AUDIO_CONFIG_5_1 || output_config == IVAS_AUDIO_CONFIG_5_1_2 || output_config == IVAS_AUDIO_CONFIG_5_1_4 || output_config == IVAS_AUDIO_CONFIG_7_1 || output_config == IVAS_AUDIO_CONFIG_7_1_4 || output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { +#ifdef DEBUGGING + assert( st_ivas->renderer_type == RENDERER_MC || st_ivas->renderer_type == RENDERER_MC_PARAMMC || st_ivas->renderer_type == RENDERER_DIRAC || st_ivas->renderer_type == RENDERER_DISABLE ); +#endif + } +#ifdef DEBUGGING + else if ( output_config == IVAS_AUDIO_CONFIG_FOA || output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_HOA3 ) + { + /* FOA/HOA output */ + /* Nothing to do, renderer is always RENDERER_SBA_LINEAR_ENC */ + assert( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC && renderer_type_old == RENDERER_SBA_LINEAR_ENC ); } +#endif } /*-----------------------------------------------------------------* diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index 7209018d1..eb816509f 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -36,6 +36,9 @@ #include "prot.h" #include "rom_com.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" #include "cnst.h" #include "basop_proto_func.h" @@ -106,6 +109,12 @@ static void dec_prm_tcx_sidebits( { CONTEXT_HM_CONFIG hm_cfg; int16_t start_bit_pos; +#ifdef DEBUG_MODE_TCX + int16_t bits_common; + static FILE *pF = NULL; + if ( pF == NULL ) + pF = fopen( "./res/stereo_tcx_dec_ind.txt", "w" ); +#endif /*--------------------------------------------------------------------------------* * Initialization @@ -214,12 +223,21 @@ static void dec_prm_tcx_spec( int16_t target_bitsTCX10[NB_DIV]; int16_t indexBuffer[N_MAX + 1]; CONTEXT_HM_CONFIG hm_cfg; +#ifdef DEBUG_MODE_TCX + static FILE *pF = NULL; + if ( pF == NULL ) + pF = fopen( "./res/stereo_tcx_dec_ind.txt", "w" ); +#endif /*--------------------------------------------------------------------------------* * Initialization *--------------------------------------------------------------------------------*/ hm_cfg.indexBuffer = indexBuffer; +#ifdef DEBUG_MODE_TCX + fprintf( pF, "== stereo Chan %d - Nominal Bits %d - Allocated Bits %d ==\n", st->idchan, st->bits_frame_nominal, (int16_t) ( st->total_brate / FRAMES_PER_SEC ) ); + fprintf( pF, "stereo Common Header: %d bits\n", st->next_bit_pos ); +#endif start_bit_pos = st->next_bit_pos; @@ -923,6 +941,34 @@ void ivas_mdct_core_reconstruct( mvr2r( synthFB, signal_outFB[ch], st->hTcxDec->L_frameTCX ); } +#ifdef DEBUG_PLC_INFO + { + int16_t i; + int16_t tmp[L_FRAME48k]; + static FILE *sP = NULL; + + for ( i = 0; i < st->hTcxDec->L_frameTCX; i++ ) + { + tmp[i] = (int16_t) ( signal_outFB[ch][i] + 0.5f ); + } + if ( ch == 0 ) + { + dbgwrite( tmp, sizeof( int16_t ), st->hTcxDec->L_frameTCX, 1, "./res/mdct_stereo_dec_synthFB_ch0.pcm" ); +#ifndef DEBUG_MODE_INFO + dbgwrite( &st->bfi, sizeof( int16_t ), 1, st->hTcxDec->L_frameTCX, "./res/bfi.pcm" ); +#endif + dbgwrite( &st->tonal_mdct_plc_active, sizeof( int16_t ), 1, L_frameTCX[ch], "./res/tonal_mdct_active_ch0.pcm" ); + dbgwrite( &st->tonal_mdct_plc_active, sizeof( int16_t ), 1, L_frameTCX[ch], "./res/tonal_mdct_active_ch0.pcm" ); + dbgwrite( &st->con_tcx, sizeof( int16_t ), 1, 640, "./res/con_tcx_ch0.pcm" ); + } + else + { + dbgwrite( tmp, sizeof( int16_t ), st->hTcxDec->L_frameTCX, 1, "./res/mdct_stereo_dec_synthFB_ch1.pcm" ); + dbgwrite( &st->tonal_mdct_plc_active, sizeof( int16_t ), 1, L_frameTCX[ch], "./res/tonal_mdct_active_ch1.pcm" ); + dbgwrite( &st->con_tcx, sizeof( int16_t ), 1, 640, "./res/con_tcx_ch1.pcm" ); + } + } +#endif /* updates */ st->last_voice_factor = 0.0f; diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index c05cd617a..4f3300572 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -37,6 +37,9 @@ #include "ivas_prot_rend.h" #include #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 6bf9cdfdd..af5d116a6 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -37,6 +37,9 @@ #include "prot.h" #include "ivas_prot_rend.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index 903839686..d05bf0a46 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -37,6 +37,9 @@ #include "prot.h" #include "ivas_prot_rend.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_dec/ivas_out_setup_conversion.c b/lib_dec/ivas_out_setup_conversion.c index e1d0c12e5..d622e4cf1 100644 --- a/lib_dec/ivas_out_setup_conversion.c +++ b/lib_dec/ivas_out_setup_conversion.c @@ -39,6 +39,9 @@ #include "ivas_prot_rend.h" #include "ivas_rom_com.h" #include "ivas_rom_rend.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index 94bf27274..c273a8948 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -35,6 +35,10 @@ #include "ivas_cnst.h" #include "ivas_prot.h" #include "ivas_stat_dec.h" +#ifdef DEBUGGING +#include "debug.h" +#include +#endif #include "wmc_auto.h" @@ -93,12 +97,31 @@ void ivas_renderer_select( if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { +#ifdef DEBUGGING + if ( st_ivas->hDecoderConfig->force_rend == FORCE_CLDFB_RENDERER ) + { + *renderer_type = RENDERER_BINAURAL_FASTCONV; + *internal_config = IVAS_AUDIO_CONFIG_HOA3; /* Render ISM to HOA3 before binauralization*/ + } + else + { + *renderer_type = RENDERER_BINAURAL_OBJECTS_TD; + *internal_config = output_config; + } +#else *renderer_type = RENDERER_BINAURAL_OBJECTS_TD; *internal_config = output_config; +#endif } else { *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM; +#ifdef DEBUGGING + if ( st_ivas->hRenderConfig->renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV ) + { + *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM; + } +#endif *internal_config = IVAS_AUDIO_CONFIG_7_1_4; } } @@ -178,7 +201,11 @@ void ivas_renderer_select( if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { +#ifdef DEBUGGING + if ( ( ( ( st_ivas->transport_config == IVAS_AUDIO_CONFIG_5_1 || st_ivas->transport_config == IVAS_AUDIO_CONFIG_7_1 ) && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) ) || ( st_ivas->hDecoderConfig->force_rend == FORCE_TD_RENDERER ) ) && ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) && !( st_ivas->hDecoderConfig->force_rend == FORCE_CLDFB_RENDERER ) ) +#else if ( ( st_ivas->transport_config == IVAS_AUDIO_CONFIG_5_1 || st_ivas->transport_config == IVAS_AUDIO_CONFIG_7_1 ) && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) && ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) +#endif { *renderer_type = RENDERER_BINAURAL_OBJECTS_TD; } @@ -220,6 +247,16 @@ void ivas_renderer_select( { *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM; } +#ifdef DEBUGGING + if ( st_ivas->hRenderConfig->renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_CREND ) + { + *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM; + } + else if ( st_ivas->hRenderConfig->renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV ) + { + *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM; + } +#endif } } } diff --git a/lib_dec/ivas_pca_dec.c b/lib_dec/ivas_pca_dec.c index acb92fe88..fc7c214b1 100644 --- a/lib_dec/ivas_pca_dec.c +++ b/lib_dec/ivas_pca_dec.c @@ -34,6 +34,9 @@ #include "options.h" #include "prot.h" #include "ivas_prot.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "ivas_cnst.h" #include "wmc_auto.h" @@ -257,6 +260,9 @@ void ivas_pca_dec( return; } +#ifdef DEBUGGING + assert( ivas_total_brate == PCA_BRATE ); /* the remaining code is defined at 256k where there are 4 dmx channel */ +#endif if ( !bfi ) { /* set PCA by-pass mode indicator */ diff --git a/lib_dec/ivas_post_proc.c b/lib_dec/ivas_post_proc.c index 08d1d25ab..0ec2fa24a 100644 --- a/lib_dec/ivas_post_proc.c +++ b/lib_dec/ivas_post_proc.c @@ -38,6 +38,9 @@ #include "prot.h" #include "ivas_prot.h" #include "ivas_cnst.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" /*------------------------------------------------------------------------- @@ -59,7 +62,9 @@ void ivas_post_proc( const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ ) { +#ifndef DEBUG_STEREO_DFT_NOCORE int16_t k; +#endif int16_t delay_comp; int32_t output_Fs; Decoder_State **sts; @@ -109,6 +114,7 @@ void ivas_post_proc( } else /* IVAS_CPE_DFT */ { +#ifndef DEBUG_STEREO_DFT_NOCORE int16_t pit_res_max_past_tmp; pit_res_max_past_tmp = sts[0]->pit_res_max_past; @@ -142,6 +148,7 @@ void ivas_post_proc( tcx_ltp_post( sts[0], hTcxLtpDec, TCX_20_CORE, output_frame, NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ), output[k], hCPE->output_mem[k] ); } } +#endif } return; @@ -172,8 +179,10 @@ void stereo_dft_dec_core_switching( Decoder_State *st; int16_t predelay, ap_fade_len; float pAp_input[L_FRAME16k]; +#ifndef DEBUG_STEREO_DFT_NOCORE float tcx_core_buf[L_FRAME16k]; float synth_tmp[L_FRAME48k]; +#endif st = hCPE->hCoreCoder[0]; /* in DFT stereo, only M channel is decoded by the CoreCoder */ output_Fs = st->output_Fs; @@ -188,6 +197,9 @@ void stereo_dft_dec_core_switching( tmps = NS2SA( output_Fs, DELAY_BWE_TOTAL_NS ); /*cross-fading size @ FB*/ delay_comp = NS2SA( st->L_frame * FRAMES_PER_SEC, DELAY_BWE_TOTAL_NS ); /*cross-fading size @ LB*/ +#if defined( DEBUG_MODE_DFT ) && defined( DEBUG_STEREO_DFT_NOCORE ) + stereo_dft_dec_analyze( hCPE, output, DFT, 0, output_frame, output_frame, DFT_STEREO_DEC_ANA_NOCORE, 0, 0 ); +#else /* resample DFT analysis memories in case of internal sampling rate change */ if ( st->last_L_frame != st->L_frame && st->last_L_frame <= L_FRAME16k && st->L_frame <= L_FRAME16k ) { @@ -204,6 +216,9 @@ void stereo_dft_dec_core_switching( if ( st->core == TCX_20_CORE || st->core == TCX_10_CORE || st->core == HQ_CORE || ( st->bfi == 1 && st->core == ACELP_CORE && st->con_tcx == 1 ) ) { +#ifdef DEBUGGING + assert( L_frameTCX == output_frame ); +#endif if ( ( ( st->last_core != ACELP_CORE || ( st->prev_bfi == 1 && st->last_core == ACELP_CORE && st->last_con_tcx == 1 ) ) && st->last_core != AMR_WB_CORE ) || ( sba_dirac_stereo_dtx_flag && st->cng_type == FD_CNG ) ) /* TCX / HQ-CORE -> TCX / HQ-CORE */ { /* In case of a TCX to ACELP switch next frame */ @@ -424,6 +439,7 @@ void stereo_dft_dec_core_switching( } } } +#endif /*----------------------------------------------------------------* * enhanced stereo filling: allpass filter @@ -431,6 +447,20 @@ void stereo_dft_dec_core_switching( if ( hCPE->hStereoDft->hConfig->res_pred_mode == STEREO_DFT_RESPRED_ESF ) { +#if defined( DEBUG_MODE_INFO ) && defined( DEBUG_STEREO_DFT_NOCORE ) + { + char file_name[100]; + int16_t tmp[320]; + { + sprintf( file_name, "./res/stereo_dft_enc_M_S_%d_c%d_b0.pcm", st->L_frame * FRAMES_PER_SEC, 0 ); + } + dbgread( tmp, sizeof( int16_t ), st->L_frame, file_name ); + for ( i = 0; i < st->L_frame; i++ ) + { + pAp_input[i] = (float) ( tmp[i] ); + } + } +#endif if ( st->sr_core == INT_FS_12k8 ) { ap_fade_len = STEREO_DFT_ALLPASS_FADELEN_12k8; @@ -440,6 +470,7 @@ void stereo_dft_dec_core_switching( ap_fade_len = STEREO_DFT_ALLPASS_FADELEN_16k; } +#if !defined( DEBUG_MODE_INFO ) || !defined( DEBUG_STEREO_DFT_NOCORE ) if ( st->core == TCX_20_CORE || st->core == TCX_10_CORE || st->core == HQ_CORE || ( st->bfi == 1 && st->core == ACELP_CORE && st->con_tcx == 1 ) ) { int16_t numZeros = (int16_t) ( NS2SA( st->sr_core, N_ZERO_MDCT_NS ) ); @@ -476,11 +507,25 @@ void stereo_dft_dec_core_switching( } } } +#endif predelay = NS2SA( st->sr_core, DELAY_BWE_TOTAL_NS ); /* apply predelay to have same overall filter delay for all cases */ delay_signal( pAp_input, st->L_frame, hCPE->hStereoDft->ap_delay_mem, predelay ); +#ifdef DEBUG_MODE_DFT + { + int16_t v; + int16_t out_ap[L_FRAME16k]; + + for ( v = 0; v < st->L_frame; v++ ) + { + out_ap[v] = (int16_t) pAp_input[v]; + } + + dbgwrite( out_ap, sizeof( int16_t ), st->L_frame, 1, "res/stereo_dft_allpass_input.pcm" ); + } +#endif /*DEBUG_MODE_DFT*/ /* input zeroes for transient frames */ if ( hCPE->hStereoDft->attackPresent ) @@ -515,6 +560,18 @@ void stereo_dft_dec_core_switching( filter_with_allpass( pAp_input, pAp_input, st->L_frame, &hCPE->hStereoDft->ap2 ); filter_with_allpass( pAp_input, pAp_input, st->L_frame, &hCPE->hStereoDft->ap3 ); +#ifdef DEBUG_MODE_DFT + { + int16_t v; + int16_t out_ap[L_FRAME16k]; + for ( v = 0; v < st->L_frame; v++ ) + { + out_ap[v] = (int16_t) pAp_input[v]; + } + + dbgwrite( out_ap, sizeof( int16_t ), st->L_frame, 1, "res/stereo_dft_allpass.pcm" ); + } +#endif /*DEBUG_MODE_DFT*/ /* apply DFT to allpass-filtered signal */ stereo_dft_dec_analyze( hCPE, pAp_input, DFT, 1, st->L_frame, output_frame, DFT_STEREO_DEC_ANA_FB, 0, 0 ); } diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 011a16d81..c3134fa8a 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -145,6 +145,27 @@ int16_t ivas_qmetadata_dec_decode( int16_t reduce_bits; int16_t ind_order[MASA_MAXIMUM_CODING_SUBBANDS]; +#ifdef DEBUG_MODE_QMETADATA + static FILE *pF = NULL; + static FILE *pF_azi = NULL; + static FILE *pF_ele = NULL; + static FILE *pF_ratio = NULL; + static FILE *pF_spcoh = NULL; + static FILE *pF_surcoh = NULL; + + if ( pF == NULL ) + pF = fopen( "./res/qmetadata_dec.txt", "w" ); + if ( pF_azi == NULL ) + pF_azi = fopen( "./res/qmetadata_azi_dec.txt", "w" ); + if ( pF_ele == NULL ) + pF_ele = fopen( "./res/qmetadata_ele_dec.txt", "w" ); + if ( pF_ratio == NULL ) + pF_ratio = fopen( "./res/qmetadata_ratio_dec.txt", "w" ); + if ( pF_spcoh == NULL ) + pF_spcoh = fopen( "./res/qmetadata_spcoh_dec.txt", "w" ); + if ( pF_surcoh == NULL ) + pF_surcoh = fopen( "./res/qmetadata_surcoh_dec.txt", "w" ); +#endif ec_flag = 0; start_index_0 = *index; @@ -521,6 +542,9 @@ int16_t ivas_qmetadata_dec_decode( } } +#ifdef DEBUGGING + assert( ( diff_bits <= 0 ) || ( q_direction->not_in_2D == 0 ) ); +#endif /* Read raw-coded bits*/ for ( b = start_band; b < nbands; b++ ) { @@ -581,6 +605,44 @@ int16_t ivas_qmetadata_dec_decode( bits_dir_target += bits_dir_raw; bits_dir_used += bits_dir; +#ifdef DEBUG_MODE_QMETADATA + fprintf( pF, "frame %d: diff %d coh %d surcoh %d ", frame, bits_diff, bits_coherence, bits_sur_coherence ); + fprintf( pF, "dir %d %d,%d,%d\n", ec_flag, start_index_0 - *index, total_bits_1dir, bits_dir_raw ); + + fprintf( pF_azi, "frame %d/dir/ec %d/%d: ", frame, d, ec_flag ); + fprintf( pF_ele, "frame %d/dir/ec %d/%d: ", frame, d, ec_flag ); + fprintf( pF_ratio, "frame %d/dir %d: ", frame, d ); + fprintf( pF_spcoh, "frame %d/dir %d: ", frame, d ); + if ( d == 0 ) + { + fprintf( pF_surcoh, "frame %d/dir %d: ", frame, d ); + } + for ( b = start_band; b < nbands; b++ ) + { + for ( m = 0; m < q_direction->cfg.nblocks; m++ ) + { + fprintf( pF_azi, " %+5.2f ", (int16_t) ( 100.f * q_direction->band_data[b].azimuth[m] ) / 100.f ); + fprintf( pF_ele, " %+5.2f ", (int16_t) ( 100.f * q_direction->band_data[b].elevation[m] ) / 100.f ); + fprintf( pF_ratio, " %1.3f ", q_direction->band_data[b].energy_ratio[m] ); + if ( q_direction->coherence_band_data != NULL ) + { + fprintf( pF_spcoh, " %d ", q_direction->coherence_band_data[b].spread_coherence[m] ); + } + if ( d == 0 && hQMetaData->surcoh_band_data != NULL ) + { + fprintf( pF_surcoh, " %d ", hQMetaData->surcoh_band_data[b].surround_coherence[m] ); + } + } + } + fprintf( pF_azi, "\n" ); + fprintf( pF_ele, "\n" ); + fprintf( pF_ratio, "\n" ); + fprintf( pF_spcoh, "\n" ); + if ( d == 0 ) + { + fprintf( pF_surcoh, "\n" ); + } +#endif } /* move 2 dir data to its correct subband */ @@ -681,14 +743,41 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( const uint8_t ncoding_bands_config ) { int16_t d, b, m; +#ifdef DEBUG_MODE_QMETADATA + int16_t bits_diff_sum; +#endif int16_t nbands, start_band; IVAS_QDIRECTION *q_direction; int16_t start_index_0; +#ifdef DEBUG_MODE_QMETADATA + int16_t bits_no_dirs_coh, bits_sur_coherence; +#endif uint16_t all_coherence_zero; int16_t p[MASA_MAXIMUM_CODING_SUBBANDS], dif_p[MASA_MAXIMUM_CODING_SUBBANDS]; int16_t codedBands, sf_nbands0, sf_nbands1; sf_nbands1 = 1; +#ifdef DEBUG_MODE_QMETADATA + static FILE *pF = NULL; + static FILE *pF_azi = NULL; + static FILE *pF_ele = NULL; + static FILE *pF_ratio = NULL; + static FILE *pF_spcoh = NULL; + static FILE *pF_surcoh = NULL; + + if ( pF == NULL ) + pF = fopen( "./res/qmetadata_dec.txt", "w" ); + if ( pF_azi == NULL ) + pF_azi = fopen( "./res/qmetadata_azi_dec.txt", "w" ); + if ( pF_ele == NULL ) + pF_ele = fopen( "./res/qmetadata_ele_dec.txt", "w" ); + if ( pF_ratio == NULL ) + pF_ratio = fopen( "./res/qmetadata_ratio_dec.txt", "w" ); + if ( pF_spcoh == NULL ) + pF_spcoh = fopen( "./res/qmetadata_spcoh_dec.txt", "w" ); + if ( pF_surcoh == NULL ) + pF_surcoh = fopen( "./res/qmetadata_surcoh_dec.txt", "w" ); +#endif start_index_0 = *index; /* read number of higher inactive/not encoded bands */ @@ -741,11 +830,17 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( hQMetaData->q_direction[0].cfg.nbands = codedBands; /*Coherence flag decoding*/ +#ifdef DEBUG_MODE_QMETADATA + bits_no_dirs_coh = 0; +#endif all_coherence_zero = 1; if ( hQMetaData->coherence_flag ) { /* read if coherence is zero */ all_coherence_zero = bitstream[( *index )--]; +#ifdef DEBUG_MODE_QMETADATA + bits_no_dirs_coh += 1; +#endif } hQMetaData->all_coherence_zero = (uint8_t) all_coherence_zero; @@ -775,6 +870,9 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( p[b] = p[b - 1] + dif_p[b] + 1; hQMetaData->twoDirBands[p[b]] = 1; } +#ifdef DEBUG_MODE_QMETADATA + bits_no_dirs_coh += ( d - *index ); +#endif } if ( bits_sph_idx == 16 && hQMetaData->no_directions == 2 ) @@ -785,10 +883,16 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( hQMetaData->q_direction[1].cfg.nbands = codedBands; } } +#ifdef DEBUG_MODE_QMETADATA + bits_diff_sum = +#endif ivas_qmetadata_entropy_decode_diffuseness_hr_512( bitstream, index, &( hQMetaData->q_direction[0] ) ); if ( hQMetaData->no_directions == 2 ) { +#ifdef DEBUG_MODE_QMETADATA + bits_diff_sum += +#endif ivas_qmetadata_entropy_decode_diffuseness_hr_512( bitstream, index, &( hQMetaData->q_direction[1] ) ); } @@ -879,10 +983,16 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( if ( all_coherence_zero == 0 ) { +#ifdef DEBUG_MODE_QMETADATA + bits_sur_coherence = +#endif read_surround_coherence_hr( bitstream, index, hQMetaData ); } else { +#ifdef DEBUG_MODE_QMETADATA + bits_sur_coherence = 0; +#endif /*Surround coherence*/ for ( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) { @@ -892,6 +1002,9 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( } } } +#ifdef DEBUG_MODE_QMETADATA + bits_no_dirs_coh += bits_sur_coherence; +#endif for ( d = 0; d < hQMetaData->no_directions; d++ ) { @@ -924,6 +1037,33 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( /* Decode quantized directions frame-wise */ ivas_qmetadata_raw_decode_dir_512( q_direction, bitstream, index, nbands, start_band, sph_grid16 ); +#ifdef DEBUG_MODE_QMETADATA + fprintf( pF, "frame %d: diff %d surcoh %d ", frame, bits_diff_sum, bits_sur_coherence ); + fprintf( pF, "dir %d\n", start_index_0 - *index ); + fprintf( pF_azi, "frame %d/dir/ec %d: ", frame, d ); + fprintf( pF_ele, "frame %d/dir/ec %d: ", frame, d ); + fprintf( pF_spcoh, "frame %d/dir %d: ", frame, d ); + fprintf( pF_ratio, "frame %d/dir %d: ", frame, d ); + + for ( b = start_band; b < nbands; b++ ) + { + for ( m = 0; m < q_direction->cfg.nblocks; m++ ) + { + + fprintf( pF_ratio, " %1.3f ", q_direction->band_data[b].energy_ratio[m] ); + fprintf( pF_azi, " %+5.2f ", (int16_t) ( 100.f * q_direction->band_data[b].azimuth[m] ) / 100.f ); + fprintf( pF_ele, " %+5.2f ", (int16_t) ( 100.f * q_direction->band_data[b].elevation[m] ) / 100.f ); + if ( q_direction->coherence_band_data != NULL ) + { + fprintf( pF_spcoh, " %d ", q_direction->coherence_band_data[b].spread_coherence[m] ); + } + } + } + fprintf( pF_ratio, "\n" ); + fprintf( pF_azi, "\n" ); + fprintf( pF_ele, "\n" ); + fprintf( pF_spcoh, "\n" ); +#endif } if ( hQMetaData->no_directions == 2 ) @@ -984,6 +1124,38 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( } } +#ifdef DEBUG_MODE_QMETADATA + for ( d = 0; d < hQMetaData->no_directions; d++ ) + { + q_direction = &hQMetaData->q_direction[d]; + nbands = q_direction->cfg.nbands; + start_band = q_direction->cfg.start_band; + + + if ( d == 0 ) + { + fprintf( pF_surcoh, "frame %d/dir %d: ", frame, d ); + } + for ( b = start_band; b < nbands; b++ ) + { + for ( m = 0; m < q_direction->cfg.nblocks; m++ ) + { + + + if ( d == 0 && hQMetaData->surcoh_band_data != NULL ) + { + fprintf( pF_surcoh, " %d ", hQMetaData->surcoh_band_data[b].surround_coherence[m] ); + } + } + } + + + if ( d == 0 ) + { + fprintf( pF_surcoh, "\n" ); + } + } +#endif /* Store status information for renderer use */ hQMetaData->ec_flag = 0; @@ -1031,6 +1203,21 @@ int16_t ivas_qmetadata_dec_sid_decode( float direction_vector[3]; int16_t metadata_sid_bits; /* bits allocated to SID for metadata */ int16_t bits_delta, bits_dir; +#ifdef DEBUG_MODE_QMETADATA + static FILE *pF = NULL; + static FILE *pF_azi = NULL; + static FILE *pF_ele = NULL; + static FILE *pF_ratio = NULL; + + if ( pF == NULL ) + pF = fopen( "./res/qmetadata_sid_dec.txt", "w" ); + if ( pF_azi == NULL ) + pF_azi = fopen( "./res/qmetadata_sid_azi_dec.txt", "w" ); + if ( pF_ele == NULL ) + pF_ele = fopen( "./res/qmetadata_sid_ele_dec.txt", "w" ); + if ( pF_ratio == NULL ) + pF_ratio = fopen( "./res/qmetadata_sid_ratio_dec.txt", "w" ); +#endif if ( ivas_format == SBA_FORMAT ) { @@ -1231,6 +1418,27 @@ int16_t ivas_qmetadata_dec_sid_decode( b = bitstream[( *index )--]; } +#ifdef DEBUG_MODE_QMETADATA + fprintf( pF, "frame %d: all %d ", frame, start_index - *index ); + + fprintf( pF_azi, "frame %d SID: ", frame ); + fprintf( pF_ele, "frame %d SID: ", frame ); + fprintf( pF_ratio, "frame %d SID: ", frame ); + + for ( b = start_band; b < nbands; b++ ) + { + for ( m = 0; m < nblocks; m++ ) + { + fprintf( pF_azi, " %+5.2f ", (int16_t) ( 100.f * q_direction->band_data[b].azimuth[m] ) / 100.f ); + fprintf( pF_ele, " %+5.2f ", (int16_t) ( 100.f * q_direction->band_data[b].elevation[m] ) / 100.f ); + fprintf( pF_ratio, " %1.3f ", q_direction->band_data[b].energy_ratio[m] ); + } + } + fprintf( pF_azi, "\n" ); + fprintf( pF_ele, "\n" ); + fprintf( pF_ratio, "\n" ); + +#endif return ( start_index - *index ); } @@ -2021,6 +2229,9 @@ static uint16_t ivas_qmetadata_DecodeQuasiUniform( int16_t i, bits; uint16_t tresh, value; +#ifdef DEBUGGING + assert( ( alphabet_size >= 1 ) ); +#endif bits = 30 - norm_l( alphabet_size ); /* bits = floor(log2(alphabet_size)) */ tresh = ( 1U << ( bits + 1 ) ) - alphabet_size; @@ -2036,6 +2247,9 @@ static uint16_t ivas_qmetadata_DecodeQuasiUniform( value = ( value << 1 ) - tresh + bitstream[( *index )--]; } +#ifdef DEBUGGING + assert( value < alphabet_size ); +#endif return value; } @@ -2078,6 +2292,9 @@ int16_t ivas_qmetadata_DecodeExtendedGR( } else { +#ifdef DEBUGGING + assert( bitstream[*index] == 0 ); +#endif ( *index )--; lsb = 0; for ( i = 0; i < gr_param; i++ ) @@ -2089,6 +2306,9 @@ int16_t ivas_qmetadata_DecodeExtendedGR( value = ( msb << gr_param ) + lsb; } +#ifdef DEBUGGING + assert( value < alph_size ); +#endif return value; } @@ -2987,6 +3207,9 @@ static int16_t read_common_direction( *pbit_pos = bit_pos; +#ifdef DEBUGGING + /*assert(nbits == bits_total); */ +#endif return nbits; } @@ -3149,6 +3372,12 @@ static ivas_error read_huf( } } +#ifdef DEBUGGING + if ( nbits == max_len ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong Huffman codeword for average index in coherence encoding." ); + } +#endif *num_bits_read = end_pos; return IVAS_ERR_OK; @@ -3209,6 +3438,9 @@ static int16_t read_GR_min_removed_data( } } +#ifdef DEBUGGING + assert( nbits == *p_bit_pos - bit_pos ); +#endif *p_bit_pos = bit_pos; return nbits; @@ -3322,6 +3554,9 @@ static int16_t decode_fixed_rate_composed_index_coherence( { decoded_index[j] = temp_index[j]; } +#ifdef DEBUGGING + assert( nbits == *p_bit_pos - bit_pos ); +#endif nbits = *p_bit_pos - bit_pos; *p_bit_pos = bit_pos; @@ -3530,6 +3765,9 @@ static int16_t read_coherence_data( uint16_t spr_coh_temp_index[MASA_MAXIMUM_CODING_SUBBANDS]; no_cb = 1; +#ifdef DEBUGGING + assert( coding_subbands % 2 == 0 ); +#endif for ( j = 0; j < coding_subbands / 2; j++ ) { no_cb *= no_cv_vec[j]; @@ -3632,6 +3870,9 @@ static int16_t read_coherence_data( } } } +#ifdef DEBUGGING + assert( nbits == *p_bit_pos - bit_pos ); +#endif nbits = *p_bit_pos - bit_pos; *p_bit_pos = bit_pos; diff --git a/lib_dec/ivas_range_uni_dec.c b/lib_dec/ivas_range_uni_dec.c index 70ce6b84e..6fbbaa563 100644 --- a/lib_dec/ivas_range_uni_dec.c +++ b/lib_dec/ivas_range_uni_dec.c @@ -40,6 +40,9 @@ #include "options.h" #include "prot.h" #include "wmc_auto.h" +#ifdef DEBUGGING +#include "debug.h" +#endif /* @@ -117,6 +120,10 @@ uint16_t rc_uni_dec_read_symbol_fastS( uint16_t ceil_log2_alphabet_size; /* ceil(log2(alphabet_size)) */ uint16_t step; uint32_t reversed_low; +#ifdef DEBUGGING + assert( tot_shift <= 16 ); + assert( rc_st_dec->rc_range >= 0x01000000 ); /* rc_range is normalized */ +#endif low = rc_st_dec->rc_low; range = rc_st_dec->rc_range; @@ -220,6 +227,9 @@ uint16_t rc_uni_dec_read_bit( uint32_t val; uint32_t low; /* local copy (1 to 5 uses) */ uint32_t range; /* local copy (3 to 6 uses) */ +#ifdef DEBUGGING + assert( rc_st_dec->rc_range >= 0x01000000 ); /* rc_range is normalized */ +#endif low = rc_st_dec->rc_low; range = rc_st_dec->rc_range; @@ -278,6 +288,10 @@ uint16_t rc_uni_dec_read_bit_prob_fast( uint32_t val; uint32_t low; /* local copy (2 to 7 uses) */ uint32_t range; /* local copy (5 to 9 uses) */ +#ifdef DEBUGGING + assert( tot_shift <= 16 ); + assert( rc_st_dec->rc_range >= 0x01000000 ); /* rc_range is normalized */ +#endif low = rc_st_dec->rc_low; range = rc_st_dec->rc_range; @@ -345,6 +359,10 @@ uint16_t rc_uni_dec_read_bits( uint32_t val; uint32_t low; /* local copy (2 to 6 uses) */ uint32_t range; /* local copy (4 to 7 uses) */ +#ifdef DEBUGGING + assert( bits <= 16 ); + assert( rc_st_dec->rc_range >= 0x01000000 ); /* rc_range is normalized */ +#endif low = rc_st_dec->rc_low; range = rc_st_dec->rc_range; @@ -401,6 +419,9 @@ int16_t rc_uni_dec_finish( { int16_t total_bit_count; int16_t bits; +#ifdef DEBUGGING + assert( rc_st_dec->rc_range >= 0x01000000 ); /* rc_range is normalized */ +#endif /* floor(log2(x)) = floor(log2(x >> 24)) + 24, for any x >= 2 ^ 24 */ /* 32 - floor(log2(y)) = norm_ul(y) + 1 = norm_l(y >> 24) - 22 */ @@ -409,6 +430,9 @@ int16_t rc_uni_dec_finish( bits++; /* conservative number of bits, because the decoder only has rc_range available */ +#ifdef DEBUGGING + assert( ( bits >= 2 ) && ( bits <= 9 ) ); /* depends on rc_range, which is normalized */ +#endif total_bit_count = ( rc_st_dec->bit_count - 32 ) + bits; @@ -466,6 +490,16 @@ static int16_t rc_uni_dec_read( return 0; /* reading the 8 bits would trigger an out-of-bounds array access */ } +#ifdef DEBUGGING + /* shifted_bit_buffer[i] must contain only binary values */ + { + int16_t i; + for ( i = 0; i < 8; ++i ) + { + assert( shifted_bit_buffer[i] <= 1 ); + } + } +#endif /* pack the first 8 bits from shifted_bit_buffer, first bit is most significant */ byte_read = ( (int16_t) shifted_bit_buffer[0] << 7 ) | ( (int16_t) shifted_bit_buffer[1] << 6 ) | diff --git a/lib_dec/ivas_rom_dec.c b/lib_dec/ivas_rom_dec.c index 0ab45b6f1..a48df1ad9 100644 --- a/lib_dec/ivas_rom_dec.c +++ b/lib_dec/ivas_rom_dec.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "ivas_cnst.h" #include diff --git a/lib_dec/ivas_rom_dec.h b/lib_dec/ivas_rom_dec.h index 4ff133596..77e0fd9b1 100644 --- a/lib_dec/ivas_rom_dec.h +++ b/lib_dec/ivas_rom_dec.h @@ -35,6 +35,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "ivas_cnst.h" #include "ivas_stat_dec.h" diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 3be1d2ff3..774444dd3 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -41,6 +41,9 @@ #include "ivas_rom_com.h" #include "ivas_rom_dec.h" #include +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -754,6 +757,9 @@ ivas_error ivas_sba_dec_render( nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); nchan_out = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; +#ifdef DEBUGGING + assert( hSpar ); +#endif for ( ch = 0; ch < nchan_out; ch++ ) { output_f_local[ch] = output_f[ch]; @@ -772,6 +778,9 @@ ivas_error ivas_sba_dec_render( slots_to_render -= hSpar->subframe_nbslots[last_sf]; last_sf++; } +#ifdef DEBUGGING + assert( slots_to_render == 0 ); +#endif for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c index d8487479f..8367509ac 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -39,6 +39,9 @@ #include "ivas_prot.h" #include "ivas_rom_com.h" #include "ivas_rom_dec.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -99,10 +102,18 @@ void ivas_sba_dirac_stereo_config( { if ( hConfig != NULL ) { +#ifndef DEBUG_STEREO_DFT_NOSTEREO hConfig->dmx_active = STEREO_DFT_DMX_ACTIVE; +#else + hConfig->dmx_active = 0; +#endif hConfig->band_res = STEREO_DFT_BAND_RES_HIGH; hConfig->prm_res = 2; +#ifdef DEBUG_MODE_DFT + hConfig->itd_mode = 0; + hConfig->gipd_mode = 0; +#endif hConfig->res_pred_mode = STEREO_DFT_RESPRED_ESF; hConfig->res_cod_mode = STEREO_DFT_RES_COD_OFF; diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index 692e1a4cf..3d06dac2f 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -38,9 +38,19 @@ #include "ivas_stat_dec.h" #include "ivas_cnst.h" #include +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" +#ifdef DEBUG_MODE_DIRAC +/*-----------------------------------------------------------------------* + * Local function prototypes + *-----------------------------------------------------------------------*/ + +static void debug_mode_dirac( float output[MAX_OUTPUT_CHANNELS][L_FRAME48k], const int16_t nchan_transport, const int16_t output_frame ); +#endif /*-------------------------------------------------------------------------* @@ -291,6 +301,9 @@ int16_t ivas_sba_remapTCs( { int16_t nchan_remapped; +#ifdef DEBUG_MODE_DIRAC + debug_mode_dirac( sba_data, st_ivas->nchan_transport, output_frame ); +#endif nchan_remapped = st_ivas->nchan_transport; if ( nchan_remapped == 3 ) @@ -508,3 +521,43 @@ void ivas_sba_mix_matrix_determiner( } +#ifdef DEBUG_MODE_DIRAC +/*-----------------------------------------------------------------------* + * Debugging function + *-----------------------------------------------------------------------*/ + +static void debug_mode_dirac( + float output[MAX_OUTPUT_CHANNELS][L_FRAME48k], + const int16_t nchan_transport, + const int16_t output_frame ) +{ + int16_t i, n; + int16_t tmp[L_FRAME48k]; + char file_name[50] = { 0 }; + +#ifdef DEBUG_MODE_DIRAC_NOCORE + for ( n = 0; n < nchan_transport; n++ ) + { + sprintf( file_name, "./res/ivas_dirac_enc_%d.%d.pcm", n, (int16_t) ( output_frame * 0.05 ) ); + dbgread( tmp, sizeof( int16_t ), output_frame, file_name ); + for ( i = 0; i < output_frame; i++ ) + { + output[n][i] = (float) ( tmp[i] ); + } + } +#else + for ( n = 0; n < nchan_transport; n++ ) + { + for ( i = 0; i < output_frame; i++ ) + { + tmp[i] = (int16_t) ( output[n][i] + 0.5f ); + } + + sprintf( file_name, "./res/ivas_dirac_dec_%d.%d.pcm", n, (int16_t) ( output_frame * 0.05 ) ); + dbgwrite( tmp, sizeof( int16_t ), output_frame, 1, file_name ); + } +#endif + + return; +} +#endif diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index 752ce0e95..36ec1386a 100644 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -39,6 +39,9 @@ #include "prot.h" #include "ivas_prot.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -139,6 +142,9 @@ ivas_error ivas_sce_dec( st->idchan = 0; st->element_mode = IVAS_SCE; +#ifdef DEBUGGING + st->id_element = sce_id; +#endif /* Force to MODE1 in IVAS */ st->codec_mode = MODE1; @@ -277,6 +283,34 @@ ivas_error ivas_sce_dec( st_ivas->BER_detect |= st->BER_detect; +#ifdef DEBUG_MODE_INFO + { + float tmpF = hSCE->element_brate / 1000.0f; + int16_t i, n; + + n = 1; + if ( st_ivas->ini_frame == 0 && frame > 0 ) + { + /* in case first frame(s) is/are lost, write info several times */ + n = (int16_t) frame - st_ivas->ini_frame + 1; + } + + for ( i = 0; i < n; i++ ) + { + dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "element_brate", 0, sce_id, DEC ) ); + dbgwrite( &st->element_mode, sizeof( int16_t ), 1, output_frame, fname( debug_dir, "element_mode", 0, sce_id, DEC ) ); + + dbgwrite( output, sizeof( float ), output_frame, 1, fname( debug_dir, "output.sce", 0, sce_id, DEC ) ); + + if ( st_ivas->ivas_format != MASA_ISM_FORMAT ) + { + tmpF = 0; + dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "output.cpe", 0, sce_id, DEC ) ); + dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "output.mct", 0, sce_id, DEC ) ); + } + } + } +#endif pop_wmops(); diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index ab913d08b..e9631c550 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "ivas_stat_dec.h" #include "prot.h" #include "string.h" @@ -1187,10 +1190,18 @@ void ivas_spar_dec_agc_pca( *---------------------------------------------------------------------*/ ivas_agc_dec_process( hSpar->hAgcDec, output, output, nchan_transport, output_frame ); +#ifdef DEBUG_SBA_AUDIO_DUMP + /* Dump audio signal after ivas_agc_dec_process */ + ivas_spar_dump_signal_wav( output_frame, NULL, output, st_ivas->nchan_transport, spar_foa_dec_wav[1], "ivas_agc_dec_process()" ); +#endif if ( hSpar->hPCA != NULL ) { ivas_pca_dec( hSpar->hPCA, output_frame, num_in_ingest, hDecoderConfig->ivas_total_brate, hDecoderConfig->last_ivas_total_brate, st_ivas->bfi, output ); +#ifdef DEBUG_SBA_AUDIO_DUMP + /* Dump audio signal after ivas_pca_dec */ + ivas_spar_dump_signal_wav( output_frame, NULL, output, num_in_ingest, spar_foa_dec_wav[2], "ivas_pca_dec()" ); +#endif } pop_wmops(); @@ -1212,6 +1223,9 @@ void ivas_spar_dec_set_render_map( SPAR_DEC_HANDLE hSpar; hSpar = st_ivas->hSpar; +#ifdef DEBUGGING + assert( hSpar ); +#endif /* adapt subframes */ hSpar->num_slots = nCldfbTs; @@ -1541,6 +1555,42 @@ void ivas_spar_dec_upmixer_sf( } } +#ifdef DEBUG_SPAR_BYPASS_EVS_CODEC + /* by-pass core-coder */ + /*write the core coder output to a file for debugging*/ + { + float tmp; + int16_t pcm, j; + for ( j = 0; j < output_frame; j++ ) + { + for ( i = 0; i < nchan_transport; i++ ) + { + tmp = roundf( output[i][j] * PCM16_TO_FLT_FAC ); + pcm = ( tmp > MAX16B_FLT ) ? MAX16B : ( tmp < MIN16B_FLT ) ? MIN16B + : (short) tmp; + dbgwrite( &pcm, sizeof( int16_t ), 1, 1, "dmx_dec.raw" ); + } + } + } + + /*overwrite the core coder output with core input for debugging*/ + { + static FILE *fid_enc = 0; + int16_t smp; + + if ( !fid_enc ) + { + fid_enc = fopen( "evs_input_float.raw", "rb" ); + } + for ( smp = 0; smp < L_FRAME48k; smp++ ) + { + for ( in_ch = 0; in_ch < nchan_transport; in_ch++ ) + { + fread( &output[in_ch][smp], sizeof( float ), 1, fid_enc ); + } + } + } +#endif /*---------------------------------------------------------------------* * TD Decorr and pcm ingest @@ -1558,6 +1608,9 @@ void ivas_spar_dec_upmixer_sf( /*---------------------------------------------------------------------* * PCA decoder *---------------------------------------------------------------------*/ +#ifdef DEBUG_SBA_AUDIO_DUMP + hSpar->pca_ingest_channels = num_in_ingest; +#endif hSpar->hFbMixer->fb_cfg->num_in_chans = num_in_ingest; @@ -1603,6 +1656,10 @@ void ivas_spar_dec_upmixer_sf( numch_out_dirac = hDecoderConfig->nchan_out; +#ifdef DEBUG_SBA_AUDIO_DUMP + /* Dump audio signal after ivas_agc_dec_process */ + ivas_spar_dump_signal_wav( output_frame, p_tc, NULL, numch_in, spar_foa_dec_wav[4], "ivas_spar_upmixer()" ); +#endif /* CLDFB analysis of incoming frame */ for ( in_ch = 0; in_ch < numch_in; in_ch++ ) @@ -1759,6 +1816,9 @@ void ivas_spar_dec_upmixer_sf( idx_in++; } } +#ifdef DEBUG_SBA_AUDIO_DUMP + hSpar->numOutChannels = outchannels; +#endif } else { @@ -1770,7 +1830,14 @@ void ivas_spar_dec_upmixer_sf( cldfbSynthesis( &cldfb_in_ts_re[out_ch][ts], &cldfb_in_ts_im[out_ch][ts], &output[out_ch][ts * num_cldfb_bands], num_cldfb_bands, st_ivas->cldfbSynDec[out_ch] ); } } - } +#ifdef DEBUG_SBA_AUDIO_DUMP + hSpar->numOutChannels = numch_out_dirac; +#endif + } +#ifdef DEBUG_SBA_AUDIO_DUMP + /* Dump audio signal after cldfbSynthesis */ + ivas_spar_dump_signal_wav( output_frame, NULL, output, hSpar->numOutChannels, spar_foa_dec_wav[3], "cldfbSynthesis()" ); +#endif hSpar->slots_rendered += hSpar->subframe_nbslots[hSpar->subframes_rendered]; hSpar->subframes_rendered++; diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 42ea099a6..2231ac14a 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "math.h" #include "prot.h" #include "ivas_prot.h" @@ -786,6 +789,39 @@ void ivas_spar_md_dec_process( /* set correct number of bands*/ nB = IVAS_MAX_NUM_BANDS; +#ifdef DEBUG_LBR_SBA + /* Dumping SPAR Coefficients */ + char f_name[100]; + int16_t nbands = 4; // 6 total, just looking at SPAR + int16_t num_subframes = 1; + int16_t num_elements = 6; + int16_t num_block_group = 1; + int16_t byte_size = sizeof( float ); + + sprintf( f_name, "SBA_MD_values_dec.bin" ); + ( frame == 0 ) ? dbgwrite( &nbands, sizeof( nbands ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_block_group, sizeof( num_block_group ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + + for ( b = 0; b < nbands; b++ ) + { + for ( int16_t sf = 0; sf < num_subframes; sf++ ) + { + for ( int16_t bl = 0; bl < num_block_group; bl++ ) + { + dbgwrite( &hMdDec->spar_md.band_coeffs[b].pred_re[0], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].pred_re[1], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].pred_re[2], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].P_re[0], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].P_re[1], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].P_re[2], byte_size, 1, 1, f_name ); + // fprintf(stdout, "%f\t%f\t%f\t%d\t%d\n", dirac_md_kbps, spar_md_kbps, sba_md_kbps, qsi, code_strat ); + } + } + } +#endif /* expand DirAC MD to all time slots */ for ( i_ts = 1; i_ts < num_md_sub_frames; i_ts++ ) @@ -1411,6 +1447,25 @@ void ivas_spar_dec_gen_umx_mat( } } +#ifdef DEBUG_SBA_MD_DUMP + { + static FILE *f_mat = 0; + + if ( f_mat == 0 ) + f_mat = fopen( "mixer_mat_dec", "w" ); + + for ( i = 0; i < num_out_ch; i++ ) + { + for ( j = 0; j < num_out_ch; j++ ) + { + for ( b = 0; b < num_bands_out; b++ ) + { + fprintf( f_mat, "%f\n", hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ); + } + } + } + } +#endif } ivas_spar_dec_compute_ramp_down_post_matrix( hMdDec, num_bands_out, bfi, num_md_sub_frames ); @@ -1625,6 +1680,9 @@ static void ivas_spar_dec_parse_md_bs( ivas_map_prior_coeffs_quant( &hMdDec->spar_md_prev, &hMdDec->spar_md_cfg, qsi, *nB ); } } +#ifdef SPAR_HOA_DBG + fprintf( stdout, "\n\n no_ec = %d, strat = %d\n", no_ec, strat ); +#endif hMdDec->spar_md_cfg.prev_quant_idx = qsi; if ( no_ec == 0 ) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index d350ec18c..9a7738aa6 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -654,6 +654,10 @@ typedef struct ivas_spar_dec_lib_t int32_t core_nominal_brate; /* Nominal bitrate for core coding */ int16_t i_subframe; +#ifdef DEBUG_SBA_AUDIO_DUMP + int16_t numOutChannels; + int16_t pca_ingest_channels; +#endif int16_t subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; int16_t render_to_md_map[MAX_JBM_CLDFB_TIMESLOTS]; int16_t nb_subframes; @@ -971,6 +975,10 @@ typedef struct decoder_config_structure int16_t Opt_ExternalOrientation; /* indiates whether external orientations are used */ int16_t Opt_dpid_on; /* indicates whether Directivity pattern option is used */ int16_t Opt_aeid_on; /* indicates whether Acoustic environment option is used */ +#ifdef DEBUGGING + /* temp. development parameters */ + int16_t force_rend; /* forced TD/CLDFB binaural renderer (for ISM and MC) */ +#endif int16_t Opt_tsm; /* indicates whether time scaling modification is activated */ IVAS_RENDER_FRAMESIZE render_framesize; int16_t Opt_delay_comp; /* flag indicating delay compensation active */ @@ -1081,6 +1089,9 @@ typedef struct Decoder_Struct DECODER_TC_BUFFER_HANDLE hTcBuffer; /* JBM structure */ JBM_METADATA_HANDLE hJbmMetadata; /* Structure for metadata buffering in JBM */ +#ifdef DEBUGGING + int32_t noClipping; /* number of clipped samples */ +#endif int32_t last_active_ivas_total_brate; int16_t ism_extmeta_active; /* Extended metadata active in decoder */ int16_t ism_extmeta_cnt; /* Change frame counter for extended metadata */ diff --git a/lib_dec/ivas_stereo_adapt_GR_dec.c b/lib_dec/ivas_stereo_adapt_GR_dec.c index 81a3131f8..7e698f616 100644 --- a/lib_dec/ivas_stereo_adapt_GR_dec.c +++ b/lib_dec/ivas_stereo_adapt_GR_dec.c @@ -37,6 +37,9 @@ #include "ivas_prot.h" #include "ivas_rom_com.h" #include "rom_dec.h" +#ifdef DEBUGGING +#include "debug.h" +#endif /*---------------------------------------------------------------------* @@ -197,6 +200,12 @@ static ivas_error find_map( ( *map_idx )++; } +#ifdef DEBUGGING + if ( *map_idx == len ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "find_map(map, %d) : value not found!!", val ); + } +#endif return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index 91a560cb2..5953e93ed 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -38,6 +38,9 @@ #include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" /*------------------------------------------------------------------- diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index 03c0fe15a..fb3c35a24 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -42,6 +42,9 @@ #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "ivas_rom_dec.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -656,6 +659,9 @@ void stereo_dft_dec_analyze( float *mem, input_buff[STEREO_DFT32MS_OVL_MAX + L_FRAME48k]; float DFT[STEREO_DFT32MS_N_MAX], *pDFT_out; int16_t NFFT, NFFT_core, ovl, zp; +#if defined( DEBUG_MODE_DFT ) || defined( DEBUG_STEREO_DFT_NOCORE ) + int16_t N; +#endif int16_t offset; float fac; const float *trigo, *win_left, *win_right, *win2; @@ -769,6 +775,9 @@ void stereo_dft_dec_analyze( delay_dec = NS2SA( inputFs, STEREO_DFT32MS_OVL_NS ); zp = NS2SA( inputFs, STEREO_DFT32MS_ZP_NS ); ovl = NS2SA( inputFs, STEREO_DFT32MS_OVL_NS ); +#ifdef DEBUG_MODE_DFT + N = NS2SA( inputFs, STEREO_DFT32MS_HOP_NS ); +#endif NFFT = NS2SA( inputFs, STEREO_DFT32MS_N_NS ); fac = (float) ( hStereoDft->NFFT ) / (float) ( NFFT ); ovl2 = NS2SA( inputFs, STEREO_DFT32MS_OVL2_NS ); @@ -789,6 +798,39 @@ void stereo_dft_dec_analyze( return; } +#ifdef DEBUG_MODE_DFT + { + int16_t tmp[L_FRAME48k]; + char file_name[50] = { 0 }; +#ifdef DEBUG_STEREO_DFT_NOCORE + if ( ana_type == DFT_STEREO_DEC_ANA_NOCORE && delay == 0 ) + { + sprintf( file_name, "./res/stereo_dft_enc_M_S_%d_c%d_b0.pcm", input_frame * FRAMES_PER_SEC, chan ); + dbgread( tmp, sizeof( int16_t ), 2 * N, file_name ); + for ( i = 0; i < input_frame; i++ ) + { + pInput_buff[mem_size + i] = (float) ( tmp[i] ); + } + mvr2r( input_buff + input_frame, mem, mem_size ); + } +#endif + offset = 0; + pInput = pInput_buff + offset; + for ( i = 0; i < 2 * N; i++ ) + { + tmp[i] = (int16_t) ( pInput[i] + 0.5f ); + } + if ( ana_type != DFT_STEREO_DEC_ANA_BPF ) + { + sprintf( file_name, "./res/stereo_dft_dec_M_S_c%d_%d.pcm", input_frame * FRAMES_PER_SEC, chan ); + } + else + { + sprintf( file_name, "./res/stereo_dft_dec_BPF_c%d_%d.pcm", input_frame * FRAMES_PER_SEC, chan ); + } + dbgwrite( tmp, sizeof( int16_t ), 2 * N, 1, file_name ); + } +#endif /*-----------------------------------------------------------------* * DFT Analysis: loop over frame @@ -1045,6 +1087,19 @@ void stereo_dft_dec_synthesize( p_DFT += STEREO_DFT32MS_N_MAX; } +#ifdef DEBUG_MODE_DFT + { + int16_t tmp[1024]; + char file_name[50] = { 0 }; + + for ( i = 0; i < output_frame; i++ ) + { + tmp[i] = (int16_t) ( output[i] + 0.5f ); + } + sprintf( file_name, "./res/stereo_dft_ch%d_output.pcm", chan ); + dbgwrite( tmp, sizeof( int16_t ), output_frame, 1, file_name ); + } +#endif pop_wmops(); return; @@ -1116,6 +1171,16 @@ void stereo_dft_dec( hStereoDft->trans = ( ( ( st0->clas_dec == ONSET ) || ( st0->clas_dec == SIN_ONSET ) || ( st0->clas_dec == UNVOICED_CLAS ) || ( st0->clas_dec == UNVOICED_TRANSITION ) ) || ( st0->stab_fac <= 0.25f ) ) || ( st0->core == TCX_20_CORE && ( ( st0->hTcxCfg->tcx_last_overlap_mode == MIN_OVERLAP ) || ( st0->hTcxCfg->tcx_last_overlap_mode == HALF_OVERLAP ) ) ) || ( st0->core == TCX_10_CORE ); +#ifdef DEBUG_MODE_DFT + { + int16_t tmps; + int16_t tmp_output_frame = (int16_t) ( st0->output_Fs / FRAMES_PER_SEC ); + dbgwrite( &( hStereoDft->attackPresent ), sizeof( int16_t ), 1, tmp_output_frame, "res/stereo_attack.pcm" ); + dbgwrite( &( hStereoDft->trans ), sizeof( int16_t ), 1, tmp_output_frame, "res/stereo_trans.pcm" ); + tmps = (int16_t) ( 100.f * ( st0->stab_fac ) + 0.5f ); + dbgwrite( &tmps, sizeof( int16_t ), 1, tmp_output_frame, "res/stereo_stab.pcm" ); + } +#endif /* Initialization */ k_offset = 1; @@ -1147,6 +1212,9 @@ void stereo_dft_dec( dmx_nrg = stereo_dft_dmx_swb_nrg( DFT[0], DFT[0] + STEREO_DFT32MS_N_MAX, min( hStereoDft->NFFT, STEREO_DFT32MS_N_32k ) ); } +#ifdef DEBUG_MODE_DFT + dbgwrite( hStereoDft->res_pred_gain + STEREO_DFT_BAND_MAX, sizeof( float ), hStereoDft->nbands, 1, "./res/stereo_dft_dec_gainPred.pcm" ); +#endif #ifdef DEBUG_PRINT printf( "\nframe: %d\n", frame ); @@ -1224,6 +1292,17 @@ void stereo_dft_dec( } } +#ifdef DEBUGGING + if ( dbgflag( "write_res" ) ) + { + dbgwrite( pDFT_RES, sizeof( float ), 2 * hStereoDft->band_limits[hStereoDft->res_cod_band_max], 1, "dec_res.float" ); + } + + if ( dbgflag( "read_res" ) ) + { + dbgread( pDFT_RES, sizeof( float ), 2 * hStereoDft->band_limits[hStereoDft->res_cod_band_max], "dec_res.float" ); + } +#endif /* Apply active DMX */ /* pDFT_RES is used for the second channel in inactive frames */ if ( hStereoDft->frame_sid_nodata && !sba_dirac_stereo_flag ) @@ -1258,6 +1337,12 @@ void stereo_dft_dec( hFdCngDec->cna_g_state[b] = g; } +#ifdef DEBUG_MODE_DFT + if ( b < hStereoDft->res_cod_band_max ) + { + dbgwrite( &g, sizeof( float ), 1, 1, "./res/stereo_dft_dec_g.pcm" ); + } +#endif /* No residual coding in inactive frames, instead pDFT_RES is used for the second channel */ if ( b >= hStereoDft->res_cod_band_max && !hStereoDft->frame_sid_nodata && !( sba_dirac_stereo_flag && hMdDec ) ) { @@ -1450,6 +1535,12 @@ void stereo_dft_dec( DFT_L[2 * i + 1] = pDFT_DMX[2 * i + 1] + tmp; DFT_R[2 * i + 1] = pDFT_DMX[2 * i + 1] - tmp; +#ifdef DEBUG_STEREO_DFT_OUTRESPRED + DFT_L[2 * i] = DFT_PRED_RES[2 * i]; + DFT_R[2 * i] = -DFT_PRED_RES[2 * i]; + DFT_L[2 * i + 1] = DFT_PRED_RES[2 * i + 1]; + DFT_R[2 * i + 1] = -DFT_PRED_RES[2 * i + 1]; +#endif /* DEBUG_STEREO_DFT_OUTRESPRED */ } for ( ; i < hStereoDft->band_limits[b + 1]; i++ ) @@ -1464,6 +1555,12 @@ void stereo_dft_dec( DFT_L[2 * i + 1] = pDFT_DMX[2 * i + 1] + tmp; DFT_R[2 * i + 1] = pDFT_DMX[2 * i + 1] - tmp; +#ifdef DEBUG_STEREO_DFT_OUTRESPRED + DFT_L[2 * i] = 0.f; + DFT_R[2 * i] = 0.f; + DFT_L[2 * i + 1] = 0.f; + DFT_R[2 * i + 1] = 0.f; +#endif /* DEBUG_STEREO_DFT_OUTRESPRED */ } /* Active Upmix */ @@ -1520,12 +1617,18 @@ void stereo_dft_dec( pPredGain = NULL; /* to avoid compilation warnings */ pSideGain = NULL; +#ifndef DEBUG_STEREO_DFT_NOSTEREO /* Dummy upmix-> mono binauralization */ for ( i = 0; i < hStereoDft->NFFT; i++ ) { DFT_L[i] = ( pDFT_DMX[i] + pDFT_RES[i] ); DFT_R[i] = ( pDFT_DMX[i] - pDFT_RES[i] ); } +#else + /*Copy DMX to Left channel and reset Right channel*/ + mvr2r( pDFT_DMX, DFT_L, hStereoDft->NFFT ); + mvr2r( pDFT_DMX, DFT_R, hStereoDft->NFFT ); +#endif } /* Comfort Noise Addition */ @@ -1598,10 +1701,12 @@ void stereo_dft_dec( /* Update memories */ hStereoDft->past_DMX_pos = ( hStereoDft->past_DMX_pos + 1 ) % STEREO_DFT_PAST_MAX; mvr2r( pDFT_DMX, hStereoDft->DFT_past_DMX[hStereoDft->past_DMX_pos], min( hStereoDft->NFFT, STEREO_DFT32MS_N_32k ) ); +#ifndef DEBUG_STEREO_DFT_NOSTEREO if ( pPredGain ) { stereo_dft_adapt_sf_delay( hStereoDft, pPredGain ); } +#endif mvr2r( DFT_L, DFT[0] + k * STEREO_DFT32MS_N_MAX, hStereoDft->NFFT ); mvr2r( DFT_R, DFT[1] + k * STEREO_DFT32MS_N_MAX, hStereoDft->NFFT ); @@ -1678,8 +1783,29 @@ void stereo_dft_dec_res( } } +#ifdef DEBUG_STEREO_DFT_NOQRES + { + int16_t tmp[1024]; + dbgread( &tmp, sizeof( int16_t ), L_FRAME8k, "./res/stereo_dft_enc_res_original.pcm" ); + for ( i = 0; i < L_FRAME8k; i++ ) + { + win[i] = (float) ( tmp[i] ); + } + } +#endif mvr2r( win, output, L_FRAME8k ); +#ifdef DEBUG_MODE_DFT + { + int16_t tmp[L_FRAME8k]; + + for ( i = 0; i < L_FRAME8k; i++ ) + { + tmp[i] = (int16_t) ( win[i] ); + } + dbgwrite( tmp, sizeof( int16_t ), L_FRAME8k, 1, "./res/stereo_dft_dec_res_decoded.pcm" ); + } +#endif if ( hCPE->hCoreCoder[0]->core == ACELP_CORE ) { /* bass post-filter */ @@ -1709,6 +1835,25 @@ void stereo_dft_dec_res( set_zero( hCPE->hStereoDft->hBpf->pst_old_syn, STEREO_DFT_NBPSF_PIT_MAX_8k ); hCPE->hStereoDft->hBpf->pst_mem_deemp_err = 0.f; } +#ifdef DEBUG_MODE_DFT + { + int16_t v; + int16_t out_bpf[L_FRAME8k]; + + if ( hCPE->hCoreCoder[0]->core == ACELP_CORE ) + { + for ( v = 0; v < L_FRAME8k; v++ ) + { + out_bpf[v] = (int16_t) bpf_error_signal_8k[v]; + } + } + else + { + set_s( out_bpf, 0, L_FRAME8k ); + } + dbgwrite( out_bpf, sizeof( int16_t ), L_FRAME8k, 1, "res/bpf_res.pcm" ); + } +#endif return; } @@ -1752,6 +1897,21 @@ void stereo_dft_dec_read_BS( float res_pred_gain_tmp[STEREO_DFT_BAND_MAX]; int16_t itd_mode; +#ifdef DEBUG_MODE_DFT + static FILE *pF = NULL; + static FILE *ITD_values = NULL, *side_gain_values = NULL, *RPG_values = NULL; + + if ( pF == NULL ) + pF = fopen( "./res/stereo_dft_dec_ind.txt", "w" ); + if ( ITD_values == NULL ) + ITD_values = fopen( "./res/itd_indicies_dec.txt", "w" ); + if ( side_gain_values == NULL ) + side_gain_values = fopen( "./res/side_gain_indicies_dec.txt", "w" ); + if ( RPG_values == NULL ) + RPG_values = fopen( "./res/rpg_indicies_dec.txt", "w" ); + + assert( *nb_bits <= 800 ); +#endif /*------------------------------------------------------------------* * Initialization *-----------------------------------------------------------------*/ @@ -1838,6 +1998,9 @@ void stereo_dft_dec_read_BS( { hStereoDft->res_cod_mode[k_offset] = get_next_indice( st, 1 ); ( *nb_bits )++; +#ifdef DEBUG_MODE_DFT + fprintf( pF, "res_cod_mode: %d\n", hStereoDft->res_cod_mode[k_offset] ); +#endif } /* read number of bands in the bitstream - depends on the audio bandwidth and not to output_Fs */ @@ -1873,6 +2036,10 @@ void stereo_dft_dec_read_BS( hStereoDft->res_cod_line_max = 8 * ( hStereoDft->res_cod_line_max / 8 ); hStereoDft->res_pred_band_min = max( STEREO_DFT_RES_PRED_BAND_MIN, hStereoDft->res_cod_band_max ); +#ifdef DEBUG_MODE_DFT + fprintf( pF, "stereo Data: %d %d %d %d %d\n", hStereoDft->band_res[k_offset], hStereoDft->prm_res[k_offset], hStereoDft->res_pred_mode[k_offset], hStereoDft->res_cod_mode[k_offset], hStereoDft->res_cod_band_max ); + fprintf( pF, "stereo Bands: %d\n", hStereoDft->nbands ); +#endif /*Copy config. for all DFT frames*/ set_s( hStereoDft->band_res + k_offset + 1, hStereoDft->band_res[k_offset], N_div - 1 ); @@ -1887,11 +2054,17 @@ void stereo_dft_dec_read_BS( /* Sent from the latest to the oldest */ for ( k = hStereoDft->prm_res[k_offset] - 1; k < N_div; k += hStereoDft->prm_res[k + k_offset] ) { +#ifdef DEBUG_MODE_DFT + fprintf( pF, "ch[%d]:", k ); +#endif /* reset parameters */ set_zero( hStereoDft->side_gain + ( k + k_offset ) * STEREO_DFT_BAND_MAX, STEREO_DFT_BAND_MAX ); hStereoDft->gipd[k + k_offset] = 0.f; set_zero( hStereoDft->res_pred_gain + ( k + k_offset ) * STEREO_DFT_BAND_MAX, STEREO_DFT_BAND_MAX ); +#ifdef DEBUG_MODE_DFT + fprintf( pF, "ITD: %d ", hStereoDft->hConfig->itd_mode ); +#endif if ( !( ivas_format == MASA_FORMAT && ivas_total_brate <= IVAS_SID_5k2 ) ) { @@ -1943,6 +2116,13 @@ void stereo_dft_dec_read_BS( hStereoDft->res_gains_ind[0][b + STEREO_DFT_BAND_MAX] = ind1[b]; } +#ifdef DEBUG_MODE_DFT + for ( b = 0; b < hStereoDft->nbands; b++ ) + { + fprintf( pF, "Side gain: %d ", ind1[b] ); + fprintf( side_gain_values, " %d ", ind1[b] ); + } +#endif st->next_bit_pos += n_bits; ( *nb_bits ) += n_bits; } @@ -1961,6 +2141,10 @@ void stereo_dft_dec_read_BS( { ( *nb_bits ) += read_itd( st, &I ); stereo_dft_dequantize_itd( &I, hStereoDft->itd + k + k_offset, st->output_Fs ); +#ifdef DEBUG_MODE_DFT + fprintf( pF, "ITD: %d ", I ); + fprintf( ITD_values, "%d %d ", frame, I ); +#endif } } else if ( *nb_bits <= ( ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - STEREO_DFT_ITD_MODE_NBITS - STEREO_DFT_SID_ITD_NBITS - 1 - SID_FORMAT_NBITS ) ) @@ -1977,6 +2161,10 @@ void stereo_dft_dec_read_BS( I = I << STEREO_DFT_SID_ITD_FAC; I += 256 * sign_flag; stereo_dft_dequantize_itd( &I, hStereoDft->itd + k + k_offset, st->output_Fs ); +#ifdef DEBUG_MODE_DFT + fprintf( pF, "ITD: %d ", I ); + fprintf( ITD_values, "%d %d ", frame, I ); +#endif } } @@ -2047,6 +2235,9 @@ void stereo_dft_dec_read_BS( hStereoDft->reverb_flag = get_next_indice( st, STEREO_DFT_REVERB_MODE_NBITS ); ( *nb_bits ) += STEREO_DFT_REVERB_MODE_NBITS; nb += STEREO_DFT_REVERB_MODE_NBITS; +#ifdef DEBUG_MODE_DFT + fprintf( RPG_values, " reverb_flag %d ", hStereoDft->reverb_flag ); +#endif if ( hStereoDft->reverb_flag ) { nbands -= STEREO_DFT_RES_PRED_BAND_MIN_CONST; @@ -2060,6 +2251,9 @@ void stereo_dft_dec_read_BS( if ( hStereoDft->res_pred_flag_0 == 0 ) { +#ifdef DEBUG_MODE_DFT + fprintf( RPG_values, "flag: 0" ); +#endif b = read_BS_adapt_GR_rpg( st->bit_stream, nb, ind1_pred, hStereoDft->res_pred_band_min, nbands, &hStereoDft->res_pred_flag_1 ); n_bits += b; } @@ -2067,6 +2261,9 @@ void stereo_dft_dec_read_BS( { if ( hStereoDft->res_pred_flag_0 == 2 ) { +#ifdef DEBUG_MODE_DFT + fprintf( RPG_values, "flag: 2" ); +#endif b = read_BS_GR( st->bit_stream, nb, &ind1_pred[hStereoDft->res_pred_band_min], nbands - hStereoDft->res_pred_band_min, &hStereoDft->res_pred_flag_1 ); n_bits += b; @@ -2077,6 +2274,9 @@ void stereo_dft_dec_read_BS( } else { +#ifdef DEBUG_MODE_DFT + fprintf( RPG_values, "flag: 1" ); +#endif for ( b = hStereoDft->res_pred_band_min; b < nbands; b++ ) { ind1_pred[b] = get_value( &st->bit_stream[nb], STEREO_DFT_RES_GAINS_BITS ); @@ -2098,6 +2298,13 @@ void stereo_dft_dec_read_BS( { I = ind1_pred[b]; stereo_dft_dequantize_res_gains( ind1 + b, &I, hStereoDft->side_gain + ( k + k_offset ) * STEREO_DFT_BAND_MAX + b, hStereoDft->res_pred_gain + ( k + k_offset ) * STEREO_DFT_BAND_MAX + b, 1 ); +#ifdef DEBUG_MODE_DFT + fprintf( pF, "Res pred values: %d ", I ); + if ( hStereoDft->res_pred_flag_0 == 2 ) + fprintf( RPG_values, " %d(%d) ", I, hStereoDft->res_pred_index_previous[b] ); + else + fprintf( RPG_values, " %d ", I ); +#endif hStereoDft->res_pred_index_previous[b] = I; hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX] = I; } @@ -2138,6 +2345,9 @@ void stereo_dft_dec_read_BS( } } +#ifdef DEBUG_MODE_DFT + /*fprintf(stderr, "\nbres: %d\n", *nb_bits - nb_bits0);*/ +#endif } if ( !( ivas_format == MASA_FORMAT && ivas_total_brate <= IVAS_SID_5k2 ) ) @@ -2171,6 +2381,9 @@ void stereo_dft_dec_read_BS( I = get_next_indice( st, STEREO_DFT_RES_GLOBAL_GAIN_BITS ); ( *nb_bits ) += STEREO_DFT_RES_GLOBAL_GAIN_BITS; +#ifdef DEBUG_MODE_DFT + fprintf( pF, "\nGain: %d ", I ); +#endif push_wmops( "residual_decode" ); if ( I != ECSQ_GLOBAL_GAIN_INDEX_ALL_ZERO ) @@ -2187,6 +2400,10 @@ void stereo_dft_dec_read_BS( n_bits = rc_uni_dec_finish( &range_uni_dec_state ); +#ifdef DEBUGGING + /* IVAS_fmToDo: the assert has to be changed with proper bitstream error handling */ + assert( range_uni_dec_state.bit_error_detected == 0 ); +#endif set_zero( res_buf, STEREO_DFT_N_8k ); ECSQ_dequantize_vector( dec, hStereoDft->res_global_gain, hStereoDft->res_cod_line_max, res_buf ); @@ -2202,6 +2419,10 @@ void stereo_dft_dec_read_BS( ( *nb_bits ) += n_bits; pop_wmops(); +#ifdef DEBUG_MODE_DFT + fprintf( pF, "%d (max: %d)", n_bits + STEREO_DFT_RES_GLOBAL_GAIN_BITS, max_bits ); + /*fprintf(pF, "%d (max: %d)", n_bits, max_bits);*/ +#endif } if ( hStereoDft->frame_sid && !( ivas_format == MASA_FORMAT && ivas_total_brate <= IVAS_SID_5k2 ) ) @@ -2217,6 +2438,13 @@ void stereo_dft_dec_read_BS( *total_brate = element_brate - ( *nb_bits * FRAMES_PER_SEC ); } +#ifdef DEBUG_MODE_DFT + /*fprintf(pF, "Total bits: %d", (*nb_bits));*/ + fprintf( pF, "\n" ); + fprintf( ITD_values, "\n" ); + fprintf( side_gain_values, "\n" ); + fprintf( RPG_values, "\n" ); +#endif return; } @@ -2506,6 +2734,7 @@ void stereo_dft_generate_res_pred( } } +#ifndef DEBUG_STEREO_DFT_NOCORE if ( hStereoDft->band_limits[nbands_respred] > bin0 ) { /* apply stereo filling in ACELP BWE region */ @@ -2569,6 +2798,7 @@ void stereo_dft_generate_res_pred( } } else +#endif { for ( b = band0; b < nbands_respred; b++ ) { @@ -2615,6 +2845,7 @@ void stereo_dft_generate_res_pred( g_long = 0.0f; g_short = 1.0f; } +#ifndef DEBUG_STEREO_DFT_NOCORE if ( hStereoDft->core_hist[d_short / 2] == ACELP_CORE ) { g_short = 0; @@ -2623,6 +2854,7 @@ void stereo_dft_generate_res_pred( { g_long = 0; } +#endif if ( max( g_short, g_long ) > 0 ) { @@ -2658,7 +2890,9 @@ void stereo_dft_generate_res_pred( } } } +#ifndef DEBUG_STEREO_DFT_NOCORE } +#endif /* update buffers */ for ( b = hStereoDft->res_pred_band_min; b < hStereoDft->nbands; b++ ) @@ -3063,6 +3297,14 @@ static void stereo_dft_adapt_sf_delay( hStereoDft->stefi_short_gain = ( STEREO_DFT_STEFFI_DELAY_LONG - target_delay ) / ( STEREO_DFT_STEFFI_DELAY_LONG - STEREO_DFT_STEFFI_DELAY_SHORT ); hStereoDft->stefi_long_gain = sqrtf( 1.0f - hStereoDft->stefi_short_gain * hStereoDft->stefi_short_gain ); +#ifdef DEBUG_MODE_DFT + dbgwrite( &hStereoDft->lt_pred_gain, sizeof( float ), 1, 1, "res/stereo_dft_lt_pred_gain_b.pcm" ); + dbgwrite( &hStereoDft->lt_pred_gain_variation, sizeof( float ), 1, 1, "res/stereo_dft_lt_pred_gain_variance_b.pcm" ); + dbgwrite( &hStereoDft->lt_var_mean_ratio, sizeof( float ), 1, 1, "res/stereo_dft_lt_var_mean_ratio_b.pcm" ); + dbgwrite( &target_delay, sizeof( float ), 1, 1, "res/stereo_dft_target_delay.pcm" ); + dbgwrite( &hStereoDft->stefi_short_gain, sizeof( float ), 1, 1, "res/stereo_dft_short_gain.pcm" ); + dbgwrite( &hStereoDft->stefi_long_gain, sizeof( float ), 1, 1, "res/stereo_dft_long_gain.pcm" ); +#endif /* DEBUG_MODE_DFT */ return; } diff --git a/lib_dec/ivas_stereo_dft_dec_dmx.c b/lib_dec/ivas_stereo_dft_dec_dmx.c index 120a060b2..e9bb3bc49 100644 --- a/lib_dec/ivas_stereo_dft_dec_dmx.c +++ b/lib_dec/ivas_stereo_dft_dec_dmx.c @@ -41,6 +41,9 @@ #include "ivas_rom_com.h" #include "ivas_rom_dec.h" #include "rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -170,6 +173,9 @@ void stereo_dft_unify_dmx( { g = pSideGain[b]; +#ifdef DEBUG_MODE_DFT + dbgwrite( &g, sizeof( float ), 1, 1, "./res/stereo_dft_dec_g.pcm" ); +#endif for ( i = hStereoDft->band_limits[b]; i < hStereoDft->band_limits[b + 1]; i++ ) { diff --git a/lib_dec/ivas_stereo_dft_plc.c b/lib_dec/ivas_stereo_dft_plc.c index 8c7611f73..4c026dfb7 100644 --- a/lib_dec/ivas_stereo_dft_plc.c +++ b/lib_dec/ivas_stereo_dft_plc.c @@ -37,6 +37,9 @@ #include "ivas_cnst.h" #include "ivas_prot.h" #include "math.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" /*--------------------------------------------------------------- diff --git a/lib_dec/ivas_stereo_eclvq_dec.c b/lib_dec/ivas_stereo_eclvq_dec.c index 0a16d2acc..b47c3d219 100644 --- a/lib_dec/ivas_stereo_eclvq_dec.c +++ b/lib_dec/ivas_stereo_eclvq_dec.c @@ -132,6 +132,9 @@ void ECSQ_decode( rc_st_dec = (RangeUniDecState *) ecsq_inst->ac_handle; +#ifdef DEBUGGING + assert( N > 0 ); +#endif segment_count = ( N + ECSQ_SEGMENT_SIZE - 1 ) / ECSQ_SEGMENT_SIZE; @@ -178,6 +181,9 @@ void ECSQ_decode( } else { +#ifdef DEBUGGING + assert( ECSQ_NONZERO_MAX == 3 ); +#endif nonzero = rc_uni_dec_read_bits( rc_st_dec, 2 ); diff --git a/lib_dec/ivas_stereo_esf_dec.c b/lib_dec/ivas_stereo_esf_dec.c index 391398fd0..ff7e810e8 100644 --- a/lib_dec/ivas_stereo_esf_dec.c +++ b/lib_dec/ivas_stereo_esf_dec.c @@ -35,6 +35,9 @@ #include "ivas_prot.h" #include "ivas_stat_dec.h" #include "ivas_cnst.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" /*-------------------------------------------------------------------* diff --git a/lib_dec/ivas_stereo_ica_dec.c b/lib_dec/ivas_stereo_ica_dec.c index 760d81ce6..b400dee72 100644 --- a/lib_dec/ivas_stereo_ica_dec.c +++ b/lib_dec/ivas_stereo_ica_dec.c @@ -38,6 +38,9 @@ #include "ivas_cnst.h" #include "prot.h" #include "ivas_prot.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" #include "rom_com.h" #include "ivas_rom_com.h" @@ -206,6 +209,11 @@ void stereo_tca_dec( l_shift_adapt = l_shift_adapt >> 1; } +#ifdef DEBUGGING + /* Max sample looked in INTERP1 should lie within the bounds of output_frame and memory populated */ + assert( ( ( min( N_MAX_SHIFT_CHANGE, N_MAX_SHIFT_CHANGE * output_Fs / 32000.0f ) + 1 ) + SINC_ORDER1 / INTERP_FACTOR1 ) + l_shift_adapt - currentNCShift < output_frame ); + assert( ( ( min( N_MAX_SHIFT_CHANGE, N_MAX_SHIFT_CHANGE * output_Fs / 32000.0f ) + 1 ) + SINC_ORDER1 / INTERP_FACTOR1 + currentNCShift ) <= L_DEC_MEM_LEN_ICA ); +#endif if ( abs( currentNCShift - prevNCShift ) <= N_MAX_SHIFT_CHANGE && bothChannelShift == 0 ) { adjustTargetSignal( target - currentNCShift, currentNCShift, prevNCShift, l_shift_adapt, 0 ); diff --git a/lib_dec/ivas_stereo_icbwe_dec.c b/lib_dec/ivas_stereo_icbwe_dec.c index 334fb5bd7..aad34a875 100644 --- a/lib_dec/ivas_stereo_icbwe_dec.c +++ b/lib_dec/ivas_stereo_icbwe_dec.c @@ -41,6 +41,9 @@ #include "wmc_auto.h" #include "rom_com.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif /*-------------------------------------------------------------------* * ic_bwe_dec_reset() @@ -167,6 +170,21 @@ void stereo_icBWE_dec( hCPE->hStereoDft->hb_nrg[0] = hb_nrg; hCPE->hStereoDft->td_gain[0] = 0; hCPE->hStereoDft->core_hist[0] = st->core; +#ifdef DEBUG_MODE_DFT + { + int16_t tmp[L_FRAME48k]; + for ( i = 0; i < output_frame; i++ ) + { + tmp[i] = (int16_t) synthRef[i]; + } + dbgwrite( tmp, sizeof( int16_t ), output_frame, 1, "res/hb_synth.pcm" ); + for ( i = 0; i < output_frame; i++ ) + { + tmp[i] = (int16_t) hCPE->hStereoDft->hb_stefi_sig[i + output_frame / 2]; + } + dbgwrite( tmp, sizeof( int16_t ), output_frame, 1, "res/hb_stefi_sig.pcm" ); + } +#endif /* DEBUG_MODE_DFT */ } /*--------------------------------------------------------------------* @@ -666,7 +684,11 @@ void stereo_icBWE_decproc( { v_add( temp0, output[0], output[0], output_frame ); +#ifdef DEBUG_STEREO_DFT_NOSTEREO + v_add( temp0, output[1], output[1], output_frame ); +#else v_add( temp1, output[1], output[1], output_frame ); +#endif } mvr2r( outputHB[0] + output_frame - memOffset, hStereoICBWE->memOutHB[0], memOffset ); mvr2r( outputHB[1] + output_frame - memOffset, hStereoICBWE->memOutHB[1], memOffset ); diff --git a/lib_dec/ivas_stereo_mdct_core_dec.c b/lib_dec/ivas_stereo_mdct_core_dec.c index 20a6e3e5b..c95729bc2 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec.c +++ b/lib_dec/ivas_stereo_mdct_core_dec.c @@ -39,6 +39,9 @@ #include "stat_com.h" #include "ivas_prot.h" #include "ivas_stat_dec.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -332,6 +335,9 @@ void stereo_mdct_core_dec( if ( ( !bfi || !( sts[0]->core == ACELP_CORE && sts[1]->core == ACELP_CORE ) ) && !hCPE->hStereoMdct->isSBAStereoMode ) { +#ifdef DEBUGGING + assert( ( sts[0]->core == sts[1]->core ) || ( ( hCPE->hStereoMdct->mdct_stereo_mode[0] == SMDCT_DUAL_MONO ) && ( hCPE->hStereoMdct->mdct_stereo_mode[1] == SMDCT_DUAL_MONO ) ) ); +#endif stereo_decoder_tcx( hCPE->hStereoMdct, ms_mask, x_0[1], x[0], x[1], &hCPE->hStereoMdct->mdct_stereo_mode[0], sts[0]->core, sts[1]->core, sts[0]->igf, L_frameTCX[0], L_frameTCX[1], 0, sts[0]->last_core, sts[1]->last_core, 0 ); } diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec.c b/lib_dec/ivas_stereo_mdct_stereo_dec.c index 42cbf3378..bd0fa38e0 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec.c @@ -64,6 +64,9 @@ void parse_stereo_from_bitstream( { int16_t i, k, nSubframes, mdct_stereo_mode; STEREO_MDCT_BAND_PARAMETERS *sfbConf; +#ifdef DEBUGGING + int16_t nbits_start = st0->next_bit_pos; +#endif if ( !isSBAStereoMode ) { @@ -182,6 +185,13 @@ void parse_stereo_from_bitstream( assert( hStereoMdct->split_ratio > 0 ); } +#ifdef DEBUGGING + { + int16_t nBitsStereo = st0->next_bit_pos - nbits_start; + + assert( nBitsStereo <= st0->bits_frame_nominal ); + } +#endif return; } @@ -260,6 +270,12 @@ void stereo_decoder_tcx( } } } +#ifdef DEBUGGING + else if ( mdct_stereo_mode[k] != SMDCT_DUAL_MONO ) + { + assert( !"Not supported MDCT stereo mode!\n" ); + } +#endif if ( igf ) { @@ -291,6 +307,12 @@ void stereo_decoder_tcx( } } } +#ifdef DEBUGGING + else if ( hStereoMdct->IGFStereoMode[k] != SMDCT_DUAL_MONO ) + { + assert( !"Not supported MDCT stereo mode!\n" ); + } +#endif } if ( !mct_on ) diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 96ff3f48f..d311d7b41 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" @@ -1835,6 +1838,9 @@ void smooth_dft2td_transition( if ( ( ipit_max + corr_len ) > ilen ) /*ensure the search is performed on the available memory*/ { +#ifdef DEBUG_MODE_TD + /*printf( "**********Pitch too long = %d, skipping this loop at frame %d\n", ipit_max + corr_len, frame );*/ +#endif continue; } @@ -1874,6 +1880,9 @@ void smooth_dft2td_transition( ptO[i] = pt1[i]; } } +#ifdef DEBUG_MODE_TD + /*printf( "ch %d, ipit_max %d ipit_min %d, ipit %d :::: lsearch %d\tidiff %d\t%.4f At frame : \t%d\n", ch, ipit_max, ipit_min, ipit, lsearch, idiff, fmaxcorr, frame );*/ +#endif /* Set buffer for the reserved buffer of the current frame */ ptO2 = tmp_out2 + output_frame - ilen; @@ -1908,6 +1917,9 @@ void smooth_dft2td_transition( ptO2[i] = pt1[i]; } } +#ifdef DEBUG_MODE_TD + /*printf( "ch %d, ipit_max %d ipit_min %d, ipit %d :::: lsearch %d\tidiff %d\t%.4f At frame : \t%d\n", ch, ipit_max, ipit_min, ipit, lsearch, idiff, fmaxcorr, frame );*/ +#endif /* perform OVA between predicted signals */ flen = 1.0f / ilen; diff --git a/lib_dec/ivas_stereo_td_dec.c b/lib_dec/ivas_stereo_td_dec.c index f7a26cdef..41018cae2 100644 --- a/lib_dec/ivas_stereo_td_dec.c +++ b/lib_dec/ivas_stereo_td_dec.c @@ -39,6 +39,9 @@ #include "ivas_prot.h" #include "ivas_rom_com.h" #include "ivas_cnst.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" /*-------------------------------------------------------------------* @@ -247,6 +250,12 @@ void tdm_configure_dec( hCPE->hStereoTCA->targetGain = powf( 10, hCPE->hStereoTCA->targetGain ); } +#ifdef DEBUG_MODE_TD + dbgwrite( &mod_ct, 2, 1, 320, "res/mod_ct.dec" ); + dbgwrite( tdm_ratio_idx, 2, 1, 320, "res/tdm_ratio_idx.dec" ); + dbgwrite( &tdm_inst_ratio_idx, 2, 1, 320, "res/tdm_inst_ratio_idx.dec" ); + dbgwrite( &hStereoTD->tdm_lp_reuse_flag, 2, 1, 320, "res/tdm_lp_reuse_flag.dec" ); +#endif /* set the BW of the secondary channel */ if ( hStereoTD->tdm_LRTD_flag && sts[1]->bits_frame_channel >= IVAS_16k4 / FRAMES_PER_SEC ) diff --git a/lib_dec/ivas_svd_dec.c b/lib_dec/ivas_svd_dec.c index 9ea4af761..d2c72d62a 100644 --- a/lib_dec/ivas_svd_dec.c +++ b/lib_dec/ivas_svd_dec.c @@ -37,6 +37,9 @@ #include "ivas_stat_dec.h" #include "ivas_cnst.h" #include +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index d705b8f45..71e20a5df 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -33,6 +33,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "rom_com.h" @@ -246,6 +249,10 @@ void stereo_tcx_core_dec( set_zero( synth, L_FRAME_PLUS + M ); set_zero( synthFB, L_FRAME_PLUS + M ); +#ifdef DEBUG_MODE_INFO_PLC + dbgwrite( synth_buf, sizeof( float ), OLD_SYNTH_SIZE_DEC + L_FRAME_PLUS + M, 1, "res/synth_buf_init" ); + dbgwrite( synth_bufFB, sizeof( float ), OLD_SYNTH_SIZE_DEC + L_FRAME_PLUS + M, 1, "res/synthFB_buf_init" ); +#endif /*--------------------------------------------------------------------------------* * BITSTREAM DECODING @@ -731,6 +738,29 @@ void stereo_tcx_core_dec( } } +#ifdef DEBUG_MODE_TCX + { + int16_t tmp[L_FRAME48k]; + static FILE *sP = NULL; + + for ( i = 0; i < hTcxDec->L_frameTCX; i++ ) + { + tmp[i] = (int16_t) ( signal_outFB[i] + 0.5f ); + } + dbgwrite( tmp, sizeof( int16_t ), hTcxDec->L_frameTCX, 1, "./res/stereo_tcx_dec_synthFB.pcm" ); + + for ( i = 0; i < hTcxDec->L_frameTCX; i++ ) + { + tmp[i] = (int16_t) ( signal_out[i] + 0.5f ); + } + dbgwrite( tmp, sizeof( int16_t ), hTcxDec->L_frameTCX, 1, "./res/stereo_tcx_dec_synthLB.pcm" ); + + if ( sP == NULL ) + sP = fopen( "./res/stereo_tcx_core_dec_swicthes.txt", "w" ); + + fprintf( sP, "frame:%d\t mdct_sw=%d\t rf_mode=%d tcxonly=%d\t tcxMode=%d\t core=%d\t, enableTcxLpc=%d\t igf=%d\t envWeighted=%d\t lpcQuantization=%d\t enablePlcWaveadjust=%d\t tcxltp=%d\t fIsTNSAllowed=%d\t tcx_lpc_shaped_ari=%d\t ctx_hm=%d\t \n", frame, st->mdct_sw, 0, st->tcxonly, 0, st->core, hTcxDec->enableTcxLpc, st->igf, hTcxDec->envWeighted, st->lpcQuantization, st->enablePlcWaveadjust, hTcxLtpDec->tcxltp, st->hTcxCfg->fIsTNSAllowed, 0, st->hTcxCfg->ctx_hm ); + } +#endif pop_wmops(); @@ -756,6 +786,12 @@ static void dec_prm_tcx( int16_t start_bit_pos, bits_common; CONTEXT_HM_CONFIG hm_cfg; int16_t indexBuffer[N_MAX + 1]; +#ifdef DEBUG_MODE_TCX + int16_t nbits_tcx; + static FILE *pF = NULL; + if ( pF == NULL ) + pF = fopen( "./res/stereo_tcx_dec_ind.txt", "w" ); +#endif assert( st->mdct_sw == MODE1 ); @@ -764,6 +800,10 @@ static void dec_prm_tcx( *--------------------------------------------------------------------------------*/ hm_cfg.indexBuffer = indexBuffer; +#ifdef DEBUG_MODE_TCX + fprintf( pF, "== stereo Chan %d - Nominal Bits %d - Allocated Bits %d ==\n", st->idchan, st->bits_frame_nominal, (int16_t) ( st->total_brate / FRAMES_PER_SEC ) ); + fprintf( pF, "stereo Common Header: %d bits\n", st->next_bit_pos ); +#endif if ( st->element_mode != IVAS_CPE_MDCT ) { st->bits_frame_core = (int16_t) ( ( st->total_brate / FRAMES_PER_SEC ) - st->next_bit_pos ); @@ -822,6 +862,10 @@ static void dec_prm_tcx( } } +#ifdef DEBUG_MODE_TCX + fprintf( pF, "\t TCX Header: %d bits: %d %d %d %d\n", st->next_bit_pos - start_bit_pos, st->tcxonly, st->core, st->tcxonly ? st->clas_dec : st->hTcxCfg->coder_type, st->hTcxCfg->tcx_curr_overlap_mode ); + nbits_tcx = st->next_bit_pos; +#endif /*--------------------------------------------------------------------------------* * LPC parameters @@ -831,6 +875,9 @@ static void dec_prm_tcx( bits_common = st->next_bit_pos - start_bit_pos; +#ifdef DEBUG_MODE_TCX + fprintf( pF, "\t TCX LPC: %d bits\n", st->next_bit_pos - nbits_tcx ); +#endif /*--------------------------------------------------------------------------------* * TCX20/10 parameters diff --git a/lib_dec/ivas_td_low_rate_dec.c b/lib_dec/ivas_td_low_rate_dec.c index 646c6561d..8ab266345 100644 --- a/lib_dec/ivas_td_low_rate_dec.c +++ b/lib_dec/ivas_td_low_rate_dec.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "stat_enc.h" #include "rom_com.h" diff --git a/lib_dec/jbm_jb4_circularbuffer.c b/lib_dec/jbm_jb4_circularbuffer.c index da95e4135..b1067f96e 100644 --- a/lib_dec/jbm_jb4_circularbuffer.c +++ b/lib_dec/jbm_jb4_circularbuffer.c @@ -39,6 +39,9 @@ #include "options.h" #include "string.h" #include "prot.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" /* local includes */ #include "jbm_jb4_circularbuffer.h" diff --git a/lib_dec/jbm_jb4_inputbuffer.c b/lib_dec/jbm_jb4_inputbuffer.c index 852c95946..32c870bfa 100644 --- a/lib_dec/jbm_jb4_inputbuffer.c +++ b/lib_dec/jbm_jb4_inputbuffer.c @@ -41,6 +41,9 @@ #include "options.h" #include "prot.h" #include "string.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "jbm_jb4_inputbuffer.h" #include "wmc_auto.h" @@ -208,6 +211,14 @@ int16_t JB4_INPUTBUFFER_Enque( } } +#ifdef DEBUGGING + assert( h->compareFunction( element, JB4_INPUTBUFFER_Element( h, low ), &replace ) != 0 ); + if ( low > 0 ) + assert( h->compareFunction( element, JB4_INPUTBUFFER_Element( h, low - 1 ), &replace ) > 0 ); + assert( h->compareFunction( element, JB4_INPUTBUFFER_Element( h, low ), &replace ) < 0 ); + if ( (uint16_t) ( low + 1 ) < size ) + assert( h->compareFunction( element, JB4_INPUTBUFFER_Element( h, low + 1 ), &replace ) < 0 ); +#endif insertPos = ( h->readPos + low ) % h->capacity; if ( h->readPos < h->writePos ) diff --git a/lib_dec/jbm_jb4_jmf.c b/lib_dec/jbm_jb4_jmf.c index 99abd75e5..5d7dfa2e6 100644 --- a/lib_dec/jbm_jb4_jmf.c +++ b/lib_dec/jbm_jb4_jmf.c @@ -43,6 +43,9 @@ #include #include "options.h" #include "prot.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" /* local includes */ diff --git a/lib_dec/jbm_jb4sb.c b/lib_dec/jbm_jb4sb.c index 04a2aac31..755187b64 100644 --- a/lib_dec/jbm_jb4sb.c +++ b/lib_dec/jbm_jb4sb.c @@ -42,6 +42,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" /* local headers */ #include "jbm_jb4_circularbuffer.h" diff --git a/lib_dec/jbm_pcmdsp_apa.c b/lib_dec/jbm_pcmdsp_apa.c index 8a69fa78e..1242004fc 100644 --- a/lib_dec/jbm_pcmdsp_apa.c +++ b/lib_dec/jbm_pcmdsp_apa.c @@ -44,6 +44,9 @@ #include #include "options.h" #include "prot.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" /* local headers */ #include "jbm_pcmdsp_apa.h" diff --git a/lib_dec/jbm_pcmdsp_similarityestimation.c b/lib_dec/jbm_pcmdsp_similarityestimation.c index 13b3a3190..c67e71d59 100644 --- a/lib_dec/jbm_pcmdsp_similarityestimation.c +++ b/lib_dec/jbm_pcmdsp_similarityestimation.c @@ -41,6 +41,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" /* local headers */ diff --git a/lib_dec/jbm_pcmdsp_window.c b/lib_dec/jbm_pcmdsp_window.c index 942f25db6..15f692fb8 100644 --- a/lib_dec/jbm_pcmdsp_window.c +++ b/lib_dec/jbm_pcmdsp_window.c @@ -38,6 +38,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "jbm_pcmdsp_window.h" #include "cnst.h" #include "wmc_auto.h" diff --git a/lib_dec/lead_deindexing.c b/lib_dec/lead_deindexing.c index 0b3c68d10..830daa812 100644 --- a/lib_dec/lead_deindexing.c +++ b/lib_dec/lead_deindexing.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "rom_com.h" diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 9281c292d..000ed618a 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -41,6 +41,9 @@ #include #include #include +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" /*---------------------------------------------------------------------* @@ -629,6 +632,12 @@ ivas_error IVAS_DEC_EnableVoIP( { hDecoderConfig->nchan_out = audioCfg2channels( hDecoderConfig->output_config ); } +#ifdef VARIABLE_SPEED_DECODING + else + { + hDecoderConfig->nchan_out = 1; + } +#endif if ( ( error = input_format_API_to_internal( inputFormat, &hIvasDec->bitstreamformat, &hIvasDec->sdp_hf_only, true ) ) != IVAS_ERR_OK ) { @@ -1677,6 +1686,20 @@ static ivas_error copyRendererConfigStruct( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } +#ifdef DEBUGGING + switch ( hRCin->renderer_type_override ) + { + case IVAS_RENDER_TYPE_OVERRIDE_CREND: + hRCout->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_CREND; + break; + case IVAS_RENDER_TYPE_OVERRIDE_FASTCONV: + hRCout->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_FASTCONV; + break; + default: + hRCout->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_NONE; + break; + } +#endif hRCout->roomAcoustics.override = hRCin->roomAcoustics.override; hRCout->roomAcoustics.nBands = hRCin->roomAcoustics.nBands; hRCout->roomAcoustics.acousticPreDelay = hRCin->roomAcoustics.acousticPreDelay; @@ -1749,6 +1772,17 @@ ivas_error IVAS_DEC_FeedRenderConfig( } hRenderConfig = hIvasDec->st_ivas->hRenderConfig; +#ifdef DEBUGGING + hRenderConfig->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_NONE; + if ( renderConfig.renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV ) + { + hRenderConfig->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_FASTCONV; + } + if ( renderConfig.renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_CREND ) + { + hRenderConfig->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_CREND; + } +#endif hRenderConfig->roomAcoustics.override = renderConfig.roomAcoustics.override; hRenderConfig->roomAcoustics.nBands = renderConfig.roomAcoustics.nBands; hRenderConfig->roomAcoustics.acousticPreDelay = renderConfig.roomAcoustics.acousticPreDelay; @@ -2707,6 +2741,59 @@ void IVAS_DEC_PrintConfig( } +#ifdef DEBUGGING +#define WMC_TOOL_SKIP +void IVAS_DEC_PrintConfigWithBitstream( + IVAS_DEC_HANDLE hIvasDec, + const bool quietModeEnabled, + uint16_t bit_stream[], + const int16_t num_bits ) +{ + Decoder_Struct *st_ivas; + + /* Create a copy of decoder struct that will be modified by preview_indices(), + * leaving the original decoder struct unchanged. The additional memory used here + * should not be counted towards memory footprint of the decoder. */ + st_ivas = malloc( sizeof( Decoder_Struct ) ); + memcpy( st_ivas, hIvasDec->st_ivas, sizeof( Decoder_Struct ) ); + + preview_indices( st_ivas, bit_stream, num_bits ); + + /* Print config from modified decoder struct */ + printConfigInfo_dec( st_ivas, hIvasDec->bitstreamformat, hIvasDec->Opt_VOIP, quietModeEnabled ); + + free( st_ivas ); + + return; +} + +void IVAS_DEC_PrintConfigWithVoipBitstream( + IVAS_DEC_HANDLE hIvasDec, + const bool quietModeEnabled, + uint8_t *au, + const uint16_t auSizeBits ) +{ + Decoder_Struct *st_ivas; + uint16_t bit_stream[MAX_BITS_PER_FRAME + 4 * 8]; + + /* Create a copy of decoder struct that will be modified by preview_indices(), + * leaving the original decoder struct unchanged. The additional memory used here + * should not be counted towards memory footprint of the decoder. */ + st_ivas = malloc( sizeof( Decoder_Struct ) ); + memcpy( st_ivas, hIvasDec->st_ivas, sizeof( Decoder_Struct ) ); + + bsCompactToSerial( au, bit_stream, auSizeBits ); + preview_indices( st_ivas, bit_stream, auSizeBits ); + + /* Print config from modified decoder struct */ + printConfigInfo_dec( st_ivas, hIvasDec->bitstreamformat, hIvasDec->Opt_VOIP, quietModeEnabled ); + + free( st_ivas ); + + return; +} +#undef WMC_TOOL_SKIP +#endif /*---------------------------------------------------------------------* @@ -2814,11 +2901,17 @@ static ivas_error evs_dec_main( int16_t pcm_buf_local[L_FRAME48k * MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN]; /* convert 'float' output data to 'short' */ +#ifdef DEBUGGING + st_ivas->noClipping += +#endif ivas_syn_output( p_output, nOutSamples, st_ivas->hDecoderConfig->nchan_out, pcm_buf_local ); mvs2r( pcm_buf_local, floatBuf, nOutSamples * st_ivas->hDecoderConfig->nchan_out ); } else { +#ifdef DEBUGGING + st_ivas->noClipping += +#endif ivas_syn_output( p_output, nOutSamples, st_ivas->hDecoderConfig->nchan_out, pcmBuf ); } @@ -2826,6 +2919,157 @@ static ivas_error evs_dec_main( } +#ifdef DEBUGGING +/*---------------------------------------------------------------------* + * IVAS_DEC_GetBer_detect_flag() + * + * return BER_detect flag + *---------------------------------------------------------------------*/ + +bool IVAS_DEC_GetBerDetectFlag( + IVAS_DEC_HANDLE hIvasDec /* i : IVAS decoder handle */ +) +{ + if ( hIvasDec->st_ivas->BER_detect == 1 ) + { + return 1; + } + else + { + return 0; + } +} + + +/*---------------------------------------------------------------------* + * IVAS_DEC_GetNoCLipping() + * + * return number of clipped samples + *---------------------------------------------------------------------*/ + +int32_t IVAS_DEC_GetNoCLipping( + IVAS_DEC_HANDLE hIvasDec /* i : IVAS decoder handle */ +) +{ + return hIvasDec->st_ivas->noClipping; +} + + +/*---------------------------------------------------------------------* + * IVAS_DEC_GetCntFramesLimited() + * + * return number of frames where limiter is applied + *---------------------------------------------------------------------*/ + +int32_t IVAS_DEC_GetCntFramesLimited( + IVAS_DEC_HANDLE hIvasDec /* i : IVAS decoder handle */ +) +{ + if ( hIvasDec->st_ivas->hLimiter == NULL ) + { + return 0; + } + else + { + return hIvasDec->st_ivas->hLimiter->cnt_frames_limited; + } +} + + +/*---------------------------------------------------------------------* + * forcedRendModeApiToInternalDec() + * + * + *---------------------------------------------------------------------*/ + +static ivas_error forcedRendModeApiToInternalDec( + const IVAS_DEC_FORCED_REND_MODE forcedRendMode, + int16_t *forcedModeInternal ) +{ + switch ( forcedRendMode ) + { + case IVAS_DEC_FORCE_REND_TD_RENDERER: + *forcedModeInternal = FORCE_TD_RENDERER; + break; + case IVAS_DEC_FORCE_REND_CLDFB_RENDERER: + *forcedModeInternal = FORCE_CLDFB_RENDERER; + break; + case IVAS_DEC_FORCE_REND_UNFORCED: + *forcedModeInternal = -1; + break; + default: + return IVAS_ERR_INVALID_FORCE_MODE; + break; + } + + return IVAS_ERR_OK; +} + + +/*---------------------------------------------------------------------* + * IVAS_DEC_SetForcedRendMode() + * + * + *---------------------------------------------------------------------*/ + +ivas_error IVAS_DEC_SetForcedRendMode( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const IVAS_DEC_FORCED_REND_MODE forcedRendMode /* i : forced renderer mode */ +) +{ + int16_t newForcedRend; + ivas_error error; + + if ( ( error = forcedRendModeApiToInternalDec( forcedRendMode, &newForcedRend ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( hIvasDec->st_ivas->hDecoderConfig->force_rend != newForcedRend ) + { + hIvasDec->st_ivas->hDecoderConfig->force_rend = newForcedRend; + } + + return IVAS_ERR_OK; +} + + +#ifdef DEBUG_SBA_AUDIO_DUMP +/*---------------------------------------------------------------------* + * IVAS_DEC_GetSbaDebugParams( ) + * + * Returns SBA debug parameters + *---------------------------------------------------------------------*/ + +ivas_error IVAS_DEC_GetSbaDebugParams( + const IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + int16_t *numOutputChannels, + int16_t *numTransportChannels, + int16_t *pca_ingest_channels ) +{ + if ( hIvasDec->st_ivas == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + if ( hIvasDec->st_ivas->ivas_format != SBA_FORMAT || hIvasDec->st_ivas->hSpar == NULL ) + { + *numOutputChannels = 1; + *numTransportChannels = 1; + *pca_ingest_channels = 1; + } + else + { + *numOutputChannels = hIvasDec->st_ivas->hSpar->numOutChannels; + *numTransportChannels = hIvasDec->st_ivas->nchan_transport; + *pca_ingest_channels = hIvasDec->st_ivas->hSpar->pca_ingest_channels; + } + + return IVAS_ERR_OK; +} +#endif /* DEBUG_SBA_AUDIO_DUMP */ + +#endif /* DEBUGGING */ /*---------------------------------------------------------------------* diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index ad4efa505..fe75a6aae 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -64,6 +64,15 @@ typedef enum _IVAS_DEC_COMPLEXITY_LEVEL } IVAS_DEC_COMPLEXITY_LEVEL; +#ifdef DEBUGGING +typedef enum _IVAS_DEC_FORCED_REND_MODE +{ + IVAS_DEC_FORCE_REND_CLDFB_RENDERER, + IVAS_DEC_FORCE_REND_TD_RENDERER, + IVAS_DEC_FORCE_REND_UNFORCED, + IVAS_DEC_FORCE_REND_UNDEFINED = 0xffff +} IVAS_DEC_FORCED_REND_MODE; +#endif @@ -275,6 +284,34 @@ ivas_error IVAS_DEC_GetRenderFramesizeMs( uint32_t *render_framesize /* o : render framesize in samples */ ); +#ifdef DEBUGGING +bool IVAS_DEC_GetBerDetectFlag( + IVAS_DEC_HANDLE hIvasDec /* i : IVAS decoder handle */ +); + +int32_t IVAS_DEC_GetNoCLipping( + IVAS_DEC_HANDLE hIvasDec /* i : IVAS decoder handle */ +); + +int32_t IVAS_DEC_GetCntFramesLimited( + IVAS_DEC_HANDLE hIvasDec /* i : IVAS decoder handle */ +); + +/*! r: error code */ +ivas_error IVAS_DEC_SetForcedRendMode( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const IVAS_DEC_FORCED_REND_MODE forcedRendMode /* i : forced renderer mode */ +); + +#ifdef DEBUG_SBA_AUDIO_DUMP +ivas_error IVAS_DEC_GetSbaDebugParams( + const IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + int16_t *numOutputChannels, + int16_t *numTransportChannels, + int16_t *pca_ingest_channels +); +#endif +#endif /* Getter functions - retrieve information from a decoder through a handle */ @@ -399,6 +436,21 @@ void IVAS_DEC_PrintConfig( const bool voipMode ); +#ifdef DEBUGGING +void IVAS_DEC_PrintConfigWithBitstream( + IVAS_DEC_HANDLE hIvasDec, /* i : IVAS decoder handle */ + const bool quietModeEnabled, /* i : quiet mode flag: if true, reduces the amount of config info printed */ + uint16_t bit_stream[], /* i : bitstream buffer */ + const int16_t num_bits /* i : number of bits in bitstream */ +); + +void IVAS_DEC_PrintConfigWithVoipBitstream( + IVAS_DEC_HANDLE hIvasDec, /* i : IVAS decoder handle */ + const bool quietModeEnabled, /* i : quiet mode flag: if true, reduces the amount of config info printed */ + uint8_t *au, /* i : buffer containing input access unit */ + const uint16_t auSizeBits /* i : size of the access unit in bits */ +); +#endif void IVAS_DEC_PrintDisclaimer( void diff --git a/lib_dec/lp_exc_d.c b/lib_dec/lp_exc_d.c index 65457e630..c436edcf1 100644 --- a/lib_dec/lp_exc_d.c +++ b/lib_dec/lp_exc_d.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_dec/lsf_dec.c b/lib_dec/lsf_dec.c index 4e5871fea..119cf7ecf 100644 --- a/lib_dec/lsf_dec.c +++ b/lib_dec/lsf_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_dec/lsf_msvq_ma_dec.c b/lib_dec/lsf_msvq_ma_dec.c index 945797915..9c911ab5f 100644 --- a/lib_dec/lsf_msvq_ma_dec.c +++ b/lib_dec/lsf_msvq_ma_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "rom_com.h" diff --git a/lib_dec/nelp_dec.c b/lib_dec/nelp_dec.c index 77b3703d1..67d8fb5f8 100644 --- a/lib_dec/nelp_dec.c +++ b/lib_dec/nelp_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_dec/peak_vq_dec.c b/lib_dec/peak_vq_dec.c index 857bf0d5f..21c8014f8 100644 --- a/lib_dec/peak_vq_dec.c +++ b/lib_dec/peak_vq_dec.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_dec/pit_dec.c b/lib_dec/pit_dec.c index 2f19d7079..c569e6609 100644 --- a/lib_dec/pit_dec.c +++ b/lib_dec/pit_dec.c @@ -40,6 +40,9 @@ #include "cnst.h" #include "prot.h" #include "rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" /*----------------------------------------------------------* diff --git a/lib_dec/pitch_extr.c b/lib_dec/pitch_extr.c index 209370d2f..a0370946b 100644 --- a/lib_dec/pitch_extr.c +++ b/lib_dec/pitch_extr.c @@ -38,6 +38,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_dec/post_dec.c b/lib_dec/post_dec.c index f661992ac..5bc31d56e 100644 --- a/lib_dec/post_dec.c +++ b/lib_dec/post_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "rom_com.h" diff --git a/lib_dec/pvq_core_dec.c b/lib_dec/pvq_core_dec.c index 677b80f5c..115d53ac5 100644 --- a/lib_dec/pvq_core_dec.c +++ b/lib_dec/pvq_core_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_dec/pvq_decode.c b/lib_dec/pvq_decode.c index b161d12aa..a0da5f09e 100644 --- a/lib_dec/pvq_decode.c +++ b/lib_dec/pvq_decode.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "rom_com.h" diff --git a/lib_dec/range_dec.c b/lib_dec/range_dec.c index 87589a840..25cfdb215 100644 --- a/lib_dec/range_dec.c +++ b/lib_dec/range_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_dec/re8_dec.c b/lib_dec/re8_dec.c index a48e6471a..d9a7c750d 100644 --- a/lib_dec/re8_dec.c +++ b/lib_dec/re8_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "wmc_auto.h" diff --git a/lib_dec/rom_dec.c b/lib_dec/rom_dec.c index 11661592f..e0ae59e58 100644 --- a/lib_dec/rom_dec.c +++ b/lib_dec/rom_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "wmc_auto.h" diff --git a/lib_dec/rom_dec.h b/lib_dec/rom_dec.h index bbf6759bd..5930eda56 100644 --- a/lib_dec/rom_dec.h +++ b/lib_dec/rom_dec.h @@ -39,6 +39,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" extern const float h_low[]; /* LP filter for filtering periodic part of excitation in artificial onset construction after FEC */ diff --git a/lib_dec/rst_dec.c b/lib_dec/rst_dec.c index 00bc9298d..f3fbd3216 100644 --- a/lib_dec/rst_dec.c +++ b/lib_dec/rst_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index 822b593c5..d83b77ab4 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -42,6 +42,9 @@ #include "cnst.h" #include "stat_com.h" /* Common structures */ #include "ivas_cnst.h" +#ifdef DEBUGGING +#include "debug.h" +#endif /*---------------------------------------------------------------* * Structure for FD Mode2 frameMode @@ -895,6 +898,9 @@ typedef struct Decoder_State int16_t idchan; /* channel ID (audio channel number) */ int16_t element_mode; /* element mode */ +#ifdef DEBUGGING + int16_t id_element; /* element ID */ +#endif int32_t element_brate; /* element bitrate */ int16_t codec_mode; /* Mode 1 or 2 */ int16_t mdct_sw_enable; /* MDCT switching enable flag */ diff --git a/lib_dec/stat_noise_uv_dec.c b/lib_dec/stat_noise_uv_dec.c index 0c024aaac..2fa711814 100644 --- a/lib_dec/stat_noise_uv_dec.c +++ b/lib_dec/stat_noise_uv_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "wmc_auto.h" diff --git a/lib_dec/swb_bwe_dec.c b/lib_dec/swb_bwe_dec.c index 23c59cf5c..a89a17cca 100644 --- a/lib_dec/swb_bwe_dec.c +++ b/lib_dec/swb_bwe_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_dec/swb_bwe_dec_hr.c b/lib_dec/swb_bwe_dec_hr.c index 065a24c6b..1c4d5c7f6 100644 --- a/lib_dec/swb_bwe_dec_hr.c +++ b/lib_dec/swb_bwe_dec_hr.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "rom_com.h" diff --git a/lib_dec/swb_bwe_dec_lr.c b/lib_dec/swb_bwe_dec_lr.c index 7953ee5d9..c0ccb648c 100644 --- a/lib_dec/swb_bwe_dec_lr.c +++ b/lib_dec/swb_bwe_dec_lr.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_dec/swb_tbe_dec.c b/lib_dec/swb_tbe_dec.c index c858a80af..e4f211b2a 100644 --- a/lib_dec/swb_tbe_dec.c +++ b/lib_dec/swb_tbe_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_dec/syn_outp.c b/lib_dec/syn_outp.c index aebcc9b04..c28666d1e 100644 --- a/lib_dec/syn_outp.c +++ b/lib_dec/syn_outp.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_dec/tcq_core_dec.c b/lib_dec/tcq_core_dec.c index c9dcb27d1..8b0a6f2d4 100644 --- a/lib_dec/tcq_core_dec.c +++ b/lib_dec/tcq_core_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_dec/tcx_utils_dec.c b/lib_dec/tcx_utils_dec.c index e2dc05a8a..5db8a20b0 100644 --- a/lib_dec/tcx_utils_dec.c +++ b/lib_dec/tcx_utils_dec.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "rom_com.h" diff --git a/lib_dec/tonalMDCTconcealment.c b/lib_dec/tonalMDCTconcealment.c index 56bae2137..ce77ecb97 100644 --- a/lib_dec/tonalMDCTconcealment.c +++ b/lib_dec/tonalMDCTconcealment.c @@ -39,6 +39,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "ivas_prot.h" diff --git a/lib_dec/transition_dec.c b/lib_dec/transition_dec.c index a7fa472b5..05c7887f4 100644 --- a/lib_dec/transition_dec.c +++ b/lib_dec/transition_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_dec/updt_dec.c b/lib_dec/updt_dec.c index 9ee8093ff..7ff9c9ee0 100644 --- a/lib_dec/updt_dec.c +++ b/lib_dec/updt_dec.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "rom_com.h" #include "cnst.h" diff --git a/lib_dec/waveadjust_fec_dec.c b/lib_dec/waveadjust_fec_dec.c index dce0e221d..99a10e886 100644 --- a/lib_dec/waveadjust_fec_dec.c +++ b/lib_dec/waveadjust_fec_dec.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "wmc_auto.h" diff --git a/lib_enc/ACcontextMapping_enc.c b/lib_enc/ACcontextMapping_enc.c index ff345d69e..a608db5ea 100644 --- a/lib_enc/ACcontextMapping_enc.c +++ b/lib_enc/ACcontextMapping_enc.c @@ -43,6 +43,9 @@ #include "ivas_prot.h" /* Range coder header file */ #include "ivas_rom_com.h" #include "ivas_rom_enc.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -362,6 +365,9 @@ void ACcontextMapping_encode2_no_mem_s17_LC( /* Push the rest of the buffer */ push_next_bits( hBstr, (uint16_t *) &ptr[bp], nbbits - bp ); +#ifdef DEBUGGING + /* return (bp+nbbits_lsbs);*/ /*return only for debug plot*/ +#endif return; } @@ -821,6 +827,9 @@ void RCcontextMapping_encode2_no_mem_s17_LCS( rc_uni_enc_encode_symbol_fastS( &rc_st_enc, a1 + A_THRES * b1, cum_freq_ari_pk_s17_LC_ext[pki], sym_freq_ari_pk_s17_LC_ext[pki], 14 ); /* Encode MSB symbol */ /*Confirm that there is no overflow, i.e. bit-budget has not exceeded */ +#ifdef DEBUGGING + assert( rc_uni_enc_virtual_finish( &rc_st_enc ) <= nbbits - nbbits_signs - nbbits_lsbs - nbbits_ntuples ); +#endif /* Update context for next 2-tuple */ if ( p1 == p2 ) @@ -939,6 +948,9 @@ void RCcontextMapping_encode2_no_mem_s17_LCS( rc_uni_enc_encode_symbol_fastS( &rc_st_enc, a1 + A_THRES * b1, cum_freq_ari_pk_s17_LC_ext[pki], sym_freq_ari_pk_s17_LC_ext[pki], 14 ); /* Encode MSB symbol */ /*Confirm that there is no overflow, i.e. bit-budget has not exceeded */ +#ifdef DEBUGGING + assert( rc_uni_enc_virtual_finish( &rc_st_enc ) <= nbbits - nbbits_signs - nbbits_lsbs - nbbits_ntuples ); +#endif /* Update context for next 2-tuple */ if ( esc_nb < 2 ) @@ -962,6 +974,9 @@ void RCcontextMapping_encode2_no_mem_s17_LCS( bp = rc_tot_bits + nbbits_ntuples; /* Update bitstream pointer */ /* Cross-check that there is no overflow */ +#ifdef DEBUGGING + assert( k == lastnz ); +#endif /* Push number of encoded tuples */ value = ( lastnz >> 1 ) - 1; diff --git a/lib_enc/FEC_enc.c b/lib_enc/FEC_enc.c index 30f35f37a..9b753c97b 100644 --- a/lib_enc/FEC_enc.c +++ b/lib_enc/FEC_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_enc/acelp_core_enc.c b/lib_enc/acelp_core_enc.c index 7162bdeea..ca7dec18a 100644 --- a/lib_enc/acelp_core_enc.c +++ b/lib_enc/acelp_core_enc.c @@ -36,6 +36,10 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#include "string.h" +#endif #include #include "cnst.h" #include "rom_enc.h" @@ -317,6 +321,9 @@ ivas_error acelp_core_enc( } } +#ifdef DEBUG_MODE_ACELP + dbgwrite( exc, sizeof( float ), st->L_frame, 1, "res/exc.enc" ); +#endif /* Reset HO counter in the first SID frame */ if ( st->hTdCngEnc != NULL ) { @@ -567,7 +574,39 @@ ivas_error acelp_core_enc( encod_gen_voic( st, inp, Aw, Aq, Es_pred, res, syn, exc, exc2, pitch_buf, voice_factors, bwe_exc, unbits, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf ); } +#ifdef DEBUG_MODE_ACELP + dbgwrite( exc, sizeof( float ), st->L_frame, 1, fname( debug_dir, "exc.enc", st->idchan, st->id_element, ENC ) ); + dbgwrite( res, sizeof( float ), st->L_frame, 1, fname( debug_dir, "resid", st->idchan, st->id_element, ENC ) ); +#endif +#ifdef DEBUGGING + /* SNR measuremenet of CELP output */ + if ( ppp_mode == 0 ) + { + char name[50] = "CELP_output_ch "; + + if ( st->id_element == 0 ) + { + name[14] = (char) ( st->idchan + '0' ); + } + else + { + char name2[50] = "CELP_output.idX_chX "; + name2[14] = (char) ( st->id_element + '0' ); + name2[18] = (char) ( st->idchan + '0' ); + strcpy( name, name2 ); + } + + if ( st->idchan == 0 ) + { + snr_celp( st->L_frame, L_SUBFR, st->gamma, st->preemph_fac, st->vad_flag, st->coder_type, inp, syn, A, 0, name ); + } + else if ( st->idchan == 1 ) + { + snr_celp( st->L_frame, L_SUBFR, st->gamma, st->preemph_fac, st->vad_flag, st->coder_type, inp, syn, A, 1, name ); + } + } +#endif /* update mem_syn1 for ACELP core switching */ mvr2r( hLPDmem->mem_syn, hLPDmem->mem_syn1, M ); @@ -636,6 +675,12 @@ ivas_error acelp_core_enc( i = min( nBits, 16 ); push_indice( hBstr, IND_UNUSED, 0, i ); nBits -= i; +#ifdef DEBUGGING + if ( st->idchan == 1 && st->element_mode == IVAS_CPE_TD ) + { + printf( "Issue with unused bits at Ln 653 in acelp_core_enc channel 1 at frame %d\n", frame ); + } +#endif } } diff --git a/lib_enc/acelp_core_switch_enc.c b/lib_enc/acelp_core_switch_enc.c index b02f9a62c..efa33ff8a 100644 --- a/lib_enc/acelp_core_switch_enc.c +++ b/lib_enc/acelp_core_switch_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_enc.h" @@ -138,6 +141,9 @@ void acelp_core_switch_enc( *----------------------------------------------------------------*/ i = find_indice( hBstr, TAG_ACELP_SUBFR_LOOP_START, &value, &nb_bits ); +#ifdef DEBUGGING + assert( i >= 0 && "Internal error in ACELP core switching - unable to find ACELP subframe indices!" ); +#endif while ( hBstr->ind_list[i].id == TAG_ACELP_SUBFR_LOOP_START ) { push_indice( hBstr, IND_CORE_SWITCHING_CELP_SUBFRAME, hBstr->ind_list[i].value, hBstr->ind_list[i].nb_bits ); diff --git a/lib_enc/acelp_enc_util.c b/lib_enc/acelp_enc_util.c index 3cead2ee7..fdbc3a8b0 100644 --- a/lib_enc/acelp_enc_util.c +++ b/lib_enc/acelp_enc_util.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "cnst.h" #include "rom_com.h" diff --git a/lib_enc/amr_wb_enc.c b/lib_enc/amr_wb_enc.c index b133d9413..e921698e5 100644 --- a/lib_enc/amr_wb_enc.c +++ b/lib_enc/amr_wb_enc.c @@ -36,12 +36,18 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_enc.h" #include "rom_com.h" #include "prot.h" #include "wmc_auto.h" +#ifdef DEBUG_MODE_INFO +extern float snr_[2][320]; +#endif /*-------------------------------------------------------------------* * amr_wb_enc() @@ -119,6 +125,9 @@ void amr_wb_enc( st->encoderPastSamples_enc = ( L_FRAME * 9 ) / 16; st->encoderLookahead_enc = L_LOOK_12k8; +#ifdef DEBUG_MODE_INFO + set_f( snr_[0], 0.0f, 320 ); +#endif st->bpf_off = 0; if ( st->last_core == HQ_CORE || st->last_codec_mode == MODE2 ) @@ -469,6 +478,10 @@ void amr_wb_enc( encod_amr_wb( st, inp, Aw, Aq, res, syn, exc, exc2, pitch_buf, hf_gain, inp_16k ); +#ifdef DEBUGGING + /* SNR measuremenet of CELP coded output */ + snr_celp( L_FRAME, L_SUBFR, GAMMA1, TILT_FAC, ( st->vad_flag | vad_flag_dtx ), st->coder_type, inp, syn, A, 0, "CELP_output" ); +#endif /* update mem_syn1 for ACELP core switching */ mvr2r( hLPDmem->mem_syn, hLPDmem->mem_syn1, M ); @@ -519,6 +532,21 @@ void amr_wb_enc( updt_enc_common( st ); +#ifdef DEBUG_MODE_INFO + dbgwrite( &st->codec_mode, sizeof( int16_t ), 1, input_frame, "res/codec" ); + dbgwrite( &st->core, sizeof( int16_t ), 1, input_frame, "res/core" ); + dbgwrite( &st->extl, sizeof( int16_t ), 1, input_frame, "res/extl" ); + dbgwrite( &st->bwidth, sizeof( int16_t ), 1, input_frame, "res/bwidth" ); + ener = st->total_brate / 1000.0f; + dbgwrite( &ener, sizeof( float ), 1, input_frame, "res/total_brate" ); + ener = st->core_brate / 1000.0f; + dbgwrite( &ener, sizeof( float ), 1, input_frame, "res/core_brate" ); + dbgwrite( &st->coder_type, sizeof( int16_t ), 1, input_frame, "res/coder_type" ); + dbgwrite( &st->cng_type, sizeof( int16_t ), 1, input_frame, "res/cng_type" ); + dbgwrite( &st->L_frame, sizeof( int16_t ), 1, input_frame, "res/L_frame" ); + dbgwrite( &st->vad_flag, sizeof( int16_t ), 1, input_frame, "res/vad_flag" ); + dbgwrite( snr_[0], sizeof( float ), 320, 1, "res/snr" ); +#endif return; } diff --git a/lib_enc/analy_lp.c b/lib_enc/analy_lp.c index 536d1e13a..c0541e78f 100644 --- a/lib_enc/analy_lp.c +++ b/lib_enc/analy_lp.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_enc/analy_sp.c b/lib_enc/analy_sp.c index c03ec0c90..4a4bcb357 100644 --- a/lib_enc/analy_sp.c +++ b/lib_enc/analy_sp.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_enc.h" diff --git a/lib_enc/ari_enc.c b/lib_enc/ari_enc.c index b2e692bc1..405b3a899 100644 --- a/lib_enc/ari_enc.c +++ b/lib_enc/ari_enc.c @@ -41,6 +41,9 @@ #include "prot.h" #include "stat_com.h" #include "basop_util.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_enc/arith_coder_enc.c b/lib_enc/arith_coder_enc.c index d4b473549..546e7f07a 100644 --- a/lib_enc/arith_coder_enc.c +++ b/lib_enc/arith_coder_enc.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_enc/avq_cod.c b/lib_enc/avq_cod.c index f76b4a353..78900b554 100644 --- a/lib_enc/avq_cod.c +++ b/lib_enc/avq_cod.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "rom_com.h" diff --git a/lib_enc/bass_psfilter_enc.c b/lib_enc/bass_psfilter_enc.c index dbfb38224..582ed3f22 100644 --- a/lib_enc/bass_psfilter_enc.c +++ b/lib_enc/bass_psfilter_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "rom_com.h" diff --git a/lib_enc/bw_detect.c b/lib_enc/bw_detect.c index 94e26fbf5..121754e1d 100644 --- a/lib_enc/bw_detect.c +++ b/lib_enc/bw_detect.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_enc.h" diff --git a/lib_enc/cng_enc.c b/lib_enc/cng_enc.c index de5c00b71..d99e05395 100644 --- a/lib_enc/cng_enc.c +++ b/lib_enc/cng_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_enc.h" diff --git a/lib_enc/cod2t32.c b/lib_enc/cod2t32.c index 38d062853..0d5e548be 100644 --- a/lib_enc/cod2t32.c +++ b/lib_enc/cod2t32.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_enc/cod4t64.c b/lib_enc/cod4t64.c index 8d851c47d..79d1814f5 100644 --- a/lib_enc/cod4t64.c +++ b/lib_enc/cod4t64.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_enc.h" diff --git a/lib_enc/cod4t64_fast.c b/lib_enc/cod4t64_fast.c index 7594f23e4..9c16758d4 100644 --- a/lib_enc/cod4t64_fast.c +++ b/lib_enc/cod4t64_fast.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_enc/cod_ace.c b/lib_enc/cod_ace.c index 75058cfdd..7a5c605d9 100644 --- a/lib_enc/cod_ace.c +++ b/lib_enc/cod_ace.c @@ -38,6 +38,9 @@ #include "prot.h" #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "rom_com.h" #include "wmc_auto.h" @@ -391,6 +394,17 @@ void coder_acelp( p_A -= ( M + 1 ); p_Aq -= ( M + 1 ); +#ifdef DEBUGGING + /* SNR measuremenet of CELP output */ + if ( st->idchan == 0 ) + { + snr_celp( st->L_frame, L_SUBFR, st->gamma, st->preemph_fac, st->vad_flag, st->coder_type, speech, syn, A, 0, "CELP_output" ); + } + else + { + snr_celp( st->L_frame, L_SUBFR, st->gamma, st->preemph_fac, st->vad_flag, st->coder_type, speech, syn, A, 1, "CELP_output_chan2" ); + } +#endif /*----------------------------------------------------------* * Update LPD memory * diff --git a/lib_enc/cod_tcx.c b/lib_enc/cod_tcx.c index 0577aafef..e2efb2c26 100644 --- a/lib_enc/cod_tcx.c +++ b/lib_enc/cod_tcx.c @@ -43,6 +43,12 @@ #include "wmc_auto.h" #include "ivas_prot.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include +#endif +#ifdef DEBUG_PLOT +#include "deb_out.h" +#endif /*-------------------------------------------------------------------* * HBAutocorrelation() @@ -215,6 +221,9 @@ void TNSAnalysisStereo( sts[0]->hTcxCfg->pCurrentTnsConfig = &sts[0]->hTcxCfg->tnsConfig[sts[0]->hTcxEnc->transform_type[k] == TCX_20][( k == 0 ) && ( sts[0]->last_core == ACELP_CORE )]; sts[1]->hTcxCfg->pCurrentTnsConfig = &sts[1]->hTcxCfg->tnsConfig[sts[1]->hTcxEnc->transform_type[k] == TCX_20][( k == 0 ) && ( sts[1]->last_core == ACELP_CORE )]; +#ifdef DEBUGGING + assert( sts[0]->hTcxCfg->pCurrentTnsConfig->nMaxFilters == sts[1]->hTcxCfg->pCurrentTnsConfig->nMaxFilters ); +#endif for ( iFilter = sts[0]->hTcxCfg->pCurrentTnsConfig->nMaxFilters - 1; iFilter >= 0; iFilter-- ) { STnsFilter *pFilter[2]; @@ -224,6 +233,10 @@ void TNSAnalysisStereo( pFilter[1] = sts[1]->hTcxEnc->tnsData[k].filter + iFilter; pTnsParameters[1] = sts[1]->hTcxCfg->pCurrentTnsConfig->pTnsParameters + iFilter; +#ifdef DEBUGGING + assert( pTnsParameters[0]->startLineFrequency == pTnsParameters[1]->startLineFrequency ); + assert( pTnsParameters[0]->nSubdivisions == pTnsParameters[1]->nSubdivisions ); +#endif /* if prediction gain and avgSqrCoef are both close we are pretty sure the filters are quite similar, use the avg of * both filters for the decision */ @@ -1002,6 +1015,12 @@ void EstimateStereoTCXNoiseLevel( } } /* bitrate */ } +#ifdef DEBUG_MODE_MDCT + dbgwrite( &smooth_gain, sizeof( float ), 1, 1, "./res/smooth_gain" ); + dbgwrite( &st->hTcxEnc->tcxltp_gain, sizeof( float ), 1, 1, "./res/tcxltp_gain" ); + dbgwrite( &noiseTransWidth, sizeof( int16_t ), 1, 1, "./res/noiseTrans" ); + dbgwrite( &fac_ns[ch][0], sizeof( float ), 2, 1, "./res/fac_ns" ); +#endif } return; @@ -1610,6 +1629,34 @@ void QuantizeTCXSpectrum( } } +#ifdef DEBUGGING + /*-----------------------------------------------------------* + * TCX SNR for Analysis purposes * + *-----------------------------------------------------------*/ + { + float diff[N_MAX]; + char name[50] = "TCX_output_chX "; + + for ( i = 0; i < min( L_frame, L_spec ); i++ ) + { + diff[i] = x_orig[i] - *gain_tcx * spectrum[i]; + } + + if ( st->id_element == 0 ) + { + name[13] = (char) ( st->idchan + '0' ); + } + else + { + char name2[50] = "TCX_output.idX_chX "; + name2[13] = (char) ( st->id_element + '0' ); + name2[17] = (char) ( st->idchan + '0' ); + strcpy( name, name2 ); + } + + snr( x_orig, diff, min( L_frame, L_spec ), name ); + } +#endif return; } diff --git a/lib_enc/core_enc_2div.c b/lib_enc/core_enc_2div.c index 25d62130c..faa7af358 100644 --- a/lib_enc/core_enc_2div.c +++ b/lib_enc/core_enc_2div.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "rom_com.h" diff --git a/lib_enc/core_enc_init.c b/lib_enc/core_enc_init.c index b0ef74245..b307e0361 100644 --- a/lib_enc/core_enc_init.c +++ b/lib_enc/core_enc_init.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "ivas_prot.h" diff --git a/lib_enc/core_enc_ol.c b/lib_enc/core_enc_ol.c index 278f47b73..e83fd598b 100644 --- a/lib_enc/core_enc_ol.c +++ b/lib_enc/core_enc_ol.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "rom_com.h" @@ -955,6 +958,19 @@ void core_acelp_tcx20_switching( st->core = TCX_20_CORE; st->acelpFramesCount = 0; } +#ifdef DEBUGGING + if ( st->force != -1 ) + { + if ( st->force == FORCE_SPEECH ) + { + st->core = ACELP_CORE; + } + else + { + st->core = TCX_20_CORE; + } + } +#endif } /* Fixed Decision (using -C) */ diff --git a/lib_enc/core_enc_reconf.c b/lib_enc/core_enc_reconf.c index 0ad804f95..9dffda020 100644 --- a/lib_enc/core_enc_reconf.c +++ b/lib_enc/core_enc_reconf.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "rom_com.h" #include "rom_enc.h" diff --git a/lib_enc/core_enc_switch.c b/lib_enc/core_enc_switch.c index e6b672d85..44952cc1d 100644 --- a/lib_enc/core_enc_switch.c +++ b/lib_enc/core_enc_switch.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "rom_com.h" #include "wmc_auto.h" diff --git a/lib_enc/core_enc_updt.c b/lib_enc/core_enc_updt.c index 1e17f7822..3d5476a89 100644 --- a/lib_enc/core_enc_updt.c +++ b/lib_enc/core_enc_updt.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "rom_com.h" #include "cnst.h" diff --git a/lib_enc/core_switching_enc.c b/lib_enc/core_switching_enc.c index 9b988a123..e964f33c0 100644 --- a/lib_enc/core_switching_enc.c +++ b/lib_enc/core_switching_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_enc.h" diff --git a/lib_enc/corr_xh.c b/lib_enc/corr_xh.c index def6a44f0..c317878e1 100644 --- a/lib_enc/corr_xh.c +++ b/lib_enc/corr_xh.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "cnst.h" #include "wmc_auto.h" diff --git a/lib_enc/decision_matrix_enc.c b/lib_enc/decision_matrix_enc.c index 8dd792144..e2587fbe0 100644 --- a/lib_enc/decision_matrix_enc.c +++ b/lib_enc/decision_matrix_enc.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "stat_enc.h" #include "stat_dec.h" @@ -181,10 +184,17 @@ void decision_matrix_enc( { st->core = ACELP_CORE; +#ifdef DEBUGGING + if ( st->total_brate >= HQCORE_NB_MIN_RATE && ( st->force == FORCE_MUSIC || ( st->force == -1 && st->sp_aud_decision1 == 1 ) ) ) + { + st->core = HQ_CORE; + } +#else if ( st->total_brate >= HQCORE_NB_MIN_RATE && st->sp_aud_decision1 == 1 ) { st->core = HQ_CORE; } +#endif } /*---------------------------------------------------------------------* @@ -195,7 +205,11 @@ void decision_matrix_enc( { st->core = ACELP_CORE; +#ifdef DEBUGGING + if ( ( st->total_brate >= HQCORE_WB_MIN_RATE && ( st->force == FORCE_MUSIC || ( st->force == -1 && st->sp_aud_decision1 == 1 ) ) ) || st->total_brate >= HQ_96k ) +#else if ( ( st->total_brate >= HQCORE_WB_MIN_RATE && st->sp_aud_decision1 == 1 ) || st->total_brate >= HQ_96k ) +#endif { st->core = HQ_CORE; } @@ -228,7 +242,11 @@ void decision_matrix_enc( else if ( st->bwidth == SWB || st->bwidth == FB ) { +#ifdef DEBUGGING + if ( ( st->total_brate >= HQCORE_WB_MIN_RATE && ( st->force == FORCE_MUSIC || ( st->force == -1 && st->sp_aud_decision1 == 1 ) ) ) || st->total_brate >= HQ_96k ) +#else if ( ( st->total_brate >= HQCORE_SWB_MIN_RATE && st->sp_aud_decision1 == 1 ) || st->total_brate >= HQ_96k ) +#endif { st->core = HQ_CORE; } diff --git a/lib_enc/detect_transient.c b/lib_enc/detect_transient.c index 669b55433..0b73a12e6 100644 --- a/lib_enc/detect_transient.c +++ b/lib_enc/detect_transient.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "cnst.h" #include "rom_com.h" diff --git a/lib_enc/diffcod.c b/lib_enc/diffcod.c index 47810a672..fd6646c48 100644 --- a/lib_enc/diffcod.c +++ b/lib_enc/diffcod.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "rom_com.h" #include "wmc_auto.h" diff --git a/lib_enc/dtx.c b/lib_enc/dtx.c index 9153316fa..606c8aaaf 100644 --- a/lib_enc/dtx.c +++ b/lib_enc/dtx.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" @@ -442,6 +445,16 @@ void dtx( } } +#ifdef DEBUG_MODE_ACELP + { + int16_t tmp_s; + + tmp_s = (int16_t) st->bckr_tilt_lt; + dbgwrite( &( tmp_s ), sizeof( int16_t ), 1, st->L_frame, "./res/bckr_tilt.pcm" ); + tmp_s = (int16_t) st->lp_noise; + dbgwrite( &( tmp_s ), sizeof( int16_t ), 1, st->L_frame, "./res/lp_noise.pcm" ); + } +#endif return; } diff --git a/lib_enc/enc_acelp.c b/lib_enc/enc_acelp.c index 8e034e1c7..5e1401828 100644 --- a/lib_enc/enc_acelp.c +++ b/lib_enc/enc_acelp.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "rom_com.h" diff --git a/lib_enc/enc_acelp_tcx_main.c b/lib_enc/enc_acelp_tcx_main.c index 338d87cc6..5c549b23d 100644 --- a/lib_enc/enc_acelp_tcx_main.c +++ b/lib_enc/enc_acelp_tcx_main.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "rom_com.h" #include "wmc_auto.h" diff --git a/lib_enc/enc_acelpx.c b/lib_enc/enc_acelpx.c index d8dcf192b..c72f2fa1c 100644 --- a/lib_enc/enc_acelpx.c +++ b/lib_enc/enc_acelpx.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "rom_enc.h" #include "wmc_auto.h" diff --git a/lib_enc/enc_amr_wb.c b/lib_enc/enc_amr_wb.c index f90268002..bb09c0886 100644 --- a/lib_enc/enc_amr_wb.c +++ b/lib_enc/enc_amr_wb.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "rom_com.h" diff --git a/lib_enc/enc_gen_voic.c b/lib_enc/enc_gen_voic.c index 07dc54f77..4c78b484c 100644 --- a/lib_enc/enc_gen_voic.c +++ b/lib_enc/enc_gen_voic.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "rom_com.h" diff --git a/lib_enc/enc_gen_voic_rf.c b/lib_enc/enc_gen_voic_rf.c index c3a6a4f8f..7ceece404 100644 --- a/lib_enc/enc_gen_voic_rf.c +++ b/lib_enc/enc_gen_voic_rf.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "rom_com.h" diff --git a/lib_enc/enc_higher_acelp.c b/lib_enc/enc_higher_acelp.c index bd68e5d68..5610bdfe4 100644 --- a/lib_enc/enc_higher_acelp.c +++ b/lib_enc/enc_higher_acelp.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_enc/enc_nelp.c b/lib_enc/enc_nelp.c index 253a97a9b..7d828208b 100644 --- a/lib_enc/enc_nelp.c +++ b/lib_enc/enc_nelp.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_enc/enc_pit_exc.c b/lib_enc/enc_pit_exc.c index b640e0b41..eba203b6a 100644 --- a/lib_enc/enc_pit_exc.c +++ b/lib_enc/enc_pit_exc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_enc/enc_ppp.c b/lib_enc/enc_ppp.c index 51e353dfe..b5b7e4548 100644 --- a/lib_enc/enc_ppp.c +++ b/lib_enc/enc_ppp.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_enc/enc_prm.c b/lib_enc/enc_prm.c index 41a211fbf..61bfbf2f0 100644 --- a/lib_enc/enc_prm.c +++ b/lib_enc/enc_prm.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" @@ -193,6 +196,9 @@ void writeTCXWindowing( const int16_t overlap_mode /* i : overlap mode */ ) { +#ifdef DEBUGGING + assert( overlap_mode != NOT_SUPPORTED && overlap_mode <= ALDO_WINDOW && overlap_mode >= FULL_OVERLAP ); /*1 is not allowed!*/ +#endif if ( overlap_mode == MIN_OVERLAP ) { @@ -334,6 +340,9 @@ void writeTCXparam( int16_t total_nbbits, nbits_igf, nbits_tcx; int16_t nTnsParams, nTnsBits; int16_t pre_part, post_part; +#ifdef DEBUG_PLOT_BITS + int16_t tmp = hBstr->nb_bits_tot; +#endif if ( pre_past_flag == 0 ) { @@ -410,6 +419,10 @@ void writeTCXparam( { push_next_indice( hBstr, 0, 1 ); } +#ifdef DEBUG_PLOT_BITS + tmp = hBstr->nb_bits_tot - tmp; + dbgwrite( &tmp, sizeof( int16_t ), 1, 1, "./res/bits_LTP" ); +#endif } j += 3; } @@ -462,6 +475,9 @@ void writeTCXparam( } j += nTnsParams; } +#ifdef DEBUG_PLOT_BITS + dbgwrite( &nTnsBits, sizeof( int16_t ), 1, 1, "./res/bits_TNS" ); +#endif if ( post_part ) { @@ -514,6 +530,9 @@ void writeTCXparam( else { /*Context HM flag*/ +#ifdef DEBUGGING + assert( st->hTcxCfg->ctx_hm == 0 ); +#endif p_param[k] = j; } } @@ -548,6 +567,16 @@ void writeTCXparam( } } } +#ifdef DEBUG_PLOT_BITS + if ( pre_part ) + { + if ( nSubframes == 1 ) + { + tmp = 0; + dbgwrite( &tmp, sizeof( int16_t ), 1, 1, "./res/bits_TNS" ); + } + } +#endif return; } diff --git a/lib_enc/enc_tran.c b/lib_enc/enc_tran.c index 6bd536aae..d713584fa 100644 --- a/lib_enc/enc_tran.c +++ b/lib_enc/enc_tran.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "rom_com.h" #include "wmc_auto.h" diff --git a/lib_enc/enc_uv.c b/lib_enc/enc_uv.c index 2ca7ecfdc..f6c17e410 100644 --- a/lib_enc/enc_uv.c +++ b/lib_enc/enc_uv.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" @@ -180,6 +183,9 @@ void encod_unvoiced( index = gain_enc_gacelp_uv( code, code2, L_SUBFR, Es_pred, &gain_pit, &gain_code, &gain_code2, &g_corr, &norm_gain_code, &gain_inov, st->flag_noisy_speech_snr ); +#ifdef DEBUGGING + assert( st->acelp_cfg.gains_mode[i_subfr / L_SUBFR] == 7 && "Error: UC two-stage, only 5+2 gain Q is supported" ); +#endif push_indice( st->hBstr, IND_GAIN, index, st->acelp_cfg.gains_mode[i_subfr / L_SUBFR] ); gp_clip_test_gain_pit( st->element_mode, st->core_brate, gain_pit, st->clip_var ); diff --git a/lib_enc/eval_pit_contr.c b/lib_enc/eval_pit_contr.c index 7f6a026ac..6779afe2a 100644 --- a/lib_enc/eval_pit_contr.c +++ b/lib_enc/eval_pit_contr.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_enc/evs_enc.c b/lib_enc/evs_enc.c index 56734fe37..0398876b9 100644 --- a/lib_enc/evs_enc.c +++ b/lib_enc/evs_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" @@ -488,6 +491,48 @@ ivas_error evs_enc( st->codec_mode = MODE2; } +#ifdef DEBUG_MODE_INFO + dbgwrite( &st->codec_mode, sizeof( int16_t ), 1, input_frame, "res/codec" ); + dbgwrite( &st->core, sizeof( int16_t ), 1, input_frame, "res/core" ); + dbgwrite( &st->extl, sizeof( int16_t ), 1, input_frame, "res/extl" ); + dbgwrite( &st->bwidth, sizeof( int16_t ), 1, input_frame, "res/bwidth" ); + ener = st->total_brate / 1000.0f; + dbgwrite( &ener, sizeof( float ), 1, input_frame, "res/total_brate" ); + ener = st->core_brate / 1000.0f; + dbgwrite( &ener, sizeof( float ), 1, input_frame, "res/core_brate" ); + ener = st->extl_brate / 1000.0f; + dbgwrite( &ener, sizeof( float ), 1, input_frame, "res/extl_brate" ); + dbgwrite( &st->coder_type, sizeof( int16_t ), 1, input_frame, "res/coder_type" ); + dbgwrite( &st->clas, sizeof( int16_t ), 1, input_frame, "res/clas" ); + dbgwrite( &st->cng_type, sizeof( int16_t ), 1, input_frame, "res/cng_type" ); + dbgwrite( &st->L_frame, sizeof( int16_t ), 1, input_frame, "res/L_frame" ); + dbgwrite( &st->vad_flag, sizeof( int16_t ), 1, input_frame, "res/vad_flag" ); + + { + int16_t _pitch[3]; + if ( ( st->coder_type == INACTIVE ) || ( st->coder_type == UNVOICED ) ) + { + _pitch[0] = 0; + _pitch[1] = 0; + _pitch[2] = 0; + } + else + { + _pitch[0] = st->pitch[0]; + _pitch[1] = st->pitch[1]; + _pitch[2] = st->pitch[2]; + } + dbgwrite( &_pitch[0], sizeof( int16_t ), 1, ( input_frame / 8 * 3 ), "res/pitch" ); + dbgwrite( &_pitch[1], sizeof( int16_t ), 1, ( input_frame / 8 * 3 ), "res/pitch" ); + dbgwrite( &_pitch[2], sizeof( int16_t ), 1, ( input_frame / 8 * 2 ), "res/pitch" ); + } + + if ( st->core != ACELP_CORE ) + { + set_f( new_swb_speech, 0, input_frame ); + dbgwrite( new_swb_speech, 4, st->L_frame, 1, "res/exc.enc" ); + } +#endif pop_wmops(); diff --git a/lib_enc/ext_sig_ana.c b/lib_enc/ext_sig_ana.c index 6488407e3..16f0b1732 100644 --- a/lib_enc/ext_sig_ana.c +++ b/lib_enc/ext_sig_ana.c @@ -37,10 +37,16 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "rom_com.h" #include "wmc_auto.h" +#ifdef DEBUG_PLOT +#include "deb_out.h" +#endif /*-------------------------------------------------------------------* diff --git a/lib_enc/fd_cng_enc.c b/lib_enc/fd_cng_enc.c index 12019f480..407121d59 100644 --- a/lib_enc/fd_cng_enc.c +++ b/lib_enc/fd_cng_enc.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "rom_enc.h" #include "rom_com.h" @@ -1019,6 +1022,9 @@ void FdCngEncodeMDCTStereoSID( ms_ptr[ch] = &logNoiseEst[ch][0]; lr_out_ptr[ch] = &sts[ch]->hFdCngEnc->hFdCngCom->sidNoiseEst[0]; } +#ifdef DEBUGGING + assert( sts[0]->hFdCngEnc->npartDec == sts[1]->hFdCngEnc->npartDec ); +#endif N = sts[0]->hFdCngEnc->npartDec; set_f( weights, 1.f, NPART ); @@ -1247,6 +1253,9 @@ void FdCngEncodeDiracMDCTStereoSID( lr_out_ptr[ch] = &sts[ch]->hFdCngEnc->hFdCngCom->sidNoiseEst[0]; } set_f( weights, 1.f, NPART ); +#ifdef DEBUGGING + assert( N[0] == N[1] ); +#endif /* apply log and save energy of original left and right channels */ for ( ch = 0; ch < CPE_CHANNELS; ch++ ) diff --git a/lib_enc/find_tar.c b/lib_enc/find_tar.c index fc9419427..008fb17cb 100644 --- a/lib_enc/find_tar.c +++ b/lib_enc/find_tar.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_enc/find_tilt.c b/lib_enc/find_tilt.c index fcff9d796..bdfac0569 100644 --- a/lib_enc/find_tilt.c +++ b/lib_enc/find_tilt.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_enc/find_uv.c b/lib_enc/find_uv.c index 9551a2a15..a80971880 100644 --- a/lib_enc/find_uv.c +++ b/lib_enc/find_uv.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_enc/find_wsp.c b/lib_enc/find_wsp.c index 4837411a5..e08918a4d 100644 --- a/lib_enc/find_wsp.c +++ b/lib_enc/find_wsp.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_enc/gain_enc.c b/lib_enc/gain_enc.c index 6ee7c7228..b114b34c7 100644 --- a/lib_enc/gain_enc.c +++ b/lib_enc/gain_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_enc/gaus_enc.c b/lib_enc/gaus_enc.c index 7f3220094..79b480e51 100644 --- a/lib_enc/gaus_enc.c +++ b/lib_enc/gaus_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_enc/gp_clip.c b/lib_enc/gp_clip.c index 36133af3e..43394c2bf 100644 --- a/lib_enc/gp_clip.c +++ b/lib_enc/gp_clip.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "cnst.h" diff --git a/lib_enc/gs_enc.c b/lib_enc/gs_enc.c index c22285436..25f1f8fc7 100644 --- a/lib_enc/gs_enc.c +++ b/lib_enc/gs_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_enc/hf_cod_amrwb.c b/lib_enc/hf_cod_amrwb.c index 7357bcd18..c9cbba3cd 100644 --- a/lib_enc/hf_cod_amrwb.c +++ b/lib_enc/hf_cod_amrwb.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_enc/hq_classifier_enc.c b/lib_enc/hq_classifier_enc.c index 1df92357d..a8d798e65 100644 --- a/lib_enc/hq_classifier_enc.c +++ b/lib_enc/hq_classifier_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_enc/hq_core_enc.c b/lib_enc/hq_core_enc.c index 261e02202..3fb39b535 100644 --- a/lib_enc/hq_core_enc.c +++ b/lib_enc/hq_core_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_enc/hq_env_enc.c b/lib_enc/hq_env_enc.c index c0a63e262..4d57dde16 100644 --- a/lib_enc/hq_env_enc.c +++ b/lib_enc/hq_env_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "rom_com.h" #include "rom_enc.h" diff --git a/lib_enc/hq_hr_enc.c b/lib_enc/hq_hr_enc.c index 1855f26df..d815295a4 100644 --- a/lib_enc/hq_hr_enc.c +++ b/lib_enc/hq_hr_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "rom_enc.h" @@ -190,7 +193,11 @@ void hq_hr_enc( if ( hqswb_clas == HQ_HVQ ) { +#ifdef DEBUGGING + sum = hvq_enc( hBstr, st->bwidth, st->idchan, st->core_brate, *num_bits, Npeaks, ynrm, R, peaks, nf_gains, noise_level, pe_gains, t_audio, t_audio_q ); +#else sum = hvq_enc( hBstr, st->bwidth, st->core_brate, *num_bits, Npeaks, ynrm, R, peaks, nf_gains, noise_level, pe_gains, t_audio, t_audio_q ); +#endif *num_bits -= sum; } else diff --git a/lib_enc/hq_lr_enc.c b/lib_enc/hq_lr_enc.c index 8aa39964b..343a31713 100644 --- a/lib_enc/hq_lr_enc.c +++ b/lib_enc/hq_lr_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_enc.h" @@ -933,7 +936,11 @@ void hq_lr_enc( hq2_bit_alloc( band_energy, bands, Rk_fx, &bit_budget, p2a_flags, bit_alloc_weight_fx, band_width, *num_bits, hqswb_clas, st->bwidth, is_transient ); } +#ifdef DEBUGGING + tcq_core_LR_enc( hBstr, st->idchan, inp_vector, t_audio, y2, bit_budget, bands, band_start, band_end, band_width, Rk_fx, npulses, k_sort, p2a_flags, p2a_bands, hHQ_core->last_bitalloc_max_band, inner_frame, adjustFlag, is_transient ); +#else tcq_core_LR_enc( hBstr, inp_vector, t_audio, y2, bit_budget, bands, band_start, band_end, band_width, Rk_fx, npulses, k_sort, p2a_flags, p2a_bands, hHQ_core->last_bitalloc_max_band, inner_frame, adjustFlag, is_transient ); +#endif if ( ( inner_frame == L_FRAME8k && st->core_brate <= ACELP_13k20 ) || inner_frame == L_FRAME16k ) { diff --git a/lib_enc/hvq_enc.c b/lib_enc/hvq_enc.c index 54c50f31a..42ac52cc3 100644 --- a/lib_enc/hvq_enc.c +++ b/lib_enc/hvq_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" @@ -53,6 +56,9 @@ int16_t hvq_enc( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const int16_t bwidth, /* i : audio bandwidth */ +#ifdef DEBUGGING + const int16_t idchan, /* i : channel ID */ +#endif const int32_t core_brate, /* i : core bitrate */ const int16_t hvq_bits, /* i : HVQ bit budget */ const int16_t Npeaks, /* i : Number of peaks */ @@ -146,7 +152,11 @@ int16_t hvq_enc( nf_gains[i] *= 2 * lb_nfpe; } +#ifdef DEBUGGING + bits_used += peak_vq_enc( hBstr, bwidth, idchan, coefs, coefs_out, core_brate, hvq_bits - bits_used, Npeaks, ynrm, R, peaks, &nf_gains[0] ); +#else bits_used += peak_vq_enc( hBstr, bwidth, coefs, coefs_out, core_brate, hvq_bits - bits_used, Npeaks, ynrm, R, peaks, &nf_gains[0] ); +#endif return bits_used; diff --git a/lib_enc/igf_enc.c b/lib_enc/igf_enc.c index c1a2e29b8..93306733c 100644 --- a/lib_enc/igf_enc.c +++ b/lib_enc/igf_enc.c @@ -37,12 +37,18 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "ivas_prot.h" #include "cnst.h" #include "stat_enc.h" #include "wmc_auto.h" +#ifdef DEBUG_PLOT +#include "deb_out.h" +#endif /*-------------------------------------------------------------------* diff --git a/lib_enc/igf_scf_enc.c b/lib_enc/igf_scf_enc.c index 3c97808ef..f893a8b31 100644 --- a/lib_enc/igf_scf_enc.c +++ b/lib_enc/igf_scf_enc.c @@ -37,6 +37,9 @@ #include #include "options.h" #include "prot.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "stat_enc.h" #include "stat_com.h" #include "cnst.h" diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c index e5d8f6294..e722d8350 100644 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "rom_enc.h" diff --git a/lib_enc/inov_enc.c b/lib_enc/inov_enc.c index 2c99ebdac..fedc98e10 100644 --- a/lib_enc/inov_enc.c +++ b/lib_enc/inov_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "ivas_prot.h" @@ -311,6 +314,12 @@ void inov_encode( set_f( y2, 0.0f, L_SUBFR ); } } +#ifdef DEBUGGING + else + { + IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "invalid mode for acelp frame!\n" ); + } +#endif } else { diff --git a/lib_enc/isf_enc_amr_wb.c b/lib_enc/isf_enc_amr_wb.c index b9479edef..c10ee6288 100644 --- a/lib_enc/isf_enc_amr_wb.c +++ b/lib_enc/isf_enc_amr_wb.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_enc.h" #include "rom_com.h" diff --git a/lib_enc/ivas_agc_enc.c b/lib_enc/ivas_agc_enc.c index 7c72028a8..09db68d7d 100644 --- a/lib_enc/ivas_agc_enc.c +++ b/lib_enc/ivas_agc_enc.c @@ -33,6 +33,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "ivas_prot.h" #include "prot.h" #include @@ -46,6 +49,16 @@ #define AGC_MIN_DELTA ( 4.656612873077393e-10f ) /*2^-31*/ +#ifdef DEBUG_AGC +/*------------------------------------------------------------------------------------------* + * Local functions declarations + *------------------------------------------------------------------------------------------*/ + +extern FILE *agcOut; + +static int16_t ivas_agc_writeBits( FILE *stream, const int16_t n_channels, ivas_agc_enc_state_t *pState ); + +#endif /*-----------------------------------------------------------------------------------------* * Function ivas_agc_enc_get_flag() @@ -55,6 +68,9 @@ /*! r: AGC enable flag */ int16_t ivas_agc_enc_get_flag( +#ifdef DEBUG_AGC_ENCODER_CMD_OPTION + const int16_t agc_configuration, /* i : AGC configuration from command-line */ +#endif const int16_t nchan_transport /* i : number of transport channels */ ) { @@ -63,6 +79,11 @@ int16_t ivas_agc_enc_get_flag( /* AGC is enabled only if there is one transport channel. */ agc_flag = (int16_t) ( nchan_transport == 1 ); +#ifdef DEBUG_AGC_ENCODER_CMD_OPTION + /* If agc_configuration is not undefined, then this value decides on the state of * enablement, + otherwise AGC is enabled only if there is one transport channel. */ + agc_flag = ( agc_configuration != SBA_AGC_DEFAULT ) ? agc_configuration : agc_flag; +#endif return agc_flag; } @@ -430,7 +451,42 @@ void ivas_agc_enc_process( } } +#ifdef DEBUG_AGC + /* writing to a temporary bitstream file */ + if ( ivas_agc_writeBits( agcOut, n_channels, pState ) ) + { + IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "SPAR ENC AGC Failed to open agcOut\n " ); + } +#endif return; } +#ifdef DEBUG_AGC +static int16_t ivas_agc_writeBits( FILE *stream, const int16_t n_channels, ivas_agc_enc_state_t *pState ) +{ + if ( stream == NULL ) + { + return TRUE; + } + + int16_t num_bits = 0, num_dmx_bits[4] = { 0 }; + for ( int16_t i = 0; i < n_channels; i++ ) + { + if ( pState->gain_data[i].absGainExpCurr < 0 || + pState->gain_data[i].absGainExpCurr >= (int16_t) pow( 2, pState->agc_com.betaE ) ) + { + IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error Gain values to write!!\n\n" ); + } + + fwrite( &( pState->gain_data[i].absGainExpCurr ), sizeof( int32_t ), 1, stream ); /* n bits */ + num_bits += pState->agc_com.betaE; + num_dmx_bits[i]++; + + /*fprintf(stdout, "absGainExpCurr[%d]:= %d[%d bits]; ", i, pState->gain_data[i].absGainExpCurr, pState->betaE); */ + } + /*fprintf(stdout, "AGC bits:= %d ", num_bits);*/ + + return FALSE; +} +#endif diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index fe16b7784..a4be24698 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" @@ -40,6 +43,9 @@ #include "wmc_auto.h" #include +#ifdef DEBUG_MODE_ACELP +extern float snr_[2][320]; +#endif /*-------------------------------------------------------------------* @@ -159,6 +165,9 @@ ivas_error ivas_core_enc( * Initializiation per core-coder channel *-----------------------------------------------------------------*/ +#ifdef DEBUG_MODE_ACELP + set_f( snr_[n], 0.0f, 320 ); +#endif st->extl = -1; unbits[n] = 0; @@ -437,6 +446,117 @@ ivas_error ivas_core_enc( } } +#ifdef DEBUG_MODE_INFO + for ( n = 0; n < n_CoreChannels; n++ ) + { + float tmpF; + int16_t tmpS, id; +#if defined DEBUG_MODE_ACELP || defined DEBUG_MODE_TCX + int16_t k, _pitch[3], _pitch_buf[5]; +#endif + + st = sts[n]; + id = st->id_element; + + dbgwrite( &st->core, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "core", n, id, ENC ) ); + dbgwrite( &st->extl, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "extl", n, id, ENC ) ); + dbgwrite( &st->bwidth, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "bwidth", n, id, ENC ) ); + tmpF = st->total_brate / 1000.0f; + dbgwrite( &tmpF, sizeof( float ), 1, input_frame, fname( debug_dir, "total_brate", n, id, ENC ) ); + tmpS = st->bits_frame_nominal; + dbgwrite( &tmpS, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "bits_nominal", n, id, ENC ) ); + tmpF = st->core_brate / 1000.0f; + dbgwrite( &tmpF, sizeof( float ), 1, input_frame, fname( debug_dir, "core_brate", n, id, ENC ) ); + tmpF = st->extl_brate / 1000.0f; + dbgwrite( &tmpF, sizeof( float ), 1, input_frame, fname( debug_dir, "extl_brate", n, id, ENC ) ); + + dbgwrite( &st->coder_type, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "coder_type", n, id, ENC ) ); + dbgwrite( &st->coder_type_raw, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "coder_type_raw", n, id, ENC ) ); + dbgwrite( &st->clas, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "clas", n, id, ENC ) ); + dbgwrite( &st->cng_type, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "cng_type", n, id, ENC ) ); + dbgwrite( &st->L_frame, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "L_frame", n, id, ENC ) ); + dbgwrite( &st->vad_flag, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "vad_flag", n, id, ENC ) ); + dbgwrite( &st->localVAD, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "localVAD", n, id, ENC ) ); + + dbgwrite( &st->count_WB, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "count_WB", n, id, ENC ) ); + dbgwrite( &st->count_SWB, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "count_SWB", n, id, ENC ) ); + +#ifdef DEBUG_MODE_ACELP + dbgwrite( snr_[n], sizeof( float ), 320, 1, fname( debug_dir, "snr", n, id, ENC ) ); +#endif + dbgwrite( &st->sp_aud_decision0, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "sp_aud_decision0", n, id, ENC ) ); + dbgwrite( &st->sp_aud_decision1, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "sp_aud_decision1", n, id, ENC ) ); + dbgwrite( &st->sp_aud_decision2, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "sp_aud_decision2", n, id, ENC ) ); + + dbgwrite( &st->lp_noise, sizeof( float ), 1, input_frame, fname( debug_dir, "lp_noise", n, id, ENC ) ); + +#if ( defined DEBUG_MODE_ACELP ) || ( defined DEBUG_MODE_TCX ) + if ( st->coder_type == INACTIVE || st->coder_type == UNVOICED ) + { + _pitch[0] = 0; + _pitch[1] = 0; + _pitch[2] = 0; + } + else + { + _pitch[0] = st->pitch[0]; + _pitch[1] = st->pitch[1]; + _pitch[2] = st->pitch[2]; + } + dbgwrite( &_pitch[0], sizeof( int16_t ), 1, ( input_frame / 8 * 3 ), fname( debug_dir, "pitch", n, id, ENC ) ); + dbgwrite( &_pitch[1], sizeof( int16_t ), 1, ( input_frame / 8 * 3 ), fname( debug_dir, "pitch", n, id, ENC ) ); + dbgwrite( &_pitch[2], sizeof( int16_t ), 1, ( input_frame / 8 * 2 ), fname( debug_dir, "pitch", n, id, ENC ) ); + + if ( ( st->coder_type == INACTIVE ) || ( st->coder_type == UNVOICED ) ) + { + set_s( _pitch_buf, 0, NB_SUBFR16k ); + } + else if ( st->L_frame != L_FRAME ) + { + for ( k = 0; k < NB_SUBFR16k; k++ ) + _pitch_buf[k] = (int16_t) ( pitch_buf[n][k] + 0.5f ); + } + else + { + for ( k = 0; k < NB_SUBFR; k++ ) + _pitch_buf[k] = (int16_t) ( pitch_buf[n][k] * 5.0f / 4.0f + 0.5f ); + } + if ( st->L_frame != L_FRAME ) + { + for ( k = 0; k < NB_SUBFR16k; k++ ) + dbgwrite( &_pitch_buf[k], sizeof( int16_t ), 1, L_SUBFR, fname( debug_dir, "pitchCL", n, id, ENC ) ); + } + else + { + for ( k = 0; k < NB_SUBFR; k++ ) + dbgwrite( &_pitch_buf[k], sizeof( int16_t ), 1, L_SUBFR16k, fname( debug_dir, "pitchCL", n, id, ENC ) ); + } +#endif + +#ifdef DEBUG_MODE_ACELP + if ( st->core != ACELP_CORE ) + { + tmpF = 0.0f; + dbgwrite( &tmpF, sizeof( float ), 1, st->L_frame, fname( debug_dir, "exc.enc", n, id, ENC ) ); + dbgwrite( &tmpF, sizeof( float ), 1, st->L_frame, fname( debug_dir, "resid", n, id, ENC ) ); + } + if ( n_CoreChannels == 1 ) + { + tmpS = -1; + dbgwrite( &tmpS, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "coder_type", 2, id, ENC ) ); + tmpF = 0.0f; + dbgwrite( &tmpF, sizeof( float ), 1, input_frame, fname( debug_dir, "total_brate", 2, id, ENC ) ); + tmpF = 0.0f; + dbgwrite( &tmpF, sizeof( float ), 1, input_frame, fname( debug_dir, "core_brate", 2, id, ENC ) ); + tmpF = 0.0f; + dbgwrite( &tmpF, sizeof( float ), 1, input_frame, fname( debug_dir, "extl_brate", 2, id, ENC ) ); + dbgwrite( &tmpS, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "vad_flag", 2, id, ENC ) ); + dbgwrite( &tmpS, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "localVAD", 2, id, ENC ) ); + } + +#endif + } +#endif pop_wmops(); diff --git a/lib_enc/ivas_core_pre_proc.c b/lib_enc/ivas_core_pre_proc.c index 35f3eace6..129177c0c 100644 --- a/lib_enc/ivas_core_pre_proc.c +++ b/lib_enc/ivas_core_pre_proc.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "ivas_cnst.h" #include "ivas_prot.h" @@ -464,6 +467,10 @@ ivas_error pre_proc_ivas( } } +#ifdef DEBUG_MODE_ACELP + dbgwrite( inp_12k8, sizeof( float ), L_FRAME, 1, fname( debug_dir, "inp_12k8", st->idchan, st->id_element, ENC ) ); + dbgwrite( inp_16k, sizeof( float ), L_FRAME, 1, fname( debug_dir, "inp_16k", st->idchan, st->id_element, ENC ) ); +#endif pop_wmops(); return error; @@ -600,6 +607,12 @@ ivas_error ivas_compute_core_buffers( set_f( temp1F_icatdmResampBuf, 0, L_FILT_MAX ); modify_Fs( temp1F_icatdmResampBuf, NS2SA( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_16k + NS2SA( sr_core, FRAME_SIZE_NS ), sr_core, mem_decim16k_dummy, 0 ); } +#ifdef DEBUGGING + else + { + return ( IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong internal sampling rate. Exiting..." ) ); + } +#endif } else if ( st->idchan == 0 ) { diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c index d938cf0b1..d0dbd1603 100644 --- a/lib_enc/ivas_core_pre_proc_front.c +++ b/lib_enc/ivas_core_pre_proc_front.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "ivas_cnst.h" #include "rom_enc.h" @@ -722,6 +725,21 @@ ivas_error pre_proc_front_ivas( smc_dec = ivas_smc_gmm( st, hStereoClassif, localVAD_HE_SAD, Etot, lsp_new, *cor_map_sum, epsP, PS, non_staX, *relE, &high_lpn_flag, flag_spitch ); +#ifdef DEBUGGING + if ( st->idchan == 0 ) + { + if ( st->force == FORCE_SPEECH ) + { + /* enforce speech */ + st->sp_aud_decision0 = 0; + } + else if ( st->force == FORCE_MUSIC ) + { + /* enforce music */ + st->sp_aud_decision0 = 1; + } + } +#endif /*----------------------------------------------------------------* * VAD energy updates diff --git a/lib_enc/ivas_corecoder_enc_reconfig.c b/lib_enc/ivas_corecoder_enc_reconfig.c index bb79c0bd9..8619b1122 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig.c +++ b/lib_enc/ivas_corecoder_enc_reconfig.c @@ -35,6 +35,10 @@ #include "ivas_cnst.h" #include "prot.h" #include "ivas_prot.h" +#ifdef DEBUGGING +#include "debug.h" +#include +#endif #include "wmc_auto.h" /*-------------------------------------------------------------------* @@ -145,6 +149,12 @@ ivas_error ivas_corecoder_enc_reconfig( { hBstr = st_ivas->hCPE[0]->hCoreCoder[0]->hBstr; } +#ifdef DEBUGGING + else + { + assert( 0 && "At least one SCE or one CPE should have existed before!\n" ); + } +#endif /* save bitstream information */ nb_bits_tot = hBstr->nb_bits_tot; @@ -173,6 +183,9 @@ ivas_error ivas_corecoder_enc_reconfig( temp_ind_list[i].nb_bits = -1; } +#ifdef DEBUGGING + assert( ( nb_bits == nb_bits_tot ) && "Error saving bitstream information during core-coder reconfiguration!\n" ); +#endif if ( hEncoderConfig->ivas_format == MC_FORMAT && last_mc_mode == MC_MODE_MCMASA && st_ivas->mc_mode == MC_MODE_MCMASA ) { @@ -383,6 +396,9 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hCPE[0]->hCoreCoder[0]->hBstr->nb_bits_tot = nb_bits_tot; } +#ifdef DEBUGGING + assert( ( nb_bits == nb_bits_tot ) && "Error restoring bitstream information during core-coder reconfiguration!\n" ); +#endif if ( last_mc_mode == MC_MODE_MCMASA && st_ivas->mc_mode == MC_MODE_MCMASA ) @@ -482,6 +498,9 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hCPE[0]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; } +#ifdef DEBUGGING + st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct->mdct_stereo_mode_cmdl = hEncoderConfig->stereo_mode_cmdl; +#endif initMdctStereoEncData( st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct, hEncoderConfig->ivas_format, st_ivas->hCPE[st_ivas->nCPE - 1]->element_mode, st_ivas->hCPE[st_ivas->nCPE - 1]->element_brate, hEncoderConfig->max_bwidth, 0, NULL, 1 ); st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct->isSBAStereoMode = ( ( hEncoderConfig->ivas_format == SBA_FORMAT || hEncoderConfig->ivas_format == SBA_ISM_FORMAT ) && ( st_ivas->nchan_transport == 2 ) ); } diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 9e2da33be..480b559dc 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -39,6 +39,9 @@ #include "prot.h" #include "ivas_prot.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -131,6 +134,12 @@ ivas_error ivas_cpe_enc( tdm_ratio_idx_SM = -1; tdm_last_ratio = 0; +#ifdef DEBUGGING + if ( hCPE->hCoreCoder[0]->ini_frame == 0 ) + { + hCPE->stereo_mode_cmdl = hEncoderConfig->stereo_mode_cmdl; + } +#endif /*------------------------------------------------------------------* * CPE initialization - core coder @@ -148,6 +157,10 @@ ivas_error ivas_cpe_enc( sts[n]->bwidth = sts[n]->last_bwidth; /* updated in BWD */ } sts[n]->rate_switching_reset = 0; +#ifdef DEBUGGING + sts[n]->force = hEncoderConfig->force; + sts[n]->id_element = cpe_id + st_ivas->nSCE; +#endif } mvr2r( data_f_ch0, sts[0]->input, input_frame ); @@ -340,6 +353,9 @@ ivas_error ivas_cpe_enc( /* reconfiguration in case of bitrate switching */ if ( hCPE->element_brate != hCPE->last_element_brate && st_ivas->hMCT == NULL ) { +#ifdef DEBUGGING + hCPE->hStereoMdct->mdct_stereo_mode_cmdl = hEncoderConfig->mdct_stereo_mode_cmdl; +#endif initMdctStereoEncData( hCPE->hStereoMdct, ivas_format, hCPE->element_mode, hCPE->element_brate, max_bwidth, 0, NULL, 0 ); hCPE->hStereoMdct->isSBAStereoMode = ( ( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT ) && ( st_ivas->nchan_transport == 2 ) ); } @@ -355,12 +371,19 @@ ivas_error ivas_cpe_enc( stereo_dft_hybrid_ITD_flag( hCPE->hStereoDft->hConfig, input_Fs, hCPE->hStereoDft->hItd->hybrid_itd_max ); /* Time Domain ITD compensation using extrapolation */ +#ifdef DEBUG_MODE_DFT + stereo_td_itd( hCPE->hStereoDft->hItd, hCPE->hStereoDft->input_mem_itd, hCPE->hStereoDft->hConfig->hybrid_itd_flag, hCPE->hStereoDft->hConfig->itd_mode, hCPE->hStereoDft->dft_ovl, sts, input_frame, hCPE->input_mem ); +#else stereo_td_itd( hCPE->hStereoDft->hItd, hCPE->hStereoDft->input_mem_itd, hCPE->hStereoDft->hConfig->hybrid_itd_flag, hCPE->hStereoDft->dft_ovl, sts, input_frame, hCPE->input_mem ); +#endif /* DFT on right and left input channels */ stereo_dft_enc_analyze( sts, CPE_CHANNELS, input_frame, hCPE->hStereoDft, NULL, hCPE->hStereoDft->DFT, hCPE->input_mem ); sts[0]->total_brate = ( sts[0]->bits_frame_nominal + 10 ) * FRAMES_PER_SEC; /* add small overhead; st[0]->total_brate used in coder_type_modif() */ +#ifdef DEBUG_MODE_DFT + hCPE->hStereoDft->res_cod_bits = (int16_t) ( ( hCPE->element_brate ) / FRAMES_PER_SEC - 0.8f * sts[0]->bits_frame_nominal ); +#endif /* Update DFT Stereo memories */ stereo_dft_enc_update( hCPE->hStereoDft, sts[0]->max_bwidth ); @@ -434,6 +457,13 @@ ivas_error ivas_cpe_enc( set_zero( sts[1]->input, input_frame ); } +#ifdef DEBUG_MODE_INFO + for ( n = 0; n < n_CoreChannels; n++ ) + { + dbgwrite( sts[0]->input - NS2SA( sts[0]->input_Fs, ACELP_LOOK_NS ), sizeof( float ), input_frame, 1, fname( debug_dir, "input_DMX", n, sts[n]->id_element, ENC ) ); + } + dbgwrite( &hCPE->element_mode, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "element_mode", 0, sts[0]->id_element, ENC ) ); +#endif /*----------------------------------------------------------------* * Front Pre-processing @@ -592,6 +622,9 @@ ivas_error ivas_cpe_enc( } stereo_dft_cng_side_gain( hCPE->hStereoDft, hCPE->hStereoCng, sts[0]->core_brate, sts[0]->last_core_brate, sts[0]->bwidth ); +#ifdef DEBUG_MODE_DFT + hCPE->hStereoDft->res_cod_bits = 0; +#endif } else { @@ -638,6 +671,17 @@ ivas_error ivas_cpe_enc( } else { +#ifdef DEBUGGING + if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) + { + assert( ( ( hCPE->element_brate / FRAMES_PER_SEC - nb_bits - nb_bits_metadata + (int16_t) ( hCPE->brate_surplus / FRAMES_PER_SEC ) ) >= ( 0.8f * sts[0]->bits_frame_nominal ) ) && "Stereo DFT: bit budget is violated" ); + } + else + { + assert( ( ( hCPE->element_brate / FRAMES_PER_SEC - nb_bits ) >= ( 0.8f * sts[0]->bits_frame_nominal ) ) && "Stereo DFT: bit budget is violated" ); + } + +#endif /* Flexible total bitrate in M channel */ sts[0]->total_brate = hCPE->element_brate - ( nb_bits * FRAMES_PER_SEC ); } @@ -707,6 +751,41 @@ ivas_error ivas_cpe_enc( sts[n]->hTranDet->transientDetector.prev_bIsAttackPresent = sts[n]->hTranDet->transientDetector.bIsAttackPresent; } +#ifdef DEBUG_MODE_INFO + if ( hCPE->element_mode == IVAS_CPE_DFT ) + { + n = (int16_t) hCPE->hStereoDft->hItd->itd[1]; + dbgwrite( &n, 2, 1, input_frame, "res/itd" ); + n = 0; + dbgwrite( &n, 2, 1, input_frame, "res/TCA_idx_refChan" ); + dbgwrite( &n, 2, 1, input_frame, "res/TCA_idx_NCShift" ); + dbgwrite( &n, 2, 1, input_frame, "res/TCA_idx_ica_gD" ); + n = -1; + // dbgwrite( &n, 2, 1, input_frame, "res/tdm_ratio_idx.enc" ); + } + else if ( hCPE->element_mode == IVAS_CPE_TD ) + { + dbgwrite( &hCPE->hStereoTCA->refChanIndx, 2, 1, input_frame, "res/TCA_idx_refChan" ); + n = hCPE->hStereoTCA->refChanIndx == 0 ? hCPE->hStereoTCA->indx_ica_NCShift : -hCPE->hStereoTCA->indx_ica_NCShift; + dbgwrite( &n, 2, 1, input_frame, "res/TCA_idx_NCShift" ); + dbgwrite( &hCPE->hStereoTCA->indx_ica_gD, 2, 1, input_frame, "res/TCA_idx_ica_gD" ); + + n = hCPE->hStereoTCA->corrLagStats[2]; + dbgwrite( &n, 2, 1, input_frame, "res/itd" ); + + dbgwrite( &tdm_ratio_idx, 2, 1, input_frame, "res/tdm_ratio_idx.enc" ); + } + else if ( hCPE->element_mode == IVAS_CPE_MDCT ) + { + n = -2; + // dbgwrite( &n, 2, 1, input_frame, "res/tdm_ratio_idx.enc" ); + } + + { + float tmpF = ivas_total_brate / 1000.0f; + dbgwrite( &tmpF, sizeof( float ), 1, input_frame, fname( debug_dir, "element_brate", 0, cpe_id, ENC ) ); + } +#endif pop_wmops(); return error; @@ -868,7 +947,11 @@ ivas_error create_cpe_enc( hCPE->hStereoCng = NULL; } +#ifdef DEBUGGING + if ( hEncoderConfig->Opt_DTX_ON && ( hCPE->element_mode == IVAS_CPE_TD || hEncoderConfig->stereo_mode_cmdl == 1 ) && !( ivas_format == MASA_FORMAT && element_mode_init == IVAS_CPE_MDCT ) ) +#else if ( hEncoderConfig->Opt_DTX_ON && element_mode_init != IVAS_CPE_MDCT ) +#endif { for ( n = 0; n < CPE_CHANNELS; n++ ) { @@ -951,6 +1034,9 @@ ivas_error create_cpe_enc( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MDCT Stereo \n" ) ); } +#ifdef DEBUGGING + hCPE->hStereoMdct->mdct_stereo_mode_cmdl = st_ivas->hEncoderConfig->mdct_stereo_mode_cmdl; +#endif initMdctStereoEncData( hCPE->hStereoMdct, ivas_format, hCPE->element_mode, hCPE->element_brate, max_bwidth, 0, NULL, 1 ); hCPE->hStereoMdct->isSBAStereoMode = ( ( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT ) && ( st_ivas->nchan_transport == 2 ) ); diff --git a/lib_enc/ivas_decision_matrix_enc.c b/lib_enc/ivas_decision_matrix_enc.c index afa2d2d00..b9578423b 100644 --- a/lib_enc/ivas_decision_matrix_enc.c +++ b/lib_enc/ivas_decision_matrix_enc.c @@ -38,6 +38,9 @@ #include "prot.h" #include "ivas_prot.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -174,6 +177,39 @@ void ivas_decision_matrix_enc( st->core = TCX_20_CORE; } +#ifdef DEBUGGING + if ( st->idchan == 0 ) + { + if ( st->force == FORCE_SPEECH && st->element_mode != IVAS_CPE_MDCT && st->total_brate <= MAX_ACELP_BRATE ) + { + st->core = ACELP_CORE; + } + else if ( st->force == FORCE_MUSIC && st->core == ACELP_CORE ) + { + st->core = TCX_20_CORE; + } + else if ( st->force == FORCE_ACELP && st->element_mode != IVAS_CPE_MDCT && st->total_brate <= MAX_ACELP_BRATE ) + { + st->core = ACELP_CORE; + if ( st->coder_type == AUDIO ) + { + st->coder_type = GENERIC; + } + } + else if ( st->force == FORCE_GSC && element_brate < IVAS_24k4 ) + { + st->core = ACELP_CORE; + } + else if ( st->force == FORCE_TCX ) + { + st->core = TCX_20_CORE; + } + else if ( st->force == FORCE_HQ && st->element_mode != IVAS_CPE_MDCT && element_brate >= IVAS_24k4 ) + { + st->core = HQ_CORE; + } + } +#endif /* TCX not available at low bitrates -> replace it by GSC */ if ( st->core == TCX_20_CORE && st->total_brate < STEREO_TCX_MIN_RATE ) diff --git a/lib_enc/ivas_dirac_enc.c b/lib_enc/ivas_dirac_enc.c index 2c6f71d39..5c2493ec1 100644 --- a/lib_enc/ivas_dirac_enc.c +++ b/lib_enc/ivas_dirac_enc.c @@ -39,6 +39,9 @@ #include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" /*------------------------------------------------------------------------- @@ -694,6 +697,10 @@ void ivas_dirac_param_est_enc( } else { +#ifdef DEBUGGING + assert( pp_fr_real ); + assert( pp_fr_imag ); +#endif for ( i = 0; i < nchan_fb_in; i++ ) { mvr2r( &pp_fr_real[i][ts * l_ts], Cldfb_RealBuffer[i], l_ts ); @@ -749,6 +756,9 @@ void ivas_dirac_param_est_enc( if ( hodirac_flag ) { +#ifdef DEBUGGING + assert( l_ts <= DIRAC_NO_FB_BANDS_MAX ); +#endif calculate_hodirac_sector_parameters( hDirAC, Cldfb_RealBuffer, @@ -866,6 +876,100 @@ void ivas_dirac_param_est_enc( } } +#ifdef DEBUG_SBA_MD_DUMP + { + char f_name[100]; + int16_t num_subframes = 1, num_block_groups = 1, num_elements = 1, byte_size = sizeof( float ); + sprintf( f_name, "dirac_enc_diffuseness.bin" ); + ( frame == 0 ) ? dbgwrite( &hDirAC->hConfig->nbands, sizeof( hDirAC->hConfig->nbands ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_block_groups, sizeof( num_block_groups ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + dbgwrite( hDirAC->diffuseness_m, sizeof( float ), hDirAC->hConfig->nbands, 1, f_name ); + sprintf( f_name, "dirac_reference_power.bin" ); + ( frame == 0 ) ? dbgwrite( &hDirAC->hConfig->nbands, sizeof( hDirAC->hConfig->nbands ), 1, 1, f_name ) : false; + num_elements = hDirAC->block_grouping[1] - hDirAC->block_grouping[0]; + ( frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + num_block_groups = hDirAC->block_grouping[1]; + ( frame == 0 ) ? dbgwrite( &num_block_groups, sizeof( num_block_groups ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + for ( ts = hDirAC->block_grouping[0]; ts < hDirAC->block_grouping[1]; ts++ ) + { + dbgwrite( reference_power[ts], sizeof( float ), hDirAC->hConfig->nbands, 1, f_name ); + } + num_elements = 1; + num_subframes = MAX_PARAM_SPATIAL_SUBFRAMES; + num_block_groups = 1; + sprintf( f_name, "dirac_enc_dir0.bin" ); + ( frame == 0 ) ? dbgwrite( &hDirAC->hConfig->nbands, sizeof( hDirAC->hConfig->nbands ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_block_groups, sizeof( num_block_groups ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + for ( block_m_idx = 0; block_m_idx < MAX_PARAM_SPATIAL_SUBFRAMES; block_m_idx++ ) + { + dbgwrite( hDirAC->direction_vector_m[0][block_m_idx], sizeof( float ), hDirAC->hConfig->nbands, 1, f_name ); + } + sprintf( f_name, "dirac_enc_dir1.bin" ); + ( frame == 0 ) ? dbgwrite( &hDirAC->hConfig->nbands, sizeof( hDirAC->hConfig->nbands ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_block_groups, sizeof( num_block_groups ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + for ( block_m_idx = 0; block_m_idx < MAX_PARAM_SPATIAL_SUBFRAMES; block_m_idx++ ) + { + dbgwrite( hDirAC->direction_vector_m[1][block_m_idx], sizeof( float ), hDirAC->hConfig->nbands, 1, f_name ); + } + sprintf( f_name, "dirac_enc_dir2.bin" ); + ( frame == 0 ) ? dbgwrite( &hDirAC->hConfig->nbands, sizeof( hDirAC->hConfig->nbands ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_block_groups, sizeof( num_block_groups ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + for ( block_m_idx = 0; block_m_idx < MAX_PARAM_SPATIAL_SUBFRAMES; block_m_idx++ ) + { + dbgwrite( hDirAC->direction_vector_m[2][block_m_idx], sizeof( float ), hDirAC->hConfig->nbands, 1, f_name ); + } + } +#endif +#ifdef DEBUG_MODE_DIRAC + { + static FILE *fp_direction_vector = NULL, *fp_diffuseness = NULL, *fp_referencePower = NULL; + + if ( fp_direction_vector == NULL ) + fp_direction_vector = fopen( "./res/dbg_direction_vector_C.bin", "wb" ); + if ( fp_diffuseness == NULL ) + fp_diffuseness = fopen( "./res/dbg_diffuseness_C.bin", "wb" ); + if ( fp_referencePower == NULL ) + fp_referencePower = fopen( "./res/dbg_reference_power_C.bin", "wb" ); + + dbgwrite( hDirAC->diffuseness_m, sizeof( float ), hDirAC->hConfig->nbands, 1, "./res/dirac_enc_diffuseness.dat" ); + for ( block_m_idx = 0; block_m_idx < MAX_PARAM_SPATIAL_SUBFRAMES; block_m_idx++ ) + { + dbgwrite( hDirAC->direction_vector_m[0][block_m_idx], sizeof( float ), hDirAC->hConfig->nbands, 1, "./res/dirac_enc_dir0.dat" ); + dbgwrite( hDirAC->direction_vector_m[1][block_m_idx], sizeof( float ), hDirAC->hConfig->nbands, 1, "./res/dirac_enc_dir1.dat" ); + dbgwrite( hDirAC->direction_vector_m[2][block_m_idx], sizeof( float ), hDirAC->hConfig->nbands, 1, "./res/dirac_enc_dir2.dat" ); + + for ( ts = hDirAC->block_grouping[block_m_idx]; ts < hDirAC->block_grouping[block_m_idx + 1]; ts++ ) + { + for ( band_m_idx = 0; band_m_idx < hDirAC->hConfig->nbands; band_m_idx++ ) + { + for ( i = hDirAC->band_grouping[band_m_idx]; i < hDirAC->band_grouping[band_m_idx + 1]; i++ ) + { + for ( d = 0; d < DIRAC_NUM_DIMS; d++ ) + { + fwrite( &( hDirAC->direction_vector_m[d][block_m_idx][band_m_idx] ), sizeof( float ), 1, fp_direction_vector ); + } + fwrite( &( hDirAC->diffuseness_m[band_m_idx] ), sizeof( float ), 1, fp_diffuseness ); + fwrite( &( reference_power[ts][band_m_idx] ), sizeof( float ), 1, fp_referencePower ); + } + } + } + } + } +#endif pop_wmops(); return; } diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 0672aeda8..c52a722c2 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -38,6 +38,9 @@ #include "prot.h" #include "ivas_prot.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" /*-------------------------------------------------------------------* @@ -93,6 +96,17 @@ ivas_error ivas_enc( n = 0; while ( n < nchan_inp ) { +#ifdef DEBUG_MODE_LFE + if ( n == LFE_CHANNEL ) + { + int16_t tmp[L_FRAME48k]; + for ( i = 0; i < n_samples_chan; i++ ) + { + tmp[i] = data[i * nchan_inp + n]; + } + dbgwrite( tmp, sizeof( int16_t ), n_samples_chan, 1, "./lfe_chan_in.raw" ); + } +#endif for ( i = 0; i < n_samples_chan; i++ ) { data_f[n][i] = (float) data[i * nchan_inp + n]; @@ -108,6 +122,9 @@ ivas_error ivas_enc( } } +#ifdef DEBUG_MODE_LFE + dbgwrite( data_f[LFE_CHANNEL], sizeof( float ), n_samples_chan, 1, "./res/lfe_input" ); +#endif if ( ivas_format == SBA_FORMAT ) { @@ -130,6 +147,7 @@ ivas_error ivas_enc( n = getNumChanAnalysis( st_ivas ); +#ifndef DEBUG_SPAR_BYPASS_EVS_CODEC /* bypass EVS coding in float precision, emulating EVS encoder/decoder delay */ for ( i = 0; i < n; i++ ) { @@ -142,6 +160,7 @@ ivas_error ivas_enc( hp20( data_f[i], input_frame, st_ivas->mem_hp20_in[i], input_Fs ); } } +#endif /*----------------------------------------------------------------* * write IVAS format signaling @@ -334,7 +353,11 @@ ivas_error ivas_enc( } /* Configuration of combined-format bit-budget distribution */ +#ifdef DEBUG_MODE_INFO + ivas_set_surplus_brate_enc( st_ivas, nb_bits_metadata ); +#else ivas_set_surplus_brate_enc( st_ivas ); +#endif /* Encode MASA transport channels */ if ( ( ivas_cpe_enc( st_ivas, 0, data_f[n], data_f[n + 1], input_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) @@ -530,6 +553,12 @@ ivas_error ivas_enc( hEncoderConfig->last_ivas_total_brate = ivas_total_brate; +#ifdef DEBUG_MODE_INFO + { + float tmpF = ivas_total_brate / 1000.0f; + dbgwrite( &tmpF, sizeof( float ), 1, input_frame, "res/ivas_total_brate" ); + } +#endif pop_wmops(); return error; diff --git a/lib_enc/ivas_enc_cov_handler.c b/lib_enc/ivas_enc_cov_handler.c index d4e82c6d9..0eb88dcc1 100644 --- a/lib_enc/ivas_enc_cov_handler.c +++ b/lib_enc/ivas_enc_cov_handler.c @@ -35,6 +35,9 @@ #include "prot.h" #include "ivas_prot.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" /*------------------------------------------------------------------------------------------* @@ -308,6 +311,29 @@ void ivas_enc_cov_handler_process( } } +#ifdef DEBUG_SPAR_WRITE_OUT_COV + { + static FILE *fid = 0; + int16_t k = 0; + float tmp_buf[10]; + if ( !fid ) + { + fid = fopen( "cov_real.txt", "wt" ); + } + + for ( i = 0; i < num_ch; i++ ) + { + for ( j = 0; j < num_ch; j++ ) + { + for ( k = start_band; k < end_band; k++ ) + { + fprintf( fid, "%.6f\n", cov_real[i][j][k] ); + } + } + } + fprintf( fid, "\n" ); + } +#endif for ( i = 0; i < num_ch; i++ ) { for ( j = 0; j < num_ch; j++ ) diff --git a/lib_enc/ivas_entropy_coder.c b/lib_enc/ivas_entropy_coder.c index e118c7271..0157711bd 100644 --- a/lib_enc/ivas_entropy_coder.c +++ b/lib_enc/ivas_entropy_coder.c @@ -33,6 +33,9 @@ #include #include "options.h" #include "ivas_cnst.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "ivas_prot.h" #include "ivas_rom_com.h" diff --git a/lib_enc/ivas_front_vad.c b/lib_enc/ivas_front_vad.c index 4dcf2cd61..52c3b8cd4 100644 --- a/lib_enc/ivas_front_vad.c +++ b/lib_enc/ivas_front_vad.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "ivas_cnst.h" #include "rom_enc.h" @@ -144,6 +147,13 @@ ivas_error front_vad( /* Only run VAD if DTX is on and TD stereo or unified stereo is selected */ if ( hFrontVads[0] != NULL && element_mode != IVAS_CPE_MDCT ) { +#ifdef DEBUGGING + /* If stereo switching is not enabled and TD is selected restore element_mode to TD every frame before the VAD */ + if ( hCPE != NULL && hCPE->stereo_mode_cmdl == IVAS_CPE_TD ) + { + hCPE->element_mode = IVAS_CPE_TD; + } +#endif /*------------------------------------------------------------------* * VAD diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index ba4e0eaa1..e1aa7113a 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -38,6 +38,9 @@ #include "ivas_prot.h" #include "ivas_stat_enc.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -271,6 +274,9 @@ void copy_encoder_config( st->rf_fec_offset = st_ivas->hEncoderConfig->rf_fec_offset; st->rf_fec_indicator = st_ivas->hEncoderConfig->rf_fec_indicator; +#ifdef DEBUGGING + st->force = st_ivas->hEncoderConfig->force; +#endif st->element_mode = st_ivas->hEncoderConfig->element_mode_init; return; @@ -875,6 +881,12 @@ ivas_error ivas_init_encoder( } } } +#ifdef DEBUGGING + else + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Invalid IVAS format. Exiting.\n" ); + } +#endif /*-----------------------------------------------------------------* * Allocate and initialize HP20 filter memories diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 60737e731..1277d0d88 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -36,6 +36,9 @@ #include "ivas_cnst.h" #include "prot.h" #include "ivas_prot.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 5f34a92a9..db689cc9f 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -36,6 +36,9 @@ #include "prot.h" #include "ivas_prot.h" #include "ivas_stat_enc.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -144,6 +147,10 @@ ivas_error ivas_ism_enc( st->input_bwidth = st->last_input_bwidth; /* updated in BWD */ st->bwidth = st->last_bwidth; /* updated in BWD */ st->rate_switching_reset = 0; +#ifdef DEBUGGING + st->force = st_ivas->hEncoderConfig->force; + st->id_element = sce_id; +#endif /*---------------------------------------------------------------* * Time Domain Transient Detector @@ -202,6 +209,13 @@ ivas_error ivas_ism_enc( ivas_ism_coh_estim_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, st_ivas->nchan_transport, input_frame ); } +#ifdef DEBUG_MODE_PARAM_ISM + if ( st_ivas->hParamIsmDec != NULL ) + dbgwrite( &( st_ivas->hParamIsmDec->hParamIsm->flag_noisy_speech ), sizeof( int16_t ), 1, 1, "./res/ParamISM_noisy_speech_flag_enc.dat" ); + dbgwrite( &( st_ivas->hISMDTX->dtx_flag ), sizeof( int16_t ), 1, 1, "./res/ParamISM_DTX_CNG_flag_enc.dat" ); + dbgwrite( &( st_ivas->hISMDTX->sce_id_dtx ), sizeof( int16_t ), 1, input_frame, "./res/sce_id_dtx" ); + dbgwrite( &( dtx_flag ), sizeof( int16_t ), 1, input_frame, "./res/dtx_flag" ); +#endif } /*------------------------------------------------------------------* @@ -368,6 +382,40 @@ ivas_error ivas_ism_enc( } } +#ifdef DEBUG_MODE_INFO + if ( dtx_flag ) + { + float tmpF; + int16_t id, n; + + n = 0; + for ( sce_id = 0; sce_id < nchan_transport_ism; sce_id++ ) + { + if ( sce_id != st_ivas->hISMDTX->sce_id_dtx ) + { + st = st_ivas->hSCE[sce_id]->hCoreCoder[0]; + id = st->id_element; + + dbgwrite( &st->core, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "core", n, id, ENC ) ); + dbgwrite( &st->extl, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "extl", n, id, ENC ) ); + dbgwrite( &st->bwidth, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "bwidth", n, id, ENC ) ); + tmpF = st->total_brate / 1000.0f; + dbgwrite( &tmpF, sizeof( float ), 1, input_frame, fname( debug_dir, "total_brate", n, id, ENC ) ); + tmpF = st->core_brate / 1000.0f; + dbgwrite( &tmpF, sizeof( float ), 1, input_frame, fname( debug_dir, "core_brate", n, id, ENC ) ); + tmpF = st->extl_brate / 1000.0f; + dbgwrite( &tmpF, sizeof( float ), 1, input_frame, fname( debug_dir, "extl_brate", n, id, ENC ) ); + + dbgwrite( &st->coder_type, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "coder_type", n, id, ENC ) ); + dbgwrite( &st->coder_type_raw, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "coder_type_raw", n, id, ENC ) ); + dbgwrite( &st->vad_flag, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "vad_flag", n, id, ENC ) ); + dbgwrite( &st->localVAD, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "localVAD", n, id, ENC ) ); + + dbgwrite( &st->lp_noise, sizeof( float ), 1, input_frame, fname( debug_dir, "lp_noise", n, id, ENC ) ); + } + } + } +#endif pop_wmops(); return error; diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index d272953a6..849b7957a 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -39,6 +39,9 @@ #include "ivas_rom_com.h" #include "prot.h" #include +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index dd30d5828..6492c537a 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -142,6 +142,12 @@ static void ivas_param_ism_compute_obj_parameters( /* Power ratio range [0.5,1] is mapped to [0,1] first, rounding via truncation float->integer */ hParamIsm->power_ratios_idx[b][m] = (int16_t) ( ( ( power_ratios_m[b][m] - 0.5f ) * 2 ) * ( ( 1 << PARAM_ISM_POW_RATIO_NBITS ) - 1 ) + 0.5f ); assert( ( hParamIsm->power_ratios_idx[b][m] >= 0 ) && ( hParamIsm->power_ratios_idx[b][m] <= ( ( 1 << PARAM_ISM_POW_RATIO_NBITS ) - 1 ) ) ); +#ifdef DEBUG_MODE_PARAM_ISM + dbgwrite( ref_power_local, sizeof( float ), 3, 1, "res/ParamISM_refPowerLocal.dat" ); + dbgwrite( hParamIsm->obj_indices[b][m], sizeof( int16_t ), 2, 1, "res/ParamISM_objIndices.dat" ); + dbgwrite( &hParamIsm->power_ratios_idx[b][m], sizeof( int16_t ), 1, 1, "res/ParamISM_powerRatioIdx.dat" ); + dbgwrite( &power_ratios_m[b][m], sizeof( float ), 1, 1, "res/ParamISM_powerRatio.dat" ); +#endif } } diff --git a/lib_enc/ivas_lfe_enc.c b/lib_enc/ivas_lfe_enc.c index 0c7a1a21a..2ff49cb1f 100644 --- a/lib_enc/ivas_lfe_enc.c +++ b/lib_enc/ivas_lfe_enc.c @@ -37,6 +37,9 @@ #include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index bc6993bc0..6019ee03c 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -3103,6 +3103,9 @@ static int16_t encode_ratio_ism_subframe( int16_t bits_index; int16_t nbits00, nbits11; int16_t idx_sep_obj_local; +#ifdef DEBUGGING + int16_t bits_pos0; +#endif idx_sep_obj_local = idx_separated_obj; if ( idx_separated_obj > -1 ) @@ -3116,6 +3119,9 @@ static int16_t encode_ratio_ism_subframe( nbits0 = 0; nbits1 = 0; +#ifdef DEBUGGING + bits_pos0 = hMetaData->nb_bits_tot; +#endif differential_subframe = 1; /* the differences are taken with respect to previous subframe */ /* first subframe */ @@ -3151,6 +3157,9 @@ static int16_t encode_ratio_ism_subframe( } } +#ifdef DEBUGGING + assert( nbits == ( hMetaData->nb_bits_tot - bits_pos0 ) ); +#endif } else { @@ -3319,6 +3328,9 @@ static int16_t encode_ratio_ism_subframe( } } +#ifdef DEBUGGING + assert( nbits == ( hMetaData->nb_bits_tot - bits_pos0 ) ); +#endif } } diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index 5a90fc89a..fba297566 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -41,6 +41,12 @@ #include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif +#ifdef DEBUG_PLOT +#include "deb_out.h" +#endif #include "wmc_auto.h" @@ -124,6 +130,10 @@ ivas_error ivas_param_mc_enc_open( st_ivas->nSCE = 0; st_ivas->hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; break; +#ifdef DEBUGGING + default: + assert( 0 && "Number of transport channels not supported by ParamMC!\n" ); +#endif } /* get dmx factors */ @@ -261,6 +271,10 @@ ivas_error ivas_param_mc_enc_reconfig( st_ivas->nSCE = 0; st_ivas->hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; break; +#ifdef DEBUGGING + default: + assert( 0 && "Number of transport channels not supported by ParamMC!\n" ); +#endif } /* get dmx factors */ @@ -269,6 +283,9 @@ ivas_error ivas_param_mc_enc_reconfig( /* deallocate the full icc map, gets newly allocated in the metadata open function */ for ( i = 0; i < 2; i++ ) { +#ifdef DEBUGGING + assert( hParamMC->hMetadataPMC.icc_map_full[i] != NULL ); +#endif if ( hParamMC->hMetadataPMC.icc_map_full[i] != NULL ) { free( hParamMC->hMetadataPMC.icc_map_full[i] ); @@ -474,6 +491,10 @@ void ivas_param_mc_enc( } } break; +#ifdef DEBUGGING + default: + assert( !"Number of transport channels not valid for ParamMC!" ); +#endif } /* Encoding */ @@ -1713,6 +1734,9 @@ static void ivas_param_mc_encode_parameter( } } +#ifdef DEBUG_MODE_PARAM_MC + dbgwrite( seq, sizeof( int16_t ), sz_seq, 1, "./res/param_mc_quant_param_idx_enc.dat" ); +#endif bit_cnt_uni = sz_seq * hParameterCodingInfo->uni_bits - 1; /* -1 for the additional diff/direct signaling bit for the range encoder*/ diff --git a/lib_enc/ivas_mc_paramupmix_enc.c b/lib_enc/ivas_mc_paramupmix_enc.c index 54f1eba84..bcb519f07 100644 --- a/lib_enc/ivas_mc_paramupmix_enc.c +++ b/lib_enc/ivas_mc_paramupmix_enc.c @@ -41,6 +41,12 @@ #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "ivas_rom_enc.h" +#ifdef DEBUGGING +#include "debug.h" +#endif +#ifdef DEBUG_PLOT +#include "deb_out.h" +#endif #include "wmc_auto.h" /*------------------------------------------------------------------------- @@ -159,6 +165,10 @@ ivas_error ivas_mc_paramupmix_enc_open( st_ivas->nSCE = 0; st_ivas->hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; break; +#ifdef DEBUGGING + default: + assert( 0 && "Number of transport channels not supported by MC PARAM UPMIX MODE!\n" ); +#endif } /* Transient Detector handle */ diff --git a/lib_enc/ivas_mcmasa_enc.c b/lib_enc/ivas_mcmasa_enc.c index 7bb8092d7..32833d37b 100644 --- a/lib_enc/ivas_mcmasa_enc.c +++ b/lib_enc/ivas_mcmasa_enc.c @@ -40,6 +40,9 @@ #include "prot.h" #include "ivas_rom_com.h" #include "ivas_rom_enc.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index 84aef1d46..c20d09e33 100644 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -37,6 +37,9 @@ #include "prot.h" #include "ivas_prot.h" #include "rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -85,6 +88,13 @@ static void FindChannelRatio( } } +#ifdef DEBUG_MODE_MDCT + for ( i = 0; i < nChannels; i++ ) + { + dbgwrite( &chBitRatios[i], sizeof( int16_t ), 1, 1, "./res/chBitRatio" ); + /* dbgwrite(&chRatio[i], sizeof(float),1,1,"./res/chRatio");*/ + } +#endif return; } @@ -201,7 +211,16 @@ void ivas_mct_core_enc( int16_t sp_aud_decision0[MCT_MAX_CHANNELS]; BSTR_ENC_HANDLE hBstr; float mdst; +#ifdef DEBUGGING + int32_t total_brate = 0; + int16_t sba_meta = 0; + int16_t format_bits = 0; + int16_t mct_bits = 0; +#endif +#if defined( DEBUG_MODE_MDCT ) && defined( DEBUG_PLOT_BITS ) + static FILE *f_bit_split = 0; +#endif push_wmops( "mct_encoding" ); @@ -502,6 +521,9 @@ void ivas_mct_core_enc( } nAvailBits -= total_side_bits + hMCT->nchan_out_woLFE; /* if MC 1 extra bit that was initially send to signal LFE_off */ +#ifdef DEBUG_MODE_MDCT + dbgwrite( &nAvailBits, sizeof( int16_t ), 1, 1, "./res/availBits" ); +#endif if ( hMCT->hbr_mct ) { @@ -517,6 +539,9 @@ void ivas_mct_core_enc( } push_next_indice( hBstr, chBitRatios[ch], NBBITS_MCT_RATIO ); +#ifdef DEBUGGING + mct_bits += NBBITS_MCT_RATIO; +#endif } /*distribute bits amongst channels*/ @@ -533,9 +558,24 @@ void ivas_mct_core_enc( } st->total_brate = ( st->bits_frame_channel + st->side_bits_frame_channel ) * FRAMES_PER_SEC; +#ifdef DEBUGGING + total_brate += st->total_brate; +#endif + } +#ifdef DEBUGGING + if ( hCPE[cpe_id]->hMetaData != NULL ) + { + sba_meta += hCPE[cpe_id]->hMetaData->nb_bits_tot; } +#endif } +#ifdef DEBUGGING + format_bits = ( ivas_format == MC_FORMAT ? IVAS_FORMAT_SIGNALING_NBITS + MC_LS_SETUP_BITS : IVAS_FORMAT_SIGNALING_NBITS_EXTENDED + SBA_ORDER_BITS + SBA_PLANAR_BITS ); + format_bits += ( ivas_format == SBA_ISM_FORMAT && nChannels > FOA_CHANNELS ); + mct_bits += hMCT->nBitsMCT + hMCT->nchan_out_woLFE; + assert( ( total_brate + ( NBITS_BWIDTH + format_bits + mct_bits + sba_meta + lfe_bits ) * FRAMES_PER_SEC ) == ivas_total_brate ); +#endif pop_wmops(); diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index 9f1b4a416..59bec00e2 100644 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -38,6 +38,9 @@ #include "ivas_cnst.h" #include "prot.h" #include "ivas_prot.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -186,6 +189,12 @@ ivas_error ivas_mct_enc( max_bwidth = st_ivas->hEncoderConfig->max_bwidth; ivas_total_brate = st_ivas->hEncoderConfig->ivas_total_brate; +#ifdef DEBUG_FORCE_MCT_CP + if ( ivas_format == MC_FORMAT ) + { + assert( !"Debugging switch works only with SBA modes" ); + } +#endif for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { @@ -325,6 +334,12 @@ ivas_error create_mct_enc( { hMCT->nchan_out_woLFE = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS - 1; } +#ifdef DEBUGGING + else + { + assert( !"IVAS format currently not supported for MCT" ); + } +#endif cp_bitrate = ivas_total_brate / hMCT->nchan_out_woLFE * CPE_CHANNELS; if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) @@ -372,6 +387,9 @@ ivas_error create_mct_enc( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MDCT Stereo \n" ) ); } +#ifdef DEBUGGING + hMCT->hBlockData[n]->hStereoMdct->mdct_stereo_mode_cmdl = SMDCT_MS_DECISION; +#endif initMdctStereoEncData( hMCT->hBlockData[n]->hStereoMdct, ivas_format, IVAS_CPE_MDCT, cp_bitrate, st_ivas->hEncoderConfig->max_bwidth, st_ivas->hCPE[0]->hCoreCoder[0]->igf, st_ivas->hCPE[0]->hCoreCoder[0]->igf ? st_ivas->hCPE[0]->hCoreCoder[0]->hIGFEnc->igfData.igfInfo.grid : NULL, 1 ); } @@ -443,6 +461,12 @@ ivas_error mct_enc_reconfigure( hMCT->nchan_out_woLFE += st_ivas->hEncoderConfig->nchan_ism; } } +#ifdef DEBUGGING + else + { + assert( !"IVAS format currently not supported for MCT" ); + } +#endif } cp_bitrate = ivas_total_brate / hMCT->nchan_out_woLFE * CPE_CHANNELS; @@ -526,6 +550,9 @@ ivas_error mct_enc_reconfigure( } } +#ifdef DEBUGGING + hMCT->hBlockData[n]->hStereoMdct->mdct_stereo_mode_cmdl = SMDCT_MS_DECISION; +#endif initMdctStereoEncData( hMCT->hBlockData[n]->hStereoMdct, ivas_format, IVAS_CPE_MDCT, cp_bitrate, st_ivas->hEncoderConfig->max_bwidth, st_ivas->hCPE[0]->hCoreCoder[0]->igf, st_ivas->hCPE[0]->hCoreCoder[0]->igf ? st_ivas->hCPE[0]->hCoreCoder[0]->hIGFEnc->igfData.igfInfo.grid : NULL, mem_init ); } @@ -723,6 +750,12 @@ static ivas_error ivas_mc_enc_reconfig( return error; } } +#ifdef DEBUGGING + else + { + assert( 0 ); + } +#endif /*De-allocate handles for other MC modes*/ ivas_param_mc_enc_close( &st_ivas->hParamMC, st_ivas->hEncoderConfig->input_Fs ); diff --git a/lib_enc/ivas_mct_enc_mct.c b/lib_enc/ivas_mct_enc_mct.c index ee2690507..c5df49bf0 100644 --- a/lib_enc/ivas_mct_enc_mct.c +++ b/lib_enc/ivas_mct_enc_mct.c @@ -200,6 +200,9 @@ static void getCorrelationMatrix( xCorrMatrix[ch1][ch2] = 0.f; } +#ifdef DEBUG_MODE_MDCT + dbgwrite( &xCorrMatrix[ch1][ch2], sizeof( float ), 1, 1, "./res/xCorrMatrix" ); +#endif } } @@ -430,6 +433,11 @@ static void getGlobalILD( } } +#ifdef DEBUG_MODE_MDCT + /*check if energy levels are comparable*/ + getChannelEnergies( sts, nrg, nchan ); + dbgwrite( nrg, sizeof( float ), 6, 1, "./res/nrgGlobalILD" ); +#endif return; } @@ -486,6 +494,7 @@ void apply_MCT_enc( { /*Normalize energies with global ILD*/ getGlobalILD( sts, hMCT, mdst_spectrum, nchan ); +#ifndef DEBUG_FORCE_MCT_CP getCorrelationMatrix( sts, hMCT, xCorrMatrix ); /*check if previous tree should be kept*/ @@ -536,6 +545,9 @@ void apply_MCT_enc( } } +#ifdef DEBUG_MODE_MDCT + dbgwrite( &forceKeepTree, sizeof( int16_t ), 1, 1, "./res/keepTree" ); +#endif currBlockDataCnt = 0; while ( currBlockDataCnt < hMCT->nchan_out_woLFE ) @@ -614,6 +626,58 @@ void apply_MCT_enc( /*save number of blocks for next frame*/ hMCT->currBlockDataCnt = currBlockDataCnt; +#else + forceKeepTree = 1; + if ( nchan == 3 ) /*3 TCs*/ + { +#ifdef DEBUG_SINGLE_CODE_OMNI + ch1 = 1; + ch2 = 2; + cpEle[0] = 0; +#else + /* one stereo pair for first and second channel (W,Y)*/ + ch1 = 0; + ch2 = 1; + cpEle[2] = 0; +#endif + hMCT->currBlockDataCnt = 1; + hMCT->hBlockData[0]->ch1 = ch1; + hMCT->hBlockData[0]->ch2 = ch2; + + getBlockValues( sts, ch1, ch2, hMCT->hBlockData[0], mdst_spectrum, inv_spectrum, inv_mdst_spectrum ); + + if ( hMCT->hBlockData[0]->isActive ) + { + cpEle[ch1] = 1; + cpEle[ch2] = 1; + } + else + { + hMCT->currBlockDataCnt = 0; + } + } + else + { + assert( nchan == 4 ); /*4 TCs*/ + /* 2 Stereo Pairs W-Y and X-Z */ + hMCT->currBlockDataCnt = nchan * 0.5; + for ( currBlockDataCnt = 0; currBlockDataCnt < hMCT->currBlockDataCnt; currBlockDataCnt++ ) + { + hMCT->hBlockData[currBlockDataCnt]->ch1 = currBlockDataCnt * CPE_CHANNELS; + hMCT->hBlockData[currBlockDataCnt]->ch2 = currBlockDataCnt * CPE_CHANNELS + 1; + getBlockValues( sts, hMCT->hBlockData[currBlockDataCnt]->ch1, hMCT->hBlockData[currBlockDataCnt]->ch2, hMCT->hBlockData[currBlockDataCnt], mdst_spectrum, inv_spectrum, inv_mdst_spectrum ); + if ( hMCT->hBlockData[0]->isActive ) + { + cpEle[hMCT->hBlockData[currBlockDataCnt]->ch1] = 1; + cpEle[hMCT->hBlockData[currBlockDataCnt]->ch2] = 1; + } + else + { + hMCT->currBlockDataCnt -= 1; + } + } + } +#endif for ( ch = 0; ch < nchan; ch++ ) { @@ -652,6 +716,24 @@ void apply_MCT_enc( hMCT->mc_global_ild[ch] = 0; } } +#ifdef DEBUG_MODE_MDCT + dbgwrite( &hMCT->currBlockDataCnt, sizeof( int16_t ), 1, 1, "./res/blockCnt" ); + + { + int16_t pair, k; + for ( pair = 0; pair < (int16_t) ( hMCT->nchan_out_woLFE * 0.5 ); pair++ ) + { + dbgwrite( &hMCT->hBlockData[pair]->ch1, sizeof( int16_t ), 1, 1, "./res/CP_in_blocks" ); + dbgwrite( &hMCT->hBlockData[pair]->ch2, sizeof( int16_t ), 1, 1, "./res/CP_in_blocks" ); + for ( k = 0; k < 2; k++ ) + { + dbgwrite( &hMCT->hBlockData[pair]->hStereoMdct->global_ild[k], sizeof( int16_t ), 1, 1, "./res/ILD_p_block" ); + dbgwrite( &hMCT->hBlockData[pair]->hStereoMdct->mdct_stereo_mode[k], sizeof( int16_t ), 1, 1, "./res/stereo_mode_p_block" ); + dbgwrite( &hMCT->hBlockData[pair]->mask[k], sizeof( int16_t ), MAX_SFB, 1, "./res/ms_mask_p_block" ); + } + } + } +#endif pop_wmops(); diff --git a/lib_enc/ivas_mdct_core_enc.c b/lib_enc/ivas_mdct_core_enc.c index 368b76e94..f37eeb435 100644 --- a/lib_enc/ivas_mdct_core_enc.c +++ b/lib_enc/ivas_mdct_core_enc.c @@ -40,6 +40,9 @@ #include "ivas_prot.h" #include "rom_com.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" /*--------------------------------------------------------------* @@ -67,6 +70,9 @@ static void enc_prm_pre_mdct( ) { int16_t nbits_start; +#ifdef DEBUG_PLOT_BITS + int16_t tmp; +#endif nbits_start = hBstr->nb_bits_tot; @@ -92,6 +98,11 @@ static void enc_prm_pre_mdct( } st->glr_reset = 0; +#ifdef DEBUG_PLOT_BITS + tmp = hBstr->nb_bits_tot - nbits_start; + dbgwrite( &tmp, sizeof( int16_t ), 1, 1, "./res/bits_TCX" ); + tmp = hBstr->nb_bits_tot; +#endif /*--------------------------------------------------------------------------------* * TCX20/TCX10 parameters @@ -101,6 +112,9 @@ static void enc_prm_pre_mdct( st->side_bits_frame_channel = hBstr->nb_bits_tot - nbits_start; +#ifdef DEBUG_PLOT_BITS + dbgwrite( &st->side_bits_frame_channel, sizeof( int16_t ), 1, 1, "./res/side_bits_pre" ); +#endif return; } @@ -902,6 +916,14 @@ void ivas_mdct_core_whitening_enc( } else { +#ifdef DEBUG_MODE_MDCT + { + float ener_side = 0; + float ener_mid = 0; + dbgwrite( &ener_side, sizeof( float ), 1, 1, "./res/ener_side" ); + dbgwrite( &ener_mid, sizeof( float ), 1, 1, "./res/ener_mid" ); + } +#endif for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { param_lpc[ch][0] = ch; @@ -1248,6 +1270,16 @@ void ivas_mdct_quant_coder( ivas_mdct_tcx10_bit_distribution( target_bitsTCX10[ch], bitsAvailable, nTnsBitsTCX10Tmp ); } +#ifdef DEBUG_PLOT_BITS + if ( st->hTcxEnc->tcxMode == TCX_20 ) + { + set_s( &target_bitsTCX10[ch][0], 0, NB_DIV ); + } + for ( n = 0; n < NB_DIV; n++ ) + { + dbgwrite( &target_bitsTCX10[ch][n], sizeof( int16_t ), 1, 1, "./res/bits_tarrget_TCX10" ); + } +#endif for ( n = 0; n < nSubframes; n++ ) { diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 404c1537d..8f0cf1348 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -39,6 +39,9 @@ #include "prot.h" #include "ivas_rom_com.h" #include "ivas_rom_enc.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -666,6 +669,10 @@ void ivas_set_ism_importance_interformat( void ivas_set_surplus_brate_enc( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +#ifdef DEBUG_MODE_INFO + , + const int16_t *nb_bits_metadata /* i : number of metadata bits */ +#endif ) { if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) @@ -682,6 +689,31 @@ void ivas_set_surplus_brate_enc( st_ivas->hCPE[0]->brate_surplus = 0; } +#ifdef DEBUG_MODE_INFO + if ( st_ivas->hSCE[0] != NULL ) + { + int16_t input_frame = (int16_t) ( st_ivas->hEncoderConfig->input_Fs / FRAMES_PER_SEC ); + float tmpF = 0; + + if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) + { + tmpF += st_ivas->hSCE[0]->hCoreCoder[0]->total_brate + (float) ( nb_bits_metadata[1] * 50 ); + } + else + { + for ( int16_t i = 0; i < st_ivas->hEncoderConfig->nchan_ism; i++ ) + { + tmpF += st_ivas->hSCE[i]->hCoreCoder[0]->total_brate + (float) ( nb_bits_metadata[i + 1] * 50 ); + } + } + tmpF /= 1000.f; + dbgwrite( &tmpF, 4, 1, input_frame, "res/brate_ISM" ); /* == ism_total_brate incl. ISM MD */ + tmpF = st_ivas->hEncoderConfig->ivas_total_brate / 1000.0f - tmpF; + dbgwrite( &tmpF, 4, 1, input_frame, "res/brate_MASA" ); /* == masa_total_brate incl. MASA MD */ + tmpF = nb_bits_metadata[0] * FRAMES_PER_SEC / 1000.0f; + dbgwrite( &tmpF, 4, 1, input_frame, "res/brate_MASA_MD" ); /* == MASA MD bitrate */ + } +#endif return; } diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index 38c435ad1..675b89c6d 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -39,6 +39,9 @@ #include "prot.h" #include "ivas_rom_com.h" #include "ivas_rom_enc.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_enc/ivas_pca_enc.c b/lib_enc/ivas_pca_enc.c index c3cdd6b2d..f8b4c8e9a 100644 --- a/lib_enc/ivas_pca_enc.c +++ b/lib_enc/ivas_pca_enc.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "ivas_prot.h" #include "ivas_cnst.h" @@ -329,6 +332,9 @@ void ivas_pca_enc( return; } +#ifdef DEBUGGING + assert( ivas_total_brate == PCA_BRATE ); /* the remaining code is defined at 256k where there are 4 dmx channel */ +#endif /*-----------------------------------------------------------------* * Covariance *-----------------------------------------------------------------*/ diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index adf728547..0be2dc62d 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -47,6 +47,10 @@ * Local function prototypes *-----------------------------------------------------------------------*/ +#ifdef DEBUG_MODE_QMETADATA +static float direction_distance( float elevation[DIRAC_MAX_NBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], float azimuth[DIRAC_MAX_NBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], IVAS_QDIRECTION *q_direction, const int16_t dim1, const int16_t dim2, float mat_dist[DIRAC_MAX_NBANDS][MAX_PARAM_SPATIAL_SUBFRAMES] ); + +#endif static void ivas_qmetadata_quantize_diffuseness_nrg_ratios( IVAS_QMETADATA_HANDLE hQMetaData, int16_t *needed_bits, int16_t *nbits_diff, int16_t *dfRatioBits, const int16_t hodirac_flag ); static int16_t ivas_qmetadata_entropy_encode_diffuseness( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, uint16_t *diffuseness_index_max_ec_frame ); @@ -164,6 +168,33 @@ ivas_error ivas_qmetadata_enc_encode( error = IVAS_ERR_OK; +#ifdef DEBUG_MODE_QMETADATA + int16_t ec_flag = 0; + int16_t tmp; + + static FILE *pF = NULL; + static FILE *pF_azi = NULL; + static FILE *pF_ele = NULL; + static FILE *pF_ratio = NULL; + static FILE *pF_spcoh = NULL; + static FILE *pF_spcoh_orig = NULL; + static FILE *pF_surcoh = NULL; + + if ( pF == NULL ) + pF = fopen( "./res/qmetadata_enc.txt", "w" ); + if ( pF_azi == NULL ) + pF_azi = fopen( "./res/qmetadata_azi_enc.txt", "w" ); + if ( pF_ele == NULL ) + pF_ele = fopen( "./res/qmetadata_ele_enc.txt", "w" ); + if ( pF_ratio == NULL ) + pF_ratio = fopen( "./res/qmetadata_ratio_enc.txt", "w" ); + if ( pF_spcoh == NULL ) + pF_spcoh = fopen( "./res/qmetadata_spcoh_enc.txt", "w" ); + if ( pF_spcoh_orig == NULL ) + pF_spcoh_orig = fopen( "./res/qmetadata_spcoh_orig.txt", "w" ); + if ( pF_surcoh == NULL ) + pF_surcoh = fopen( "./res/qmetadata_surcoh_enc.txt", "w" ); +#endif /* Save initial position in bitstream */ @@ -187,6 +218,9 @@ ivas_error ivas_qmetadata_enc_encode( if ( ndirections > 1 ) { +#ifdef DEBUGGING + assert( ndirections == 2 ); +#endif /* Reorder 2dir bands for more efficient encoding. */ if ( !hodirac_flag ) { @@ -217,6 +251,9 @@ ivas_error ivas_qmetadata_enc_encode( { set_f( hQMetaData->q_direction[1].band_data[i].energy_ratio, 0.0f, hQMetaData->q_direction[1].cfg.nblocks ); } +#ifdef DEBUGGING + assert( d == hQMetaData->numTwoDirBands ); +#endif hQMetaData->q_direction[1].cfg.nbands = hQMetaData->numTwoDirBands; } @@ -333,6 +370,25 @@ ivas_error ivas_qmetadata_enc_encode( bits_diff[d] = 0; } +#ifdef DEBUG_MODE_QMETADATA + { + int16_t j, k; + k = 0; + fprintf( pF_spcoh_orig, "%d %d ", frame, k ); + + for ( i = start_band; i < nbands; i++ ) + { + for ( j = 0; j < nblocks; j++ ) + { + if ( q_direction->coherence_band_data != NULL ) + { + fprintf( pF_spcoh_orig, " %d ", q_direction->coherence_band_data[i].spread_coherence[j] ); + } + } + } + fprintf( pF_spcoh_orig, "\n" ); + } +#endif bits_signaling[d] = 0; @@ -384,9 +440,21 @@ ivas_error ivas_qmetadata_enc_encode( { hMetaData->ind_list[next_ind_raw_flag].value = 1; /*rewrite flag*/ bits_ec = ivas_qmetadata_raw_encode_dir( hMetaData, q_direction, q_direction->cfg.nbands, q_direction->cfg.start_band ); +#ifdef DEBUGGING + assert( bits_dir_bands[0] == bits_ec ); +#endif } bits_dir[d] = bits_ec + 1; +#ifdef DEBUG_MODE_QMETADATA + tmp = bits_dir[d] - ( total_bits_1dir - ( bits_diff[d] + bits_coherence[d] + bits_signaling[d] ) ); +#endif extra_bits = hQMetaData->metadata_max_bits - ( hMetaData->nb_bits_tot - bit_pos_0 ); +#ifdef DEBUGGING + assert( bit_pos_start + bits_signaling[d] - 1 + bits_dir[d] == hMetaData->nb_bits_tot ); +#endif +#ifdef DEBUG_MODE_QMETADATA + ec_flag = 0; +#endif /* Encode quantized directions with EC band-wise */ if ( ( total_bits_1dir + bits_surround_coh <= hQMetaData->qmetadata_max_bit_req ) && ( bits_dir[d] + bits_diff[d] + bits_coherence[d] + bits_signaling[d] > total_bits_1dir ) && q_direction->cfg.nblocks > 1 ) @@ -437,13 +505,28 @@ ivas_error ivas_qmetadata_enc_encode( /* Write ec bits */ bits_ec = ivas_qmetadata_raw_encode_dir( hMetaData, q_direction, i + 1, i ); +#ifdef DEBUGGING + assert( bits_dir_bands[i] == bits_ec ); +#endif } bits_dir[d] += bits_dir_bands[i] + 1; } extra_bits = hQMetaData->metadata_max_bits - ( hMetaData->nb_bits_tot - bit_pos_0 ); +#ifdef DEBUGGING + if ( ( diff_bits <= 0 ) && ( bits_dir[d] + bits_diff[d] + bits_coherence[d] + bits_signaling[d] > total_bits_1dir ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "not possible!!" ); + } +#endif +#ifdef DEBUGGING + assert( bit_pos_start + bits_signaling[d] - 1 + bits_dir[d] == hMetaData->nb_bits_tot ); +#endif +#ifdef DEBUG_MODE_QMETADATA + ec_flag = 1; +#endif } /* Requantized directions */ @@ -486,6 +569,9 @@ ivas_error ivas_qmetadata_enc_encode( bits_dir[d] = hMetaData->nb_bits_tot; requantize_direction_EC_3( &extra_bits, q_direction, nbands, hMetaData, elevation_orig, azimuth_orig, ind_order ); bits_dir[d] = hMetaData->nb_bits_tot - bits_dir[d]; +#ifdef DEBUG_MODE_QMETADATA + ec_flag = 2; +#endif } /* finalize writing coherence */ @@ -501,6 +587,67 @@ ivas_error ivas_qmetadata_enc_encode( { total_bits_1dir = hQMetaData->metadata_max_bits - ( hMetaData->nb_bits_tot - bit_pos_0 ); } +#ifdef DEBUG_MODE_QMETADATA + { + int16_t j; + float tmp_f, mat_dist[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; + + fprintf( pF, "frame %d: diff %d coh %d surcoh %d ", frame, bits_diff[d], bits_coherence[d], bits_surround_coh ); + fprintf( pF, "dir %d %d,%d,%d %d %5.3f\n", ec_flag, hMetaData->nb_bits_tot - bit_pos_0, total_bits_1dir, bits_dir_raw, tmp, direction_distance( elevation_orig, azimuth_orig, q_direction, nbands, nblocks, mat_dist ) ); + fprintf( pF_azi, "frame %d/dir/ec %d/%d: ", frame, d, ec_flag ); + fprintf( pF_ele, "frame %d/dir/ec %d/%d: ", frame, d, ec_flag ); + fprintf( pF_ratio, "frame %d/dir %d: ", frame, d ); + /*fprintf( pF_spcoh, "frame %d/dir %d: ", frame, d ); */ + fprintf( pF_spcoh, " %d %d ", frame, d ); + if ( d == 0 ) + { + fprintf( pF_surcoh, "frame %d/dir %d: ", frame, d ); + } + + /* direction_distance( elevation_orig, azimuth_orig, q_direction, nbands, nblocks, mat_dist );*/ + for ( i = start_band; i < nbands; i++ ) + { + for ( j = 0; j < nblocks; j++ ) + { + fprintf( pF_azi, " %+5.2f ", (int16_t) ( 100.f * q_direction->band_data[i].azimuth[j] ) / 100.f ); + fprintf( pF_ele, " %+5.2f ", (int16_t) ( 100.f * q_direction->band_data[i].elevation[j] ) / 100.f ); + fprintf( pF_ratio, " %1.3f ", q_direction->band_data[i].energy_ratio[j] ); + if ( q_direction->coherence_band_data != NULL ) + { + fprintf( pF_spcoh, " %d ", q_direction->coherence_band_data[i].spread_coherence[j] ); + } + if ( d == 0 && hQMetaData->surcoh_band_data != NULL ) + { + fprintf( pF_surcoh, " %d ", hQMetaData->surcoh_band_data[i].surround_coherence[0] ); + } + } + } + fprintf( pF_azi, "\n" ); + fprintf( pF_ele, "\n" ); + fprintf( pF_ratio, "\n" ); + fprintf( pF_spcoh, "\n" ); + if ( d == 0 ) + { + fprintf( pF_surcoh, "\n" ); + } + + for ( i = 0; i < nblocks; i++ ) + { + for ( j = 0; j < nbands; j++ ) + { + dbgwrite( &( q_direction->band_data[j].azimuth[i] ), sizeof( float ), 1, 1, "./res/IVAS_QMETADATA_azi.bin" ); + dbgwrite( &( q_direction->band_data[j].elevation[i] ), sizeof( float ), 1, 1, "./res/IVAS_QMETADATA_ele.bin" ); + dbgwrite( &( mat_dist[j][i] ), sizeof( float ), 1, 1, "./res/IVAS_QMETADATA_dist.bin" ); + dbgwrite( &( q_direction->band_data[j].energy_ratio_index[i] ), sizeof( uint16_t ), 1, 1, "./res/IVAS_QMETADATA_diffuseness_index.bin" ); + tmp_f = 1.f - q_direction->band_data[j].energy_ratio[i]; + dbgwrite( &tmp_f, sizeof( float ), 1, 1, "./res/IVAS_QMETADATA_diffuseness.bin" ); + } + } + + j = (int16_t) ( hMetaData->nb_bits_tot ); + dbgwrite( &j, sizeof( int16_t ), 1, 1, "./res/IVAS_QMETADATA_bits.bin" ); + } +#endif /* Save quantized DOAs */ for ( i = start_band; i < nbands; i++ ) @@ -539,17 +686,48 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( int16_t nbands, nblocks, start_band; int16_t ndirections, d; int16_t all_coherence_zero; +#ifdef DEBUG_MODE_QMETADATA + int16_t bits_no_dirs_coh; +#endif int16_t bits_ec; float azimuth_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], elevation_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; ivas_error error; error = IVAS_ERR_OK; +#ifdef DEBUG_MODE_QMETADATA + + static FILE *pF = NULL; + static FILE *pF_azi = NULL; + static FILE *pF_ele = NULL; + static FILE *pF_ratio = NULL; + static FILE *pF_spcoh = NULL; + static FILE *pF_spcoh_orig = NULL; + static FILE *pF_surcoh = NULL; + + if ( pF == NULL ) + pF = fopen( "./res/qmetadata_enc.txt", "w" ); + if ( pF_azi == NULL ) + pF_azi = fopen( "./res/qmetadata_azi_enc.txt", "w" ); + if ( pF_ele == NULL ) + pF_ele = fopen( "./res/qmetadata_ele_enc.txt", "w" ); + if ( pF_ratio == NULL ) + pF_ratio = fopen( "./res/qmetadata_ratio_enc.txt", "w" ); + if ( pF_spcoh == NULL ) + pF_spcoh = fopen( "./res/qmetadata_spcoh_enc.txt", "w" ); + if ( pF_spcoh_orig == NULL ) + pF_spcoh_orig = fopen( "./res/qmetadata_spcoh_orig.txt", "w" ); + if ( pF_surcoh == NULL ) + pF_surcoh = fopen( "./res/qmetadata_surcoh_enc.txt", "w" ); +#endif ndirections = hQMetaData->no_directions; /* Check if coherence should be encoded */ all_coherence_zero = 1; +#ifdef DEBUG_MODE_QMETADATA + bits_no_dirs_coh = 0; +#endif if ( hQMetaData->q_direction->cfg.inactiveBands > 0 ) { push_next_indice( hMetaData, 1, 1 ); @@ -565,11 +743,17 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( { all_coherence_zero = hQMetaData->all_coherence_zero; push_next_indice( hMetaData, all_coherence_zero, 1 ); /* signal coherence */ +#ifdef DEBUG_MODE_QMETADATA + bits_no_dirs_coh += 1; +#endif } /* encode 2 direction subbands position */ if ( ndirections == 2 && bits_sph_idx == 11 ) { +#ifdef DEBUG_MODE_QMETADATA + bits_no_dirs_coh += +#endif write_2dir_info( hMetaData, hQMetaData->twoDirBands, hQMetaData->q_direction[0].cfg.nbands, hQMetaData->numTwoDirBands ); d = 0; for ( i = hQMetaData->q_direction[1].cfg.start_band; i < hQMetaData->q_direction[1].cfg.nbands; i++ ) @@ -623,6 +807,25 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( nblocks = q_direction->cfg.nblocks; start_band = q_direction->cfg.start_band; +#ifdef DEBUG_MODE_QMETADATA + { + int16_t k; + k = 0; + fprintf( pF_spcoh_orig, "%d %d ", frame, k ); + + for ( i = start_band; i < nbands; i++ ) + { + for ( j = 0; j < nblocks; j++ ) + { + if ( q_direction->coherence_band_data != NULL ) + { + fprintf( pF_spcoh_orig, " %d ", q_direction->coherence_band_data[i].spread_coherence[j] ); + } + } + } + fprintf( pF_spcoh_orig, "\n" ); + } +#endif q_direction->not_in_2D = 0; @@ -649,6 +852,65 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( } bits_ec = hMetaData->nb_bits_tot - bits_ec; +#ifdef DEBUG_MODE_QMETADATA + { + float tmp_f; + fprintf( pF, "frame %d: diff %d ", frame, bits_diff[d] ); + fprintf( pF_azi, "frame %d/dir/ec %d: ", frame, d ); + fprintf( pF_ele, "frame %d/dir/ec %d: ", frame, d ); + fprintf( pF_ratio, "frame %d/dir %d: ", frame, d ); + /*fprintf( pF_spcoh, "frame %d/dir %d: ", frame, d ); */ + fprintf( pF_spcoh, " %d %d ", frame, d ); + + if ( d == 0 ) + { + fprintf( pF_surcoh, "frame %d/dir %d: ", frame, d ); + } + + /* direction_distance( elevation_orig, azimuth_orig, q_direction, nbands, nblocks, mat_dist );*/ + for ( i = start_band; i < nbands; i++ ) + { + for ( j = 0; j < nblocks; j++ ) + { + fprintf( pF_azi, " %+5.2f ", (int16_t) ( 100.f * q_direction->band_data[i].azimuth[j] ) / 100.f ); + fprintf( pF_ele, " %+5.2f ", (int16_t) ( 100.f * q_direction->band_data[i].elevation[j] ) / 100.f ); + fprintf( pF_ratio, " %1.3f ", q_direction->band_data[i].energy_ratio[j] ); + if ( q_direction->coherence_band_data != NULL ) + { + fprintf( pF_spcoh, " %d ", q_direction->coherence_band_data[i].spread_coherence[j] ); + } + if ( d == 0 && hQMetaData->surcoh_band_data != NULL ) + { + fprintf( pF_surcoh, " %d ", hQMetaData->surcoh_band_data[i].surround_coherence[j] ); + } + } + } + fprintf( pF, "\n" ); + fprintf( pF_azi, "\n" ); + fprintf( pF_ele, "\n" ); + fprintf( pF_ratio, "\n" ); + fprintf( pF_spcoh, "\n" ); + if ( d == 0 ) + { + fprintf( pF_surcoh, "\n" ); + } + + for ( i = 0; i < nblocks; i++ ) + { + for ( j = 0; j < nbands; j++ ) + { + dbgwrite( &( q_direction->band_data[j].azimuth[i] ), sizeof( float ), 1, 1, "./res/IVAS_QMETADATA_azi.bin" ); + dbgwrite( &( q_direction->band_data[j].elevation[i] ), sizeof( float ), 1, 1, "./res/IVAS_QMETADATA_ele.bin" ); + dbgwrite( &( q_direction->band_data[j].energy_ratio_index[i] ), sizeof( uint16_t ), 1, 1, "./res/IVAS_QMETADATA_diffuseness_index.bin" ); + tmp_f = 1.f - q_direction->band_data[j].energy_ratio[i]; + dbgwrite( &tmp_f, sizeof( float ), 1, 1, "./res/IVAS_QMETADATA_diffuseness.bin" ); + } + } + + j = (int16_t) ( hMetaData->nb_bits_tot ); + dbgwrite( &j, sizeof( int16_t ), 1, 1, "./res/IVAS_QMETADATA_bits.bin" ); + } +#endif /* Save quantized DOAs */ if ( bits_sph_idx == 11 ) @@ -716,6 +978,19 @@ void ivas_qmetadata_enc_sid_encode( metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; } +#ifdef DEBUG_MODE_QMETADATA + static FILE *pF_azi = NULL; + static FILE *pF_ele = NULL; + static FILE *pF_ratio = NULL; + + if ( pF_azi == NULL ) + pF_azi = fopen( "./res/qmetadata_sid_azi_enc.txt", "w" ); + if ( pF_ele == NULL ) + pF_ele = fopen( "./res/qmetadata_sid_ele_enc.txt", "w" ); + if ( pF_ratio == NULL ) + pF_ratio = fopen( "./res/qmetadata_sid_ratio_enc.txt", "w" ); + +#endif /* Save initial position in bitstream */ bit_pos_start = hMetaData->nb_bits_tot; @@ -914,6 +1189,26 @@ void ivas_qmetadata_enc_sid_encode( } } +#ifdef DEBUG_MODE_QMETADATA + { + fprintf( pF_azi, "frame %d: ", frame ); + fprintf( pF_ele, "frame %d: ", frame ); + fprintf( pF_ratio, "frame %d: ", frame ); + + + /* Data is not used currently. Fix function when needed. */ + /*direction_distance( elevation_orig, azimuth_orig, q_direction->elevation, q_direction->azimuth, nbands, nblocks, mat_dist );*/ + for ( b = start_band; b < nbands; b++ ) + { + fprintf( pF_azi, " %+5.2f ", (int16_t) ( 100.f * avg_azimuth[b] ) / 100.f ); + fprintf( pF_ele, " %+5.2f ", (int16_t) ( 100.f * avg_elevation[b] ) / 100.f ); + fprintf( pF_ratio, " %1.3f ", q_direction->band_data[b].energy_ratio[0] ); + } + fprintf( pF_azi, "\n" ); + fprintf( pF_ele, "\n" ); + fprintf( pF_ratio, "\n" ); + } +#endif /* fill bits*/ assert( ( hMetaData->nb_bits_tot - bit_pos_start ) <= metadata_sid_bits && "Too many written bits!" ); @@ -951,6 +1246,9 @@ void reset_metadata_spatial( { if ( ivas_format == SBA_FORMAT ) { +#ifdef DEBUGGING + assert( hMetaData->ind_list[0].nb_bits == 1 ); +#endif hMetaData->ind_list[0].value = 1; metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; @@ -986,6 +1284,9 @@ void reset_metadata_spatial( } hMetaData->nb_ind_tot = j; +#ifdef DEBUGGING + assert( ( hMetaData->nb_bits_tot == ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS ) && "Problem of SID metadata in SCE" ); +#endif } } else @@ -1005,6 +1306,9 @@ void reset_metadata_spatial( hMetaData->nb_bits_tot -= hMetaData->ind_list[hMetaData->nb_ind_tot].nb_bits; hMetaData->ind_list[hMetaData->nb_ind_tot].nb_bits = -1; } +#ifdef DEBUGGING + assert( hMetaData->nb_bits_tot == nb_bits_metadata && "Problem in metadata for SCE" ); +#endif } return; @@ -1499,6 +1803,9 @@ static int16_t ivas_qmetadata_entropy_encode_diffuseness( { ivas_diffuseness_huff_ec_encode( hMetaData, avr_idx[b] ); } +#ifdef DEBUGGING + assert( ( hMetaData->nb_bits_tot - start_bit_pos ) == diffuseness_bits_huff + 1 ); +#endif } else { @@ -1518,6 +1825,9 @@ static int16_t ivas_qmetadata_entropy_encode_diffuseness( *diffuseness_index_max_ec_frame = DIRAC_DIFFUSE_LEVELS - 1; } +#ifdef DEBUGGING + assert( ( hMetaData->nb_bits_tot - start_bit_pos ) <= 1 + diffuseness_bits_raw ); +#endif return ( hMetaData->nb_bits_tot - start_bit_pos ); } @@ -1671,6 +1981,10 @@ static void ivas_qmetadata_encode_quasi_uniform( { int16_t bits; uint16_t tresh; +#ifdef DEBUGGING + assert( ( alphabet_size >= 1 ) ); + assert( value < alphabet_size ); +#endif bits = 30 - norm_l( alphabet_size ); /* bits = floor(log2(alphabet_size)) */ tresh = ( 1U << ( bits + 1 ) ) - alphabet_size; @@ -1906,6 +2220,10 @@ static int16_t ivas_qmetadata_encode_quasi_uniform_length( { int16_t bits; uint16_t tresh; +#ifdef DEBUGGING + assert( ( alphabet_size >= 1 ) ); + assert( value < alphabet_size ); +#endif bits = 30 - norm_l( alphabet_size ); /* bits = floor(log2(alphabet_size)) */ tresh = ( 1U << ( bits + 1 ) ) - alphabet_size; @@ -2124,6 +2442,9 @@ static int16_t ivas_qmetadata_entropy_encode_dir( { avg_elevation_index_projected = ivas_dirac_project_elevation_index( avg_elevation_index, avg_elevation_alphabet, q_direction->band_data[i].elevation_m_alphabet[j] ); } +#ifdef DEBUGGING + assert( ( 0 <= avg_elevation_index_projected ) && ( avg_elevation_index_projected < q_direction->band_data[i].elevation_m_alphabet[j] ) ); +#endif if ( q_direction->cfg.mc_ls_setup != MC_LS_SETUP_INVALID ) { @@ -2171,6 +2492,9 @@ static int16_t ivas_qmetadata_entropy_encode_dir( { egr_size_elevation += ivas_qmetadata_encode_extended_gr_length( dist_elevation_indexes[i], dist_elevation_alphabets[i], gr_param_elevation ); } +#ifdef DEBUGGING + assert( egr_size_elevation <= gr_size_elevation ); +#endif } elevation_bits_ec += ivas_qmetadata_encode_quasi_uniform_length( gr_param_elevation, 4 + 1 ) + egr_size_elevation; @@ -2234,6 +2558,9 @@ static int16_t ivas_qmetadata_entropy_encode_dir( /* project the quantized average azimuth angle to the same grid as the current sample */ avg_azimuth_index_projected = ivas_dirac_project_azimuth_index( avg_azimuth_index, avg_azimuth_alphabet, q_direction->band_data[i].azimuth_m_alphabet[j] ); } +#ifdef DEBUGGING + assert( ( 0 <= avg_azimuth_index_projected ) && ( avg_azimuth_index_projected < q_direction->band_data[i].azimuth_m_alphabet[j] ) ); +#endif dist_azimuth_indexes[idx] = ivas_qmetadata_reorder_azimuth_index( ivas_qmetadata_dereorder_generic( q_direction->band_data[i].azimuth_index[j] ) + ( q_direction->band_data[i].azimuth_m_alphabet[j] >> 1 ), avg_azimuth_index_projected, q_direction->band_data[i].azimuth_m_alphabet[j] ); dist_azimuth_alphabets[idx] = q_direction->band_data[i].azimuth_m_alphabet[j]; @@ -2274,6 +2601,9 @@ static int16_t ivas_qmetadata_entropy_encode_dir( { egr_size_azimuth += ivas_qmetadata_encode_extended_gr_length( dist_azimuth_indexes[i], dist_azimuth_alphabets[i], gr_param_azimuth ); } +#ifdef DEBUGGING + assert( egr_size_azimuth <= gr_size_azimuth ); +#endif } azimuth_bits_ec += ivas_qmetadata_encode_quasi_uniform_length( gr_param_azimuth, 5 + 1 ) + egr_size_azimuth; @@ -2556,6 +2886,11 @@ ivas_qmetadata_encode_extended_gr_length( int16_t bits; uint16_t msb, lsb; +#ifdef DEBUGGING + assert( alphabet_size >= 1 ); + assert( value < alphabet_size ); + assert( ( gr_param >= 0 ) && ( gr_param <= 15 ) ); +#endif msb_alphabet_size = ( alphabet_size + ( 1U << gr_param ) - 1 ) >> gr_param; @@ -2597,6 +2932,9 @@ static int16_t ivas_qmetadata_reorder_elevation_index( { int16_t elevation_alphabet_half; int16_t elevation_index_reordered; +#ifdef DEBUGGING + assert( ( elevation_alphabet & 0x01 ) == 1 ); /* elevation_alphabet has the form 2 * n_points + 1 */ +#endif elevation_alphabet_half = elevation_alphabet >> 1; elevation_index_reordered = elevation_index - avg_elevation_index; @@ -2613,6 +2951,9 @@ static int16_t ivas_qmetadata_reorder_elevation_index( /* fold reduced signed distance value for converting to unsigned */ elevation_index_reordered = ivas_qmetadata_reorder_generic( elevation_index_reordered ); +#ifdef DEBUGGING + assert( ( 0 <= elevation_index_reordered ) && ( elevation_index_reordered < elevation_alphabet ) ); +#endif return elevation_index_reordered; } @@ -2652,12 +2993,21 @@ static int16_t ivas_qmetadata_reorder_azimuth_index( } /* fold reduced signed distance value for converting to unsigned */ azimuth_index_reordered = ivas_qmetadata_reorder_generic( azimuth_index_reordered ); +#ifdef DEBUGGING + assert( ( 0 <= azimuth_index_reordered ) && ( azimuth_index_reordered < azimuth_alphabet ) ); +#endif } else { /* for North and South poles, a single azimuth direction exists */ +#ifdef DEBUGGING + assert( ( azimuth_index == 0 ) || ( azimuth_index == MASA_NO_INDEX ) ); +#endif azimuth_index_reordered = 0; +#ifdef DEBUGGING + assert( avg_azimuth_index == 0 ); +#endif } return azimuth_index_reordered; @@ -2679,6 +3029,11 @@ void ivas_qmetadata_encode_extended_gr( uint16_t msb_alphabet_size; uint16_t msb, lsb, cnt; +#ifdef DEBUGGING + assert( alphabet_size >= 1 ); + assert( value < alphabet_size ); + assert( ( gr_param >= 0 ) && ( gr_param <= 31 ) ); +#endif msb_alphabet_size = ( alphabet_size + ( 1U << gr_param ) - 1 ) >> gr_param; @@ -2764,6 +3119,9 @@ static int16_t truncGR0( for ( i = 0; i < len; i++ ) { +#ifdef DEBUGGING + assert( data_idx[i] < MASA_NO_INDEX ); +#endif data_idx[i] = quantize_phi( data[i] + 180, 0, &data_hat[i], 8 ); data_hat[i] -= 180; data_idx[i] = remap3b[data_idx[i]]; @@ -2827,6 +3185,13 @@ static int16_t truncGR0( if ( bits > bits_allowed ) { +#ifdef DEBUGGING + assert( bits_allowed > len ); + for ( i = 0; i < len; i++ ) + { + assert( data_idx[i] <= 1 ); + } +#endif sort_desc_ind( diff, len, indx ); for ( i = len - 1; i >= 0; i-- ) @@ -2896,6 +3261,9 @@ static int16_t truncGR0_chan( for ( i = 0; i < len; i++ ) { +#ifdef DEBUGGING + assert( data_idx[i] < MASA_NO_INDEX ); +#endif data_idx[i] = quantize_phi_chan_lbr( data[i], &data_hat[i], 9 ); bits += ivas_qmetadata_encode_extended_gr_length( data_idx[i], 9, 0 ); @@ -3200,6 +3568,9 @@ static int16_t encode_directions_subband( bits_dir0[max_nb_idx] -= 1; allowed_bits -= 1; } +#ifdef DEBUGGING + assert( bits_dir0[max_nb_idx] > 0 ); +#endif } if ( no_subframes > 1 ) { @@ -3498,6 +3869,12 @@ static ivas_error requantize_direction_EC_3( } } } +#ifdef DEBUGGING + if ( diff > 0 ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Not enough bits in requantize_direction_EC_3(); %d bits written \n", nbits ); + } +#endif *extra_bits = -diff; @@ -3871,6 +4248,12 @@ static ivas_error write_ec_direction( } } +#ifdef DEBUGGING + if ( min_val == MASA_NO_INDEX ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "No azimuth data to be coded in write_ec_direction()" ); + } +#endif /* write min*/ bits_crt = hMetaData->nb_bits_tot; @@ -3889,6 +4272,15 @@ static ivas_error write_ec_direction( } } } +#ifdef DEBUGGING + else + { + if ( use_context != -3 ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong use_context value in write_ec_direction()" ); + } + } +#endif } else { @@ -4481,6 +4873,15 @@ static int16_t encode_surround_coherence( } } } +#ifdef DEBUGGING + for ( i = 0; i < coding_subbands; i++ ) + { + for ( j = 1; j < q_direction->cfg.nblocks; j++ ) + { + hQMetaData->surcoh_band_data[i].surround_coherence[j] = hQMetaData->surcoh_band_data[i].surround_coherence[0]; + } + } +#endif return nbits; } @@ -5048,6 +5449,9 @@ static int16_t ivas_qmetadata_quantize_coherence( { /* make two indxes */ no_cb = 1; +#ifdef DEBUGGING + assert( coding_subbands % 2 == 0 ); +#endif for ( j = 0; j < coding_subbands / 2; j++ ) { @@ -5217,6 +5621,9 @@ static int16_t write_2dir_info( dif_p[i] = p[i] - p[i - 1] - 1; } +#ifdef DEBUGGING + assert( k == j ); +#endif j = hMetaData->nb_bits_tot; for ( i = 0; i < k; i++ ) { @@ -5264,6 +5671,9 @@ static void transform_azimuth_dir2( { hQMetaData->q_direction[1].band_data[i].azimuth[b] += 360; } +#ifdef DEBUGGING + assert( hQMetaData->q_direction[1].band_data[i].azimuth[b] < 180 && hQMetaData->q_direction[1].band_data[i].azimuth[b] >= -180 ); +#endif } } } @@ -5271,6 +5681,38 @@ static void transform_azimuth_dir2( return; } +#ifdef DEBUG_MODE_QMETADATA +/*------------------------------------------------------------------------- + * DEBUG function direction_distance() + * + *------------------------------------------------------------------------*/ + +static float direction_distance( + float elevation[DIRAC_MAX_NBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], + float azimuth[DIRAC_MAX_NBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], + IVAS_QDIRECTION *q_direction, + const int16_t dim1, + const int16_t dim2, + float mat_dist[DIRAC_MAX_NBANDS][MAX_PARAM_SPATIAL_SUBFRAMES] ) +{ + float d; + int16_t i, j; + + d = 0; + for ( i = 0; i < dim1; i++ ) + { + for ( j = 0; j < dim2; j++ ) + { + mat_dist[i][j] = sinf( elevation[i][j] * PI_OVER_180 ) * sinf( q_direction->band_data[i].elevation[j] * PI_OVER_180 ) + + cosf( elevation[i][j] * PI_OVER_180 ) * cosf( q_direction->band_data[i].elevation[j] * PI_OVER_180 ) * cosf( ( azimuth[i][j] - q_direction->band_data[i].azimuth[j] ) * PI_OVER_180 ); + + d += fabsf( mat_dist[i][j] ); + } + } + + return d / (float) ( dim1 * dim2 ); +} +#endif static int16_t divide_GR_orders( @@ -5571,6 +6013,16 @@ void ivas_omasa_encode_masa_to_total( int16_t bits_pos, nb_bits; int16_t n_streams, len_stream; +#ifdef DEBUG_MODE_QMETADATA + static FILE *pF = NULL; + static FILE *pF_ratio = NULL; + + if ( pF == NULL ) + pF = fopen( "./res/qmetadata_ism_qidx__enc.txt", "w" ); + if ( pF_ratio == NULL ) + pF_ratio = fopen( "./res/qmetadata_masa2tot_enc.txt", "w" ); + +#endif bits_pos = hMetaData->nb_bits_tot; k = 0; @@ -5726,6 +6178,29 @@ void ivas_omasa_encode_masa_to_total( } assert( nb_bits == ( hMetaData->nb_bits_tot - bits_pos ) ); +#ifdef DEBUG_MODE_QMETADATA + { + + fprintf( pF, "frame %d: ", frame ); + fprintf( pF_ratio, "frame %d: ", frame ); + + + /* direction_distance( elevation_orig, azimuth_orig, q_direction, nbands, nblocks, mat_dist );*/ + for ( i = 0; i < nbands; i++ ) + { + for ( j = 0; j < 4; j++ ) + { + fprintf( pF_ratio, " %5.2f ", hQMetaData->masa_to_total_energy_ratio[j][i] ); + } + } + for ( i = 0; i < 20; i++ ) + { + fprintf( pF, " %4d ", q_idx[i] ); + } + fprintf( pF, "\n" ); + fprintf( pF_ratio, "\n" ); + } +#endif return; } diff --git a/lib_enc/ivas_range_uni_enc.c b/lib_enc/ivas_range_uni_enc.c index 6781c750a..82f6813c2 100644 --- a/lib_enc/ivas_range_uni_enc.c +++ b/lib_enc/ivas_range_uni_enc.c @@ -40,6 +40,9 @@ #include "options.h" #include "prot.h" #include "wmc_auto.h" +#ifdef DEBUGGING +#include "debug.h" +#endif /* @@ -94,6 +97,9 @@ void rc_uni_enc_encode_fast( ) { uint32_t r, tmp; +#ifdef DEBUGGING + assert( tot_shift <= 16 ); +#endif r = rc_st_enc->rc_range >> tot_shift; tmp = r * cum_freq; @@ -156,6 +162,10 @@ int16_t rc_uni_enc_finish( int16_t total_bit_count; uint32_t val, mask; int16_t bits; +#ifdef DEBUGGING + assert( rc_st_enc->rc_range >= 0x01000000 ); /* rc_range is normalized */ + assert( rc_st_enc->last_byte_bit_count == -1 ); /* make sure finalization was not done already */ +#endif /* floor(log2(x)) = floor(log2(x >> 24)) + 24, for any x >= 2 ^ 24 */ /* 32 - floor(log2(y)) = norm_ul(y) + 1 = norm_l(y >> 24) - 22 */ @@ -164,6 +174,9 @@ int16_t rc_uni_enc_finish( bits++; /* conservative number of bits, because the decoder only has rc_range available */ +#ifdef DEBUGGING + assert( ( bits >= 2 ) && ( bits <= 9 ) ); /* depends on rc_range, which is normalized */ +#endif mask = 0xFFFFFFFFu >> bits; val = ( rc_st_enc->rc_low + mask ) & ~mask; @@ -188,29 +201,51 @@ int16_t rc_uni_enc_finish( /* rc_carry_count > 0, therefore the last call to rc_uni_enc_shift incremented rc_carry_count */ if ( rc_st_enc->rc_cache >= 0 ) /* may actually be always true, but it is difficult to prove formally */ { +#ifdef DEBUGGING + assert( rc_st_enc->byte_count < RANGE_UNI_BUFFER_BYTES_MAX ); +#endif rc_st_enc->byte_buffer[rc_st_enc->byte_count++] = (uint8_t) ( rc_st_enc->rc_cache + rc_st_enc->rc_carry ); } while ( rc_st_enc->rc_carry_count > 1 ) { +#ifdef DEBUGGING + assert( rc_st_enc->byte_count < RANGE_UNI_BUFFER_BYTES_MAX ); +#endif rc_st_enc->byte_buffer[rc_st_enc->byte_count++] = (uint8_t) ( rc_st_enc->rc_carry + 0xFF ); rc_st_enc->rc_carry_count--; } /* pack the last 1 to 8 bits into the MSB of the last byte, with zero padding into the LSB */ +#ifdef DEBUGGING + assert( rc_st_enc->byte_count < RANGE_UNI_BUFFER_BYTES_MAX ); +#endif rc_st_enc->byte_buffer[rc_st_enc->byte_count++] = (uint8_t) ( ( rc_st_enc->rc_carry + 0xFF ) & ( 0xFFu << ( 8 - bits ) ) ); rc_st_enc->last_byte_bit_count = bits; } else { /* rc_carry_count == 0, therefore the last call to rc_uni_enc_shift wrote into rc_cache */ +#ifdef DEBUGGING + assert( rc_st_enc->rc_cache >= 0 ); +#endif /* pack the last 1 to 8 bits into the MSB of the last byte, with zero padding into the LSB */ +#ifdef DEBUGGING + assert( rc_st_enc->byte_count < RANGE_UNI_BUFFER_BYTES_MAX ); +#endif rc_st_enc->byte_buffer[rc_st_enc->byte_count++] = (uint8_t) ( ( rc_st_enc->rc_cache + rc_st_enc->rc_carry ) & ( 0xFFu << ( 8 - bits ) ) ); rc_st_enc->last_byte_bit_count = bits; } +#ifdef DEBUGGING + assert( ( rc_st_enc->last_byte_bit_count >= 1 ) && ( rc_st_enc->last_byte_bit_count <= 8 ) ); + assert( rc_st_enc->byte_count >= 1 ); +#endif total_bit_count = ( ( rc_st_enc->byte_count - 1 ) << 3 ) + rc_st_enc->last_byte_bit_count; +#ifdef DEBUGGING + assert( total_bit_count >= 2 ); +#endif return total_bit_count; } @@ -226,6 +261,11 @@ int16_t rc_uni_enc_virtual_finish( RangeUniEncState *rc_st_enc /* i : RC state handle */ ) { +#ifdef DEBUGGING + assert( rc_st_enc->rc_range >= 0x01000000 ); /* rc_range is normalized */ + assert( rc_st_enc->last_byte_bit_count == -1 ); /* make sure finalization was not done already */ + assert( sizeof( rc_st_enc->rc_cache ) == 2 ); /* ensure the sign bit computation is correct */ +#endif /* byte_count bytes have already been written to the byte_buffer array @@ -254,11 +294,17 @@ static void rc_uni_enc_shift( { if ( rc_st_enc->rc_cache >= 0 ) { +#ifdef DEBUGGING + assert( rc_st_enc->byte_count < RANGE_UNI_BUFFER_BYTES_MAX ); +#endif rc_st_enc->byte_buffer[rc_st_enc->byte_count++] = (uint8_t) ( rc_st_enc->rc_cache + rc_st_enc->rc_carry ); } while ( rc_st_enc->rc_carry_count > 0 ) { +#ifdef DEBUGGING + assert( rc_st_enc->byte_count < RANGE_UNI_BUFFER_BYTES_MAX ); +#endif rc_st_enc->byte_buffer[rc_st_enc->byte_count++] = (uint8_t) ( rc_st_enc->rc_carry + 0xFF ); rc_st_enc->rc_carry_count--; } @@ -290,6 +336,9 @@ void rc_uni_enc_encode_bits( ) { uint32_t tmp; +#ifdef DEBUGGING + assert( bits <= 16 ); +#endif rc_st_enc->rc_range >>= bits; tmp = rc_st_enc->rc_range * value; diff --git a/lib_enc/ivas_rom_enc.c b/lib_enc/ivas_rom_enc.c index ebbffc089..9d04a2068 100644 --- a/lib_enc/ivas_rom_enc.c +++ b/lib_enc/ivas_rom_enc.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "ivas_cnst.h" #include diff --git a/lib_enc/ivas_rom_enc.h b/lib_enc/ivas_rom_enc.h index c15d1a27b..60d4ddcf7 100644 --- a/lib_enc/ivas_rom_enc.h +++ b/lib_enc/ivas_rom_enc.h @@ -35,6 +35,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "ivas_cnst.h" diff --git a/lib_enc/ivas_sba_enc.c b/lib_enc/ivas_sba_enc.c index d81b73c6f..1b62335b9 100644 --- a/lib_enc/ivas_sba_enc.c +++ b/lib_enc/ivas_sba_enc.c @@ -40,6 +40,9 @@ #include "prot.h" #include "ivas_prot.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -75,6 +78,20 @@ void ivas_sba_getTCs( } } +#ifdef DEBUG_MODE_DIRAC + for ( int16_t n = 0; n < st_ivas->nchan_transport; n++ ) + { + int16_t tmp[L_FRAME48k]; + char file_name[50] = { 0 }; + + sprintf( file_name, "./res/ivas_dirac_enc_%d.%d.pcm", n, (int16_t) ( input_frame * 0.05 ) ); + for ( int16_t i = 0; i < input_frame; i++ ) + { + tmp[i] = (int16_t) ( sba_data[n][i] + 0.5f ); + } + dbgwrite( tmp, sizeof( int16_t ), input_frame, 1, file_name ); + } +#endif return; } diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index c72feda1d..ae6496657 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -38,6 +38,9 @@ #include "prot.h" #include "ivas_prot.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -114,6 +117,10 @@ ivas_error ivas_sce_enc( st->input_bwidth = st->last_input_bwidth; /* updated in BWD */ st->bwidth = st->last_bwidth; /* updated in BWD */ st->rate_switching_reset = 0; +#ifdef DEBUGGING + st->force = st_ivas->hEncoderConfig->force; + st->id_element = sce_id; +#endif /*---------------------------------------------------------------* * Time Domain Transient Detector @@ -164,6 +171,10 @@ ivas_error ivas_sce_enc( flag_16k_smc = 1; } +#ifdef DEBUG_MODE_INFO + dbgwrite( st->input - NS2SA( st->input_Fs, ACELP_LOOK_NS ), sizeof( float ), input_frame, 1, "res/input_DMX" ); + dbgwrite( &st->element_mode, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "element_mode", 0, st->id_element, ENC ) ); +#endif /*----------------------------------------------------------------* * Front Pre-processing @@ -268,6 +279,12 @@ ivas_error ivas_sce_enc( /* Store previous attack detection flag */ st->hTranDet->transientDetector.prev_bIsAttackPresent = st->hTranDet->transientDetector.bIsAttackPresent; +#ifdef DEBUG_MODE_INFO + { + float tmpF = hSCE->element_brate / 1000.0f; + dbgwrite( &tmpF, sizeof( float ), 1, input_frame, fname( debug_dir, "element_brate", 0, sce_id, ENC ) ); + } +#endif pop_wmops(); diff --git a/lib_enc/ivas_sns_enc.c b/lib_enc/ivas_sns_enc.c index 5b455060a..5648aa794 100644 --- a/lib_enc/ivas_sns_enc.c +++ b/lib_enc/ivas_sns_enc.c @@ -40,6 +40,9 @@ #include "rom_com.h" #include "ivas_rom_com.h" #include "ivas_cnst.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -312,6 +315,19 @@ void sns_avq_cod_stereo( side[i] = snsl[i] - snsr[i]; ener_side += side[i] * side[i]; } +#ifdef DEBUG_MODE_MDCT + { + float ener_mid = 0; + /* Compute mid */ + for ( i = 0; i < M; i++ ) + { + mid[i] = ( snsl[i] + snsr[i] ) * 0.5f; + ener_mid += mid[i] * mid[i]; + } + dbgwrite( &ener_side, sizeof( float ), 1, 1, "./res/ener_side" ); + dbgwrite( &ener_mid, sizeof( float ), 1, 1, "./res/ener_mid" ); + } +#endif if ( ener_side < 12.f ) { diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 3e4dce43c..ec31fe9c6 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "ivas_prot.h" #include "ivas_rom_com.h" #include "ivas_stat_com.h" @@ -149,7 +152,11 @@ ivas_error ivas_spar_enc_open( hSpar->hMdEnc->table_idx = -1; /* AGC handle */ +#ifdef DEBUG_AGC_ENCODER_CMD_OPTION + hSpar->AGC_Enable = ivas_agc_enc_get_flag( hEncoderConfig->Opt_AGC_ON, nchan_transport ); +#else hSpar->AGC_Enable = ivas_agc_enc_get_flag( nchan_transport ); +#endif hSpar->hAgcEnc = NULL; if ( hSpar->AGC_Enable ) @@ -708,12 +715,102 @@ static ivas_error ivas_spar_enc_process( return error; } +#ifdef DEBUG_LBR_SBA + /* Dumping SPAR Coefficients */ + char f_name[100]; + int16_t nbands = 6; + int16_t num_subframes = 1; + int16_t num_elements = 6; + int16_t num_block_group = 1; + int16_t byte_size = sizeof( float ); + + sprintf( f_name, "SBA_MD_values.bin" ); + ( frame == 0 ) ? dbgwrite( &nbands, sizeof( nbands ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_block_group, sizeof( num_block_group ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + + for ( b = 0; b < nbands; b++ ) + { + for ( int16_t sf = 0; sf < num_subframes; sf++ ) + { + for ( int16_t bl = 0; bl < num_block_group; bl++ ) + { + dbgwrite( &hSpar->hMdEnc->spar_md.band_coeffs[b].pred_re[0], byte_size, 1, 1, f_name ); + dbgwrite( &hSpar->hMdEnc->spar_md.band_coeffs[b].pred_re[1], byte_size, 1, 1, f_name ); + dbgwrite( &hSpar->hMdEnc->spar_md.band_coeffs[b].pred_re[2], byte_size, 1, 1, f_name ); + dbgwrite( &hSpar->hMdEnc->spar_md.band_coeffs[b].P_re[0], byte_size, 1, 1, f_name ); + dbgwrite( &hSpar->hMdEnc->spar_md.band_coeffs[b].P_re[1], byte_size, 1, 1, f_name ); + dbgwrite( &hSpar->hMdEnc->spar_md.band_coeffs[b].P_re[2], byte_size, 1, 1, f_name ); + // fprintf(stdout, "%f\t%f\t%f\t%d\t%d\n", dirac_md_kbps, spar_md_kbps, sba_md_kbps, qsi, code_strat ); + } + } + } +#endif +#ifdef DEBUG_LBR_SBA + /* Dumping SPAR Coefficients */ + nbands = 6; + num_subframes = 1; + num_elements = 6; + num_block_group = 1; + byte_size = sizeof( float ); + + sprintf( f_name, "SBA_MD_values_quant.bin" ); + ( frame == 0 ) ? dbgwrite( &nbands, sizeof( nbands ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_block_group, sizeof( num_block_group ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + + for ( b = 0; b < nbands; b++ ) + { + for ( int16_t sf = 0; sf < num_subframes; sf++ ) + { + for ( int16_t bl = 0; bl < num_block_group; bl++ ) + { + dbgwrite( &hSpar->hMdEnc->spar_md.band_coeffs[b].pred_quant_re[0], byte_size, 1, 1, f_name ); + dbgwrite( &hSpar->hMdEnc->spar_md.band_coeffs[b].pred_quant_re[1], byte_size, 1, 1, f_name ); + dbgwrite( &hSpar->hMdEnc->spar_md.band_coeffs[b].pred_quant_re[2], byte_size, 1, 1, f_name ); + dbgwrite( &hSpar->hMdEnc->spar_md.band_coeffs[b].P_quant_re[0], byte_size, 1, 1, f_name ); + dbgwrite( &hSpar->hMdEnc->spar_md.band_coeffs[b].P_quant_re[1], byte_size, 1, 1, f_name ); + dbgwrite( &hSpar->hMdEnc->spar_md.band_coeffs[b].P_quant_re[2], byte_size, 1, 1, f_name ); + // fprintf(stdout, "%f\t%f\t%f\t%d\t%d\n", dirac_md_kbps, spar_md_kbps, sba_md_kbps, qsi, code_strat ); + } + } + } +#endif /*-----------------------------------------------------------------------------------------* * FB mixer *-----------------------------------------------------------------------------------------*/ ivas_fb_mixer_get_in_out_mapping( hSpar->hFbMixer->fb_cfg, in_out_mixer_map ); +#ifdef DEBUG_SBA_MD_DUMP + { + int16_t k; + static FILE *f_mat = 0; + + if ( f_mat == 0 ) + f_mat = fopen( "mixer_mat_enc", "w" ); + + for ( i = 0; i < hSpar->hFbMixer->fb_cfg->num_out_chans; i++ ) + { + for ( j = 0; j < hSpar->hFbMixer->fb_cfg->num_in_chans; j++ ) + { + for ( k = 0; k < hSpar->hFbMixer->pFb->filterbank_num_bands; k++ ) + { + fprintf( f_mat, "%f\n", hSpar->hMdEnc->mixer_mat[i][j][k] ); + + if ( ( in_out_mixer_map[i][j] == 0 ) && ( fabs( hSpar->hMdEnc->mixer_mat[i][j][k] ) > 1e-20 ) ) + { + assert( 0 && "Non zero value in unexpected mixer map!!!" ); + } + } + } + } + } +#endif #ifdef DEBUG_SPAR_DIRAC_WRITE_OUT_PRED_PARS { static FILE *fid = 0; @@ -728,6 +825,9 @@ static ivas_error ivas_spar_enc_process( ivas_fb_mixer_process( hSpar->hFbMixer, hSpar->hMdEnc->mixer_mat, p_pcm_tmp, input_frame, in_out_mixer_map ); +#ifdef DEBUG_SBA_AUDIO_DUMP + ivas_spar_dump_signal_wav( input_frame, p_pcm_tmp, NULL, nchan_transport, spar_foa_enc_wav[1], "ivas_fb_mixer_process()" ); +#endif if ( hSpar->hFbMixer->fb_cfg->active_w_mixing == 0 ) { @@ -794,6 +894,19 @@ static ivas_error ivas_spar_enc_process( } } +#ifdef DEBUG_LBR_SBA + for ( int16_t t = 0; t < 960; t++ ) + { + for ( int16_t c = 0; c < hSpar->hFbMixer->fb_cfg->num_out_chans; c++ ) + { + float val = p_pcm_tmp[c][t]; // / MAX16B_FLT; + dbgwrite( &val, sizeof( float ), 1, 1, "int_enc_dmx.raw" ); + } + } +#endif +#ifdef DEBUG_SBA_AUDIO_DUMP + ivas_spar_dump_signal_wav( input_frame, p_pcm_tmp, NULL, nchan_transport, spar_foa_enc_wav[0], "ivas_pca_enc()" ); +#endif /*-----------------------------------------------------------------------------------------* * AGC @@ -806,7 +919,46 @@ static ivas_error ivas_spar_enc_process( ivas_agc_enc_process( hSpar->hAgcEnc, hMetaData, p_pcm_tmp, p_pcm_tmp, hSpar->hFbMixer->fb_cfg->num_out_chans, hEncoderConfig ); } } +#ifdef DEBUG_SBA_AUDIO_DUMP + /* Dump audio signal after ivas_agc_enc_process */ + ivas_spar_dump_signal_wav( input_frame, p_pcm_tmp, NULL, nchan_transport, spar_foa_enc_wav[2], "ivas_agc_enc_process()" ); +#endif +#ifdef DEBUG_SPAR_BYPASS_EVS_CODEC + { + static FILE *fid_enc = 0; + static float delay_buf[576 * 4] = { 0 }; + int16_t smp, ch, buf_idx, framelen = input_frame, delay = 576; + if ( !fid_enc ) + { + fid_enc = fopen( "evs_input_float.raw", "wb" ); + } + + /* write out buffer */ + for ( smp = 0; smp < delay * nchan_transport; smp++ ) + { + fwrite( &delay_buf[smp], sizeof( float ), 1, fid_enc ); + } + + for ( smp = 0; smp < framelen - delay; smp++ ) + { + for ( ch = 0; ch < nchan_transport; ch++ ) + { + fwrite( &p_pcm_tmp[ch][smp], sizeof( float ), 1, fid_enc ); + } + } + + /* update delay buffer*/ + buf_idx = 0; + for ( ; smp < framelen; smp++ ) + { + for ( ch = 0; ch < nchan_transport; ch++ ) + { + delay_buf[buf_idx++] = p_pcm_tmp[ch][smp]; + } + } + } +#endif /*-----------------------------------------------------------------------------------------* * Re-order the dmx back to ACN/SN3D format diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index 422cc4b05..5a6ef2289 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -34,6 +34,9 @@ #include "options.h" #include "prot.h" #include "ivas_prot.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "math.h" #include "ivas_rom_com.h" #include @@ -251,8 +254,13 @@ ivas_error ivas_spar_md_enc_init( hMdEnc->spar_md.prior_dyn_active_w_flag = 0; +#ifndef DEBUG_AGC_ENCODER_CMD_OPTION ivas_spar_set_bitrate_config( &hMdEnc->spar_md_cfg, table_idx, ( hMdEnc->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : SPAR_DIRAC_SPLIT_START_BAND, hMdEnc->spar_hoa_dirac2spar_md_flag, 1, hEncoderConfig->Opt_PCA_ON, ivas_agc_enc_get_flag( ivas_spar_br_table_consts[table_idx].nchan_transport ) ); +#else + ivas_spar_set_bitrate_config( &hMdEnc->spar_md_cfg, table_idx, ( hMdEnc->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : SPAR_DIRAC_SPLIT_START_BAND, + hMdEnc->spar_hoa_dirac2spar_md_flag, 1, hEncoderConfig->Opt_PCA_ON, ivas_agc_enc_get_flag( hEncoderConfig->Opt_AGC_ON, ivas_spar_br_table_consts[table_idx].nchan_transport ) ); +#endif /* get FB coefficients */ for ( i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) @@ -624,9 +632,22 @@ ivas_error ivas_spar_md_enc_process( } } } +#ifdef DEBUG_LBR_SBA + float dirac_md_kbps = (float) ( hMetaData->nb_bits_tot ) * 50 / 1000; +#endif code_strat = 0; +#ifdef DEBUG_SBA_MD_DUMP + ndec = -1; +#endif +#ifdef DEBUG_SPAR_MD_TARGET_TUNING + for ( qsi = 0; qsi < 1; qsi++ ) +#else for ( qsi = 0; qsi < num_quant_strats; qsi++ ) +#endif { +#ifdef SPAR_HOA_DBG + fprintf( stdout, "qsi = %d\n", qsi ); +#endif for ( b = 0; b < num_bands; b++ ) { ndm = hMdEnc->spar_md_cfg.num_dmx_chans_per_band[b * bands_bw]; @@ -742,6 +763,19 @@ ivas_error ivas_spar_md_enc_process( } } } +#ifdef SPAR_HOA_DBG + /*fprintf(stderr, "\n\n C coefficients: band %d\n", b); + + for (i = 0; i < num_ch - ndm; i++) + { + for (j = 0; j < ndm - 1; j++) + { + fprintf(stderr, "%f, ", hMdEnc->spar_md.band_coeffs[b].C_re[i][j]); + } + fprintf(stderr, "\n"); + } + fprintf(stderr, "\n\n"); */ +#endif ivas_quant_c_per_band( &hMdEnc->spar_md.band_coeffs[b], &hMdEnc->spar_md.band_coeffs_idx[b], &hMdEnc->spar_md_cfg.quant_strat[qsi], ndec, ndm ); @@ -808,6 +842,16 @@ ivas_error ivas_spar_md_enc_process( } } +#ifdef DEBUGGING + if ( dtx_vad == 1 ) + { + assert( packed_ok == 1 ); + } + if ( hEncoderConfig->ivas_total_brate >= IVAS_256k ) + { + assert( qsi == 0 ); + } +#endif /* Reuse mixer matrix values for unsent bands */ if ( ( hEncoderConfig->ivas_total_brate < IVAS_24k4 ) && ( code_strat > 3 ) ) @@ -828,6 +872,211 @@ ivas_error ivas_spar_md_enc_process( } } } +#ifdef DEBUG_LBR_SBA + char f_name[100]; + int16_t nbands = 1; + int16_t num_subframes = 1; + int16_t num_elements = 6; + int16_t num_block_group = 1; + int16_t byte_size = sizeof( float ); + + float sba_md_kbps = (float) hMetaData->nb_bits_tot * 50 / 1000; + float spar_md_kbps = sba_md_kbps - dirac_md_kbps; + float corebr_kbps = (float) hEncoderConfig->ivas_total_brate / 1000 - sba_md_kbps; + + sprintf( f_name, "SBA_MD_bitrate.bin" ); + ( frame == 0 ) ? dbgwrite( &nbands, sizeof( nbands ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_block_group, sizeof( num_block_group ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + + for ( b = 0; b < nbands; b++ ) + { + for ( int16_t sf = 0; sf < num_subframes; sf++ ) + { + for ( int16_t bl = 0; bl < num_block_group; bl++ ) + { + float fqsi = (float) qsi; + float fcode = (float) code_strat; + + dbgwrite( &dirac_md_kbps, byte_size, 1, 1, f_name ); + dbgwrite( &spar_md_kbps, byte_size, 1, 1, f_name ); + dbgwrite( &sba_md_kbps, byte_size, 1, 1, f_name ); + dbgwrite( &fqsi, byte_size, 1, 1, f_name ); + dbgwrite( &fcode, byte_size, 1, 1, f_name ); + dbgwrite( &corebr_kbps, byte_size, 1, 1, f_name ); + // fprintf(stdout, "%f\t%f\t%f\t%d\t%d\n", dirac_md_kbps, spar_md_kbps, sba_md_kbps, qsi, code_strat ); + } + } + } +#endif +#ifdef SPAR_HOA_DBG + /*if ( strat >= 4 ) + { + for ( b = 0; b < nB; b++ ) + { + b = 0; + fprintf( stdout, "\n\nMETADATA PR: band %d, qsi %d\n\n", b, qsi ); + for ( i = 0; i < num_ch - 1; i++ ) + { + fprintf( stdout, "i: %d -- %f\t %d\t %d\n", i, //hMdEnc->spar_md.band_coeffs[b].pred_re[i], + hMdEnc->spar_md.band_coeffs[b].pred_quant_re[i], + hMdEnc->spar_md_prior.band_coeffs_idx[b].pred_index_re[i], + hMdEnc->spar_md.band_coeffs_idx[b].pred_index_re[i] ); + } + fprintf( stdout, "\n\n METADATA C: band %d\n\n", b ); + int16_t k = 0; + for ( i = 0; i < ndec; i++ ) + { + for ( j = 0; j < ( ndm - 1 ); j++ ) + { + fprintf( stdout, "i: %d -- %f\t %d\t %d\n", i, // hMdEnc->spar_md.band_coeffs[b].C_re[i][j], + hMdEnc->spar_md.band_coeffs[b].C_quant_re[i][j], + hMdEnc->spar_md_prior.band_coeffs_idx[b].drct_index_re[k], + hMdEnc->spar_md.band_coeffs_idx[b].drct_index_re[k] ); + k++; + } + } + fprintf( stdout, "\n\n METADATA Pd: band %d\n\n", b ); + for ( i = 0; i < num_ch - ndm; i++ ) + { + fprintf( stdout, "i: %d -- %f\t %d\t %d\n", i, //hMdEnc->spar_md.band_coeffs[b].P_re[i][i], + hMdEnc->spar_md.band_coeffs[b].P_quant_re[i][i], + hMdEnc->spar_md_prior.band_coeffs_idx[b].decd_index_re[i], + hMdEnc->spar_md.band_coeffs_idx[b].decd_index_re[i] ); + } + fprintf( stdout, "\n\n" ); + } + }*/ + b = 0; + ndm = hMdEnc->spar_md_cfg.num_dmx_chans_per_band[b * bands_bw]; + + fprintf( stdout, "\n\n Metadata PR (15x1), C(15x15), P(15x15): band %d\n", b ); + for ( i = 0; i < num_ch - 1; i++ ) + { + fprintf( stdout, "i: %d -- %.2f\t|\t", i, hMdEnc->spar_md.band_coeffs[b].pred_quant_re[i] ); + if ( i < num_ch - ndm ) + { + for ( j = 0; j < ndm - 1; j++ ) + { + fprintf( stdout, "%.2f\t", hMdEnc->spar_md.band_coeffs[b].C_quant_re[i][j] ); + } + fprintf( stdout, "|\t" ); + for ( j = 0; j < num_ch - ndm; j++ ) + { + fprintf( stdout, "%.2f\t", hMdEnc->spar_md.band_coeffs[b].P_quant_re[j] ); + } + } + fprintf( stdout, "\n" ); + } + fprintf( stdout, "\n" ); +#endif +#ifdef DEBUG_SBA_MD_DUMP + { + char f_name[100]; + int16_t n_bands = 1, num_subframes = 1, num_block_groups = 1, num_elements = 1, byte_size = sizeof( int16_t ); + sprintf( f_name, "spar_qsi.bin" ); + ( frame == 0 ) ? dbgwrite( &n_bands, sizeof( nB ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_block_groups, sizeof( num_block_groups ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + dbgwrite( &qsi, sizeof( int16_t ), 1, 1, f_name ); + sprintf( f_name, "spar_strat.bin" ); + ( frame == 0 ) ? dbgwrite( &n_bands, sizeof( nB ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_block_groups, sizeof( num_block_groups ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + dbgwrite( &strat, sizeof( int16_t ), 1, 1, f_name ); + byte_size = sizeof( float ); + for ( b = 0; b < nB; b++ ) + { + ndm = hMdEnc->spar_md_cfg.num_dmx_chans_per_band[b * bands_bw]; + + sprintf( f_name, "spar_band_pred_coeffs.bin" ); + ( b == 0 && frame == 0 ) ? dbgwrite( &nB, sizeof( nB ), 1, 1, f_name ) : false; + num_elements = num_ch - 1; + ( b == 0 && frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( b == 0 && frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( b == 0 && frame == 0 ) ? dbgwrite( &num_block_groups, sizeof( num_block_groups ), 1, 1, f_name ) : false; + ( b == 0 && frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + for ( i = 0; i < num_ch - 1; i++ ) + { + dbgwrite( &hMdEnc->spar_md.band_coeffs[b].pred_re[i], sizeof( float ), 1, 1, f_name ); + } + sprintf( f_name, "spar_band_C_coeffs.bin" ); + ( b == 0 && frame == 0 ) ? dbgwrite( &nB, sizeof( nB ), 1, 1, f_name ) : false; + num_elements = ndec * ( ndm - 1 ); + ( b == 0 && frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( b == 0 && frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( b == 0 && frame == 0 ) ? dbgwrite( &num_block_groups, sizeof( num_block_groups ), 1, 1, f_name ) : false; + ( b == 0 && frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + for ( i = 0; i < ndec; i++ ) + { + for ( j = 0; j < ( ndm - 1 ); j++ ) + { + dbgwrite( &hMdEnc->spar_md.band_coeffs[b].C_re[i][j], sizeof( float ), 1, 1, f_name ); + } + } + sprintf( f_name, "spar_band_P_coeffs.bin" ); + ( b == 0 && frame == 0 ) ? dbgwrite( &nB, sizeof( nB ), 1, 1, f_name ) : false; + num_elements = num_ch - ndm; + ( b == 0 && frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( b == 0 && frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( b == 0 && frame == 0 ) ? dbgwrite( &num_block_groups, sizeof( num_block_groups ), 1, 1, f_name ) : false; + ( b == 0 && frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + for ( i = 0; i < num_ch - ndm; i++ ) + { + dbgwrite( &hMdEnc->spar_md.band_coeffs[b].P_re[i], sizeof( float ), 1, 1, f_name ); + } + sprintf( f_name, "spar_band_pred_coeffs_quant.bin" ); + ( b == 0 && frame == 0 ) ? dbgwrite( &nB, sizeof( nB ), 1, 1, f_name ) : false; + num_elements = num_ch - 1; + ( b == 0 && frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( b == 0 && frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( b == 0 && frame == 0 ) ? dbgwrite( &num_block_groups, sizeof( num_block_groups ), 1, 1, f_name ) : false; + ( b == 0 && frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + for ( i = 0; i < num_ch - 1; i++ ) + { + dbgwrite( &hMdEnc->spar_md.band_coeffs[b].pred_quant_re[i], sizeof( float ), 1, 1, f_name ); + } + sprintf( f_name, "spar_band_C_coeffs_quant.bin" ); + ( b == 0 && frame == 0 ) ? dbgwrite( &nB, sizeof( nB ), 1, 1, f_name ) : false; + num_elements = ndec * ( ndm - 1 ); + ( b == 0 && frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( b == 0 && frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( b == 0 && frame == 0 ) ? dbgwrite( &num_block_groups, sizeof( num_block_groups ), 1, 1, f_name ) : false; + ( b == 0 && frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + for ( i = 0; i < ndec; i++ ) + { + for ( j = 0; j < ( ndm - 1 ); j++ ) + { + dbgwrite( &hMdEnc->spar_md.band_coeffs[b].C_quant_re[i][j], sizeof( float ), 1, 1, f_name ); + } + } + sprintf( f_name, "spar_band_P_coeffs_quant.bin" ); + ( b == 0 && frame == 0 ) ? dbgwrite( &nB, sizeof( nB ), 1, 1, f_name ) : false; + num_elements = num_ch - ndm; + ( b == 0 && frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( b == 0 && frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( b == 0 && frame == 0 ) ? dbgwrite( &num_block_groups, sizeof( num_block_groups ), 1, 1, f_name ) : false; + ( b == 0 && frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + for ( i = 0; i < num_ch - ndm; i++ ) + { + dbgwrite( &hMdEnc->spar_md.band_coeffs[b].P_quant_re[i], sizeof( float ), 1, 1, f_name ); + } + } + } +#endif +#ifdef DEBUG_SPAR_MD_TARGET_TUNING + int16_t md_bits = hMetaData->nb_bits_tot - bit_pos_start + ( ( ( hEncoderConfig->ivas_total_brate == IVAS_256k ) && ( sba_order == SBA_FOA_ORDER ) ) ? 1 : 0 ); + FILE *fp = fopen( "spar_md_bitrate.txt", "a" ); + + fprintf( fp, "%d\t %d \t %d\n", md_bits, qsi, code_strat ); + fclose( fp ); +#endif ivas_store_prior_coeffs( hMdEnc, num_bands, code_strat, dtx_vad, qsi ); @@ -1001,6 +1250,12 @@ static void ivas_write_spar_md_bitstream( } } +#ifdef SPAR_HOA_DBG + if ( strat < 2 ) + fprintf( stdout, "\n\n no_ec = %d, strat = %d\n", no_ec, strat - 1 ); + else + fprintf( stdout, "\n\n no_ec = %d, strat = %d\n", no_ec, strat ); +#endif if ( no_ec == 1 ) { entropy_coding_result = diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index eae9c41dd..6725d778b 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -271,6 +271,10 @@ typedef struct stereo_dft_enc_data_struct float icbweRefEner; float lbEner; int16_t flip_sign; +#ifdef DEBUG_MODE_DFT + int16_t verbose; + int16_t res_cod_bits; +#endif } STEREO_DFT_ENC_DATA, *STEREO_DFT_ENC_DATA_HANDLE; @@ -288,6 +292,11 @@ typedef struct stereo_mdct_enc_data_structure /* only intraframe */ int16_t mdct_stereo_mode[2]; /* mdct stereo mode: LR, MS, band-wise MS */ +#ifdef DEBUGGING + int16_t mdct_stereo_mode_cmdl; /* MDCT stereo mode from command-line */ + int16_t fDualMono; /* force dual mono in MDCT stereo mode */ + int16_t fMSstereo; /* force full-band MS in MDCT stereo mode */ +#endif int16_t global_ild[2]; /* Quantized ILD for the whole spectrum */ int16_t split_ratio; /* Ratio of bitrate (1 to 7), split_ratio = 8 * 1st chn bitrate / (1st + 2nd chn bitrate) */ @@ -996,6 +1005,9 @@ typedef struct cpe_enc_data_structure float *input_mem[CPE_CHANNELS]; /* input channels buffers memory; needed to be up-to-date for TD->DFT stereo switching */ int32_t brate_surplus; /* bitrate surplus for bitrate adaptation in combined format coding */ +#ifdef DEBUGGING + int16_t stereo_mode_cmdl; /* stereo mode forced from the commaand-line */ +#endif } CPE_ENC_DATA, *CPE_ENC_HANDLE; @@ -1166,6 +1178,15 @@ typedef struct encoder_config_structure /* temp. development parameters */ int16_t Opt_PCA_ON; /* flag indicating PCA operation in SBA */ +#ifdef DEBUGGING + /* debugging options */ + int16_t stereo_mode_cmdl; /* stereo mode forced from the command-line */ + int16_t force; /* parameter to force specific "core" of the Core-Coder*/ + int16_t mdct_stereo_mode_cmdl; /* mdct stereo mode forced from command-line, employed only when DEBUG_FORCE_MDCT_STEREO_MODE is activated */ +#ifdef DEBUG_AGC_ENCODER_CMD_OPTION + int16_t Opt_AGC_ON; /* flag indicating AGC operation in SBA */ +#endif +#endif } ENCODER_CONFIG, *ENCODER_CONFIG_HANDLE; diff --git a/lib_enc/ivas_stereo_adapt_GR_enc.c b/lib_enc/ivas_stereo_adapt_GR_enc.c index c8816da9c..087ecda8e 100644 --- a/lib_enc/ivas_stereo_adapt_GR_enc.c +++ b/lib_enc/ivas_stereo_adapt_GR_enc.c @@ -38,6 +38,9 @@ #include "stat_enc.h" #include "wmc_auto.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif /*---------------------------------------------------------------------* diff --git a/lib_enc/ivas_stereo_classifier.c b/lib_enc/ivas_stereo_classifier.c index 68be77ad1..427b55fe6 100644 --- a/lib_enc/ivas_stereo_classifier.c +++ b/lib_enc/ivas_stereo_classifier.c @@ -40,6 +40,9 @@ #include "ivas_rom_com.h" #include "ivas_rom_enc.h" #include "ivas_cnst.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -109,6 +112,9 @@ int16_t select_stereo_mode( stereo_switching_flag = 1; if ( hCPE->element_brate >= MIN_BRATE_MDCT_STEREO || ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) && hCPE->element_brate < MASA_STEREO_MIN_BITRATE ) +#ifdef DEBUGGING + || ( hCPE->stereo_mode_cmdl == IVAS_CPE_DFT || hCPE->stereo_mode_cmdl == IVAS_CPE_TD ) +#endif ) { stereo_switching_flag = 0; @@ -145,6 +151,12 @@ int16_t select_stereo_mode( { element_mode = IVAS_CPE_DFT; } +#ifdef DEBUGGING + if ( hCPE->stereo_mode_cmdl > 1 ) + { + element_mode = hCPE->stereo_mode_cmdl; + } +#endif } else if ( element_mode == IVAS_CPE_TD ) { @@ -199,6 +211,12 @@ int16_t select_stereo_mode( set_f( hStereoClassif->xtalk_fv, -1.0f, SSC_MAX_NFEA ); } } +#ifdef DEBUG_MODE_TD + dbgwrite( &hStereoClassif->unclr_decision, sizeof( int16_t ), 1, L_FRAME16k, "res/unclr_decision.enc" ); + dbgwrite( &hStereoClassif->xtalk_decision, sizeof( int16_t ), 1, L_FRAME16k, "res/xtalk_decision.enc" ); + dbgwrite( &hCPE->hCoreCoder[0]->sp_aud_decision0, sizeof( int16_t ), 1, L_FRAME16k, "res/sp_aud_class.enc" ); + dbgwrite( &hCPE->hCoreCoder[0]->last_core, sizeof( int16_t ), 1, L_FRAME16k, "res/last_core.enc" ); +#endif if ( element_mode == IVAS_CPE_TD && hCPE->hCoreCoder[0]->Opt_DTX_ON ) { @@ -535,6 +553,9 @@ void unclr_classifier_td( int16_t i, ind; float relE_ST, edge, edge_0_1; float score, fvn[SSC_MAX_NFEA]; +#ifdef DEBUG_MODE_TD + int16_t dec; +#endif STEREO_CLASSIF_HANDLE hStereoClassif = hCPE->hStereoClassif; set_f( fvn, -1.0f, SSC_MAX_NFEA ); @@ -552,6 +573,10 @@ void unclr_classifier_td( score += fvn[i] * unclr_coef_td[i]; } +#ifdef DEBUG_MODE_TD + /* raw decision */ + dec = score > 0; +#endif /* normalize score to -1:+1 */ if ( score > UNCLR_SCORE_THR ) @@ -591,6 +616,11 @@ void unclr_classifier_td( hStereoClassif->unclr_decision = !hStereoClassif->unclr_decision; } +#ifdef DEBUG_MODE_TD + dbgwrite( &dec, sizeof( int16_t ), 1, 1, "res/unclr_dec.x" ); + dbgwrite( &hStereoClassif->unclr_wscore, sizeof( float ), 1, 1, "res/unclr_wscore.x" ); + dbgwrite( &hStereoClassif->unclr_decision, sizeof( int16_t ), 1, 1, "res/unclr_dec_hyst.x" ); +#endif return; } @@ -609,6 +639,9 @@ void unclr_classifier_dft( int16_t i, ind; float edge, relE_ST, edge_0_1; float score, fvn[SSC_MAX_NFEA]; +#ifdef DEBUG_MODE_TD + int16_t dec; +#endif STEREO_CLASSIF_HANDLE hStereoClassif = hCPE->hStereoClassif; @@ -625,6 +658,10 @@ void unclr_classifier_dft( score += fvn[i] * unclr_coef_dft[i]; } +#ifdef DEBUG_MODE_TD + /* raw decision */ + dec = score > 0; +#endif /* normalize score to -1:+1 */ if ( score > UNCLR_SCORE_THR ) @@ -669,6 +706,11 @@ void unclr_classifier_dft( hStereoClassif->unclr_decision = !hStereoClassif->unclr_decision; } +#ifdef DEBUG_MODE_TD + dbgwrite( &dec, sizeof( int16_t ), 1, 1, "res/unclr_dec.x" ); + dbgwrite( &hStereoClassif->unclr_wscore, sizeof( float ), 1, 1, "res/unclr_wscore.x" ); + dbgwrite( &hStereoClassif->unclr_decision, sizeof( int16_t ), 1, 1, "res/unclr_dec_hyst.x" ); +#endif return; } @@ -688,6 +730,9 @@ void xtalk_classifier_td( float score, fvn[SSC_MAX_NFEA]; float edge, edge_0_1, wedge, scr_min, scr_max, wrelE; +#ifdef DEBUG_MODE_TD + int16_t dec; +#endif STEREO_CLASSIF_HANDLE hStereoClassif = hCPE->hStereoClassif; @@ -740,6 +785,10 @@ void xtalk_classifier_td( score = 0; } +#ifdef DEBUG_MODE_TD + /* raw decision */ + dec = score > 0; +#endif /* weight raw score with relative energy */ wrelE = lin_interp( hStereoClassif->relE_0_1, 0.5f, 0.95f, 0.9f, 0.0f, 1 ); @@ -791,6 +840,11 @@ void xtalk_classifier_td( hStereoClassif->xtalk_decision = !hStereoClassif->xtalk_decision; } +#ifdef DEBUG_MODE_TD + dbgwrite( &hStereoClassif->xtalk_wscore, sizeof( float ), 1, 1, "res/xtalk_wscore.x" ); + dbgwrite( &dec, sizeof( int16_t ), 1, 1, "res/xtalk_dec.x" ); + dbgwrite( &hStereoClassif->xtalk_decision, sizeof( int16_t ), 1, 1, "res/xtalk_dec_hyst.x" ); +#endif return; } @@ -815,6 +869,9 @@ void xtalk_classifier_dft( float fvn[SSC_MAX_NFEA], edge, edge_0_1, wedge; float ratio_m1_m2, m2_m2, d_itd2, itd1_flip; float scr_min, scr_max; +#ifdef DEBUG_MODE_TD + int16_t dec; +#endif hStereoClassif = hCPE->hStereoClassif; hItd = ( hCPE->hStereoDft != NULL ) ? hCPE->hStereoDft->hItd : hCPE->hStereoMdct->hItd; @@ -904,6 +961,10 @@ void xtalk_classifier_dft( score = 0; } +#ifdef DEBUG_MODE_TD + /* raw decision */ + dec = score > 0; +#endif /* rising edge detector on raw score -> yields 1 if strong rising edge is detected in the given buffer */ @@ -936,12 +997,20 @@ void xtalk_classifier_dft( hCPE->hCoreCoder[0]->vad_flag == 1 && hCPE->hCoreCoder[0]->flag_noisy_speech_snr == 0 && hCPE->hCoreCoder[0]->hNoiseEst->aEn_inac_cnt > 15 ) { hStereoClassif->xtalk_decision = 1; +#ifdef DEBUG_MODE_TD + printf( "\nSwitch DFT-stereo -> TD-LR on frame %d\n", frame ); +#endif } else if ( hCPE->element_brate >= IVAS_16k4 && hStereoClassif->xtalk_decision == 0 && abs( itd ) > STEREO_DFT_ITD_MAX && ( hCPE->hCoreCoder[0]->lp_speech - hCPE->hCoreCoder[0]->lp_noise ) > 25.0f ) { hStereoClassif->xtalk_decision = 1; } +#ifdef DEBUG_MODE_TD + dbgwrite( &hStereoClassif->xtalk_wscore, sizeof( float ), 1, 1, "res/xtalk_wscore.x" ); + dbgwrite( &dec, sizeof( int16_t ), 1, 1, "res/xtalk_dec.x" ); + dbgwrite( &hStereoClassif->xtalk_decision, sizeof( int16_t ), 1, 1, "res/xtalk_dec_hyst.x" ); +#endif /* updates */ hItd->prev_m1 = m1; diff --git a/lib_enc/ivas_stereo_cng_enc.c b/lib_enc/ivas_stereo_cng_enc.c index 10a87659a..76f56532d 100644 --- a/lib_enc/ivas_stereo_cng_enc.c +++ b/lib_enc/ivas_stereo_cng_enc.c @@ -40,6 +40,9 @@ #include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_enc/ivas_stereo_dft_enc.c b/lib_enc/ivas_stereo_dft_enc.c index 3463af2da..109def1fd 100644 --- a/lib_enc/ivas_stereo_dft_enc.c +++ b/lib_enc/ivas_stereo_dft_enc.c @@ -42,7 +42,16 @@ #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "ivas_rom_enc.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" +#ifdef DEBUG_PLOT +#include "deb_out.h" +#endif +#ifdef DEBUG_MODE_DFT +static FILE *pF = NULL; +#endif /*-------------------------------------------------------------------* @@ -70,7 +79,11 @@ static float stereo_dft_calc_mean_ipd_change( float *pIpd, float *ipd_smooth, in static void stereo_dft_gipd_stabilization( float *pgIpd, float prev_gipd, float ipd_mean_change ); +#ifdef DEBUG_MODE_DFT +static void stereo_dft_enc_get_nipd_flag( STEREO_DFT_ENC_DATA_HANDLE hStereoDft, float *pgIpd, const int16_t sp_aud_decision0, const float gainIPD ); +#else static void stereo_dft_enc_get_nipd_flag( STEREO_DFT_ENC_DATA_HANDLE hStereoDft, const int16_t sp_aud_decision0, const float gainIPD ); +#endif static void stereo_dft_enc_get_reverb_flag( STEREO_DFT_ENC_DATA_HANDLE hStereoDft, float *pPredGain, float *sub_nrg_DMX, const float *sub_nrg_L, const float *sub_nrg_R, const int16_t k_offset, const float *bin_nrgL, const float *bin_nrgR ); @@ -126,6 +139,11 @@ void stereo_dft_quantize_res_gains( sign = 1; } +#ifdef DEBUGGING + /* the following assertions should be satisfied by the input data: */ + assert( 1 - gg * gg + EPSILON >= rr * rr / 2 ); + assert( gg <= 1 ); +#endif gg = min( gg, 1 - EPSILON ); rr = min( rr, sqrtf( 1 - gg * gg ) - EPSILON ); @@ -492,6 +510,9 @@ void stereo_dft_enc_reset( hStereoDft->first_frm_flag = 1; +#ifdef DEBUG_MODE_DFT + hStereoDft->verbose = 1; +#endif stereo_enc_itd_init( hStereoDft->hItd ); @@ -616,6 +637,56 @@ void stereo_dft_enc_update( hStereoDft->res_cod_line_max = 8 * ( hStereoDft->res_cod_line_max / 8 ); hStereoDft->res_pred_band_min = max( STEREO_DFT_RES_PRED_BAND_MIN, hStereoDft->res_cod_band_max ); +#ifdef DEBUG_MODE_DFT + /*Compute the expected bitrate*/ + if ( hStereoDft->verbose ) + { + int16_t tmp, nbits, N_div_param, bits_itd; + int16_t input_frame = hStereoDft->N; + int32_t input_Fs; + input_Fs = input_frame * FRAMES_PER_SEC; + + hStereoDft->verbose = 0; + + /*init*/ + N_div_param = 1; + + nbits = 0; /*header: 0 bits*/ + + fprintf( stderr, "Stereo DFT\n" ); + + /*ITD*/ + tmp = 1 + STEREO_DFT_ITD_NBITS; + nbits += 1; + bits_itd = STEREO_DFT_ITD_NBITS; + fprintf( stderr, "\t ITD: %.2f kbps\n", tmp * input_Fs / ( 1000.f * input_frame ) ); + + /*SIDE_GAIN*/ + tmp = hStereoDft->nbands * 5 * N_div_param; + nbits += tmp; + fprintf( stderr, "\t SIDE_GAIN: %.2f kbps\n", tmp * input_Fs / ( 1000.f * input_frame ) ); + + + /*residual coding prediction*/ + tmp = 0; + if ( hStereoDft->hConfig->res_pred_mode ) + { + tmp = ( hStereoDft->nbands - hStereoDft->res_pred_band_min ) * 3 * N_div_param; + fprintf( stderr, "\t Res pred.: %.2f kbps\n", tmp * input_Fs / ( 1000.f * input_frame ) ); + } + nbits += max( tmp, bits_itd ); + + /*residual coding*/ + if ( hStereoDft->hConfig->res_cod_mode ) + { + tmp = hStereoDft->res_cod_bits; + nbits += tmp; + fprintf( stderr, "\t Res cod.: %.2f kbps\n", tmp * input_Fs / ( 1000.f * input_frame ) ); + } + + fprintf( stderr, "\t Total: %.2f kbps\n", nbits * input_Fs / ( 1000.f * input_frame ) ); + } +#endif /*DEBUGGING*/ return; } @@ -689,6 +760,23 @@ void stereo_dft_enc_analyze( mem[n] = input_mem[n]; } +#ifdef DEBUG_MODE_DFT + { + int16_t tmp[1024]; + + /* stereo side info is only simulated */ + for ( i = 0; i < input_frame; i++ ) + { + tmp[i] = (int16_t) ( input[0][i] + 0.5f ); + } + dbgwrite( tmp, sizeof( int16_t ), input_frame, 1, "./res/stereo_dft_ch0_input.pcm" ); + for ( i = 0; i < input_frame; i++ ) + { + tmp[i] = (int16_t) ( input[1][i] + 0.5f ); + } + dbgwrite( tmp, sizeof( int16_t ), input_frame, 1, "./res/stereo_dft_ch1_input.pcm" ); + } +#endif /*-----------------------------------------------------------------* * DFT Analysis @@ -765,7 +853,11 @@ void stereo_dft_enc_analyze( mem[n] = &input[n][N - dft_ovl]; } +#ifdef DEBUG_MODE_DFT + if ( hStereoDft != NULL && hStereoDft->hConfig->hybrid_itd_flag && hStereoDft->hConfig->itd_mode && hStereoDft->hItd->td_itd[STEREO_DFT_OFFSET] ) +#else if ( hStereoDft != NULL && hStereoDft->hConfig->hybrid_itd_flag && hStereoDft->hItd->td_itd[STEREO_DFT_OFFSET] ) +#endif { for ( n = 0; n < n_channels; n++ ) { @@ -1068,6 +1160,66 @@ float stereo_dft_enc_synthesize( output[offset + N + i] = ( tmp[zp + N + i] - ifft_deviation ) / win_ana[ovl - 1 - i] + ifft_deviation; } +#ifdef DEBUG_MODE_DFT + { + int16_t tmp_dbg[L_FRAME48k]; +#ifdef DEBUG_STEREO_DFT_NOCORE + static float mem_win[2][STEREO_DFT_OVL_MAX] = { { 0 }, { 0 } }; +#endif + char file_name[50] = { 0 }; + int16_t input_frame = N; + int16_t b = 0; + offset = -ovl; + b = L_frame; + +#ifdef DEBUG_STEREO_DFT_NOCORE + /*Simulate the un-windowing process which breaks partly TDAC of MDCT*/ + if ( ( ( chan == 1 ) || ( output_sampling_rate == input_Fs ) ) && ( L_frame <= 0 ) ) + { + float tmp_f[L_FRAME48k + STEREO_DFT_OVL_MAX]; + float MDCT[L_FRAME48k]; + + /*window signal*/ + for ( i = 0; i < ovl; i++ ) + { + tmp_f[i] = output[offset + i] * sqrt( win_ana[i] * win[i] ); + tmp_f[input_frame + i] = output[offset + input_frame + i] * sqrt( win_ana[ovl - 1 - i] * win[ovl - 1 - i] ); + } + /*Middle->Copy*/ + for ( ; i < input_frame; i++ ) + { + tmp_f[i] = output[offset + i]; + } + + /*MDCT -IMDCT (inject Time domain aliasing)*/ + TCX_MDCT( tmp_f, MDCT, ovl, input_frame - ovl, ovl, IVAS_CPE_DFT ); + TCX_MDCT_Inverse( MDCT, tmp_f, ovl, input_frame - ovl, ovl, IVAS_CPE_DFT ); + + /*OLA*/ + /*overlapping parts*/ + for ( i = 0; i < ovl; i++ ) + { + tmp_f[i] = mem_win[chan][i] + tmp_f[i] * sqrt( win_ana[i] * win[i] ); + mem_win[chan][i] = tmp_f[input_frame + i] * sqrt( win_ana[ovl - 1 - i] * win[ovl - 1 - i] ); + } + for ( i = 0; i < input_frame; i++ ) + { + tmp_dbg[i] = (int16_t) ( tmp_f[i] + 0.5f ); + } + } + else +#endif + { + for ( i = 0; i < input_frame; i++ ) + { + tmp_dbg[i] = (int16_t) ( output[offset + i] + 0.5f ); + } + } + + sprintf( file_name, "./res/stereo_dft_enc_M_S_%d_c%d_b%d.pcm", output_sampling_rate, chan, b ); + dbgwrite( tmp_dbg, sizeof( int16_t ), input_frame, 1, file_name ); + } +#endif pop_wmops(); return ( nrg ); @@ -1135,6 +1287,9 @@ void stereo_dft_enc_process( hStereoDft->res_pred_band_min = max( STEREO_DFT_RES_PRED_BAND_MIN, hStereoDft->res_cod_band_max ); +#ifdef DEBUG_MODE_DFT + dbgwrite( &( hStereoDft->nbands ), sizeof( int16_t ), 1, 1, "./res/stereo_dft_nbands.dat" ); +#endif hStereoDft->voicing_lt = 0.75f * hStereoDft->voicing_lt + 0.25f * hCPE->hCoreCoder[0]->voicing[0]; hStereoDft->voicing_lt = 0.75f * hStereoDft->voicing_lt + 0.25f * hCPE->hCoreCoder[0]->voicing[1]; @@ -1149,6 +1304,9 @@ void stereo_dft_enc_process( pDFT_L = hStereoDft->DFT[0]; pDFT_R = hStereoDft->DFT[1]; +#ifdef DEBUG_MODE_DFT + if ( hStereoDft->hConfig->itd_mode ) +#endif { stereo_dft_enc_compute_itd( hCPE, pDFT_L, pDFT_R, k_offset, input_frame, vad_flag_dtx, vad_hover_flag, bin_nrgL, bin_nrgR ); if ( hCPE->element_mode == IVAS_CPE_MDCT ) @@ -1207,6 +1365,18 @@ void stereo_dft_enc_process( bin_nrgR[i] = pDFT_R[2 * i] * pDFT_R[2 * i] + pDFT_R[2 * i + 1] * pDFT_R[2 * i + 1]; } } +#ifdef DEBUG_MODE_DFT + else + { + /* no ITD computation, get binwise energies here */ + + for ( i = 0; i < hStereoDft->NFFT / 2; i++ ) + { + bin_nrgL[i] = pDFT_L[2 * i] * pDFT_L[2 * i] + pDFT_L[2 * i + 1] * pDFT_L[2 * i + 1]; + bin_nrgR[i] = pDFT_R[2 * i] * pDFT_R[2 * i] + pDFT_R[2 * i + 1] * pDFT_R[2 * i + 1]; + } + } +#endif /* DFT stereo parameters */ stereo_dft_enc_compute_prm( hStereoDft, pDFT_L, pDFT_R, k_offset, 1, hCPE->hCoreCoder[0]->sp_aud_decision0, hCPE->hCoreCoder[0]->vad_flag, bin_nrgL, bin_nrgR, dot_prod_nrg_ratio ); @@ -1235,6 +1405,12 @@ void stereo_dft_enc_process( /*------------------------------------------------------------------* * Channel mapping: computation of DMX and RES *-----------------------------------------------------------------*/ +#ifdef DEBUG_MODE_DFT + { + int16_t tmp_dbg = (int16_t) ( 100 * fac_att ); + dbgwrite( &tmp_dbg, sizeof( int16_t ), 1, 1, "./res/stereo_dft_enc_facAtt.pcm" ); + } +#endif res_nrg_all_curr = EPSILON; dmx_nrg_all_curr = EPSILON; @@ -1278,6 +1454,13 @@ void stereo_dft_enc_process( if ( b < hStereoDft->res_cod_band_max && vad_flag_dtx[0] ) { +#ifdef DEBUGGING + assert( hStereoDft->nbands == hStereoDft->nbands_dmx && "Don't use coarser stereo parameter resolution for residual coding bitrates!" ); +#endif +#ifdef DEBUG_MODE_DFT + dbgwrite( &g, sizeof( float ), 1, 1, "./res/stereo_dft_enc_g.pcm" ); + dbgwrite( &alpha, sizeof( float ), 1, 1, "./res/stereo_dft_enc_alpha.pcm" ); +#endif /*Get the previous frame energy*/ if ( hStereoDft->hConfig->ada_wb_res_cod_mode ) @@ -1429,6 +1612,7 @@ void stereo_dft_enc_process( } else { +#ifndef DEBUG_STEREO_DFT_NOSTEREO /*passive DMX*/ assert( hStereoDft->nbands == hStereoDft->nbands_dmx && "Don't use coarser stereo parameter resolution for residual coding bitrates!" ); for ( i = 0; i < hStereoDft->band_limits[hStereoDft->res_cod_band_max]; i++ ) @@ -1440,6 +1624,22 @@ void stereo_dft_enc_process( { pDFT_DMX[i] = ( pDFT_L[i] + pDFT_R[i] ) * 0.5f; } +#else + /*Copy Left channel to DMX and reset residual coding*/ + mvr2r( pDFT_L, DFT_DMX, hStereoDft->NFFT ); + set_zero( pDFT_RES, hStereoDft->NFFT ); + + /*for( b=0; bnbands; b++ ) + { + if( hStereoDft->res_pred_mode[k+k_offset] && b>= hStereoDft->res_pred_band_min ) + { + if( (k % hStereoDft->prm_res_enc[k+k_offset]) == (hStereoDft->prm_res_enc[k+k_offset]-1) ) + { + stereo_dft_quantize_res_pred_gain( pPredGain+b, pPredGain+b, 1, hStereoDft->Ind+(k_offset+k)*STEREO_DFT_PRM_MAX, hStereoDft->nInd+k+k_offset ); + } + } + }*/ +#endif } /*------------------------------------------------------------------* @@ -1660,6 +1860,17 @@ static void stereo_dft_enc_get_res_cod_mode_flag( set_zero( hStereoDft->output_mem_res_8k, STEREO_DFT_OVL_8k ); } +#ifdef DEBUG_MODE_DFT + /* look at res_nrg_all value */ + { + static FILE *ResNrgAll_FILE = NULL; + + if ( ResNrgAll_FILE == NULL ) + ResNrgAll_FILE = fopen( "./res/stereo_dft_res_nrg.txt", "w" ); + fprintf( ResNrgAll_FILE, "%f\t\t%d\n", hStereoDft->res_dmx_ratio_lt, hStereoDft->res_cod_mode[STEREO_DFT_OFFSET] ); + dbgwrite( &hStereoDft->res_cod_mode[STEREO_DFT_OFFSET], sizeof( int16_t ), 1, 320, "./res/stereo_dft_res_cod_mode_flag.pcm" ); + } +#endif return; } @@ -1688,6 +1899,9 @@ void stereo_dft_enc_res( float panning_gain, panning_gain_min; float res_cod_gain[10]; float in_phase_ratio; +#ifdef DEBUG_MODE_DFT + float MDCT_RES_dec[L_FRAME8k] = { 0 }; +#endif assert( hStereoDft->res_cod_line_max <= L_FRAME8k ); if ( hStereoDft->res_cod_mode[STEREO_DFT_OFFSET] ) @@ -1729,6 +1943,9 @@ void stereo_dft_enc_res( } /*Smooth max_snr because of several perturbations in computation*/ +#ifdef DEBUG_MODE_DFT + dbgwrite( &max_snr, sizeof( float ), 1, 1, "./res/stereo_dft_res_cod_target_snr0.dat" ); +#endif hStereoDft->old_snr = 0.2f * max_snr + 0.8f * hStereoDft->old_snr; max_snr = hStereoDft->old_snr; @@ -1736,6 +1953,9 @@ void stereo_dft_enc_res( { max_snr = STEREO_DFT_RES_COD_SNR_MIN; } +#ifdef DEBUG_MODE_DFT + dbgwrite( &max_snr, sizeof( float ), 1, 1, "./res/stereo_dft_res_cod_target_snr.dat" ); +#endif push_wmops( "residual_encode" ); /* residual encoding */ @@ -1746,7 +1966,11 @@ void stereo_dft_enc_res( ecsq_inst.config_index = 2 * hStereoDft->res_cod_mode[STEREO_DFT_OFFSET] - 1; /* 7 bits (STEREO_DFT_RES_GLOBAL_GAIN_BITS) for global_gain_index, 2 bits for closing of the arithmetic coder, 8 safety bits to account for the size estimation accuracy */ +#ifndef DEBUG_MODE_DFT ECSQ_encode_target_SNR( &ecsq_inst, MDCT_RES, hStereoDft->res_cod_line_max, max_snr, max_bits - ( *nb_bits ) - STEREO_DFT_RES_GLOBAL_GAIN_BITS - 2 - 8, NULL, &global_gain_index ); +#else + total_bit_count = (int16_t) ECSQ_encode_target_SNR( &ecsq_inst, MDCT_RES, hStereoDft->res_cod_line_max, max_snr, max_bits - ( *nb_bits ) - STEREO_DFT_RES_GLOBAL_GAIN_BITS - 2 - 8, MDCT_RES_dec, &global_gain_index ); +#endif if ( global_gain_index != ECSQ_GLOBAL_GAIN_INDEX_ALL_ZERO ) { total_bit_count = rc_uni_enc_finish( &range_uni_enc_state ); @@ -1759,6 +1983,9 @@ void stereo_dft_enc_res( /* Global gain */ push_indice( hBstr, IND_STEREO_DFT_RESIDUAL_GLOBAL_GAIN, global_gain_index, STEREO_DFT_RES_GLOBAL_GAIN_BITS ); ( *nb_bits ) += STEREO_DFT_RES_GLOBAL_GAIN_BITS; +#ifdef DEBUG_MODE_DFT + fprintf( pF, "Gain: %d ", global_gain_index ); +#endif /* Push arithmetic coded bits */ byte_buffer = range_uni_enc_state.byte_buffer; @@ -1772,6 +1999,9 @@ void stereo_dft_enc_res( push_indice( hBstr, IND_STEREO_DFT_RESIDUAL_COD, byte_buffer[idx] >> ( 8 - ( total_bit_count & 7 ) ), total_bit_count & 7 ); } ( *nb_bits ) += total_bit_count; +#ifdef DEBUG_MODE_DFT + fprintf( pF, "%d (max: %d)\n", STEREO_DFT_RES_GLOBAL_GAIN_BITS + total_bit_count, max_bits ); +#endif } else { @@ -1779,6 +2009,10 @@ void stereo_dft_enc_res( global_gain_index = ECSQ_GLOBAL_GAIN_INDEX_ALL_ZERO; push_indice( hBstr, IND_STEREO_DFT_RESIDUAL_GLOBAL_GAIN, global_gain_index, STEREO_DFT_RES_GLOBAL_GAIN_BITS ); ( *nb_bits ) += STEREO_DFT_RES_GLOBAL_GAIN_BITS; +#ifdef DEBUG_MODE_DFT + fprintf( pF, "Gain: %d ", global_gain_index ); + fprintf( pF, "%d (max: %d)\n", STEREO_DFT_RES_GLOBAL_GAIN_BITS, max_bits ); +#endif } } else @@ -1786,11 +2020,95 @@ void stereo_dft_enc_res( /* Global gain -> 127*/ push_indice( hBstr, IND_STEREO_DFT_RESIDUAL_GLOBAL_GAIN, global_gain_index, STEREO_DFT_RES_GLOBAL_GAIN_BITS ); ( *nb_bits ) += STEREO_DFT_RES_GLOBAL_GAIN_BITS; +#ifdef DEBUG_MODE_DFT + fprintf( pF, "Gain: %d ", global_gain_index ); + fprintf( pF, "%d (max: %d)\n", STEREO_DFT_RES_GLOBAL_GAIN_BITS, max_bits ); +#endif } +#ifdef DEBUG_MODE_DFT + { + static FILE *resCodingSNR = NULL; + if ( resCodingSNR == NULL ) + resCodingSNR = fopen( "./res/resCodingSNR.txt", "w" ); + fprintf( resCodingSNR, "%d\t%d\t%f\n", STEREO_DFT_RES_GLOBAL_GAIN_BITS + total_bit_count, max_bits, max_snr ); + } +#endif pop_wmops(); +#ifdef DEBUG_MODE_DFT + { + int16_t tmp[1024]; + static float mem_win[STEREO_DFT_OVL_8k]; + float global_gain; + int16_t input_frame = L_FRAME8k; + float res_cod_error, res_cod_nrg, res_cod_snr; + + for ( i = 0; i < input_frame; i++ ) + { + tmp[i] = (int16_t) ( input_8k[i] + 0.5f ); + } + dbgwrite( &tmp, sizeof( int16_t ), input_frame, 1, "./res/stereo_dft_enc_res_original.pcm" ); + + if ( global_gain_index != ECSQ_GLOBAL_GAIN_INDEX_ALL_ZERO ) + { + global_gain = ECSQ_dequantize_gain( global_gain_index ); + } + else + { + global_gain = 0.f; + } + dbgwrite( &global_gain, sizeof( float ), 1, 1, "./res/stereo_dft_res_cod_gain.dat" ); + + tmp[0] = total_bit_count; + dbgwrite( &tmp, sizeof( int16_t ), 1, 1, "./res/stereo_dft_res_cod_bits.dat" ); + + dbgwrite( &( hStereoDft->res_cod_line_max ), sizeof( int16_t ), 1, 1, "./res/stereo_dft_res_cod_line.dat" ); + dbgwrite( &( hStereoDft->res_cod_band_max ), sizeof( int16_t ), 1, 1, "./res/stereo_dft_res_cod_band_max.dat" ); + dbgwrite( &( hStereoDft->res_cod_NRG_M ), sizeof( float ), hStereoDft->nbands, 1, "./res/stereo_dft_dmx_nrg.dat" ); + dbgwrite( &( hStereoDft->res_cod_NRG_S ), sizeof( float ), hStereoDft->nbands, 1, "./res/stereo_dft_res_nrg.dat" ); + + /*Compute coding SNR*/ + res_cod_nrg = EPSILON; + res_cod_error = EPSILON; + for ( i = 0; i < hStereoDft->res_cod_line_max; i++ ) + { + res_cod_nrg += MDCT_RES[i] * MDCT_RES[i]; + res_cod_error += ( MDCT_RES[i] - MDCT_RES_dec[i] ) * ( MDCT_RES[i] - MDCT_RES_dec[i] ); + } + + res_cod_snr = 10.f * log10f( res_cod_nrg / res_cod_error ); + dbgwrite( &( res_cod_snr ), sizeof( float ), 1, 1, "./res/stereo_dft_res_cod_snr.dat" ); + + /*IMDCT*/ + TCX_MDCT_Inverse( MDCT_RES_dec, win, STEREO_DFT_OVL_8k, L_FRAME8k - STEREO_DFT_OVL_8k, STEREO_DFT_OVL_8k, IVAS_CPE_DFT ); + + /*OLA*/ + /*overlapping parts*/ + for ( i = 0; i < STEREO_DFT_OVL_8k; i++ ) + { + win[i] = mem_win[i] + win[i] * hStereoDft->win_mdct_8k[i]; + mem_win[i] = win[input_frame + i] * hStereoDft->win_mdct_8k[STEREO_DFT_OVL_8k - 1 - i]; + } + for ( i = 0; i < input_frame; i++ ) + { + tmp[i] = (int16_t) ( win[i] + 0.5f ); + } + dbgwrite( tmp, sizeof( int16_t ), input_frame, 1, "./res/stereo_dft_enc_res_decoded.pcm" ); + } +#endif } +#ifdef DEBUG_MODE_DFT + { + int16_t input_frame = L_FRAME8k; + static FILE *bits_consumed = NULL; + if ( bits_consumed == NULL ) + bits_consumed = fopen( "./res/stereo_dft_bits_consumed.txt", "w" ); + + fprintf( bits_consumed, " %d \n", *nb_bits ); + dbgwrite( nb_bits, sizeof( int16_t ), 1, input_frame, "./res/stereo_dft_bits_consumed.dat" ); + } +#endif return; } @@ -1817,6 +2135,21 @@ void stereo_dft_enc_write_BS( BSTR_ENC_HANDLE hBstr; STEREO_DFT_ENC_DATA_HANDLE hStereoDft; int32_t core_brate; +#ifdef DEBUG_MODE_DFT + static FILE *ITD_values = NULL, *side_gain_values = NULL, *RPG_values = NULL; + static FILE *cum_freq_enc = NULL; + + if ( pF == NULL ) + pF = fopen( "./res/stereo_dft_enc_ind.txt", "w" ); + if ( ITD_values == NULL ) + ITD_values = fopen( "./res/itd_indicies_enc.txt", "w" ); + if ( side_gain_values == NULL ) + side_gain_values = fopen( "./res/side_gain_indicies_enc.txt", "w" ); + if ( RPG_values == NULL ) + RPG_values = fopen( "./res/rpg_indicies_enc.txt", "w" ); + if ( cum_freq_enc == NULL ) + cum_freq_enc = fopen( "./res/cum_freq_enc.txt", "w" ); +#endif /*------------------------------------------------------------------* * Initialization @@ -1874,8 +2207,19 @@ void stereo_dft_enc_write_BS( ( *nb_bits )++; hStereoDft->res_cod_band_max = dft_band_res_cod[hStereoDft->hConfig->band_res][hStereoDft->res_cod_mode[k_offset]]; hStereoDft->res_pred_band_min = max( STEREO_DFT_RES_PRED_BAND_MIN, hStereoDft->res_cod_band_max ); +#ifdef DEBUG_MODE_DFT + fprintf( pF, "res_cod_mode: %d\n", hStereoDft->res_cod_mode[k_offset] ); +#endif } +#ifdef DEBUG_MODE_DFT + fprintf( pF, "stereo Data: %d %d %d %d %d\n", hStereoDft->band_res[k_offset], 1, hStereoDft->res_pred_mode[k_offset], hStereoDft->res_cod_mode[k_offset], hStereoDft->res_cod_band_max ); + fprintf( pF, "stereo Bands: %d\n", hStereoDft->nbands ); + + dbgwrite( &( hStereoDft->nbands ), sizeof( int16_t ), 1, 1, "./res/stereo_dft_encBS_nbands.dat" ); + dbgwrite( &( hCPE->hCoreCoder[0]->bwidth ), sizeof( int16_t ), 1, 1, "./res/stereo_dft_encBS_bwidth.dat" ); + +#endif if ( nbands_full < hStereoDft->nbands ) { @@ -1901,6 +2245,9 @@ void stereo_dft_enc_write_BS( ( *nb_bits ) += STEREO_DFT_ITD_MODE_NBITS; /*ITD mode flag: 1bit*/ } +#ifdef DEBUG_MODE_DFT + fprintf( pF, "ITD: %d ", hStereoDft->hConfig->itd_mode && ( hStereoDft->hItd->itd[k_offset] != 0 ) ); +#endif if ( core_brate != SID_2k40 ) { if ( hStereoDft->hItd->itd[k_offset] ) @@ -1941,6 +2288,10 @@ void stereo_dft_enc_write_BS( ( *nb_bits ) += STEREO_DFT_ITD_NBITS + 1; } } +#ifdef DEBUG_MODE_DFT + fprintf( pF, "ITD: %d ", hStereoDft->hItd->itd_index[k_offset] ); + fprintf( ITD_values, "%d %d ", frame, hStereoDft->hItd->itd_index[k_offset] ); +#endif } } @@ -1967,6 +2318,13 @@ void stereo_dft_enc_write_BS( no_GR_ord = 3; +#ifdef DEBUG_MODE_DFT + for ( b = 0; b < hStereoDft->nbands; b++ ) + { + fprintf( pF, "Side gain: %d ", hStereoDft->side_gain_index_EC[b] ); + fprintf( side_gain_values, " %d ", hStereoDft->side_gain_index_EC[b] ); + } +#endif if ( hStereoDft->side_gain_flag_1 == 0 ) { nb += write_bitstream_adapt_GR( hBstr, IND_STEREO_DFT_SIDEGAINS, encoded_ind_GR, hStereoDft->nbands, hStereoDft->side_gain_flag_2, no_GR_ord ); @@ -2052,6 +2410,10 @@ void stereo_dft_enc_write_BS( ( *nb_bits ) += STEREO_DFT_SID_ITD_NBITS + 1; } +#ifdef DEBUG_MODE_DFT + fprintf( pF, "ITD: %d ", hStereoDft->hItd->itd_index[k_offset] ); + fprintf( ITD_values, "%d %d ", frame, hStereoDft->hItd->itd_index[k_offset] ); +#endif } } } @@ -2108,6 +2470,9 @@ void stereo_dft_enc_write_BS( /*read flag*/ push_indice( hBstr, IND_STEREO_DFT_REVERB_MODE, hStereoDft->reverb_flag, STEREO_DFT_REVERB_MODE_NBITS ); nb += STEREO_DFT_REVERB_MODE_NBITS; +#ifdef DEBUG_MODE_DFT + fprintf( RPG_values, " reverb_flag %d ", hStereoDft->reverb_flag ); +#endif if ( hStereoDft->reverb_flag ) { nbands -= STEREO_DFT_RES_PRED_BAND_MIN_CONST; @@ -2129,6 +2494,9 @@ void stereo_dft_enc_write_BS( no_GR_ord = 2; if ( hStereoDft->res_pred_flag_1 == 0 ) { +#ifdef DEBUG_MODE_DFT + fprintf( RPG_values, "flag: 0" ); +#endif if ( encoded_ind_pred_GR[0] == dft_maps_rpg[8 * NO_SYMB_GR_PRED_G] ) { nb += write_GR1( hBstr, IND_STEREO_DFT_PRED_GAIN_COD, encoded_ind_pred_GR, 1 ); @@ -2142,10 +2510,16 @@ void stereo_dft_enc_write_BS( { if ( hStereoDft->res_pred_flag_1 == 2 ) { +#ifdef DEBUG_MODE_DFT + fprintf( RPG_values, "flag: 2" ); +#endif nb += write_bitstream_GR( hBstr, IND_STEREO_DFT_PRED_GAIN_COD, &hStereoDft->res_pred_index_ECDiff[hStereoDft->res_pred_band_min], nbands - hStereoDft->res_pred_band_min, hStereoDft->res_pred_flag_2 - no_GR_ord ); } else { +#ifdef DEBUG_MODE_DFT + fprintf( RPG_values, "flag: 1" ); +#endif for ( b = hStereoDft->res_pred_band_min; b < nbands; b++ ) { push_indice( hBstr, IND_STEREO_DFT_PRED_GAIN_COD, hStereoDft->res_pred_index_EC[b], STEREO_DFT_RES_GAINS_BITS ); @@ -2154,6 +2528,20 @@ void stereo_dft_enc_write_BS( } } +#ifdef DEBUG_MODE_DFT + for ( b = hStereoDft->res_pred_band_min; b < nbands; b++ ) + { + fprintf( pF, "Res pred values: %d ", hStereoDft->res_pred_index_EC[b] ); + if ( hStereoDft->res_pred_flag_1 == 2 ) + { + fprintf( RPG_values, " %d(%d) ", hStereoDft->res_pred_index_EC[b], hStereoDft->res_pred_index_EC[b] + ( ( hStereoDft->res_pred_index_ECDiff[b] % 2 ) ? -( hStereoDft->res_pred_index_ECDiff[b] + 1 ) / 2 : ( hStereoDft->res_pred_index_ECDiff[b] ) / 2 ) ); + } + else + { + fprintf( RPG_values, " %d ", hStereoDft->res_pred_index_EC[b] ); + } + } +#endif } else { @@ -2172,6 +2560,13 @@ void stereo_dft_enc_write_BS( stereo_dft_enc_sid_coh( hBstr, hCPE->hStereoCng->mem_cohBand, hStereoDft->nbands, nb_bits, cohBand ); } +#ifdef DEBUG_MODE_DFT + /*fprintf(pF, "Total bits: %d", (*nb_bits));*/ + fprintf( pF, "\n" ); + fprintf( ITD_values, "\n" ); + fprintf( side_gain_values, "\n" ); + fprintf( RPG_values, "\n" ); +#endif return; } @@ -2250,6 +2645,10 @@ static void stereo_dft_enc_compute_prm( sum_dot_prod_real = EPSILON; sum_dot_prod_img = EPSILON; sub_nrg_DMX2 = 0.f; +#ifdef DEBUG_MODE_DFT + sum_nrg_L = EPSILON; + sum_nrg_R = EPSILON; +#endif /*------------------------------------------------------------------* * Band-wise processing @@ -2471,13 +2870,40 @@ static void stereo_dft_enc_compute_prm( hStereoDft->nrg_past_pos = ( pos + 1 ) % STEREO_DFT_NRG_PAST_LEN; +#ifdef DEBUG_MODE_DFT + { + float tmp_f; + dbgwrite( pPredGain, sizeof( float ), hStereoDft->nbands, 1, "./res/stereo_dft_gainPred.pcm" ); + dbgwrite( pSideGain, sizeof( float ), hStereoDft->nbands, 1, "./res/stereo_dft_gainSide.pcm" ); + + for ( i = 0; i < hStereoDft->nbands; i++ ) + { + float regularization; + + regularization = ( hStereoDft->band_limits[i + 1] - hStereoDft->band_limits[i] ) * sqrtf( hStereoDft->NFFT ); + tmp_f = sub_nrg_DMX[i] / ( regularization * regularization ); + dbgwrite( &tmp_f, sizeof( float ), 1, 1, "./res/stereo_dft_nrgDMX.pcm" ); + + g = sqrtf( sum_nrg_L / sum_nrg_R ); + tmp_f = ( g - 1 ) / ( g + 1 ); + dbgwrite( &tmp_f, sizeof( float ), 1, 1, "./res/stereo_dft_gainILD.pcm" ); + } + } +#endif /*------------------------------------------------------------------* * Compute IPDs *-----------------------------------------------------------------*/ +#ifdef DEBUG_MODE_DFT + stereo_dft_enc_get_nipd_flag( hStereoDft, pgIpd, sp_aud_decision0, gain_IPD ); +#else stereo_dft_enc_get_nipd_flag( hStereoDft, sp_aud_decision0, gain_IPD ); +#endif +#ifdef DEBUG_MODE_DFT + hStereoDft->no_ipd_flag = ( hStereoDft->hConfig->gipd_mode == 0 ) ? 1 : hStereoDft->no_ipd_flag; +#endif if ( flag_quant ) { @@ -2602,7 +3028,16 @@ static void stereo_dft_enc_compute_prm( hStereoDft->res_pred_index_EC[b - STEREO_DFT_RES_PRED_BAND_MIN_CONST] = hStereoDft->res_pred_index_EC[b]; } } +#ifdef DEBUG_MODE_DFT + if ( hStereoDft->reverb_flag ) + { + dbgwrite( &ipred, sizeof( ipred ), 1, 1, "./res/stereo_dft_enc_ipred" ); + } +#endif } +#ifdef DEBUG_MODE_DFT + dbgwrite( &( hStereoDft->reverb_flag ), sizeof( int16_t ), 1, 640, "./res/stereo_dft_reverb_flag2.pcm" ); +#endif assert( hStereoDft->nbands <= 13 ); /* always use band_limits_erb4 and not band_limits_erb2 */ @@ -2824,6 +3259,10 @@ static float stereo_dft_calc_mean_bipd( } ipd_buf[STEREO_DFT_IPD_BUF_LEN - 1] = *pIpd; +#ifdef DEBUG_MODE_DFT + dbgwrite( pIpd, sizeof( float ), 1, 1, "res/stereo_dft_bipd.pcm" ); + dbgwrite( &ipd_smooth, sizeof( float ), 1, 1, "res/stereo_dft_bipd_smooth.pcm" ); +#endif return ipd_smooth; } @@ -2857,6 +3296,10 @@ static float stereo_dft_calc_mean_ipd_change( } ipd_mean_change /= gipd_band_max; +#ifdef DEBUG_MODE_DFT + dbgwrite( ipd_change, sizeof( float ), hStereoDft->gipd_band_max, 1, "res/stereo_dft_ipd_change.pcm" ); + dbgwrite( &ipd_mean_change, sizeof( float ), 1, 1, "res/stereo_dft_ipd_mean_change.pcm" ); +#endif return ipd_mean_change; } @@ -2933,6 +3376,9 @@ static void stereo_dft_gipd_stabilization( static void stereo_dft_enc_get_nipd_flag( STEREO_DFT_ENC_DATA_HANDLE hStereoDft, +#ifdef DEBUG_MODE_DFT + float *pgIpd, +#endif const int16_t sp_aud_decision0, const float gainIPD ) { @@ -2945,6 +3391,15 @@ static void stereo_dft_enc_get_nipd_flag( hStereoDft->no_ipd_flag = 1; /* Set the flag */ } +#ifdef DEBUG_MODE_DFT + { + int16_t tmp; + dbgwrite( &( hStereoDft->no_ipd_flag ), sizeof( int16_t ), 1, 640, "./res/stereo_dft_nipd_first.pcm" ); + tmp = (int16_t) ( hStereoDft->gainIPD_sm * 100.f ); + dbgwrite( &tmp, sizeof( int16_t ), 1, 640, "./res/stereo_dft_gipd_gain_IPD.pcm" ); + dbgwrite( pgIpd, sizeof( float ), 1, 1, "./res/stereo_dft_gipd_IPD.pcm" ); + } +#endif /* hangover between the group IPD and subband IPD */ if ( hStereoDft->prev_no_ipd_flag != hStereoDft->no_ipd_flag && hStereoDft->no_ipd_cnt < 5 ) @@ -2959,6 +3414,10 @@ static void stereo_dft_enc_get_nipd_flag( hStereoDft->prev_no_ipd_flag = hStereoDft->no_ipd_flag; /* Save the no IPD flag for the next frame */ +#ifdef DEBUG_MODE_DFT + /*fprintf(pF2, "%d\n",hStereoDft->no_ipd_flag);*/ + dbgwrite( &( hStereoDft->no_ipd_flag ), sizeof( int16_t ), 1, 640, "./res/stereo_dft_nipd_final.pcm" ); +#endif return; } @@ -3118,6 +3577,9 @@ static void stereo_dft_enc_get_reverb_flag( } } +#ifdef DEBUG_MODE_DFT + dbgwrite( &( hStereoDft->reverb_flag ), sizeof( int16_t ), 1, 640, "./res/stereo_dft_reverb_flag.pcm" ); +#endif return; } diff --git a/lib_enc/ivas_stereo_dft_enc_itd.c b/lib_enc/ivas_stereo_dft_enc_itd.c index 2d43e3d30..d3336f4eb 100644 --- a/lib_enc/ivas_stereo_dft_enc_itd.c +++ b/lib_enc/ivas_stereo_dft_enc_itd.c @@ -42,6 +42,9 @@ #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "ivas_rom_enc.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -1060,6 +1063,12 @@ void stereo_dft_enc_compute_itd( hStereoClassif->unclr_fv[E_sum_xcorr] = sum_xcorr; hStereoClassif->xtalk_fv[E_sum_xcorr] = sum_xcorr; +#if defined( DEBUG_MODE_DFT ) || defined( DEBUG_MODE_TD ) + dbgwrite( &hStereoClassif->unclr_fv[E_cohSNR], sizeof( float ), 1, 1, "res/stereo_clf_cohSNR.x" ); + dbgwrite( &hStereoClassif->unclr_fv[E_es_em], sizeof( float ), 1, 1, "res/stereo_clf_es_em.x" ); + dbgwrite( &hStereoClassif->unclr_fv[E_d_prodL_prodR], sizeof( float ), 1, 1, "res/stereo_clf_d_prodL_prodR.x" ); + dbgwrite( &hStereoClassif->unclr_fv[E_sum_xcorr], sizeof( float ), 1, 1, "res/stereo_clf_sum_xcorr.x" ); +#endif } /* reset estimates when silence is detected*/ @@ -1092,6 +1101,9 @@ void stereo_dft_enc_compute_itd( mvr2r( &xcorr_itd[STEREO_DFT_N_32k_ENC / 2 - XTALK_PHAT_LEN], gcc_phat, 2 * XTALK_PHAT_LEN + 1 ); +#ifdef DEBUG_MODE_DFT + dbgwrite( gcc_phat, sizeof( float ), 2 * XTALK_PHAT_LEN + 1, 1, "res/gcc_phat" ); +#endif thres = peak_detect( xcorr_itd, &tmpf1, &index, &zero_itd, cohSNR, hCPE->hCoreCoder[0]->vad_flag, &second_max, &second_max_lag, hItd->prev_itd, flag_noisy_speech_snr, hItd->detected_itd_flag, &hItd->prev_max, &hItd->prev_index, &hItd->prev_avg_max, &total_max ); @@ -1105,13 +1117,38 @@ void stereo_dft_enc_compute_itd( hStereoClassif->unclr_fv[E_xcorr_itd_value] = total_max; hStereoClassif->xtalk_fv[E_xcorr_itd_value] = total_max; +#if defined( DEBUG_MODE_DFT ) || defined( DEBUG_MODE_TD ) + { + int16_t stmp = index - STEREO_DFT_ITD_MAX_ANA; + dbgwrite( &stmp, sizeof( int16_t ), 1, 1, "res/raw_itd.x" ); + } + dbgwrite( &hStereoClassif->unclr_fv[E_xcorr_itd_value], sizeof( float ), 1, 1, "res/stereo_clf_raw_itd.x" ); +#endif + +#ifdef DEBUG_MODE_DFT + { + int16_t tmp; + tmp = (int16_t) ( tmpf1 * 100.f / thres ); + dbgwrite( &tmp, sizeof( int16_t ), 1, input_frame, "./res/stereo_dft_itd_thres0.pcm" ); + } +#endif /*for tonal music items increase thresholing by a factor up to 2.*/ if ( hCPE->hCoreCoder[0]->sp_aud_decision0 && ( index - STEREO_DFT_ITD_MAX_ANA ) != hItd->prev_itd && !flag_noisy_speech_snr && hCPE->hCoreCoder[0]->vad_flag && tmpf1 < 0.3 ) { thres *= 1.0f + 1.f * min( 1.f, max( 0.f, ( -1.0f * sfm_L + 0.5f ) / ( 0.5f - 0.2f ) ) ); } +#ifdef DEBUG_MODE_DFT + { + int16_t tmp; + + tmp = (int16_t) ( sfm_L * 100.f ); + dbgwrite( &tmp, sizeof( int16_t ), 1, input_frame, "./res/stereo_dft_itd_sfm.pcm" ); + tmp = (int16_t) ( tmpf1 * 100.f / thres ); + dbgwrite( &tmp, sizeof( int16_t ), 1, input_frame, "./res/stereo_dft_itd_thres.pcm" ); + } +#endif itd_cal_flag = 0; /*smooth threshold value depending on sfm for music items*/ @@ -1310,6 +1347,9 @@ void stereo_dft_enc_compute_itd( /* collect UNCLR classifier parameters */ hStereoClassif->unclr_fv[E_ITD] = hItd->itd[k_offset]; +#if defined( DEBUG_MODE_DFT ) || defined( DEBUG_MODE_TD ) + dbgwrite( &hItd->itd[k_offset], sizeof( float ), 1, 1, "res/stereo_clf_ITD.x" ); +#endif /* limit ITD range for MDCT stereo even more */ if ( hCPE->element_mode == IVAS_CPE_MDCT && fabsf( hItd->itd[k_offset] ) > ITD_MAX_MDCT ) @@ -1338,6 +1378,20 @@ void stereo_dft_enc_compute_itd( hItd->hybrid_itd_max = -1; } +#ifdef DEBUG_MODE_DFT + { + int16_t tmp; + static FILE *log_fid = NULL; + + tmp = (int16_t) hItd->itd[k_offset]; + dbgwrite( &tmp, sizeof( int16_t ), 1, input_frame, "./res/stereo_dft_itd_combined_fc.pcm" ); + dbgwrite( &tmp, sizeof( int16_t ), 1, input_frame, "./res/stereo_dft_itd_combined_fc.txt" ); + + if ( log_fid == NULL ) + log_fid = fopen( "./res/itd_log_td_itd.txt", "w" ); + fprintf( log_fid, "frame: %d\t itd: %f\t td_itd: %d\t delta_itd: %f\n", frame, hItd->itd[1], (int16_t) hItd->td_itd[1], hItd->deltaItd[1] ); + } +#endif return; } diff --git a/lib_enc/ivas_stereo_dft_td_itd.c b/lib_enc/ivas_stereo_dft_td_itd.c index ce5553518..ee37e924d 100644 --- a/lib_enc/ivas_stereo_dft_td_itd.c +++ b/lib_enc/ivas_stereo_dft_td_itd.c @@ -41,6 +41,12 @@ #include "ivas_rom_com.h" #include "ivas_stat_enc.h" #include "ivas_cnst.h" +#ifdef DEBUGGING +#include "debug.h" +#endif +#ifdef DEBUG_PLOT +#include "deb_out.h" +#endif #include "wmc_auto.h" @@ -229,6 +235,9 @@ void stereo_td_itd( ITD_DATA *hITD, /* i/o: ITD data structure */ float input_mem_itd[CPE_CHANNELS][STEREO_DFT_OVL_MAX], /* o : ITD memory (only used in DFT Stereo) */ const int16_t hybrid_itd_flag, /* i : flag for hybrid TD/FD ITD processing */ +#ifdef DEBUG_MODE_DFT + const int16_t itd_mode, /* i : main ITD processing flag */ +#endif const int16_t dft_ovl, /* i : size of DFT overlap */ Encoder_State **sts, /* i/o: Encoder state structure */ const int16_t input_frame, /* i : input frame length */ @@ -275,6 +284,9 @@ void stereo_td_itd( stereo_td_get_td_itd( &( hITD->td_itd[k_offset] ), &( hITD->td_itd_32k[k_offset] ), hITD->itd[k_offset], sts[0]->input_Fs ); /* initializations*/ +#ifdef DEBUG_MODE_DFT + if ( itd_mode ) +#endif { size_ovl = dft_ovl; @@ -346,6 +358,25 @@ void stereo_td_itd( } } +#ifdef DEBUG_MODE_DFT + { + int16_t tmp[L_FRAME48k]; + + for ( i = 0; i < input_frame; i++ ) + { + tmp[i] = (int16_t) ( sts[0]->input[i] + 0.5f ); + } + + dbgwrite( tmp, sizeof( int16_t ), input_frame, 1, "./res/td_shifted_signal_ch0.pcm" ); + + for ( i = 0; i < input_frame; i++ ) + { + tmp[i] = (int16_t) ( sts[1]->input[i] + 0.5f ); + } + + dbgwrite( tmp, sizeof( int16_t ), input_frame, 1, "./res/td_shifted_signal_ch1.pcm" ); + } +#endif return; } @@ -390,7 +421,11 @@ void stereo_td_itd_mdct_stereo( stereo_dft_enc_compute_itd( hCPE, DFT[0], DFT[1], STEREO_DFT_OFFSET, input_frame, vad_flag_dtx, vad_hover_flag, bin_nrgL, bin_nrgR ); /* Time Domain ITD compensation using extrapolation */ +#ifdef DEBUG_MODE_DFT + stereo_td_itd( hStereoMdct->hItd, NULL, 1, 1, hStereoMdct->hDft_ana->dft_ovl, hCPE->hCoreCoder, input_frame, hCPE->input_mem ); +#else stereo_td_itd( hStereoMdct->hItd, NULL, 1, hStereoMdct->hDft_ana->dft_ovl, hCPE->hCoreCoder, input_frame, hCPE->input_mem ); +#endif } return; diff --git a/lib_enc/ivas_stereo_dmx_evs.c b/lib_enc/ivas_stereo_dmx_evs.c index 5ac6fe180..2ffc13d75 100644 --- a/lib_enc/ivas_stereo_dmx_evs.c +++ b/lib_enc/ivas_stereo_dmx_evs.c @@ -40,6 +40,9 @@ #include "ivas_prot.h" #include "ivas_rom_com.h" #include "ivas_rom_enc.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_enc/ivas_stereo_eclvq_enc.c b/lib_enc/ivas_stereo_eclvq_enc.c index 663101ca4..f71beece8 100644 --- a/lib_enc/ivas_stereo_eclvq_enc.c +++ b/lib_enc/ivas_stereo_eclvq_enc.c @@ -82,6 +82,10 @@ void ECSQ_quantize_vector( { int16_t i; float inv_global_gain; +#ifdef DEBUGGING + assert( N > 0 ); + assert( global_gain > 0.0f ); +#endif inv_global_gain = 1.0f / global_gain; for ( i = 0; i < N; ++i ) @@ -108,6 +112,9 @@ float ECSQ_compute_optimal_gain( float sum_sq_output; float sum_input_output; float optimal_global_gain; +#ifdef DEBUGGING + assert( N > 0 ); +#endif sum_sq_output = 0.0f; sum_input_output = 0.0f; @@ -137,6 +144,9 @@ static int16_t ECSQ_quantize_gain( { int16_t index; +#ifdef DEBUGGING + assert( global_gain > 0.0f ); +#endif global_gain = max( global_gain, 1.0f ); /* because always index >= 0 anyway */ @@ -167,6 +177,10 @@ static void arith_encode_bit( RangeUniEncState *rc_st_enc; rc_st_enc = (RangeUniEncState *) ecsq_inst->ac_handle; +#ifdef DEBUGGING + assert( bit >= 0 ); + assert( bit < 2 ); +#endif ecsq_inst->bit_count_estimate += 1024; /* 1024 eq 1 << 10, 22Q10 fixed-point representation */ @@ -193,6 +207,9 @@ static void arith_encode_bits( RangeUniEncState *rc_st_enc; rc_st_enc = (RangeUniEncState *) ecsq_inst->ac_handle; +#ifdef DEBUGGING + assert( n < ( 1 << size ) ); +#endif ecsq_inst->bit_count_estimate += size << 10; /* 22Q10 fixed-point representation */ @@ -218,6 +235,10 @@ static int16_t code_length_from_count( /* with c in {1, ..., 2 ^ 14}, representing a probability count in 14-bit AC implementations */ int16_t c_norm; int16_t res; +#ifdef DEBUGGING + assert( c >= 1 ); + assert( c <= ( 1 << 14 ) ); +#endif #define WMC_TOOL_SKIP c_norm = norm_s( (int16_t) c ); /* equivalent with 14 - floor(log_base2(c)) */ @@ -227,6 +248,10 @@ static int16_t code_length_from_count( /* normalize to {16384, ..., 32767}, subtract MSB bit, and convert to Q6 for indexing log2_1px_table */ res = ( c_norm << 10 ) - log2_1px_table[( ( c << c_norm ) - ( 1 << 14 ) + ( 1 << 7 ) ) >> 8]; +#ifdef DEBUGGING + assert( res >= 0 ); /* for c == 1 */ + assert( res <= 14 * ( 1 << 10 ) ); /* for c == 16384 */ +#endif /* |(14 - log2(c)) - res / (1 << 10)| < 0.0113, for c in {1, ..., 2 ^ 14} */ /* complexity: 1 norm_s, 2 adds, 3 shifts, 1 table lookup */ @@ -248,6 +273,12 @@ static void arith_encode_bit_prob( RangeUniEncState *rc_st_enc; rc_st_enc = (RangeUniEncState *) ecsq_inst->ac_handle; +#ifdef DEBUGGING + assert( bit >= 0 ); + assert( bit < 2 ); + assert( count0 >= 1 ); + assert( count0 <= ECSQ_PROB_TOTAL - 1 ); +#endif count = ECSQ_PROB_TOTAL - count0; @@ -284,9 +315,18 @@ static void arith_encode_prob( rc_st_enc = (RangeUniEncState *) ecsq_inst->ac_handle; +#ifdef DEBUGGING + assert( symbol < table_size ); + assert( table[symbol] <= ( 1 << 14 ) ); +#else count = table_size; /* just to avoid warning when DEBUGGING is deactivated */ +#endif count = table[symbol] - table[symbol + 1]; +#ifdef DEBUGGING + assert( count >= 1 ); + assert( count <= ( 1 << 14 ) ); +#endif ecsq_inst->bit_count_estimate += code_length_from_count( count ); /* 22Q10 fixed-point representation */ @@ -310,6 +350,10 @@ static void arith_encode_elias_mod( const int16_t n ) { int16_t i; +#ifdef DEBUGGING + assert( n >= 0 ); + /* n is already limited by the data type int16_t, so n_bits = floor(log_2(n)) <= 14 */ +#endif if ( n <= 1 ) { @@ -389,10 +433,16 @@ static int16_t get_best_param( sum_abs = 0; count = stop_offset - start_offset + 1; count0 = 0; +#ifdef DEBUGGING + assert( count > 0 ); +#endif /* compute sum(abs(x[v])) and sum(x[v] == 0) */ for ( v = start_offset; v <= stop_offset; ++v ) { +#ifdef DEBUGGING + assert( abs( x[v] ) <= MAX16B ); +#endif val = x[v]; sum_abs += abs( val ); @@ -402,6 +452,9 @@ static int16_t get_best_param( } } +#ifdef DEBUGGING + assert( sum_abs <= count * MAX16B ); +#endif /* the vector has at most ECSQ_NONZERO_MAX values of +-1 and the rest are zeros */ if ( ( count - count0 <= ECSQ_NONZERO_MAX ) && ( sum_abs == count - count0 ) ) @@ -455,6 +508,9 @@ static float get_est_size( index = param - ECSQ_log2TB_FIRST_PARAM; index = min( index, ECSQ_log2TB_SIZE - 2 ); +#ifdef DEBUGGING + assert( index >= 0 ); +#endif /* the estimated size in bits is N * log2(2 * 2 ^ param) + */ /* + N * log2(e) * (avg_abs_sum / 2 ^ param) - (N - N0) * log2(T(2 ^ param)) - */ @@ -525,6 +581,14 @@ static int32_t ECSQ_encode_raw( bit_count_estimate_initial = ecsq_inst->bit_count_estimate; +#ifdef DEBUGGING + assert( N > 0 ); + assert( ECSQ_ALL_ZERO_PARAM == -1 ); /* other values need code and table adjustments */ + assert( ( ecsq_inst->config_index >= 1 ) && ( ecsq_inst->config_index < ECSQ_CONFIG_COUNT ) ); + + /* ensure we are using target SNR configurations, disable target bits configurations for the moment */ + assert( ( ecsq_inst->config_index == 1 ) || ( ecsq_inst->config_index == 3 ) || ( ecsq_inst->config_index == 5 ) ); +#endif total_size = 0.0f; segment_count = ( N + ECSQ_SEGMENT_SIZE - 1 ) / ECSQ_SEGMENT_SIZE; @@ -639,6 +703,10 @@ static int32_t ECSQ_encode_raw( { nonzero = seg_length - saved_seg_count0[segment]; +#ifdef DEBUGGING + assert( ECSQ_NONZERO_MAX == 3 ); + assert( nonzero <= ECSQ_NONZERO_MAX ); +#endif arith_encode_bits( ecsq_inst, nonzero, 2 ); /* log_base2(ECSQ_NONZERO_MAX + 1) == 2 */ @@ -650,12 +718,21 @@ static int32_t ECSQ_encode_raw( val = input[i]; sym = (int16_t) abs( val ); +#ifdef DEBUGGING + assert( sym <= 1 ); +#endif if ( left1 == 0 ) { +#ifdef DEBUGGING + assert( sym == 0 ); +#endif } else if ( left0 == 0 ) { +#ifdef DEBUGGING + assert( sym == 1 ); +#endif } else { @@ -676,6 +753,18 @@ static int32_t ECSQ_encode_raw( } } +#ifdef DEBUGGING + DEBUG_LINE( 1 ) + { + static FILE *tolf = NULL; + if ( tolf == NULL ) + { + tolf = fopen( "tolerance.txt", "wt" ); + } + fprintf( tolf, "%8.3f %8.3f\n", ( ecsq_inst->bit_count_estimate - bit_count_estimate_initial ) / 1024.0, ( ecsq_inst->bit_count_estimate - bit_count_estimate_initial ) / 1024.0 - total_size ); + fflush( tolf ); + } +#endif return ecsq_inst->bit_count_estimate - bit_count_estimate_initial; } @@ -713,6 +802,10 @@ int32_t ECSQ_encode_target_SNR( int32_t max_bits_fixpt; float sum_squared, target_ratio, target_sum_squared_error; const float global_gain_step = powf( 10.0f, ECLVQ_INV_GLOBAL_GAIN_FACTOR ); +#ifdef DEBUGGING + int16_t j; + assert( N > 0 ); +#endif max_bits_fixpt = max_bits * 1024; /* max_bits_fixpt is in 22Q10 fixed-point representation */ @@ -769,6 +862,10 @@ int32_t ECSQ_encode_target_SNR( ECSQ_quantize_vector( input, global_gain, N, quantized_input ); test_size = ECSQ_encode_raw( ecsq_inst, quantized_input, N ); +#ifdef DEBUGGING + DEBUG_LINE( 1 ) + printf( "global_gain_index[0] %3d global_gain %9.3f test_size %9d max_bits %9d\n", global_gain_index, global_gain, test_size, max_bits_fixpt ); +#endif ++iteration; while ( ( test_size > max_bits_fixpt ) && ( iteration < ECSQ_MAX_BITS_ITERATIONS ) ) @@ -783,12 +880,20 @@ int32_t ECSQ_encode_target_SNR( ECSQ_quantize_vector( input, global_gain, N, quantized_input ); test_size = ECSQ_encode_raw( ecsq_inst, quantized_input, N ); +#ifdef DEBUGGING + DEBUG_LINE( 1 ) + printf( "global_gain_index[%d] %3d global_gain %9.3f test_size %9d max_bits %9d\n", iteration, global_gain_index, global_gain, test_size, max_bits_fixpt ); +#endif ++iteration; } if ( test_size > max_bits_fixpt ) { +#ifdef DEBUGGING + DEBUG_LINE( 1 ) + printf( "test_size %9d still larger than max_bits %9d, incrementing global_gain_index\n", test_size, max_bits_fixpt ); +#endif /* further increase the quantization step with the smallest increment for global_gain_index */ global_gain_index = (int16_t) min( global_gain_index + 1, 126 ); } @@ -821,6 +926,26 @@ int32_t ECSQ_encode_target_SNR( global_gain_index = ECSQ_quantize_gain( global_gain ); *global_gain_index_output = global_gain_index; +#ifdef DEBUGGING + DEBUG_LINE( 1 ) + { + float actual_sum_squared_error; + float delta_global_gain_index; + actual_sum_squared_error = 0.0f; + + /* compute the actual sum squared quantization error */ + global_gain = ECSQ_dequantize_gain( global_gain_index ); + for ( j = 0; j < N; ++j ) + { + float error; + error = input[j] - (float) quantized_input[j] * global_gain; + + actual_sum_squared_error += error * error; + } + delta_global_gain_index = (float) ( log( target_sum_squared_error / actual_sum_squared_error ) / ( 2.0f * log( global_gain_step ) ) ); + printf( "global_gain_index %3d global_gain %9.3f target_SSE %13.6e actual_SSE %13.6e delta_global_gain_index %9.3f\n", global_gain_index, global_gain, target_sum_squared_error, actual_sum_squared_error, delta_global_gain_index ); + } +#endif if ( output != NULL ) { diff --git a/lib_enc/ivas_stereo_ica_enc.c b/lib_enc/ivas_stereo_ica_enc.c index 4d698dfde..4cdd1c2fc 100644 --- a/lib_enc/ivas_stereo_ica_enc.c +++ b/lib_enc/ivas_stereo_ica_enc.c @@ -38,6 +38,9 @@ #include "ivas_cnst.h" #include "prot.h" #include "ivas_prot.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" #include "rom_com.h" #include "ivas_rom_com.h" @@ -928,6 +931,9 @@ void stereo_tca_enc( hStereoTCA->corrStatsSmoothFac = 0.7f; estDownmixGain( hStereoTCA, ptrChanL, ptrChanR, 0, input_frame, hCPE->element_mode, NULL, 0 ); hStereoTCA->prevTargetGain = hStereoTCA->targetGain; +#ifdef DEBUG_MODE_INFO + hStereoTCA->indx_ica_NCShift = 0; +#endif /* back up the L/R missing target */ mvr2r( bufChanL + input_frame, hStereoTCA->memChanL, lMemRecalc + lMemRecalc_SCh ); @@ -1121,6 +1127,13 @@ void stereo_tca_enc( tempS = ( currentNCShift >> 1 ); if ( abs( currentNCShift - prevNCShift ) <= min( N_MAX_SHIFT_CHANGE, N_MAX_SHIFT_CHANGE * input_Fs / 32000.0f ) ) { +#ifdef DEBUGGING + /* Max sample looked in INTERP1 should lie within the bounds of input_frame and memory populated */ + assert( ( ( abs( currentNCShift - prevNCShift ) + 1 ) + SINC_ORDER1 / INTERP_FACTOR1 ) + L_shift_adapt - tempS < input_frame ); + assert( ( ( abs( currentNCShift - prevNCShift ) + 1 ) + SINC_ORDER1 / INTERP_FACTOR1 + tempS ) < L_NCSHIFTMAX ); + assert( tempS + currentNCShift <= lMemRecalc ); + assert( input_frame - ( min( N_MAX_SHIFT_CHANGE, ( N_MAX_SHIFT_CHANGE * input_Fs ) / 32000 ) + 1 + SINC_ORDER1 / INTERP_FACTOR1 ) - ( prevNCShift >> 1 ) >= L_shift_adapt - tempS ); +#endif adjustTargetSignal( ( target - tempS ), prevNCShift, currentNCShift, L_shift_adapt, 0 ); } else diff --git a/lib_enc/ivas_stereo_icbwe_enc.c b/lib_enc/ivas_stereo_icbwe_enc.c index d4d70a344..e7b40e3ba 100644 --- a/lib_enc/ivas_stereo_icbwe_enc.c +++ b/lib_enc/ivas_stereo_icbwe_enc.c @@ -40,6 +40,9 @@ #include "wmc_auto.h" #include "rom_com.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif /*-------------------------------------------------------------------* * ic_bwe_enc_reset() diff --git a/lib_enc/ivas_stereo_mdct_core_enc.c b/lib_enc/ivas_stereo_mdct_core_enc.c index 579438a3f..d74f21d8e 100644 --- a/lib_enc/ivas_stereo_mdct_core_enc.c +++ b/lib_enc/ivas_stereo_mdct_core_enc.c @@ -38,6 +38,9 @@ #include "prot.h" #include "ivas_prot.h" #include "rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" /*-------------------------------------------------------------------* @@ -186,7 +189,14 @@ void stereo_mdct_core_enc( if ( hCPE->hCoreCoder[0]->igf ) { +#ifdef DEBUGGING + int16_t orig_mdct_stereo_mode_cmdl = hCPE->hStereoMdct->mdct_stereo_mode_cmdl; + hCPE->hStereoMdct->mdct_stereo_mode_cmdl = SMDCT_MS_DECISION; +#endif initMdctStereoEncData( hCPE->hStereoMdct, STEREO_FORMAT, IVAS_CPE_MDCT, hCPE->element_brate, hCPE->hCoreCoder[0]->bwidth, hCPE->hCoreCoder[0]->igf, hCPE->hCoreCoder[0]->hIGFEnc->igfData.igfInfo.grid, 0 ); +#ifdef DEBUGGING + hCPE->hStereoMdct->mdct_stereo_mode_cmdl = orig_mdct_stereo_mode_cmdl; +#endif stereo_mdct_init_igf_start_band( &( hCPE->hStereoMdct->stbParamsTCX20 ), 1.0f, hCPE->hCoreCoder[0]->bwidth, hCPE->element_brate ); stereo_mdct_init_igf_start_band( &( hCPE->hStereoMdct->stbParamsTCX10 ), 0.5f, hCPE->hCoreCoder[0]->bwidth, hCPE->element_brate ); @@ -305,6 +315,10 @@ void stereo_mdct_core_enc( st = sts[ch]; nSubframes = ( st->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; L_subframeTCX = st->hTcxEnc->L_frameTCX / nSubframes; +#ifdef DEBUG_MODE_MDCT + dbgwrite( powerSpec[ch], sizeof( float ), 640, 1, "./res/powerSpec" ); + +#endif if ( st->last_core == ACELP_CORE ) { L_subframeTCX += L_subframeTCX / 4; @@ -384,8 +398,15 @@ void stereo_mdct_core_enc( /*write IGF data to bitstream*/ for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { +#ifdef DEBUG_PLOT_BITS + int16_t tmp = hBstr->nb_bits_tot; +#endif st = sts[ch]; enc_prm_igf_mdct( st, hBstr ); +#ifdef DEBUG_PLOT_BITS + tmp = hBstr->nb_bits_tot - tmp; + dbgwrite( &tmp, sizeof( int16_t ), 1, 1, "./res/bits_IGF" ); +#endif } } @@ -416,6 +437,9 @@ void stereo_mdct_core_enc( nAvailBits -= SMDCT_NBBITS_SPLIT_RATIO; splitAvailableBits( nAvailBits, hStereoMdct->split_ratio, hStereoMdct->isSBAStereoMode, &sts[0]->bits_frame_channel, &sts[1]->bits_frame_channel ); +#ifdef DEBUG_MODE_MDCT + dbgwrite( &nAvailBits, sizeof( int16_t ), 1, 1, "./res/nAvailBits" ); +#endif sts[0]->bits_frame_channel += sts[0]->core * SMDCT_MINIMUM_ARITH_BITS; sts[1]->bits_frame_channel += sts[1]->core * SMDCT_MINIMUM_ARITH_BITS; @@ -430,6 +454,13 @@ void stereo_mdct_core_enc( push_next_indice( hBstr, hStereoMdct->split_ratio, SMDCT_NBBITS_SPLIT_RATIO ); +#ifdef DEBUG_MODE_MDCT + dbgwrite( &hStereoMdct->split_ratio, sizeof( int16_t ), 1, 1, "./res/split_ratio" ); + for ( ch = 0; ch < CPE_CHANNELS; ch++ ) + { + dbgwrite( &sts[ch]->bits_frame_channel, sizeof( int16_t ), 1, 1, "./res/bit_frame_channel" ); + } +#endif ivas_mdct_quant_coder( hCPE, tnsBits, tnsSize, p_param, 0 ); diff --git a/lib_enc/ivas_stereo_mdct_stereo_enc.c b/lib_enc/ivas_stereo_mdct_stereo_enc.c index 78d950c74..38e537713 100644 --- a/lib_enc/ivas_stereo_mdct_stereo_enc.c +++ b/lib_enc/ivas_stereo_mdct_stereo_enc.c @@ -41,6 +41,9 @@ #include "ivas_rom_enc.h" #include "wmc_auto.h" #include "stat_enc.h" +#ifdef DEBUG_PLOT +#include "deb_out.h" +#endif /*-------------------------------------------------------------------* @@ -210,6 +213,20 @@ void stereo_coder_tcx( nonQNrgRatio[k] = max( 0.5f / SMDCT_ILD_RANGE, min( ( SMDCT_ILD_RANGE - 0.5f ) / SMDCT_ILD_RANGE, nonQNrgRatio[k] ) ); nonQNrgRatio[k] = 1.0f / nonQNrgRatio[k] - 1.0f; } +#ifdef DEBUG_MODE_MDCT + { + float tmp; + for ( k = 0; k < 2; k++ ) + { + tmp = GetChannelEnergyRatio( sts, k, k, 1 ); + if ( nSubframes == 1 && k == 1 ) + { + tmp = 0; + } + dbgwrite( &tmp, sizeof( float ), 1, 1, "./res/ild" ); + } + } +#endif } else { @@ -219,6 +236,20 @@ void stereo_coder_tcx( nrgRatio[0] = nrgRatio[1] = (float) SMDCT_ILD_RANGE / hStereoMdct->global_ild[0] - 1; /* nrgRatio = nrg[1]/nrg[0] */ nonQNrgRatio[0] = nonQNrgRatio[1] = max( 0.5f / SMDCT_ILD_RANGE, min( ( SMDCT_ILD_RANGE - 0.5f ) / SMDCT_ILD_RANGE, nonQNrgRatio[0] ) ); nonQNrgRatio[0] = nonQNrgRatio[1] = 1.0f / nonQNrgRatio[0] - 1.0f; +#ifdef DEBUG_MODE_MDCT + { + float tmp; + for ( k = 0; k < 2; k++ ) + { + tmp = GetChannelEnergyRatio( sts, 0, nSubframes - 1, 1 ); + if ( nSubframes == 1 && k == 1 ) + { + tmp = 0; + } + dbgwrite( &tmp, sizeof( float ), 1, 1, "./res/ild" ); + } + } +#endif } for ( k = 0; k < nSubframes; k++ ) @@ -243,22 +274,78 @@ void stereo_coder_tcx( } if ( +#ifdef DEBUG_FORCE_MDCT_STEREO_MODE + hStereoMdct->fDualMono || +#endif ( sts[0]->hTcxEnc->transform_type[0] != sts[1]->hTcxEnc->transform_type[0] ) || ( sts[0]->hTcxEnc->transform_type[1] != sts[1]->hTcxEnc->transform_type[1] ) || ( sts[0]->last_core != sts[1]->last_core && ( sts[0]->last_core == ACELP_CORE || sts[1]->last_core == ACELP_CORE ) ) || sts[0]->last_core == ACELP_CORE || sts[1]->last_core == ACELP_CORE ) { hStereoMdct->mdct_stereo_mode[0] = SMDCT_DUAL_MONO; hStereoMdct->mdct_stereo_mode[1] = SMDCT_DUAL_MONO; +#ifdef DEBUG_MODE_MDCT + for ( k = 0; k < 2; k++ ) + { + nAvailBitsMS[k] = -1; + dbgwrite( &nAvailBitsMS[k], sizeof( int16_t ), 1, 1, "./res/nAvailBitsMS" ); + } +#endif if ( sts[0]->igf ) { hStereoMdct->IGFStereoMode[0] = SMDCT_DUAL_MONO; hStereoMdct->IGFStereoMode[1] = SMDCT_DUAL_MONO; } +#ifdef DEBUG_MODE_MDCT + /* MDCT stereo data */ + { + float Em[2]; + int16_t ch; + getChannelEnergies( sts, Em, 2 ); + dbgwrite( Em, sizeof( float ), 2, 1, "./res/Ech" ); + for ( k = 0; k < 2; k++ ) + { + dbgwrite( &hStereoMdct->global_ild[k], sizeof( int16_t ), 1, 1, "./res/ild_q" ); + dbgwrite( &hStereoMdct->mdct_stereo_mode[k], sizeof( int16_t ), 1, 1, "./res/stereo_mode" ); + dbgwrite( &hStereoMdct->IGFStereoMode[k], sizeof( int16_t ), 1, 1, "./res/stereo_mode_ifg" ); + dbgwrite( ms_mask[k], sizeof( int16_t ), 70, 1, "./res/ms_mask" ); + } + for ( ch = 0; ch < CPE_CHANNELS; ch++ ) + { + for ( k = 0; k < 2; k++ ) + { + dbgwrite( sts[ch]->hTcxEnc->spectrum[k], sizeof( float ), 640, 1, "./res/MDCT_spec_after_stereo" ); + dbgwrite( mdst_spectrum[ch][k], sizeof( float ), 640, 1, "./res/MDST_spec_after_stereo" ); + } + } + } +#endif hStereoMdct->sw_uncorr = 1; pop_wmops(); return; } +#ifdef DEBUG_FORCE_MDCT_STEREO_MODE + else if ( hStereoMdct->fMSstereo ) + { + hStereoMdct->mdct_stereo_mode[0] = SMDCT_MS_FULL; + hStereoMdct->mdct_stereo_mode[1] = SMDCT_MS_FULL; + if ( sts[0]->igf ) + { + hStereoMdct->IGFStereoMode[0] = SMDCT_MS_FULL; + hStereoMdct->IGFStereoMode[1] = SMDCT_MS_FULL; + } + for ( k = 0; k < nSubframes; k++ ) + { + convertToMS( L_frameTCX, sts[0]->hTcxEnc->spectrum[k], sts[1]->hTcxEnc->spectrum[k], SQRT2_OVER_2 ); + + /* Make sure that the MDST is processed in the correct way also */ + set_s( &ms_mask[k][0], 1, MAX_SFB ); + } + + pop_wmops(); + return; + } +#endif else /* decide based on signal */ { for ( k = 0; k < nSubframes; k++ ) @@ -351,6 +438,12 @@ void stereo_coder_tcx( } } /* for k */ +#ifdef DEBUG_MODE_MDCT + for ( k = 0; k < 2; k++ ) + { + dbgwrite( &nAvailBitsMS[k], sizeof( int16_t ), 1, 1, "./res/nAvailBitsMS" ); + } +#endif } /* for bitrate switching determine correlation depending on m/s decision */ { @@ -375,6 +468,30 @@ void stereo_coder_tcx( pop_wmops(); +#ifdef DEBUG_MODE_MDCT + /* MDCT stereo data */ + { + float Em[2]; + int16_t ch; + getChannelEnergies( sts, Em, 2 ); + dbgwrite( Em, sizeof( float ), 2, 1, "./res/Ech" ); + for ( k = 0; k < 2; k++ ) + { + dbgwrite( &hStereoMdct->global_ild[k], sizeof( int16_t ), 1, 1, "./res/ild_q" ); + dbgwrite( &hStereoMdct->mdct_stereo_mode[k], sizeof( int16_t ), 1, 1, "./res/stereo_mode" ); + dbgwrite( &hStereoMdct->IGFStereoMode[k], sizeof( int16_t ), 1, 1, "./res/stereo_mode_ifg" ); + dbgwrite( ms_mask[k], sizeof( int16_t ), 70, 1, "./res/ms_mask" ); + } + for ( ch = 0; ch < CPE_CHANNELS; ch++ ) + { + for ( k = 0; k < 2; k++ ) + { + dbgwrite( sts[ch]->hTcxEnc->spectrum[k], sizeof( float ), 640, 1, "./res/MDCT_spec_after_stereo" ); + dbgwrite( mdst_spectrum[ch][k], sizeof( float ), 640, 1, "./res/MDST_spec_after_stereo" ); + } + } + } +#endif return; } @@ -954,6 +1071,12 @@ static void MsStereoDecision( context_update( ctxR, ctxS, endline ); bitsBW += bitsL + bitsR; } +#ifdef DEBUG_MODE_MDCT + dbgwrite( &bitsL, sizeof( int16_t ), 1, 1, "./res/bitsL" ); + dbgwrite( &bitsR, sizeof( int16_t ), 1, 1, "./res/bitsR" ); + dbgwrite( &bitsM, sizeof( int16_t ), 1, 1, "./res/bitsM" ); + dbgwrite( &bitsS, sizeof( int16_t ), 1, 1, "./res/bitsS" ); +#endif } bitsBW += sfbParam->nBandsStereoCore; /* Signaling bits */ @@ -1022,6 +1145,20 @@ void initMdctStereoEncData( set_s( hStereoMdct->IGFStereoMode, -1, 2 ); +#ifdef DEBUG_FORCE_MDCT_STEREO_MODE + /*set all other members to defined states */ + hStereoMdct->fDualMono = 0; + hStereoMdct->fMSstereo = 0; + + if ( hStereoMdct->mdct_stereo_mode_cmdl == SMDCT_FORCE_LR ) + { + hStereoMdct->fDualMono = 1; + } + else if ( hStereoMdct->mdct_stereo_mode_cmdl == SMDCT_FORCE_MS ) + { + hStereoMdct->fMSstereo = 1; + } +#endif hStereoMdct->split_ratio = SMDCT_EQUAL_RATIO_RANGE; set_s( hStereoMdct->global_ild, SMDCT_ILD_RANGE >> 1, 2 ); diff --git a/lib_enc/ivas_stereo_switching_enc.c b/lib_enc/ivas_stereo_switching_enc.c index 5b173936c..fca3c7785 100644 --- a/lib_enc/ivas_stereo_switching_enc.c +++ b/lib_enc/ivas_stereo_switching_enc.c @@ -39,6 +39,9 @@ #include "ivas_rom_com.h" #include "assert.h" #include "wmc_auto.h" +#ifdef DEBUGGING +#include "debug.h" +#endif /*-------------------------------------------------------------------* * Function allocate_CoreCoder_enc() @@ -531,6 +534,9 @@ ivas_error stereo_memory_enc( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MDCT Stereo \n" ) ); } +#ifdef DEBUGGING + hCPE->hStereoMdct->mdct_stereo_mode_cmdl = SMDCT_MS_DECISION; +#endif initMdctStereoEncData( hCPE->hStereoMdct, ivas_format, hCPE->element_mode, hCPE->element_brate, hCPE->hCoreCoder[0]->max_bwidth, 0, NULL, 1 ); hCPE->hStereoMdct->isSBAStereoMode = ( ivas_format == SBA_FORMAT && nchan_transport == 2 ); diff --git a/lib_enc/ivas_stereo_td_analysis.c b/lib_enc/ivas_stereo_td_analysis.c index 01f8a992c..fc318ce6b 100644 --- a/lib_enc/ivas_stereo_td_analysis.c +++ b/lib_enc/ivas_stereo_td_analysis.c @@ -40,6 +40,9 @@ #include "ivas_rom_com.h" #include "ivas_cnst.h" #include "rom_enc.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -532,6 +535,11 @@ int16_t stereo_tdm_ener_analysis( hCPE->hStereoClassif->ratio_L = ratio_L; +#ifdef DEBUG_MODE_TD + dbgwrite( &ratio_L, 4, 1, 320, "res/ratio_L" ); + dbgwrite( &hStereoTD->prev_fr_LRTD_TD_dec, 2, 1, 320, "res/prev_fr_LRTD_TD_dec" ); + dbgwrite( &hStereoTD->tdm_inst_ratio_idx, 2, 1, 320, "res/inst_ratio_L" ); +#endif return ( idx ); } diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index 7a72d612e..64446f3e5 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -32,6 +32,10 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#include "assert.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" @@ -172,6 +176,9 @@ ivas_error stereo_set_tdm( hCPE->hStereoTD->tdm_LRTD_flag = hCPE->hStereoTD->prev_fr_LRTD_TD_dec; } +#ifdef DEBUG_MODE_INFO + dbgwrite( &hCPE->hStereoTD->tdm_LRTD_flag, 2, 1, (int16_t) ( hCPE->hCoreCoder[0]->input_Fs / FRAMES_PER_SEC ), "res/tdm_LRTD_flag" ); +#endif /* normal TD / LRTD switching */ if ( hCPE->hStereoTD->tdm_LRTD_flag == 0 ) @@ -269,6 +276,24 @@ ivas_error stereo_set_tdm( } else { +#ifdef DEBUG_MODE_INFO + { + int16_t tmp = -2; + dbgwrite( &tmp, 2, 1, (int16_t) ( hCPE->hCoreCoder[0]->input_Fs / FRAMES_PER_SEC ), "res/tdm_LRTD_flag" ); + } +#endif +#ifdef DEBUG_MODE_TD + { + float ftmp = -0.0; + int16_t tmp = -2; + dbgwrite( &tmp, 2, 1, 320, "res/prev_fr_LRTD_TD_dec" ); + dbgwrite( &tmp, 2, 1, 320, "res/inst_ratio_L" ); + dbgwrite( &ftmp, 4, 1, 320, "res/ratio_L" ); + dbgwrite( &tmp, 2, 1, 320, "res/tdm_low_rate_mode" ); + // dbgwrite( &tmp, 2, 1, 320, "res/tdm_lp_reuse_flag" ); + // dbgwrite( &tmp, 2, 1, 320, "res/mod_ct.enx" ); + } +#endif hCPE->hCoreCoder[0]->tdm_LRTD_flag = 0; hCPE->hCoreCoder[1]->tdm_LRTD_flag = 0; } @@ -521,6 +546,11 @@ void tdm_configure_enc( push_indice( &hStereoTD->tdm_hBstr_tmp, IND_STEREO_GD, hCPE->hStereoTCA->indx_ica_gD, STEREO_BITS_TCA_GD ); } +#ifdef DEBUG_MODE_TD + dbgwrite( &hStereoTD->tdm_low_rate_mode, 2, 1, 320, "res/tdm_low_rate_mode_c" ); + dbgwrite( &hStereoTD->tdm_lp_reuse_flag, 2, 1, 320, "res/tdm_lp_reuse_flag_c" ); + dbgwrite( &mod_ct, 2, 1, 320, "res/mod_ct.enc" ); +#endif /*----------------------------------------------------------------* * Updates @@ -574,6 +604,12 @@ ivas_error signaling_enc_secondary( { ind -= 2; } +#ifdef DEBUGGING + else if ( st->coder_type == TRANSITION || st->coder_type == VOICED ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Coder type not supported in secondary channel\n" ); + } +#endif ind <<= 1; ind += tdm_SM_or_LRTD_Pri; /* addition of the channel combination scheme flag value or the LRTD primary channel*/ @@ -798,6 +834,9 @@ void stereo_tdm_prep_dwnmx( sw_pos = 22 * i; enr_len = 6 * i; +#ifdef DEBUG_MODE_TD + assert( sw_pos > 15 ); +#endif if ( hCPE->element_mode == IVAS_CPE_TD ) { if ( hCPE->hStereoTD->flag_skip_DMX == 1 ) /* hStereoTD is defined only if element mode == TD */ diff --git a/lib_enc/ivas_tcx_core_enc.c b/lib_enc/ivas_tcx_core_enc.c index ef239607e..7d8394f5a 100644 --- a/lib_enc/ivas_tcx_core_enc.c +++ b/lib_enc/ivas_tcx_core_enc.c @@ -33,6 +33,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" @@ -174,6 +177,11 @@ void stereo_tcx_core_enc( /* bitstream */ BSTR_ENC_HANDLE hBstr = st->hBstr; +#ifdef DEBUG_MODE_TCX + static FILE *pF = NULL; + if ( pF == NULL ) + pF = fopen( "./res/stereo_tcx_enc_ind.txt", "w" ); +#endif push_wmops( "stereo_tcx_core_enc" ); @@ -261,6 +269,10 @@ void stereo_tcx_core_enc( n_subframes = 1; } +#ifdef DEBUG_MODE_TCX + fprintf( pF, "== stereo Chan %d - Nominal Bits %d - Allocated Bits %d ==\n", st->idchan, st->bits_frame_nominal, (int16_t) ( st->total_brate / FRAMES_PER_SEC ) ); + fprintf( pF, "stereo Common Header: %d bits\n", hBstr->nb_bits_tot ); +#endif nbits_start = hBstr->nb_bits_tot; /*--------------------------------------------------------------------------------* @@ -281,6 +293,9 @@ void stereo_tcx_core_enc( } assert( nbits_header == ( hBstr->nb_bits_tot - nbits_start ) ); +#ifdef DEBUG_MODE_TCX + fprintf( pF, "\t TCX Header: %d bits: %d %d %d %d\n", hBstr->nb_bits_tot - nbits_start, st->tcxonly, st->core, st->tcxonly ? st->clas : st->hTcxCfg->coder_type, st->hTcxCfg->tcx_curr_overlap_mode ); +#endif /*--------------------------------------------------------------* * Core Signal Analysis: MDCT, TNS, LPC analysis @@ -388,6 +403,9 @@ void stereo_tcx_core_enc( writeLPCparam( st, hBstr, param_lpc, bits_param_lpc, no_param_lpc, &total_nbbits ); assert( total_nbbits == ( nbits_lpc[0] + nbits_lpc[1] ) ); +#ifdef DEBUG_MODE_TCX + fprintf( pF, "\t TCX LPC: %d bits\n", total_nbbits ); +#endif /*--------------------------------------------------------------* * Run TCX10/20 Core @@ -486,6 +504,29 @@ void stereo_tcx_core_enc( } } +#ifdef DEBUG_MODE_TCX + { + int16_t tmp[L_FRAME48k]; + + for ( i = 0; i < st->L_frame; i++ ) + { + tmp[i] = (int16_t) ( st->synth[i] + 0.5f ); + } + dbgwrite( tmp, sizeof( int16_t ), st->L_frame, 1, "./res/stereo_tcx_enc_synth.pcm" ); + + for ( i = 0; i < st->L_frame; i++ ) + { + tmp[i] = (int16_t) ( st->speech_enc[i] + 0.5f ); + } + dbgwrite( tmp, sizeof( int16_t ), st->L_frame, 1, "./res/stereo_tcx_enc_inLB.pcm" ); + + for ( i = 0; i < hTcxEnc->L_frameTCX; i++ ) + { + tmp[i] = (int16_t) ( st->hTcxEnc->speech_TCX[i] + 0.5f ); + } + dbgwrite( tmp, sizeof( int16_t ), hTcxEnc->L_frameTCX, 1, "./res/stereo_tcx_enc_inFB.pcm" ); + } +#endif /*--------------------------------------------------------------------------------* * Encode TCX20/10 parameters @@ -495,6 +536,16 @@ void stereo_tcx_core_enc( total_nbbits = hBstr->nb_bits_tot - nbits_start; +#ifdef DEBUG_MODE_TCX + { + static FILE *sP = NULL; + + if ( sP == NULL ) + sP = fopen( "./res/stereo_tcx_core_enc_swicthes.txt", "w" ); + + fprintf( sP, "frame:%d\t mdct_sw=%d\t rf_mode=%d tcxonly=%d\t tcxMode=%d\t core=%d\t, enableTcxLpc=%d\t igf=%d\t envWeighted=%d\t lpcQuantization=%d\t enablePlcWaveadjust=%d\t tcxltp=%d\t fIsTNSAllowed=%d\t tcx_lpc_shaped_ari=%d\t ctx_hm=%d\t \n", frame, st->mdct_sw, st->rf_mode, st->tcxonly, hTcxEnc->tcxMode, st->core, st->enableTcxLpc, st->igf, st->envWeighted, st->lpcQuantization, st->enablePlcWaveadjust, hTcxEnc->tcxltp, st->hTcxCfg->fIsTNSAllowed, hTcxEnc->tcx_lpc_shaped_ari, st->hTcxCfg->ctx_hm ); + } +#endif if ( param_core[1 + NOISE_FILL_RANGES] != 0 ) { @@ -823,6 +874,18 @@ int16_t ivas_acelp_tcx20_switching( smc_dec_ol = 2; } +#ifdef DEBUGGING + if ( st->force == FORCE_SPEECH ) + { + /* enforce ACELP */ + smc_dec_ol = 0; + } + else if ( st->force == FORCE_MUSIC ) + { + /* enforce TCX */ + smc_dec_ol = 2; + } +#endif st->prevTempFlatness = currFlatness; diff --git a/lib_enc/ivas_td_low_rate_enc.c b/lib_enc/ivas_td_low_rate_enc.c index 40d10e485..de75faf2f 100644 --- a/lib_enc/ivas_td_low_rate_enc.c +++ b/lib_enc/ivas_td_low_rate_enc.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "stat_enc.h" #include "rom_com.h" diff --git a/lib_enc/lead_indexing.c b/lib_enc/lead_indexing.c index 31116dfd1..6208d66eb 100644 --- a/lib_enc/lead_indexing.c +++ b/lib_enc/lead_indexing.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "rom_com.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 238de3ab1..a308be9bb 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -37,6 +37,9 @@ #include #include #include +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" #include "options.h" @@ -49,6 +52,9 @@ struct IVAS_ENC Encoder_Struct *st_ivas; ENC_CORE_HANDLE hCoreCoder; bool isConfigured; +#ifdef DEBUGGING + bool cmd_stereo; +#endif bool switchingActive; /* flag for configuration changes during encoding - currently only used with mono */ int16_t Opt_RF_ON_loc; int16_t rf_fec_offset_loc; @@ -74,7 +80,13 @@ static ivas_error sanitizeBitrateISM( const ENCODER_CONFIG_HANDLE hEncoderConfig static void init_encoder_config( ENCODER_CONFIG_HANDLE hEncoderConfig ); static void resetIsmMetadataProvidedFlags( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error bandwidthApiToInternal( const IVAS_ENC_BANDWIDTH maxBandwidth, int16_t *internalMaxBandwidth ); +#ifdef DEBUG_AGC_ENCODER_CMD_OPTION +static ivas_error agcAPIToInternal( const IVAS_ENC_AGC agcOption, int16_t *internalAGCOption ); +#endif static ivas_error fecIndicatorApiToInternal( const IVAS_ENC_FEC_INDICATOR fecIndicator, int16_t *fecIndicatorInternal ); +#ifdef DEBUGGING +static ivas_error forcedModeApiToInternal( IVAS_ENC_FORCED_MODE forcedMode, int16_t *forcedModeInternal ); +#endif /*---------------------------------------------------------------------* @@ -105,6 +117,9 @@ ivas_error IVAS_ENC_Open( ( *phIvasEnc )->hCoreCoder = NULL; ( *phIvasEnc )->isConfigured = false; +#ifdef DEBUGGING + ( *phIvasEnc )->cmd_stereo = false; +#endif ( *phIvasEnc )->switchingActive = false; ( *phIvasEnc )->maxBandwidthUser = false; resetIsmMetadataProvidedFlags( *phIvasEnc ); @@ -244,6 +259,10 @@ ivas_error IVAS_ENC_ConfigureForStereo( const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ const bool is_binaural /* i : flag indicating if input is binaural audio */ +#ifdef DEBUGGING + , + const IVAS_ENC_STEREO_MODE stereoMode /* i : forces a specific stereo coding mode */ +#endif ) { Encoder_Struct *st_ivas; @@ -262,6 +281,41 @@ ivas_error IVAS_ENC_ConfigureForStereo( hEncoderConfig->ivas_format = STEREO_FORMAT; hEncoderConfig->is_binaural = (int16_t) is_binaural; +#ifdef DEBUGGING + switch ( stereoMode ) + { + case IVAS_ENC_STEREO_MODE_UNIFIED: + hEncoderConfig->stereo_mode_cmdl = 1; /* set unified stereo by default */ + hEncoderConfig->element_mode_init = IVAS_CPE_DFT; + hIvasEnc->cmd_stereo = true; + break; + case IVAS_ENC_STEREO_MODE_DFT: + hEncoderConfig->element_mode_init = IVAS_CPE_DFT; + hEncoderConfig->stereo_mode_cmdl = IVAS_CPE_DFT; + break; + case IVAS_ENC_STEREO_MODE_TD: + hEncoderConfig->stereo_mode_cmdl = IVAS_CPE_TD; + hEncoderConfig->element_mode_init = IVAS_CPE_TD; + break; + case IVAS_ENC_STEREO_MODE_MDCT_DECISION: + hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; + hEncoderConfig->mdct_stereo_mode_cmdl = SMDCT_MS_DECISION; + break; +#ifdef DEBUG_FORCE_MDCT_STEREO_MODE + case IVAS_ENC_STEREO_MODE_MDCT_FORCE_LR: + hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; + hEncoderConfig->mdct_stereo_mode_cmdl = SMDCT_FORCE_LR; + break; + case IVAS_ENC_STEREO_MODE_MDCT_FORCE_MS: + hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; + hEncoderConfig->mdct_stereo_mode_cmdl = SMDCT_FORCE_MS; + break; +#endif + default: + return IVAS_ERR_INVALID_STEREO_MODE; + break; + } +#endif /* DEBUGGING */ hIvasEnc->maxBandwidthUser = max_bwidth_user; @@ -430,7 +484,14 @@ ivas_error IVAS_ENC_ConfigureForAmbisonics( const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ const IVAS_ENC_SBA_ORDER order, /* i : order of the Ambisonics input */ const bool isPlanar, /* i : if true, input is treated as planar Ambisonics */ +#ifdef DEBUG_AGC_ENCODER_CMD_OPTION + const IVAS_ENC_AGC Opt_AGC_ON, /* i : AGC on/off/undefined flag */ +#endif const bool Opt_PCA_ON /* i : PCA option flag */ +#ifdef DEBUG_SBA_AUDIO_DUMP + , + int16_t *numTransportChannels +#endif ) { ENCODER_CONFIG_HANDLE hEncoderConfig; @@ -451,6 +512,12 @@ ivas_error IVAS_ENC_ConfigureForAmbisonics( /* Input in ACN/SN3D in all cases (3D and planar): get number of channels */ hEncoderConfig->nchan_inp = ivas_sba_get_nchan( hEncoderConfig->sba_order, 0 ); /*planar input arg. deliberately set to zero since input always in ACN/SN3D*/ +#ifdef DEBUG_AGC_ENCODER_CMD_OPTION + if ( ( error = agcAPIToInternal( Opt_AGC_ON, &( hEncoderConfig->Opt_AGC_ON ) ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif hEncoderConfig->Opt_PCA_ON = (int16_t) Opt_PCA_ON; @@ -458,6 +525,9 @@ ivas_error IVAS_ENC_ConfigureForAmbisonics( error = configureEncoder( hIvasEnc, inputFs, bitrate, maxBandwidth, dtxConfig, IVAS_ENC_GetDefaultChannelAwareConfig() ); +#ifdef DEBUG_SBA_AUDIO_DUMP + *numTransportChannels = hIvasEnc->st_ivas->nchan_transport; +#endif return error; } @@ -549,6 +619,9 @@ ivas_error IVAS_ENC_ConfigureForMasa( break; case IVAS_ENC_MASA_2CH: hEncoderConfig->nchan_inp = 2; +#ifdef DEBUGGING + hEncoderConfig->stereo_mode_cmdl = 1; /* set unified stereo by default */ +#endif hEncoderConfig->element_mode_init = IVAS_CPE_DFT; /* initialization only, might be changed later based on element_brate */ break; default: @@ -753,11 +826,20 @@ static ivas_error configureEncoder( if ( hEncoderConfig->ivas_format == STEREO_FORMAT ) { +#ifdef DEBUGGING + if ( hIvasEnc->cmd_stereo ) +#endif { hEncoderConfig->element_mode_init = IVAS_CPE_DFT; +#ifdef DEBUGGING + hEncoderConfig->stereo_mode_cmdl = 1; +#endif if ( hEncoderConfig->ivas_total_brate >= MIN_BRATE_MDCT_STEREO ) { hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; +#ifdef DEBUGGING + hEncoderConfig->stereo_mode_cmdl = 0; +#endif } } @@ -901,6 +983,12 @@ static ivas_error configureEncoder( return IVAS_ERROR( IVAS_ERR_DTX_NOT_SUPPORTED, "DTX is not supported in this IVAS format and element mode." ); } +#ifdef DEBUG_AGC_ENCODER_CMD_OPTION + if ( hEncoderConfig->Opt_AGC_ON == SBA_AGC_FORCE_ENABLE && !( hEncoderConfig->ivas_format == SBA_FORMAT ) ) + { + return IVAS_ERROR( IVAS_ERR_NOT_SUPPORTED_OPTION, "AGC supported in SBA format at bitrates >= 24.4 kbps only." ); + } +#endif if ( hEncoderConfig->Opt_PCA_ON && !( hEncoderConfig->ivas_format == SBA_FORMAT && hEncoderConfig->ivas_total_brate == PCA_BRATE && hEncoderConfig->sba_order == SBA_FOA_ORDER ) ) { @@ -1220,6 +1308,9 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( if ( hEncoderConfig->ivas_format == MONO_FORMAT ) /* EVS mono */ { hCoreCoder->total_brate = hEncoderConfig->ivas_total_brate; /* needed in case of bitrate switching */ +#ifdef DEBUGGING + hCoreCoder->id_element = 0; +#endif if ( hEncoderConfig->stereo_dmx_evs == 1 ) { @@ -1358,6 +1449,41 @@ ivas_error IVAS_ENC_SetChannelAwareConfig( } +#ifdef DEBUGGING +/*---------------------------------------------------------------------* + * IVAS_ENC_SetForcedMode() + * + * + *---------------------------------------------------------------------*/ + +ivas_error IVAS_ENC_SetForcedMode( + IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ + const IVAS_ENC_FORCED_MODE forcedMode /* i : forced coding mode */ +) +{ + int16_t newForced; + ivas_error error; + + /* Do additional checks for user-facing function */ + if ( ( error = doCommonSetterChecks( hIvasEnc ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = forcedModeApiToInternal( forcedMode, &newForced ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( hIvasEnc->st_ivas->hEncoderConfig->force != newForced ) + { + hIvasEnc->st_ivas->hEncoderConfig->force = newForced; + hIvasEnc->switchingActive = true; + } + + return IVAS_ERR_OK; +} +#endif /* DEBUGGING */ /*---------------------------------------------------------------------* @@ -1479,6 +1605,24 @@ static ivas_error printConfigInfo_enc( } else if ( hEncoderConfig->ivas_format == STEREO_FORMAT ) { +#ifdef DEBUGGING + if ( hEncoderConfig->stereo_mode_cmdl == 1 ) + { + fprintf( stdout, "IVAS format: stereo - Unified stereo\n" ); + } + else if ( hEncoderConfig->element_mode_init == IVAS_CPE_DFT ) + { + fprintf( stdout, "IVAS format: stereo - DFT stereo\n" ); + } + else if ( hEncoderConfig->element_mode_init == IVAS_CPE_TD ) + { + fprintf( stdout, "IVAS format: stereo - TD stereo\n" ); + } + else if ( hEncoderConfig->element_mode_init == IVAS_CPE_MDCT ) + { + fprintf( stdout, "IVAS format: stereo - MDCT stereo\n" ); + } +#else if ( hEncoderConfig->element_mode_init != IVAS_CPE_MDCT ) { fprintf( stdout, "IVAS format: stereo - Unified stereo\n" ); @@ -1487,6 +1631,7 @@ static ivas_error printConfigInfo_enc( { fprintf( stdout, "IVAS format: stereo - MDCT stereo\n" ); } +#endif } else if ( hEncoderConfig->ivas_format == ISM_FORMAT ) { @@ -1507,6 +1652,23 @@ static ivas_error printConfigInfo_enc( fprintf( stdout, "- PCA configured with signal adaptive decision " ); } +#ifdef DEBUG_AGC_ENCODER_CMD_OPTION + switch ( hEncoderConfig->Opt_AGC_ON ) + { + case SBA_AGC_FORCE_ENABLE: + fprintf( stdout, "- AGC FORCED ON " ); + break; + case SBA_AGC_FORCE_DISABLE: + fprintf( stdout, "- AGC FORCED OFF " ); + break; + case SBA_AGC_DEFAULT: + fprintf( stdout, "- AGC default mode " ); + break; + default: + fprintf( stdout, "- AGC unknown " ); + break; + } +#endif fprintf( stdout, "\n" ); } else if ( hEncoderConfig->ivas_format == MASA_FORMAT ) @@ -2080,6 +2242,36 @@ static ivas_error bandwidthApiToInternal( return IVAS_ERR_OK; } +#ifdef DEBUG_AGC_ENCODER_CMD_OPTION +/*---------------------------------------------------------------------* + * agcAPIToInternal() + * + * + *---------------------------------------------------------------------*/ + +static ivas_error agcAPIToInternal( + const IVAS_ENC_AGC agcOption, + int16_t *internalAGCOption ) +{ + switch ( agcOption ) + { + case IVAS_ENC_AGC_ENABLED: + *internalAGCOption = SBA_AGC_FORCE_ENABLE; + break; + case IVAS_ENC_AGC_DISABLED: + *internalAGCOption = SBA_AGC_FORCE_DISABLE; + break; + case IVAS_ENC_AGC_UNDEFINED: + *internalAGCOption = SBA_AGC_DEFAULT; + break; + default: + return IVAS_ERR_INVALID_AGC; + break; + } + + return IVAS_ERR_OK; +} +#endif /*---------------------------------------------------------------------* @@ -2108,6 +2300,48 @@ static ivas_error fecIndicatorApiToInternal( return IVAS_ERR_OK; } +#ifdef DEBUGGING +/*---------------------------------------------------------------------* + * forcedModeApiToInternal() + * + * + *---------------------------------------------------------------------*/ + +static ivas_error forcedModeApiToInternal( + IVAS_ENC_FORCED_MODE forcedMode, + int16_t *forcedModeInternal ) +{ + switch ( forcedMode ) + { + case IVAS_ENC_FORCE_SPEECH: + *forcedModeInternal = FORCE_SPEECH; + break; + case IVAS_ENC_FORCE_MUSIC: + *forcedModeInternal = FORCE_MUSIC; + break; + case IVAS_ENC_FORCE_ACELP: + *forcedModeInternal = FORCE_ACELP; + break; + case IVAS_ENC_FORCE_GSC: + *forcedModeInternal = FORCE_GSC; + break; + case IVAS_ENC_FORCE_TCX: + *forcedModeInternal = FORCE_TCX; + break; + case IVAS_ENC_FORCE_HQ: + *forcedModeInternal = FORCE_HQ; + break; + case IVAS_ENC_FORCE_UNFORCED: + *forcedModeInternal = -1; + break; + default: + return IVAS_ERR_INVALID_FORCE_MODE; + break; + } + + return IVAS_ERR_OK; +} +#endif /*---------------------------------------------------------------------* @@ -2171,6 +2405,14 @@ static void init_encoder_config( hEncoderConfig->sba_order = 0; hEncoderConfig->sba_planar = 0; hEncoderConfig->ism_extended_metadata_flag = 0; +#ifdef DEBUGGING + hEncoderConfig->stereo_mode_cmdl = 0; + hEncoderConfig->force = -1; + hEncoderConfig->mdct_stereo_mode_cmdl = SMDCT_MS_DECISION; +#ifdef DEBUG_AGC_ENCODER_CMD_OPTION + hEncoderConfig->Opt_AGC_ON = SBA_AGC_DEFAULT; +#endif +#endif hEncoderConfig->Opt_PCA_ON = 0; return; diff --git a/lib_enc/lib_enc.h b/lib_enc/lib_enc.h index b57a1375a..13399ba0c 100644 --- a/lib_enc/lib_enc.h +++ b/lib_enc/lib_enc.h @@ -109,6 +109,39 @@ typedef enum _IVAS_ENC_COMBINED_FORMAT IVAS_ENC_COMBINED_UNDEFINED = 0xffff } IVAS_ENC_COMBINED_FORMAT; +#ifdef DEBUGGING +typedef enum _IVAS_ENC_STEREO_MODE +{ + IVAS_ENC_STEREO_MODE_UNIFIED, + IVAS_ENC_STEREO_MODE_DFT, + IVAS_ENC_STEREO_MODE_TD, + IVAS_ENC_STEREO_MODE_MDCT_DECISION, + IVAS_ENC_STEREO_MODE_MDCT_FORCE_LR, + IVAS_ENC_STEREO_MODE_MDCT_FORCE_MS, + IVAS_ENC_STEREO_MODE_UNDEFINED = 0xffff +} IVAS_ENC_STEREO_MODE; + +typedef enum _IVAS_ENC_FORCED_MODE +{ + IVAS_ENC_FORCE_SPEECH, + IVAS_ENC_FORCE_MUSIC, + IVAS_ENC_FORCE_ACELP, + IVAS_ENC_FORCE_GSC, + IVAS_ENC_FORCE_TCX, + IVAS_ENC_FORCE_HQ, + IVAS_ENC_FORCE_UNFORCED, + IVAS_ENC_FORCE_UNDEFINED = 0xffff +} IVAS_ENC_FORCED_MODE; + +#ifdef DEBUG_AGC_ENCODER_CMD_OPTION +typedef enum _IVAS_ENC_AGC +{ + IVAS_ENC_AGC_DISABLED = 0, + IVAS_ENC_AGC_ENABLED, + IVAS_ENC_AGC_UNDEFINED = 0xffff +} IVAS_ENC_AGC; +#endif +#endif /*---------------------------------------------------------------------* * Encoder structures @@ -150,6 +183,10 @@ ivas_error IVAS_ENC_ConfigureForStereo( const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ const bool is_binaural /* i : flag indicating if input is binaural audio */ +#ifdef DEBUGGING + , + const IVAS_ENC_STEREO_MODE stereoMode /* i : forces a specific stereo coding mode */ +#endif ); /*! r: error code */ @@ -198,7 +235,14 @@ ivas_error IVAS_ENC_ConfigureForAmbisonics( const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ const IVAS_ENC_SBA_ORDER order, /* i : order of the Ambisonics input */ const bool isPlanar, /* i : if true, input is treated as planar Ambisonics */ +#ifdef DEBUG_AGC_ENCODER_CMD_OPTION + const IVAS_ENC_AGC Opt_AGC_ON, /* i : AGC on/off/undefined flag */ +#endif const bool Opt_PCA_ON /* i : PCA option flag */ +#ifdef DEBUG_SBA_AUDIO_DUMP + , + int16_t *numTransportChannels +#endif ); /*! r: error code */ @@ -280,6 +324,13 @@ ivas_error IVAS_ENC_SetChannelAwareConfig( const IVAS_ENC_CHANNEL_AWARE_CONFIG rfConfig /* i : configuration of channel-aware mode */ ); +#ifdef DEBUGGING +/*! r: error code */ +ivas_error IVAS_ENC_SetForcedMode( + IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ + const IVAS_ENC_FORCED_MODE forcedMode /* i : forced coding mode */ +); +#endif /* Getter functions - retrieve information from an encoder through a handle */ diff --git a/lib_enc/long_enr.c b/lib_enc/long_enr.c index 6277129f8..488012b6b 100644 --- a/lib_enc/long_enr.c +++ b/lib_enc/long_enr.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_enc/lp_exc_e.c b/lib_enc/lp_exc_e.c index 07b1954f5..4fb81a9b7 100644 --- a/lib_enc/lp_exc_e.c +++ b/lib_enc/lp_exc_e.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_enc/lsf_enc.c b/lib_enc/lsf_enc.c index c32757972..61a81ffec 100644 --- a/lib_enc/lsf_enc.c +++ b/lib_enc/lsf_enc.c @@ -36,6 +36,10 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#include +#endif #include "cnst.h" #include "rom_enc.h" #include "rom_com.h" @@ -1142,6 +1146,9 @@ static float vq_lvq_lsf_enc( if ( pred_flag == 0 ) /* safety net*/ { cb = &Quantizers[CB_lsf[mode]]; +#ifdef DEBUGGING + assert( levels[stagesVQ] >= min_lat_bits_SN[mode] ); +#endif if ( mode < 6 ) /* for NB */ { mode_glb = offset_lvq_modes_SN[mode] + offset_in_lvq_mode_SN[mode][levels[stagesVQ] - min_lat_bits_SN[mode]]; @@ -1154,6 +1161,9 @@ static float vq_lvq_lsf_enc( else /* pred */ { cb = &Quantizers_p[CB_p_lsf[mode]]; +#ifdef DEBUGGING + assert( levels[stagesVQ] >= min_lat_bits_pred[mode] ); +#endif if ( ( mode < 6 ) || ( mode == 12 ) ) /* for NB or I 16k */ { mode_glb = offset_lvq_modes_pred[mode] + offset_in_lvq_mode_pred[mode][levels[stagesVQ] - min_lat_bits_pred[mode]]; diff --git a/lib_enc/lsf_msvq_ma_enc.c b/lib_enc/lsf_msvq_ma_enc.c index b825109dd..d75d57021 100644 --- a/lib_enc/lsf_msvq_ma_enc.c +++ b/lib_enc/lsf_msvq_ma_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "ivas_prot.h" #include "prot.h" diff --git a/lib_enc/mdct_classifier.c b/lib_enc/mdct_classifier.c index 976c642a2..f26b12773 100644 --- a/lib_enc/mdct_classifier.c +++ b/lib_enc/mdct_classifier.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_enc/mdct_selector.c b/lib_enc/mdct_selector.c index ebe268fc7..45f3d3174 100644 --- a/lib_enc/mdct_selector.c +++ b/lib_enc/mdct_selector.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_enc.h" diff --git a/lib_enc/multi_harm.c b/lib_enc/multi_harm.c index 18c354a97..c53371e28 100644 --- a/lib_enc/multi_harm.c +++ b/lib_enc/multi_harm.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_enc/nelp_enc.c b/lib_enc/nelp_enc.c index 1c065a517..a1ae3c20d 100644 --- a/lib_enc/nelp_enc.c +++ b/lib_enc/nelp_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_enc/noise_adjust.c b/lib_enc/noise_adjust.c index 7b059f5c5..0ba9bd453 100644 --- a/lib_enc/noise_adjust.c +++ b/lib_enc/noise_adjust.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_enc/normalizecoefs.c b/lib_enc/normalizecoefs.c index 90b7c4a54..bd24f2cd2 100644 --- a/lib_enc/normalizecoefs.c +++ b/lib_enc/normalizecoefs.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "rom_com.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_enc/peak_vq_enc.c b/lib_enc/peak_vq_enc.c index 27943ed61..efdd0b14a 100644 --- a/lib_enc/peak_vq_enc.c +++ b/lib_enc/peak_vq_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" @@ -63,6 +66,9 @@ static int16_t sparse_code_pos( const int16_t *inp, const int16_t length, int16_ int16_t peak_vq_enc( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const int16_t bwidth, /* i : audio bandwidth */ +#ifdef DEBUGGING + const int16_t idchan, /* i : channel ID */ +#endif const float *coefs, /* i : Input coefficient vector */ float *coefs_out, /* o : Quantized output vector */ const int32_t core_brate, /* i : Core bitrate */ @@ -306,6 +312,30 @@ int16_t peak_vq_enc( k_sort[i] = i; } +#ifdef DEBUGGING + /* SNR measurement */ + for ( i = 0; i < pvq_bands; i++ ) + { + float diff[120]; + + if ( npulses[i] > 0 ) + { + for ( j = 0; j < hvq_band_width[i]; j++ ) + { + diff[j] = pvq_vector[hvq_band_start[i] + j] - gopt[i] * coefs_pvq[hvq_band_start[i] + j]; + } + + if ( idchan == 0 ) + { + snr( &pvq_vector[hvq_band_start[i]], diff, hvq_band_width[i], "HVQ_PVQ_output" ); + } + else + { + snr( &pvq_vector[hvq_band_start[i]], diff, hvq_band_width[i], "HVQ_PVQ_output_chan2" ); + } + } + } +#endif fine_gain_pred( hvq_band_start, hvq_band_end, hvq_band_width, k_sort, npulses, NULL, NULL, pvq_bands, coefs_pvq, pvq_inp_vector, fg_pred, HQ_CORE ); diff --git a/lib_enc/pitch_ol2.c b/lib_enc/pitch_ol2.c index b7864e758..bc414158e 100644 --- a/lib_enc/pitch_ol2.c +++ b/lib_enc/pitch_ol2.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_enc.h" #include "prot.h" diff --git a/lib_enc/pre_proc.c b/lib_enc/pre_proc.c index cb85ea29b..d6ddbc2b6 100644 --- a/lib_enc/pre_proc.c +++ b/lib_enc/pre_proc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_enc.h" #include "rom_com.h" diff --git a/lib_enc/pvq_core_enc.c b/lib_enc/pvq_core_enc.c index 0a8b7954d..5876c8b44 100644 --- a/lib_enc/pvq_core_enc.c +++ b/lib_enc/pvq_core_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "rom_com.h" #include "prot.h" diff --git a/lib_enc/pvq_encode.c b/lib_enc/pvq_encode.c index 17ed334b1..eb066e8ed 100644 --- a/lib_enc/pvq_encode.c +++ b/lib_enc/pvq_encode.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "rom_com.h" diff --git a/lib_enc/q_gain2p.c b/lib_enc/q_gain2p.c index c03f5c430..9c89b44c8 100644 --- a/lib_enc/q_gain2p.c +++ b/lib_enc/q_gain2p.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "cnst.h" diff --git a/lib_enc/qlpc_stoch.c b/lib_enc/qlpc_stoch.c index 05e7d8ec0..31021aee7 100644 --- a/lib_enc/qlpc_stoch.c +++ b/lib_enc/qlpc_stoch.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_enc/range_enc.c b/lib_enc/range_enc.c index 9074c9a9a..8ea8c888d 100644 --- a/lib_enc/range_enc.c +++ b/lib_enc/range_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_enc/re8_cod.c b/lib_enc/re8_cod.c index 72b6c50bb..5facffd8f 100644 --- a/lib_enc/re8_cod.c +++ b/lib_enc/re8_cod.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "wmc_auto.h" diff --git a/lib_enc/reordernorm.c b/lib_enc/reordernorm.c index 96c7c0f52..831adeee5 100644 --- a/lib_enc/reordernorm.c +++ b/lib_enc/reordernorm.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "cnst.h" #include "rom_com.h" diff --git a/lib_enc/rom_enc.c b/lib_enc/rom_enc.c index ea1d5b469..ae96fdfc3 100644 --- a/lib_enc/rom_enc.c +++ b/lib_enc/rom_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "wmc_auto.h" diff --git a/lib_enc/rom_enc.h b/lib_enc/rom_enc.h index 6e39642b4..7e7659ceb 100644 --- a/lib_enc/rom_enc.h +++ b/lib_enc/rom_enc.h @@ -39,6 +39,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "stat_enc.h" #include "cnst.h" diff --git a/lib_enc/rst_enc.c b/lib_enc/rst_enc.c index 023f1998c..3a2041875 100644 --- a/lib_enc/rst_enc.c +++ b/lib_enc/rst_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_enc/setmodeindex.c b/lib_enc/setmodeindex.c index a1b8f9144..b2187b899 100644 --- a/lib_enc/setmodeindex.c +++ b/lib_enc/setmodeindex.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "cnst.h" #include "ivas_cnst.h" diff --git a/lib_enc/sig_clas.c b/lib_enc/sig_clas.c index 3e282c4bc..18ee55df6 100644 --- a/lib_enc/sig_clas.c +++ b/lib_enc/sig_clas.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_enc/speech_music_classif.c b/lib_enc/speech_music_classif.c index 5b50391c0..fac0f01e4 100644 --- a/lib_enc/speech_music_classif.c +++ b/lib_enc/speech_music_classif.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" @@ -334,7 +337,11 @@ void speech_music_classif( } /* Select AUDIO frames */ +#ifdef DEBUGGING + if ( st->codec_mode == MODE1 && ( st->force == 1 || ( st->force == -1 && ( st->sp_aud_decision2 || st->GSC_noisy_speech ) ) ) ) +#else if ( st->codec_mode == MODE1 && ( st->sp_aud_decision2 || st->GSC_noisy_speech ) ) +#endif { st->coder_type = AUDIO; st->hGSCEnc->noise_lev = NOISE_LEVEL_SP0; @@ -1788,6 +1795,9 @@ int16_t ivas_smc_gmm( mvs2s( &hSpMusClas->past_dec[0], &hSpMusClas->past_dec[1], HANG_LEN - 2 ); hSpMusClas->past_dec[0] = dec; +#ifdef DEBUG_MODE_INFO + dbgwrite( &st->hSpMusClas->wdlp_0_95_sp, sizeof( float ), 1, 1, "res/wdlp_0_95_sp.x" ); +#endif return dec; } @@ -1956,6 +1966,38 @@ void ivas_smc_mode_selection( *attack_flag = attack + 1; } +#ifdef DEBUGGING + if ( st->idchan == 0 && st->coder_type != INACTIVE ) + { + if ( st->force == FORCE_GSC && element_brate < IVAS_24k4 ) + { + /* enforce GSC */ + st->sp_aud_decision1 = 1; + st->sp_aud_decision2 = 0; + } + else if ( st->force == FORCE_SPEECH && ( st->sp_aud_decision1 == 1 || st->sp_aud_decision2 == 1 ) ) + { + if ( element_brate < IVAS_24k4 ) + { + /* convert TCX to GSC */ + st->sp_aud_decision1 = 1; + st->sp_aud_decision2 = 0; + } + else + { + /* convert TCX to ACELP */ + st->sp_aud_decision1 = 0; + st->sp_aud_decision2 = 0; + } + } + else if ( st->force == FORCE_MUSIC ) + { + /* enforce TCX */ + st->sp_aud_decision1 = 1; + st->sp_aud_decision2 = 1; + } + } +#endif /* set GSC noisy speech flag on unvoiced SWB segments */ st->GSC_noisy_speech = 0; diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index 3e6fc9a48..b5fc7fdd7 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -39,6 +39,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "stat_com.h" #include "cnst.h" #include "ivas_cnst.h" @@ -1121,6 +1124,9 @@ typedef struct enc_core_structure int16_t idchan; /* channel ID (audio channel number) */ int16_t element_mode; /* element mode */ +#ifdef DEBUGGING + int16_t id_element; /* element ID */ +#endif int32_t element_brate; /* element bitrate */ int16_t codec_mode; /* Mode1 or Mode2 */ int16_t last_codec_mode; /* previous frame Mode 1 or 2 */ @@ -1162,6 +1168,9 @@ typedef struct enc_core_structure int16_t last_Opt_SC_VBR; /* flag indicating prev frame's SC-VBR mode */ int16_t low_rate_mode; /* low-rate mode flag */ int16_t inactive_coder_type_flag; /* inactive coder type flag (0 = AVQ / 1 = GSC) */ +#ifdef DEBUGGING + int16_t force; /* flag indicating specific signal type (0 = speech, 1 = music, -1 = N/A) */ +#endif int16_t ini_frame; /* initialization frames counter */ diff --git a/lib_enc/stat_noise_uv_enc.c b/lib_enc/stat_noise_uv_enc.c index 10894b02f..a1adfb052 100644 --- a/lib_enc/stat_noise_uv_enc.c +++ b/lib_enc/stat_noise_uv_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "rom_com.h" #include "wmc_auto.h" diff --git a/lib_enc/swb_bwe_enc.c b/lib_enc/swb_bwe_enc.c index 3ff74624a..e2c8812ec 100644 --- a/lib_enc/swb_bwe_enc.c +++ b/lib_enc/swb_bwe_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_enc/swb_bwe_enc_hr.c b/lib_enc/swb_bwe_enc_hr.c index ba13ad306..7b2f3687a 100644 --- a/lib_enc/swb_bwe_enc_hr.c +++ b/lib_enc/swb_bwe_enc_hr.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "rom_com.h" diff --git a/lib_enc/swb_bwe_enc_lr.c b/lib_enc/swb_bwe_enc_lr.c index 07cd4b7a4..63c432ea1 100644 --- a/lib_enc/swb_bwe_enc_lr.c +++ b/lib_enc/swb_bwe_enc_lr.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_enc/swb_pre_proc.c b/lib_enc/swb_pre_proc.c index 87d28c0b0..3ec175958 100644 --- a/lib_enc/swb_pre_proc.c +++ b/lib_enc/swb_pre_proc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_enc/swb_tbe_enc.c b/lib_enc/swb_tbe_enc.c index e8573d96b..135e856a9 100644 --- a/lib_enc/swb_tbe_enc.c +++ b/lib_enc/swb_tbe_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_enc/tcq_core_enc.c b/lib_enc/tcq_core_enc.c index 03164a323..aad3e54e7 100644 --- a/lib_enc/tcq_core_enc.c +++ b/lib_enc/tcq_core_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "rom_com.h" #include "prot.h" #include "cnst.h" @@ -51,6 +54,9 @@ ivas_error tcq_core_LR_enc( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ +#ifdef DEBUGGING + const int16_t idchan, +#endif int32_t inp_vector[], const float coefs_norm[], float coefs_quant[], @@ -465,6 +471,35 @@ ivas_error tcq_core_LR_enc( } } +#ifdef DEBUGGING + if ( parenc->num_bits > bit_budget + 1 ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "nTCQ too much bits used! \n" ); + } + + for ( i = 0; i < BANDS; i++ ) + { + float diff[TCQ_MAX_BAND_SIZE]; + + if ( npulses[i] > 0 ) + { + /* SNR measurement */ + for ( j = 0; j < sfmsize[i]; j++ ) + { + diff[j] = coefs_norm[sfm_start[i] + j] - coefs_quant[sfm_start[i] + j]; + } + + if ( idchan == 0 ) + { + snr( &coefs_norm[sfm_start[i]], diff, sfmsize[i], "TCQ_output" ); + } + else + { + snr( &coefs_norm[sfm_start[i]], diff, sfmsize[i], "TCQ_output_chan2" ); + } + } + } +#endif return error; } diff --git a/lib_enc/tcx_ltp_enc.c b/lib_enc/tcx_ltp_enc.c index b8bc7dcd0..0ea2e0424 100644 --- a/lib_enc/tcx_ltp_enc.c +++ b/lib_enc/tcx_ltp_enc.c @@ -36,11 +36,17 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "rom_enc.h" #include "rom_com.h" #include "wmc_auto.h" +#ifdef DEBUG_PLOT +#include "deb_out.h" +#endif /*---------------------------------------------------------------------* diff --git a/lib_enc/tcx_utils_enc.c b/lib_enc/tcx_utils_enc.c index 31473d404..deaab8d69 100644 --- a/lib_enc/tcx_utils_enc.c +++ b/lib_enc/tcx_utils_enc.c @@ -37,6 +37,9 @@ #include #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "prot.h" #include "rom_com.h" diff --git a/lib_enc/transient_detection.c b/lib_enc/transient_detection.c index 43689d333..04cf8ea24 100644 --- a/lib_enc/transient_detection.c +++ b/lib_enc/transient_detection.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "stat_enc.h" #include "cnst.h" #include "prot.h" diff --git a/lib_enc/transition_enc.c b/lib_enc/transition_enc.c index f879066b1..925a6f1c3 100644 --- a/lib_enc/transition_enc.c +++ b/lib_enc/transition_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "rom_com.h" diff --git a/lib_enc/updt_enc.c b/lib_enc/updt_enc.c index a92e7ef47..5cc66667f 100644 --- a/lib_enc/updt_enc.c +++ b/lib_enc/updt_enc.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" diff --git a/lib_enc/updt_tar.c b/lib_enc/updt_tar.c index 52eb709cc..4c3ff4843 100644 --- a/lib_enc/updt_tar.c +++ b/lib_enc/updt_tar.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "prot.h" #include "wmc_auto.h" diff --git a/lib_enc/vad.c b/lib_enc/vad.c index 2486aa843..62c7ccb91 100644 --- a/lib_enc/vad.c +++ b/lib_enc/vad.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_enc/vad_param_updt.c b/lib_enc/vad_param_updt.c index f9b315ec9..b7adac46e 100644 --- a/lib_enc/vad_param_updt.c +++ b/lib_enc/vad_param_updt.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "cnst.h" #include "prot.h" diff --git a/lib_enc/vbr_average_rate.c b/lib_enc/vbr_average_rate.c index 3ee355c55..8e7330c8b 100644 --- a/lib_enc/vbr_average_rate.c +++ b/lib_enc/vbr_average_rate.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "prot.h" #include "rom_com.h" diff --git a/lib_enc/vlpc_1st_cod.c b/lib_enc/vlpc_1st_cod.c index 84afcd816..553cf7e26 100644 --- a/lib_enc/vlpc_1st_cod.c +++ b/lib_enc/vlpc_1st_cod.c @@ -36,6 +36,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include +#endif #include "cnst.h" #include "prot.h" #include "rom_com.h" @@ -58,6 +61,10 @@ static void lsf_weight( float scale = ( (float) sr_core ) / INT_FS_12k8; float freq_max = sr_core / 2.f; +#ifdef DEBUGGING + /* Verify, that M is pair, otherwise adapt exit of loop below */ + assert( ( M & 1 ) == 0 ); +#endif /* weighting function */ inv_di0 = scale / lsfq[0]; @@ -97,6 +104,9 @@ int16_t vlpc_1st_cod( float w[M], x[M]; float dist_min, dist, temp; const float *p_dico; +#ifdef DEBUGGING + int16_t hit = 0; +#endif float scale = ( (float) sr_core ) / INT_FS_12k8; float scaleinv = 1.f / scale; @@ -130,6 +140,9 @@ int16_t vlpc_1st_cod( { dist_min = dist; index = i; +#ifdef DEBUGGING + hit++; /*just for testing*/ +#endif } } @@ -141,6 +154,10 @@ int16_t vlpc_1st_cod( lsfq[j] += scale * *p_dico++; /* += cause it's differential */ } +#ifdef DEBUGGING + assert( index < 256 ); + assert( hit > 0 ); +#endif return index; } diff --git a/lib_rend/ivas_allrad_dec.c b/lib_rend/ivas_allrad_dec.c index abc98d70a..a7d915cf0 100644 --- a/lib_rend/ivas_allrad_dec.c +++ b/lib_rend/ivas_allrad_dec.c @@ -38,9 +38,43 @@ #include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_rom_rend.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" +#ifdef DEBUG_MODE_INFO_ALLRAD +/*-------------------------------------------------------------------------* + * debugMatrix_ivas() + * + * Write a column-major (IVAS-style) flattened matrix to + * a 2D array in a CSV file + *-------------------------------------------------------------------------*/ +static void debugMatrix_ivas( float *mtx, int16_t rows, int16_t cols, char *filename ) +{ + FILE *fid; + int16_t i, j; + + fid = fopen( filename, "w" ); + + if ( fid == NULL ) + { + IVAS_ERROR( IVAS_ERR_FAILED_FILE_WRITE, "Error writing file %s\n", filename ); + return; + } + + for ( i = 0; i < rows; i++ ) + { + for ( j = 0; j < cols - 1; j++ ) + { + fprintf( fid, "%.16f, ", mtx[i * cols + j] ); + } + fprintf( fid, "%.16f\n", mtx[i * cols + j] ); + } + fclose( fid ); +} +#endif /*-----------------------------------------------------------------------* * Global function definitions @@ -158,6 +192,13 @@ ivas_error ivas_sba_get_hoa_dec_matrix( assert( 0 && "ALLRAD: output not supported!!!" ); } +#ifdef DEBUG_MODE_INFO_ALLRAD + { + char filename[50]; + sprintf( filename, "./res/mtx_hoa%d_decoder_allradC.csv", ambisonics_order ); + debugMatrix_ivas( *hoa_dec_mtx, num_spk, SBA_NHARM_HOA3, filename ); + } +#endif return error; } diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 71ad9fec4..6a407f81b 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -41,6 +41,9 @@ #include "ivas_rom_binaural_crend_head.h" #include "ivas_stat_rend.h" #include "lib_rend.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_rend/ivas_dirac_ana.c b/lib_rend/ivas_dirac_ana.c index f848b59ce..2391d7cfa 100644 --- a/lib_rend/ivas_dirac_ana.c +++ b/lib_rend/ivas_dirac_ana.c @@ -38,6 +38,9 @@ #include "prot.h" #include "ivas_stat_rend.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 28b16eb64..95d25965b 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -42,6 +42,9 @@ #include "ivas_rom_rend.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -399,6 +402,9 @@ void ivas_dirac_dec_binaural_render( hSpatParamRendCom = st_ivas->hSpatParamRendCom; nchan_out = BINAURAL_CHANNELS; +#ifdef DEBUGGING + assert( hSpatParamRendCom ); +#endif for ( ch = 0; ch < nchan_out; ch++ ) { output_f_local[ch] = output_f_local_buff[ch]; @@ -417,6 +423,9 @@ void ivas_dirac_dec_binaural_render( last_sf++; } +#ifdef DEBUGGING + assert( slots_to_render == 0 ); +#endif output_length = 0; for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { diff --git a/lib_rend/ivas_dirac_decorr_dec.c b/lib_rend/ivas_dirac_decorr_dec.c index 0240eb7ea..89c2c4a08 100644 --- a/lib_rend/ivas_dirac_decorr_dec.c +++ b/lib_rend/ivas_dirac_decorr_dec.c @@ -40,6 +40,9 @@ #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_rend.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -354,18 +357,27 @@ void ivas_dirac_dec_decorr_process( /* check handles */ if ( h_freq_domain_decorr_ap_params == NULL || h_freq_domain_decorr_ap_state == NULL ) { +#ifdef DEBUGGING + assert( !"Error: NULL pointer.\n" ); +#endif return; } /* check input data */ if ( input_frame_f == NULL ) { +#ifdef DEBUGGING + assert( !"Error: NULL pointer.\n" ); +#endif return; } /* check result arrays */ if ( frame_dec_f == NULL ) { +#ifdef DEBUGGING + assert( !"Error: NULL pointer.\n" ); +#endif return; } @@ -620,11 +632,17 @@ void ivas_dirac_dec_decorr_close( if ( ph_freq_domain_decorr_ap_params == NULL || ph_freq_domain_decorr_ap_state == NULL ) { +#ifdef DEBUGGING + assert( 0 && "Error: Closing decorrelation synthesis failed." ); +#endif return; } if ( *ph_freq_domain_decorr_ap_params == NULL || *ph_freq_domain_decorr_ap_state == NULL ) { +#ifdef DEBUGGING + assert( 0 && "Error: Closing decorrelation synthesis failed." ); +#endif return; } diff --git a/lib_rend/ivas_dirac_onsets_dec.c b/lib_rend/ivas_dirac_onsets_dec.c index 5d24f40ad..8a03dc2c5 100644 --- a/lib_rend/ivas_dirac_onsets_dec.c +++ b/lib_rend/ivas_dirac_onsets_dec.c @@ -40,6 +40,9 @@ #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "ivas_rom_dec.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index a85ea96d0..8ee3b1e4f 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -42,6 +42,9 @@ #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "ivas_rom_dec.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" /*------------------------------------------------------------------------- @@ -2422,6 +2425,9 @@ static void computeAlphaSynthesis( /* check input pointer */ if ( alpha_synthesis == NULL ) { +#ifdef DEBUGGING + assert( !"Error: NULL pointer.\n" ); +#endif return; } diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index b998b9636..9fa1ddd8e 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -40,6 +40,9 @@ #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_rend.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_rend/ivas_efap.c b/lib_rend/ivas_efap.c index 4c202a481..40f5e7312 100644 --- a/lib_rend/ivas_efap.c +++ b/lib_rend/ivas_efap.c @@ -39,6 +39,9 @@ #include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_stat_dec.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" /*-----------------------------------------------------------------------* @@ -80,6 +83,9 @@ static void get_poly_gains( const float azi, const float ele, const float aziPol static float get_tri_gain( const float A[2], const float B[2], const float C[2], const float P_minus_A[2] ); +#ifdef DEBUG_EFAP_POLY_TOFILE +static void get_poly_select( EFAP_POLYSET_DATA *polyData ); +#endif /*-----------------------------------------------------------------------* @@ -455,9 +461,49 @@ static ivas_error poly_init( efap->polyData.numPoly = finalLength; +#ifdef DEBUG_EFAP_POLY_TOFILE + get_poly_select( &efap->polyData ); +#endif return error; } +#ifdef DEBUG_EFAP_POLY_TOFILE +static void get_poly_select( + EFAP_POLYSET_DATA *polyData /* o : Polygon data structure */ +) +{ + int16_t azi_index, ele_index; + float P[2]; + +#ifdef DEBUG_EFAP_POLY_TOFILE + /* Write polygon selection table to .csv file, modify filename according to selected loudspeaker layout! */ + static FILE *pF = NULL; + if ( pF == NULL ) + pF = fopen( "./res/efap_poly_select_cicpX.csv", "w" ); +#endif + + for ( azi_index = 0; azi_index <= ( 360 / PANNING_AZI_RESOLUTION ); azi_index++ ) + { + P[0] = (float) ( ( azi_index * PANNING_AZI_RESOLUTION ) - 180 ); + for ( ele_index = 0; ele_index <= ( 180 / PANNING_ELE_RESOLUTION ); ele_index++ ) + { + P[1] = (float) ( ( ele_index * PANNING_ELE_RESOLUTION ) - 90 ); + +#ifdef DEBUG_EFAP_POLY_TOFILE + if ( pF != NULL ) + fprintf( pF, "%d,", get_poly_num( P, polyData ) ); +#endif + } + } + +#ifdef DEBUG_EFAP_POLY_TOFILE + if ( pF != NULL ) + fclose( pF ); +#endif + + return; +} +#endif /*-------------------------------------------------------------------------* * sphere_triangulation() @@ -2106,6 +2152,9 @@ static int16_t in_poly( if ( numVertices < 3 ) { +#ifdef DEBUGGING + IVAS_ERROR( IVAS_ERR_INTERNAL, "Less than 3 channels in the polygon" ); +#endif return 0; } diff --git a/lib_rend/ivas_limiter.c b/lib_rend/ivas_limiter.c index ae7e3afb8..0953e8a82 100644 --- a/lib_rend/ivas_limiter.c +++ b/lib_rend/ivas_limiter.c @@ -132,6 +132,9 @@ ivas_error ivas_limiter_open( hLimiter->release_heuristic = 0.f; hLimiter->attack_constant = powf( 0.01f, 1.0f / ( IVAS_LIMITER_ATTACK_SECONDS * sampling_rate ) ); hLimiter->strong_saturation_count = 0; +#ifdef DEBUGGING + hLimiter->cnt_frames_limited = 0; +#endif for ( i = 0; i < max_num_channels; ++i ) { @@ -291,6 +294,12 @@ void limiter_process( * ^ * React faster when release time should be increased */ +#ifdef DEBUGGING + if ( max_val > threshold ) + { + hLimiter->cnt_frames_limited++; + } +#endif } else { diff --git a/lib_rend/ivas_mcmasa_ana.c b/lib_rend/ivas_mcmasa_ana.c index d0dd9787d..7ed4aeb0d 100644 --- a/lib_rend/ivas_mcmasa_ana.c +++ b/lib_rend/ivas_mcmasa_ana.c @@ -40,6 +40,9 @@ #include "prot.h" #include "ivas_stat_rend.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 984f35ed3..b80732620 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -38,6 +38,9 @@ #include "ivas_prot_rend.h" #include #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_rend/ivas_objectRenderer_mix.c b/lib_rend/ivas_objectRenderer_mix.c index cf1dba8b2..f65f6a452 100644 --- a/lib_rend/ivas_objectRenderer_mix.c +++ b/lib_rend/ivas_objectRenderer_mix.c @@ -38,6 +38,9 @@ #include "ivas_error.h" #include "wmc_auto.h" #include "ivas_rom_rend.h" +#ifdef DEBUGGING +#include "debug.h" +#endif /*-------------------------------------------------------------------* diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c index 5d948cab8..2706a9c5c 100644 --- a/lib_rend/ivas_objectRenderer_sources.c +++ b/lib_rend/ivas_objectRenderer_sources.c @@ -36,6 +36,9 @@ #include "prot.h" #include "ivas_prot_rend.h" #include "wmc_auto.h" +#ifdef DEBUGGING +#include "debug.h" +#endif /*---------------------------------------------------------------------* diff --git a/lib_rend/ivas_objectRenderer_vec.c b/lib_rend/ivas_objectRenderer_vec.c index 0abde0389..061b790e1 100644 --- a/lib_rend/ivas_objectRenderer_vec.c +++ b/lib_rend/ivas_objectRenderer_vec.c @@ -36,6 +36,9 @@ #include "prot.h" #include "ivas_prot_rend.h" #include "wmc_auto.h" +#ifdef DEBUGGING +#include "debug.h" +#endif /*-------------------------------------------------------------------* diff --git a/lib_rend/ivas_omasa_ana.c b/lib_rend/ivas_omasa_ana.c index dd29384c6..16f0e0b5d 100644 --- a/lib_rend/ivas_omasa_ana.c +++ b/lib_rend/ivas_omasa_ana.c @@ -39,6 +39,9 @@ #include "prot.h" #include "ivas_stat_rend.h" #include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index c540c9911..ff24510c5 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -36,6 +36,9 @@ #include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include #include "wmc_auto.h" diff --git a/lib_rend/ivas_output_init.c b/lib_rend/ivas_output_init.c index ae9312cff..3c92765d4 100644 --- a/lib_rend/ivas_output_init.c +++ b/lib_rend/ivas_output_init.c @@ -37,6 +37,10 @@ #include "ivas_prot_rend.h" #include "ivas_rom_com.h" #include "ivas_prot.h" +#ifdef DEBUGGING +#include "debug.h" +#include +#endif #include "wmc_auto.h" /*-------------------------------------------------------------------------* @@ -226,6 +230,10 @@ void ivas_output_init( /* Default values are used */ break; default: +#ifdef DEBUGGING + /* error */ + assert( !"Error: Unknown output setup!\n" ); +#endif return; } } diff --git a/lib_rend/ivas_reflections.c b/lib_rend/ivas_reflections.c index d5742624c..47143e20c 100644 --- a/lib_rend/ivas_reflections.c +++ b/lib_rend/ivas_reflections.c @@ -42,6 +42,9 @@ #include "ivas_prot.h" #include "ivas_rom_com.h" #include "wmc_auto.h" +#ifdef DEBUGGING +#include "debug.h" +#endif /*-----------------------------------------------------------------------------------------* diff --git a/lib_rend/ivas_render_config.c b/lib_rend/ivas_render_config.c index 7eeaaa54c..1e5aec6d4 100644 --- a/lib_rend/ivas_render_config.c +++ b/lib_rend/ivas_render_config.c @@ -36,6 +36,9 @@ #include "ivas_prot_rend.h" #include "ivas_rom_rend.h" #include "ivas_rom_TdBinauralRenderer.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -106,6 +109,9 @@ ivas_error ivas_render_config_init_from_rom( { return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Unexpected null pointer while attempting to fill renderer configuration from ROM" ); } +#ifdef DEBUGGING + ( *hRenderConfig )->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_NONE; +#endif ( *hRenderConfig )->roomAcoustics.override = FALSE; ( *hRenderConfig )->roomAcoustics.nBands = IVAS_REVERB_DEFAULT_N_BANDS; ( *hRenderConfig )->roomAcoustics.acousticPreDelay = IVAS_REVERB_DEFAULT_PRE_DELAY; diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index cf61669c9..537ecde2c 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -35,6 +35,9 @@ #include "prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "math.h" #include "ivas_rom_rend.h" #include @@ -1167,6 +1170,9 @@ ivas_error ivas_reverb_open( set_reverb_acoustic_data( ¶ms, input_audio_config, hHrtf, &hRenderConfig->roomAcoustics, subframe_len, nr_fc_input, nr_fc_fft_filter ); /* set reverb acoustic configuration based on renderer config */ +#ifdef DEBUGGING + pState->pConfig.renderer_type_override = hRenderConfig->renderer_type_override; +#endif pState->pConfig.roomAcoustics.override = hRenderConfig->roomAcoustics.override; pState->pConfig.roomAcoustics.nBands = hRenderConfig->roomAcoustics.nBands; diff --git a/lib_rend/ivas_reverb_delay_line.c b/lib_rend/ivas_reverb_delay_line.c index 64271ae15..a91551f71 100644 --- a/lib_rend/ivas_reverb_delay_line.c +++ b/lib_rend/ivas_reverb_delay_line.c @@ -35,6 +35,9 @@ #include "ivas_prot.h" #include "ivas_prot_rend.h" #include "prot.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_rend/ivas_reverb_fft_filter.c b/lib_rend/ivas_reverb_fft_filter.c index b1ae53ae7..8b14d2d41 100644 --- a/lib_rend/ivas_reverb_fft_filter.c +++ b/lib_rend/ivas_reverb_fft_filter.c @@ -34,6 +34,9 @@ #include "options.h" #include "prot.h" #include "ivas_prot_rend.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include "wmc_auto.h" diff --git a/lib_rend/ivas_reverb_filter_design.c b/lib_rend/ivas_reverb_filter_design.c index 3bd53cdb4..2c4dc7530 100644 --- a/lib_rend/ivas_reverb_filter_design.c +++ b/lib_rend/ivas_reverb_filter_design.c @@ -34,6 +34,9 @@ #include "options.h" #include "prot.h" #include "ivas_prot_rend.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include #include #include diff --git a/lib_rend/ivas_reverb_iir_filter.c b/lib_rend/ivas_reverb_iir_filter.c index bf326e09b..ce73c9d86 100644 --- a/lib_rend/ivas_reverb_iir_filter.c +++ b/lib_rend/ivas_reverb_iir_filter.c @@ -34,6 +34,9 @@ #include "options.h" #include "prot.h" #include "ivas_prot_rend.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_rend/ivas_reverb_utils.c b/lib_rend/ivas_reverb_utils.c index 3bdc9b2af..23d7592ce 100644 --- a/lib_rend/ivas_reverb_utils.c +++ b/lib_rend/ivas_reverb_utils.c @@ -36,6 +36,9 @@ #include "ivas_prot_rend.h" #include "ivas_rom_rend.h" #include +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_rend/ivas_rom_TdBinauralRenderer.c b/lib_rend/ivas_rom_TdBinauralRenderer.c index a84f26198..c3c8ae118 100644 --- a/lib_rend/ivas_rom_TdBinauralRenderer.c +++ b/lib_rend/ivas_rom_TdBinauralRenderer.c @@ -34,6 +34,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "ivas_cnst.h" #include "wmc_auto.h" diff --git a/lib_rend/ivas_rom_TdBinauralRenderer.h b/lib_rend/ivas_rom_TdBinauralRenderer.h index 8e113b040..e60a72783 100644 --- a/lib_rend/ivas_rom_TdBinauralRenderer.h +++ b/lib_rend/ivas_rom_TdBinauralRenderer.h @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "ivas_cnst.h" diff --git a/lib_rend/ivas_rom_binauralRenderer.c b/lib_rend/ivas_rom_binauralRenderer.c index cc77cc46c..5708cc7e6 100644 --- a/lib_rend/ivas_rom_binauralRenderer.c +++ b/lib_rend/ivas_rom_binauralRenderer.c @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "ivas_cnst.h" #include "wmc_auto.h" diff --git a/lib_rend/ivas_rom_binauralRenderer.h b/lib_rend/ivas_rom_binauralRenderer.h index 656bc44b8..97ec8f390 100644 --- a/lib_rend/ivas_rom_binauralRenderer.h +++ b/lib_rend/ivas_rom_binauralRenderer.h @@ -32,6 +32,9 @@ #include #include "options.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "cnst.h" #include "ivas_cnst.h" diff --git a/lib_rend/ivas_rom_rend.c b/lib_rend/ivas_rom_rend.c index 4a5bb177f..99ffe4428 100644 --- a/lib_rend/ivas_rom_rend.c +++ b/lib_rend/ivas_rom_rend.c @@ -32,6 +32,9 @@ #include "options.h" #include +#ifdef DEBUGGING +#include "debug.h" +#endif #include "ivas_rom_rend.h" /* clang-format off */ diff --git a/lib_rend/ivas_rom_rend.h b/lib_rend/ivas_rom_rend.h index 9e7d0b889..e94efb771 100644 --- a/lib_rend/ivas_rom_rend.h +++ b/lib_rend/ivas_rom_rend.h @@ -35,6 +35,9 @@ #include "options.h" #include +#ifdef DEBUGGING +#include "debug.h" +#endif #include "ivas_cnst.h" #include "ivas_stat_rend.h" diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index bda768ca4..234311672 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -38,6 +38,9 @@ #include "cnst.h" #include "prot.h" #include "ivas_prot_rend.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_rend/ivas_sba_rendering.c b/lib_rend/ivas_sba_rendering.c index 55671330b..6fc30a477 100644 --- a/lib_rend/ivas_sba_rendering.c +++ b/lib_rend/ivas_sba_rendering.c @@ -38,6 +38,9 @@ #include "ivas_stat_dec.h" #include "ivas_cnst.h" #include +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 12175766d..26931b63a 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -1285,6 +1285,9 @@ typedef struct float release_heuristic; float attack_constant; int16_t strong_saturation_count; +#ifdef DEBUGGING + int32_t cnt_frames_limited; /* counter of frames in which the limiter is applied */ +#endif } IVAS_LIMITER, *IVAS_LIMITER_HANDLE; diff --git a/lib_rend/ivas_td_decorr.c b/lib_rend/ivas_td_decorr.c index 8deab7b15..beff2ae36 100644 --- a/lib_rend/ivas_td_decorr.c +++ b/lib_rend/ivas_td_decorr.c @@ -35,6 +35,9 @@ #include "prot.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "math.h" #include #include "wmc_auto.h" diff --git a/lib_rend/ivas_vbap.c b/lib_rend/ivas_vbap.c index 38a7a86c0..602d64df6 100644 --- a/lib_rend/ivas_vbap.c +++ b/lib_rend/ivas_vbap.c @@ -38,6 +38,9 @@ #include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_stat_dec.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" /*-----------------------------------------------------------------------* @@ -492,6 +495,10 @@ void vbap_determine_gains( float *top_virtual_speaker_node_division_gains; float *back_virtual_speaker_node_division_gains; +#ifdef DEBUGGING + assert( hVBAPdata != NULL && "VBAP gain determination requires initialized structure." ); + assert( gains != NULL && "VBAP gain determination requires reserved memory for gain output." ); +#endif push_wmops( "vbap_gains" ); num_speaker_nodes = hVBAPdata->num_speaker_nodes; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 4ffc2cc07..ce38f288d 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -186,6 +186,9 @@ struct IVAS_REND int32_t sampleRateOut; IVAS_LIMITER_HANDLE hLimiter; +#ifdef DEBUGGING + int32_t numClipping; /* Counter of clipped output samples */ +#endif input_ism inputsIsm[RENDERER_MAX_ISM_INPUTS]; input_mc inputsMc[RENDERER_MAX_MC_INPUTS]; @@ -366,6 +369,12 @@ static int32_t limitRendererOutput( /* Apply clipping to buffer in case the limiter let through some samples > 1.0f */ for ( i = 0; i < output_frame * num_channels; ++i ) { +#ifdef DEBUGGING + if ( output[i] < INT16_MIN || output[i] > INT16_MAX ) + { + ++numClipping; + } +#endif output[i] = min( max( INT16_MIN, output[i] ), INT16_MAX ); } @@ -2543,6 +2552,9 @@ ivas_error IVAS_REND_Open( hIvasRend->hLimiter = NULL; hIvasRend->efapOutWrapper.hEfap = NULL; hIvasRend->efapOutWrapper.pCustomLsSetup = NULL; +#ifdef DEBUGGING + hIvasRend->numClipping = 0; +#endif hIvasRend->num_subframes = num_subframes; /* Initialize limiter */ @@ -3701,6 +3713,20 @@ int16_t IVAS_REND_GetRenderConfig( } hRCin = hIvasRend->hRendererConfig; +#ifdef DEBUGGING + switch ( hRCin->renderer_type_override ) + { + case IVAS_RENDER_TYPE_OVERRIDE_CREND: + hRCout->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_CREND; + break; + case IVAS_RENDER_TYPE_OVERRIDE_FASTCONV: + hRCout->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_FASTCONV; + break; + default: + hRCout->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_NONE; + break; + } +#endif hRCout->roomAcoustics.override = hRCin->roomAcoustics.override; hRCout->roomAcoustics.nBands = hRCin->roomAcoustics.nBands; hRCout->roomAcoustics.acousticPreDelay = hRCin->roomAcoustics.acousticPreDelay; @@ -3737,6 +3763,9 @@ int16_t IVAS_REND_FeedRenderConfig( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } hRenderConfig = hIvasRend->hRendererConfig; +#ifdef DEBUGGING + hRenderConfig->renderer_type_override = renderConfig.renderer_type_override; +#endif hRenderConfig->roomAcoustics.override = renderConfig.roomAcoustics.override; hRenderConfig->roomAcoustics.nBands = renderConfig.roomAcoustics.nBands; @@ -4473,6 +4502,9 @@ static int16_t getNumSubframesInBuffer( const int32_t sampleRate ) { +#ifdef DEBUGGING + assert( buffer->config.numSamplesPerChannel % ( sampleRate / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) == 0 ); +#endif return (int16_t) ( buffer->config.numSamplesPerChannel / ( sampleRate / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); } @@ -6272,6 +6304,9 @@ static ivas_error getSamplesInternal( #ifndef DISABLE_LIMITER +#ifdef DEBUGGING + hIvasRend->numClipping += +#endif limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); #endif @@ -6364,6 +6399,30 @@ void IVAS_REND_Close( +#ifdef DEBUGGING +/*-------------------------------------------------------------------* + * IVAS_REND_GetNoCLipping() + * + * + *-------------------------------------------------------------------*/ + +int32_t IVAS_REND_GetNoCLipping( + IVAS_REND_CONST_HANDLE hIvasRend ) +{ + return hIvasRend->numClipping; +} + +int32_t IVAS_REND_GetCntFramesLimited( + IVAS_REND_CONST_HANDLE hIvasRend ) +{ + if ( hIvasRend->hLimiter == NULL ) + { + return 0; + } + + return hIvasRend->hLimiter->cnt_frames_limited; +} +#endif static ivas_error ivas_masa_ext_rend_dirac_rend_init( input_masa *inputMasa ) diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index b8bc3a8a8..a6a479733 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -316,6 +316,15 @@ void IVAS_REND_Close( +#ifdef DEBUGGING +int32_t IVAS_REND_GetNoCLipping( + IVAS_REND_CONST_HANDLE hIvasRend /* i : Renderer handle */ +); + +int32_t IVAS_REND_GetCntFramesLimited( + IVAS_REND_CONST_HANDLE hIvasRend /* i : Renderer handle */ +); +#endif /* clang-format on */ diff --git a/lib_util/bitstream_reader.c b/lib_util/bitstream_reader.c index d103e7e79..2e88746c0 100644 --- a/lib_util/bitstream_reader.c +++ b/lib_util/bitstream_reader.c @@ -263,6 +263,22 @@ cleanup: return error; } +#ifdef DEBUGGING +ivas_error BS_Reader_Rewind( BS_READER_HANDLE hBsReader ) +{ + if ( hBsReader == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + if ( hBsReader->rewind == NULL ) + { + return IVAS_ERR_NOT_IMPLEMENTED; + } + + return hBsReader->rewind( hBsReader->hFormatReader ); +} +#endif ivas_error BS_Reader_ReadFrame_short( BS_READER_HANDLE hBsReader, uint16_t *serial, int16_t *num_bits, int16_t *bfi ) { diff --git a/lib_util/bitstream_reader.h b/lib_util/bitstream_reader.h index 937e8f167..374c19d43 100644 --- a/lib_util/bitstream_reader.h +++ b/lib_util/bitstream_reader.h @@ -58,6 +58,9 @@ typedef struct BS_Reader *BS_READER_HANDLE; ivas_error BS_Reader_Open_filename( BS_READER_HANDLE *phBsReader, const char *filename, BS_READER_FORMAT format ); +#ifdef DEBUGGING +ivas_error BS_Reader_Rewind( BS_READER_HANDLE hBsReader ); +#endif ivas_error BS_Reader_ReadFrame_short( BS_READER_HANDLE hBsReader, uint16_t *serial, int16_t *num_bits, int16_t *bfi ); diff --git a/lib_util/masa_file_reader.c b/lib_util/masa_file_reader.c index 00f3d69a9..5fda0fcc3 100644 --- a/lib_util/masa_file_reader.c +++ b/lib_util/masa_file_reader.c @@ -132,6 +132,9 @@ ivas_error MasaFileReader_readNextFrame( { if ( hMeta->descriptive_meta.formatDescriptor[i] != ivasmasaFormatDescriptor[i] ) { +#ifdef DEBUGGING + fprintf( stderr, "Input format is not IVASMASA\n" ); +#endif return IVAS_ERR_INVALID_MASA_FORMAT_METADATA_FILE; } } diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 9661dcdf2..9ea77d5fa 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -1180,6 +1180,25 @@ ivas_error RenderConfigReader_checkValues( return IVAS_ERR_WRONG_PARAMS; } +#ifdef DEBUGGING + /* Specific limits for Jot reverb */ + if ( hRenderConfig->renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_CREND ) + { + if ( ( pRoom_acoustics->acousticPreDelay > ACOUSTICPREDELAY_JOTREV_MAX ) || ( pRoom_acoustics->acousticPreDelay < ACOUSTICPREDELAY_JOTREV_MIN ) ) + { + return IVAS_ERR_WRONG_PARAMS; + } + } + + /* Specific limits for frequency-domain reverb */ + if ( hRenderConfig->renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV ) + { + if ( ( pRoom_acoustics->acousticPreDelay > ACOUSTICPREDELAY_FDREV_MAX ) || ( pRoom_acoustics->acousticPreDelay < ACOUSTICPREDELAY_FDREV_MIN ) ) + { + return IVAS_ERR_WRONG_PARAMS; + } + } +#endif /* DEBUGGING */ if ( pRoom_acoustics->use_er == 1 ) @@ -1879,6 +1898,9 @@ ivas_error RenderConfigReader_read( while ( sscanf( pParams + params_idx, "%64[^=]=%[^;];", item, pValue ) == 2 ) { params_idx += (int32_t) ( strlen( item ) + strlen( pValue ) + 2 ); +#ifdef DEBUGGING + fprintf( stderr, " PARAM: %s -> %s\n", item, pValue ); +#endif if ( strcmp( item, "FREQUENCYGRIDCOUNT" ) == 0 ) { /* Read the number of frequency grids */ @@ -1950,7 +1972,23 @@ ivas_error RenderConfigReader_read( acIdx = 0; roomAcHasAcEnvCount = TRUE; } +#ifdef DEBUGGING + else + { + fprintf( stderr, "Rendering configuration: unsupported property %s\n", item ); + } +#endif } +#ifdef DEBUGGING + if ( roomAcHasFgCount == FALSE ) + { + fprintf( stderr, "Renderer configuration: frequencyGridCount missing from 'roomAcoustics' chapter.\n\n" ); + } + if ( roomAcHasAcEnvCount == FALSE ) + { + fprintf( stderr, "Renderer configuration: acousticEnvironmentCount missing from 'roomAcoustics' chapter.\n\n" ); + } +#endif if ( roomAcHasFgCount == FALSE || roomAcHasAcEnvCount == FALSE ) { return IVAS_ERR_INVALID_RENDER_CONFIG; @@ -1967,6 +2005,9 @@ ivas_error RenderConfigReader_read( idx = strtol( strtok( NULL, ":" ), NULL, 0 ); if ( idx >= pRenderConfigReader->nFG ) { +#ifdef DEBUGGING + fprintf( stderr, "Rendering configuration: frequency grid with index %d does not fit into the frequency grid array of %d elements.\n", idx, pRenderConfigReader->nFG ); +#endif return IVAS_ERR_INVALID_RENDER_CONFIG; } @@ -1977,6 +2018,9 @@ ivas_error RenderConfigReader_read( while ( sscanf( pParams + params_idx, "%64[^=]=%[^;];", item, pValue ) == 2 ) { params_idx += (int32_t) ( strlen( item ) + strlen( pValue ) + 2 ); +#ifdef DEBUGGING + fprintf( stderr, " PARAM: %s -> %s\n", item, pValue ); +#endif if ( strcmp( item, "METHOD" ) == 0 ) { if ( strcmp( pValue, "INDIVIDUALFREQUENCIES" ) == 0 ) @@ -2133,6 +2177,9 @@ ivas_error RenderConfigReader_read( } else { +#ifdef DEBUGGING + fprintf( stderr, "Rendering configuration: unsupported property %s\n", item ); +#endif break; } params_idx += (int32_t) ( strlen( item ) + strlen( pValue ) + 2 ); @@ -2140,6 +2187,9 @@ ivas_error RenderConfigReader_read( if ( defGridOffset + defGridNrBands > defGridLen ) { +#ifdef DEBUGGING + fprintf( stderr, "Rendering configuration: invalid default banding selection.\n\n" ); +#endif return IVAS_ERR_INVALID_RENDER_CONFIG; } pRenderConfigReader->pFG[idx].nrBands = defGridNrBands; @@ -2156,12 +2206,21 @@ ivas_error RenderConfigReader_read( pRenderConfigReader->pFG[idx].pFc[i] = pDefGrid[defGridOffset + i]; } } +#ifdef DEBUGGING + else + { + fprintf( stderr, "Rendering configuration: unsupported configuration property %s\n", item ); + } +#endif } if ( fgHasMethod == FALSE || ( fgMode == FREQ_GRID_MODE_INDIVIDUAL_FREQUENCIES && ( fgHasFreqs == FALSE || fgHasNBands == FALSE ) ) || ( fgMode == FREQ_GRID_MODE_DEFAULT_BANDING && fgHasDefaultGrid == FALSE ) || ( fgMode == FREQ_GRID_MODE_START_HOP_AMOUNT && ( fgHasStartFreq == FALSE || fgHasFreqHop == FALSE || fgHasNBands == FALSE ) ) ) { +#ifdef DEBUGGING + fprintf( stderr, "Rendering configuration: inconsistent default frequency band configuration.\n\n" ); +#endif return IVAS_ERR_INVALID_RENDER_CONFIG; } free( pValue ); @@ -2183,6 +2242,9 @@ ivas_error RenderConfigReader_read( while ( sscanf( pParams + params_idx, "%64[^=]=%[^;];", item, pValue ) == 2 ) { params_idx += (int32_t) ( strlen( item ) + strlen( pValue ) + 2 ); +#ifdef DEBUGGING + fprintf( stderr, " PARAM: %s -> %s\n", item, pValue ); +#endif /* Frequency grid index */ if ( strcmp( item, "FREQUENCYGRIDINDEX" ) == 0 ) { @@ -2276,6 +2338,9 @@ ivas_error RenderConfigReader_read( { if ( pRenderConfigReader->pAE[acIdx].pEarlyReflections == NULL ) { +#ifdef DEBUGGING + fprintf( stderr, "Rendering configuration: early reflections absorption coefficients specified without room size preceding.\n\n" ); +#endif return IVAS_ERR_INVALID_RENDER_CONFIG; } if ( read_txt_vector( pValue, N_ABS_COEFFS, erTemp ) ) @@ -2293,6 +2358,9 @@ ivas_error RenderConfigReader_read( { if ( pRenderConfigReader->pAE[acIdx].pEarlyReflections == NULL ) { +#ifdef DEBUGGING + fprintf( stderr, "Rendering configuration: early reflections listener origin specified without room size preceding.\n\n" ); +#endif return IVAS_ERR_INVALID_RENDER_CONFIG; } if ( read_txt_vector( pValue, 3, erTemp ) ) @@ -2312,6 +2380,9 @@ ivas_error RenderConfigReader_read( { if ( pRenderConfigReader->pAE[acIdx].pEarlyReflections == NULL ) { +#ifdef DEBUGGING + fprintf( stderr, "Rendering configuration: early reflections low complexity flag specified without room size preceding.\n\n" ); +#endif return IVAS_ERR_INVALID_RENDER_CONFIG; } if ( read_txt_bool( pValue, &pRenderConfigReader->pAE[acIdx].pEarlyReflections->lowComplexity ) ) @@ -2320,7 +2391,35 @@ ivas_error RenderConfigReader_read( return IVAS_ERR_INVALID_RENDER_CONFIG; } } +#ifdef DEBUGGING + else + { + fprintf( stderr, "Rendering configuration: unsupported configuration property %s\n", item ); + } +#endif + } +#ifdef DEBUGGING + if ( aeHasFgIdx == FALSE ) + { + fprintf( stderr, "Renderer configuration: frequencyGridIndex missing from 'acousticEnvironment' %d.\n\n", acIdx ); } + if ( aeHasPredelay == FALSE ) + { + fprintf( stderr, "Renderer configuration: predelay missing from 'acousticEnvironment' %d.\n\n", acIdx ); + } + if ( aeHasRt60 == FALSE ) + { + fprintf( stderr, "Renderer configuration: RT60 missing from 'acousticEnvironment' %d.\n\n", acIdx ); + } + if ( aeHasDsr == FALSE ) + { + fprintf( stderr, "Renderer configuration: DSR missing from 'acousticEnvironment' %d.\n\n", acIdx ); + } + if ( aeHasERsize == TRUE && aeHasERabs == FALSE ) + { + fprintf( stderr, "Renderer configuration: early reflections absorption coefficients missing from 'acousticEnvironment' %d.\n\n", acIdx ); + } +#endif if ( aeHasFgIdx == FALSE || aeHasPredelay == FALSE || aeHasRt60 == FALSE || aeHasDsr == FALSE ) { return IVAS_ERR_INVALID_RENDER_CONFIG; @@ -2346,6 +2445,9 @@ ivas_error RenderConfigReader_read( while ( sscanf( pParams + params_idx, "%64[^=]=%[^;];", item, pValue ) == 2 ) { params_idx += (int32_t) ( strlen( item ) + strlen( pValue ) + 2 ); +#ifdef DEBUGGING + fprintf( stderr, " PARAM: %s -> %s\n", item, pValue ); +#endif if ( strcmp( item, "DIRECTIVITYCOUNT" ) == 0 ) { /* Read the number of directivity chapters */ @@ -2393,6 +2495,9 @@ ivas_error RenderConfigReader_read( while ( sscanf( pParams + params_idx, "%64[^=]=%[^;];", item, pValue ) == 2 ) { params_idx += (int32_t) ( strlen( item ) + strlen( pValue ) + 2 ); +#ifdef DEBUGGING + fprintf( stderr, " PARAM: %s -> %s, DIRECTIVITYPATTERN -> %u\n", item, pValue, idx ); +#endif /* Allocate memory for directivity arrays*/ if ( ( pRenderConfigReader->pDP[accDPIdx].pDirectivity = (float *) malloc( 3 * sizeof( float ) ) ) == NULL ) { @@ -2420,6 +2525,9 @@ ivas_error RenderConfigReader_read( while ( sscanf( pParams + params_idx, "%64[^=]=%[^;];", item, pValue ) == 2 ) { params_length = (int32_t) ( strlen( item ) + strlen( pValue ) + 2 ); +#ifdef DEBUGGING + fprintf( stderr, " PARAM: %s -> %s\n", item, pValue ); +#endif if ( strcmp( item, "BINARYCONFIG" ) == 0 ) { /* get correct case reverb configuration file path */ @@ -2451,6 +2559,25 @@ ivas_error RenderConfigReader_read( free( pCombinedName ); } else +#ifdef DEBUGGING + if ( strcmp( item, "RENDERER" ) == 0 ) + { + if ( strcmp( pValue, "CREND" ) == 0 ) + { + hRenderConfig->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_CREND; + } + else if ( strcmp( pValue, "FASTCONV" ) == 0 ) + { + hRenderConfig->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_FASTCONV; + } + else + { + errorHandler( pValue, ERROR_VALUE_INVALID ); + return IVAS_ERR_INVALID_RENDER_CONFIG; + } + } + else +#endif if ( strcmp( item, "DIRECTIVITY" ) == 0 ) { if ( read_txt_vector( pValue, 3, hRenderConfig->directivity ) ) @@ -2458,6 +2585,12 @@ ivas_error RenderConfigReader_read( errorHandler( item, ERROR_VALUE_INVALID ); } } +#ifdef DEBUGGING + else + { + fprintf( stderr, "Unsupported configuration property %s\n", item ); + } +#endif params_idx += params_length; } free( pValue ); @@ -2471,6 +2604,12 @@ ivas_error RenderConfigReader_read( { /* comment lines are to be ignored */ } +#ifdef DEBUGGING + else + { + fprintf( stderr, "Unsupported configuration property %s\n", item ); + } +#endif } free( pConfig_str ); -- GitLab From 70066e7e33f11e1a7b91b1f897067b164fbbc752 Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Thu, 4 Jul 2024 10:04:53 +0200 Subject: [PATCH 02/10] Restore whitespace differences in MSVC project files --- Workspace_msvc/Workspace_msvc.sln | 206 ++-- Workspace_msvc/decoder.vcxproj | 340 +++--- Workspace_msvc/encoder.vcxproj | 354 +++---- Workspace_msvc/lib_com.vcxproj | 616 +++++------ Workspace_msvc/lib_com.vcxproj.filters | 1100 ++++++++++---------- Workspace_msvc/lib_debug.vcxproj | 235 +++-- Workspace_msvc/lib_dec.vcxproj | 698 ++++++------- Workspace_msvc/lib_dec.vcxproj.filters | 1142 ++++++++++----------- Workspace_msvc/lib_enc.vcxproj | 730 ++++++------- Workspace_msvc/lib_enc.vcxproj.filters | 1256 +++++++++++------------ Workspace_msvc/lib_rend.vcxproj | 412 ++++---- Workspace_msvc/lib_rend.vcxproj.filters | 440 ++++---- Workspace_msvc/lib_util.vcxproj | 310 +++--- Workspace_msvc/renderer.vcxproj | 358 +++---- 14 files changed, 4096 insertions(+), 4101 deletions(-) diff --git a/Workspace_msvc/Workspace_msvc.sln b/Workspace_msvc/Workspace_msvc.sln index dc89573d4..a0783ddbf 100644 --- a/Workspace_msvc/Workspace_msvc.sln +++ b/Workspace_msvc/Workspace_msvc.sln @@ -1,103 +1,103 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.902 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_dec", "lib_dec.vcxproj", "{E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_enc", "lib_enc.vcxproj", "{824DA4CF-06F0-45C9-929A-8792F0E19C3E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_com", "lib_com.vcxproj", "{39EC200D-7795-4FF8-B214-B24EDA5526AE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_rend", "lib_rend.vcxproj", "{718DE063-A18B-BB72-9150-62B892E6FFA6}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_util", "lib_util.vcxproj", "{2FA8F384-0775-F3B7-F8C3-85209222FC70}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_debug", "lib_debug.vcxproj", "{54509728-928B-44D9-A118-A6F92F08B34F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "decoder", "decoder.vcxproj", "{E3DCBC31-7FC9-D127-E000-529F8460D5FD}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "encoder", "encoder.vcxproj", "{B3FC9DFC-7268-8660-7C0D-B60BAF02C554}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "renderer", "renderer.vcxproj", "{12B4C8A5-1E06-4E30-B443-D1F916F52B47}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{51160D4C-55C9-4C16-A792-D94507225746}" - ProjectSection(SolutionItems) = preProject - ..\.clang-format = ..\.clang-format - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}.Debug|Win32.ActiveCfg = Debug|Win32 - {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}.Debug|Win32.Build.0 = Debug|Win32 - {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}.Debug|x64.ActiveCfg = Debug|Win32 - {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}.Release|Win32.ActiveCfg = Release|Win32 - {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}.Release|Win32.Build.0 = Release|Win32 - {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}.Release|x64.ActiveCfg = Release|Win32 - {824DA4CF-06F0-45C9-929A-8792F0E19C3E}.Debug|Win32.ActiveCfg = Debug|Win32 - {824DA4CF-06F0-45C9-929A-8792F0E19C3E}.Debug|Win32.Build.0 = Debug|Win32 - {824DA4CF-06F0-45C9-929A-8792F0E19C3E}.Debug|x64.ActiveCfg = Debug|Win32 - {824DA4CF-06F0-45C9-929A-8792F0E19C3E}.Release|Win32.ActiveCfg = Release|Win32 - {824DA4CF-06F0-45C9-929A-8792F0E19C3E}.Release|Win32.Build.0 = Release|Win32 - {824DA4CF-06F0-45C9-929A-8792F0E19C3E}.Release|x64.ActiveCfg = Release|Win32 - {39EC200D-7795-4FF8-B214-B24EDA5526AE}.Debug|Win32.ActiveCfg = Debug|Win32 - {39EC200D-7795-4FF8-B214-B24EDA5526AE}.Debug|Win32.Build.0 = Debug|Win32 - {39EC200D-7795-4FF8-B214-B24EDA5526AE}.Debug|x64.ActiveCfg = Debug|Win32 - {39EC200D-7795-4FF8-B214-B24EDA5526AE}.Release|Win32.ActiveCfg = Release|Win32 - {39EC200D-7795-4FF8-B214-B24EDA5526AE}.Release|Win32.Build.0 = Release|Win32 - {39EC200D-7795-4FF8-B214-B24EDA5526AE}.Release|x64.ActiveCfg = Release|Win32 - {718DE063-A18B-BB72-9150-62B892E6FFA6}.Debug|Win32.ActiveCfg = Debug|Win32 - {718DE063-A18B-BB72-9150-62B892E6FFA6}.Debug|Win32.Build.0 = Debug|Win32 - {718DE063-A18B-BB72-9150-62B892E6FFA6}.Debug|x64.ActiveCfg = Debug|Win32 - {718DE063-A18B-BB72-9150-62B892E6FFA6}.Release|Win32.ActiveCfg = Release|Win32 - {718DE063-A18B-BB72-9150-62B892E6FFA6}.Release|Win32.Build.0 = Release|Win32 - {718DE063-A18B-BB72-9150-62B892E6FFA6}.Release|x64.ActiveCfg = Release|Win32 - {2FA8F384-0775-F3B7-F8C3-85209222FC70}.Debug|Win32.ActiveCfg = Debug|Win32 - {2FA8F384-0775-F3B7-F8C3-85209222FC70}.Debug|Win32.Build.0 = Debug|Win32 - {2FA8F384-0775-F3B7-F8C3-85209222FC70}.Debug|x64.ActiveCfg = Debug|Win32 - {2FA8F384-0775-F3B7-F8C3-85209222FC70}.Release|Win32.ActiveCfg = Release|Win32 - {2FA8F384-0775-F3B7-F8C3-85209222FC70}.Release|Win32.Build.0 = Release|Win32 - {2FA8F384-0775-F3B7-F8C3-85209222FC70}.Release|x64.ActiveCfg = Release|Win32 - {54509728-928B-44D9-A118-A6F92F08B34F}.Debug|Win32.ActiveCfg = Debug|Win32 - {54509728-928B-44D9-A118-A6F92F08B34F}.Debug|Win32.Build.0 = Debug|Win32 - {54509728-928B-44D9-A118-A6F92F08B34F}.Debug|x64.ActiveCfg = Debug|Win32 - {54509728-928B-44D9-A118-A6F92F08B34F}.Release|Win32.ActiveCfg = Release|Win32 - {54509728-928B-44D9-A118-A6F92F08B34F}.Release|Win32.Build.0 = Release|Win32 - {54509728-928B-44D9-A118-A6F92F08B34F}.Release|x64.ActiveCfg = Release|Win32 - {E3DCBC31-7FC9-D127-E000-529F8460D5FD}.Debug|Win32.ActiveCfg = Debug|Win32 - {E3DCBC31-7FC9-D127-E000-529F8460D5FD}.Debug|Win32.Build.0 = Debug|Win32 - {E3DCBC31-7FC9-D127-E000-529F8460D5FD}.Debug|x64.ActiveCfg = Debug|Win32 - {E3DCBC31-7FC9-D127-E000-529F8460D5FD}.Release|Win32.ActiveCfg = Release|Win32 - {E3DCBC31-7FC9-D127-E000-529F8460D5FD}.Release|Win32.Build.0 = Release|Win32 - {E3DCBC31-7FC9-D127-E000-529F8460D5FD}.Release|x64.ActiveCfg = Release|Win32 - {B3FC9DFC-7268-8660-7C0D-B60BAF02C554}.Debug|Win32.ActiveCfg = Debug|Win32 - {B3FC9DFC-7268-8660-7C0D-B60BAF02C554}.Debug|Win32.Build.0 = Debug|Win32 - {B3FC9DFC-7268-8660-7C0D-B60BAF02C554}.Debug|x64.ActiveCfg = Debug|Win32 - {B3FC9DFC-7268-8660-7C0D-B60BAF02C554}.Release|Win32.ActiveCfg = Release|Win32 - {B3FC9DFC-7268-8660-7C0D-B60BAF02C554}.Release|Win32.Build.0 = Release|Win32 - {B3FC9DFC-7268-8660-7C0D-B60BAF02C554}.Release|x64.ActiveCfg = Release|Win32 - {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Debug|Win32.ActiveCfg = Debug|Win32 - {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Debug|Win32.Build.0 = Debug|Win32 - {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Debug|x64.ActiveCfg = Debug|Win32 - {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Release|Win32.ActiveCfg = Release|Win32 - {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Release|Win32.Build.0 = Release|Win32 - {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Release|x64.ActiveCfg = Release|Win32 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|Win32.ActiveCfg = Debug|Win32 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|Win32.Build.0 = Debug|Win32 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|x64.ActiveCfg = Debug|Win32 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|Win32.ActiveCfg = Release|Win32 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|Win32.Build.0 = Release|Win32 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|x64.ActiveCfg = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {74E3E3B8-3E51-4003-816B-8ED3057AAC21} - EndGlobalSection -EndGlobal +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.902 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_dec", "lib_dec.vcxproj", "{E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_enc", "lib_enc.vcxproj", "{824DA4CF-06F0-45C9-929A-8792F0E19C3E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_com", "lib_com.vcxproj", "{39EC200D-7795-4FF8-B214-B24EDA5526AE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_rend", "lib_rend.vcxproj", "{718DE063-A18B-BB72-9150-62B892E6FFA6}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_util", "lib_util.vcxproj", "{2FA8F384-0775-F3B7-F8C3-85209222FC70}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_debug", "lib_debug.vcxproj", "{54509728-928B-44D9-A118-A6F92F08B34F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "decoder", "decoder.vcxproj", "{E3DCBC31-7FC9-D127-E000-529F8460D5FD}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "encoder", "encoder.vcxproj", "{B3FC9DFC-7268-8660-7C0D-B60BAF02C554}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "renderer", "renderer.vcxproj", "{12B4C8A5-1E06-4E30-B443-D1F916F52B47}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{51160D4C-55C9-4C16-A792-D94507225746}" + ProjectSection(SolutionItems) = preProject + ..\.clang-format = ..\.clang-format + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}.Debug|Win32.ActiveCfg = Debug|Win32 + {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}.Debug|Win32.Build.0 = Debug|Win32 + {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}.Debug|x64.ActiveCfg = Debug|Win32 + {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}.Release|Win32.ActiveCfg = Release|Win32 + {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}.Release|Win32.Build.0 = Release|Win32 + {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3}.Release|x64.ActiveCfg = Release|Win32 + {824DA4CF-06F0-45C9-929A-8792F0E19C3E}.Debug|Win32.ActiveCfg = Debug|Win32 + {824DA4CF-06F0-45C9-929A-8792F0E19C3E}.Debug|Win32.Build.0 = Debug|Win32 + {824DA4CF-06F0-45C9-929A-8792F0E19C3E}.Debug|x64.ActiveCfg = Debug|Win32 + {824DA4CF-06F0-45C9-929A-8792F0E19C3E}.Release|Win32.ActiveCfg = Release|Win32 + {824DA4CF-06F0-45C9-929A-8792F0E19C3E}.Release|Win32.Build.0 = Release|Win32 + {824DA4CF-06F0-45C9-929A-8792F0E19C3E}.Release|x64.ActiveCfg = Release|Win32 + {39EC200D-7795-4FF8-B214-B24EDA5526AE}.Debug|Win32.ActiveCfg = Debug|Win32 + {39EC200D-7795-4FF8-B214-B24EDA5526AE}.Debug|Win32.Build.0 = Debug|Win32 + {39EC200D-7795-4FF8-B214-B24EDA5526AE}.Debug|x64.ActiveCfg = Debug|Win32 + {39EC200D-7795-4FF8-B214-B24EDA5526AE}.Release|Win32.ActiveCfg = Release|Win32 + {39EC200D-7795-4FF8-B214-B24EDA5526AE}.Release|Win32.Build.0 = Release|Win32 + {39EC200D-7795-4FF8-B214-B24EDA5526AE}.Release|x64.ActiveCfg = Release|Win32 + {718DE063-A18B-BB72-9150-62B892E6FFA6}.Debug|Win32.ActiveCfg = Debug|Win32 + {718DE063-A18B-BB72-9150-62B892E6FFA6}.Debug|Win32.Build.0 = Debug|Win32 + {718DE063-A18B-BB72-9150-62B892E6FFA6}.Debug|x64.ActiveCfg = Debug|Win32 + {718DE063-A18B-BB72-9150-62B892E6FFA6}.Release|Win32.ActiveCfg = Release|Win32 + {718DE063-A18B-BB72-9150-62B892E6FFA6}.Release|Win32.Build.0 = Release|Win32 + {718DE063-A18B-BB72-9150-62B892E6FFA6}.Release|x64.ActiveCfg = Release|Win32 + {2FA8F384-0775-F3B7-F8C3-85209222FC70}.Debug|Win32.ActiveCfg = Debug|Win32 + {2FA8F384-0775-F3B7-F8C3-85209222FC70}.Debug|Win32.Build.0 = Debug|Win32 + {2FA8F384-0775-F3B7-F8C3-85209222FC70}.Debug|x64.ActiveCfg = Debug|Win32 + {2FA8F384-0775-F3B7-F8C3-85209222FC70}.Release|Win32.ActiveCfg = Release|Win32 + {2FA8F384-0775-F3B7-F8C3-85209222FC70}.Release|Win32.Build.0 = Release|Win32 + {2FA8F384-0775-F3B7-F8C3-85209222FC70}.Release|x64.ActiveCfg = Release|Win32 + {54509728-928B-44D9-A118-A6F92F08B34F}.Debug|Win32.ActiveCfg = Debug|Win32 + {54509728-928B-44D9-A118-A6F92F08B34F}.Debug|Win32.Build.0 = Debug|Win32 + {54509728-928B-44D9-A118-A6F92F08B34F}.Debug|x64.ActiveCfg = Debug|Win32 + {54509728-928B-44D9-A118-A6F92F08B34F}.Release|Win32.ActiveCfg = Release|Win32 + {54509728-928B-44D9-A118-A6F92F08B34F}.Release|Win32.Build.0 = Release|Win32 + {54509728-928B-44D9-A118-A6F92F08B34F}.Release|x64.ActiveCfg = Release|Win32 + {E3DCBC31-7FC9-D127-E000-529F8460D5FD}.Debug|Win32.ActiveCfg = Debug|Win32 + {E3DCBC31-7FC9-D127-E000-529F8460D5FD}.Debug|Win32.Build.0 = Debug|Win32 + {E3DCBC31-7FC9-D127-E000-529F8460D5FD}.Debug|x64.ActiveCfg = Debug|Win32 + {E3DCBC31-7FC9-D127-E000-529F8460D5FD}.Release|Win32.ActiveCfg = Release|Win32 + {E3DCBC31-7FC9-D127-E000-529F8460D5FD}.Release|Win32.Build.0 = Release|Win32 + {E3DCBC31-7FC9-D127-E000-529F8460D5FD}.Release|x64.ActiveCfg = Release|Win32 + {B3FC9DFC-7268-8660-7C0D-B60BAF02C554}.Debug|Win32.ActiveCfg = Debug|Win32 + {B3FC9DFC-7268-8660-7C0D-B60BAF02C554}.Debug|Win32.Build.0 = Debug|Win32 + {B3FC9DFC-7268-8660-7C0D-B60BAF02C554}.Debug|x64.ActiveCfg = Debug|Win32 + {B3FC9DFC-7268-8660-7C0D-B60BAF02C554}.Release|Win32.ActiveCfg = Release|Win32 + {B3FC9DFC-7268-8660-7C0D-B60BAF02C554}.Release|Win32.Build.0 = Release|Win32 + {B3FC9DFC-7268-8660-7C0D-B60BAF02C554}.Release|x64.ActiveCfg = Release|Win32 + {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Debug|Win32.ActiveCfg = Debug|Win32 + {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Debug|Win32.Build.0 = Debug|Win32 + {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Debug|x64.ActiveCfg = Debug|Win32 + {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Release|Win32.ActiveCfg = Release|Win32 + {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Release|Win32.Build.0 = Release|Win32 + {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Release|x64.ActiveCfg = Release|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|Win32.ActiveCfg = Debug|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|Win32.Build.0 = Debug|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|x64.ActiveCfg = Debug|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|Win32.ActiveCfg = Release|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|Win32.Build.0 = Release|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|x64.ActiveCfg = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {74E3E3B8-3E51-4003-816B-8ED3057AAC21} + EndGlobalSection +EndGlobal diff --git a/Workspace_msvc/decoder.vcxproj b/Workspace_msvc/decoder.vcxproj index 1ea98099d..e59992847 100644 --- a/Workspace_msvc/decoder.vcxproj +++ b/Workspace_msvc/decoder.vcxproj @@ -1,171 +1,171 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - decoder - {E3DCBC31-7FC9-D127-E000-529F8460D5FD} - decoder - 10.0.17763.0 - - - - Application - v141 - false - MultiByte - - - Application - v141 - false - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - ..\ - .\Debug_$(ProjectName)\ - false - false - IVAS_dec - - - ..\ - .\Release_$(ProjectName)\ - false - false - IVAS_dec - - - - - - - $(IntDir)$(ProjectName).tlb - - - - Disabled - ..\lib_dec;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) - - EnableFastChecks - MultiThreadedDebug - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - - $(OutDir)$(TargetName).exe - true - - true - $(IntDir)$(ProjectName).pdb - Console - false - - MachineX86 - - - - - $(IntDir)$(ProjectName).tlb - - - - MaxSpeed - AnySuitable - false - Neither - false - false - ..\lib_dec;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - Precise - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - - Default - %(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - $(OutDir)$(TargetName).exe - true - - false - $(IntDir)$(ProjectName).pdb - Console - false - - MachineX86 - libcmtd.lib - - - - - - - - {e822ddaf-0f5f-4cd0-a694-38ae69de74d3} - false - - - {2fa8f384-0775-f3b7-f8c3-85209222fc70} - false - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + decoder + {E3DCBC31-7FC9-D127-E000-529F8460D5FD} + decoder + 10.0.17763.0 + + + + Application + v141 + false + MultiByte + + + Application + v141 + false + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + ..\ + .\Debug_$(ProjectName)\ + false + false + IVAS_dec + + + ..\ + .\Release_$(ProjectName)\ + false + false + IVAS_dec + + + + + + + $(IntDir)$(ProjectName).tlb + + + + Disabled + ..\lib_dec;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) + + EnableFastChecks + MultiThreadedDebug + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + OldStyle + Default + %(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + + $(OutDir)$(TargetName).exe + true + + true + $(IntDir)$(ProjectName).pdb + Console + false + + MachineX86 + + + + + $(IntDir)$(ProjectName).tlb + + + + MaxSpeed + AnySuitable + false + Neither + false + false + ..\lib_dec;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + Precise + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + + Default + %(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + $(OutDir)$(TargetName).exe + true + + false + $(IntDir)$(ProjectName).pdb + Console + false + + MachineX86 + libcmtd.lib + + + + + + + + {e822ddaf-0f5f-4cd0-a694-38ae69de74d3} + false + + + {2fa8f384-0775-f3b7-f8c3-85209222fc70} + false + + + + + + + + + + \ No newline at end of file diff --git a/Workspace_msvc/encoder.vcxproj b/Workspace_msvc/encoder.vcxproj index 5ec7a2c01..9578e488d 100644 --- a/Workspace_msvc/encoder.vcxproj +++ b/Workspace_msvc/encoder.vcxproj @@ -1,178 +1,178 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - encoder - {B3FC9DFC-7268-8660-7C0D-B60BAF02C554} - encoder - 10.0.17763.0 - - - - Application - v141 - false - MultiByte - - - Application - v141 - false - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - ..\ - .\Debug_$(ProjectName)\ - false - false - IVAS_cod - - - ..\ - .\Release_$(ProjectName)\ - false - false - IVAS_cod - - - - - - - $(IntDir)$(ProjectName).tlb - - - - Disabled - ..\lib_enc;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) - - EnableFastChecks - MultiThreadedDebug - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - - $(OutDir)$(TargetName).exe - true - - false - true - $(IntDir)$(ProjectName).pdb - Console - - false - - MachineX86 - - - - - - - - - - - $(IntDir)$(ProjectName).tlb - - - - MaxSpeed - AnySuitable - false - Neither - false - false - ..\lib_enc;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - Precise - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - - Default - %(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - $(OutDir)$(TargetName).exe - true - - false - $(IntDir)$(ProjectName).pdb - Console - false - - MachineX86 - - - - - - - - {824da4cf-06f0-45c9-929a-8792f0e19c3e} - false - - - {2fa8f384-0775-f3b7-f8c3-85209222fc70} - false - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + encoder + {B3FC9DFC-7268-8660-7C0D-B60BAF02C554} + encoder + 10.0.17763.0 + + + + Application + v141 + false + MultiByte + + + Application + v141 + false + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + ..\ + .\Debug_$(ProjectName)\ + false + false + IVAS_cod + + + ..\ + .\Release_$(ProjectName)\ + false + false + IVAS_cod + + + + + + + $(IntDir)$(ProjectName).tlb + + + + Disabled + ..\lib_enc;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) + + EnableFastChecks + MultiThreadedDebug + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + OldStyle + Default + %(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + + $(OutDir)$(TargetName).exe + true + + false + true + $(IntDir)$(ProjectName).pdb + Console + + false + + MachineX86 + + + + + + + + + + + $(IntDir)$(ProjectName).tlb + + + + MaxSpeed + AnySuitable + false + Neither + false + false + ..\lib_enc;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + Precise + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + + Default + %(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + $(OutDir)$(TargetName).exe + true + + false + $(IntDir)$(ProjectName).pdb + Console + false + + MachineX86 + + + + + + + + {824da4cf-06f0-45c9-929a-8792f0e19c3e} + false + + + {2fa8f384-0775-f3b7-f8c3-85209222fc70} + false + + + + + + + + + + \ No newline at end of file diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj index b118e727a..0c5d4dcca 100644 --- a/Workspace_msvc/lib_com.vcxproj +++ b/Workspace_msvc/lib_com.vcxproj @@ -1,309 +1,309 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {39EC200D-7795-4FF8-B214-B24EDA5526AE} - common - 10.0.17763.0 - - - - StaticLibrary - v141 - false - MultiByte - - - StaticLibrary - v141 - false - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - libivascom - - - .\Release_$(ProjectName)\ - .\Release_$(ProjectName)\ - libivascom - - - - - - - Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) - - EnableFastChecks - MultiThreadedDebug - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - - - MaxSpeed - AnySuitable - false - Neither - false - false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - - - $(IntDir)$(ProjectName).pdb - Level4 - true - - Default - %(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + {39EC200D-7795-4FF8-B214-B24EDA5526AE} + common + 10.0.17763.0 + + + + StaticLibrary + v141 + false + MultiByte + + + StaticLibrary + v141 + false + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + .\Debug_$(ProjectName)\ + .\Debug_$(ProjectName)\ + libivascom + + + .\Release_$(ProjectName)\ + .\Release_$(ProjectName)\ + libivascom + + + + + + + Disabled + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) + + EnableFastChecks + MultiThreadedDebug + + + $(IntDir)$(ProjectName).pdb + Level4 + true + OldStyle + Default + %(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + + + + MaxSpeed + AnySuitable + false + Neither + false + false + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + + + $(IntDir)$(ProjectName).pdb + Level4 + true + + Default + %(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Workspace_msvc/lib_com.vcxproj.filters b/Workspace_msvc/lib_com.vcxproj.filters index 66edeac26..85fd7e8d6 100644 --- a/Workspace_msvc/lib_com.vcxproj.filters +++ b/Workspace_msvc/lib_com.vcxproj.filters @@ -1,551 +1,551 @@ - - - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_evs_c - - - common_evs_c - - - common_evs_c - - - common_evs_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_all_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_evs_c - - - common_evs_c - - - common_evs_c - - - common_evs_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - common_ivas_c - - - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - common_h - - - - common_h - - - - - - {890c2f45-9385-4fce-859b-6a65469e8dc0} - - - {201ea764-9626-4dca-9cc4-5b4106f8b8b2} - - - {fbb860e2-79d0-45b1-ada1-c3a0a369ce2c} - - - {b95b7bed-a666-4a00-9332-2b528638503e} - - + + + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_evs_c + + + common_evs_c + + + common_evs_c + + + common_evs_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_all_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_evs_c + + + common_evs_c + + + common_evs_c + + + common_evs_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + common_ivas_c + + + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + common_h + + + + common_h + + + + + + {890c2f45-9385-4fce-859b-6a65469e8dc0} + + + {201ea764-9626-4dca-9cc4-5b4106f8b8b2} + + + {fbb860e2-79d0-45b1-ada1-c3a0a369ce2c} + + + {b95b7bed-a666-4a00-9332-2b528638503e} + + \ No newline at end of file diff --git a/Workspace_msvc/lib_debug.vcxproj b/Workspace_msvc/lib_debug.vcxproj index 7a3f87e44..f54f282f0 100644 --- a/Workspace_msvc/lib_debug.vcxproj +++ b/Workspace_msvc/lib_debug.vcxproj @@ -1,121 +1,116 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {54509728-928B-44D9-A118-A6F92F08B34F} - debug - 10.0.17763.0 - - - - StaticLibrary - v141 - MultiByte - - - StaticLibrary - v141 - MultiByte - true - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - libivasdebug - - - .\Release_$(ProjectName)\ - .\Release_$(ProjectName)\ - libivasdebug - - - - - - - Disabled - ..\lib_com;..\lib_debug;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) - false - - EnableFastChecks - MultiThreadedDebug - false - $(IntDir)$(ProjectName).pdb - Level4 - OldStyle - Default - %(DisableSpecificWarnings) - - - $(OutDir)$(TargetName).lib - - - - - - - - MaxSpeed - AnySuitable - false - false - ..\lib_com;..\lib_debug;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - $(IntDir)$(ProjectName).pdb - Level4 - - Default - %(DisableSpecificWarnings) - - - $(OutDir)$(TargetName).lib - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + {54509728-928B-44D9-A118-A6F92F08B34F} + debug + 10.0.17763.0 + + + + StaticLibrary + v141 + MultiByte + + + StaticLibrary + v141 + MultiByte + true + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + .\Debug_$(ProjectName)\ + .\Debug_$(ProjectName)\ + libivasdebug + + + .\Release_$(ProjectName)\ + .\Release_$(ProjectName)\ + libivasdebug + + + + + + + Disabled + ..\lib_com;..\lib_debug;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) + false + + EnableFastChecks + MultiThreadedDebug + false + $(IntDir)$(ProjectName).pdb + Level4 + OldStyle + Default + %(DisableSpecificWarnings) + + + $(OutDir)$(TargetName).lib + + + + + + + + MaxSpeed + AnySuitable + false + false + ..\lib_com;..\lib_debug;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + $(IntDir)$(ProjectName).pdb + Level4 + + Default + %(DisableSpecificWarnings) + + + $(OutDir)$(TargetName).lib + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Workspace_msvc/lib_dec.vcxproj b/Workspace_msvc/lib_dec.vcxproj index 55dcb0cdd..0266955ab 100644 --- a/Workspace_msvc/lib_dec.vcxproj +++ b/Workspace_msvc/lib_dec.vcxproj @@ -1,349 +1,349 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - lib_dec - {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3} - evs_dec - 10.0.17763.0 - - - StaticLibrary - v141 - false - MultiByte - - - - StaticLibrary - v141 - false - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - false - false - libivasdec - - - .\Release_$(ProjectName)\ - .\Release_$(ProjectName)\ - false - false - libivasdec - - - - - - - .\Debug\$(ProjectName).tlb - - - - Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) - - EnableFastChecks - MultiThreadedDebug - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - - - $(IntDir)$(ProjectName).tlb - - - - MaxSpeed - AnySuitable - false - Neither - false - false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - - Default - %(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {39ec200d-7795-4ff8-b214-b24eda5526ae} - false - - - {54509728-928b-44d9-a118-a6f92f08b34f} - false - - - {718DE063-A18B-BB72-9150-62B892E6FFA6} - false - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + lib_dec + {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3} + evs_dec + 10.0.17763.0 + + + StaticLibrary + v141 + false + MultiByte + + + + StaticLibrary + v141 + false + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + .\Debug_$(ProjectName)\ + .\Debug_$(ProjectName)\ + false + false + libivasdec + + + .\Release_$(ProjectName)\ + .\Release_$(ProjectName)\ + false + false + libivasdec + + + + + + + .\Debug\$(ProjectName).tlb + + + + Disabled + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) + + EnableFastChecks + MultiThreadedDebug + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + OldStyle + Default + %(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + + + + $(IntDir)$(ProjectName).tlb + + + + MaxSpeed + AnySuitable + false + Neither + false + false + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + + Default + %(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {39ec200d-7795-4ff8-b214-b24eda5526ae} + false + + + {54509728-928b-44d9-a118-a6f92f08b34f} + false + + + {718DE063-A18B-BB72-9150-62B892E6FFA6} + false + + + + + + + + + + + diff --git a/Workspace_msvc/lib_dec.vcxproj.filters b/Workspace_msvc/lib_dec.vcxproj.filters index 80340b480..24d58eb97 100644 --- a/Workspace_msvc/lib_dec.vcxproj.filters +++ b/Workspace_msvc/lib_dec.vcxproj.filters @@ -1,572 +1,572 @@ - - - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_ivas_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_evs_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - decoder_all_c - - - - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - decoder_h - - - - - - {f63b6db2-97ec-4d8d-be9c-e798ac8bb645} - - - {0853864e-7de7-411d-975b-5045652f22c3} - - - {e29aae34-aeeb-45dd-a986-61b39890c5bb} - - - {c33b80b3-67ce-466b-91c0-4adfc9efcb5c} - - + + + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_evs_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + decoder_h + + + + + + {f63b6db2-97ec-4d8d-be9c-e798ac8bb645} + + + {0853864e-7de7-411d-975b-5045652f22c3} + + + {e29aae34-aeeb-45dd-a986-61b39890c5bb} + + + {c33b80b3-67ce-466b-91c0-4adfc9efcb5c} + + \ No newline at end of file diff --git a/Workspace_msvc/lib_enc.vcxproj b/Workspace_msvc/lib_enc.vcxproj index afaac6e1b..e2db02d61 100644 --- a/Workspace_msvc/lib_enc.vcxproj +++ b/Workspace_msvc/lib_enc.vcxproj @@ -1,365 +1,365 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - lib_enc - {824DA4CF-06F0-45C9-929A-8792F0E19C3E} - evs_enc - 10.0.17763.0 - - - - StaticLibrary - v141 - false - MultiByte - - - StaticLibrary - v141 - false - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - false - false - libivasenc - - - .\Release_$(ProjectName)\ - .\Release_$(ProjectName)\ - false - false - libivasenc - - - - - - - $(IntDir)$(ProjectName).tlb - - - - Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) - - EnableFastChecks - MultiThreadedDebug - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - - - - - - $(IntDir)$(ProjectName).tlb - - - - MaxSpeed - AnySuitable - false - Neither - false - false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - Precise - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - - Default - %(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {39ec200d-7795-4ff8-b214-b24eda5526ae} - false - - - {54509728-928b-44d9-a118-a6f92f08b34f} - false - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + lib_enc + {824DA4CF-06F0-45C9-929A-8792F0E19C3E} + evs_enc + 10.0.17763.0 + + + + StaticLibrary + v141 + false + MultiByte + + + StaticLibrary + v141 + false + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + .\Debug_$(ProjectName)\ + .\Debug_$(ProjectName)\ + false + false + libivasenc + + + .\Release_$(ProjectName)\ + .\Release_$(ProjectName)\ + false + false + libivasenc + + + + + + + $(IntDir)$(ProjectName).tlb + + + + Disabled + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) + + EnableFastChecks + MultiThreadedDebug + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + OldStyle + Default + %(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + + + + + + + $(IntDir)$(ProjectName).tlb + + + + MaxSpeed + AnySuitable + false + Neither + false + false + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + Precise + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + + Default + %(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {39ec200d-7795-4ff8-b214-b24eda5526ae} + false + + + {54509728-928b-44d9-a118-a6f92f08b34f} + false + + + + + + + + + + + diff --git a/Workspace_msvc/lib_enc.vcxproj.filters b/Workspace_msvc/lib_enc.vcxproj.filters index 4995de5c9..250aecf0b 100644 --- a/Workspace_msvc/lib_enc.vcxproj.filters +++ b/Workspace_msvc/lib_enc.vcxproj.filters @@ -1,629 +1,629 @@ - - - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_evs_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_all_c - - - enc_evs_c - - - enc_evs_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_all_c - - - enc_evs_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - enc_ivas_c - - - - - enc_h - - - enc_h - - - enc_h - - - enc_h - - - - - - {b7ee0526-8b79-4554-a3ec-04e51d38475f} - - - {dabed049-70a2-48f2-9da6-3b81a3664033} - - - {5717f1cb-c593-400b-b23a-45c422fd95c8} - - - {6cccabbe-510f-43d3-90e1-8ed5ea3837d7} - - + + + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_evs_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_all_c + + + enc_evs_c + + + enc_evs_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_all_c + + + enc_evs_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + enc_ivas_c + + + + + enc_h + + + enc_h + + + enc_h + + + enc_h + + + + + + {b7ee0526-8b79-4554-a3ec-04e51d38475f} + + + {dabed049-70a2-48f2-9da6-3b81a3664033} + + + {5717f1cb-c593-400b-b23a-45c422fd95c8} + + + {6cccabbe-510f-43d3-90e1-8ed5ea3837d7} + + \ No newline at end of file diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index 021a037fb..ee40123a8 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -1,207 +1,207 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - lib_rend - {718DE063-A18B-BB72-9150-62B892E6FFA6} - evs_dec - 10.0.17763.0 - - - StaticLibrary - v141 - false - MultiByte - - - - StaticLibrary - v141 - false - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - false - false - libivasrend - - - .\Release_$(ProjectName)\ - .\Release_$(ProjectName)\ - false - false - libivasrend - - - - - - - .\Debug\$(ProjectName).tlb - - - - Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) - - EnableFastChecks - MultiThreadedDebug - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - - - $(IntDir)$(ProjectName).tlb - - - - MaxSpeed - AnySuitable - false - Neither - false - false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - - Default - %(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {39ec200d-7795-4ff8-b214-b24eda5526ae} - false - - - {54509728-928b-44d9-a118-a6f92f08b34f} - false - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + lib_rend + {718DE063-A18B-BB72-9150-62B892E6FFA6} + evs_dec + 10.0.17763.0 + + + StaticLibrary + v141 + false + MultiByte + + + + StaticLibrary + v141 + false + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + .\Debug_$(ProjectName)\ + .\Debug_$(ProjectName)\ + false + false + libivasrend + + + .\Release_$(ProjectName)\ + .\Release_$(ProjectName)\ + false + false + libivasrend + + + + + + + .\Debug\$(ProjectName).tlb + + + + Disabled + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) + + EnableFastChecks + MultiThreadedDebug + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + OldStyle + Default + %(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + + + + $(IntDir)$(ProjectName).tlb + + + + MaxSpeed + AnySuitable + false + Neither + false + false + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + + Default + %(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + WS2_32.lib; %(AdditionalDependencies) + $(OutDir)$(TargetName).lib + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {39ec200d-7795-4ff8-b214-b24eda5526ae} + false + + + {54509728-928b-44d9-a118-a6f92f08b34f} + false + + + + + + + + + + \ No newline at end of file diff --git a/Workspace_msvc/lib_rend.vcxproj.filters b/Workspace_msvc/lib_rend.vcxproj.filters index e5e6c9401..4707a48b2 100644 --- a/Workspace_msvc/lib_rend.vcxproj.filters +++ b/Workspace_msvc/lib_rend.vcxproj.filters @@ -1,221 +1,221 @@ - - - - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - rend_c - - - - - - rend_h - - - rend_h - - - rend_h - - - rend_h - - - rend_h - - - rend_h - - - rend_h - - - rend_h - - - rend_h - - - rend_h - - - rend_h - - - - - {54449ece-ef29-44b5-9512-ed8f555851a8} - - - {672b0eb6-cce8-425c-8bf2-aba4b45639bb} - - + + + + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + + + + rend_h + + + rend_h + + + rend_h + + + rend_h + + + rend_h + + + rend_h + + + rend_h + + + rend_h + + + rend_h + + + rend_h + + + rend_h + + + + + {54449ece-ef29-44b5-9512-ed8f555851a8} + + + {672b0eb6-cce8-425c-8bf2-aba4b45639bb} + + \ No newline at end of file diff --git a/Workspace_msvc/lib_util.vcxproj b/Workspace_msvc/lib_util.vcxproj index 889d6f79c..6696ee00a 100644 --- a/Workspace_msvc/lib_util.vcxproj +++ b/Workspace_msvc/lib_util.vcxproj @@ -1,156 +1,156 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {2FA8F384-0775-F3B7-F8C3-85209222FC70} - utility - 10.0.17763.0 - - - - StaticLibrary - v141 - MultiByte - - - StaticLibrary - v141 - MultiByte - true - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - true - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - libivasutil - - - false - .\Release_$(ProjectName)\ - .\Release_$(ProjectName)\ - libivasutil - - - - Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);ZLIB_WINAPI;%(PreprocessorDefinitions) - false - - EnableFastChecks - MultiThreadedDebug - false - $(IntDir)$(ProjectName).pdb - Level4 - OldStyle - Default - %(DisableSpecificWarnings) - - - $(OutDir)$(TargetName).lib - - - - - MaxSpeed - AnySuitable - false - false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);ZLIB_WINAPI;%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - $(IntDir)$(ProjectName).pdb - Level4 - - Default - %(DisableSpecificWarnings) - - - $(OutDir)$(TargetName).lib - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + {2FA8F384-0775-F3B7-F8C3-85209222FC70} + utility + 10.0.17763.0 + + + + StaticLibrary + v141 + MultiByte + + + StaticLibrary + v141 + MultiByte + true + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + true + .\Debug_$(ProjectName)\ + .\Debug_$(ProjectName)\ + libivasutil + + + false + .\Release_$(ProjectName)\ + .\Release_$(ProjectName)\ + libivasutil + + + + Disabled + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);ZLIB_WINAPI;%(PreprocessorDefinitions) + false + + EnableFastChecks + MultiThreadedDebug + false + $(IntDir)$(ProjectName).pdb + Level4 + OldStyle + Default + %(DisableSpecificWarnings) + + + $(OutDir)$(TargetName).lib + + + + + MaxSpeed + AnySuitable + false + false + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);ZLIB_WINAPI;%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + $(IntDir)$(ProjectName).pdb + Level4 + + Default + %(DisableSpecificWarnings) + + + $(OutDir)$(TargetName).lib + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Workspace_msvc/renderer.vcxproj b/Workspace_msvc/renderer.vcxproj index b51cde0bc..c62874ec0 100644 --- a/Workspace_msvc/renderer.vcxproj +++ b/Workspace_msvc/renderer.vcxproj @@ -1,180 +1,180 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - renderer - {12B4C8A5-1E06-4E30-B443-D1F916F52B47} - renderer - 10.0.17763.0 - - - - Application - v141 - false - MultiByte - - - Application - v141 - false - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>15.0.27428.2015 - - - ..\ - .\Debug_$(ProjectName)\ - false - false - IVAS_rend - - - ..\ - .\Release_$(ProjectName)\ - false - false - IVAS_rend - - - - $(IntDir)$(ProjectName).tlb - - - - Disabled - ..\lib_com;..\lib_debug;..\lib_util;..\lib_rend;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) - - EnableFastChecks - MultiThreadedDebug - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - - $(OutDir)$(TargetName).exe - true - - true - $(IntDir)$(ProjectName).pdb - Console - false - - MachineX86 - - - - - $(IntDir)$(ProjectName).tlb - - - - MaxSpeed - AnySuitable - false - Neither - false - false - ..\lib_com;..\lib_debug;..\lib_util;..\lib_rend;.%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) - true - - Default - MultiThreaded - true - Precise - false - - - $(IntDir)$(ProjectName).pdb - Level4 - true - - Default - %(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - $(OutDir)$(TargetName).exe - true - - false - $(IntDir)$(ProjectName).pdb - Console - false - - MachineX86 - libcmtd.lib - - - - - - - - {54509728-928B-44D9-A118-A6F92F08B34F} - false - - - {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3} - false - - - {2FA8F384-0775-F3B7-F8C3-85209222FC70} - false - - - {39ec200d-7795-4ff8-b214-b24eda5526ae} - false - - - {718DE063-A18B-BB72-9150-62B892E6FFA6} - false - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + renderer + {12B4C8A5-1E06-4E30-B443-D1F916F52B47} + renderer + 10.0.17763.0 + + + + Application + v141 + false + MultiByte + + + Application + v141 + false + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27428.2015 + + + ..\ + .\Debug_$(ProjectName)\ + false + false + IVAS_rend + + + ..\ + .\Release_$(ProjectName)\ + false + false + IVAS_rend + + + + $(IntDir)$(ProjectName).tlb + + + + Disabled + ..\lib_com;..\lib_debug;..\lib_util;..\lib_rend;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) + + EnableFastChecks + MultiThreadedDebug + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + OldStyle + Default + %(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + + $(OutDir)$(TargetName).exe + true + + true + $(IntDir)$(ProjectName).pdb + Console + false + + MachineX86 + + + + + $(IntDir)$(ProjectName).tlb + + + + MaxSpeed + AnySuitable + false + Neither + false + false + ..\lib_com;..\lib_debug;..\lib_util;..\lib_rend;.%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) + true + + Default + MultiThreaded + true + Precise + false + + + $(IntDir)$(ProjectName).pdb + Level4 + true + + Default + %(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c0c + + + $(OutDir)$(TargetName).exe + true + + false + $(IntDir)$(ProjectName).pdb + Console + false + + MachineX86 + libcmtd.lib + + + + + + + + {54509728-928B-44D9-A118-A6F92F08B34F} + false + + + {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3} + false + + + {2FA8F384-0775-F3B7-F8C3-85209222FC70} + false + + + {39ec200d-7795-4ff8-b214-b24eda5526ae} + false + + + {718DE063-A18B-BB72-9150-62B892E6FFA6} + false + + + + + + + + + + \ No newline at end of file -- GitLab From a79f18fce382ce99a3fc818e5645096388c35e59 Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Thu, 4 Jul 2024 17:28:24 +0200 Subject: [PATCH 03/10] Disable assert that is hit with -10 dB with DEBUGGING active --- lib_com/options.h | 3 +++ lib_enc/ivas_stereo_dft_enc.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 62f0c8807..680ca88e1 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -58,6 +58,9 @@ #ifdef DEBUGGING +#define DISABLE_DFT_STEREO_ASSERT /* This assert is hit for -10 dB tests/codec_be_on_mr_nonselection/test_param_file.py::test_param_file_tests[stv-stereo at 32 kbps, 48kHz in, 48kHz out, DTX on, random FER at 5%, bandwidth switching] */ + + /*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ #ifdef DEBUG_MODE_INFO /*#define DEBUG_MODE_ACELP*/ /* output most important ACELP core parameters to the subdirectory "res/" */ diff --git a/lib_enc/ivas_stereo_dft_enc.c b/lib_enc/ivas_stereo_dft_enc.c index 109def1fd..84c978034 100644 --- a/lib_enc/ivas_stereo_dft_enc.c +++ b/lib_enc/ivas_stereo_dft_enc.c @@ -140,9 +140,11 @@ void stereo_dft_quantize_res_gains( } #ifdef DEBUGGING +#ifndef DISABLE_DFT_STEREO_ASSERT /* the following assertions should be satisfied by the input data: */ assert( 1 - gg * gg + EPSILON >= rr * rr / 2 ); assert( gg <= 1 ); +#endif #endif gg = min( gg, 1 - EPSILON ); -- GitLab From daff34a2fd8058967390f6b6f0410e78c71c4826 Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Wed, 31 Jul 2024 11:53:33 +0200 Subject: [PATCH 04/10] update wmc_auto.[h|c] to that of the IVAS float repo --- lib_debug/wmc_auto.c | 113 +++++++++++++++++++++------- lib_debug/wmc_auto.h | 174 ++++++++++++++++++++++--------------------- 2 files changed, 175 insertions(+), 112 deletions(-) diff --git a/lib_debug/wmc_auto.c b/lib_debug/wmc_auto.c index 0ff7786f0..1ab20a2ee 100644 --- a/lib_debug/wmc_auto.c +++ b/lib_debug/wmc_auto.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #ifndef _MSC_VER @@ -36,12 +37,14 @@ * Complexity counting tool *--------------------------------------------------------------------*/ -#define MAX_FUNCTION_NAME_LENGTH 50 /* Maximum length of the function name */ -#define MAX_PARAMS_LENGTH 50 /* Maximum length of the function parameter string */ -#define MAX_NUM_RECORDS 300 /* Initial maximum number of records -> mightb be increased during runtime, if needed */ +#define MAX_FUNCTION_NAME_LENGTH 200 /* Maximum length of the function name */ +#define MAX_PARAMS_LENGTH 200 /* Maximum length of the function parameter string */ +#define MAX_NUM_RECORDS 300 /* Initial maximum number of records -> might be increased during runtime, if needed */ #define MAX_NUM_RECORDS_REALLOC_STEP 50 /* When re-allocating the list of records, increase the number of records by this number */ #define MAX_CALL_TREE_DEPTH 100 /* maximum depth of the function call tree */ #define DOUBLE_MAX 0x80000000 +#define FAC ( FRAMES_PER_SECOND / 1e6 ) + typedef struct { @@ -123,7 +126,7 @@ void reset_wmops( void ) exit( -1 ); } - /* initilize the list of wmops records */ + /* initilize the list of WMOPS records */ /* initilize the BASOP WMOPS counters */ for ( i = 0; i < max_num_wmops_records; i++ ) { @@ -186,35 +189,84 @@ void reset_wmops( void ) return; } - -void push_wmops( const char *label ) +void push_wmops_fct( const char *label, ... ) { int new_flag; - int i, j; + int i, j, index_record; + unsigned int *ptr; + va_list arg; + char func_name[MAX_FUNCTION_NAME_LENGTH] = ""; + + /* concatenate all function name labels into a single string */ + va_start( arg, label ); + while ( label ) + { + strcat( func_name, label ); + label = va_arg( arg, const char * ); + } + va_end( arg ); /* Check, if this is a new function label */ new_flag = 1; for ( i = 0; i < num_wmops_records; i++ ) { - if ( strcmp( wmops[i].label, label ) == 0 ) + if ( strcmp( wmops[i].label, func_name ) == 0 ) { new_flag = 0; break; } } + index_record = i; /* Create a new record in the list */ if ( new_flag ) { if ( num_wmops_records >= max_num_wmops_records ) { - /* There is no room for a new wmops record -> reallocate the list */ + /* There is no room for a new WMOPS record -> reallocate the list */ max_num_wmops_records += MAX_NUM_RECORDS_REALLOC_STEP; wmops = realloc( wmops, max_num_wmops_records * sizeof( wmops_record ) ); multiCounter = realloc( multiCounter, max_num_wmops_records * sizeof( BASIC_OP ) ); + + /* initilize newly created WMOPS records */ + for ( i = num_wmops_records; i < max_num_wmops_records; i++ ) + { + strcpy( &wmops[i].label[0], "\0" ); + wmops[i].call_number = 0; + wmops[i].update_cnt = 0; + for ( j = 0; j < MAX_CALL_TREE_DEPTH; j++ ) + { + wmops[i].call_tree[j] = -1; + } + wmops[i].start_selfcnt = 0.0; + wmops[i].current_selfcnt = 0.0; + wmops[i].max_selfcnt = 0.0; + wmops[i].min_selfcnt = DOUBLE_MAX; + wmops[i].tot_selfcnt = 0.0; + wmops[i].start_cnt = 0.0; + wmops[i].current_cnt = 0.0; + wmops[i].max_cnt = 0.0; + wmops[i].min_cnt = DOUBLE_MAX; + wmops[i].tot_cnt = 0.0; +#ifdef WMOPS_WC_FRAME_ANALYSIS + wmops[i].wc_cnt = 0.0; + wmops[i].wc_selfcnt = 0.0; + wmops[i].current_call_number = 0; + wmops[i].wc_call_number = -1; +#endif + + /* initialize BASOP WMOPS counters */ + ptr = (unsigned int *) &multiCounter[i]; + for ( j = 0; j < (int) ( sizeof( BASIC_OP ) / sizeof( unsigned int ) ); j++ ) + { + *ptr++ = 0; + } + wmops[i].LastWOper = 0; + } + } - strcpy( wmops[i].label, label ); + strcpy( wmops[index_record].label, func_name ); num_wmops_records++; } @@ -236,29 +288,29 @@ void push_wmops( const char *label ) /* update call tree */ for ( j = 0; j < MAX_CALL_TREE_DEPTH; j++ ) { - if ( wmops[i].call_tree[j] == current_record ) + if ( wmops[index_record].call_tree[j] == current_record ) { break; } - else if ( wmops[i].call_tree[j] == -1 ) + else if ( wmops[index_record].call_tree[j] == -1 ) { - wmops[i].call_tree[j] = current_record; + wmops[index_record].call_tree[j] = current_record; break; } } } /* update the current context info */ - current_record = i; - wmops[current_record].start_selfcnt = ops_cnt; - wmops[current_record].start_cnt = ops_cnt; - wmops[current_record].call_number++; + current_record = index_record; + wmops[index_record].start_selfcnt = ops_cnt; + wmops[index_record].start_cnt = ops_cnt; + wmops[index_record].call_number++; #ifdef WMOPS_WC_FRAME_ANALYSIS - wmops[current_record].current_call_number++; + wmops[index_record].current_call_number++; #endif /* set the ID of BASOP functions counters */ - Set_BASOP_WMOPS_counter( current_record ); + Set_BASOP_WMOPS_counter( index_record ); return; } @@ -1095,7 +1147,7 @@ void *mem_alloc( #ifdef MEM_COUNT_DETAILS /* Export heap memory allocation record to the .csv file */ - fprintf( fid_csv_filename, "A,%d,%s,%d,%d\n", update_cnt, ptr_record->name, ptr_record->lineno, ptr_record->block_size ); + fprintf( fid_csv_filename, "A,%ld,%s,%d,%d\n", update_cnt, ptr_record->name, ptr_record->lineno, ptr_record->block_size ); #endif if ( ptr_record->frame_allocated != -1 ) @@ -1393,8 +1445,8 @@ allocator_record *get_mem_record( unsigned long *hash, const char *func_name, in /*-------------------------------------------------------------------* * mem_free() * - * This function de-allocatesd the memory block and frees the mphysical memory with free(). - * It also updates actual and average usage of the memory block. + * This function de-allocates memory blocks and frees physical memory with free(). + * It also updates the actual and average usage of memory blocks. * * Note: The record is not removed from the list and may be reused later on in mem_alloc()! *--------------------------------------------------------------------*/ @@ -1435,7 +1487,7 @@ void mem_free( const char *func_name, int func_lineno, void *ptr ) #ifdef MEM_COUNT_DETAILS /* Export heap memory de-allocation record to the .csv file */ - fprintf( fid_csv_filename, "D,%d,%s,%d,%d\n", update_cnt, ptr_record->name, ptr_record->lineno, ptr_record->block_size ); + fprintf( fid_csv_filename, "D,%ld,%s,%d,%d\n", update_cnt, ptr_record->name, ptr_record->lineno, ptr_record->block_size ); #endif /* De-Allocate Memory Block */ @@ -1695,7 +1747,7 @@ static void mem_count_summary( void ) allocator_record *ptr_record, *ptr; /* Prepare format string */ - sprintf( format_str, "%%-%ds %%5s %%6s %%-%ds %%20s %%6s ", MAX_FUNCTION_NAME_LENGTH, MAX_PARAMS_LENGTH ); + sprintf( format_str, "%%-%d.%ds %%5.5s %%6.6s %%-%d.%ds %%20.20s %%6.6s ", 50, 50, 50, 50 ); if ( n_items_wc_intra_frame_heap > 0 ) { @@ -1903,8 +1955,8 @@ void print_mem( ROM_Size_Lookup_Table Const_Data_PROM_Table[] ) } else { - /* bytes */ - fprintf( stdout, "Program ROM size (%s): %d bytes\n", Const_Data_PROM_Table[i].file_spec, Const_Data_PROM_Table[i].PROM_size << Stat_Cnt_Size ); + /* bytes (here, we assume that each instruction takes PROM_INST_SIZE bits of the PROM memory) */ + fprintf( stdout, "Program ROM size (%s): %d bytes\n", Const_Data_PROM_Table[i].file_spec, Const_Data_PROM_Table[i].PROM_size * ( PROM_INST_SIZE / 8 ) ); } } @@ -1994,10 +2046,15 @@ void print_mem( ROM_Size_Lookup_Table Const_Data_PROM_Table[] ) mem_count_summary(); #endif - if ( Stat_Cnt_Size == 0 ) + if ( Stat_Cnt_Size > 0 ) + { + /* words */ + fprintf( stdout, "\nNote: The Program ROM size is calculated under the assumption that 1 instruction word is stored with %d bits\n", 8 << Stat_Cnt_Size ); + } + else { /* bytes */ - fprintf( stdout, "\nNote: The Program ROM size is calculated under the assumption that 1 instruction word is stored with %d bytes (%d bits)\n", 1 << Stat_Cnt_Size, 8 << Stat_Cnt_Size ); + fprintf( stdout, "\nNote: The Program ROM size is calculated under the assumption that 1 instruction word is stored with %d bits\n", PROM_INST_SIZE ); } fprintf( stdout, "Note: The Data ROM size is calculated using the sizeof(type) built-in function\n" ); diff --git a/lib_debug/wmc_auto.h b/lib_debug/wmc_auto.h index e2f2af4d8..42110465e 100644 --- a/lib_debug/wmc_auto.h +++ b/lib_debug/wmc_auto.h @@ -33,10 +33,8 @@ #define INT_MAX 32767 #endif -/* Real-time relationships */ #define FRAMES_PER_SECOND 50.0 -#define WMOPS_BOOST_FAC ( 1.0f ) /* scaling factor for equalizing the difference between automatic and manual instrumentation */ -#define FAC ( FRAMES_PER_SECOND / 1e6 * WMOPS_BOOST_FAC ) +#define PROM_INST_SIZE 32 /* number of bits of each program instruction when stored in the PROM memory (applied only when the user selects reporting in bytes) */ #ifdef WMOPS enum instructions @@ -565,7 +563,8 @@ extern double prom_cnt; extern double inst_cnt[NUM_INST]; void reset_wmops( void ); -void push_wmops( const char *label ); +#define push_wmops( ... ) push_wmops_fct( __VA_ARGS__, NULL ) +void push_wmops_fct( const char *label, ... ); void pop_wmops( void ); void update_wmops( void ); void update_mem( void ); @@ -615,14 +614,6 @@ extern int cntr_push_pop; #endif -/* mac & msu (Non Instrumented Versions) */ -#ifndef mac -#define mac( a, b, c ) ( ( a ) + ( b ) * ( c ) ) -#endif -#ifndef mac -#define msu( a, b, c ) ( ( a ) - ( b ) * ( c ) ) -#endif - #ifndef WMOPS /* DESACTIVATE the Counting Mechanism */ #define OP_COUNT_( op, n ) @@ -670,84 +661,99 @@ static int wmc_flag_ = 0; #endif /* Define all Macros without '{' & '}' (None of these should be called externally!) */ -#define ABS_( x ) OP_COUNT_( _ABS, ( x ) / WMOPS_BOOST_FAC ) -#define ADD_( x ) OP_COUNT_( _ADD, ( x ) / WMOPS_BOOST_FAC ) -#define MULT_( x ) OP_COUNT_( _MULT, ( x ) / WMOPS_BOOST_FAC ) -#define MAC_( x ) OP_COUNT_( _MAC, ( x ) / WMOPS_BOOST_FAC ) -#define MOVE_( x ) OP_COUNT_( _MOVE, ( x ) / WMOPS_BOOST_FAC ) -#define STORE_( x ) OP_COUNT_( _STORE, ( x ) / WMOPS_BOOST_FAC ) -#define LOGIC_( x ) OP_COUNT_( _LOGIC, ( x ) / WMOPS_BOOST_FAC ) -#define SHIFT_( x ) OP_COUNT_( _SHIFT, ( x ) / WMOPS_BOOST_FAC ) -#define BRANCH_( x ) OP_COUNT_( _BRANCH, ( x ) / WMOPS_BOOST_FAC ) -#define DIV_( x ) OP_COUNT_( _DIV, ( x ) / WMOPS_BOOST_FAC ) -#define SQRT_( x ) OP_COUNT_( _SQRT, ( x ) / WMOPS_BOOST_FAC ) -#define TRANS_( x ) OP_COUNT_( _TRANS, ( x ) / WMOPS_BOOST_FAC ) +#define ABS_( x ) OP_COUNT_( _ABS, ( x ) ) +#define ADD_( x ) OP_COUNT_( _ADD, ( x ) ) +#define MULT_( x ) OP_COUNT_( _MULT, ( x ) ) +#define MAC_( x ) OP_COUNT_( _MAC, ( x ) ) +#define MOVE_( x ) OP_COUNT_( _MOVE, ( x ) ) +#define STORE_( x ) OP_COUNT_( _STORE, ( x ) ) +#define LOGIC_( x ) OP_COUNT_( _LOGIC, ( x ) ) +#define SHIFT_( x ) OP_COUNT_( _SHIFT, ( x ) ) +#define BRANCH_( x ) OP_COUNT_( _BRANCH, ( x ) ) +#define DIV_( x ) OP_COUNT_( _DIV, ( x ) ) +#define SQRT_( x ) OP_COUNT_( _SQRT, ( x ) ) +#define TRANS_( x ) OP_COUNT_( _TRANS, ( x ) ) #define POWER_( x ) TRANS_( x ) #define LOG_( x ) TRANS_( x ) -#define LOOP_( x ) OP_COUNT_( _LOOP, ( x ) / WMOPS_BOOST_FAC ) -#define INDIRECT_( x ) OP_COUNT_( _INDIRECT, ( x ) / WMOPS_BOOST_FAC ) -#define PTR_INIT_( x ) OP_COUNT_( _PTR_INIT, ( x ) / WMOPS_BOOST_FAC ) -#define FUNC_( x ) ( OP_COUNT_( _MOVE, ( x ) / WMOPS_BOOST_FAC ), OP_COUNT_( _FUNC, 1 ) ) +#define LOOP_( x ) OP_COUNT_( _LOOP, ( x ) ) +#define INDIRECT_( x ) OP_COUNT_( _INDIRECT, ( x ) ) +#define PTR_INIT_( x ) OP_COUNT_( _PTR_INIT, ( x ) ) +#define FUNC_( x ) ( OP_COUNT_( _MOVE, ( x ) ), OP_COUNT_( _FUNC, 1 ) ) #define MISC_( x ) ABS_( x ) /* Math Operations */ -#define abs_ OP_COUNT_WRAPPER1_( ABS_( 1 ), abs ) -#define fabs_ OP_COUNT_WRAPPER1_( ABS_( 1 ), fabs ) -#define labs_ OP_COUNT_WRAPPER1_( ABS_( 1 ), labs ) -#define floor_ OP_COUNT_WRAPPER1_( MISC_( 1 ), floor ) -#define sqrt_ OP_COUNT_WRAPPER1_( SQRT_( 1 ), sqrt ) -#define pow_ OP_COUNT_WRAPPER1_( POWER_( 1 ), pow ) -#define exp_ OP_COUNT_WRAPPER1_( POWER_( 1 ), exp ) -#define log_ OP_COUNT_WRAPPER1_( LOG_( 1 ), log ) -#define log10_ OP_COUNT_WRAPPER1_( LOG_( 1 ), log10 ) -#define cos_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), cos ) -#define sin_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), sin ) -#define tan_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), tan ) -#define acos_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), acos ) -#define asin_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), asin ) -#define atan_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), atan ) -#define atan2_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), atan2 ) -#define cosh_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), cosh ) -#define sinh_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), sinh ) -#define tanh_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), tanh ) -#define fmod_ OP_COUNT_WRAPPER1_( DIV_( 1 ), fmod ) -/* these macros use any local macros already defined */ -/* min/max and their Variants */ -#define min_( a, b ) OP_COUNT_WRAPPER1_( MISC_( 1 ), min( ( a ), ( b ) ) ) -#define max_( a, b ) OP_COUNT_WRAPPER1_( MISC_( 1 ), max( ( a ), ( b ) ) ) -#define MIN_( a, b ) OP_COUNT_WRAPPER1_( MISC_( 1 ), MIN( ( a ), ( b ) ) ) -#define MAX_( a, b ) OP_COUNT_WRAPPER1_( MISC_( 1 ), MAX( ( a ), ( b ) ) ) -#define Min_( a, b ) OP_COUNT_WRAPPER1_( MISC_( 1 ), Min( ( a ), ( b ) ) ) -#define Max_( a, b ) OP_COUNT_WRAPPER1_( MISC_( 1 ), Max( ( a ), ( b ) ) ) -/* Square and its Variants */ -#define sqr_( x ) OP_COUNT_WRAPPER1_( MULT_( 1 ), sqr( ( x ) ) ) -#define Sqr_( x ) OP_COUNT_WRAPPER1_( MULT_( 1 ), Sqr( ( x ) ) ) -#define SQR_( x ) OP_COUNT_WRAPPER1_( MULT_( 1 ), SQR( ( x ) ) ) -#define square_( x ) OP_COUNT_WRAPPER1_( MULT_( 1 ), square( ( x ) ) ) -#define Square_( x ) OP_COUNT_WRAPPER1_( MULT_( 1 ), Square( ( x ) ) ) -#define SQUARE_( x ) OP_COUNT_WRAPPER1_( MULT_( 1 ), SQUARE( ( x ) ) ) -/* Sign and its Variants */ -#define sign_( x ) OP_COUNT_WRAPPER1_( MOVE_( 1 ), sign( ( x ) ) ) -#define Sign_( x ) OP_COUNT_WRAPPER1_( MOVE_( 1 ), Sign( ( x ) ) ) -#define SIGN_( x ) OP_COUNT_WRAPPER1_( MOVE_( 1 ), SIGN( ( x ) ) ) -/* Square Root and its Variants */ -#define sqrtf_( x ) OP_COUNT_WRAPPER1_( SQRT_( 1 ), sqrtf( ( x ) ) ) -/* Invert Square Root and its Variants */ -#define inv_sqrt_( x ) OP_COUNT_WRAPPER1_( SQRT_( 1 ), inv_sqrt( ( x ) ) ) -/* Others */ +#define abs_ OP_COUNT_WRAPPER1_( ABS_( 1 ), abs ) +#define fabs_ OP_COUNT_WRAPPER1_( ABS_( 1 ), fabs ) +#define fabsf_ OP_COUNT_WRAPPER1_( ABS_( 1 ), fabsf ) +#define labs_ OP_COUNT_WRAPPER1_( ABS_( 1 ), labs ) +#define floor_ OP_COUNT_WRAPPER1_( MISC_( 1 ), floor ) +#define floorf_ OP_COUNT_WRAPPER1_( MISC_( 1 ), floorf ) +#define sqrt_ OP_COUNT_WRAPPER1_( SQRT_( 1 ), sqrt ) +#define sqrtf_ OP_COUNT_WRAPPER1_( SQRT_( 1 ), sqrtf ) +#define pow_ OP_COUNT_WRAPPER1_( POWER_( 1 ), pow ) +#define powf_ OP_COUNT_WRAPPER1_( POWER_( 1 ), powf ) +#define exp_ OP_COUNT_WRAPPER1_( POWER_( 1 ), exp ) +#define expf_ OP_COUNT_WRAPPER1_( POWER_( 1 ), expf ) +#define log_ OP_COUNT_WRAPPER1_( LOG_( 1 ), log ) +#define logf_ OP_COUNT_WRAPPER1_( LOG_( 1 ), logf ) +#define log10_ OP_COUNT_WRAPPER1_( LOG_( 1 ), log10 ) +#define log10f_ OP_COUNT_WRAPPER1_( LOG_( 1 ), log10f ) +#define cos_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), cos ) +#define cosf_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), cosf ) +#define sin_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), sin ) +#define sinf_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), sinf ) +#define tan_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), tan ) +#define tanf_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), tanf ) +#define acos_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), acos ) +#define acosf_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), acosf ) +#define asin_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), asin ) +#define asinf_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), asinf ) +#define atan_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), atan ) +#define atanf_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), atanf ) +#define atan2_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), atan2 ) +#define atan2f_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), atan2f ) +#define cosh_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), cosh ) +#define coshf_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), coshf ) +#define sinh_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), sinh ) +#define sinhf_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), sinhf ) +#define tanh_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), tanh ) +#define tanhf_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), tanhf ) +#define fmod_ OP_COUNT_WRAPPER1_( DIV_( 1 ), fmod ) +#define fmodf_ OP_COUNT_WRAPPER1_( DIV_( 1 ), fmodf ) +#define frexp_ OP_COUNT_WRAPPER1_( MISC_( 2 ), frexp ) +#define frexpf_ OP_COUNT_WRAPPER1_( MISC_( 2 ), frexpf ) + +/* the macros below are instrumented versions of user-defined macros that might be used in the source code +/* representing some well-known and recognized mathematical operations (that are not defined in math.h) */ +/* Note: the 'wmc_flag_=wmc_flag_' is used to avoid warning: left-hand operand of comma expression has no effect with gcc */ + +#define min_( a, b ) OP_COUNT_WRAPPER1_( MISC_( 1 ), min( ( a ), ( b ) ) ) +#define max_( a, b ) OP_COUNT_WRAPPER1_( MISC_( 1 ), max( ( a ), ( b ) ) ) +#define MIN_( a, b ) OP_COUNT_WRAPPER1_( MISC_( 1 ), MIN( ( a ), ( b ) ) ) +#define MAX_( a, b ) OP_COUNT_WRAPPER1_( MISC_( 1 ), MAX( ( a ), ( b ) ) ) +#define Min_( a, b ) OP_COUNT_WRAPPER1_( MISC_( 1 ), Min( ( a ), ( b ) ) ) +#define Max_( a, b ) OP_COUNT_WRAPPER1_( MISC_( 1 ), Max( ( a ), ( b ) ) ) +#define sqr_( x ) OP_COUNT_WRAPPER1_( MULT_( 1 ), sqr( ( x ) ) ) +#define Sqr_( x ) OP_COUNT_WRAPPER1_( MULT_( 1 ), Sqr( ( x ) ) ) +#define SQR_( x ) OP_COUNT_WRAPPER1_( MULT_( 1 ), SQR( ( x ) ) ) +#define square_( x ) OP_COUNT_WRAPPER1_( MULT_( 1 ), square( ( x ) ) ) +#define Square_( x ) OP_COUNT_WRAPPER1_( MULT_( 1 ), Square( ( x ) ) ) +#define SQUARE_( x ) OP_COUNT_WRAPPER1_( MULT_( 1 ), SQUARE( ( x ) ) ) +#define sign_( x ) OP_COUNT_WRAPPER1_( MOVE_( 1 ), sign( ( x ) ) ) +#define Sign_( x ) OP_COUNT_WRAPPER1_( MOVE_( 1 ), Sign( ( x ) ) ) +#define SIGN_( x ) OP_COUNT_WRAPPER1_( MOVE_( 1 ), SIGN( ( x ) ) ) +#define inv_sqrt_( x ) OP_COUNT_WRAPPER1_( SQRT_( 1 ), inv_sqrt( ( x ) ) ) +#define inv_sqrtf_( x ) OP_COUNT_WRAPPER1_( SQRT_( 1 ), inv_sqrtf( ( x ) ) ) #define log_base_2_( x ) OP_COUNT_WRAPPER1_( ( LOG_( 1 ), MULT_( 1 ) ), log_base_2( ( x ) ) ) +#define log2_( x ) OP_COUNT_WRAPPER1_( ( LOG_( 1 ), MULT_( 1 ) ), log2( ( x ) ) ) +#define log2f_( x ) OP_COUNT_WRAPPER1_( ( LOG_( 1 ), MULT_( 1 ) ), log2f( ( x ) ) ) #define log2_f_( x ) OP_COUNT_WRAPPER1_( ( LOG_( 1 ), MULT_( 1 ) ), log2_f( ( x ) ) ) -/* The 'wmc_flag_=wmc_flag_' is Used to Avoid: "warning: left-hand operand of comma expression has no effect" - with Cygwin gcc Compiler */ -#define _round_( x ) OP_COUNT_WRAPPER1_( wmc_flag_ = wmc_flag_, _round( ( x ) ) ) -#define round_f_( x ) OP_COUNT_WRAPPER1_( wmc_flag_ = wmc_flag_, round_f( ( x ) ) ) -#define _squant_( x ) OP_COUNT_WRAPPER1_( wmc_flag_ = wmc_flag_, _squant( ( x ) ) ) -/* Set Min/Max */ +#define _round_( x ) OP_COUNT_WRAPPER1_( wmc_flag_ = wmc_flag_, _round( ( x ) ) ) +#define round_( x ) OP_COUNT_WRAPPER1_( wmc_flag_ = wmc_flag_, round( ( x ) ) ) +#define round_f_( x ) OP_COUNT_WRAPPER1_( wmc_flag_ = wmc_flag_, round_f( ( x ) ) ) +#define roundf_( x ) OP_COUNT_WRAPPER1_( wmc_flag_ = wmc_flag_, roundf( ( x ) ) ) #define set_min_( a, b ) OP_COUNT_WRAPPER3_( ( ADD_( 1 ), BRANCH_( 1 ), MOVE_( 1 ) ), set_min( ( a ), ( b ) ) ) #define set_max_( a, b ) OP_COUNT_WRAPPER3_( ( ADD_( 1 ), BRANCH_( 1 ), MOVE_( 1 ) ), set_max( ( a ), ( b ) ) ) -/* mac & msu (Instrumented Versions) */ -#define mac_( a, b, c ) OP_COUNT_WRAPPER1_( MAC_( 1 ), mac( a, b, c ) ) -#define msu_( a, b, c ) OP_COUNT_WRAPPER1_( MAC_( 1 ), msu( a, b, c ) ) /* Functions */ #define func_( name, x ) OP_COUNT_WRAPPER1_( FUNC_( x ), name ) @@ -1014,11 +1020,11 @@ int push_stack( const char *filename, const char *fctname ); int pop_stack( const char *filename, const char *fctname ); #ifdef WMOPS_DETAIL -#define STACK_DEPTH_FCT_CALL ( push_wmops( __FUNCTION__ " [WMC_AUTO]" ), push_stack( __FILE__, __FUNCTION__ ) ) /* add push_wmops() in all function calls */ -#define STACK_DEPTH_FCT_RETURN ( pop_wmops(), pop_stack( __FILE__, __FUNCTION__ ) ) /* add pop_wmops() in all function returns */ +#define STACK_DEPTH_FCT_CALL ( push_wmops( __func__, "[WMC_AUTO]" ), push_stack( __FILE__, __func__ ) ) /* add push_wmops() in all function calls */ +#define STACK_DEPTH_FCT_RETURN ( pop_wmops(), pop_stack( __FILE__, __func__ ) ) /* add pop_wmops() in all function returns */ #else #define STACK_DEPTH_FCT_CALL push_stack( __FILE__, __FUNCTION__ ) -#define STACK_DEPTH_FCT_RETURN pop_stack( __FILE__, __FUNCTION__ ) +#define STACK_DEPTH_FCT_RETURN pop_stack( __FILE__, __func__ ) #endif void reset_stack( void ); -- GitLab From b2fa83736524efc5d6f0d6be650775b6a6d56078 Mon Sep 17 00:00:00 2001 From: malenov Date: Wed, 31 Jul 2024 11:59:15 +0200 Subject: [PATCH 05/10] add debug.h and other debugging files in MSVC project --- Workspace_msvc/lib_debug.vcxproj | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Workspace_msvc/lib_debug.vcxproj b/Workspace_msvc/lib_debug.vcxproj index f54f282f0..396078790 100644 --- a/Workspace_msvc/lib_debug.vcxproj +++ b/Workspace_msvc/lib_debug.vcxproj @@ -100,9 +100,14 @@ + + + + + -- GitLab From 3b35073ce75a3610a4adf9719280856d0f162f53 Mon Sep 17 00:00:00 2001 From: malenov Date: Thu, 22 Aug 2024 11:55:30 +0200 Subject: [PATCH 06/10] deactivate DEBUGGING to see if the race condition problem is solved --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index cfb09c3ba..93b6f3293 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -48,7 +48,7 @@ /* ################### Start DEBUGGING switches ########################### */ #ifndef RELEASE -#define DEBUGGING /* Activate debugging part of the code */ +/*#define DEBUGGING*/ /* Activate debugging part of the code */ #endif /*#define WMOPS*/ /* Activate complexity and memory counters */ /*#define WMOPS_PER_FRAME*/ /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */ -- GitLab From e5ac688f30ebf9ea2d65a106e54631684fbaccdf Mon Sep 17 00:00:00 2001 From: malenov Date: Thu, 22 Aug 2024 11:56:19 +0200 Subject: [PATCH 07/10] add Gitlab CI yaml file just to test BE against ivas-float-update branch --- .gitlab-ci.yml | 2674 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 2674 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..62ef1dbd3 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,2674 @@ +variables: + TESTV_DIR: "/usr/local/testv" + LTV_DIR: "/usr/local/ltv" + BUILD_OUTPUT: "build_output.txt" + EVS_BE_TEST_DIR: "/usr/local/be_2_evs_test" + EVS_BE_WIN_TEST_DIR: "C:/Users/gitlab-runner/testvec" + EXIT_CODE_NON_BE: 123 + EXIT_CODE_FAIL: 1 + PROCESSING_SCRIPTS_BIN_DIR: "/test-bin" + TESTS_DIR_CODEC_BE_ON_MR: "tests/codec_be_on_mr_nonselection" + SANITIZER_TESTS: "CLANG1 CLANG2 CLANG3" + OUT_FORMATS_CHANNEL_BASED: "stereo mono 5_1 5_1_2 5_1_4 7_1 7_1_4" + OUT_FORMATS_SCENE_BASED: "FOA HOA2 HOA3" + OUT_FORMATS_BINAURAL: "BINAURAL BINAURAL_ROOM_IR BINAURAL_ROOM_REVERB" + OUT_FORMATS_ALL: "$OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL EXT" + IVAS_PIPELINE_NAME: '' + MANUAL_PIPELINE_TYPE: + description: "Type for the manual pipeline run. Use 'test-be-release' to run BE test against release codec." + value: 'default' + options: + - 'default' + - 'test-be-release' + - 'test-long-self-test' + - 'ivas-conformance' + - 'ivas-conformance-linux' + - 'check-float-reference' + GIT_CLEAN_FLAGS: -ffdxq + TESTCASE_TIMEOUT_STV_SANITIZERS: 180 + TESTCASE_TIMEOUT_LTV_SANITIZERS: 1200 + BASOP_REFERENCE_BRANCH: "ivas-float-update" + + +default: + interruptible: true # Make all jobs by default interruptible + +# This sets when pipelines are created. Jobs have more specific rules to restrict them. +workflow: + name: '$IVAS_PIPELINE_NAME' + rules: + # see https://docs.gitlab.com/ee/ci/yaml/workflow.html#switch-between-branch-pipelines-and-merge-request-pipelines + - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push" + when: never + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + variables: + IVAS_PIPELINE_NAME: 'MR pipeline: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME' + - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Pushes to main + variables: + IVAS_PIPELINE_NAME: 'Push pipeline: $CI_COMMIT_BRANCH' + - if: $CI_PIPELINE_SOURCE == 'schedule' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Scheduled in main + variables: + IVAS_PIPELINE_NAME: 'Scheduled pipeline: $CI_COMMIT_BRANCH' + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'default' # for testing + variables: + IVAS_PIPELINE_NAME: 'Web run pipeline: $CI_COMMIT_BRANCH' + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'test-be-release' + variables: + IVAS_PIPELINE_NAME: 'Test BE to release pipeline: $CI_COMMIT_BRANCH' + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'test-long-self-test' + variables: + IVAS_PIPELINE_NAME: 'Test long self-test against main pipeline: $CI_COMMIT_BRANCH' + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'ivas-conformance' + variables: + IVAS_PIPELINE_NAME: 'Draft IVAS Conformance test: $CI_COMMIT_BRANCH' + - if: $CI_PIPELINE_SOURCE == 'trigger' + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'ivas-conformance-linux' + variables: + IVAS_PIPELINE_NAME: 'Draft IVAS Conformance test -- Linux: $CI_COMMIT_BRANCH' + - if: $CI_PIPELINE_SOURCE == 'trigger' + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'check-float-reference' + variables: + IVAS_PIPELINE_NAME: 'check-float-reference: $CI_COMMIT_BRANCH' + + +stages: + - .pre + - maintenance + - prevalidate + - build + - test + - compare + - postvalidate + - deploy + +# --------------------------------------------------------------- +# Generic script anchors +# --------------------------------------------------------------- + +# These can be used later on to do common tasks + +# Prints useful information for every job and should be used at the beginning of each job +.print-common-info: &print-common-info + - | + echo "Printing common information for build job." + echo "Current job is run on commit $CI_COMMIT_SHA" + echo "Commit time was $CI_COMMIT_TIMESTAMP" + date | xargs echo "System time is" + +.print-common-info-windows: &print-common-info-windows + - | + echo "Printing common information for build job." + echo "Current job is run on commit $CI_COMMIT_SHA" + echo "Commit time was $CI_COMMIT_TIMESTAMP" + ("echo 'System time is'", "Get-Date -Format 'dddd dd/MM/yyyy HH:mm K'") | Invoke-Expression + +.get-previous-merge-commit-sha: &get-previous-merge-commit-sha + - previous_merge_commit=$(git --no-pager log --merges HEAD~1 -n 1 --pretty=format:%H) + +.mr-fetch-target-branch: &mr-fetch-target-branch + # first delete local target branch to avoid conflicts when branch is cached and there are merge conflicts during fetching + # depending on chaching, the branch may not be there, so prevent failure of this command -> should maybe be done smarter later + - git branch -D $CI_MERGE_REQUEST_TARGET_BRANCH_NAME || true + # needed when depth is lower than the number of commits in the branch + - git fetch origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME:$CI_MERGE_REQUEST_TARGET_BRANCH_NAME + +.mr-get-target-commit: &mr-get-target-commit # compare to last target branch commit before pipeline was created + - target_commit=$(git log $CI_MERGE_REQUEST_TARGET_BRANCH_NAME -1 --oneline --before=${CI_PIPELINE_CREATED_AT} --format=%H) + +.check-for-testvectors: &check-for-testvectors # check if the testvector files specified in scripts/config/ci_linux*.json are present + - python3 -m pytest ci/test_vectors_available.py + +.disable-debugging-macro: &disable-debugging-macro +# automatically disable #DEBUGGING macro in options.h using /**/-comment + - sed -i.bak -e "s/^[[:space:]]*\(#define[[:space:]]*DEBUGGING\)/\/\*\1\*\//g" lib_com/options.h + +.merge-request-comparison-setup-codec: &merge-request-comparison-setup-codec + ### build test binaries, initial clean for paranoia reasons + - *disable-debugging-macro + - make clean + - mkdir build + - cd build + - cmake .. + - make -j + - mv IVAS_cod ../IVAS_cod_test + - mv IVAS_dec ../IVAS_dec_test + - mv IVAS_rend ../IVAS_rend_test + - cd .. + - rm -rf build/* + - git restore . + + ### store the current commit hash + - source_branch_commit_sha=$(git rev-parse HEAD) + + ### checkout version to compare against + - *mr-fetch-target-branch + - *mr-get-target-commit + - git checkout $target_commit + - echo "Building reference codec at commit $target_commit" + + ### build reference binaries + - *disable-debugging-macro + - cd build + - cmake .. + - make -j + - mv IVAS_cod ../IVAS_cod_ref + - mv IVAS_dec ../IVAS_dec_ref + - mv IVAS_rend ../IVAS_rend_ref + - cd .. + - git restore . + + # rename test binaries back + - mv IVAS_cod_test IVAS_cod + - mv IVAS_dec_test IVAS_dec + - mv IVAS_rend_test IVAS_rend + +.merge-request-comparison-check: &merge-request-comparison-check + - echo "--------------- Running merge-request-comparison-check anchor ---------------" + - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi + - if [ $exit_code -eq 1 ] && [ $non_be_flag == 0 ]; then echo "Non-bitexact cases without non-BE tag encountered!"; exit $EXIT_CODE_FAIL; fi + - if [ $exit_code -eq 1 ] && [ $non_be_flag != 0 ]; then echo "Non-bitexact cases with non-BE tag encountered"; exit $EXIT_CODE_NON_BE; fi + - exit 0 + +.update-ltv-repo: &update-ltv-repo + - cd $LTV_DIR + - git pull + - cd - + +.update-ltv-repo-win: &update-ltv-repo-win + - Push-Location + - cd $LTV_DIR_WIN + - git pull + - Pop-Location + +.disable-limiter: &disable-limiter +# automatically enable #define DISABLE_LIMITER in options.h, handling both /**/-comment and //-comment + - sed -i.bak -e "s/\/\*[[:space:]]*\(#define[[:space:]]*DISABLE_LIMITER\)[[:space:]]*\*\//\1/g" ./lib_com/options.h + +.get-commits-behind-count: &get-commits-behind-count + - echo $CI_COMMIT_SHA + - echo $CI_MERGE_REQUEST_TARGET_BRANCH_NAME + - commits_behind_count=$(git rev-list --count $CI_COMMIT_SHA..origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME) + +.check-commits-behind-count-in-compare-jobs: &check-commits-behind-count-in-compare-jobs + - if [ $commits_behind_count -ne 0 ]; then echo "Your branch is not up-to-date with main -> Compare tests will not run as they can contain false negatives this way.\nMain might have changed during your pipeline run. Run 'git merge origin/main' to update."; exit 1; fi + +.copy-ltv-files-to-testv-dir: ©-ltv-files-to-testv-dir + - cp "$LTV_DIR"/*.wav scripts/testv/ + - cp "$LTV_DIR"/*.met scripts/testv/ + - cp "$LTV_DIR"/*.csv scripts/testv/ + +.copy-ltv-files-to-testv-dir-win: ©-ltv-files-to-testv-dir-win + - cp $LTV_DIR_WIN\*.wav scripts\testv + - cp $LTV_DIR_WIN\*.met scripts\testv + - cp $LTV_DIR_WIN\*.csv scripts\testv + +.activate-Werror-linux: &activate-Werror-linux + - sed -i.bak "s/^# \(CFLAGS += -Werror\)/\1/" Makefile + - sed -i.bak "s/# \(set(CMAKE_C_FLAGS \"\${CMAKE_C_FLAGS} -Werror\")\)/\1/" CMakeLists.txt + +.activate-WX-windows: &activate-WX-windows + - (Get-Content -Path "CMakeLists.txt") -replace '# \(add_compile_options\("\/WX"\)\)', '$1' | Set-Content -Path "CMakeLists.txt" + - Get-ChildItem -Path "Workspace_msvc" -Filter "*.vcxproj" | ForEach-Object { (Get-Content -Path $_.FullName) -replace 'false', 'true' | Set-Content -Path $_.FullName } + +# to be reused in MR and LTV-scheduled sanitizer test jobs +# set CLANG_NUM, SELFTEST_SANITY_TIMEOUT and SELF_TEST_PRM_FILE in before_script section +.sanitizer-selftest-anchor: &sanitizer-selftest-anchor + script: + - *print-common-info + - *copy-ltv-files-to-testv-dir + - make clean + - make -j CLANG=$CLANG_NUM + - testcase_timeout=$SELFTEST_SANITY_TIMEOUT + - export UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1 + + - exit_code20=0 + - exit_code10=0 + - exit_code5=0 + + - if [ $CLANG_NUM -eq 1 ]; then sanitizer_type="MemorySanitizer"; elif [ $CLANG_NUM -eq 2 ]; then sanitizer_type="AddressSanitizer"; elif [ $CLANG_NUM -eq 3 ]; then sanitizer_type="UndefinedBehaviorSanitizer"; else echo "Wrong CLANG_NUM $CLANG_NUM given!"; exit 1; fi + + # run encoder and decoder with 20ms renderer framesize first, use reference creation mode + - python3 -m pytest tests/codec_be_on_mr_nonselection/test_param_file.py --param_file $SELF_TEST_PRM_FILE -v --update_ref 1 -m create_ref --html=report-20ms.html --self-contained-html --junit-xml=report-junit-20ms.xml --testcase_timeout=$testcase_timeout --ref_encoder_path ./IVAS_cod --ref_decoder_path ./IVAS_dec || exit_code20=$? + # for 10ms and 5ms renderer framesize, we only need to run the decoder part as renderer framesize is a decoder-only option + # set tolerance very high do ignore any BE differences due to the different renderer framesizes, those can appear due to the limiter being active + # we are only interested in runtime errors from the sanitizers and ignore the diffs + - python3 -m pytest tests/codec_be_on_mr_nonselection/test_param_file.py --param_file $SELF_TEST_PRM_FILE -v --html=report-5ms.html --self-contained-html --junit-xml=report-junit-5ms.xml --dut_fr 5 --decoder_only --abs_tol 100000 || exit_code5=$? + - python3 -m pytest tests/codec_be_on_mr_nonselection/test_param_file.py --param_file $SELF_TEST_PRM_FILE -v --html=report-10ms.html --self-contained-html --junit-xml=report-junit-10ms.xml --dut_fr 10 --decoder_only --abs_tol 100000 || exit_code10=$? + + - if [ $exit_code20 -ne 0 ] || [ $exit_code10 -ne 0 ] || [ $exit_code5 -ne 0 ]; then exit 1; fi + + +# --------------------------------------------------------------- +# Job templates +# --------------------------------------------------------------- + +# When designing templates, try not to use too much inheritance and +# if multiple templates and extended on, remember that on conflict, +# latest overwrites the parameter. + +# templates for rules +.rules-basis: + rules: + - if: $MIRROR_ACCESS_TOKEN # Don't run in the mirror update pipeline (only then MIRROR_ACCESS_TOKEN is defined) + when: never + - if: $CI_PIPELINE_SOURCE == 'schedule' # Don't run in any scheduled pipelines by default (use schedule templates below to enable again for certain conditions) + when: never + - if: $CI_PIPELINE_SOURCE == 'trigger' # Don't run triggered pipeline by default + when: never + - if: $MANUAL_PIPELINE_TYPE == 'test-be-release' # Skip all the normal jobs when testing manually against release codec + when: never + - if: $MANUAL_PIPELINE_TYPE == 'test-long-self-test' # Skip all the normal jobs when testing manually against release codec + when: never + - if: $MANUAL_PIPELINE_TYPE == 'ivas-conformance' + when: never + - if: $MANUAL_PIPELINE_TYPE == 'ivas-conformance-linux' + when: never + - if: $MANUAL_PIPELINE_TYPE == 'check-float-reference' + when: never + - when: on_success + +.rules-merge-request: + extends: .rules-basis + rules: + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" # only have MR pipelines for MRs to main + - if: $CI_PIPELINE_SOURCE == 'push' + when: never + +.rules-main-push: + extends: .rules-basis + rules: + - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + +.rules-main-scheduled: + extends: .rules-basis + rules: + - if: $CI_PIPELINE_SOURCE == 'schedule' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + +# templates to define stages and platforms +.test-job-linux: + tags: + - ivas-linux + +.build-job-linux: + stage: build + timeout: "4 minutes" + needs: [] + tags: + - ivas-linux + +.build-job-windows: + stage: build + needs: [] + timeout: "4 minutes" + tags: + - ivas-windows + +# template for test jobs on linux that need the TESTV_DIR +.test-job-linux-needs-testv-dir: + extends: .test-job-linux + before_script: + - if [ ! -d "$TESTV_DIR" ]; then mkdir -p $TESTV_DIR; fi + - python3 scripts/prepare_combined_format_inputs.py + - cp -r scripts/testv/* $TESTV_DIR/ + +.sanitizer-selftest-on-mr: + stage: test + extends: + - .test-job-linux-needs-testv-dir + - .rules-merge-request + artifacts: + name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" + expire_in: 1 week + when: always + paths: + - report-junit-20ms.xml + - report-junit-10ms.xml + - report-junit-5ms.xml + - report-20ms.html + - report-10ms.html + - report-5ms.html + expose_as: "Sanitizer selftest results" + reports: + junit: + - report-junit-20ms.xml + - report-junit-10ms.xml + - report-junit-5ms.xml + +.sanitizer-selftest-ltv: + stage: test + extends: + - .test-job-linux-needs-testv-dir + artifacts: + name: "$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA--results" + expire_in: 2 week + when: always + paths: + - report-junit-20ms.xml + - report-junit-10ms.xml + - report-junit-5ms.xml + - report-20ms.html + - report-10ms.html + - report-5ms.html + expose_as: "Sanitizer selftest results" + reports: + junit: + - report-junit-20ms.xml + - report-junit-10ms.xml + - report-junit-5ms.xml + +# --------------------------------------------------------------- +# .pre jobs for setting up things +# --------------------------------------------------------------- + +# See: https://gitlab.com/gitlab-org/gitlab/-/issues/194023 +# Solution to make main branch pipelines uninterruptible while all other +# pipelines can be interrupted by default. This works because all jobs +# after uninterruptible jobs will be uninterruptible. Resource group +# setting avoids rare case where two fast merges could still interrupt +# pipeline. This should be revisited if there are updates to Gitlab. +uninterruptible: + stage: .pre + interruptible: false + resource_group: uninterruptible + script: + - echo "$CI_COMMIT_BRANCH is uninterruptible" + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + when: always + tags: + - ivas-linux + +# --------------------------------------------------------------- +# Validation jobs +# --------------------------------------------------------------- + +branch-is-up-to-date-with-main-pre: + extends: + - .rules-merge-request + stage: prevalidate + needs: [] + tags: + - ivas-linux + script: + - *get-commits-behind-count + - echo $commits_behind_count + - if [ $commits_behind_count -eq 0 ]; then exit 0; else echo "Your branch is behind main, run 'git merge origin/main' to update."; exit 1; fi; + +check-self-test-names-pre: + extends: + - .rules-merge-request + stage: prevalidate + needs: [] + tags: + - ivas-linux + script: + - python3 ci/check_self_test_names.py scripts/config/self_test.prm 135 + +branch-is-up-to-date-with-main-post: + extends: + - .rules-merge-request + stage: postvalidate + tags: + - ivas-linux + script: + - *get-commits-behind-count + - echo $commits_behind_count + - if [ $commits_behind_count -eq 0 ]; then exit 0; else echo "Your branch is behind main, possibly main changed during your pipeline run, run 'git merge origin/main' to update." exit 1; fi; + +# for merges to basop-ci-branch, run the long test suite in reference generation mode to catch problems already here and not only in the BASOP repo +check-compatibility-with-basop-reference-branch: + extends: + - .test-job-linux + rules: + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "basop-ci-branch" + changes: + - tests/**/* + - scripts/**/* + - ci/**/* + - if: ($CI_PIPELINE_SOURCE == 'web' || $CI_PIPELINE_SOURCE == 'trigger') && $MANUAL_PIPELINE_TYPE == 'check-float-reference' + - if: $CI_PIPELINE_SOURCE == 'push' + when: never + tags: + - ivas-linux-fast + script: + - git clone -b $BASOP_REFERENCE_BRANCH https://forge.3gpp.org/rep/sa4/audio/ivas-basop.git --single-branch + - make -j -C ivas-basop + - cp ivas-basop/IVAS_cod ./IVAS_cod_ref + - cp ivas-basop/IVAS_dec ./IVAS_dec_ref + - cp ivas-basop/IVAS_cod ./IVAS_cod # Not used but needed to launch the pytest + - cp ivas-basop/IVAS_dec ./IVAS_dec # Not used but needed to launch the pytest + - python3 ci/remove_unsupported_testcases.py scripts/config/self_test.prm + - python3 tests/create_short_testvectors.py + - exit_code1=0 + - exit_code2=0 + - python3 -m pytest tests/codec_be_on_mr_nonselection -v --update_ref 1 -m create_ref --html=report1.html --self-contained-html --junit-xml=report-junit1.xml || exit_code1=$? + - python3 -m pytest tests/codec_be_on_mr_nonselection -v --update_ref 1 -m create_ref_part2 --html=report2.html --self-contained-html --junit-xml=report-junit2.xml || exit_code2=$? + - zero_errors=$(cat report-junit1.xml report-junit2.xml | grep -c 'errors="0"') || true + - if [ $zero_errors != 2 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi + - exit 0 + artifacts: + name: "check-float-reference--sha-$CI_COMMIT_SHORT_SHA--results" + when: always + expire_in: 1 month + paths: + - report-junit1.xml + - report-junit2.xml + - report1.html + - report2.html + expose_as: "check-float-reference results" + reports: + junit: + - report-junit1.xml + - report-junit2.xml + +# --------------------------------------------------------------- +# Build jobs +# --------------------------------------------------------------- + +build-codec-linux-make: + extends: + - .build-job-linux + - .rules-basis + script: + - *print-common-info + - *activate-Werror-linux + - make -j + +build-codec-linux-cmake: + extends: + - .build-job-linux + - .rules-basis + script: + - *print-common-info + - *activate-Werror-linux + - mkdir build + - cd build + - cmake .. + - cd .. + - make -C build -j + +build-codec-instrumented-linux: + extends: + - .build-job-linux + - .rules-basis + timeout: "10 minutes" + script: + - *print-common-info + - *activate-Werror-linux + - ./scripts/prepare_instrumentation.sh + - make -j -C scripts/c-code_instrument + +# make sure that the codec builds with msan, asan and usan +build-codec-sanitizers-linux: + extends: + - .build-job-linux + - .rules-basis + script: + - *print-common-info + - *activate-Werror-linux + - bash ci/build_codec_sanitizers_linux.sh + +build-codec-windows-cmake: + extends: + - .build-job-windows + - .rules-basis + script: + - *print-common-info-windows + - *activate-WX-windows + - cmake -G "Visual Studio 15 2017" . -Bbuild + - cmake --build build -j + +build-codec-windows-msbuild: + extends: + - .build-job-windows + - .rules-basis + script: + - *print-common-info-windows + - *activate-WX-windows + - MSBuild.exe -maxcpucount .\Workspace_msvc\Workspace_msvc.sln /property:Configuration=Debug + +# --------------------------------------------------------------- +# Test jobs for merge requests +# --------------------------------------------------------------- + +# test that runs all modes with 1s input signals +codec-smoke-test: + extends: + - .test-job-linux-needs-testv-dir + - .rules-merge-request + timeout: "20 minutes" + tags: + - ivas-linux-fast + stage: test + needs: ["build-codec-linux-cmake", "build-codec-linux-make", "build-codec-instrumented-linux", "build-codec-sanitizers-linux"] + script: + - *print-common-info + # LTV update needed as ltv ISM metadata files are used + - *update-ltv-repo + - bash ci/smoke_test.sh + ### analyze for failures + - if ! [ -s smoke_test_output.txt ] || ! [ -s smoke_test_output_jbm.txt ] || ! [ -s smoke_test_output_hrtf.txt ]; then echo "Error in smoke test"; exit 1; fi + - ret_val=0 + - if cat smoke_test_output.txt | grep -c "failed"; then echo "Smoke test without JBM failed"; ret_val=1; fi + - if cat smoke_test_output_jbm.txt | grep -c "failed"; then echo "Smoke test JBM part failed"; ret_val=1; fi + - if cat smoke_test_output_hrtf.txt | grep -c "failed"; then echo "Smoke test with external hrtf files failed"; ret_val=1; fi + - exit $ret_val + artifacts: + name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" + expire_in: 1 week + when: always + paths: + - smoke_test_output.txt + - smoke_test_output_jbm.txt + - smoke_test_output_hrtf.txt + expose_as: "Smoke test results" + +# code selftest testvectors with memory-sanitizer binaries +codec-msan: + extends: + - .sanitizer-selftest-on-mr + tags: + - ivas-linux-fast + before_script: + - CLANG_NUM=1 + - SELFTEST_SANITY_TIMEOUT=$TESTCASE_TIMEOUT_STV_SANITIZERS + - SELF_TEST_PRM_FILE="scripts/config/self_test.prm" + <<: *sanitizer-selftest-anchor + +# code selftest testvectors with address-sanitizer binaries +codec-asan: + extends: + - .sanitizer-selftest-on-mr + before_script: + - CLANG_NUM=2 + - SELFTEST_SANITY_TIMEOUT=$TESTCASE_TIMEOUT_STV_SANITIZERS + - SELF_TEST_PRM_FILE="scripts/config/self_test.prm" + <<: *sanitizer-selftest-anchor + +# code selftest testvectors with undefined-behaviour-sanitizer binaries +codec-usan: + extends: + - .sanitizer-selftest-on-mr + tags: + - ivas-linux-fast + before_script: + - CLANG_NUM=3 + - SELFTEST_SANITY_TIMEOUT=$TESTCASE_TIMEOUT_STV_SANITIZERS + - SELF_TEST_PRM_FILE="scripts/config/self_test.prm" + <<: *sanitizer-selftest-anchor + +# compare bit-exactness between 5ms and 20 on the branch +pytest-compare-20ms-and-5ms-rendering: + extends: + - .test-job-linux + - .rules-merge-request + stage: test + needs: ["build-codec-linux-cmake", "build-codec-linux-make", "build-codec-instrumented-linux", "build-codec-sanitizers-linux"] + script: + - *print-common-info + - *disable-limiter + - make clean + - make -j + ### prepare pytest + - cp IVAS_cod IVAS_cod_ref + - cp IVAS_dec IVAS_dec_ref + # create references + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 -m create_ref + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 -m create_ref_part2 + ### run pytest + - exit_code=0 + - exit_code5=0 + - exit_code10=0 + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report-5ms.html --self-contained-html --junit-xml=report-junit-5ms.xml --dut_fr 5 --decoder_only || exit_code5=$? + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report-10ms.html --self-contained-html --junit-xml=report-junit-10ms.xml --dut_fr 10 --decoder_only || exit_code10=$? + - zero_errors5=$(cat report-junit-5ms.xml | grep -c 'errors="0"') || true + - zero_errors10=$(cat report-junit-10ms.xml | grep -c 'errors="0"') || true + - zero_errors=1 + - if [ $zero_errors5 != 1 ]; then echo "run error in with 5ms rendering encountered"; zero_errors=0 ; fi + - if [ $zero_errors10 != 1 ]; then echo "run error in with 10ms rendering encountered"; zero_errors=0 ; fi + - if [ $zero_errors != 1 ]; then exit $EXIT_CODE_FAIL; fi + - if [ $exit_code5 -eq 1 ]; then echo "Non-bitexact cases encountered with 5ms rendering!"; exit_code=1; fi + - if [ $exit_code10 -eq 1 ]; then echo "Non-bitexact cases encountered with 10ms rendering!"; exit_code=1; fi + - if [ $exit_code -eq 1 ]; then exit $EXIT_CODE_FAIL; fi + artifacts: + name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" + expire_in: 1 week + when: always + expose_as: "pytest 5ms and 10ms vs 20ms results" + paths: + - report-junit-5ms.xml + - report-5ms.html + - report-junit-10ms.xml + - report-10ms.html + reports: + junit: + - report-junit-5ms.xml + - report-junit-10ms.xml + +# test renderer executable +renderer-smoke-test: + extends: + - .test-job-linux + - .rules-merge-request + needs: ["build-codec-linux-make"] + stage: test + script: + - make -j IVAS_rend + - testcase_timeout=60 + - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py --testcase_timeout=$testcase_timeout + artifacts: + name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" + expire_in: 1 week + when: always + paths: + - report-junit.xml + expose_as: "renderer make pytest results" + reports: + junit: + - report-junit.xml + +# test renderer executable with cmake + asan +renderer-asan: + extends: + - .test-job-linux + - .rules-merge-request + needs: ["build-codec-linux-cmake"] + stage: test + script: + - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=asan -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true + - cmake --build cmake-build -- -j + - testcase_timeout=180 + - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py --testcase_timeout=$testcase_timeout + + artifacts: + name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" + expire_in: 1 week + when: always + paths: + - report-junit.xml + expose_as: "renderer asan pytest results" + reports: + junit: + - report-junit.xml + +# test renderer executable with cmake + msan +renderer-msan: + extends: + - .test-job-linux + - .rules-merge-request + needs: ["build-codec-linux-cmake"] + stage: test + script: + - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=msan -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true + - cmake --build cmake-build -- -j + - testcase_timeout=180 + - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py --testcase_timeout=$testcase_timeout + + artifacts: + name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" + expire_in: 1 week + when: always + paths: + - report-junit.xml + expose_as: "renderer msan pytest results" + reports: + junit: + - report-junit.xml + +# test renderer executable with cmake + usan +renderer-usan: + extends: + - .test-job-linux + - .rules-merge-request + needs: ["build-codec-linux-cmake"] + stage: test + script: + - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=usan -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true + - cmake --build cmake-build -- -j + - testcase_timeout=180 + - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1,log_path=usan_log_catchall python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py --testcase_timeout=$testcase_timeout + - grep_exit_code=0 + - touch usan_log_empty # Creates an empty file, this is to avoid "grep: usan_log_*: No such file or directory" in case no USAN failures are reported from pytest + - grep UndefinedBehaviorSanitizer usan_log_* || grep_exit_code=$? + - if [ $grep_exit_code != 1 ] ; then echo "Run errors in test_renderer.py with Clang undefined-behavior-sanitizer"; exit 1; fi + + artifacts: + name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" + expire_in: 1 week + when: always + paths: + - report-junit.xml + expose_as: "renderer usan pytest results" + reports: + junit: + - report-junit.xml + +# compare renderer bitexactness between target and source branch +renderer-pytest-on-merge-request: + extends: + - .test-job-linux-needs-testv-dir + - .rules-merge-request + needs: ["build-codec-linux-make"] + # TODO: set reasonable timeout, will most likely take less + timeout: "20 minutes" + stage: compare + script: + - *print-common-info + - *get-commits-behind-count + - *check-commits-behind-count-in-compare-jobs + - *merge-request-comparison-setup-codec + + # some helper variables - "|| true" to prevent failures from grep not finding anything + # write to temporary file as workaround for failures observed with piping echo + - echo $CI_MERGE_REQUEST_TITLE > tmp.txt + - non_be_flag=$(grep -c --ignore-case "\[rend\(erer\)*[ -]*non[ -]*be\]" tmp.txt) || true + - ref_using_main=$(grep -c --ignore-case "\[ref[ -]*using[ -]*main\]" tmp.txt) || true + + ### If ref_using_main is not set, checkout the source branch to use scripts and input from there + - if [ $ref_using_main == 0 ]; then git checkout $source_branch_commit_sha; fi + + - exit_code=0 + - testcase_timeout=60 + - python3 -m pytest -q --log-level ERROR -n auto -rA --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py --create_ref --testcase_timeout=$testcase_timeout || exit_code=$? + + ### Run test using branch scripts and input + - if [ $ref_using_main == 1 ]; then git checkout $source_branch_commit_sha; fi + + # run test + - python3 -m pytest -q --log-level ERROR -n auto -rA --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer_.py --create_cut --testcase_timeout=$testcase_timeout || exit_code=$? + - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true + + - *merge-request-comparison-check + + allow_failure: + exit_codes: + - 123 + artifacts: + name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" + expire_in: 1 week + when: always + paths: + - report-junit.xml + - report.html + expose_as: "pytest renderer results" + reports: + junit: + - report-junit.xml + +# test split rendering +split-rendering-smoke-test: + extends: + - .test-job-linux + - .rules-merge-request + needs: ["build-codec-linux-make"] + stage: test + script: + - make -j + - testcase_timeout=10 + - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/split_rendering/test_split_rendering.py --testcase_timeout=$testcase_timeout + artifacts: + name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" + expire_in: 1 week + when: always + paths: + - report-junit.xml + expose_as: "split rendering make pytest results" + reports: + junit: + - report-junit.xml + +lc3-wrapper-unit-test: + extends: + - .test-job-linux + - .rules-merge-request + needs: ["build-codec-linux-cmake"] + stage: test + script: + - cmake -B cmake-build -G "Unix Makefiles" -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true + - cmake --build cmake-build -- -j + - scripts/split_rendering/lc3plus/ivas_lc3plus_unit_test + +# compare split-rendering bitexactness between target and source branch +split-rendering-pytest-on-merge-request: + extends: + - .test-job-linux-needs-testv-dir + - .rules-merge-request + needs: ["build-codec-linux-make"] + # TODO: set reasonable timeout, will most likely take less + timeout: "30 minutes" + stage: compare + script: + - *print-common-info + - *get-commits-behind-count + - *check-commits-behind-count-in-compare-jobs + + # some helper variables - "|| true" to prevent failures from grep not finding anything + # write to temporary file as workaround for failures observed with piping echo + - echo $CI_MERGE_REQUEST_TITLE > tmp.txt + - non_be_flag=$(grep -c --ignore-case "\[split*[ -]*non[ -]*be\]" tmp.txt) || true + - ref_using_main=$(grep -c --ignore-case "\[ref[ -]*using[ -]*main\]" tmp.txt) || true + + # store the current commit hash + - source_branch_commit_sha=$(git rev-parse HEAD) + + - *mr-fetch-target-branch + - *mr-get-target-commit + - git checkout $target_commit + - echo "Building reference codec at commit $target_commit" + + # build reference binaries + - make -j + - mv IVAS_cod IVAS_cod_ref + - mv IVAS_dec IVAS_dec_ref + - mv IVAS_rend IVAS_rend_ref + + ### If ref_using_main is not set, checkout the source branch to use scripts and input from there + - if [ $ref_using_main == 0 ]; then git restore lib_com/options.h; fi # Revert changes back before checking out another branch to avoid conflicts + - if [ $ref_using_main == 0 ]; then git checkout $source_branch_commit_sha; fi + - exit_code=0 + - testcase_timeout=60 + - python3 -m pytest -q --log-level ERROR -n auto -rA --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout || exit_code=$? + + # back to source branch + - git restore lib_com/options.h # Revert changes back before checking out another branch to avoid conflicts + - git checkout $source_branch_commit_sha + - make clean + - make -j + + ### Run test using scripts and input from main + - if [ $ref_using_main == 1 ]; then git restore lib_com/options.h; fi # Revert changes back before checking out another branch to avoid conflicts + - if [ $ref_using_main == 1 ]; then git checkout $source_branch_commit_sha; fi + + # run test + - python3 -m pytest -q --log-level ERROR -n auto -rA --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/split_rendering/test_split_rendering.py --create_cut --testcase_timeout=$testcase_timeout || exit_code=$? + - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true + + - *merge-request-comparison-check + + allow_failure: + exit_codes: + - 123 + artifacts: + name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" + expire_in: 2 week + when: always + paths: + - report-junit.xml + - report.html + expose_as: "pytest split rendering results" + reports: + junit: + - report-junit.xml + +# compare bit exactness between target and source branch +ivas-pytest-on-merge-request: + extends: + - .test-job-linux-needs-testv-dir + - .rules-merge-request + stage: compare + needs: ["build-codec-linux-cmake", "codec-smoke-test"] + timeout: "14 minutes" + script: + - *print-common-info + - *get-commits-behind-count + - *check-commits-behind-count-in-compare-jobs + - *merge-request-comparison-setup-codec + + # some helper variables - "|| true" to prevent failures from grep not finding anything + # write to temporary file as workaround for failures observed with piping echo + - echo $CI_MERGE_REQUEST_TITLE > tmp.txt + - non_be_flag=$(grep -c --ignore-case "\[non[ -]*be\]" tmp.txt) || true + - ref_using_main=$(grep -c --ignore-case "\[ref[ -]*using[ -]*main\]" tmp.txt) || true + + ### If ref_using_main is not set, checkout the source branch to use scripts and input from there + - if [ $ref_using_main == 0 ]; then git checkout $source_branch_commit_sha; fi + + ### prepare pytest + # create references + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 -m create_ref + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 -m create_ref_part2 + + ### Run test using branch scripts and input + - if [ $ref_using_main == 1 ]; then git checkout $source_branch_commit_sha; fi + + ### run pytest + - exit_code=0 + - testcase_timeout=60 + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout=$testcase_timeout || exit_code=$? + - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true + + - *merge-request-comparison-check + + allow_failure: + exit_codes: + - 123 + artifacts: + name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" + expire_in: 1 week + when: always + paths: + - report-junit.xml + - report.html + expose_as: "pytest ivas results" + reports: + junit: + - report-junit.xml + + +# Check interop IVAS_cod_test -> IVAS_dec_ref +ivas-interop-on-merge-request: + extends: + - .test-job-linux-needs-testv-dir + - .rules-merge-request + stage: test + needs: ["build-codec-linux-cmake"] + timeout: "10 minutes" + script: + - *print-common-info + - *get-commits-behind-count + - *check-commits-behind-count-in-compare-jobs + - *merge-request-comparison-setup-codec + # the next line is dependent on ref-using-main flag in the other tests, but here the flag does not make sense + - git checkout $source_branch_commit_sha + + # some helper variables - "|| true" to prevent failures from grep not finding anything + # write to temporary file as workaround for failures observed with piping echo + - echo $CI_MERGE_REQUEST_TITLE > tmp.txt + - non_interop_flag=$(grep -c --ignore-case "\[non[ -]*io\]" tmp.txt) || true + + ### prepare pytest + + # Run reference creation, using source branch encoder and main decoder (see .merge-request-comparison-setup-codec) + - exit_code=0 + - exit_code2=0 + # set timeout for individual testcase runs to 60 seconds + - testcase_timeout=60 + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report.html --self-contained-html --junit-xml=report-junit.xml --update_ref 1 -m create_ref --ref_encoder_path ./IVAS_cod --ref_decoder_path ./IVAS_dec_ref --testcase_timeout=$testcase_timeout || exit_code=$? + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report2.html --self-contained-html --junit-xml=report2-junit.xml --update_ref 1 -m create_ref_part2 --ref_encoder_path ./IVAS_cod --ref_decoder_path ./IVAS_dec_ref --testcase_timeout=$testcase_timeout || exit_code2=$? + - zero_failures=$(cat report-junit.xml report2-junit.xml | grep -c 'failures="0"') || true + + - if [ $zero_failures != 2 ] && [ $non_interop_flag == 0 ]; then echo "Non-interop cases without non-interop flag encountered!"; exit $EXIT_CODE_FAIL; fi + - if [ $zero_failures != 2 ] && [ $non_interop_flag == 1 ]; then echo "Non-interop cases with non-interop flag encountered"; exit $EXIT_CODE_NON_BE; fi + - exit 0 + + allow_failure: + exit_codes: + - 123 + artifacts: + name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" + expire_in: 1 week + when: always + paths: + - report-junit.xml + - report.html + - report2-junit.xml + - report2.html + expose_as: "interop test results" + reports: + junit: + - report*-junit.xml + +evs-pytest-on-merge-request: + extends: + - .test-job-linux + - .rules-merge-request + stage: compare + needs: ["build-codec-linux-cmake", "codec-smoke-test"] + timeout: "10 minutes" + script: + - *print-common-info + - *get-commits-behind-count + - *check-commits-behind-count-in-compare-jobs + - *merge-request-comparison-setup-codec + + # some helper variables - "|| true" to prevent failures from grep not finding anything + # write to temporary file as workaround for failures observed with piping echo + - echo $CI_MERGE_REQUEST_TITLE > tmp.txt + - non_be_flag=$(grep -c --ignore-case "\[evs[ -]*non[ -]*be\]" tmp.txt) || true + - ref_using_main=$(grep -c --ignore-case "\[ref[ -]*using[ -]*main\]" tmp.txt) || true + + ### If ref_using_main is not set, checkoug the source branch to use scripts and input from there + - if [ $ref_using_main == 0 ]; then git checkout $source_branch_commit_sha; fi + + ### prepare pytest + # create references + - testcase_timeout=60 + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR/test_param_file.py -v --update_ref 1 -m create_ref --param_file scripts/config/self_test_evs.prm --testcase_timeout=$testcase_timeout + + ### Run test using branch scripts and input + - if [ $ref_using_main == 1 ]; then git checkout $source_branch_commit_sha; fi + + ### run pytest for EVS cases + - exit_code=0 + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR/test_param_file.py -v --param_file scripts/config/self_test_evs.prm --html=report.html --self-contained-html --junit-xml=report-junit-evs.xml --testcase_timeout=$testcase_timeout || exit_code=$? + - zero_errors=$(cat report-junit-evs.xml | grep -c 'errors="0"') || true + + - *merge-request-comparison-check + + allow_failure: + exit_codes: + - 123 + artifacts: + name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" + expire_in: 1 week + when: always + paths: + - report-junit-evs.xml + - report.html + expose_as: "pytest evs results" + reports: + junit: + - report-junit-evs.xml + +voip-be-on-merge-request: + extends: + - .test-job-linux-needs-testv-dir + - .rules-merge-request + stage: test + needs: ["build-codec-linux-make"] + timeout: "10 minutes" + script: + - *print-common-info + - make clean + - make -j + - python3 -m pytest tests/test_be_for_jbm_neutral_dly_profile.py + +clang-format-check: + extends: + - .test-job-linux + - .rules-merge-request + variables: + ARTIFACT_BASE_NAME: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--formatting-fix" + stage: prevalidate + needs: [] + timeout: "5 minutes" + script: + # Set up variables. This can't be done in the "variables" section because variables are not expanded properly there + - PATCH_FILE_NAME="$ARTIFACT_BASE_NAME".patch + - > + INSTRUCTIONS_GITLAB="To fix formatting issues:\n + - download the diff patch available as artifact of this job\n + - unzip the artifact and place the patch file in the root directory of your local IVAS repo\n + - run: git apply $PATCH_FILE_NAME\n + - commit new changes" + - > + INSTRUCTIONS_README="To fix formatting issues:\n + - place the patch file in the root directory of your local IVAS repo\n + - run: git apply $PATCH_FILE_NAME\n + - commit new changes" + + - format_problems=0 + - scripts/check-format.sh -af -p 8 || format_problems=$? + - if [ $format_problems == 0 ] ; then exit 0; fi + + - mkdir tmp-formatting-fix + - git diff > "tmp-formatting-fix/$PATCH_FILE_NAME" + + # Print instructions to job output + - echo -e "$INSTRUCTIONS_GITLAB" + + # Include readme in the artifact, in case someone misses the job printout (e.g. getting the artifact via MR interface) + - echo -e "$INSTRUCTIONS_README" > "tmp-formatting-fix/readme.txt" + + - exit $format_problems + artifacts: + expire_in: 1 day + paths: + - tmp-formatting-fix/ + when: on_failure + name: "$ARTIFACT_BASE_NAME" + expose_as: "formatting patch" + +# check for crashes if first received frame on decoder side is an SID +check-first-frame-is-sid: + extends: + - .test-job-linux-needs-testv-dir + - .rules-merge-request + tags: + - ivas-linux + stage: test + needs: ["build-codec-linux-cmake"] + script: + - *print-common-info + - *update-ltv-repo + # this rm makes check-for-testvectors only check for the signals we actually need in this test + - rm scripts/config/ci_linux_ltv.json scripts/config/ci_linux.json + - *check-for-testvectors + - bash ci/run-first-frame-is-sid-test.sh + + artifacts: + paths: + - logs_enc + - logs_dec_msan + - logs_dec_asan + - logs_dec_usan + when: always + name: "$CI_JOB_NAME--$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--sidstart" + expose_as: "logs-sidstart" + expire_in: "5 days" + +.lc3plus-ensure-no-code-changes: + extends: + - .test-job-linux + - .rules-merge-request + stage: postvalidate + needs: [] + timeout: "5 minutes" + script: + # Replace code commited to repo with code downloaded from ETSI + - ./scripts/lc3plus_lib_setup/get_lc3plus.sh + + # Ensure git reports no changes + - modified_files=$(git status -s) + - if [[ $modified_files ]]; then printf 'LC3plus codebase was modified!\n\n'"$modified_files"'\n\n'; exit $EXIT_CODE_FAIL; fi + +check-bitexactness-hrtf-rom-and-file: + extends: + - .test-job-linux + - .rules-merge-request + stage: test + needs: ["build-codec-linux-cmake"] + timeout: "5 minutes" + script: + - *print-common-info + - cmake . + - make -j + - python3 tests/create_short_testvectors.py --cut_len 1.0 + - python3 -m pytest tests/hrtf_binary_loading --html=report.html --junit-xml=report-junit.xml --self-contained-html + artifacts: + paths: + - report.html + - report-junit.xml + when: always + name: "$CI_JOB_NAME--$CI_MERGE_REQUEST_ID--sha-$CI_COMMIT_SHA--hrtf-loading" + expose_as: "logs-hrtf-loading" + expire_in: "5 days" + +check-bitexactness-ext-and-transport-format: + extends: + - .test-job-linux + - .rules-merge-request + stage: test + needs: ["build-codec-linux-cmake"] + timeout: "5 minutes" + script: + - *print-common-info + - cmake . + - make -j + - python3 tests/create_short_testvectors.py --cut_len 1.0 + - python3 -m pytest tests/test_be_for_ext_outputs.py --html=report.html --junit-xml=report-junit.xml --self-contained-html + artifacts: + paths: + - report.html + - report-junit.xml + when: always + name: "$CI_JOB_NAME--$CI_MERGE_REQUEST_ID--sha-$CI_COMMIT_SHA--ext-sanity-check" + expose_as: "logs-ext-sanity-check" + expire_in: "5 days" + + +# --------------------------------------------------------------- +# Test jobs for main branch +# --------------------------------------------------------------- + +# check bitexactness to EVS windows binaries +be-2-evs-windows: + extends: + - .rules-main-push + tags: + - ivas-windows + stage: test + needs: ["build-codec-windows-msbuild"] + timeout: "20 minutes" # To be revisited + script: + - *print-common-info-windows + + - $winoutdata = $null + - MSBuild.exe -maxcpucount .\Workspace_msvc\Workspace_msvc.sln /property:Configuration=Release | tee -variable winoutdata + - $winoutdata | Out-File $BUILD_OUTPUT -Encoding Utf8 + + # copy over to never change the testvector dir + - cp -r $EVS_BE_WIN_TEST_DIR ./evs_be_win_test + - cp IVAS_cod.exe ./evs_be_win_test/bin/IVAS_cod.exe + - cp IVAS_dec.exe ./evs_be_win_test/bin/IVAS_dec.exe + + - cd evs_be_win_test + - python ../ci/run_evs_be_win_test.py + +# check bitexactness to EVS +be-2-evs-linux: + extends: + - .test-job-linux + - .rules-main-push + tags: + - be-2-evs-temp + stage: test + needs: ["build-codec-linux-cmake"] + timeout: "20 minutes" # To be revisited + script: + - *print-common-info + + - mkdir build + - cd build + - cmake .. + - make -j + - cd .. + + # copy over to never change the testvector dir + - cp -r $EVS_BE_TEST_DIR ./evs_be_test + - cp build/IVAS_cod ./evs_be_test/bin/EVS_cod + - cp build/IVAS_dec ./evs_be_test/bin/EVS_dec + + - cd evs_be_test + - python3 ../ci/run_evs_be_test.py + +codec-comparison-on-main-push: + extends: + - .test-job-linux-needs-testv-dir + - .rules-main-push + stage: compare + needs: ["build-codec-linux-cmake"] + timeout: "30 minutes" # To be revisited + script: + - *print-common-info + - latest_commit=$(git rev-parse HEAD) # Latest commit + - *get-previous-merge-commit-sha # Stored in previous_merge_commit shell variable now + - echo "Comparing changes from $previous_merge_commit to $latest_commit" + - git --no-pager diff --stat $previous_merge_commit..$latest_commit + + # Rest is more or less placeholder adapted from MR self test. This should be replaced with more complex tests. + + ### build test binaries, initial clean for paranoia reasons + - make clean + - mkdir build + - cd build + - cmake .. + - make -j + - mv IVAS_cod ../IVAS_cod_test + - mv IVAS_dec ../IVAS_dec_test + - cd .. + - rm -rf build/* + + ### compare to the previous merge commit in the main branch + - git fetch origin main + - git checkout $previous_merge_commit + - echo "Building reference codec at commit $previous_merge_commit" + + ### build reference binaries + - cd build + - cmake .. + - make -j + - mv IVAS_cod ../IVAS_cod_ref + - mv IVAS_dec ../IVAS_dec_ref + - cd .. + + # helper variable - "|| true" to prevent failures from grep not finding anything + # write to temporary file as workaround for failures observed with piping echo + - echo $CI_COMMIT_MESSAGE > tmp.txt + - non_be_flag=$(grep -c --ignore-case "\[non[ -]*be\]" tmp.txt) || true + - ref_using_main=$(grep -c --ignore-case "\[ref[ -]*using[ -]*main\]" tmp.txt) || true + + ### re-checkout the latest commit in the main branch, if ref_using_main is not set + - if [ $ref_using_main == 0 ]; then git checkout $latest_commit;fi + + ### prepare pytest + # rename test binaries back + - mv IVAS_cod_test IVAS_cod + - mv IVAS_dec_test IVAS_dec + # create references + - testcase_timeout=60 + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 -m create_ref --testcase_timeout=$testcase_timeout + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 -m create_ref_part2 --testcase_timeout=$testcase_timeout + + ### re-checkout the latest commit here, if ref_using_main is set + - if [ $ref_using_main -eq 1 ]; then git checkout $latest_commit;fi + + ### run pytest + - exit_code=0 + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout=$testcase_timeout || exit_code=$? + - if [ $exit_code -eq 1 ] && [ $non_be_flag == 0 ]; then echo "pytest run had failures and non-BE flag not present"; exit $EXIT_CODE_FAIL; fi + - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true + - if [ $exit_code -eq 1 ] && [ $zero_errors == 1 ]; then echo "pytest run had failures, but no errors and non-BE flag present"; exit $EXIT_CODE_NON_BE; fi + - if [ $exit_code -ne 0 ]; then echo "pytest run had errors"; exit $EXIT_CODE_FAIL; fi; + allow_failure: + exit_codes: + - 123 + artifacts: + name: "main-push--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" + expire_in: 1 week + when: always + paths: + - report-junit.xml + - report.html + expose_as: "Results of comparison to previous merge commit" + reports: + junit: report-junit.xml + + +# --------------------------------------------------------------- +# Manual jobs +# --------------------------------------------------------------- + +test-be-to-release: + stage: test + tags: + - ivas-windows + resource_group: ivas-be-to-release-test-resource + timeout: "20 minutes" + rules: + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'test-be-release' + script: + + - echo "$CI_COMMIT_BRANCH" + - MSBuild.exe -maxcpucount .\Workspace_msvc\Workspace_msvc.sln /property:Configuration=Debug /p:Platform=win32 /m | tee -variable winoutdata + + # path to release candidate refs defined in config.toml + + - echo "Placeholder for BE test to release script" + - mkdir logs + + artifacts: + name: "test-be-to-release--sha-$CI_COMMIT_SHORT_SHA--results" + when: always + expire_in: 1 week + paths: + - logs/ + expose_as: "test-be-to-release results" + + +ivas-conformance: + tags: + - ivas-windows + stage: test + timeout: "90 minutes" + rules: + - if: ($CI_PIPELINE_SOURCE == 'web' || $CI_PIPELINE_SOURCE == 'trigger') && $MANUAL_PIPELINE_TYPE == 'ivas-conformance' + - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + allow_failure: + exit_codes: + - 123 + script: + - *print-common-info-windows + - MSBuild.exe -maxcpucount .\Workspace_msvc\Workspace_msvc.sln /property:Configuration=Debug + - cp -force IVAS_cod.exe IVAS_cod_ref.exe + - cp -force IVAS_dec.exe IVAS_dec_ref.exe + - cp -force IVAS_rend.exe IVAS_rend_ref.exe + + # Reference creation + - python scripts/prepare_combined_format_inputs.py + - $TEST_SET = "tests/codec_be_on_mr_nonselection", "tests/renderer/test_renderer.py", "tests/split_rendering/test_split_rendering.py" + - python -m pytest $TEST_SET -v -n auto --update_ref 1 -m create_ref --create_ref --keep_files + - python -m pytest $TEST_SET -v -n auto --update_ref 1 -m create_ref_part2 --keep_files + + # Output creation + - python -m pytest $TEST_SET -v -n auto --keep_files --create_cut --html=report_cmd.html --self-contained-html + - python scripts/parse_commands.py report_cmd.html Readme_IVAS.txt + + # Copy input data and output ref data + - if (Test-Path testvec) {rm -r -force testvec} + - if (Test-Path TMP_DEC) {rm -r -force TMP_DEC} + - if (Test-Path TMP_ENC) {rm -r -force TMP_ENC} + - if (Test-Path TMP_JBM) {rm -r -force TMP_JBM} + - if (Test-Path TMP_REND) {rm -r -force TMP_REND} + - if (Test-Path TMP_ISAR_POST_REND) {rm -r -force TMP_ISAR_POST_REND} + - if (Test-Path TMP_DEC_ISAR) {rm -r -force TMP_DEC_ISAR} + - mkdir testvec + - mkdir testvec/binauralRenderer_interface + - mkdir testvec/testv + - mkdir testvec/testv/renderer + - mkdir testvec/testv/split_rendering + - mkdir testvec/bin + - cp -force -ErrorAction Ignore scripts/testv/* testvec/testv + - cp -r -force -ErrorAction Ignore scripts/ls_layouts testvec + - cp -r -force -ErrorAction Ignore scripts/switchPaths testvec + - cp -r -force -ErrorAction Ignore scripts/trajectories testvec + - cp -r -force -ErrorAction Ignore scripts/binauralRenderer_interface/binaural_renderers_hrtf_data testvec/binauralRenderer_interface + - cp -r -force -ErrorAction Ignore tests/ref testvec/testv/ref + - cp -r -force -ErrorAction Ignore tests/dut/* testvec/testv/ref + - cp -r -force -ErrorAction Ignore tests/renderer/cut testvec/testv/renderer/ref + - cp -r -force -ErrorAction Ignore tests/split_rendering/cut testvec/testv/split_rendering/ref + - cp -r -force -ErrorAction Ignore tests/split_rendering/renderer_configs testvec/testv/split_rendering/renderer_configs + - cp -r -force -ErrorAction Ignore tests/split_rendering/error_patterns testvec/testv/split_rendering/error_patterns + + # Remove redundant files + - python scripts/cleanup_26252.py + + # Copy test script files + - cp -r -force -ErrorAction Ignore tests/conformance-test testvec/ + - cp Readme_IVAS_dec.txt testvec + - cp Readme_IVAS_enc.txt testvec + - cp Readme_IVAS_rend.txt testvec + - cp Readme_IVAS_JBM_dec.txt testvec + - cp Readme_IVAS_ISAR_dec.txt testvec + - cp Readme_IVAS_ISAR_post_rend.txt testvec + - cp IVAS_cod.exe testvec/bin + - cp IVAS_dec.exe testvec/bin + - cp IVAS_rend.exe testvec/bin + - cp ISAR_post_rend.exe testvec/bin + + + # Test run generated scripts in testvec + - cd testvec + - python -m pytest conformance-test/test_26252.py --junit-xml=report-junit.xml --html=report.html --self-contained-html + - mv report.html .. + - mv report-junit.xml .. + + artifacts: + name: "ivas-conformance-$CI_COMMIT_SHORT_SHA" + expire_in: 1 week + when: always + paths: + - report-junit.xml + - report.html + - Readme_IVAS_dec.txt + - Readme_IVAS_enc.txt + - Readme_IVAS_rend.txt + - Readme_IVAS_JBM_dec.txt + - Readme_IVAS_ISAR_dec.txt + - Readme_IVAS_ISAR_post_rend.txt + expose_as: "Draft IVAS conformance" + reports: + junit: report-junit.xml + +ivas-conformance-linux: + tags: + - ivas-linux + stage: test + timeout: "90 minutes" + rules: + - if: ($CI_PIPELINE_SOURCE == 'web' || $CI_PIPELINE_SOURCE == 'trigger') && $MANUAL_PIPELINE_TYPE == 'ivas-conformance-linux' + allow_failure: + exit_codes: + - 123 + script: + - *print-common-info + - make -j + - cp IVAS_cod IVAS_cod_ref + - cp IVAS_dec IVAS_dec_ref + - cp IVAS_rend IVAS_rend_ref + + # Reference creation + - python3 scripts/prepare_combined_format_inputs.py + - TEST_SET="tests/codec_be_on_mr_nonselection tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py" + - python3 -m pytest $TEST_SET -v -n auto --update_ref 1 -m create_ref --create_ref --keep_files + - python3 -m pytest $TEST_SET -v -n auto --update_ref 1 -m create_ref_part2 --keep_files + + # Output creation + - python3 -m pytest $TEST_SET -v -n auto --keep_files --create_cut --html=report_cmd.html --self-contained-html + - python3 scripts/parse_commands.py report_cmd.html Readme_IVAS.txt + + # Copy input data and output ref data + - rm -rf testvec + - mkdir testvec + - mkdir testvec/binauralRenderer_interface + - mkdir testvec/testv + - mkdir testvec/testv/renderer + - mkdir testvec/testv/split_rendering + - mkdir testvec/bin + - cp -r scripts/testv/* testvec/testv + - cp -r scripts/ls_layouts testvec + - cp -r scripts/switchPaths testvec + - cp -r scripts/trajectories testvec + - cp -r scripts/binauralRenderer_interface/binaural_renderers_hrtf_data testvec/binauralRenderer_interface + - cp -r tests/ref testvec/testv/ref + - cp -r tests/dut/* testvec/testv/ref + - cp -r tests/renderer/cut testvec/testv/renderer/ref + - cp -r tests/split_rendering/cut testvec/testv/split_rendering/ref + - cp -r tests/split_rendering/renderer_configs testvec/testv/split_rendering/renderer_configs + - cp -r tests/split_rendering/error_patterns testvec/testv/split_rendering/error_patterns + + # Remove redundant files + - python3 scripts/cleanup_26252.py + + # Copy test script files + - cp -r tests/conformance-test testvec/ + - cp Readme_IVAS_dec.txt testvec + - cp Readme_IVAS_enc.txt testvec + - cp Readme_IVAS_rend.txt testvec + - cp Readme_IVAS_JBM_dec.txt testvec + - cp Readme_IVAS_ISAR_dec.txt testvec + - cp Readme_IVAS_ISAR_post_rend.txt testvec + + # Create GCOV execs for coverage analysis + - make clean + - make GCOV=1 -j + + - cp IVAS_cod testvec/bin + - cp IVAS_dec testvec/bin + - cp IVAS_rend testvec/bin + - cp ISAR_post_rend testvec/bin + + # Test run generated scripts in testvec + - cd testvec + - exit_code=0 + - python3 -m pytest conformance-test/test_26252.py --junit-xml=report-junit.xml --html=report.html --self-contained-html || exit_code=$? + - mv report.html .. + - mv report-junit.xml .. + + # Collect coverage + - cd - + - lcov -c -d obj -o coverage.info + - lcov -r coverage.info "*apps*" -o coverage.info + - lcov -r coverage.info "*lib_util*" -o coverage.info + - commit_sha=$(git rev-parse HEAD) + - genhtml coverage.info -o coverage -t "Coverage on main @ $commit_sha" + + # Check for failures + - if [ $exit_code -eq 1 ]; then echo "Test failures encountered"; exit $EXIT_CODE_FAIL; fi + + artifacts: + name: "ivas-conformance-linux-$CI_COMMIT_SHORT_SHA" + expire_in: 1 week + when: always + paths: + - report_cmd.html + - report-junit.xml + - report.html + - Readme_IVAS_dec.txt + - Readme_IVAS_enc.txt + - Readme_IVAS_rend.txt + - Readme_IVAS_JBM_dec.txt + - Readme_IVAS_ISAR_dec.txt + - Readme_IVAS_ISAR_post_rend.txt + - coverage.info + - coverage + expose_as: "Draft IVAS conformance -- Linux" + reports: + junit: report-junit.xml + + +test-long-self-test: + tags: + - ivas-linux-fast + stage: compare + resource_group: ivas-long-self-test-resource + timeout: "50 minutes" + rules: + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'test-long-self-test' + allow_failure: + exit_codes: + - 123 + script: + - *print-common-info + - *update-ltv-repo + + ### build branch binaries + - cmake . -Bbuild-test + - cmake --build build-test -- -j + - mv build-test/IVAS_cod ./IVAS_cod + - mv build-test/IVAS_dec ./IVAS_dec + + ### store the current commit hash + - source_branch_commit_sha=$(git rev-parse HEAD) + + ### switch to main + - git checkout main + - git pull origin main + - echo "Building reference codec at commit $(git rev-parse HEAD)" + + ### build main (ref) binaries + - cmake . -Bbuild-ref + - cmake --build build-ref -- -j + - mv build-ref/IVAS_cod ./IVAS_cod_ref + - mv build-ref/IVAS_dec ./IVAS_dec_ref + + ### Switch back to branch, this could probably be removed later + - git checkout $source_branch_commit_sha + + ### prepare pytest + + # Copy test vectors from LTV to TESTV + - *copy-ltv-files-to-testv-dir + + # create references + - exit_code_ref=0 + - testcase_timeout=300 + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR/test_param_file.py -v --update_ref 1 -m create_ref --param_file scripts/config/self_test_ltv.prm --testcase_timeout=$testcase_timeout || exit_code_ref=$? + + ### run pytest self-test using long test vectors + - exit_code=0 + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR/test_param_file.py -v --param_file scripts/config/self_test_ltv.prm --html=report-ltv.html --self-contained-html --junit-xml=report-junit-ltv.xml --testcase_timeout=$testcase_timeout || exit_code=$? + - zero_errors=$(cat report-junit-ltv.xml | grep -c 'errors="0"') || true + + - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi + - if [ $exit_code -eq 1 ]; then echo "Non-bitexact cases encountered!"; exit $EXIT_CODE_NON_BE; fi + - exit 0 + + + artifacts: + name: "test-long-self-test--sha-$CI_COMMIT_SHORT_SHA--results" + when: always + expire_in: 4 mos + paths: + - report-junit-ltv.xml + - report-ltv.html + expose_as: "test-long-self-test results" + reports: + junit: + - report-junit-ltv.xml + + +# --------------------------------------------------------------- +# Scheduled jobs on main +# --------------------------------------------------------------- + +# code selftest long testvectors with memory-sanitizer binaries +ltv-msan: + extends: + - .sanitizer-selftest-ltv + rules: + - if: $SANITIZER_SCHEDULE_E + timeout: 4 hour + tags: + - ivas-linux-fast + before_script: + - CLANG_NUM=1 + - SELFTEST_SANITY_TIMEOUT=$TESTCASE_TIMEOUT_LTV_SANITIZERS + - SELF_TEST_PRM_FILE="scripts/config/self_test_ltv.prm" + <<: *sanitizer-selftest-anchor + +# code selftest long testvectors with address-sanitizer binaries +ltv-asan: + extends: + - .sanitizer-selftest-ltv + rules: + - if: $SANITIZER_SCHEDULE_E + when: delayed + start_in: 4 hours + tags: + - ivas-linux-fast + timeout: 3 hour + before_script: + - CLANG_NUM=2 + - SELFTEST_SANITY_TIMEOUT=$TESTCASE_TIMEOUT_LTV_SANITIZERS + - SELF_TEST_PRM_FILE="scripts/config/self_test_ltv.prm" + <<: *sanitizer-selftest-anchor + +# code selftest long testvectors with undefined-behaviour-sanitizer binaries +ltv-usan: + extends: + - .sanitizer-selftest-ltv + rules: + - if: $SANITIZER_SCHEDULE_E + when: delayed + start_in: 7 hours + tags: + - ivas-linux-fast + timeout: 3 hour + before_script: + - CLANG_NUM=3 + - SELFTEST_SANITY_TIMEOUT=$TESTCASE_TIMEOUT_LTV_SANITIZERS + - SELF_TEST_PRM_FILE="scripts/config/self_test_ltv.prm" + <<: *sanitizer-selftest-anchor + +.sanitizer-test-template: + extends: + - .test-job-linux + stage: test + tags: + - sanitizer_test_main + - ivas-linux-fast + artifacts: + name: "$CI_JOB_NAME--main--sha-$CI_COMMIT_SHORT_SHA" + expire_in: 2 weeks + when: always + paths: + - ep_015.g192 + - dly_profile.dat + - head_rot_traj.csv + - exof_traj.csv + - ./LOGS_PLC + - ./LOGS_noPLC + +### --- sanitizer schedule A --- + +.sanitizer-test-schedule-A: + extends: + - .sanitizer-test-template + +sanitizer-test-mono: + extends: .sanitizer-test-schedule-A + rules: + - if: $SANITIZER_SCHEDULE_A + timeout: 1.25 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py mono mono --tests $SANITIZER_TESTS + +sanitizer-test-stereo: + extends: .sanitizer-test-schedule-A + rules: + - if: $SANITIZER_SCHEDULE_A + when: delayed + start_in: 1.25 hours + timeout: 2.5 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py stereo $OUT_FORMATS_CHANNEL_BASED EXT --tests $SANITIZER_TESTS + +sanitizer-test-stereodmxevs: + extends: .sanitizer-test-schedule-A + rules: + - if: $SANITIZER_SCHEDULE_A + when: delayed + start_in: 3.75 hours + timeout: 1.25 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py StereoDmxEVS mono --tests $SANITIZER_TESTS + +sanitizer-test-mc-5_1: + extends: .sanitizer-test-schedule-A + rules: + - if: $SANITIZER_SCHEDULE_A + when: delayed + start_in: 5 hours + timeout: 2.5 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py 5_1 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-mc-5_1_2: + extends: .sanitizer-test-schedule-A + rules: + - if: $SANITIZER_SCHEDULE_A + when: delayed + start_in: 7.5 hours + timeout: 2.5 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py 5_1_2 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-mc-5_1_4: + extends: .sanitizer-test-schedule-A + rules: + - if: $SANITIZER_SCHEDULE_A + when: delayed + start_in: 10 hours + timeout: 3.75 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py 5_1_4 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-mc-7_1: + extends: .sanitizer-test-schedule-A + rules: + - if: $SANITIZER_SCHEDULE_A + when: delayed + start_in: 13.75 hours + timeout: 2.5 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py 7_1 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-mc-7_1_4: + extends: .sanitizer-test-schedule-A + rules: + - if: $SANITIZER_SCHEDULE_A + when: delayed + start_in: 16.25 hours + timeout: 5 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py 7_1_4 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-ism+1: + extends: .sanitizer-test-schedule-A + rules: + - if: $SANITIZER_SCHEDULE_A + when: delayed + start_in: 21.25 hours + timeout: 1.25 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py ISM1 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-ism+2: + extends: .sanitizer-test-schedule-A + rules: + - if: $SANITIZER_SCHEDULE_A + when: delayed + start_in: 22.5 hours + timeout: 2.5 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py ISM2 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-ism+3: + extends: .sanitizer-test-schedule-A + rules: + - if: $SANITIZER_SCHEDULE_A + when: delayed + start_in: 25 hours + timeout: 3.75 hour + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py ISM3 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-ism+4: + extends: .sanitizer-test-schedule-A + rules: + - if: $SANITIZER_SCHEDULE_A + when: delayed + start_in: 28.75 hours + timeout: 5 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py ISM4 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-masa: + extends: .sanitizer-test-schedule-A + rules: + - if: $SANITIZER_SCHEDULE_A + when: delayed + start_in: 33.75 hours + timeout: 10 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py MASA $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +### --- sanitizer schedule B --- + +.sanitizer-test-schedule-B: + extends: + - .sanitizer-test-template + timeout: 7.5 hours + +sanitizer-test-foa: + extends: .sanitizer-test-schedule-B + rules: + - if: $SANITIZER_SCHEDULE_B + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py FOA $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-hoa2: + extends: .sanitizer-test-schedule-B + rules: + - if: $SANITIZER_SCHEDULE_B + when: delayed + start_in: 7.5 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py HOA2 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-hoa3: + extends: .sanitizer-test-schedule-B + rules: + - if: $SANITIZER_SCHEDULE_B + when: delayed + start_in: 15 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py HOA3 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-osba-foa-ism1: + extends: .sanitizer-test-schedule-B + rules: + - if: $SANITIZER_SCHEDULE_B + when: delayed + start_in: 22.5 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py FOA-ISM1 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-osba-foa-ism2: + extends: .sanitizer-test-schedule-B + rules: + - if: $SANITIZER_SCHEDULE_B + when: delayed + start_in: 30 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py FOA-ISM2 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-osba-foa-ism3: + extends: .sanitizer-test-schedule-B + rules: + - if: $SANITIZER_SCHEDULE_B + when: delayed + start_in: 37.5 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py FOA-ISM3 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-osba-foa-ism4: + extends: .sanitizer-test-schedule-B + rules: + - if: $SANITIZER_SCHEDULE_B + when: delayed + start_in: 45 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py FOA-ISM4 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-osba-hoa2-ism1: + extends: .sanitizer-test-schedule-B + rules: + - if: $SANITIZER_SCHEDULE_B + when: delayed + start_in: 52.5 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py HOA2-ISM1 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-osba-hoa2-ism2: + extends: .sanitizer-test-schedule-B + rules: + - if: $SANITIZER_SCHEDULE_B + when: delayed + start_in: 60 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py HOA2-ISM2 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-osba-hoa2-ism3: + extends: .sanitizer-test-schedule-B + rules: + - if: $SANITIZER_SCHEDULE_B + when: delayed + start_in: 67.5 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py HOA2-ISM3 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-osba-hoa2-ism4: + extends: .sanitizer-test-schedule-B + rules: + - if: $SANITIZER_SCHEDULE_B + when: delayed + start_in: 75 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py HOA2-ISM4 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-osba-hoa3-ism1: + extends: .sanitizer-test-schedule-B + rules: + - if: $SANITIZER_SCHEDULE_B + when: delayed + start_in: 82.5 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py HOA3-ISM1 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-osba-hoa3-ism2: + extends: .sanitizer-test-schedule-B + rules: + - if: $SANITIZER_SCHEDULE_B + when: delayed + start_in: 90 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py HOA3-ISM2 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-omasa-ism4: + extends: .sanitizer-test-schedule-B + rules: + - if: $SANITIZER_SCHEDULE_B + when: delayed + start_in: 97.5 hours + timeout: 10 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py MASA-ISM4 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + + +### --- sanitizer schedule C --- + +.sanitizer-test-schedule-C: + extends: + - .sanitizer-test-template + timeout: 10 hours + +sanitizer-test-omasa-ism1: + extends: .sanitizer-test-schedule-C + rules: + - if: $SANITIZER_SCHEDULE_C + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py MASA-ISM1 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-omasa-ism2: + extends: .sanitizer-test-schedule-C + rules: + - if: $SANITIZER_SCHEDULE_C + when: delayed + start_in: 10 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py MASA-ISM2 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-omasa-ism3: + extends: .sanitizer-test-schedule-C + rules: + - if: $SANITIZER_SCHEDULE_C + when: delayed + start_in: 20 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py MASA-ISM3 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-osba-hoa3-ism3: + extends: .sanitizer-test-schedule-C + rules: + - if: $SANITIZER_SCHEDULE_C + when: delayed + start_in: 30 hours + timeout: 7.5 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py HOA3-ISM3 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-osba-hoa3-ism4: + extends: .sanitizer-test-schedule-C + rules: + - if: $SANITIZER_SCHEDULE_C + when: delayed + start_in: 37.5 hours + timeout: 7.5 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py HOA3-ISM4 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +### --- sanitizer schedule D --- + +.sanitizer-test-schedule-D: + extends: + - .sanitizer-test-template + timeout: 7.5 hours + +sanitizer-test-planar-foa: + extends: .sanitizer-test-schedule-D + rules: + - if: $SANITIZER_SCHEDULE_D + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py PlanarFOA $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-planar-hoa2: + extends: .sanitizer-test-schedule-D + rules: + - if: $SANITIZER_SCHEDULE_D + when: delayed + start_in: 7.5 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py PlanarHOA2 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-planar-hoa3: + extends: .sanitizer-test-schedule-D + rules: + - if: $SANITIZER_SCHEDULE_D + when: delayed + start_in: 15 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py PlanarHOA3 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-osba-planar-foa-ism1: + extends: .sanitizer-test-schedule-D + rules: + - if: $SANITIZER_SCHEDULE_D + when: delayed + start_in: 22.5 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py PlanarFOA-ISM1 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-osba-planar-foa-ism2: + extends: .sanitizer-test-schedule-D + rules: + - if: $SANITIZER_SCHEDULE_D + when: delayed + start_in: 30 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py PlanarFOA-ISM2 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-osba-planar-foa-ism3: + extends: .sanitizer-test-schedule-D + rules: + - if: $SANITIZER_SCHEDULE_D + when: delayed + start_in: 37.5 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py PlanarFOA-ISM3 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-osba-planar-foa-ism4: + extends: .sanitizer-test-schedule-D + rules: + - if: $SANITIZER_SCHEDULE_D + when: delayed + start_in: 45 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py PlanarFOA-ISM4 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-osba-planar-hoa2-ism1: + extends: .sanitizer-test-schedule-D + rules: + - if: $SANITIZER_SCHEDULE_D + when: delayed + start_in: 52.5 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py PlanarHOA2-ISM1 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-osba-planar-hoa2-ism2: + extends: .sanitizer-test-schedule-D + rules: + - if: $SANITIZER_SCHEDULE_D + when: delayed + start_in: 60 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py PlanarHOA2-ISM2 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-osba-planar-hoa2-ism3: + extends: .sanitizer-test-schedule-D + rules: + - if: $SANITIZER_SCHEDULE_D + when: delayed + start_in: 67.5 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py PlanarHOA2-ISM3 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-osba-planar-hoa2-ism4: + extends: .sanitizer-test-schedule-D + rules: + - if: $SANITIZER_SCHEDULE_D + when: delayed + start_in: 75 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py PlanarHOA2-ISM4 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-osba-planar-hoa3-ism1: + extends: .sanitizer-test-schedule-D + rules: + - if: $SANITIZER_SCHEDULE_D + when: delayed + start_in: 82.5 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py PlanarHOA3-ISM1 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-osba-planar-hoa3-ism2: + extends: .sanitizer-test-schedule-D + rules: + - if: $SANITIZER_SCHEDULE_D + when: delayed + start_in: 90 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py PlanarHOA3-ISM2 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-osba-planar-hoa3-ism3: + extends: .sanitizer-test-schedule-D + rules: + - if: $SANITIZER_SCHEDULE_D + when: delayed + start_in: 97.5 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py PlanarHOA3-ISM3 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + +sanitizer-test-osba-planar-hoa3-ism4: + extends: .sanitizer-test-schedule-D + rules: + - if: $SANITIZER_SCHEDULE_D + when: delayed + start_in: 105 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py PlanarHOA3-ISM4 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS + + + +# GCOV/LCOV coverage analysis of self_test suite +coverage-test-on-main-scheduled: + extends: + - .test-job-linux-needs-testv-dir + - .rules-main-scheduled + tags: + - ivas-linux + stage: test + rules: + # only run in scheduled pipeline that passes this env vars + - if: $COVERAGE_TEST + timeout: 3 hours + script: + - *print-common-info + - *update-ltv-repo + - *copy-ltv-files-to-testv-dir + - make GCOV=1 -j + - cp IVAS_rend IVAS_rend_ref # Copy exec to be able to run renderer script + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v -n auto --update_ref 1 -m create_ref --ref_encoder_path ./IVAS_cod --ref_decoder_path ./IVAS_dec + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v -n auto --update_ref 1 -m create_ref_part2 --ref_encoder_path ./IVAS_cod --ref_decoder_path ./IVAS_dec + # need to ignore non-zero exit codes as limiter is active and thus the different framesiszes will not be BE in all cases + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --dut_encoder_path ./IVAS_cod --dut_decoder_path ./IVAS_dec --dut_fr 5 --decoder_only || true + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --dut_encoder_path ./IVAS_cod --dut_decoder_path ./IVAS_dec --dut_fr 10 --decoder_only || true + - python3 -m pytest -q -n auto tests/renderer/test_renderer.py --create_ref + - python3 -m pytest -q -n auto tests/renderer/test_renderer.py --create_cut + - lcov -c -d obj -o coverage_stv.info # extract coverage of short test vectors here + # remove apps and lib_util files from coverage + - lcov -r coverage_stv.info "*apps*" -o coverage_stv.info + - lcov -r coverage_stv.info "*lib_util*" -o coverage_stv.info + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR/test_param_file.py -v -n auto --update_ref 1 -m create_ref --param_file scripts/config/self_test_evs.prm --ref_encoder_path ./IVAS_cod --ref_decoder_path ./IVAS_dec + - bash ci/smoke_test.sh coverage + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR/test_param_file.py -v -n auto --update_ref 1 -m create_ref --param_file scripts/config/self_test_ltv.prm --ref_encoder_path ./IVAS_cod --ref_decoder_path ./IVAS_dec + - python3 -m pytest tests/test_be_for_jbm_neutral_dly_profile.py + - lcov -c -d obj -o coverage.info + # remove apps and lib_util files from coverage + - lcov -r coverage.info "*apps*" -o coverage.info + - lcov -r coverage.info "*lib_util*" -o coverage.info + - commit_sha=$(git rev-parse HEAD) + - genhtml coverage.info -o coverage -t "Coverage on main @ $commit_sha" + - genhtml coverage_stv.info -o coverage_stv -t "Coverage on main -- short test vectors @ $commit_sha" + artifacts: + name: "main-coverage-sha-$CI_COMMIT_SHORT_SHA" + when: always + expire_in: 1 week + paths: + - coverage.info + - coverage_stv.info + - coverage + - coverage_stv + +# --------------------------------------------------------------- +# Complexity measurement jobs +# --------------------------------------------------------------- + +.complexity-measurements-setup: + &complexity-measurements-setup # create necessary environment + - mkdir -p wmops/logs + + - job_id=$(python3 ci/get_id_of_last_job_occurence.py $CI_COMMIT_REF_NAME $CI_JOB_NAME $CI_PROJECT_ID) + - echo $job_id + - curl --request GET "https://forge.3gpp.org/rep/api/v4/projects/$CI_PROJECT_ID/jobs/$job_id/artifacts" --output artifacts.zip + - unzip artifacts.zip || true # this may fail on first run, when there are no artifacts there and the zip file is actually just "404"-html + - ls + - public_dir="$CI_JOB_NAME-public" + # if is needed to catch case when no artifact is there (first run), similarly as above + - if [[ -d $public_dir ]]; then mv $public_dir/* wmops/; fi + - ls wmops + - rm artifacts.zip + - rm -rf $public_dir + +.complexity-measurements-prepare-artifacts: + &complexity-measurements-prepare-artifacts # prepare artifacts -> move to public directory + - public_dir="$CI_JOB_NAME-public" + - mkdir $public_dir + - mv -f wmops/log_*_all.txt wmops/*.js ${public_dir}/ + # move logfiles for links + - mkdir $public_dir/logs + # first move logs + - log_files=$(cat $public_dir/graphs*.js | grep logFile | sed "s/.*\(wmops_newsletter_.*\.csv\).*/\1/g") + - echo $log_files + - ls wmops/logs + - for f in $log_files; do [ -f wmops/logs/$f ] && mv wmops/logs/$f $public_dir/logs/$f; done + # copy index page blueprint + - cp ci/complexity_measurements/index_complexity.html ${public_dir}/index.html + # patch the format in the title + - sed -i "s/IVAS FORMAT/IVAS $in_format to $out_format/g" ${public_dir}/index.html + # do separately here to avoid overwrite complaints by mv + - mv -f ci/complexity_measurements/style.css ${public_dir}/ + - ls $public_dir + +.complexity-template: + extends: + # still needed as long as no long MASA testvectors are there + - .test-job-linux-needs-testv-dir + tags: + - ivas-linux-fast + timeout: 3 hours 30 minutes + stage: test + before_script: + - *print-common-info + - *update-ltv-repo + - *complexity-measurements-setup + artifacts: + name: "$CI_JOB_NAME--$CI_COMMIT_REF_NAME--sha-$CI_COMMIT_SHA" + when: always + expire_in: 1 week + paths: + - $CI_JOB_NAME-public + +complexity-stereo-in-ext-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + script: + - in_format=stereo + - out_format=ext + - ret_val=0 + - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + +complexity-ism-in-binaural-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + when: delayed + start_in: 1 hour + script: + - in_format=ISM + - out_format=BINAURAL + - ret_val=0 + - bash ci/complexity_measurements/getWmops.sh "ISM+1 ISM+2 ISM+3 ISM+4" "$out_format" || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + +complexity-ism-in-binaural_room_ir-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + when: delayed + start_in: 2 hours + script: + - in_format=ISM + - out_format=BINAURAL_ROOM_IR + - ret_val=0 + - bash ci/complexity_measurements/getWmops.sh "ISM+1 ISM+2 ISM+3 ISM+4" "$out_format" || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + +complexity-ism-in-ext-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + when: delayed + start_in: 3 hours + script: + - in_format=ISM + - out_format=EXT + - ret_val=0 + - bash ci/complexity_measurements/getWmops.sh "ISM+1 ISM+2 ISM+3 ISM+4" "$out_format" || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + +complexity-sba-hoa3-in-ext-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + when: delayed + start_in: 4 hours + script: + - in_format=HOA3 + - out_format=EXT + - ret_val=0 + - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + +complexity-sba-hoa3-in-binaural-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + when: delayed + start_in: 5 hours + script: + - in_format=HOA3 + - out_format=BINAURAL + - ret_val=0 + - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + +complexity-sba-hoa3-in-binaural_room_ir-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + when: delayed + start_in: 6 hours + script: + - in_format=HOA3 + - out_format=BINAURAL_ROOM_IR + - ret_val=0 + - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + +complexity-mc-in-ext-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + when: delayed + start_in: 7 hours + script: + - in_format=MC + - out_format=EXT + - ret_val=0 + - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + +complexity-mc-in-binaural-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + when: delayed + start_in: 8 hours + script: + - in_format=MC + - out_format=BINAURAL + - ret_val=0 + - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + +complexity-mc-in-binaural_room_ir-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + when: delayed + start_in: 9 hours + script: + - in_format=MC + - out_format=BINAURAL_ROOM_IR + - ret_val=0 + - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + +complexity-masa-in-ext-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + when: delayed + start_in: 10 hours + script: + - in_format=MASA + - out_format=EXT + - ret_val=0 + - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + +complexity-masa-in-binaural-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + when: delayed + start_in: 11 hours + script: + - in_format=MASA + - out_format=BINAURAL + - ret_val=0 + - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + +complexity-masa-in-hoa3-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + when: delayed + start_in: 12 hours + script: + - in_format=MASA + - out_format=HOA3 + - ret_val=0 + - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + +complexity-omasa-in-ext-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + when: delayed + start_in: 13 hours + script: + - in_format=OMASA + - out_format=EXT + - ret_val=0 + - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + +complexity-omasa-in-binaural-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + when: delayed + start_in: 14 hours + script: + - in_format=OMASA + - out_format=BINAURAL + - ret_val=0 + - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + +complexity-omasa-in-hoa3-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + when: delayed + start_in: 15 hours + script: + - in_format=OMASA + - out_format=HOA3 + - ret_val=0 + - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + +complexity-StereoDmxEVS-stereo-in-mono-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + when: delayed + start_in: 16 hours + script: + - in_format=StereoDmxEVS + - out_format=mono + - ret_val=0 + - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + +complexity-osba-in-ext-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + when: delayed + start_in: 17 hours + script: + - in_format=OSBA + - out_format=EXT + - ret_val=0 + - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + +complexity-osba-in-binaural-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + when: delayed + start_in: 18 hours + script: + - in_format=OSBA + - out_format=BINAURAL + - ret_val=0 + - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + +complexity-osba-in-binaural_room_ir-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + when: delayed + start_in: 19 hours + script: + - in_format=OSBA + - out_format=BINAURAL_ROOM_IR + - ret_val=0 + - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + +# --------------------------------------------------------------- +# Other jobs +# --------------------------------------------------------------- + +# job that sets up gitlab pages website +pages: + stage: deploy + tags: + - ivas-linux + rules: + - if: $UPDATE_PAGES + script: + - python3 ci/setup_pages.py + artifacts: + paths: + - public + expire_in: 1 day + +# Pull state of a branch on 3GPP repo, push to a mirror repo. +pull-from-3gpp-forge: + stage: maintenance + rules: + - if: $MIRROR_ACCESS_TOKEN # Only run in the mirror update pipeline (only then MIRROR_ACCESS_TOKEN is defined) + script: + # Set up git LFS for mirroring (see: https://github.com/git-lfs/git-lfs/issues/1762) + - git lfs install --skip-smudge --local + + # Check out mirror branch - by default the runner checks out by commit hash, which results in detached head state + - git checkout $CI_COMMIT_BRANCH + + # Pull commits from upstream + - git remote add upstream https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec.git + - git pull --ff-only --tags upstream $MIRROR_SOURCE_BRANCH + - git lfs pull upstream + + # Push to mirror, include tags. Option `-o ci.skip` tells GitLab to skip CI for the pushed commits (assumed already tested upstream) + - git push --tags -o ci.skip "https://${GITLAB_USER_LOGIN}:${MIRROR_ACCESS_TOKEN}@${CI_REPOSITORY_URL#*@}" "HEAD:${CI_COMMIT_BRANCH}" -- GitLab From 7e35bcb675f1032abd62f1f5f92882649a1db73c Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Thu, 22 Aug 2024 12:02:38 +0200 Subject: [PATCH 08/10] correct version of the Gitlab CI yaml file --- .gitlab-ci.yml | 3129 +++++++++++------------------------------------- 1 file changed, 687 insertions(+), 2442 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 62ef1dbd3..6a77da6fa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,39 +1,47 @@ variables: TESTV_DIR: "/usr/local/testv" LTV_DIR: "/usr/local/ltv" + EVS_BE_TEST_DIR_BASOP: "/usr/local/be_2_evs_basop" + REFERENCE_BRANCH: "ivas-float-update" BUILD_OUTPUT: "build_output.txt" - EVS_BE_TEST_DIR: "/usr/local/be_2_evs_test" - EVS_BE_WIN_TEST_DIR: "C:/Users/gitlab-runner/testvec" + SCRIPTS_DIR: "/usr/local/scripts" EXIT_CODE_NON_BE: 123 EXIT_CODE_FAIL: 1 - PROCESSING_SCRIPTS_BIN_DIR: "/test-bin" - TESTS_DIR_CODEC_BE_ON_MR: "tests/codec_be_on_mr_nonselection" - SANITIZER_TESTS: "CLANG1 CLANG2 CLANG3" - OUT_FORMATS_CHANNEL_BASED: "stereo mono 5_1 5_1_2 5_1_4 7_1 7_1_4" - OUT_FORMATS_SCENE_BASED: "FOA HOA2 HOA3" - OUT_FORMATS_BINAURAL: "BINAURAL BINAURAL_ROOM_IR BINAURAL_ROOM_REVERB" - OUT_FORMATS_ALL: "$OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL EXT" + LONG_TEST_SUITE: "tests/codec_be_on_mr_nonselection tests/renderer --param_file scripts/config/self_test_ltv.prm" + SHORT_TEST_SUITE: "tests/codec_be_on_mr_nonselection" + TEST_SUITE: "" + DUT_ENCODER_PATH: "./IVAS_cod" + DUT_DECODER_PATH: "./IVAS_dec" + REF_ENCODER_PATH: "./IVAS_cod_ref" + REF_DECODER_PATH: "./IVAS_dec_ref" + LEVEL_SCALING: "1.0" IVAS_PIPELINE_NAME: '' + BASOP_CI_BRANCH_PC_REPO: "basop-ci-branch" + PRM_FILES: "scripts/config/self_test.prm scripts/config/self_test_ltv.prm" + TESTCASE_TIMEOUT_STV: 900 + TESTCASE_TIMEOUT_LTV: 2400 + TESTCASE_TIMEOUT_STV_SANITIZERS: 1800 + CI_REGRESSION_THRESH_MLD: "0.1" + CI_REGRESSION_THRESH_MAX_ABS_DIFF: "50" + CI_REGRESSION_THRESH_SSNR: "-1" + CI_REGRESSION_THRESH_ODG: "-0.05" + GIT_CLEAN_FLAGS: -ffdxq MANUAL_PIPELINE_TYPE: - description: "Type for the manual pipeline run. Use 'test-be-release' to run BE test against release codec." + description: "Type for the manual pipeline run. Use 'pytest-compare' to run comparison test against reference float codec." value: 'default' options: - 'default' - - 'test-be-release' - - 'test-long-self-test' - - 'ivas-conformance' - - 'ivas-conformance-linux' - - 'check-float-reference' - GIT_CLEAN_FLAGS: -ffdxq - TESTCASE_TIMEOUT_STV_SANITIZERS: 180 - TESTCASE_TIMEOUT_LTV_SANITIZERS: 1200 - BASOP_REFERENCE_BRANCH: "ivas-float-update" + - 'pytest-compare' + - 'pytest-compare-long' + - 'pytest-saturation-smoke-test' + - 'evs-26444' + - 'sanitizer-stv' + - 'pytest-renderer' default: interruptible: true # Make all jobs by default interruptible -# This sets when pipelines are created. Jobs have more specific rules to restrict them. workflow: name: '$IVAS_PIPELINE_NAME' rules: @@ -43,42 +51,40 @@ workflow: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' variables: IVAS_PIPELINE_NAME: 'MR pipeline: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME' - - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Pushes to main - variables: - IVAS_PIPELINE_NAME: 'Push pipeline: $CI_COMMIT_BRANCH' - - if: $CI_PIPELINE_SOURCE == 'schedule' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Scheduled in main - variables: - IVAS_PIPELINE_NAME: 'Scheduled pipeline: $CI_COMMIT_BRANCH' + ### disabled for now because pipeline setup is redundant with MR pipeline with current workflow + # - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Pushes to main + # variables: + # IVAS_PIPELINE_NAME: 'Push pipeline: $CI_COMMIT_BRANCH' - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'default' # for testing variables: IVAS_PIPELINE_NAME: 'Web run pipeline: $CI_COMMIT_BRANCH' - - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'test-be-release' + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-compare' variables: - IVAS_PIPELINE_NAME: 'Test BE to release pipeline: $CI_COMMIT_BRANCH' - - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'test-long-self-test' + IVAS_PIPELINE_NAME: 'Run comparison tools against float ref: $CI_COMMIT_BRANCH' + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-compare-long' variables: - IVAS_PIPELINE_NAME: 'Test long self-test against main pipeline: $CI_COMMIT_BRANCH' - - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'ivas-conformance' + IVAS_PIPELINE_NAME: 'Run comparison tools against float ref (long test vectors): $CI_COMMIT_BRANCH' + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-saturation-smoke-test' variables: - IVAS_PIPELINE_NAME: 'Draft IVAS Conformance test: $CI_COMMIT_BRANCH' - - if: $CI_PIPELINE_SOURCE == 'trigger' - - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'ivas-conformance-linux' + IVAS_PIPELINE_NAME: 'Run saturation smoke-test: $CI_COMMIT_BRANCH' + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'evs-26444' variables: - IVAS_PIPELINE_NAME: 'Draft IVAS Conformance test -- Linux: $CI_COMMIT_BRANCH' - - if: $CI_PIPELINE_SOURCE == 'trigger' - - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'check-float-reference' + IVAS_PIPELINE_NAME: 'EVS 26.444 test: $CI_COMMIT_BRANCH' + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'sanitizer-stv' variables: - IVAS_PIPELINE_NAME: 'check-float-reference: $CI_COMMIT_BRANCH' - + IVAS_PIPELINE_NAME: 'Short testvectors sanitizers' + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-renderer' + variables: + IVAS_PIPELINE_NAME: 'Renderer test: $CI_COMMIT_BRANCH' + - if: $CI_PIPELINE_SOURCE == 'schedule' # Scheduled in any branch + variables: + IVAS_PIPELINE_NAME: 'Scheduled pipeline: $CI_COMMIT_BRANCH' + stages: - - .pre - - maintenance - prevalidate - build - test - - compare - - postvalidate - deploy # --------------------------------------------------------------- @@ -95,2580 +101,819 @@ stages: echo "Commit time was $CI_COMMIT_TIMESTAMP" date | xargs echo "System time is" -.print-common-info-windows: &print-common-info-windows - - | - echo "Printing common information for build job." - echo "Current job is run on commit $CI_COMMIT_SHA" - echo "Commit time was $CI_COMMIT_TIMESTAMP" - ("echo 'System time is'", "Get-Date -Format 'dddd dd/MM/yyyy HH:mm K'") | Invoke-Expression - -.get-previous-merge-commit-sha: &get-previous-merge-commit-sha - - previous_merge_commit=$(git --no-pager log --merges HEAD~1 -n 1 --pretty=format:%H) - -.mr-fetch-target-branch: &mr-fetch-target-branch - # first delete local target branch to avoid conflicts when branch is cached and there are merge conflicts during fetching - # depending on chaching, the branch may not be there, so prevent failure of this command -> should maybe be done smarter later - - git branch -D $CI_MERGE_REQUEST_TARGET_BRANCH_NAME || true - # needed when depth is lower than the number of commits in the branch - - git fetch origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME:$CI_MERGE_REQUEST_TARGET_BRANCH_NAME - -.mr-get-target-commit: &mr-get-target-commit # compare to last target branch commit before pipeline was created - - target_commit=$(git log $CI_MERGE_REQUEST_TARGET_BRANCH_NAME -1 --oneline --before=${CI_PIPELINE_CREATED_AT} --format=%H) - -.check-for-testvectors: &check-for-testvectors # check if the testvector files specified in scripts/config/ci_linux*.json are present - - python3 -m pytest ci/test_vectors_available.py - -.disable-debugging-macro: &disable-debugging-macro -# automatically disable #DEBUGGING macro in options.h using /**/-comment - - sed -i.bak -e "s/^[[:space:]]*\(#define[[:space:]]*DEBUGGING\)/\/\*\1\*\//g" lib_com/options.h - -.merge-request-comparison-setup-codec: &merge-request-comparison-setup-codec - ### build test binaries, initial clean for paranoia reasons - - *disable-debugging-macro +.build-reference-and-dut-binaries: &build-reference-and-dut-binaries + - current_commit_sha=$(git rev-parse HEAD) + ### build reference binaries + - git checkout $REFERENCE_BRANCH + - git pull - make clean - - mkdir build - - cd build - - cmake .. - make -j - - mv IVAS_cod ../IVAS_cod_test - - mv IVAS_dec ../IVAS_dec_test - - mv IVAS_rend ../IVAS_rend_test - - cd .. - - rm -rf build/* - - git restore . - - ### store the current commit hash - - source_branch_commit_sha=$(git rev-parse HEAD) - - ### checkout version to compare against - - *mr-fetch-target-branch - - *mr-get-target-commit - - git checkout $target_commit - - echo "Building reference codec at commit $target_commit" + - mv ./IVAS_cod ./$REF_ENCODER_PATH + - mv ./IVAS_dec ./$REF_DECODER_PATH + - mv ./IVAS_rend ./IVAS_rend_ref - ### build reference binaries - - *disable-debugging-macro - - cd build - - cmake .. + ### build test binaries + - git checkout $current_commit_sha + - make clean - make -j - - mv IVAS_cod ../IVAS_cod_ref - - mv IVAS_dec ../IVAS_dec_ref - - mv IVAS_rend ../IVAS_rend_ref - - cd .. - - git restore . - - # rename test binaries back - - mv IVAS_cod_test IVAS_cod - - mv IVAS_dec_test IVAS_dec - - mv IVAS_rend_test IVAS_rend - -.merge-request-comparison-check: &merge-request-comparison-check - - echo "--------------- Running merge-request-comparison-check anchor ---------------" - - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi - - if [ $exit_code -eq 1 ] && [ $non_be_flag == 0 ]; then echo "Non-bitexact cases without non-BE tag encountered!"; exit $EXIT_CODE_FAIL; fi - - if [ $exit_code -eq 1 ] && [ $non_be_flag != 0 ]; then echo "Non-bitexact cases with non-BE tag encountered"; exit $EXIT_CODE_NON_BE; fi - - exit 0 -.update-ltv-repo: &update-ltv-repo - - cd $LTV_DIR +.build-and-create-reference-outputs: &build-and-create-reference-outputs + - *build-reference-and-dut-binaries + + ### prepare pytest + # create short test vectors + - python3 tests/create_short_testvectors.py + # create references + - exit_code=0 + - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref --create_ref -n auto --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? + - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref_part2 -n auto --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? # Catch exit code to prevent halt in case this step produces zero tests + + +.update-scripts-repo: &update-scripts-repo + - cd $SCRIPTS_DIR + - sed -i '/fetch/d' .git/config # Remove all fetch lines to clean out dead links + - git remote set-branches --add origin $BASOP_CI_BRANCH_PC_REPO # Add currently used branch + - git fetch + - git restore . # Just as a precaution + - git checkout $BASOP_CI_BRANCH_PC_REPO - git pull - cd - + - cp -r $SCRIPTS_DIR/ci . + - cp -r $SCRIPTS_DIR/scripts . + - cp -r $SCRIPTS_DIR/tests . + - cp $SCRIPTS_DIR/pytest.ini . -.update-ltv-repo-win: &update-ltv-repo-win - - Push-Location - - cd $LTV_DIR_WIN - - git pull - - Pop-Location - -.disable-limiter: &disable-limiter -# automatically enable #define DISABLE_LIMITER in options.h, handling both /**/-comment and //-comment - - sed -i.bak -e "s/\/\*[[:space:]]*\(#define[[:space:]]*DISABLE_LIMITER\)[[:space:]]*\*\//\1/g" ./lib_com/options.h - -.get-commits-behind-count: &get-commits-behind-count - - echo $CI_COMMIT_SHA - - echo $CI_MERGE_REQUEST_TARGET_BRANCH_NAME - - commits_behind_count=$(git rev-list --count $CI_COMMIT_SHA..origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME) - -.check-commits-behind-count-in-compare-jobs: &check-commits-behind-count-in-compare-jobs - - if [ $commits_behind_count -ne 0 ]; then echo "Your branch is not up-to-date with main -> Compare tests will not run as they can contain false negatives this way.\nMain might have changed during your pipeline run. Run 'git merge origin/main' to update."; exit 1; fi +.apply-testv-scaling: &apply-testv-scaling + - echo "Applying level scaling in scripts/testv using scale=$LEVEL_SCALING" + - tests/scale_pcm.py ./scripts/testv/ $LEVEL_SCALING +.update-ltv-repo: &update-ltv-repo + - cd $LTV_DIR + - git pull + - cd - + .copy-ltv-files-to-testv-dir: ©-ltv-files-to-testv-dir - cp "$LTV_DIR"/*.wav scripts/testv/ - cp "$LTV_DIR"/*.met scripts/testv/ - cp "$LTV_DIR"/*.csv scripts/testv/ -.copy-ltv-files-to-testv-dir-win: ©-ltv-files-to-testv-dir-win - - cp $LTV_DIR_WIN\*.wav scripts\testv - - cp $LTV_DIR_WIN\*.met scripts\testv - - cp $LTV_DIR_WIN\*.csv scripts\testv - .activate-Werror-linux: &activate-Werror-linux - sed -i.bak "s/^# \(CFLAGS += -Werror\)/\1/" Makefile - - sed -i.bak "s/# \(set(CMAKE_C_FLAGS \"\${CMAKE_C_FLAGS} -Werror\")\)/\1/" CMakeLists.txt - -.activate-WX-windows: &activate-WX-windows - - (Get-Content -Path "CMakeLists.txt") -replace '# \(add_compile_options\("\/WX"\)\)', '$1' | Set-Content -Path "CMakeLists.txt" - - Get-ChildItem -Path "Workspace_msvc" -Filter "*.vcxproj" | ForEach-Object { (Get-Content -Path $_.FullName) -replace 'false', 'true' | Set-Content -Path $_.FullName } - -# to be reused in MR and LTV-scheduled sanitizer test jobs -# set CLANG_NUM, SELFTEST_SANITY_TIMEOUT and SELF_TEST_PRM_FILE in before_script section -.sanitizer-selftest-anchor: &sanitizer-selftest-anchor - script: - - *print-common-info - - *copy-ltv-files-to-testv-dir - - make clean - - make -j CLANG=$CLANG_NUM - - testcase_timeout=$SELFTEST_SANITY_TIMEOUT - - export UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1 - - - exit_code20=0 - - exit_code10=0 - - exit_code5=0 - - - if [ $CLANG_NUM -eq 1 ]; then sanitizer_type="MemorySanitizer"; elif [ $CLANG_NUM -eq 2 ]; then sanitizer_type="AddressSanitizer"; elif [ $CLANG_NUM -eq 3 ]; then sanitizer_type="UndefinedBehaviorSanitizer"; else echo "Wrong CLANG_NUM $CLANG_NUM given!"; exit 1; fi - - # run encoder and decoder with 20ms renderer framesize first, use reference creation mode - - python3 -m pytest tests/codec_be_on_mr_nonselection/test_param_file.py --param_file $SELF_TEST_PRM_FILE -v --update_ref 1 -m create_ref --html=report-20ms.html --self-contained-html --junit-xml=report-junit-20ms.xml --testcase_timeout=$testcase_timeout --ref_encoder_path ./IVAS_cod --ref_decoder_path ./IVAS_dec || exit_code20=$? - # for 10ms and 5ms renderer framesize, we only need to run the decoder part as renderer framesize is a decoder-only option - # set tolerance very high do ignore any BE differences due to the different renderer framesizes, those can appear due to the limiter being active - # we are only interested in runtime errors from the sanitizers and ignore the diffs - - python3 -m pytest tests/codec_be_on_mr_nonselection/test_param_file.py --param_file $SELF_TEST_PRM_FILE -v --html=report-5ms.html --self-contained-html --junit-xml=report-junit-5ms.xml --dut_fr 5 --decoder_only --abs_tol 100000 || exit_code5=$? - - python3 -m pytest tests/codec_be_on_mr_nonselection/test_param_file.py --param_file $SELF_TEST_PRM_FILE -v --html=report-10ms.html --self-contained-html --junit-xml=report-junit-10ms.xml --dut_fr 10 --decoder_only --abs_tol 100000 || exit_code10=$? - - - if [ $exit_code20 -ne 0 ] || [ $exit_code10 -ne 0 ] || [ $exit_code5 -ne 0 ]; then exit 1; fi - - -# --------------------------------------------------------------- -# Job templates -# --------------------------------------------------------------- -# When designing templates, try not to use too much inheritance and -# if multiple templates and extended on, remember that on conflict, -# latest overwrites the parameter. - -# templates for rules -.rules-basis: +.rules-pytest-to-ref-short: rules: - - if: $MIRROR_ACCESS_TOKEN # Don't run in the mirror update pipeline (only then MIRROR_ACCESS_TOKEN is defined) - when: never - - if: $CI_PIPELINE_SOURCE == 'schedule' # Don't run in any scheduled pipelines by default (use schedule templates below to enable again for certain conditions) - when: never - - if: $CI_PIPELINE_SOURCE == 'trigger' # Don't run triggered pipeline by default + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "pytest-compare" + - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + - if: $CI_PIPELINE_SOURCE == 'push' when: never - - if: $MANUAL_PIPELINE_TYPE == 'test-be-release' # Skip all the normal jobs when testing manually against release codec + - if: $CI_PIPELINE_SOURCE == 'schedule' when: never - - if: $MANUAL_PIPELINE_TYPE == 'test-long-self-test' # Skip all the normal jobs when testing manually against release codec + +# TODO: only temporary as long the MR encoder tests should not compare to main +.rules-pytest-to-ref-enc-short-temp: + rules: + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "pytest-compare" + - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" # only have MR pipelines for MRs to main + - if: $CI_PIPELINE_SOURCE == 'push' when: never - - if: $MANUAL_PIPELINE_TYPE == 'ivas-conformance' - when: never - - if: $MANUAL_PIPELINE_TYPE == 'ivas-conformance-linux' - when: never - - if: $MANUAL_PIPELINE_TYPE == 'check-float-reference' + - if: $CI_PIPELINE_SOURCE == 'schedule' when: never - - when: on_success -.rules-merge-request: - extends: .rules-basis +.rules-pytest-to-main-short: rules: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" # only have MR pipelines for MRs to main - if: $CI_PIPELINE_SOURCE == 'push' when: never -.rules-main-push: - extends: .rules-basis +.rules-pytest-long: rules: - - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + - if: $PYTEST_MLD_LONG # Set by scheduled pipeline + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "pytest-compare-long" + - if: $CI_PIPELINE_SOURCE == 'push' + when: never + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + when: never -.rules-main-scheduled: - extends: .rules-basis +.rules-pytest-saturation-smoke-test: rules: - - if: $CI_PIPELINE_SOURCE == 'schedule' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + - if: $PYTEST_SMOKE_TEST # Set by scheduled pipeline + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "pytest-saturation-smoke-test" + - if: $CI_PIPELINE_SOURCE == 'push' + when: never + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + when: never + +# --------------------------------------------------------------- +# Job templates +# --------------------------------------------------------------- # templates to define stages and platforms .test-job-linux: tags: - - ivas-linux + - ivas-basop-linux .build-job-linux: stage: build - timeout: "4 minutes" - needs: [] - tags: - - ivas-linux - -.build-job-windows: - stage: build + timeout: "2 minutes" needs: [] - timeout: "4 minutes" tags: - - ivas-windows + - ivas-basop-linux # template for test jobs on linux that need the TESTV_DIR .test-job-linux-needs-testv-dir: extends: .test-job-linux before_script: + - *update-scripts-repo - if [ ! -d "$TESTV_DIR" ]; then mkdir -p $TESTV_DIR; fi - - python3 scripts/prepare_combined_format_inputs.py - cp -r scripts/testv/* $TESTV_DIR/ -.sanitizer-selftest-on-mr: +.ivas-pytest-anchor: &ivas-pytest-anchor stage: test - extends: - - .test-job-linux-needs-testv-dir - - .rules-merge-request + needs: ["build-codec-linux-make"] + timeout: "240 minutes" + variables: + # keep "mld" in artifact name for backwards compatibility reasons + CSV_ARTIFACT_NAME: "mld--$CI_JOB_NAME-$CI_JOB_ID--sha-$CI_COMMIT_SHORT_SHA.csv" + MERGED_CSV_ARTIFACT_NAME: "$CI_JOB_NAME--merged_csv--$CI_JOB_ID.csv" + PAGES_HTML_ARTIFACT_NAME: "$CI_JOB_NAME-index.html" + SUMMARY_HTML_ARTIFACT_NAME: "summary_$CI_JOB_NAME.html" + IMAGES_ARTIFACT_NAME: "images_$CI_JOB_NAME" + script: + - *print-common-info + - *update-scripts-repo + - if [ $USE_LTV -eq 1 ]; then + - *update-ltv-repo + - *copy-ltv-files-to-testv-dir + - testcase_timeout=$TESTCASE_TIMEOUT_LTV + - else + - testcase_timeout=$TESTCASE_TIMEOUT_STV + - fi + + - python3 ci/remove_unsupported_testcases.py $PRM_FILES + - if [ $LEVEL_SCALING != "1.0" ];then + - *apply-testv-scaling + - fi + - *build-and-create-reference-outputs + + ### run pytest + - exit_code=0 + - python3 -m pytest --tb=no $TEST_SUITE -v --create_cut --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld --ssnr --odg -n auto --testcase_timeout $testcase_timeout --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? + - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true + + - python3 scripts/parse_xml_report.py report-junit.xml $CSV_ARTIFACT_NAME + - mkdir $IMAGES_ARTIFACT_NAME + - for MEASURE in MLD DIFF SSNR;do python3 scripts/create_histogram_summary.py $CSV_ARTIFACT_NAME $IMAGES_ARTIFACT_NAME/summary_"$MEASURE".csv $IMAGES_ARTIFACT_NAME/summary_"$MEASURE".png --measure $MEASURE; done + - python3 ci/basop-pages/create_summary_page.py $SUMMARY_HTML_ARTIFACT_NAME $CI_JOB_ID $CI_JOB_NAME + + - if [ $USE_LTV -eq 1 ] && [ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]; then + - id_previous=$(python3 ci/get_id_of_last_job_occurence.py $CI_DEFAULT_BRANCH $CI_JOB_NAME $CI_PROJECT_ID) + - echo "Job ID from variables - $CI_JOB_ID, Job ID from script - $id_previous" + - curl --request GET "https://forge.3gpp.org/rep/api/v4/projects/$CI_PROJECT_ID/jobs/$id_previous/artifacts" --output artifacts.zip + - unzip artifacts.zip -d previous_artifacts + # This wildcard thingy relies on only one csv file being present per job + - file_previous="previous_artifacts/mld--$CI_JOB_NAME-$id_previous--sha-*.csv" + - python3 ci/basop-pages/create_report_pages.py $PAGES_HTML_ARTIFACT_NAME $MERGED_CSV_ARTIFACT_NAME $CSV_ARTIFACT_NAME $file_previous $CI_JOB_ID $id_previous $CI_JOB_NAME + - else + # create empty file for artifacts to avoid errors + - touch $PAGES_HTML_ARTIFACT_NAME + - touch $MERGED_CSV_ARTIFACT_NAME + - fi + + - if [ $zero_errors != 1 ]; then + - echo "Run errors encountered!" + # TODO: temporary only to not fail pipelines on crashes in encoder + - if [[ "$CI_JOB_NAME" =~ "ivas-pytest-compare_to_ref-short-enc" ]]; then + - exit $EXIT_CODE_NON_BE + - else + - exit $EXIT_CODE_FAIL + - fi + - fi + - if [ $exit_code -eq 1 ]; then echo "Differences encountered"; exit $EXIT_CODE_NON_BE; fi + - exit 0 + + allow_failure: + exit_codes: + - 123 artifacts: - name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" + name: "$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA--results" expire_in: 1 week when: always paths: - - report-junit-20ms.xml - - report-junit-10ms.xml - - report-junit-5ms.xml - - report-20ms.html - - report-10ms.html - - report-5ms.html - expose_as: "Sanitizer selftest results" + - report-junit.xml + - report.html + - $PAGES_HTML_ARTIFACT_NAME + - $CSV_ARTIFACT_NAME + - $MERGED_CSV_ARTIFACT_NAME + - $SUMMARY_HTML_ARTIFACT_NAME + - $IMAGES_ARTIFACT_NAME + expose_as: "pytest compare results" reports: junit: - - report-junit-20ms.xml - - report-junit-10ms.xml - - report-junit-5ms.xml + - report-junit.xml -.sanitizer-selftest-ltv: +.ivas-pytest-on-merge-request-anchor: &ivas-pytest-on-merge-request-anchor stage: test - extends: - - .test-job-linux-needs-testv-dir + needs: ["build-codec-linux-make"] + timeout: "300 minutes" + variables: + XML_REPORT_BRANCH: "report-junit-branch-$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.xml" + XML_REPORT_MAIN: "report-junit-main-$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.xml" + HTML_REPORT_BRANCH: "report-junit-branch-$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.html" + HTML_REPORT_MAIN: "report-junit-main-$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.html" + CSV_BRANCH: "scores-branch-$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.csv" + CSV_MAIN: "scores-main-$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.csv" + IMAGES_ARTIFACT_NAME: "images_$CI_JOB_NAME" + SUMMARY_HTML_ARTIFACT_NAME: "summary_$CI_JOB_NAME.html" + script: + - *print-common-info + - *update-scripts-repo + - if [ $USE_LTV -eq 1 ]; then + - *update-ltv-repo + - *copy-ltv-files-to-testv-dir + - testcase_timeout=$TESTCASE_TIMEOUT_LTV + - else + - testcase_timeout=$TESTCASE_TIMEOUT_STV + - fi + + - python3 ci/remove_unsupported_testcases.py $PRM_FILES + - if [ $LEVEL_SCALING != "1.0" ];then + - *apply-testv-scaling + - fi + + # check MR title for flag that allows regressions to be mergable + - echo $CI_MERGE_REQUEST_TITLE > tmp.txt + - allow_regressions_flag=$(grep -c --ignore-case "\[allow[ -]*regression\]" tmp.txt) || true + + ### run branch first + # this per default builds the branch and the reference and creates the reference outputs + - *build-and-create-reference-outputs + - exit_code=0 + - python3 -m pytest --tb=no $TEST_SUITE -v --create_cut --html=$HTML_REPORT_BRANCH --self-contained-html --junit-xml=$XML_REPORT_BRANCH --mld --ssnr --odg --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout || exit_code=$? + - zero_errors_branch=$(cat $XML_REPORT_BRANCH | grep -c 'errors="0"') || true + - python3 scripts/parse_xml_report.py $XML_REPORT_BRANCH $CSV_BRANCH + + # create the summary based on the branch + - mkdir $IMAGES_ARTIFACT_NAME + - for MEASURE in MLD DIFF SSNR;do python3 scripts/create_histogram_summary.py $CSV_BRANCH $IMAGES_ARTIFACT_NAME/summary_"$MEASURE".csv $IMAGES_ARTIFACT_NAME/summary_"$MEASURE".png --measure $MEASURE; done + - python3 ci/basop-pages/create_summary_page.py $SUMMARY_HTML_ARTIFACT_NAME $CI_JOB_ID $CI_JOB_NAME + + ### run main now + - git checkout $CI_MERGE_REQUEST_TARGET_BRANCH_NAME + - git pull + - make clean + - make -j + - python3 -m pytest --tb=no $TEST_SUITE -v --create_cut --html=$HTML_REPORT_MAIN --self-contained-html --junit-xml=$XML_REPORT_MAIN --mld --ssnr --odg --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout || true + - python3 scripts/parse_xml_report.py $XML_REPORT_MAIN $CSV_MAIN + + ### compare the two csv files for regressions + - regressions_found=0 + - python3 scripts/basop_check_for_changes_in_testcases.py $CSV_BRANCH $CSV_MAIN || regressions_found=$? + + - if [ $regressions_found != 0 ]; then + - echo "Detected regression wrt to main!" + - if [ $allow_regressions_flag == 0 ]; then + - exit $EXIT_CODE_FAIL; + - else + - exit $EXIT_CODE_NON_BE; + - fi + - fi + - if [ $zero_errors_branch != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_NON_BE; fi + - if [ $exit_code -eq 1 ]; then echo "Differences encountered"; exit $EXIT_CODE_NON_BE; fi + - exit 0 + after_script: + - rm -rf tests/dut tests/ref + allow_failure: + exit_codes: + - 123 artifacts: name: "$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA--results" - expire_in: 2 week + expire_in: 1 week when: always paths: - - report-junit-20ms.xml - - report-junit-10ms.xml - - report-junit-5ms.xml - - report-20ms.html - - report-10ms.html - - report-5ms.html - expose_as: "Sanitizer selftest results" + - $XML_REPORT_BRANCH + - $XML_REPORT_MAIN + - $HTML_REPORT_BRANCH + - $HTML_REPORT_MAIN + - $CSV_BRANCH + - $CSV_MAIN + - $SUMMARY_HTML_ARTIFACT_NAME + - $IMAGES_ARTIFACT_NAME + - changes_crashes.csv + - changes_MLD.csv + - changes_MAXIMUM_ABS_DIFF.csv + - changes_MIN_SSNR.csv + - changes_MIN_ODG.csv + expose_as: "pytest compare results" reports: junit: - - report-junit-20ms.xml - - report-junit-10ms.xml - - report-junit-5ms.xml + - $XML_REPORT_BRANCH + - $XML_REPORT_MAIN -# --------------------------------------------------------------- -# .pre jobs for setting up things -# --------------------------------------------------------------- -# See: https://gitlab.com/gitlab-org/gitlab/-/issues/194023 -# Solution to make main branch pipelines uninterruptible while all other -# pipelines can be interrupted by default. This works because all jobs -# after uninterruptible jobs will be uninterruptible. Resource group -# setting avoids rare case where two fast merges could still interrupt -# pipeline. This should be revisited if there are updates to Gitlab. -uninterruptible: - stage: .pre - interruptible: false - resource_group: uninterruptible - script: - - echo "$CI_COMMIT_BRANCH is uninterruptible" +.ivas-pytest-sanitizers-anchor: &ivas-pytest-sanitizers-anchor + stage: test + needs: ["build-codec-linux-make"] + timeout: "90 minutes" rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - when: always - tags: - - ivas-linux + - if: $CI_PIPELINE_SOURCE == 'push' + when: never + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + when: never + - if: $CI_PIPELINE_SOURCE == 'schedule' && $IVAS_PYTEST_MSAN + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "sanitizer-stv" + script: + - *print-common-info + - *update-scripts-repo + - python3 ci/remove_unsupported_testcases.py $PRM_FILES + - *build-reference-and-dut-binaries + - make clean + - make -j CLANG=$CLANG_NUM + - if [[ $CLANG_NUM == 3 ]]; then export UBSAN_OPTIONS="suppressions=scripts/ubsan.supp,report_error_type=1"; fi + - testcase_timeout=$TESTCASE_TIMEOUT_STV_SANITIZERS + - python3 -m pytest $SHORT_TEST_SUITE -v --tb=no --update_ref 1 -m create_ref --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout $testcase_timeout --ref_encoder_path $DUT_ENCODER_PATH --ref_decoder_path $DUT_DECODER_PATH + artifacts: + name: "$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA--results" + when: always + expire_in: "2 weeks" + paths: + - report-junit.xml + - report.html + reports: + junit: + - report-junit.xml # --------------------------------------------------------------- -# Validation jobs +# verification jobs # --------------------------------------------------------------- -branch-is-up-to-date-with-main-pre: +clang-format-check: extends: - - .rules-merge-request + - .test-job-linux + rules: + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" # only have MR pipelines for MRs to main + - if: $CI_PIPELINE_SOURCE == 'push' + when: never + - if: $CI_PIPELINE_SOURCE == 'schedule' + when: never + variables: + ARTIFACT_BASE_NAME: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--formatting-fix" stage: prevalidate needs: [] - tags: - - ivas-linux + timeout: "5 minutes" script: - - *get-commits-behind-count - - echo $commits_behind_count - - if [ $commits_behind_count -eq 0 ]; then exit 0; else echo "Your branch is behind main, run 'git merge origin/main' to update."; exit 1; fi; + - *update-scripts-repo + # Set up variables. This can't be done in the "variables" section because variables are not expanded properly there + - PATCH_FILE_NAME="$ARTIFACT_BASE_NAME".patch + - > + INSTRUCTIONS_GITLAB="To fix formatting issues:\n + - download the diff patch available as artifact of this job\n + - unzip the artifact and place the patch file in the root directory of your local IVAS repo\n + - run: git apply $PATCH_FILE_NAME\n + - commit new changes" + - > + INSTRUCTIONS_README="To fix formatting issues:\n + - place the patch file in the root directory of your local IVAS repo\n + - run: git apply $PATCH_FILE_NAME\n + - commit new changes" -check-self-test-names-pre: - extends: - - .rules-merge-request - stage: prevalidate - needs: [] - tags: - - ivas-linux - script: - - python3 ci/check_self_test_names.py scripts/config/self_test.prm 135 + - format_problems=0 + - scripts/check-format.sh -afD -p 8 || format_problems=$? + - if [ $format_problems == 0 ] ; then exit 0; fi -branch-is-up-to-date-with-main-post: - extends: - - .rules-merge-request - stage: postvalidate - tags: - - ivas-linux - script: - - *get-commits-behind-count - - echo $commits_behind_count - - if [ $commits_behind_count -eq 0 ]; then exit 0; else echo "Your branch is behind main, possibly main changed during your pipeline run, run 'git merge origin/main' to update." exit 1; fi; + - mkdir tmp-formatting-fix + - git diff > "tmp-formatting-fix/$PATCH_FILE_NAME" -# for merges to basop-ci-branch, run the long test suite in reference generation mode to catch problems already here and not only in the BASOP repo -check-compatibility-with-basop-reference-branch: - extends: - - .test-job-linux - rules: - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "basop-ci-branch" - changes: - - tests/**/* - - scripts/**/* - - ci/**/* - - if: ($CI_PIPELINE_SOURCE == 'web' || $CI_PIPELINE_SOURCE == 'trigger') && $MANUAL_PIPELINE_TYPE == 'check-float-reference' - - if: $CI_PIPELINE_SOURCE == 'push' - when: never - tags: - - ivas-linux-fast - script: - - git clone -b $BASOP_REFERENCE_BRANCH https://forge.3gpp.org/rep/sa4/audio/ivas-basop.git --single-branch - - make -j -C ivas-basop - - cp ivas-basop/IVAS_cod ./IVAS_cod_ref - - cp ivas-basop/IVAS_dec ./IVAS_dec_ref - - cp ivas-basop/IVAS_cod ./IVAS_cod # Not used but needed to launch the pytest - - cp ivas-basop/IVAS_dec ./IVAS_dec # Not used but needed to launch the pytest - - python3 ci/remove_unsupported_testcases.py scripts/config/self_test.prm - - python3 tests/create_short_testvectors.py - - exit_code1=0 - - exit_code2=0 - - python3 -m pytest tests/codec_be_on_mr_nonselection -v --update_ref 1 -m create_ref --html=report1.html --self-contained-html --junit-xml=report-junit1.xml || exit_code1=$? - - python3 -m pytest tests/codec_be_on_mr_nonselection -v --update_ref 1 -m create_ref_part2 --html=report2.html --self-contained-html --junit-xml=report-junit2.xml || exit_code2=$? - - zero_errors=$(cat report-junit1.xml report-junit2.xml | grep -c 'errors="0"') || true - - if [ $zero_errors != 2 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi - - exit 0 + # Print instructions to job output + - echo -e "$INSTRUCTIONS_GITLAB" + + # Include readme in the artifact, in case someone misses the job printout (e.g. getting the artifact via MR interface) + - echo -e "$INSTRUCTIONS_README" > "tmp-formatting-fix/readme.txt" + + - exit $format_problems artifacts: - name: "check-float-reference--sha-$CI_COMMIT_SHORT_SHA--results" - when: always - expire_in: 1 month + expire_in: 1 day paths: - - report-junit1.xml - - report-junit2.xml - - report1.html - - report2.html - expose_as: "check-float-reference results" - reports: - junit: - - report-junit1.xml - - report-junit2.xml + - tmp-formatting-fix/ + when: on_failure + name: "$ARTIFACT_BASE_NAME" + expose_as: "formatting patch" # --------------------------------------------------------------- # Build jobs # --------------------------------------------------------------- +# ensure that codec builds on linux build-codec-linux-make: + rules: + - if: $CI_PIPELINE_SOURCE == 'web' + - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" # only have MR pipelines for MRs to main + - if: $CI_PIPELINE_SOURCE == 'schedule' + - if: $CI_PIPELINE_SOURCE == 'push' + when: never extends: - .build-job-linux - - .rules-basis script: - *print-common-info - *activate-Werror-linux - make -j -build-codec-linux-cmake: +# ensure that codec builds on linux with instrumentation active +build-codec-linux-instrumented-make: + rules: + - if: $CI_PIPELINE_SOURCE == 'web' + - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" # only have MR pipelines for MRs to main + - if: $CI_PIPELINE_SOURCE == 'schedule' + - if: $CI_PIPELINE_SOURCE == 'push' + when: never extends: - .build-job-linux - - .rules-basis script: - *print-common-info - - *activate-Werror-linux - - mkdir build - - cd build - - cmake .. - - cd .. - - make -C build -j + - sed -i".bak" "s/\/\*#define WMOPS 1\*\//#define WMOPS 1/g" lib_com/count.h + - make -j -build-codec-instrumented-linux: - extends: - - .build-job-linux - - .rules-basis - timeout: "10 minutes" - script: - - *print-common-info - - *activate-Werror-linux - - ./scripts/prepare_instrumentation.sh - - make -j -C scripts/c-code_instrument +# --------------------------------------------------------------- +# Short test jobs that run in merge request pipelines +# --------------------------------------------------------------- -# make sure that the codec builds with msan, asan and usan -build-codec-sanitizers-linux: - extends: - - .build-job-linux - - .rules-basis - script: - - *print-common-info - - *activate-Werror-linux - - bash ci/build_codec_sanitizers_linux.sh +### jobs that test fx encoder -> flt decoder +# TODO: reenable once encoder tests shall compare to main +# ivas-pytest-compare_to_main-short-enc: +# extends: +# - .rules-pytest-to-main-short +# - .test-job-linux +# before_script: +# - USE_LTV=0 +# - DUT_DECODER_PATH=./IVAS_dec_ref +# - TEST_SUITE="$SHORT_TEST_SUITE" +# - LEVEL_SCALING=1.0 +# <<: *ivas-pytest-on-merge-request-anchor + +# ivas-pytest-compare_to_main-short-enc-lev-10: +# extends: +# - .rules-pytest-to-main-short +# - .test-job-linux +# before_script: +# - USE_LTV=0 +# - DUT_DECODER_PATH=./IVAS_dec_ref +# - TEST_SUITE="$SHORT_TEST_SUITE" +# - LEVEL_SCALING=0.3162 +# <<: *ivas-pytest-on-merge-request-anchor + +# ivas-pytest-compare_to_main-short-enc-lev+10: +# extends: +# - .rules-pytest-to-main-short +# - .test-job-linux +# before_script: +# - USE_LTV=0 +# - DUT_DECODER_PATH=./IVAS_dec_ref +# - TEST_SUITE="$SHORT_TEST_SUITE" +# - LEVEL_SCALING=3.162 +# <<: *ivas-pytest-on-merge-request-anchor + +### jobs that test flt encoder -> fx decoder +ivas-pytest-compare_to_main-short-dec: + extends: + - .rules-pytest-to-main-short + - .test-job-linux + before_script: + - USE_LTV=0 + - DUT_ENCODER_PATH=./IVAS_cod_ref + - TEST_SUITE="$SHORT_TEST_SUITE" + - LEVEL_SCALING=1.0 + - rm -rf tests/dut tests/ref + <<: *ivas-pytest-on-merge-request-anchor -build-codec-windows-cmake: +ivas-pytest-compare_to_main-short-dec-lev-10: extends: - - .build-job-windows - - .rules-basis - script: - - *print-common-info-windows - - *activate-WX-windows - - cmake -G "Visual Studio 15 2017" . -Bbuild - - cmake --build build -j + - .rules-pytest-to-main-short + - .test-job-linux + before_script: + - USE_LTV=0 + - DUT_ENCODER_PATH=./IVAS_cod_ref + - TEST_SUITE="$SHORT_TEST_SUITE" + - LEVEL_SCALING=0.3162 + - rm -rf tests/dut tests/ref + <<: *ivas-pytest-on-merge-request-anchor -build-codec-windows-msbuild: +ivas-pytest-compare_to_main-short-dec-lev+10: extends: - - .build-job-windows - - .rules-basis - script: - - *print-common-info-windows - - *activate-WX-windows - - MSBuild.exe -maxcpucount .\Workspace_msvc\Workspace_msvc.sln /property:Configuration=Debug + - .rules-pytest-to-main-short + - .test-job-linux + before_script: + - USE_LTV=0 + - DUT_ENCODER_PATH=./IVAS_cod_ref + - TEST_SUITE="$SHORT_TEST_SUITE" + - LEVEL_SCALING=3.162 + - rm -rf tests/dut tests/ref + <<: *ivas-pytest-on-merge-request-anchor # --------------------------------------------------------------- -# Test jobs for merge requests +# Short test jobs for running from web interface or schedule # --------------------------------------------------------------- -# test that runs all modes with 1s input signals -codec-smoke-test: +### jobs that test fx encoder -> flt decoder +ivas-pytest-compare_to_ref-short-enc: extends: - - .test-job-linux-needs-testv-dir - - .rules-merge-request - timeout: "20 minutes" - tags: - - ivas-linux-fast - stage: test - needs: ["build-codec-linux-cmake", "build-codec-linux-make", "build-codec-instrumented-linux", "build-codec-sanitizers-linux"] - script: - - *print-common-info - # LTV update needed as ltv ISM metadata files are used - - *update-ltv-repo - - bash ci/smoke_test.sh - ### analyze for failures - - if ! [ -s smoke_test_output.txt ] || ! [ -s smoke_test_output_jbm.txt ] || ! [ -s smoke_test_output_hrtf.txt ]; then echo "Error in smoke test"; exit 1; fi - - ret_val=0 - - if cat smoke_test_output.txt | grep -c "failed"; then echo "Smoke test without JBM failed"; ret_val=1; fi - - if cat smoke_test_output_jbm.txt | grep -c "failed"; then echo "Smoke test JBM part failed"; ret_val=1; fi - - if cat smoke_test_output_hrtf.txt | grep -c "failed"; then echo "Smoke test with external hrtf files failed"; ret_val=1; fi - - exit $ret_val - artifacts: - name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" - expire_in: 1 week - when: always - paths: - - smoke_test_output.txt - - smoke_test_output_jbm.txt - - smoke_test_output_hrtf.txt - expose_as: "Smoke test results" + #- .rules-pytest-to-ref-short + - .rules-pytest-to-ref-enc-short-temp + - .test-job-linux + before_script: + - USE_LTV=0 + - DUT_DECODER_PATH=./$REF_DECODER_PATH + - TEST_SUITE="$SHORT_TEST_SUITE" + - LEVEL_SCALING=1.0 + <<: *ivas-pytest-anchor -# code selftest testvectors with memory-sanitizer binaries -codec-msan: +ivas-pytest-compare_to_ref-short-enc-lev-10: extends: - - .sanitizer-selftest-on-mr - tags: - - ivas-linux-fast + #- .rules-pytest-to-ref-short + - .rules-pytest-to-ref-enc-short-temp + - .test-job-linux before_script: - - CLANG_NUM=1 - - SELFTEST_SANITY_TIMEOUT=$TESTCASE_TIMEOUT_STV_SANITIZERS - - SELF_TEST_PRM_FILE="scripts/config/self_test.prm" - <<: *sanitizer-selftest-anchor + - USE_LTV=0 + - DUT_DECODER_PATH=./$REF_DECODER_PATH + - TEST_SUITE="$SHORT_TEST_SUITE" + - LEVEL_SCALING=0.3162 + <<: *ivas-pytest-anchor -# code selftest testvectors with address-sanitizer binaries -codec-asan: +ivas-pytest-compare_to_ref-short-enc-lev+10: extends: - - .sanitizer-selftest-on-mr + #- .rules-pytest-to-ref-short + - .rules-pytest-to-ref-enc-short-temp + - .test-job-linux before_script: - - CLANG_NUM=2 - - SELFTEST_SANITY_TIMEOUT=$TESTCASE_TIMEOUT_STV_SANITIZERS - - SELF_TEST_PRM_FILE="scripts/config/self_test.prm" - <<: *sanitizer-selftest-anchor + - USE_LTV=0 + - DUT_DECODER_PATH=./$REF_DECODER_PATH + - TEST_SUITE="$SHORT_TEST_SUITE" + - LEVEL_SCALING=3.162 + <<: *ivas-pytest-anchor -# code selftest testvectors with undefined-behaviour-sanitizer binaries -codec-usan: +ivas-pytest-enc-msan: extends: - - .sanitizer-selftest-on-mr - tags: - - ivas-linux-fast + - .test-job-linux before_script: - - CLANG_NUM=3 - - SELFTEST_SANITY_TIMEOUT=$TESTCASE_TIMEOUT_STV_SANITIZERS - - SELF_TEST_PRM_FILE="scripts/config/self_test.prm" - <<: *sanitizer-selftest-anchor + - CLANG_NUM=1 + - DUT_DECODER_PATH=./$REF_DECODER_PATH + <<: *ivas-pytest-sanitizers-anchor -# compare bit-exactness between 5ms and 20 on the branch -pytest-compare-20ms-and-5ms-rendering: +ivas-pytest-enc-asan: extends: - .test-job-linux - - .rules-merge-request - stage: test - needs: ["build-codec-linux-cmake", "build-codec-linux-make", "build-codec-instrumented-linux", "build-codec-sanitizers-linux"] - script: - - *print-common-info - - *disable-limiter - - make clean - - make -j - ### prepare pytest - - cp IVAS_cod IVAS_cod_ref - - cp IVAS_dec IVAS_dec_ref - # create references - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 -m create_ref - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 -m create_ref_part2 - ### run pytest - - exit_code=0 - - exit_code5=0 - - exit_code10=0 - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report-5ms.html --self-contained-html --junit-xml=report-junit-5ms.xml --dut_fr 5 --decoder_only || exit_code5=$? - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report-10ms.html --self-contained-html --junit-xml=report-junit-10ms.xml --dut_fr 10 --decoder_only || exit_code10=$? - - zero_errors5=$(cat report-junit-5ms.xml | grep -c 'errors="0"') || true - - zero_errors10=$(cat report-junit-10ms.xml | grep -c 'errors="0"') || true - - zero_errors=1 - - if [ $zero_errors5 != 1 ]; then echo "run error in with 5ms rendering encountered"; zero_errors=0 ; fi - - if [ $zero_errors10 != 1 ]; then echo "run error in with 10ms rendering encountered"; zero_errors=0 ; fi - - if [ $zero_errors != 1 ]; then exit $EXIT_CODE_FAIL; fi - - if [ $exit_code5 -eq 1 ]; then echo "Non-bitexact cases encountered with 5ms rendering!"; exit_code=1; fi - - if [ $exit_code10 -eq 1 ]; then echo "Non-bitexact cases encountered with 10ms rendering!"; exit_code=1; fi - - if [ $exit_code -eq 1 ]; then exit $EXIT_CODE_FAIL; fi - artifacts: - name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" - expire_in: 1 week - when: always - expose_as: "pytest 5ms and 10ms vs 20ms results" - paths: - - report-junit-5ms.xml - - report-5ms.html - - report-junit-10ms.xml - - report-10ms.html - reports: - junit: - - report-junit-5ms.xml - - report-junit-10ms.xml + before_script: + - CLANG_NUM=2 + - DUT_DECODER_PATH=./$REF_DECODER_PATH + <<: *ivas-pytest-sanitizers-anchor -# test renderer executable -renderer-smoke-test: +ivas-pytest-enc-usan: extends: - .test-job-linux - - .rules-merge-request - needs: ["build-codec-linux-make"] - stage: test - script: - - make -j IVAS_rend - - testcase_timeout=60 - - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py --testcase_timeout=$testcase_timeout - artifacts: - name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" - expire_in: 1 week - when: always - paths: - - report-junit.xml - expose_as: "renderer make pytest results" - reports: - junit: - - report-junit.xml + before_script: + - CLANG_NUM=3 + - DUT_DECODER_PATH=./$REF_DECODER_PATH + <<: *ivas-pytest-sanitizers-anchor + +### jobs that test flt encoder -> fx decoder +ivas-pytest-compare_to_ref-short-dec: + extends: + - .rules-pytest-to-ref-short + - .test-job-linux + before_script: + - USE_LTV=0 + - DUT_ENCODER_PATH=./$REF_ENCODER_PATH + - TEST_SUITE="$SHORT_TEST_SUITE" + - LEVEL_SCALING=1.0 + <<: *ivas-pytest-anchor + +ivas-pytest-compare_to_ref-short-lev-10: + extends: + - .rules-pytest-to-ref-short + - .test-job-linux + before_script: + - USE_LTV=0 + - DUT_ENCODER_PATH=./$REF_ENCODER_PATH + - TEST_SUITE="$SHORT_TEST_SUITE" + - LEVEL_SCALING=0.3162 + <<: *ivas-pytest-anchor + +ivas-pytest-compare_to_ref-short-dec-lev+10: + extends: + - .rules-pytest-to-ref-short + - .test-job-linux + before_script: + - USE_LTV=0 + - DUT_ENCODER_PATH=./$REF_ENCODER_PATH + - TEST_SUITE="$SHORT_TEST_SUITE" + - LEVEL_SCALING=3.162 + <<: *ivas-pytest-anchor -# test renderer executable with cmake + asan -renderer-asan: +ivas-pytest-dec-msan-short: extends: - .test-job-linux - - .rules-merge-request - needs: ["build-codec-linux-cmake"] - stage: test - script: - - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=asan -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true - - cmake --build cmake-build -- -j - - testcase_timeout=180 - - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py --testcase_timeout=$testcase_timeout - - artifacts: - name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" - expire_in: 1 week - when: always - paths: - - report-junit.xml - expose_as: "renderer asan pytest results" - reports: - junit: - - report-junit.xml + before_script: + - CLANG_NUM=1 + - DUT_ENCODER_PATH=./$REF_ENCODER_PATH + <<: *ivas-pytest-sanitizers-anchor -# test renderer executable with cmake + msan -renderer-msan: +ivas-pytest-dec-asan-short: extends: - .test-job-linux - - .rules-merge-request - needs: ["build-codec-linux-cmake"] - stage: test - script: - - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=msan -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true - - cmake --build cmake-build -- -j - - testcase_timeout=180 - - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py --testcase_timeout=$testcase_timeout - - artifacts: - name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" - expire_in: 1 week - when: always - paths: - - report-junit.xml - expose_as: "renderer msan pytest results" - reports: - junit: - - report-junit.xml + before_script: + - CLANG_NUM=2 + - DUT_ENCODER_PATH=./$REF_ENCODER_PATH + <<: *ivas-pytest-sanitizers-anchor -# test renderer executable with cmake + usan -renderer-usan: +ivas-pytest-dec-usan-short: extends: - .test-job-linux - - .rules-merge-request - needs: ["build-codec-linux-cmake"] - stage: test - script: - - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=usan -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true - - cmake --build cmake-build -- -j - - testcase_timeout=180 - - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1,log_path=usan_log_catchall python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py --testcase_timeout=$testcase_timeout - - grep_exit_code=0 - - touch usan_log_empty # Creates an empty file, this is to avoid "grep: usan_log_*: No such file or directory" in case no USAN failures are reported from pytest - - grep UndefinedBehaviorSanitizer usan_log_* || grep_exit_code=$? - - if [ $grep_exit_code != 1 ] ; then echo "Run errors in test_renderer.py with Clang undefined-behavior-sanitizer"; exit 1; fi - - artifacts: - name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" - expire_in: 1 week - when: always - paths: - - report-junit.xml - expose_as: "renderer usan pytest results" - reports: - junit: - - report-junit.xml - -# compare renderer bitexactness between target and source branch -renderer-pytest-on-merge-request: - extends: - - .test-job-linux-needs-testv-dir - - .rules-merge-request - needs: ["build-codec-linux-make"] - # TODO: set reasonable timeout, will most likely take less - timeout: "20 minutes" - stage: compare - script: - - *print-common-info - - *get-commits-behind-count - - *check-commits-behind-count-in-compare-jobs - - *merge-request-comparison-setup-codec - - # some helper variables - "|| true" to prevent failures from grep not finding anything - # write to temporary file as workaround for failures observed with piping echo - - echo $CI_MERGE_REQUEST_TITLE > tmp.txt - - non_be_flag=$(grep -c --ignore-case "\[rend\(erer\)*[ -]*non[ -]*be\]" tmp.txt) || true - - ref_using_main=$(grep -c --ignore-case "\[ref[ -]*using[ -]*main\]" tmp.txt) || true - - ### If ref_using_main is not set, checkout the source branch to use scripts and input from there - - if [ $ref_using_main == 0 ]; then git checkout $source_branch_commit_sha; fi - - - exit_code=0 - - testcase_timeout=60 - - python3 -m pytest -q --log-level ERROR -n auto -rA --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py --create_ref --testcase_timeout=$testcase_timeout || exit_code=$? - - ### Run test using branch scripts and input - - if [ $ref_using_main == 1 ]; then git checkout $source_branch_commit_sha; fi - - # run test - - python3 -m pytest -q --log-level ERROR -n auto -rA --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer_.py --create_cut --testcase_timeout=$testcase_timeout || exit_code=$? - - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true - - - *merge-request-comparison-check + before_script: + - CLANG_NUM=3 + - DUT_ENCODER_PATH=./$REF_ENCODER_PATH + <<: *ivas-pytest-sanitizers-anchor - allow_failure: - exit_codes: - - 123 - artifacts: - name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" - expire_in: 1 week - when: always - paths: - - report-junit.xml - - report.html - expose_as: "pytest renderer results" - reports: - junit: - - report-junit.xml +# --------------------------------------------------------------- +# Long test jobs +# --------------------------------------------------------------- -# test split rendering -split-rendering-smoke-test: +ivas-pytest-compare_ref-long-enc: extends: - - .test-job-linux - - .rules-merge-request - needs: ["build-codec-linux-make"] - stage: test - script: - - make -j - - testcase_timeout=10 - - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/split_rendering/test_split_rendering.py --testcase_timeout=$testcase_timeout - artifacts: - name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" - expire_in: 1 week - when: always - paths: - - report-junit.xml - expose_as: "split rendering make pytest results" - reports: - junit: - - report-junit.xml + - .rules-pytest-long + - .test-job-linux + before_script: + - USE_LTV=1 + - DUT_DECODER_PATH=./$REF_DECODER_PATH + - TEST_SUITE="$LONG_TEST_SUITE" + - LEVEL_SCALING=1.0 + <<: *ivas-pytest-anchor + +ivas-pytest-compare_ref-long-dec: + extends: + - .rules-pytest-long + - .test-job-linux + before_script: + - USE_LTV=1 + - DUT_ENCODER_PATH=./$REF_ENCODER_PATH + - TEST_SUITE="$LONG_TEST_SUITE" + - LEVEL_SCALING=1.0 + <<: *ivas-pytest-anchor + +ivas-pytest-compare_ref-long-enc-lev-10: + extends: + - .rules-pytest-long + - .test-job-linux + before_script: + - USE_LTV=1 + - DUT_DECODER_PATH=./$REF_DECODER_PATH + - TEST_SUITE="$LONG_TEST_SUITE" + - LEVEL_SCALING=0.3162 + <<: *ivas-pytest-anchor + +ivas-pytest-compare_ref-long-dec-lev-10: + extends: + - .rules-pytest-long + - .test-job-linux + before_script: + - USE_LTV=1 + - DUT_ENCODER_PATH=./$REF_ENCODER_PATH + - TEST_SUITE="$LONG_TEST_SUITE" + - LEVEL_SCALING=0.3162 + <<: *ivas-pytest-anchor -lc3-wrapper-unit-test: +ivas-pytest-compare_ref-long-enc-lev+10: extends: - - .test-job-linux - - .rules-merge-request - needs: ["build-codec-linux-cmake"] - stage: test - script: - - cmake -B cmake-build -G "Unix Makefiles" -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true - - cmake --build cmake-build -- -j - - scripts/split_rendering/lc3plus/ivas_lc3plus_unit_test + - .rules-pytest-long + - .test-job-linux + before_script: + - USE_LTV=1 + - DUT_DECODER_PATH=./$REF_DECODER_PATH + - TEST_SUITE="$LONG_TEST_SUITE" + - LEVEL_SCALING=3.162 + <<: *ivas-pytest-anchor + +ivas-pytest-compare_ref-long-dec-lev+10: + extends: + - .rules-pytest-long + - .test-job-linux + before_script: + - USE_LTV=1 + - DUT_ENCODER_PATH=./$REF_ENCODER_PATH + - TEST_SUITE="$LONG_TEST_SUITE" + - LEVEL_SCALING=3.162 + <<: *ivas-pytest-anchor -# compare split-rendering bitexactness between target and source branch -split-rendering-pytest-on-merge-request: +ivas-smoke-test-saturation: extends: + - .rules-pytest-saturation-smoke-test - .test-job-linux-needs-testv-dir - - .rules-merge-request - needs: ["build-codec-linux-make"] - # TODO: set reasonable timeout, will most likely take less - timeout: "30 minutes" - stage: compare script: - - *print-common-info - - *get-commits-behind-count - - *check-commits-behind-count-in-compare-jobs - - # some helper variables - "|| true" to prevent failures from grep not finding anything - # write to temporary file as workaround for failures observed with piping echo - - echo $CI_MERGE_REQUEST_TITLE > tmp.txt - - non_be_flag=$(grep -c --ignore-case "\[split*[ -]*non[ -]*be\]" tmp.txt) || true - - ref_using_main=$(grep -c --ignore-case "\[ref[ -]*using[ -]*main\]" tmp.txt) || true - - # store the current commit hash - - source_branch_commit_sha=$(git rev-parse HEAD) - - - *mr-fetch-target-branch - - *mr-get-target-commit - - git checkout $target_commit - - echo "Building reference codec at commit $target_commit" - - # build reference binaries - - make -j - - mv IVAS_cod IVAS_cod_ref - - mv IVAS_dec IVAS_dec_ref - - mv IVAS_rend IVAS_rend_ref - - ### If ref_using_main is not set, checkout the source branch to use scripts and input from there - - if [ $ref_using_main == 0 ]; then git restore lib_com/options.h; fi # Revert changes back before checking out another branch to avoid conflicts - - if [ $ref_using_main == 0 ]; then git checkout $source_branch_commit_sha; fi - - exit_code=0 - - testcase_timeout=60 - - python3 -m pytest -q --log-level ERROR -n auto -rA --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout || exit_code=$? - - # back to source branch - - git restore lib_com/options.h # Revert changes back before checking out another branch to avoid conflicts - - git checkout $source_branch_commit_sha - - make clean - - make -j - - ### Run test using scripts and input from main - - if [ $ref_using_main == 1 ]; then git restore lib_com/options.h; fi # Revert changes back before checking out another branch to avoid conflicts - - if [ $ref_using_main == 1 ]; then git checkout $source_branch_commit_sha; fi - - # run test - - python3 -m pytest -q --log-level ERROR -n auto -rA --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/split_rendering/test_split_rendering.py --create_cut --testcase_timeout=$testcase_timeout || exit_code=$? - - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true - - - *merge-request-comparison-check - - allow_failure: - exit_codes: - - 123 - artifacts: - name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" - expire_in: 2 week - when: always - paths: - - report-junit.xml - - report.html - expose_as: "pytest split rendering results" - reports: - junit: - - report-junit.xml + - USE_LTV=1 + - LEVEL_SCALING=32768 -# compare bit exactness between target and source branch -ivas-pytest-on-merge-request: - extends: - - .test-job-linux-needs-testv-dir - - .rules-merge-request - stage: compare - needs: ["build-codec-linux-cmake", "codec-smoke-test"] - timeout: "14 minutes" - script: - *print-common-info - - *get-commits-behind-count - - *check-commits-behind-count-in-compare-jobs - - *merge-request-comparison-setup-codec - - # some helper variables - "|| true" to prevent failures from grep not finding anything - # write to temporary file as workaround for failures observed with piping echo - - echo $CI_MERGE_REQUEST_TITLE > tmp.txt - - non_be_flag=$(grep -c --ignore-case "\[non[ -]*be\]" tmp.txt) || true - - ref_using_main=$(grep -c --ignore-case "\[ref[ -]*using[ -]*main\]" tmp.txt) || true - - ### If ref_using_main is not set, checkout the source branch to use scripts and input from there - - if [ $ref_using_main == 0 ]; then git checkout $source_branch_commit_sha; fi - - ### prepare pytest - # create references - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 -m create_ref - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 -m create_ref_part2 - - ### Run test using branch scripts and input - - if [ $ref_using_main == 1 ]; then git checkout $source_branch_commit_sha; fi - - ### run pytest - - exit_code=0 - - testcase_timeout=60 - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout=$testcase_timeout || exit_code=$? - - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true + - *update-scripts-repo + - if [ $USE_LTV -eq 1 ]; then + - *update-ltv-repo + - *copy-ltv-files-to-testv-dir + - fi + - if [ $LEVEL_SCALING != "1.0" ];then + - *apply-testv-scaling + - fi + - cp -r scripts/testv/* $TESTV_DIR/ - - *merge-request-comparison-check + # skip prepare_mem_dryrun.py script in smoke_test.sh + - sed -i 's/python3 .\/scripts\/prepare_mem_dryrun.py/#python3 .\/scripts\/prepare_mem_dryrun.py/g' ci/smoke_test.sh - allow_failure: - exit_codes: - - 123 + - bash ci/smoke_test.sh + ### analyze for failures + - if ! [ -s smoke_test_output.txt ] || ! [ -s smoke_test_output_plc.txt ] || ! [ -s smoke_test_output_jbm_noEXT.txt ] || ! [ -s smoke_test_output_hrtf.txt ]; then echo "Error in smoke test"; exit 1; fi + - ret_val=0 + - if cat smoke_test_output.txt | grep -c "failed" ; then echo "Smoke test without PLC failed"; ret_val=1; fi + - if cat smoke_test_output_plc.txt | grep -c "failed"; then echo "Smoke test with PLC failed"; ret_val=1; fi + - if cat smoke_test_output_jbm_noEXT.txt | grep -c "failed"; then echo "Smoke test JBM part failed"; ret_val=1; fi + - if cat smoke_test_output_hrtf.txt | grep -c "failed"; then echo "Smoke test with external hrtf files failed"; ret_val=1; fi + - exit $ret_val artifacts: - name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" + name: "$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA--results" expire_in: 1 week when: always paths: - - report-junit.xml - - report.html - expose_as: "pytest ivas results" - reports: - junit: - - report-junit.xml + - smoke_test_output.txt + - smoke_test_output_plc.txt + - smoke_test_output_jbm_noEXT.txt + - smoke_test_output_hrtf.txt + expose_as: "saturation smoke test results" +# --------------------------------------------------------------- +# EVS 26.444 test job +# --------------------------------------------------------------- -# Check interop IVAS_cod_test -> IVAS_dec_ref -ivas-interop-on-merge-request: +# check bitexactness to EVS +be-2-evs-26444: extends: - - .test-job-linux-needs-testv-dir - - .rules-merge-request + - .test-job-linux + rules: + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "evs-26444" + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" + tags: + - be-2-evs-basop stage: test - needs: ["build-codec-linux-cmake"] - timeout: "10 minutes" + timeout: "120 minutes" # To be revisited script: - *print-common-info - - *get-commits-behind-count - - *check-commits-behind-count-in-compare-jobs - - *merge-request-comparison-setup-codec - # the next line is dependent on ref-using-main flag in the other tests, but here the flag does not make sense - - git checkout $source_branch_commit_sha - - # some helper variables - "|| true" to prevent failures from grep not finding anything - # write to temporary file as workaround for failures observed with piping echo - - echo $CI_MERGE_REQUEST_TITLE > tmp.txt - - non_interop_flag=$(grep -c --ignore-case "\[non[ -]*io\]" tmp.txt) || true + - *update-scripts-repo + - sed -i".bak" "s/\(#define EVS_FLOAT\)/\/\/\1/" lib_com/options.h + - make -j - ### prepare pytest + # copy over to never change the testvector dir + - cp -r $EVS_BE_TEST_DIR_BASOP ./evs_be_test + - mkdir -p ./evs_be_test/output/decoded ./evs_be_test/output/bitstreams - # Run reference creation, using source branch encoder and main decoder (see .merge-request-comparison-setup-codec) - exit_code=0 - - exit_code2=0 - # set timeout for individual testcase runs to 60 seconds - - testcase_timeout=60 - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report.html --self-contained-html --junit-xml=report-junit.xml --update_ref 1 -m create_ref --ref_encoder_path ./IVAS_cod --ref_decoder_path ./IVAS_dec_ref --testcase_timeout=$testcase_timeout || exit_code=$? - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report2.html --self-contained-html --junit-xml=report2-junit.xml --update_ref 1 -m create_ref_part2 --ref_encoder_path ./IVAS_cod --ref_decoder_path ./IVAS_dec_ref --testcase_timeout=$testcase_timeout || exit_code2=$? - - zero_failures=$(cat report-junit.xml report2-junit.xml | grep -c 'failures="0"') || true - - - if [ $zero_failures != 2 ] && [ $non_interop_flag == 0 ]; then echo "Non-interop cases without non-interop flag encountered!"; exit $EXIT_CODE_FAIL; fi - - if [ $zero_failures != 2 ] && [ $non_interop_flag == 1 ]; then echo "Non-interop cases with non-interop flag encountered"; exit $EXIT_CODE_NON_BE; fi + - python3 -m pytest tests/test_26444.py -v --html=report.html --self-contained-html --junit-xml=report-junit.xml -n auto || exit_code=$? + - if [ $exit_code -eq 1 ]; then echo "Differences encountered"; exit $EXIT_CODE_FAIL; fi - exit 0 - - allow_failure: - exit_codes: - - 123 + artifacts: - name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" + name: "$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA--results" expire_in: 1 week when: always paths: - report-junit.xml - report.html - - report2-junit.xml - - report2.html - expose_as: "interop test results" + expose_as: "EVS 26444 result" reports: junit: - - report*-junit.xml + - report-junit.xml -evs-pytest-on-merge-request: +ivas-pytest-renderer: extends: - .test-job-linux - - .rules-merge-request - stage: compare - needs: ["build-codec-linux-cmake", "codec-smoke-test"] - timeout: "10 minutes" - script: - - *print-common-info - - *get-commits-behind-count - - *check-commits-behind-count-in-compare-jobs - - *merge-request-comparison-setup-codec - - # some helper variables - "|| true" to prevent failures from grep not finding anything - # write to temporary file as workaround for failures observed with piping echo - - echo $CI_MERGE_REQUEST_TITLE > tmp.txt - - non_be_flag=$(grep -c --ignore-case "\[evs[ -]*non[ -]*be\]" tmp.txt) || true - - ref_using_main=$(grep -c --ignore-case "\[ref[ -]*using[ -]*main\]" tmp.txt) || true - - ### If ref_using_main is not set, checkoug the source branch to use scripts and input from there - - if [ $ref_using_main == 0 ]; then git checkout $source_branch_commit_sha; fi - - ### prepare pytest - # create references - - testcase_timeout=60 - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR/test_param_file.py -v --update_ref 1 -m create_ref --param_file scripts/config/self_test_evs.prm --testcase_timeout=$testcase_timeout - - ### Run test using branch scripts and input - - if [ $ref_using_main == 1 ]; then git checkout $source_branch_commit_sha; fi - - ### run pytest for EVS cases - - exit_code=0 - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR/test_param_file.py -v --param_file scripts/config/self_test_evs.prm --html=report.html --self-contained-html --junit-xml=report-junit-evs.xml --testcase_timeout=$testcase_timeout || exit_code=$? - - zero_errors=$(cat report-junit-evs.xml | grep -c 'errors="0"') || true - - - *merge-request-comparison-check + rules: + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "pytest-renderer" + before_script: + - USE_LTV=0 + - TEST_SUITE="tests/renderer" + - LEVEL_SCALING=1.0 + <<: *ivas-pytest-anchor - allow_failure: - exit_codes: - - 123 - artifacts: - name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" - expire_in: 1 week - when: always - paths: - - report-junit-evs.xml - - report.html - expose_as: "pytest evs results" - reports: - junit: - - report-junit-evs.xml -voip-be-on-merge-request: - extends: - - .test-job-linux-needs-testv-dir - - .rules-merge-request - stage: test - needs: ["build-codec-linux-make"] - timeout: "10 minutes" +# job that sets up gitlab pages website +pages: + stage: deploy + tags: + - ivas-basop-linux + rules: + - if: $UPDATE_PAGES script: - *print-common-info - - make clean - - make -j - - python3 -m pytest tests/test_be_for_jbm_neutral_dly_profile.py - -clang-format-check: - extends: - - .test-job-linux - - .rules-merge-request - variables: - ARTIFACT_BASE_NAME: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--formatting-fix" - stage: prevalidate - needs: [] - timeout: "5 minutes" - script: - # Set up variables. This can't be done in the "variables" section because variables are not expanded properly there - - PATCH_FILE_NAME="$ARTIFACT_BASE_NAME".patch - - > - INSTRUCTIONS_GITLAB="To fix formatting issues:\n - - download the diff patch available as artifact of this job\n - - unzip the artifact and place the patch file in the root directory of your local IVAS repo\n - - run: git apply $PATCH_FILE_NAME\n - - commit new changes" - - > - INSTRUCTIONS_README="To fix formatting issues:\n - - place the patch file in the root directory of your local IVAS repo\n - - run: git apply $PATCH_FILE_NAME\n - - commit new changes" - - - format_problems=0 - - scripts/check-format.sh -af -p 8 || format_problems=$? - - if [ $format_problems == 0 ] ; then exit 0; fi - - - mkdir tmp-formatting-fix - - git diff > "tmp-formatting-fix/$PATCH_FILE_NAME" - - # Print instructions to job output - - echo -e "$INSTRUCTIONS_GITLAB" - - # Include readme in the artifact, in case someone misses the job printout (e.g. getting the artifact via MR interface) - - echo -e "$INSTRUCTIONS_README" > "tmp-formatting-fix/readme.txt" - - - exit $format_problems - artifacts: - expire_in: 1 day - paths: - - tmp-formatting-fix/ - when: on_failure - name: "$ARTIFACT_BASE_NAME" - expose_as: "formatting patch" - -# check for crashes if first received frame on decoder side is an SID -check-first-frame-is-sid: - extends: - - .test-job-linux-needs-testv-dir - - .rules-merge-request - tags: - - ivas-linux - stage: test - needs: ["build-codec-linux-cmake"] - script: - - *print-common-info - - *update-ltv-repo - # this rm makes check-for-testvectors only check for the signals we actually need in this test - - rm scripts/config/ci_linux_ltv.json scripts/config/ci_linux.json - - *check-for-testvectors - - bash ci/run-first-frame-is-sid-test.sh - - artifacts: - paths: - - logs_enc - - logs_dec_msan - - logs_dec_asan - - logs_dec_usan - when: always - name: "$CI_JOB_NAME--$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--sidstart" - expose_as: "logs-sidstart" - expire_in: "5 days" - -.lc3plus-ensure-no-code-changes: - extends: - - .test-job-linux - - .rules-merge-request - stage: postvalidate - needs: [] - timeout: "5 minutes" - script: - # Replace code commited to repo with code downloaded from ETSI - - ./scripts/lc3plus_lib_setup/get_lc3plus.sh - - # Ensure git reports no changes - - modified_files=$(git status -s) - - if [[ $modified_files ]]; then printf 'LC3plus codebase was modified!\n\n'"$modified_files"'\n\n'; exit $EXIT_CODE_FAIL; fi - -check-bitexactness-hrtf-rom-and-file: - extends: - - .test-job-linux - - .rules-merge-request - stage: test - needs: ["build-codec-linux-cmake"] - timeout: "5 minutes" - script: - - *print-common-info - - cmake . - - make -j - - python3 tests/create_short_testvectors.py --cut_len 1.0 - - python3 -m pytest tests/hrtf_binary_loading --html=report.html --junit-xml=report-junit.xml --self-contained-html - artifacts: - paths: - - report.html - - report-junit.xml - when: always - name: "$CI_JOB_NAME--$CI_MERGE_REQUEST_ID--sha-$CI_COMMIT_SHA--hrtf-loading" - expose_as: "logs-hrtf-loading" - expire_in: "5 days" - -check-bitexactness-ext-and-transport-format: - extends: - - .test-job-linux - - .rules-merge-request - stage: test - needs: ["build-codec-linux-cmake"] - timeout: "5 minutes" - script: - - *print-common-info - - cmake . - - make -j - - python3 tests/create_short_testvectors.py --cut_len 1.0 - - python3 -m pytest tests/test_be_for_ext_outputs.py --html=report.html --junit-xml=report-junit.xml --self-contained-html - artifacts: - paths: - - report.html - - report-junit.xml - when: always - name: "$CI_JOB_NAME--$CI_MERGE_REQUEST_ID--sha-$CI_COMMIT_SHA--ext-sanity-check" - expose_as: "logs-ext-sanity-check" - expire_in: "5 days" - - -# --------------------------------------------------------------- -# Test jobs for main branch -# --------------------------------------------------------------- - -# check bitexactness to EVS windows binaries -be-2-evs-windows: - extends: - - .rules-main-push - tags: - - ivas-windows - stage: test - needs: ["build-codec-windows-msbuild"] - timeout: "20 minutes" # To be revisited - script: - - *print-common-info-windows - - - $winoutdata = $null - - MSBuild.exe -maxcpucount .\Workspace_msvc\Workspace_msvc.sln /property:Configuration=Release | tee -variable winoutdata - - $winoutdata | Out-File $BUILD_OUTPUT -Encoding Utf8 - - # copy over to never change the testvector dir - - cp -r $EVS_BE_WIN_TEST_DIR ./evs_be_win_test - - cp IVAS_cod.exe ./evs_be_win_test/bin/IVAS_cod.exe - - cp IVAS_dec.exe ./evs_be_win_test/bin/IVAS_dec.exe - - - cd evs_be_win_test - - python ../ci/run_evs_be_win_test.py - -# check bitexactness to EVS -be-2-evs-linux: - extends: - - .test-job-linux - - .rules-main-push - tags: - - be-2-evs-temp - stage: test - needs: ["build-codec-linux-cmake"] - timeout: "20 minutes" # To be revisited - script: - - *print-common-info - - - mkdir build - - cd build - - cmake .. - - make -j - - cd .. - - # copy over to never change the testvector dir - - cp -r $EVS_BE_TEST_DIR ./evs_be_test - - cp build/IVAS_cod ./evs_be_test/bin/EVS_cod - - cp build/IVAS_dec ./evs_be_test/bin/EVS_dec - - - cd evs_be_test - - python3 ../ci/run_evs_be_test.py - -codec-comparison-on-main-push: - extends: - - .test-job-linux-needs-testv-dir - - .rules-main-push - stage: compare - needs: ["build-codec-linux-cmake"] - timeout: "30 minutes" # To be revisited - script: - - *print-common-info - - latest_commit=$(git rev-parse HEAD) # Latest commit - - *get-previous-merge-commit-sha # Stored in previous_merge_commit shell variable now - - echo "Comparing changes from $previous_merge_commit to $latest_commit" - - git --no-pager diff --stat $previous_merge_commit..$latest_commit - - # Rest is more or less placeholder adapted from MR self test. This should be replaced with more complex tests. - - ### build test binaries, initial clean for paranoia reasons - - make clean - - mkdir build - - cd build - - cmake .. - - make -j - - mv IVAS_cod ../IVAS_cod_test - - mv IVAS_dec ../IVAS_dec_test - - cd .. - - rm -rf build/* - - ### compare to the previous merge commit in the main branch - - git fetch origin main - - git checkout $previous_merge_commit - - echo "Building reference codec at commit $previous_merge_commit" - - ### build reference binaries - - cd build - - cmake .. - - make -j - - mv IVAS_cod ../IVAS_cod_ref - - mv IVAS_dec ../IVAS_dec_ref - - cd .. - - # helper variable - "|| true" to prevent failures from grep not finding anything - # write to temporary file as workaround for failures observed with piping echo - - echo $CI_COMMIT_MESSAGE > tmp.txt - - non_be_flag=$(grep -c --ignore-case "\[non[ -]*be\]" tmp.txt) || true - - ref_using_main=$(grep -c --ignore-case "\[ref[ -]*using[ -]*main\]" tmp.txt) || true - - ### re-checkout the latest commit in the main branch, if ref_using_main is not set - - if [ $ref_using_main == 0 ]; then git checkout $latest_commit;fi - - ### prepare pytest - # rename test binaries back - - mv IVAS_cod_test IVAS_cod - - mv IVAS_dec_test IVAS_dec - # create references - - testcase_timeout=60 - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 -m create_ref --testcase_timeout=$testcase_timeout - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 -m create_ref_part2 --testcase_timeout=$testcase_timeout - - ### re-checkout the latest commit here, if ref_using_main is set - - if [ $ref_using_main -eq 1 ]; then git checkout $latest_commit;fi - - ### run pytest - - exit_code=0 - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout=$testcase_timeout || exit_code=$? - - if [ $exit_code -eq 1 ] && [ $non_be_flag == 0 ]; then echo "pytest run had failures and non-BE flag not present"; exit $EXIT_CODE_FAIL; fi - - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true - - if [ $exit_code -eq 1 ] && [ $zero_errors == 1 ]; then echo "pytest run had failures, but no errors and non-BE flag present"; exit $EXIT_CODE_NON_BE; fi - - if [ $exit_code -ne 0 ]; then echo "pytest run had errors"; exit $EXIT_CODE_FAIL; fi; - allow_failure: - exit_codes: - - 123 - artifacts: - name: "main-push--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" - expire_in: 1 week - when: always - paths: - - report-junit.xml - - report.html - expose_as: "Results of comparison to previous merge commit" - reports: - junit: report-junit.xml - - -# --------------------------------------------------------------- -# Manual jobs -# --------------------------------------------------------------- - -test-be-to-release: - stage: test - tags: - - ivas-windows - resource_group: ivas-be-to-release-test-resource - timeout: "20 minutes" - rules: - - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'test-be-release' - script: - - - echo "$CI_COMMIT_BRANCH" - - MSBuild.exe -maxcpucount .\Workspace_msvc\Workspace_msvc.sln /property:Configuration=Debug /p:Platform=win32 /m | tee -variable winoutdata - - # path to release candidate refs defined in config.toml - - - echo "Placeholder for BE test to release script" - - mkdir logs - - artifacts: - name: "test-be-to-release--sha-$CI_COMMIT_SHORT_SHA--results" - when: always - expire_in: 1 week - paths: - - logs/ - expose_as: "test-be-to-release results" - - -ivas-conformance: - tags: - - ivas-windows - stage: test - timeout: "90 minutes" - rules: - - if: ($CI_PIPELINE_SOURCE == 'web' || $CI_PIPELINE_SOURCE == 'trigger') && $MANUAL_PIPELINE_TYPE == 'ivas-conformance' - - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - allow_failure: - exit_codes: - - 123 - script: - - *print-common-info-windows - - MSBuild.exe -maxcpucount .\Workspace_msvc\Workspace_msvc.sln /property:Configuration=Debug - - cp -force IVAS_cod.exe IVAS_cod_ref.exe - - cp -force IVAS_dec.exe IVAS_dec_ref.exe - - cp -force IVAS_rend.exe IVAS_rend_ref.exe - - # Reference creation - - python scripts/prepare_combined_format_inputs.py - - $TEST_SET = "tests/codec_be_on_mr_nonselection", "tests/renderer/test_renderer.py", "tests/split_rendering/test_split_rendering.py" - - python -m pytest $TEST_SET -v -n auto --update_ref 1 -m create_ref --create_ref --keep_files - - python -m pytest $TEST_SET -v -n auto --update_ref 1 -m create_ref_part2 --keep_files - - # Output creation - - python -m pytest $TEST_SET -v -n auto --keep_files --create_cut --html=report_cmd.html --self-contained-html - - python scripts/parse_commands.py report_cmd.html Readme_IVAS.txt - - # Copy input data and output ref data - - if (Test-Path testvec) {rm -r -force testvec} - - if (Test-Path TMP_DEC) {rm -r -force TMP_DEC} - - if (Test-Path TMP_ENC) {rm -r -force TMP_ENC} - - if (Test-Path TMP_JBM) {rm -r -force TMP_JBM} - - if (Test-Path TMP_REND) {rm -r -force TMP_REND} - - if (Test-Path TMP_ISAR_POST_REND) {rm -r -force TMP_ISAR_POST_REND} - - if (Test-Path TMP_DEC_ISAR) {rm -r -force TMP_DEC_ISAR} - - mkdir testvec - - mkdir testvec/binauralRenderer_interface - - mkdir testvec/testv - - mkdir testvec/testv/renderer - - mkdir testvec/testv/split_rendering - - mkdir testvec/bin - - cp -force -ErrorAction Ignore scripts/testv/* testvec/testv - - cp -r -force -ErrorAction Ignore scripts/ls_layouts testvec - - cp -r -force -ErrorAction Ignore scripts/switchPaths testvec - - cp -r -force -ErrorAction Ignore scripts/trajectories testvec - - cp -r -force -ErrorAction Ignore scripts/binauralRenderer_interface/binaural_renderers_hrtf_data testvec/binauralRenderer_interface - - cp -r -force -ErrorAction Ignore tests/ref testvec/testv/ref - - cp -r -force -ErrorAction Ignore tests/dut/* testvec/testv/ref - - cp -r -force -ErrorAction Ignore tests/renderer/cut testvec/testv/renderer/ref - - cp -r -force -ErrorAction Ignore tests/split_rendering/cut testvec/testv/split_rendering/ref - - cp -r -force -ErrorAction Ignore tests/split_rendering/renderer_configs testvec/testv/split_rendering/renderer_configs - - cp -r -force -ErrorAction Ignore tests/split_rendering/error_patterns testvec/testv/split_rendering/error_patterns - - # Remove redundant files - - python scripts/cleanup_26252.py - - # Copy test script files - - cp -r -force -ErrorAction Ignore tests/conformance-test testvec/ - - cp Readme_IVAS_dec.txt testvec - - cp Readme_IVAS_enc.txt testvec - - cp Readme_IVAS_rend.txt testvec - - cp Readme_IVAS_JBM_dec.txt testvec - - cp Readme_IVAS_ISAR_dec.txt testvec - - cp Readme_IVAS_ISAR_post_rend.txt testvec - - cp IVAS_cod.exe testvec/bin - - cp IVAS_dec.exe testvec/bin - - cp IVAS_rend.exe testvec/bin - - cp ISAR_post_rend.exe testvec/bin - - - # Test run generated scripts in testvec - - cd testvec - - python -m pytest conformance-test/test_26252.py --junit-xml=report-junit.xml --html=report.html --self-contained-html - - mv report.html .. - - mv report-junit.xml .. - - artifacts: - name: "ivas-conformance-$CI_COMMIT_SHORT_SHA" - expire_in: 1 week - when: always - paths: - - report-junit.xml - - report.html - - Readme_IVAS_dec.txt - - Readme_IVAS_enc.txt - - Readme_IVAS_rend.txt - - Readme_IVAS_JBM_dec.txt - - Readme_IVAS_ISAR_dec.txt - - Readme_IVAS_ISAR_post_rend.txt - expose_as: "Draft IVAS conformance" - reports: - junit: report-junit.xml - -ivas-conformance-linux: - tags: - - ivas-linux - stage: test - timeout: "90 minutes" - rules: - - if: ($CI_PIPELINE_SOURCE == 'web' || $CI_PIPELINE_SOURCE == 'trigger') && $MANUAL_PIPELINE_TYPE == 'ivas-conformance-linux' - allow_failure: - exit_codes: - - 123 - script: - - *print-common-info - - make -j - - cp IVAS_cod IVAS_cod_ref - - cp IVAS_dec IVAS_dec_ref - - cp IVAS_rend IVAS_rend_ref - - # Reference creation - - python3 scripts/prepare_combined_format_inputs.py - - TEST_SET="tests/codec_be_on_mr_nonselection tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py" - - python3 -m pytest $TEST_SET -v -n auto --update_ref 1 -m create_ref --create_ref --keep_files - - python3 -m pytest $TEST_SET -v -n auto --update_ref 1 -m create_ref_part2 --keep_files - - # Output creation - - python3 -m pytest $TEST_SET -v -n auto --keep_files --create_cut --html=report_cmd.html --self-contained-html - - python3 scripts/parse_commands.py report_cmd.html Readme_IVAS.txt - - # Copy input data and output ref data - - rm -rf testvec - - mkdir testvec - - mkdir testvec/binauralRenderer_interface - - mkdir testvec/testv - - mkdir testvec/testv/renderer - - mkdir testvec/testv/split_rendering - - mkdir testvec/bin - - cp -r scripts/testv/* testvec/testv - - cp -r scripts/ls_layouts testvec - - cp -r scripts/switchPaths testvec - - cp -r scripts/trajectories testvec - - cp -r scripts/binauralRenderer_interface/binaural_renderers_hrtf_data testvec/binauralRenderer_interface - - cp -r tests/ref testvec/testv/ref - - cp -r tests/dut/* testvec/testv/ref - - cp -r tests/renderer/cut testvec/testv/renderer/ref - - cp -r tests/split_rendering/cut testvec/testv/split_rendering/ref - - cp -r tests/split_rendering/renderer_configs testvec/testv/split_rendering/renderer_configs - - cp -r tests/split_rendering/error_patterns testvec/testv/split_rendering/error_patterns - - # Remove redundant files - - python3 scripts/cleanup_26252.py - - # Copy test script files - - cp -r tests/conformance-test testvec/ - - cp Readme_IVAS_dec.txt testvec - - cp Readme_IVAS_enc.txt testvec - - cp Readme_IVAS_rend.txt testvec - - cp Readme_IVAS_JBM_dec.txt testvec - - cp Readme_IVAS_ISAR_dec.txt testvec - - cp Readme_IVAS_ISAR_post_rend.txt testvec - - # Create GCOV execs for coverage analysis - - make clean - - make GCOV=1 -j - - - cp IVAS_cod testvec/bin - - cp IVAS_dec testvec/bin - - cp IVAS_rend testvec/bin - - cp ISAR_post_rend testvec/bin - - # Test run generated scripts in testvec - - cd testvec - - exit_code=0 - - python3 -m pytest conformance-test/test_26252.py --junit-xml=report-junit.xml --html=report.html --self-contained-html || exit_code=$? - - mv report.html .. - - mv report-junit.xml .. - - # Collect coverage - - cd - - - lcov -c -d obj -o coverage.info - - lcov -r coverage.info "*apps*" -o coverage.info - - lcov -r coverage.info "*lib_util*" -o coverage.info - - commit_sha=$(git rev-parse HEAD) - - genhtml coverage.info -o coverage -t "Coverage on main @ $commit_sha" - - # Check for failures - - if [ $exit_code -eq 1 ]; then echo "Test failures encountered"; exit $EXIT_CODE_FAIL; fi - - artifacts: - name: "ivas-conformance-linux-$CI_COMMIT_SHORT_SHA" - expire_in: 1 week - when: always - paths: - - report_cmd.html - - report-junit.xml - - report.html - - Readme_IVAS_dec.txt - - Readme_IVAS_enc.txt - - Readme_IVAS_rend.txt - - Readme_IVAS_JBM_dec.txt - - Readme_IVAS_ISAR_dec.txt - - Readme_IVAS_ISAR_post_rend.txt - - coverage.info - - coverage - expose_as: "Draft IVAS conformance -- Linux" - reports: - junit: report-junit.xml - - -test-long-self-test: - tags: - - ivas-linux-fast - stage: compare - resource_group: ivas-long-self-test-resource - timeout: "50 minutes" - rules: - - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'test-long-self-test' - allow_failure: - exit_codes: - - 123 - script: - - *print-common-info - - *update-ltv-repo - - ### build branch binaries - - cmake . -Bbuild-test - - cmake --build build-test -- -j - - mv build-test/IVAS_cod ./IVAS_cod - - mv build-test/IVAS_dec ./IVAS_dec - - ### store the current commit hash - - source_branch_commit_sha=$(git rev-parse HEAD) - - ### switch to main - - git checkout main - - git pull origin main - - echo "Building reference codec at commit $(git rev-parse HEAD)" - - ### build main (ref) binaries - - cmake . -Bbuild-ref - - cmake --build build-ref -- -j - - mv build-ref/IVAS_cod ./IVAS_cod_ref - - mv build-ref/IVAS_dec ./IVAS_dec_ref - - ### Switch back to branch, this could probably be removed later - - git checkout $source_branch_commit_sha - - ### prepare pytest - - # Copy test vectors from LTV to TESTV - - *copy-ltv-files-to-testv-dir - - # create references - - exit_code_ref=0 - - testcase_timeout=300 - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR/test_param_file.py -v --update_ref 1 -m create_ref --param_file scripts/config/self_test_ltv.prm --testcase_timeout=$testcase_timeout || exit_code_ref=$? - - ### run pytest self-test using long test vectors - - exit_code=0 - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR/test_param_file.py -v --param_file scripts/config/self_test_ltv.prm --html=report-ltv.html --self-contained-html --junit-xml=report-junit-ltv.xml --testcase_timeout=$testcase_timeout || exit_code=$? - - zero_errors=$(cat report-junit-ltv.xml | grep -c 'errors="0"') || true - - - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi - - if [ $exit_code -eq 1 ]; then echo "Non-bitexact cases encountered!"; exit $EXIT_CODE_NON_BE; fi - - exit 0 - - - artifacts: - name: "test-long-self-test--sha-$CI_COMMIT_SHORT_SHA--results" - when: always - expire_in: 4 mos - paths: - - report-junit-ltv.xml - - report-ltv.html - expose_as: "test-long-self-test results" - reports: - junit: - - report-junit-ltv.xml - - -# --------------------------------------------------------------- -# Scheduled jobs on main -# --------------------------------------------------------------- - -# code selftest long testvectors with memory-sanitizer binaries -ltv-msan: - extends: - - .sanitizer-selftest-ltv - rules: - - if: $SANITIZER_SCHEDULE_E - timeout: 4 hour - tags: - - ivas-linux-fast - before_script: - - CLANG_NUM=1 - - SELFTEST_SANITY_TIMEOUT=$TESTCASE_TIMEOUT_LTV_SANITIZERS - - SELF_TEST_PRM_FILE="scripts/config/self_test_ltv.prm" - <<: *sanitizer-selftest-anchor - -# code selftest long testvectors with address-sanitizer binaries -ltv-asan: - extends: - - .sanitizer-selftest-ltv - rules: - - if: $SANITIZER_SCHEDULE_E - when: delayed - start_in: 4 hours - tags: - - ivas-linux-fast - timeout: 3 hour - before_script: - - CLANG_NUM=2 - - SELFTEST_SANITY_TIMEOUT=$TESTCASE_TIMEOUT_LTV_SANITIZERS - - SELF_TEST_PRM_FILE="scripts/config/self_test_ltv.prm" - <<: *sanitizer-selftest-anchor - -# code selftest long testvectors with undefined-behaviour-sanitizer binaries -ltv-usan: - extends: - - .sanitizer-selftest-ltv - rules: - - if: $SANITIZER_SCHEDULE_E - when: delayed - start_in: 7 hours - tags: - - ivas-linux-fast - timeout: 3 hour - before_script: - - CLANG_NUM=3 - - SELFTEST_SANITY_TIMEOUT=$TESTCASE_TIMEOUT_LTV_SANITIZERS - - SELF_TEST_PRM_FILE="scripts/config/self_test_ltv.prm" - <<: *sanitizer-selftest-anchor - -.sanitizer-test-template: - extends: - - .test-job-linux - stage: test - tags: - - sanitizer_test_main - - ivas-linux-fast - artifacts: - name: "$CI_JOB_NAME--main--sha-$CI_COMMIT_SHORT_SHA" - expire_in: 2 weeks - when: always - paths: - - ep_015.g192 - - dly_profile.dat - - head_rot_traj.csv - - exof_traj.csv - - ./LOGS_PLC - - ./LOGS_noPLC - -### --- sanitizer schedule A --- - -.sanitizer-test-schedule-A: - extends: - - .sanitizer-test-template - -sanitizer-test-mono: - extends: .sanitizer-test-schedule-A - rules: - - if: $SANITIZER_SCHEDULE_A - timeout: 1.25 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py mono mono --tests $SANITIZER_TESTS - -sanitizer-test-stereo: - extends: .sanitizer-test-schedule-A - rules: - - if: $SANITIZER_SCHEDULE_A - when: delayed - start_in: 1.25 hours - timeout: 2.5 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py stereo $OUT_FORMATS_CHANNEL_BASED EXT --tests $SANITIZER_TESTS - -sanitizer-test-stereodmxevs: - extends: .sanitizer-test-schedule-A - rules: - - if: $SANITIZER_SCHEDULE_A - when: delayed - start_in: 3.75 hours - timeout: 1.25 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py StereoDmxEVS mono --tests $SANITIZER_TESTS - -sanitizer-test-mc-5_1: - extends: .sanitizer-test-schedule-A - rules: - - if: $SANITIZER_SCHEDULE_A - when: delayed - start_in: 5 hours - timeout: 2.5 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py 5_1 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-mc-5_1_2: - extends: .sanitizer-test-schedule-A - rules: - - if: $SANITIZER_SCHEDULE_A - when: delayed - start_in: 7.5 hours - timeout: 2.5 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py 5_1_2 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-mc-5_1_4: - extends: .sanitizer-test-schedule-A - rules: - - if: $SANITIZER_SCHEDULE_A - when: delayed - start_in: 10 hours - timeout: 3.75 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py 5_1_4 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-mc-7_1: - extends: .sanitizer-test-schedule-A - rules: - - if: $SANITIZER_SCHEDULE_A - when: delayed - start_in: 13.75 hours - timeout: 2.5 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py 7_1 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-mc-7_1_4: - extends: .sanitizer-test-schedule-A - rules: - - if: $SANITIZER_SCHEDULE_A - when: delayed - start_in: 16.25 hours - timeout: 5 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py 7_1_4 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-ism+1: - extends: .sanitizer-test-schedule-A - rules: - - if: $SANITIZER_SCHEDULE_A - when: delayed - start_in: 21.25 hours - timeout: 1.25 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py ISM1 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-ism+2: - extends: .sanitizer-test-schedule-A - rules: - - if: $SANITIZER_SCHEDULE_A - when: delayed - start_in: 22.5 hours - timeout: 2.5 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py ISM2 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-ism+3: - extends: .sanitizer-test-schedule-A - rules: - - if: $SANITIZER_SCHEDULE_A - when: delayed - start_in: 25 hours - timeout: 3.75 hour - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py ISM3 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-ism+4: - extends: .sanitizer-test-schedule-A - rules: - - if: $SANITIZER_SCHEDULE_A - when: delayed - start_in: 28.75 hours - timeout: 5 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py ISM4 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-masa: - extends: .sanitizer-test-schedule-A - rules: - - if: $SANITIZER_SCHEDULE_A - when: delayed - start_in: 33.75 hours - timeout: 10 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py MASA $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -### --- sanitizer schedule B --- - -.sanitizer-test-schedule-B: - extends: - - .sanitizer-test-template - timeout: 7.5 hours - -sanitizer-test-foa: - extends: .sanitizer-test-schedule-B - rules: - - if: $SANITIZER_SCHEDULE_B - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py FOA $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-hoa2: - extends: .sanitizer-test-schedule-B - rules: - - if: $SANITIZER_SCHEDULE_B - when: delayed - start_in: 7.5 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py HOA2 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-hoa3: - extends: .sanitizer-test-schedule-B - rules: - - if: $SANITIZER_SCHEDULE_B - when: delayed - start_in: 15 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py HOA3 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-osba-foa-ism1: - extends: .sanitizer-test-schedule-B - rules: - - if: $SANITIZER_SCHEDULE_B - when: delayed - start_in: 22.5 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py FOA-ISM1 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-osba-foa-ism2: - extends: .sanitizer-test-schedule-B - rules: - - if: $SANITIZER_SCHEDULE_B - when: delayed - start_in: 30 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py FOA-ISM2 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-osba-foa-ism3: - extends: .sanitizer-test-schedule-B - rules: - - if: $SANITIZER_SCHEDULE_B - when: delayed - start_in: 37.5 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py FOA-ISM3 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-osba-foa-ism4: - extends: .sanitizer-test-schedule-B - rules: - - if: $SANITIZER_SCHEDULE_B - when: delayed - start_in: 45 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py FOA-ISM4 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-osba-hoa2-ism1: - extends: .sanitizer-test-schedule-B - rules: - - if: $SANITIZER_SCHEDULE_B - when: delayed - start_in: 52.5 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py HOA2-ISM1 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-osba-hoa2-ism2: - extends: .sanitizer-test-schedule-B - rules: - - if: $SANITIZER_SCHEDULE_B - when: delayed - start_in: 60 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py HOA2-ISM2 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-osba-hoa2-ism3: - extends: .sanitizer-test-schedule-B - rules: - - if: $SANITIZER_SCHEDULE_B - when: delayed - start_in: 67.5 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py HOA2-ISM3 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-osba-hoa2-ism4: - extends: .sanitizer-test-schedule-B - rules: - - if: $SANITIZER_SCHEDULE_B - when: delayed - start_in: 75 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py HOA2-ISM4 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-osba-hoa3-ism1: - extends: .sanitizer-test-schedule-B - rules: - - if: $SANITIZER_SCHEDULE_B - when: delayed - start_in: 82.5 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py HOA3-ISM1 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-osba-hoa3-ism2: - extends: .sanitizer-test-schedule-B - rules: - - if: $SANITIZER_SCHEDULE_B - when: delayed - start_in: 90 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py HOA3-ISM2 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-omasa-ism4: - extends: .sanitizer-test-schedule-B - rules: - - if: $SANITIZER_SCHEDULE_B - when: delayed - start_in: 97.5 hours - timeout: 10 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py MASA-ISM4 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - - -### --- sanitizer schedule C --- - -.sanitizer-test-schedule-C: - extends: - - .sanitizer-test-template - timeout: 10 hours - -sanitizer-test-omasa-ism1: - extends: .sanitizer-test-schedule-C - rules: - - if: $SANITIZER_SCHEDULE_C - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py MASA-ISM1 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-omasa-ism2: - extends: .sanitizer-test-schedule-C - rules: - - if: $SANITIZER_SCHEDULE_C - when: delayed - start_in: 10 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py MASA-ISM2 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-omasa-ism3: - extends: .sanitizer-test-schedule-C - rules: - - if: $SANITIZER_SCHEDULE_C - when: delayed - start_in: 20 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py MASA-ISM3 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-osba-hoa3-ism3: - extends: .sanitizer-test-schedule-C - rules: - - if: $SANITIZER_SCHEDULE_C - when: delayed - start_in: 30 hours - timeout: 7.5 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py HOA3-ISM3 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-osba-hoa3-ism4: - extends: .sanitizer-test-schedule-C - rules: - - if: $SANITIZER_SCHEDULE_C - when: delayed - start_in: 37.5 hours - timeout: 7.5 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py HOA3-ISM4 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -### --- sanitizer schedule D --- - -.sanitizer-test-schedule-D: - extends: - - .sanitizer-test-template - timeout: 7.5 hours - -sanitizer-test-planar-foa: - extends: .sanitizer-test-schedule-D - rules: - - if: $SANITIZER_SCHEDULE_D - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py PlanarFOA $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-planar-hoa2: - extends: .sanitizer-test-schedule-D - rules: - - if: $SANITIZER_SCHEDULE_D - when: delayed - start_in: 7.5 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py PlanarHOA2 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-planar-hoa3: - extends: .sanitizer-test-schedule-D - rules: - - if: $SANITIZER_SCHEDULE_D - when: delayed - start_in: 15 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py PlanarHOA3 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-osba-planar-foa-ism1: - extends: .sanitizer-test-schedule-D - rules: - - if: $SANITIZER_SCHEDULE_D - when: delayed - start_in: 22.5 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py PlanarFOA-ISM1 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-osba-planar-foa-ism2: - extends: .sanitizer-test-schedule-D - rules: - - if: $SANITIZER_SCHEDULE_D - when: delayed - start_in: 30 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py PlanarFOA-ISM2 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-osba-planar-foa-ism3: - extends: .sanitizer-test-schedule-D - rules: - - if: $SANITIZER_SCHEDULE_D - when: delayed - start_in: 37.5 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py PlanarFOA-ISM3 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-osba-planar-foa-ism4: - extends: .sanitizer-test-schedule-D - rules: - - if: $SANITIZER_SCHEDULE_D - when: delayed - start_in: 45 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py PlanarFOA-ISM4 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-osba-planar-hoa2-ism1: - extends: .sanitizer-test-schedule-D - rules: - - if: $SANITIZER_SCHEDULE_D - when: delayed - start_in: 52.5 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py PlanarHOA2-ISM1 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-osba-planar-hoa2-ism2: - extends: .sanitizer-test-schedule-D - rules: - - if: $SANITIZER_SCHEDULE_D - when: delayed - start_in: 60 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py PlanarHOA2-ISM2 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-osba-planar-hoa2-ism3: - extends: .sanitizer-test-schedule-D - rules: - - if: $SANITIZER_SCHEDULE_D - when: delayed - start_in: 67.5 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py PlanarHOA2-ISM3 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-osba-planar-hoa2-ism4: - extends: .sanitizer-test-schedule-D - rules: - - if: $SANITIZER_SCHEDULE_D - when: delayed - start_in: 75 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py PlanarHOA2-ISM4 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-osba-planar-hoa3-ism1: - extends: .sanitizer-test-schedule-D - rules: - - if: $SANITIZER_SCHEDULE_D - when: delayed - start_in: 82.5 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py PlanarHOA3-ISM1 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-osba-planar-hoa3-ism2: - extends: .sanitizer-test-schedule-D - rules: - - if: $SANITIZER_SCHEDULE_D - when: delayed - start_in: 90 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py PlanarHOA3-ISM2 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-osba-planar-hoa3-ism3: - extends: .sanitizer-test-schedule-D - rules: - - if: $SANITIZER_SCHEDULE_D - when: delayed - start_in: 97.5 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py PlanarHOA3-ISM3 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - -sanitizer-test-osba-planar-hoa3-ism4: - extends: .sanitizer-test-schedule-D - rules: - - if: $SANITIZER_SCHEDULE_D - when: delayed - start_in: 105 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py PlanarHOA3-ISM4 $OUT_FORMATS_ALL --tests $SANITIZER_TESTS - - - -# GCOV/LCOV coverage analysis of self_test suite -coverage-test-on-main-scheduled: - extends: - - .test-job-linux-needs-testv-dir - - .rules-main-scheduled - tags: - - ivas-linux - stage: test - rules: - # only run in scheduled pipeline that passes this env vars - - if: $COVERAGE_TEST - timeout: 3 hours - script: - - *print-common-info - - *update-ltv-repo - - *copy-ltv-files-to-testv-dir - - make GCOV=1 -j - - cp IVAS_rend IVAS_rend_ref # Copy exec to be able to run renderer script - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v -n auto --update_ref 1 -m create_ref --ref_encoder_path ./IVAS_cod --ref_decoder_path ./IVAS_dec - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v -n auto --update_ref 1 -m create_ref_part2 --ref_encoder_path ./IVAS_cod --ref_decoder_path ./IVAS_dec - # need to ignore non-zero exit codes as limiter is active and thus the different framesiszes will not be BE in all cases - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --dut_encoder_path ./IVAS_cod --dut_decoder_path ./IVAS_dec --dut_fr 5 --decoder_only || true - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --dut_encoder_path ./IVAS_cod --dut_decoder_path ./IVAS_dec --dut_fr 10 --decoder_only || true - - python3 -m pytest -q -n auto tests/renderer/test_renderer.py --create_ref - - python3 -m pytest -q -n auto tests/renderer/test_renderer.py --create_cut - - lcov -c -d obj -o coverage_stv.info # extract coverage of short test vectors here - # remove apps and lib_util files from coverage - - lcov -r coverage_stv.info "*apps*" -o coverage_stv.info - - lcov -r coverage_stv.info "*lib_util*" -o coverage_stv.info - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR/test_param_file.py -v -n auto --update_ref 1 -m create_ref --param_file scripts/config/self_test_evs.prm --ref_encoder_path ./IVAS_cod --ref_decoder_path ./IVAS_dec - - bash ci/smoke_test.sh coverage - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR/test_param_file.py -v -n auto --update_ref 1 -m create_ref --param_file scripts/config/self_test_ltv.prm --ref_encoder_path ./IVAS_cod --ref_decoder_path ./IVAS_dec - - python3 -m pytest tests/test_be_for_jbm_neutral_dly_profile.py - - lcov -c -d obj -o coverage.info - # remove apps and lib_util files from coverage - - lcov -r coverage.info "*apps*" -o coverage.info - - lcov -r coverage.info "*lib_util*" -o coverage.info - - commit_sha=$(git rev-parse HEAD) - - genhtml coverage.info -o coverage -t "Coverage on main @ $commit_sha" - - genhtml coverage_stv.info -o coverage_stv -t "Coverage on main -- short test vectors @ $commit_sha" - artifacts: - name: "main-coverage-sha-$CI_COMMIT_SHORT_SHA" - when: always - expire_in: 1 week - paths: - - coverage.info - - coverage_stv.info - - coverage - - coverage_stv - -# --------------------------------------------------------------- -# Complexity measurement jobs -# --------------------------------------------------------------- - -.complexity-measurements-setup: - &complexity-measurements-setup # create necessary environment - - mkdir -p wmops/logs - - - job_id=$(python3 ci/get_id_of_last_job_occurence.py $CI_COMMIT_REF_NAME $CI_JOB_NAME $CI_PROJECT_ID) - - echo $job_id - - curl --request GET "https://forge.3gpp.org/rep/api/v4/projects/$CI_PROJECT_ID/jobs/$job_id/artifacts" --output artifacts.zip - - unzip artifacts.zip || true # this may fail on first run, when there are no artifacts there and the zip file is actually just "404"-html - - ls - - public_dir="$CI_JOB_NAME-public" - # if is needed to catch case when no artifact is there (first run), similarly as above - - if [[ -d $public_dir ]]; then mv $public_dir/* wmops/; fi - - ls wmops - - rm artifacts.zip - - rm -rf $public_dir - -.complexity-measurements-prepare-artifacts: - &complexity-measurements-prepare-artifacts # prepare artifacts -> move to public directory - - public_dir="$CI_JOB_NAME-public" - - mkdir $public_dir - - mv -f wmops/log_*_all.txt wmops/*.js ${public_dir}/ - # move logfiles for links - - mkdir $public_dir/logs - # first move logs - - log_files=$(cat $public_dir/graphs*.js | grep logFile | sed "s/.*\(wmops_newsletter_.*\.csv\).*/\1/g") - - echo $log_files - - ls wmops/logs - - for f in $log_files; do [ -f wmops/logs/$f ] && mv wmops/logs/$f $public_dir/logs/$f; done - # copy index page blueprint - - cp ci/complexity_measurements/index_complexity.html ${public_dir}/index.html - # patch the format in the title - - sed -i "s/IVAS FORMAT/IVAS $in_format to $out_format/g" ${public_dir}/index.html - # do separately here to avoid overwrite complaints by mv - - mv -f ci/complexity_measurements/style.css ${public_dir}/ - - ls $public_dir - -.complexity-template: - extends: - # still needed as long as no long MASA testvectors are there - - .test-job-linux-needs-testv-dir - tags: - - ivas-linux-fast - timeout: 3 hours 30 minutes - stage: test - before_script: - - *print-common-info - - *update-ltv-repo - - *complexity-measurements-setup - artifacts: - name: "$CI_JOB_NAME--$CI_COMMIT_REF_NAME--sha-$CI_COMMIT_SHA" - when: always - expire_in: 1 week - paths: - - $CI_JOB_NAME-public - -complexity-stereo-in-ext-out: - extends: - - .complexity-template - rules: - - if: $MEASURE_COMPLEXITY_LINUX - script: - - in_format=stereo - - out_format=ext - - ret_val=0 - - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? - - *complexity-measurements-prepare-artifacts - - exit $ret_val - -complexity-ism-in-binaural-out: - extends: - - .complexity-template - rules: - - if: $MEASURE_COMPLEXITY_LINUX - when: delayed - start_in: 1 hour - script: - - in_format=ISM - - out_format=BINAURAL - - ret_val=0 - - bash ci/complexity_measurements/getWmops.sh "ISM+1 ISM+2 ISM+3 ISM+4" "$out_format" || ret_val=$? - - *complexity-measurements-prepare-artifacts - - exit $ret_val - -complexity-ism-in-binaural_room_ir-out: - extends: - - .complexity-template - rules: - - if: $MEASURE_COMPLEXITY_LINUX - when: delayed - start_in: 2 hours - script: - - in_format=ISM - - out_format=BINAURAL_ROOM_IR - - ret_val=0 - - bash ci/complexity_measurements/getWmops.sh "ISM+1 ISM+2 ISM+3 ISM+4" "$out_format" || ret_val=$? - - *complexity-measurements-prepare-artifacts - - exit $ret_val - -complexity-ism-in-ext-out: - extends: - - .complexity-template - rules: - - if: $MEASURE_COMPLEXITY_LINUX - when: delayed - start_in: 3 hours - script: - - in_format=ISM - - out_format=EXT - - ret_val=0 - - bash ci/complexity_measurements/getWmops.sh "ISM+1 ISM+2 ISM+3 ISM+4" "$out_format" || ret_val=$? - - *complexity-measurements-prepare-artifacts - - exit $ret_val - -complexity-sba-hoa3-in-ext-out: - extends: - - .complexity-template - rules: - - if: $MEASURE_COMPLEXITY_LINUX - when: delayed - start_in: 4 hours - script: - - in_format=HOA3 - - out_format=EXT - - ret_val=0 - - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? - - *complexity-measurements-prepare-artifacts - - exit $ret_val - -complexity-sba-hoa3-in-binaural-out: - extends: - - .complexity-template - rules: - - if: $MEASURE_COMPLEXITY_LINUX - when: delayed - start_in: 5 hours - script: - - in_format=HOA3 - - out_format=BINAURAL - - ret_val=0 - - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? - - *complexity-measurements-prepare-artifacts - - exit $ret_val - -complexity-sba-hoa3-in-binaural_room_ir-out: - extends: - - .complexity-template - rules: - - if: $MEASURE_COMPLEXITY_LINUX - when: delayed - start_in: 6 hours - script: - - in_format=HOA3 - - out_format=BINAURAL_ROOM_IR - - ret_val=0 - - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? - - *complexity-measurements-prepare-artifacts - - exit $ret_val - -complexity-mc-in-ext-out: - extends: - - .complexity-template - rules: - - if: $MEASURE_COMPLEXITY_LINUX - when: delayed - start_in: 7 hours - script: - - in_format=MC - - out_format=EXT - - ret_val=0 - - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? - - *complexity-measurements-prepare-artifacts - - exit $ret_val - -complexity-mc-in-binaural-out: - extends: - - .complexity-template - rules: - - if: $MEASURE_COMPLEXITY_LINUX - when: delayed - start_in: 8 hours - script: - - in_format=MC - - out_format=BINAURAL - - ret_val=0 - - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? - - *complexity-measurements-prepare-artifacts - - exit $ret_val - -complexity-mc-in-binaural_room_ir-out: - extends: - - .complexity-template - rules: - - if: $MEASURE_COMPLEXITY_LINUX - when: delayed - start_in: 9 hours - script: - - in_format=MC - - out_format=BINAURAL_ROOM_IR - - ret_val=0 - - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? - - *complexity-measurements-prepare-artifacts - - exit $ret_val - -complexity-masa-in-ext-out: - extends: - - .complexity-template - rules: - - if: $MEASURE_COMPLEXITY_LINUX - when: delayed - start_in: 10 hours - script: - - in_format=MASA - - out_format=EXT - - ret_val=0 - - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? - - *complexity-measurements-prepare-artifacts - - exit $ret_val - -complexity-masa-in-binaural-out: - extends: - - .complexity-template - rules: - - if: $MEASURE_COMPLEXITY_LINUX - when: delayed - start_in: 11 hours - script: - - in_format=MASA - - out_format=BINAURAL - - ret_val=0 - - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? - - *complexity-measurements-prepare-artifacts - - exit $ret_val - -complexity-masa-in-hoa3-out: - extends: - - .complexity-template - rules: - - if: $MEASURE_COMPLEXITY_LINUX - when: delayed - start_in: 12 hours - script: - - in_format=MASA - - out_format=HOA3 - - ret_val=0 - - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? - - *complexity-measurements-prepare-artifacts - - exit $ret_val - -complexity-omasa-in-ext-out: - extends: - - .complexity-template - rules: - - if: $MEASURE_COMPLEXITY_LINUX - when: delayed - start_in: 13 hours - script: - - in_format=OMASA - - out_format=EXT - - ret_val=0 - - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? - - *complexity-measurements-prepare-artifacts - - exit $ret_val - -complexity-omasa-in-binaural-out: - extends: - - .complexity-template - rules: - - if: $MEASURE_COMPLEXITY_LINUX - when: delayed - start_in: 14 hours - script: - - in_format=OMASA - - out_format=BINAURAL - - ret_val=0 - - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? - - *complexity-measurements-prepare-artifacts - - exit $ret_val - -complexity-omasa-in-hoa3-out: - extends: - - .complexity-template - rules: - - if: $MEASURE_COMPLEXITY_LINUX - when: delayed - start_in: 15 hours - script: - - in_format=OMASA - - out_format=HOA3 - - ret_val=0 - - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? - - *complexity-measurements-prepare-artifacts - - exit $ret_val - -complexity-StereoDmxEVS-stereo-in-mono-out: - extends: - - .complexity-template - rules: - - if: $MEASURE_COMPLEXITY_LINUX - when: delayed - start_in: 16 hours - script: - - in_format=StereoDmxEVS - - out_format=mono - - ret_val=0 - - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? - - *complexity-measurements-prepare-artifacts - - exit $ret_val - -complexity-osba-in-ext-out: - extends: - - .complexity-template - rules: - - if: $MEASURE_COMPLEXITY_LINUX - when: delayed - start_in: 17 hours - script: - - in_format=OSBA - - out_format=EXT - - ret_val=0 - - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? - - *complexity-measurements-prepare-artifacts - - exit $ret_val - -complexity-osba-in-binaural-out: - extends: - - .complexity-template - rules: - - if: $MEASURE_COMPLEXITY_LINUX - when: delayed - start_in: 18 hours - script: - - in_format=OSBA - - out_format=BINAURAL - - ret_val=0 - - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? - - *complexity-measurements-prepare-artifacts - - exit $ret_val - -complexity-osba-in-binaural_room_ir-out: - extends: - - .complexity-template - rules: - - if: $MEASURE_COMPLEXITY_LINUX - when: delayed - start_in: 19 hours - script: - - in_format=OSBA - - out_format=BINAURAL_ROOM_IR - - ret_val=0 - - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? - - *complexity-measurements-prepare-artifacts - - exit $ret_val - -# --------------------------------------------------------------- -# Other jobs -# --------------------------------------------------------------- - -# job that sets up gitlab pages website -pages: - stage: deploy - tags: - - ivas-linux - rules: - - if: $UPDATE_PAGES - script: + - *update-scripts-repo - python3 ci/setup_pages.py + - ls + - ls public artifacts: paths: - public expire_in: 1 day - -# Pull state of a branch on 3GPP repo, push to a mirror repo. -pull-from-3gpp-forge: - stage: maintenance - rules: - - if: $MIRROR_ACCESS_TOKEN # Only run in the mirror update pipeline (only then MIRROR_ACCESS_TOKEN is defined) - script: - # Set up git LFS for mirroring (see: https://github.com/git-lfs/git-lfs/issues/1762) - - git lfs install --skip-smudge --local - - # Check out mirror branch - by default the runner checks out by commit hash, which results in detached head state - - git checkout $CI_COMMIT_BRANCH - - # Pull commits from upstream - - git remote add upstream https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec.git - - git pull --ff-only --tags upstream $MIRROR_SOURCE_BRANCH - - git lfs pull upstream - - # Push to mirror, include tags. Option `-o ci.skip` tells GitLab to skip CI for the pushed commits (assumed already tested upstream) - - git push --tags -o ci.skip "https://${GITLAB_USER_LOGIN}:${MIRROR_ACCESS_TOKEN}@${CI_REPOSITORY_URL#*@}" "HEAD:${CI_COMMIT_BRANCH}" -- GitLab From e005a5d0b60a40a71b2a2a25282858d2f0ce06af Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Fri, 23 Aug 2024 12:48:58 +0200 Subject: [PATCH 09/10] try isolating test_sba_plc_system tests --- .gitlab-ci.yml | 22 ++++++++++++++++++---- lib_com/options.h | 2 +- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6a77da6fa..e92e16e33 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -125,8 +125,15 @@ stages: - python3 tests/create_short_testvectors.py # create references - exit_code=0 - - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref --create_ref -n auto --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? - - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref_part2 -n auto --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? # Catch exit code to prevent halt in case this step produces zero tests + # - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref --create_ref -n auto --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? + - python3 -m pytest $TEST_SUITE -k "not test_sba_plc_system" -v --update_ref 1 -m create_ref --create_ref -n auto --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? + - python3 -m pytest $TEST_SUITE -k "test_sba_plc_system" -v --update_ref 1 -m create_ref --create_ref -n auto --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? + + # - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref_part2 -n auto --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? + - python3 -m pytest $TEST_SUITE -k "not test_sba_plc_system" -v --update_ref 1 -m create_ref_part2 -n auto --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? + - python3 -m pytest $TEST_SUITE -k "test_sba_plc_system" -v --update_ref 1 -m create_ref_part2 -n auto --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? + + # Catch exit code to prevent halt in case this step produces zero tests .update-scripts-repo: &update-scripts-repo @@ -258,9 +265,13 @@ stages: ### run pytest - exit_code=0 - - python3 -m pytest --tb=no $TEST_SUITE -v --create_cut --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld --ssnr --odg -n auto --testcase_timeout $testcase_timeout --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? + # - python3 -m pytest --tb=no $TEST_SUITE -v --create_cut --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld --ssnr --odg -n auto --testcase_timeout $testcase_timeout --ref_encoder_path $REF_ENCODER_PATH + - python3 -m pytest --tb=no $TEST_SUITE -v --create_cut -k "not test_sba_plc_system" --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld --ssnr --odg -n auto --testcase_timeout $testcase_timeout --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? + - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true + - python3 -m pytest --tb=no $TEST_SUITE -v --create_cut -k "test_sba_plc_system" --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld --ssnr --odg -n auto --testcase_timeout $testcase_timeout --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true + - python3 scripts/parse_xml_report.py report-junit.xml $CSV_ARTIFACT_NAME - mkdir $IMAGES_ARTIFACT_NAME - for MEASURE in MLD DIFF SSNR;do python3 scripts/create_histogram_summary.py $CSV_ARTIFACT_NAME $IMAGES_ARTIFACT_NAME/summary_"$MEASURE".csv $IMAGES_ARTIFACT_NAME/summary_"$MEASURE".png --measure $MEASURE; done @@ -431,7 +442,10 @@ stages: - make -j CLANG=$CLANG_NUM - if [[ $CLANG_NUM == 3 ]]; then export UBSAN_OPTIONS="suppressions=scripts/ubsan.supp,report_error_type=1"; fi - testcase_timeout=$TESTCASE_TIMEOUT_STV_SANITIZERS - - python3 -m pytest $SHORT_TEST_SUITE -v --tb=no --update_ref 1 -m create_ref --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout $testcase_timeout --ref_encoder_path $DUT_ENCODER_PATH --ref_decoder_path $DUT_DECODER_PATH + # - python3 -m pytest $SHORT_TEST_SUITE -v --tb=no --update_ref 1 -m create_ref --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout $testcase_timeout --ref_encoder_path $DUT_ENCODER_PATH --ref_decoder_path $DUT_DECODER_PATH + - python3 -m pytest $SHORT_TEST_SUITE -k "not test_sba_plc_system" -v --tb=no --update_ref 1 -m create_ref --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout $testcase_timeout --ref_encoder_path $DUT_ENCODER_PATH --ref_decoder_path $DUT_DECODER_PATH + - python3 -m pytest $SHORT_TEST_SUITE -k "test_sba_plc_system" -v --tb=no --update_ref 1 -m create_ref --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout $testcase_timeout --ref_encoder_path $DUT_ENCODER_PATH --ref_decoder_path $DUT_DECODER_PATH + artifacts: name: "$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA--results" when: always diff --git a/lib_com/options.h b/lib_com/options.h index 93b6f3293..cfb09c3ba 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -48,7 +48,7 @@ /* ################### Start DEBUGGING switches ########################### */ #ifndef RELEASE -/*#define DEBUGGING*/ /* Activate debugging part of the code */ +#define DEBUGGING /* Activate debugging part of the code */ #endif /*#define WMOPS*/ /* Activate complexity and memory counters */ /*#define WMOPS_PER_FRAME*/ /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */ -- GitLab From 1b33b073178aab3028ec654274e0c5a254ba74cb Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Tue, 3 Sep 2024 10:16:34 +0200 Subject: [PATCH 10/10] Update .gitlab-ci.yml --- .gitlab-ci.yml | 317 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 294 insertions(+), 23 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e92e16e33..7e1746bcc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,7 +7,7 @@ variables: SCRIPTS_DIR: "/usr/local/scripts" EXIT_CODE_NON_BE: 123 EXIT_CODE_FAIL: 1 - LONG_TEST_SUITE: "tests/codec_be_on_mr_nonselection tests/renderer --param_file scripts/config/self_test_ltv.prm" + LONG_TEST_SUITE: "tests/codec_be_on_mr_nonselection tests/renderer --param_file scripts/config/self_test_ltv.prm --use_ltv" SHORT_TEST_SUITE: "tests/codec_be_on_mr_nonselection" TEST_SUITE: "" DUT_ENCODER_PATH: "./IVAS_cod" @@ -26,6 +26,7 @@ variables: CI_REGRESSION_THRESH_SSNR: "-1" CI_REGRESSION_THRESH_ODG: "-0.05" GIT_CLEAN_FLAGS: -ffdxq + INSTR_DIR: "scripts/c-code_instrument" MANUAL_PIPELINE_TYPE: description: "Type for the manual pipeline run. Use 'pytest-compare' to run comparison test against reference float codec." value: 'default' @@ -37,6 +38,7 @@ variables: - 'evs-26444' - 'sanitizer-stv' - 'pytest-renderer' + - 'complexity' default: @@ -51,7 +53,7 @@ workflow: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' variables: IVAS_PIPELINE_NAME: 'MR pipeline: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME' - ### disabled for now because pipeline setup is redundant with MR pipeline with current workflow + ### disabled for now because pipeline cd is redundant with MR pipeline with current workflow # - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Pushes to main # variables: # IVAS_PIPELINE_NAME: 'Push pipeline: $CI_COMMIT_BRANCH' @@ -76,6 +78,9 @@ workflow: - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-renderer' variables: IVAS_PIPELINE_NAME: 'Renderer test: $CI_COMMIT_BRANCH' + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'complexity' + variables: + IVAS_PIPELINE_NAME: 'Complexity Measurement on $CI_COMMIT_BRANCH' - if: $CI_PIPELINE_SOURCE == 'schedule' # Scheduled in any branch variables: IVAS_PIPELINE_NAME: 'Scheduled pipeline: $CI_COMMIT_BRANCH' @@ -113,6 +118,7 @@ stages: - mv ./IVAS_rend ./IVAS_rend_ref ### build test binaries + - git restore . - git checkout $current_commit_sha - make clean - make -j @@ -125,16 +131,7 @@ stages: - python3 tests/create_short_testvectors.py # create references - exit_code=0 - # - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref --create_ref -n auto --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? - - python3 -m pytest $TEST_SUITE -k "not test_sba_plc_system" -v --update_ref 1 -m create_ref --create_ref -n auto --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? - - python3 -m pytest $TEST_SUITE -k "test_sba_plc_system" -v --update_ref 1 -m create_ref --create_ref -n auto --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? - - # - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref_part2 -n auto --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? - - python3 -m pytest $TEST_SUITE -k "not test_sba_plc_system" -v --update_ref 1 -m create_ref_part2 -n auto --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? - - python3 -m pytest $TEST_SUITE -k "test_sba_plc_system" -v --update_ref 1 -m create_ref_part2 -n auto --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? - - # Catch exit code to prevent halt in case this step produces zero tests - + - python3 -m pytest $TEST_SUITE -v --update_ref 1 --create_ref -n auto --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? .update-scripts-repo: &update-scripts-repo - cd $SCRIPTS_DIR @@ -265,13 +262,9 @@ stages: ### run pytest - exit_code=0 - # - python3 -m pytest --tb=no $TEST_SUITE -v --create_cut --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld --ssnr --odg -n auto --testcase_timeout $testcase_timeout --ref_encoder_path $REF_ENCODER_PATH - - python3 -m pytest --tb=no $TEST_SUITE -v --create_cut -k "not test_sba_plc_system" --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld --ssnr --odg -n auto --testcase_timeout $testcase_timeout --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? - - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true - - python3 -m pytest --tb=no $TEST_SUITE -v --create_cut -k "test_sba_plc_system" --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld --ssnr --odg -n auto --testcase_timeout $testcase_timeout --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? + - python3 -m pytest --tb=no $TEST_SUITE -v --create_cut --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld --ssnr --odg -n auto --testcase_timeout $testcase_timeout --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true - - python3 scripts/parse_xml_report.py report-junit.xml $CSV_ARTIFACT_NAME - mkdir $IMAGES_ARTIFACT_NAME - for MEASURE in MLD DIFF SSNR;do python3 scripts/create_histogram_summary.py $CSV_ARTIFACT_NAME $IMAGES_ARTIFACT_NAME/summary_"$MEASURE".csv $IMAGES_ARTIFACT_NAME/summary_"$MEASURE".png --measure $MEASURE; done @@ -442,10 +435,7 @@ stages: - make -j CLANG=$CLANG_NUM - if [[ $CLANG_NUM == 3 ]]; then export UBSAN_OPTIONS="suppressions=scripts/ubsan.supp,report_error_type=1"; fi - testcase_timeout=$TESTCASE_TIMEOUT_STV_SANITIZERS - # - python3 -m pytest $SHORT_TEST_SUITE -v --tb=no --update_ref 1 -m create_ref --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout $testcase_timeout --ref_encoder_path $DUT_ENCODER_PATH --ref_decoder_path $DUT_DECODER_PATH - - python3 -m pytest $SHORT_TEST_SUITE -k "not test_sba_plc_system" -v --tb=no --update_ref 1 -m create_ref --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout $testcase_timeout --ref_encoder_path $DUT_ENCODER_PATH --ref_decoder_path $DUT_DECODER_PATH - - python3 -m pytest $SHORT_TEST_SUITE -k "test_sba_plc_system" -v --tb=no --update_ref 1 -m create_ref --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout $testcase_timeout --ref_encoder_path $DUT_ENCODER_PATH --ref_decoder_path $DUT_DECODER_PATH - + - python3 -m pytest $SHORT_TEST_SUITE -v --tb=no --update_ref 1 --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout $testcase_timeout --ref_encoder_path $DUT_ENCODER_PATH --ref_decoder_path $DUT_DECODER_PATH artifacts: name: "$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA--results" when: always @@ -544,10 +534,12 @@ build-codec-linux-instrumented-make: when: never extends: - .build-job-linux + timeout: "7 minutes" script: - *print-common-info - - sed -i".bak" "s/\/\*#define WMOPS 1\*\//#define WMOPS 1/g" lib_com/count.h - - make -j + - *update-scripts-repo + - bash scripts/prepare_instrumentation.sh -m MEM_ONLY -p BASOP + - make -j -C $INSTR_DIR # --------------------------------------------------------------- # Short test jobs that run in merge request pipelines @@ -914,6 +906,285 @@ ivas-pytest-renderer: <<: *ivas-pytest-anchor +# --------------------------------------------------------------- +# Complexity measurement jobs +# --------------------------------------------------------------- + +.complexity-measurements-setup: + &complexity-measurements-setup # create necessary environment + ### 1. part: mainly same as in float repo - this is boilerplate code to make the gitlab pages presentation work + - mkdir -p wmops/logs + + - job_id=$(python3 ci/get_id_of_last_job_occurence.py $CI_COMMIT_REF_NAME $CI_JOB_NAME $CI_PROJECT_ID) + - echo $job_id + - curl --request GET "https://forge.3gpp.org/rep/api/v4/projects/$CI_PROJECT_ID/jobs/$job_id/artifacts" --output artifacts.zip + - unzip artifacts.zip || true # this may fail on first run, when there are no artifacts there and the zip file is actually just "404"-html + - ls + - public_dir="$CI_JOB_NAME-public" + # if is needed to catch case when no artifact is there (first run), similarly as above + - if [[ -d $public_dir ]]; then mv $public_dir/* wmops/; fi + - ls wmops + - rm artifacts.zip + - rm -rf $public_dir + + ### 2. part: setup specific for BASOP repo + # hack for using the reference encoder -> need to build manually to make script use ref enc and BASOP dec + - mkdir COMPLEXITY + - cp IVAS_cod_ref COMPLEXITY/IVAS_cod + # build branch code aain with instrumentation + - make clean + - bash scripts/prepare_instrumentation.sh -p BASOP -m MEM_ONLY + - make -j -C $INSTR_DIR + - cp $INSTR_DIR/IVAS_dec COMPLEXITY/IVAS_dec + +.complexity-measurements-prepare-artifacts: + &complexity-measurements-prepare-artifacts # prepare artifacts -> move to public directory + - public_dir="$CI_JOB_NAME-public" + - mkdir $public_dir + - mv -f wmops/log_*_all.txt wmops/*.js ${public_dir}/ + # move logfiles for links + - mkdir $public_dir/logs + # first move logs + - log_files=$(cat $public_dir/graphs*.js | grep logFile | sed "s/.*\(wmops_newsletter_.*\.csv\).*/\1/g") + - echo $log_files + - ls wmops/logs + - for f in $log_files; do [ -f wmops/logs/$f ] && mv wmops/logs/$f $public_dir/logs/$f; done + # copy index page blueprint + - cp ci/complexity_measurements/index_complexity.html ${public_dir}/index.html + # patch the format in the title + - sed -i "s/IVAS FORMAT/IVAS $in_format to $out_format/g" ${public_dir}/index.html + # do separately here to avoid overwrite complaints by mv + - mv -f ci/complexity_measurements/style.css ${public_dir}/ + - ls $public_dir + +.complexity-template: + extends: + - .test-job-linux + timeout: 3 hours 30 minutes + stage: test + variables: + ret_val: 0 + before_script: + - *print-common-info + - *update-scripts-repo + - *update-ltv-repo + - *build-reference-and-dut-binaries + - *complexity-measurements-setup + - which coan + artifacts: + name: "$CI_JOB_NAME--$CI_COMMIT_REF_NAME--sha-$CI_COMMIT_SHA" + when: always + expire_in: 1 week + paths: + - $CI_JOB_NAME-public + +complexity-stereo-in-stereo-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + script: + - in_format=stereo + - out_format=stereo + - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" mem_only || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + +# complexity-stereo-in-7_1_4-out: +# extends: +# - .complexity-template +# rules: +# - if: $MEASURE_COMPLEXITY_LINUX +# script: +# - in_format=stereo +# - out_format=7_1_4 +# - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? +# - *complexity-measurements-prepare-artifacts +# - exit $ret_val + +# complexity-ism-in-ext-out: +# extends: +# - .complexity-template +# rules: +# - if: $MEASURE_COMPLEXITY_LINUX +# # when: delayed: +# # start_in: 1 hours +# script: +# - in_format=ISM +# - out_format=EXT +# - bash ci/complexity_measurements/getWmops.sh "ISM+1 ISM+2 ISM+3 ISM+4" "$out_format" || ret_val=$? +# - *complexity-measurements-prepare-artifacts +# - exit $ret_val + +# complexity-ism-in-binaural-out: +# extends: +# - .complexity-template +# rules: +# - if: $MEASURE_COMPLEXITY_LINUX +# # when: delayed: +# # start_in: 1 hours +# script: +# - in_format=ISM +# - out_format=BINAURAL BINAURAL_ROOM_IR BINAURAL_ROOM_REVERB +# - bash ci/complexity_measurements/getWmops.sh "ISM+1 ISM+2 ISM+3 ISM+4" "$out_format" || ret_val=$? +# - *complexity-measurements-prepare-artifacts +# - exit $ret_val + +# complexity-hoa3-in-hoa3-out: +# extends: +# - .complexity-template +# rules: +# - if: $MEASURE_COMPLEXITY_LINUX +# # when: delayed: +# # start_in: 2 hours +# script: +# - in_format=HOA3 +# - out_format=HOA3 +# - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? +# - *complexity-measurements-prepare-artifacts +# - exit $ret_val + +# complexity-hoa3-in-binaural-out: +# extends: +# - .complexity-template +# rules: +# - if: $MEASURE_COMPLEXITY_LINUX +# # when: delayed: +# # start_in: 2 hours +# script: +# - in_format=HOA3 +# - out_format=BINAURAL BINAURAL_ROOM_IR BINAURAL_ROOM_REVERB +# - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? +# - *complexity-measurements-prepare-artifacts +# - exit $ret_val + +# complexity-osba-in-ext-out: +# extends: +# - .complexity-template +# rules: +# - if: $MEASURE_COMPLEXITY_LINUX +# # when: delayed: +# # start_in: 2 hours +# script: +# - in_format=OSBA +# - out_format=EXT +# - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? +# - *complexity-measurements-prepare-artifacts +# - exit $ret_val + +# complexity-osba-in-binaural-out: +# extends: +# - .complexity-template +# rules: +# - if: $MEASURE_COMPLEXITY_LINUX +# # when: delayed: +# # start_in: 2 hours +# script: +# - in_format=OSBA +# - out_format=BINAURAL BINAURAL_ROOM_IR BINAURAL_ROOM_REVERB +# - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? +# - *complexity-measurements-prepare-artifacts +# - exit $ret_val + +# complexity-mc-in-7_1_4-out: +# extends: +# - .complexity-template +# rules: +# - if: $MEASURE_COMPLEXITY_LINUX +# # when: delayed: +# # start_in: 2 hours +# script: +# - in_format=MC +# - out_format=7_1_4 +# - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? +# - *complexity-measurements-prepare-artifacts +# - exit $ret_val + +# complexity-mc-in-binaural-out: +# extends: +# - .complexity-template +# rules: +# - if: $MEASURE_COMPLEXITY_LINUX +# # when: delayed: +# # start_in: 2 hours +# script: +# - in_format=MC +# - out_format=BINAURAL BINAURAL_ROOM_IR BINAURAL_ROOM_REVERB +# - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? +# - *complexity-measurements-prepare-artifacts +# - exit $ret_val + +# complexity-masa-in-ext-out: +# extends: +# - .complexity-template +# rules: +# - if: $MEASURE_COMPLEXITY_LINUX +# # when: delayed: +# # start_in: 2 hours +# script: +# - in_format=MASA +# - out_format=EXT +# - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? +# - *complexity-measurements-prepare-artifacts +# - exit $ret_val + +# complexity-masa-in-binaural-out: +# extends: +# - .complexity-template +# rules: +# - if: $MEASURE_COMPLEXITY_LINUX +# # when: delayed: +# # start_in: 2 hours +# script: +# - in_format=MASA +# - out_format="BINAURAL BINAURAL_ROOM_IR BINAURAL_ROOM_REVERB" +# - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? +# - *complexity-measurements-prepare-artifacts +# - exit $ret_val + +# complexity-omasa-in-ext-out: +# extends: +# - .complexity-template +# rules: +# - if: $MEASURE_COMPLEXITY_LINUX +# # when: delayed: +# # start_in: 2 hours +# script: +# - in_format=OMASA +# - out_format=EXT +# - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? +# - *complexity-measurements-prepare-artifacts +# - exit $ret_val + +# complexity-omasa-in-binaural-out: +# extends: +# - .complexity-template +# rules: +# - if: $MEASURE_COMPLEXITY_LINUX +# # when: delayed: +# # start_in: 2 hours +# script: +# - in_format=OMASA +# - out_format="BINAURAL BINAURAL_ROOM_IR BINAURAL_ROOM_REVERB" +# - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? +# - *complexity-measurements-prepare-artifacts +# - exit $ret_val + +# complexity-StereoDmxEVS-stereo-in-mono-out: +# extends: +# - .complexity-template +# rules: +# - if: $MEASURE_COMPLEXITY_LINUX +# # when: delayed: +# # start_in: 2 hours +# script: +# - in_format=StereoDmxEVS +# - out_format=mono +# - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? +# - *complexity-measurements-prepare-artifacts +# - exit $ret_val + + # job that sets up gitlab pages website pages: stage: deploy -- GitLab