Commit e792d0e2 authored by vaclav's avatar vaclav
Browse files

FIX_2280_REDUCTION_UNNECESSARY_SCALING2

parent f20a898e
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -109,6 +109,7 @@
#define FIX_2349_HARM_FIND_UV                           /* VA: basop issue 2349: harmonization of find_uv() function */
#define FIX_2280_REDUCTION_UNNECESSARY_SCALING          /* VA: reduction of unnecessary scaling */
//#define FIX_2280_REDUCTION_UNNECESSARY_SCALING_NONBE
#define FIX_2280_REDUCTION_UNNECESSARY_SCALING2

/* #################### End BE switches ################################## */

+5 −1
Original line number Diff line number Diff line
@@ -7661,7 +7661,11 @@ ivas_error core_switching_post_dec_fx(
#else
    Word32 *output_fx,           /* i/o: LB synth/upsampled LB synth                                                     Q4*/
#endif
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING2
    Word32 output_mem_fx32[], /* i  : OLA memory from last TCX/HQ frame                                               Qx*/
#else
    Word16 output_mem_fx[],      /* i  : OLA memory from last TCX/HQ frame                                               Qx*/
#endif
    const Word16 use_cldfb_for_dft,     /* i  : flag to use of CLDFB for DFT Stereo                                             Q0*/
    const Word16 output_frame,          /* i  : frame length                                                                    Q0*/
    const Word16 core_switching_flag,   /* i  : ACELP->HQ switching flag                                                        Q0*/
+18 −1
Original line number Diff line number Diff line
@@ -207,6 +207,12 @@ void bw_switching_pre_proc_fx(
}


/*---------------------------------------------------------------------*
 * core_switching_post_dec()
 *
 * Postprocessing for ACELP/HQ core switching
 *---------------------------------------------------------------------*/

ivas_error core_switching_post_dec_fx(
    Decoder_State *st_fx, /* i/o: decoder state structure                                                           */
    Word16 *synth,        /* i/o: output synthesis                                                            Qsynth*/
@@ -215,7 +221,11 @@ ivas_error core_switching_post_dec_fx(
#else
    Word32 *output_fx,                                                                                      /* i/o: LB synth/upsampled LB synth                                                     Q4*/
#endif
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING2
    Word32 output_mem_fx32[], /* i  : OLA memory from last TCX/HQ frame                                               Qx*/
#else
    Word16 output_mem_fx[],                                                                                 /* i  : OLA memory from last TCX/HQ frame                                               Qx*/
#endif
    const Word16 use_cldfb_for_dft,     /* i  : flag to use of CLDFB for DFT Stereo                                             Q0*/
    const Word16 output_frame,          /* i  : frame length                                                                    Q0*/
    const Word16 core_switching_flag,   /* i  : ACELP->HQ switching flag                                                        Q0*/
@@ -618,10 +628,17 @@ ivas_error core_switching_post_dec_fx(
                    hHQ_core->Q_old_wtda = Qtmp;
                    move16();
                }
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING2
                Word16 output_mem_fx[NS2SA( 48000, STEREO_DFT32MS_OVL_NS )];

                Copy_Scale_sig_32_16( output_mem_fx32, output_mem_fx, NS2SA_FX2( st_fx->output_Fs, STEREO_DFT32MS_OVL_NS ), -Q11 ); // Q(q_output_mem_fx-11)
                Scale_sig( output_mem_fx, NS2SA_FX2( st_fx->output_Fs, STEREO_DFT32MS_OVL_NS ), Qtmp );                             /* Qtmp */
#else
                IF( output_mem_fx != NULL )
                {
                    Scale_sig( output_mem_fx, NS2SA_FX2( st_fx->output_Fs, STEREO_DFT32MS_OVL_NS ), Qtmp ); /* Qtmp */
                }
#endif
                *Qsynth = Qtmp;
                move16();

+9 −3
Original line number Diff line number Diff line
@@ -835,6 +835,7 @@ ivas_error ivas_core_dec_fx(
        /*core_switching_post_dec*/
        Q_synth = add( sub( 15, e_sig[0] ), st->Q_syn_factor );

#ifndef FIX_2280_REDUCTION_UNNECESSARY_SCALING2
        /*------------------fix-to-fix-end-----------------------*/

        Word16 output_mem_16_fx[L_FRAME48k];
@@ -850,14 +851,15 @@ ivas_error ivas_core_dec_fx(
            p_output_mem_16 = NULL;
            set16_fx( output_mem_16_fx, 0, NS2SA_FX2( st->output_Fs, 3125000 ) );
        }

#endif
#ifndef FIX_2280_REDUCTION_UNNECESSARY_SCALING
        Scale_sig32( output_32_fx[n], L_FRAME48k, Q4 - Q11 ); // Q4

#endif
#ifndef FIX_2280_REDUCTION_UNNECESSARY_SCALING2
        /*size of synth is choosen as delay comp to start with*/
        /*-------------------cldfb-start-------------------------*/

#endif
        IF( st->cldfbSyn != NULL )
        {
            scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, Q4 - Q11 ); // Q4
@@ -917,7 +919,11 @@ ivas_error ivas_core_dec_fx(
            Copy_Scale_sig_16_32_no_sat( synth_16_fx[n], hSCE->save_synth_fx, output_frame, sub( hSCE->q_save_synth_fx, Q_synth ) ); // q_save_synth_fx
        }

#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING2
        IF( NE_32( ( error = core_switching_post_dec_fx( st, synth_16_fx[n], output_32_fx[n], p_output_mem_fx, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, last_element_mode, &Q_synth ) ), IVAS_ERR_OK ) )
#else
        IF( NE_32( ( error = core_switching_post_dec_fx( st, synth_16_fx[n], output_32_fx[n], p_output_mem_16, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, last_element_mode, &Q_synth ) ), IVAS_ERR_OK ) )
#endif
        {
            return error;
        }