Commit d96b7c28 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Core coder updates

parent 89c969b3
Loading
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -3258,12 +3258,25 @@ void stereo_td2dft_update(
    const int16_t output_frame                                  /* i  : frame length                            */
);

void stereo_td2dft_update_fx(
  CPE_DEC_HANDLE hCPE,       /* i/o: CPE decoder structure   */
  const int16_t n,           /* i  : channel number          */
  Word32 output_fx[],            /* i/o: synthesis @internal Fs  */
  Word32 synth_fx[],             /* i/o: synthesis @output Fs    */
  Word32 hb_synth_fx[],          /* i/o: hb synthesis            */
  const int16_t output_frame /* i  : frame length            */
);
void stereo_mdct2dft_update(
    CPE_DEC_HANDLE hCPE,                                        /* i/o: CPE decoder structure                   */
    float output0[],                                            /* i/o: synthesis @internal Fs, ch0             */
    float synth0[]                                              /* i/o: synthesis @output Fs, ch0               */
);

void stereo_mdct2dft_update_fx(
  CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure        */
  Word32 output0_fx[],     /* i/o: synthesis @internal Fs, ch0  */
  Word32 synth0_fx[]       /* i/o: synthesis @output Fs, ch0    */
);
/*! r: number of bits written */
int16_t write_GR0(
    BSTR_ENC_HANDLE hBstr,                                      /* i/o: Encoder bitstream handle                */
+0 −7
Original line number Diff line number Diff line
@@ -983,13 +983,6 @@ void stereo_dft_dec_fx(
    const Word16 num_md_sub_frames              /* i  : number of MD subframes             */
);

void synchro_synthesis_fx(
    const Word32 ivas_total_brate,     /* i  : IVAS total bitrate                  */
    CPE_DEC_HANDLE hCPE,                /* i/o: CPE decoder structure               */
    Word32 *output[CPE_CHANNELS],        /* i/o: output synthesis signal             */
    const Word16 output_frame,         /* i  : Number of samples                   */
    const Word16 sba_dirac_stereo_flag /* i  : signal stereo output for SBA DirAC  */
);

void ivas_ls_setup_conversion_fx(
    Decoder_Struct *st_ivas,   /* i  : IVAS decoder structure           */
+1051 −284

File changed.

Preview size limit exceeded, changes collapsed.

+33 −32
Original line number Diff line number Diff line
@@ -280,34 +280,35 @@ ivas_error ivas_mct_dec(
            {
#ifdef IVAS_FLOAT_FIXED
                Word32 synth_fx[CPE_CHANNELS][L_FRAME48k];
                Word16 q = 11;
                for ( int p = 0; p < L_FRAME48k; p++ )
                {
                    synth_fx[n][p] = (Word32) ( synth[n][p] * ONE_IN_Q14 );
                    synth_fx[n][p] = (Word32) ( synth[n][p] * ( 1u << q ) );

                    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->output_mem_fx[0][p] = (Word32) ( hCPE->output_mem[0][p] * ( 1u << q ) );
                        hCPE->output_mem_fx[1][p] = (Word32) ( hCPE->output_mem[1][p] * ( 1u << q ) );
                    }

                    hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_32[p] = (Word32) ( hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_float[p] * ONE_IN_Q14 );
                    hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_32[p] = (Word32) ( hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_float[p] * ( 1u << q ) );
                    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 );
                        hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_32[p] = (Word32) ( hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_float[p] * ( 1u << q ) );
                    }
                }
                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);
                        hCPE->hCoreCoder[n]->hHQ_core->oldOut_fx[k] = (Word32) ( hCPE->hCoreCoder[n]->hHQ_core->old_out[k] * ( 1u << q ) );
                        if ( k < 111 )
                        {
                      hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_32[k] = (Word32)(hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_float[k] * ONE_IN_Q14);
                            hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_32[k] = (Word32) ( hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_float[k] * ( 1u << q ) );
                        }
                        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);
                            hCPE->hCoreCoder[n]->delay_buf_out32_fx[k] = (Word32) ( hCPE->hCoreCoder[n]->delay_buf_out[k] * ( 1u << q ) );
                        }
                    }
                }
@@ -315,10 +316,10 @@ ivas_error ivas_mct_dec(
                {
                    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 );
                        hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_32[p] = (Word32) ( hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_float[p] * ( 1u << q ) );
                        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_mem_in_32[p] = (Word32) ( hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_in_float[p] * ( 1u << q ) );
                        }
                    }
                    hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_post_prev = (Word16) ( hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_post_prev_float * ONE_IN_Q15 );
@@ -328,32 +329,32 @@ ivas_error ivas_mct_dec(
                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 );
                    hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_32[p] = (Word32) ( hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_float[p] * ( 1u << q ) );
                }

                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;
                    synth[n][p] = (float) synth_fx[n][p] / ( 1u << q );

                    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->output_mem[0][p] = (float) hCPE->output_mem_fx[0][p] / ( 1u << q );
                        hCPE->output_mem[1][p] = (float) hCPE->output_mem_fx[1][p] / ( 1u << q );
                    }

                    hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_float[p] = (float) hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_32[p] / ONE_IN_Q14;
                    hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_float[p] = (float) hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_out_32[p] / ( 1u << q );
                    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;
                        hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_float[p] = (float) hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_mem_in_32[p] / ( 1u << q );
                    }
                }
                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]->hTcxDec->FBTCXdelayBuf_float[k] = (float) hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_32[k] / ( 1u << q );
                    }
                }
                hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev_float = (float) hCPE->hCoreCoder[n]->hTcxLtpDec->tcxltp_gain_post_prev / ONE_IN_Q15;
@@ -362,10 +363,10 @@ ivas_error ivas_mct_dec(
                {
                    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;
                        hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_float[p] = (float) hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_32[p] / ( 1u << q );
                        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_mem_out_float[p] = (float) hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_32[p] / ( 1u << q );
                        }
                    }
                    hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_post_prev_float = (float) hCPE->hStereoDft->hTcxLtpDec->tcxltp_gain_post_prev / ONE_IN_Q15;
@@ -470,7 +471,7 @@ ivas_error ivas_mct_dec(
            }

            save_synthesis_hq_fec_fx( sts[n], output_fx, output_frame, hCPE );

            save_synthesis_hq_fec(sts[n], output[cpe_id * CPE_CHANNELS + n], output_frame, hCPE);
            if ( ( sts[n]->codec_mode == MODE1 && sts[n]->hTcxDec != NULL ) && ( ( sts[n]->core == ACELP_CORE && !( sts[n]->bfi == 1 && sts[n]->con_tcx == 1 ) ) || sts[n]->core == HQ_CORE ) )
            {
                /*dumps*/
+1 −1
Original line number Diff line number Diff line
@@ -1182,7 +1182,7 @@ void ivas_sba_dirac_stereo_dec_fx(
        stereo_dft_dec_synthesize_fx( hCPE, DFT, 1, output[1], output_frame );
    }

    synchro_synthesis_fx( st_ivas->hDecoderConfig->ivas_total_brate, hCPE, output, output_frame, 1 /*st_ivas->sba_dirac_stereo_flag*/ );
    synchro_synthesis_fixed_clean( st_ivas->hDecoderConfig->ivas_total_brate, hCPE, output, output_frame, 1 /*st_ivas->sba_dirac_stereo_flag*/ );

    /* output scaling */
    IF ( EQ_16(sba_mono_flag, 0) )
Loading