Commit 7b218f96 authored by vaclav's avatar vaclav
Browse files

- Merge remote-tracking branch 'remotes/origin/main' into 1880-basop-PortFlpMr1548

- port MR, part2
parents ef7604b6 494a65f4
Loading
Loading
Loading
Loading
Loading
+12 −4
Original line number Original line Diff line number Diff line
@@ -623,7 +623,9 @@ ivas_error config_acelp1_fx(
    const Word16 tdm_lp_reuse_flag,        /* i  : LPC reuse flag (can be 1 only with secondary channel */
    const Word16 tdm_lp_reuse_flag,        /* i  : LPC reuse flag (can be 1 only with secondary channel */
    const Word16 tdm_low_rate_mode,        /* i  : secondary channel low rate mode flag */
    const Word16 tdm_low_rate_mode,        /* i  : secondary channel low rate mode flag */
    const Word16 idchan,                   /* i  : stereo channel ID               */
    const Word16 idchan,                   /* i  : stereo channel ID               */
#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
    const Word16 active_cnt, /* i  : Active frame counter            */
    const Word16 active_cnt, /* i  : Active frame counter            */
#endif
    const Word16 tdm_Pitch_reuse_flag, /* i  : primary channel pitch reuse flag*/
    const Word16 tdm_Pitch_reuse_flag, /* i  : primary channel pitch reuse flag*/
    const Word16 tdm_LRTD_flag,        /* i  : LRTD stereo mode flag           */
    const Word16 tdm_LRTD_flag,        /* i  : LRTD stereo mode flag           */
    const Word16 GSC_IVAS_mode         /* i  : GSC IVAS mode                   */
    const Word16 GSC_IVAS_mode         /* i  : GSC IVAS mode                   */
@@ -806,7 +808,9 @@ ivas_error config_acelp1_fx(


        test();
        test();
        test();
        test();
#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
        test();
        test();
#endif
        IF( !tdm_lp_reuse_flag || idchan == 0 )
        IF( !tdm_lp_reuse_flag || idchan == 0 )
        {
        {
            /* LSF Q bit-budget */
            /* LSF Q bit-budget */
@@ -883,7 +887,11 @@ ivas_error config_acelp1_fx(


            bits = sub( bits, acelp_cfg->mid_lsf_bits );
            bits = sub( bits, acelp_cfg->mid_lsf_bits );
        }
        }
#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
        ELSE IF( EQ_16( tdm_lp_reuse_flag, 1 ) && EQ_16( idchan, 1 ) )
#else
        ELSE IF( EQ_16( tdm_lp_reuse_flag, 1 ) && EQ_16( idchan, 1 ) && NE_16( active_cnt, 1 ) )
        ELSE IF( EQ_16( tdm_lp_reuse_flag, 1 ) && EQ_16( idchan, 1 ) && NE_16( active_cnt, 1 ) )
#endif
        {
        {
            bits = sub( bits, TDM_IC_LSF_PRED_BITS );
            bits = sub( bits, TDM_IC_LSF_PRED_BITS );
        }
        }
+0 −5
Original line number Original line Diff line number Diff line
@@ -397,13 +397,8 @@ void ivas_get_dirac_sba_max_md_bits_fx(
        /* OSBA needs an additional 2-bits safety margin to avoid acelp crashes */
        /* OSBA needs an additional 2-bits safety margin to avoid acelp crashes */
        IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) )
        IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) )
        {
        {
#ifdef NONBE_FIX_SBA_SIGNALING_BITS_B
            ( *metadata_max_bits ) = sub( ( *metadata_max_bits ), 7 );
            ( *metadata_max_bits ) = sub( ( *metadata_max_bits ), 7 );
            move16();
            move16();
#else
            ( *metadata_max_bits ) = sub( ( *metadata_max_bits ), 3 );
            move16();
#endif
        }
        }
    }
    }
    ELSE IF( LE_32( sba_total_brate, IVAS_32k ) )
    ELSE IF( LE_32( sba_total_brate, IVAS_32k ) )
