Commit d36fbf20 authored by vaclav's avatar vaclav
Browse files

updt

parent b4c1d135
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1588,8 +1588,12 @@ void ivas_hq_core_dec_fx(
    const Word16 output_frame,                                  /* i  : output frame length                     */
    const Word16 hq_core_type,                                  /* i  : HQ core type                            */
    const Word16 core_switching_flag,                           /* i  : ACELP->HQ switching frame flag          */
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
    Word32 *output_32_fx                                        /* o  : synthesis @internal_Fs, Q11             */
#else
    Word16 output[],
    Word16 *Q_output 
#endif
);

void ivas_HQ_FEC_Mem_update_fx(
@@ -2068,7 +2072,11 @@ void ivas_buffer_deinterleaved_to_interleaved_fx(
void stereo_tcx_core_dec_fx(
    Decoder_State *st,                                          /* i/o: decoder state structure                     */
    const FRAME_MODE frameMode,                                 /* i  : Decoder frame mode                          */
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
    Word32 *signal_out_32_fx,                                   /* o  : synthesis @internal_Fs, Q11                 */
#else
    Word16 *signal_out,                                         /* o  : synthesis @internal_Fs, Q0                  */
#endif
    Word16 *signal_outFB,                                       /* o  : synthesis @output_Fs, Q0                    */
    Word16 pitch_buf[],                                         /* o  : floating pitch for each subframe, Q6        */
    const Word16 sba_dirac_stereo_flag,                         /* i  : signal stereo output for SBA DirAC          */
+9 −5
Original line number Diff line number Diff line
@@ -10200,7 +10200,11 @@ Word16 swb_bwe_dec_fx32(
ivas_error acelp_core_dec_fx(
    Decoder_State *st, /* i/o: decoder state structure                                                 */
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
    Word32 output_fx32[],        /* o  : synthesis @internal Fs                                               Q11*/
#else
    Word16 output_fx[],          /* o  : synthesis @internal Fs                                                  */
#endif
    Word16 synth_fx16[], /* o  : synthesis                                                               */
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
    Word32 save_hb_synth_fx32[], /* o  : HB synthesis                                                          Q0*/
+17 −5
Original line number Diff line number Diff line
@@ -53,7 +53,11 @@

ivas_error acelp_core_dec_fx(
    Decoder_State *st, /* i/o: decoder state structure                                                 */
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
    Word32 output_fx32[], /* o  : synthesis @internal Fs                                                  Q11*/
#else
    Word16 output_fx[],          /* o  : synthesis @internal Fs                                                  Q_syn*/
#endif
    Word16 synth_fx16[], /* o  : synthesis                                                               Q_syn2*/
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
    Word32 save_hb_synth_fx32[], /* o  : HB synthesis                                                            Q0*/
@@ -214,7 +218,11 @@ ivas_error acelp_core_dec_fx(
            Copy( lsp_new_fx, st->lsp_old_fx, M ); /*Q15*/
        }

#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
        set32_fx( output_fx32, 0, output_frame ); /* output and synth are not used in DFT domain CNG generation and the decoder output is unaffected if they are left uninitalized */
#else
        set16_fx( output_fx, 0, output_frame );  /* output and synth are not used in DFT domain CNG generation and the decoder output is unaffected if they are left uninitalized */
#endif
        set16_fx( synth_fx16, 0, output_frame ); /* They are however read in a few places which causes errors in the valgrind tests. Simplest solution from a code perspective was to set them to zero. */

        /* CN generation done in DFT domain */
@@ -2209,7 +2217,11 @@ ivas_error acelp_core_dec_fx(
        Scale_sig( syn_tmp_fx, add( st->L_frame, L_SUBFR ), negate( st->Q_syn ) ); // Q0
        IF( st->element_mode > EVS_MONO )
        {
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
            Copy_Scale_sig_16_32_no_sat( psyn_fx, output_fx32, L_FRAME48k, sub( Q11, st->Q_syn2 ) ); // Q_syn2->Q11
#else
            Copy( psyn_fx, output_fx, st->L_frame ); /*Q_syn*/
#endif
        }

        st->Q_syn2 = 0;
+36 −2
Original line number Diff line number Diff line
@@ -468,8 +468,13 @@ void ivas_hq_core_dec_fx(
    const Word16 output_frame,        /* i  : output frame length                Q0*/
    const Word16 hq_core_type,        /* i  : HQ core type                       Q0*/
    const Word16 core_switching_flag, /* i  : ACELP->HQ switching frame flag     Q0*/
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
    Word32 *output_32_fx /* o  : synthesis @internal_Fs, Q11        */
#else
    Word16 output[], /* Q_ouput */
    Word16 *Q_output )
    Word16 *Q_output
#endif
)
{
    Word16 num_bits, is_transient, hqswb_clas, inner_frame;
    Word16 i, j, flag_uv, num_Sb, nb_sfm;
@@ -504,7 +509,19 @@ void ivas_hq_core_dec_fx(
    Word16 mdctWindowLength;
    Word16 mdctWindowLengthFB;
    Word16 tmp_e;
#ifndef FIX_2280_REDUCTION_UNNECESSARY_SCALING
    Word16 tmp_out[L_FRAME48k];
#else
    Word16 output[L_FRAME48k];
    Word16 Q_output;

    Q_output = 0;
    move16();
    *Q_synth = 0;
    move16();
    st_fx->Q_syn_factor = 0;
    move16();
#endif

    /*--------------------------------------------------------------------------
     * Initializations
@@ -886,7 +903,11 @@ void ivas_hq_core_dec_fx(
                move16();
                Inverse_Transform( t_audio_q, &Q_audio, wtda_audio_LB, is_transient, st_fx->L_frame, inner_frame, st_fx->element_mode );
            }
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
            Q_output = Q_audio;
#else
            *Q_output = Q_audio;
#endif
            move16();
        }

@@ -912,7 +933,11 @@ void ivas_hq_core_dec_fx(
            IF( st_fx->element_mode > EVS_MONO )
            {
                /* LB synthesis for potential switch to ACELP */
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
                window_ola_fx( wtda_audio_LB, output, &Q_output, hHQ_core->old_out_LB_fx, &hHQ_core->Q_old_wtda_LB, L_FRAME16k, st_fx->hTcxCfg->tcx_last_overlap_mode, st_fx->hTcxCfg->tcx_curr_overlap_mode, st_fx->prev_bfi && !hHQ_core->ph_ecu_active, hHQ_core->oldHqVoicing, hHQ_core->oldgapsynth_fx );
#else
                window_ola_fx( wtda_audio_LB, output, Q_output, hHQ_core->old_out_LB_fx, &hHQ_core->Q_old_wtda_LB, L_FRAME16k, st_fx->hTcxCfg->tcx_last_overlap_mode, st_fx->hTcxCfg->tcx_curr_overlap_mode, st_fx->prev_bfi && !hHQ_core->ph_ecu_active, hHQ_core->oldHqVoicing, hHQ_core->oldgapsynth_fx );
#endif
            }
            test();
            test();
@@ -974,12 +999,21 @@ void ivas_hq_core_dec_fx(
        Copy( &st_fx->mem_pitch_gain[2], &st_fx->mem_pitch_gain[nbsubfr + 2], nbsubfr ); /* Q14 */
        set16_fx( &st_fx->mem_pitch_gain[2], 0, nbsubfr );
    }

    /* Move LB excitation to old_exc memory in case of switch HQ->ACELP */
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
    Copy_Scale_sig( output, st_fx->old_exc_fx + sub( L_EXC_MEM_DEC, st_fx->L_frame ), st_fx->L_frame, negate( Q_output ) ); /* Q0 */

    Copy_Scale_sig_16_32_DEPREC( output, output_32_fx, L_FRAME48k, sub( Q11, Q_output ) ); // Q11
    st_fx->Q_syn_factor = s_min( 0, s_min( *Q_synth, Q_output ) );
#else
    IF( st_fx->element_mode > EVS_MONO )
    {
        Copy_Scale_sig( output, tmp_out, st_fx->L_frame, negate( *Q_output ) );                    /* Q0 */
        Copy( tmp_out, st_fx->old_exc_fx + sub( L_EXC_MEM_DEC, st_fx->L_frame ), st_fx->L_frame ); /* Q0 */
    }
#endif

    return;
}

+14 −2
Original line number Diff line number Diff line
@@ -524,7 +524,7 @@ ivas_error ivas_core_dec_fx(
            move16();

#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
            IF( NE_32( ( error = acelp_core_dec_fx( st, output_16_fx[n], synth_16_fx[n], save_hb_synth_32_fx, bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx[n], sharpFlag[n], pitch_buf_fx[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lsfQ_PCh_fx, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hStereoCng, read_sid_info ) ), IVAS_ERR_OK ) )
            IF( NE_32( ( error = acelp_core_dec_fx( st, output_32_fx[n], synth_16_fx[n], save_hb_synth_32_fx, bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx[n], sharpFlag[n], pitch_buf_fx[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lsfQ_PCh_fx, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hStereoCng, read_sid_info ) ), IVAS_ERR_OK ) )
#else
            IF( NE_32( ( error = acelp_core_dec_fx( st, output_16_fx[n], synth_16_fx[n], save_hb_synth_16_fx, bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx[n], sharpFlag[n], pitch_buf_fx[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lsfQ_PCh_fx, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hStereoCng, read_sid_info ) ), IVAS_ERR_OK ) )
#endif
@@ -532,8 +532,10 @@ ivas_error ivas_core_dec_fx(
                return error;
            }

#ifndef FIX_2280_REDUCTION_UNNECESSARY_SCALING
            Copy_Scale_sig_16_32_no_sat( output_16_fx[n], output_32_fx[n], L_FRAME48k, sub( Q11, st->Q_syn2 ) ); // Q_syn2->Q11
            Scale_sig( output_16_fx[n], L_FRAME48k, negate( st->Q_syn2 ) );                                      // Q0
#endif
            IF( st->cldfbAna )
            {
                scale_sig32( st->cldfbAna->cldfb_state_fx, st->cldfbAna->cldfb_size, Q10 - Q11 ); /* 9 * (Word16)(st->L_frame * FRAMES_PER_SEC * INV_CLDFB_BANDWIDTH + 0.5f) , Q10  */
@@ -603,9 +605,13 @@ ivas_error ivas_core_dec_fx(
                move32();
            }

#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
            stereo_tcx_core_dec_fx( st, frameMode[n], output_32_fx[n], synth_16_fx[n], pitch_buf_fx[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hStereoCng, nchan_out, ivas_format );
#else
            stereo_tcx_core_dec_fx( st, frameMode[n], output_16_fx[n], synth_16_fx[n], pitch_buf_fx[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hStereoCng, nchan_out, ivas_format );

            Copy_Scale_sig_16_32_DEPREC( output_16_fx[n], output_32_fx[n], output_frame, sub( Q11, st->Q_syn_factor ) ); // Q11
#endif

            IF( st->hTcxDec )
            {
@@ -623,6 +629,11 @@ ivas_error ivas_core_dec_fx(
        IF( EQ_16( st->core, HQ_CORE ) )
        {
            /* HQ core decoder */
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
            ivas_hq_core_dec_fx( st, synth_16_fx[n], &Q_synth, output_frame, NORMAL_HQ_CORE, core_switching_flag[n], output_32_fx[n] );

            Scale_sig( synth_16_fx[n], output_frame, sub( st->Q_syn_factor, Q_synth ) ); // st->Q_syn_factor
#else
            Word16 Q_output;

            Q_output = 0;
@@ -638,6 +649,7 @@ ivas_error ivas_core_dec_fx(
            st->Q_syn_factor = s_min( 0, s_min( Q_synth, Q_output ) );
            Scale_sig( synth_16_fx[n], output_frame, sub( st->Q_syn_factor, Q_synth ) ); // st->Q_syn_factor
            Scale_sig( output_16_fx[n], L_FRAME48k, sub( st->Q_syn_factor, Q_output ) ); // st->Q_syn_factor
#endif
        }

        /*---------------------------------------------------------------------*
Loading