Commit 6aa2465e authored by vaclav's avatar vaclav
Browse files

Merge branch '116-Bitrate-Switching-in-MC' of...

Merge branch '116-Bitrate-Switching-in-MC' of https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec into 116-Bitrate-Switching-in-MC
parents 9efdc663 472db4b9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -291,6 +291,7 @@
    <ClCompile Include="..\lib_dec\ivas_limiter.c" />
    <ClCompile Include="..\lib_dec\ivas_ls_custom_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_masa_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_mcmasa_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_mct_core_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_mct_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_mct_dec_mct.c" />
+3 −0
Original line number Diff line number Diff line
@@ -584,6 +584,9 @@
    <ClCompile Include="..\lib_dec\ivas_corecoder_dec_reconfig.c">
      <Filter>dec_ivas_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_dec\ivas_mcmasa_dec.c">
      <Filter>dec_ivas_c</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="..\lib_dec\jbm_jb4_inputbuffer.h">
+37 −0
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ void ivas_mcmasa_set_separate_channel_mode(
    return;
}

#ifndef MCMASA_BITRATE_SWITCHING
/*--------------------------------------------------------------------------*
 * ivas_mcmasa_mono_brate()
 *
@@ -112,3 +113,39 @@ int32_t ivas_mcmasa_mono_brate(
        return ( const int32_t )( MCMASA_MONOBITRATIO * ivas_total_brate );
    }
}
#else
/*--------------------------------------------------------------------------*
 * ivas_mcmasa_split_brate()
 *
 * Split the total bitrate to elements in McMASA
 *--------------------------------------------------------------------------*/
void ivas_mcmasa_split_brate(
    const uint8_t separateChannelEnabled, /* i  : Transport running in "separate channel" mode      */
    const int32_t ivas_total_brate,       /* i  : Total bitrate available to be split               */
    const int16_t nSCE,                   /* i  : Number of SCEs in use (0 or 1)                    */
    const int16_t nCPE,                   /* i  : Number of CPEs in use (0 or 1)                    */
    int32_t *brate_sce,                   /* o  : Pointer to SCE element bitrate                    */
    int32_t *brate_cpe                    /* o  : Pointer to CPE element bitrate                    */
)
{
    if ( separateChannelEnabled )
    {
        /* 25% of total bitrate is used for SCE below 96 kb/s (separated mono channel), otherwise 30% */
        if ( ivas_total_brate < IVAS_96k )
        {
            *brate_sce = (int32_t) ( MCMASA_MONOBITRATIO_64k * ivas_total_brate );
        }
        else
        {
            *brate_sce = (int32_t) ( MCMASA_MONOBITRATIO * ivas_total_brate );
        }

        *brate_cpe = ivas_total_brate - *brate_sce;
    }
    else
    {
        *brate_sce = nSCE > 0 ? ivas_total_brate / ( nCPE + nSCE ) : 0;
        *brate_cpe = nCPE > 0 ? ivas_total_brate / ( nCPE + nSCE ) : 0;
    }
}
#endif
+48 −0
Original line number Diff line number Diff line
@@ -128,7 +128,14 @@ ivas_error ivas_corecoder_enc_reconfig(
    Encoder_Struct *st_ivas,                                    /* i/o: IVAS encoder structure                  */
    const int16_t nSCE_old,                                     /* i  : number of SCEs in previous frame        */
    const int16_t nCPE_old,                                     /* i  : number of CPEs in previous frame        */
#ifdef MCMASA_BITRATE_SWITCHING
    const int16_t nchan_transport_old,                          /* i  : number of TCs in previous frame         */
    const int32_t brate_SCE,                                    /* i  : bitrate to be set for the SCEs          */
    const int32_t brate_CPE,                                    /* i  : bitrate to be set for the CPEs          */
    const MC_MODE last_mc_mode                                  /* i  : switching between MC modes: last mode   */
#else
    const int16_t nchan_transport_old                           /* i  : number of TCs in previous frame         */
#endif
);
#endif

