Commit 95990ff4 authored by premathasara's avatar premathasara
Browse files

Decouple IVAS_AGC_ENC enum and rename AGC flag function

- Decouple IVAS_AGC_ENC enum within the submodules of the codec
- Rename AGC flag function to be a bit smaller. This function will likely be moved and renamed when the future of AGC is more certain
parent c768234d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -132,6 +132,9 @@ enum{

#define MAX_V_MULT_MAT                  100             /* maximum array length for the function v_mult_mat() */

#define SBA_AGC_FORCE_ENABLE            1
#define SBA_AGC_FORCE_DISABLE           0
#define SBA_AGC_DEFAULT                 -1

/*----------------------------------------------------------------------------------*
 * Layers
+3 −0
Original line number Diff line number Diff line
@@ -86,6 +86,9 @@ typedef enum
    IVAS_ERR_FILE_READER_TIMESTAMP_MISMATCH,
    IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT,
    IVAS_ERR_INVALID_MASA_FORMAT_METADATA_FILE,
#ifdef DEBUG_AGC_ENCODER_CMD_OPTION
    IVAS_ERR_INVALID_AGC,
#endif

    /*----------------------------------------*
     *            input data errors           *
+2 −7
Original line number Diff line number Diff line
@@ -44,11 +44,6 @@
#include "ivas_stat_dec.h"
#include "ivas_stat_com.h"
#include "ivas_error_utils.h"
#ifdef AGC_ENABLE_FOR_LBR
#ifdef DEBUG_AGC_ENCODER_CMD_OPTION
#include "lib_enc.h"
#endif /* DEBUG_AGC_ENCODER_CMD_OPTION */
#endif /* AGC_ENABLE_FOR_LBR */

/* clang-format off */

@@ -3759,9 +3754,9 @@ void ivas_sba_prototype_renderer(

/* AGC */
#ifdef AGC_ENABLE_FOR_LBR
int16_t ivas_agc_enc_get_enablement_flag(
int16_t ivas_agc_enc_get_flag(
#ifdef DEBUG_AGC_ENCODER_CMD_OPTION
    IVAS_ENC_AGC agc_configuration,                             /* i  : configuration used when encoder was initialised from cmd line */
    int16_t agc_configuration,                             /* i  : configuration used when encoder was initialised from cmd line */
#endif
    int16_t nchan_transport                                     /* i  : number of transport channels                                  */
);
+5 −5
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ static int16_t ivas_agc_writeBits( FILE *stream, const int16_t n_channels, ivas_
#ifdef AGC_ENABLE_FOR_LBR
#ifdef DEBUG_AGC_ENCODER_CMD_OPTION
/*-----------------------------------------------------------------------------------------*
 * Function ivas_agc_enc_get_enablement_flag()
 * Function ivas_agc_enc_get_flag()
 *
 * This function determines if AGC should be enabled or disabled.
 * If agc_configuration is not undefined, then this value decides on the state of
@@ -71,7 +71,7 @@ static int16_t ivas_agc_writeBits( FILE *stream, const int16_t n_channels, ivas_
 *-----------------------------------------------------------------------------------------*/
#else
/*-----------------------------------------------------------------------------------------*
 * Function ivas_agc_enc_get_enablement_flag()
 * Function ivas_agc_enc_get_flag()
 *
 * This function determines if AGC should be enabled or disabled.
 * AGC is enabled only if there is one transport channel.
@@ -79,14 +79,14 @@ static int16_t ivas_agc_writeBits( FILE *stream, const int16_t n_channels, ivas_
 *-----------------------------------------------------------------------------------------*/
#endif

int16_t ivas_agc_enc_get_enablement_flag(
int16_t ivas_agc_enc_get_flag(
#ifdef DEBUG_AGC_ENCODER_CMD_OPTION
    IVAS_ENC_AGC agc_configuration,
    int16_t agc_configuration,
#endif
    int16_t nchan_transport )
{
#ifdef DEBUG_AGC_ENCODER_CMD_OPTION
    return (int16_t) ( ( agc_configuration == IVAS_ENC_AGC_UNDEFINED )
    return (int16_t) ( ( agc_configuration == SBA_AGC_DEFAULT )
                           ? ( nchan_transport == 1 )
                           : agc_configuration );
#else
+2 −2
Original line number Diff line number Diff line
@@ -122,9 +122,9 @@ ivas_error ivas_spar_enc_open(
    /* AGC handle */
#ifdef AGC_ENABLE_FOR_LBR
#ifdef DEBUG_AGC_ENCODER_CMD_OPTION
    hSpar->AGC_Enable = ivas_agc_enc_get_enablement_flag( hEncoderConfig->Opt_AGC_ON, nchan_transport );
    hSpar->AGC_Enable = ivas_agc_enc_get_flag( hEncoderConfig->Opt_AGC_ON, nchan_transport );
#else
    hSpar->AGC_Enable = ivas_agc_enc_get_enablement_flag( nchan_transport );
    hSpar->AGC_Enable = ivas_agc_enc_get_flag( nchan_transport );
#endif
#endif
    if ( ( error = ivas_spar_agc_enc_open( &hSpar->hAgcEnc, input_Fs, nchan_inp ) ) != IVAS_ERR_OK )
Loading