Commit f58f7608 authored by vaclav's avatar vaclav
Browse files

simplification

parent d51b093c
Loading
Loading
Loading
Loading
Loading
+12 −15
Original line number Diff line number Diff line
@@ -227,9 +227,6 @@ ivas_error ivas_corecoder_enc_reconfig_fx(
        Word16 q_com_cpe = Q15, q_com_cpe32 = Q31;
        move16();
        move16();
#ifdef FIX_2320_OOB_SCE_SWITCHING
        Word16 len_fir = NS2SA_FX2( hEncoderConfig->input_Fs, DELAY_FIR_RESAMPL_NS );
#endif
        IF( nSCE_old > 0 )
        {
            FOR( k = 0; k < nSCE_old; k++ )
@@ -240,8 +237,8 @@ ivas_error ivas_corecoder_enc_reconfig_fx(
                move16();
                q_com_sce = s_min( q_com_sce, st_ivas->hSCE[k]->hCoreCoder[0]->q_old_inp );
#ifdef FIX_2320_OOB_SCE_SWITCHING
                shift = sub( getScaleFactor16( st_ivas->hSCE[k]->hCoreCoder[0]->input_fx, add( input_frame, len_fir ) ), Q1 );
                scale_sig( st_ivas->hSCE[k]->hCoreCoder[0]->input_fx, add( input_frame, len_fir ), shift ); /*  st_ivas->hSCE[k]->hCoreCoder[0]->q_inp + shift */
                shift = sub( getScaleFactor16( st_ivas->hSCE[k]->hCoreCoder[0]->input_fx, input_frame ), Q1 );
                scale_sig( st_ivas->hSCE[k]->hCoreCoder[0]->input_fx, input_frame, shift ); /*  st_ivas->hSCE[k]->hCoreCoder[0]->q_inp + shift */
#else
                shift = sub( getScaleFactor16( st_ivas->hSCE[k]->hCoreCoder[0]->input_fx, sub( L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), input_frame ) ), Q1 );
                scale_sig( st_ivas->hSCE[k]->hCoreCoder[0]->input_fx, sub( L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), input_frame ), shift ); /*  st_ivas->hSCE[k]->hCoreCoder[0]->q_inp + shift */
@@ -256,8 +253,8 @@ ivas_error ivas_corecoder_enc_reconfig_fx(
                move16();
                q_com_sce32 = s_min( q_com_sce32, st_ivas->hSCE[k]->hCoreCoder[0]->q_old_inp32 );
#ifdef FIX_2320_OOB_SCE_SWITCHING
                shift = sub( getScaleFactor32( st_ivas->hSCE[k]->hCoreCoder[0]->input32_fx, add( input_frame, len_fir ) ), Q1 );
                scale_sig32( st_ivas->hSCE[k]->hCoreCoder[0]->input32_fx, add( input_frame, len_fir ), shift ); /*  st_ivas->hSCE[k]->hCoreCoder[0]->q_inp + shift */
                shift = sub( getScaleFactor32( st_ivas->hSCE[k]->hCoreCoder[0]->input32_fx, input_frame ), Q1 );
                scale_sig32( st_ivas->hSCE[k]->hCoreCoder[0]->input32_fx, input_frame, shift ); /*  st_ivas->hSCE[k]->hCoreCoder[0]->q_inp + shift */
#else
                shift = sub( getScaleFactor32( st_ivas->hSCE[k]->hCoreCoder[0]->input32_fx, sub( L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), input_frame ) ), Q1 );
                scale_sig32( st_ivas->hSCE[k]->hCoreCoder[0]->input32_fx, sub( L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), input_frame ), shift ); /*  st_ivas->hSCE[k]->hCoreCoder[0]->q_inp + shift */
@@ -281,8 +278,8 @@ ivas_error ivas_corecoder_enc_reconfig_fx(
                    move16();
                    q_com_cpe = s_min( q_com_cpe, st_ivas->hCPE[cpe_id]->hCoreCoder[n]->q_old_inp );
#ifdef FIX_2320_OOB_SCE_SWITCHING
                    shift = sub( getScaleFactor16( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input_fx, add( input_frame, len_fir ) ), Q1 );
                    scale_sig( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input_fx, add( input_frame, len_fir ), shift ); /* st_ivas->hCPE[cpe_id]->hCoreCoder[n]->q_inp + shift */
                    shift = sub( getScaleFactor16( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input_fx, input_frame ), Q1 );
                    scale_sig( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input_fx, input_frame, shift ); /* st_ivas->hCPE[cpe_id]->hCoreCoder[n]->q_inp + shift */
#else
                    shift = sub( getScaleFactor16( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input_fx, sub( L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), input_frame ) ), Q1 );
                    scale_sig( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input_fx, sub( L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), input_frame ), shift ); /* st_ivas->hCPE[cpe_id]->hCoreCoder[n]->q_inp + shift */
