Commit 2b74dee8 authored by TYAGIRIS's avatar TYAGIRIS
Browse files

SBA bitrate switching changes with re-init function

parent 34c6b03f
Loading
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -106,7 +106,17 @@ ivas_error mct_enc_reconfigure(
    Encoder_Struct *st_ivas,                                    /* i/o: IVAS encoder structure                  */
    const uint16_t b_nchan_change                               /* i  : flag indicating different channel count */
);

#ifdef SBA_BR_SWITCHING
ivas_error ivas_sba_enc_reinit(
    Encoder_Struct *st_ivas /* i/o: IVAS encoder structure      */
);
#endif
#ifdef SBA_BR_SWITCHING
int16_t get_sba_reinit_flag(
    int32_t ivas_total_bitrate,                                /* i: current bitrate                  */
    int32_t last_ivas_total_brate                              /* i: previous bitrate                  */
);
#endif
ivas_error ivas_sba_enc_reconfigure( 
    Encoder_Struct *st_ivas                                     /* i/o: IVAS encoder structure                  */
);
@@ -3053,7 +3063,11 @@ void ivas_sba_config(
    int16_t *nCPE,                                              /* o  : number of CPEs                          */
    int16_t *element_mode                                       /* o  : element mode of the core coder          */
);

#ifdef SBA_BR_SWITCHING
ivas_error ivas_sba_dec_reinit(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                  */
);
#endif
ivas_error ivas_sba_dec_reconfigure(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                  */
);
+20 −2
Original line number Diff line number Diff line
@@ -71,8 +71,26 @@ SBA_MODE ivas_sba_mode_select(

    return sba_mode;
}


#ifdef SBA_BR_SWITCHING
/*-------------------------------------------------------------------*
 * get_sba_reinit_flag()
 *
 * Get SBA reinitialisation flag
 *-------------------------------------------------------------------*/
int16_t get_sba_reinit_flag(
    int32_t ivas_total_bitrate,   /* i  : Current bitrate  */
    int32_t last_ivas_total_brate /* i  : Previous bitrate  */
)
{
    int16_t sba_reinit_flag;
    sba_reinit_flag = 0;
    if ( ivas_total_bitrate != last_ivas_total_brate && ( last_ivas_total_brate > IVAS_SID_5k2 ) && ( ivas_total_bitrate > IVAS_SID_5k2 ) )
    {
        sba_reinit_flag = 1;
    }
    return sba_reinit_flag;
}
#endif
/*-------------------------------------------------------------------*
 * ivas_sba_config()
 *
+1 −1
Original line number Diff line number Diff line
@@ -152,7 +152,7 @@
#define FIX_155_HP20_ISSUE                              /* Issue 155: apply hp20 on all input channels instead of just 2 channels */
#define EFAP_FIX_POLY                                   /* Issue 167: fix bug in EFAP polygon selection */
#define SBA_HOA_HBR_IMPROV                              /* issue 91: Improvements to SBA high bitrate HOA3 coding */

#define SBA_BR_SWITCHING                                /* Issue 114: Changes for sba bit rate switching*/

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
+4 −1
Original line number Diff line number Diff line
@@ -93,8 +93,11 @@ typedef INT64 int64_t;

/* This is the maximum number of allocations for which to keep information.
   It can be increased if required. */
#ifdef SBA_BR_SWITCHING
#define MAX_INFO_RECORDS 3200
#else
#define MAX_INFO_RECORDS 3000

#endif
/* This is the length after which the function name
   will be truncated when the summary is printed. */
#define MAX_FUNCTION_NAME_LENGTH 18
+16 −3
Original line number Diff line number Diff line
@@ -69,7 +69,6 @@ ivas_error ivas_dec_setup(
    Decoder_State *st;
    int32_t ivas_total_brate;
    ivas_error error;

    error = IVAS_ERR_OK;

    num_bits_read = 0;
@@ -128,10 +127,24 @@ ivas_error ivas_dec_setup(
            num_bits_read += SBA_ORDER_BITS;
            if ( st_ivas->ini_frame > 0 && ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate && ivas_total_brate > IVAS_SID_5k2 )
            {
#ifdef SBA_BR_SWITCHING
                if ( get_sba_reinit_flag( ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate ) )
                {
                    if ( ( error = ivas_sba_dec_reinit( st_ivas ) ) != IVAS_ERR_OK )
                    {
                        return error;
                    }
                }
                else
                {
#endif
                    if ( ( error = ivas_sba_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK )
                    {
                        return error;
                    }
#ifdef SBA_BR_SWITCHING
                }
#endif
            }
            else
            {
Loading