Commit 8c4cbf5a authored by multrus's avatar multrus
Browse files

merge from main

parents 270ae8ce e1206992
Loading
Loading
Loading
Loading
Loading
+0 −18
Original line number Diff line number Diff line
@@ -159,11 +159,7 @@ typedef struct

static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg );
static void usage_dec( void );
#ifdef FIX_FLOAT_1539_G192_FORMAT_SWITCH
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE *phIvasDec, int16_t *pcmBuf );
#else
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
#endif
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE *phIvasDec, int16_t *pcmBuf );
static ivas_error load_hrtf_from_file( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const IVAS_AUDIO_CONFIG OutputConfig, const int32_t output_Fs );
static void do_object_editing_fx( IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader );
@@ -670,11 +666,7 @@ int main(
    }
    else
    {
#ifdef FIX_FLOAT_1539_G192_FORMAT_SWITCH
        error = decodeG192( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &splitRendBits, &hIvasDec, pcmBuf );
#else
        error = decodeG192( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &splitRendBits, hIvasDec, pcmBuf );
#endif
    }

    if ( error == IVAS_ERR_OK || error == IVAS_ERR_END_OF_FILE )
@@ -2002,11 +1994,7 @@ static ivas_error decodeG192(
    Vector3PairFileReader *referenceVectorReader,
    ObjectEditFileReader *objectEditFileReader,
    ISAR_SPLIT_REND_BITS_DATA *splitRendBits,
#ifdef FIX_FLOAT_1539_G192_FORMAT_SWITCH
    IVAS_DEC_HANDLE *phIvasDec,
#else
    IVAS_DEC_HANDLE hIvasDec,
#endif
    int16_t *pcmBuf )

