Loading lib_com/tcx_ltp_fx.c +9 −9 Original line number Diff line number Diff line Loading @@ -115,10 +115,10 @@ void tcx_ltp_get_lpc_fx( Word32 *A, const Word16 order ) { Word16 i, j, s, s2, tmp; Word32 r, L_tmp; Word16 i, j, s, s2; Word32 r, tmp, L_tmp; Word16 tmpbuf[L_FRAME_MAX], *p = x; Word32 tmpbuf[L_FRAME_MAX], *p = x; Word16 r_l[TCXLTP_LTP_ORDER + 1], r_h[TCXLTP_LTP_ORDER + 1]; Loading @@ -136,8 +136,8 @@ void tcx_ltp_get_lpc_fx( if ( L_tmp > 0 ) r = L_shr( r, 2 ); tmp = shl( x[j], s ); r = L_mac0( r, tmp, tmp ); tmp = L_shl( x[j], s ); r = Madd_32_32( r, tmp, tmp ); } r = L_max( r, L_shl( 100, shl( s, 1 ) ) ); r = Mpy_32_16_1( r, 16386 /*1.0001f Q14*/ ); Loading @@ -159,9 +159,9 @@ void tcx_ltp_get_lpc_fx( move64(); FOR( j = 0; j < L; j++ ) { tmpbuf[j] = mult_r( x[j], tmp ); move16(); r64 = W_mac0_16_16( r64, tmpbuf[j], tmpbuf[j] ); tmpbuf[j] = Mpy_32_32( x[j], tmp ); move32(); r64 = W_add( r64, W_mult0_32_32(tmpbuf[j], tmpbuf[j] )); } r = W_sat_l( r64 ); } Loading @@ -188,7 +188,7 @@ void tcx_ltp_get_lpc_fx( move64(); FOR( j = 0; j < tmp; j++ ) { r64 = W_mac0_16_16( r64, p[j], p[j + i] ); r64 = W_add( r64, Mpy_32_32( p[j], p[j + i] ) ); } r = W_sat_l( r64 ); } Loading lib_dec/ivas_core_dec.c +149 −0 Original line number Diff line number Diff line Loading @@ -878,7 +878,156 @@ ivas_error ivas_core_dec( { if ( st->element_mode != IVAS_CPE_MDCT || sba_dirac_stereo_flag ) { #ifdef IVAS_FLOAT_FIXED Word32 synth_fx[CPE_CHANNELS][L_FRAME48k]; for ( int k = 0; k < output_frame; k++ ) { synth_fx[n][k] = (Word32) ( synth[n][k] * ONE_IN_Q14 ); } IF( hSCE != NULL ) { for ( int k = 0; k < output_frame; k++ ) { hSCE->hCoreCoder[n]->hHQ_core->oldOut_fx[k] = (Word32) ( hSCE->hCoreCoder[n]->hHQ_core->old_out[k] * ONE_IN_Q14 ); if ( k < 111 ) { hSCE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_32[k] = (Word32) ( hSCE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_float[k] * ONE_IN_Q14 ); } if ( k < HQ_DELTA_MAX * HQ_DELAY_COMP ) { hSCE->hCoreCoder[n]->delay_buf_out32_fx[k] = (Word32) ( hSCE->hCoreCoder[n]->delay_buf_out[k] * ONE_IN_Q14 ); } hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_32[k] = (Word32)(hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_float[k] * ONE_IN_Q14); if (k < TCXLTP_MAX_DELAY) { hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_32[k] = (Word32)(hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_float[k] * ONE_IN_Q14); } } hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev = (Word16) ( hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev_float * ONE_IN_Q15 ); hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain = (Word16) ( hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_float * ONE_IN_Q15 ); } ELSE { if ( hCPE->hCoreCoder[n]->hTcxLtpDec != NULL ) { if ( !( NE_16( hCPE->hCoreCoder[n]->core, TCX_20_CORE ) && NE_16( hCPE->hCoreCoder[n]->core, TCX_10_CORE ) ) ) { for ( int k = 0; k < output_frame; k++ ) { hCPE->hCoreCoder[n]->hHQ_core->oldOut_fx[k] = (Word32) ( hCPE->hCoreCoder[n]->hHQ_core->old_out[k] * ONE_IN_Q14 ); if ( k < 111 ) { hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_32[k] = (Word32) ( hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_float[k] * ONE_IN_Q14 ); } if ( k < HQ_DELTA_MAX * HQ_DELAY_COMP ) { hCPE->hCoreCoder[n]->delay_buf_out32_fx[k] = (Word32) ( hCPE->hCoreCoder[n]->delay_buf_out[k] * ONE_IN_Q14 ); } } } for ( int k = 0; k < output_frame; k++ ) { hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_32[k] = (Word32) ( hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_float[k] * ONE_IN_Q14 ); if ( k < TCXLTP_MAX_DELAY ) { hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_32[k] = (Word32) ( hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_float[k] * ONE_IN_Q14 ); } } hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev = (Word16) ( hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev_float * ONE_IN_Q15 ); hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain = (Word16) ( hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_float * ONE_IN_Q15 ); } if ( !( ( hCPE->hCoreCoder[0]->element_mode != IVAS_CPE_DFT && !( sba_dirac_stereo_flag && hCPE->hCoreCoder[0]->element_mode != IVAS_CPE_MDCT ) ) || ( hCPE->hCoreCoder[0]->element_mode == IVAS_CPE_DFT && hCPE->nchan_out == 1 && hCPE->hStereoDft->hConfig->res_cod_mode == STEREO_DFT_RES_COD_OFF ) ) ) { for ( int p = 0; p < L_FRAME48k; p++ ) { hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_32[p] = (Word32) ( hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_float[p] * ONE_IN_Q14 ); if ( p < TCXLTP_MAX_DELAY ) { hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_in_32[p] = (Word32) ( hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_in_float[p] * ONE_IN_Q14 ); } if (p < NS2SA(hCPE->hCoreCoder[n]->output_Fs, STEREO_DFT32MS_OVL_NS)) { hCPE->output_mem_fx[0][p] = (Word32)(hCPE->output_mem[0][p] * ONE_IN_Q14); hCPE->output_mem_fx[1][p] = (Word32)(hCPE->output_mem[1][p] * ONE_IN_Q14); } } hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_post_prev = (Word16) ( hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_post_prev_float * ONE_IN_Q15 ); hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain = (Word16) ( hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_float * ONE_IN_Q15 ); } } ivas_post_proc_fx( hSCE, hCPE, n, synth_fx[n], NULL, output_frame, sba_dirac_stereo_flag ); for ( int k = 0; k < output_frame; k++ ) { synth[n][k] = (float) synth_fx[n][k] / ONE_IN_Q14; } IF( hSCE != NULL ) { for ( int k = 0; k < output_frame; k++ ) { hSCE->hCoreCoder[n]->hHQ_core->old_out[k] = (float) hSCE->hCoreCoder[n]->hHQ_core->oldOut_fx[k] / ONE_IN_Q14; if ( k < 111 ) { hSCE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_float[k] = (float) hSCE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_32[k] / ONE_IN_Q14; } if ( k < ( HQ_DELTA_MAX * HQ_DELAY_COMP ) ) { hSCE->hCoreCoder[n]->delay_buf_out[k] = (float) hSCE->hCoreCoder[n]->delay_buf_out32_fx[k] / ONE_IN_Q14; } hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_float[k] = (float)hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_32[k] / ONE_IN_Q14; if (k < TCXLTP_MAX_DELAY) { hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_float[k] = (float)hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_32[k] / ONE_IN_Q14; } } hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev_float = (float) hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev / ONE_IN_Q15; hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_float = (float) hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain / ONE_IN_Q15; } ELSE { if ( hCPE->hCoreCoder[n]->hTcxLtpDec != NULL ) { if ( !( NE_16( hCPE->hCoreCoder[n]->core, TCX_20_CORE ) && NE_16( hCPE->hCoreCoder[n]->core, TCX_10_CORE ) ) ) { for ( int k = 0; k < 111; k++ ) { hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_float[k] = (float) hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_32[k] / ONE_IN_Q14; } } for ( int k = 0; k < output_frame; k++ ) { hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_float[k] = (float) hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_32[k] / ONE_IN_Q14; if ( k < TCXLTP_MAX_DELAY ) { hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_float[k] = (float) hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_32[k] / ONE_IN_Q14; } } hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev_float = (float) hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev / ONE_IN_Q15; hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_float = (float) hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain / ONE_IN_Q15; } if ( !( ( hCPE->hCoreCoder[0]->element_mode != IVAS_CPE_DFT && !( sba_dirac_stereo_flag && hCPE->hCoreCoder[0]->element_mode != IVAS_CPE_MDCT ) ) || ( hCPE->hCoreCoder[0]->element_mode == IVAS_CPE_DFT && hCPE->nchan_out == 1 && hCPE->hStereoDft->hConfig->res_cod_mode == STEREO_DFT_RES_COD_OFF ) ) ) { for ( int p = 0; p < L_FRAME48k; p++ ) { hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_float[p] = (float) hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_32[p] / ONE_IN_Q14; if ( p < TCXLTP_MAX_DELAY ) { hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_in_float[p] = (float) hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_in_32[p] / ONE_IN_Q14; } if (p < NS2SA(hCPE->hCoreCoder[n]->output_Fs, STEREO_DFT32MS_OVL_NS)) { hCPE->output_mem[0][p] = (float)hCPE->output_mem_fx[0][p] / ONE_IN_Q14; hCPE->output_mem[1][p] = (float)hCPE->output_mem_fx[1][p] / ONE_IN_Q14; } } hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_post_prev_float = (float) hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_post_prev / ONE_IN_Q15; hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_float = (float) hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain / ONE_IN_Q15; } } #else ivas_post_proc( hSCE, hCPE, n, synth[n], NULL, output_frame, sba_dirac_stereo_flag ); #endif // IVAS_FLOAT_FIXED } /* update OLA buffers - needed for switching to DFT stereo */ Loading lib_dec/ivas_mct_dec.c +95 −0 Original line number Diff line number Diff line Loading @@ -263,7 +263,102 @@ ivas_error ivas_mct_dec( { if ( st_ivas->sba_dirac_stereo_flag && ( st_ivas->ivas_format != SBA_ISM_FORMAT || cpe_id >= nCPE - 2 ) ) { #ifdef IVAS_FLOAT_FIXED Word32 synth_fx[CPE_CHANNELS][L_FRAME48k]; for ( int p = 0; p < L_FRAME48k; p++ ) { synth_fx[n][p] = (Word32) ( synth[n][p] * ONE_IN_Q14 ); if ( p < NS2SA( hCPE->hCoreCoder[n]->output_Fs, STEREO_DFT32MS_OVL_NS ) ) { hCPE->output_mem_fx[0][p] = (Word32) ( hCPE->output_mem[0][p] * ONE_IN_Q14 ); hCPE->output_mem_fx[1][p] = (Word32) ( hCPE->output_mem[1][p] * ONE_IN_Q14 ); } hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_32[p] = (Word32) ( hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_float[p] * ONE_IN_Q14 ); if ( p < TCXLTP_MAX_DELAY ) { hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_32[p] = (Word32) ( hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_float[p] * ONE_IN_Q14 ); } } if (!(NE_16(hCPE->hCoreCoder[n]->core, TCX_20_CORE) && NE_16(hCPE->hCoreCoder[n]->core, TCX_10_CORE))) { for (int k = 0; k < output_frame; k++) { hCPE->hCoreCoder[n]->hHQ_core->oldOut_fx[k] = (Word32)(hCPE->hCoreCoder[n]->hHQ_core->old_out[k] * ONE_IN_Q14); if (k < 111) { hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_32[k] = (Word32)(hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_float[k] * ONE_IN_Q14); } if (k < HQ_DELTA_MAX * HQ_DELAY_COMP) { hCPE->hCoreCoder[n]->delay_buf_out32_fx[k] = (Word32)(hCPE->hCoreCoder[n]->delay_buf_out[k] * ONE_IN_Q14); } } } if ( !( ( hCPE->hCoreCoder[n]->element_mode != IVAS_CPE_DFT && !( st_ivas->sba_dirac_stereo_flag && hCPE->hCoreCoder[n]->element_mode != IVAS_CPE_MDCT ) ) || ( hCPE->hCoreCoder[n]->element_mode == IVAS_CPE_DFT && hCPE->nchan_out == 1 && hCPE->hStereoDft->hConfig->res_cod_mode == STEREO_DFT_RES_COD_OFF ) ) ) { for ( int p = 0; p < L_FRAME48k; p++ ) { hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_32[p] = (Word32) ( hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_float[p] * ONE_IN_Q14 ); if ( p < TCXLTP_MAX_DELAY ) { hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_in_32[p] = (Word32) ( hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_in_float[p] * ONE_IN_Q14 ); } } hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_post_prev = (Word16) ( hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_post_prev_float * ONE_IN_Q15 ); hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain = (Word16) ( hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_float * ONE_IN_Q15 ); } hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev = (Word16) ( hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev_float * ONE_IN_Q15 ); hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain = (Word16) ( hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_float * ONE_IN_Q15 ); for ( int p = 0; p < 111; p++ ) { hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_32[p] = (Word32) ( hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_float[p] * ONE_IN_Q14 ); } ivas_post_proc_fx( NULL, hCPE, n, synth_fx[n], NULL, output_frame, 1 ); for ( int p = 0; p < L_FRAME48k; p++ ) { synth[n][p] = (float) synth_fx[n][p] / ONE_IN_Q14; if ( p < NS2SA( hCPE->hCoreCoder[n]->output_Fs, STEREO_DFT32MS_OVL_NS ) ) { hCPE->output_mem[0][p] = (float) hCPE->output_mem_fx[0][p] / ONE_IN_Q14; hCPE->output_mem[1][p] = (float) hCPE->output_mem_fx[1][p] / ONE_IN_Q14; } hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_float[p] = (float) hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_32[p] / ONE_IN_Q14; if ( p < TCXLTP_MAX_DELAY ) { hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_float[p] = (float) hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_32[p] / ONE_IN_Q14; } } if (!(NE_16(hCPE->hCoreCoder[n]->core, TCX_20_CORE) && NE_16(hCPE->hCoreCoder[n]->core, TCX_10_CORE))) { for (int k = 0; k < 111; k++) { hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_float[k] = (float)hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_32[k] / ONE_IN_Q14; } } hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev_float = (float) hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev / ONE_IN_Q15; hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_float = (float) hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain / ONE_IN_Q15; if ( !( ( hCPE->hCoreCoder[n]->element_mode != IVAS_CPE_DFT && !( st_ivas->sba_dirac_stereo_flag && hCPE->hCoreCoder[n]->element_mode != IVAS_CPE_MDCT ) ) || ( hCPE->hCoreCoder[n]->element_mode == IVAS_CPE_DFT && hCPE->nchan_out == 1 && hCPE->hStereoDft->hConfig->res_cod_mode == STEREO_DFT_RES_COD_OFF ) ) ) { for ( int p = 0; p < L_FRAME48k; p++ ) { hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_float[p] = (float) hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_32[p] / ONE_IN_Q14; if ( p < TCXLTP_MAX_DELAY ) { hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_float[p] = (float) hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_32[p] / ONE_IN_Q14; } } hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_post_prev_float = (float) hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_post_prev / ONE_IN_Q15; hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_float = (float) hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain / ONE_IN_Q15; } #else ivas_post_proc( NULL, hCPE, n, synth[n], NULL, output_frame, 1 ); #endif // IVAS_FLOAT_FIXED } /* Postprocessing for ACELP/MDCT core switching and synchronization */ Loading Loading
lib_com/tcx_ltp_fx.c +9 −9 Original line number Diff line number Diff line Loading @@ -115,10 +115,10 @@ void tcx_ltp_get_lpc_fx( Word32 *A, const Word16 order ) { Word16 i, j, s, s2, tmp; Word32 r, L_tmp; Word16 i, j, s, s2; Word32 r, tmp, L_tmp; Word16 tmpbuf[L_FRAME_MAX], *p = x; Word32 tmpbuf[L_FRAME_MAX], *p = x; Word16 r_l[TCXLTP_LTP_ORDER + 1], r_h[TCXLTP_LTP_ORDER + 1]; Loading @@ -136,8 +136,8 @@ void tcx_ltp_get_lpc_fx( if ( L_tmp > 0 ) r = L_shr( r, 2 ); tmp = shl( x[j], s ); r = L_mac0( r, tmp, tmp ); tmp = L_shl( x[j], s ); r = Madd_32_32( r, tmp, tmp ); } r = L_max( r, L_shl( 100, shl( s, 1 ) ) ); r = Mpy_32_16_1( r, 16386 /*1.0001f Q14*/ ); Loading @@ -159,9 +159,9 @@ void tcx_ltp_get_lpc_fx( move64(); FOR( j = 0; j < L; j++ ) { tmpbuf[j] = mult_r( x[j], tmp ); move16(); r64 = W_mac0_16_16( r64, tmpbuf[j], tmpbuf[j] ); tmpbuf[j] = Mpy_32_32( x[j], tmp ); move32(); r64 = W_add( r64, W_mult0_32_32(tmpbuf[j], tmpbuf[j] )); } r = W_sat_l( r64 ); } Loading @@ -188,7 +188,7 @@ void tcx_ltp_get_lpc_fx( move64(); FOR( j = 0; j < tmp; j++ ) { r64 = W_mac0_16_16( r64, p[j], p[j + i] ); r64 = W_add( r64, Mpy_32_32( p[j], p[j + i] ) ); } r = W_sat_l( r64 ); } Loading
lib_dec/ivas_core_dec.c +149 −0 Original line number Diff line number Diff line Loading @@ -878,7 +878,156 @@ ivas_error ivas_core_dec( { if ( st->element_mode != IVAS_CPE_MDCT || sba_dirac_stereo_flag ) { #ifdef IVAS_FLOAT_FIXED Word32 synth_fx[CPE_CHANNELS][L_FRAME48k]; for ( int k = 0; k < output_frame; k++ ) { synth_fx[n][k] = (Word32) ( synth[n][k] * ONE_IN_Q14 ); } IF( hSCE != NULL ) { for ( int k = 0; k < output_frame; k++ ) { hSCE->hCoreCoder[n]->hHQ_core->oldOut_fx[k] = (Word32) ( hSCE->hCoreCoder[n]->hHQ_core->old_out[k] * ONE_IN_Q14 ); if ( k < 111 ) { hSCE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_32[k] = (Word32) ( hSCE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_float[k] * ONE_IN_Q14 ); } if ( k < HQ_DELTA_MAX * HQ_DELAY_COMP ) { hSCE->hCoreCoder[n]->delay_buf_out32_fx[k] = (Word32) ( hSCE->hCoreCoder[n]->delay_buf_out[k] * ONE_IN_Q14 ); } hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_32[k] = (Word32)(hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_float[k] * ONE_IN_Q14); if (k < TCXLTP_MAX_DELAY) { hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_32[k] = (Word32)(hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_float[k] * ONE_IN_Q14); } } hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev = (Word16) ( hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev_float * ONE_IN_Q15 ); hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain = (Word16) ( hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_float * ONE_IN_Q15 ); } ELSE { if ( hCPE->hCoreCoder[n]->hTcxLtpDec != NULL ) { if ( !( NE_16( hCPE->hCoreCoder[n]->core, TCX_20_CORE ) && NE_16( hCPE->hCoreCoder[n]->core, TCX_10_CORE ) ) ) { for ( int k = 0; k < output_frame; k++ ) { hCPE->hCoreCoder[n]->hHQ_core->oldOut_fx[k] = (Word32) ( hCPE->hCoreCoder[n]->hHQ_core->old_out[k] * ONE_IN_Q14 ); if ( k < 111 ) { hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_32[k] = (Word32) ( hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_float[k] * ONE_IN_Q14 ); } if ( k < HQ_DELTA_MAX * HQ_DELAY_COMP ) { hCPE->hCoreCoder[n]->delay_buf_out32_fx[k] = (Word32) ( hCPE->hCoreCoder[n]->delay_buf_out[k] * ONE_IN_Q14 ); } } } for ( int k = 0; k < output_frame; k++ ) { hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_32[k] = (Word32) ( hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_float[k] * ONE_IN_Q14 ); if ( k < TCXLTP_MAX_DELAY ) { hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_32[k] = (Word32) ( hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_float[k] * ONE_IN_Q14 ); } } hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev = (Word16) ( hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev_float * ONE_IN_Q15 ); hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain = (Word16) ( hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_float * ONE_IN_Q15 ); } if ( !( ( hCPE->hCoreCoder[0]->element_mode != IVAS_CPE_DFT && !( sba_dirac_stereo_flag && hCPE->hCoreCoder[0]->element_mode != IVAS_CPE_MDCT ) ) || ( hCPE->hCoreCoder[0]->element_mode == IVAS_CPE_DFT && hCPE->nchan_out == 1 && hCPE->hStereoDft->hConfig->res_cod_mode == STEREO_DFT_RES_COD_OFF ) ) ) { for ( int p = 0; p < L_FRAME48k; p++ ) { hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_32[p] = (Word32) ( hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_float[p] * ONE_IN_Q14 ); if ( p < TCXLTP_MAX_DELAY ) { hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_in_32[p] = (Word32) ( hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_in_float[p] * ONE_IN_Q14 ); } if (p < NS2SA(hCPE->hCoreCoder[n]->output_Fs, STEREO_DFT32MS_OVL_NS)) { hCPE->output_mem_fx[0][p] = (Word32)(hCPE->output_mem[0][p] * ONE_IN_Q14); hCPE->output_mem_fx[1][p] = (Word32)(hCPE->output_mem[1][p] * ONE_IN_Q14); } } hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_post_prev = (Word16) ( hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_post_prev_float * ONE_IN_Q15 ); hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain = (Word16) ( hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_float * ONE_IN_Q15 ); } } ivas_post_proc_fx( hSCE, hCPE, n, synth_fx[n], NULL, output_frame, sba_dirac_stereo_flag ); for ( int k = 0; k < output_frame; k++ ) { synth[n][k] = (float) synth_fx[n][k] / ONE_IN_Q14; } IF( hSCE != NULL ) { for ( int k = 0; k < output_frame; k++ ) { hSCE->hCoreCoder[n]->hHQ_core->old_out[k] = (float) hSCE->hCoreCoder[n]->hHQ_core->oldOut_fx[k] / ONE_IN_Q14; if ( k < 111 ) { hSCE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_float[k] = (float) hSCE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_32[k] / ONE_IN_Q14; } if ( k < ( HQ_DELTA_MAX * HQ_DELAY_COMP ) ) { hSCE->hCoreCoder[n]->delay_buf_out[k] = (float) hSCE->hCoreCoder[n]->delay_buf_out32_fx[k] / ONE_IN_Q14; } hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_float[k] = (float)hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_32[k] / ONE_IN_Q14; if (k < TCXLTP_MAX_DELAY) { hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_float[k] = (float)hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_32[k] / ONE_IN_Q14; } } hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev_float = (float) hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev / ONE_IN_Q15; hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_float = (float) hSCE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain / ONE_IN_Q15; } ELSE { if ( hCPE->hCoreCoder[n]->hTcxLtpDec != NULL ) { if ( !( NE_16( hCPE->hCoreCoder[n]->core, TCX_20_CORE ) && NE_16( hCPE->hCoreCoder[n]->core, TCX_10_CORE ) ) ) { for ( int k = 0; k < 111; k++ ) { hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_float[k] = (float) hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_32[k] / ONE_IN_Q14; } } for ( int k = 0; k < output_frame; k++ ) { hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_float[k] = (float) hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_32[k] / ONE_IN_Q14; if ( k < TCXLTP_MAX_DELAY ) { hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_float[k] = (float) hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_32[k] / ONE_IN_Q14; } } hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev_float = (float) hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev / ONE_IN_Q15; hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_float = (float) hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain / ONE_IN_Q15; } if ( !( ( hCPE->hCoreCoder[0]->element_mode != IVAS_CPE_DFT && !( sba_dirac_stereo_flag && hCPE->hCoreCoder[0]->element_mode != IVAS_CPE_MDCT ) ) || ( hCPE->hCoreCoder[0]->element_mode == IVAS_CPE_DFT && hCPE->nchan_out == 1 && hCPE->hStereoDft->hConfig->res_cod_mode == STEREO_DFT_RES_COD_OFF ) ) ) { for ( int p = 0; p < L_FRAME48k; p++ ) { hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_float[p] = (float) hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_32[p] / ONE_IN_Q14; if ( p < TCXLTP_MAX_DELAY ) { hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_in_float[p] = (float) hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_in_32[p] / ONE_IN_Q14; } if (p < NS2SA(hCPE->hCoreCoder[n]->output_Fs, STEREO_DFT32MS_OVL_NS)) { hCPE->output_mem[0][p] = (float)hCPE->output_mem_fx[0][p] / ONE_IN_Q14; hCPE->output_mem[1][p] = (float)hCPE->output_mem_fx[1][p] / ONE_IN_Q14; } } hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_post_prev_float = (float) hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_post_prev / ONE_IN_Q15; hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_float = (float) hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain / ONE_IN_Q15; } } #else ivas_post_proc( hSCE, hCPE, n, synth[n], NULL, output_frame, sba_dirac_stereo_flag ); #endif // IVAS_FLOAT_FIXED } /* update OLA buffers - needed for switching to DFT stereo */ Loading
lib_dec/ivas_mct_dec.c +95 −0 Original line number Diff line number Diff line Loading @@ -263,7 +263,102 @@ ivas_error ivas_mct_dec( { if ( st_ivas->sba_dirac_stereo_flag && ( st_ivas->ivas_format != SBA_ISM_FORMAT || cpe_id >= nCPE - 2 ) ) { #ifdef IVAS_FLOAT_FIXED Word32 synth_fx[CPE_CHANNELS][L_FRAME48k]; for ( int p = 0; p < L_FRAME48k; p++ ) { synth_fx[n][p] = (Word32) ( synth[n][p] * ONE_IN_Q14 ); if ( p < NS2SA( hCPE->hCoreCoder[n]->output_Fs, STEREO_DFT32MS_OVL_NS ) ) { hCPE->output_mem_fx[0][p] = (Word32) ( hCPE->output_mem[0][p] * ONE_IN_Q14 ); hCPE->output_mem_fx[1][p] = (Word32) ( hCPE->output_mem[1][p] * ONE_IN_Q14 ); } hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_32[p] = (Word32) ( hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_float[p] * ONE_IN_Q14 ); if ( p < TCXLTP_MAX_DELAY ) { hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_32[p] = (Word32) ( hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_float[p] * ONE_IN_Q14 ); } } if (!(NE_16(hCPE->hCoreCoder[n]->core, TCX_20_CORE) && NE_16(hCPE->hCoreCoder[n]->core, TCX_10_CORE))) { for (int k = 0; k < output_frame; k++) { hCPE->hCoreCoder[n]->hHQ_core->oldOut_fx[k] = (Word32)(hCPE->hCoreCoder[n]->hHQ_core->old_out[k] * ONE_IN_Q14); if (k < 111) { hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_32[k] = (Word32)(hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_float[k] * ONE_IN_Q14); } if (k < HQ_DELTA_MAX * HQ_DELAY_COMP) { hCPE->hCoreCoder[n]->delay_buf_out32_fx[k] = (Word32)(hCPE->hCoreCoder[n]->delay_buf_out[k] * ONE_IN_Q14); } } } if ( !( ( hCPE->hCoreCoder[n]->element_mode != IVAS_CPE_DFT && !( st_ivas->sba_dirac_stereo_flag && hCPE->hCoreCoder[n]->element_mode != IVAS_CPE_MDCT ) ) || ( hCPE->hCoreCoder[n]->element_mode == IVAS_CPE_DFT && hCPE->nchan_out == 1 && hCPE->hStereoDft->hConfig->res_cod_mode == STEREO_DFT_RES_COD_OFF ) ) ) { for ( int p = 0; p < L_FRAME48k; p++ ) { hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_32[p] = (Word32) ( hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_float[p] * ONE_IN_Q14 ); if ( p < TCXLTP_MAX_DELAY ) { hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_in_32[p] = (Word32) ( hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_in_float[p] * ONE_IN_Q14 ); } } hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_post_prev = (Word16) ( hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_post_prev_float * ONE_IN_Q15 ); hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain = (Word16) ( hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_float * ONE_IN_Q15 ); } hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev = (Word16) ( hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev_float * ONE_IN_Q15 ); hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain = (Word16) ( hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_float * ONE_IN_Q15 ); for ( int p = 0; p < 111; p++ ) { hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_32[p] = (Word32) ( hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_float[p] * ONE_IN_Q14 ); } ivas_post_proc_fx( NULL, hCPE, n, synth_fx[n], NULL, output_frame, 1 ); for ( int p = 0; p < L_FRAME48k; p++ ) { synth[n][p] = (float) synth_fx[n][p] / ONE_IN_Q14; if ( p < NS2SA( hCPE->hCoreCoder[n]->output_Fs, STEREO_DFT32MS_OVL_NS ) ) { hCPE->output_mem[0][p] = (float) hCPE->output_mem_fx[0][p] / ONE_IN_Q14; hCPE->output_mem[1][p] = (float) hCPE->output_mem_fx[1][p] / ONE_IN_Q14; } hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_float[p] = (float) hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_32[p] / ONE_IN_Q14; if ( p < TCXLTP_MAX_DELAY ) { hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_float[p] = (float) hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_32[p] / ONE_IN_Q14; } } if (!(NE_16(hCPE->hCoreCoder[n]->core, TCX_20_CORE) && NE_16(hCPE->hCoreCoder[n]->core, TCX_10_CORE))) { for (int k = 0; k < 111; k++) { hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_float[k] = (float)hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_32[k] / ONE_IN_Q14; } } hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev_float = (float) hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev / ONE_IN_Q15; hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_float = (float) hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain / ONE_IN_Q15; if ( !( ( hCPE->hCoreCoder[n]->element_mode != IVAS_CPE_DFT && !( st_ivas->sba_dirac_stereo_flag && hCPE->hCoreCoder[n]->element_mode != IVAS_CPE_MDCT ) ) || ( hCPE->hCoreCoder[n]->element_mode == IVAS_CPE_DFT && hCPE->nchan_out == 1 && hCPE->hStereoDft->hConfig->res_cod_mode == STEREO_DFT_RES_COD_OFF ) ) ) { for ( int p = 0; p < L_FRAME48k; p++ ) { hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_float[p] = (float) hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_32[p] / ONE_IN_Q14; if ( p < TCXLTP_MAX_DELAY ) { hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_float[p] = (float) hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_32[p] / ONE_IN_Q14; } } hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_post_prev_float = (float) hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_post_prev / ONE_IN_Q15; hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_float = (float) hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain / ONE_IN_Q15; } #else ivas_post_proc( NULL, hCPE, n, synth[n], NULL, output_frame, 1 ); #endif // IVAS_FLOAT_FIXED } /* Postprocessing for ACELP/MDCT core switching and synchronization */ Loading