+4 −3
Original line number Original line Diff line number Diff line
@@ -884,12 +884,13 @@ void ivas_lfe_dec_close_fx(
    LFE_DEC_HANDLE *hLFE /* i/o: LFE decoder handle */
    LFE_DEC_HANDLE *hLFE /* i/o: LFE decoder handle */
);
);



void td_stereo_param_updt_fx(
void td_stereo_param_updt_fx(
    const Word16 lsp_old_PCh_fx[],    /* i  : primary channel old LSPs                                     Q15 */
    const Word16 lsp_old_PCh_fx[],    /* i  : primary channel old LSPs                                     Q15 */
    const Word16 lsf_old_PCh_fx[],    /* i  : primary channel old LSFs                             Qlog2(2.56) */
    const Word16 lsf_old_PCh_fx[],    /* i  : primary channel old LSFs                             Qlog2(2.56) */
    const Word16 pitch_buf_PCh_fx[],  /* i  : primary channel pitch buffer                                  Q6 */
    const Word16 pitch_buf_PCh_fx[],  /* i  : primary channel pitch buffer                                  Q6 */
#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
    Word16 tdm_lspQ_PCh_fx[],         /* o  : Q LSPs for primary channel                                   Q15 */
    Word16 tdm_lspQ_PCh_fx[],         /* o  : Q LSPs for primary channel                                   Q15 */
#endif
    Word16 tdm_lsfQ_PCh_fx[],         /* o  : Q LSFs for primary channel                           Qlog2(2.56) */
    Word16 tdm_lsfQ_PCh_fx[],         /* o  : Q LSFs for primary channel                           Qlog2(2.56) */
    Word16 tdm_Pri_pitch_buf_fx[],    /* o  : pitch values for primary channel                              Q6 */
    Word16 tdm_Pri_pitch_buf_fx[],    /* o  : pitch values for primary channel                              Q6 */
    const Word16 flag_ACELP16k,       /* i  : ACELP@16kHz flag                                                 */
    const Word16 flag_ACELP16k,       /* i  : ACELP@16kHz flag                                                 */
@@ -3521,9 +3522,9 @@ void ivas_param_mc_enc_fx(
    Encoder_Struct *st_ivas,   /* i/o: IVAS Encoder handle                                 */
    Encoder_Struct *st_ivas,   /* i/o: IVAS Encoder handle                                 */
    BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle                      */
    BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle                      */
    Word32 *data_f_fx[],       /* i/o: input/transport MC data                     Q11 */
    Word32 *data_f_fx[],       /* i/o: input/transport MC data                     Q11 */
    const Word1
    const Word16 input_frame   /* i  : input frame length                                   */
    6 input_frame   /* i  : input frame length                                   */
);
);

void ivas_merge_masa_transports_fx(
void ivas_merge_masa_transports_fx(
    Word32 data_in_f1_fx[][L_FRAME48k], // Qx
    Word32 data_in_f1_fx[][L_FRAME48k], // Qx
    Word32 *data_in_f2_fx[],            // Qx
    Word32 *data_in_f2_fx[],            // Qx
+53 −9
Original line number Original line Diff line number Diff line
@@ -525,6 +525,7 @@ void tdm_bit_alloc(
    *total_brate_sec = L_add( *total_brate_sec, sub( fast_FCB_rates_2sfr[idx], tmp_rate ) ); /*Q0*/
    *total_brate_sec = L_add( *total_brate_sec, sub( fast_FCB_rates_2sfr[idx], tmp_rate ) ); /*Q0*/
    move32();
    move32();
}
}

/* To prevent 13.2 kb/s for primary channel as some bitstream issues arrise with it */
/* To prevent 13.2 kb/s for primary channel as some bitstream issues arrise with it */
IF( EQ_32( L_sub( element_brate_wo_meta, *total_brate_sec ), ACELP_13k20 ) )
IF( EQ_32( L_sub( element_brate_wo_meta, *total_brate_sec ), ACELP_13k20 ) )
{
{
@@ -532,6 +533,7 @@ IF( EQ_32( L_sub( element_brate_wo_meta, *total_brate_sec ), ACELP_13k20 ) )
    move32();
    move32();
}
}
}
}

