Loading lib_com/ivas_prot.h +8 −2 Original line number Diff line number Diff line Loading @@ -4489,8 +4489,11 @@ void ivas_calc_c_p_coeffs( const int16_t num_dmx, const int16_t band_idx, const int16_t dtx_vad, const int16_t compute_p_flag, const int16_t compute_p_flag #ifndef FIX_280_PLANAR_CP , const int16_t planarCP #endif ); void ivas_get_spar_md_from_dirac( Loading Loading @@ -4957,8 +4960,11 @@ void ivas_copy_band_coeffs_idx_to_arr( const int16_t nB, int16_t *pSymbol_re, ivas_cell_dim_t *pCell_dims, const ivas_coeffs_type_t coeff_type, const ivas_coeffs_type_t coeff_type #ifndef FIX_280_PLANAR_CP , const int16_t planarCP #endif ); void ivas_clear_band_coeffs( Loading lib_com/ivas_spar_com.c +16 −5 Original line number Diff line number Diff line Loading @@ -1253,10 +1253,16 @@ void ivas_calc_c_p_coeffs( const int16_t num_dmx, const int16_t band_idx, const int16_t dtx_vad, const int16_t compute_p_flag, const int16_t planarCP ) const int16_t compute_p_flag #ifndef FIX_280_PLANAR_CP , const int16_t planarCP #endif ) { #ifndef FIX_280_PLANAR_CP int16_t i, j; #endif float postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; if ( num_dmx != num_ch ) Loading @@ -1267,7 +1273,7 @@ void ivas_calc_c_p_coeffs( { ivas_calc_c_coeffs_per_band( pSparMd, i_ts, postpred_cov_re, num_ch, num_dmx, band_idx, dtx_vad ); } #ifndef FIX_280_PLANAR_CP if ( planarCP ) { for ( i = 0; i < num_ch - num_dmx; i++ ) Loading @@ -1281,12 +1287,12 @@ void ivas_calc_c_p_coeffs( } } } #endif if ( compute_p_flag == 1 ) { ivas_calc_p_coeffs_per_band( pSparMd, i_ts, postpred_cov_re, num_ch, dtx_vad, num_dmx, band_idx ); } #ifndef FIX_280_PLANAR_CP if ( planarCP ) { for ( i = num_dmx; i < num_ch; i++ ) Loading @@ -1297,6 +1303,7 @@ void ivas_calc_c_p_coeffs( } } } #endif } return; Loading Loading @@ -1611,7 +1618,11 @@ void ivas_compute_spar_params( if ( ndm != num_ch ) { #ifndef FIX_280_PLANAR_CP ivas_calc_c_p_coeffs( hSparMd, cov_real, i_ts, mixer_mat, num_ch, ndm, b, dtx_vad, 1, 0 ); #else ivas_calc_c_p_coeffs( hSparMd, cov_real, i_ts, mixer_mat, num_ch, ndm, b, dtx_vad, 1 ); #endif #ifdef SPAR_HOA_DBG /* if (b == 0) */ Loading lib_com/ivas_spar_com_quant_util.c +12 −2 Original line number Diff line number Diff line Loading @@ -243,11 +243,17 @@ void ivas_copy_band_coeffs_idx_to_arr( const int16_t nB, int16_t *pSymbol_re, ivas_cell_dim_t *pCell_dims, const ivas_coeffs_type_t coeff_type, const int16_t planarCP ) const ivas_coeffs_type_t coeff_type #ifndef FIX_280_PLANAR_CP , const int16_t planarCP #endif ) { int16_t i, len; #ifndef FIX_280_PLANAR_CP int16_t j, k; #endif int16_t *pPtr_idx = NULL; for ( i = 0; i < nB; i++ ) Loading Loading @@ -277,10 +283,13 @@ void ivas_copy_band_coeffs_idx_to_arr( len = pCell_dims[i].dim1 * pCell_dims[i].dim2; if ( ( coeff_type != DECX_COEFF ) ) { #ifndef FIX_280_PLANAR_CP if ( ( coeff_type == PRED_COEFF ) || !planarCP ) { #endif mvs2s( pPtr_idx, pSymbol_re, len ); pSymbol_re += len; #ifndef FIX_280_PLANAR_CP } else { Loading @@ -295,6 +304,7 @@ void ivas_copy_band_coeffs_idx_to_arr( } pSymbol_re += k; } #endif } } Loading lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,7 @@ #define FIX_383_CLEAN_UP /* Dlb : Clean up of unused functions */ // #define FIX_532_ISM_MD_INACTIVE /* VA: issue 532: improve MD coding in ISM inactive frames */ #define FIX_547_NAN_IGF_DEC /* FhG: issue 547: fix possible nan in IGF decoder */ #define FIX_280_PLANAR_CP /* Dlb : fix issue 28 : remove planarCP=1 related code*/ /* ################## End DEVELOPMENT switches ######################### */ Loading lib_dec/ivas_spar_md_dec.c +116 −22 Original line number Diff line number Diff line Loading @@ -63,13 +63,21 @@ static const int16_t ivas_spar_dec_plc_spatial_target[IVAS_SPAR_MAX_CH] = { 1, 0 *------------------------------------------------------------------------------------------*/ static void ivas_get_spar_matrices( ivas_spar_md_dec_state_t *hMdDec, const int16_t num_bands_out, const int16_t n_ts, const int16_t bw, const int16_t dtx_vad, const int16_t nB, const int16_t numch_out, const int16_t active_w_vlbr ); #ifndef FIX_280_PLANAR_CP static void ivas_decode_arith_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, const uint16_t qsi, const int16_t nB, const int16_t bands_bw, int16_t *pDo_diff, const int16_t freq_diff, const int16_t planarCP, const int16_t strat, const int32_t ivas_total_brate ); static void ivas_decode_huffman_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, const uint16_t qsi, const int16_t nB, const int16_t bands_bw, const int16_t planarCP ); static void ivas_fill_band_coeffs_idx( ivas_band_coeffs_ind_t *pBands_idx, const int16_t nB, int16_t *pSymbol_re, ivas_cell_dim_t *pCell_dims, ivas_coeffs_type_t coeff_type, const int16_t planarCP ); #else static void ivas_decode_arith_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, const uint16_t qsi, const int16_t nB, const int16_t bands_bw, int16_t *pDo_diff, const int16_t freq_diff, const int16_t strat, const int32_t ivas_total_brate ); static void ivas_decode_huffman_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, const uint16_t qsi, const int16_t nB, const int16_t bands_bw ); static void ivas_fill_band_coeffs_idx( ivas_band_coeffs_ind_t *pBands_idx, const int16_t nB, int16_t *pSymbol_re, ivas_cell_dim_t *pCell_dims, ivas_coeffs_type_t coeff_type ); #endif static void ivas_get_band_idx_from_differential( ivas_spar_md_t *pSpar_md, const int16_t q_levels[2], const int16_t one_sided, const int16_t nB, const ivas_coeffs_type_t coeff_type ); static void ivas_mat_col_rearrange( float in_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], const int16_t order[IVAS_SPAR_MAX_CH], const int16_t i_ts, float ***mixer_mat, const int16_t bands, const int16_t num_ch ); Loading @@ -84,7 +92,12 @@ static void ivas_parse_parameter_bitstream_dtx( ivas_spar_md_t *pSpar_md, Decode static ivas_error ivas_deindex_real_index( const int16_t *index, const int16_t q_levels, const float min_value, const float max_value, float *quant, const int16_t num_ch_dim2 ); #ifndef FIX_280_PLANAR_CP static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, int16_t *nB, int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, const int16_t use_planar_coeff, const int16_t sba_inactive_mode, const int32_t last_active_brate ); #else static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, int16_t *nB, int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, const int16_t sba_inactive_mode, const int32_t last_active_brate ); #endif /*------------------------------------------------------------------------- Loading Loading @@ -675,8 +688,10 @@ void ivas_spar_md_dec_process( ivas_spar_dec_parse_md_bs( hMdDec, st0, &nB, &bw, &dtx_vad, st_ivas->hDecoderConfig->ivas_total_brate, ivas_spar_br_table_consts[hMdDec->table_idx].usePlanarCoeff, st_ivas->hQMetaData->sba_inactive_mode, st_ivas->last_active_ivas_total_brate ); #ifndef FIX_280_PLANAR_CP ivas_spar_br_table_consts[hMdDec->table_idx].usePlanarCoeff, #endif st_ivas->hQMetaData->sba_inactive_mode, st_ivas->last_active_ivas_total_brate ); #if 0 { Loading Loading @@ -1697,7 +1712,9 @@ static void ivas_spar_dec_parse_md_bs( int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, #ifndef FIX_280_PLANAR_CP const int16_t use_planar_coeff, #endif const int16_t sba_inactive_mode, const int32_t last_active_brate ) { Loading @@ -1707,7 +1724,9 @@ static void ivas_spar_dec_parse_md_bs( ivas_quant_strat_t qs; int16_t strat, freq_diff, no_ec; int16_t do_diff[IVAS_MAX_NUM_BANDS]; #ifndef FIX_280_PLANAR_CP int16_t planarCP; #endif float quant[IVAS_SPAR_MAX_C_COEFF]; int16_t do_repeat[IVAS_MAX_NUM_BANDS]; int16_t bw_final, bw_fact; Loading Loading @@ -1819,7 +1838,7 @@ static void ivas_spar_dec_parse_md_bs( } qs = hMdDec->spar_md_cfg.quant_strat[qsi]; #ifndef FIX_280_PLANAR_CP planarCP = 0; if ( ( qsi == 2 ) && ( use_planar_coeff ) ) { Loading @@ -1828,6 +1847,7 @@ static void ivas_spar_dec_parse_md_bs( fprintf( stdout, "planarCP = 1\n" ); #endif } #endif strat = get_next_indice( st0, 3 ); #ifdef SPAR_HOA_DBG Loading Loading @@ -1888,12 +1908,20 @@ static void ivas_spar_dec_parse_md_bs( if ( no_ec == 0 ) { ivas_decode_arith_bs( hMdDec, st0, qsi, *nB, *bands_bw, do_diff, freq_diff, planarCP, ivas_decode_arith_bs( hMdDec, st0, qsi, *nB, *bands_bw, do_diff, freq_diff, #ifndef FIX_280_PLANAR_CP planarCP, #endif strat, ivas_total_brate ); } else { ivas_decode_huffman_bs( hMdDec, st0, qsi, *nB, *bands_bw, planarCP ); ivas_decode_huffman_bs( hMdDec, st0, qsi, *nB, *bands_bw #ifndef FIX_280_PLANAR_CP , planarCP #endif ); } for ( i = 0; i < *nB; i++ ) Loading Loading @@ -2036,7 +2064,9 @@ static void ivas_decode_arith_bs( const int16_t bands_bw, int16_t *pDo_diff, const int16_t freq_diff, #ifndef FIX_280_PLANAR_CP const int16_t planarCP, #endif const int16_t strat, const int32_t ivas_total_brate ) { Loading Loading @@ -2111,13 +2141,23 @@ static void ivas_decode_arith_bs( } } } ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, pred_cell_dims, PRED_COEFF, planarCP ); ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, pred_cell_dims, PRED_COEFF #ifndef FIX_280_PLANAR_CP , planarCP #endif ); } ivas_arith_decode_cmplx_cell_array( &hMdDec->arith_coeffs.pred_arith_re[qsi], &hMdDec->arith_coeffs.pred_arith_re_diff[qsi], st0, pred_cell_dims, pDo_diff, nB, symbol_arr_re, symbol_arr_old_re ); ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, pred_cell_dims, PRED_COEFF, planarCP ); ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, pred_cell_dims, PRED_COEFF #ifndef FIX_280_PLANAR_CP , planarCP #endif ); if ( hMdDec->spar_hoa_md_flag && hMdDec->spar_hoa_dirac2spar_md_flag ) { Loading @@ -2140,9 +2180,14 @@ static void ivas_decode_arith_bs( if ( any_diff == 1 ) { ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, drct_cell_dims, DRCT_COEFF, planarCP ); ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, drct_cell_dims, DRCT_COEFF #ifndef FIX_280_PLANAR_CP , planarCP #endif ); } #ifndef FIX_280_PLANAR_CP if ( planarCP ) { for ( i = 0; i < nB; i++ ) Loading @@ -2150,17 +2195,27 @@ static void ivas_decode_arith_bs( drct_cell_dims[i].dim1 = drct_cell_dims[i].dim1 - IVAS_SPAR_HOA3_NP_CHS; } } #endif ivas_arith_decode_cmplx_cell_array( &hMdDec->arith_coeffs.drct_arith_re[qsi], &hMdDec->arith_coeffs.drct_arith_re_diff[qsi], st0, drct_cell_dims, pDo_diff, nB, symbol_arr_re, symbol_arr_old_re ); ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, drct_cell_dims, DRCT_COEFF, planarCP ); ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, drct_cell_dims, DRCT_COEFF #ifndef FIX_280_PLANAR_CP , planarCP #endif ); if ( any_diff == 1 ) { ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, decd_cell_dims, DECD_COEFF, planarCP ); ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, decd_cell_dims, DECD_COEFF #ifndef FIX_280_PLANAR_CP , planarCP #endif ); } #ifndef FIX_280_PLANAR_CP if ( planarCP ) { for ( i = 0; i < nB; i++ ) Loading @@ -2168,18 +2223,33 @@ static void ivas_decode_arith_bs( decd_cell_dims[i].dim1 = decd_cell_dims[i].dim1 - IVAS_SPAR_HOA3_NP_CHS; } } #endif ivas_arith_decode_cmplx_cell_array( &hMdDec->arith_coeffs.decd_arith_re[qsi], &hMdDec->arith_coeffs.decd_arith_re_diff[qsi], st0, decd_cell_dims, pDo_diff, nB, symbol_arr_re, symbol_arr_old_re ); ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, decd_cell_dims, DECD_COEFF, planarCP ); ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, decd_cell_dims, DECD_COEFF #ifndef FIX_280_PLANAR_CP , planarCP #endif ); if ( any_diff == 1 ) { ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, decx_cell_dims, DECX_COEFF, planarCP ); ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, decx_cell_dims, DECX_COEFF #ifndef FIX_280_PLANAR_CP , planarCP #endif ); } ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, decx_cell_dims, DECX_COEFF, planarCP ); ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, decx_cell_dims, DECX_COEFF #ifndef FIX_280_PLANAR_CP , planarCP #endif ); if ( freq_diff == 1 ) { Loading Loading @@ -2291,10 +2361,18 @@ static void ivas_fill_band_coeffs_idx( const int16_t nB, int16_t *pSymbol_re, ivas_cell_dim_t *pCell_dims, const ivas_coeffs_type_t coeff_type, const int16_t planarCP ) const ivas_coeffs_type_t coeff_type #ifndef FIX_280_PLANAR_CP , const int16_t planarCP #endif ) { #ifndef FIX_280_PLANAR_CP int16_t i, j, k, len; #else int16_t i, len; #endif int16_t *pPtr_idx = NULL; for ( i = 0; i < nB; i++ ) Loading Loading @@ -2327,11 +2405,14 @@ static void ivas_fill_band_coeffs_idx( if ( coeff_type != DECX_COEFF ) { #ifndef FIX_280_PLANAR_CP if ( ( coeff_type == PRED_COEFF ) || !planarCP ) { #endif len = pCell_dims[i].dim1 * pCell_dims[i].dim2; mvs2s( pSymbol_re, pPtr_idx, len ); pSymbol_re += len; #ifndef FIX_280_PLANAR_CP } else { Loading @@ -2351,6 +2432,7 @@ static void ivas_fill_band_coeffs_idx( } pSymbol_re += k; } #endif } } Loading @@ -2369,8 +2451,12 @@ static void ivas_decode_huffman_bs( Decoder_State *st0, /* i/o: decoder state structure - for bitstream handling*/ const uint16_t qsi, const int16_t nB, const int16_t bands_bw, const int16_t planarCP ) const int16_t bands_bw #ifndef FIX_280_PLANAR_CP , const int16_t planarCP #endif ) { int16_t i, j; int16_t ndm, ndec; Loading Loading @@ -2412,26 +2498,34 @@ static void ivas_decode_huffman_bs( for ( j = 0; j < drct_dim; j++ ) { #ifndef FIX_280_PLANAR_CP if ( planarCP && !keep_planar[(int16_t) floor( j / ( ndm - 1 ) )] ) { hMdDec->spar_md.band_coeffs_idx[i].drct_index_re[j] = 0; } else { #endif ivas_huffman_decode( &hMdDec->huff_coeffs.drct_huff_re[qsi], st0, &hMdDec->spar_md.band_coeffs_idx[i].drct_index_re[j] ); #ifndef FIX_280_PLANAR_CP } #endif } for ( j = 0; j < decd_dim; j++ ) { #ifndef FIX_280_PLANAR_CP if ( planarCP && !keep_planar[j] ) { hMdDec->spar_md.band_coeffs_idx[i].decd_index_re[j] = 0; } else { #endif ivas_huffman_decode( &hMdDec->huff_coeffs.decd_huff_re[qsi], st0, &hMdDec->spar_md.band_coeffs_idx[i].decd_index_re[j] ); #ifndef FIX_280_PLANAR_CP } #endif } } Loading Loading
lib_com/ivas_prot.h +8 −2 Original line number Diff line number Diff line Loading @@ -4489,8 +4489,11 @@ void ivas_calc_c_p_coeffs( const int16_t num_dmx, const int16_t band_idx, const int16_t dtx_vad, const int16_t compute_p_flag, const int16_t compute_p_flag #ifndef FIX_280_PLANAR_CP , const int16_t planarCP #endif ); void ivas_get_spar_md_from_dirac( Loading Loading @@ -4957,8 +4960,11 @@ void ivas_copy_band_coeffs_idx_to_arr( const int16_t nB, int16_t *pSymbol_re, ivas_cell_dim_t *pCell_dims, const ivas_coeffs_type_t coeff_type, const ivas_coeffs_type_t coeff_type #ifndef FIX_280_PLANAR_CP , const int16_t planarCP #endif ); void ivas_clear_band_coeffs( Loading
lib_com/ivas_spar_com.c +16 −5 Original line number Diff line number Diff line Loading @@ -1253,10 +1253,16 @@ void ivas_calc_c_p_coeffs( const int16_t num_dmx, const int16_t band_idx, const int16_t dtx_vad, const int16_t compute_p_flag, const int16_t planarCP ) const int16_t compute_p_flag #ifndef FIX_280_PLANAR_CP , const int16_t planarCP #endif ) { #ifndef FIX_280_PLANAR_CP int16_t i, j; #endif float postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; if ( num_dmx != num_ch ) Loading @@ -1267,7 +1273,7 @@ void ivas_calc_c_p_coeffs( { ivas_calc_c_coeffs_per_band( pSparMd, i_ts, postpred_cov_re, num_ch, num_dmx, band_idx, dtx_vad ); } #ifndef FIX_280_PLANAR_CP if ( planarCP ) { for ( i = 0; i < num_ch - num_dmx; i++ ) Loading @@ -1281,12 +1287,12 @@ void ivas_calc_c_p_coeffs( } } } #endif if ( compute_p_flag == 1 ) { ivas_calc_p_coeffs_per_band( pSparMd, i_ts, postpred_cov_re, num_ch, dtx_vad, num_dmx, band_idx ); } #ifndef FIX_280_PLANAR_CP if ( planarCP ) { for ( i = num_dmx; i < num_ch; i++ ) Loading @@ -1297,6 +1303,7 @@ void ivas_calc_c_p_coeffs( } } } #endif } return; Loading Loading @@ -1611,7 +1618,11 @@ void ivas_compute_spar_params( if ( ndm != num_ch ) { #ifndef FIX_280_PLANAR_CP ivas_calc_c_p_coeffs( hSparMd, cov_real, i_ts, mixer_mat, num_ch, ndm, b, dtx_vad, 1, 0 ); #else ivas_calc_c_p_coeffs( hSparMd, cov_real, i_ts, mixer_mat, num_ch, ndm, b, dtx_vad, 1 ); #endif #ifdef SPAR_HOA_DBG /* if (b == 0) */ Loading
lib_com/ivas_spar_com_quant_util.c +12 −2 Original line number Diff line number Diff line Loading @@ -243,11 +243,17 @@ void ivas_copy_band_coeffs_idx_to_arr( const int16_t nB, int16_t *pSymbol_re, ivas_cell_dim_t *pCell_dims, const ivas_coeffs_type_t coeff_type, const int16_t planarCP ) const ivas_coeffs_type_t coeff_type #ifndef FIX_280_PLANAR_CP , const int16_t planarCP #endif ) { int16_t i, len; #ifndef FIX_280_PLANAR_CP int16_t j, k; #endif int16_t *pPtr_idx = NULL; for ( i = 0; i < nB; i++ ) Loading Loading @@ -277,10 +283,13 @@ void ivas_copy_band_coeffs_idx_to_arr( len = pCell_dims[i].dim1 * pCell_dims[i].dim2; if ( ( coeff_type != DECX_COEFF ) ) { #ifndef FIX_280_PLANAR_CP if ( ( coeff_type == PRED_COEFF ) || !planarCP ) { #endif mvs2s( pPtr_idx, pSymbol_re, len ); pSymbol_re += len; #ifndef FIX_280_PLANAR_CP } else { Loading @@ -295,6 +304,7 @@ void ivas_copy_band_coeffs_idx_to_arr( } pSymbol_re += k; } #endif } } Loading
lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,7 @@ #define FIX_383_CLEAN_UP /* Dlb : Clean up of unused functions */ // #define FIX_532_ISM_MD_INACTIVE /* VA: issue 532: improve MD coding in ISM inactive frames */ #define FIX_547_NAN_IGF_DEC /* FhG: issue 547: fix possible nan in IGF decoder */ #define FIX_280_PLANAR_CP /* Dlb : fix issue 28 : remove planarCP=1 related code*/ /* ################## End DEVELOPMENT switches ######################### */ Loading
lib_dec/ivas_spar_md_dec.c +116 −22 Original line number Diff line number Diff line Loading @@ -63,13 +63,21 @@ static const int16_t ivas_spar_dec_plc_spatial_target[IVAS_SPAR_MAX_CH] = { 1, 0 *------------------------------------------------------------------------------------------*/ static void ivas_get_spar_matrices( ivas_spar_md_dec_state_t *hMdDec, const int16_t num_bands_out, const int16_t n_ts, const int16_t bw, const int16_t dtx_vad, const int16_t nB, const int16_t numch_out, const int16_t active_w_vlbr ); #ifndef FIX_280_PLANAR_CP static void ivas_decode_arith_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, const uint16_t qsi, const int16_t nB, const int16_t bands_bw, int16_t *pDo_diff, const int16_t freq_diff, const int16_t planarCP, const int16_t strat, const int32_t ivas_total_brate ); static void ivas_decode_huffman_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, const uint16_t qsi, const int16_t nB, const int16_t bands_bw, const int16_t planarCP ); static void ivas_fill_band_coeffs_idx( ivas_band_coeffs_ind_t *pBands_idx, const int16_t nB, int16_t *pSymbol_re, ivas_cell_dim_t *pCell_dims, ivas_coeffs_type_t coeff_type, const int16_t planarCP ); #else static void ivas_decode_arith_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, const uint16_t qsi, const int16_t nB, const int16_t bands_bw, int16_t *pDo_diff, const int16_t freq_diff, const int16_t strat, const int32_t ivas_total_brate ); static void ivas_decode_huffman_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, const uint16_t qsi, const int16_t nB, const int16_t bands_bw ); static void ivas_fill_band_coeffs_idx( ivas_band_coeffs_ind_t *pBands_idx, const int16_t nB, int16_t *pSymbol_re, ivas_cell_dim_t *pCell_dims, ivas_coeffs_type_t coeff_type ); #endif static void ivas_get_band_idx_from_differential( ivas_spar_md_t *pSpar_md, const int16_t q_levels[2], const int16_t one_sided, const int16_t nB, const ivas_coeffs_type_t coeff_type ); static void ivas_mat_col_rearrange( float in_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], const int16_t order[IVAS_SPAR_MAX_CH], const int16_t i_ts, float ***mixer_mat, const int16_t bands, const int16_t num_ch ); Loading @@ -84,7 +92,12 @@ static void ivas_parse_parameter_bitstream_dtx( ivas_spar_md_t *pSpar_md, Decode static ivas_error ivas_deindex_real_index( const int16_t *index, const int16_t q_levels, const float min_value, const float max_value, float *quant, const int16_t num_ch_dim2 ); #ifndef FIX_280_PLANAR_CP static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, int16_t *nB, int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, const int16_t use_planar_coeff, const int16_t sba_inactive_mode, const int32_t last_active_brate ); #else static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, int16_t *nB, int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, const int16_t sba_inactive_mode, const int32_t last_active_brate ); #endif /*------------------------------------------------------------------------- Loading Loading @@ -675,8 +688,10 @@ void ivas_spar_md_dec_process( ivas_spar_dec_parse_md_bs( hMdDec, st0, &nB, &bw, &dtx_vad, st_ivas->hDecoderConfig->ivas_total_brate, ivas_spar_br_table_consts[hMdDec->table_idx].usePlanarCoeff, st_ivas->hQMetaData->sba_inactive_mode, st_ivas->last_active_ivas_total_brate ); #ifndef FIX_280_PLANAR_CP ivas_spar_br_table_consts[hMdDec->table_idx].usePlanarCoeff, #endif st_ivas->hQMetaData->sba_inactive_mode, st_ivas->last_active_ivas_total_brate ); #if 0 { Loading Loading @@ -1697,7 +1712,9 @@ static void ivas_spar_dec_parse_md_bs( int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, #ifndef FIX_280_PLANAR_CP const int16_t use_planar_coeff, #endif const int16_t sba_inactive_mode, const int32_t last_active_brate ) { Loading @@ -1707,7 +1724,9 @@ static void ivas_spar_dec_parse_md_bs( ivas_quant_strat_t qs; int16_t strat, freq_diff, no_ec; int16_t do_diff[IVAS_MAX_NUM_BANDS]; #ifndef FIX_280_PLANAR_CP int16_t planarCP; #endif float quant[IVAS_SPAR_MAX_C_COEFF]; int16_t do_repeat[IVAS_MAX_NUM_BANDS]; int16_t bw_final, bw_fact; Loading Loading @@ -1819,7 +1838,7 @@ static void ivas_spar_dec_parse_md_bs( } qs = hMdDec->spar_md_cfg.quant_strat[qsi]; #ifndef FIX_280_PLANAR_CP planarCP = 0; if ( ( qsi == 2 ) && ( use_planar_coeff ) ) { Loading @@ -1828,6 +1847,7 @@ static void ivas_spar_dec_parse_md_bs( fprintf( stdout, "planarCP = 1\n" ); #endif } #endif strat = get_next_indice( st0, 3 ); #ifdef SPAR_HOA_DBG Loading Loading @@ -1888,12 +1908,20 @@ static void ivas_spar_dec_parse_md_bs( if ( no_ec == 0 ) { ivas_decode_arith_bs( hMdDec, st0, qsi, *nB, *bands_bw, do_diff, freq_diff, planarCP, ivas_decode_arith_bs( hMdDec, st0, qsi, *nB, *bands_bw, do_diff, freq_diff, #ifndef FIX_280_PLANAR_CP planarCP, #endif strat, ivas_total_brate ); } else { ivas_decode_huffman_bs( hMdDec, st0, qsi, *nB, *bands_bw, planarCP ); ivas_decode_huffman_bs( hMdDec, st0, qsi, *nB, *bands_bw #ifndef FIX_280_PLANAR_CP , planarCP #endif ); } for ( i = 0; i < *nB; i++ ) Loading Loading @@ -2036,7 +2064,9 @@ static void ivas_decode_arith_bs( const int16_t bands_bw, int16_t *pDo_diff, const int16_t freq_diff, #ifndef FIX_280_PLANAR_CP const int16_t planarCP, #endif const int16_t strat, const int32_t ivas_total_brate ) { Loading Loading @@ -2111,13 +2141,23 @@ static void ivas_decode_arith_bs( } } } ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, pred_cell_dims, PRED_COEFF, planarCP ); ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, pred_cell_dims, PRED_COEFF #ifndef FIX_280_PLANAR_CP , planarCP #endif ); } ivas_arith_decode_cmplx_cell_array( &hMdDec->arith_coeffs.pred_arith_re[qsi], &hMdDec->arith_coeffs.pred_arith_re_diff[qsi], st0, pred_cell_dims, pDo_diff, nB, symbol_arr_re, symbol_arr_old_re ); ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, pred_cell_dims, PRED_COEFF, planarCP ); ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, pred_cell_dims, PRED_COEFF #ifndef FIX_280_PLANAR_CP , planarCP #endif ); if ( hMdDec->spar_hoa_md_flag && hMdDec->spar_hoa_dirac2spar_md_flag ) { Loading @@ -2140,9 +2180,14 @@ static void ivas_decode_arith_bs( if ( any_diff == 1 ) { ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, drct_cell_dims, DRCT_COEFF, planarCP ); ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, drct_cell_dims, DRCT_COEFF #ifndef FIX_280_PLANAR_CP , planarCP #endif ); } #ifndef FIX_280_PLANAR_CP if ( planarCP ) { for ( i = 0; i < nB; i++ ) Loading @@ -2150,17 +2195,27 @@ static void ivas_decode_arith_bs( drct_cell_dims[i].dim1 = drct_cell_dims[i].dim1 - IVAS_SPAR_HOA3_NP_CHS; } } #endif ivas_arith_decode_cmplx_cell_array( &hMdDec->arith_coeffs.drct_arith_re[qsi], &hMdDec->arith_coeffs.drct_arith_re_diff[qsi], st0, drct_cell_dims, pDo_diff, nB, symbol_arr_re, symbol_arr_old_re ); ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, drct_cell_dims, DRCT_COEFF, planarCP ); ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, drct_cell_dims, DRCT_COEFF #ifndef FIX_280_PLANAR_CP , planarCP #endif ); if ( any_diff == 1 ) { ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, decd_cell_dims, DECD_COEFF, planarCP ); ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, decd_cell_dims, DECD_COEFF #ifndef FIX_280_PLANAR_CP , planarCP #endif ); } #ifndef FIX_280_PLANAR_CP if ( planarCP ) { for ( i = 0; i < nB; i++ ) Loading @@ -2168,18 +2223,33 @@ static void ivas_decode_arith_bs( decd_cell_dims[i].dim1 = decd_cell_dims[i].dim1 - IVAS_SPAR_HOA3_NP_CHS; } } #endif ivas_arith_decode_cmplx_cell_array( &hMdDec->arith_coeffs.decd_arith_re[qsi], &hMdDec->arith_coeffs.decd_arith_re_diff[qsi], st0, decd_cell_dims, pDo_diff, nB, symbol_arr_re, symbol_arr_old_re ); ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, decd_cell_dims, DECD_COEFF, planarCP ); ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, decd_cell_dims, DECD_COEFF #ifndef FIX_280_PLANAR_CP , planarCP #endif ); if ( any_diff == 1 ) { ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, decx_cell_dims, DECX_COEFF, planarCP ); ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, decx_cell_dims, DECX_COEFF #ifndef FIX_280_PLANAR_CP , planarCP #endif ); } ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, decx_cell_dims, DECX_COEFF, planarCP ); ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, decx_cell_dims, DECX_COEFF #ifndef FIX_280_PLANAR_CP , planarCP #endif ); if ( freq_diff == 1 ) { Loading Loading @@ -2291,10 +2361,18 @@ static void ivas_fill_band_coeffs_idx( const int16_t nB, int16_t *pSymbol_re, ivas_cell_dim_t *pCell_dims, const ivas_coeffs_type_t coeff_type, const int16_t planarCP ) const ivas_coeffs_type_t coeff_type #ifndef FIX_280_PLANAR_CP , const int16_t planarCP #endif ) { #ifndef FIX_280_PLANAR_CP int16_t i, j, k, len; #else int16_t i, len; #endif int16_t *pPtr_idx = NULL; for ( i = 0; i < nB; i++ ) Loading Loading @@ -2327,11 +2405,14 @@ static void ivas_fill_band_coeffs_idx( if ( coeff_type != DECX_COEFF ) { #ifndef FIX_280_PLANAR_CP if ( ( coeff_type == PRED_COEFF ) || !planarCP ) { #endif len = pCell_dims[i].dim1 * pCell_dims[i].dim2; mvs2s( pSymbol_re, pPtr_idx, len ); pSymbol_re += len; #ifndef FIX_280_PLANAR_CP } else { Loading @@ -2351,6 +2432,7 @@ static void ivas_fill_band_coeffs_idx( } pSymbol_re += k; } #endif } } Loading @@ -2369,8 +2451,12 @@ static void ivas_decode_huffman_bs( Decoder_State *st0, /* i/o: decoder state structure - for bitstream handling*/ const uint16_t qsi, const int16_t nB, const int16_t bands_bw, const int16_t planarCP ) const int16_t bands_bw #ifndef FIX_280_PLANAR_CP , const int16_t planarCP #endif ) { int16_t i, j; int16_t ndm, ndec; Loading Loading @@ -2412,26 +2498,34 @@ static void ivas_decode_huffman_bs( for ( j = 0; j < drct_dim; j++ ) { #ifndef FIX_280_PLANAR_CP if ( planarCP && !keep_planar[(int16_t) floor( j / ( ndm - 1 ) )] ) { hMdDec->spar_md.band_coeffs_idx[i].drct_index_re[j] = 0; } else { #endif ivas_huffman_decode( &hMdDec->huff_coeffs.drct_huff_re[qsi], st0, &hMdDec->spar_md.band_coeffs_idx[i].drct_index_re[j] ); #ifndef FIX_280_PLANAR_CP } #endif } for ( j = 0; j < decd_dim; j++ ) { #ifndef FIX_280_PLANAR_CP if ( planarCP && !keep_planar[j] ) { hMdDec->spar_md.band_coeffs_idx[i].decd_index_re[j] = 0; } else { #endif ivas_huffman_decode( &hMdDec->huff_coeffs.decd_huff_re[qsi], st0, &hMdDec->spar_md.band_coeffs_idx[i].decd_index_re[j] ); #ifndef FIX_280_PLANAR_CP } #endif } } Loading