@@ -297,8 +294,8 @@ ivas_error ivas_corecoder_enc_reconfig_fx(
                    move16();
                    q_com_cpe32 = s_min( q_com_cpe32, st_ivas->hCPE[cpe_id]->hCoreCoder[n]->q_old_inp32 );
#ifdef FIX_2320_OOB_SCE_SWITCHING
                    shift = sub( getScaleFactor32( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input32_fx, add( input_frame, len_fir ) ), Q1 );
                    scale_sig32( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input32_fx, add( input_frame, len_fir ), shift ); /* st_ivas->hCPE[cpe_id]->hCoreCoder[n]->q_inp + shift */
                    shift = sub( getScaleFactor32( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input32_fx, input_frame ), Q1 );
                    scale_sig32( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input32_fx, input_frame, shift ); /* st_ivas->hCPE[cpe_id]->hCoreCoder[n]->q_inp + shift */
#else
                    shift = sub( getScaleFactor32( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input32_fx, sub( L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), input_frame ) ), Q1 );
                    scale_sig32( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input32_fx, sub( L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), input_frame ), shift );                                                    /* st_ivas->hCPE[cpe_id]->hCoreCoder[n]->q_inp + shift */
@@ -318,14 +315,14 @@ ivas_error ivas_corecoder_enc_reconfig_fx(
                st_ivas->hSCE[k]->hCoreCoder[0]->q_old_inp = q_com;
                move16();
#ifdef FIX_2320_OOB_SCE_SWITCHING
                scale_sig( st_ivas->hSCE[k]->hCoreCoder[0]->input_fx, add( input_frame, len_fir ), sub( q_com, st_ivas->hSCE[k]->hCoreCoder[0]->q_inp ) ); /* q_com */
                scale_sig( st_ivas->hSCE[k]->hCoreCoder[0]->input_fx, input_frame, sub( q_com, st_ivas->hSCE[k]->hCoreCoder[0]->q_inp ) ); /* q_com */
#else
                scale_sig( st_ivas->hSCE[k]->hCoreCoder[0]->input_fx, sub( L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), input_frame ), sub( q_com, st_ivas->hSCE[k]->hCoreCoder[0]->q_inp ) );                  /* q_com */
#endif
                st_ivas->hSCE[k]->hCoreCoder[0]->q_inp = q_com;
                move16();
#ifdef FIX_2320_OOB_SCE_SWITCHING
                Copy_Scale_sig_16_32_DEPREC( st_ivas->hSCE[k]->hCoreCoder[0]->input_buff_fx, st_ivas->hSCE[k]->hCoreCoder[0]->input_buff32_fx, add( shl( input_frame, 1 ), len_fir ), Q6 ); /* Q6 + q_com */
                Copy_Scale_sig_16_32_DEPREC( st_ivas->hSCE[k]->hCoreCoder[0]->input_buff_fx, st_ivas->hSCE[k]->hCoreCoder[0]->input_buff32_fx, shl( input_frame, 1 ), Q6 ); /* Q6 + q_com */
#else
                Copy_Scale_sig_16_32_DEPREC( st_ivas->hSCE[k]->hCoreCoder[0]->input_buff_fx, st_ivas->hSCE[k]->hCoreCoder[0]->input_buff32_fx, L_FRAME48k + NS2SA( 48000, IVAS_FB_ENC_DELAY_NS ) + L_FRAME48k, Q6 );               /* Q6 + q_com */
#endif
@@ -346,14 +343,14 @@ ivas_error ivas_corecoder_enc_reconfig_fx(
                    st_ivas->hCPE[cpe_id]->hCoreCoder[n]->q_old_inp = q_com;
                    move16();
#ifdef FIX_2320_OOB_SCE_SWITCHING
                    scale_sig( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input_fx, add( input_frame, len_fir ), sub( q_com, st_ivas->hCPE[cpe_id]->hCoreCoder[n]->q_inp ) ); /* q_com */
                    scale_sig( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input_fx, input_frame, sub( q_com, st_ivas->hCPE[cpe_id]->hCoreCoder[n]->q_inp ) ); /* q_com */
#else
                    scale_sig( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input_fx, sub( L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), input_frame ), sub( q_com, st_ivas->hCPE[cpe_id]->hCoreCoder[n]->q_inp ) );    /* q_com */
#endif
                    st_ivas->hCPE[cpe_id]->hCoreCoder[n]->q_inp = q_com;
                    move16();
