Commit d9037ac9 authored by vaclav's avatar vaclav
Browse files

updates within OMASA_TUNING_TD_STEREO

parent fce075b3
Loading
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -1826,14 +1826,15 @@ void stereo_tdm_prep_dwnmx (
    const float *input1,                                        /* i  : right channel input                     */       
    const int16_t input_frame                                   /* i  : frame lenght                            */           
);

int16_t stereo_tdm_ener_analysis(
#ifdef OMASA_TUNING_TD_STEREO
    const int16_t ivas_format,                                  /* i  : IVAS format                             */
#endif
    CPE_ENC_HANDLE hCPE,                                        /* i  : CPE structure                           */
    const int16_t input_frame,                                  /* i  : Number of samples                       */
    int16_t *tdm_SM_or_LRTD_Pri,                                /* o  : channel combination scheme flag in TD stereo OR LRTD primary channel */
    int16_t *tdm_ratio_idx_SM                                   /* o  : TDM ratio index for SM mode             */
#ifdef OMASA_TUNING_TD_STEREO
   ,const int16_t isOmasa                                       /* i  : flag that indicates OMASA format        */
#endif
);

void stereo_tdm_downmix(
@@ -1852,13 +1853,12 @@ void stereo_td_init_dec(
);

void tdm_configure_dec(
#ifdef OMASA_TUNING_TD_STEREO
    const int16_t ivas_format,                                  /* i  : IVAS format                             */
#endif
    CPE_DEC_HANDLE hCPE,                                        /* i/o: CPE decoder structure                   */
    int16_t *tdm_ratio_idx,                                     /* o  : ratio index                             */
    const int16_t nb_bits_metadata                              /* i  : number of metadata bits                 */
#ifdef OMASA_TUNING_TD_STEREO
   ,const int16_t IsOmasa                                       /* i  : flag that indicates OMASA format        */
#endif

);

void tdm_upmix_plain(
@@ -1905,6 +1905,9 @@ void tdm_ol_pitch_comparison(
);

void tdm_configure_enc(
#ifdef OMASA_TUNING_TD_STEREO
    const int16_t ivas_format,                                  /* i  : IVAS format                             */
#endif
    CPE_ENC_HANDLE hCPE,                                        /* i  : CPE encoder structure                   */
    const float Etot_last[CPE_CHANNELS],                        /* i/o: Energy of last frame                    */
    const int16_t tdm_SM_or_LRTD_Pri,                           /* i  : channel combination scheme flag in TD stereo OR LRTD primary channel */
@@ -1912,9 +1915,6 @@ void tdm_configure_enc(
    const int16_t tdm_ratio_idx_SM,                             /* i  : ratio index in SM mode                  */
    const int16_t attack_flag,                                  /* i  : Primary channel attack flag             */
    const int16_t nb_bits_metadata                              /* i  : number of metadata bits                 */
#ifdef OMASA_TUNING_TD_STEREO
   ,const int16_t IsOmasa                                       /* i  : flag that indicates OMASA format        */
#endif
);

ivas_error signaling_enc_secondary(
@@ -1924,6 +1924,9 @@ ivas_error signaling_enc_secondary(
);

void tdm_bit_alloc(
#ifdef OMASA_TUNING_TD_STEREO
    const int16_t ivas_format,                                  /* i  : IVAS format                             */
#endif
    const int32_t element_brate_wo_meta,                        /* i  : element bitrate without metadata        */
    const int16_t tdm_lp_reuse_flag,                            /* i  : LPC reusage flag                        */
    int32_t *total_brate_pri,                                   /* o  : Allocated primary channel bitrate       */
@@ -1938,9 +1941,6 @@ void tdm_bit_alloc(
    const int16_t tdm_LRTD_flag,                                /* i  : LRTD stereo mode flag                   */
    const int16_t coder_type0,                                  /* i  : coder type (temporary in the encoder, from bitstream in decoder) */
    const int16_t tdm_inst_ratio_idx                            /* i  : instantaneous correlation ratio index   */
#ifdef OMASA_TUNING_TD_STEREO
   ,const int16_t IsOmasa                                      /* i  : flag that indicates OMASA format         */
#endif
);

void td_stereo_param_updt(
+4 −5
Original line number Diff line number Diff line
@@ -74,6 +74,9 @@
 *-------------------------------------------------------------------*/

void tdm_bit_alloc(
#ifdef OMASA_TUNING_TD_STEREO
    const int16_t ivas_format, /* i  : IVAS format                         */
#endif
    const int32_t element_brate_wo_meta, /* i  : element bitrate without metadata    */
    const int16_t tdm_lp_reuse_flag,     /* i  : LPC reusage flag                    */
    int32_t *total_brate_pri,            /* o  : Allocated primary channel bitrate   */
@@ -88,10 +91,6 @@ void tdm_bit_alloc(
    const int16_t tdm_LRTD_flag,         /* i  : LRTD stereo mode flag               */
    const int16_t coder_type0,           /* i  : coder type (temporary in the encoder, from bitstream in decoder) */
    const int16_t tdm_inst_ratio_idx_ref /* i  : instantaneous correlation ratio idx */
#ifdef OMASA_TUNING_TD_STEREO
    ,
    const int16_t IsOmasa /* i  : flag that indicates OMASA format    */
#endif
)
{
    int16_t idx, four_subfr_fcb, two_subfr_fcb;
@@ -141,7 +140,7 @@ void tdm_bit_alloc(

    /* secondary channel bitrate allocation based on the energy scaling ratio */
#ifdef OMASA_TUNING_TD_STEREO
    if ( ( IsOmasa == 0 && ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) ) || ( IsOmasa == 1 && coder_type > UNVOICED ) )
    if ( ( ivas_format != MASA_ISM_FORMAT && ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) ) || ( ivas_format == MASA_ISM_FORMAT && coder_type > UNVOICED ) )
#else
    if ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 )
#endif
+3 −4
Original line number Diff line number Diff line
@@ -413,12 +413,11 @@ ivas_error ivas_cpe_dec(
    {
        if ( !st_ivas->bfi )
        {
            tdm_configure_dec( hCPE, &tdm_ratio_idx, nb_bits_metadata
            tdm_configure_dec(
#ifdef OMASA_TUNING_TD_STEREO
                               ,
                               ( st_ivas->ivas_format == MASA_ISM_FORMAT || ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate == IVAS_24k4 ) )
                st_ivas->ivas_format,
#endif
            );
                hCPE, &tdm_ratio_idx, nb_bits_metadata );

            sts[1]->bit_stream = sts[0]->bit_stream + ( sts[0]->total_brate / FRAMES_PER_SEC );
        }
+10 −12
Original line number Diff line number Diff line
@@ -84,14 +84,12 @@ void stereo_td_init_dec(
 *-------------------------------------------------------------------*/

void tdm_configure_dec(
#ifdef OMASA_TUNING_TD_STEREO
    const int16_t ivas_format, /* i  : IVAS format                     */
#endif
    CPE_DEC_HANDLE hCPE,           /* i/o: CPE decoder structure           */
    int16_t *tdm_ratio_idx,        /* o  : ratio index                     */
    const int16_t nb_bits_metadata /* i  : number of metadata bits         */
#ifdef OMASA_TUNING_TD_STEREO
    ,
    const int16_t IsOmasa /* i  : flag that indicates OMASA format*/
#endif

)
{
    STEREO_TD_DEC_DATA_HANDLE hStereoTD;
@@ -310,15 +308,15 @@ void tdm_configure_dec(
     *----------------------------------------------------------------*/

#ifdef MASA_AND_OBJECTS
    tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus,
                   hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ),
                   &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag,
                   sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, tdm_inst_ratio_idx
    tdm_bit_alloc(
#ifdef OMASA_TUNING_TD_STEREO
                   ,
                   IsOmasa
        ivas_format,
#endif
    );

        hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus,
        hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ),
        &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag,
        sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, tdm_inst_ratio_idx );
#else
    tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag, sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, tdm_inst_ratio_idx );
#endif
+6 −8
Original line number Diff line number Diff line
@@ -435,12 +435,11 @@ ivas_error ivas_cpe_enc(
    else if ( hCPE->element_mode == IVAS_CPE_TD )
    {
        /* Determine the energy ratio between the 2 channels */
        tdm_ratio_idx = stereo_tdm_ener_analysis( hCPE, input_frame, &tdm_SM_or_LRTD_Pri, &tdm_ratio_idx_SM
        tdm_ratio_idx = stereo_tdm_ener_analysis(
#ifdef OMASA_TUNING_TD_STEREO
                                                  ,
                                                  st_ivas->hOMasa != NULL
            ivas_format,
#endif
        );
            hCPE, input_frame, &tdm_SM_or_LRTD_Pri, &tdm_ratio_idx_SM );

        /* Compute the downmix signal based on the ratio index */
        stereo_tdm_downmix( hCPE->hStereoTD, sts[0]->input, sts[1]->input, input_frame, tdm_ratio_idx, ( ( hCPE->hStereoTD->tdm_LRTD_flag == 0 ) ? tdm_SM_or_LRTD_Pri : 0 ), tdm_ratio_idx_SM );
@@ -606,12 +605,11 @@ ivas_error ivas_cpe_enc(
    {
        tdm_ol_pitch_comparison( hCPE, pitch_fr, voicing_fr );

        tdm_configure_enc( hCPE, Etot_last, tdm_SM_or_LRTD_Pri, tdm_ratio_idx, tdm_ratio_idx_SM, attack_flag[0], nb_bits_metadata
        tdm_configure_enc(
#ifdef OMASA_TUNING_TD_STEREO
                           ,
                           st_ivas->hOMasa != NULL
            ivas_format,
#endif
        );
            hCPE, Etot_last, tdm_SM_or_LRTD_Pri, tdm_ratio_idx, tdm_ratio_idx_SM, attack_flag[0], nb_bits_metadata );

        if ( hEncoderConfig->Opt_DTX_ON )
        {
Loading