{
@@ -2014,9 +2002,7 @@ static ivas_error decodeG192(
    uint16_t bit_stream[IVAS_MAX_BITS_PER_FRAME + 4 * 8];
    int16_t i, num_bits;
    int16_t bfi = 0;
#ifdef FIX_FLOAT_1539_G192_FORMAT_SWITCH
    IVAS_DEC_HANDLE hIvasDec = *phIvasDec;
#endif
    AudioFileWriter *afWriter = NULL;
    MasaFileWriter *masaWriter = NULL;
    bool decodedGoodFrame = false;
@@ -2040,9 +2026,7 @@ static ivas_error decodeG192(
    int16_t isSplitRend, isSplitCoded;
    IVAS_RENDER_CONFIG_DATA renderConfig;
    RenderConfigReader *renderConfigReader = NULL;
#ifdef FIX_FLOAT_1539_G192_FORMAT_SWITCH
    bool restartNeeded;
#endif

#ifdef VARIABLE_SPEED_DECODING
    if ( arg.tsmEnabled )
@@ -2297,7 +2281,6 @@ static ivas_error decodeG192(
                    return error;
                }

#ifdef FIX_FLOAT_1539_G192_FORMAT_SWITCH
                if ( ( error = IVAS_DEC_isRestartNeeded( hIvasDec, &restartNeeded ) ) != IVAS_ERR_OK )
                {
                    return error;
@@ -2311,7 +2294,6 @@ static ivas_error decodeG192(
                        goto cleanup;
                    }
                }
#endif

                /* Placeholder for memory reallocation */
                /* ... */
+15 −0
Original line number Diff line number Diff line
@@ -825,7 +825,11 @@ Word16 getTcxLpcShapedAri(
 * Initialization of TCX
 *-----------------------------------------------------------------------*/

#ifdef HARMONIZE_2567_init_functions
void init_tcx_cfg_fx(
#else
void init_tcx_cfg_ivas_fx(
#endif
    TCX_CONFIG_HANDLE hTcxCfg,
    const Word32 total_brate,     /*Q0*/
    const Word32 sr_core,         /*Q0*/
@@ -841,7 +845,12 @@ void init_tcx_cfg_ivas_fx(
    const Word16 infoIGFStopFreq, /*Q0*/
    const Word16 element_mode,    /*Q0*/
    const Word16 ini_frame,       /*Q0*/
#ifdef HARMONIZE_2567_init_functions
    const Word16 MCT_flag, /*Q0*/
    const Word16 fscaleFB /*Q0*/ )
#else
    const Word16 MCT_flag /*Q0*/ )
#endif
{
    Word16 i;
    Word16 mdctWindowLength;
@@ -859,7 +868,11 @@ void init_tcx_cfg_ivas_fx(
    hTcxCfg->tcx_mdct_window_length_old = hTcxCfg->tcx_mdct_window_length; /*Q0*/
    move16();
    mdctWindowLength = getMdctWindowLength_fx( fscale ); /*Q0*/
#ifdef HARMONIZE_2567_init_functions
    mdctWindowLengthFB = getMdctWindowLength_fx( fscaleFB ); /*Q0*/ /* this replaces (int16_t) ( mdctWindowLength * input_Fs / sr_core ) as used in float */
#else
    mdctWindowLengthFB = (Word16) ( mdctWindowLength * input_Fs / sr_core );
#endif

    init_tcx_window_cfg_fx( hTcxCfg, sr_core, input_Fs, L_frame, L_frameTCX, mdctWindowLength, mdctWindowLengthFB, element_mode );
    /* SQ deadzone & memory quantization*/
@@ -1080,6 +1093,7 @@ void init_tcx_window_cfg_fx(
    return;
}

#ifndef HARMONIZE_2567_init_functions
void init_tcx_cfg_fx(
    TCX_CONFIG_HANDLE hTcxCfg,
    const Word32 total_brate,     /*Q0*/
@@ -1227,3 +1241,4 @@ void init_tcx_cfg_fx(

    return;
}
#endif
+0 −8
Original line number Diff line number Diff line
@@ -1146,22 +1146,14 @@ static Word16 Find_bit_alloc_IVAS_fx(
            /* bits_per_bands[i] = 112; */
            bits_per_bands[i] = Q18_112;
            move32();
#ifndef FIX_2585_BIT_ALLOCATION_DIFF
            j = add( j, add( i, 1 ) );
#else
            j = add( i, 1 );
#endif
        }

        /* safety check for overage bit reallocation */
        /* else if (bits_per_bands[i] + sum_bit / 3 > 112) */
        ELSE IF( GT_32( L_add( bits_per_bands[i], Mpy_32_16_1( sum_bit, Q15_0_33 ) ), Q18_112 ) )
        {
#ifndef FIX_2585_BIT_ALLOCATION_DIFF
            j = add( j, add( i, 1 ) );
#else
            j = add( i, 1 );
#endif
        }
    }

+0 −22
Original line number Diff line number Diff line
@@ -1173,12 +1173,8 @@ void stereo_dft_dec_fx(

Word32 stereo_dft_enc_synthesize_fx(
    STEREO_DFT_ENC_DATA_HANDLE hStereoDft,                      /* i/o: encoder stereo handle               */
#ifdef NONBE_FIX_ISSUE_2206
    Word32 *output_fx,                                          /* i/o  : output synthesis         q_output */
    Word16 *q_output,                                           /* i/o  : output synthesis               Q0 */
#else
    Word32 *output_fx,                                          /* o  : output synthesis                Q16 */
#endif
    Word16 *output_start_index,
    Word16 *output_end_index,
    const Word16 chan,                                          /* i  : channel number                      */
@@ -1358,12 +1354,8 @@ void stereo_tcx_init_dec_fx(

void stereo_icBWE_enc_fx(
    CPE_ENC_HANDLE hCPE,                                        /* i/o: CPE encoder structure                */
#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT
    const Word16 shb_speech_ref_fx16[],                         /* i  : SHB speech ref channel             shb_speech_ref_q*/
    const Word16 shb_speech_ref_q,                              /* i  : SHB speech ref channel Q             */
#else
    const Word16 shb_speech_ref_fx16[],                         /* i  : SHB speech ref channel             Q0*/
#endif
    Word16 shb_speech_nonref_fx_16[],                           /* i/o: SHB speech non-ref channel         shb_speech_nonref_e*/
    Word16 shb_speech_nonref_e,                                 /* i/o: SHB speech non-ref channel           */
    const Word16 *voice_factors_fx                              /* i  : voicing factors                  Q15 */
@@ -2673,9 +2665,7 @@ Word16 ivas_acelp_tcx20_switching_fx(
    Word16 *inp_fx,                                             /* i  : new input signal                        */
    Word16 q_inp,                                               /* i  : i/p Q                                   */
    Word16 *wsp,                                                /* i  : input weighted signal                   */
#ifdef NONBE_FIX_ISSUE_2206
    Word16 q_wsp,                                               /* i  : Q of input weighted signal                   */
#endif
    Word32 non_staX,                                            /* i  : unbound non-stationarity for sp/mu clas */
    Word16 *pitch_fr,                                           /* i  : fraction pitch values                   */
    Word16 *voicing_fr,                                         /* i  : fractional voicing values               */
@@ -5707,12 +5697,8 @@ void pre_proc_ivas_fx(
    Word16 *epsP_fx_q,                                          /* i  : LP prediction errors                                   */
    Word16 lsp_new_fx[M],                                       /* i/o: LSPs at the end of the frame                        Q15*/
    Word16 lsp_mid_fx[M],                                       /* i/o: LSPs in the middle of the frame                     Q15*/
#ifdef NONBE_FIX_ISSUE_2206
    Word16 *new_inp_resamp16k_fx,                               /* o  : new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE    q_new_inp_resamp16k_fx*/
    Word16 *q_new_inp_resamp16k_fx,                             /* o  : Q value of new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE */
#else
    Word16 *new_inp_resamp16k_fx,                               /* o  : new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE    Q_new-1*/
#endif
    Word16 *Voicing_flag,                                       /* o  : voicing flag for HQ FEC                              Q0*/
    Word16 old_wsp_fx[],                                        /* i  : weighted input signal buffer                  e_old_wsp*/
    const Word16 e_old_wsp,                                     /* i  : Q value of weighted input signal buffer                */
@@ -6087,12 +6073,8 @@ UWord16 get_indice_st(

void stereo_mdct_core_enc_fx(
    CPE_ENC_HANDLE hCPE,                                        /* i/o: CPE encoder structure                   */
#ifdef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549
    Word16 new_samples[CPE_CHANNELS][L_INP],                    /* i  : new samples                new_samples_q*/
    Word16 *new_samples_q,
#else
    Word16 new_samples[CPE_CHANNELS][L_INP],                    /* i  : new samples                       Qnew-1*/
#endif
    Word16 old_wsp[CPE_CHANNELS][L_WSP],                        /* i  : 12.8kHz weighted speech (for LTP      Qx*/
    Word16 pitch_buf_fx[CPE_CHANNELS][NB_SUBFR16k]              /* o  : floating pitch for each subframe      Q6*/
);
@@ -6139,12 +6121,8 @@ void stereo_switching_dec_fx(

void ivas_mdct_core_whitening_enc_fx(
    CPE_ENC_HANDLE hCPE,                                        /* i/o: CPE encoder structure                   */
#ifdef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549
    Word16 new_samples_fx[CPE_CHANNELS][L_INP],                 /* i  : new samples                    Q_new[]-1*/
    Word16 *Q_new,                                              /* i  : new samples q                           */
#else
    Word16 new_samples_fx[CPE_CHANNELS][L_INP],                 /* i  : new samples                             */
#endif
    Word16 old_wsp_fx[CPE_CHANNELS][L_WSP],                     /* i  : 12.8kHz weighted speech (for LTP        */
    Word16 pitch_buf[CPE_CHANNELS][NB_SUBFR16k],                /* o  : floating pitch for each subframe        */
    Word32 *mdst_spectrum_long[CPE_CHANNELS],                   /* o  : buffer for MDST spectrum                */
+0 −14
Original line number Diff line number Diff line
@@ -204,7 +204,6 @@ void tdm_bit_alloc(
        }
        ELSE
        {
#ifdef FIX_2585_BIT_ALLOCATION_DIFF
            Word16 neg = 0;
            move16();
            if ( bit_rate_diff_fx < 0 )
@@ -212,17 +211,12 @@ void tdm_bit_alloc(
                neg = 1;
                move16();
            }
#endif
            IF( LT_16( ener_ratio_idx, LRTD_STEREO_MID_IS_PRIM ) )
            {
                bit_rate_diff_fx = imult3216( bit_rate_diff_fx, sub( LRTD_STEREO_MID_IS_PRIM, ener_ratio_idx ) ); /*Q0*/
                bit_rate_diff_fx = L_shr( bit_rate_diff_fx, 1 );                                                  /*Q0*/
                bit_rate_diff_fx = Mpy_32_16_1( L_abs( bit_rate_diff_fx ), 3277 /*0.1f in Q15*/ );                /*Q0*/
#ifdef FIX_2585_BIT_ALLOCATION_DIFF
                if ( neg != 0 )
#else
                if ( bit_rate_diff_fx < 0 )
#endif
                {
                    bit_rate_diff_fx = L_negate( bit_rate_diff_fx );
                }
@@ -232,11 +226,7 @@ void tdm_bit_alloc(
                bit_rate_diff_fx = imult3216( bit_rate_diff_fx, sub( ener_ratio_idx, LRTD_STEREO_MID_IS_PRIM ) ); /*Q0*/
                bit_rate_diff_fx = L_shr( bit_rate_diff_fx, 1 );                                                  /*Q0*/
                bit_rate_diff_fx = Mpy_32_16_1( L_abs( bit_rate_diff_fx ), 3277 /*0.1f in Q15*/ );                /*Q0*/
#ifdef FIX_2585_BIT_ALLOCATION_DIFF
                if ( neg != 0 )
#else
                if ( bit_rate_diff_fx < 0 )
#endif
                {
                    bit_rate_diff_fx = L_negate( bit_rate_diff_fx );
                }
@@ -338,11 +328,7 @@ void tdm_bit_alloc(
            *tdm_low_rate_mode = 0;
            move16();
        }
#ifndef FIX_2585_BIT_ALLOCATION_DIFF
        ELSE IF( ( tdm_lp_reuse_flag == 0 && LT_32( *total_brate_sec, TDM_UC_NORMAL_MODE_MINBR_LP_R ) && EQ_16( coder_type, UNVOICED ) ) || ( tdm_lp_reuse_flag == 0 && LE_32( *total_brate_sec, L_deposit_l( add( tdm_bit_allc_tbl[idx][0], MID_LP_BRATE ) ) ) ) )
#else
        ELSE IF( ( tdm_lp_reuse_flag == 0 && LT_32( *total_brate_sec, TDM_UC_NORMAL_MODE_MINBR_LP_R ) && EQ_16( coder_type, UNVOICED ) ) || ( tdm_lp_reuse_flag == 0 && LT_32( *total_brate_sec, L_deposit_l( add( tdm_bit_allc_tbl[idx][0], MID_LP_BRATE ) ) ) ) )
#endif
        {
            *total_brate_sec = L_add( *total_brate_sec, MID_LP_BRATE ); /*Q0*/
            move32();
Loading