Loading lib_com/bitstream_fx.c +7 −3 Original line number Diff line number Diff line Loading @@ -389,13 +389,15 @@ UWord16 get_next_indice_fx( /* o : value of the indice */ { UWord16 value; Word16 i; Word32 nbits_total; assert(nb_bits <= 16); value = 0; move16(); nbits_total = st_fx->total_brate / FRAMES_PER_SEC; /* detect corrupted bitstream */ IF(GT_16(add(st_fx->next_bit_pos, nb_bits), st_fx->total_num_bits)) IF(GT_16(add(st_fx->next_bit_pos, nb_bits), nbits_total)) { st_fx->BER_detect = 1; move16(); Loading Loading @@ -423,12 +425,14 @@ UWord16 get_next_indice_1_fx( /* o : value of the indice */ Decoder_State *st_fx /* i/o: decoder state structure */ ) { Word32 nbits_total; nbits_total = st_fx->total_brate / FRAMES_PER_SEC; /* detect corrupted bitstream */ test(); test(); test(); IF((GT_16(add(st_fx->next_bit_pos, 1), st_fx->total_num_bits) && EQ_16(st_fx->codec_mode, MODE1)) || (GT_16(add(st_fx->next_bit_pos, 1), add(st_fx->total_num_bits, 2 * 8)) && EQ_16(st_fx->codec_mode, MODE2)) /* add two zero bytes for arithmetic coder flush */ IF((GT_16(add(st_fx->next_bit_pos, 1), nbits_total) && EQ_16(st_fx->codec_mode, MODE1)) || (GT_16(add(st_fx->next_bit_pos, 1), add(nbits_total, 2 * 8)) && EQ_16(st_fx->codec_mode, MODE2)) /* add two zero bytes for arithmetic coder flush */ ) { st_fx->BER_detect = 1; Loading lib_com/prot.h +4 −4 Original line number Diff line number Diff line Loading @@ -6706,13 +6706,13 @@ void enc_acelp_tcx_main( void getTCXMode_ivas( Decoder_State *st, /* i/o: decoder memory state */ Decoder_State *st0, /* i : bitstream */ const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ ); void getTCXWindowing_ivas( const int16_t core, /* i : current frame mode */ const int16_t last_core, /* i : last frame mode */ const int16_t element_mode, /* i : element mode */ const Word16 core, /* i : current frame mode */ const Word16 last_core, /* i : last frame mode */ const Word16 element_mode, /* i : element mode */ TCX_CONFIG_HANDLE hTcxCfg, /* i/o: TCX configuration handle */ Decoder_State *st0 /* i : bitstream */ ); Loading lib_com/prot_fx2.h +21 −0 Original line number Diff line number Diff line Loading @@ -985,6 +985,10 @@ UWord16 get_next_indice_1( /* o : value of the indice */ Decoder_State *st_fx /* i/o: decoder state structure */ ); UWord16 get_next_indice_1_fx( /* o : value of the indice */ Decoder_State *st_fx /* i/o: decoder state structure */ ); void get_next_indice_tmp_fx( Decoder_State *st_fx, /* i/o: decoder state structure */ Word16 nb_bits /* i : number of bits that were used to quantize the indice */ Loading Loading @@ -7264,6 +7268,13 @@ void dec_prm( Word16 *bitsRead ); void getLPCparam( Decoder_State *st, /* i/o: decoder memory state */ Word16 param_lpc[], /* o : LTP parameters */ Decoder_State *st0, /* i : bitstream */ const Word16 ch, /* i : channel */ const Word16 sns_low_br_mode /* i : SNS low-bitrate mode */ ); //ari_hm_fx.c void UnmapIndex( Loading Loading @@ -7451,6 +7462,16 @@ Word16 decode_lpc_avq( #endif ); //decode_lpc_avq declaration with IVAS_CODE_AVQ_LPC enabled Word16 decode_lpc_avq_ivas( Decoder_State *st, /* i/o: decoder state structure */ const Word16 numlpc, /* i : Number of sets of lpc */ Word16 *param_lpc /* o : lpc parameters */ , const Word16 ch, /* i : channel */ const Word16 element_mode, /* i : element mode */ const Word16 sns_low_br_mode /* i : SNS low-bitrate mode */ ); //vlpc_1st_dec_fx.c void vlpc_1st_dec( Word16 index, /* i : codebook index */ Loading lib_dec/dec_prm.c +101 −45 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ #include "rom_com.h" #include "prot.h" #include "wmc_auto.h" #include "prot_fx2.h" /*-------------------------------------------------------------------* * getTCXMode_ivas() Loading @@ -52,133 +52,175 @@ void getTCXMode_ivas( Decoder_State *st, /* i/o: decoder memory state */ Decoder_State *st0, /* i : bitstream */ const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ) { uint16_t ind; UWord16 ind; if ( st->tcxonly ) IF ( st->tcxonly ) { /* get core */ #ifdef IVAS_FLOAT_FIXED ind = get_next_indice_fx( st0, 1 ); /* Store decoder memory of last_core */ #else ind = get_next_indice( st0, 1 ); st->core = ind + TCX_20_CORE; #endif // IVAS_FLOAT_FIXED st->core =add( ind , TCX_20_CORE); /* get class */ #ifdef IVAS_FLOAT_FIXED ind = get_next_indice_fx( st0, 2 ); #else ind = get_next_indice( st0, 2 ); #endif // IVAS_FLOAT_FIXED st->clas_dec = ONSET; if ( ind == 0 ) IF ( ind == 0 ) { st->clas_dec = UNVOICED_CLAS; } else if ( ind == 1 ) ELSE IF ( ind == 1 ) { if ( st->last_good >= VOICED_TRANSITION ) IF (GE_16( st->last_good , VOICED_TRANSITION )) { st->clas_dec = VOICED_TRANSITION; } else ELSE { st->clas_dec = UNVOICED_TRANSITION; } } else if ( ind == 2 ) ELSE IF ( ind == 2 ) { st->clas_dec = VOICED_CLAS; } st->coder_type = INACTIVE; if ( st->element_mode == IVAS_CPE_MDCT && !MCT_flag ) IF ( EQ_16( st->element_mode , IVAS_CPE_MDCT ) && !MCT_flag ) { #ifdef IVAS_FLOAT_FIXED st->VAD = get_next_indice_fx( st0, 1 ); #else st->VAD = get_next_indice( st0, 1 ); #endif // IVAS_FLOAT_FIXED } else ELSE { st->VAD = 0; } } else ELSE { if ( st->mdct_sw == MODE1 ) IF ( EQ_16( st->mdct_sw , MODE1 ) ) { /* 2 bits instead of 3 as TCX is already signaled */ st->core = TCX_20_CORE; #ifdef IVAS_FLOAT_FIXED st->hTcxCfg->coder_type = get_next_indice_fx( st0, 2 ); #else st->hTcxCfg->coder_type = get_next_indice( st0, 2 ); #endif // IVAS_FLOAT_FIXED st->coder_type = st->hTcxCfg->coder_type; } else ELSE { if ( st->mdct_sw_enable == MODE2 ) IF ( EQ_16( st->mdct_sw_enable , MODE2 ) ) { if ( get_next_indice_1( st0 ) ) /* TCX */ #ifdef IVAS_FLOAT_FIXED IF( get_next_indice_1_fx( st0 ) ) #else IF ( get_next_indice_1( st0 ) ) /* TCX */ #endif // IVAS_FLOAT_FIXED { #ifdef IVAS_FLOAT_FIXED ind = get_next_indice_fx( st0, 3 ); #else ind = get_next_indice( st0, 3 ); #endif assert( !( ind & 4 ) || !"HQ_CORE encountered in dec_prm_ivas" ); st->core = TCX_20_CORE; st->hTcxCfg->coder_type = ind; st->coder_type = st->hTcxCfg->coder_type; } else /* ACELP */ ELSE /* ACELP */ { st->core = ACELP_CORE; #ifdef IVAS_FLOAT_FIXED st->coder_type = get_next_indice_fx( st0, 2 ); #else st->coder_type = get_next_indice( st0, 2 ); #endif // IVAS_FLOAT_FIXED } } else ELSE { if ( st->rf_flag == 1 ) IF ( EQ_16( st->rf_flag , 1 ) ) { if ( !st->use_partial_copy ) IF ( !st->use_partial_copy ) { #ifdef IVAS_FLOAT_FIXED ind = get_next_indice_fx( st0, 1 ); #else ind = get_next_indice( st0, 1 ); if ( ind == 0 ) #endif // IVAS_FLOAT_FIXED IF ( ind == 0 ) { st->core = ACELP_CORE; } else ELSE { st->core = TCX_20_CORE; st->hTcxCfg->coder_type = st->coder_type; } } } else ELSE { #ifdef IVAS_FLOAT_FIXED ind = get_next_indice_fx( st, 3 ); #else ind = get_next_indice( st, 3 ); if ( ind < ACELP_MODE_MAX ) #endif // IVAS_FLOAT_FIXED IF (LT_16( ind , ACELP_MODE_MAX )) { st->core = ACELP_CORE; st->coder_type = ind; } else ELSE { st->core = TCX_20_CORE; st->hTcxCfg->coder_type = ind - ACELP_MODE_MAX; st->hTcxCfg->coder_type =sub( ind , ACELP_MODE_MAX ); st->coder_type = st->hTcxCfg->coder_type; } } } } if ( st->element_mode == EVS_MONO ) IF(EQ_16( st->element_mode , EVS_MONO )) { if ( st->igf && st->core == ACELP_CORE ) IF ( st->igf && EQ_16( st->core , ACELP_CORE ) ) { #ifdef IVAS_FLOAT_FIXED st->bits_frame_core = sub( st->bits_frame_core, get_tbe_bits_fx( st->total_brate, st->bwidth, st->rf_flag ) ); #else st->bits_frame_core -= get_tbe_bits( st->total_brate, st->bwidth, st->rf_flag ); #endif // IVAS_FLOAT_FIXED } if ( st->rf_flag ) IF ( st->rf_flag ) { st->bits_frame_core -= ( st->rf_target_bits + 1 ); /* +1 as flag-bit not considered in rf_target_bits */ st->bits_frame_core = sub( st->bits_frame_core, add( st->rf_target_bits , 1 ) ); /* +1 as flag-bit not considered in rf_target_bits */ } } /* Inactive frame detection on non-DTX mode */ if ( st->coder_type == INACTIVE ) IF(EQ_16( st->coder_type , INACTIVE )) { st->VAD = 0; } else ELSE { st->VAD = 1; } Loading @@ -186,7 +228,7 @@ void getTCXMode_ivas( /*Core extended mode mapping for correct PLC classification*/ st->core_ext_mode = st->coder_type; if ( st->coder_type == INACTIVE ) IF(EQ_16( st->coder_type , INACTIVE )) { st->core_ext_mode = UNVOICED; } Loading @@ -202,29 +244,29 @@ void getTCXMode_ivas( *--------------------------------------------------------------------*/ void getTCXWindowing_ivas( const int16_t core, /* i : current core */ const int16_t last_core, /* i : last frame core */ const int16_t element_mode, /* i : element mode */ const Word16 core, /* i : current core */ const Word16 last_core, /* i : last frame core */ const Word16 element_mode, /* i : element mode */ TCX_CONFIG_HANDLE hTcxCfg, /* i/o: TCX configuration handle */ Decoder_State *st0 /* i : bitstream */ ) { int16_t overlap_code; Word16 overlap_code; /* Set the last overlap mode based on the previous and current frame type and coded overlap mode */ if ( last_core == ACELP_CORE || last_core == AMR_WB_CORE ) IF( EQ_16( last_core, ACELP_CORE ) || EQ_16( last_core, AMR_WB_CORE ) ) { hTcxCfg->tcx_last_overlap_mode = TRANSITION_OVERLAP; } else if ( core == TCX_10_CORE && hTcxCfg->tcx_curr_overlap_mode == ALDO_WINDOW ) ELSE IF( EQ_16( core, TCX_10_CORE ) && EQ_16( hTcxCfg->tcx_curr_overlap_mode, ALDO_WINDOW ) ) { hTcxCfg->tcx_last_overlap_mode = FULL_OVERLAP; } else if ( core != TCX_10_CORE && hTcxCfg->tcx_curr_overlap_mode == FULL_OVERLAP ) ELSE IF( NE_16( core, TCX_10_CORE ) && EQ_16( hTcxCfg->tcx_curr_overlap_mode, FULL_OVERLAP ) ) { hTcxCfg->tcx_last_overlap_mode = ALDO_WINDOW; } else ELSE { hTcxCfg->tcx_last_overlap_mode = hTcxCfg->tcx_curr_overlap_mode; } Loading @@ -232,33 +274,47 @@ void getTCXWindowing_ivas( /* Set the current overlap mode based on the current frame type and coded overlap mode */ hTcxCfg->tcx_curr_overlap_mode = ALDO_WINDOW; if ( core != ACELP_CORE ) IF( NE_16( core, ACELP_CORE ) ) { overlap_code = 0; #ifdef IVAS_FLOAT_FIXED IF( get_next_indice_fx( st0, 1 ) ) { overlap_code = add( 2, get_next_indice_fx( st0, 1 ) ); } #else if ( get_next_indice( st0, 1 ) ) { overlap_code = 2 + get_next_indice( st0, 1 ); } #endif assert( MIN_OVERLAP == 2 && HALF_OVERLAP == 3 ); hTcxCfg->tcx_curr_overlap_mode = overlap_code; /*TCX10 : always symmetric windows*/ if ( core == TCX_20_CORE && overlap_code == 0 && last_core != ACELP_CORE && last_core != AMR_WB_CORE ) IF( EQ_16( core, TCX_20_CORE ) && EQ_16( overlap_code, 0 ) && NE_16( last_core, ACELP_CORE ) && NE_16( last_core, AMR_WB_CORE ) ) { hTcxCfg->tcx_curr_overlap_mode = ALDO_WINDOW; } } if ( element_mode != EVS_MONO && core == TCX_10_CORE ) IF( NE_16( element_mode, EVS_MONO ) && EQ_16( core, TCX_10_CORE ) ) { /* also read last overlap */ overlap_code = 0; #ifdef IVAS_FLOAT_FIXED IF( get_next_indice_fx( st0, 1 ) ) { overlap_code = add( 2, get_next_indice_fx( st0, 1 ) ); } #else if ( get_next_indice( st0, 1 ) ) { overlap_code = 2 + get_next_indice( st0, 1 ); } #endif hTcxCfg->tcx_last_overlap_mode = overlap_code; } Loading lib_dec/dec_prm_fx.c +79 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,85 @@ #include "prot_fx2.h" #include "basop_util.h" /*-------------------------------------------------------------------* * getLPCparam_ivas() * * get LPC parameters *--------------------------------------------------------------------*/ void getLPCparam( Decoder_State *st, /* i/o: decoder memory state */ Word16 param_lpc[], /* o : LTP parameters */ Decoder_State *st0, /* i : bitstream */ const Word16 ch, /* i : channel */ const Word16 sns_low_br_mode /* i : SNS low-bitrate mode */ ) { IF( EQ_16( st->use_partial_copy, 0 ) ) { /* Number of sets of LPC parameters (does not include mid-lpc) */ IF( ( st->tcxonly, 0 ) || LT_16( st->core, TCX_10_CORE ) ) { st->numlpc = 1; } ELSE { st->numlpc = 2; } /* Decode LPC parameters */ IF( st->hTcxDec->enableTcxLpc && NE_16( st->core, ACELP_CORE ) ) { Word16 tcx_lpc_cdk; tcx_lpc_cdk = tcxlpc_get_cdk( st->coder_type ); dec_lsf_tcxlpc( st0, ¶m_lpc, st->narrowBand, tcx_lpc_cdk ); } ELSE { IF( EQ_16( st->lpcQuantization, 0 ) ) { decode_lpc_avq_ivas( st0, st->numlpc, param_lpc, ch, st->element_mode, sns_low_br_mode ); } ELSE IF( EQ_16( st->lpcQuantization, 1 ) ) { IF( EQ_32( st->sr_core, INT_FS_16k ) && EQ_16( st->coder_type, VOICED ) && EQ_16( st->core, ACELP_CORE ) ) { assert( EQ_16( st->element_mode, EVS_MONO ) ); lsf_bctcvq_decprm( st0, param_lpc ); } ELSE { lsf_msvq_ma_decprm( st0, param_lpc ); } } ELSE { assert( 0 ); } } } ELSE { st->numlpc = 1; IF( EQ_16( st->rf_frame_type, RF_TCXFD ) ) { param_lpc[0] = 0; param_lpc[1] = get_next_indice_fx( st0, lsf_numbits[0] ); /* VQ 1 */ param_lpc[2] = get_next_indice_fx( st0, lsf_numbits[1] ); /* VQ 2 */ param_lpc[3] = get_next_indice_fx( st0, lsf_numbits[2] ); /* VQ 3 */ } ELSE IF( GE_16( st->rf_frame_type, RF_ALLPRED ) && LE_16( st->rf_frame_type, RF_NELP ) ) { /* LSF indices */ param_lpc[0] = get_next_indice_fx( st0, 8 ); /* VQ 1 */ param_lpc[1] = get_next_indice_fx( st0, 8 ); /* VQ 2 */ } } return; } static void dec_prm_hm( Decoder_State *st, Word16 *prm_hm, Loading Loading
lib_com/bitstream_fx.c +7 −3 Original line number Diff line number Diff line Loading @@ -389,13 +389,15 @@ UWord16 get_next_indice_fx( /* o : value of the indice */ { UWord16 value; Word16 i; Word32 nbits_total; assert(nb_bits <= 16); value = 0; move16(); nbits_total = st_fx->total_brate / FRAMES_PER_SEC; /* detect corrupted bitstream */ IF(GT_16(add(st_fx->next_bit_pos, nb_bits), st_fx->total_num_bits)) IF(GT_16(add(st_fx->next_bit_pos, nb_bits), nbits_total)) { st_fx->BER_detect = 1; move16(); Loading Loading @@ -423,12 +425,14 @@ UWord16 get_next_indice_1_fx( /* o : value of the indice */ Decoder_State *st_fx /* i/o: decoder state structure */ ) { Word32 nbits_total; nbits_total = st_fx->total_brate / FRAMES_PER_SEC; /* detect corrupted bitstream */ test(); test(); test(); IF((GT_16(add(st_fx->next_bit_pos, 1), st_fx->total_num_bits) && EQ_16(st_fx->codec_mode, MODE1)) || (GT_16(add(st_fx->next_bit_pos, 1), add(st_fx->total_num_bits, 2 * 8)) && EQ_16(st_fx->codec_mode, MODE2)) /* add two zero bytes for arithmetic coder flush */ IF((GT_16(add(st_fx->next_bit_pos, 1), nbits_total) && EQ_16(st_fx->codec_mode, MODE1)) || (GT_16(add(st_fx->next_bit_pos, 1), add(nbits_total, 2 * 8)) && EQ_16(st_fx->codec_mode, MODE2)) /* add two zero bytes for arithmetic coder flush */ ) { st_fx->BER_detect = 1; Loading
lib_com/prot.h +4 −4 Original line number Diff line number Diff line Loading @@ -6706,13 +6706,13 @@ void enc_acelp_tcx_main( void getTCXMode_ivas( Decoder_State *st, /* i/o: decoder memory state */ Decoder_State *st0, /* i : bitstream */ const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ ); void getTCXWindowing_ivas( const int16_t core, /* i : current frame mode */ const int16_t last_core, /* i : last frame mode */ const int16_t element_mode, /* i : element mode */ const Word16 core, /* i : current frame mode */ const Word16 last_core, /* i : last frame mode */ const Word16 element_mode, /* i : element mode */ TCX_CONFIG_HANDLE hTcxCfg, /* i/o: TCX configuration handle */ Decoder_State *st0 /* i : bitstream */ ); Loading
lib_com/prot_fx2.h +21 −0 Original line number Diff line number Diff line Loading @@ -985,6 +985,10 @@ UWord16 get_next_indice_1( /* o : value of the indice */ Decoder_State *st_fx /* i/o: decoder state structure */ ); UWord16 get_next_indice_1_fx( /* o : value of the indice */ Decoder_State *st_fx /* i/o: decoder state structure */ ); void get_next_indice_tmp_fx( Decoder_State *st_fx, /* i/o: decoder state structure */ Word16 nb_bits /* i : number of bits that were used to quantize the indice */ Loading Loading @@ -7264,6 +7268,13 @@ void dec_prm( Word16 *bitsRead ); void getLPCparam( Decoder_State *st, /* i/o: decoder memory state */ Word16 param_lpc[], /* o : LTP parameters */ Decoder_State *st0, /* i : bitstream */ const Word16 ch, /* i : channel */ const Word16 sns_low_br_mode /* i : SNS low-bitrate mode */ ); //ari_hm_fx.c void UnmapIndex( Loading Loading @@ -7451,6 +7462,16 @@ Word16 decode_lpc_avq( #endif ); //decode_lpc_avq declaration with IVAS_CODE_AVQ_LPC enabled Word16 decode_lpc_avq_ivas( Decoder_State *st, /* i/o: decoder state structure */ const Word16 numlpc, /* i : Number of sets of lpc */ Word16 *param_lpc /* o : lpc parameters */ , const Word16 ch, /* i : channel */ const Word16 element_mode, /* i : element mode */ const Word16 sns_low_br_mode /* i : SNS low-bitrate mode */ ); //vlpc_1st_dec_fx.c void vlpc_1st_dec( Word16 index, /* i : codebook index */ Loading
lib_dec/dec_prm.c +101 −45 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ #include "rom_com.h" #include "prot.h" #include "wmc_auto.h" #include "prot_fx2.h" /*-------------------------------------------------------------------* * getTCXMode_ivas() Loading @@ -52,133 +52,175 @@ void getTCXMode_ivas( Decoder_State *st, /* i/o: decoder memory state */ Decoder_State *st0, /* i : bitstream */ const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ) { uint16_t ind; UWord16 ind; if ( st->tcxonly ) IF ( st->tcxonly ) { /* get core */ #ifdef IVAS_FLOAT_FIXED ind = get_next_indice_fx( st0, 1 ); /* Store decoder memory of last_core */ #else ind = get_next_indice( st0, 1 ); st->core = ind + TCX_20_CORE; #endif // IVAS_FLOAT_FIXED st->core =add( ind , TCX_20_CORE); /* get class */ #ifdef IVAS_FLOAT_FIXED ind = get_next_indice_fx( st0, 2 ); #else ind = get_next_indice( st0, 2 ); #endif // IVAS_FLOAT_FIXED st->clas_dec = ONSET; if ( ind == 0 ) IF ( ind == 0 ) { st->clas_dec = UNVOICED_CLAS; } else if ( ind == 1 ) ELSE IF ( ind == 1 ) { if ( st->last_good >= VOICED_TRANSITION ) IF (GE_16( st->last_good , VOICED_TRANSITION )) { st->clas_dec = VOICED_TRANSITION; } else ELSE { st->clas_dec = UNVOICED_TRANSITION; } } else if ( ind == 2 ) ELSE IF ( ind == 2 ) { st->clas_dec = VOICED_CLAS; } st->coder_type = INACTIVE; if ( st->element_mode == IVAS_CPE_MDCT && !MCT_flag ) IF ( EQ_16( st->element_mode , IVAS_CPE_MDCT ) && !MCT_flag ) { #ifdef IVAS_FLOAT_FIXED st->VAD = get_next_indice_fx( st0, 1 ); #else st->VAD = get_next_indice( st0, 1 ); #endif // IVAS_FLOAT_FIXED } else ELSE { st->VAD = 0; } } else ELSE { if ( st->mdct_sw == MODE1 ) IF ( EQ_16( st->mdct_sw , MODE1 ) ) { /* 2 bits instead of 3 as TCX is already signaled */ st->core = TCX_20_CORE; #ifdef IVAS_FLOAT_FIXED st->hTcxCfg->coder_type = get_next_indice_fx( st0, 2 ); #else st->hTcxCfg->coder_type = get_next_indice( st0, 2 ); #endif // IVAS_FLOAT_FIXED st->coder_type = st->hTcxCfg->coder_type; } else ELSE { if ( st->mdct_sw_enable == MODE2 ) IF ( EQ_16( st->mdct_sw_enable , MODE2 ) ) { if ( get_next_indice_1( st0 ) ) /* TCX */ #ifdef IVAS_FLOAT_FIXED IF( get_next_indice_1_fx( st0 ) ) #else IF ( get_next_indice_1( st0 ) ) /* TCX */ #endif // IVAS_FLOAT_FIXED { #ifdef IVAS_FLOAT_FIXED ind = get_next_indice_fx( st0, 3 ); #else ind = get_next_indice( st0, 3 ); #endif assert( !( ind & 4 ) || !"HQ_CORE encountered in dec_prm_ivas" ); st->core = TCX_20_CORE; st->hTcxCfg->coder_type = ind; st->coder_type = st->hTcxCfg->coder_type; } else /* ACELP */ ELSE /* ACELP */ { st->core = ACELP_CORE; #ifdef IVAS_FLOAT_FIXED st->coder_type = get_next_indice_fx( st0, 2 ); #else st->coder_type = get_next_indice( st0, 2 ); #endif // IVAS_FLOAT_FIXED } } else ELSE { if ( st->rf_flag == 1 ) IF ( EQ_16( st->rf_flag , 1 ) ) { if ( !st->use_partial_copy ) IF ( !st->use_partial_copy ) { #ifdef IVAS_FLOAT_FIXED ind = get_next_indice_fx( st0, 1 ); #else ind = get_next_indice( st0, 1 ); if ( ind == 0 ) #endif // IVAS_FLOAT_FIXED IF ( ind == 0 ) { st->core = ACELP_CORE; } else ELSE { st->core = TCX_20_CORE; st->hTcxCfg->coder_type = st->coder_type; } } } else ELSE { #ifdef IVAS_FLOAT_FIXED ind = get_next_indice_fx( st, 3 ); #else ind = get_next_indice( st, 3 ); if ( ind < ACELP_MODE_MAX ) #endif // IVAS_FLOAT_FIXED IF (LT_16( ind , ACELP_MODE_MAX )) { st->core = ACELP_CORE; st->coder_type = ind; } else ELSE { st->core = TCX_20_CORE; st->hTcxCfg->coder_type = ind - ACELP_MODE_MAX; st->hTcxCfg->coder_type =sub( ind , ACELP_MODE_MAX ); st->coder_type = st->hTcxCfg->coder_type; } } } } if ( st->element_mode == EVS_MONO ) IF(EQ_16( st->element_mode , EVS_MONO )) { if ( st->igf && st->core == ACELP_CORE ) IF ( st->igf && EQ_16( st->core , ACELP_CORE ) ) { #ifdef IVAS_FLOAT_FIXED st->bits_frame_core = sub( st->bits_frame_core, get_tbe_bits_fx( st->total_brate, st->bwidth, st->rf_flag ) ); #else st->bits_frame_core -= get_tbe_bits( st->total_brate, st->bwidth, st->rf_flag ); #endif // IVAS_FLOAT_FIXED } if ( st->rf_flag ) IF ( st->rf_flag ) { st->bits_frame_core -= ( st->rf_target_bits + 1 ); /* +1 as flag-bit not considered in rf_target_bits */ st->bits_frame_core = sub( st->bits_frame_core, add( st->rf_target_bits , 1 ) ); /* +1 as flag-bit not considered in rf_target_bits */ } } /* Inactive frame detection on non-DTX mode */ if ( st->coder_type == INACTIVE ) IF(EQ_16( st->coder_type , INACTIVE )) { st->VAD = 0; } else ELSE { st->VAD = 1; } Loading @@ -186,7 +228,7 @@ void getTCXMode_ivas( /*Core extended mode mapping for correct PLC classification*/ st->core_ext_mode = st->coder_type; if ( st->coder_type == INACTIVE ) IF(EQ_16( st->coder_type , INACTIVE )) { st->core_ext_mode = UNVOICED; } Loading @@ -202,29 +244,29 @@ void getTCXMode_ivas( *--------------------------------------------------------------------*/ void getTCXWindowing_ivas( const int16_t core, /* i : current core */ const int16_t last_core, /* i : last frame core */ const int16_t element_mode, /* i : element mode */ const Word16 core, /* i : current core */ const Word16 last_core, /* i : last frame core */ const Word16 element_mode, /* i : element mode */ TCX_CONFIG_HANDLE hTcxCfg, /* i/o: TCX configuration handle */ Decoder_State *st0 /* i : bitstream */ ) { int16_t overlap_code; Word16 overlap_code; /* Set the last overlap mode based on the previous and current frame type and coded overlap mode */ if ( last_core == ACELP_CORE || last_core == AMR_WB_CORE ) IF( EQ_16( last_core, ACELP_CORE ) || EQ_16( last_core, AMR_WB_CORE ) ) { hTcxCfg->tcx_last_overlap_mode = TRANSITION_OVERLAP; } else if ( core == TCX_10_CORE && hTcxCfg->tcx_curr_overlap_mode == ALDO_WINDOW ) ELSE IF( EQ_16( core, TCX_10_CORE ) && EQ_16( hTcxCfg->tcx_curr_overlap_mode, ALDO_WINDOW ) ) { hTcxCfg->tcx_last_overlap_mode = FULL_OVERLAP; } else if ( core != TCX_10_CORE && hTcxCfg->tcx_curr_overlap_mode == FULL_OVERLAP ) ELSE IF( NE_16( core, TCX_10_CORE ) && EQ_16( hTcxCfg->tcx_curr_overlap_mode, FULL_OVERLAP ) ) { hTcxCfg->tcx_last_overlap_mode = ALDO_WINDOW; } else ELSE { hTcxCfg->tcx_last_overlap_mode = hTcxCfg->tcx_curr_overlap_mode; } Loading @@ -232,33 +274,47 @@ void getTCXWindowing_ivas( /* Set the current overlap mode based on the current frame type and coded overlap mode */ hTcxCfg->tcx_curr_overlap_mode = ALDO_WINDOW; if ( core != ACELP_CORE ) IF( NE_16( core, ACELP_CORE ) ) { overlap_code = 0; #ifdef IVAS_FLOAT_FIXED IF( get_next_indice_fx( st0, 1 ) ) { overlap_code = add( 2, get_next_indice_fx( st0, 1 ) ); } #else if ( get_next_indice( st0, 1 ) ) { overlap_code = 2 + get_next_indice( st0, 1 ); } #endif assert( MIN_OVERLAP == 2 && HALF_OVERLAP == 3 ); hTcxCfg->tcx_curr_overlap_mode = overlap_code; /*TCX10 : always symmetric windows*/ if ( core == TCX_20_CORE && overlap_code == 0 && last_core != ACELP_CORE && last_core != AMR_WB_CORE ) IF( EQ_16( core, TCX_20_CORE ) && EQ_16( overlap_code, 0 ) && NE_16( last_core, ACELP_CORE ) && NE_16( last_core, AMR_WB_CORE ) ) { hTcxCfg->tcx_curr_overlap_mode = ALDO_WINDOW; } } if ( element_mode != EVS_MONO && core == TCX_10_CORE ) IF( NE_16( element_mode, EVS_MONO ) && EQ_16( core, TCX_10_CORE ) ) { /* also read last overlap */ overlap_code = 0; #ifdef IVAS_FLOAT_FIXED IF( get_next_indice_fx( st0, 1 ) ) { overlap_code = add( 2, get_next_indice_fx( st0, 1 ) ); } #else if ( get_next_indice( st0, 1 ) ) { overlap_code = 2 + get_next_indice( st0, 1 ); } #endif hTcxCfg->tcx_last_overlap_mode = overlap_code; } Loading
lib_dec/dec_prm_fx.c +79 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,85 @@ #include "prot_fx2.h" #include "basop_util.h" /*-------------------------------------------------------------------* * getLPCparam_ivas() * * get LPC parameters *--------------------------------------------------------------------*/ void getLPCparam( Decoder_State *st, /* i/o: decoder memory state */ Word16 param_lpc[], /* o : LTP parameters */ Decoder_State *st0, /* i : bitstream */ const Word16 ch, /* i : channel */ const Word16 sns_low_br_mode /* i : SNS low-bitrate mode */ ) { IF( EQ_16( st->use_partial_copy, 0 ) ) { /* Number of sets of LPC parameters (does not include mid-lpc) */ IF( ( st->tcxonly, 0 ) || LT_16( st->core, TCX_10_CORE ) ) { st->numlpc = 1; } ELSE { st->numlpc = 2; } /* Decode LPC parameters */ IF( st->hTcxDec->enableTcxLpc && NE_16( st->core, ACELP_CORE ) ) { Word16 tcx_lpc_cdk; tcx_lpc_cdk = tcxlpc_get_cdk( st->coder_type ); dec_lsf_tcxlpc( st0, ¶m_lpc, st->narrowBand, tcx_lpc_cdk ); } ELSE { IF( EQ_16( st->lpcQuantization, 0 ) ) { decode_lpc_avq_ivas( st0, st->numlpc, param_lpc, ch, st->element_mode, sns_low_br_mode ); } ELSE IF( EQ_16( st->lpcQuantization, 1 ) ) { IF( EQ_32( st->sr_core, INT_FS_16k ) && EQ_16( st->coder_type, VOICED ) && EQ_16( st->core, ACELP_CORE ) ) { assert( EQ_16( st->element_mode, EVS_MONO ) ); lsf_bctcvq_decprm( st0, param_lpc ); } ELSE { lsf_msvq_ma_decprm( st0, param_lpc ); } } ELSE { assert( 0 ); } } } ELSE { st->numlpc = 1; IF( EQ_16( st->rf_frame_type, RF_TCXFD ) ) { param_lpc[0] = 0; param_lpc[1] = get_next_indice_fx( st0, lsf_numbits[0] ); /* VQ 1 */ param_lpc[2] = get_next_indice_fx( st0, lsf_numbits[1] ); /* VQ 2 */ param_lpc[3] = get_next_indice_fx( st0, lsf_numbits[2] ); /* VQ 3 */ } ELSE IF( GE_16( st->rf_frame_type, RF_ALLPRED ) && LE_16( st->rf_frame_type, RF_NELP ) ) { /* LSF indices */ param_lpc[0] = get_next_indice_fx( st0, 8 ); /* VQ 1 */ param_lpc[1] = get_next_indice_fx( st0, 8 ); /* VQ 2 */ } } return; } static void dec_prm_hm( Decoder_State *st, Word16 *prm_hm, Loading