Commit 27b76eaf 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'

Unified/MDCT stereo switching for 3ISM @96 kbps and 4ISM @128 kbps in OMASA

See merge request !598
parents e65e93ac 57e7b11d
Loading
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -263,6 +263,9 @@ enum{
enum
{
    IND_IVAS_FORMAT,
#ifdef FIX_OMASA_STEREO_SWITCHING
    IND_SMODE_OMASA,
#endif
    IND_SMODE,
    IND_SID_TYPE,
    IND_BWIDTH,
+8 −1
Original line number Diff line number Diff line
@@ -1221,10 +1221,17 @@ enum
#define MASA_STEREO_MIN_BITRATE                 IVAS_24k4
#ifdef MASA_AND_OBJECTS
#define MAXIMUM_OMASA_FREQ_BANDS                8                           /* Corresponds to maximum number of coding bands at 32 kbps */

#ifdef FIX_OMASA_STEREO_SWITCHING
#define OMASA_STEREO_SW_CNT_MAX                 100
#define OMASA_STEREO_SW_CNT_MAX2                5
#endif

#endif

#define MASA_BIT_REDUCT_PARAM                   10
#define MASA_MAXIMUM_TWO_DIR_BANDS              18

typedef enum
{
    MASA_STEREO_NOT_DEFINED,
+3 −0
Original line number Diff line number Diff line
@@ -837,6 +837,9 @@ ivas_error ivas_ism_metadata_enc(
    const int16_t ism_extended_metadata_flag                    /* i  : Extended metadata flag                      */
#ifdef MASA_AND_OBJECTS
   ,const float lp_noise_CPE                                    /* i  : LP filterend total noise estimation         */
#ifdef FIX_OMASA_STEREO_SWITCHING
   ,int16_t *omasa_stereo_sw_cnt
#endif
#endif
);

+2 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@

#ifdef DEBUGGING

/*#define DEBUG_MODE_INFO*/                     /* output most important parameters to the subdirectory "res/" */
#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_TCX*/                      /* output most important TCX core parameters to the subdirectory "res/" */
@@ -179,6 +179,7 @@
#define MASA_AND_OBJECTS                                /* Nokia: Combination of MASA and objects */
#ifdef MASA_AND_OBJECTS
#define MASAISM_EDIT_OBJECTS                            /* Nokia: Temporary command line editing of object directions in the decoder */
#define FIX_OMASA_STEREO_SWITCHING  // VA: introduce  Unified/MDCT stereo switching for 3ISM @96 kbps and 4ISM @128 kbps 
#endif


+40 −0
Original line number Diff line number Diff line
@@ -79,6 +79,9 @@ ivas_error ivas_cpe_dec(
    ivas_error error;
#ifdef MASA_AND_OBJECTS
    int32_t cpe_brate;
#ifdef FIX_OMASA_STEREO_SWITCHING
    int32_t element_brate_ref;
#endif
#endif
    error = IVAS_ERR_OK;

@@ -95,10 +98,40 @@ ivas_error ivas_cpe_dec(
    sts[0]->BER_detect |= st_ivas->BER_detect;
    sts[1]->BER_detect |= st_ivas->BER_detect;

#ifdef FIX_OMASA_STEREO_SWITCHING
    element_brate_ref = hCPE->element_brate;
#endif

    /*------------------------------------------------------------------*
     * Read stereo technology info & audio bandwidth
     *-----------------------------------------------------------------*/

#ifdef FIX_OMASA_STEREO_SWITCHING
    if ( st_ivas->ivas_format == MASA_ISM_FORMAT )
    {
        if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC &&
             ( ( st_ivas->nchan_ism == 3 && ivas_total_brate == IVAS_96k ) ||
               ( st_ivas->nchan_ism == 4 && ivas_total_brate == IVAS_128k ) ) )
        {
            /* read OMASA stereo mode signalling */
            if ( get_next_indice( sts[0], NBITS_ELEMENT_MODE ) )
            {
                hCPE->element_mode = IVAS_CPE_MDCT;
            }
            else
            {
                hCPE->element_mode = IVAS_CPE_DFT;
            }

            if ( hCPE->element_mode == IVAS_CPE_MDCT )
            {
                hCPE->element_brate = IVAS_64k;
                hCPE->brate_surplus -= ( hCPE->element_brate - element_brate_ref );
            }
        }
    }
#endif

    read_stereo_mode_and_bwidth( hCPE, st_ivas );

    /*----------------------------------------------------------------*
@@ -551,6 +584,13 @@ ivas_error ivas_cpe_dec(
    hCPE->last_element_brate = hCPE->element_brate;
    hCPE->last_element_mode = hCPE->element_mode;

#ifdef FIX_OMASA_STEREO_SWITCHING
    if ( st_ivas->ivas_format == MASA_ISM_FORMAT )
    {
        hCPE->element_brate = element_brate_ref;
    }
#endif

    if ( hCPE->element_mode == IVAS_CPE_DFT || hCPE->element_mode == IVAS_CPE_TD )
    {
        stereo_cng_dec_update( hCPE, ivas_total_brate );
Loading