Commit 22de430a authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Merge branch 'va/contribution-omasa-combined-format-fixes' into...

Merge branch 'va/contribution-omasa-combined-format-fixes' into 'nokia/contribution-omasa-combined-format'

fixes_OMASA_branch

See merge request !578
parents f15d1763 b2357112
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
+4 −4
Original line number Diff line number Diff line
@@ -60,11 +60,11 @@

/*#define DEBUG_MODE_INFO*/                     /* output most important parameters to the subdirectory "res/" */
#ifdef DEBUG_MODE_INFO
#define DEBUG_MODE_ACELP                    /* output most important ACELP core parameters to the subdirectory "res/" */
/*#define DEBUG_MODE_ACELP*/                    /* output most important ACELP core parameters to the subdirectory "res/" */
/*#define DEBUG_MODE_TCX*/                      /* output most important TCX core parameters to the subdirectory "res/" */
/*#define DEBUG_MODE_DFT */                     /* output most important DFT stereo parameters to the subdirectory "res/" */
#define DEBUG_MODE_TD                       /* output most important TD stereo parameters to the subdirectory "res/ */
//#define DEBUG_MODE_DIRAC                   /* output most important DIRAC parameters to the subdirectory "res/" */
/*#define DEBUG_MODE_TD*/                       /* output most important TD stereo parameters to the subdirectory "res/ */
/*#define DEBUG_MODE_DIRAC*/                    /* output most important DIRAC parameters to the subdirectory "res/" */
/*#define DEBUG_MODE_MDCT*/                     /* output most important MDCT parameters to the subdirectory "res/" */
/*#define DEBUG_MODE_PARAM_MC */                /* output Parametric MC paramters to the subdirectory "res/" */
/*#define DEBUG_MODE_PARAM_ISM*/                /* output Parametric ISM paramters to the subdirectory "res/" */
+5 −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 );
        }
@@ -597,12 +596,14 @@ ivas_error ivas_cpe_dec(
                dbgwrite( output[j], sizeof( float ), output_frame, 1, fname( debug_dir, "output.cpe", j, cpe_id, DEC ) );
            }

#ifdef MASA_AND_OBJECTS
            if ( st_ivas->ivas_format != MASA_ISM_FORMAT )
            {
                tmpF = 0;
                dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "output.sce", 0, cpe_id, DEC ) );
                dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "output.mct", 0, cpe_id, DEC ) );
            }
#endif
        }
    }
#endif
+1 −0
Original line number Diff line number Diff line
@@ -1526,6 +1526,7 @@ void ivas_dirac_dec_compute_directional_responses(
    num_channels_dir = hDirAC->num_outputs_dir;
    azimuth = hDirAC->azimuth[hDirAC->dirac_read_idx];
    elevation = hDirAC->elevation[hDirAC->dirac_read_idx];

#ifdef MASA_AND_OBJECTS
    if ( hDirAC->numParametricDirections == 2 )
#else
Loading