@@ -333,11 +340,22 @@ void ivas_mct_dec_close(

#ifdef CORECODER_BITRATE_SWITCHING
ivas_error ivas_corecoder_dec_reconfig(
#ifdef MCMASA_BITRATE_SWITCHING
    Decoder_Struct *st_ivas,                 /* i/o: IVAS decoder structure                                    */
    const int16_t nSCE_old,                  /* i  : number of SCEs in previous frame                          */
    int16_t nCPE_old,                        /* i  : number of CPEs in previous frame                          */
    const int16_t nchan_transport_old,       /* i  : number of TCs in previous frame                           */
    const int16_t sba_dirac_stereo_flag_old, /* i  : signal stereo rendering using DFT upmix in previous frame */
    const int32_t brate_SCE,                 /* i  : bitrate to be set for the SCEs                            */
    const int32_t brate_CPE,                 /* i  : bitrate to be set for the CPEs                            */
    const MC_MODE last_mc_mode               /* i  : MC mode in the previous frame                             */
#else
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    const int16_t nSCE_old,                                     /* i  : number of SCEs in previous frame        */
    const int16_t nCPE_old,                                     /* i  : number of CPEs in previous frame        */
    const int16_t nchan_transport_old,                          /* i  : number of TCs in previous frame         */
    const int16_t sba_dirac_stereo_flag_old                     /* i  : signal stereo output for SBA DirAC in previous frame */
#endif
);

ivas_error ivas_hp20_dec_reconfig(
@@ -4769,6 +4787,16 @@ void ivas_mcmasa_enc_close(
    const int32_t input_Fs                                      /* i  : input sampling rate                             */
);

#ifdef MCMASA_BITRATE_SWITCHING
ivas_error ivas_mcmasa_enc_reconfig(
    Encoder_Struct *st_ivas                                     /* i/o: IVAS encoder handle                              */
);

ivas_error ivas_mcmasa_dec_reconfig(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder handle                              */
);
#endif

void ivas_mcmasa_setNumTransportChannels(
    int16_t* nchan_transport,                                   /* o  : Pointer to number of transport channels to be set */
    int16_t* element_mode,                                      /* o  : Pointer to element mode to be set                 */
@@ -4781,10 +4809,21 @@ void ivas_mcmasa_set_separate_channel_mode(
    const int32_t ivas_total_brate                              /* i  : Total bitrate of IVAS                             */
);

#ifndef MCMASA_BITRATE_SWITCHING
/*! r: McMASA SCE bitrate */
int32_t ivas_mcmasa_mono_brate(
    const int32_t ivas_total_brate                              /* i  : IVAS total bitrate                                */
);
#else
void ivas_mcmasa_split_brate(
    const uint8_t separateChannelEnabled,                       /* i  : Transport running in "separate channel" mode      */
    const int32_t ivas_total_brate,                             /* i  : Total bitrate available to be split               */
    const int16_t nSCE,                                         /* i  : Number of SCEs in use (0 or 1)                    */
    const int16_t nCPE,                                         /* i  : Number of CPEs in use (0 or 1)                    */
    int32_t *brate_sce,                                         /* o  : Pointer to SCE element bitrate                    */
    int32_t *brate_cpe                                          /* o  : Pointer to CPE element bitrate                    */
);
#endif

void ivas_mcmasa_enc(
    MCMASA_ENC_HANDLE hMcMasa,                                  /* i/o: Encoder McMASA handle                             */
@@ -4809,6 +4848,15 @@ void ivas_mcmasa_param_est_enc(
    const int16_t nchan_inp                                     /* i  : Number of input channels                          */
);

#ifdef MCMASA_BITRATE_SWITCHING
void ivas_mcmasa_dmx_modify(
    const int16_t n_samples,                                        /* i  : input frame length in samples                        */
    float dmx[][L_FRAME48k + NS2SA( 48000, IVAS_FB_ENC_DELAY_NS )], /* i/o: downmix signal to be transformed into another format */
    const uint8_t n_chnls_dmx_old,                                  /* i  : number of downmix channels in the old format         */
    const uint8_t n_chnls_dmx_new                                   /* i  : number of downmix channels in the target format      */
);
#endif

void v_multc_acc(
    const float x[],                                            /* i  : Input vector                                     */
    const float c,                                              /* i  : Constant                                         */
+4 −2
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@

#ifdef DEBUGGING

#define MEM_COUNT_DETAILS                       /* RAM counting tool: print per sub-structure details */
/*#define MEM_COUNT_DETAILS*/                   /* RAM counting tool: print per sub-structure details */

/*#define DEBUG_MODE_INFO*/                     /* output most important parameters to the subdirectory "res/" */
#ifdef DEBUG_MODE_INFO
@@ -159,7 +159,9 @@

#define CORECODER_BITRATE_SWITCHING                     /* Issue 133: support bitrate switching in core-coder */
#define MC_BITRATE_SWITCHING                            /* Issue 116: support bitrate switching in MC format  */

#ifdef MC_BITRATE_SWITCHING
#define MCMASA_BITRATE_SWITCHING                        /* Issue 116: support bitrate switching in MC format: sub-part of McMASA modes */
#endif

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
Loading