/* prevent 2.4 kb/s and 2.8 kb/s as they are reserved bitrates for DTX and VBR */
/* prevent 2.4 kb/s and 2.8 kb/s as they are reserved bitrates for DTX and VBR */
test();
test();
IF( EQ_32( *total_brate_sec, PPP_NELP_2k80 ) || EQ_32( *total_brate_sec, SID_2k40 ) )
IF( EQ_32( *total_brate_sec, PPP_NELP_2k80 ) || EQ_32( *total_brate_sec, SID_2k40 ) )
@@ -545,16 +547,20 @@ move32();


return;
return;
}
}

/*-------------------------------------------------------------------*
/*-------------------------------------------------------------------*
 * td_stereo_param_updt()
 * td_stereo_param_updt()
 *
 *
 * copy certain TD stereo parameters from primary channel to secondary channel
 * copy certain TD stereo parameters from primary channel to secondary channel
 *-------------------------------------------------------------------*/
 *-------------------------------------------------------------------*/

void td_stereo_param_updt_fx(
void td_stereo_param_updt_fx(
    const Word16 lsp_old_PCh_fx[],   /* i  : primary channel old LSPs                                     Q15 */
    const Word16 lsp_old_PCh_fx[],   /* i  : primary channel old LSPs                                     Q15 */
    const Word16 lsf_old_PCh_fx[],   /* i  : primary channel old LSFs                             Qlog2(2.56) */
    const Word16 lsf_old_PCh_fx[],   /* i  : primary channel old LSFs                             Qlog2(2.56) */
    const Word16 pitch_buf_PCh_fx[], /* i  : primary channel pitch buffer                                  Q6 */
    const Word16 pitch_buf_PCh_fx[], /* i  : primary channel pitch buffer                                  Q6 */
#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
    Word16 tdm_lspQ_PCh_fx[], /* o  : Q LSPs for primary channel                                   Q15 */
    Word16 tdm_lspQ_PCh_fx[], /* o  : Q LSPs for primary channel                                   Q15 */
#endif
    Word16 tdm_lsfQ_PCh_fx[],         /* o  : Q LSFs for primary channel                           Qlog2(2.56) */
    Word16 tdm_lsfQ_PCh_fx[],         /* o  : Q LSFs for primary channel                           Qlog2(2.56) */
    Word16 tdm_Pri_pitch_buf_fx[],    /* o  : pitch values for primary channel                              Q6 */
    Word16 tdm_Pri_pitch_buf_fx[],    /* o  : pitch values for primary channel                              Q6 */
    const Word16 flag_ACELP16k,       /* i  : ACELP@16kHz flag                                                 Q0*/
    const Word16 flag_ACELP16k,       /* i  : ACELP@16kHz flag                                                 Q0*/
@@ -562,24 +568,65 @@ void td_stereo_param_updt_fx(
)
)
{
{
    Word16 i;
    Word16 i;

    /* Copy some primary channel information into the secondary channel structure for later usage */
    /* Copy some primary channel information into the secondary channel structure for later usage */
    IF( EQ_16( tdm_use_IAWB_Ave_lpc, 1 ) )
    IF( EQ_16( tdm_use_IAWB_Ave_lpc, 1 ) )
    {
    {
        /*not being assert*/
        /*not being assert*/
        Copy( IAWB_Ave_fx, tdm_lsfQ_PCh_fx, M ); /*Qlog2(2.56)*/
        Copy( IAWB_Ave_fx, tdm_lsfQ_PCh_fx, M ); /*Qlog2(2.56)*/
#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC

#ifdef FIX_1111_TDM_LSP_BUFFER
        IF( tdm_lspQ_PCh_fx != NULL )
        {
            lsf2lsp_fx( tdm_lsfQ_PCh_fx, tdm_lspQ_PCh_fx, M, INT_FS_12k8 );
        }
#else
        lsf2lsp_fx( tdm_lsfQ_PCh_fx, tdm_lspQ_PCh_fx, M, INT_FS_12k8 );
        lsf2lsp_fx( tdm_lsfQ_PCh_fx, tdm_lspQ_PCh_fx, M, INT_FS_12k8 );
#endif
#endif
    }
    }
    ELSE IF( EQ_16( flag_ACELP16k, 1 ) )
    ELSE IF( EQ_16( flag_ACELP16k, 1 ) )
    {
    {
#ifdef FIX_1111_TDM_LSP_BUFFER
#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
        IF( tdm_lspQ_PCh_fx != NULL )
        {
            Copy( lsp_old_PCh_fx, tdm_lspQ_PCh_fx, M ); /*Q15*/
            lsp_convert_poly_fx( tdm_lspQ_PCh_fx, L_FRAME, 0 );
            lsp2lsf_fx( tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, M, INT_FS_12k8 );
        }
        ELSE
        {
#endif
            Word16 lsp_temp[M];
            Copy( lsp_old_PCh_fx, lsp_temp, M ); /*Q15*/
            lsp_convert_poly_fx( lsp_temp, L_FRAME, 0 );
            lsp2lsf_fx( lsp_temp, tdm_lsfQ_PCh_fx, M, INT_FS_12k8 );
#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
        }
#endif
#else
        Copy( lsp_old_PCh_fx, tdm_lspQ_PCh_fx, M ); /*Q15*/
        Copy( lsp_old_PCh_fx, tdm_lspQ_PCh_fx, M ); /*Q15*/
        lsp_convert_poly_fx( tdm_lspQ_PCh_fx, L_FRAME, 0 );
        lsp_convert_poly_fx( tdm_lspQ_PCh_fx, L_FRAME, 0 );
        lsp2lsf_fx( tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, M, INT_FS_12k8 );
        lsp2lsf_fx( tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, M, INT_FS_12k8 );
#endif
    }
    }
    ELSE
    ELSE
    {
#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
#ifdef FIX_1111_TDM_LSP_BUFFER
        IF( tdm_lspQ_PCh_fx != NULL )
        {
        {
            Copy( lsp_old_PCh_fx, tdm_lspQ_PCh_fx, M ); /*Q15*/
            Copy( lsp_old_PCh_fx, tdm_lspQ_PCh_fx, M ); /*Q15*/
        }
#else
        Copy( lsp_old_PCh_fx, tdm_lspQ_PCh_fx, M ); /*Q15*/
#endif
#endif
        Copy( lsf_old_PCh_fx, tdm_lsfQ_PCh_fx, M ); /*Qlog2(2.56)*/
        Copy( lsf_old_PCh_fx, tdm_lsfQ_PCh_fx, M ); /*Qlog2(2.56)*/
    }
    }

    IF( EQ_16( flag_ACELP16k, 1 ) )
    IF( EQ_16( flag_ACELP16k, 1 ) )
    {
    {
        Word16 tmp16;
        Word16 tmp16;
@@ -649,10 +696,7 @@ static void tdm_SCh_LSF_intra_pred_tri_diag_mat_fx(
    v_sub_16( lsf_SCh_fx, lsf_mean_in_fx, lsf_tmp_fx, M );
    v_sub_16( lsf_SCh_fx, lsf_mean_in_fx, lsf_tmp_fx, M );


    lsf_tmp_ptr1_fx = lsf_tmp_fx;      /*x2.56*/
    lsf_tmp_ptr1_fx = lsf_tmp_fx;      /*x2.56*/

    lsf_SCh_ptr_fx = lsf_SCh_fx;       /*x2.56*/
    lsf_SCh_ptr_fx = lsf_SCh_fx;       /*x2.56*/


    lsf_tmp_ptr2_fx = lsf_tmp_ptr1_fx; /*x2.56*/
    lsf_tmp_ptr2_fx = lsf_tmp_ptr1_fx; /*x2.56*/


    *lsf_SCh_ptr_fx = mult_r( *lsf_tmp_ptr1_fx++, *prd_ptr_fx++ ); // Q2.56 + 15 -15
    *lsf_SCh_ptr_fx = mult_r( *lsf_tmp_ptr1_fx++, *prd_ptr_fx++ ); // Q2.56 + 15 -15
+9 −4
Original line number Original line Diff line number Diff line
@@ -102,7 +102,7 @@
#define FIX_WARNING_RENDER_CONFIG                       /* Orange: fix warning on windows build */
#define FIX_WARNING_RENDER_CONFIG                       /* Orange: fix warning on windows build */


#define FIX_1052_EXT_OUTPUT                             /* VA: issue 1052: define EXT decoder output configuration for stereo and MC formats */
#define FIX_1052_EXT_OUTPUT                             /* VA: issue 1052: define EXT decoder output configuration for stereo and MC formats */

#define NONBE_1215_FIX_JBM_MAX_SCALING                  /* FhG: issue 1215: Fix assert hit in a specific VoIP decoder config. Caused by integer overflow in max scaling calculation. */


#define NONBE_FIX_991_PARAMBIN_BINARY_HRTF              /* Nokia: issue #991: fix using of binary file HRTF in ParamBin (to activate when USE_NEW_HRTF_BINARY_FILE_FORMAT and FIX_777_COMBI_RENDER_CONFIG_FILE are on ) */
#define NONBE_FIX_991_PARAMBIN_BINARY_HRTF              /* Nokia: issue #991: fix using of binary file HRTF in ParamBin (to activate when USE_NEW_HRTF_BINARY_FILE_FORMAT and FIX_777_COMBI_RENDER_CONFIG_FILE are on ) */
#define NONBE_FIX_1091_PMC_LOW_SIGNAL_BURSTS            /* FhG: fix for #1091, fix limit calculation for the regularized inverse of Kx to avoid bursts in very low signals */
#define NONBE_FIX_1091_PMC_LOW_SIGNAL_BURSTS            /* FhG: fix for #1091, fix limit calculation for the regularized inverse of Kx to avoid bursts in very low signals */
@@ -113,17 +113,22 @@
#define FIX_1831_REVERB_REGRESSION                      /* Philips: fixes reverb regression issues  */
#define FIX_1831_REVERB_REGRESSION                      /* Philips: fixes reverb regression issues  */
#define FIX_1835_REVERB_ACTIVATION                      /* FhG: Modified reverberation activation logic and corrected factEQ calculation */
#define FIX_1835_REVERB_ACTIVATION                      /* FhG: Modified reverberation activation logic and corrected factEQ calculation */
#define LC3PLUS_LEA_COMPAT_BITRATES_48_6                /* FhG: treat split-rendering 256kbps lc3plus 10ms 0dof bitrate as sentinel value for LEA compatible 48_6 bitrate (124 kbps per channel)  */
#define LC3PLUS_LEA_COMPAT_BITRATES_48_6                /* FhG: treat split-rendering 256kbps lc3plus 10ms 0dof bitrate as sentinel value for LEA compatible 48_6 bitrate (124 kbps per channel)  */
#define NONBE_FIX_SBA_SIGNALING_BITS_B                  /* FhG: issue 1061: option B: signal sba order additionally in OSBA */
#define NONBE_FIX_ISM_XOVER_BR                          /* FhG: issue 1072: select OSBA coding method depending on number of object and bitrate */
#define NONBE_FIX_ISM_XOVER_BR                          /* FhG: issue 1072: select OSBA coding method depending on number of object and bitrate */
#define NONBE_FIX_1028_1DB_TCX_LEVEL_DROP               /* VA: Harmonize the logic setting LP weighting factor between TCX encoder and TCX decoder */
#define FIX_1053_REVERB_RECONFIGURATION                 /* Philips: issue 1053: fix for dynamic switching of acoustic environment */
#define FIX_1053_REVERB_RECONFIGURATION                 /* Philips: issue 1053: fix for dynamic switching of acoustic environment */
#define CONF_DISTATT                                    /* Eri: Make distance attenuation configurable */
#define CONF_DISTATT                                    /* Eri: Make distance attenuation configurable */

#define FIX_1068_ASAN_IN_MC_2_BINAURAL_ROOM_IR          /* issue 1068 : Memory leak in MC to BINAURAL_ROOM decoding with bitrate switching*/
#define FIX_1068_ASAN_IN_MC_2_BINAURAL_ROOM_IR          /* issue 1068 : Memory leak in MC to BINAURAL_ROOM decoding with bitrate switching*/
#define NONBE_FIX_1052_SBA_EXT                          /* Dlb: SBA external output support */
#define NONBE_FIX_1052_SBA_EXT                          /* Dlb: SBA external output support */
#define NONBE_FIX_MC_LFE_LPF                                  /* Dlb: Adding the LFE LPF filter back for MC content. */
#define NONBE_FIX_MC_LFE_LPF                                  /* Dlb: Adding the LFE LPF filter back for MC content. */
#define NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR            /* Nok: issue 1074 fixing number of objects signaling in OMASA low rate */
#define NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR            /* Nok: issue 1074 fixing number of objects signaling in OMASA low rate */
#define FIX_1222_OMASA_DEC_CHANNEL_BUFFERS              /* VA: issue 1222: Reduction of the number of channel buffers in OMASA decoder */
#define FIX_1222_OMASA_DEC_CHANNEL_BUFFERS              /* VA: issue 1222: Reduction of the number of channel buffers in OMASA decoder */
#define NONBE_FIX_1130_DIV_ZERO_LEV_DUR                 /* VA: issue 1130: avoid div by zero in L-D by thresholding R[0] to a min value of 100.0 */
#define FIX_1111_TDM_LSP_BUFFER                         /* VA: issue 1111: remove unused buffer `tdm_lspQ_PCh[]' */
#define NONBE_1325_TD_STEREO_QUANT_LSF_SEC              /* Nokia: issue 1325: fix for usage of active_cnt variable in TD stereo LSFQ */
#define NONBE_1329_FIX_OSBA_CRASH                       /* FhG: issue 1329: prevent assert when bit budget is low*/
#define NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER            /* FhG: issue 1128: set output ambisonics order to input order for EXT output  */
#define FIX_1138_SBA_EXT_ERROR_PRINTOUT                 /* VA: issue 1138: Fix SBA EXT output call of audioCfg2channels() */
#define NONBE_FIX_981_PARAMBIN_DEFAULT_EARLY_PART             /* Nokia: Set default early part energy correction to unity for BINAURAL_ROOM_REVERB */
#define NONBE_FIX_1174_MCMASA_LBR_LOOP_ERROR            /* Nokia: Fix issue 1174 by removing the unnecessary inner loop causing problems. */
#define NONBE_FIX_1052_SBA_EXT_FIX                      /* VA: SBA external output support fix - do not overwrite "output_config" parameter */
#define NONBE_FIX_1052_SBA_EXT_FIX                      /* VA: SBA external output support fix - do not overwrite "output_config" parameter */


/* #################### End BASOP porting switches ############################ */
/* #################### End BASOP porting switches ############################ */
Loading