#ifdef FIX_2320_OOB_SCE_SWITCHING
                    Copy_Scale_sig_16_32_DEPREC( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input_buff_fx, st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input_buff32_fx, add( shl( input_frame, 1 ), len_fir ), Q6 ); /* Q6 + q_com */
                    Copy_Scale_sig_16_32_DEPREC( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input_buff_fx, st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input_buff32_fx, shl( input_frame, 1 ), Q6 ); /* Q6 + q_com */
#else
                    Copy_Scale_sig_16_32_DEPREC( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input_buff_fx, st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input_buff32_fx, L_FRAME48k + NS2SA( 48000, IVAS_FB_ENC_DELAY_NS ) + L_FRAME48k, Q6 ); /* Q6 + q_com */
#endif
+7 −8
Original line number Diff line number Diff line
@@ -438,11 +438,10 @@ ivas_error ivas_cpe_enc_fx(
     *----------------------------------------------------------------*/

#ifdef FIX_2320_OOB_SCE_SWITCHING
    Word16 len_input_buff = add( shl( input_frame, 1 ), NS2SA_FX2( hEncoderConfig->input_Fs, DELAY_FIR_RESAMPL_NS ) );
    shift = s_min( L_norm_arr( sts[0]->input_buff32_fx, len_input_buff ), L_norm_arr( sts[1]->input_buff32_fx, len_input_buff ) );
    shift = s_min( L_norm_arr( sts[0]->input_buff32_fx, shl( input_frame, 1 ) ), L_norm_arr( sts[1]->input_buff32_fx, shl( input_frame, 1 ) ) );
    q_min = add( sts[0]->q_inp32, sub( shift, find_guarded_bits_fx( input_frame ) ) );
    scale_sig32( sts[1]->input_buff32_fx, len_input_buff, sub( q_min, sts[1]->q_inp32 ) ); /* q_min */
    scale_sig32( sts[0]->input_buff32_fx, len_input_buff, sub( q_min, sts[0]->q_inp32 ) ); /* q_min */
    scale_sig32( sts[1]->input_buff32_fx, shl( input_frame, 1 ), sub( q_min, sts[1]->q_inp32 ) ); /* q_min */
    scale_sig32( sts[0]->input_buff32_fx, shl( input_frame, 1 ), sub( q_min, sts[0]->q_inp32 ) ); /* q_min */
#else
    shift = s_min( L_norm_arr( sts[0]->input_buff32_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), L_norm_arr( sts[1]->input_buff32_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ) );
    q_min = add( sts[0]->q_inp32, sub( shift, find_guarded_bits_fx( input_frame ) ) );
@@ -458,10 +457,10 @@ ivas_error ivas_cpe_enc_fx(
    stereo_tca_enc_fx( hCPE, input_frame );

#ifdef FIX_2320_OOB_SCE_SWITCHING
    shift = sub( add( L_norm_arr( sts[0]->input_buff32_fx, len_input_buff ), sts[0]->q_inp32 ), 16 );
    shift = s_min( shift, sub( add( L_norm_arr( sts[1]->input_buff32_fx, len_input_buff ), sts[1]->q_inp32 ), 16 ) );
    Copy_Scale_sig32_16( sts[0]->input_buff32_fx, sts[0]->input_buff_fx, len_input_buff, sub( add( Q16, shift ), sts[0]->q_inp32 ) ); // shift
    Copy_Scale_sig32_16( sts[1]->input_buff32_fx, sts[1]->input_buff_fx, len_input_buff, sub( add( Q16, shift ), sts[1]->q_inp32 ) ); // shift
    shift = sub( add( L_norm_arr( sts[0]->input_buff32_fx, shl( input_frame, 1 ) ), sts[0]->q_inp32 ), 16 );
    shift = s_min( shift, sub( add( L_norm_arr( sts[1]->input_buff32_fx, shl( input_frame, 1 ) ), sts[1]->q_inp32 ), 16 ) );
    Copy_Scale_sig32_16( sts[0]->input_buff32_fx, sts[0]->input_buff_fx, shl( input_frame, 1 ), sub( add( Q16, shift ), sts[0]->q_inp32 ) ); // shift
    Copy_Scale_sig32_16( sts[1]->input_buff32_fx, sts[1]->input_buff_fx, shl( input_frame, 1 ), sub( add( Q16, shift ), sts[1]->q_inp32 ) ); // shift
#else
    shift = sub( add( L_norm_arr( sts[0]->input_buff32_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), sts[0]->q_inp32 ), 16 );
    shift = s_min( shift, sub( add( L_norm_arr( sts[1]->input_buff32_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), sts[1]->q_inp32 ), 16 ) );